/** * Allows caller to set additional url parameters * * @since 1.0 * @access public * @param string * @return */ public function setVar($key, $value) { $this->pagination->setAdditionalUrlParam($key, $value); }
/** * browser képernyo kirajzolása * @JRequest string orderCol optional * @JRequest string orderDir optional * @JRequest string filterStr optional * @JRequest integer limitstart optional * @JRequest integer limit optional * @JRequest string id optional * @session object optional browser status {orderCol, orderDir, filterStr, limitstart, limit, id} */ public function browser() { $this->getState(); $this->saveState(); $this->state->limit = 20; $model = $this->getModel($this->modelName); $items = $model->getItems($this->state); $form =& JForm::getInstance($this->browserName, JPATH_COMPONENT . '/models/forms/' . $this->formName . '.xml', array('control' => 'jform')); for ($i = 0; $i < count($items); $i++) { $this->itemAccess($items[$i]); } $total = $model->getTotal($this->state); $pagination = new JPagination($total, $this->state->limitstart, $this->state->limit); $pagination->setAdditionalUrlParam('termek_id', $this->state->termek_id); $view = $this->getView($this->browserName, 'html'); $view->set('title', JText::_($this->lngPre . '_BROWSER')); $view->set('state', $this->state); $view->set('items', $items); $view->set('form', $form); $view->set('total', $total); $view->set('pagination', $pagination); $view->set('message', $this->message); $view->termek = $model->getTermek($this->state->termek_id); $view->isAdmin = $this->helper->isAdmin(); $buttons = $this->browserButtons(); $view->set('buttons', $buttons); $view->setLayout('default'); $view->display(); }
/** * browse task * @return void * @request integer limit * @request integer limitstart * @request integer order * @request integer filterStr * @request integer temakor * @request integer szavazas * @session object 'temakoroklist_status' */ public function browse() { jimport('hs.user.user'); JHTML::_('behavior.modal'); $total = 0; $pagination = null; $user = JFactory::getUser(); $db = JFactory::getDBO(); // alapértelmezett browser status beolvasása sessionból $session = JFactory::getSession(); $brStatusStr = $session->get($this->NAME . 'list_status'); if ($brStatusStr == '') { $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":"","temakor_id":0,"szavazas_id":0}'; } $brStatus = JSON_decode($brStatus); $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart); $limit = JRequest::getVar('limit', $brStatus->limit); $order = JRequest::getVar('order', $brStatus->order); $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr)); if ($this->temakor_id == '') { $this->temakor_id = $brStatus->temakor_id; } if ($this->szavazas_id == '') { $this->szavazas_id = $brStatus->szavazas_id; } // browser status save to session and JRequest $brStatus->limit = $limit; $brStatus->limitStart = $limitStart; $brStatus->order = $order; $brStatus->filterStr = $filterStr; $brStatus->temakor_id = $this->temakor_id; $brStatus->szavazas_id = $this->szavazas_id; $session->set($this->NAME . 'list_status', JSON_encode($brStatus)); JRequest::setVar('limit', $limit); JRequest::setVar('limitstart', $limitstart); JRequest::setVar('order', $order); JRequest::setVar('filterStr', $filterStr); JRequest::setVar('temakor', $this->temakor_id); JRequest::setVar('szavazas', $this->szavazas_id); // adattábla tartalom elérése és átadása a view -nek $items = $this->model->getItems(); //DBG echo $this->model->getDBO()->getQuery(); if ($this->model->getError() != '') { $this->view->Msg = $this->model->getError(); } $this->view->set('Items', $items); $this->view->set('Temakor', $this->temakor); $this->view->set('Szavazas', $this->szavazas); $this->view->set('Title', JText::_('ALTERNATIVAK')); // browser müködéshez linkek definiálása if ($this->szavazas->vita1 == 1) { $itemLink = JURI::base() . 'index.php?option=com_alternativak&view=alternativak' . '&task=edit' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1') . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } else { $itemLink = ''; } $backLink = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&temakor=' . $this->temakor_id . '&task=browse'; $homeLink = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist' . '&task=browse'; $this->view->set('itemLink', $itemLink); $this->view->set('backLink', $backLink); $this->view->set('homeLink', $homeLink); // van ált. képviselője? $altKepviseloje = 0; $db->setQuery('select k.kepviselo_id, u.name from #__kepviselok k, #__users u where k.kepviselo_id = u.id and k.user_id = "' . $user->id . '" and k.temakor_id=0 and k.szavazas_id = 0 and k.lejarat >= "' . date('Y-m-d') . '"'); $res = $db->loadObject(); if ($db->getErrorNum() > 0) { $db->stderr(); } if ($res) { $altKepviseloje = $res->kepviselo_id; } // van témakör képviselője? $kepviseloje = 0; $db->setQuery('select k.kepviselo_id, u.name from #__kepviselok k, #__users u where k.kepviselo_id = u.id and k.user_id = "' . $user->id . '" and k.temakor_id=' . $this->temakor_id . ' and k.szavazas_id = 0 and k.lejarat >= "' . date('Y-m-d') . '"'); $res = $db->loadObject(); if ($db->getErrorNum() > 0) { $db->stderr(); } if ($res) { $kepviseloje = $res->kepviselo_id; } // Ő maga képviselő jelölt? $kepviseloJelolt = false; $db->setQuery('select user_id from #__kepviselojeloltek where user_id = "' . $user->id . '"'); $res = $db->loadObject(); if ($db->getErrorNum() > 0) { $db->stderr(); } if ($res) { $kepviseloJelolt = true; } // kik az alternativa felvivők? $alternativa_felvivo = $this->alternativa_felvivo(); // akciók definiálása $akciok = array(); if ($this->temakorokHelper->isAdmin($user) | $szavazas_felvivo == 10 & ($this->szavazas->szavazok = 1) & $user->id > 0 | $szavazas_felvivo == 10 & $this->userTag($this->temakor_id, $user) | $this->szavazasIndito($this->szavazas_id, $user)) { if ($this->szavazas->vita1 == 1) { $akciok['ujAlternativa'] = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . '&task=add' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id . '&limit=' . JRequest::getVar('limit', 20) . '&limitstart=' . JRequest::getVar('limitstart', 0) . '&order=' . JRequest::getVar('order', 1) . '&filterStr=' . JRequest::getVar('filterStr', ''); } } if ($this->temakorokHelper->isAdmin($user) | $this->szavazas->letrehozo == $user->id) { $akciok['szavazasedit'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=edit' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } if ($this->temakorokHelper->isAdmin($user) | $this->szavazas->letrehozo == $user->id) { $akciok['szavazastorles'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } if ($this->temakorokHelper->isAdmin($user) | $this->temakorIndito($this->temakor_id, $user)) { $akciok['temakoredit'] = JURI::base() . 'index.php?option=com_temakorok&view=temakorok&task=edit' . '&temakor=' . $this->temakor_id; } if ($this->temakorokHelper->isAdmin($user) | $this->temakorIndito($this->temakor_id, $user)) { $akciok['temakortorles'] = JURI::base() . 'index.php?option=com_temakorok&view=temakorok&task=deleteform' . '&temakor=' . $this->temakor_id; } if ($this->temakorokHelper->isAdmin($user) | $this->temakorIndito($this->temakor_id, $user)) { if ($this->szavazas->vita1 == 1) { $akciok['alternativaedit'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativak&task=edit' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } } if ($this->temakorokHelper->isAdmin($user) | $this->temakorIndito($this->temakor_id, $user)) { if ($this->szavazas->vita1 == 1) { $akciok['alternativatorles'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativak&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } } if ($this->szavazas->szavazas == 1 & $user->id > 0) { $db = JFactory::getDBO(); $db->setQuery('select id from #__szavazatok where szavazas_id="' . $this->szavazas_id . '" and user_id="' . $user->id . '"'); $res = $db->loadObjectList(); if (count($res) == 0) { $akciok['szavazok'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=szavazoform&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } } if ($this->szavazas->lezart == 1) { $akciok['eredmeny'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=eredmeny&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } $akciok['tagok'] = JURI::base() . 'index.php?option=com_tagok&temakor=' . $this->temakor_id; $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_(strtoupper($this->NAME) . 'LIST_SUGO') . '&Itemid=435&tmpl=component'; $this->view->set('Akciok', $akciok); // globális képviselő/képviselő jelölt gombok definiálása $altKepviselo = array(); $altKepviselo['kepviselojeLink'] = ''; $kepviselo = array(); $kepviselo['kepviselojeLink'] = ''; $kepviselo['kepviseloJeloltLink'] = ''; $kepviselo['kepviselotValasztLink'] = ''; $kepviselo['ujJeloltLink'] = ''; if ($user->id > 0) { if ($altKepviseloje > 0) { $kepviseloUser = JFactory::getUser($altKepviseloje); if ($kepviseloUser) { $userEx = HsUser::getInstance($altKepviseloje); $altKepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=show&id=' . $altKepviseloje; if (isset($userEx->image)) { $altKepviselo['image'] = $userEx->get('image'); } else { $altKepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />'; } $altKepviselo['nev'] = $kepviseloUser->name; } } if ($kepviseloje > 0) { $kepviseloUser = JFactory::getUser($kepviseloje); if ($kepviseloUser) { $userEx = HsUser::getInstance($kepviseloje); $kepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=show&id=' . $kepviseloje; if (isset($userEx->image)) { $kepviselo['image'] = $userEx->get('image'); } else { $kepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />'; } $kepviselo['nev'] = $kepviseloUser->name; } } else { if ($kepviseloJelolt) { $kepviselo['kepviseloJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselo&task=edit&id=' . $user->id; } else { $kepviselo['kepviselotValasztLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=find&temekor=' . $this->temakor_id . '&szavazas=0'; $kepviselo['ujJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&task=add&temekor=' . $this->temakor_id . '&szavazas=0&id=' . $user->id; } } } $this->view->set('Kepviselo', $kepviselo); $this->view->set('AltKepviselo', $altKepviselo); //lapozósor definiálása jimport('joomla.html.pagination'); $total = $this->model->getTotal($filterStr); $pagination = new JPagination($total, $limitStart, $limit); $pagination->setAdditionalUrlParam('order', $order); $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr)); $this->view->set('Lapozosor', $pagination->getListFooter()); $this->view->display(); }
/** * This method tests the setAdditionalUrlParam function by emptying an existing URL. * * @return void * * @covers JPagination::setAdditionalUrlParam * @since 3.1 */ public function testSetEmptyAdditionalUrlParam() { $pagination = new JPagination(100, 50, 20, '', $this->app); $pagination->setAdditionalUrlParam('Joomla', '//www.joomla.org'); $this->assertEquals(TestReflection::getValue($pagination, 'additionalUrlParams'), array('Joomla' => '//www.joomla.org'), 'The URL is not the value expected'); $pagination->setAdditionalUrlParam('Joomla', null); $this->assertArrayNotHasKey('Joomla', TestReflection::getValue($pagination, 'additionalUrlParams')); unset($pagination); }
public function getStreamDataHTML($filter = array(), $options = array()) { jimport('joomla.html.pagination'); $app = JFactory::getApplication(); $jconfig = new JConfig(); $html = ''; $user = JXFactory::getUser(); if ($mention = JRequest::getVar('mention', '')) { $filter['mention'] = '@' . $mention; } if ($user_id = JRequest::getVar('user_id', '')) { $filter['user_id'] = $user_id; } if ($search = JRequest::getVar('search', '')) { $filter['search'] = $search; } if ($group_id = JRequest::getVar('group_id', '')) { $filter['group_id'] = $group_id; } if ($limit_start = JRequest::getVar('limitstart', '')) { $filter['limitstart'] = $limit_start; } if ($overdue = JRequest::getVar('overdue', '')) { $date = new JDate(); $filter['end_date'] = $date->toMySQL(); } // Order by 'updated' $filter['order_by_desc'] = 'updated'; $model = StreamFactory::getModel('stream'); $data = $model->getStream($filter, $jconfig->list_limit, JRequest::getVar('limitstart', 0)); $total = $model->countStream($filter); // Set $user if user_id filter is specified if (isset($filter['user_id'])) { $user = JXFactory::getUser($filter['user_id']); } $tmpl = new StreamTemplate(); $tmpl->set('user', $user); if (isset($options['filter'])) { $html = $tmpl->fetch($options['filter']); } else { if (!isset($options['hide_filter'])) { $html = $tmpl->fetch('stream.filter'); } } // Pagination $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $jconfig->list_limit); // If URI is defined, we need to set the pagination link properly if ($uri = JRequest::getVar('uri', '')) { $uri = new JURI($uri); $router = $app->getRouter(); $result = $router->parse($uri); foreach ($result as $key => $val) { $pagination->setAdditionalUrlParam($key, $val); } } $tmpl = new StreamTemplate(); $tmpl->set('rows', $data); $tmpl->set('total', $total); $tmpl->set('pagination', $pagination); $tmpl->set('options', $options); $html .= $tmpl->fetch('stream.data'); return $html; }
function display($tpl = null) { $mainframe = JFactory::getApplication(); //$params = K2HelperUtilities::getParams('com_k2'); if ($mainframe->isSite()) { $params = $mainframe->getParams('com_jak2filter'); } else { $params = JComponentHelper::getParams('com_jak2filter'); } //JA K2 FILTER - custom params to display well search result with category view $params->set('show_page_heading', 1); $params->set('catItemImage', 1); $params->set('catCatalogMode', 0); $params->set('theme', JRequest::getString('theme', $params->get('theme', 'default'))); $params->def('num_leading_items', 0); $params->def('num_leading_columns', 1); $params->def('num_primary_items', 9); $params->def('num_primary_columns', 3); $params->def('num_secondary_items', 0); $params->def('num_secondary_columns', 1); $params->def('num_links', 0); $params->def('num_links_columns', 1); // $model = $this->getModel('itemlist'); $limitstart = JRequest::getInt('limitstart'); $view = JRequest::getWord('view'); $task = JRequest::getWord('task'); $db = JFactory::getDBO(); // Add link if (K2HelperPermissions::canAddItem()) { $addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component'); } $this->assignRef('addLink', $addLink); // Get data depending on task switch ($task) { case 'category': // Get category $id = JRequest::getInt('id'); JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'tables'); $category = JTable::getInstance('K2Category', 'Table'); $category->load($id); $category->event = new stdClass(); // State check if (!$category->published || $category->trash) { JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND')); } // Access check $user = JFactory::getUser(); if (K2_JVERSION != '15') { if (!in_array($category->access, $user->getAuthorisedViewLevels())) { if ($user->guest) { $uri = JFactory::getURI(); $url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()); $mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); $mainframe->redirect(JRoute::_($url, false)); } else { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); return; } } $languageFilter = $mainframe->getLanguageFilter(); $languageTag = JFactory::getLanguage()->getTag(); if ($languageFilter && $category->language != $languageTag && $category->language != '*') { return; } } else { if ($category->access > $user->get('aid', 0)) { if ($user->guest) { $uri = JFactory::getURI(); $url = 'index.php?option=com_user&view=login&return=' . base64_encode($uri->toString()); $mainframe->enqueueMessage(JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice'); $mainframe->redirect(JRoute::_($url, false)); } else { JError::raiseError(403, JText::_('K2_ALERTNOTAUTH')); return; } } } // Hide the add new item link if user cannot post in the specific category if (!K2HelperPermissions::canAddItem($id)) { unset($this->addLink); } // Merge params $cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params); // Get the meta information before merging params since we do not want them to be inherited $category->metaDescription = $cparams->get('catMetaDesc'); $category->metaKeywords = $cparams->get('catMetaKey'); $category->metaRobots = $cparams->get('catMetaRobots'); $category->metaAuthor = $cparams->get('catMetaAuthor'); if ($cparams->get('inheritFrom')) { $masterCategory = JTable::getInstance('K2Category', 'Table'); $masterCategory->load($cparams->get('inheritFrom')); $cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params); } $params->merge($cparams); // Category link $category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id . ':' . urlencode($category->alias)))); // Category image $category->image = K2HelperUtilities::getCategoryImage($category->image, $params); // Category plugins $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $category->text = $category->description; if (K2_JVERSION != '15') { $dispatcher->trigger('onContentPrepare', array('com_k2.category', &$category, &$params, $limitstart)); } else { $dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart)); } $category->description = $category->text; // Category K2 plugins $category->event->K2CategoryDisplay = ''; JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart)); $category->event->K2CategoryDisplay = trim(implode("\n", $results)); $category->text = $category->description; $dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart)); $category->description = $category->text; $this->assignRef('category', $category); $this->assignRef('user', $user); // Category children $ordering = $params->get('subCatOrdering'); $children = $model->getCategoryFirstChildren($id, $ordering); if (count($children)) { foreach ($children as $child) { if ($params->get('subCatTitleItemCounter')) { $child->numOfItems = $model->countCategoryItems($child->id); } $child->image = K2HelperUtilities::getCategoryImage($child->image, $params); $child->name = htmlspecialchars($child->name, ENT_QUOTES); $child->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($child->id . ':' . urlencode($child->alias)))); $subCategories[] = $child; } $this->assignRef('subCategories', $subCategories); } // Set limit $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links'); // Set featured flag JRequest::setVar('featured', $params->get('catFeaturedItems')); // Set layout $this->setLayout('category'); // Set title $title = $category->name; $category->name = htmlspecialchars($category->name, ENT_QUOTES); // Set ordering if ($params->get('singleCatOrdering')) { $ordering = $params->get('singleCatOrdering'); } else { $ordering = $params->get('catOrdering'); } $addHeadFeedLink = $params->get('catFeedLink'); break; case 'user': // Get user $id = JRequest::getInt('id'); $userObject = JFactory::getUser($id); $userObject->event = new stdClass(); // Check user status if ($userObject->block) { JError::raiseError(404, JText::_('K2_USER_NOT_FOUND')); } // Get K2 user profile $userObject->profile = $model->getUserProfile(); // User image $userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth')); // User K2 plugins $userObject->event->K2UserDisplay = ''; if (is_object($userObject->profile) && $userObject->profile->id > 0) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2UserDisplay', array(&$userObject->profile, &$params, $limitstart)); $userObject->event->K2UserDisplay = trim(implode("\n", $results)); $userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8'); } $this->assignRef('user', $userObject); $date = JFactory::getDate(); $now = K2_JVERSION == '15' ? $date->toMySQL() : $date->toSql(); $this->assignRef('now', $now); // Set layout $this->setLayout('user'); // Set limit $limit = $params->get('userItemCount'); // Set title $title = $userObject->name; $userObject->name = htmlspecialchars($userObject->name, ENT_QUOTES); // Set ordering $ordering = $params->get('userOrdering'); $addHeadFeedLink = $params->get('userFeedLink', 1); break; case 'tag': // Set layout $this->setLayout('tag'); // Set limit $limit = $params->get('tagItemCount'); // Set title $title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG') . ' ' . JRequest::getVar('tag'); // Set ordering $ordering = $params->get('tagOrdering'); $addHeadFeedLink = $params->get('tagFeedLink', 1); break; case 'search': // Set layout $this->setLayout('category'); // Set limit //$limit = $params->get('genericItemCount'); //JA K2 FILTER - like category view $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links'); // Set title $title = JText::_('JAK2FILTER_SEARCH_RESULTS') . ' ' . JRequest::getVar('searchword'); $addHeadFeedLink = $params->get('genericFeedLink', 1); //JA K2 FILTER - Set ordering $ordering = JRequest::getVar('ordering', $params->get('catOrdering')); break; case 'date': // Set layout $this->setLayout('generic'); // Set limit $limit = $params->get('genericItemCount'); // Fix wrong timezone if (function_exists('date_default_timezone_get')) { $originalTimezone = date_default_timezone_get(); } if (function_exists('date_default_timezone_set')) { date_default_timezone_set('UTC'); } // Set title if (JRequest::getInt('day')) { $date = strtotime(JRequest::getInt('year') . '-' . JRequest::getInt('month') . '-' . JRequest::getInt('day')); $dateFormat = K2_JVERSION == '15' ? '%A, %d %B %Y' : 'l, d F Y'; $title = JText::_('K2_ITEMS_FILTERED_BY_DATE') . ' ' . JHTML::_('date', $date, $dateFormat); } else { $date = strtotime(JRequest::getInt('year') . '-' . JRequest::getInt('month')); $dateFormat = K2_JVERSION == '15' ? '%B %Y' : 'F Y'; $title = JText::_('K2_ITEMS_FILTERED_BY_DATE') . ' ' . JHTML::_('date', $date, $dateFormat); } // Restore the original timezone if (function_exists('date_default_timezone_set') && isset($originalTimezone)) { date_default_timezone_set($originalTimezone); } // Set ordering $ordering = 'rdate'; $addHeadFeedLink = $params->get('genericFeedLink', 1); break; default: // Set layout $this->setLayout('category'); $user = JFactory::getUser(); $this->assignRef('user', $user); // Set limit $limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links'); // Set featured flag JRequest::setVar('featured', $params->get('catFeaturedItems')); // Set title $title = $params->get('page_title'); // Set ordering $ordering = $params->get('catOrdering'); $addHeadFeedLink = $params->get('catFeedLink', 1); break; } // Set limit for model if (!$limit) { $limit = 10; } JRequest::setVar('limit', $limit); // Get items if (!isset($ordering)) { $items = $model->getData(); } else { $items = $model->getData($ordering); } if (count($items) == 0) { return JError::raiseNotice(500, JText::_('SEARCH_RESULT_NULL')); } // Pagination jimport('joomla.html.pagination'); $total = count($items) ? $model->getTotal() : 0; $pagination = new JPagination($total, $limitstart, $limit); $vars = JRequest::get('get'); $pagination->setAdditionalUrlParam('Itemid', $vars['Itemid']); //Fix bug: page navigation does not work properly if SEF is enabled /* if(count($vars)) { foreach ($vars as $k => $v) { if($k == 'task') continue; if(is_array($v)) { foreach ($v as $sk => $sv) { $pagination->setAdditionalUrlParam($k.'['.$sk.']', $sv); } } else { $pagination->setAdditionalUrlParam($k, $v); } } }*/ //Prepare items $user = JFactory::getUser(); $cache = JFactory::getCache('com_k2_extended'); $model = JModelLegacy::getInstance('item', 'K2Model'); for ($i = 0; $i < sizeof($items); $i++) { //Item group // JA K2 FILTER - using category view for displaying search result if ($task == "category" || $task == "search" || $task == "") { if ($i < $params->get('num_links') + $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items')) { $items[$i]->itemGroup = 'links'; } if ($i < $params->get('num_secondary_items') + $params->get('num_leading_items') + $params->get('num_primary_items')) { $items[$i]->itemGroup = 'secondary'; } if ($i < $params->get('num_primary_items') + $params->get('num_leading_items')) { $items[$i]->itemGroup = 'primary'; } if ($i < $params->get('num_leading_items')) { $items[$i]->itemGroup = 'leading'; } } // Check if the model should use the cache for preparing the item even if the user is logged in /* // JA K2 Filter: Remove cache method if ($user->guest || $task == 'tag' || $task == 'search' || $task == 'date') { $cacheFlag = true; } else { $cacheFlag = true; if (K2HelperPermissions::canEditItem($items[$i]->created_by, $items[$i]->catid)) { $cacheFlag = false; } } // Prepare item if ($cacheFlag) { $hits = $items[$i]->hits; $items[$i]->hits = 0; JTable::getInstance('K2Category', 'Table'); $items[$i] = $cache->call(array($model, 'prepareItem'), $items[$i], $view, $task); $items[$i]->hits = $hits; } else { $items[$i] = $model->prepareItem($items[$i], $view, $task); } */ // JA K2 Filter: PrepareItem $items[$i] = $model->prepareItem($items[$i], $view, ''); // Plugins $items[$i]->params->set('genericItemIntroText', $params->get('catItemIntroText')); $items[$i]->params->set('catItemK2Plugins', $params->get('catItemK2Plugins')); $items[$i] = $model->execPlugins($items[$i], 'itemlist', ''); // Trigger comments counter event $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $results = $dispatcher->trigger('onK2CommentsCounter', array(&$items[$i], &$params, $limitstart)); $items[$i]->event->K2CommentsCounter = trim(implode("\n", $results)); //JA K2 FILTER - CUSTOM VIEW OPTIONS $items[$i]->params->merge($params); if (!is_array($items[$i]->extra_fields)) { $items[$i]->extra_fields = $model->getItemExtraFields($items[$i]->extra_fields, $items[$i]); } if ($params->get('catItemIntroTextWordLimit')) { $items[$i]->introtext = K2HelperUtilities::wordLimit($items[$i]->introtext, $params->get('catItemIntroTextWordLimit')); } //JA K2 FILTER - CUSTOM VIEW OPTIONS - AUTHOR if (!empty($items[$i]->created_by_alias)) { $items[$i]->author = new stdClass(); $items[$i]->author->name = $items[$i]->created_by_alias; $items[$i]->author->avatar = K2HelperUtilities::getAvatar('alias'); $items[$i]->author->link = JURI::root(); } else { $author = JFactory::getUser($items[$i]->created_by); $items[$i]->author = $author; $items[$i]->author->link = JRoute::_(K2HelperRoute::getUserRoute($items[$i]->created_by)); $items[$i]->author->profile = $model->getUserProfile($items[$i]->created_by); $items[$i]->author->avatar = K2HelperUtilities::getAvatar($author->id, $author->email, $params->get('userImageWidth')); } if (!isset($items[$i]->author->profile) || is_null($items[$i]->author->profile)) { $items[$i]->author->profile = new JObject(); $items[$i]->author->profile->gender = NULL; } //JA K2 FILTER - CUSTOM VIEW OPTIONS - RATING $items[$i]->votingPercentage = $model->getVotesPercentage($items[$i]->id); $items[$i]->numOfvotes = $model->getVotesNum($items[$i]->id); } // Set title $document = JFactory::getDocument(); $application = JFactory::getApplication(); $menus = $application->getMenu(); $menu = $menus->getActive(); if (is_object($menu)) { if (is_string($menu->params)) { $menu_params = K2_JVERSION == '15' ? new JParameter($menu->params) : new JRegistry($menu->params); } else { $menu_params = $menu->params; } $params->set('page_title', $menu_params->get('page_title', $title)); $params->set('page_heading', $menu_params->get('page_heading', $title)); // override theming params $params_query = new JRegistry($menu->query); $params->set('theme', $params_query->get('theme', $params->get('theme'))); } else { $params->set('page_title', $title); } // We're adding a new variable here which won't get the appended/prepended site title, // when enabled via Joomla!'s SEO/SEF settings $params->set('page_title_clean', $title); if (K2_JVERSION != '15') { if ($mainframe->getCfg('sitename_pagetitles', 0) == 1) { $tmpTitle = JText::sprintf('JPAGETITLE', $mainframe->getCfg('sitename'), $params->get('page_title')); $params->set('page_title', $tmpTitle); } elseif ($mainframe->getCfg('sitename_pagetitles', 0) == 2) { $tmpTitle = JText::sprintf('JPAGETITLE', $params->get('page_title'), $mainframe->getCfg('sitename')); $params->set('page_title', $tmpTitle); } } $document->setTitle($params->get('page_title')); // Search - Update the Google Search results container (K2 v2.6.6+) /* if ($task == 'search') { $googleSearchContainerID = trim($params->get('googleSearchContainer', 'k2GoogleSearchContainer')); if ($googleSearchContainerID == 'k2Container') { $googleSearchContainerID = 'k2GoogleSearchContainer'; } $params->set('googleSearchContainer', $googleSearchContainerID); } */ // Set metadata for category if ($task == 'category') { if ($category->metaDescription) { $document->setDescription($category->metaDescription); } else { $metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $this->category->description); $metaDescItem = strip_tags($metaDescItem); $metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150)); $metaDescItem = htmlspecialchars($metaDescItem, ENT_QUOTES, 'UTF-8'); $document->setDescription($metaDescItem); } if ($category->metaKeywords) { $document->setMetadata('keywords', $category->metaKeywords); } if ($category->metaRobots) { $document->setMetadata('robots', $category->metaRobots); } if ($category->metaAuthor) { $document->setMetadata('author', $category->metaAuthor); } } if (K2_JVERSION != '15') { // Menu metadata options if ($params->get('menu-meta_description')) { $document->setDescription($params->get('menu-meta_description')); } if ($params->get('menu-meta_keywords')) { $document->setMetadata('keywords', $params->get('menu-meta_keywords')); } if ($params->get('robots')) { $document->setMetadata('robots', $params->get('robots')); } // Menu page display options if ($params->get('page_heading')) { $params->set('page_title', $params->get('page_heading')); } $params->set('show_page_title', $params->get('show_page_heading')); } // Pathway $pathway = $mainframe->getPathWay(); if (!isset($menu->query['task'])) { $menu->query['task'] = ''; } if ($menu) { switch ($task) { case 'category': if ($menu->query['task'] != 'category' || $menu->query['id'] != JRequest::getInt('id')) { $pathway->addItem($title, ''); } break; case 'user': if ($menu->query['task'] != 'user' || $menu->query['id'] != JRequest::getInt('id')) { $pathway->addItem($title, ''); } break; case 'tag': if ($menu->query['task'] != 'tag' || $menu->query['tag'] != JRequest::getVar('tag')) { $pathway->addItem($title, ''); } break; case 'search': case 'date': $pathway->addItem($title, ''); break; } } // Feed link $config = JFactory::getConfig(); $menu = $application->getMenu(); $default = $menu->getDefault(); $active = $menu->getActive(); if ($task == 'tag') { $link = K2HelperRoute::getTagRoute(JRequest::getVar('tag')); } else { $link = ''; } $sef = K2_JVERSION == '30' ? $config->get('sef') : $config->getValue('config.sef'); if (!is_null($active) && $active->id == $default->id && $sef) { $link .= '&Itemid=' . $active->id . '&format=feed&limitstart='; } else { $link .= '&format=feed&limitstart='; } $feed = JRoute::_($link); $this->assignRef('feed', $feed); // Add head feed link if ($addHeadFeedLink) { $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); } //JA K2 FILTER - custom item view option // Assign data if ($task == "category" || $task == "search" || $task == "") { $leading = @array_slice($items, 0, $params->get('num_leading_items')); $primary = @array_slice($items, $params->get('num_leading_items'), $params->get('num_primary_items')); $secondary = @array_slice($items, $params->get('num_leading_items') + $params->get('num_primary_items'), $params->get('num_secondary_items')); $links = @array_slice($items, $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items'), $params->get('num_links')); $this->assignRef('leading', $leading); $this->assignRef('primary', $primary); $this->assignRef('secondary', $secondary); $this->assignRef('links', $links); } else { $this->assignRef('items', $items); } // Set default values to avoid division by zero if ($params->get('num_leading_columns') == 0) { $params->set('num_leading_columns', 1); } if ($params->get('num_primary_columns') == 0) { $params->set('num_primary_columns', 1); } if ($params->get('num_secondary_columns') == 0) { $params->set('num_secondary_columns', 1); } if ($params->get('num_links_columns') == 0) { $params->set('num_links_columns', 1); } $this->assignRef('params', $params); $this->assignRef('pagination', $pagination); // Set Facebook meta data $document = JFactory::getDocument(); $uri = JURI::getInstance(); $document->setMetaData('og:url', $uri->toString()); $document->setMetaData('og:title', htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8')); $document->setMetaData('og:type', 'website'); if ($task == 'category' && $this->category->image && strpos($this->category->image, 'placeholder/category.png') === false) { $image = substr(JURI::root(), 0, -1) . str_replace(JURI::root(true), '', $this->category->image); $document->setMetaData('og:image', $image); $document->setMetaData('image', $image); } $document->setMetaData('og:description', htmlspecialchars(strip_tags($document->getDescription()), ENT_QUOTES, 'UTF-8')); // Look for template files in component folders $this->_addPath('template', JPATH_BASE . DS . 'components' . DS . 'com_k2' . DS . 'templates'); $this->_addPath('template', JPATH_BASE . DS . 'components' . DS . 'com_k2' . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (K2 template structure) $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates'); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . 'default'); // Look for overrides in template folder (Joomla! template structure) $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'default'); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2'); // Look for specific K2 theme files if ($params->get('theme')) { $this->_addPath('template', JPATH_BASE . DS . 'components' . DS . 'com_k2' . DS . 'templates' . DS . $params->get('theme')); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . 'templates' . DS . $params->get('theme')); $this->_addPath('template', JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_k2' . DS . $params->get('theme')); } $nullDate = $db->getNullDate(); $this->assignRef('nullDate', $nullDate); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('k2'); $dispatcher->trigger('onK2BeforeViewDisplay'); // Prevent spammers from using the tag view if ($task == 'tag' && !count($this->items)) { $tag = JRequest::getString('tag'); $db = JFactory::getDBO(); $db->setQuery('SELECT id FROM #__k2_tags WHERE name = ' . $db->quote($tag)); $tagID = $db->loadResult(); if (!$tagID) { JError::raiseError(404, JText::_('K2_NOT_FOUND')); return false; } } $badchars = array('#', '>', '<', '\\'); $searchword = JString::trim(JString::str_ireplace($badchars, '', JRequest::getString('searchword', null))); if ($params->get('enableHighlightSearchTerm', 0)) { $document->addScript(JURI::root(true) . '/modules/mod_jak2filter/assets/jquery/jquery.highlight-4.js'); $document->addStyleDeclaration('.highlight { background-color: #FFFFCC }'); if (!empty($searchword) && strpos($searchword, '-') !== 0) { $document->addScriptDeclaration("\n\t\t\t\t(function(\$) {\n\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\tif(\$('#k2Container').length) {\n \t\t\t\t\tjak2Highlight(\$('#k2Container'), \"" . addslashes($searchword) . "\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t})(jQuery);\n\t\t\t\t"); } } parent::display($tpl); }
/** * ujTag felvételi form * @return void * &JRequest: limit, limitstart, filterStr, order */ public function ujTag() { JHTML::_('behavior.modal'); $total = 0; $pagination = null; $user = JFactory::getUser(); $db = JFactory::getDBO(); if (!$this->temakorokHelper->isAdmin($user) & !$this->temakor_admin) { echo '<div class="">Access denied</div>'; return; } // alapértelmezett browser status beolvasása sessionból $session = JFactory::getSession(); $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":""}'; $brStatus = JSON_decode($brStatusStr); $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart); $limit = JRequest::getVar('limit', $brStatus->limit); $order = JRequest::getVar('order', $brStatus->order); $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr)); JRequest::setVar('limit', $limit); JRequest::setVar('limitstart', $limitStart); JRequest::setVar('order', $order); JRequest::setVar('filterStr', $filterStr); // adattábla tartalom elérése és átadása a view -nek $items = $this->model->getItems(); //DBG echo $this->model->getDBO()->getQuery(); $this->view->set('Items', $items); // browser müködéshez linkek definiálása $reorderLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list&tas=ujTag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&temakor=' . $this->temakor_id . '&filterStr=' . urlencode($filterStr); $doFilterLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list&task=ujTag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&temakor=' . $this->temakor_id . '&order=' . JRequest::getVar('order', '1'); if ($this->temakor_id > 0) { $itemLink = JURI::base() . 'index.php?option=com_tagok&view=tagok&task=doujtag' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&temakor=' . $this->temakor_id . '&order=' . JRequest::getVar('order', '1'); } $this->view->set('reorderLink', $reorderLink); $this->view->set('doFilterLink', $doFilterLink); $this->view->set('itemLink', $itemLink); // akciók definiálása $akciok = array(); if ($this->temakor_id > 0) { $akciok['temakor'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist&task=browse' . '&temakor=' . $this->temakor_id; } else { $akciok['temakorok'] = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist&task=browse'; } $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_('UJTAG_SUGO') . '&Itemid=435&tmpl=component'; $this->view->set('Akciok', $akciok); $this->view->set('Title', JText::_('UJTAG')); $this->view->set('Temakor', $this->temakor); //lapozósor definiálása jimport('joomla.html.pagination'); $total = $this->model->getTotal($filterStr); $pagination = new JPagination($total, $limitStart, $limit); $pagination->setAdditionalUrlParam('order', $order); $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr)); $pagination->setAdditionalUrlParam('temakor', $this->temakor_id); $this->view->set('LapozoSor', $pagination->getListFooter()); $this->view->setLayout('ujtag'); $this->view->display(); }
/** function that will create pagination for views * @param object $setLimit * total - total number of rows * start - number or index to start e.g 0 ( will start from 0 - limit ) * value - ending number or limit e.g 20 ( will only show 20 rows ) * @return $display */ private static function _pagination($setLimit, $onlyBox = false, $showTotal = false) { jimport('joomla.html.pagination'); $total = $setLimit->total; $start = $setLimit->start; $value = $setLimit->end; $pagination = new JPagination($total, $start, $value); //alex pagination $pagination->setAdditionalUrlParam('limit', JRequest::getVar('limit')); if (version_compare(JVERSION, '3.0.0', '<')) { if ($onlyBox) { $display = "<div class=\"list-footer\">\n"; $display .= "\n<div class=\"limit\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . JText::_('Display Num') . ' ' . $pagination->getLimitBox() . "</div>"; $display .= "\n<div class=\"counter\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . ' ' . $pagination->getPagesCounter() . "</div>"; if ($showTotal) { $display .= "\n<div class=\"outof\" style=\"float:left; height:22px; line-height:22px; margin:0 10px;\">" . ' ' . JText::_('Total Result:') . ' <span style="font-weight: bold; text-decoration: underlined;">' . $total . "</span></div>"; } $display .= "\n</div>"; } else { $display = $pagination->getListFooter(); } } else { $display = '<div style="display:inline; font-size:14px;">'; $display .= '<div class="jnews_pagination_one" style="float:right; margin-left:15px;">'; $display .= $pagination->getLimitBox(); $display .= '</div>'; $pagi = $pagination->getListFooter(); if (!empty($pagi)) { $display .= '<div class="jnews_pagination" style="float:right; margin-left:15px;">'; $display .= $pagi; $display .= '</div>'; } $pagi = $pagination->getPagesCounter(); if (!empty($pagi)) { $display .= '<div style="float:right;padding-top: 4px;">'; $display .= $pagi; $display .= '</div>'; } $display .= '</div>'; } return $display; }
/** * képviselő eddigi szavazatainak megjelenítése * (böngésző képernyő) * @return void * @JRequest integer temakor * @JRequest integer id - kepviselo_id * @JRequest integer limitstart * @JRequest integer limit * @JRequest string filterStr * @JRequest integer order */ public function szavazatok() { JHTML::_('behavior.modal'); $total = 0; $pagination = null; $user = JFactory::getUser(); $db = JFactory::getDBO(); $document = JFactory::getDocument(); $viewType = $document->getType(); $view =& $this->getView('szavazatoklist', $viewType); $model =& $this->getModel('szavazatoklist'); // alapértelmezett browser status beolvasása sessionból $session = JFactory::getSession(); $brStatusStr = $session->get('szavazasoklist_status'); if ($brStatusStr == '') { $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":""}'; } $brStatus = JSON_decode($brStatus); $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart); $limit = JRequest::getVar('limit', $brStatus->limit); $order = JRequest::getVar('order', $brStatus->order); $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr)); // browser status save to session and JRequest $brStatus->limit = $limit; $brStatus->limitStart = $limitStart; $brStatus->order = $order; $brStatus->filterStr = $filterStr; // ebben az esetben inkább ne jegyezze meg.... //$session->set('szavazatoklist_status', JSON_encode($brStatus)); JRequest::setVar('limit', $limit); JRequest::setVar('limitstart', $limitStart); JRequest::setVar('order', $order); JRequest::setVar('filterStr', $filterStr); // adattábla tartalom elérése és átadása a view -nek $items = $model->getItems(); //DBG echo '<p>'.$model->getDBO()->getQuery().'</p>'; // items-temakor-user hozzáférés ellenörzés if ($this->temakorokHelper->isAdmin($user) == false) { for ($i = 0; $i < count($items); $i++) { $item = $items[$i]; if ($item->lathatosag == 1 & $user->id == 0 | $item->lathatosag == 2 & $this->temakorokHelper->userTag($item->id, $user) == false) { // letiltott $items[$i]->szmegenevezes = '***'; $items[$i]->amegenevezes = '***'; $items[$i]->pozicio = '**'; } } } $view->set('Items', $items); // témakör beolvasása $db->setQuery('select * from #__temakorok where id="' . JRequest::getVar('temakor', 0) . '"'); $view->Temakor = $db->loadObject(); if ($view->Temakor == false) { $view->Temakor = new stdclass(); $view->Temakor->megnevezes = JText::_('ALTALANOSKEPVISELO'); $view->Temakor->id = 0; } else { $view->Temakor->megnevezes .= ' ' . JText::_('KEPVISELO'); } // képviselő adatok beolvasása $view->set('Kuser', JFactory::getUser(JRequest::getVar('id', 0))); // browser müködéshez linkek definiálása $reorderLink = JURI::base() . 'index.php?option=com_kepviselok&view=kepviselok&task=szavazatok' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&temakor=' . JRequest::getVar('temakor') . '&id=' . JRequest::getVar('id', 0); $doFilterLink = JURI::base() . 'index.php?option=com_kepviselok&view=kepviselok&task=add' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&order=' . JRequest::getVar('order', '1') . '&temakor=' . JRequest::getVar('temakor') . '&id=' . JRequest::getVar('id', 0); $view->set('reorderLink', $reorderLink); $view->set('doFilterLink', $doFilterLink); // akciók definiálása $akciok = array(); $akciok['back'] = JURI::base() . 'index.php?option=com_kepviselok&view=kepviselok&task=show' . '&temakor=' . JRequest::getVar('temakor') . '&id=' . JRequest::getVar('id', 0); $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_('SZAVAZATOKSUGO') . '&Itemid=435&tmpl=component'; $view->set('Akciok', $akciok); //lapozósor definiálása jimport('joomla.html.pagination'); $total = $model->getTotal($filterStr); $pagination = new JPagination($total, $limitStart, $limit); $pagination->setAdditionalUrlParam('order', $order); $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr)); $view->set('LapozoSor', $pagination->getListFooter()); // display $view->setLayout('browse'); $view->display(); }
/** * browse task * @return void * @request integer limit * @request integer limitstart * @request integer order * @request integer filterStr * @request integer temakor * @request integer szavazas * @session object 'temakoroklist_status' */ public function browse() { jimport('hs.user.user'); JHTML::_('behavior.modal'); $total = 0; $pagination = null; $user = JFactory::getUser(); $db = JFactory::getDBO(); // hozzáférés ellenörzés if ($this->temakorokHelper->isAdmin($user) == false) { if ($this->temakor->lathatosag == 1 & $user->id == 0 | $this->temakor->lathatosag == 2 & $this->temakorokHelper->userTag($this->temakor->id, $user) == false) { // Redirect to login $this->temakorokHelper->getLogin(JText::_('TEMAKOR_NEKED_NEM_ELERHETO')); } } // alapértelmezett browser status beolvasása sessionból $session = JFactory::getSession(); $brStatusStr = $session->get($this->NAME . 'list_status'); if ($brStatusStr == '') { $brStatusStr = '{"limit":20,"limitStart":0,"order":1,"filterStr":"","temakor_id":0,"szavazas_id":0}'; } $brStatus = JSON_decode($brStatusStr); $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart); $limit = JRequest::getVar('limit', $brStatus->limit); $order = JRequest::getVar('order', $brStatus->order); $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr)); if ($this->temakor_id == '') { $this->temakor_id = $brStatus->temakor_id; } if ($this->szavazas_id == '') { $this->szavazas_id = $brStatus->szavazas_id; } // browser status save to session and JRequest $brStatus->limit = $limit; $brStatus->limitStart = $limitStart; $brStatus->order = $order; $brStatus->filterStr = $filterStr; $brStatus->temakor_id = $this->temakor_id; $brStatus->szavazas_id = $this->szavazas_id; $session->set($this->NAME . 'list_status', JSON_encode($brStatus)); JRequest::setVar('limit', $limit); JRequest::setVar('limitstart', $limitStart); JRequest::setVar('order', $order); JRequest::setVar('filterStr', $filterStr); JRequest::setVar('temakor', $this->temakor_id); JRequest::setVar('szavazas', $this->szavazas_id); // adattábla tartalom elérése és átadása a view -nek $items = $this->model->getItems(); $db->setQuery('select sum(igen) igen, sum(nem) nem from #__szavazasok_in where szavazas_id = ' . $db->quote($this->szavazas_id)); $igenNem = $db->loadObject(); // user szavazott? $db->setQuery('select * from #__szavazok where szavazas_id="' . $this->szavazas->id . '" and user_id="' . $user->id . '"'); $szavazo = $db->loadObject(); //DBG echo $this->model->getDBO()->getQuery(); if ($this->model->getError() != '') { $this->view->Msg = $this->model->getError(); } $this->view->set('Items', $items); $this->view->set('igen', $igenNem->igen); $this->view->set('nem', $igenNem->nem); $this->view->set('Temakor', $this->temakor); $this->view->set('Szulok', $this->temakorokHelper->getSzulok()); $this->view->set('Szavazas', $this->szavazas); $this->view->set('Szavazo', $szavazo); $this->view->set('Title', JText::_('ALTERNATIVAK')); $this->view->set('TemakorGroupId', $this->temakorokHelper->getTemakorGroupId($this->temakor->id)); //+ 2014.09.10 Az alternativa név csak akkor link ha jogosult módosítani $this->view->set('isAdmin', $this->temakorokHelper->isAdmin($user)); $this->view->set('temakor_admin', $this->temakor_admin); $this->view->set('user', $user); //- 2014.09.10 Az alternativa név csak akkor link ha jogosult módosítani // hányan szavaztak már? $db->setQuery('select count(distinct szavazo_id) cc from #__szavazatok where szavazas_id="' . $this->szavazas->id . '"'); $res = $db->loadObject(); $szavaztak = $res->cc; $this->view->set('szavaztak', $szavaztak); // browser müködéshez linkek definiálása if ($this->szavazas->vita1 == 1) { $itemLink = JURI::base() . 'index.php?option=com_alternativak&view=alternativak' . '&task=edit' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1') . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } else { $itemLink = ''; } $backLink = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&temakor=' . $this->temakor_id . '&task=browse'; $homeLink = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist' . '&task=browse'; $this->view->set('itemLink', $itemLink); $this->view->set('backLink', $backLink); $this->view->set('homeLink', $homeLink); // van ált. képviselője? $altKepviseloje = 0; $db->setQuery('select k.kepviselo_id, u.name from #__kepviselok k, #__users u where k.kepviselo_id = u.id and k.user_id = "' . $user->id . '" and k.temakor_id=0 and k.szavazas_id = 0 and k.lejarat >= "' . date('Y-m-d') . '"'); $res = $db->loadObject(); if ($db->getErrorNum() > 0) { $db->stderr(); } if ($res) { $altKepviseloje = $res->kepviselo_id; } // van témakör képviselője? $kepviseloje = 0; $db->setQuery('select k.kepviselo_id, u.name from #__kepviselok k, #__users u where k.kepviselo_id = u.id and k.user_id = "' . $user->id . '" and k.temakor_id=' . $this->temakor_id . ' and k.szavazas_id = 0 and k.lejarat >= "' . date('Y-m-d') . '"'); $res = $db->loadObject(); if ($db->getErrorNum() > 0) { $db->stderr(); } if ($res) { $kepviseloje = $res->kepviselo_id; } // Ő maga képviselő jelölt? $kepviseloJelolt = false; $db->setQuery('select user_id from #__kepviselojeloltek where user_id = "' . $user->id . '"'); $res = $db->loadObject(); if ($db->getErrorNum() > 0) { $db->stderr(); } if ($res) { $kepviseloJelolt = true; } // kik az alternativa felvivők? $alternativa_felvivo = $this->alternativa_felvivo($user); // akciók definiálása $akciok = array(); if ($this->temakorokHelper->isAdmin($user) | $szavazas_felvivo == 10 & ($this->szavazas->szavazok = 1) & $user->id > 0 | $szavazas_felvivo == 10 & $this->temakorokHelper->userTag($this->temakor_id, $user) | $this->temakor_admin | $this->alternativa_felvivo($user)) { if ($this->szavazas->vita1 == 1) { $akciok['ujAlternativa'] = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . '&task=add' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id . '&limit=' . JRequest::getVar('limit', 20) . '&limitstart=' . JRequest::getVar('limitstart', 0) . '&order=' . JRequest::getVar('order', 1) . '&filterStr=' . JRequest::getVar('filterStr', ''); } } if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->szavazas->letrehozo == $user->id) { $akciok['szavazasedit'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=edit' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->szavazas->letrehozo == $user->id) { $akciok['szavazastorles'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->temakorIndito($this->temakor_id, $user)) { $akciok['temakoredit'] = JURI::base() . 'index.php?option=com_temakorok&view=temakorok&task=edit' . '&temakor=' . $this->temakor_id; } if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->temakorIndito($this->temakor_id, $user)) { $akciok['temakortorles'] = JURI::base() . 'index.php?option=com_temakorok&view=temakorok&task=deleteform' . '&temakor=' . $this->temakor_id; } if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->temakorIndito($this->temakor_id, $user)) { if ($this->szavazas->vita1 == 1) { $akciok['alternativaedit'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativak&task=edit' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } } if ($this->temakorokHelper->isAdmin($user) | $this->temakor_admin | $this->temakorIndito($this->temakor_id, $user)) { if ($this->szavazas->vita1 == 1) { $akciok['alternativatorles'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativak&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } } if ($this->szavazas->szavazas == 1 & $user->id > 0) { // a szavazás folyamatban van és bejelentkezett user $db = JFactory::getDBO(); $db->setQuery('select id from #__szavazatok where szavazas_id="' . $this->szavazas_id . '" and user_id="' . $user->id . '"'); $res = $db->loadObjectList(); if (count($res) == 0) { // ez a user még nem szavazott if ($this->szavazas->szavazok == 1 | $this->szavazas->szavazok == 2 & $this->temakorokHelper->userTag($this->temakor_id, $user, false) | $this->szavazas->szavazok == 3 & $this->temakorokHelper->userTag($this->temakor_id, $user, true)) { $akciok['szavazok'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=szavazoform&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } } else { $akciok['szavaztal'] = 'Y'; if ($this->szavazas->titkos == 0) { $akciok['szavazatTorles'] = JURI::base() . 'index.php?option=com_alternativak&&task=szavazattorles&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } } } // if ($this->szavazas->lezart == 1) { $akciok['eredmeny'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=eredmeny&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; // } if ($this->szavazas->szavazas == 1 & $user->id > 0) { $akciok['emailszavazas'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=meghivo&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; } $akciok['copy'] = JURI::base() . 'index.php?option=com_alternativak&view=alternativaklist&task=copy' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; $akciok['tagok'] = JURI::base() . 'index.php?option=com_tagok&temakor=' . $this->temakor_id; $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_(strtoupper($this->NAME) . 'LIST_SUGO') . '&Itemid=435&tmpl=component'; $akciok['deleteSzavazas'] = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasok&task=deleteform' . '&temakor=' . $this->temakor_id . '&szavazas=' . $this->szavazas_id; $this->view->set('Akciok', $akciok); // globális képviselő/képviselő jelölt gombok definiálása $altKepviselo = array(); $altKepviselo['kepviselojeLink'] = ''; $kepviselo = array(); $kepviselo['kepviselojeLink'] = ''; $kepviselo['kepviseloJeloltLink'] = ''; $kepviselo['kepviselotValasztLink'] = ''; $kepviselo['ujJeloltLink'] = ''; if ($user->id > 0) { if ($altKepviseloje > 0) { $kepviseloUser = JFactory::getUser($altKepviseloje); if ($kepviseloUser) { $userEx = HsUser::getInstance($altKepviseloje); $altKepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=show&id=' . $altKepviseloje; if (isset($userEx->image)) { $altKepviselo['image'] = $userEx->get('image'); } else { $altKepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />'; } $altKepviselo['nev'] = $kepviseloUser->name; } } if ($kepviseloje > 0) { $kepviseloUser = JFactory::getUser($kepviseloje); if ($kepviseloUser) { $userEx = HsUser::getInstance($kepviseloje); $kepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=show&id=' . $kepviseloje; if (isset($userEx->image)) { $kepviselo['image'] = $userEx->get('image'); } else { $kepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />'; } $kepviselo['nev'] = $kepviseloUser->name; } } else { if ($kepviseloJelolt) { $kepviselo['kepviseloJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselo&task=edit&id=' . $user->id; } else { $kepviselo['kepviselotValasztLink'] = JURI::base() . 'index.php?option=com_kepviselok&task=find&temekor=' . $this->temakor_id . '&szavazas=0'; $kepviselo['ujJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&task=add&temekor=' . $this->temakor_id . '&szavazas=0&id=' . $user->id; } } } $this->view->set('Kepviselo', $kepviselo); $this->view->set('AltKepviselo', $altKepviselo); //lapozósor definiálása jimport('joomla.html.pagination'); $total = $this->model->getTotal($filterStr); $pagination = new JPagination($total, $limitStart, $limit); $pagination->setAdditionalUrlParam('order', $order); $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr)); $this->view->set('LapozoSor', $pagination->getListFooter()); // kacsolodó cikk id-jének elérése és átadása a viewer-nek $db->setQuery('SELECT id from #__content WHERE alias="sz' . $this->szavazas_id . '"'); $res = $db->loadObject(); if ($res) { $this->view->set('CommentId', $res->id); } else { $this->view->set('CommentId', 0); } $this->view->display(); }
/** * browse task * @return void * @request integer limit * @request integer limitstart * @request integer order * @request integer filterStr * @session object 'temakoroklist_status' */ public function browse() { jimport('hs.user.user'); JHTML::_('behavior.modal'); $temakor_id = JRequest::getVar('temakor', 0); $config = $this->temakorokHelper->getConfig($temakor_id); $kepviseletAtruhazasMegngedett = $config->tobbszintu_atruhazas == 1; $total = 0; $pagination = null; $user = JFactory::getUser(); $db = JFactory::getDBO(); // alapértelmezett browser status beolvasása sessionból $session = JFactory::getSession(); $brStatusStr = $session->get($this->NAME . 'list_status'); if ($brStatusStr == '') { $brStatusStr = '{"limit":20,"limitStart":0,"order":1,"filterStr":""}'; } $brStatus = JSON_decode($brStatusStr); $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart); $limit = JRequest::getVar('limit', $brStatus->limit); $order = JRequest::getVar('order', $brStatus->order); $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr)); // browser status save to session and JRequest $brStatus->limit = $limit; $brStatus->limitStart = $limitStart; $brStatus->order = $order; $brStatus->filterStr = $filterStr; $session->set($this->NAME . 'list_status', JSON_encode($brStatus)); JRequest::setVar('limit', $limit); JRequest::setVar('limitstart', $limitStart); JRequest::setVar('order', $order); JRequest::setVar('filterStr', $filterStr); // adattábla tartalom elérése és átadása a view -nek $items = $this->model->getItems(); $this->view->set('Items', $items); // browser müködéshez linkek definiálása $reorderLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr); $doFilterLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . 'list' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&order=' . JRequest::getVar('order', '1'); $itemLink = JURI::base() . 'index.php?option=com_szavazasok&view=szavazasoklist' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1'); $this->view->set('reorderLink', $reorderLink); $this->view->set('doFilterLink', $doFilterLink); $this->view->set('itemLink', $itemLink); // van ált. képviselője? $kepviseloje = 0; $db->setQuery('select k.kepviselo_id, u.name from #__kepviselok k, #__users u where k.kepviselo_id = u.id and k.user_id = "' . $user->id . '" and k.temakor_id=0 and k.szavazas_id = 0 and k.lejarat >= "' . date('Y-m-d') . '"'); $res = $db->loadObject(); if ($db->getErrorNum() > 0) { $db->stderr(); } if ($res) { $kepviseloje = $res->kepviselo_id; } // Ő maga képviselő jelölt? $kepviseloJelolt = false; $db->setQuery('select user_id from #__kepviselojeloltek where user_id = "' . $user->id . '" and temakor_id=0'); $res = $db->loadObject(); if ($db->getErrorNum() > 0) { $db->stderr(); } if ($res) { $kepviseloJelolt = true; } // kik a témakor felvivők? $temakor_felvivo = $this->temakor_felvivo(); // akciók definiálása $akciok = array(); if ($this->temakorokHelper->isAdmin($user) | $temakor_felvivo == 1 & $user->id > 0) { $akciok['ujTemakor'] = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=' . $this->NAME . '&task=add'; } if ($this->temakorokHelper->isAdmin($user)) { $akciok['beallitasok'] = JURI::base() . 'index.php?option=com_beallitasok'; } $akciok['tagok'] = JURI::base() . 'index.php?option=com_tagok'; $akciok['sugo'] = JURI::base() . 'index.php?option=com_content&view=article' . '&id=' . JText::_(strtoupper($this->NAME) . 'LIST_SUGO') . '&Itemid=435&tmpl=component'; $this->view->set('Akciok', $akciok); // globális képviselő/képviselő jelölt gombok definiálása $kepviselo = array(); $kepviselo['kepviselojeLink'] = ''; $kepviselo['kepviseloJeloltLink'] = ''; $kepviselo['kepviselotValasztLink'] = ''; $kepviselo['ujJeloltLink'] = ''; if ($user->id > 0) { if ($kepviseloje > 0) { $kepviseloUser = JFactory::getUser($kepviseloje); if ($kepviseloUser) { $userEx = HsUser::getInstance($kepviseloje); $kepviselo['kepviselojeLink'] = JURI::base() . 'index.php?option=com_kepviselok&view=kepviselok&task=show&id=' . $kepviseloje; if (isset($userEx->image)) { $kepviselo['image'] = $userEx->get('image'); } else { $kepviselo['image'] = '<img src="components/com_hs_users/asset/images/noimage.png" width="50" height="50" />'; } $kepviselo['nev'] = $kepviseloUser->name; } } else { if ($kepviseloJelolt) { $kepviselo['kepviseloJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&view=kepviselojeloltek&task=add&id=' . $user->id; } else { $kepviselo['kepviselotValasztLink'] = JURI::base() . 'index.php?option=com_kepviselok&view=kepviseloklist&task=add&temekor=0&szavazas=0'; $kepviselo['ujJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&task=add&temekor=0&szavazas=0&id=' . $user->id; } } if ($kepviseletAtruhazasMegngedett) { if ($kepviseloje == 0) { $kepviselo['kepviselotValasztLink'] = JURI::base() . 'index.php?option=com_kepviselok&view=kepviseloklist&task=add&temekor=0&szavazas=0'; } if (!$kepviseloJelolt) { $kepviselo['ujJeloltLink'] = JURI::base() . 'index.php?option=com_kepviselojeloltek&task=add&temekor=0&szavazas=0&id=' . $user->id; } } } $this->view->set('Kepviselo', $kepviselo); //lapozósor definiálása jimport('joomla.html.pagination'); $total = $this->model->getTotal($filterStr); $pagination = new JPagination($total, $limitStart, $limit); $pagination->setAdditionalUrlParam('order', $order); $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr)); $this->view->set('LapozoSor', $pagination->getListFooter()); $this->view->display(); }
/** * szavaztam * @return void * @request integer limit * @request integer limitstart * @request integer order * @request integer filterStr * @session object 'temakoroklist_status' */ public function szavaztam() { jimport('hs.user.user'); JHTML::_('behavior.modal'); $total = 0; $pagination = null; $user = JFactory::getUser(); $db = JFactory::getDBO(); // hozzáférés ellenörzés if ($user->id == 0) { $this->temakorokHelper->getLogin(JText::_('JELENTKEZZBE')); } // alapértelmezett browser status beolvasása sessionból $session = JFactory::getSession(); $brStatusStr = '{"limit":20,"limitstart":0,"order":1,"filterStr":"|1"}'; $brStatus = JSON_decode($brStatus); $limitStart = JRequest::getVar('limitstart', $brStatus->limitstart); $limit = JRequest::getVar('limit', $brStatus->limit); $order = JRequest::getVar('order', $brStatus->order); $filterStr = urldecode(JRequest::getVar('filterStr', $brStatus->filterStr)); if ($this->temakor_id == '') { $this->temakor_id = $brStatus->temakor_id; } JRequest::setVar('limit', $limit); JRequest::setVar('limitstart', $limitStart); JRequest::setVar('order', $order); JRequest::setVar('filterStr', $filterStr); JRequest::setVar('temakor', $this->temakor_id); // adattábla tartalom elérése és átadása a view -nek $items = $this->model->getItems(); if ($this->model->getDBO()->getErrorNum() > 0) { $this->model->getDBO()->stderr(); } if ($this->model->getError() != '') { $this->view->Msg = $this->model->getError(); } $this->view->set('Items', $items); $this->view->set('Title', JText::_('SZAVAZASOK_SZAVAZTAM')); // browser müködéshez linkek definiálása $reorderLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=szavazhatok&task=szavazhatok' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&temakor=' . $this->temakor_id; $doFilterLink = JURI::base() . 'index.php?option=com_' . $this->NAME . '&view=szavazhatok&task=szavazhatok' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&order=' . JRequest::getVar('order', '1') . '&temakor=' . $this->temakor_id; $itemLink = JURI::base() . 'index.php?option=com_alternativak&view=alternativaklist&task=szavazhatok' . '&task=browse' . '&limit=' . JRequest::getVar('limit', '20') . '&limitstart=0' . '&filterStr=' . urlencode($filterStr) . '&order=' . JRequest::getVar('order', '1'); $backLink = JURI::base() . 'index.php?option=com_temakorok&view=temakoroklist' . '&task=browse'; $this->view->set('reorderLink', $reorderLink); $this->view->set('doFilterLink', $doFilterLink); $this->view->set('itemLink', $itemLink); $this->view->set('backLink', $backLink); $this->view->set('temakorLink', $temakorLink); // kik a szavazaás felvivők? $szavazas_felvivo = $this->szavazas_felvivo(); // akciók definiálása $akciok = array(); $this->view->set('Akciok', $akciok); //lapozósor definiálása jimport('joomla.html.pagination'); $total = $this->model->getTotal($filterStr); $pagination = new JPagination($total, $limitStart, $limit); $pagination->setAdditionalUrlParam('order', $order); $pagination->setAdditionalUrlParam('filterStr', urlencode($filterStr)); $this->view->set('LapozoSor', $pagination->getListFooter()); $this->view->display(); }
public function showMessages() { jimport('joomla.html.pagination'); $app = JFactory::getApplication(); $my = JXFactory::getUser(); $jconfig = new JConfig(); $html = ''; if ($ids = JRequest::getVar('ids', '')) { $filter['id'] = $ids; } $model = StreamFactory::getModel('stream'); $data = $model->getStream($filter, $jconfig->list_limit, JRequest::getVar('limitstart', 0)); // for some reason, data retrieved has not permissable view message foreach ($data as $streamMsg) { if (!$my->authorise('stream.message.read', $streamMsg)) { $app = JFactory::getApplication(); $app->redirect(JURI::base(), JText::_('COM_STREAM_ERROR_NO_ACCESS'), 'error'); exit; } } $total = $model->countStream($filter); // Pagination $pagination = new JPagination($total, JRequest::getVar('limitstart', 0), $jconfig->list_limit); // If URI is defined, we need to set the pagination link properly if ($uri = JRequest::getVar('uri', '')) { $uri = new JURI($uri); $router = $app->getRouter(); $result = $router->parse($uri); foreach ($result as $key => $val) { $pagination->setAdditionalUrlParam($key, $val); } } $tmpl = new StreamTemplate(); $tmpl->set('rows', $data); $tmpl->set('total', $total); $tmpl->set('pagination', $pagination); $html .= $tmpl->fetch('stream.data'); return $html; }