<?php

/**
 * @name          : Joomla Social Pinboard
 * @version	  : 1.5.0
 * @package       : apptha
 * @since         : Joomla 1.5
 * @author        : Apptha - http://www.apptha.com
 * @copyright     : Copyright (C) 2011 Powered by Apptha
 * @license       : http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
 * @abstract      : Social Pinboard Component home model
 * @Creation Date : March 2013
 * @Modified Date : March 2013
 * */
// No direct Access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.model');
jimport('joomla.user.helper');

class wishlogueModelwwya extends JModelList {

    function getwwya() {
        $db = JFactory::getDBO();
		$nullDate = $db->quote($db->getNullDate());
		$date = JFactory::getDate();
		$nowDate = $db->quote($date->toSql());

		if ( JRequest::getVar('id', 0) > 0 ) {
			$expectId = JRequest::getVar('id');
		} else {
			$expectId = 0;
		}

		$query = 'SELECT a.id, a.title, a.fulltext, a.introtext, a.created_by, b.name 
					FROM #__content a 
					INNER JOIN #__users b 
					WHERE a.id = ' . $expectId . ' AND b.id = a.created_by AND a.featured = 1 AND a.state = 1 
					AND (a.publish_up = ' . $nullDate . ' OR a.publish_up <= ' . $nowDate . ') 
					AND (a.publish_down = ' . $nullDate . ' OR a.publish_down >= ' . $nowDate . ') ';
		$db->setQuery($query);
        $wwya = $db->loadObject();
        return $wwya;
    }
}

?>