public function loadTranslation() { if (!$this->validate()) { Alert::addError('Translation has not been loaded', $this->errors); return false; } $xlsImport = new xlsImport(Yii::$app->controller, Yii::$app->request->referrer, SourceMessage::className(), KReader::className(), $this, 'file', $this->isUpdate); $xlsImport->run(); return true; }
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); }
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"); } } } } }
public function createMessage() { if (!$this->validate()) { Alert::addError(Yii::t('messages', 'Translation has not been saved'), $this->errors); return false; } $sourceMessage = new SourceMessage(); $sourceMessage->language = $this->language; $sourceMessage->category = $this->category; $sourceMessage->message = $this->source_message; $sourceMessage->messageTranslation = $this->translation; if (!$sourceMessage->save()) { Alert::addError(Yii::t('messages', 'Translation has not been saved'), $sourceMessage->errors); } return false; }
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); }
<?php $breadcrumbs = isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []; foreach (Yii::$app->controller->modules as $module) { if ($module != Yii::$app) { array_unshift($breadcrumbs, ['label' => Inflector::camel2words($module->id), 'url' => ['/' . $module->uniqueId]]); } } ?> <?php echo Breadcrumbs::widget(['tag' => 'ol', 'encodeLabels' => false, 'homeLink' => ['label' => '<i class="fa fa-dashboard"></i> Home/Dashboard', 'url' => ['/site/index']], 'links' => $breadcrumbs]); ?> </section> <!-- Main content --> <section class="content"> <?php echo Alert::widget(); ?> <?php echo $content; ?> </section><!-- /.content --> </div><!-- /.content-wrapper --> <footer class="main-footer"> <div class="pull-right hidden-xs"> <b>Version</b> 3.0 </div> <strong>Copyright © 2006-2015 <a href="http://sangkilsoft.com">SangkilSoft</a>.</strong> All rights reserved. </footer> </div><!-- ./wrapper -->
use yii\bootstrap\NavBar; /* @var $this \app\components\MainView */ include_once 'header.php'; $this->beginBody(); ?> <div class="wrap"> <?php NavBar::begin(['brandLabel' => 'Beacon-CMS', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-default navbar-fixed-top']]); echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-left'], 'items' => $this->getLayoutData(SiteLayout::place_left_nav)]); echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $this->getLayoutData(SiteLayout::place_right_nav)]); NavBar::end(); ?> <div class="container"> <?php echo Alert::printAlert($this); ?> <?php echo Nav::widget(['options' => ['class' => 'nav-tabs'], 'items' => $this->getLayoutData(TabbedLayout::place_tabs)]); ?> <div class="col-md-2"> <?php echo Nav::widget(['options' => ['class' => 'nav-tabs nav-stacked'], 'items' => $this->getLayoutData(SubTabbedLayout::place_left_sub_tabs)]); ?> </div> <div class="col-md-10"> <?php echo $content; ?> </div> </div>
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()); }
<?php echo Alert::recursiveFind($succStore, 'msg'); ?> <?php } ?> <?php if (count($warnStore)) { ?> <?php echo Alert::recursiveFind($warnStore, 'msg'); ?> <?php } ?> <?php if (count($errStore)) { ?> <?php echo Alert::recursiveFind($errStore, 'msg'); ?> <?php } ?> </div> <script> </script>
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']); }
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]); }
public function run() { if (!self::prepareFile()) { return false; } self::setIsUpdate(); $this->transaction = Yii::$app->getDb()->beginTransaction(); $this->xlsRowToDb(); if (count($this->errors) || $this->error) { $this->transaction->rollback(); $error_array = array(); if (count($this->errors)) { $error_array[] = $this->errors; } if (count($this->error)) { $error_array[] = $this->error; } Alert::addError(Yii::t('messages', 'Your request ends with errors'), $error_array); return $this->controller->redirect(Url::to([$this->base_url])); } else { $this->transaction->commit(); if (count($this->warnings)) { Alert::addWarning(Yii::t('messages', 'Your request ends with warnings'), $this->warnings); } return $this->controller->redirect(Url::to([$this->base_url])); } }
/** * */ 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']); }