/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); # it's needed to set the parent option parent::populateState('a.dates', 'asc'); }
public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('id', 'a.id', 'lno', 'a.lno', 'labname', 'labname', 'pic', 'a.pic', 'state', 'a.state', 'admin', 'a.admin', 'phone', 'a.phone', 'description', 'a.description'); } parent::__construct($config); }
/** * Returns an object list * * @param string The query * @param int Offset * @param int The number of records * @return array */ protected function _getList($query, $limitstart = 0, $limit = 0) { $ordering = $this->getState('list.ordering'); $search = $this->getState('filter.search'); // Replace slashes so preg_match will work $search = str_replace('/', ' ', $search); $db = $this->getDbo(); if ($ordering == 'name' || !empty($search) && stripos($search, 'id:') !== 0) { $db->setQuery($query); $result = $db->loadObjectList(); $lang = JFactory::getLanguage(); $this->translate($result); if (!empty($search)) { foreach ($result as $i => $item) { if (!preg_match("/{$search}/i", $item->name)) { unset($result[$i]); } } } JArrayHelper::sortObjects($result, $this->getState('list.ordering'), $this->getState('list.direction') == 'desc' ? -1 : 1, true, $lang->getLocale()); $total = count($result); $this->cache[$this->getStoreId('getTotal')] = $total; if ($total < $limitstart) { $limitstart = 0; $this->setState('list.start', 0); } return array_slice($result, $limitstart, $limit ? $limit : null); } else { $query->order($db->quoteName($ordering) . ' ' . $this->getState('list.direction')); $result = parent::_getList($query, $limitstart, $limit); $this->translate($result); return $result; } }
public function __construct(array $config) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('name', 'brand', 'diameter', 'density', 'number'); } parent::__construct($config); }
public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('id', 'businessName'); } parent::__construct($config); }
public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('name', 'f.name', 'id', 'f.id', 'label', 'f.label', 'label', 'f.label', 'tooltip', 'f.tooltip', 'type', 'f.type', 'in_search', 'f.in_search', 'search_type', 'f.search_type', 'published', 'f.published'); } parent::__construct($config); }
/** * Constructor. * * @param array An optional associative array of configuration settings. * @see JController */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('file_id', 'a.file_id', 'file_title', 'a.file_title', 'file_alias', 'a.file_alias', 'description, a.description', 'description_long', 'a.description_long', 'file_pic', 'a.file_pic', 'images', 'a.images', 'price', 'a.price', 'release', 'a.release', 'file_language', 'a.file_language', 'system', 'a.system', 'license', 'a.license', 'url_license', 'a.url_license', 'size', 'a.size', 'date_added', 'a.date_added', 'file_date', 'a.file_date', 'publish_from', 'a.publish_from', 'publish_to', 'a.publish_to', 'use_timeframe', 'a.use_timeframe', 'url_download', 'a.url_download', 'preview_filename', 'a.preview_filename', 'other_file_id', 'a.other_file_id', 'md5_value', 'a.md5_value', 'sha1_value', 'a.sha1_value', 'extern_file', 'a.extern_file', 'extern_site', 'a.extern_site', 'mirror_1', 'a.mirror_1', 'mirror_2', 'a.mirror_2', 'extern_site_mirror-1', 'a.extern_site_mirror_1', 'extern_site_mirror_2', 'a.extern_site_mirror_2', 'url_home', 'a.url_home', 'author', 'a.author', 'url_author', 'a.url_author', 'created_id', 'a.created_id', 'created_mail', 'a.created_mail', 'modified_id', 'a.modified_id', 'modified_date', 'a.modified_date', 'submitted_by', 'a.submitted_by', 'set_aup_points', 'a.set_aup_points', 'downloads', 'a.downloads', 'cat_id', 'a.cat_id', 'category_title', 'changelog', 'a.changelog', 'password', 'a.password', 'password_md5', 'a.password_md5', 'views', 'a.views', 'metakey', 'a.metakey', 'metadesc', 'a.metadesc', 'robots', 'a.robots', 'update_active', 'a.update_active', 'custom_field_1', 'a.custom_field_1', 'custom_field_2', 'a.custom_field_2', 'custom_field_3', 'a.custom_field_3', 'custom_field_4', 'a.custom_field_4', 'custom_field_5', 'a.custom_field_5', 'custom_field_6', 'a.custom_field_6', 'custom_field_7', 'a.custom_field_7', 'custom_field_8', 'a.custom_field_8', 'custom_field_9', 'a.custom_field_9', 'custom_field_10', 'a.custom_field_10', 'custom_field_11', 'a.custom_field_11', 'custom_field_12', 'a.custom_field_12', 'custom_field_13', 'a.custom_field_13', 'custom_field_14', 'a.custom_field_14', 'access', 'a.access', 'access_level', 'language', 'a.language', 'ordering', 'a.ordering', 'published', 'a.published', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time'); } parent::__construct($config); }
protected function _getList($query, $limitstart = 0, $limit = 0) { $ordering = $this->getState('list.ordering', 'ordering'); if (in_array($ordering, array('pages', 'name'))) { $this->_db->setQuery($query); $result = $this->_db->loadObjectList(); $this->translate($result); $lang = JFactory::getLanguage(); JArrayHelper::sortObjects($result, $ordering, $this->getState('list.direction') == 'desc' ? -1 : 1, true, $lang->getLocale()); $total = count($result); $this->cache[$this->getStoreId('getTotal')] = $total; if ($total < $limitstart) { $limitstart = 0; $this->setState('list.start', 0); } return array_slice($result, $limitstart, $limit ? $limit : null); } else { if ($ordering == 'ordering') { $query->order('position ASC'); } $query->order($this->_db->quoteName($ordering) . ' ' . $this->getState('list.direction')); if ($ordering == 'position') { $query->order('ordering ASC'); } $result = parent::_getList($query, $limitstart, $limit); $this->translate($result); return $result; } }
public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array(); } parent::__construct($config); }
/** * Method to get an array of data items. * * @return array An array of data items * * @since 12.2 */ public function getItems() { JDeveloperLoader::import("archive"); $extension = JTable::getInstance("Extension", "JTable"); // Get a storage key. $store = $this->getStoreId('getItems'); // Load the list items. $items = parent::getItems(); // Add information foreach ($items as $item) { // Is Component already installed? $item->createDir = JDeveloperArchive::getArchiveDir() . "/" . JDeveloperArchive::getArchiveName("mod_", $item->name, $item->version); $item->installed = JDeveloperInstall::isInstalled("module", "mod_" . $item->name); if ($item->installed) { $extension->load(array("name" => "mod_" . $item->name, "type" => "module")); $item->enabled = (bool) $extension->enabled; } else { $item->enabled = false; } } // If emtpy or an error, just return. if (empty($items)) { return array(); } // Add the items to the internal cache. $this->cache[$store] = $items; return $this->cache[$store]; }
/** * Autopopulate the model */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication('administrator'); $data = JRequest::getVar('filters'); if (empty($data)) { $data = array(); $data['select'] = $app->getUserState('com_localise.select'); $data['search'] = $app->getUserState('com_localise.translations.search'); } else { $app->setUserState('com_localise.select', $data['select']); $app->setUserState('com_localise.translations.search', isset($data['search']) ? $data['search'] : ''); } $this->setState('filter.search', isset($data['search']['expr']) ? $data['search']['expr'] : ''); $this->setState('filter.storage', isset($data['select']['storage']) ? $data['select']['storage'] : ''); $this->setState('filter.origin', isset($data['select']['origin']) ? $data['select']['origin'] : ''); $this->setState('filter.state', isset($data['select']['state']) ? $data['select']['state'] : ''); $this->setState('filter.type', isset($data['select']['type']) ? $data['select']['type'] : ''); $this->setState('filter.client', isset($data['select']['client']) ? $data['select']['client'] : ''); $this->setState('filter.tag', isset($data['select']['tag']) ? $data['select']['tag'] : ''); $params = JComponentHelper::getParams('com_localise'); $this->setState('params', $params); $reference = $params->get('reference', 'en-GB'); $this->setState('translations.reference', $reference); // Call auto-populate parent method parent::populateState('filename', 'asc'); }
/** * Method to get a list of items. * * @return mixed An array of objects on success, false on failure. */ public function getItems() { // Get the list of items from the database. $items = parent::getItems(); $client = JApplicationHelper::getClientInfo($this->getState('stfilter.client_id', 0)); $lang = JFactory::getLanguage(); // Loop through the results to add the XML metadata, // and load language support. foreach ($items as &$item) { $path = JPath::clean($client->path . '/modules/' . $item->module . '/' . $item->module . '.xml'); if (file_exists($path)) { $item->xml = simplexml_load_file($path); } else { $item->xml = null; } // 1.5 Format; Core files or language packs then // 1.6 3PD Extension Support $lang->load($item->module . '.sys', $client->path, null, false, true) || $lang->load($item->module . '.sys', $client->path . '/modules/' . $item->module, null, false, true); $item->name = JText::_($item->name); if (isset($item->xml) && ($text = trim($item->xml->description))) { $item->desc = JText::_($text); } else { $item->desc = JText::_('COM_MODULES_NODESCRIPTION'); } } $items = JArrayHelper::sortObjects($items, 'name', 1, true, true); // TODO: Use the cached XML from the extensions table? return $items; }
protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.category'); return parent::getStoreId($id); }
/** * Constructor. * * @param array An optional associative array of configuration settings. * @see JControllerLegacy */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('id', 'a.id', 'tdate', 'a.tdate', 'sport', 's.sport', 'method', 'a.method', 'description', 'a.description', 'comment', 'a.comment', 'location', 'a.location'); } parent::__construct($config); }
/** * Constructor * * @param array $config An optional associative array of configuration settings. */ public function __construct($config = array()) { if (empty($config["filter_fields"])) { $config["filter_fields"] = array("id", "a.id", "date", "a.date", "exported", "a.exported"); } parent::__construct($config); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JFactory::getApplication(); $filters = JRequest::getVar('filters'); if (empty($filters)) { $data = $app->getUserState($this->_context . '.data'); $filters = $data['filters']; } else { $app->setUserState($this->_context . '.data', array('filters' => $filters)); } $this->setState('message', $app->getUserState('com_installer.message')); $this->setState('extension_message', $app->getUserState('com_installer.extension_message')); $app->setUserState('com_installer.message', ''); $app->setUserState('com_installer.extension_message', ''); // Recall the 'Install from Directory' path. $path = $app->getUserStateFromRequest($this->_context . '.install_directory', 'install_directory', $app->getCfg('tmp_path')); $this->setState('install.directory', $path); $this->setState('filter.type', isset($filters['type']) ? $filters['type'] : ''); if (!isset($filters['update_site_id'])) { JRequest::setVar('update_site_id', '2'); } $this->setState('filter.update_site_id', isset($filters['update_site_id']) ? $filters['update_site_id'] : '2'); $this->setState('filter.folder', isset($filters['folder']) ? $filters['folder'] : ''); $this->setState('filter.search', isset($filters['search']) ? $filters['search'] : ''); parent::populateState('a.name', 'asc'); }
/** * Filters */ protected function getStoreId($id = '') { $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); $id .= ':' . $this->getState('filter.language'); return parent::getStoreId($id); }
protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); // Load the filter state. $search = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); //Omit double (white-)spaces and set state $this->setState('filter.search', preg_replace('/\\s+/', ' ', $search)); //Filter (dropdown) tshirt-size $tshirtsizes = $app->getUserStateFromRequest($this->context . '.filter.tshirt_size', 'filter_tshirtsize', '', 'string'); $this->setState('filter.tshirt_size', $tshirtsizes); //Filter (dropdown) tshirt-size $campingPlace = $app->getUserStateFromRequest($this->context . '.filter.campingPlace', 'filter_campingPlace', '', 'int'); $this->setState('filter.campingPlace', $campingPlace); //Filter (dropdown) service $services = $app->getUserStateFromRequest($this->context . '.filter.services_members', 'filter_services_members', '', 'string'); $this->setState('filter.services_members', $services); // Get pagination request variables $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'string'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); parent::populateState('lastname', 'ASC'); }
/** * Display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a Error object. * * @since 1.0.0 */ public function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->params = $this->state->get('params'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // Get payment methods. $paymentMethods = CMDonationHelper::getPaymentMethods(); // Get campaigns. $campaigns = JModelList::getInstance('Campaigns', 'CMDonationModel')->getCampaignsForFilter(); // Build campaign options for filter and index for displaying campaign name. $campaignOptions = array(); $campaignIndex = array(); if (!empty($campaigns)) { foreach ($campaigns as $campaign) { $campaignOptions[] = JHtml::_('select.option', $campaign->id, htmlspecialchars($campaign->name)); $campaignIndex[$campaign->id] = $campaign->name; } } $this->assignRef('paymentMethods', $paymentMethods); $this->assignRef('campaigns', $campaigns); $this->assignRef('campaignOptions', $campaignOptions); $this->assignRef('campaignIndex', $campaignIndex); $this->submenu = CMDonationHelper::addSubmenu('donations'); $this->addToolbar(); parent::display($tpl); }
protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication('administrator'); $filterSearch = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', ''); $this->setState('filter.search', $filterSearch); parent::populateState('name', 'asc'); }
protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $this->setState($this->context . '.filter.search', $app->getUserStateFromRequest($this->context . '.fields.search', 'filter_search')); $this->setState($this->context . '.filter.filter_state', $app->getUserStateFromRequest($this->context . '.fields.filter_state', 'filter_state')); parent::populateState('ordering', 'ASC'); }
public function getItems() { $result = parent::getItems(); if (is_array($result) && !empty($result[0])) { $item = $result[0]; // Get comprehension info $item->comprenhensions = $this->_getComprehensionInfos($item->id); // Get compositions info $item->compositions = $this->_getCompositionInfos($item->id); // Get precises info $item->precises = $this->_getPrecisInfos($item->id); // Get grammar info $item->grammars = $this->_getGrammarInfos($item->id); // Get usage info $item->usages = $this->_getUsageInfos($item->id); // Get exercise info $item->exercises = $this->_getExerciseInfo($item->id); $displayType = 0; if (!empty($item->comprenhensions) && count($item->comprenhensions)) { $displayType &= 1; } if (!empty($item->compositions) && count($item->compositions) > 0) { $displayType &= 1; } $result = $item; } return $result; }
public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('id', 'a.id', 'title', 'a.title', 'state', 'a.state', 'company', 'a.company', 'image', 'a.image', 'url', 'a.url', 'phone', 'a.phone', 'description', 'a.description', 'ordering', 'a.ordering'); } parent::__construct($config); }
public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('id', 'a.id', 'title', 'a.title', 'ordering', 'a.ordering'); } parent::__construct($config); }
/** * Method to get a list of items for a list of tags. * * @return mixed An array of objects on success, false on failure. * * @since 3.1 */ public function getItems() { // Invoke the parent getItems method to get the main list $items = parent::getItems(); if (!empty($items)) { foreach ($items as $item) { $explodedTypeAlias = explode('.', $item->type_alias); $item->link = 'index.php?option=' . $explodedTypeAlias[0] . '&view=' . $explodedTypeAlias[1] . '&id=' . $item->content_item_id . ':' . $item->core_alias; // Get display date switch ($this->state->params->get('tag_list_show_date')) { case 'modified': $item->displayDate = $item->core_modified_time; break; case 'created': $item->displayDate = $item->core_created_time; break; default: case 'published': $item->displayDate = $item->core_publish_up == 0 ? $item->core_created_time : $item->core_publish_up; break; } } return $items; } else { return false; } }
/** * Method to auto-populate the model state. * * @Note. Calling getState in this method will result in recursion. * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); // List state information. parent::populateState('table', 'asc'); }
/** * Constructor. * * @param array An optional associative array of configuration settings. * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('id', 'a.id', 'title', 'a.title', 'alias', 'a.alias', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', 'catid', 'a.catid', 'category_title', 'state', 'a.state', 'access', 'a.access', 'access_level', 'created', 'a.created', 'created_by', 'a.created_by', 'modified', 'a.modified', 'ordering', 'a.ordering', 'featured', 'a.featured', 'language', 'a.language', 'hits', 'a.hits', 'publish_up', 'a.publish_up', 'publish_down', 'a.publish_down', 'author', 'a.author'); } parent::__construct($config); }
protected function populateState($ordering = null, $direction = null) { parent::populateState(); $app = JFactory::getApplication(); $id = JRequest::getVar('id', 0, '', 'int'); $this->setState('airports.id', $id); // Load the filter state. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_search'); $this->setState('filter.state', $state); $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int'); $this->setState('filter.level', $level); $country_id = $this->getUserStateFromRequest($this->context . '.filter.country_id', 'filter_country_id', 0, 'int'); $this->setState('filter.country_id', $country_id); $app = JFactory::getApplication(); $value = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit')); $limit = $value; $this->setState('list.limit', $limit); $value = $app->getUserStateFromRequest($this->context . '.limitstart', 'limitstart', 0); $limitstart = $limit != 0 ? floor($value / $limit) * $limit : 0; $this->setState('list.start', $limitstart); $value = $app->getUserStateFromRequest($this->context . '.ordercol', 'filter_order', $ordering); $this->setState('list.ordering', $value); $value = $app->getUserStateFromRequest($this->context . '.orderdirn', 'filter_order_Dir', $direction); $this->setState('list.direction', $value); parent::populateState('a.lft', 'asc'); }
/** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. * @return string A store id. */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); return parent::getStoreId($id); }
/** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array('id', 'name', 'published'); } parent::__construct($config); }