<?php defined('MW_PATH') || exit('No direct script access allowed');

/**
 * ArticleCategoriesWidget
 * 
 * @package MailWizz EMA
 * @author Serban George Cristian <cristian.serban@mailwizz.com> 
 * @link http://www.mailwizz.com/
 * @copyright 2013-2014 MailWizz EMA (http://www.mailwizz.com)
 * @license http://www.mailwizz.com/license/
 * @since 1.0
 */
 
class RelatedPropertiesWidget extends CWidget
{
    public $in_array;
    public $section_id;
     
    public function run()
    {
		    $showned_properties = $this->in_array; 
		    $title 				=  "Related Properties";
		     
		    if($this->section_id==PlaceAnAd::SALE_ID)
		    {
				$section 			=  PlaceAnAd::SALE_ID;
				$title 				=  "Related Properties"; ;
			}
			elseif($this->section_id==PlaceAnAd::RENT_ID)
			{
				$section 			=  PlaceAnAd::RENT_ID;
				$title 				=   "Related Properties"; ;
			}
			else
			{
				$section 			= 	"";
				$title 				=   "Latest Properties"; ;
			}
		     
		    $relatedAds = PlaceAnAd::model()->getRealtedAds($showned_properties,$section,$limit=5);
			$this->render('form',compact('relatedAds','title'));
    }
}
