/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $html = array(); $options = array(); $selectedId = (int) $this->form->getValue('customer_group_id'); $options = SolidresHelper::getCustomerGroupOptions(); $html[] = JHtml::_('select.genericlist', $options, $this->name, null, 'value', 'text', $selectedId); return implode($html); }
public function display($tpl = null) { $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); $this->customerGroups = SRFactory::getUserHelper()->getUserGroups(); $doc = JFactory::getDocument(); $this->customerGroupOptions = SolidresHelper::getCustomerGroupOptions(); JText::script('SUN'); JText::script('MON'); JText::script('TUE'); JText::script('WED'); JText::script('THU'); JText::script('FRI'); JText::script('SAT'); $params = JComponentHelper::getParams('com_solidres'); $this->currency_id = $params->get('default_currency_id'); SRHtml::_('jquery.datepicker'); JHtml::stylesheet('com_solidres/assets/main.css', false, true, false); $rowidx = isset($this->item->tariff) ? count($this->item->tariff) : 0; $rowIdRoom = isset($this->item->rooms) ? count($this->item->rooms) : 0; $customerGroupsJS = ''; $i = 0; foreach ($this->customerGroups as $group) { $customerGroupsJS[$i]['id'] = $group->id === NULL ? '' : $group->id; $customerGroupsJS[$i]['title'] = $group->name; $i++; } JText::script('SR_FIELD_ROOM_CAN_NOT_DELETE_ROOM'); $doc->addScriptDeclaration("\n srUg = " . json_encode($customerGroupsJS) . ";\n\t\t\tSolidres.jQuery(function(\$) {\n\t\t\t \$('#toolbar').srRoomType({rowidx : {$rowidx}, rowIdRoom: {$rowIdRoom}, srUg: srUg});\n\t\t\t});\n\t\t"); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); }