Example #1
0
 function getProfiletypeFieldHTML($name, $value, $control_name = 'params', $reqnone = false, $reqall = false)
 {
     require_once JPATH_ROOT . '/components/com_xipt/libraries/profiletypes.php';
     $required = '1';
     $html = '';
     $class = $required == 1 ? ' required' : '';
     $options = XiPTLibraryProfiletypes::getProfiletypeArray();
     $html .= '<select id="' . $control_name . '[' . $name . ']" name="' . $control_name . '[' . $name . ']" title="' . "Select Account Type" . '::' . "Please Select your account type" . '">';
     if ($reqall) {
         $selected = JString::trim(0) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . 0 . '"' . $selected . '>' . JText::_("ALL") . '</option>';
     }
     if ($reqnone) {
         $selected = JString::trim(-1) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . -1 . '"' . $selected . '>' . JText::_("NONE") . '</option>';
     }
     for ($i = 0; $i < count($options); $i++) {
         $option = $options[$i]->name;
         $id = $options[$i]->id;
         $selected = JString::trim($id) == $value ? ' selected="true"' : '';
         $html .= '<option value="' . $id . '"' . $selected . '>' . $option . '</option>';
     }
     $html .= '</select>';
     $html .= '<span id="errprofiletypemsg" style="display: none;">&nbsp;</span>';
     return $html;
 }
 function getPT($options = array(), $level = 0)
 {
     $pts = XiPTLibraryProfiletypes::getProfiletypeArray();
     foreach ($pts as $option) {
         $val = $option->id;
         $text = $option->name;
         $options[] = JHTML::_('select.option', $val, $text);
         //                      $options = $this->getPT ($cat['id'], $options, $level + 1);
     }
     return $options;
 }