Beispiel #1
0
	public function display($tpl = null)
	{
		$this->items      = $this->get('Items');
		$this->state      = $this->get('State');
		$this->pagination = $this->get('Pagination');
		$this->params     = JUDownloadHelper::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_JUDOWNLOAD_FIELD_ID'),
			'tag.title'    => JText::_('COM_JUDOWNLOAD_FIELD_TITLE'),
			'tag.created'  => JText::_('COM_JUDOWNLOAD_FIELD_CREATED'),
			'tag.ordering' => JText::_('COM_JUDOWNLOAD_FIELD_ORDERING')
		);

		$this->order_dir_array = array('ASC'  => JText::_('COM_JUDOWNLOAD_ASC'),
		                               'DESC' => JText::_('COM_JUDOWNLOAD_DESC'));

		$this->_prepareDocument();
		$this->_setBreadcrumb();

		parent::display($tpl);
	}
Beispiel #2
0
	public function display($tpl = null)
	{
		$this->params = JUDownloadHelper::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);
	}
Beispiel #3
0
	public function display($tpl = null)
	{
		
		if (count($errors = $this->get('Errors')))
		{
			JError::raiseError(500, implode("\n", $errors));

			return false;
		}

		$this->_prepareDocument();

		$this->_setBreadcrumb();

		$this->params = JUDownloadHelper::getParams();

		parent::display($tpl);
	}
Beispiel #4
0
	public function display($tpl = null)
	{
		$app        = JFactory::getApplication();
		$licenseId  = $app->input->getInt('id', 0);
		$this->item = JUDownloadFrontHelper::getLicense($licenseId);
		if (!is_object($this->item))
		{
			return JError::raiseError(403, JText::_('COM_JUDOWNLOAD_LICENSE_NOT_FOUND'));
		}

		$this->params = JUDownloadHelper::getParams();

		
		if (count($errors = $this->get('Errors')))
		{
			JError::raiseError(500, implode("\n", $errors));

			return false;
		}

		$limitStart = $app->input->getUint('limitstart', 0);

		$dispatcher = JDispatcher::getInstance();
		JPluginHelper::importPlugin('content');
		$this->item->event = new stdClass();
		$context           = 'com_judownload.license';

		$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));

		$this->_prepareDocument();

		$this->_setBreadcrumb();

		
		parent::display($tpl);
	}
Beispiel #5
0
	public function display($tpl = null)
	{
		$this->state      = $this->get('State');
		$this->items      = $this->get('Items');
		$this->pagination = $this->get('Pagination');
		$this->params     = JUDownloadHelper::getParams();
		
		if (count($errors = $this->get('Errors')))
		{
			JError::raiseError(500, implode("\n", $errors));

			return false;
		}

		$this->_prepareDocument();

		

		parent::display($tpl);
	}
Beispiel #6
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     = JUDownloadHelper::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', 'jSelectDocument');
		
		$this->totalDocs = $this->get('Total');

		$this->_prepareDocument();

		
		parent::display($tpl);
	}
Beispiel #7
0
	public function display($tpl = null)
	{
		$this->items        = $this->get('Items');
		$this->params       = JUDownloadHelper::getParams();
		$this->state        = $this->get('State');
		$this->pagination   = $this->get('Pagination');
		$this->root_comment = JUDownloadFrontHelperComment::getRootComment();

		
		if (count($errors = $this->get('Errors')))
		{
			JError::raiseError(500, implode("\n", $errors));

			return false;
		}

		
		$this->order_name_array = array(
			'cm.title'         => JText::_('COM_JUDOWNLOAD_FIELD_TITLE'),
			'cm.created'       => JText::_('COM_JUDOWNLOAD_FIELD_CREATED'),
			'r.score'          => JText::_('COM_JUDOWNLOAD_FIELD_RATING_SCORE'),
			'cm.helpful_votes' => JText::_('COM_JUDOWNLOAD_FIELD_HELPFUL_VOTES'),
			'cm.total_votes'   => JText::_('COM_JUDOWNLOAD_FIELD_TOTAL_VOTES'));

		$this->order_dir_array = array(
			'ASC'  => JText::_('COM_JUDOWNLOAD_ASC'),
			'DESC' => JText::_('COM_JUDOWNLOAD_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);
	}
Beispiel #8
0
	public function display($tpl = null)
	{
		
		$this->state  = $this->get('State');
		$this->token  = JSession::getFormToken();
		$this->params = $this->state->params;

		
		$app = JFactory::getApplication();

		$submit_simple_search = $app->input->getString('submit_simple_search', '');
		if (isset($submit_simple_search) && $submit_simple_search == "search")
		{
			$model = $this->getModel();
			$model->resetState();
		}
		$this->model = $this->getModel();
		$user        = JFactory::getUser();
		$uri         = JUri::getInstance();
		$this->items = $this->get('Items');
		foreach ($this->items as $item)
		{
			$item->report_link = JRoute::_(JUDownloadHelperRoute::getReportDocumentRoute($item->id));

			
			if ($item->checked_out > 0 && $item->checked_out != $user->get('id'))
			{
				if (JUDownloadFrontHelperPermission::canCheckInDocument($item->id))
				{
					$item->checkin_link = JRoute::_('index.php?option=com_judownload&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)));
				}
			}
			else
			{
				$item->edit_link = JRoute::_('index.php?option=com_judownload&task=form.edit&id=' . $item->id . '&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));

				if ($item->published == 1)
				{
					$item->editstate_link = JRoute::_('index.php?option=com_judownload&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));
				}
				else
				{
					$item->editstate_link = JRoute::_('index.php?option=com_judownload&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));
				}
			}

			$item->delete_link = JRoute::_('index.php?option=com_judownload&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));

			$dispatcher = JDispatcher::getInstance();
			JPluginHelper::importPlugin('content');
			$item->event = new stdClass();
			$context     = 'com_judownload.document_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');
		$this->searchword = trim($app->input->getString('searchword', ''));

		
		$this->searchword = JUDownloadFrontHelper::UrlDecode($this->searchword);

		$this->cat_id  = $app->input->getInt('cat_id', 0);
		$this->sub_cat = $app->input->getInt('sub_cat', 0);

		
		if (count($errors = $this->get('Errors')))
		{
			JError::raiseError(500, implode("\n", $errors));

			return false;
		}

		$nestedCategories = JUDownloadFrontHelperCategory::getCategoriesRecursive(1, false, false, true);
		$options          = array();

		$parent_cat_level = 0;
		foreach ($nestedCategories AS $key => $categoryObj)
		{
			if ($key == 0)
			{
				$parent_cat_level = $categoryObj->level;
			}
			$options[] = JHtml::_('select.option', $categoryObj->id, str_repeat('-.', ($categoryObj->level - $parent_cat_level)) . $categoryObj->title);
		}
		$this->cat_select_list = JHtml::_('select.genericList', $options, 'cat_id', '', 'value', 'text', $this->cat_id);

		
		$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));

		$this->_prepareData();
		$this->_prepareDocument();
		$this->_setBreadcrumb();

		parent::display($tpl);
	}
Beispiel #9
0
	public function display($tpl = null)
	{
		$this->item = $this->get('Item');

		
		if (!JUDownloadFrontHelperPermission::canViewDocument($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_JUDOWNLOAD_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['judl_recently_viewed_documents']))
		{
			$recently_viewed_doc_array = explode(',', $_COOKIE['judl_recently_viewed_documents']);
			$recently_viewed_doc_array = array_unique($recently_viewed_doc_array);
			$key                       = array_search($this->item->id, $recently_viewed_doc_array);
			if ($key !== false)
			{
				unset($recently_viewed_doc_array[$key]);
			}
			else
			{
				
				if ($limitStart == 0)
				{
					$this->model->updateHits($this->item->id);
				}
			}

			$maxDocuments = $this->params->get('max_recently_viewed_documents', 12);
			if (count($recently_viewed_doc_array) >= $maxDocuments)
			{
				$recently_viewed_doc_array = array_slice($recently_viewed_doc_array, 0, $maxDocuments - 1);
			}
			array_unshift($recently_viewed_doc_array, $this->item->id);
			$recently_viewed_doc_array = implode(',', $recently_viewed_doc_array);
			setcookie('judl_recently_viewed_documents', $recently_viewed_doc_array, time() + (3600 * 24 * 15), $cookie_path, $cookie_domain);
		}
		else
		{
			
			if ($limitStart == 0)
			{
				$this->model->updateHits($this->item->id);
			}

			setcookie('judl_recently_viewed_documents', $this->item->id, time() + (3600 * 24 * 15), $cookie_path, $cookie_domain);
		}

		
		$topLevelCats = JUDownloadHelper::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 (JUDLPROVERSION && $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_judownload.document';

		$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('onBeforeDisplayJUDLComment', array($context, &$this->item, &$this->item->params, $limitStart));
		$this->item->event->beforeDisplayJUDLComment = trim(implode("\n", $results));

		$results                                    = $dispatcher->trigger('onAfterDisplayJUDLComment', array($context, &$this->item, &$this->item->params, $limitStart));
		$this->item->event->afterDisplayJUDLComment = trim(implode("\n", $results));

		$this->_prepareData();
		$this->_prepareDocument();

		$this->_setBreadcrumb();

		parent::display($tpl);
	}
Beispiel #10
0
	public function display($tpl = null)
	{
		$app        = JFactory::getApplication();
		$categoryId = $app->input->getInt('id', 1);

		
		$this->category = JUDownloadFrontHelperCategory::getCategory($categoryId);

		
		$error = array();
		if (!JUDownloadFrontHelperPermission::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_JUDOWNLOAD_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);
	}
Beispiel #11
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 = JUDownloadFrontHelperCategory::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 (!JUDownloadFrontHelperPermission::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_JUDOWNLOAD_YOU_ARE_NOT_AUTHORIZED_TO_ACCESS_THIS_PAGE'), 'warning');

				return false;
			}
		}

		
		$topLevelCats = JUDownloadHelper::getCatsByLevel(1, $categoryId);
		if (is_array($topLevelCats) && count($topLevelCats) > 0)
		{
			$this->tl_catid = $topLevelCats[0]->id;
		}

		
		$this->category = JUDownloadFrontHelperCategory::getCategory($categoryId);

		
		$this->show_feed = JUDLPROVERSION ? $this->params->get('rss_display_icon', 1) : 0;
		$this->rss_link  = JRoute::_(JUDownloadHelperRoute::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) . '/' . JUDownloadFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judownload/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 = JUDownloadFrontHelperString::truncateHtml($this->category->description, $categoryDescLimit);
		}

		
		if ($this->params->get('plugin_support', 0))
		{
			$this->category->description = JHtml::_('content.prepare', $this->category->description, '', 'com_judownload.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) . '/' . JUDownloadFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judownload/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 = JUDownloadFrontHelperString::truncateHtml($relatedCategory->introtext, $relatedCategoryDescLimit);
					}

					if ($params->get('plugin_support', 0))
					{
						$relatedCategory->introtext = JHtml::_('content.prepare', $relatedCategory->introtext, '', 'com_judownload.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) . '/' . JUDownloadFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judownload/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 = JUDownloadFrontHelperString::truncateHtml($subCategory->introtext, $subCategoryDescLimit);
					}
					if ($this->params->get('plugin_support', 0))
					{
						$subCategory->introtext = JHtml::_('content.prepare', $subCategory->introtext, '', 'com_judownload.category');
					}
				}
				else
				{
					$subCategory->introtext = '';
				}
			}
		}

		$this->category->can_submit_doc = JUDownloadFrontHelperPermission::canSubmitDocument($this->category->id);
		if ($this->category->can_submit_doc && $this->params->get('show_submit_document_btn_in_category', 1))
		{
			$this->category->submit_doc_link = JUDownloadFrontHelperDocument::getAddDocumentLink($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)
			{
				$documentItemid = JUDownloadHelperRoute::findItemIdOfDocument($item->id);

				$item->report_link = JRoute::_(JUDownloadHelperRoute::getReportDocumentRoute($item->id));

				
				if ($item->checked_out > 0 && $item->checked_out != $user->get('id'))
				{
					if (JUDownloadFrontHelperPermission::canCheckInDocument($item->id))
					{
						$item->checkin_link = JRoute::_('index.php?option=com_judownload&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)));
					}
				}
				else
				{
					$item->edit_link = JRoute::_('index.php?option=com_judownload&task=form.edit&id=' . $item->id . '&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));

					if ($item->published == 1)
					{
						$item->editstate_link = JRoute::_('index.php?option=com_judownload&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));
					}
					else
					{
						$item->editstate_link = JRoute::_('index.php?option=com_judownload&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));
					}
				}

				$item->delete_link = JRoute::_('index.php?option=com_judownload&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));

				$dispatcher = JDispatcher::getInstance();
				JPluginHelper::importPlugin('content');
				$item->event = new stdClass();
				$context     = 'com_judownload.document_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');
		}

		
		$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));

		
		$this->_prepareData();

		$this->_prepareDocument();

		$this->_setBreadcrumb();

		parent::display($tpl);
	}
Beispiel #12
0
	public function display($tpl = null)
	{
		$this->model  = $this->getModel();
		$this->state  = $this->get('State');
		$this->params = $this->state->get('params');
		$user         = JFactory::getUser();
		$uri          = JUri::getInstance();
		$this->items  = $this->get('Items');
		foreach ($this->items as $item)
		{
			$item->report_link = JRoute::_(JUDownloadHelperRoute::getReportDocumentRoute($item->id));

			
			if ($item->checked_out > 0 && $item->checked_out != $user->get('id'))
			{
				if (JUDownloadFrontHelperPermission::canCheckInDocument($item->id))
				{
					$item->checkin_link = JRoute::_('index.php?option=com_judownload&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)));
				}
			}
			else
			{
				$item->edit_link = JRoute::_('index.php?option=com_judownload&task=form.edit&id=' . $item->id . '&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));

				if ($item->published == 1)
				{
					$item->editstate_link = JRoute::_('index.php?option=com_judownload&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));
				}
				else
				{
					$item->editstate_link = JRoute::_('index.php?option=com_judownload&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));
				}
			}

			$item->delete_link = JRoute::_('index.php?option=com_judownload&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDownloadHelperRoute::findItemIdOfDocument($item->id));

			$dispatcher = JDispatcher::getInstance();
			JPluginHelper::importPlugin('content');
			$item->event = new stdClass();
			$context     = 'com_judownload.document_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 = JUDLPROVERSION ? $this->params->get('rss_display_icon', 1) : 0;

		$app                  = JFactory::getApplication();
		$rootCategory         = JUDownloadFrontHelperCategory::getRootCategory();
		$this->categoryId     = $app->input->getInt('id', $rootCategory->id);
		$this->fetchAllSubCat = $app->input->getInt('all', 0);

		$rssLink        = JRoute::_(JUDownloadHelperRoute::getFeaturedRoute($this->categoryId, $this->fetchAllSubCat, 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);
	}