Example #1
0
 /**
  * Method to get the user group field input markup.
  *
  * @return  string  The field input markup.
  */
 protected function getInput()
 {
     // Initialize variables.
     $options = array();
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Iterate through the children and build an array of options.
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $tmp = Dropdown::option((string) $option['value'], trim((string) $option), 'value', 'text', (string) $option['disabled'] == 'true');
         // Set some option attributes.
         $tmp->class = (string) $option['class'];
         // Set some JavaScript option attributes.
         $tmp->onclick = (string) $option['onclick'];
         // Add the option object to the result set.
         $options[] = $tmp;
     }
     return Access::usergroup($this->name, $this->value, $attr, $options, $this->id);
 }
Example #2
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  */
 protected function getInput()
 {
     // Initialize variables.
     $attr = '';
     // Initialize some field attributes.
     $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
     $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
     $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
     $attr .= $this->multiple ? ' multiple="multiple"' : '';
     // Initialize JavaScript field attributes.
     $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
     // Get the field options.
     $options = $this->getOptions();
     return Access::level($this->name, $this->value, $attr, $options, $this->id);
 }
Example #3
0
 /**
  * Fetch a calendar element
  *
  * @param   string  $name          Element name
  * @param   string  $value         Element value
  * @param   object  &$node         XMLElement node object containing the settings for the element
  * @param   string  $control_name  Control name
  * @return  string
  */
 public function fetchElement($name, $value, &$node, $control_name)
 {
     $ctrl = $control_name . '[' . $name . ']';
     $attribs = ' ';
     if ($v = $node['size']) {
         $attribs .= 'size="' . (string) $v . '"';
     }
     if ($v = $node['class']) {
         $attribs .= 'class="' . (string) $v . '"';
     } else {
         $attribs .= 'class="inputbox"';
     }
     if ($m = $node['multiple']) {
         $attribs .= 'multiple="multiple"';
         $ctrl .= '[]';
     }
     return Access::usergroup($ctrl, $value, $attribs, false);
 }
Example #4
0
 /**
  * Display a list of all categories
  *
  * @return  void
  */
 public function displayTask()
 {
     // Get filters
     $this->view->filters = array('sort' => Request::getState($this->_option . '.' . $this->_controller . '.sort', 'filter_order', 'title'), 'sort_Dir' => Request::getState($this->_option . '.' . $this->_controller . '.sortdir', 'filter_order_Dir', 'ASC'), 'limit' => Request::getState($this->_option . '.' . $this->_controller . '.limit', 'limit', Config::get('list_limit'), 'int'), 'start' => Request::getState($this->_option . '.' . $this->_controller . '.limitstart', 'limitstart', 0, 'int'));
     //print_r($this->view->filters);
     $obj = new Archive();
     // Get record count
     $this->view->total = $obj->products('count', $this->view->filters);
     // Get records
     $this->view->rows = $obj->products('list', $this->view->filters);
     // For all records here get SKUs
     $skus = new \stdClass();
     $warehouse = new Warehouse();
     foreach ($this->view->rows as $r) {
         $key = $r->pId;
         $allSkus = $warehouse->getProductSkus($r->pId, 'all', false);
         // Count how many active and how many inactive SKUs there are
         $skuCounter = new \stdClass();
         $skuCounter->active = 0;
         $skuCounter->inactive = 0;
         foreach ($allSkus as $skuInfo) {
             if ($skuInfo->sActive) {
                 $skuCounter->active++;
             } else {
                 $skuCounter->inactive++;
             }
         }
         $skus->{$key} = $skuCounter;
     }
     //print_r($skus); die;
     $this->view->skus = $skus;
     // access groups
     //$ag = JHTML::_('access.assetgroups');
     $ag = Access::assetgroups();
     $accessGroups = array();
     $accessGroups[0] = 'All';
     foreach ($ag as $obj) {
         $accessGroups[$obj->value] = $obj->text;
     }
     $this->view->ag = $accessGroups;
     // Output the HTML
     //print_r($this->view); die;
     $this->view->display();
 }
Example #5
0
 /**
  * Display a batch widget for the access level selector.
  *
  * @return  string  The necessary HTML for the widget.
  */
 public static function access()
 {
     // Create the batch selector to change an access level on a selection list.
     $lines = array('<label id="batch-access-lbl" for="batch-access" class="hasTip" title="' . Lang::txt('JLIB_HTML_BATCH_ACCESS_LABEL') . '::' . Lang::txt('JLIB_HTML_BATCH_ACCESS_LABEL_DESC') . '">', Lang::txt('JLIB_HTML_BATCH_ACCESS_LABEL'), '</label>', Access::assetgrouplist('batch[assetgroup_id]', '', 'class="inputbox"', array('title' => Lang::txt('JLIB_HTML_BATCH_NOCHANGE'), 'id' => 'batch-access')));
     return implode("\n", $lines);
 }