Your IP : 216.73.216.54


Current Path : /var/www/html/components/com_jvld/models/
Upload File :
Current File : /var/www/html/components/com_jvld/models/mylinks.php

<?php
/**
 * @version		$Id$
 * @package		JV-LinkDirectory
 * @subpackage	com_jvld
 * @copyright	Copyright 2008-2013 JV-Extensions. All rights reserved
 * @license		GNU General Public License version 3 or later
 * @author		JV-Extensions
 * @link		http://www.jv-extensions.com
 */

// No direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.modellist');

class JvldModelMylinks extends JModelList
{
	protected function getListQuery()
	{
		$langcheckq = (_JVLD_JOOMLA_MLANG) ?  " and (L.language = '".JFactory::getLanguage()->getTag()."' or L.language = '*') " : "";
		$u_alevels = implode(',', JFactory::getUser()->getAuthorisedViewLevels());

		$sql = "select L.id from #__jvld_links as L, #__jvld_catlinks as CL, #__categories as JC
					where L.id = CL.lid
					and CL.isprimary = 1
					and CL.cid = JC.id".$langcheckq."
					and JC.access in (".$u_alevels.") 
					and L.access in (".$u_alevels.")
					and JC.published = 1 
					and L.uid = '".(int)JFactory::getUser()->get('id')."'
					order by L.link_status desc";

		return $sql;
	}

	public function getCurrentPageNumber()
	{
		if ($this->getLimit() == 0)
			return 0;

		return ($this->getStart()/$this->getLimit()) + 1;
	}

	public function getStart()
	{
		return $this->getState('list.start');
	}

	public function getLimit()
	{
		return $this->getState('list.limit');
	}

	protected function getStoreId($id = '')
	{
		return parent::getStoreId($id);
	}

	protected function populateState($ordering = null, $direction = null)
	{
		$app = JFactory::getApplication();

		$start_value = $app->input->get('limitstart', 0, 'int');
		$this->setState('list.start', $start_value);

		$limit_value = $app->input->get('limit', intval($app->get('list_limit', 0)), 'uint');
		$this->setState('list.limit', $limit_value);
	}
}