示例#1
0
 /**
  * @return bool
  */
 function run()
 {
     $this->id = "ALERT-" . time();
     $message = $this->message ? $this->message : Alerts::getMessage();
     $alert_type = $this->alert_type ? $this->alert_type : Alerts::getAlertType();
     $this->countdown = $this->countdown ? $this->countdown : Alerts::getCountdown();
     if (!$alert_type) {
         $alert_type = Alerts::ALERT_INFO;
     }
     if ($message) {
         /* ~ Clears message after use */
         Alerts::clearMessage();
         return $this->render('alerts', ['id' => $this->id, 'message' => $message, 'alert_type' => $alert_type, 'close' => $this->close, 'countdown' => $this->countdown]);
     }
     return FALSE;
 }
示例#2
0
 /**
  * Updates an existing AliasUrl model.
  * If update is successful, the browser will be redirected to the 'view' page.
  *
  * @param string $id
  *
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if (isset($_POST['AliasUrl'])) {
         $post = $_POST['AliasUrl'];
         $public = strtolower(trim($post['public']));
         if (AppAliasUrl::isDuplicate($id, $public, $post['is_frontend']) == TRUE) {
             Alerts::setAlertType(Alerts::ALERT_WARNING);
             Alerts::setMessage('Public alias already taken');
         } else {
             CoreHelper::saveModelForm('c006\\url\\models\\AliasUrl', $post);
             Alerts::setAlertType(Alerts::ALERT_SUCCESS);
             Alerts::setMessage('SUCCESS: Information updated');
         }
         return $this->redirect('/alias');
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }