/** * This action will trigger every 15 minute * @return avoid */ public function actionIndex() { // send message $mschedules = MessageSchedule::find()->all(); $this->_run($mschedules); // send checklist $cschedules = ChecklistSchedule::find()->all(); $this->_run($cschedules); }
<?php use app\models\ChecklistSchedule; ?> <table class="table table-striped table-vcenter"> <tbody> <?php $cschedules = ChecklistSchedule::find()->where(['checklists_id' => $checklists_id])->orderBy('id DESC')->all(); if (!empty($cschedules)) { foreach ($cschedules as $key => $cschedules) { ?> <tr> <td> <small data-toggle="tooltip" data-original-title="Client"><span class="label label-default"><i class="fa fa-fw fa-user"></i></span></small> <small data-toggle="tooltip" data-original-title="Active"><span class="label label-default"><i class="fa fa-fw fa-bell"></i></span></small> <?php echo $cschedules->subject; ?> </td> <td class="text-right" style="width:140px;"> <a data-toggle="modal" href="#modal-schedules-checklist-view" class="btn btn-xs btn-default btn-view-cschedules" data-to="/cschedules/view/<?php echo $cschedules->id; ?> " data-update="#checklist-view"><i class="fa fa-eye"></i>View</a> <a data-toggle="modal" href="#modal-schedules-checklist-edit" class="btn btn-xs btn-default btn-edit-cschedules" data-to="/cschedules/edit/<?php echo $cschedules->id; ?> " data-load="/cschedules/load/<?php echo $cschedules->id; ?> " data-update="#mschedule-form"><i class="fa fa-pencil"></i> Edit</a>
/** * Finds the MessageSchedule model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MessageSchedule the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ChecklistSchedule::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * establish relation with Cschedule model * @return mix */ public function getCschedule() { return $this->hasMany(ChecklistSchedule::className(), ['checklists_id' => 'id']); }