Exemplo n.º 1
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     // Initialize variables
     $user =& JFactory::getUser();
     $document =& JFactory::getDocument();
     // Request variables
     $id = JRequest::getVar('id', null, '', 'int');
     $limit = JRequest::getVar('limit', 5, '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     // Get the page/component configuration
     $params =& $mainframe->getParams();
     // parameters
     $intro = $params->def('num_intro_articles', 4);
     $leading = $params->def('num_leading_articles', 1);
     $links = $params->def('num_links', 4);
     $descrip = $params->def('show_description', 1);
     $descrip_image = $params->def('show_description_image', 1);
     $params->set('show_intro', 1);
     $limit = $intro + $leading + $links;
     JRequest::setVar('limit', (int) $limit);
     //set data model
     $items =& $this->get('data');
     $total =& $this->get('total');
     // Create a user access object for the user
     $access = new stdClass();
     $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
     $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
     $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
     //add alternate feed link
     if ($params->get('show_feed_link', 1) == 1) {
         $link = '&format=feed&limitstart=';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
         $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
         $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     }
     $menus =& JSite::getMenu();
     $menu = $menus->getActive();
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new JParameter($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', htmlspecialchars_decode($mainframe->getCfg('sitename')));
         }
     } else {
         $params->set('page_title', htmlspecialchars_decode($mainframe->getCfg('sitename')));
     }
     $document->setTitle($params->get('page_title'));
     jimport('joomla.html.pagination');
     $this->pagination = new JPagination($total, $limitstart, $limit - $links);
     $this->assign('total', $total);
     $this->assignRef('user', $user);
     $this->assignRef('access', $access);
     $this->assignRef('params', $params);
     $this->assignRef('items', $items);
     parent::display($tpl);
 }
Exemplo n.º 2
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     // Initialize some variables
     $user =& JFactory::getUser();
     $document =& JFactory::getDocument();
     // Get the page/component configuration
     $params =& $mainframe->getParams();
     // Request variables
     $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     //parameters
     $intro = $params->def('num_intro_articles', 4);
     $leading = $params->def('num_leading_articles', 1);
     $links = $params->def('num_links', 4);
     $limit = $intro + $leading + $links;
     JRequest::setVar('limit', (int) $limit);
     // Get some data from the model
     $items =& $this->get('Data');
     $total =& $this->get('Total');
     $categories =& $this->get('Categories');
     $section =& $this->get('Section');
     // Create a user access object for the user
     $access = new stdClass();
     $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
     $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
     $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
     //add alternate feed link
     if ($params->get('show_feed_link', 1) == 1) {
         $link = '&format=feed&limitstart=';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
         $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
         $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     }
     for ($i = 0; $i < count($categories); $i++) {
         $category =& $categories[$i];
         $category->link = JRoute::_('index.php?view=category&id=' . $category->slug);
     }
     if ($total == 0) {
         $params->set('show_categories', false);
     }
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit - $links);
     $this->assign('total', $total);
     $this->assignRef('items', $items);
     $this->assignRef('section', $section);
     $this->assignRef('categories', $categories);
     $this->assignRef('params', $params);
     $this->assignRef('user', $user);
     $this->assignRef('access', $access);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Exemplo n.º 3
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     if (empty($layout)) {
         // degrade to default
         $layout = 'list';
     }
     // Initialize some variables
     $user =& JFactory::getUser();
     $pathway =& $mainframe->getPathway();
     // Get the page/component configuration
     $params =& $mainframe->getParams('com_content');
     // Request variables
     $task = JRequest::getCmd('task');
     $limit = JRequest::getVar('limit', $params->get('display_num', 20), '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $month = JRequest::getInt('month');
     $year = JRequest::getInt('year');
     $filter = JRequest::getString('filter');
     // Get some data from the model
     $state =& $this->get('state');
     $items =& $this->get('data');
     $total =& $this->get('total');
     // Add item to pathway
     $pathway->addItem(JText::_('Archive'), '');
     $params->def('filter', 1);
     $params->def('filter_type', 'title');
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $form = new stdClass();
     // Month Field
     $months = array(JHTML::_('select.option', null, JText::_('Month')), JHTML::_('select.option', '01', JText::_('JANUARY_SHORT')), JHTML::_('select.option', '02', JText::_('FEBRUARY_SHORT')), JHTML::_('select.option', '03', JText::_('MARCH_SHORT')), JHTML::_('select.option', '04', JText::_('APRIL_SHORT')), JHTML::_('select.option', '05', JText::_('MAY_SHORT')), JHTML::_('select.option', '06', JText::_('JUNE_SHORT')), JHTML::_('select.option', '07', JText::_('JULY_SHORT')), JHTML::_('select.option', '08', JText::_('AUGUST_SHORT')), JHTML::_('select.option', '09', JText::_('SEPTEMBER_SHORT')), JHTML::_('select.option', '10', JText::_('OCTOBER_SHORT')), JHTML::_('select.option', '11', JText::_('NOVEMBER_SHORT')), JHTML::_('select.option', '12', JText::_('DECEMBER_SHORT')));
     $form->monthField = JHTML::_('select.genericlist', $months, 'month', 'size="1" class="inputbox"', 'value', 'text', $month);
     // Year Field
     $years = array();
     $years[] = JHTML::_('select.option', null, JText::_('Year'));
     for ($i = 2000; $i <= 2010; $i++) {
         $years[] = JHTML::_('select.option', $i, $i);
     }
     $form->yearField = JHTML::_('select.genericlist', $years, 'year', 'size="1" class="inputbox"', 'value', 'text', $year);
     $form->limitField = $pagination->getLimitBox();
     $this->assign('filter', $filter);
     $this->assign('year', $year);
     $this->assign('month', $month);
     $this->assignRef('form', $form);
     $this->assignRef('items', $items);
     $this->assignRef('params', $params);
     $this->assignRef('user', $user);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Exemplo n.º 4
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     // Initialize some variables
     $user =& JFactory::getUser();
     $uri =& JFactory::getURI();
     $document =& JFactory::getDocument();
     $pathway =& $mainframe->getPathway();
     // Get the menu item object
     $menus =& JSite::getMenu();
     $menu = $menus->getActive();
     // Get the page/component configuration
     $params = clone $mainframe->getParams('com_content');
     // Request variables
     $layout = JRequest::getCmd('layout');
     $task = JRequest::getCmd('task');
     // Parameters
     $params->def('num_leading_articles', 1);
     $params->def('num_intro_articles', 4);
     $params->def('num_columns', 2);
     $params->def('num_links', 4);
     $params->def('show_headings', 1);
     $params->def('show_pagination', 2);
     $params->def('show_pagination_results', 1);
     $params->def('show_pagination_limit', 1);
     $params->def('filter', 1);
     $intro = $params->get('num_intro_articles');
     $leading = $params->get('num_leading_articles');
     $links = $params->get('num_links');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     if ($layout == 'blog') {
         $default_limit = $intro + $leading + $links;
     } else {
         $params->def('display_num', $mainframe->getCfg('list_limit'));
         $default_limit = $params->get('display_num');
     }
     $limit = $mainframe->getUserStateFromRequest('com_content.' . $this->getLayout() . '.limit', 'limit', $default_limit, 'int');
     JRequest::setVar('limit', (int) $limit);
     $contentConfig =& JComponentHelper::getParams('com_content');
     $params->def('show_page_title', $contentConfig->get('show_title'));
     // Get some data from the model
     $items =& $this->get('Data');
     $total =& $this->get('Total');
     $category =& $this->get('Category');
     //add alternate feed link
     if ($params->get('show_feed_link', 1) == 1) {
         $link = '&format=feed&limitstart=';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
         $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
         $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     }
     // Create a user access object for the user
     $access = new stdClass();
     $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
     $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
     $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
     // Set page title per category
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new JParameter($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', $category->title);
         }
     } else {
         $params->set('page_title', $category->title);
     }
     $document->setTitle($params->get('page_title'));
     //set breadcrumbs
     if (is_object($menu) && $menu->query['view'] != 'category') {
         $pathway->addItem($category->title, '');
     }
     // Prepare category description
     $category->description = JHTML::_('content.prepare', $category->description);
     $params->def('date_format', JText::_('DATE_FORMAT_LC1'));
     // Keep a copy for safe keeping this is soooooo dirty -- must deal with in a later version
     // @todo -- oh my god we need to find this reference issue in 1.6 :)
     $this->_params = $params->toArray();
     jimport('joomla.html.pagination');
     //In case we are in a blog view set the limit
     if ($layout == 'blog') {
         $pagination = new JPagination($total, $limitstart, $limit - $links);
     } else {
         $pagination = new JPagination($total, $limitstart, $limit);
     }
     $this->assign('total', $total);
     $this->assign('action', $uri->toString());
     $this->assignRef('items', $items);
     $this->assignRef('params', $params);
     $this->assignRef('category', $category);
     $this->assignRef('user', $user);
     $this->assignRef('access', $access);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Exemplo n.º 5
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     // Initialize some variables
     $user =& JFactory::getUser();
     $document =& JFactory::getDocument();
     // Get the page/component configuration
     $params =& $mainframe->getParams();
     // Request variables
     $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     //parameters
     $intro = $params->def('num_intro_articles', 4);
     $leading = $params->def('num_leading_articles', 1);
     $links = $params->def('num_links', 4);
     $limit = $intro + $leading + $links;
     JRequest::setVar('limit', (int) $limit);
     // Get some data from the model
     $items =& $this->get('Data');
     $total =& $this->get('Total');
     $categories =& $this->get('Categories');
     $section =& $this->get('Section');
     // Create a user access object for the user
     $access = new stdClass();
     $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all');
     $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own');
     $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all');
     //add alternate feed link
     if ($params->get('show_feed_link', 1) == 1) {
         $link = '&format=feed&limitstart=';
         $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
         $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
         $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
         $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
     }
     $menus =& JSite::getMenu();
     $menu = $menus->getActive();
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new JParameter($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', $section->title);
         }
     } else {
         $params->set('page_title', $section->title);
     }
     $document->setTitle($params->get('page_title'));
     // Prepare section description
     $section->description = JHTML::_('content.prepare', $section->description);
     for ($i = 0; $i < count($categories); $i++) {
         $category =& $categories[$i];
         $category->link = JRoute::_(ContentHelperRoute::getCategoryRoute($category->slug, $category->section) . '&layout=default');
         // Prepare category description
         $category->description = JHTML::_('content.prepare', $category->description);
     }
     if ($total == 0) {
         $params->set('show_categories', false);
     }
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit - $links);
     $this->assign('total', $total);
     $this->assignRef('items', $items);
     $this->assignRef('section', $section);
     $this->assignRef('categories', $categories);
     $this->assignRef('params', $params);
     $this->assignRef('user', $user);
     $this->assignRef('access', $access);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Exemplo n.º 6
0
 function _displayPagebreak($tpl)
 {
     $document =& JFactory::getDocument();
     $document->setTitle(JText::_('PGB ARTICLE PAGEBRK'));
     parent::display($tpl);
 }