/** * 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 model id. * @throws CHttpException if the model is not found. * @return EmailMessage the model. */ protected function loadModel($id) { $model = EmailMessage::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('email', 'Page not found.')); } return $model; }
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); } }