Xanthia_Templating_Environment
[ class tree: Xanthia_Templating_Environment ] [ index: Xanthia_Templating_Environment ] [ all elements ]

Source for file function.dbtypes.php

Documentation is available at function.dbtypes.php

  1. <?php
  2. /**
  3.  * pnRender plugin
  4.  *
  5.  * This file is a plugin for pnRender, the Zikula implementation of Smarty
  6.  *
  7.  * @package      Xanthia_Templating_Environment
  8.  * @subpackage   pnRender
  9.  * @version      $Id: function.dbtypes.php 24342 2008-06-06 12:03:14Z markwest $
  10.  * @author       The Zikula development team
  11.  * @link         http://www.zikula.org  The Zikula Home Page
  12.  * @copyright    Copyright (C) 2002 by the Zikula Development Team
  13.  * @license      http://www.gnu.org/copyleft/gpl.html GNU General Public License
  14.  */
  15.  
  16.  
  17. /**
  18.  * Smarty function to display a drop down list of database engines
  19.  *
  20.  * Available parameters:
  21.  *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
  22.  *   - name:     Name for the control
  23.  *   - selected: Selected value
  24.  *
  25.  * Example
  26.  *   <!--[dbtypes name=dbtype selectedValue=value]-->
  27.  *
  28.  *
  29.  * @author       Mark West
  30.  * @since        17 March 2006
  31.  * @param        array       $params      All attributes passed to this function from the template
  32.  * @param        object      &$smarty     Reference to the Smarty object
  33.  * @return       string      the value of the last status message posted, or void if no status message exists
  34.  */
  35. function smarty_function_dbtypes($params&$smarty)
  36. {
  37.     if (!isset($params['name'])) {
  38.         $smarty->trigger_error("dbtypes: parameter 'name' required");
  39.         return false;
  40.     }
  41.     if (!isset($params['id'])) {
  42.         $params['id'$params['name'];
  43.     }
  44.  
  45.     $name DataUtil::formatForDisplay($params['name']);
  46.     $id DataUtil::formatForDisplay($params['id']);
  47.     $sv   = isset($params['selectedValue']$params['selectedValue''mysql';
  48.  
  49.     $dbtypesdropdown "<select name=\"$name\" id=\"$id\" onchange=\"dbtype_onchange()\">\n";
  50.     if (function_exists('mysql_connect')) {
  51.         $sel $sv=='mysql' 'selected' '';
  52.         $dbtypesdropdown .= "<option value=\"mysql\" $sel>DataUtil::formatForDisplay(_INSTALLERDBTYPEMYSQL"</option>\n";
  53.     }
  54.     if (function_exists('mysqli_connect')) {
  55.         $sel $sv=='mysqli' 'selected' '';
  56.         $dbtypesdropdown .= "<option value=\"mysqli\" $sel>DataUtil::formatForDisplay(_INSTALLERDBTYPEMYSQLI"</option>\n";
  57.     }
  58.     if (function_exists('mssql_connect')) {
  59.         $sel $sv=='mssql' 'selected' '';
  60.         $dbtypesdropdown .= "<option value=\"mssql\" $sel>DataUtil::formatForDisplay(_INSTALLERDBTYPEMSSQL"</option>\n";
  61.     }
  62.     if (function_exists('OCIPLogon')) {
  63.         $sel $sv=='oci8' 'selected' '';
  64.         $dbtypesdropdown .= "<option value=\"oci8\" $sel>DataUtil::formatForDisplay(_INSTALLERDBTYPEOCI"</option>\n";
  65.         $sel $sv=='oracle' 'selected' '';
  66.         $dbtypesdropdown .= "<option value=\"oracle\" $sel>DataUtil::formatForDisplay(_INSTALLERDBTYPEORACLE"</option>\n";
  67.     }
  68.     if (function_exists('pg_connect')) {
  69.         $sel $sv=='postgres' 'selected' '';
  70.         $dbtypesdropdown .= "<option value=\"postgres\" $sel>DataUtil::formatForDisplay(_INSTALLERDBTYPEPOSTGRES"</option>\n";
  71.     }
  72.     $dbtypesdropdown .= "</select>\n";
  73.  
  74.     if (isset($params['assign'])) {
  75.         $smarty->assign($params['assign']$dbtypesdropdown);
  76.     else {
  77.         return $dbtypesdropdown;
  78.     }
  79. }

Documentation generated on Fri, 18 Jul 2008 21:45:14 +0200 by phpDocumentor 1.4.1