Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 3
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.º 4
0
 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);
 }
Ejemplo n.º 6
0
                    <?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 &copy; 2006-2015 <a href="http://sangkilsoft.com">SangkilSoft</a>.</strong> All rights reserved.
            </footer>

        </div><!-- ./wrapper -->
Ejemplo n.º 7
0
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>
Ejemplo n.º 8
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());
 }
Ejemplo n.º 9
0
        <?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>

Ejemplo n.º 10
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.º 11
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.º 12
0
 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]));
     }
 }
Ejemplo n.º 13
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']);
 }