public function actionGetCodeTitles() { //$items = ['some', 'array', 'of', 'values' => ['associative', 'array']]; \Yii::$app->response->format = 'json'; $items = \app\models\CalendarCodeTitles::find()->asArray()->all(); return $items; }
public static function getBodyText($calenderEvent, $companyOntvanger, $companyAanbieder, $contractdeal) { //afhankelijk van de gebruikte code_title wordt een bepaalde email verzonden $model = EmailMessages::findOne(['code_title' => $calenderEvent->code_title]); self::$CONTACTPERSOONAANBIEDER = $companyAanbieder->profile->full_name; self::$FNAAMAANBIEDER = $companyAanbieder->name; self::$TELEFOONAANBIEDER = $companyAanbieder->telephone; self::$CPONTVANGER = $companyOntvanger->profile->full_name; self::$DIENST = CalendarCodeTitles::findOne(['code_title' => $calenderEvent->code_title])->title; self::$AANVANGSTIJD = date("d-m-Y", strtotime($calenderEvent->start)) . ' om ' . $contractdeal->aanvangstijd; self::$RPFLINK = '<a href=http://www.werkmetspoor.nl' . Url::base() . '/index.php/calendar-events/mijnkalender?_id=' . $calenderEvent->user_id . '&_dd=' . substr($calenderEvent->start, 0, 10) . '>www.werkmetspoor.nl</a>'; self::$PLAATS = $contractdeal->city; self::$LOKATIE = $contractdeal->location; $bodytext = $model->body; return preg_replace_callback('/\\{([A-Z]+)\\}/', function ($matches) { $a = ''; switch ($matches[0]) { case '{CONTACTPERSOONAANBIEDER}': $a = self::$CONTACTPERSOONAANBIEDER; break; case '{FNAAMAANBIEDER}': $a = self::$FNAAMAANBIEDER; break; case '{TELEFOONAANBIEDER}': $a = self::$TELEFOONAANBIEDER; break; case '{CPONTVANGER}': $a = self::$CPONTVANGER; break; case '{DIENST}': $a = self::$DIENST; break; case '{AANVANGSTIJD}': $a = self::$AANVANGSTIJD; break; case '{RPFLINK}': $a = self::$RPFLINK; break; case '{PLAATS}': $a = self::$PLAATS; break; case '{LOKATIE}': $a = self::$LOKATIE; break; default: $a = ''; } return $a; }, $bodytext); }
public static function getBodyText($calenderEvent, $companyOntvanger, $companyAanbieder, $contractdeal) { //afhankelijk van de gebruikte code_title wordt een bepaalde email verzonden $model = EmailMessages::findOne(['code_title' => $calenderEvent->code_title]); $CONTACTPERSOONAANBIEDER = $companyAanbieder->profile->full_name; $FNAAMAANBIEDER = $companyAanbieder->name; $TELEFOONAANBIEDER = $companyAanbieder->telephone; $CPONTVANGER = $companyOntvanger->profile->full_name; $DIENST = CalendarCodeTitles::findOne(['code_title' => $calenderEvent->code_title])->title; $AANVANGSTIJD = date("d-m-Y", strtotime($calenderEvent->start)) . ' om ' . $contractdeal->aanvangstijd; $RPFLINK = '<a href=https://rail4people-jaccos.c9.io/' . Url::base() . '/index.php/calendar-events/mijnkalender?_id=' . $calenderEvent->user_id . '&_dd=' . substr($calenderEvent->start, 0, 10) . '>www.werkmetspoor.nl</a>'; $PLAATS = $contractdeal->city; $LOKATIE = $contractdeal->location; $bodytext = $model->body; return preg_replace('/\\{([A-Z]+)\\}/e', "\$\$1", $bodytext); }
public function getNextCodeTitles($code_title) { switch ($code_title) { case 'ddAvail': $new_codeTitle = 'ddContr'; break; case 'ndAvail': $new_codeTitle = 'ndContr'; break; case 'ddContr': $new_codeTitle = 'ddAccep'; break; case 'ndContr': $new_codeTitle = 'ndAccep'; break; } return \app\models\CalendarCodeTitles::findOne(['code_title' => $new_codeTitle]); }
/** * Finds the CalendarCodeTitles model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CalendarCodeTitles the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CalendarCodeTitles::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use dosamigos\ckeditor\CKEditor; use app\models\CalendarCodeTitles; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model app\models\EmailMessages */ /* @var $form yii\widgets\ActiveForm */ \Yii::$app->language = 'nl'; $dataList=ArrayHelper::map(CalendarCodeTitles::find()->asArray()->all(), 'code_title', 'code_title'); ?> <div class="email-messages-form"> <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'name')?> <?= $form->field($model, 'partof')?> <?= $form->field($model, 'code_title')->dropDownList($dataList, ['prompt'=>'- kies een codetitle -']) ?> <?= $form->field($model, 'code_to')->dropDownList(['Nvt'=>'Nvt','dienstaanbieder'=>'dienstaanbieder (werknemer)', 'dienstafnemer'=>'dienstafnemer (werkgever)'], ['prompt'=>'- kies een dienst -']) ?>