/** * @param $text */ public static function addInlineStyle($text) { $container = RokCommon_Service::getContainer(); /** @var $self RokCommon_Header_Interface */ $self = $container->header; $self->addInlineStyle($text); }
/** * @static * * @param $original * @return \RokCommon_Registry */ public static function convert($original) { $container = RokCommon_Service::getContainer(); /** @var $converter RokCommon_Registry_IConverter */ $converter = $container->registry_converter; return $converter->convert($original); }
/** * @param $text * @deprecated */ public static function addInlineStyle($text) { $container = RokCommon_Service::getContainer(); /** @var $header RokCommon_IHeader */ $header = $container->header; $header->addInlineStyle($text); }
/** * @throws RokCommon_Loader_Exception * @return RokCommon_Doctrine_Platform */ protected function loadPlatformInstance() { if (!isset($this->platform_instance)) { $container = RokCommon_Service::getContainer(); $this->platform_instance = $container->doctrine_platform; } }
public static function compile($lessfile, $outfile, $force = false) { try { $container = RokCommon_Service::getContainer(); /** @var $cache_handler RokCommon_ICache */ $cache_handler = $container->getService('cache'); $less_file_md5 = md5($lessfile); if ($force || !($cache = $cache_handler->get(self::CACHE_GROUP, $less_file_md5))) { $cache = $lessfile; } $new_cache = RokCommon_Less_Compiler::cexecute($cache); if (!is_array($cache) || $new_cache['updated'] > $cache['updated']) { $cache_handler->set(self::CACHE_GROUP, $less_file_md5, $new_cache); $tmp_ouput_file = tempnam(dirname($outfile), 'rokcommon_less'); file_put_contents($tmp_ouput_file, $new_cache['compiled']); // Do the messed up file renaming for windows if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $move_old_file_name = tempnam(dirname($outfile), 'rokcommon_less'); if (is_file($outfile)) { @rename($outfile, $move_old_file_name); } @rename($tmp_ouput_file, $outfile); @unlink($move_old_file_name); } else { @rename($tmp_ouput_file, $outfile); } } } catch (Exception $ex) { echo "lessphp fatal error: " . $ex->getMessage(); } }
/** * Method to get the field options for the list of installed editors. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { $container = RokCommon_Service::getContainer(); $fieldname = $this->element['name']; $configkey = (string) $this->element['configkey']; $options = array(); $params = $container[$configkey]; $params = get_object_vars($params); ksort($params); foreach ($params as $provider_id => $provider_info) { /** @var $provider RokSprocket_IProvider */ $provider_class = $container[sprintf('roksprocket.providers.registered.%s.class', $provider_id)]; $available = call_user_func(array($provider_class, 'isAvailable')); if ($available) { //if ($this->value == $provider_id) $selected = ' selected="selected"'; else $selected = ""; $tmp = JHtml::_('select.option', $provider_id, $provider_info->displayname); // Set some option attributes. $tmp->attr = array('rel' => $fieldname . '_' . $provider_id); $tmp->icon = 'provider ' . $provider_id; $options[] = $tmp; } } reset($options); return $options; }
/** * Method to get the field options for the list of installed editors. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { $container = RokCommon_Service::getContainer(); /** @var $model RokSprocket_Model_Widgets */ $model = $container->getService('roksprocket.widgets.model'); $widgets = $model->getAvailableInstances(); $fieldname = $this->element['name']; $options = array(); $options[] = RokCommon_HTML_SelectList::option('', rc__('- Select RokSprocket Widget -')); foreach ($widgets as $info) { if ($this->value == $info['id']) { $selected = ' selected="selected"'; } else { $selected = ""; } $tmp = RokCommon_HTML_SelectList::option($info['id'], $info['title']); $options[] = $tmp; } $options = array_merge(parent::getOptions(), $options); foreach ($options as &$option) { // Set some option attributes. $option->attr = array('class' => $option->value, 'rel' => $fieldname . '_' . $option->value); } reset($options); return $options; }
/** * Method to get the field options for the list of installed editors. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { $container = RokCommon_Service::getContainer(); $fieldname = $this->element['name']; $options = array(); if (isset($this->element['configkey'])) { $configkey = (string) $this->element['configkey']; $params = $container[$configkey]; foreach ($params as $id => $info) { if ($this->value == $id) { $selected = ' selected="selected"'; } else { $selected = ""; } $tmp = RokCommon_HTML_SelectList::option($id, $info->displayname); $options[] = $tmp; } } $options = array_merge(parent::getOptions(), $options); foreach ($options as &$option) { // Set some option attributes. $option->attr = array('class' => $option->value, 'rel' => $fieldname . '_' . $option->value); } reset($options); return $options; }
/** * Method to get the field options for the list of installed editors. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { $container = RokCommon_Service::getContainer(); $fieldname = $this->element['name']; $provider = (string) $this->element['provider']; $populator = (string) $this->element['populator']; $options = array(); /** @var $provider RokSprocket_IProvider */ $provider_class = $container[sprintf('roksprocket.providers.registered.%s.class', $provider)]; $available = call_user_func(array($provider_class, 'isAvailable')); if ($available) { if (method_exists($provider_class, $populator)) { $provider_options = call_user_func(array($provider_class, $populator)); foreach ($provider_options as $provider_option_value => $provider_option_label) { //if ($this->value == $provider_option_value) $selected = ' selected="selected"'; else $selected = ""; $tmp = RokCommon_HTML_SelectList::option($provider_option_value, $provider_option_label); // Set some option attributes. $tmp->attr = array('rel' => $fieldname . '_' . $provider_option_value); //$tmp->icon = 'provider ' . $provider_id; $options[] = $tmp; } } } reset($options); return $options; }
/** * */ public function ajax() { $app = JFactory::getApplication(); $input = $app->input; try { $container = RokCommon_Service::getContainer(); foreach ($container['roksprocket.layouts'] as $layout) { if (isset($layout->paths) && isset($layout->ajax->dir)) { $paths = $layout->paths; $ajax_dir = $layout->ajax->dir; foreach ($paths as $priority => $path) { $ajax_path = $path . '/' . $ajax_dir; if (is_dir($ajax_path)) { RokCommon_Ajax::addModelPath($ajax_path, 'RokSprocketSiteLayoutAjaxModel', $priority); } } } } $model = $input->get('model', null, 'word'); $action = $input->get('model_action', $input->get('action', null, 'word'), 'word'); if (isset($_REQUEST['params'])) { $params = RokCommon_Ajax::smartStripSlashes($_REQUEST['params']); } echo RokCommon_Ajax::run($model, $action, $params); } catch (Exception $e) { $result = new RokCommon_Ajax_Result(); $result->setAsError(); $result->setMessage($e->getMessage()); echo json_encode($result); } }
/** * @param $module_id * * @return bool */ public static function addNewItem($module_id) { $container = RokCommon_Service::getContainer(); /** @var RokSprocket_Provider_Simple_Storage_Interface $storage */ $storage = $container->getService('roksprocket.provider.simple_storage'); return $storage->addNewItem($module_id); }
/** * @param string $model * * @return RokCommon_Ajax_Model */ protected static function &getModel($model) { $container = RokCommon_Service::getContainer(); /** @var $ajaxModelLoader RokCommon_ClassLoader_PrefixedLoader */ $ajaxModelLoader = $container->getService('ajax.model.loader'); $model = $ajaxModelLoader->getItem($model, null, 'RokCommon_Ajax_Model'); return $model; }
/** * Display the view */ public function display($tpl = null) { JHTML::_('behavior.mootools'); JHTML::_('behavior.keepalive'); $this->container = RokCommon_Service::getContainer(); $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->articles = $this->getModel()->getArticles($this->item->id, $this->item->params); $this->layout = isset($this->item->params['layout']) ? $this->item->params['layout'] : $this->form->getFieldAttribute('layout', 'default', 'text', 'params'); $this->provider = isset($this->item->params['provider']) ? $this->item->params['provider'] : $this->form->getFieldAttribute('provider', 'default', 'text', 'params'); if (!isset($this->container[sprintf('roksprocket.layouts.%s', $this->layout)])) { JError::raiseWarning(500, rc__(ROKSPROCKET_UNABLE_TO_FIND_LAYOUT_ERROR, $this->layout)); $app = JFactory::getApplication(); $app->redirect(JRoute::_(sprintf('index.php?option=%s&view=modules', RokSprocket_Helper::getRedirectionOption()), false)); return false; } $this->perItemForm = $this->getModel()->getPerItemsForm($this->layout); /** @var $i18n RokCommon_I18N */ $i18n = $this->container->i18n; foreach ($this->container['roksprocket.layouts'] as $layout_type => $layoutinfo) { $layout_lang_paths = $this->container[sprintf('roksprocket.layouts.%s.paths', $layout_type)]; foreach ($layout_lang_paths as $lang_path) { @$i18n->loadLanguageFiles('roksprocket_layout_' . $layout_type, $lang_path); } } $load_more_total = count($this->articles); $module_params = new RokCommon_Registry($this->item->params); $limit = 10; if ($load_more_total > $limit) { $this->articles = $this->articles->trim($limit); $load_more = 'true'; } else { $load_more = 'false'; } $load_more_script = sprintf('RokSprocket.Paging = {more: %s, page: 1, next_page: 2, amount: %d};', $load_more, $load_more_total); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Read cookie for showing/hide per-article items if (!isset($_COOKIE['roksprocket-showitems'])) { $showitems_cookie = 1; setcookie("roksprocket-showitems", $showitems_cookie, time() + 60 * 60 * 24 * 365, '/'); } else { $showitems_cookie = $_COOKIE['roksprocket-showitems']; } $this->showitems = (bool) $showitems_cookie; $siteURL = JURI::root(true); $adminURL = JURI::base(true); $this->addToolbar(); $this->compileLess(); $this->compileJS(); RokCommon_Header::addInlineScript("RokSprocket.params = 'jform_params';RokSprocket.SiteURL = '" . $siteURL . "'; RokSprocket.AdminURL = '" . $adminURL . "'; RokSprocket.URL = RokSprocket.AdminURL + '/index.php?option=" . JRequest::getString('option') . "&task=ajax&format=raw';" . $load_more_script); RokCommon_Header::addStyle($siteURL . '/components/com_roksprocket/fields/filters/css/datepicker.css'); parent::display($tpl); }
/** * @param $path * @param $prefix * @param int $priority */ public function addPath($path, $prefix, $priority = self::DEFAULT_PATH_PRIORITY) { $container = RokCommon_Service::getContainer(); if (!$container->hasParameter($this->classpath_key)) { $container->setParameter($this->classpath_key, new stdClass()); } $container->setParameter($this->classpath_key . '.' . $prefix . '.' . $priority, array($path)); $this->clearChecked(); }
/** * @param null|SimpleXMLElement $xmlnode * @param null $renderer */ public function __construct(SimpleXMLElement &$xmlnode = null, $renderer = null) { $this->container = RokCommon_Service::getContainer(); $this->xmlnode = $xmlnode; $this->initializeSelections(); if (null != $renderer) { $this->selectRenderer = $renderer; } }
/** * @param string $identifier the identifier for the options * @param string $filename * @param string $joinmode * @param string $searchmode */ public function __construct($identifier, $filename, $joinmode = self::JOIN_MODE_MERGE, $searchmode = self::SEARCH_MODE_BASEDIRS) { $this->identifier = $identifier; $this->container = RokCommon_Service::getContainer(); $this->logger = $this->container->logger; $this->joinMode = $joinmode; $this->searchMode = $searchmode; $this->xml = new RokCommon_XMLElement('<config/>'); $this->filename = $filename; }
/** * Magic function to render this object as a string using default args of toString method. * @return string */ public function __toString() { try { return $this->toString(); } catch (Exception $e) { $container = RokCommon_Service::getContainer(); $logger = $container->logger; $logger->error($e->getMessage()); return ''; } }
/** * @param string $provider_name */ public function __construct($provider_name = 'unsupported') { $this->container = RokCommon_Service::getContainer(); $this->provider_name = $provider_name; $this->filter_file = $this->container['roksprocket.providers.registered.' . $provider_name . '.path'] . '/' . $this->container['roksprocket.providers.registered.' . $provider_name . '.filter.file']; if (!file_exists($this->filter_file)) { throw new Exception(rc__('Unable to find filter file for %1s at path %2s.', $provider_name, $this->filter_file)); } $xmlfile = simplexml_load_file($this->filter_file); $this->filter = new RokCommon_Filter($xmlfile); }
/** * @param $string * @param $n * * @return string */ function rc_n($string, $n) { try { $container = RokCommon_Service::getContainer(); $i18n = $container->i18n; $args = func_get_args(); return call_user_func_array(array($i18n, 'translatePlural'), $args); } catch (RokCommon_Loader_Exception $le) { //TODO: log a failure to load a translation driver return $string; } }
/** * @param $action * @param $params * * @throws Exception * @throws RokCommon_Ajax_Exception * @return RokCommon_Ajax_Result */ public function run($action, $params) { $result = parent::run($action, $params); $payload = $result->getPayload(); if (isset($payload['html'])) { $container = RokCommon_Service::getContainer(); /** @var $helper RokSprocket_PlatformHelper */ $helper = $container->roksprocket_platformhelper; $payload['html'] = $helper->cleanup($payload['html']); } $result->setPayload($payload); return $result; }
/** * @param $params * { * "page":1, * "moduleid": 86 * } * * @return RokCommon_Ajax_Result */ public function getPage($params) { $result = new RokCommon_Ajax_Result(); try { $html = ''; $container = RokCommon_Service::getContainer(); /** @var $platformHelper RokSprocket_PlatformHelper */ $platformHelper = $container->roksprocket_platformhelper; $module_params = $platformHelper->getModuleParameters($params->moduleid); // add the layout classpath $layout_lib_path = $container['roksprocket.layouts.grids.library.paths']; foreach ($layout_lib_path as $lib_path) { RokCommon_ClassLoader::addPath($lib_path); } $container = RokCommon_Service::getContainer(); /** @var $platformHelper RokSprocket_PlatformHelper */ $platformHelper = $container->roksprocket_platformhelper; $items = $platformHelper->getFromCache(array('RokSprocket', 'getItemsWithParams'), array($params->moduleid, $module_params, true), $module_params, $params->moduleid); /** @var $layout RokSprocket_Layout_Grids */ $layout = $container->getService('roksprocket.layout.grids'); $layout->initialize($items, $module_params); $items = $layout->getItems(); $provider_type = $module_params->get('provider', 'joomla'); $sort_type = $module_params->get($provider_type . '_sort', 'automatic'); if ($sort_type == RokSprocket_ItemCollection::SORT_METHOD_RANDOM) { $items->sort($sort_type); } $limit = $module_params->get('display_limit', '∞'); if ($limit != '∞' && (int) $limit > 0) { $items = $items->trim($limit); } $offset = ($params->page - 1) * $module_params->get('grids_items_per_page', 1); $items = $items->slice($offset, $module_params->get('grids_items_per_page', 1)); $items = $platformHelper->processItemsForEvents($items, $module_params); $themecontext = $layout->getThemeContent(); ob_start(); $index = 0; foreach ($items as $item) { echo $themecontext->load('item.php', array('item' => $item, 'parameters' => $module_params, 'index' => $index)); $index++; } $html .= ob_get_clean(); $html = $platformHelper->processOutputForEvents($html, $module_params); $result->setPayload(array('html' => $html, 'page' => $params->page)); } catch (Exception $e) { throw $e; } return $result; }
/** * Constructor * * @throws RokCommon_Cache_Exception * * @param int $lifeTime * @param string $dir Directory - without ending slash! */ public function __construct($lifeTime = self::DEFAULT_LIFETIME, $dir) { $this->lifeTime = $lifeTime; $container = RokCommon_Service::getContainer(); /** @var $platforminfo RokCommon_PlatformInfo */ $platforminfo = $container->platforminfo; $dir = $platforminfo->getRootPath() . $dir; if (!empty($dir) && $this->checkDirectory($dir)) { $this->dir = $dir; } else { if (!$this->checkDirectory($this->dir)) { throw new RokCommon_Cache_Exception('Unable to use given directory. Check file permissions.'); } } }
/** * @return RokSprocket_ItemCollection */ public function getData() { $container = RokCommon_Service::getContainer(); /** @var $platformHelper RokSprocket_PlatformHelper */ $platformHelper = $container->roksprocket_platformhelper; $items = $platformHelper->getFromCache(array($this, '_realGetData'), array(), $this->params, $this->params->get('module_id', 0)); // get the data to present to the layout $provider_type = $this->params->get('provider', 'joomla'); $sort_type = $this->params->get($provider_type . '_sort', 'automatic'); if ($sort_type == RokSprocket_ItemCollection::SORT_METHOD_RANDOM) { $items->sort($sort_type); } $items = $platformHelper->processItemsForEvents($items, $this->params); return $items; }
/** * Method to get the field options for the list of installed editors. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { $container = RokCommon_Service::getContainer(); $fieldname = $this->element['name']; $configkey = (string) $this->element['configkey']; $controller = (string) $this->element['controller']; $populator = (string) $this->element['populator']; $cck_group_control = $this->getCCKGroupControls(); $options = array(); $params = $container[$configkey]; $form_wrapper = $this->container['roksprocket.form.wrapper.class']; $wrapper_form = new $form_wrapper($this->form); $provider_id = $wrapper_form->getData()->get('params')->provider; $provider_info = $this->container["roksprocket.providers.registered.{$provider_id}"]; //foreach ($params as $provider_id => $provider_info) { /** @var $provider RokSprocket_IProvider */ $provider_class = $container[sprintf('roksprocket.providers.registered.%s.class', $provider_id)]; $available = call_user_func(array($provider_class, 'isAvailable')); if ($available) { if (method_exists($provider_class, $populator)) { $provider_options = call_user_func(array($provider_class, $populator)); foreach ($provider_options as $provider_option_value => $provider_option_data) { $provider_option_label = $provider_option_data['display']; $cck_grouping = ''; if (isset($cck_group_control[$provider_id]) && isset($provider_option_data['group'])) { $cck_grouping = sprintf('%s %s_%s', $cck_group_control[$provider_id], $cck_group_control[$provider_id], $provider_option_data['group']); } //if ($this->value == $provider_option_value) $selected = ' selected="selected"'; else $selected = ""; $tmp = JHtml::_('select.option', $provider_info->name . '_' . $provider_option_value, $provider_option_label); // Set some option attributes. $tmp->attr = array('class' => sprintf('%s %s_%s %s', $controller, $controller, $provider_id, $cck_grouping), 'rel' => $fieldname . '_' . $provider_info->name . '_' . $provider_option_value); //$tmp->icon = 'provider ' . $provider_id; $options[] = $tmp; } } } //} $defined_options = $this->getDefinedOptions(); foreach ($defined_options as &$defined_option) { $defined_option->attr = array('class' => '', 'rel' => $fieldname . '_' . $defined_option->value); } $options = array_merge($defined_options, $options); reset($options); return $options; }
public function saveandclose($params) { $result = new RokCommon_Ajax_Result(); try { $container = RokCommon_Service::getContainer(); /** @var $platforminfo RokCommon_IPlatformInfo */ $platforminfo = $container->getService('platforminfo'); /** @var $model RokSprocket_Model_Edit */ $model = $container->getService('roksprocket.edit.model'); if (($id = $model->save($params)) === false) { throw new Exception($model->getLastError()); } $result->setPayload(array('redirect' => $platforminfo->getRootUrl() . '/wp-admin/admin.php?page=roksprocket-list')); return $result; } catch (Exception $e) { throw $e; } }
public static function getLoader() { $container = RokCommon_Service::getContainer(); /** @var $platforminfo RokCommon_IPlatformInfo */ $platforminfo = $container->platforminfo; $loader = false; $cache_loaders = $container->getParameter('classloader.cacheloaders'); foreach ($cache_loaders as $cache_type => $cache_loader) { if ($cache_loader->use && extension_loaded($cache_loader->extension)) { $cache_loader->prefix = $platforminfo->getInstanceId() . '-' . $cache_loader->prefix; $loader = $container->getService($cache_loader->service); break; } } if (!$loader) { $loader = $container->classloader_basicloader; } return $loader; }
/** * @param null|SimpleXMLElement $xmlnode * @param null $renderer */ function __construct(SimpleXMLElement &$xmlnode = null, $renderer = null) { parent::__construct(); $this->container = RokCommon_Service::getContainer(); $this->xmlnode = $xmlnode; if (null != $renderer) { $this->selectRenderer = $renderer; } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('CONCAT(cf.name, "||", cf.storage_field) AS value, cf.type, cf.options, cf.options2, CONCAT(ct.title, " - ", IF(ctf.label!="",ctf.label,cf.label)) AS title'); $query->from('#__cck_core_fields AS cf'); $query->join('LEFT', '#__cck_core_type_field AS ctf ON ctf.fieldid = cf.id'); $query->join('LEFT', '#__cck_core_types AS ct ON ct.id = ctf.typeid'); $query->join('LEFT', '#__cck_core AS c ON c.cck = ct.name'); $query->where('c.storage_location = "joomla_article"'); $query->where('cf.storage_table = "#__cck_core"'); $query->group('cf.id'); $query->order('cf.title ASC'); // Get the options. $db->setQuery($query); $items = $db->loadObjectList(); $this->selection_types = array(); $this->selection_labels = array(); $this->selection_options = array(); foreach ($items as $item) { if (array_key_exists($item->type, $this->class_mappings)) { $this->selection_types[$item->value] = $this->class_mappings[$item->type]; $this->selection_labels[$item->value] = $item->title; $this->selections[$item->value] = new $this->class_mappings[$item->type]($this->xmlnode); switch ($item->type) { case 'select_simple': case 'select_numeric': case 'select_dynamic': $this->selections[$item->value]->setSelectionOptions($this->getSelectFieldOptions($item)); $this->selections[$item->value]->setName($item->type); break; default: } } } }
/** * Delete the file and all associated rows (done by foreign keys) and files * $params object should be a json like * <code> * { * "pathsref": "roksprocket.providers.registered.joomla.path", * "file": "filters.xml" * } * </code> * * @param $params * * @throws #C\Exception|? * @throws RokSprocket_Exception * @return \RokCommon_Ajax_Result * * */ public function getFilters($params) { /* After everything fine, i'll handle via js and domready the call to filters ajax model Something along these lines: model: 'Filters', action: 'getData', params: JSON.encoded( [{ id1: {pathrefs: .., file: ..} }], [{ id2: {pathrefs: .., file: ..} }], [{ id3: {pathrefs: .., file: ..} }], ... ) */ $result = new RokCommon_Ajax_Result(); try { $container = RokCommon_Service::getContainer(); $filters = $params->filters; $output = array(); foreach ($filters as $filterid => $filter) { $filter_file = $container[$filter->pathsref] . '/' . $filter->file; if (!file_exists($filter_file)) { throw new RokSprocket_Exception(rc__('Unable to find filter file %s', $filter_file)); } $xmlfile = simplexml_load_file($filter_file); $outfilter = new RokCommon_Filter($xmlfile); $output[$filterid] = $outfilter->getJson(); } $result->setPayload(array('json' => $output)); } catch (Exception $e) { throw $e; } return $result; }
protected function getInput() { $container = RokCommon_Service::getContainer(); $empty_button_text = rc__('Add New Item'); if (isset($this->element['emptybuttontext'])) { $empty_button_text = rc__((string) $this->element['emptybuttontext']); } $html = array(); $classes = explode(' ', $this->element['class']); $classes[] = 'roksprocket-filters'; if (!is_array($this->value)) { $classes[] = 'empty'; } $classes = implode(' ', $classes); $html[] = '<ul class="' . $classes . '" data-additem="' . $this->id . '" data-additem-name="' . $this->name . '">'; $html[] = ' <li class="create-new"><div class="btn btn-primary" data-additem-action="addItem">' . $empty_button_text . '</div></li>'; $html[] = ' </ul>'; if ($this->element['notice'] && strlen($this->element['notice'])) { $html[] = '<div data-cookie="' . $this->id . '" class="roksprocket-filters-description alert alert-info"><a class="close" data-dismiss="alert">×</a>' . JText::_($this->element['notice']) . '</div>'; } return implode("\n", $html); }
/** * Method to get the field options for the list of installed editors. * * @return array The field option objects. * @since 11.1 */ protected function getOptions() { $container = RokCommon_Service::getContainer(); $fieldname = $this->element['name']; $configkey = (string) $this->element['configkey']; $options = array(); $params = $container[$configkey]; $params = get_object_vars($params); ksort($params); foreach ($params as $id => $info) { if (!in_array($id, self::$loaded_icons)) { $layout_composite_path = 'roksprocket_layout_' . $id; $priority = 0; foreach ($info->paths as $path) { RokCommon_Composite::addPackagePath($layout_composite_path, $path, $priority); $priority++; } $iconurl = RokCommon_Composite::get($layout_composite_path)->getUrl($info->icon); if (empty($iconurl)) { $iconurl = "components/com_roksprocket/assets/images/default_layout_icon.png"; } $css = sprintf('#module-form i.layout.%s {background-image: url(%s);background-position: 0 0;}', $id, $iconurl); RokCommon_Header::addInlineStyle($css); self::$loaded_icons[] = $id; } if ($this->value == $id) { $selected = ' selected="selected"'; } else { $selected = ""; } $tmp = JHtml::_('select.option', $id, $info->displayname); // Set some option attributes. $tmp->attr = array('class' => $id, 'rel' => $fieldname . '_' . $id); $tmp->icon = $fieldname . ' ' . $id; $options[] = $tmp; } reset($options); return $options; }