コード例 #1
0
	protected function populateState($ordering = null, $direction = null)
	{
		
		$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search', '');
		$this->setState('filter.search', $search);

		$featured = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured', '');
		$this->setState('filter.featured', $featured);

		$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_catid', '');
		$this->setState('filter.catid', $categoryId);

		$license = $this->getUserStateFromRequest($this->context . '.filter.license', 'filter_licenseid', '');
		$this->setState('filter.licenseid', $license);

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

		
		parent::populateState('d.title', 'asc');

		$field_display = $this->getUserStateFromRequest($this->context . '.field_display', 'field_display', array());
		$this->setState('field_display', $field_display);
	}
コード例 #2
0
ファイル: documents.php プロジェクト: kosmosby/medicine-prof
	public function __construct($config = array())
	{
		if (empty($config['filter_fields']))
		{
			$config['filter_fields'] = array(
				'd.id',
				'd.title',
				'c.title',
				'l.title',
				'd.created_by',
				'd.created',
				'catid',
				'licenseid',
				'access',
				'published',
				'featured'
			);
		}

		parent::__construct($config);
	}
コード例 #3
0
ファイル: tags.php プロジェクト: kosmosby/medicine-prof
	public function getItems()
	{
		$items = parent::getItems();
		if (is_array($items) && !empty($items))
		{
			foreach ($items AS $item)
			{
				$item->total_documents = (int) $this->getTotalDocumentsAssignTag($item->id);
			}
		}

		return $items;
	}
コード例 #4
0
ファイル: document.php プロジェクト: kosmosby/medicine-prof
	public function getItems()
	{
		$user       = JFactory::getUser();
		$token      = JSession::getFormToken();
		$items      = parent::getItems();
		$documentId = (int) $this->getState('document.id');
		$params     = $this->getState('params');
		if (count($items) > 0)
		{
			$commentsRecursive = array();
			foreach ($items AS $item)
			{
				$commentsRecursive[] = $item;
				$commentsRecursive   = array_merge($commentsRecursive, $this->getCommentRecursive($item->id));
			}

			$items = $commentsRecursive;
		}

		foreach ($items AS $item)
		{
			$item->comment_edit = $item->comment;
			$item->comment      = JUDownloadFrontHelper::BBCode2Html($item->comment);
			$item->comment      = JUDownloadFrontHelperComment::parseCommentText($item->comment, $documentId);

			
			$item->can_reply     = JUDownloadFrontHelperPermission::canReplyComment($documentId, $item->id);
			$item->can_vote      = JUDownloadFrontHelperPermission::canVoteComment($documentId, $item->id);
			$item->can_report    = JUDownloadFrontHelperPermission::canReportComment($documentId, $item->id);
			$item->can_subscribe = false;
			$item->can_edit      = false;
			$item->can_delete    = false;
			$isOwnerComment      = JUDownloadFrontHelperPermission::isCommentOwner($item->id);
			if ($isOwnerComment)
			{
				$item->can_edit    = JUDownloadFrontHelperPermission::canEditComment($item->id);
				$item->can_delete  = JUDownloadFrontHelperPermission::canDeleteComment($item->id);
				$item->link_delete = JRoute::_('index.php?option=com_judownload&task=document.deleteComment&comment_id=' . $item->id . '&' . $token . '=1');

				if ($params->get('can_subscribe_own_comment', 1))
				{
					$item->can_subscribe = true;
					if ($this->isSubscriber($user->id, $item->id, 'comment'))
					{
						$item->is_subscriber = true;
						$secret              = JFactory::getConfig()->get('secret');
						$type                = 'comment';
						$code                = md5($user->id . $user->email . $type . $secret);

						$subscriptionObject = JUDownloadFrontHelper::getSubscriptionObjectByType($user->id, $item->id, $type);

						$item->subscribe_link = JRoute::_('index.php?option=com_judownload&task=subscribe.remove&sub_id=' . (int) $subscriptionObject->id .
							'&code=' . $code . '&' . $token . '=1');

					}
					else
					{
						$item->is_subscriber  = false;
						$item->subscribe_link = JRoute::_('index.php?option=com_judownload&task=subscribe.save' .
							'&comment_id=' . $item->id . '&' . $token . '=1');
					}
				}
			}

			$item->voted_value = $this->getCommentVotedValue($item->id);
		}

		return $items;
	}
コード例 #5
0
	public function getItems()
	{
		$params = $this->getState('params');

		if ($params->get('top_comments_limit', 100))
		{
			$commentObjectList = array_slice($this->getTopDocumentsLimit(), $this->getStart(), $this->getState('list.limit'));
		}
		else
		{
			$commentObjectList = parent::getItems();
		}

		return $commentObjectList;
	}
コード例 #6
0
ファイル: tag.php プロジェクト: kosmosby/medicine-prof
	public function getItems()
	{
		$params             = $this->getState('params');
		$documentObjectList = parent::getItems();

		JUDownloadFrontHelper::appendDataToDocumentObjList($documentObjectList, $params);

		return $documentObjectList;
	}
コード例 #7
0
ファイル: search.php プロジェクト: kosmosby/medicine-prof
	public function getItems()
	{
		$app              = JFactory::getApplication();
		$searchword       = $app->input->getString('searchword', '');
		$params           = $this->getState('params');
		$minSearchWord    = $params->get('searchword_min_length', 3);
		$maxSearchWord    = $params->get('searchword_max_length', 30);
		$searchwordLength = strlen($searchword);
		if (!$searchwordLength || ($minSearchWord > 0 && $searchwordLength < $minSearchWord) || ($maxSearchWord > 0 && $searchwordLength > $maxSearchWord))
		{
			if ($searchwordLength > 0)
			{
				$app->enqueueMessage(JText::sprintf("COM_JUDOWNLOAD_SEARCH_TERM_MUST_BE_A_MINIMUM_OF_X_CHARACTERS_AND_MAXIMUM_OF_X_CHARACTER", $minSearchWord, $maxSearchWord));
			}

			return array();
		}
		else
		{
			$documentObjectList = parent::getItems();
			JUDownloadFrontHelper::appendDataToDocumentObjList($documentObjectList, $params);

			return $documentObjectList;
		}
	}