コード例 #1
0
ファイル: view.html.php プロジェクト: densem-2013/exikom
 /**
  * @param null $tpl
  * @return bool
  */
 function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->authors = $this->get('Authors');
     $this->categories = $this->get('Categories');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     parent::display($tpl);
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: TeamCodeStudio/fpmoz
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     JHtml::_('behavior.framework', true);
     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 */
     /** @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=" . JFactory::getApplication()->input->getString('option') . "&task=ajax&format=raw';" . $load_more_script);
     RokCommon_Header::addStyle($siteURL . '/components/com_roksprocket/fields/filters/css/datepicker.css');
     $template_path_param = sprintf('roksprocket.providers.registered.%s.templatepath', strtolower($this->provider));
     if ($this->container->hasParameter($template_path_param)) {
         RokCommon_Composite::addPackagePath('roksprocket', $this->container->getParameter($template_path_param), 30);
     }
     parent::display($tpl);
 }