function td_getOrderStatusSelect($select, $id) { OrderStatus::init(); return JHtmlSelect::genericlist(OrderStatus::$map, $id, 'class="td_orderstatus input-small"', 'value', 'text', $select); }
function getParentBox($select) { $options = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('a.id as value, a.title as text, a.level'); $query->from('#__bookpro_dest AS a'); $query->join('LEFT', $db->quoteName('#__bookpro_dest') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); $query->where('a.state IN (0,1)'); $query->group('a.id, a.title, a.level, a.lft, a.rgt, a.parent_id'); $query->order('a.lft ASC'); // Get the options. $db->setQuery($query); $options = $db->loadObjectList(); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } // Pad the option text with spaces using depth level as a multiplier. for ($i = 0, $n = count($options); $i < $n; $i++) { // Translate ROOT if ($options[$i]->level == 0) { $options[$i]->text = JText::_('JGLOBAL_ROOT_PARENT'); } $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text; } array_unshift($options, JHtml::_('select.option', 1, JText::_('JGLOBAL_ROOT'))); return JHtmlSelect::genericlist($options, 'parent_id', '', 'value', 'text', $select); }
/** * combobox với một danh mục đơn giản * @param string $table * @param string $field * @param string $where * @param string $order * @param string $text * @param string $code * @param string $name * @param string $selected * @param string $idname * @param string $class * @param string $attrArray */ public function getCbo($table, $field, $where = null, $order, $text, $code, $name, $selected = null, $idname = null, $class = null, $attrArray = null) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array($field))->from($table); if ($where != null || $where != "") { $query->where($where); } $query->order($order); $db->setQuery($query); $tmp = $db->loadObjectList(); $data = array(); array_push($data, array('value', 'text' => $text)); for ($i = 0; $i < count($tmp); $i++) { $attr = array(); if (isset($attrArray) && is_array($attrArray)) { foreach ($attrArray as $k => $v) { $attr += array($k => $tmp[$i]->{$v}); } } if (!isset($attr) && !is_array($attr)) { array_push($data, array('value' => $tmp[$i]->{$code}, 'text' => $tmp[$i]->{$name})); } else { array_push($data, array('value' => $tmp[$i]->{$code}, 'text' => $tmp[$i]->{$name}, 'attr' => $attr)); } } $options = array('id' => $idname, 'list.attr' => array('class' => $class), 'option.key' => 'value', 'option.text' => 'text', 'option.attr' => 'attr', 'list.select' => $selected); return $result = JHtmlSelect::genericlist($data, $idname, $options); }
/** * Method to get the radio button field input markup. * * @return string The field input markup. * * @since 1.0.1 */ public function getInput() { // Initialize variables. $html = array(); $attr = ''; // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; // To avoid user's confusion, readonly="true" should imply disabled="true". if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') { $attr .= ' 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'] . '"' : ''; $attr .= $this->element['ondblclick'] ? ' ondblclick="' . (string) $this->element['ondblclick'] . '"' : ''; // Get the field options. $options = (array) $this->getOptions(); // Create a read-only list (no name) with a hidden input to store the value. if ((string) $this->element['readonly'] == 'true') { $html[] = JHtmlSelect::genericlist($options, '', trim($attr), 'value', 'text', $this->value, $this->id); $html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"/>'; } else { $html[] = JHtmlSelect::genericlist($options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); } return implode($html); }
function _displayModal($tpl) { JToolBarHelper::title(JText::_('COM_JOOMLEAGUE_ADMIN_PERSON_ASSIGN_DESCR')); // Do not allow cache JResponse::allowCache(false); $document = JFactory::getDocument(); $prjid = array(); $prjid = JRequest::getVar('prjid', array(0), 'post', 'array'); $proj_id = (int) $prjid[0]; //build the html select list for projects $projects[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_PROJECT'), 'id', 'name'); if ($res = JoomleagueHelper::getProjects()) { $projects = array_merge($projects, $res); } $lists['projects'] = JHtmlSelect::genericlist($projects, 'prjid[]', 'class="inputbox" onChange="this.form.submit();" style="width:170px"', 'id', 'name', $proj_id); unset($projects); $projectteams[] = JHtmlSelect::option('0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_TEAM'), 'value', 'text'); // if a project is active we show the teams select list if ($proj_id > 0) { if ($res = JoomleagueHelper::getProjectteams($proj_id)) { $projectteams = array_merge($projectteams, $res); } $lists['projectteams'] = JHtmlSelect::genericlist($projectteams, 'xtid[]', 'class="inputbox" style="width:170px"', 'value', 'text'); unset($projectteams); } $this->lists = $lists; $this->project_id = $proj_id; parent::display($tpl); }
protected function getTourList() { $tours = $this->tours; foreach ($tours as $tour) { $tour->title .= ' - ' . $tour->code; } return JHtmlSelect::genericlist($tours, 'filter_tour_id', '', 'id', 'title', $this->state->get('filter.tour_id')); }
public function display($tpl = null) { $app = JFactory::getApplication(); $jinput = $app->input; $option = $jinput->getCmd('option'); $app = JFactory::getApplication(); $uri = JFactory::getURI(); $user = JFactory::getUser(); $model = $this->getModel(); $lists = array(); //get template data $template = $this->get('data'); $isNew = $template->id < 1; // fail if checked out not by 'me' if ($model->isCheckedOut($user->get('id'))) { $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('COM_JOOMLEAGUE_ADMIN_TEMPLATE_THETEMPLATE'), $template->name); $app->redirect('index.php?option=' . $option, $msg); } $projectws = $this->get('Data', 'project'); $templatepath = JPATH_COMPONENT_SITE . '/settings'; $xmlfile = $templatepath . '/default/' . $template->template . '.xml'; $extensions = JoomleagueHelper::getExtensions(JRequest::getInt('p')); foreach ($extensions as $e => $extension) { $extensiontpath = JPATH_COMPONENT_SITE . '/extensions/' . $extension; if (is_dir($extensiontpath . '/settings/default')) { if (file_exists($extensiontpath . '/settings/default/' . $template->template . '.xml')) { $xmlfile = $extensiontpath . '/settings/default/' . $template->template . '.xml'; } } } $form = JForm::getInstance($template->template, $xmlfile, array('control' => 'params')); $form->bind($template->params); $master_id = $projectws->master_template ? $projectws->master_template : '-1'; $templates = array(); //$templates[]=JHtml::_('select.option','0',JText::_('COM_JOOMLEAGUE_ADMIN_TEMPLATE_OTHER_TEMPLATE' ),'value','text'); if ($res = $model->getAllTemplatesList($projectws->id, $master_id)) { $templates = array_merge($templates, $res); } $lists['templates'] = JHtmlSelect::genericlist($templates, 'select_id', 'class="inputbox" size="1" onchange="javascript: Joomla.submitbutton(\'template.apply\');"', 'value', 'text', $template->id); unset($res); unset($templates); $this->request_url = $uri->toString(); $this->template = $template; $this->form = $form; $this->project = $projectws; $this->lists = $lists; $this->user = $user; $this->addToolbar(); parent::display($tpl); }
public function getCboLoaitaisan($select = null) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array('id', 'tenloaitaisan'))->from($db->quoteName('kkts_taisan'))->where('status=1 and parent_id = 0'); $query->order('orders'); $db->setQuery($query); $arrChuyennganh = $db->loadObjectList(); $data = array(); array_push($data, array('value' => "0", 'text' => "--Chọn tài sản cha--")); for ($i = 0; $i < sizeof($arrChuyennganh); $i++) { array_push($data, array('value' => $arrChuyennganh[$i]->id, 'text' => $arrChuyennganh[$i]->tenloaitaisan)); } $options = array('id' => 'parent_id', 'option.key' => 'value', 'option.text' => 'text', 'option.attr' => 'attr', 'list.select' => $select); return $result = JHtmlSelect::genericlist($data, 'parent_id', $options); }
function getZoneList() { $app = JFactory::getApplication(); $post = $app->input->getArray($_POST); if ($post['country_id']) { $model = F0FModel::getTmpInstance('Zones', 'J2storeModel'); $model->setState('country_id', $post['country_id']); $zones = $model->getList(true); } $model->clearState(); $options = array(); if (!empty($zones)) { foreach ($zones as $zone) { $options[] = JHtml::_('select.option', $zone->j2store_zone_id, $zone->zone_name); } } $default = $post['zone_id']; echo JHtmlSelect::genericlist($options, $post['field_name'], '', 'value', 'text', $default, $post['field_id']); $app->close(); }
/** * Lấy thông tin Cán bộ theo donvi_id, đưa vào <select>, tự động selected option ứng với $select * @param int $donvi_id donvi_id * @param int $select id để selected * @return string */ public function getCanboById($donvi_id, $select = null) { // lấy danh sách cán bộ tại đơn vị theo inst_code -> từ tree, select = option đã chọn $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('hosochinh_id as id, hoten as e_name')->from('hosochinh_quatrinhhientai ht')->where('( ' . $db->quoteName('ht.congtac_donvi_id') . '=' . $db->quote($donvi_id) . ' OR ' . $db->quoteName('ht.congtac_phong_id') . '=' . $db->quote($donvi_id) . ')')->where('ht.hoso_trangthai= "00"'); $donviloaitru = Core::getUnManageDonvi(JFactory::getUser()->id, 'com_hoso', 'treeview', 'treequyhoach'); if ($donviloaitru != '') { $query->where('ht.congtac_donvi_id NOT IN (' . $donviloaitru . ') and ht.congtac_phong_id NOT IN (' . $donviloaitru . ')'); } $db->setQuery($query); $arrCanbo = $db->loadObjectList(); $data = array(); array_push($data, array('value' => "", 'text' => "--Chọn CBCC--")); for ($i = 0; $i < sizeof($arrCanbo); $i++) { array_push($data, array('value' => $arrCanbo[$i]->id, 'text' => $arrCanbo[$i]->e_name)); } $options = array('id' => 'emp_id', 'option.key' => 'value', 'option.text' => 'text', 'option.attr' => 'attr', 'list.select' => $select); return $result = JHtmlSelect::genericlist($data, 'emp_id', $options); }
public static function getProductOptionValues($option_id, $default, $product_optionvalue_id) { //load option values for this option id from the general and pass the default value to it. $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('ov.optionvalue_id,ov.optionvalue_name'); $query->from('#__k2store_optionvalues AS ov'); $query->where('ov.option_id=' . $option_id); $query->order('ov.ordering ASC'); $db->setQuery($query); $rows = $db->loadObjectList(); $list = array(); if (count($rows)) { foreach ($rows as $row) { $options[] = JHtmlSelect::option($row->optionvalue_id, $row->optionvalue_name); } $name = "optionvalue_id[{$product_optionvalue_id}]"; $attribs = array('class' => 'inputbox', 'size' => '1', 'title' => JText::_('K2STORE_SELECT_AN_OPTION')); $list = JHtmlSelect::genericlist($options, $name, $attribs, 'value', 'text', $default, 'optionvalue_id'); } return $list; }
public static function releaseStates(array $attribs = array()) { //-- aka autoload :P JHtml::_('select.option', 'foo'); $attribs = array_merge(array('name' => 'releaseState', 'id' => 'releaseState', 'selected' => 'release'), $attribs); //$name = isset($attribs['name']) ? $attribs['name'] $options = array(); $states = array('release', 'development'); foreach ($states as $state) { $options[] = JHtmlSelect::option($state, ucfirst($state)); } return JHtmlSelect::genericlist($options, $attribs['name'], $attribs, 'value', 'text', $attribs['selected'], $attribs['id']); }
function view() { $app = JFactory::getApplication(); require_once JPATH_ADMINISTRATOR . '/components/com_j2store/library/select.php'; J2StoreToolBar::_custom('save', 'save', 'save', 'JTOOLBAR_SAVE', false, 'shippingTask'); J2StoreToolBar::_custom('cancel', 'cancel', 'cancel', 'JTOOLBAR_CLOSE', false, 'shippingTask'); JToolBarHelper::title(JText::_('J2STORE_SHIPM_SHIPPING_METHODS'), 'j2store-logo'); $id = $app->input->getInt('id', '0'); $sid = $app->input->getInt('sid', '0'); $this->includeCustomModel('ShippingMethods'); $this->includeCustomTables(); $model = JModelLegacy::getInstance('ShippingMethods', 'J2StoreModel'); $model->setId((int) $sid); $item = $model->getItem(); if (!isset($item)) { $item = JTable::getInstance('ShippingMethods', 'Table'); } $data = array(); $data['published'] = JHTML::_('select.booleanlist', 'published', 'class=""', $item->published); $data['taxclass'] = J2StoreSelect::taxclass($item->tax_class_id, 'tax_class_id'); $data['shippingtype'] = J2StoreSelect::shippingtype($item->shipping_method_type, 'shipping_method_type', '', 'shipping_method_type', false); $options = array(); $options[] = JHtml::_('select.option', 'no', JText::_('JNO')); $options[] = JHtml::_('select.option', 'store', JText::_('J2STORE_SHIPPING_STORE_ADDRESS')); $data['address_override'] = JHtmlSelect::genericlist($options, 'address_override', array(), 'value', 'text', $item->address_override); // Form $form = array(); $form['action'] = $this->baseLink(); $form['shippingTask'] = 'save'; //We are calling a view from the ShippingMethods we isn't actually the same controller this has, however since all it does is extend the base view it is // all good, and we don't need to remake getView() $view = $this->getView('ShippingMethods', 'html'); $view->hidemenu = true; $view->hidestats = true; //$view->setTask(true); $view->setModel($model, true); $view->assign('item', $item); $view->assign('data', $data); $view->assign('form2', $form); $view->setLayout('view'); $view->display(); }
static function getDurationBox($selected, $name = 'days') { $options = array(); $options[] = JHtmlSelect::option('', JText::_('COM_BOOKPRO_SELECT_DURATION')); $options[] = JHtmlSelect::option(1, JText::_('COM_BOOKPRO_TOUR_DAYTRIP')); for ($i = 2; $i < 40; $i++) { $options[] = JHtmlSelect::option($i, JText::sprintf('COM_BOOKPRO_DAYS_TXT', $i)); } return JHtmlSelect::genericlist($options, $name, 'class="input"', 'value', 'text', $selected); }
protected function getSelectField($level, $type) { if (!in_array($type, array('add', 'remove'))) { return ''; } // Put groups in select field $groups = $this->getGroups(); $options = array(); $options[] = JHTML::_('select.option', '', JText::_('PLG_AKEEBASUBS_' . strtoupper($this->name) . '_NONE')); foreach ($groups as $title => $id) { $options[] = JHTML::_('select.option', $id, $title); } // Set pre-selected values $selected = array(); if ($type == 'add') { if (!empty($this->addGroups[$level->akeebasubs_level_id])) { $selected = $this->addGroups[$level->akeebasubs_level_id]; } } else { if (!empty($this->removeGroups[$level->akeebasubs_level_id])) { $selected = $this->removeGroups[$level->akeebasubs_level_id]; } } // Create the select field return JHtmlSelect::genericlist($options, 'params[' . strtolower($this->name) . '_' . $type . 'groups][]', 'multiple="multiple" size="8" class="input-large"', 'value', 'text', $selected); }
static function getHtmlList($name, $attribute, $select, $id = null) { self::init(); return JHtmlSelect::genericlist(self::$map, $name, $attribute, 'value', 'text', $select, $id); }
public static function getLuggageBox($selected, $n = 59, $start = 0, $name = 'transport_luggage') { $options = array(); for ($i = $start; $i <= $n; $i++) { $otext = $i; $options[] = JHtmlSelect::option($i, $otext); } return JHtmlSelect::genericlist($options, $name, 'class="input-mini"', 'value', 'text', $selected); }
self::$videoHelpInit = true; } $unique_id = uniqid('chkbox_'); $output .= ' <div class="fld clearfix videojs_fld"> <h4 ' . ($option->description ? 'class="hasTip" title="' . $option->label . '::' . $option->description . '"' : '') . '>' . $option->label . '</h4> <input name="' . $name . '[' . $option->name . '][enabled][]" class="en_stat" type="hidden" value="' . ($values[$option->name]['enabled'] == 'enabled' ? 'enabled' : '') . '" /> <label class="iostoggle ' . ($values[$option->name]['enabled'] == 'enabled' ? 'video-enabled' : '') . '"></label> <div class="clearfix"></div> <div class="video_options"> <div class="inner-vo"> <p>The image above these settings is becoming the poster image.</p>'; // Video Type $vt_data = array(array('value' => 'self_hosted', 'text' => 'Self Hosted'), array('value' => 'youtube', 'text' => 'YouTube Video'), array('value' => 'vimeo', 'text' => 'Vimeo Video')); $vt_options = array('option.key' => 'value', 'option.text' => 'text', 'list.select' => isset($values[$option->name]['video_type']) ? $values[$option->name]['video_type'] : 'youtube'); $videotypelist = JHtmlSelect::genericlist($vt_data, $name . '[' . $option->name . '][video_type][]', $vt_options); $output .= ' <div class="field-row clearfix"> <div class="label">Video Type:</div> ' . $videotypelist . ' </div>'; // Source $output .= ' <div class="field-row clearfix"> <div class="label">Source ID <a href="#" class="open-videohelp">[ How to add source?! ]</a></div> <input type="text" name="' . $name . '[' . $option->name . '][sourceid][]' . '" value="' . ($values[$option->name]['sourceid'] ? $values[$option->name]['sourceid'] : '') . '" class="input-xlarge" /> </div>'; // Loop $output .= ' <div class="field-row clearfix">
/** * Lấy thông tin Cán bộ theo donvi_id, đưa vào <select>, tự động selected option ứng với $select * @param int $donvi_id donvi_id * @param int $select id để selected * @return string */ public function getCanboById($donvi_id, $select = null) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array('a.id, a.e_name'))->from($db->quoteName('hosochinh', 'a'))->join('inner', $db->quoteName('hosochinh_quatrinhhientai', 'b') . ' ON (' . $db->quoteName('b.hosochinh_id') . ' = ' . $db->quoteName('a.id') . ') '); $query->where('( ' . $db->quoteName('b.congtac_donvi_id') . '=' . $db->quote($donvi_id) . ' OR ' . $db->quoteName('b.congtac_phong_id') . '=' . $db->quote($donvi_id) . ')'); $query->where('b.hoso_trangthai = "00" '); $donviloaitru = Core::getUnManageDonvi(JFactory::getUser()->id, 'com_nhucaudaotao', 'treeview', 'treenhucautonghop'); if ($donviloaitru != '') { $query->where('b.congtac_donvi_id NOT IN (' . $donviloaitru . ') and b.congtac_phong_id NOT IN (' . $donviloaitru . ')'); } $db->setQuery($query); $arrCanbo = $db->loadObjectList(); $data = array(); array_push($data, array('value' => "", 'text' => "--Chọn CBCC--")); for ($i = 0; $i < sizeof($arrCanbo); $i++) { array_push($data, array('value' => $arrCanbo[$i]->id, 'text' => $arrCanbo[$i]->e_name)); } $options = array('id' => 'empid', 'list.attr' => array('class' => 'chosen required'), 'option.key' => 'value', 'option.text' => 'text', 'option.attr' => 'attr', 'list.select' => $select); return $result = JHtmlSelect::genericlist($data, 'empid', $options); }
" > <span class="variationlabel_percent"><?php echo $completestay->PercentVariation; ?> </span>% <?php echo JTEXT::_('MOD_BOOKINGFORSEARCHFILTER_OFFERS'); ?> <i class="fa fa-angle-down" aria-hidden="true"></i> </div> </div> </div> </td> <td> <?php echo JHtmlSelect::genericlist($extraopts, 'extras' . $selPrice->PriceId, array('list.select' => $selectedExtra, 'option.key' => 'Id', 'option.text' => 'Name', 'option.attr' => 'attr', 'list.attr' => array('onchange' => 'quoteCalculatorServiceChanged(this);', 'class' => 'input-mini extrasselect', 'data-resource' => $res->ResourceId, 'data-resourcename' => $res->Name, 'data-brand' => $res->MerchantName))); ?> </td> <?php if ($countPrices == 0) { ?> <td style="width:1%;white-space: nowrap;" class="totalextrasstay<?php echo $res->ResourceId; ?> "> <!-- prezzo--> <div class="com_bookingforconnector_merchantdetails-resource-stay com_bookingforconnector_resource-quote"> <div class="com_bookingforconnector_resource-quote-desc"> <div class="com_bookingforconnector_merchantdetails-resource-stay-price fullquote" style="text-align:center;"> <span class="com_bookingforconnector_resourcelist_strikethrough <?php
function _displayEditlist($tpl) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $project_id = $mainframe->getUserState($option . 'project'); $node_id = $mainframe->getUserState($option . 'node_id'); $uri = JFactory::getURI(); $treetomatchs = $this->get('Data'); $total = $this->get('Total'); $model = $this->getModel(); $projectws = $this->get('Data', 'project'); $nodews = $this->get('Data', 'node'); //build the html select list for node assigned matches $ress = array(); $res1 = array(); $notusedmatches = array(); if ($ress = $model->getNodeMatches($node_id)) { $matcheslist = array(); foreach ($ress as $res) { if (empty($res1->info)) { $node_matcheslist[] = JHtmlSelect::option($res->value, $res->text); } else { $node_matcheslist[] = JHtmlSelect::option($res->value, $res->text . ' (' . $res->info . ')'); } } $lists['node_matches'] = JHtmlSelect::genericlist($node_matcheslist, 'node_matcheslist[]', ' style="width:250px; height:300px;" class="inputbox" multiple="true" size="' . min(30, count($ress)) . '"', 'value', 'text'); } else { $lists['node_matches'] = '<select name="node_matcheslist[]" id="node_matcheslist" style="width:250px; height:300px;" class="inputbox" multiple="true" size="10"></select>'; } if ($ress1 = $model->getMatches()) { if ($ress = $model->getNodeMatches($node_id)) { foreach ($ress1 as $res1) { $used = 0; foreach ($ress as $res) { if ($res1->value == $res->value) { $used = 1; } } if ($used == 0 && !empty($res1->info)) { $notusedmatches[] = JHtmlSelect::option($res1->value, $res1->text . ' (' . $res1->info . ')'); } elseif ($used == 0 && empty($res1->info)) { $notusedmatches[] = JHtmlSelect::option($res1->value, $res1->text); } } } else { foreach ($ress1 as $res1) { if (empty($res1->info)) { $notusedmatches[] = JHtmlSelect::option($res1->value, $res1->text); } else { $notusedmatches[] = JHtmlSelect::option($res1->value, $res1->text . ' (' . $res1->info . ')'); } } } } else { JError::raiseWarning('ERROR_CODE', '<br />' . JText::_('COM_JOOMLEAGUE_ADMIN_TREETOMATCH_ADD_MATCH') . '<br /><br />'); } //build the html select list for matches if (count($notusedmatches) > 0) { $lists['matches'] = JHtmlSelect::genericlist($notusedmatches, 'matcheslist[]', ' style="width:250px; height:300px;" class="inputbox" multiple="true" size="' . min(30, count($notusedmatches)) . '"', 'value', 'text'); } else { $lists['matches'] = '<select name="matcheslist[]" id="matcheslist" style="width:250px; height:300px;" class="inputbox" multiple="true" size="10"></select>'; } unset($res); unset($res1); unset($notusedmatches); $this->user = JFactory::getUser(); $this->lists = $lists; $this->treetomatchs = $treetomatchs; $this->projectws = $projectws; $this->nodews = $nodews; $this->pagination = $pagination; $this->request_url = $uri->toString(); parent::display($tpl); }
function _displayEditlist($tpl) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $project_id = $mainframe->getUserState($option . 'project'); $db = JFactory::getDbo(); $uri = JFactory::getURI(); $filter_state = $mainframe->getUserStateFromRequest($option . 'tl_filter_state', 'filter_state', '', 'word'); $filter_order = $mainframe->getUserStateFromRequest($option . 'tl_filter_order', 'filter_order', 't.name', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'tl_filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . 'tl_search', 'search', '', 'string'); $search_mode = $mainframe->getUserStateFromRequest($option . 'tl_search_mode', 'search_mode', '', 'string'); $search = JString::strtolower($search); $projectteam = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); $model = $this->getModel(); // state filter $lists['state'] = JHtml::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $lists['search_mode'] = $search_mode; $projectws = $this->get('Data', 'project'); //build the html select list for project assigned teams $ress = array(); $res1 = array(); $notusedteams = array(); if ($ress = $model->getProjectTeams($project_id)) { $teamslist = array(); foreach ($ress as $res) { if (empty($res1->info)) { $project_teamslist[] = JHtmlSelect::option($res->value, $res->text); } else { $project_teamslist[] = JHtmlSelect::option($res->value, $res->text . ' (' . $res->info . ')'); } } $lists['project_teams'] = JHtmlSelect::genericlist($project_teamslist, 'project_teamslist[]', ' style="width:250px; height:300px;" class="inputbox" multiple="true" size="' . min(30, count($ress)) . '"', 'value', 'text'); } else { $lists['project_teams'] = '<select name="project_teamslist[]" id="project_teamslist" style="width:250px; height:300px;" class="inputbox" multiple="true" size="10"></select>'; } if ($ress1 = $model->getTeams()) { if ($ress = $model->getProjectTeams($project_id)) { foreach ($ress1 as $res1) { $used = 0; foreach ($ress as $res) { if ($res1->value == $res->value) { $used = 1; } } if ($used == 0 && !empty($res1->info)) { $notusedteams[] = JHtmlSelect::option($res1->value, $res1->text . ' (' . $res1->info . ')'); } elseif ($used == 0 && empty($res1->info)) { $notusedteams[] = JHtmlSelect::option($res1->value, $res1->text); } } } else { foreach ($ress1 as $res1) { if (empty($res1->info)) { $notusedteams[] = JHtmlSelect::option($res1->value, $res1->text); } else { $notusedteams[] = JHtmlSelect::option($res1->value, $res1->text . ' (' . $res1->info . ')'); } } } } else { JError::raiseWarning('ERROR_CODE', '<br />' . JText::_('COM_JOOMLEAGUE_ADMIN_PROJECTTEAMS_ADD_TEAM') . '<br /><br />'); } //build the html select list for teams if (count($notusedteams) > 0) { $lists['teams'] = JHtmlSelect::genericlist($notusedteams, 'teamslist[]', ' style="width:250px; height:300px;" class="inputbox" multiple="true" size="' . min(30, count($notusedteams)) . '"', 'value', 'text'); } else { $lists['teams'] = '<select name="teamslist[]" id="teamslist" style="width:250px; height:300px;" class="inputbox" multiple="true" size="10"></select>'; } unset($res); unset($res1); unset($notusedteams); $this->user = JFactory::getUser(); $this->lists = $lists; $this->projectteam = $projectteam; $this->projectws = $projectws; $this->pagination = $pagination; $this->request_url = $uri->toString(); $this->addToolbar_Editlist(); parent::display($tpl); }
<input type="text" class="input-large toolitem-caption toolbox-input" name="toolitem-caption" data-name="caption" value="" /> </fieldset> </li> </ul> <ul> <li> <label class="hasTip" title="<?php echo JTexT::_('PLAZART_NAVIGATION_MM_DIRECTION'), '::', JTexT::_('PLAZART_NAVIGATION_MM_DIRECTION_DESC'); ?> "><?php echo JTexT::_('PLAZART_NAVIGATION_MM_DIRECTION'); ?> </label> <fieldset class=""> <?php echo JHtmlSelect::genericlist($arr_pos, 'toolitem-directionx', ' class="input-medium toolitem-directionx toolbox-input" data-name="directionx" '); ?> </fieldset> </li> </ul> </div> <div id="plazart-admin-mm-toolsub" class="admin-toolbox"> <h3><?php echo JTexT::_('PLAZART_NAVIGATION_MM_SUBMNEU_CONF'); ?> </h3> <ul> <li> <label class="hasTip" title="<?php echo JTexT::_('PLAZART_NAVIGATION_MM_SUBMNEU_GRID'), '::', JTexT::_('PLAZART_NAVIGATION_MM_SUBMNEU_GRID_DESC');
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $params = JComponentHelper::getParams($option); $filter_state = $mainframe->getUserStateFromRequest($option . 'mc_filter_state', 'filter_state', '', 'word'); $filter_order = $mainframe->getUserStateFromRequest($option . 'mc_filter_order', 'filter_order', 'mc.match_number', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'mc_filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . 'mc_search', 'search', '', 'string'); $search_mode = $mainframe->getUserStateFromRequest($option . 'mc_search_mode', 'search_mode', '', 'string'); $division = $mainframe->getUserStateFromRequest($option . 'mc_division', 'division', '', 'string'); $project_id = $mainframe->getUserState($option . 'project'); $search = JString::strtolower($search); $matches = $this->get('Data'); $total = $this->get('Total'); $pagination = $this->get('Pagination'); $model = $this->getModel(); $projectteams = $model->getProjectTeams(); // state filter $lists['state'] = JHtml::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $lists['search_mode'] = $search_mode; $projectws = $this->get('Data', 'project'); $roundws = $this->get('Data', 'round'); //build the html options for teams foreach ($matches as $row) { $teams[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_TEAM')); $divhomeid = 0; //apply the filter only if both teams are from the same division //teams are not from the same division in tournament mode with divisions if ($row->divhomeid == $row->divawayid) { $divhomeid = $row->divhomeid; } else { $row->divhomeid = 0; $row->divawayid = 0; } if ($projectteams = $model->getProjectTeamsOptions($divhomeid)) { $teams = array_merge($teams, $projectteams); } $lists['teams_' + $divhomeid] = $teams; unset($teams); } //build the html selectlist for rounds $model = $this->getModel('project'); $ress = JoomleagueHelper::getRoundsOptions($model->_id, 'ASC', true); $project_roundslist = array(); foreach ($ress as $res) { $project_roundslist[] = JHtml::_('select.option', $res->id, $this->getRoundDescription($res)); } $lists['project_rounds'] = JHtml::_('select.genericList', $project_roundslist, 'rid[]', 'class="inputbox" ' . 'onChange="document.getElementById(\'short_act\').value=\'rounds\';' . 'document.roundForm.submit();" ', 'value', 'text', $roundws->id); $lists['project_rounds2'] = JHtml::_('select.genericList', $project_roundslist, 'rid', 'class="inputbox" ', 'value', 'text', $roundws->id); //build the html selectlist for matches $overall_config = $model->getTemplateConfig('overall'); if (isset($overall_config['use_jl_substitution']) && $overall_config['use_jl_substitution'] || isset($overall_config['use_jl_events']) && $overall_config['use_jl_events']) { $match_list = array(); $mdd[] = JHtml::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_MATCH')); foreach ($matches as $row) { $mdd[] = JHtml::_('select.option', 'index3.php?option=com_joomleague&task=match.editEvents&cid[0]=' . $row->id, $row->team1 . '-' . $row->team2); } $RosterEventMessage = isset($overall_config['use_jl_substitution']) && $overall_config['use_jl_substitution'] ? JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_LINEUP') : ''; if (isset($overall_config['use_jl_events']) && $overall_config['use_jl_events']) { if (isset($overall_config['use_jl_events']) && $overall_config['use_jl_substitution']) { $RosterEventMessage .= ' / '; } $RosterEventMessage .= JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_EVENTS'); } $RosterEventMessage .= $RosterEventMessage != '' ? ':' : ''; $lists['RosterEventMessage'] = $RosterEventMessage; $lists['round_matches'] = JHtml::_('select.genericList', $mdd, 'mdd', 'id="mdd" class="inputbox" onchange="jl_load_new_match_events(this,\'eventscontainer\')"', 'value', 'text', '0'); } //build the html options for extratime $match_result_type[] = JHtmlSelect::option('0', JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_RT')); $match_result_type[] = JHtmlSelect::option('1', JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_OT')); $match_result_type[] = JHtmlSelect::option('2', JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_SO')); $lists['match_result_type'] = $match_result_type; unset($match_result_type); //build the html options for massadd create type $createTypes = array(0 => JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_MASSADD'), 1 => JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_MASSADD_1'), 2 => JText::_('COM_JOOMLEAGUE_ADMIN_MATCHES_MASSADD_2')); $ctOptions = array(); foreach ($createTypes as $key => $value) { $ctOptions[] = JHtmlSelect::option($key, $value); } $lists['createTypes'] = JHtmlSelect::genericlist($ctOptions, 'ct[]', 'class="inputbox" onchange="javascript:displayTypeView();"', 'value', 'text', 1, 'ct'); unset($createTypes); // build the html radio for adding into one round / all rounds $createYesNo = array(0 => JText::_('COM_JOOMLEAGUE_GLOBAL_NO'), 1 => JText::_('COM_JOOMLEAGUE_GLOBAL_YES')); $ynOptions = array(); foreach ($createYesNo as $key => $value) { $ynOptions[] = JHtmlSelect::option($key, $value); } $lists['addToRound'] = JHtmlSelect::radiolist($ynOptions, 'addToRound', 'class="inputbox"', 'value', 'text', 0); // build the html radio for auto publish new matches $lists['autoPublish'] = JHtmlSelect::radiolist($ynOptions, 'autoPublish', 'class="inputbox"', 'value', 'text', 0); //build the html options for divisions $divisions[] = JHtmlSelect::option('0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_DIVISION')); $mdlDivisions = JModelLegacy::getInstance("divisions", "JoomLeagueModel"); if ($res = $mdlDivisions->getDivisions($project_id)) { $divisions = array_merge($divisions, $res); } $lists['divisions'] = $divisions; unset($divisions); $this->division = $division; $this->user = JFactory::getUser(); $this->lists = $lists; $this->matches = $matches; $this->ress = $ress; $this->projectws = $projectws; $this->roundws = $roundws; $this->pagination = $pagination; $this->teams = $projectteams; $this->request_url = $uri->toString(); $this->prefill = $params->get('use_prefilled_match_roster', 0); $this->addToolbar(); parent::display($tpl); }
<td class="nowrap" class="center"> <?php $append = ''; if (empty($row->country)) { $append = ' background-color:#FFCCCC;'; } echo JHtmlSelect::genericlist($this->lists['nation'], 'country' . $row->id, $inputappend . ' class="inputbox" style="width:140px; ' . $append . '" onchange="document.getElementById(\'cb' . $i . '\').checked=true"', 'value', 'text', $row->country); ?> </td> <td class="nowrap" class="center"> <?php $append = ''; if (empty($row->position_id)) { $append = ' background-color:#FFCCCC;'; } echo JHtmlSelect::genericlist($this->lists['positions'], 'position' . $row->id, $inputappend . 'class="inputbox" style="width:140px; ' . $append . '" onchange="document.getElementById(\'cb' . $i . '\').checked=true"', 'value', 'text', $row->position_id); ?> </td> <td class="center"><?php echo $published; ?> </td> <td class="center"><?php echo $row->id; ?> </td> </tr> <?php } } ?>
/** * Method to get the field input for module layouts. * * @return string The field input. * * @since 11.1 */ protected function getInput() { // Load Dependencies $doc = JFactory::getDocument(); $doc->addStyleSheet(JURI::root(TRUE) . '/libraries/xef/assets/css/image-picker.css'); $doc->addScript(JURI::root(TRUE) . '/libraries/xef/assets/js/image-picker.min.js'); $js = 'jQuery(document).ready(function(){ jQuery(".img-list").imagepicker({show_label: true}); });'; $doc->addScriptDeclaration($js); // Get the client id. $clientId = $this->element['client_id']; if (is_null($clientId) && $this->form instanceof JForm) { $clientId = $this->form->getValue('client_id'); } $clientId = (int) $clientId; $client = JApplicationHelper::getClientInfo($clientId); // Get the module. $module = (string) $this->element['module']; if (empty($module) && $this->form instanceof JForm) { $module = $this->form->getValue('module'); } $module = preg_replace('#\\W#', '', $module); // Get the template. $template = (string) $this->element['template']; $template = preg_replace('#\\W#', '', $template); // Get the style. if ($this->form instanceof JForm) { $template_style_id = $this->form->getValue('template_style_id'); } $template_style_id = preg_replace('#\\W#', '', $template_style_id); // If an extension and view are present build the options. if ($module && $client) { // Load language file $lang = JFactory::getLanguage(); $lang->load($module . '.sys', $client->path, null, false, false) || $lang->load($module . '.sys', $client->path . '/modules/' . $module, null, false, false) || $lang->load($module . '.sys', $client->path, $lang->getDefault(), false, false) || $lang->load($module . '.sys', $client->path . '/modules/' . $module, $lang->getDefault(), false, false); // Get the database object and a new query object. $db = JFactory::getDBO(); $query = $db->getQuery(true); // Build the query. $query->select('element, name'); $query->from('#__extensions as e'); $query->where('e.client_id = ' . (int) $clientId); $query->where('e.type = ' . $db->quote('template')); $query->where('e.enabled = 1'); if ($template) { $query->where('e.element = ' . $db->quote($template)); } if ($template_style_id) { $query->join('LEFT', '#__template_styles as s on s.template=e.element'); $query->where('s.id=' . (int) $template_style_id); } // Set the query and load the templates. $db->setQuery($query); $templates = $db->loadObjectList('element'); // Check for a database error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); } // Build the search paths for module layouts. $module_path = JPath::clean($client->path . '/modules/' . $module . '/tmpl'); // Prepare array of component layouts $module_layouts = array(); // Prepare the grouped list $data = array(); // Add the layout options from the module path. if (is_dir($module_path) && ($module_layouts = JFolder::files($module_path, '^[^_]*\\.php$'))) { foreach ($module_layouts as $file) { // Add an option to the module group $value = JFile::stripExt($file); $text = $lang->hasKey($key = strtoupper($module . '_LAYOUT_' . $value)) ? JText::_($key) : $value; $image_path = JURI::root(TRUE) . '/modules/' . $module . '/tmpl/' . $value . '.png'; $data[] = array('value' => $value, 'text' => $text, 'attr' => array('data-img-src' => $image_path)); } } // Loop on all templates if ($templates) { foreach ($templates as $template) { // Load language file $lang->load('tpl_' . $template->element . '.sys', $client->path, null, false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, null, false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path, $lang->getDefault(), false, false) || $lang->load('tpl_' . $template->element . '.sys', $client->path . '/templates/' . $template->element, $lang->getDefault(), false, false); $template_path = JPath::clean($client->path . '/templates/' . $template->element . '/html/' . $module); // Add the layout options from the template path. if (is_dir($template_path) && ($files = JFolder::files($template_path, '^[^_]*\\.php$'))) { foreach ($files as $i => $file) { // Remove layout that already exist in component ones if (in_array($file, $module_layouts)) { unset($files[$i]); } } if (count($files)) { foreach ($files as $file) { // Add an option to the template group $value = JFile::stripExt($file); $text = $lang->hasKey($key = strtoupper('TPL_' . $template->element . '_' . $module . '_LAYOUT_' . $value)) ? JText::_($key) : $value; $image_path = JURI::root(TRUE) . '/templates/' . $template->element . '/html/' . $module . '/' . $value . '.png'; if (!file_exists($image_path)) { $image_path = JURI::root(TRUE) . '/libraries/xef/assets/images/imagepicker_layout_not_found.png'; } $data[] = array('value' => $value, 'text' => $text, 'attr' => array('data-img-src' => $image_path)); } } } } } // Compute the current selected values $selected = array($this->value); // Pass all options $options = array('id' => $this->id, 'list.attr' => array('class' => 'img-list'), 'list.translate' => false, 'option.key' => 'value', 'option.text' => 'text', 'option.attr' => 'attr', 'list.select' => $selected); $html = JHtmlSelect::genericlist($data, $this->name, $options); return $html; } else { return ''; } }
public static function getSelectParent($id, $parent_id, $name, $attribs) { $db = JFactory::getDbo(); $node = false; if ((int) $id > 0) { $query = 'SELECT lft,rgt FROM ins_cap WHERE id = ' . $id; $db->setQuery($query); $node = $db->loadAssoc(); } //var_dump($node); $query = $db->getQuery(true); $query->select(array('id AS value', 'CONCAT(REPEAT(\'--\', level), name) AS text'))->from('ins_cap')->order('lft'); if ($node != false) { $query->where('id NOT IN (SELECT id FROM ins_cap WHERE lft >= ' . $node['lft'] . ' AND rgt <= ' . $node['rgt'] . ')'); } //echo $query->__toString(); $db->setQuery($query); $rows = $db->loadAssocList(); //array_merge(array('value'=>'','text'=>''),$rows); array_unshift($rows, array('value' => '', 'text' => '')); return JHtmlSelect::genericlist($rows, $name, $attribs, 'value', 'text', $parent_id); }
/** * Test the genericlist method. * * @param string $expected Expected generated HTML <select> string. * @param array $data An array of objects, arrays, or scalars. * @param string $name The value of the HTML name attribute. * @param mixed $attribs Additional HTML attributes for the <select> tag. This * can be an array of attributes, or an array of options. Treated as options * if it is the last argument passed. Valid options are: * Format options, see {@see JHtml::$formatOptions}. * Selection options, see {@see JHtmlSelect::options()}. * list.attr, string|array: Additional attributes for the select * element. * id, string: Value to use as the select element id attribute. * Defaults to the same as the name. * list.select, string|array: Identifies one or more option elements * to be selected, based on the option key values. * @param string $optKey The name of the object variable for the option value. If * set to null, the index of the value array is used. * @param string $optText The name of the object variable for the option text. * @param mixed $selected The key that is selected (accepts an array or a string). * @param mixed $idtag Value of the field id or null by default * @param boolean $translate True to translate * * @return void * * @dataProvider getGenericlistData * @since 3.2 */ public function testGenericlist($expected, $data, $name, $attribs = null, $optKey = 'value', $optText = 'text', $selected = null, $idtag = false, $translate = false) { if (func_num_args() == 4) { $this->assertEquals($expected, JHtmlSelect::genericlist($data, $name, $attribs)); } else { $this->assertEquals($expected, JHtmlSelect::genericlist($data, $name, $attribs, $optKey, $optText, $selected, $idtag, $translate)); } }
static function getStateList($name, $selected) { $data[] = JHtmlSelect::option('1', JText::_('JPUBLISHED')); $data[] = JHtmlSelect::option('0', JText::_('JUNPUBLISHED')); return JHtmlSelect::genericlist($data, $name, 'class="inputbox"', 'value', 'text', $selected, 'id_state'); }