Example #1
0
    /**
     * Index action
     * @param string $tab
     */
    public function actionIndex($tab = 'cl_adm_change')
    {
        //get users to approve
        $usersToApprove = UsersToApprove::model()->with('user')->findAllByAttributes(array(
            'Approved_By_Admin' => UsersToApprove::NOT_APPR_BY_ADMIN,
        ));

        if ($_SESSION['admin_active_tab']) {
            $tab = $_SESSION['admin_active_tab'];
        }
        //get clients list
        $clientsList = Clients::model()->getClientsList();

        //get service level settings
        $serviceLevelSettings = ServiceLevelSettings::model()->findAll();

        //get service requests for support
        $support_requests = SupportRequests::model()->findAllByAttributes(array(
           'Problem_Status'=>'W'
        ));


        $auto_loaded_tabs = $this->generateTabsForAutoLoad(); //array of views and additional variables



        $this->render('index' , array(
            'tab' => $tab,
            'usersToApprove' => $usersToApprove,
            'support_requests'=>$support_requests,
            'clientsList' => $clientsList,
            'serviceLevelSettings' => $serviceLevelSettings,
            'auto_loaded_tabs'=>$auto_loaded_tabs
        ));
    }
	/**
	 * Returns the data model based on the primary key given in the GET variable.
	 * If the data model is not found, an HTTP exception will be raised.
	 * @param integer $id the ID of the model to be loaded
	 * @return SupportRequests the loaded model
	 * @throws CHttpException
	 */
	public function loadModel($id)
	{
		$model=SupportRequests::model()->findByPk($id);
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}