/** * Prepare the statuses of the items. * * @param array $data * @param array $options */ public function handle(&$data, array $options = array()) { foreach ($data as $key => $item) { // Calculate funding end date if (is_numeric($item->funding_days) and $item->funding_days > 0) { $fundingStartDate = new Crowdfunding\Date($item->funding_start); $endDate = $fundingStartDate->calculateEndDate($item->funding_days); $item->funding_end = $endDate->format(Prism\Constants::DATE_FORMAT_SQL_DATE); } // Calculate funded percentage. $item->funded_percents = (string) MathHelper::calculatePercentage($item->funded, $item->goal, 0); // Calculate days left $today = new Crowdfunding\Date(); $item->days_left = $today->calculateDaysLeft($item->funding_days, $item->funding_start, $item->funding_end); // Decode parameters. if ($item->params === null) { $item->params = '{}'; } if (is_string($item->params) and $item->params !== '') { $params = new Registry(); $params->loadString($item->params); $item->params = $params; } } }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params)) { // Convert the params field to an array. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->groups)) { // JSON Decode groups. $item->groups = json_decode($item->groups, true); } if (!empty($item->id)) { $item->tags = new JHelperTags(); $item->tags->getTagIds($item->id, 'com_componentbuilder.help_document'); } } return $item; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params)) { // Convert the params field to an array. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->template)) { // base64 Decode template. $item->template = base64_decode($item->template); } if (!empty($item->php_view)) { // base64 Decode php_view. $item->php_view = base64_decode($item->php_view); } if (!empty($item->id)) { $item->tags = new JHelperTags(); $item->tags->getTagIds($item->id, 'com_componentbuilder.template'); } } return $item; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params)) { // Convert the params field to an array. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->causesrisks)) { // JSON Decode causesrisks. $item->causesrisks = json_decode($item->causesrisks); } if (!empty($item->id)) { $item->tags = new JHelperTags(); $item->tags->getTagIds($item->id, 'com_costbenefitprojection.country'); } } $this->countryvvvy = $item->id; $this->countryvvvz = $item->id; $this->countryvvwa = $item->id; return $item; }
/** * Method to auto-populate the model state. * * @param string $ordering Field used for order by clause * @param string $direction Direction of order * * Note. Calling getState in this method will result in recursion. * */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $this->setState('filter.extension', $this->_extension); // Get the parent id if defined. $parent_id = $app->input->getInt('id'); $this->setState('filter.parentId', $parent_id); // Load the parameters. Merge Global and Menu Item params into new object $params = $app->getParams(); $menu_params = new Registry(); if ($menu = $app->getMenu()->getActive()) { $menu_params->loadString($menu->params); } $merged_params = clone $menu_params; $merged_params->merge($params); $this->setState('params', $merged_params); $params = $merged_params; $this->setState('filter.published', 1); $this->setState('filter.language', $app->getLanguageFilter()); // process show_category_noauth parameter if (!$params->get('show_category_noauth')) { $this->setState('filter.access', true); } else { $this->setState('filter.access', false); } }
/** * Get the component information. * * @param string $option The component option. * @param boolean $strict If set and the component does not exist, the enabled attribute will be set to false. * * @return stdClass An object with the information for the component. * * @since 1.5 */ public static function getComponent($option, $strict = false) { if (!isset(static::$components[$option])) { if (static::load($option)) { $result = static::$components[$option]; } else { $result = new stdClass; $result->enabled = $strict ? false : true; $result->params = new Registry; } } else { $result = static::$components[$option]; } if (is_string($result->params)) { $temp = new Registry; $temp->loadString(static::$components[$option]->params); static::$components[$option]->params = $temp; } return $result; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params)) { // Convert the params field to an array. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->interventions)) { // JSON Decode interventions. $item->interventions = json_decode($item->interventions); } if (!empty($item->id)) { $item->tags = new JHelperTags(); $item->tags->getTagIds($item->id, 'com_costbenefitprojection.intervention'); } } return $item; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params)) { // Convert the params field to an array. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->testcompanies)) { // JSON Decode testcompanies. $item->testcompanies = json_decode($item->testcompanies); } if (!empty($item->id)) { $item->tags = new JHelperTags(); $item->tags->getTagIds($item->id, 'com_costbenefitprojection.service_provider'); } } $this->service_providervvvx = $item->id; return $item; }
/** * Renders a module script and returns the results as a string * * @param mixed $module The name of the module to render * @param array $attribs Associative array of values * @param string $content If present, module information from the buffer will be used * * @return string The output of the script * * @since 11.1 */ public function render($module, $attribs = array(), $content = null) { if (!is_object($module)) { $title = isset($attribs['title']) ? $attribs['title'] : null; $module = JModuleHelper::getModule($module, $title); if (!is_object($module)) { if (is_null($content)) { return ''; } else { /** * If module isn't found in the database but data has been pushed in the buffer * we want to render it */ $tmp = $module; $module = new stdClass(); $module->params = null; $module->module = $tmp; $module->id = 0; $module->user = 0; } } } // Get the user and configuration object // $user = JFactory::getUser(); $conf = Factory::getConfig(); // Set the module content if (!is_null($content)) { $module->content = $content; } // Get module parameters $params = new Registry(); $params->loadString($module->params); // Use parameters from template if (isset($attribs['params'])) { $template_params = new Registry(); $template_params->loadString(html_entity_decode($attribs['params'], ENT_COMPAT, 'UTF-8')); $params->merge($template_params); $module = clone $module; $module->params = (string) $params; } $contents = ''; // Default for compatibility purposes. Set cachemode parameter or use JModuleHelper::moduleCache from within the // module instead $cachemode = $params->get('cachemode', 'oldstatic'); if ($params->get('cache', 0) == 1 && $conf->get('caching') >= 1 && $cachemode != 'id' && $cachemode != 'safeuri') { // Default to itemid creating method and workarounds on $cacheparams = new stdClass(); $cacheparams->cachemode = $cachemode; $cacheparams->class = 'JModuleHelper'; $cacheparams->method = 'renderModule'; $cacheparams->methodparams = array($module, $attribs); $contents = JModuleHelper::ModuleCache($module, $params, $cacheparams); } else { $contents = JModuleHelper::renderModule($module, $attribs); } return $contents; }
/** * Constructor * * @param DispatcherInterface &$subject The object to observe * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'group', 'params', 'language' * (this list is not meant to be comprehensive). * * @since 1.5 */ public function __construct(&$subject, $config = array()) { // Get the parameters. if (isset($config['params'])) { if ($config['params'] instanceof Registry) { $this->params = $config['params']; } else { $this->params = new Registry(); $this->params->loadString($config['params']); } } // Get the plugin name. if (isset($config['name'])) { $this->_name = $config['name']; } // Get the plugin type. if (isset($config['type'])) { $this->_type = $config['type']; } // Load the language files if needed. if ($this->autoloadLanguage) { $this->loadLanguage(); } if (property_exists($this, 'app')) { $reflection = new ReflectionClass($this); $appProperty = $reflection->getProperty('app'); if ($appProperty->isPrivate() === false && is_null($this->app)) { $this->app = JFactory::getApplication(); } } if (property_exists($this, 'db')) { $reflection = new ReflectionClass($this); $dbProperty = $reflection->getProperty('db'); if ($dbProperty->isPrivate() === false && is_null($this->db)) { $this->db = JFactory::getDbo(); } } // Set the dispatcher we are to register our listeners with $this->setDispatcher($subject); // Register the event listeners with the dispatcher. Override the registerListeners method to customise. $this->registerListeners(); }
/** * Retrieve the detail record for the current $id if the data has not already been loaded. * * @author Max Milbers */ function getItem($id = 0) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*')->from('#__tsmart_general'); $item = $db->setQuery($query)->loadObject(); $params = new Registry(); $params->loadString($item->params); $item->params = $params; return $item; }
function getParams() { $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('params')->from('#__extensions')->where('enabled = 1')->where('type =' . $db->quote('plugin'))->where('folder =' . $db->quote('kmplugins'))->where('element =' . $db->quote('modules')); $db_params = $db->setQuery($query)->loadResult(); $params = new Registry(); if (!empty($db_params)) { $params->loadString($db_params); } return $params; }
/** * Constructor * * @param object &$subject The object to observe * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'group', 'params', 'language' * (this list is not meant to be comprehensive). * * @since 11.1 */ public function __construct(&$subject, $config = array()) { // Get the parameters. if (isset($config['params'])) { if ($config['params'] instanceof Registry) { $this->params = $config['params']; } else { $this->params = new Registry(); $this->params->loadString($config['params']); } } // Get the plugin name. if (isset($config['name'])) { $this->_name = $config['name']; } // Get the plugin type. if (isset($config['type'])) { $this->_type = $config['type']; } parent::__construct($subject); }
/** * Constructor * * @param object &$subject The object to observe * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'group', 'params', 'language' * (this list is not meant to be comprehensive). * * @since 1.5 */ public function __construct(&$subject, $config = array()) { // Get the parameters. if (isset($config['params'])) { if ($config['params'] instanceof Registry) { $this->params = $config['params']; } else { $this->params = new Registry(); $this->params->loadString($config['params']); } } // Get the plugin name. if (isset($config['name'])) { $this->_name = $config['name']; } // Get the plugin type. if (isset($config['type'])) { $this->_type = $config['type']; } // Load the language files if needed. if ($this->autoloadLanguage) { $this->loadLanguage(); } if (property_exists($this, 'app')) { $reflection = new ReflectionClass($this); $appProperty = $reflection->getProperty('app'); if ($appProperty->isPrivate() === false && is_null($this->app)) { $this->app = JFactory::getApplication(); } } if (property_exists($this, 'db')) { $reflection = new ReflectionClass($this); $dbProperty = $reflection->getProperty('db'); if ($dbProperty->isPrivate() === false && is_null($this->db)) { $this->db = JFactory::getDbo(); } } parent::__construct($subject); }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params)) { // Convert the params field to an array. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->php_after_getitem)) { // base64 Decode php_after_getitem. $item->php_after_getitem = base64_decode($item->php_after_getitem); } if (!empty($item->php_before_getitems)) { // base64 Decode php_before_getitems. $item->php_before_getitems = base64_decode($item->php_before_getitems); } if (!empty($item->php_before_getitem)) { // base64 Decode php_before_getitem. $item->php_before_getitem = base64_decode($item->php_before_getitem); } if (!empty($item->php_getlistquery)) { // base64 Decode php_getlistquery. $item->php_getlistquery = base64_decode($item->php_getlistquery); } if (!empty($item->php_after_getitems)) { // base64 Decode php_after_getitems. $item->php_after_getitems = base64_decode($item->php_after_getitems); } if (!empty($item->php_calculation)) { // base64 Decode php_calculation. $item->php_calculation = base64_decode($item->php_calculation); } if (!empty($item->php_custom_get)) { // base64 Decode php_custom_get. $item->php_custom_get = base64_decode($item->php_custom_get); } if (!empty($item->id)) { $item->tags = new JHelperTags(); $item->tags->getTagIds($item->id, 'com_componentbuilder.dynamic_get'); } } return $item; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { // Convert the images field to an array. $registry = new Registry(); $registry->loadString($item->images); $item->images = $registry->toArray(); //Convert the sensors field to an array $registry = new Registry(); $registry->loadString($item->sensors); $item->sensors = $registry->toArray(); } return $item; }
/** * Get component params. * * @return Registry */ public function getParams() { if ($this->params) { return $this->params; } $app = $this->getContainer()->get('app'); $comParams = ExtensionHelper::getParams($this->option); $menuParams = new Registry(); if ($menu = $app->getMenu()->getActive()) { $menuParams->loadString($menu->params); } $menuParams->merge($comParams); return $this->params = $menuParams; }
/** * Class constructor * * @param array $options An array of configuration options. * * @since 1.5 */ public function __construct($options = array()) { // Load the menu items $this->load(); foreach ($this->_items as $item) { if ($item->home) { $this->_default[trim($item->language)] = $item->id; } // Decode the item params $result = new Registry(); $result->loadString($item->params); $item->params = $result; } }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise an Error object. */ public function display($tpl = null) { $this->commonCategoryDisplay(); // Prepare the data. // Compute the newsfeed slug. foreach ($this->items as $item) { $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $temp = new Registry(); $temp->loadString($item->params); $item->params = clone $this->params; $item->params->merge($temp); } return parent::display($tpl); }
/** * Redefine the function and add some properties to make the styling more easy * * @return mixed An array of data items 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 (!count($items)) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); $params = new Registry(); if ($active) { $params->loadString($active->params); } } return $items; }
/** * Class constructor * * @param array $options An array of configuration options. * * @since 1.5 */ public function __construct($options = array()) { // Load the menu items $this->load(); foreach ($this->_items as $item) { if ($item->home) { $this->_default[trim($item->language)] = $item->id; } // Decode the item params $result = new Registry(); $result->loadString($item->params); $item->params = $result; } $this->user = isset($options['user']) && $options['user'] instanceof JUser ? $options['user'] : JFactory::getUser(); }
/** * Method to get a list of items. * * @return mixed An array of objects on success, false on failure. */ public function getItems() { // Invoke the parent getItems method to get the main list $items = parent::getItems(); // Convert the params field into an object, saving original in _params for ($i = 0, $n = count($items); $i < $n; $i++) { $item =& $items[$i]; if (!isset($this->_params)) { $params = new Registry(); $params->loadString($item->params); $item->params = $params; } } return $items; }
/** * Method to display the view. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed Exception on failure, void on success. * * @since 1.6 */ public function display($tpl = null) { $app = JFactory::getApplication(); $params = $app->getParams(); // Get some data from the models $state = $this->get('State'); $items = $this->get('Items'); $category = $this->get('Category'); $children = $this->get('Children'); $parent = $this->get('Parent'); $pagination = $this->get('Pagination'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } // Prepare the data. // Compute the contact slug. for ($i = 0, $n = count($items); $i < $n; $i++) { $item =& $items[$i]; $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $temp = new Registry(); $temp->loadString($item->params); $item->params = clone $params; $item->params->merge($temp); if ($item->params->get('show_email', 0) == 1) { $item->email_to = trim($item->email_to); if (!empty($item->email_to) && JMailHelper::isEmailAddress($item->email_to)) { $item->email_to = JHtml::_('email.cloak', $item->email_to); } else { $item->email_to = ''; } } } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'), ENT_COMPAT, 'UTF-8'); $maxLevel = $params->get('maxLevel', -1); $this->maxLevel =& $maxLevel; $this->state =& $state; $this->items =& $items; $this->category =& $category; $this->children =& $children; $this->params =& $params; $this->parent =& $parent; $this->pagination =& $pagination; $this->_prepareDocument(); return parent::display($tpl); }
/** * Display function * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed * * @since 1.7.2 */ public function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $state = $this->get('State'); $items = $this->get('Items'); $this->return = $this->get('ReturnPage'); // Get the parameters $params = JComponentHelper::getParams('com_churchdirectory'); $params->merge($state->params); // Check for errors. if (count($errors = $this->get('Errors'))) { $app->enqueueMessage(implode("\n", $errors), 'error'); return false; } $document = JFactory::getDocument(); $renderer = $document->loadRenderer('module'); $mod_params = ['style' => 'xhtml']; $contents = ''; $mod = JModuleHelper::getModule('mod_finder'); $registry = new Registry; $registry->loadString($mod->params); $registry->set('searchfilter', 'paramvalue'); $registry->set('show_advanced', '0'); $registry->set('opensearch', '1'); $registry->set('set_itemid', $app->input->getInt('Itemid')); $registry->set('size-lbl', '12'); $registry->set('show_button', '1'); $registry->set('button_pos', 'right'); $mod->params = (string) $registry; $contents .= $renderer->render($mod, $mod_params); $this->search = $contents; $this->renderHelper = new ChurchDirectoryRenderHelper; $this->params = & $params; $this->user = & $user; $this->items = & $items; $this->prepareDocument(); return parent::display($tpl); }
/** * Method to auto-populate the model state. * Note. Calling getState in this method will result in recursion. * * @param string $ordering ? * @param string $direction ? * * @return void * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_churchdirectory'); // List state information $format = $app->input->getWord('format', ''); if ($format == 'feed') { $limit = $app->get('feed_limit'); } else { $limit = 0; } $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $limitstart); // Get list ordering default from the parameters $menuParams = new Registry(); if ($menu = $app->getMenu()->getActive()) { $menuParams->loadString($menu->params); } $mergedParams = clone $params; $mergedParams->merge($menuParams); $orderCol = $app->input->get('filter_order', $mergedParams->get('dinitial_sort', 'ordering')); $this->setState('list.ordering', $orderCol); $listOrder = $app->input->get('filter_order_Dir', 'ASC'); if (!in_array(strtoupper($listOrder), ['ASC', 'DESC', ''])) { $listOrder = 'ASC'; } $this->setState('list.direction', $listOrder); $id = $app->input->get('id', 0, 'int'); $this->setState('category.id', $id); $user = JFactory::getUser(); if (!$user->authorise('core.edit.state', 'com_churchdirectory') && !$user->authorise('core.edit', 'com_churchdirectory')) { // Limit to published for people who can't edit or edit.state. $this->setState('filter.published', 1); // Filter by start and end dates. $this->setState('filter.publish_date', true); } $mstatus = $app->input->get('filter_mstatus', $mergedParams->get('mstatus', '0')); $this->setState('filter.mstatus', $mstatus); $order = $app->input->get('filter_order', $mergedParams->get('order', 'a.id')); $this->setState('filter.order', $order); // Load the parameters. $this->setState('params', $params); }
/** * Method to load a User object by user id number. * * @param mixed $identifier The user id of the user to load. * * @return $this Method allows chaining * * @since 1.0 * @throws \RuntimeException */ protected function load($identifier) { // Create the user table object $table = new TableUsers($this->database); // Load the User object based on the user id or throw a warning. if (!$table->load($identifier)) { throw new \RuntimeException('Unable to load the user with id: ' . $identifier); } // Assuming all is well at this point let's bind the data foreach ($table->getFields() as $key => $value) { if (isset($this->{$key}) && $key != 'params') { $this->{$key} = $table->{$key}; } } $this->params->loadString($table->params); $this->loadAccessGroups(); return $this; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params)) { // Convert the params field to an array. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->xml)) { // JSON Decode xml. $item->xml = json_decode($item->xml); } if (!empty($item->css_view)) { // base64 Decode css_view. $item->css_view = base64_decode($item->css_view); } if (!empty($item->css_views)) { // base64 Decode css_views. $item->css_views = base64_decode($item->css_views); } if (!empty($item->javascript_view_footer)) { // base64 Decode javascript_view_footer. $item->javascript_view_footer = base64_decode($item->javascript_view_footer); } if (!empty($item->javascript_views_footer)) { // base64 Decode javascript_views_footer. $item->javascript_views_footer = base64_decode($item->javascript_views_footer); } if (!empty($item->id)) { $item->tags = new JHelperTags(); $item->tags->getTagIds($item->id, 'com_componentbuilder.field'); } } return $item; }
/** * 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 */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JFactory::getApplication('site'); $jinput = $app->input; $params = $app->getParams(); $menuParams = new Registry(); if ($menu = $app->getMenu()->getActive()) { $menuParams->loadString($menu->params); } $mergedParams = clone $menuParams; $mergedParams->merge($params); $this->setState('params', $mergedParams); // Optional filter text $this->setState('list.filter', $jinput->getString('filter-search')); $value = $app->input->get('limit', $app->get('list_limit', 0), 'uint'); $this->setState('list.limit', $value); $value = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $value); }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 1.7.0 */ protected function getInput() { // Initialize variables. $html = ''; $attr = ''; // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : ''; $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; // Get some field values from the form. $memberId = (int) $this->form->getValue('id'); $categoryId = (int) $this->form->getValue('catid'); $funitid = (int) $this->form->getValue('funitid'); // Build the query for the ordering list. $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id, name, funitid, attribs, spouse')->from('#__churchdirectory_details')->where('catid = ' . (int) $categoryId)->where('published = 1')->where('funitid = ' . (int) $funitid); $db->setQuery($query); $results = $db->loadObjectList(); foreach ($results as $item) { $registry = new Registry(); $registry->loadString($item->attribs); // Todo Need to fix this. Bcc; $family_position = $registry->get('familypostion'); $item = (object) array_merge((array) $item, (array) $family_position); if ($item->funitid != '0' && $item->id != $memberId) { $link = 'index.php?option=com_churchdirectory&task=member.edit&id=' . (int) $item->id . '&tmpl=component&layout=modal'; $html = '<h4> <a class="btn btn-primary" onclick="SqueezeBox.fromElement(this, {handler:\'iframe\', size: {x: 900, y: 550}, url:\'' . $link . '\'})" title="' . $item->name . '">'; $html .= $db->escape($item->name); $html .= '</a>'; } elseif ($item->funitid <= '0' && $item->id == $memberId) { $html = '<h4>Old Record: ' . $item->spouse . '</h4>'; } } return $html; }
/** * Method to get a single record. * * @param integer $pk The id of the primary key. * * @return mixed Object on success, false on failure. * * @since 1.6 */ public function getItem($pk = null) { if ($item = parent::getItem($pk)) { if (!empty($item->params)) { // Convert the params field to an array. $registry = new Registry(); $registry->loadString($item->params); $item->params = $registry->toArray(); } if (!empty($item->metadata)) { // Convert the metadata field to an array. $registry = new Registry(); $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); } if (!empty($item->id)) { $item->tags = new JHelperTags(); $item->tags->getTagIds($item->id, 'com_demo.look'); } } return $item; }