/** * * Get data * @param Array $pk */ public function &prepareDisplayedData($pk) { $data = null; $JSNConfig = JSNFactory::getConfig(); $params = $JSNConfig->getMenuParams($pk['Itemid']); $JSNConfig->megreGlobalParams('com_content', $params); $items = $this->getItems(); $pagination = $this->getPagination(); foreach ($items as $item) { $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid; $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id; } $form = new stdClass(); // Month Field $months = array('' => JText::_('COM_CONTENT_MONTH'), '01' => JText::_('JANUARY_SHORT'), '02' => JText::_('FEBRUARY_SHORT'), '03' => JText::_('MARCH_SHORT'), '04' => JText::_('APRIL_SHORT'), '05' => JText::_('MAY_SHORT'), '06' => JText::_('JUNE_SHORT'), '07' => JText::_('JULY_SHORT'), '08' => JText::_('AUGUST_SHORT'), '09' => JText::_('SEPTEMBER_SHORT'), '10' => JText::_('OCTOBER_SHORT'), '11' => JText::_('NOVEMBER_SHORT'), '12' => JText::_('DECEMBER_SHORT')); $form->monthField = JHtml::_('select.genericlist', $months, 'month', array('list.attr' => 'size="1" class="inputbox"', 'list.select' => $this->getState('filter.month'), 'option.key' => null)); // Year Field $years = array(); $years[] = JHtml::_('select.option', null, JText::_('JYEAR')); for ($i = 2000; $i <= 2020; $i++) { $years[] = JHtml::_('select.option', $i, $i); } $form->yearField = JHtml::_('select.genericlist', $years, 'year', array('list.attr' => 'size="1" class="inputbox"', 'list.select' => $this->getState('filter.year'))); $form->limitField = $pagination->getLimitBox(); //Escape strings for HTML output $data->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $data->filter = $this->getState('list.filter'); $data->form = $form; $data->items = $items; $data->params = $params; $data->pagination = $pagination; return $data; }
public function getItems($pk) { if (!count($this->_items)) { $app = JFactory::getApplication(); $menu = $app->getMenu(); $active = $menu->getActive(); $this->params = $params = $this->getState('params'); if ($active) { $params->loadString($active->params); } $options = array(); $options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0); $categories = JCategories::getInstance('Contact', $options); $this->_parent = $categories->get($pk['id']); $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact'); $JSNConfig->megreGlobalParams('com_contact', $this->params, true); if (is_object($this->_parent)) { $this->_items = $this->_parent->getChildren(); } else { $this->_items = false; } } return $this->_items; }
/** * * Get data * @param Array $pk */ public function &prepareDisplayedData($pk) { $parentId = JRequest::getInt('id'); $this->setState('filter.parentId', $pk['id']); $data = null; $state = $this->getState(); $items = $this->getItems($pk); $parent = $this->getParent(); if ($items === false) { echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND'); return; } if ($parent == false) { echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND'); return; } $params =& $state->params; $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $params); $JSNConfig->megreGlobalParams('com_weblinks', $params, true); $items = array($parent->id => $items); // //Escape strings for HTML output $data->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $data->maxLevelcat = $params->get('maxLevelcat', -1); $data->params = $params; $data->parent = $parent; $data->items = $items; return $data; }
/** * * Get data * @param Array $pk */ public function prepareDisplayedData($pk) { $data = null; $params = $this->getState('params'); // Get some data from the models $state = $this->getState(); $items = $this->getItems(); $pagination = $this->getPagination(); for ($i = 0, $n = count($items); $i < $n; $i++) { $item =& $items[$i]; $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $temp = new JRegistry(); $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 = $item->email_to; } else { $item->email_to = ''; } } } $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact'); $JSNConfig->megreGlobalParams('com_contact', $params, true); $maxLevel = $params->get('maxLevel', -1); $data->maxLevel = $maxLevel; $data->state = $state; $data->items = $items; $data->params = $params; $data->pagination = $pagination; return $data; }
/** * * Get data * * @param Array $pk */ public function prepareDisplayedData($pk) { $data = null; jimport('joomla.application.categories'); $this->setState('category.id', $pk['id']); $params = $this->getState('params'); // Get some data from the models $state = $this->getState(); $items = $this->getItems(); $category = $this->getCategory(); $children = $this->getChildren(); $parent = $this->getParent(); $pagination = $this->getPagination(); // Check for errors. if ($category == false) { echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND'); } if ($parent == false) { echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND'); } // 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 JRegistry(); $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 = ''; } } } // Setup the category parameters. $cparams = $category->getParams(); $category->params = clone $params; $category->params->merge($cparams); $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact'); $JSNConfig->megreGlobalParams('com_contact', $params, true); $children = array($category->id => $children); $maxLevel = $params->get('maxLevel', -1); $data->maxLevel = $maxLevel; $data->state = $state; $data->items = $items; $data->category = $category; $data->children = $children; $data->params = $params; $data->parent = $parent; $data->pagination = $pagination; return $data; }
/** * * Get data * * @param Array $pk */ public function prepareDisplayedData($pk) { $data = null; $this->setState('category.id', $pk['id']); // Get some data from the models $state = $this->getState(); $items = $this->getItems(); $category = $this->getCategory(); $children = $this->getChildren(); $parent = $this->getParent(); $pagination = $this->getPagination(); $params = $this->getState('params'); // Check for errors. if ($category == false) { echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND'); return; } if ($parent == false) { echo JText::_('JGLOBAL_CATEGORY_NOT_FOUND'); return; } // Prepare the data. // Compute the weblink slug & link url. for ($i = 0, $n = count($items); $i < $n; $i++) { $item =& $items[$i]; $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; if ($item->params->get('count_clicks', $params->get('count_clicks')) == 1) { $item->link = JRoute::_('index.php?option=com_weblinks&task=weblink.go&&id=' . $item->id); } else { $item->link = $item->url; } $temp = new JRegistry(); $temp->loadString($item->params); $item->params = clone $params; $item->params->merge($temp); } // Setup the category parameters. $cparams = $category->getParams(); $category->params = clone $params; $category->params->merge($cparams); $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $params); $JSNConfig->megreGlobalParams('com_weblinks', $params, true); $children = array($category->id => $children); $maxLevel = $params->get('maxLevel', -1); $data->maxLevel = $maxLevel; $data->state = $state; $data->items = $items; $data->category = $category; $data->children = $children; $data->params = $params; $data->parent = $parent; $data->pagination = $pagination; return $data; }
public function display($tpl = null) { $app = JFactory::getApplication(); $JSNMedia = JSNFactory::getMedia(); JSNHtmlAsset::addScript(JSN_POWERADMIN_LIB_JSNJS_URI . 'jsn.datas.validation.js'); $JSNMedia->addScriptDeclaration("\n\t\t\tvar baseUrl = '" . JURI::root() . "';\n\t\t\t(function(\$){\n\t\t\t\t\$(window).ready(function(){\n\t\t\t\t\t\$('#jsn-component-settings').textboxDataNumberic({maxValue:500});\n\t\t\t\t\t\$('.apply-setting-area').click(function(){\n\t\t\t\t\t\tif (\$(this).children('input').val() == 'globally'){\n\t\t\t\t\t\t\t\$(this).children('input').val('only');\n\t\t\t\t\t\t\t\$(this).children('span.symbol-only').show();\n\t\t\t\t\t\t\t\$(this).children('span.symbol-globally').hide();\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\$(this).children('span.symbol-only').hide();\n\t\t\t\t\t\t\t\$(this).children('span.symbol-globally').show();\n\t\t\t\t\t\t\t\$(this).children('input').val('globally');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t})(JoomlaShine.jQuery);\n\t\t"); $JSNConfig = JSNFactory::getConfig(); $params = $JSNConfig->getMenuParams($app->getUserState('com_poweradmin.component.menuid', 0)); $JSNConfig->megreGlobalParams('com_content', $params, true); $this->assign('params', $params); return parent::display(); }
/** * * */ public function getParams($pks) { $app = JFactory::getApplication('site'); $siteMenu = JMenu::getInstance('site'); $menuParams = $siteMenu->getItem($pks['Itemid']); if (isset($menuParams->params)) { $params = $menuParams->params; } else { $params = $this->getState()->get('params'); } $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreGlobalParams($pks['option'], $params); return $params; }
/** * * Get item * * @param Array $pk */ public function getItems($pk, $recursive = false) { if (!count($this->_items)) { // Process params $this->params = $params = $this->getState('params'); $options = array(); $options['countItems'] = $params->get('show_cat_num_articles_cat', 1) || !$params->get('show_empty_categories_cat', 0); $categories = JCategories::getInstance('Content', $options); $this->_parent = $categories->get($pk['id']); $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $this->params); $JSNConfig->megreGlobalParams('com_content', $this->params, true); if (is_object($this->_parent)) { $this->_items = $this->_parent->getChildren(false); } else { $this->_items = false; } } return $this->_items; }
/** * * Get item * * @param Array $pk */ public function &getItem($pk = array()) { $item = parent::getItem($pk['id']); // Add router helpers. $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid; $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id; // Merge article params. If this is single-article view, menu params override article params // Otherwise, article params override menu item params $this->params = $this->state->get('params'); $temp = clone $this->params; // Merge so that article params take priority $temp->merge($item->params); $item->params = $temp; //Megre params $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $item->params); $JSNConfig->megreGlobalParams('com_content', $item->params, true); $offset = $this->state->get('list.offset'); $item->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx')); return $item; }
/** * * Custom page save setting */ public function custompageSave() { $app = JFactory::getApplication(); $saveTypes = JRequest::getVar('saveTypes', array(), 'post', 'array'); $layout = JRequest::getVar('layout', 'readmore_settings'); $JSNConfig = JSNFactory::getConfig(); foreach ($_POST as $key => $value) { $saveType = @$saveTypes[$key]; switch ($saveType) { case 'only': $JSNConfig->menuitem($app->getUserState('com_poweradmin.component.menuid', 0), array($key => $value)); break; case 'globally': default: //Set global config $JSNConfig->extension($app->getUserState('com_poweradmin.component.request_from_extension', ''), array($key => $value)); //Set for menu article layout $allMenuitems = $this->getModel('menuitem')->getAllItems(array('option' => $app->getUserState('com_poweradmin.component.request_from_extension', ''), 'view' => $app->getUserState('com_poweradmin.component.request_from_view', ''), 'layout' => $app->getUserState('com_poweradmin.component.request_from_layout', ''))); foreach ($allMenuitems as $item) { $JSNConfig->menuitem($item->id, array($key => '')); } break; } } //redirect to current layout $this->setRedirect('index.php?option=com_poweradmin&view=component&layout=' . $layout . '&tmpl=component'); $this->redirect(); }
/** * Get the articles in the category * * @return mixed An array of articles or false if an error occurs. * @since 1.5 */ function getSpecificItems($Itemid) { $app = JFactory::getApplication('site'); $JSNConfig = JSNFactory::getConfig(); $this->_data->params = $JSNConfig->getMenuParams($Itemid); $JSNConfig->megreGlobalParams('com_content', $this->_data->params); $this->setState('params', $this->_data->params); if ($this->_data->params->get('layout_type') == 'blog') { $limit = (int) $this->_data->params->def('num_leading_articles', 1) + (int) $this->_data->params->get('num_intro_articles', 4) + (int) $this->_data->params->def('num_links', 4); } else { $this->setState('filter.published', 1); $limit = $app->getUserStateFromRequest('com_content.category.list.' . $Itemid . '.limit', 'limit', $this->_data->params->get('display_num')); } if ($category = $this->getCategory()) { $model = $this->getModel('Articles', 'ContentModel', array('ignore_request' => true)); $activeAllParams = new JRegistry(); foreach ($this->_data->params->toArray() as $key => $val) { if (strpos($key, 'show_') !== false && (int) $this->_data->params->get($key) == 0 && $this->_data->params->get('layout_type') == 'blog') { $activeAllParams->set($key, 1); } else { if ($this->_data->params->get('layout_type') == '' && strpos($key, 'list_') !== false) { if ($this->_data->params->get($key) == '') { if ($key == 'filter_field') { $activeAllParams->set($key, 'title'); } else { if ($key == 'list_show_date') { $activeAllParams->set($key, 'published'); } else { if ($key == 'date_format') { $activeAllParams->set($key, 'DD-MM-YY'); } else { $activeAllParams->set($key, 1); } } } } } else { $activeAllParams->set($key, $val); } } } $activeAllParams->set('layout_type', ''); $model->setState('params', $activeAllParams); $model->setState('filter.category_id', $category->id); $model->setState('filter.published', $this->getState('filter.published')); $model->setState('filter.access', 1); $model->setState('list.ordering', $this->_buildContentOrderBy()); $model->setState('list.start', 0); $model->setState('list.limit', $limit); $model->setState('list.direction', ''); $model->setState('list.filter', ''); // filter.subcategories indicates whether to include articles from subcategories in the list or blog $model->setState('filter.subcategories', $this->_data->params->get('show_subcat_desc')); $model->setState('filter.max_category_levels', $this->_data->params->get('show_subcategory_content')); $model->setState('list.links', $this->_data->params->get('num_links')); if ($limit >= 0) { $this->_data->items = $model->getSpecificItems(); if ($this->_data->items === false) { $this->setError($model->getError()); } } else { $this->_data->items = array(); } $this->_data->pagination = $model->getPagination(); } }
/** * * Get data * * @param Array $pk */ public function prepareDisplayedData($pk) { $this->_data = new stdClass(); $this->_data->items = array(); $this->_data->children = null; $this->_data->category = null; jimport('joomla.application.categories'); $this->setState('category.id', $pk['id']); $this->_data->items = $this->getItems(); // Get some data from the models if (isset($this->state->params)) { $this->_data->params = $this->state->params; $options = array(); $options['countItems'] = $this->_data->params->get('show_cat_num_articles', 1) || !$this->_data->params->get('show_empty_categories_cat', 0); } else { $options['countItems'] = 0; } $categories = JCategories::getInstance('Content', $options); $this->_data->category = $categories->get($this->getState('category.id', 'root')); // Compute selected asset permissions. if (is_object($this->_data->category)) { // TODO: Why aren't we lazy loading the children and siblings? $this->_data->children = $this->_data->category->getChildren(); $this->_data->parent = false; if ($this->_data->category->getParent()) { $this->_data->parent = $this->_data->category->getParent(); } // Setup the category parameters. $cparams = $this->_data->category->getParams(); $this->_data->category->params = clone $this->_data->params; $this->_data->category->params->merge($cparams); } else { $this->_data->children = false; $this->_data->parent = false; } // PREPARE THE DATA // Get the metrics for the structural page layout. $numLeading = $this->_data->params->def('num_leading_articles', 1); $numIntro = $this->_data->params->def('num_intro_articles', 4); $numLinks = $this->_data->params->def('num_links', 4); // Compute the article slugs and prepare introtext (runs content plugins). for ($i = 0, $n = count($this->_data->items); $i < $n; $i++) { $item =& $this->_data->items[$i]; $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; // No link for ROOT category if ($item->parent_alias == 'root') { $item->parent_slug = null; } // Ignore content plugins on links. if ($i < $numLeading + $numIntro) { $item->introtext = JHtml::_('content.prepare', $item->introtext); } } // For blog layouts, preprocess the breakdown of leading, intro and linked articles. // This makes it much easier for the designer to just interrogate the arrays. if ($this->_data->params->get('layout_type') == 'blog' || @$pk['layout'] == 'blog') { $max = count($this->_data->items); // The first group is the leading articles. $limit = $numLeading; for ($i = 0; $i < $limit && $i < $max; $i++) { $this->_data->lead_items[$i] =& $this->_data->items[$i]; // Add router helpers. $item =& $this->_data->lead_items[$i]; $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid; $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id; } // The second group is the intro articles. $limit = $numLeading + $numIntro; // Order articles across, then down (or single column mode) for ($i = $numLeading; $i < $limit && $i < $max; $i++) { $this->_data->intro_items[$i] =& $this->_data->items[$i]; // Add router helpers. $item =& $this->_data->intro_items[$i]; $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $item->catslug = $item->category_alias ? $item->catid . ':' . $item->category_alias : $item->catid; $item->parent_slug = $item->category_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id; } $this->_data->columns = max(1, $this->_data->params->def('num_columns', 1)); $order = $this->_data->params->def('multi_column_order', 1); if ($order == 0 && $this->_data->columns > 1) { // call order down helper $this->_data->intro_items = ContentHelperQuery::orderDownColumns($this->_data->intro_items, $this->_data->columns); } $limit = $numLeading + $numIntro + $numLinks; // The remainder are the links. for ($i = $numLeading + $numIntro; $i < $limit && $i < $max; $i++) { $this->_data->link_items[$i] =& $this->_data->items[$i]; } } // Order subcategories if (sizeof($this->_data->children)) { if ($this->_data->params->get('orderby_pri') == 'alpha' || $this->_data->params->get('orderby_pri') == 'ralpha') { jimport('joomla.utilities.arrayhelper'); JArrayHelper::sortObjects($this->_data->children, 'title', $this->_data->params->get('orderby_pri') == 'alpha' ? 1 : -1); } } if (isset($this->_data->category->id)) { $this->_data->children = array($this->_data->category->id => $this->_data->children); } $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $this->_data->params); $JSNConfig->megreGlobalParams('com_content', $this->_data->params, true); //Escape strings for HTML output $this->_data->pageclass_sfx = htmlspecialchars($this->_data->params->get('pageclass_sfx')); $this->_data->maxLevel = $this->_data->params->get('maxLevel', -1); $this->_data->state = $this->state; return $this->_data; }
<?php /*------------------------------------------------------------------------ # JSN PowerAdmin # ------------------------------------------------------------------------ # author JoomlaShine.com Team # copyright Copyright (C) 2012 JoomlaShine.com. All Rights Reserved. # Websites: http://www.joomlashine.com # Technical Support: Feedback - http://www.joomlashine.com/joomlashine/contact-us.html # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # @version $Id: default.php 14475 2012-07-27 09:40:40Z thangbh $ -------------------------------------------------------------------------*/ // no direct access defined('_JEXEC') or die; JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); $JSNConfig = JSNFactory::getConfig(); // If the page class is defined, add to class as suffix. // It will be a separate class if the user starts it with a space ?> <div class="jsn-category-blog"> <!-- Heading --> <?php $showPageHeadingClass = $data->params->get('show_page_heading', 1) == 1 ? 'display-default display-item' : 'hide-item'; ?> <div class="category heading"> <div class="<?php echo $showPageHeadingClass; ?> element-switch contextmenu-approved" id="show_page_heading"> <?php echo htmlspecialchars($data->params->get('page_heading'));
/** * * Get data * @param Array $pk */ public function prepareDisplayedData($pk) { $data = null; $item = $this->getItem($pk); $state = $this->getState(); $form = $this->getForm(); // Get the parameters $params = JComponentHelper::getParams('com_contact'); if ($item) { // If we found an item, merge the item parameters $params->merge($item->params); // Get Category Model data $categoryModel = JModelLegacy::getInstance('Category', 'ContactModel', array('ignore_request' => true)); $categoryModel->setState('category.id', $item->catid); $categoryModel->setState('list.ordering', 'a.name'); $categoryModel->setState('list.direction', 'asc'); $categoryModel->setState('filter.published', 1); $contacts = $categoryModel->getItems(); } // Handle email cloaking if ($item->email_to && $params->get('show_email')) { $item->email_to = JHtml::_('email.cloak', $item->email_to); } if ($params->get('show_street_address') || $params->get('show_suburb') || $params->get('show_state') || $params->get('show_postcode') || $params->get('show_country')) { if (!empty($item->address) || !empty($item->suburb) || !empty($item->state) || !empty($item->country) || !empty($item->postcode)) { $params->set('address_check', 1); } } else { $params->set('address_check', 0); } $params->set('marker_address', JText::_('COM_CONTACT_ADDRESS') . ": "); $params->set('marker_email', JText::_('JGLOBAL_EMAIL') . ": "); $params->set('marker_telephone', JText::_('COM_CONTACT_TELEPHONE') . ": "); $params->set('marker_fax', JText::_('COM_CONTACT_FAX') . ": "); $params->set('marker_mobile', JText::_('COM_CONTACT_MOBILE') . ": "); $params->set('marker_misc', JText::_('COM_CONTACT_OTHER_INFORMATION') . ": "); $params->set('marker_class', 'jicons-text'); $JSNConfig = JSNFactory::getConfig(); $JSNConfig->megreMenuParams($pk['Itemid'], $params, 'com_contact'); $JSNConfig->megreGlobalParams('com_contact', $params, true); $data->params = $params; $data->return = $return; $data->state = $state; $data->item = $item; $data->contacts = $contacts; $data->form = $form; return $data; }