コード例 #1
0
ファイル: plugin.php プロジェクト: kaantunc/MYK-BOR
 /**
  * create a select dropdown
  *
  * @param $name string field name
  * @param $selected string/array field value(s)
  * @param $attributes array additional input attributes
  * @param $id string
  * @param $translate boolean apply JText?
  * @param $addTD boolean wrap the result in <td> tags if true
  * @param $styleTD string valid css style string e.g. 'font-weight:bold;' to td
  */
 function createSelect($name, $options, $selected = '', $attributes = array(), $id = false, $translate = false, $addTD = true, $attribTD = array())
 {
     $id = ChronoContactHelperPlugin::createId($name, $id);
     if (!is_array($selected)) {
         $selected = explode(', ', $selected);
     }
     // if the selection is empty add a null option to the beginning of the options list
     if (!empty($selected)) {
         $null_option = array('null' => JHTML::_('select.option', JText::_('--?--')));
         $options = array_merge($null_option, $options);
     }
     $return = JHTML::_('select.genericlist', $options, $name, JArrayHelper::toString($attributes), 'value', 'text', $selected, $id, $translate);
     if ($addTD) {
         $return = ChronoContactHelperPlugin::wrapTD($return, $attribTD);
     }
     return $return;
 }