Ejemplo n.º 1
0
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = TestOption::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 2
0
 public static function getOptionValueByName($optionName)
 {
     $optionInfo = TestOption::model()->findByAttributes(array('option_name' => $optionName));
     if ($optionInfo !== null) {
         return $optionInfo['option_value'];
     } else {
         return '';
     }
 }
Ejemplo n.º 3
0
 public static function isSystemAdmin($userId)
 {
     $userInfo = TestUser::model()->findByPk($userId);
     $systemAdminStr = TestOption::model()->findByAttributes(array('option_name' => TestOption::SYSTEM_ADMIN));
     $systemAdminArr = array();
     if ($systemAdminStr !== null && !empty($systemAdminStr['option_value'])) {
         $systemAdminArr = CommonService::splitStringToArray(",", $systemAdminStr['option_value']);
     }
     if (in_array($userInfo['username'], $systemAdminArr)) {
         return CommonService::$TrueFalseStatus['TRUE'];
     } else {
         return CommonService::$TrueFalseStatus['FALSE'];
     }
 }