public function actionDelete($id, $language)
 {
     $model = $this->findModel(Message::className(), ['id' => $id, 'language' => $language]);
     if ($model->delete()) {
         Alert::addSuccess(Yii::t('messages', 'Translation has been successfully deleted'));
     } else {
         Alert::addError(Yii::t('messages', 'Translation has not been deleted'));
     }
     return $this->redirect(Yii::$app->request->referrer);
 }
Ejemplo n.º 2
0
 public function actionMassDelete()
 {
     if (isset($_POST['keys'])) {
         foreach ($_POST['keys'] as $key) {
             $model = $this->findModel($key);
             if ($model) {
                 if ($model->delete()) {
                     Alert::addSuccess("Items has been successfully deleted");
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 public function afterSave($insert)
 {
     $this->activeAttributes();
     if ($insert) {
         $message = new Message();
     } else {
         $message = Message::findOne(['id' => $this->id, 'language' => $this->language]);
         if (!$message instanceof Message) {
             $message = new Message();
         }
     }
     $message->id = $this->id;
     $message->language = $this->language;
     $message->translation = $this->messageTranslation;
     if ($message->save()) {
         Alert::addSuccess(Yii::t('messages', 'Translation has been saved'));
         self::commitLocalTransaction();
         return true;
     }
     Alert::addError(Yii::t('messages', 'Translation has not been saved'), $message->errors);
     self::rollbackLocalTransaction();
     throw new BadRequestHttpException(Alert::popError());
 }
 public function actionMassDelete()
 {
     $url = Yii::$app->request->getQueryParam('url');
     if (isset($_POST['keys'])) {
         foreach ($_POST['keys'] as $key) {
             try {
                 $model = $this->findModel(ClientBeacons::className(), $key);
                 if ($model) {
                     if ($model->delete()) {
                         Alert::addSuccess("Items has been successfully deleted");
                     }
                 }
             } catch (Exception $e) {
                 Alert::addError('Item has not been deleted', $e->getMessage());
             }
         }
     }
     return $this->redirect($url);
 }
Ejemplo n.º 5
0
 public function actionMassDelete()
 {
     if (isset($_POST['keys'])) {
         foreach ($_POST['keys'] as $key) {
             try {
                 $model = $this->findModel(ClientUsers::className(), $key);
                 if ($model) {
                     if ($model->delete()) {
                         Alert::addSuccess("Items has been successfully deleted");
                     }
                 }
             } catch (Exception $e) {
                 Alert::addError('Item has not been deleted', $e->getMessage());
             }
         }
     }
     return $this->redirect(['list']);
 }
Ejemplo n.º 6
0
 public function actionPasswordChange($token)
 {
     try {
         $model = new PasswordChangeForm($token);
     } catch (InvalidParamException $e) {
         throw new BadRequestHttpException('Wrong password reset token.');
     }
     if ($model->load(Yii::$app->request->post())) {
         if ($model->validate() && $model->changePassword()) {
             Alert::addSuccess('New password was saved.');
             return $this->goHome();
         } else {
             Alert::addError('Password hasn\'t been saved.');
             return $this->goHome();
         }
     }
     return $this->render('password-change', ['model' => $model]);
 }
Ejemplo n.º 7
0
 /**
  *
  */
 public function actionSaveMap()
 {
     $model = new BeaconMapLoad();
     $model->load(Yii::$app->request->post());
     if ($model->saveMap()) {
         Alert::addSuccess(Yii::t('messages', ':map_load'));
     } else {
         Alert::addError(Yii::t('messages', ':map_not_load'));
     }
     return $this->redirect(['map']);
 }