예제 #1
0
 public function display($tpl = null)
 {
     $this->user = JFactory::getUser();
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->authors = $this->get('Authors');
     $this->params = JUDirectoryHelper::getParams();
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $levelOptions = array();
     $levelOptions[] = JHtml::_('select.option', 5, 5);
     $levelOptions[] = JHtml::_('select.option', 10, 10);
     $levelOptions[] = JHtml::_('select.option', 15, 15);
     $levelOptions[] = JHtml::_('select.option', 20, 20);
     $levelOptions[] = JHtml::_('select.option', 25, 25);
     $levelOptions[] = JHtml::_('select.option', 30, 30);
     $this->levelOptions = $levelOptions;
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $app = JFactory::getApplication();
     $this->function = $app->input->get('function', 'jSelectListing');
     $this->totalListings = $this->get('Total');
     $this->_prepareDocument();
     parent::display($tpl);
 }
예제 #2
0
 public function display($tpl = null)
 {
     $this->model = $this->getModel();
     $this->state = $this->get('State');
     $this->params = $this->state->params;
     $this->tag = $this->get('Tag');
     if (!is_object($this->tag)) {
         JError::raiseError(404, JText::_('COM_JUDIRECTORY_TAG_NOT_FOUND'));
         return false;
     }
     $user = JFactory::getUser();
     $uri = JUri::getInstance();
     $this->items = $this->get('Items');
     foreach ($this->items as $item) {
         $item->report_link = JRoute::_(JUDirectoryHelperRoute::getReportListingRoute($item->id));
         $item->claim_link = JRoute::_(JUDirectoryHelperRoute::getClaimListingRoute($item->id));
         if ($item->checked_out > 0 && $item->checked_out != $user->get('id')) {
             if (JUDirectoryFrontHelperPermission::canCheckInListing($item->id)) {
                 $item->checkin_link = JRoute::_('index.php?option=com_judirectory&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)));
             }
         } else {
             $item->edit_link = JRoute::_('index.php?option=com_judirectory&task=form.edit&id=' . $item->id . '&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             if ($item->published == 1) {
                 $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             } else {
                 $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             }
         }
         $item->delete_link = JRoute::_('index.php?option=com_judirectory&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('content');
         $item->event = new stdClass();
         $context = 'com_judirectory.listing_list';
         $results = $dispatcher->trigger('onContentAfterTitle', array($context, &$this->item, &$this->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array($context, &$this->item, &$this->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array($context, &$this->item, &$this->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
     }
     $this->pagination = $this->get('Pagination');
     $this->token = JSession::getFormToken();
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->show_feed = JUDIRPROVERSION ? $this->params->get('rss_display_icon', 1) : 0;
     $rssLink = JRoute::_(JUDirectoryHelperRoute::getTagRoute($this->tag->id, false, true));
     $this->rss_link = JRoute::_($rssLink, false);
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareData();
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
예제 #3
0
 public function display($tpl = null)
 {
     $this->params = JUDirectoryHelper::getParams();
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     if (!$this->params->get('activate_maintenance', 0)) {
         $app = JFactory::getApplication();
         $app->redirect(JUri::root());
     }
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
예제 #4
0
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->_prepareDocument();
     if (JUDirectoryHelper::isJoomla3x()) {
         $this->filterForm = $this->get('FilterForm');
         $this->activeFilters = $this->get('ActiveFilters');
     }
     parent::display($tpl);
 }
예제 #5
0
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->state = $this->get('State');
     $this->pagination = $this->get('Pagination');
     $this->params = JUDirectoryHelper::getParams();
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->listOrder = $this->escape($this->state->get('list.ordering', 'tag.title'));
     $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
     $this->order_name_array = array('tag.id' => JText::_('COM_JUDIRECTORY_FIELD_ID'), 'tag.title' => JText::_('COM_JUDIRECTORY_FIELD_TITLE'), 'tag.created' => JText::_('COM_JUDIRECTORY_FIELD_CREATED'), 'tag.ordering' => JText::_('COM_JUDIRECTORY_FIELD_ORDERING'));
     $this->order_dir_array = array('ASC' => JText::_('COM_JUDIRECTORY_ASC'), 'DESC' => JText::_('COM_JUDIRECTORY_DESC'));
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
예제 #6
0
 public function display($tpl = null)
 {
     $this->items = $this->get('Items');
     $this->params = JUDirectoryHelper::getParams();
     $this->state = $this->get('State');
     $this->pagination = $this->get('Pagination');
     $this->root_comment = JUDirectoryFrontHelperComment::getRootComment();
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->order_name_array = array('cm.title' => JText::_('COM_JUDIRECTORY_FIELD_TITLE'), 'cm.created' => JText::_('COM_JUDIRECTORY_FIELD_CREATED'), 'r.score' => JText::_('COM_JUDIRECTORY_FIELD_RATING_SCORE'), 'cm.helpful_votes' => JText::_('COM_JUDIRECTORY_FIELD_HELPFUL_VOTES'), 'cm.total_votes' => JText::_('COM_JUDIRECTORY_FIELD_TOTAL_VOTES'));
     $this->order_dir_array = array('ASC' => JText::_('COM_JUDIRECTORY_ASC'), 'DESC' => JText::_('COM_JUDIRECTORY_DESC'));
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
예제 #7
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $categoryId = $app->input->getInt('id', 1);
     $this->category = JUDirectoryFrontHelperCategory::getCategory($categoryId);
     $error = array();
     if (!JUDirectoryFrontHelperPermission::canDoCategory($this->category->id, true, $error)) {
         $user = JFactory::getUser();
         if ($user->id) {
             return JError::raiseError($error['code'], $error['message']);
         } else {
             $uri = JUri::getInstance();
             $loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false);
             $app = JFactory::getApplication();
             $app->redirect($loginUrl, JText::_('COM_JUDIRECTORY_YOU_ARE_NOT_AUTHORIZED_TO_ACCESS_THIS_PAGE'), 'warning');
             return false;
         }
     }
     $model = $this->getModel();
     $this->model = $model;
     $this->state = $this->get('State');
     $this->params = $this->state->params;
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->parent_id = $this->category->id;
     $this->subcategory_level = (int) $this->params->get('all_categories_subcategory_level', -1);
     $this->all_categories = $model->getCategoriesRecursive($this->category->id, $this->subcategory_level);
     $firstCategory = $this->all_categories[0];
     $this->category->total_childs = $firstCategory->total_childs;
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
예제 #8
0
 public function display($tpl = null)
 {
     $this->item = $this->get('Item');
     if (!JUDirectoryFrontHelperPermission::canViewListing($this->item->id)) {
         $user = JFactory::getUser();
         if ($user->id) {
             return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
         } else {
             $uri = JUri::getInstance();
             $loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false);
             $app = JFactory::getApplication();
             $app->redirect($loginUrl, JText::_('COM_JUDIRECTORY_YOU_ARE_NOT_AUTHORIZED_TO_ACCESS_THIS_PAGE'), 'warning');
             return false;
         }
     }
     $app = JFactory::getApplication();
     $this->user = JFactory::getUser();
     $this->print = $app->input->getBool('print', false);
     $this->model = $this->getModel();
     $this->state = $this->get('State');
     $this->params = $this->state->get('params');
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $limitStart = $app->input->getUint('limitstart', 0);
     $config = JFactory::getConfig();
     $cookie_domain = $config->get('cookie_domain', '');
     $cookie_path = $config->get('cookie_path', '/');
     if (isset($_COOKIE['judir_recently_viewed_listings'])) {
         $recently_viewed_listing_array = explode(',', $_COOKIE['judir_recently_viewed_listings']);
         $recently_viewed_listing_array = array_unique($recently_viewed_listing_array);
         $key = array_search($this->item->id, $recently_viewed_listing_array);
         if ($key !== false) {
             unset($recently_viewed_listing_array[$key]);
         } else {
             if ($limitStart == 0) {
                 $this->model->updateHits($this->item->id);
             }
         }
         $maxListings = $this->params->get('max_recently_viewed_listings', 12);
         if (count($recently_viewed_listing_array) >= $maxListings) {
             $recently_viewed_listing_array = array_slice($recently_viewed_listing_array, 0, $maxListings - 1);
         }
         array_unshift($recently_viewed_listing_array, $this->item->id);
         $recently_viewed_listing_array = implode(',', $recently_viewed_listing_array);
         setcookie('judir_recently_viewed_listings', $recently_viewed_listing_array, time() + 3600 * 24 * 15, $cookie_path, $cookie_domain);
     } else {
         if ($limitStart == 0) {
             $this->model->updateHits($this->item->id);
         }
         setcookie('judir_recently_viewed_listings', $this->item->id, time() + 3600 * 24 * 15, $cookie_path, $cookie_domain);
     }
     $topLevelCats = JUDirectoryHelper::getCatsByLevel(1, $this->item->cat_id);
     if ($topLevelCats) {
         $this->tl_catid = $topLevelCats[0]->id;
     }
     $this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx'));
     $this->item->class_sfx = htmlspecialchars($this->item->class_sfx);
     $this->collection_popup = false;
     if (JUDIRPROVERSION && $this->user->id > 0) {
         $this->collection_popup = true;
         $this->collections = $this->model->getCollectionPopup($this->item->id);
     }
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('content');
     $this->item->event = new stdClass();
     $context = 'com_judirectory.listing';
     $results = $dispatcher->trigger('onContentAfterTitle', array($context, &$this->item, &$this->item->params, $limitStart));
     $this->item->event->afterDisplayTitle = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentBeforeDisplay', array($context, &$this->item, &$this->item->params, $limitStart));
     $this->item->event->beforeDisplayContent = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onContentAfterDisplay', array($context, &$this->item, &$this->item->params, $limitStart));
     $this->item->event->afterDisplayContent = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onBeforeDisplayJUDIRComment', array($context, &$this->item, &$this->item->params, $limitStart));
     $this->item->event->beforeDisplayJUDIRComment = trim(implode("\n", $results));
     $results = $dispatcher->trigger('onAfterDisplayJUDIRComment', array($context, &$this->item, &$this->item->params, $limitStart));
     $this->item->event->afterDisplayJUDIRComment = trim(implode("\n", $results));
     $this->_prepareData();
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
예제 #9
0
 public function display($tpl = null)
 {
     $model = $this->getModel();
     $this->model = $model;
     $this->state = $this->get('State');
     $params = $this->state->params;
     $this->params = $params;
     $this->token = JSession::getFormToken();
     $this->root_category = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryId = $this->state->get('category.id', $this->root_category->id);
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $error = array();
     if (!JUDirectoryFrontHelperPermission::canDoCategory($categoryId, true, $error)) {
         $user = JFactory::getUser();
         if ($user->id) {
             return JError::raiseError($error['code'], $error['message']);
         } else {
             $uri = JUri::getInstance();
             $loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false);
             $app = JFactory::getApplication();
             $app->redirect($loginUrl, JText::_('COM_JUDIRECTORY_YOU_ARE_NOT_AUTHORIZED_TO_ACCESS_THIS_PAGE'), 'warning');
             return false;
         }
     }
     $topLevelCats = JUDirectoryHelper::getCatsByLevel(1, $categoryId);
     if (is_array($topLevelCats) && count($topLevelCats) > 0) {
         $this->tl_catid = $topLevelCats[0]->id;
     }
     $this->category = JUDirectoryFrontHelperCategory::getCategory($categoryId);
     $this->show_feed = JUDIRPROVERSION ? $this->params->get('rss_display_icon', 1) : 0;
     $this->rss_link = JRoute::_(JUDirectoryHelperRoute::getCategoryRoute($this->category->id, null, true));
     if (isset($this->category->images) && !empty($this->category->images) && !empty($this->category->images->detail_image)) {
         $this->category->images->detail_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judirectory/images/category/detail/', true) . $this->category->images->detail_image;
     }
     $this->category->images->detail_image_width = (int) $this->params->get('category_image_width', 200);
     $this->category->images->detail_image_height = (int) $this->params->get('category_image_height', 200);
     if ($this->params->get('category_show_description', 1)) {
         $this->category->description = $this->category->introtext . $this->category->fulltext;
     } else {
         $this->category->description = $this->category->fulltext;
     }
     $categoryDescLimit = (int) $this->params->get('category_desc_limit', 0);
     if ($categoryDescLimit > 0) {
         $this->category->description = JUDirectoryFrontHelperString::truncateHtml($this->category->description, $categoryDescLimit);
     }
     if ($this->params->get('plugin_support', 0)) {
         $this->category->description = JHtml::_('content.prepare', $this->category->description, '', 'com_judirectory.category');
     }
     $this->category->class_sfx = htmlspecialchars($this->category->class_sfx);
     $relatedCatOrdering = $this->params->get('related_category_ordering', 'crel.ordering');
     $relatedCatDirection = $this->params->get('related_category_direction', 'ASC');
     $this->related_cats = $model->getRelatedCategories($this->category->id, $relatedCatOrdering, $relatedCatDirection);
     if (is_array($this->related_cats) && count($this->related_cats) > 0) {
         foreach ($this->related_cats as $relatedCategory) {
             if (isset($relatedCategory->images->intro_image) && !empty($relatedCategory->images->intro_image)) {
                 $relatedCategory->images->intro_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/', true) . $relatedCategory->images->intro_image;
             }
             $relatedCategory->images->intro_image_width = (int) $this->params->get('related_category_intro_image_width', 200);
             $relatedCategory->images->intro_image_height = (int) $this->params->get('related_category_intro_image_height', 200);
             if ($this->params->get('related_category_show_introtext', 1)) {
                 $relatedCategoryDescLimit = (int) $this->params->get('related_category_introtext_character_limit', 500);
                 if ($relatedCategoryDescLimit > 0) {
                     $relatedCategory->introtext = JUDirectoryFrontHelperString::truncateHtml($relatedCategory->introtext, $relatedCategoryDescLimit);
                 }
                 if ($params->get('plugin_support', 0)) {
                     $relatedCategory->introtext = JHtml::_('content.prepare', $relatedCategory->introtext, '', 'com_judirectory.category');
                 }
             } else {
                 $relatedCategory->introtext = '';
             }
         }
     }
     $subCatOrdering = $this->params->get('subcategory_ordering', 'title');
     $subCatDirection = $this->params->get('subcategory_direction', 'ASC');
     $this->subcategories = $model->getSubCategories($this->category->id, $subCatOrdering, $subCatDirection);
     if (is_array($this->subcategories) && count($this->subcategories) > 0) {
         foreach ($this->subcategories as $subCategory) {
             if (isset($subCategory->images->intro_image) && !empty($subCategory->images->intro_image)) {
                 $subCategory->images->intro_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/', true) . $subCategory->images->intro_image;
             }
             $subCategory->images->intro_image_width = (int) $this->params->get('subcategory_intro_image_width', 200);
             $subCategory->images->intro_image_height = (int) $this->params->get('subcategory_intro_image_height', 200);
             if ($this->params->get('subcategory_show_introtext', 1)) {
                 $subCategoryDescLimit = (int) $this->params->get('subcategory_introtext_character_limit', 500);
                 if ($subCategoryDescLimit > 0) {
                     $subCategory->introtext = JUDirectoryFrontHelperString::truncateHtml($subCategory->introtext, $subCategoryDescLimit);
                 }
                 if ($this->params->get('plugin_support', 0)) {
                     $subCategory->introtext = JHtml::_('content.prepare', $subCategory->introtext, '', 'com_judirectory.category');
                 }
             } else {
                 $subCategory->introtext = '';
             }
         }
     }
     $this->category->can_submit_listing = JUDirectoryFrontHelperPermission::canSubmitListing($this->category->id);
     if ($this->category->can_submit_listing && $this->params->get('show_submit_listing_btn_in_category', 1)) {
         $this->category->submit_listing_link = JUDirectoryFrontHelperListing::getAddListingLink($this->category->id);
     }
     $this->items = array();
     if ($this->category->show_item) {
         $user = JFactory::getUser();
         $uri = JUri::getInstance();
         $this->items = $this->get('Items');
         foreach ($this->items as $item) {
             $item->report_link = JRoute::_(JUDirectoryHelperRoute::getReportListingRoute($item->id));
             $item->claim_link = JRoute::_(JUDirectoryHelperRoute::getClaimListingRoute($item->id));
             if ($item->checked_out > 0 && $item->checked_out != $user->get('id')) {
                 if (JUDirectoryFrontHelperPermission::canCheckInListing($item->id)) {
                     $item->checkin_link = JRoute::_('index.php?option=com_judirectory&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)));
                 }
             } else {
                 $item->edit_link = JRoute::_('index.php?option=com_judirectory&task=form.edit&id=' . $item->id . '&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 if ($item->published == 1) {
                     $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 } else {
                     $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 }
             }
             $item->delete_link = JRoute::_('index.php?option=com_judirectory&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $item->event = new stdClass();
             $context = 'com_judirectory.listing_list';
             $results = $dispatcher->trigger('onContentAfterTitle', array($context, &$item, &$item->params, 0));
             $item->event->afterDisplayTitle = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentBeforeDisplay', array($context, &$item, &$item->params, 0));
             $item->event->beforeDisplayContent = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentAfterDisplay', array($context, &$item, &$item->params, 0));
             $item->event->afterDisplayContent = trim(implode("\n", $results));
         }
         $this->pagination = $this->get('Pagination');
         //print_r($this->pagination);
     }
     $this->locations = JUDirectoryFrontHelper::getLocations($this->items);
     //print_r($this->locations);
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareData();
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }