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

/**
 * SiteController
 * 
 * @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 SearchController extends Controller
{
	
    public function actionGetCategory($id=null)
    {
	 
	  $subcategory = Subcategory::model()->ListDataForCategory($id);
	  $this->renderPartial(Yii::app()->LayoutClass->viewpath("_getCategory"),compact('subcategory'));
    }
    public function actionGetSearchFields($id=null)
    {
	 
	  $subcategory = Subcategory::model()->getSubCategoryOne($id);
	  $fields= array();
	  if($subcategory)
	  {
	  //echo $subcategory->change_parent_fields;exit;
	  $fields=  ($subcategory->change_parent_fields=="N") ? CHtml::listData($subcategory->category->relatedFields,'field_name','field_name'):CHtml::listData($subcategory->relatedFields,'field_name','field_name');
      }  
	  $this->renderPartial(Yii::app()->LayoutClass->viewpath("_getFields"),compact('fields','id'));
    }
    
     
 

}
