/** * wordt gezet indien een contract wordt geaccepteerd door de dienstaanbieder * @param string $code_title * @return string description met placeholder {BEDRIJFSNAAM} **/ public static function getEventDescriptionWhenAccepted($code_title = '', $companyname = '', $startdatum = '', $plaats = '', $lokatie = '', $email) { $titleDesc = CalendarCodeDescriptions::findOne(['code_title' => $code_title])->description; $BEDRIJFSNAAM = $companyname; $START = $startdatum; $LOKATIE = $lokatie; $PLAATS = $plaats; $EMAIL = $email; if (strpos($titleDesc, '{BEDRIJFSNAAM}') and strpos($titleDesc, '{START}')) { return preg_replace('/\\{([A-Z]+)\\}/e', "\$\$1", $titleDesc); } else { return $titleDesc; } }
/** * wordt gezet indien een contract wordt geaccepteerd door de dienstaanbieder * @param string $code_title * @return string description met placeholder {BEDRIJFSNAAM} **/ public static function getEventDescriptionWhenAccepted($code_title = '', $companyname = '', $startdatum = '', $plaats = '', $lokatie = '', $email) { $titleDesc = CalendarCodeDescriptions::findOne(['code_title' => $code_title])->description; self::$BEDRIJFSNAAM = $companyname; self::$START = $startdatum; self::$LOKATIE = $lokatie; self::$PLAATS = $plaats; self::$EMAIL = $email; if (strpos($titleDesc, '{BEDRIJFSNAAM}') and strpos($titleDesc, '{START}')) { return preg_replace_callback('/\\{([A-Z]+)\\}/', function ($matches) { $a = ''; switch ($matches[0]) { case '{BEDRIJFSNAAM}': $a = self::$BEDRIJFSNAAM; break; case '{EMAIL}': $a = self::$EMAIL; break; case '{START}': $a = self::$START; break; case '{PLAATS}': $a = self::$PLAATS; break; case '{LOKATIE}': $a = self::$LOKATIE; break; default: $a = ''; } return $a; }, $titleDesc); } else { return $titleDesc; } }
/** * Finds the CalendarCodeDescriptions model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CalendarCodeDescriptions the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CalendarCodeDescriptions::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }