Пример #1
0
 function display($tpl = null)
 {
     $task = JRequest::getCmd('task', NULL);
     $cmd = JRequest::getCmd('cmd', NULL);
     switch ($task) {
         case 'group':
             $groups = JFormFieldSelectGroup::getGroups($cmd);
             $output = '';
             foreach ($groups as $group) {
                 $output .= '<option value="' . $group->value . '">' . $group->text . '</option>';
             }
             $data = $output;
             break;
         case 'company':
             $groups = JFormFieldSelectGroup::getCompany($cmd);
             $output = '';
             $select = 1;
             foreach ($groups as $group) {
                 if ($cmd && $group->value && $select) {
                     $output .= '<option value="' . $group->value . '" selected>' . $group->text . '</option>';
                     $select = 0;
                 } else {
                     $output .= '<option value="' . $group->value . '">' . $group->text . '</option>';
                 }
             }
             $data = $output;
             break;
         default:
             break;
     }
     $document =& JFactory::getDocument();
     $document->setMimeEncoding('application/json');
     echo json_encode($data);
     return false;
 }
Пример #2
0
 static function getDriver($group)
 {
     $options = parent::getDriver($group);
     if (sizeof($options) > 1) {
         $options[0] = JHtml::_('select.option', 0, 'All Drivers');
     }
     return $options;
 }
Пример #3
0
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
?>
<div id="group_controls">
<?php 
include JPATH_COMPONENT . DS . 'models' . DS . 'vehicle_group_controls.php';
?>
</div>

<br />
<br />

<select name="driver" id="driver">
<?php 
require_once JPATH_COMPONENT . DS . 'models' . DS . 'fields' . DS . 'selectgroup.php';
$ctrl = new JFormFieldSelectGroup();
foreach ($ctrl->getDriver() as $option) {
    $selected = '';
    if ($option->value == $this->driver) {
        $selected = ' selected';
    }
    echo '<option value="' . $option->value . '"' . $selected . '>' . $option->text . '</option>';
}
?>
</select>
    <input type="hidden" name="option" value="com_fleetmatrix" />
    <input type="hidden" id="task" name="task" value="assign.submit" />
    <button type="submit" id="submit" class="button"><?php 
echo JText::_('Submit');
?>
</button>
Пример #4
0
 public function getOptions()
 {
     # The options available are based on what type was selected
     $options = array();
     return array_merge(parent::getOptions(), JFormFieldSelectGroup::getGroups());
 }
Пример #5
0
 static function getGroups($type)
 {
     $options = parent::getGroups();
     $options[0] = JHtml::_('select.option', 0, 'All Groups');
     return $options;
 }
Пример #6
0
<?php

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
?>
<div id="assignment_controls">
<div id="group_controls" class="fieldsbg">
<?php 
include JPATH_COMPONENT . DS . 'models' . DS . 'vehicle_group_controls.php';
?>
    
<select name="driver" id="driver">
<?php 
require_once JPATH_COMPONENT . DS . 'models' . DS . 'fields' . DS . 'selectgroup.php';
$ctrl = new JFormFieldSelectGroup();
$group = JRequest::getInt('group', 0);
if (!$group) {
    echo '<option value="0">Select Company and Group</option>';
} else {
    foreach ($ctrl->getDriver($group) as $option) {
        $selected = '';
        if ($option->value == $this->driver) {
            $selected = ' selected';
        }
        echo '<option value="' . $option->value . '"' . $selected . '>' . $option->text . '</option>';
    }
}
?>
</select>

    <input type="hidden" name="option" value="com_fleetmatrix" />