当前位置: 首页>>代码示例>>PHP>>正文


PHP Current::model方法代码示例

本文整理汇总了PHP中Current::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Current::model方法的具体用法?PHP Current::model怎么用?PHP Current::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Current的用法示例。


在下文中一共展示了Current::model方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionResults

 public function actionResults()
 {
     $student_id = Yii::app()->request->getQuery("student_id", NULL);
     $current = Current::model()->find('student_id=:student_id', array(':student_id' => $student_id));
     $all_sessions = Session::model()->findAll('mod_id=:mod_id', array(':mod_id' => $current->mod_id));
     $all = array();
     foreach ($all_sessions as $key0 => $session) {
         $session_id = $session->session_id;
         $session_listenings = SessionListening::model()->findAll('session_id=:session_id', array(':session_id' => $session_id));
         $all[$key0]["session_id"] = $session->session_id;
         $all[$key0]["session_name"] = $session->session_name;
         $all[$key0]["session_order"] = $session->session_order;
         $all[$key0]["mod_id"] = $session->mod_id;
         $all[$key0]["listenings"] = array();
         foreach ($session_listenings as $key => $session_listening) {
             $temp_listening_id = $session_listening->listening_id;
             $listening = Listening::model()->find('listening_id=:listening_id', array(':listening_id' => $temp_listening_id));
             $all[$key0]["listenings"][$key] = array('listening_id' => $listening->listening_id, 'listening_name' => $listening->listening_name, 'listening_repeat_number' => $listening->listening_repeat_number, 'listening_learning_guide_availability' => $listening->listening_learning_guide_availability);
             $criteria = new CDbCriteria();
             $criteria->addCondition("listening_id=:listening_id");
             //$criteria->order='RAND()';
             $criteria->params = array(':listening_id' => $listening->listening_id);
             $questions = Question::model()->findAll($criteria);
             //$questions=Question::model()->findAll('listening_id=:listening_id',array('listening_id'=>$listening->listening_id));
             foreach ($questions as $key2 => $question) {
                 $all[$key0]["listenings"][$key]['questions'][$key2] = array('question_id' => $question->question_id, 'question_body' => $question->question_body, 'question_correct_answer_id' => $question->question_correct_answer_id);
                 $criteria = new CDbCriteria();
                 $criteria->addCondition("question_id=:question_id");
                 //$criteria->order='RAND()';
                 $criteria->params = array(':question_id' => $question->question_id);
                 $answers = Answer::model()->findAll($criteria);
                 //$answers=Answer::model()->findAll('question_id=:question_id',array(':question_id'=>$question->question_id));
                 foreach ($answers as $key3 => $answer) {
                     $all[$key0]["listenings"][$key]['questions'][$key2]['answers'][$key3] = array('answer_id' => $answer->answer_id, 'answer_body' => $answer->answer_body);
                 }
             }
         }
     }
     $this->render('results', array('all' => $all, 'student_id' => $student_id));
 }
开发者ID:taskinegemen,项目名称:akdeniz_uni,代码行数:40,代码来源:ListController.php

示例2: actionPushLogin

 public function actionPushLogin()
 {
     $student_username = Yii::app()->request->getPost("student_username", NULL);
     $student_password = Yii::app()->request->getPost("student_password", NULL);
     $student = Student::model()->find('student_username=:student_username', array(':student_username' => $student_username));
     if ($student) {
         if ($student->student_password == hash('sha512', $student_password . Yii::app()->params['salt'])) {
             $current = Current::model()->find('student_id=:student_id', array('student_id' => $student->student_id));
             $mod = Mod::model()->find('mod_id=:mod_id', array('mod_id' => $current->mod_id));
             $response = array('student_id' => $student->student_id, 'student_username' => $student->student_username, 'student_name' => $student->student_name, 'student_surname' => $student->student_surname, 'mod_name' => $mod->mod_name);
             $this->renderJSON($response);
         } else {
             $this->renderJSON(array('status' => 0, 'message' => 'either username or password is not correct!'));
         }
     } else {
         $this->renderJSON(array('status' => 0, 'message' => 'there is no such a user registered!'));
     }
 }
开发者ID:taskinegemen,项目名称:akdeniz_uni,代码行数:18,代码来源:ApiController.php

示例3: loadModel

 /**
  * 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 Current the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Current::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:15,代码来源:CurrentController.php


注:本文中的Current::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。