public static function checkAdminOrSelf($id)
 {
     LoginForm::checkLogin();
     if (!(LoginForm::getUser()->isAdmin() || LoginForm::getUser()->id == $id)) {
         Yii::app()->getController()->redirect(array("site/index"));
     }
 }
 /**
  * Manages all models.
  */
 public function actionIndex()
 {
     LoginForm::checkLogin();
     $this->pageTitle = "Patients";
     $model = new Patient('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Patient'])) {
         $model->attributes = $_GET['Patient'];
     }
     $this->render('index', array('model' => $model));
 }
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     LoginForm::checkLogin();
     $this->pageTitle = "Family Planning Service Records";
     $model = new FamilyPlanningService('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['FamilyPlanningService'])) {
         $model->attributes = $_GET['FamilyPlanningService'];
         if (isset($_GET['FamilyPlanningService']['patient_family_name'])) {
             $model->patient_family_name = $_GET['FamilyPlanningService']['patient_family_name'];
         }
     }
     $this->render('index', array('model' => $model));
 }
 public function actionDeletedetails($id)
 {
     LoginForm::checkLogin();
     MaternalHealthDetails::model()->deleteByPk($id);
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
 public function actionLogout()
 {
     LoginForm::checkLogin();
     LoginForm::logout();
     $this->redirect('login');
 }
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     LoginForm::checkLogin();
     $this->pageTitle = "Child Health Records";
     $model = new ChildHealth('search');
     $model->unsetAttributes();
     if (isset($_GET['ChildHealth'])) {
         $model->attributes = $_GET['ChildHealth'];
         if (isset($_GET['ChildHealth']['patient_family_name'])) {
             $model->patient_family_name = $_GET['ChildHealth']['patient_family_name'];
         }
     }
     $this->render('index', array('model' => $model));
 }