Example #1
0
 public function actionDashboard()
 {
     if (!Yii::app()->user->isGuest) {
         if (Yii::app()->user->getState('parent_id')) {
             $this->redirect(array('parents/parent/studentprofile?id=' . Yii::app()->user->getState('stud_id')));
         }
         if (Yii::app()->user->getState('emp_id')) {
             $read = array();
             $unread = array();
             $read = EmployeeNotification::loadReadNotice();
             $count = count($read) + count($unread);
             $pages = new CPagination($count);
             $pages->pageSize = 10;
             $this->render('newdashboard', array('read' => $read, 'pages' => $pages));
         } else {
             if (Yii::app()->user->getState('stud_id')) {
                 $read = array();
                 $unread = array();
                 $read = StudentNotification::loadReadNotice();
                 $count = count($read) + count($unread);
                 $pages = new CPagination($count);
                 $pages->pageSize = 10;
                 $this->render('newdashboard', array('read' => $read, 'pages' => $pages));
             } else {
                 $this->render('newdashboard');
             }
         }
     } else {
         $this->redirect(array('login'));
     }
 }