protected function getOptions() { // if VM is not installed if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_virtuemart') or !class_exists('ShopFunctions')) { // add the root item $option = new stdClass(); $option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_NOTFOUND'); $option->value = '0'; $options[] = $option; // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } VmConfig::loadConfig(); $categorylist = ShopFunctions::categoryListTree(); // $categorylist = 'testced'; $categorylist = trim($categorylist, '</option>'); $categorylist = explode("</option><option", $categorylist); // add the root item $option = new stdClass(); $option->text = JText::_('MOD_ACCORDEONCK_VIRTUEMART_ROOTNODE'); $option->value = '0'; $options[] = $option; foreach ($categorylist as $cat) { $option = new stdClass(); $text = explode(">", $cat); $option->text = trim($text[1]); $option->value = strval(trim(trim(trim($text[0]), '"'), 'value="')); $options[] = $option; } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
protected function getOptions() { // Initialize variables. $options = array(); // Initialize some field attributes. $key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value'; $value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name']; $translate = $this->element['translate'] ? (string) $this->element['translate'] : false; $query = (string) $this->element['query']; // Get the database object. $db = JFactory::getDBO(); // Set the query and get the result list. $db->setQuery($query); $items = $db->loadObjectlist(); // Check for an error. if ($db->getErrorNum()) { JError::raiseWarning(500, $db->getErrorMsg()); return $options; } // Build the field options. if (!empty($items)) { foreach ($items as $item) { if ($translate == true) { $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value})); } else { $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value}); } } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
protected function getOptions() { // if the component is not installed if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_k2') or !JFile::exists(JPATH_ROOT . '/modules/mod_maximenuck/helper_k2.php')) { // add the root item $option = new stdClass(); $option->text = JText::_('MOD_MAXIMENUCK_K2_NOTFOUND'); $option->value = '0'; $options[] = $option; // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } // get the categories form the helper $params = new JRegistry(); require_once JPATH_ROOT . '/modules/mod_maximenuck/helper_k2.php'; $cats = modMaximenuckk2Helper::getItems($params); // add the root item $option = new stdClass(); $option->text = JText::_('MOD_MAXIMENUCK_K2_ROOTNODE'); $option->value = '0'; $options[] = $option; foreach ($cats as $cat) { $option = new stdClass(); $option->text = str_repeat(" - ", $cat->level - 1) . $cat->name; $option->value = $cat->id; $options[] = $option; } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
protected function getOptions() { // if the component is not installed if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_hikashop') or !JFile::exists(JPATH_ROOT . '/modules/mod_accordeonck/helper_hikashop.php')) { // add the root item $option = new stdClass(); $option->text = JText::_('MOD_ACCORDEONCK_HIKASHOP_NOTFOUND'); $option->value = '0'; $options[] = $option; // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } // get the categories form the helper $params = new JRegistry(); require_once JPATH_ROOT . '/modules/mod_accordeonck/helper_hikashop.php'; $cats = modAccordeonckhikashopHelper::getItems($params, true); // add the root item $option = new stdClass(); $option->text = JText::_('MOD_ACCORDEONCK_HIKASHOP_ROOTNODE'); $option->value = '2'; $options[] = $option; foreach ($cats as $cat) { $option = new stdClass(); $option->text = str_repeat(" - ", $cat->level - 1) . $cat->category_name; $option->value = $cat->id; $options[] = $option; } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
protected function getOptions() { // if the component is not installed if (!JFolder::exists(JPATH_ROOT . '/administrator/components/com_hikashop')) { // add the root item $option = new stdClass(); $option->text = JText::_('MOD_SLIDESHOWCKHIKASHOP_HIKASHOP_NOTFOUND'); $option->value = '0'; $options[] = $option; // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } // get the categories $cats = $this->getCategories(); // add the root item $option = new stdClass(); $option->text = JText::_('MOD_SLIDESHOWCKHIKASHOP_HIKASHOP_PRODUCT_CATEGORY'); $option->value = '2'; $options[] = $option; foreach ($cats as $cat) { $option = new stdClass(); $option->text = str_repeat(" - ", $cat->level) . $cat->name; $option->value = $cat->id; $options[] = $option; } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
/** * Method to get the list of files for the field options. * Specify the target directory with a directory attribute * Attributes allow an exclude mask and stripping of extensions from file name. * Default attribute may optionally be set to null (no file) or -1 (use a default). * * @return array The field option objects. * * @since 11.1 */ protected function getOptions() { // Initialize variables. $options = array(); // Initialize some field attributes. $filter = (string) $this->element['filter']; $exclude = (string) $this->element['exclude']; $stripExt = (string) $this->element['stripext']; $hideNone = (string) $this->element['hide_none']; $hideDefault = (string) $this->element['hide_default']; $default = (string) $this->element['default']; // Get the path in which to search for file options. $path = (string) $this->element['directory']; if (!is_dir($path)) { $path = JPATH_ROOT . '/' . $path; } // Prepend some default options based on field attributes. if (!$hideNone) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname))); } if (!$hideDefault) { $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname))); } // Get a list of files in the search path with the given filter. $files = JFolder::files($path, $filter); // Build the options list from the list of files. if (is_array($files)) { foreach ($files as $file) { // Check to see if the file is in the exclude mask. if ($exclude) { if (preg_match(chr(1) . $exclude . chr(1), $file)) { continue; } } // If the extension is to be stripped, do it. if ($stripExt) { $file = JFile::stripExt($file); } $options[] = JHtml::_('select.option', $file, $file); } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
protected function getOptions() { // if flexicontent is not installed if (!JFolder::exists(JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_flexicontent')) { JPluginHelper::importPlugin('system', 'flexisystem'); // add the root item $option = new stdClass(); $option->text = JText::_('MOD_MAXIMENUCK_FLEXICONTENT_NOTFOUND'); $option->value = '0'; $options[] = $option; // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } // For specific cache issues global $dump, $globalcats; if (empty($globalcats)) { if (FLEXI_SECTION || FLEXI_CAT_EXTENSION) { if (FLEXI_CACHE) { // add the category tree to categories cache $catscache = JFactory::getCache('com_flexicontent_cats'); $catscache->setCaching(1); //force cache $catscache->setLifeTime(84600); //set expiry to one day $globalcats = $catscache->call(array('plgSystemFlexisystem', 'getCategoriesTree')); } else { $globalcats = plgSystemFlexisystem::getCategoriesTree(); } } } foreach ($globalcats as $cat) { $option = new stdClass(); $option->text = str_replace("<sup>", "", str_replace("</sup>", "", $cat->treename)); $option->value = $cat->id; $options[] = $option; } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
protected function getOptions() { // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), JHtml::_('menu.menus')); return $options; }