public function actionSendmail() { $models = DataKerja::find()->where(['status' => 1])->all(); $messages = []; foreach ($models as $model) { $programmer = strtoupper($model->programmer); $marketing = strtoupper($model->marketing); $judul = strtoupper($model->judul); $reminder = explode(',', $model->reminder_email); foreach ($reminder as $mail) { $messages[] = Yii::$app->mailer->compose()->setSubject($marketing . ' dan ' . $programmer . ' Ingat ' . $judul)->setHtmlBody('Hai ' . $marketing . ' dan ' . $programmer . ' Ini adalah pesan pengingat dari job <b>' . $judul . '</b>, untuk menonaktifkannya silakan login pada panel kerja dan ubah status menjadi tidak aktif. <br><br><br> <b>JOB : </b> ' . $judul . '<br> <b>STATUS : </b> ' . $model->status_pekerjaan . '<br> <b>TIPE : </b> ' . $model->tipe . ' <br><br> SELAMAT BEKERJA !!!')->setTo($mail); } } if (Yii::$app->mailer->sendMultiple($messages)) { echo "sukses send mail"; } else { echo "Failed send mail"; } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = DataKerja::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['status' => SORT_DESC, 'modified_at' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'modified_at' => $this->modified_at]); $query->andFilterWhere(['like', 'judul', $this->judul])->andFilterWhere(['like', 'tipe', $this->tipe])->andFilterWhere(['like', 'klien', $this->klien])->andFilterWhere(['like', 'marketing', $this->marketing])->andFilterWhere(['like', 'programmer', $this->programmer])->andFilterWhere(['like', 'reminder_email', $this->reminder_email])->andFilterWhere(['like', 'informasi', $this->informasi]); return $dataProvider; }
/* @var $this yii\web\View */ /* @var $model app\modules\kerja\models\DataKerja */ $this->title = $model->id; $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Data Kerjas'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="data-kerja-view"> <?php echo $this->render('_menu'); ?> <!--<h1><?php echo Html::encode($this->title); ?> </h1>--> <p> <?php echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['judul', 'tipe', 'klien', 'marketing', 'programmer', 'reminder_email:email', 'status_pekerjaan', ['attribute' => 'informasi', 'format' => 'raw'], ['attribute' => 'status', 'format' => 'raw', 'value' => DataKerja::data_status($model)], 'created_at', 'modified_at']]); ?> </div>
/** * Finds the DataKerja model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return DataKerja the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = DataKerja::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
// "searchreplace visualblocks code fullscreen", // "insertdatetime media table contextmenu paste" // ], // 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" // ] // ]); ?> <?php echo $form->field($model, 'informasi')->widget(CKEditor::className(), ['editorOptions' => ElFinder::ckeditorOptions(['elfinder', 'path' => 'some/sub/path'], ['preset' => Yii::$app->devicedetect->isMobile() ? 'basic' : 'full', 'skin' => 'office2013'])]); ?> <?php echo $form->field($model, 'status')->dropDownList(DataKerja::status(), ['maxlength' => true]); ?> <?php //= $form->field($model, 'created_at')->textInput() ?> <?php //= $form->field($model, 'modified_at')->textInput() ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
use yii\helpers\Html; use app\modules\kerja\models\DataKerja; //use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel app\modules\kerja\models\search\DataKerjaSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Data Kerjas'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="data-kerja-index"> <?php echo $this->render('_menu'); ?> <!--<h1><?php echo Html::encode($this->title); ?> </h1>--> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo DynaGrid::widget(['options' => ['id' => Yii::$app->controller->id . "-" . Yii::$app->controller->action->id . "-" . Yii::$app->user->identity->id], 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel], 'columns' => [['attribute' => 'status', 'format' => 'raw', 'filter' => DataKerja::status(), 'value' => function ($data) { return DataKerja::data_status($data); }, 'visible' => true], ['attribute' => 'judul', 'visible' => true], ['attribute' => 'status_pekerjaan', 'visible' => true], ['attribute' => 'marketing', 'visible' => true], ['attribute' => 'programmer', 'visible' => true], ['attribute' => 'tipe', 'visible' => true], ['attribute' => 'klien', 'visible' => true], ['attribute' => 'reminder_email', 'visible' => true], ['attribute' => 'created_at', 'visible' => false], ['attribute' => 'modified_at', 'visible' => false], ['class' => 'kartik\\grid\\ActionColumn']]]); ?> </div>