Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 /**
  * Application full view
  **/
 public function appFullView()
 {
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_COMMUNITY_GROUPS_WALL_TITLE'));
     $applicationName = JString::strtolower(JRequest::getVar('app', '', 'GET'));
     if (empty($applicationName)) {
         JError::raiseError(500, 'COM_COMMUNITY_APP_ID_REQUIRED');
     }
     $output = '';
     $groupModel = CFactory::getModel('groups');
     $groupId = JRequest::getInt('groupid', '', 'GET');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$group->published) {
         $this->_redirectUnpublishGroup();
         return;
     }
     //@todo: Since group walls doesn't use application yet, we process it manually now.
     if ($applicationName == 'walls') {
         CFactory::load('libraries', 'wall');
         $limit = JRequest::getInt('limit', 5, 'REQUEST');
         $limitstart = JRequest::getInt('limitstart', 0, 'REQUEST');
         $my = CFactory::getUser();
         $config = CFactory::getConfig();
         $isBanned = $group->isBanned($my->id);
         // Test if the current browser is a member of the group
         $isMember = $group->isMember($my->id);
         $waitingApproval = $groupModel->isWaitingAuthorization($my->id, $group->id);
         CFactory::load('helpers', 'owner');
         if (!$isMember && !COwnerHelper::isCommunityAdmin() && $group->approvals == COMMUNITY_PRIVATE_GROUP) {
             $this->noAccess(JText::_('COM_COMMUNITY_GROUPS_PRIVATE_NOTICE'));
             return;
         }
         if (!$config->get('lockgroupwalls') || $config->get('lockgroupwalls') && ($isMember && !$isBanned) && !$waitingApproval || COwnerHelper::isCommunityAdmin()) {
             $output .= CWallLibrary::getWallInputForm($group->id, 'groups,ajaxSaveWall', 'groups,ajaxRemoveWall');
         }
         // Get the walls content
         $output .= '<div id="wallContent">';
         if (!$isBanned) {
             $output .= CWallLibrary::getWallContents('groups', $group->id, $my->id == $group->ownerid, $limit, $limitstart, 'wall.content', 'groups,group');
         } else {
             $output .= CWallLibrary::getWallContents('groups', $group->id, $my->id == $group->ownerid, $limit, $limitstart, 'wall.content', 'groups,group', null, 1);
         }
         $output .= '</div>';
         jimport('joomla.html.pagination');
         $wallModel = CFactory::getModel('wall');
         $pagination = new JPagination($wallModel->getCount($group->id, 'groups'), $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, 'COM_COMMUNITY_APPS_NOT_FOUND');
         }
         // Get the parameters
         $manifest = CPluginHelper::getPluginPath('community', $applicationName) . DS . $applicationName . DS . $applicationName . '.xml';
         $params = new CParameter($model->getUserAppParams($applicationId), $manifest);
         $application->params =& $params;
         $application->id = $applicationId;
         $output = $application->onAppDisplay($params);
     }
     echo $output;
 }
Exemplo n.º 5
0
 function view()
 {
     $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']);
     JPluginHelper::importPlugin('jshoppingproducts');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $manufacturer_id = JRequest::getInt('manufacturer_id');
     $category_id = JRequest::getInt('category_id');
     $label_id = JRequest::getInt('label_id');
     $vendor_id = JRequest::getInt('vendor_id');
     $manufacturer = JTable::getInstance('manufacturer', 'jshop');
     $manufacturer->load($manufacturer_id);
     $manufacturer->getDescription();
     JPluginHelper::importPlugin('jshopping');
     $dispatcher->trigger('onBeforeDisplayManufacturer', array(&$manufacturer));
     if ($manufacturer->manufacturer_publish == 0) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     if (getShopManufacturerPageItemid() == JRequest::getInt('Itemid')) {
         appendPathWay($manufacturer->name);
     }
     if ($manufacturer->meta_title == "") {
         $manufacturer->meta_title = $manufacturer->name;
     }
     setMetaData($manufacturer->meta_title, $manufacturer->meta_keyword, $manufacturer->meta_description);
     $action = xhtmlUrl($_SERVER['REQUEST_URI']);
     if (!$manufacturer->products_page) {
         $manufacturer->products_page = $jshopConfig->count_products_to_page;
     }
     $count_product_to_row = $manufacturer->products_row;
     if (!$count_product_to_row) {
         $count_product_to_row = $jshopConfig->count_products_to_row;
     }
     $context = "jshoping.manufacturlist.front.product";
     $contextfilter = "jshoping.list.front.product.manf." . $manufacturer_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', $manufacturer->products_page, 'int');
     if (!$limit) {
         $limit = $manufacturer->products_page;
     }
     $limitstart = JRequest::getInt('limitstart');
     $orderbyq = getQuerySortDirection($order, $orderby);
     $image_sort_dir = getImgSortDirection($order, $orderby);
     $field_order = $jshopConfig->sorting_products_field_s_select[$order];
     $filters = getBuildFilterListProduct($contextfilter, array("manufacturers"));
     $total = $manufacturer->getCountProducts($filters);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $pagenav = $pagination->getPagesLinks();
     $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'manufacturer'));
     if ($limitstart >= $total) {
         $limitstart = 0;
     }
     $rows = $manufacturer->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($manufacturer->products_page, $jshopConfig->count_product_select);
     //insert products_page count
     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 = JTable::getInstance('review', 'jshop');
     $allow_review = $_review->getAllowReview();
     if ($jshopConfig->show_product_list_filters) {
         $filter_categorys = $manufacturer->getCategorys();
         $first_category = array();
         $first_category[] = JHTML::_('select.option', 0, _JSHOP_ALL, 'id', 'name');
         if (isset($filters['categorys'][0])) {
             $active_category = $filters['categorys'][0];
         } else {
             $active_category = 0;
         }
         $categorys_sel = JHTML::_('select.genericlist', array_merge($first_category, $filter_categorys), 'categorys[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'id', 'name', $active_category);
     } else {
         $categorys_sel = '';
     }
     if ($jshopConfig->use_plugin_content) {
         changeDataUsePluginContent($manufacturer, "manufacturer");
     }
     $display_list_products = count($rows) > 0 || willBeUseFilter($filters);
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
     $view_name = "manufacturer";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $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_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', 0);
     $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("manufacturer", $manufacturer);
     $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('filters', $filters);
     $view->assign('display_list_products', $display_list_products);
     $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
     $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
     $view->display();
 }
Exemplo n.º 6
0
 /**
  * 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;
 }
Exemplo n.º 7
0
<?php 
    if ($this->multiple_stats == 1) {
        ?>
<div class="fulltablelink">
<?php 
        echo JHtml::link(JoomleagueHelperRoute::getStatsRankingRoute($this->project->id, $this->division ? $this->division->id : 0, $this->teamid, $rows->id), JText::_('COM_JOOMLEAGUE_STATSRANKING_VIEW_FULL_TABLE'));
        ?>
</div>
<?php 
    } else {
        jimport('joomla.html.pagination');
        $pagination = new JPagination($this->playersstats[$rows->id]->pagination_total, $this->limitstart, $this->limit);
        ?>
<div class="pageslinks">
	<?php 
        echo $pagination->getPagesLinks();
        ?>
</div>

<p class="pagescounter">
	<?php 
        echo $pagination->getPagesCounter();
        ?>
</p>
<?php 
    }
    ?>

<?php 
}
Exemplo n.º 8
0
                    <?php 
        if ($total != 0) {
            ?>

                        <div class = "jr-pagenav">
                            <ul>
                                <li class = "jr-pagenav-text"><?php 
            echo _PAGE;
            ?>
</li>

                                <li class = "jr-pagenav-nb">

                                <?php 
            // TODO: fxstein - Need to perform SEO cleanup
            echo $pageNav->getPagesLinks(JRoute::_(KUNENA_LIVEURLREL . "&amp;func=view&amp;id={$id}&amp;catid={$catid}"));
            ?>

                                </li>
                            </ul>
                        </div>

                    <?php 
        }
        ?>
                </td>
            </tr>
        </table>
        <!-- /top nav -->
        <!-- <table border = "0" cellspacing = "0" cellpadding = "0" width = "100%" align = "center"> -->
Exemplo n.º 9
0
 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;
     }
 }
Exemplo n.º 10
0
 /**
  * @param	string	The context of the content being passed to the plugin.
  * @param	object	The article object.  Note $article->text is also available
  * @param	object	The article params
  * @param	int		The 'page' number
  *
  * @return	void
  * @since	1.6
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     // Expression to search for.
     $regex = '#<hr(.*)class="system-pagebreak"(.*)\\/>#iU';
     $print = JRequest::getBool('print');
     $showall = JRequest::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;
     }
     $db = JFactory::getDbo();
     $view = JRequest::getString('view');
     $full = JRequest::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) {
                 $page_text = $page + 1;
                 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 = '';
         // Display TOC.
         if ($hasToc) {
             $this->_createToc($row, $matches, $page);
         } else {
             $row->toc = '';
         }
         // traditional mos page navigation
         jimport('joomla.html.pagination');
         $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="pagination">';
         // 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>';
     }
     return true;
 }
Exemplo n.º 11
0
    echo _GEN_DELETE;
    ?>
"/>
					</td>
				</tr>

			<?php 
} else {
    echo '<tr class="' . $boardclass . '' . $tabclass[$k] . '"><td class="td-1" colspan = "5" >' . _USER_NOSUBSCRIPTIONS . '</td></tr>';
}
?>

			<tr><td colspan = "5" class = "fb_profile-bottomnav">
					<?php 
// TODO: fxstein - Need to perform SEO cleanup
echo $pageNav->getPagesLinks("index.php?option=com_kunena&amp;func=myprofile&amp;do=showsub" . KUNENA_COMPONENT_ITEMID_SUFFIX);
?>

					<br/>
<?php 
echo $pageNav->getPagesCounter();
?>
				</td>
			</tr>
		</tbody>
	</table>
</form>
</div>
</div>
</div>
</div>
Exemplo n.º 12
0
<?php

defined('_JEXEC') or die('Restricted access');
jimport('joomla.html.pagination');
$limit = $ad_toplist;
$limitstart = JRequest::getVar('limitstart', 0, 'int');
$page_nav_links = '';
GalleryHeader();
if (!$ad_rating) {
    $app->redirect(JRoute::_('index.php?option=com_datsogallery' . $itemid, false));
}
$db->setQuery('SELECT count(*) FROM #__datsogallery WHERE imgvotes > 0 AND published = 1 AND approved = 1');
$total = $db->loadResult();
$pageNav = new JPagination($total, $limitstart, $limit);
$page_nav_links = $pageNav->getPagesLinks();
$db->setQuery('SELECT *, imgvotesum AS rating' . ' FROM #__datsogallery AS a,' . ' #__datsogallery_catg AS ca' . ' WHERE a.catid = ca.cid' . ' AND a.imgvotes > 0' . ' AND a.published = 1' . ' AND a.approved = 1' . ' AND ca.approved = 1' . ' AND ca.published = 1' . ' AND ca.access IN (' . $groups . ')' . ' ORDER BY rating DESC' . ' LIMIT ' . $pageNav->limitstart . ', ' . $pageNav->limit);
$pw_title = JText::_('COM_DATSOGALLERY_TOP_RATED');
$rows = $db->loadObjectList();
$document->setTitle($pw_title);
?>

<div class="datso_pgn">
<?php 
echo $page_nav_links;
?>
</div>
<div style="clear:both"></div>

<div class="dg_head_background"><?php 
echo $pw_title;
?>
 /**
  * Create and return the pagination page list string, ie. Previous, Next, 1 2 3 ... x.
  *
  * @return  string  Pagination page list string.
  *
  * @since   11.1
  * overide to use bootstrap in j2.5
  */
 public function getPagesLinks()
 {
     $app = JFactory::getApplication();
     if (JVM_VERSION === 3 || $app->isSite() && jrequest::getVar('tmpl') !== 'component') {
         return parent::getPagesLinks();
     }
     // Build the page navigation list.
     $data = $this->_buildDataObject();
     $list = array();
     $list['prefix'] = $this->prefix;
     $itemOverride = false;
     // Build the select list
     if ($data->all->base !== null) {
         $list['all']['active'] = true;
         $list['all']['data'] = $this->pagination_item_active($data->all);
     } else {
         $list['all']['active'] = false;
         $list['all']['data'] = $this->pagination_item_inactive($data->all);
     }
     if ($data->start->base !== null) {
         $list['start']['active'] = true;
         $list['start']['data'] = $this->pagination_item_active($data->start);
     } else {
         $list['start']['active'] = false;
         $list['start']['data'] = $this->pagination_item_inactive($data->start);
     }
     if ($data->previous->base !== null) {
         $list['previous']['active'] = true;
         $list['previous']['data'] = $this->pagination_item_active($data->previous);
     } else {
         $list['previous']['active'] = false;
         $list['previous']['data'] = $this->pagination_item_inactive($data->previous);
     }
     $list['pages'] = array();
     //make sure it exists
     foreach ($data->pages as $i => $page) {
         if ($page->base !== null) {
             $list['pages'][$i]['active'] = true;
             $list['pages'][$i]['data'] = $this->pagination_item_active($page);
         } else {
             $list['pages'][$i]['active'] = false;
             $list['pages'][$i]['data'] = $this->pagination_item_inactive($page);
         }
     }
     if ($data->next->base !== null) {
         $list['next']['active'] = true;
         $list['next']['data'] = $this->pagination_item_active($data->next);
     } else {
         $list['next']['active'] = false;
         $list['next']['data'] = $this->pagination_item_inactive($data->next);
     }
     if ($data->end->base !== null) {
         $list['end']['active'] = true;
         $list['end']['data'] = $this->pagination_item_active($data->end);
     } else {
         $list['end']['active'] = false;
         $list['end']['data'] = $this->pagination_item_inactive($data->end);
     }
     if ($this->total > $this->limit) {
         return $this->pagination_list_render($list);
     } else {
         return '';
     }
 }
Exemplo n.º 14
0
 function display($cachable = false, $urlparams = false)
 {
     $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']);
     JPluginHelper::importPlugin('jshoppingproducts');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $product = JTable::getInstance('product', 'jshop');
     $params = $mainframe->getParams();
     $header = getPageHeaderOfParams($params);
     $prefix = $params->get('pageclass_sfx');
     $seo = JTable::getInstance("seo", "jshop");
     $seodata = $seo->loadData("all-products");
     setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
     $category_id = JRequest::getInt('category_id');
     $manufacturer_id = JRequest::getInt('manufacturer_id');
     $label_id = JRequest::getInt('label_id');
     $vendor_id = JRequest::getInt('vendor_id');
     $action = xhtmlUrl($_SERVER['REQUEST_URI']);
     $products_page = $jshopConfig->count_products_to_page;
     $count_product_to_row = $jshopConfig->count_products_to_row;
     $context = "jshoping.alllist.front.product";
     $contextfilter = "jshoping.list.front.product.fulllist";
     $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');
     $orderbyq = getQuerySortDirection($order, $orderby);
     $image_sort_dir = getImgSortDirection($order, $orderby);
     $field_order = $jshopConfig->sorting_products_field_s_select[$order];
     $filters = getBuildFilterListProduct($contextfilter, array());
     $total = $product->getCountAllProducts($filters);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $pagenav = $pagination->getPagesLinks();
     $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'products'));
     if ($limitstart >= $total) {
         $limitstart = 0;
     }
     $rows = $product->getAllProducts($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);
     //insert products_page count
     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 = JTable::getInstance('review', 'jshop');
     $allow_review = $_review->getAllowReview();
     if ($jshopConfig->show_product_list_filters) {
         $first_el = JHTML::_('select.option', 0, _JSHOP_ALL, 'manufacturer_id', 'name');
         $_manufacturers = JTable::getInstance('manufacturer', 'jshop');
         if ($jshopConfig->manufacturer_sorting == 2) {
             $morder = 'name';
         } else {
             $morder = 'ordering';
         }
         $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 {
         $manufacuturers_sel = '';
         $categorys_sel = '';
     }
     $display_list_products = count($rows) > 0 || willBeUseFilter($filters);
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
     $view_name = "products";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $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_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("header", $header);
     $view->assign("prefix", $prefix);
     $view->assign("rows", $rows);
     $view->assign("count_product_to_row", $count_product_to_row);
     $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('display_list_products', $display_list_products);
     $view->assign('shippinginfo', SEFLink('index.php?option=com_jshopping&controller=content&task=view&page=shipping', 1));
     $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
     $view->display();
 }
Exemplo n.º 15
0
 function view()
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $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());
     $category_id = JRequest::getInt('category_id');
     $category = JSFactory::getTable('category', 'jshop');
     $category->load($category_id);
     $category->getDescription();
     $dispatcher->trigger('onAfterLoadCategory', array(&$category, &$user));
     if (!$category->category_id || $category->category_publish == 0 || !in_array($category->access, $user->getAuthorisedViewLevels())) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     $manufacturer_id = JRequest::getInt('manufacturer_id');
     $label_id = JRequest::getInt('label_id');
     $vendor_id = JRequest::getInt('vendor_id');
     $view_name = "category";
     $view_config = array("template_path" => $jshopConfig->template_path . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     if ($category->category_template == "") {
         $category->category_template = "default";
     }
     $view->setLayout("category_" . $category->category_template);
     $jshopConfig->count_products_to_page = $category->products_page;
     $context = "jshoping.list.front.product";
     $contextfilter = "jshoping.list.front.product.cat." . $category_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', $category->products_page, 'int');
     if (!$limit) {
         $limit = $category->products_page;
     }
     $limitstart = JRequest::getInt('limitstart');
     $orderbyq = getQuerySortDirection($order, $orderby);
     $image_sort_dir = getImgSortDirection($order, $orderby);
     $field_order = $jshopConfig->sorting_products_field_select[$order];
     $filters = getBuildFilterListProduct($contextfilter, array("categorys"));
     if (getShopMainPageItemid() == JRequest::getInt('Itemid')) {
         appendExtendPathWay($category->getTreeChild(), 'category');
     }
     $orderfield = $jshopConfig->category_sorting == 1 ? "ordering" : "name";
     $sub_categories = $category->getChildCategories($orderfield, 'asc', $publish = 1);
     $dispatcher->trigger('onBeforeDisplayCategory', array(&$category, &$sub_categories));
     if ($category->meta_title == "") {
         $category->meta_title = $category->name;
     }
     setMetaData($category->meta_title, $category->meta_keyword, $category->meta_description);
     $total = $category->getCountProducts($filters);
     $action = xhtmlUrl($_SERVER['REQUEST_URI']);
     $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'category'));
     if ($limitstart >= $total) {
         $limitstart = 0;
     }
     $products = $category->getProducts($filters, $field_order, $orderbyq, $limitstart, $limit);
     addLinkToProducts($products, $category_id);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $pagenav = $pagination->getPagesLinks();
     foreach ($jshopConfig->sorting_products_name_select as $key => $value) {
         $sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
     }
     insertValueInArray($category->products_page, $jshopConfig->count_product_select);
     //insert category count
     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 (!$category->category_ordertype) {
         $category->category_ordertype = 1;
     }
     $manufacuturers_sel = '';
     if ($jshopConfig->show_product_list_filters) {
         $filter_manufactures = $category->getManufacturers();
         $first_manufacturer = array();
         $first_manufacturer[] = JHTML::_('select.option', 0, _JSHOP_ALL, 'id', 'name');
         $manufacuturers_sel = JHTML::_('select.genericlist', array_merge($first_manufacturer, $filter_manufactures), 'manufacturers[]', 'class = "inputbox" onchange = "submitListProductFilters()"', 'id', 'name', $filters['manufacturers'][0]);
     }
     if ($jshopConfig->use_plugin_content) {
         changeDataUsePluginContent($category, "category");
     }
     $willBeUseFilter = willBeUseFilter($filters);
     $display_list_products = count($products) > 0 || $willBeUseFilter;
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$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', 0);
     $view->assign('filter_show_manufacturer', 1);
     $view->assign('pagination', $pagenav);
     $view->assign('pagination_obj', $pagination);
     $view->assign('display_pagination', $pagenav != "");
     $view->assign('rows', $products);
     $view->assign('count_product_to_row', $category->products_row);
     $view->assign('image_category_path', $jshopConfig->image_category_live_path);
     $view->assign('noimage', $jshopConfig->noimage);
     $view->assign('category', $category);
     $view->assign('categories', $sub_categories);
     $view->assign('count_category_to_row', $jshopConfig->count_category_to_row);
     $view->assign('allow_review', $allow_review);
     $view->assign('product_count', $product_count_sel);
     $view->assign('sorting', $sorting_sel);
     $view->assign('action', $action);
     $view->assign('orderby', $orderby);
     $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();
 }
Exemplo n.º 16
0
$limit = $ad_toplist;
$limitstart = JRequest::getVar('limitstart', 0, 'int');
$page_nav_links = '';
GalleryHeader();
if (!$ad_search) {
    $app->redirect(JRoute::_('index.php?option=com_datsogallery' . $itemid, false), JText::_('COM_DATSOGALLERY_SEARCH_DISABLED'));
}
$sstring = $app->getUserStateFromRequest('datsogallery.sstring', 'sstring', '', 'string');
if ($sstring) {
    $searchEscaped = $db->Quote('%' . $db->getEscaped($sstring, true) . '%', false);
    $where[] = '( imgtitle LIKE ' . $searchEscaped . ' OR imgtext LIKE ' . $searchEscaped . ' OR imgauthor LIKE ' . $searchEscaped . ' )';
}
$db->setQuery('SELECT count(*) FROM #__datsogallery AS a ' . (count($where) ? ' WHERE ' . implode(' AND ', $where) : ''));
$total = $db->loadResult();
$pageNav = new JPagination($total, $limitstart, $limit);
$page_nav_links = $pageNav->getPagesLinks('index.php?option=com_datsogallery&task=special&sorting=find' . $itemid);
$where[] = 'a.catid = cc.cid';
$where[] = 'a.published = 1';
$where[] = 'a.approved = 1';
$where[] = 'cc.approved = 1';
$where[] = 'cc.published = 1';
$where[] = 'cc.access IN (' . $groups . ')';
$images = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
$db->setQuery('SELECT a.*' . ' FROM #__datsogallery AS a,' . ' #__datsogallery_catg AS cc' . $images . ' ORDER BY a.id DESC' . ' LIMIT ' . $pageNav->limitstart . ', ' . $pageNav->limit);
if ($db->getErrorNum()) {
    echo $db->stderr();
    return false;
}
$pw_title = JText::_('COM_DATSOGALLERY_SEARCH_RESULTS') . ' ' . $sstring;
$rows = $db->loadObjectList();
$document->setTitle($pw_title);
Exemplo n.º 17
0
 function result()
 {
     $mainframe = JFactory::getApplication();
     $jshopConfig = JSFactory::getConfig();
     $db = JFactory::getDBO();
     $lang = JSFactory::getLang();
     $user = JFactory::getUser();
     $session = JFactory::getSession();
     $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
     $session->set("jshop_end_page_list_product", $_SERVER['REQUEST_URI']);
     $params = $mainframe->getParams();
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $product = JSFactory::getTable('product', 'jshop');
     $seo = JSFactory::getTable("seo", "jshop");
     $seodata = $seo->loadData("search-result");
     if (getThisURLMainPageShop()) {
         appendPathWay(_JSHOP_SEARCH);
         if ($seodata->title == "") {
             $seodata->title = _JSHOP_SEARCH;
         }
         setMetaData($seodata->title, $seodata->keyword, $seodata->description);
     } else {
         setMetaData($seodata->title, $seodata->keyword, $seodata->description, $params);
     }
     $post = JRequest::get('request');
     if (isset($post['setsearchdata']) && $post['setsearchdata'] == 1) {
         $session->set("jshop_end_form_data", $post);
     } else {
         $data = $session->get("jshop_end_form_data");
         if (count($data)) {
             $post = $data;
         }
     }
     $category_id = intval($post['category_id']);
     $manufacturer_id = intval($post['manufacturer_id']);
     if (isset($post['date_to'])) {
         $date_to = $post['date_to'];
     } else {
         $date_to = null;
     }
     if (isset($post['date_from'])) {
         $date_from = $post['date_from'];
     } else {
         $date_from = null;
     }
     if (isset($post['price_to'])) {
         $price_to = saveAsPrice($post['price_to']);
     } else {
         $price_to = null;
     }
     if (isset($post['price_from'])) {
         $price_from = saveAsPrice($post['price_from']);
     } else {
         $price_from = null;
     }
     if (isset($post['include_subcat'])) {
         $include_subcat = intval($post['include_subcat']);
     } else {
         $include_subcat = 0;
     }
     $search = trim($post['search']);
     $search_type = $post['search_type'];
     if (!$search_type) {
         $search_type = "any";
     }
     $context = "jshoping.searclist.front.product";
     $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', $jshopConfig->count_products_to_page, 'int');
     if (!$limit) {
         $limit = $jshopConfig->count_products_to_page;
     }
     $limitstart = JRequest::getInt('limitstart', 0);
     if ($order == 4) {
         $order = 1;
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         if (isset($post['extra_fields'])) {
             $extra_fields = $post['extra_fields'];
         } else {
             $extra_fields = array();
         }
         $extra_fields = filterAllowValue($extra_fields, "array_int_k_v+");
     }
     $categorys = array();
     if ($category_id) {
         if ($include_subcat) {
             $_category = JSFactory::getTable('category', 'jshop');
             $all_categories = $_category->getAllCategories();
             $cat_search[] = $category_id;
             searchChildCategories($category_id, $all_categories, $cat_search);
             foreach ($cat_search as $key => $value) {
                 $categorys[] = $value;
             }
         } else {
             $categorys[] = $category_id;
         }
     }
     $orderbyq = getQuerySortDirection($order, $orderby);
     $image_sort_dir = getImgSortDirection($order, $orderby);
     $filters = array();
     $filters['categorys'] = $categorys;
     if ($manufacturer_id) {
         $filters['manufacturers'][] = $manufacturer_id;
     }
     $filters['price_from'] = $price_from;
     $filters['price_to'] = $price_to;
     if ($jshopConfig->admin_show_product_extra_field) {
         $filters['extra_fields'] = $extra_fields;
     }
     $adv_query = "";
     $adv_from = "";
     $adv_result = $product->getBuildQueryListProductDefaultResult();
     $product->getBuildQueryListProduct("search", "list", $filters, $adv_query, $adv_from, $adv_result);
     if ($date_to && checkMyDate($date_to)) {
         $adv_query .= " AND prod.product_date_added <= '" . $db->escape($date_to) . "'";
     }
     if ($date_from && checkMyDate($date_from)) {
         $adv_query .= " AND prod.product_date_added >= '" . $db->escape($date_from) . "'";
     }
     $where_search = "";
     if ($search_type == "exact") {
         $word = addcslashes($db->escape($search), "_%");
         $tmp = array();
         foreach ($jshopConfig->product_search_fields as $field) {
             $tmp[] = "LOWER(" . getDBFieldNameFromConfig($field) . ") LIKE '%" . $word . "%'";
         }
         $where_search = implode(' OR ', $tmp);
     } else {
         $words = explode(" ", $search);
         $search_word = array();
         foreach ($words as $word) {
             $word = addcslashes($db->escape($word), "_%");
             $tmp = array();
             foreach ($jshopConfig->product_search_fields as $field) {
                 $tmp[] = "LOWER(" . getDBFieldNameFromConfig($field) . ") LIKE '%" . $word . "%'";
             }
             $where_search_block = implode(' OR ', $tmp);
             $search_word[] = "(" . $where_search_block . ")";
         }
         if ($search_type == "any") {
             $where_search = implode(" OR ", $search_word);
         } else {
             $where_search = implode(" AND ", $search_word);
         }
     }
     if ($where_search) {
         $adv_query .= " AND ({$where_search})";
     }
     $orderbyf = $jshopConfig->sorting_products_field_s_select[$order];
     $order_query = $product->getBuildQueryOrderListProduct($orderbyf, $orderbyq, $adv_from);
     $dispatcher->trigger('onBeforeQueryGetProductList', array("search", &$adv_result, &$adv_from, &$adv_query, &$order_query, &$filters));
     $query = "SELECT count(distinct prod.product_id) FROM `#__jshopping_products` AS prod\n                  LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id\n                  LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id                  \n                  {$adv_from}\n                  WHERE prod.product_publish = '1' AND cat.category_publish='1'\n                  {$adv_query}";
     $db->setQuery($query);
     $total = $db->loadResult();
     if (!$total) {
         $view_name = "search";
         $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
         $view = $this->getView($view_name, getDocumentType(), '', $view_config);
         $view->setLayout("noresult");
         $view->assign('search', $search);
         $view->display();
         return 0;
     }
     $dispatcher->trigger('onBeforeFixLimitstartDisplayProductList', array(&$limitstart, &$total, 'search'));
     if ($limitstart >= $total) {
         $limitstart = 0;
     }
     $query = "SELECT {$adv_result} FROM `#__jshopping_products` AS prod\n                  LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id\n                  LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id                  \n                  {$adv_from}\n                  WHERE prod.product_publish = '1' AND cat.category_publish='1'\n                  {$adv_query}\n                  GROUP BY prod.product_id " . $order_query;
     $db->setQuery($query, $limitstart, $limit);
     $rows = $db->loadObjectList();
     $rows = listProductUpdateData($rows);
     addLinkToProducts($rows, 0, 1);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $pagenav = $pagination->getPagesLinks();
     foreach ($jshopConfig->sorting_products_name_s_select as $key => $value) {
         $sorts[] = JHTML::_('select.option', $key, $value, 'sort_id', 'sort_value');
     }
     insertValueInArray($jshopConfig->count_products_to_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();
     $action = xhtmlUrl($_SERVER['REQUEST_URI']);
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$rows));
     $view_name = "search";
     $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('search', $search);
     $view->assign('total', $total);
     $view->assign('config', $jshopConfig);
     $view->assign('template_block_list_product', "list_products/list_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', 0);
     $view->assign('filter_show_category', 0);
     $view->assign('filter_show_manufacturer', 0);
     $view->assign('pagination', $pagenav);
     $view->assign('pagination_obj', $pagination);
     $view->assign('display_pagination', $pagenav != "");
     $view->assign('product_count', $product_count_sel);
     $view->assign('sorting', $sorting_sel);
     $view->assign('action', $action);
     $view->assign('orderby', $orderby);
     $view->assign('count_product_to_row', $jshopConfig->count_products_to_row);
     $view->assign('rows', $rows);
     $view->assign('allow_review', $allow_review);
     $view->assign('shippinginfo', SEFLink($jshopConfig->shippinginfourl, 1));
     $dispatcher->trigger('onBeforeDisplayProductListView', array(&$view));
     $view->display();
 }
Exemplo n.º 18
0
 /**
  * This method tests the getPagesLinks method.
  *
  * @param   integer  $total       The total number of items.
  * @param   integer  $limitstart  The offset of the item to start at.
  * @param   integer  $limit       The number of items to display per page.
  * @param   array    $expected    The expected results for the JPagination object
  *
  * @return  void
  *
  * @covers        JPagination::getPagesLinks
  * @dataProvider  dataTestGetPagesLinks
  * @since         3.2
  */
 public function testGetPagesLinks($total, $limitstart, $limit, $expected)
 {
     $pagination = new JPagination($total, $limitstart, $limit, '', $this->app);
     $result = $pagination->getPagesLinks();
     $this->assertEquals($result, $expected, 'The expected output of the pagination is incorrect');
     unset($pagination);
 }
Exemplo n.º 19
0
        function _getWallHTML($userid, $limit, $limitstart, $allowPosting, $allowRemoval)
        {
            $config = CFactory::getConfig();
            $html = '';
            $viewAllLink = false;
            if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
                $viewAllLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=walls');
            }
            $wallCount = CWallLibrary::getWallCount('user', $userid);
            $wallModel = CFactory::getModel('wall');
            $wallsinput = "";
            if ($allowPosting) {
                $wallsinput = CWallLibrary::getWallInputForm($userid, 'plugins,walls,ajaxSaveWall', 'plugins,walls,ajaxRemoveWall', $viewAllLink);
            }
            $contents = CWallLibrary::getWallContents('user', $userid, $allowRemoval, $limit, $limitstart, 'wall.content', 'profile,profile');
            $contents .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
            $html .= $wallsinput;
            $html .= '<div id="wallContent" style="display: block; visibility: visible;">';
            if ($contents == '') {
                $html .= '
				<div id="wall-empty-container">
					<div class="icon-nopost">
			            <img src="' . JURI::base() . 'plugins/community/walls/favicon.png" alt="" />
			        </div>
			        <div class="content-nopost">' . JText::_('PLG_WALLS_NO_WALL_POST') . '
			        </div>
				</div>';
            } else {
                $html .= CStringHelper::replaceThumbnails($contents);
            }
            $html .= '</div>';
            // Add pagination links, only in full app view
            if (JRequest::getVar('task', '', 'REQUEST') == 'app') {
                jimport('joomla.html.pagination');
                $pagination = new JPagination($wallModel->getCount($userid, 'user'), $limitstart, $limit);
                $html .= '
				<!-- Pagination -->
				<div style="text-align: center;">
					' . $pagination->getPagesLinks() . '
				</div>
				<!-- End Pagination -->';
            }
            return $html;
        }
Exemplo n.º 20
0
                </td>
            </tr>

        <?php 
}
?>

        <tr>
            <td colspan = "6" class = "<?php 
echo $boardclass;
?>
profile-bottomnav  fbm " align="center">

                <?php 
// TODO: fxstein - Need to perform SEO cleanup
echo $pageNav->getPagesLinks("index.php?option=com_kunena&amp;func=fbprofile&amp;task=showprf&amp;userid={$userid}" . KUNENA_COMPONENT_ITEMID_SUFFIX);
echo $pageNav->getLimitBox("index.php?option=com_kunena&amp;func=fbprofile&amp;task=showprf&amp;userid={$userid}" . KUNENA_COMPONENT_ITEMID_SUFFIX);
?>
                <br/>
<?php 
echo $pageNav->getPagesCounter();
?>
            </td>
        </tr>
    </tbody>
</table>
</div>
</div>
</div>
</div>
</div>
Exemplo n.º 21
0
 /**
  * Application full view
  * @return type
  */
 public function appFullView()
 {
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $this->showSubmenu();
     $applicationName = JString::strtolower($jinput->get->get('app', '', 'STRING'));
     if (empty($applicationName)) {
         JError::raiseError(500, 'COM_COMMUNITY_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 = JRequest::getInt('limit', 5, 'REQUEST');
         $limitstart = JRequest::getInt('limitstart', 0, 'REQUEST');
         $eventId = JRequest::getInt('eventid', '');
         $my = CFactory::getUser();
         $config = CFactory::getConfig();
         $eventsModel = CFactory::getModel('Events');
         $event = JTable::getInstance('Event', 'CTable');
         $event->load($eventId);
         $config = CFactory::getConfig();
         /**
          * Opengraph
          */
         CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_EVENTS_WALL_TITLE', $event->title));
         $guest = $event->isMember($my->id);
         $waitingApproval = $event->isPendingApproval($my->id);
         $status = $event->getUserStatus($my->id, 'events');
         $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()) {
             // Get the walls content
             $output .= '<div id="wallContent">';
             $output .= CWallLibrary::getWallContents('events', $event->id, $event->isAdmin($my->id), $limit, $limitstart, 'wall/content', 'events,events');
             $output .= '</div>';
             $output .= CWallLibrary::getWallInputForm($event->id, 'events,ajaxSaveWall', 'events,ajaxRemoveWall');
             jimport('joomla.html.pagination');
             $wallModel = CFactory::getModel('wall');
             $pagination = new JPagination($wallModel->getCount($event->id, 'events'), $limitstart, $limit);
             $output .= '<div class="cPagination">' . $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, 'COM_COMMUNITY_APPS_NOT_FOUND');
         }
         // 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);
     }
     echo $output;
 }
Exemplo n.º 22
0
function show_listing($listing, $url, $params, $searchbox, $searchboxbutton, $lists, $pagination, $options, $lang, $menuid, $categoriesbegenningby)
{
    global $mainframe;
    $document =& JFactory::getDocument();
    $user =& JFactory::getUser();
    // show search bar
    if ($searchbox) {
        $jumpmenulist = "\t\t<!--\n\t\tfunction jumpmenu(target,obj,restore){\n\t\t  eval(target+\".location='\"+obj.options[obj.selectedIndex].value+\"'\");\t\t\n\t\t  if (restore) obj.selectedIndex=0;\t\t\n\t\t}\t\t\n\t\t//-->";
        ?>
	<?php 
        $document->addScriptDeclaration($jumpmenulist);
        ?>
			
		<div id="searchbar">
		<table width="100%"  border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>
				<form name="adminFormSearchAC" action="" method="post">
				<?php 
        echo $searchbox;
        ?>
 <?php 
        echo $lists['list_searchfield'];
        ?>
 <?php 
        echo $searchboxbutton;
        ?>
				</form>			
				</td>
				<td><div class="orderinglist">
				<?php 
        if (count($listing) && @$listing[0]->id != '' && $options['letter'] == '') {
            echo $lists['list_defaultordering'];
        }
        ?>
				</div></td>
			</tr>
		</table>
		</div>
		
	<?php 
    }
    // If result search letter -> show result categories beginning with this letter
    if ($categoriesbegenningby) {
        echo "<div id=\"alphapcategoriesbegenningby\"><span class=\"bigletter\">" . $options['letter'] . "</span><span class=\"allcategoriesbeginningby\">" . $categoriesbegenningby . "</span></div>";
    }
    if (count($listing) > $pagination->limit) {
        $newlimit = count($listing);
        $pagination = new JPagination($options['total'], $newlimit, $pagination->limitstart);
    }
    // show Pages Counter
    if ($params->get('list_shownumberpagetotal') && (count($listing) && @$listing[0]->id != '')) {
        if (!($options['section'] == '' && ($options['letter'] != '' || $options['search'] != '') && ($params->get('weblinkssection') || $params->get('contactsection')))) {
            echo "<div id=\"alphapagecounter\"><p>";
            echo $pagination->getResultsCounter();
            echo "</p></div>";
        }
    }
    $ac_alignimage = $params->get('list_imageposition');
    $ac_numcolumnslisting = $params->get('list_numcols');
    $ac_k = $ac_alignimage == '2' ? 0 : 'none';
    // for alternate image left-right
    $line = 0;
    // just using for 2 columns
    for ($i = 0; $i < count($listing); $i++) {
        //for ( $i=0; $i < $new_pagination ; $i++ ){
        // prepare each listing
        if (@$listing[$i]->id != '') {
            // define all vars for listing template
            $id_article = $listing[$i]->id;
            // id of item article
            $num = $params->get('list_numindex') ? $i + 1 + $options['limitstart'] : '';
            //num listing
            $title = "";
            // title of item
            $featured = "";
            // show "Featured" article on homepage of AlphaContent if this option is selected
            $icon_new = "";
            // icon new
            $icon_hot = "";
            // icon hot
            $section_category = "";
            // section / category
            $author = "";
            // author or alias author if defined in item
            $content = "";
            // content intro
            $date = "";
            // date created
            $hits = "";
            // num hits
            $comments = "";
            // num of comments
            $rating = "";
            // rating bar (native Joomla)
            $print = "";
            // link to print
            $pdf = "";
            // link to pdf
            $emailthis = "";
            // link to email this
            $report = "";
            // link to report this listing
            $readmore = "";
            // readmore link if exist
            $ratingbar = "";
            // ajax rating bar integrated in AlphaContent
            $googlemaps = "";
            // link to Google Maps Location
            $tags = "";
            // tags / keywords
            $link_to_article = $listing[$i]->reallink;
            // real link to article or contact or weblink
            /*		
            *
            * Notes *
            ---------
            $rating is disabled if you use ajax rating bar integrated in AlphaContent ($ratingbar)		
            *
            */
            $url_article = $listing[$i]->slug;
            if ($listing[$i]->catslug && $url_article != '') {
                $url_article .= "&amp;catid=" . $listing[$i]->catslug;
            }
            $url_article .= "&amp;directory=" . $menuid;
            $start_url_article = "<a href=\"" . JRoute::_($listing[$i]->href . $url_article) . "\">";
            $end_url_article = "</a>";
            // get Title article/contact/weblink
            if ($params->get('list_titlelinkable')) {
                $title = $start_url_article . $listing[$i]->title . $end_url_article;
                if ($listing[$i]->is_article == 'weblink') {
                    $title = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . $listing[$i]->title . "</a>";
                }
            } else {
                $title = $listing[$i]->title;
            }
            // Featured
            if ($listing[$i]->is_article) {
                $featuredID = @explode(',', $params->get('list_featuredID'));
                $featured = $listing[$i]->featured || @in_array($listing[$i]->id, $featuredID) ? JText::_('AC_FEATURED') : '';
            }
            // get icon new and hot
            $typedatearticle = $params->get('list_showdate') ? $params->get('list_showdate') : 'created';
            if ($params->get('list_iconnew')) {
                $icon_new = showIconNew($listing[$i]->{$typedatearticle}, $params->get('list_numdaynew'), $lang);
            }
            if ($params->get('list_iconhot')) {
                $icon_hot = showIconHot($listing[$i]->hits, $params->get('list_numhitshot'), $lang);
            }
            if ($params->get('list_showsectioncategory')) {
                $section_category = $listing[$i]->section;
            }
            // get Section/Category
            $section_category = $params->get('list_showsectioncategory') ? $listing[$i]->section : '';
            // get Author
            $author = $params->get('list_showauthor') ? $listing[$i]->author : '';
            // get Ajax rating bar for AlphaContent
            if ($params->get('showsystemrating') && $params->get('activeglobalsystemrating') && $params->get('systemrating')) {
                switch ($options['section']) {
                    case 'weblinks':
                        $component4rating = 'com_weblinks';
                        break;
                    case 'contacts':
                        $component4rating = 'com_contact';
                        break;
                    default:
                        $component4rating = 'com_content';
                }
                $document =& JFactory::getDocument();
                $document->addScript(JURI::base(true) . '/components/com_alphacontent/assets/js/behavior.js');
                $document->addScript(JURI::base(true) . '/components/com_alphacontent/assets/js/rating.js');
                $document->addStyleSheet(JURI::base(true) . '/components/com_alphacontent/assets/css/rating.css');
                require_once JPATH_COMPONENT . DS . 'assets' . DS . 'includes' . DS . 'alphacontent.drawrating.php';
                $ratingbar = rating_bar($listing[$i]->id, $params->get('numstars'), $component4rating, $params->get('widthstars', 16), '', '', 0, 0, $params->get('showinfosrating'));
                // usage rating_bar( id article, num stars, component, width stars, default=16 ), static, model (example for module), comment id, review id, show or hide sum*rating/num stars (num votes) );
            }
            // get Joomla native rating bar
            if ($params->get('showsystemrating') && $params->get('systemrating') == '0' && $listing[$i]->rating_count != '') {
                // look for images in template if available
                $img = "";
                $starImageOn = JHTML::_('image.site', 'rating_star.png', '/images/M_images/');
                $starImageOff = JHTML::_('image.site', 'rating_star_blank.png', '/images/M_images/');
                for ($rb = 0; $rb < $listing[$i]->rating; $rb++) {
                    $img .= $starImageOn;
                }
                for ($rb = $listing[$i]->rating; $rb < 5; $rb++) {
                    $img .= $starImageOff;
                }
                $rating = '<span class="content_rating">';
                $rating .= JText::_('User Rating') . ':' . $img . '&nbsp;/&nbsp;';
                $rating .= intval($listing[$i]->rating_count);
                $rating .= "</span>";
            }
            // Location Google Maps link
            //if ( $params->get('list_showlinkmap') && $params->get('apikeygooglemap') ) {
            if ($params->get('list_showlinkmap')) {
                $mapIsDefined = 0;
                if (preg_match('#{ALPHAGMAP=(.*)}#Uis', $listing[$i]->text, $m)) {
                    $listing[$i]->text = preg_replace("#{ALPHAGMAP=(.*)}#Uis", "", $listing[$i]->text);
                    $mapIsDefined = 1;
                } elseif (preg_match('#{ALPHAGMAP=(.*)}#Uis', $listing[$i]->fulltext, $m)) {
                    $listing[$i]->fulltext = preg_replace("#{ALPHAGMAP=(.*)}#Uis", "", $listing[$i]->fulltext);
                    $mapIsDefined = 1;
                }
                $a = array();
                if ($mapIsDefined) {
                    $a = explode("|", $m[1]);
                    if (count($a) == 3) {
                        $thewidthmap = $params->get('widthgooglemap') + 20;
                        $theheightmap = $params->get('heightgooglemap') + 20;
                        $status = "status=no,toolbar=no,scrollbars=no,titlebar=no,menubar=no,resizable=no,width=" . $thewidthmap . ",height=" . $theheightmap . ",directories=no,location=no";
                        $googlemaps = "<a href=\"javascript:void window.open('index2.php?option=com_alphacontent&amp;task=viewmap&amp;la=" . $a[0] . "&amp;lo=" . $a[1] . "&amp;txt=" . $a[2] . "', 'win2', '{$status}');\">" . JTEXT::_('AC_MAP') . "</a>";
                    }
                }
            }
            $listing[$i]->text = preg_replace('#{ALPHAGMAP=(.*)}#Uis', '', $listing[$i]->text);
            // prepare content
            $cuttext = 0;
            switch ($params->get('list_introstyle')) {
                case '1':
                    // text only
                    $numcharsintro = $params->get('list_numcharsintro') ? $params->get('list_numcharsintro') : '999999';
                    $cuttext = strlen($listing[$i]->text) > $numcharsintro ? 1 : 0;
                    $content = acPrepareAlphaContent($listing[$i]->text, $numcharsintro, '');
                    break;
                case '2':
                    // Original intro with plugins
                    //if ( $listing[$i]->attribs!='' ) {
                    // Process the prepare content plugins
                    JPluginHelper::importPlugin('content');
                    $dispatcher =& JDispatcher::getInstance();
                    $tparams =& $mainframe->getParams('com_content');
                    // Merge article parameters into the page configuration
                    $aparams = new JParameter($listing[$i]->attribs);
                    $tparams->merge($aparams);
                    //$results = @$dispatcher->trigger('onPrepareContent', array (& $listing[$i]->text, & $tparams, 0));
                    $results = @$dispatcher->trigger('onPrepareContent', array(&$listing[$i], &$tparams, 0));
                    $content = $listing[$i]->text;
                    //}
                    break;
                case '3':
                    // Metadesc
                    $numcharsintro = $params->get('list_numcharsintro') ? $params->get('list_numcharsintro') : '999999';
                    $content = $listing[$i]->metadesc ? $listing[$i]->metadesc : acPrepareAlphaContent($listing[$i]->text, $numcharsintro, '');
                    break;
            }
            if ($listing[$i]->created) {
                if ($params->get('list_showdate') == 'created') {
                    $date = JHTML::_('date', $listing[$i]->created, JText::_($params->get('list_formatdate')));
                } elseif ($params->get('list_showdate') == 'modified') {
                    $date = JHTML::_('date', $listing[$i]->modified, JText::_($params->get('list_formatdate')));
                }
            }
            $hits = $params->get('list_showhits') ? intval($listing[$i]->hits) : '';
            // get number of comments
            if ($params->get('list_shownumcomments') && $params->get('list_commentsystem') && $listing[$i]->is_article == '1') {
                $comments = getNumberComments($params->get('list_commentsystem'), $listing[$i]->id);
            }
            // PDF link
            if ($listing[$i]->is_article == '1' && $params->get('list_showpdf')) {
                $url = 'index.php?view=article';
                $url .= @$listing[$i]->catslug ? '&catid=' . $listing[$i]->catslug : '';
                $url .= '&id=' . $listing[$i]->id . $listing[$i]->slug . '&format=pdf&option=com_content';
                $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
                $text = JText::_('PDF');
                $attribs['title'] = JText::_('PDF');
                $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
                $attribs['rel'] = 'nofollow';
                $pdf = JHTML::_('link', JRoute::_($url), $text, $attribs);
            }
            // Print link
            if ($listing[$i]->is_article == '1' && $params->get('list_showprint')) {
                $url = 'index.php?view=article';
                $url .= @$listing[$i]->catslug ? '&catid=' . $listing[$i]->catslug : '';
                $url .= '&id=' . $listing[$i]->id . $listing[$i]->slug . '&tmpl=component&print=1&option=com_content';
                $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
                $text = JText::_('Print');
                $attribs['title'] = JText::_('Print');
                $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
                $print = JHTML::_('link', JRoute::_($url), $text, $attribs);
            }
            // Email link
            if ($listing[$i]->is_article == '1' && $params->get('list_showemail')) {
                $uri =& JURI::getInstance();
                $base = $uri->toString(array('scheme', 'host', 'port'));
                $link = $base . JRoute::_("index.php?view=article&id=" . $listing[$i]->id . $listing[$i]->slug, false);
                $url = 'index.php?option=com_mailto&tmpl=component&link=' . base64_encode($link);
                $status = 'width=400,height=300,menubar=yes,resizable=yes';
                $text = '&nbsp;' . JText::_('Email');
                $attribs['title'] = JText::_('Email');
                $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
                $emailthis = JHTML::_('link', JRoute::_($url), $text, $attribs);
            }
            // report this listing link
            if ($params->get('list_showreportlisting')) {
                $url = 'index.php?option=com_alphacontent&task=report';
                //switch ( $options['section'] ) {
                switch ($listing[$i]->is_article) {
                    case 'weblink':
                        $report_type = 'com_weblinks';
                        break;
                    case 'contact':
                        $report_type = 'com_contact';
                        break;
                    default:
                        $report_type = 'com_content';
                }
                $url .= '&type=' . $report_type . '&id=' . $id_article . '&tmpl=component';
                $status = 'width=400,height=300,menubar=yes,resizable=yes';
                $text = JText::_('AC_REPORT');
                $attribsr['title'] = JText::_('AC_REPORT_THIS_LISTING');
                $attribsr['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
                $report = JHTML::_('link', JRoute::_($url), $text, $attribsr);
            }
            // readmore link
            if (($listing[$i]->readmore || $cuttext) && $params->get('list_showreadmore')) {
                $sluggy = $listing[$i]->slug;
                if ($listing[$i]->catslug && $sluggy != '') {
                    $sluggy .= "&amp;catid=" . $listing[$i]->catslug;
                }
                $sluggy .= "&amp;directory=" . $menuid;
                $readmore = "<a href=\"" . JRoute::_($listing[$i]->href . $sluggy) . "\">" . JText::_('Readmore') . "</a>";
                if ($listing[$i]->access > $user->aid) {
                    $readmore = "<a href=\"" . JRoute::_($listing[$i]->href . $sluggy) . "\">" . JText::_("REGISTER TO READ MORE...") . "</a>";
                }
            }
            // prepare image
            $linkimgsrc = "";
            if ($params->get('list_showimage')) {
                if ($listing[$i]->is_article == '1') {
                    $linkIMG = findIMG($listing[$i]->text, $params->get('list_showimage'));
                    if ($linkIMG == "") {
                        $linkIMG = findIMG($listing[$i]->fulltext, $params->get('list_showimage'));
                    }
                    $linkimgsrc = $linkIMG ? $start_url_article . "<img src=\"" . $linkIMG . "\" width=\"" . $params->get('list_widthimage') . "px\" alt=\"\" />" . $end_url_article : "";
                } elseif ($listing[$i]->is_article == 'contact' && $listing[$i]->images) {
                    $linkimgsrc = $start_url_article . "<img src=\"images/stories/" . $listing[$i]->images . "\" width=\"" . $params->get('list_widthimage') . "px\" alt=\"\" />" . $end_url_article;
                } elseif ($listing[$i]->is_article == 'weblink' && $params->get('weblinksthumbnail') == '1') {
                    $forcewidth = "width=\"" . $params->get('list_widthimage') . "px\"";
                    if ($params->get('list_keywebsnapr') && $params->get('list_sizewebsnapr', 'AC') != 'AC') {
                        $sizewebsnapr = "size=" . $params->get('list_sizewebsnapr');
                        $sizewebsnapr .= "&key=" . $params->get('list_keywebsnapr');
                        $forcewidth = "";
                    } else {
                        $sizewebsnapr = "size=s";
                    }
                    $linkimgsrc = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . "<img src=\"http://images.websnapr.com/?" . $sizewebsnapr . "&url=" . $listing[$i]->reallink . "\" alt=\"" . $listing[$i]->reallink . "\" {$forcewidth} />" . "</a>";
                }
            }
            if ($listing[$i]->is_article == 'weblink') {
                // prepare link for weblink
                $content = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . $listing[$i]->reallink . "</a><br />" . $content;
            }
            if ($listing[$i]->is_article == 'contact' && $listing[$i]->author != '') {
                // prepare link for email contact
                $content .= "<br /><a href=\"mailto:" . $listing[$i]->author . "\">" . $listing[$i]->author . "</a>";
                $author = "";
            }
            if ($listing[$i]->is_article == 'contact' && $listing[$i]->reallink != '') {
                // prepare link for webpage url
                $content .= "<br /><a href=\"" . $listing[$i]->reallink . "\" target=\"_blank\">" . $listing[$i]->reallink . "</a><br />";
            }
            if ($listing[$i]->metakey != '' && $params->get('showtags')) {
                $keywords = array();
                $keywords = explode(",", trim($listing[$i]->metakey));
                for ($a = 0, $b = count($keywords); $a < $b; $a++) {
                    $metakey = trim($keywords[$a]);
                    if ($a > 0) {
                        $tags .= ", ";
                    }
                    $tags .= " <a href=\"" . JRoute::_("index.php?option=com_search&searchword={$metakey}&submit=Search&searchphrase=any&ordering=newest") . "\">" . $metakey . "</a>";
                }
            }
            // START LAYOUT
            $ac_m = $line % 2 + 1;
            // using 2 columns
            if ($ac_numcolumnslisting && $ac_m == '1') {
                echo "\n<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"><tr><td width=\"50%\" valign=\"top\">\n";
            }
            if ($ac_numcolumnslisting && $ac_m == '2') {
                echo "\n<td width=\"50%\" valign=\"top\">\n";
            }
            ?>
			<!-- STARTING DIV CONTAINER ARTICLE -->
			<div id="container<?php 
            echo $num;
            ?>
" class="alphalisting">
			<table width="100%"><tr>	
			<?php 
            if ($params->get('list_showimage') && $linkimgsrc != '') {
                if ($ac_alignimage == 0 && $ac_k == 'none' || $ac_alignimage == '2' && $ac_k == 0) {
                    ?>
				<td valign="top" width="<?php 
                    echo $params->get('list_widthimage');
                    ?>
px">
				<!-- STARTING DIV IMAGE LEFT -->				
				<div class="_imageleft"><?php 
                    echo $linkimgsrc;
                    ?>
</div>
				<!-- END DIV IMAGE LEFT -->
				</td>
				<?php 
                }
            }
            ?>
			<!-- STARTING DIV ARTICLE -->
			<td>
			<div id="article<?php 
            echo $num;
            ?>
">
			<div id="title<?php 
            echo $num;
            ?>
">
			<?php 
            if ($num) {
                ?>
<span class="_alphanum" style="display:inline;"><?php 
                echo $num;
                ?>
. </span><?php 
            }
            ?>
			<?php 
            if ($title) {
                ?>
<span class="_alphatitle" style="display:inline;"><?php 
                echo $title;
                ?>
</span> <span class="_alphafeatured"><sup><?php 
                echo $featured;
                ?>
</sup></span> <?php 
            }
            ?>
			<?php 
            if ($icon_new || $icon_hot) {
                ?>
<span style="display:inline;"><?php 
                echo " " . $icon_new . " " . $icon_hot;
                ?>
</span><?php 
            }
            ?>
			</div>
			<?php 
            if ($ratingbar || $rating) {
                ?>
				<div id="ratingbar<?php 
                echo $num;
                ?>
" class="small">				
				<?php 
                echo $ratingbar;
                if ($rating) {
                    echo $rating;
                }
                ?>
 
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($section_category) {
                ?>
				<div class="small"><?php 
                echo $section_category;
                ?>
</div>
			<?php 
            }
            ?>
			<?php 
            if ($author) {
                ?>
				<div class="small">
				<?php 
                echo JTEXT::_('AC_AUTHOR') . $author;
                ?>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($tags) {
                ?>
			
				<div class="small">
				<?php 
                echo JTEXT::_('AC_TAGS') . $tags;
                ?>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($content) {
                ?>
				<div id="content<?php 
                echo $num;
                ?>
"><?php 
                echo $content;
                ?>
</div>
			<?php 
            }
            ?>
			<div id="features<?php 
            echo $num;
            ?>
">
			<?php 
            if ($date) {
                ?>
<span class="small"><?php 
                echo $date;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($hits) {
                ?>
 | <span class="small"><?php 
                $labelHit = $hits > 1 ? 'AC_HITS' : 'AC_HIT';
                echo $hits . " " . JTEXT::_($labelHit);
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($comments) {
                ?>
 | <span class="small"><?php 
                $labelComment = $comments > 1 ? JTEXT::_('AC_COMMENTS') : JTEXT::_('AC_COMMENT');
                echo $comments . " " . $start_url_article . $labelComment . $end_url_article;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($print) {
                ?>
 | <span class="small"><?php 
                echo $print;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($pdf) {
                ?>
 | <span class="small"><?php 
                echo $pdf;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($emailthis) {
                ?>
 | <span class="small"><?php 
                echo $emailthis;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($report) {
                ?>
 | <span class="small"><?php 
                echo $report;
                ?>
</span><?php 
            }
            ?>
			
			<?php 
            if ($readmore) {
                ?>
 | <span class="small"><?php 
                echo $readmore;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($googlemaps) {
                ?>
 | <span class="small"><?php 
                echo $googlemaps;
                ?>
</span><?php 
            }
            ?>
			</div>
			</div><!-- END DIV ARTICLE -->
			</td>
			<?php 
            if ($params->get('list_showimage') && $linkimgsrc != '') {
                if ($ac_alignimage == 1 && $ac_k == 'none' || $ac_alignimage == '2' && $ac_k == 1) {
                    ?>
				<td valign="top" width="<?php 
                    echo $params->get('list_widthimage');
                    ?>
px">
				<!-- STARTING DIV IMAGE RIGHT -->
				<div class="_imageright"><?php 
                    echo $linkimgsrc;
                    ?>
</div>				
				<!-- END DIV IMAGE RIGHT -->
				</td>
				<?php 
                }
            }
            ?>
			</tr></table></div><!-- END DIV CONTAINER -->
			<div class="_separate"></div>
			<?php 
            // END LAYOUT HTML
            // using 2 columns
            if ($ac_numcolumnslisting && $ac_m == '1') {
                echo "\n</td>\n";
            }
            if ($ac_numcolumnslisting && $ac_m == '1' && $i == count($listing) - 1) {
                echo "\n<td width=\"50%\" valign=\"top\">&nbsp;";
            }
            if ($ac_numcolumnslisting && $ac_m == '2' || $ac_numcolumnslisting && $ac_m == '1' && $i == count($listing) - 1) {
                echo "\n</td></tr></table>\n";
            }
            $line++;
            if ($ac_alignimage == '2') {
                $ac_k = 1 - $ac_k;
            }
        } else {
            if ($i > 0) {
                $i = $i - 1;
            }
        }
    }
    ?>
	
	<?php 
    if (count($listing) && @$listing[0]->id != '') {
        if (!($options['section'] == '' && ($options['letter'] != '' || $options['search'] != '') && ($params->get('weblinkssection') || $params->get('contactsection')))) {
            echo "<div id=\"alphapagination\"><p>";
            echo $pagination->getPagesLinks();
            echo "<br />";
            echo $pagination->getPagesCounter();
            echo "</p></div>";
        }
    }
}
Exemplo n.º 23
0
/**
* Page break plugin
*
* <b>Usage:</b>
* <code><hr class="system-pagebreak" /></code>
* <code><hr class="system-pagebreak" title="The page title" /></code>
* or
* <code><hr class="system-pagebreak" alt="The first page" /></code>
* or
* <code><hr class="system-pagebreak" title="The page title" alt="The first page" /></code>
* or
* <code><hr class="system-pagebreak" alt="The first page" title="The page title" /></code>
*
*/
function plgContentPagebreak(&$row, &$params, $page = 0)
{
    // expression to search for
    $regex = '#<hr([^>]*?)class=(\\"|\')system-pagebreak(\\"|\')([^>]*?)\\/*>#iU';
    // Get Plugin info
    $plugin =& JPluginHelper::getPlugin('content', 'pagebreak');
    $pluginParams = new JParameter($plugin->params);
    $print = JRequest::getBool('print');
    $showall = JRequest::getBool('showall');
    JPlugin::loadLanguage('plg_content_pagebreak');
    if (!$pluginParams->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 (strpos($row->text, 'class="system-pagebreak') === false && strpos($row->text, 'class=\'system-pagebreak') === false) {
        return true;
    }
    $db =& JFactory::getDBO();
    $view = JRequest::getCmd('view');
    if (!$page) {
        $page = 0;
    }
    // check whether plugin has been unpublished
    if (!JPluginHelper::isEnabled('content', 'pagebreak') || $params->get('intro_only') || $params->get('popup') || $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 && $pluginParams->get('showall', 1)) {
        $hasToc = $pluginParams->get('multipage_toc', 1);
        if ($hasToc) {
            // display TOC
            $page = 1;
            plgContentCreateTOC($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) {
        // Get plugin parameters
        $pluginParams = new JParameter($plugin->params);
        $title = $pluginParams->get('title', 1);
        $hasToc = $pluginParams->get('multipage_toc', 1);
        // adds heading or title to <site> Title
        if ($title) {
            if ($page) {
                $page_text = $page + 1;
                if ($page && @$matches[$page - 1][2]) {
                    $attrs = JUtility::parseAttributes($matches[$page - 1][0]);
                    if (@$attrs['title']) {
                        $row->page_title = $attrs['title'];
                    }
                }
            }
        }
        // reset the text, we already hold it in the $text array
        $row->text = '';
        // display TOC
        if ($hasToc) {
            plgContentCreateTOC($row, $matches, $page);
        } else {
            $row->toc = '';
        }
        // traditional mos page navigation
        jimport('joomla.html.pagination');
        $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="pagenavbar">';
        // adds navigation between pages to bottom of text
        if ($hasToc) {
            plgContentCreateNavigation($row, $page, $n);
        }
        // page links shown at bottom of page if TOC disabled
        if (!$hasToc) {
            $row->text .= $pageNav->getPagesLinks();
        }
        $row->text .= '</div><br />';
    }
    return true;
}
Exemplo n.º 24
0
 function display($cachable = false, $urlparams = false)
 {
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $ajax = JRequest::getInt('ajax');
     $jshopConfig = JSFactory::getConfig();
     $user = JFactory::getUser();
     JSFactory::loadJsFilesLightBox();
     $session = JFactory::getSession();
     $tmpl = JRequest::getVar("tmpl");
     if ($tmpl != "component") {
         $session->set("jshop_end_page_buy_product", $_SERVER['REQUEST_URI']);
     }
     $product_id = JRequest::getInt('product_id');
     $category_id = JRequest::getInt('category_id');
     $attr = JRequest::getVar("attr");
     $back_value = $session->get('product_back_value');
     if (!isset($back_value['pid'])) {
         $back_value = array('pid' => null, 'attr' => null, 'qty' => null);
     }
     if ($back_value['pid'] != $product_id) {
         $back_value = array('pid' => null, 'attr' => null, 'qty' => null);
     }
     if (!is_array($back_value['attr'])) {
         $back_value['attr'] = array();
     }
     if (count($back_value['attr']) == 0 && is_array($attr)) {
         $back_value['attr'] = $attr;
     }
     JPluginHelper::importPlugin('jshoppingproducts');
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onBeforeLoadProduct', array(&$product_id, &$category_id, &$back_value));
     $dispatcher->trigger('onBeforeLoadProductList', array());
     $product = JTable::getInstance('product', 'jshop');
     $product->load($product_id);
     $listcategory = $product->getCategories(1);
     if (!getDisplayPriceForProduct($product->product_price)) {
         $jshopConfig->attr_display_addprice = 0;
     }
     $attributesDatas = $product->getAttributesDatas($back_value['attr']);
     $product->setAttributeActive($attributesDatas['attributeActive']);
     $attributeValues = $attributesDatas['attributeValues'];
     $attributes = $product->getBuildSelectAttributes($attributeValues, $attributesDatas['attributeSelected']);
     if (count($attributes)) {
         $_attributevalue = JTable::getInstance('AttributValue', 'jshop');
         $all_attr_values = $_attributevalue->getAllAttributeValues();
     } else {
         $all_attr_values = array();
     }
     $session->set('product_back_value', array());
     $product->getExtendsData();
     $category = JTable::getInstance('category', 'jshop');
     $category->load($category_id);
     $category->name = $category->getName();
     $dispatcher->trigger('onBeforeCheckProductPublish', array(&$product, &$category, &$category_id, &$listcategory));
     if ($category->category_publish == 0 || $product->product_publish == 0 || !in_array($product->access, $user->getAuthorisedViewLevels()) || !in_array($category_id, $listcategory)) {
         JError::raiseError(404, _JSHOP_PAGE_NOT_FOUND);
         return;
     }
     if (getShopMainPageItemid() == JRequest::getInt('Itemid')) {
         appendExtendPathway($category->getTreeChild(), 'product');
     }
     appendPathWay($product->name);
     if ($product->meta_title == "") {
         $product->meta_title = $product->name;
     }
     setMetaData($product->meta_title, $product->meta_keyword, $product->meta_description);
     $product->hit();
     $product->product_basic_price_unit_qty = 1;
     if ($jshopConfig->admin_show_product_basic_price) {
         $product->getBasicPriceInfo();
     } else {
         $product->product_basic_price_show = 0;
     }
     $view_name = "product";
     $view_config = array("template_path" => JPATH_COMPONENT . "/templates/" . $jshopConfig->template . "/" . $view_name);
     $view = $this->getView($view_name, getDocumentType(), '', $view_config);
     if ($product->product_template == "") {
         $product->product_template = "default";
     }
     $view->setLayout("product_" . $product->product_template);
     $_review = JTable::getInstance('review', 'jshop');
     if (($allow_review = $_review->getAllowReview()) > 0) {
         $arr_marks = array();
         $arr_marks[] = JHTML::_('select.option', '0', _JSHOP_NOT, 'mark_id', 'mark_value');
         for ($i = 1; $i <= $jshopConfig->max_mark; $i++) {
             $arr_marks[] = JHTML::_('select.option', $i, $i, 'mark_id', 'mark_value');
         }
         $text_review = '';
         $select_review = JHTML::_('select.genericlist', $arr_marks, 'mark', 'class="inputbox" size="1"', 'mark_id', 'mark_value');
     } else {
         $select_review = '';
         $text_review = $_review->getText();
     }
     if ($allow_review) {
         JSFactory::loadJsFilesRating();
     }
     if ($jshopConfig->product_show_manufacturer_logo || $jshopConfig->product_show_manufacturer) {
         $product->manufacturer_info = $product->getManufacturerInfo();
         if (!isset($product->manufacturer_info)) {
             $product->manufacturer_info = new stdClass();
             $product->manufacturer_info->manufacturer_logo = '';
             $product->manufacturer_info->name = '';
         }
     } else {
         $product->manufacturer_info = new stdClass();
         $product->manufacturer_info->manufacturer_logo = '';
         $product->manufacturer_info->name = '';
     }
     if ($jshopConfig->product_show_vendor) {
         $vendorinfo = $product->getVendorInfo();
         $vendorinfo->urllistproducts = SEFLink("index.php?option=com_jshopping&controller=vendor&task=products&vendor_id=" . $vendorinfo->id, 1);
         $vendorinfo->urlinfo = SEFLink("index.php?option=com_jshopping&controller=vendor&task=info&vendor_id=" . $vendorinfo->id, 1);
         $product->vendor_info = $vendorinfo;
     } else {
         $product->vendor_info = null;
     }
     if ($jshopConfig->admin_show_product_extra_field) {
         $product->extra_field = $product->getExtraFields();
     } else {
         $product->extra_field = null;
     }
     if ($jshopConfig->admin_show_freeattributes) {
         $product->getListFreeAttributes();
         foreach ($product->freeattributes as $k => $v) {
             if (!isset($back_value['freeattr'][$v->id])) {
                 $back_value['freeattr'][$v->id] = '';
             }
             $product->freeattributes[$k]->input_field = '<input type="text" class="inputbox" size="40" name="freeattribut[' . $v->id . ']" value="' . $back_value['freeattr'][$v->id] . '" />';
         }
         $attrrequire = $product->getRequireFreeAttribute();
         $product->freeattribrequire = count($attrrequire);
     } else {
         $product->freeattributes = null;
         $product->freeattribrequire = 0;
     }
     if ($jshopConfig->product_show_qty_stock) {
         $product->qty_in_stock = getDataProductQtyInStock($product);
     }
     if (!$jshopConfig->admin_show_product_labels) {
         $product->label_id = null;
     }
     if ($product->label_id) {
         $image = getNameImageLabel($product->label_id);
         if ($image) {
             $product->_label_image = $jshopConfig->image_labels_live_path . "/" . $image;
         }
         $product->_label_name = getNameImageLabel($product->label_id, 2);
     }
     $hide_buy = 0;
     if ($jshopConfig->user_as_catalog) {
         $hide_buy = 1;
     }
     if ($jshopConfig->hide_buy_not_avaible_stock && $product->product_quantity <= 0) {
         $hide_buy = 1;
     }
     $available = "";
     if ($product->getQty() <= 0 && $product->product_quantity > 0) {
         $available = _JSHOP_PRODUCT_NOT_AVAILABLE_THIS_OPTION;
     } elseif ($product->product_quantity <= 0) {
         $available = _JSHOP_PRODUCT_NOT_AVAILABLE;
     }
     $product->_display_price = getDisplayPriceForProduct($product->getPriceCalculate());
     if (!$product->_display_price) {
         $product->product_old_price = 0;
         $product->product_price_default = 0;
         $product->product_basic_price_show = 0;
         $product->product_is_add_price = 0;
         $product->product_tax = 0;
         $jshopConfig->show_plus_shipping_in_product = 0;
     }
     if (!$product->_display_price) {
         $hide_buy = 1;
     }
     $default_count_product = 1;
     if ($jshopConfig->min_count_order_one_product > 1) {
         $default_count_product = $jshopConfig->min_count_order_one_product;
     }
     if ($back_value['qty']) {
         $default_count_product = $back_value['qty'];
     }
     if (trim($product->description) == "") {
         $product->description = $product->short_description;
     }
     if ($jshopConfig->use_plugin_content) {
         changeDataUsePluginContent($product, "product");
     }
     $product->button_back_js_click = "history.go(-1);";
     if ($session->get('jshop_end_page_list_product') && $jshopConfig->product_button_back_use_end_list) {
         $product->button_back_js_click = "location.href='" . $session->get('jshop_end_page_list_product') . "';";
     }
     $displaybuttons = '';
     if ($jshopConfig->hide_buy_not_avaible_stock && $product->getQty() <= 0) {
         $displaybuttons = 'display:none;';
     }
     $product_images = $product->getImages();
     $product_videos = $product->getVideos();
     $product_demofiles = $product->getDemoFiles();
     $dispatcher->trigger('onBeforeDisplayProductList', array(&$product->product_related));
     $dispatcher->trigger('onBeforeDisplayProduct', array(&$product, &$view, &$product_images, &$product_videos, &$product_demofiles));
     $view->assign('config', $jshopConfig);
     $view->assign('image_path', $jshopConfig->live_path . '/images');
     $view->assign('noimage', $jshopConfig->noimage);
     $view->assign('image_product_path', $jshopConfig->image_product_live_path);
     $view->assign('video_product_path', $jshopConfig->video_product_live_path);
     $view->assign('video_image_preview_path', $jshopConfig->video_product_live_path);
     $view->assign('product', $product);
     $view->assign('category_id', $category_id);
     $view->assign('images', $product_images);
     $view->assign('videos', $product_videos);
     $view->assign('demofiles', $product_demofiles);
     $view->assign('attributes', $attributes);
     $view->assign('all_attr_values', $all_attr_values);
     $view->assign('related_prod', $product->product_related);
     $view->assign('path_to_image', $jshopConfig->live_path . 'images/');
     $view->assign('live_path', JURI::root());
     $view->assign('enable_wishlist', $jshopConfig->enable_wishlist);
     $view->assign('action', SEFLink('index.php?option=com_jshopping&controller=cart&task=add', 1));
     $view->assign('urlupdateprice', SEFLink('index.php?option=com_jshopping&controller=product&task=ajax_attrib_select_and_price&product_id=' . $product_id . '&ajax=1', 1, 1));
     if ($allow_review) {
         $context = "jshoping.list.front.product.review";
         $limit = $mainframe->getUserStateFromRequest($context . 'limit', 'limit', 20, 'int');
         $limitstart = JRequest::getInt('limitstart');
         $total = $product->getReviewsCount();
         $view->assign('reviews', $product->getReviews($limitstart, $limit));
         jimport('joomla.html.pagination');
         $pagination = new JPagination($total, $limitstart, $limit);
         $pagenav = $pagination->getPagesLinks();
         $view->assign('pagination', $pagenav);
         $view->assign('pagination_obj', $pagination);
         $view->assign('display_pagination', $pagenav != "");
     }
     $view->assign('allow_review', $allow_review);
     $view->assign('select_review', $select_review);
     $view->assign('text_review', $text_review);
     $view->assign('stars_count', floor($jshopConfig->max_mark / $jshopConfig->rating_starparts));
     $view->assign('parts_count', $jshopConfig->rating_starparts);
     $view->assign('user', $user);
     $view->assign('shippinginfo', SEFLink('index.php?option=com_jshopping&controller=content&task=view&page=shipping', 1));
     $view->assign('hide_buy', $hide_buy);
     $view->assign('available', $available);
     $view->assign('default_count_product', $default_count_product);
     $view->assign('folder_list_products', "list_products");
     $view->assign('back_value', $back_value);
     $view->assign('displaybuttons', $displaybuttons);
     $dispatcher->trigger('onBeforeDisplayProductView', array(&$view));
     $view->display();
     $dispatcher->trigger('onAfterDisplayProduct', array(&$product));
     if ($ajax) {
         die;
     }
 }
Exemplo n.º 25
0
        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;
        }
Exemplo n.º 26
0
 /**
  * Application full view
  **/
 public function appFullView()
 {
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_COMMUNITY_VIDEOS_WALL_TITLE'));
     $applicationName = JString::strtolower(JRequest::getVar('app', '', 'GET'));
     if (empty($applicationName)) {
         JError::raiseError(500, 'COM_COMMUNITY_APP_ID_REQUIRED');
     }
     $output = '';
     if ($applicationName == 'walls') {
         CFactory::load('libraries', 'wall');
         $limit = JRequest::getVar('limit', 5, 'REQUEST');
         $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
         $videoId = JRequest::getInt('videoid', '', 'GET');
         $my = CFactory::getUser();
         $config = CFactory::getConfig();
         $videoModel = CFactory::getModel('videos');
         $video =& JTable::getInstance('Video', 'CTable');
         $video->load($videoId);
         CFactory::load('helpers', 'owner');
         CFactory::load('helpers', 'friends');
         if (!$config->get('lockvideoswalls') || $config->get('lockvideoswalls') && CFriendsHelper::isConnected($my->id, $video->creator) || COwnerHelper::isCommunityAdmin()) {
             $viewAllLink = false;
             if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
                 $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls');
             }
             $output .= CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink);
         }
         // Get the walls content
         $output .= '<div id="wallContent">';
         $output .= CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || COwnerHelper::isMine($my->id, $video->creator), $limit, $limitstart);
         $output .= '</div>';
         jimport('joomla.html.pagination');
         $wallModel = CFactory::getModel('wall');
         $pagination = new JPagination($wallModel->getCount($video->id, 'videos'), $limitstart, $limit);
         $output .= '<div class="pagination-container">' . $pagination->getPagesLinks() . '</div>';
     } else {
         $model = CFactory::getModel('apps');
         $applications =& CAppPlugins::getInstance();
         $applicationId = $model->getUserApplicationId($applicationName);
         $application = $applications->get($applicationName, $applicationId);
         // Get the parameters
         $manifest = CPluginHelper::getPluginPath('community', $applicationName) . DS . $applicationName . DS . $applicationName . '.xml';
         $params = new CParameter($model->getUserAppParams($applicationId), $manifest);
         $application->params =& $params;
         $application->id = $applicationId;
         $output = $application->onAppDisplay($params);
     }
     echo $output;
 }
Exemplo n.º 27
0
 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();
 }
Exemplo n.º 28
0
 function getPage($total, $limit)
 {
     jimport('joomla.html.pagination');
     $limitstart =& JRequest::getVar('limitstart', 0);
     $pagination = new JPagination($total, $limitstart, $limit);
     return $pagination->getPagesLinks();
 }
Exemplo n.º 29
0
 /**
  * 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;
 }
Exemplo n.º 30
0
    function myproductslisting()
    {
        $user =& JFactory::getUser();
        $userid = $user->id;
        $usertype = $user->usertype;
        $db =& JFactory::getDBO();
        if ($usertype == 'Merchants' && $userid != 0) {
            ?>
			<script type="text/javascript" src="components/com_dealcatalog/js/jquery1.7.js"></script>
			<script type="text/javascript" src="components/com_dealcatalog/js/jquery.fancybox.js"></script>		
			<script type="text/javascript" src="components/com_dealcatalog/css/dealcatalog.css"></script>
			<link rel="stylesheet" type="text/css" href="components/com_dealcatalog/js/jquery.fancybox.css" media="screen" />
			<script type="text/javascript">
				$(document).ready(function() {
						$(".fancybox").fancybox();
					});
			</script>
			<?php 
            //Company name
            $query = "select company_name from #__deal_merchants where user_id='{$userid}'";
            $db->setQuery($query);
            $company = $db->loadRow();
            $company_name = $company[0];
            //Pagination
            global $mainframe;
            $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
            $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
            if ($_REQUEST['limitstart'] == '') {
                $limitstart = 0;
            }
            $query = "select a.product_name,a.product_image1,a.product_thumbimage1,b.id,b.product_id,b.vendor_id,b.stock_in,b.price,b.discount_price,b.listingstart_date,b.listingend_date,b.merchantproduct_image1,b.merchantproduct_thumbimage1,b.is_deal,b.deal_price,b.dealstart_date,b.dealend_date,c.company_name from #__deal_products as a,#__deal_productslisting_deals as b,#__deal_merchants as c where c.user_id='{$userid}' and a.id=b.product_id and b.vendor_id=c.id order by b.id desc";
            $db->setQuery($query);
            $total = $db->loadResultArray();
            $total = count($total);
            //Products
            jimport('joomla.html.pagination');
            $pageNav = new JPagination($total, $limitstart, $limit);
            $query = "select a.product_name,a.product_image1,a.product_thumbimage1,b.id,b.product_id,b.vendor_id,b.stock_in,b.price,b.discount_price,b.listingstart_date,b.listingend_date,b.merchantproduct_image1,b.merchantproduct_thumbimage1,b.is_deal,b.deal_price,b.dealstart_date,b.dealend_date,c.company_name from #__deal_products as a,#__deal_productslisting_deals as b,#__deal_merchants as c where c.user_id='{$userid}' and a.id=b.product_id and b.vendor_id=c.id order by b.id desc";
            $db->setQuery($query, $pageNav->limitstart, $pageNav->limit);
            $product_all = $db->loadObjectList();
            ?>
			<div id="merchant_layout">
				<div id="merchant_menu">
						<ul>
							<li> <a href="index.php?option=com_dealcatalog&task=merchantdefault&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > DashBoard </a> </li>
							<li> <a href="index.php?option=com_dealcatalog&task=products&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > Products </a> </li>
							<li> <a href="index.php?option=com_dealcatalog&task=addproductslistingdeals&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > Add Products Listing and Deals </a> </li>
							<li> <a href="index.php?option=com_dealcatalog&task=myproductslisting&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > My Products Usage</a> </li>
							<li> <a href="index.php?option=com_dealcatalog&task=coupons&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > My Customers Coupons </a> </li>
						</ul>
				</div>
				<div id="myusage">
					<div class="welcome">
							<?php 
            echo "Welcome back " . $company_name;
            ?>
					</div>
					<div class="lists">
						<h2> My Products Listing </h2>
						<div id="products_display">
							<div id="search_product">								
								<div class="cat_head"> Showing the Results for "<b> Products Listing and Deals </b>" </div>
								<div class="cat_title">
									<div class="product_count">Showing the <?php 
            echo $pageNav->getResultsCounter();
            ?>
 </div>								
								</div>
								<form method="post" name="myproductslisting" id="myproductslisting" action="<?php 
            echo $_SERVER['REQUEST_URI'];
            ?>
">
									<?php 
            $k = $limitstart;
            for ($i = 0, $n = count($product_all); $i < $n; $i++) {
                $row =& $product_all[$i];
                $productlist = $row->id;
                $product_id = $row->product_id;
                $vendor_id = $row->vendor_id;
                $product_name = $row->product_name;
                $price = $row->price;
                $company_name = $row->company_name;
                $discount_price = $row->discount_price;
                $listenddate = $row->listingend_date;
                $pimage = $row->product_image1;
                $pimage1 = $row->product_thumbimage1;
                $mimage = $row->merchantproduct_image1;
                $mimage1 = $row->merchantproduct_thumbimage1;
                $is_deal = $row->is_deal;
                $deal_price = $row->deal_price;
                $dealstartdate = $row->dealstart_date;
                $dealenddate = $row->dealend_date;
                //Product Image
                if ($mimage != '') {
                    $image = substr($mimage, 3);
                    $thumb_image = substr($mimage1, 3);
                } else {
                    $image = substr($pimage, 3);
                    $thumb_image = substr($pimage1, 3);
                }
                if ($i % 2 == 0) {
                    ?>
											<div class="product_odd">
												<div class="img_views">
													<a class="fancybox" href="<?php 
                    echo $image;
                    ?>
" title="<?php 
                    echo $product_name;
                    ?>
">
														<img src="<?php 
                    echo $thumb_image;
                    ?>
" />
													</a>
												</div>
												<div class="offer">
													<?php 
                    echo $product_name;
                    ?>
												</div>									
												<div class="offer_price"> 
													Price : <span class="deals"><?php 
                    echo $price;
                    ?>
 </span>
												</div>													
												<div class="offer_price"> 
													Discount Price : <span class="deals"><?php 
                    echo $discount_price;
                    ?>
 </span>
												</div>
												<div class="offer">
													Product Expires on <?php 
                    echo $listenddate;
                    ?>
												</div>	
												<?php 
                    if ($is_deal == 1) {
                        ?>
													<div class="offer_price"> 
														Deal Price : <span class="deals"><?php 
                        echo $deal_price;
                        ?>
 </span>
													</div>
													<div class="offer">
														Deal Expires on <?php 
                        echo $dealenddate;
                        ?>
													</div>
													<?php 
                    }
                    ?>
												
												<div class="details_more">
													<a href="index.php?option=com_dealcatalog&task=editproductlisting&productlist=<?php 
                    echo $productlist;
                    ?>
&Itemid=<?php 
                    echo $_REQUEST['Itemid'];
                    ?>
">  Edit </a>
												</div>
											</div>
										<?php 
                } else {
                    ?>
											<div class="product_even">												
												<div class="img_views">
													<a class="fancybox" href="<?php 
                    echo $image;
                    ?>
" title="<?php 
                    echo $product_name;
                    ?>
">
														<img src="<?php 
                    echo $thumb_image;
                    ?>
" />
													</a>
												</div>
												<div class="offer">
													<?php 
                    echo $product_name;
                    ?>
												</div>									
												<div class="offer_price"> 
													Price : <span class="deals"><?php 
                    echo $price;
                    ?>
 </span>
												</div>													
												<div class="offer_price"> 
													Discount Price : <span class="deals"><?php 
                    echo $discount_price;
                    ?>
 </span>
												</div>
												<div class="offer">
													Product Expires on <?php 
                    echo $listenddate;
                    ?>
												</div>	
												<?php 
                    if ($is_deal == 1) {
                        ?>
													<div class="offer_price"> 
														Deal Price : <span class="deals"><?php 
                        echo $deal_price;
                        ?>
 </span>
													</div>
													<div class="offer">
														Deal Expires on <?php 
                        echo $dealenddate;
                        ?>
													</div>
													<?php 
                    }
                    ?>
												
												<div class="details_more">
													<a href="index.php?option=com_dealcatalog&task=editproductlisting&productlist=<?php 
                    echo $productlist;
                    ?>
&Itemid=<?php 
                    echo $_REQUEST['Itemid'];
                    ?>
">  Edit </a>
												</div>
											</div>
										<?php 
                }
                $k++;
            }
            ?>
									<div class="pagi">
										<?php 
            echo $pageNav->getPagesLinks();
            ?>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
			<?php 
        } else {
            echo "<h1> You don't have the permission to access this page </h1>";
            echo "<p> Please <a href='index.php?option=com_dealcatalog&task=merchantregister&Itemid=" . $_REQUEST['Itemid'] . "'> Register </a> as a Merchant  </p>";
        }
    }