function __construct(XiptModel &$model) { $limit = null; $limitstart = null; $this->initDefaultStates($model, $limit, $limitstart); return parent::__construct($model->getTotal(), $limitstart, $limit); }
/** * TuiyoModelPhotos::getPhotos() * An array of all photos belonging to userID * @param mixed $userID * @param mixed $albumID * @param mixed $limit * @param mixed $published * @param bool $newFirst * @return */ public function getPhotos($userID, $albumID = NULL, $published = NULL, $newFirst = TRUE, $uselimit = TRUE, $overiteLimit = NULL) { $limit = $uselimit ? $this->getState('limit') : NULL; $limit = !is_null($overiteLimit) ? (int) $overiteLimit : $limit; $limitstart = $this->getState('limitstart'); //1. Get all Photos $photosTable = TuiyoLoader::table("photos", true); $photos = $photosTable->getAllPhotos($userID, $albumID, $limitstart, $published, $newFirst, $limit); //print_R( $photos ); //1b. Paginate? jimport('joomla.html.pagination'); $dbo = $photosTable->_db; $this->_total = $dbo->loadResult(); $pageNav = new JPagination($this->_total, $limitstart, $limit); $root = JURI::root(); $this->pageNav = $pageNav->getPagesLinks(); //Set the total count $this->setState('total', $this->_total); $this->setState('pagination', $this->pageNav); //2. Check the existence of each photo! foreach ($photos as $photo) { $photo->date_added = TuiyoTimer::diff(strtotime($photo->date_added)); $photo->last_modified = TuiyoTimer::diff(strtotime($photo->last_modified)); $photo->src_original = $root . substr($photo->src_original, 1); $photo->src_thumb = $root . substr($photo->src_thumb, 1); } return (array) $photos; }
/** * Application full view **/ function appFullView() { $document =& JFactory::getDocument(); $this->showSubmenu(); $applicationName = JString::strtolower(JRequest::getVar('app', '', 'GET')); if (empty($applicationName)) { JError::raiseError(500, 'CC APP ID REQUIRED'); } if (!$this->accessAllowed('registered')) { return; } $output = ''; //@todo: Since group walls doesn't use application yet, we process it manually now. if ($applicationName == 'walls') { CFactory::load('libraries', 'wall'); $jConfig = JFactory::getConfig(); $limit = $jConfig->get('list_limit'); $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST'); $eventId = JRequest::getVar('eventid', '', 'GET'); $my = CFactory::getUser(); $config = CFactory::getConfig(); $eventsModel = CFactory::getModel('Events'); $event =& JTable::getInstance('Event', 'CTable'); $event->load($eventId); $config = CFactory::getConfig(); $document->setTitle(JText::sprintf('CC EVENTS WALL TITLE', $event->title)); CFactory::load('helpers', 'owner'); $guest = $event->isMember($my->id); $waitingApproval = $event->isPendingApproval($my->id); $status = $event->getUserStatus($my->id); $responded = $status == COMMUNITY_EVENT_STATUS_ATTEND || $status == COMMUNITY_EVENT_STATUS_WONTATTEND || $status == COMMUNITY_EVENT_STATUS_MAYBE; if (!$config->get('lockeventwalls') || $config->get('lockeventwalls') && $guest && !$waitingApproval && $responded || COwnerHelper::isCommunityAdmin()) { $output .= CWallLibrary::getWallInputForm($event->id, 'events,ajaxSaveWall', 'events,ajaxRemoveWall'); // Get the walls content $output .= '<div id="wallContent">'; $output .= CWallLibrary::getWallContents('events', $event->id, $event->isAdmin($my->id), 0, $limitstart, 'wall.content', 'events,events'); $output .= '</div>'; jimport('joomla.html.pagination'); $wallModel = CFactory::getModel('wall'); $pagination = new JPagination($wallModel->getCount($event->id, 'events'), $limitstart, $limit); $output .= '<div class="pagination-container">' . $pagination->getPagesLinks() . '</div>'; } } else { CFactory::load('libraries', 'apps'); $model = CFactory::getModel('apps'); $applications =& CAppPlugins::getInstance(); $applicationId = $model->getUserApplicationId($applicationName); $application = $applications->get($applicationName, $applicationId); if (!$application) { JError::raiseError(500, 'CC APPLICATION NOT FOUND'); } // Get the parameters $manifest = JPATH_PLUGINS . DS . 'community' . DS . $applicationName . DS . $applicationName . '.xml'; $params = new JParameter($model->getUserAppParams($applicationId), $manifest); $application->params =& $params; $application->id = $applicationId; $output = $application->onAppDisplay($params); } echo $output; }
/** * Creates a pagination using the passed in values * * @param array $config Configuration Options * total => list total, limit => list limit, offset => list start offset * * @return string */ public function pagination(array $config) { $config = new KConfig($config); jimport('joomla.html.pagination'); $pagination = new JPagination($config->total, $config->offset, $config->limit); return $pagination->getListFooter(); }
function _displaylist($tpl = null) { $document = JFactory::getDocument(); $this->assignRef('rules', $this->rules); $pagination = new JPagination($this->total, $this->limitstart, $this->limit); $document->setTitle($document->getTitle() . ' - ' . $pagination->getPagesCounter()); $this->assignRef('pagination', $pagination); $this->assignRef('params', $this->params); parent::display($tpl); }
function DefaultPaginationSearchForm($total, $limitstart, $limit) { jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); ?> <div class="jev_pagination"> <?php echo $pageNav->getListFooter(); ?> </div> <?php }
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); }
function _displaydetailrank($tpl = null) { $document = JFactory::getDocument(); $this->assignRef('detailrank', $this->detailrank); $pagination = new JPagination($this->total, $this->limitstart, $this->limit); // insert the page counter in the title of the window page $document->setTitle($document->getTitle() . ' - ' . $pagination->getPagesCounter()); $this->assignRef('pagination', $pagination); $this->assignRef('params', $this->params); $this->assignRef('useAvatarFrom', $this->useAvatarFrom); $this->assignRef('linkToProfile', $this->linkToProfile); $this->assignRef('allowGuestUserViewProfil', $this->allowGuestUserViewProfil); parent::display("listing"); }
/** * TuiyoModelNotifications::getAllNotifications() * Add function documentation * @param mixed $userID * @param mixed $status * @return void */ public function getAllNotifications($userID, $status = NULL) { $nTable = TuiyoLoader::table("notifications", true); $limit = $this->getState('limit'); $limitstart = $this->getState('limitstart'); $notices = $nTable->getUserNotifications((int) $userID, $limitstart, $limit); //1b. Paginate? jimport('joomla.html.pagination'); $dbo = $nTable->_db; $this->_total = $dbo->loadResult(); $pageNav = new JPagination($this->_total, $limitstart, $limit); $this->pageNav = $pageNav->getPagesLinks(); //Set the total count $this->setState('total', $this->_total); $this->setState('pagination', $this->pageNav); return $notices; }
function __construct($total, $limitstart, $limit) { global $mainframe; if ($limit == "") { $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); } parent::__construct($total, $limitstart, $limit); }
function __construct($total, $limitstart, $limit, $prefix = '') { // If out of range, use last page if ($total < (int) $limitstart) $limitstart = intval($total / $limit) * $limit; parent::__construct($total, $limitstart, $limit, $prefix); $this->setDisplay(); if ($limitstart === false) $this->set('pages.current', -1); $this->template = KunenaFactory::getTemplate(); }
/** * Constructor * * @param int $total The total number of items * @param int $limitstart The offset of the item to start at * @param int $limit The number of items to display per page * @param string $prefix The prefix used for request variables * @param string $anchortag The anchor to use for the URLs * @param string $onclick The contents of an optional 'onlick' attribute * @return void * @since 2.0 */ public function __construct($total, $limitstart, $limit, $prefix = '', $anchortag = 'category', $onclick = null) { parent::__construct($total, $limitstart, $limit, $prefix); $this->anchortag = ''; if ($anchortag) { $this->anchortag = JHtml::_('joomgallery.anchor', $anchortag); } if ($onclick) { $this->onclick = '" onclick="' . $onclick; } }
function DefaultPaginationForm($total, $limitstart, $limit) { jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); $Itemid = JRequest::getInt("Itemid"); $task = JRequest::getVar("jevtask"); $link = JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&Itemid={$Itemid}&task={$task}"); ?> <div class="jev_pagination"> <form action="<?php echo $link; ?> " method="post"> <?php // TODO add in catids so that changing it doesn't look the data echo $pageNav->getListFooter(); ?> </form> </div> <?php }
function _display($tpl = null) { $document = JFactory::getDocument(); $uri = JFactory::getURI(); $uri2string = $uri->toString(); $document->addScript(JURI::base(true) . '/media/system/js/core.js'); $pagination = new JPagination($this->total, $this->limitstart, $this->limit); // insert the page counter in the title of the window page $titlesuite = $this->limitstart ? ' - ' . $pagination->getPagesCounter() : ''; $document->setTitle($document->getTitle() . $titlesuite); $this->assignRef('params', $this->params); $this->assignRef('allowGuestUserViewProfil', $this->allowGuestUserViewProfil); $this->assignRef('rows', $this->rows); $this->assignRef('lists', $this->lists); $this->assignRef('limit', $this->limit); $this->assignRef('pagination', $pagination); $this->assignRef('action', $uri2string); $this->assignRef('useAvatarFrom', $this->useAvatarFrom); $this->assignRef('linkToProfile', $this->linkToProfile); parent::display($tpl); }
/** * Retrieves the html block for pagination codes * * @since 1.0 * @access public * @param bool Determines if we should use the normal post form. * @return string The html codes for the pagination. */ public function getListFooter($path = 'admin', $url = '') { // Retrieve pages data from Joomla itself. $theme = FD::themes(); // If there's nothing here, no point displaying the pagination if ($this->pagination->total == 0) { return; } $data = $this->pagination->getData(); $theme->set('data', $data); $theme->set('pagination', $this->pagination); $contents = $theme->output($path . '/pagination/default'); return $contents; }
function __construct($total, $limitstart, $limit, $perRow = 3) { if ($perRow !== 0) { $this->_perRow = $perRow; } $this->prefix = 'com_customfilters'; parent::__construct($total, $limitstart, $limit); //ItemId $module = JModuleHelper::getModule('mod_cf_filtering'); $params = new JRegistry(); $params->loadString($module->params); $itemId = $params->get('cf_itemid', ''); if (!empty($itemId)) { $this->setAdditionalUrlParam('Itemid', $itemId); } }
/** * This method tests the. * * This is a basic data driven test. It takes the data passed, runs the constructor * and make sure the appropriate values get setup. * * @return void * * @since 11.1 * @dataProvider dataTestConstructor * @covers JPagination::__construct */ public function testConstructor($total, $limitstart, $limit, $expected) { $pagination = new JPagination($total, $limitstart, $limit); $this->assertEquals($expected['total'], $pagination->total, 'Wrong Total'); $this->assertEquals($expected['limitstart'], $pagination->limitstart, 'Wrong Limitstart'); $this->assertEquals($expected['limit'], $pagination->limit, 'Wrong Limit'); $this->assertEquals($expected['pages.total'], $pagination->get('pages.total'), 'Wrong Total Pages'); $this->assertEquals($expected['pages.current'], $pagination->get('pages.current'), 'Wrong Current Page'); $this->assertEquals($expected['pages.start'], $pagination->get('pages.start'), 'Wrong Start Page'); $this->assertEquals($expected['pages.stop'], $pagination->get('pages.stop'), 'Wrong Stop Page'); unset($pagination); }
protected function _buildDataObject() { // Workaround for JRoute not allowing url-encoded ampersand %26 in values of variables $data = parent::_buildDataObject(); if (!empty($data->pages)) { foreach ($data->pages as $i => $page) { $page->link = str_replace('__amp__', '%26', $page->link); } } if (!empty($data->start->link)) { $data->start->link = str_replace('__amp__', '%26', $data->start->link); } if (!empty($data->end->link)) { $data->end->link = str_replace('__amp__', '%26', $data->end->link); } if (!empty($data->next->link)) { $data->next->link = str_replace('__amp__', '%26', $data->next->link); } if (!empty($data->previous->link)) { $data->previous->link = str_replace('__amp__', '%26', $data->previous->link); } return $data; }
public function getLimitBox() { $app = JFactory::getApplication(); $limits = array(); $limitArray = JUDirectoryFrontHelper::customLimitBox(); $keyAllLimit = array_search(0, $limitArray); if ($keyAllLimit) { $limitAll = true; unset($limitArray[$keyAllLimit]); } else { $limitAll = false; } $limitArray = array_values($limitArray); sort($limitArray); if (empty($limitArray)) { return parent::getLimitBox(); } foreach ($limitArray as $limitValue) { $limits[] = JHtml::_('select.option', "{$limitValue}"); } if ($limitAll) { $limits[] = JHtml::_('select.option', '0', JText::_('JALL')); } $jversion_arr = explode(".", JVERSION); $priVersion = $jversion_arr[0]; if ($priVersion == 2) { $selected = $this->_viewall ? 0 : $this->limit; } elseif ($priVersion == 3) { $selected = $this->viewall ? 0 : $this->limit; } if ($app->isAdmin()) { $html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="Joomla.submitform();"', 'value', 'text', $selected); } else { $html = JHtml::_('select.genericlist', $limits, $this->prefix . 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected); } return $html; }
/** * Plugin that adds a pagebreak into the text and truncates text at that point * * @param string $context The context of the content being passed to the plugin. * @param object &$row The article object. Note $article->text is also available * @param mixed &$params The article params * @param integer $page The 'page' number * * @return mixed Always returns void or true * * @since 1.6 */ public function onContentPrepare($context, &$row, &$params, $page = 0) { $canProceed = $context == 'com_content.article'; if (!$canProceed) { return; } $style = $this->params->get('style', 'pages'); // Expression to search for. $regex = '#<hr(.*)class="system-pagebreak"(.*)\\/>#iU'; $input = JFactory::getApplication()->input; $print = $input->getBool('print'); $showall = $input->getBool('showall'); if (!$this->params->get('enabled', 1)) { $print = true; } if ($print) { $row->text = preg_replace($regex, '<br />', $row->text); return true; } // Simple performance check to determine whether bot should process further. if (JString::strpos($row->text, 'class="system-pagebreak') === false) { return true; } $view = $input->getString('view'); $full = $input->getBool('fullview'); if (!$page) { $page = 0; } if ($params->get('intro_only') || $params->get('popup') || $full || $view != 'article') { $row->text = preg_replace($regex, '', $row->text); return; } // Find all instances of plugin and put in $matches. $matches = array(); preg_match_all($regex, $row->text, $matches, PREG_SET_ORDER); if ($showall && $this->params->get('showall', 1)) { $hasToc = $this->params->get('multipage_toc', 1); if ($hasToc) { // Display TOC. $page = 1; $this->_createToc($row, $matches, $page); } else { $row->toc = ''; } $row->text = preg_replace($regex, '<br />', $row->text); return true; } // Split the text around the plugin. $text = preg_split($regex, $row->text); // Count the number of pages. $n = count($text); // We have found at least one plugin, therefore at least 2 pages. if ($n > 1) { $title = $this->params->get('title', 1); $hasToc = $this->params->get('multipage_toc', 1); // Adds heading or title to <site> Title. if ($title) { if ($page) { if ($page && @$matches[$page - 1][2]) { $attrs = JUtility::parseAttributes($matches[$page - 1][1]); if (@$attrs['title']) { $row->page_title = $attrs['title']; } } } } // Reset the text, we already hold it in the $text array. $row->text = ''; if ($style == 'pages') { // Display TOC. if ($hasToc) { $this->_createToc($row, $matches, $page); } else { $row->toc = ''; } // Traditional mos page navigation $pageNav = new JPagination($n, $page, 1); // Page counter. $row->text .= '<div class="pagenavcounter">'; $row->text .= $pageNav->getPagesCounter(); $row->text .= '</div>'; // Page text. $text[$page] = str_replace('<hr id="system-readmore" />', '', $text[$page]); $row->text .= $text[$page]; // $row->text .= '<br />'; $row->text .= '<div class="pager">'; // Adds navigation between pages to bottom of text. if ($hasToc) { $this->_createNavigation($row, $page, $n); } // Page links shown at bottom of page if TOC disabled. if (!$hasToc) { $row->text .= $pageNav->getPagesLinks(); } $row->text .= '</div>'; } else { $t[] = $text[0]; $t[] = (string) JHtml::_($style . '.start', 'article' . $row->id . '-' . $style); foreach ($text as $key => $subtext) { if ($key >= 1) { $match = $matches[$key - 1]; $match = (array) JUtility::parseAttributes($match[0]); if (isset($match['alt'])) { $title = stripslashes($match['alt']); } elseif (isset($match['title'])) { $title = stripslashes($match['title']); } else { $title = JText::sprintf('PLG_CONTENT_PAGEBREAK_PAGE_NUM', $key + 1); } $t[] = (string) JHtml::_($style . '.panel', $title, 'article' . $row->id . '-' . $style . $key); } $t[] = (string) $subtext; } $t[] = (string) JHtml::_($style . '.end'); $row->text = implode(' ', $t); } } return true; }
/** * Application full view * */ public function appFullView() { /** * Opengraph */ // CHeadHelper::setType('website', JText::_('COM_COMMUNITY_PHOTOS_WALL_TITLE')); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $applicationName = JString::strtolower($jinput->get->get('app', '', 'STRING')); if (empty($applicationName)) { JError::raiseError(500, JText::_('COM_COMMUNITY_APP_ID_REQUIRED')); } $output = '<div class="joms-page">'; $output .= '<h3 class="joms-page__title">' . JText::_('COM_COMMUNITY_PHOTOS_WALL_TITLE') . '</h3>'; if ($applicationName == 'walls') { //CFactory::load( 'libraries' , 'wall' ); $limit = $jinput->request->get('limit', 5, 'INT'); //JRequest::getVar( 'limit' , 5 , 'REQUEST' ); $limitstart = $jinput->request->get('limitstart', 0, 'INT'); //JRequest::getVar( 'limitstart', 0, 'REQUEST' ); $albumId = JRequest::getInt('albumid', ''); $my = CFactory::getUser(); $album = JTable::getInstance('Album', 'CTable'); $album->load($albumId); //CFactory::load( 'helpers' , 'owner' ); //CFactory::load( 'helpers' , 'friends' ); // Get the walls content $viewAllLink = false; $wallCount = false; if ($jinput->request->get('task', '') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls'); $wallCount = CWallLibrary::getWallCount('album', $album->id); } $output .= CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || COwnerHelper::isMine($my->id, $album->creator), $limit, $limitstart); if (CFriendsHelper::isConnected($my->id, $album->creator) || COwnerHelper::isCommunityAdmin()) { $output .= CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall'); } $output .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); jimport('joomla.html.pagination'); $wallModel = CFactory::getModel('wall'); $pagination = new JPagination($wallModel->getCount($album->id, 'albums'), $limitstart, $limit); $output .= '<div class="cPagination">' . $pagination->getPagesLinks() . '</div>'; } else { $model = CFactory::getModel('apps'); $applications = CAppPlugins::getInstance(); $applicationId = $model->getUserApplicationId($applicationName); $application = $applications->get($applicationName, $applicationId); if (is_callable(array($application, 'onAppDisplay'), true)) { // Get the parameters $manifest = CPluginHelper::getPluginPath('community', $applicationName) . '/' . $applicationName . '/' . $applicationName . '.xml'; $params = new CParameter($model->getUserAppParams($applicationId), $manifest); $application->params = $params; $application->id = $applicationId; $output = $application->onAppDisplay($params); } else { JError::raiseError(500, JText::_('COM_COMMUNITY_APPS_NOT_FOUND')); } } $output .= '</div>'; echo $output; }
function products() { $mainframe = JFactory::getApplication(); $jshopConfig = JSFactory::getConfig(); $session = JFactory::getSession(); $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']); $session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeLoadProductList', array()); $vendor_id = JRequest::getInt("vendor_id"); $vendor = JSFactory::getTable('vendor', 'jshop'); $vendor->load($vendor_id); $dispatcher->trigger('onBeforeDisplayVendor', array(&$vendor)); appendPathWay($vendor->shop_name); $seo = JSFactory::getTable("seo", "jshop"); $seodata = $seo->loadData("vendor-product-" . $vendor_id); if (!isset($seodata->title) || $seodata->title == "") { $seodata = new stdClass(); $seodata->title = $vendor->shop_name; $seodata->keyword = $vendor->shop_name; $seodata->description = $vendor->shop_name; } setMetaData($seodata->title, $seodata->keyword, $seodata->description); $action = xhtmlUrl($_SERVER['REQUEST_URI']); $products_page = $jshopConfig->count_products_to_page; $count_product_to_row = $jshopConfig->count_products_to_row; $context = "jshoping.vendor.front.product"; $contextfilter = "jshoping.list.front.product.vendor." . $vendor_id; $orderby = $mainframe->getUserStateFromRequest($context . 'orderby', 'orderby', $jshopConfig->product_sorting_direction, 'int'); $order = $mainframe->getUserStateFromRequest($context . 'order', 'order', $jshopConfig->product_sorting, 'int'); $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', $products_page, 'int'); if (!$limit) { $limit = $products_page; } $limitstart = JRequest::getInt('limitstart'); if ($order == 4) { $order = 1; } $orderbyq = getQuerySortDirection($order, $orderby); $image_sort_dir = getImgSortDirection($order, $orderby); $field_order = $jshopConfig->sorting_products_field_s_select[$order]; $filters = getBuildFilterListProduct($contextfilter, array("vendors")); $total = $vendor->getCountProducts($filters); jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $pagenav = $pagination->getPagesLinks(); $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'vendor')); if ($limitstart >= $total) { $limitstart = 0; } $rows = $vendor->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit); addLinkToProducts($rows, 0, 1); foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) { $sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value'); } insertValueInArray($products_page, $jshopConfig->count_product_select); foreach ($jshopConfig->count_product_select as $key => $value) { $product_count[] = JHTML::_('select.option', $key, $value, 'count_id', 'count_value'); } $sorting_sel = JHTML::_('select.genericlist', $sorts, 'order', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'sort_id', 'sort_value', $order); $product_count_sel = JHTML::_('select.genericlist', $product_count, 'limit', 'class = "inputbox" size = "1" onchange = "submitListProductFilters()"', 'count_id', 'count_value', $limit); $_review = JSFactory::getTable('review', 'jshop'); $allow_review = $_review->getAllowReview(); if ($jshopConfig->show_product_list_filters) { $first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'manufacturer_id', 'name'); $_manufacturers = JSFactory::getTable('manufacturer', 'jshop'); $listmanufacturers = $_manufacturers->getList(); array_unshift($listmanufacturers, $first_el); if (isset($filters['manufacturers'][0])) { $active_manufacturer = $filters['manufacturers'][0]; } else { $active_manufacturer = ''; } $manufacuturers_sel = JHTML::_('select.genericlist', $listmanufacturers, 'manufacturers[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'manufacturer_id', 'name', $active_manufacturer); $first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'category_id', 'name'); $categories = buildTreeCategory(1); array_unshift($categories, $first_el); if (isset($filters['categorys'][0])) { $active_category = $filters['categorys'][0]; } else { $active_category = 0; } $categorys_sel = JHTML::_('select.genericlist', $categories, 'categorys[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'category_id', 'name', $active_category); } else { $categorys_sel = null; $manufacuturers_sel = null; } $willBeUseFilter = willBeUseFilter($filters); $display_list_products = count($rows) > 0 || $willBeUseFilter; $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows)); $view_name = "vendor"; $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name); $view = $this->getView($view_name, getDocumentType(), '', $view_config); $view->setLayout("products"); $view->assign('config', $jshopConfig); $view->assign('template_block_list_product', "list_products/list_products.php"); $view->assign('template_no_list_product', "list_products/no_products.php"); $view->assign('template_block_form_filter', "list_products/form_filters.php"); $view->assign('template_block_pagination', "list_products/block_pagination.php"); $view->assign('path_image_sorting_dir', $jshopConfig->live_path . 'images/' . $image_sort_dir); $view->assign('filter_show', 1); $view->assign('filter_show_category', 1); $view->assign('filter_show_manufacturer', 1); $view->assign('pagination', $pagenav); $view->assign('pagination_obj', $pagination); $view->assign('display_pagination', $pagenav != ""); $view->assign("rows", $rows); $view->assign("count_product_to_row", $count_product_to_row); $view->assign("vendor", $vendor); $view->assign('action', $action); $view->assign('allow_review', $allow_review); $view->assign('orderby', $orderby); $view->assign('product_count', $product_count_sel); $view->assign('sorting', $sorting_sel); $view->assign('categorys_sel', $categorys_sel); $view->assign('manufacuturers_sel', $manufacuturers_sel); $view->assign('filters', $filters); $view->assign('willBeUseFilter', $willBeUseFilter); $view->assign('display_list_products', $display_list_products); $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1)); $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view)); $view->display(); }
function insertHTML() { $article = $this->article; $model = $this->getModel(); $mainframe = JFactory::getApplication(); $doc =& JFactory::getDocument(); if (JPATH_BASE != JPATH_ADMINISTRATOR) { $doc->addStyleSheet('components/com_ginclude/css/general.css'); $doc->addStyleSheet('components/com_ginclude/css/component.css'); } if (@$_REQUEST['part'] != '') { $part = $_REQUEST['part']; } else { $part = -1; } $articleParts = $model->getParts($article->id, $part); $result = ''; $result .= '<div style="position:relative;"><h3>' . JText::_('ARTICLE') . ': ' . $article->title . '</h3>'; $result .= JText::_('SECTION') . ': <strong>' . $article->section . '</strong> ' . JText::_('CATEGORY') . ': <strong>' . $article->categorie . '</strong> ' . JText::_('CREATED') . ': <strong>' . $article->cdate . '</strong>'; $result .= '<div style="position:absolute;right:5px;top:10px;"><button onclick="location.href=\'index.php?option=com_ginclude&task=articles&tmpl=component\';">' . JText::_('SELECT_OTHER_ARTICLE') . '</button></div>'; $result .= '</div>'; if ($articleParts === false) { /*clanek neni rozdelen na casti => nabidneme ho ke vlozeni cely*/ $result .= '<div><a href="javascript:parent.gInclude(\'' . $article->id . '\',\'-1\');">' . JText::_('INSERT_FULL_ARTICLE') . '</a></div>'; } else { /*nacetli jsme jednotlive sekce, tak zobrazime vyber*/ /*strankovani*/ $limit = JRequest::getVar('limit', $mainframe->getCfg(list_limit)); $limitstart = JRequest::getVar('limitstart', 0); $articles = $model->getArticles(JRequest::getInt('section', -1), JRequest::getInt('categorie', -1), JRequest::getString('filter', ''), JRequest::getCmd('filter_order', 'title'), JRequest::getCmd('filter_order_Dir', 'asc'), $limitstart, $limit); $total = 0; /**/ $result .= '<form action="index.php" id="adminForm" name="adminForm"> <input type="hidden" name="article" value="' . $article->id . '" /> <input type="hidden" name="tmpl" value="component" /> <input type="hidden" name="task" value="insert" /> <input type="hidden" name="option" value="com_ginclude" /> <table class="adminlist" cellspacing="1">'; $result .= '<thead><tr><th style="text-align:left;">' . JText::_('ARTICLE_SECTION') . ': <select name="part" onchange="document.getElementById(\'adminForm\').submit();"><option value="-1">--' . JText::_('SELECT') . '--</option>'; if (count($articleParts['main']) > 0) { foreach ($articleParts['main'] as $key => $value) { $result .= '<option value="' . $key . '"'; if ($key == $part) { $result .= ' selected="selected" '; } $result .= '>' . $value . '</option>'; } } $result .= '</select>'; if ($part != -1) { $result .= ' <a href="javascript:parent.gInclude(\'' . $article->id . '\',\'' . $part . '\');" style="font-weight:normal;">' . JText::_('INSERT_SECTION_CONTENT') . '</a> '; } $result .= '</th></tr></thead>'; if ($part == -1) { /*neni vybrana zadna sekce clanku -> musime vypsat info pro uzivatele*/ $result .= '<tbody><tr><td>' . JText::_('ARTICLE_SECTION_SELECT') . '</td></tr></tbody>'; } elseif (count($articleParts['part']) > 0) { /*v dané sekci jsou vložitelné oblasti*/ $result .= '<tbody>'; $rowClass = 'row1'; $pos = -1; $max = $limit + $limitstart; if (count($articleParts['part']) > 0) { foreach ($articleParts['part'] as $key => $value) { $pos++; if ($pos >= $limitstart && $pos < $max) { if ($rowClass == 'row0') { $rowClass = 'row1'; } else { $rowClass = 'row0'; } $result .= '<tr class="' . $rowClass . '"><td><a href="javascript:parent.gInclude(\'' . $article->id . '\',\'' . $key . '\');">' . $value . '</a></td></tr>'; } } } $total = $pos + 1; $result .= '</tbody>'; } else { /*nejsou žádné konkrétní obsahy*/ $result .= '<tbody><tr class="row0"><td><a href="javascript:parent.gInclude(\'' . $article->id . '\',\'' . $part . '\');">' . JText::_('INSERT_CONTENT') . '...</a></td></tr></tbody>'; } jimport('joomla.html.pagination'); if ($total > 1) { $pageNav = new JPagination($total, $limitstart, $limit); $result .= '<tfoot><tr><td>' . $pageNav->getListFooter() . '</td></tr></tfoot></table>'; } $result .= '</table>'; $result .= '</form>'; } return $result; }
public static function _getArticleHTML($userid, $limit, $limitstart, $row, $app, $total, $cat, $myblogItemId, $introtext, $params) { JPluginHelper::importPlugin('content'); $dispatcher = JDispatcher::getInstance(); $html = ""; if (!empty($row)) { $html .= '<div id="application-myarticles" class="joms-tab__app">'; $html .= '<ul class="list-articles cResetList">'; foreach ($row as $data) { $text_limit = $params->get('limit', 50); if (JString::strlen($data->introtext) > $text_limit) { $content = strip_tags(JString::substr($data->introtext, 0, $text_limit)); $content .= " ....."; } else { $content = $data->introtext; } $data->text = $content; $result = $dispatcher->trigger('onPrepareContent', array(&$data, &$params, 0)); if (empty($data->permalink)) { $myblog = 0; $permalink = ""; } else { $myblog = 1; $permalink = $data->permalink; } if (empty($cat[$data->catid])) { $cat[$data->catid] = ""; } $data->sectionid = empty($data->sectionid) ? 0 : $data->sectionid; $link = plgCommunityMyArticles::buildLink($data->id, $data->alias, $data->catid, $cat[$data->catid], $data->sectionid, $myblog, $permalink, $myblogItemId); $created = new JDate($data->created); $date = CTimeHelper::timeLapse($created); $html .= ' <li>'; $html .= ' <span class="joms-text--small">' . $date . '</span>'; $html .= ' <a href="' . $link . '">' . htmlspecialchars($data->title) . '</a>'; if ($introtext == 1) { $html .= '<p>' . $content . '</p>'; } $html .= ' </li>'; } $html .= '</ul>'; if ($app == 1) { jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); $html .= ' <div class="list-articles--button"> ' . $pagination->getPagesLinks() . ' </div>'; } else { $showall = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=myarticles'); $html .= "<div class='list-articles--button'><a class='joms-button--link' href='" . $showall . "'>" . JText::_('PLG_MYARTICLES_SHOWALL') . "</a></div>"; } $html .= '</div>'; } else { $html .= "<p>" . JText::_("PLG_MYARTICLES_NO_ARTICLES") . "</p>"; } return $html; }
function getDisplayTab($tab, $user, $ui) { global $my, $_CB_framework; $lang = JFactory::getLanguage(); $lang->load('plg_cbninjaboard'); $return = null; $params = $this->params; //get parameters (plugin and related tab) $nbPlugEnabled = $params->get('nbPlugEnabled', "1"); if ($nbPlugEnabled) { JHTML::stylesheet('ninjaboard.css', 'components/com_comprofiler/plugin/user/plug_cbninjaboard/'); //get parameters $nbPlugShowSubject = $params->get('nbPlugShowSubject', "1"); $nbPlugTruncateSubject = $params->get('nbPlugTruncateSubject', "25"); $nbPlugShowMessage = $params->get('nbPlugShowMessage', "1"); $nbPlugTruncateMessage = $params->get('nbPlugTruncateMessage', "50"); $nbPlugShowForum = $params->get('nbPlugShowForum', "1"); $nbPlugShowHits = $params->get('nbPlugShowHits', "1"); $nbPlugShowCreated = $params->get('nbPlugShowCreated', "1"); $nbPlugShowModified = $params->get('nbPlugShowModified', "1"); $nbPlugDateFormat = $params->get('nbPlugDateFormat', "D, d M"); $nbPlugShowEdit = $params->get('nbPlugShowEdit', "1"); $nbPlugSortBy = $params->get('nbPlugSortBy', "1"); $nbPlugSortOrder = $params->get('nbPlugSortOrder', "DESC"); $nbPlugShowPagination = $params->get('nbPlugShowPagination', "1"); $nbPlugPaginationCount = $params->get('nbPlugPaginationCount', "5"); $limit = $nbPlugPaginationCount > 0 ? $nbPlugPaginationCount : 0; $offset = JRequest::getVar('limitstart', 0, 'REQUEST'); //get current user $userId = $user->id; //get user posts $rows = $this->getPosts($userId, $nbPlugSortBy, $nbPlugSortOrder, $nbPlugPaginationCount, $limit, $offset); //get user post count $row_count = $this->countPosts($userId); //get item id $itemId = $this->getItemId(); //create_html if ($row_count <= 0) { $list = '<div class="cbNinjaBoard"><div class="cbNBposts"><table><tr><td>You currently have no NinjaBoard posts</td></tr></table></div></div>'; } else { $list = ""; //show only selected fields in a table row $list .= '<div class="cbNinjaBoard"><div class="cbNBposts"><table><thead><tr>'; if ($nbPlugShowSubject) { $list .= '<th>' . JText::_('NB_SUBJECT_CBP') . '</th>'; } if ($nbPlugShowMessage) { $list .= '<th>' . JText::_('NB_MESSAGE_CBP') . '</th>'; } if ($nbPlugShowForum) { $list .= '<th>' . JText::_('NB_FORUM_CBP') . '</th>'; } if ($nbPlugShowHits) { $list .= '<th>' . JText::_('NB_HITS_CBP') . '</th>'; } if ($nbPlugShowCreated) { $list .= '<th>' . JText::_('NB_CREATED_CBP') . '</th>'; } if ($nbPlugShowModified) { $list .= '<th>' . JText::_('NB_MODIFIED_CBP') . '</th>'; } if ($nbPlugShowEdit) { $list .= '<th>' . JText::_('NB_VIEW_POST_CBP') . '</th>'; } $list .= '</tr></thead><tbody>'; $items = array(); foreach ($rows as $row) { //get the item subject, show no subject if there is none, truncate subject if necessary $item->subject_long = stripslashes($row->subject) ? stripslashes($row->subject) : JText::_('NB_NO_SUBJECT_CBP'); $item->subject_short = JString::strlen($row->subject) > $nbPlugTruncateSubject ? JString::substr($row->subject, 0, $nbPlugTruncateSubject - 4) . '...' : $item->subject_long; $item->subject = $nbPlugTruncateSubject > 0 ? $item->subject_short : $item->subject_long; //get the item message, show no message if there is none, truncate message if necessary $item->message_long = stripslashes($row->message) ? stripslashes($row->message) : JText::_('NB_NO_MESSAGE_CBP'); $item->message_short = JString::strlen($row->message) > $nbPlugTruncateMessage ? JString::substr($row->message, 0, $nbPlugTruncateMessage - 4) . '...' : $item->message_long; $item->unparsed = $nbPlugTruncateMessage > 0 ? $item->message_short : $item->message_long; $item->message = KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $item->unparsed)); //link to edit post $item->view_link = '<a href="' . (JURI::base() . 'index.php?option=com_ninjaboard&view=topic&id=' . $row->topic_id . '&Itemid=' . $itemId . '#post' . $row->post_id) . '" title="' . JText::_('NB_VIEW_POST_CBP') . '">' . '<img src="' . JURI::base() . 'components/com_comprofiler/plugin/user/plug_cbninjaboard/post.png" width="32" height="32" alt="' . JText::_('NB_VIEW_POST_CBP') . '" />' . '</a>'; //link to forum $item->forum_link = '<a href="' . (JURI::base() . 'index.php?option=com_ninjaboard&view=forum&id=' . $row->forum_id . '&Itemid=' . $itemId) . '" title="' . JText::_($row->forum_name) . '">' . JText::_($row->forum_name) . '</a>'; //format dates $item->c_datetime = $row->created > 0 ? date($nbPlugDateFormat, strtotime($row->created)) : JText::_('NB_NO_DATE_CBP'); $item->m_datetime = $row->modified > 0 ? date($nbPlugDateFormat, strtotime($row->modified)) : JText::_('NB_NO_DATE_CBP'); //show only selected fields in a table row $list .= '<tr>'; if ($nbPlugShowSubject) { $list .= '<td>' . $item->subject . '</td>'; } if ($nbPlugShowMessage) { $list .= '<td>' . $item->message . '</td>'; } if ($nbPlugShowForum) { $list .= '<td>' . $item->forum_link . '</td>'; } if ($nbPlugShowHits) { $list .= '<td>' . $row->hits . '</td>'; } if ($nbPlugShowCreated) { $list .= '<td>' . $item->c_datetime . '</td>'; } if ($nbPlugShowModified) { $list .= '<td>' . $item->m_datetime . '</td>'; } if ($nbPlugShowEdit) { $list .= '<td>' . $item->view_link . '</td>'; } $list .= '</tr>'; } $list .= '</table></div>'; if ($nbPlugShowPagination && $row_count > $limit) { $list .= '<div class="cbNBpagination"><table><tr><td>'; //$list .= KFactory::get('site::com.ninjaboard.helper.paginator',array('name' => 'posts'))->pagination($row_count, $offset, $limit , 4, true); jimport('joomla.html.pagination'); $pagination = new JPagination($row_count, $offset, $limit); $list .= $pagination->getPagesLinks() . $pagination->getResultsCounter(); $list .= '</td></tr></table></div>'; } $list .= '</div>'; } return $list; } }
} else { $group_id = 0; } $query = "SELECT COUNT(*) FROM #__fb_messages WHERE hold='0' AND userid='{$userid}' AND catid IN ({$fbSession->allowed})"; $kunena_db->setQuery($query); $total = count($kunena_db->loadObjectList()); check_dberror("Unable to load messages."); if ($total <= $limit) { $limitstart = 0; } $query = "SELECT a.*, b.id AS category, b.name AS catname, c.hits AS threadhits FROM #__fb_messages AS a, #__fb_categories AS b, #__fb_messages AS c, #__fb_messages_text AS d" . " WHERE a.catid=b.id AND a.thread=c.id AND a.id=d.mesid AND a.hold='0' AND a.userid='{$userid}' AND a.catid IN ({$fbSession->allowed}) ORDER BY time DESC"; $kunena_db->setQuery($query, $limitstart, $limit); $items = $kunena_db->loadObjectList(); check_dberror("Unable to load messages."); jimport('joomla.html.pagination'); $pageNav = new JPagination($total, $limitstart, $limit); if (count($items) > 0) { $tabclass = array("sectiontableentry1", "sectiontableentry2"); $k = 0; foreach ($items as $item) { $k = 1 - $k; if (!isset($item->created)) { $item->created = ""; } $fbURL = JRoute::_("index.php?option=com_kunena&func=view" . KUNENA_COMPONENT_ITEMID_SUFFIX . "&catid=" . $item->catid . "&id=" . $item->id . "#" . $item->id); $fbCatURL = JRoute::_("index.php?option=com_kunena" . KUNENA_COMPONENT_ITEMID_SUFFIX . "&func=showcat&catid=" . $item->catid); ?> <tr class = "<?php echo '' . $boardclass . '' . $tabclass[$k] . ''; ?>
echo '<tr>'; foreach ($this->columns as $column) { $columns[] = $column['Field']; echo '<th>' . $column['Field'] . '</th>'; } echo '</tr>'; //radky foreach ($this->rows as $row) { echo '<tr>'; foreach ($columns as $col) { echo '<td>' . $row[$col] . '</td>'; } echo '</tr>'; } echo '</table>'; } else { echo '<div class="error">' . JText::_('NO_ROWS_FOUND') . '</div>'; } /*--tabulka s radky*/ /*strankovani*/ echo '<p>'; jimport('joomla.html.pagination'); $pageNav = new JPagination($this->total, $this->limitstart, $this->limit); echo '<form action="' . JRoute::_('') . '" name="adminForm" id="adminForm" method="post">'; echo $pageNav->getListFooter(); echo '</form>'; echo '</p>'; /*--*/ ?>
/** * 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(); }
public function getListFooter($ajax = false) { if (!$ajax) { return parent::getListFooter(); } $app = JFactory::getApplication(); $list = array(); $list['prefix'] = $this->prefix; $list['limit'] = $this->limit; $list['limitstart'] = $this->limitstart; $list['total'] = $this->total; $list['limitfield'] = $this->getLimitBox(); $list['pagescounter'] = $this->getPagesCounter(); //override getPageLinks to introduce ajax pagination... $list['pageslinks'] = $this->getPagesLinks(); $chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/pagination.php'; if (file_exists($chromePath)) { include_once $chromePath; if (function_exists('pagination_list_footer')) { return pagination_list_footer($list); } } return $this->_list_footer($list); }
">[edit]</a> </td> <!-- Joomla! Component Builder - begin code --> <td class="jcb_fieldDiv jcb_fieldValue"> <?php echo $row->bblid; ?> </td> <!-- Joomla! Component Builder - end code --> <?php if (isset($row->ordering)) { ?> <td class="order nowrap"> <?php $page = new JPagination($n, 1, $n); $up = JString::strtolower($this->lists['order_Dir']) == 'asc' ? 'orderup' : 'orderdown'; $down = JString::strtolower($this->lists['order_Dir']) == 'asc' ? 'orderdown' : 'orderup'; $enable = $this->auth('core.edit') && $this->lists['order'] == 'ordering'; ?> <span><?php echo $page->orderUpIcon($i, $i > 0, 'buddyblacklistlist.' . $up, JText::_('JLIB_HTML_MOVE_UP'), $enable); ?> </span> <span><?php echo $page->orderDownIcon($i, $n, $i < $n, 'buddyblacklistlist.' . $down, JText::_('JLIB_HTML_MOVE_DOWN'), $enable); ?> </span> <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>