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


PHP Note::model方法代码示例

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


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

示例1: actionNote

 /**
  * 列出某个课程下的所有笔记
  * Enter description here ...
  * @param unknown_type $courseId
  */
 public function actionNote($courseId)
 {
     $courseId = intval($courseId);
     $course = Course::model()->findByPk($courseId);
     $sql = "select n.*,l.id as lessonId from ew_course c inner join ew_lesson l on c.id=l.courseId inner join ew_note n on n.noteableEntityId=l.entityId where c.id={$courseId}";
     $notes = Note::model()->findAllBySql($sql);
     $dataProvider = new CArrayDataProvider($notes);
     $this->render('my_notes', array('dataProvider' => $dataProvider, 'course' => $course));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:14,代码来源:MeController.php

示例2: actionBatchDelete

 /**
  * Deletes notes in batch mode.
  */
 public function actionBatchDelete()
 {
     if (isset($_POST['deleteNote'])) {
         foreach ($_POST['deleteNote'] as $id => $value) {
             $model = Note::model()->findByPk($id);
             $model->delete();
             unlink(Yii::app()->params['notesDir'] . $model->id . '.' . $model->extension);
         }
         Yii::app()->user->setNotification('success', 'Berkas-berkas berhasil dihapus.');
     }
     $this->redirect(array('index'));
 }
开发者ID:ekospinach,项目名称:berkuliah,代码行数:15,代码来源:HomeController.php

示例3: init

 public function init()
 {
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenATaskIsCompleted()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByTask');
         Task::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Task'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenANoteIsCreated()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByNote');
         Note::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Note'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenAnEmailIsSentOrArchived()) {
         $eventHandler = array($this, 'updateContactLatestActivityDateTimeByEmailMessage');
         EmailMessage::model()->attachEventHandler('onAfterSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['EmailMessage'] = array('onAfterSave', $eventHandler);
     }
     if (ContactsModule::shouldUpdateLatestActivityDateTimeWhenAMeetingIsInThePast()) {
         $eventHandler = array($this, 'resolveModelLatestActivityDateTimeProcessFlagByMeeting');
         Meeting::model()->attachEventHandler('onBeforeSave', $eventHandler);
         $this->attachedEventHandlersIndexedByModelClassName['Meeting'] = array('onBeforeSave', $eventHandler);
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:23,代码来源:ContactLatestActivityDateTimeObserver.php

示例4: getNoteCount

 /**
  * 获取反对票数量
  */
 public function getNoteCount()
 {
     return Note::model()->count("noteableEntityId=:entityId and value<=0", array(':entityId' => $this->getOwner()->entityId));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:7,代码来源:NoteableBehavior.php

示例5: saveNoteTypeIds

 public function saveNoteTypeIds($noteIds = [], $noteTypeId)
 {
     if (!$noteTypeId) {
         throw new CHttpException(404, "Note type is not found");
     }
     $r = Note::model()->updateAll(['not_row' => $noteTypeId], "not_id in (" . implode(",", $noteIds) . ")");
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:7,代码来源:Note.php

示例6: saveClient

 private function saveClient(Client $model)
 {
     $this->prepareModel($model);
     if (isset($_POST['Client']) && $_POST['Client']) {
         $_POST['Client']['propertyTypesIds'] = isset($_POST['Client']['propertyTypesIds']) ? $_POST['Client']['propertyTypesIds'] : [];
         $_POST['Client']['propertyCategoryIds'] = isset($_POST['Client']['propertyCategoryIds']) ? $_POST['Client']['propertyCategoryIds'] : [];
         $model->attributes = $_POST['Client'];
         if ($model->isNewRecord) {
             $model->scenario = 'validPhoneOnInsert';
         }
         $generalNoteIds = isset($_POST['noteId-' . Note::TYPE_CLIENT_GENERAL]) ? $_POST['noteId-' . Note::TYPE_CLIENT_GENERAL] : [];
         $generalNote = isset($_POST[Note::TYPE_CLIENT_GENERAL]) ? $_POST[Note::TYPE_CLIENT_GENERAL] : [];
         $reqNoteIds = isset($_POST['noteId-' . Note::TYPE_CLIENT_REQ]) ? $_POST['noteId-' . Note::TYPE_CLIENT_REQ] : [];
         $reqNote = isset($_POST[Note::TYPE_CLIENT_REQ]) ? $_POST[Note::TYPE_CLIENT_REQ] : [];
         $telephones = isset($_POST['telephones']) ? $_POST['telephones'] : [];
         $existingPhones = Telephone::model()->findAllByPk(array_filter($telephones['id']), ['index' => 'tel_id']);
         if (isset($telephones['number'][0]) && $telephones['number'][0]) {
             $phone = new Telephone();
             $phone->tel_number = $telephones['number'][0];
             $phone->tel_type = $telephones['type'][0];
             $model->_newPhones = [$phone];
         }
         $model->addressID = isset($_POST['primaryAddress']['id']) ? $_POST['primaryAddress']['id'] : 0;
         $model->secondAddressID = isset($_POST['secondAddress']['id']) ? $_POST['secondAddress']['id'] : 0;
         if ($model->save()) {
             /** @var $existingPhones Telephone */
             foreach ($telephones['number'] as $key => $number) {
                 $phoneId = $telephones['id'][$key];
                 $type = $telephones['type'][$key];
                 if (isset($existingPhones[$phoneId])) {
                     $phone = $existingPhones[$phoneId];
                 } else {
                     $phone = new Telephone();
                 }
                 if ($number) {
                     $phone->tel_cli = $model->cli_id;
                     $phone->tel_number = $number;
                     $phone->tel_type = $type;
                     $phone->save();
                 } else {
                     if (!$phone->isNewRecord) {
                         $phone->delete();
                     }
                 }
             }
             $model->saveAreas(isset($_POST['Client']['matchingPostcode']) ? $_POST['Client']['matchingPostcode'] : []);
             $model->saveFeatures(isset($_POST['Client']['feature']) ? $_POST['Client']['feature'] : []);
             if ($generalNoteIds) {
                 Note::model()->saveNoteTypeIds($generalNoteIds, $model->cli_id);
             }
             if ($reqNoteIds) {
                 Note::model()->saveNoteTypeIds($reqNoteIds, $model->cli_id);
             }
             if ($generalNote) {
                 $generalNote['not_type'] = Note::TYPE_CLIENT_GENERAL;
                 Note::model()->saveNote($generalNote, $model->cli_id);
             }
             if ($reqNote) {
                 $reqNote['not_type'] = Note::TYPE_CLIENT_REQ;
                 Note::model()->saveNote($reqNote, $model->cli_id);
             }
             if (isset($_POST['Client']['saveProceed']) && $_POST['Client']['saveProceed']) {
                 $this->redirect([$this->createUrl('appointmentBuilder/clientSelected', ['clientId' => $model->cli_id])]);
             } else {
                 Yii::app()->user->setFlash('client-update-success', 'Updated Successfully');
                 $this->redirect(array('Update', 'id' => $model->cli_id, 'useClient' => isset($_GET['useClient']) && $_GET['useClient'] ? 1 : 0));
             }
         }
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:70,代码来源:ClientController.php

示例7: actionSaveNoteBlurb

 public function actionSaveNoteBlurb()
 {
     if (!isset($_POST['noteId'], $_POST['noteBlurb'])) {
         throw new CHttpException(400, 'Wrong request');
     }
     if ($_POST['noteId']) {
         $model = Note::model()->findByPk($_POST['noteId']);
         if (!$model) {
             throw new CHttpException(400, 'Wrong request');
         }
     } elseif (isset($_POST['noteType'], $_POST['noteTypeId'])) {
         $model = new Note();
         $model->not_type = $_POST['noteType'];
         $model->not_row = $_POST['noteTypeId'];
     } else {
         throw new CHttpException(400, 'Wrong request');
     }
     $model->not_blurb = $_POST['noteBlurb'];
     $model->save();
     echo $model->not_id;
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:21,代码来源:NoteController.php

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

示例9: saveNote

 /**
  * @param $data
  * @param $noteType
  * @param $instruction
  */
 private function saveNote($data, $noteType, $instruction)
 {
     if (!isset($data[$noteType]['not_blurb']) || !$data[$noteType]['not_blurb']) {
         return;
     }
     $model = new Note();
     if (isset($data[$noteType]['not_id']) && $data[$noteType]['not_id']) {
         $model = Note::model()->findByPk($data[$noteType]['not_id']);
     }
     $model->not_blurb = $data[$noteType]['not_blurb'];
     $model->not_row = $instruction->dea_id;
     $model->not_type = $noteType;
     if (!$model->save()) {
         Yii::app()->user->setFlash('error', 'note [type = ' . $noteType . '] is not saved.');
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:21,代码来源:InstructionController.php

示例10: testUpdateInvalid

 /**
  * Tests the note update action with invalid input.
  */
 public function testUpdateInvalid()
 {
     $model = $this->notes('note3');
     // Empty title
     $fakeNote = Note::model()->findByPk($model->id);
     $fakeNote->title = null;
     $this->assertFalse($fakeNote->validate());
     // Lengthy title
     $fakeNote = Note::model()->findByPk($model->id);
     Yii::import('ext.randomness.*');
     $fakeNote->title = Randomness::randomString(Note::MAX_TITLE_LENGTH + 1);
     $this->assertFalse($fakeNote->validate());
     // Empty description
     $fakeNote = Note::model()->findByPk($model->id);
     $fakeNote->description = null;
     $this->assertFalse($fakeNote->validate());
 }
开发者ID:ekospinach,项目名称:berkuliah,代码行数:20,代码来源:NoteTest.php

示例11: loadModel

 /**
  * Loads the note model.
  * @param  int $id the note id
  * @return Note the note object associated with the given id
  */
 public function loadModel($id)
 {
     $model = Note::model()->findByPk($id);
     if ($model === NULL) {
         throw new CHttpException(404, 'Berkas catatan yang dimaksud tidak ada.');
     }
     return $model;
 }
开发者ID:ekospinach,项目名称:berkuliah,代码行数:13,代码来源:NoteController.php


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