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


PHP Exercise::model方法代码示例

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


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

示例1: checkCode

 public function checkCode()
 {
     Helpers::normalizeCode($this->code);
     if (!($this->exercise = Exercise::model()->findByAttributes(array('code' => trim($this->code))))) {
         $this->addError('code', Yii::t('swu', 'The code you entered does not exist.'));
     }
 }
开发者ID:loristissino,项目名称:swu,代码行数:7,代码来源:ExerciseInfoForm.php

示例2: sendCodes

 public function sendCodes($controller)
 {
     if (!($student = Student::model()->findByAttributes(array('email' => $this->email)))) {
         return false;
     }
     $exercises = Exercise::model()->with('assignment')->sortByDuedate()->findAllByAttributes(array('student_id' => $student->id));
     foreach ($exercises as $exercise) {
         $exercise->link = Yii::app()->controller->createAbsoluteSslUrl('exercise/info', array('k' => $exercise->generateAckKey()));
     }
     $options = array();
     if (Helpers::getYiiParam('addOriginatingIP')) {
         $options['originating_IP'] = sprintf('[%s]', Yii::app()->request->userHostAddress);
     }
     return MailTemplate::model()->mailFromTemplate('send_codes', array($student->email => $student->name), array('student' => $student, 'exercises' => $exercises), $options);
 }
开发者ID:loristissino,项目名称:swu,代码行数:15,代码来源:SendcodesForm.php

示例3: checkCode

 public function checkCode()
 {
     if ($this->getError('verifyCode')) {
         return;
         // we don't provide any information about the code if the captcha is not valid
     }
     Helpers::normalizeCode($this->code);
     if ($this->exercise = Exercise::model()->findByAttributes(array('code' => trim($this->code)))) {
         if (!$this->byteacher and $this->exercise->duedate < date('Y-m-d H:m:s', time() - $this->exercise->assignment->grace * 24 * 60 * 60)) {
             $this->addError('code', Yii::t('swu', 'The code provided is not valid anymore (time expired on %date%).', array('%date%' => $this->exercise->duedate)));
             return;
         }
     } elseif ($this->code) {
         $this->addError('code', Yii::t('swu', 'The code provided is not valid.'));
         return;
     }
 }
开发者ID:loristissino,项目名称:swu,代码行数:17,代码来源:UploadForm.php

示例4: removeExercises

 public function removeExercises($ids)
 {
     $result = array('removed' => array(), 'left' => array());
     $exercises = Exercise::model()->ofAssignment($this->id)->forStudents($ids)->with('files')->findAll();
     foreach ($exercises as $exercise) {
         $id = $exercise->id;
         if ($exercise && sizeof($exercise->files) > 0) {
             $result['left'][] = $id;
             continue;
             // we won't delete exercises when files are uploaded
         }
         try {
             $exercise->delete();
             $result['removed'][] = $id;
         } catch (Exception $e) {
             $result['left'][] = $id;
             // this should never happen
         }
     }
     return $result;
 }
开发者ID:loristissino,项目名称:swu,代码行数:21,代码来源:Assignment.php

示例5: loadModelByCode

 public function loadModelByCode($code)
 {
     return $model = Exercise::model()->findByAttributes(array('code' => $code));
 }
开发者ID:loristissino,项目名称:swu,代码行数:4,代码来源:ExerciseController.php

示例6: getExercises

 public function getExercises()
 {
     return Exercise::model()->forStudent($this->id)->with('assignment')->findAll();
 }
开发者ID:loristissino,项目名称:swu,代码行数:4,代码来源:Student.php


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