Preview: Controlleruser.php
                Size: 2.63 KB
              
              
                
              
            
            /home/jambtst2015/public_html/protected/components/Controlleruser.php
            <?php
/**
 * Controller is the customized base controller class.
 * All controller classes for this application should extend from this base class.
 */
class Controlleruser extends CController
{
	/**
	 * @var string the default layout for the controller view. Defaults to '//layouts/column1',
	 * meaning using a single column layout. See 'protected/views/layouts/column1.php'.
	 */
	public $layout='//layouts/column1';
	/**
	 * @var array context menu items. This property will be assigned to {@link CMenu::items}.
	 */
	public $menu=array();
	/**
	 * @var array the breadcrumbs of the current page. The value of this property will
	 * be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
	 * for more details on how to specify this property.
	 */
	public $breadcrumbs=array();
	
	public function beforeAction($e){
	  $isUser = Yii::app()->user->getState("isUser");
	  $action = $this->action->Id;
	  $getId = Helpers::getrecord('Examuser','id',Yii::app()->user->getState('member_session_id'),'id');
	  //echo '<pre>';
//	  print_r($getId);
//	  exit;
	  if($getId=='' && $isUser!=''){
		  $this->redirect(Yii::app()->createUrl('home/logoutbody/'));
		  return false;
	  }elseif($isUser=='' && $action!='index' && $getId!=''){
		  //exit('1');
		  $this->redirect(Yii::app()->user->returnUrl);
		  return false;
	  }else{
		  //exit('2');
		  return true;
	  }
    }
	
	/*public function beforeAction($e){
	  $isUser = Yii::app()->user->getState("isUser");
	  $isPinid = Yii::app()->user->getState("isPinid");
	  $action = $this->action->Id;
	  //exit;
	  if($isUser=='' && $action=='examination' && $isPinid==''){
		  //exit('4');
		  //$this->redirect(Yii::app()->user->returnUrl.'user/userprofile');
	  	  return true;
	  }elseif($isUser=='' && $action=='user_login' && $isPinid==''){
		  //exit('4');
		  //$this->redirect(Yii::app()->user->returnUrl.'user/userprofile');
	  	  return true;
	  }elseif($isUser=='' && $action!='index' && $isPinid==''){
		  //exit('1');
		  $this->redirect(Yii::app()->user->returnUrl);
		  return false;
	  }elseif($isUser!='' && $action=='newuserreg' && $isPinid==''){
		  //exit('2');
		  $this->redirect(Yii::app()->user->returnUrl.'user/userprofile');
	  	  return true;
	  }elseif($isUser!='' && $action=='subjectselect' && $isPinid==''){
		  //exit('3');
		  $this->redirect(Yii::app()->user->returnUrl.'user/userprofile');
	  	  return true;
	  }else{
		  //exit('5');
	  	  return true;
	  }
    }*/
	public function loginCheck(){
		$loginID = Yii::app()->user->getState('exam_user_id');
		if($loginID!=''){
			 $this->redirect(Yii::app()->user->returnUrl);
			 return false;
		}else{
			return true;
		}
	}
}
                                          Directory Contents
Dirs: 0 × Files: 12