Exemplo n.º 1
0
 /**
  * Initializes the object.
  * This method is invoked at the end of the constructor after the object is initialized with the
  * given configuration.
  */
 public function init()
 {
     parent::init();
     $request = Yii::$app->getRequest();
     $headers = $request->getHeaders();
     //ajax
     if (isset($headers['adm-nestable-ajax'])) {
         $this->ajax();
     } else {
         $view = $this->getView();
         if ($this->btn === null || $this->btn === false) {
             $this->btn = Html::tag('button', '', ['class' => 'btn btn-primary btn-adm-nestable' . ($this->btn === false ? ' hide' : ''), 'data' => ['is-nestable' => Yii::$app->getRequest()->get('nestable', 0), 'gridview-text' => Adm::t('', 'Search', ['dot' => false]), 'nestable-text' => Adm::t('', 'Sort', ['dot' => false])]]);
         }
         $pagination = $this->grid->dataProvider->getPagination();
         if (($params = $pagination->params) === null) {
             $params = $request instanceof Request ? $request->getQueryParams() : [];
         }
         $params['nestable'] = 1;
         $pagination->params = $params;
         $models = $this->grid->dataProvider->getModels();
         if (!$models) {
             $view->registerJs('$(".btn-adm-nestable-view").hide();');
             return null;
         }
         $keys = $this->grid->dataProvider->getKeys();
         $this->registerAssets($view);
         $output = strtr($this->template, ['{btn}' => $this->renderBtn(), '{nestableId}' => $this->id, '{items}' => $this->renderItems($models, $keys), '{pager}' => $this->renderPager()]);
         echo $output;
         unset($params['nestable']);
         $pagination->params = $params;
     }
 }
Exemplo n.º 2
0
 /**
  * @return string
  */
 public function actionIndex()
 {
     $module = Module::getInstance();
     /* @var $model \app\modules\admlivechat\models\SettingsForm */
     $model = $module->manager->createSettingsForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->save()) {
             Yii::$app->getSession()->setFlash('success', Adm::t('', 'Data successfully changed!'));
             return Adm::redirect(['index']);
         }
     }
     return $this->render('index', ['model' => $model]);
 }
 /**
  * @return \yii\web\Response
  */
 public function actionTest()
 {
     $error = Module::getInstance()->manager->createEmailConfigQuery('eachEmail', function ($email) {
         try {
             Yii::$app->mailer->compose()->setTo($email)->setFrom(Yii::$app->params['adminEmailName'])->setSubject(Adm::t('adm_email_config', 'Test subject', ['dot' => false]))->setHtmlBody(Adm::t('adm_email_config', 'Test text', ['dot' => false]))->send();
         } catch (\Exception $e) {
             if ($e instanceof \Swift_RfcComplianceException) {
                 Yii::$app->getSession()->setFlash('error', Adm::t('adm_email_config', 'Maybe incorrect email address: {error}', ['error' => $e->getMessage(), 'dot' => true]));
             } else {
                 Yii::$app->getSession()->setFlash('error', Adm::t('adm_email_config', 'Error: {error}', ['error' => $e->getMessage(), 'dot' => true]));
             }
             return true;
         }
     });
     if ($error) {
         Yii::$app->getSession()->removeFlash('success');
     } else {
         Yii::$app->getSession()->setFlash('success', Adm::t('adm_email_config', 'Email sent!', ['dot' => true]));
     }
     return Adm::redirect(['update']);
 }
Exemplo n.º 4
0
}
?>
<div class="user-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Adm::t('user', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>

        <?php 
if (!Adm::getInstance()->user->can('Adm-UpdateOwnUser', $model)) {
    ?>
            <?php 
    echo Html::a(Adm::t('user', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Adm::t('user', 'Are you sure you want to delete this item?', ['dot' => false]), 'method' => 'post']]);
    ?>
        <?php 
}
?>
    </p>

    <?php 
echo Adm::widget('DetailView', ['model' => $model, 'hover' => true, 'mode' => \kartik\detail\DetailView::MODE_VIEW, 'attributes' => ['username', 'email:email', ['attribute' => 'status', 'value' => $model->status_list($model->status)], ['attribute' => 'role', 'label' => Yii::t('modelAdm/user', 'Assignment Role'), 'format' => 'raw', 'value' => $rolesStr], ['attribute' => 'updated_at', 'value' => Yii::$app->formatter->asDate($model->updated_at)], ['attribute' => 'created_at', 'value' => Yii::$app->formatter->asDate($model->created_at)]]]);
?>

</div>
Exemplo n.º 5
0
<?php

use pavlinter\adm\Adm;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model pavlinter\adm\models\AuthRule */
/* @var $dynamicModel yii\base\DynamicModel */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('auth', 'Create Auth Rule');
$this->params['breadcrumbs'][] = ['label' => Adm::t('auth', 'Auth Rules'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="auth-rule-create">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model, 'dynamicModel' => $dynamicModel]);
?>

</div>
Exemplo n.º 6
0
<?php

use pavlinter\adm\Adm;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model pavlinter\adm\models\AuthItemChild */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('auth', 'Create Auth Item Child');
$this->params['breadcrumbs'][] = ['label' => Adm::t('auth', 'Auth Item Children'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="auth-item-child-create">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
Exemplo n.º 7
0
<?php

use pavlinter\adm\Adm;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model pavlinter\adm\models\AuthAssignment */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('auth', 'Update Auth Assignment: {item_name}', ['item_name' => $model->item_name]);
$this->params['breadcrumbs'][] = ['label' => Adm::t('auth', 'Auth Assignments'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->item_name, 'url' => ['index']];
$this->params['breadcrumbs'][] = Adm::t('auth', 'Update');
Yii::$app->i18n->resetDot();
?>
<div class="auth-assignment-update">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
Exemplo n.º 8
0
 /**
  * Deletes an existing Page model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param string $id
  * @param null|integer $id_parent
  * @return mixed
  */
 public function actionDelete($id, $id_parent = null)
 {
     if (!in_array($id, Module::getInst()->closeDeletePage)) {
         $this->findModel($id)->delete();
         Yii::$app->getSession()->setFlash('success', Adm::t('', 'Data successfully removed!'));
     }
     $url = ['index', 'id_parent' => 0];
     if ($id_parent !== null) {
         $url['id_parent'] = $id_parent;
     }
     return $this->redirect($url);
 }
Exemplo n.º 9
0
?>



<div class="languages-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Adm::t('language', 'Create Language'), ['create'], ['class' => 'btn btn-primary']);
?>

        <?php 
echo Html::a('!', '#', ['class' => 'btn btn-primary btn-adm-nestable-view']);
?>
    </p>

    <?php 
echo Adm::widget('GridView', ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'nestable' => ['id' => 'pages-nestable-grid', 'btn' => false, 'nameCol' => 'name', 'parentCol' => false, 'orderBy' => SORT_ASC], 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'image', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    if ($model->image) {
        return Html::img($model->image, ['style' => 'max-width: 100px;max-height:100px;']);
    }
}, 'width' => '100px'], 'name', 'code', ['class' => 'kartik\\grid\\BooleanColumn', 'attribute' => 'active', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['options' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'pluginOptions' => ['allowClear' => true]]], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} {delete}', 'width' => '70px']]]);
?>

</div>
Exemplo n.º 10
0
                </div>
            </div>
            <div class="col-xs-12 col-sm-6 col-md-6">
                <div>
                    <?php 
echo $form->field($model, 'webtools')->textarea();
?>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12">
                <div>
                    <?php 
echo $form->field($model, 'active', ["template" => "{input}\n{label}\n{hint}\n{error}"])->widget(CheckboxX::classname(), ['pluginOptions' => ['threeState' => false]]);
?>
                </div>
            </div>
        </div>

        <p>
            <?php 
echo InputButton::widget(['label' => !isset(Yii::$app->params[Module::getInstance()->settingsKey]) ? Adm::t('', 'Create', ['dot' => false]) : Adm::t('', 'Update', ['dot' => false]), 'options' => ['class' => 'btn btn-primary'], 'input' => 'adm-redirect', 'name' => 'redirect', 'formSelector' => $form]);
?>

        </p>
    <?php 
ActiveForm::end();
?>
</div>
Exemplo n.º 11
0
            </table>

            <div style="text-align: center; padding: 10px 0px;">
                <a class="text-font3" href="<?php 
echo Url::to(['default/invoice', 'alias' => $model->alias], true);
?>
" style="background: none repeat scroll 0 0 #88ad09;color: white;display: inline-block;padding: 8px 20px;text-decoration: none;">
                    <?php 
echo Adm::t('oplata/mail', "Pay");
?>
                </a>
            </div>

            <div class="text-font" style="margin: 10px 0px;">
                <?php 
echo Adm::t('oplata/mail', "Link: {url}", ['url' => Url::to(['default/invoice', 'alias' => $model->alias], true)]);
?>
            </div>
        </div>

    </div>
</div>


<?php 
$this->endBody();
?>
</body>
</html>
<?php 
$this->endPage();
Exemplo n.º 12
0
<?php

use pavlinter\adm\Adm;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model \pavlinter\adm\models\SourceMessage */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('source-message', 'Create Source Message');
$this->params['breadcrumbs'][] = ['label' => Adm::t('source-message', 'Source Messages'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="source-message-create">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
Exemplo n.º 13
0
                                        }, 1000);
                                    }
                                }']]);
    ?>
                    </div>
                <?php 
}
?>


            </div>
            <div class="col-xs-6">
                <a class="btn btn-s-md btn-white cloneBtn" href="javascript:void(0);">
                    <i class="fa fa-plus text"></i>
                    <span class="text"><?php 
echo Adm::t('oplata', 'Add Item', ['dot' => false]);
?>
</span>
                </a>
            </div>
        </div>
    </div>

    <?php 
Adm::end('ActiveForm');
?>

</div>


<?php 
Exemplo n.º 14
0
<?php

use yii\helpers\Html;
use pavlinter\adm\Adm;
/* @var $this yii\web\View */
/* @var $model app\models\ContactMsg */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('app/contact_msg', 'Update Contact Msg: ') . ' ' . $model->id;
$this->params['breadcrumbs'][] = ['label' => Adm::t('app/contact_msg', 'Contact Msgs'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = Adm::t('app/contact_msg', 'Update');
Yii::$app->i18n->resetDot();
?>
<div class="contact-msg-update">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
Exemplo n.º 15
0
<?php

use pavlinter\adm\Adm;
/**
 * @var yii\web\View $this
 */
?>

<div class="elfinder-default-index">
    <h1><?php 
echo Adm::t('file', 'Media Files');
?>
</h1>
    <?php 
echo Adm::widget('FileManager');
?>
</div>
Exemplo n.º 16
0
<?php

use yii\helpers\Html;
use pavlinter\adm\Adm;
/* @var $this yii\web\View */
/* @var $model pavlinter\admoplata\models\OplataTransaction */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('oplata', 'Update Order: ', ['modelClass' => 'Oplata Transaction']) . ' #' . $model->id;
$this->params['breadcrumbs'][] = ['label' => Adm::t('oplata', 'List'), 'url' => ['index']];
$this->params['breadcrumbs'][] = Adm::t('oplata', 'Update');
Yii::$app->i18n->resetDot();
?>
<div class="oplata-transaction-update">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model, 'items' => $items]);
?>

</div>
Exemplo n.º 17
0
/* @var $searchModel pavlinter\adm\models\AuthAssignmentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('auth', 'Auth Assignments');
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="auth-assignment-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Adm::t('auth', 'Create Auth Assignment'), ['create'], ['class' => 'btn btn-primary']);
?>
    </p>

    <?php 
echo Adm::widget('GridView', ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'item_name', ['attribute' => 'user_id', 'value' => function ($model, $index, $widget) {
    if ($model->user) {
        return $model->user->username;
    }
}], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} {delete}', 'width' => '70px']]]);
?>


</div>
Exemplo n.º 18
0
 /**
  * @param $item_name
  * @return string
  */
 public static function translateAuthItems($item_name, $params = [])
 {
     $params = ArrayHelper::merge(['dot' => false], $params);
     return Adm::t('sumoselect/items', $item_name, $params);
 }
Exemplo n.º 19
0
 /**
  * Deletes an existing Params model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     Yii::$app->getSession()->setFlash('success', Adm::t('', 'Data successfully removed!'));
     return Adm::redirect(['index']);
 }
Exemplo n.º 20
0
/* @var $searchModel pavlinter\adm\models\AuthItemSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('auth', 'Auth Items');
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="auth-item-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Adm::t('auth', 'Create Auth Item'), ['create'], ['class' => 'btn btn-primary']);
?>
    </p>


    <?php 
echo Adm::widget('GridView', ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'name', ['attribute' => 'type', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    return $model::typeList($model->type);
}, 'filterOptions' => ['style' => 'padding:8px 1px;'], 'filterType' => GridView::FILTER_SELECT2, 'filter' => $searchModel::typeList(), 'filterWidgetOptions' => ['pluginOptions' => ['width' => '120px', 'allowClear' => true]]], 'description:ntext', 'rule_name', ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} {delete}', 'width' => '70px']]]);
?>



</div>
Exemplo n.º 21
0
?>
<div class="user-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Adm::t('user', 'Create User'), ['create'], ['class' => 'btn btn-primary']);
?>
    </p>

    <?php 
echo Adm::widget('GridView', ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'username', 'email:email', ['attribute' => 'role', 'vAlign' => 'middle', 'value' => function ($model, $key, $index, $widget) {
    return $model::roles($model->role);
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => $searchModel::roles(), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'format' => 'raw'], ['attribute' => 'status', 'vAlign' => 'middle', 'value' => function ($model, $key, $index, $widget) {
    return $model::status($model->status);
}, 'filterType' => GridView::FILTER_SELECT2, 'filter' => $searchModel::status(), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => Adm::t('', 'Select ...', ['dot' => false])], 'format' => 'raw'], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{login} {view} {update} {delete}', 'buttons' => ['delete' => function ($url, $model) {
    if ($model->id == Adm::getInstance()->user->getId()) {
        return null;
    }
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']);
}, 'login' => function ($url, $model) {
    return Html::a('<span class="glyphicon glyphicon-sunglasses"></span>', ['/profilelogin/default/login', 'username' => $model->username], ['title' => Yii::t('adm/title', 'Login', ['dot' => false]), 'data-method' => 'post', 'data-pjax' => '0']);
}]]]]);
?>
</div>

Exemplo n.º 22
0
use pavlinter\adm\Adm;
/* @var $this yii\web\View */
/* @var $model app\models\ContactMsg */
Yii::$app->i18n->disableDot();
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => Adm::t('app/contact_msg', 'Contact Msgs'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="contact-msg-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Adm::t('app/contact_msg', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Adm::t('app/contact_msg', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Adm::t('app/contact_msg', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo Adm::widget('DetailView', ['model' => $model, 'hover' => true, 'mode' => \kartik\detail\DetailView::MODE_VIEW, 'attributes' => [['attribute' => 'id', 'format' => 'text'], ['attribute' => 'from_email', 'format' => 'email'], ['attribute' => 'to_email', 'format' => 'email'], ['attribute' => 'subject', 'format' => 'text'], ['attribute' => 'text', 'format' => 'raw'], ['attribute' => 'created_at', 'format' => 'text'], ['attribute' => 'updated_at', 'format' => 'text']]]);
?>

</div>
Exemplo n.º 23
0
        <?php 
echo InputButton::widget(['label' => Adm::t('adm_email_config', 'Update and Test', ['dot' => false]), 'options' => ['class' => 'btn btn-primary'], 'input' => 'adm-redirect', 'name' => 'redirect', 'value' => Url::to('test'), 'formSelector' => $form]);
?>


    </div>

    <?php 
echo Adm::t('adm_email_config', 'Update and Test', ['dot' => '.']);
?>
    <?php 
echo Adm::t('adm_email_config', 'Test subject', ['dot' => '.']);
?>
    <?php 
echo Adm::t('adm_email_config', 'Test text', ['dot' => '.']);
?>

    <?php 
Adm::end('ActiveForm');
?>

</div>

<?php 
$this->registerJs('

    $("#emailconfig-enable_smtp").on("change", function(){
        $(this).trigger("readonly");
    });
Exemplo n.º 24
0
<?php

use yii\helpers\Html;
use pavlinter\adm\Adm;
/* @var $this yii\web\View */
/* @var $model \pavlinter\admeconfig\models\EmailConfig */
/* @var $paramsValue array|null */
/* @var $data array */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('adm_email_config', 'Mail Config');
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="email-config-update">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model, 'paramsValue' => $paramsValue, 'data' => $data]);
?>
</div>
Exemplo n.º 25
0
/* @var $searchModel app\models\search\ContactMsgSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('app/contact_msg', 'Contact Msgs');
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->i18n->resetDot();
?>
<div class="contact-msg-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Adm::t('app/contact_msg', 'Create Contact Msg'), ['create'], ['class' => 'btn btn-primary']);
?>
    </p>

    <?php 
echo Adm::widget('GridView', ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['attribute' => 'id', 'format' => 'text', 'width' => '70px', 'hAlign' => 'center'], ['attribute' => 'from_email', 'format' => 'email'], ['attribute' => 'subject', 'format' => 'raw', 'value' => function ($model) {
    return Html::a($model->subject, ['view', 'id' => $model->id]);
}], ['attribute' => 'text', 'format' => 'raw'], ['attribute' => 'created_at', 'format' => 'text', 'width' => '150px', 'vAlign' => 'middle', 'hAlign' => 'center'], ['class' => 'app\\widgets\\BooleanColumn', 'attribute' => 'viewed', 'tableName' => $searchModel::tableName()], ['class' => '\\kartik\\grid\\ActionColumn', 'template' => '{view} {update} {delete}']]]);
?>

</div>
Exemplo n.º 26
0
<?php

use pavlinter\adm\Adm;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model pavlinter\adm\models\Language */
Yii::$app->i18n->disableDot();
$this->title = Adm::t('language', 'Update Language: {name}', ['name' => $model->name]);
$this->params['breadcrumbs'][] = ['label' => Adm::t('language', 'Languages'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['index']];
$this->params['breadcrumbs'][] = Adm::t('language', 'Update');
Yii::$app->i18n->resetDot();
?>
<div class="languages-update">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
echo $this->render('_form', ['model' => $model]);
?>

</div>
Exemplo n.º 27
0
        </div>
    </div>



    <div class="form-group">
        <?php 
echo InputButton::widget(['label' => $model->isNewRecord ? Adm::t('', 'Create', ['dot' => false]) : Adm::t('', 'Update', ['dot' => false]), 'options' => ['class' => 'btn btn-primary'], 'input' => 'adm-redirect', 'name' => 'redirect', 'formSelector' => $form]);
?>

        <?php 
if ($model->isNewRecord) {
    ?>
            <?php 
    echo InputButton::widget(['label' => Adm::t('', 'Create and insert new', ['dot' => false]), 'options' => ['class' => 'btn btn-primary'], 'input' => 'adm-redirect', 'name' => 'redirect', 'value' => Url::to(['create']), 'formSelector' => $form]);
    ?>
        <?php 
}
?>

        <?php 
echo InputButton::widget(['label' => $model->isNewRecord ? Adm::t('', 'Create and list', ['dot' => false]) : Adm::t('', 'Update and list', ['dot' => false]), 'options' => ['class' => 'btn btn-primary'], 'input' => 'adm-redirect', 'name' => 'redirect', 'value' => Url::to(['index']), 'formSelector' => $form]);
?>
    </div>

    <?php 
Adm::end('ActiveForm');
?>

</div>
 /**
  * For cron
  */
 public function actionCron()
 {
     $module = Module::getInstance();
     if (!$module->remindDays) {
         return 'Remind Disabled';
     }
     $query = $module->manager->createOplataTransactionQuery();
     /* @var \yii\db\Query $query */
     $query->where(['response_status' => OplataTransaction::STATUS_NOT_PAID, 'remind_note' => 0])->andWhere("NOW() > DATE_SUB(date_end, INTERVAL :day DAY) AND NOW() < date_end", ['day' => $module->remindDays]);
     foreach ($query->batch(10) as $models) {
         foreach ($models as $model) {
             Yii::$app->getI18n()->changeLanguage($model->language_id);
             $username = '';
             $user = null;
             if ($model->user_id) {
                 $user = $model->user;
                 if ($user) {
                     $username = $user->username;
                 }
             }
             Yii::$app->mailer->htmlLayout = false;
             $res = Yii::$app->mailer->compose(['html' => $module->remindTemplate], ['model' => $model, 'username' => $username])->setTo($model->email)->setFrom($module->sendFrom)->setSubject(Adm::t("oplata/remind", "Remind Payment Day", ['dot' => false]))->send();
             if ($res) {
                 $model->remind_note = 1;
                 $model->save(false);
             }
             sleep(2);
         }
     }
     return 'Success!';
 }
Exemplo n.º 29
0
                    </li>
                </ul>
            </li>
        </ul>
        <?php 
}
?>

        <?php 
if ($languages) {
    ?>
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle dker" data-toggle="dropdown">
                        <?php 
    echo Adm::t("header", "Languages", ['dot' => false]);
    ?>
 <b class="caret"></b>
                    </a>

                    <ul class="dropdown-menu">
                        <?php 
    foreach ($languages as $language) {
        $text = $language['name'];
        if ($language['image']) {
            $text = Html::img($language['image'], ['style' => 'height: 18px;']) . '&nbsp;' . $text;
        }
        ?>
                            <li><?php 
        echo Html::a($text, $language['url']);
        ?>
Exemplo n.º 30
0


<div class="languages-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
if ($show) {
    ?>
        <?php 
    echo Html::a(Adm::t('language', 'Create Language'), ['create'], ['class' => 'btn btn-primary']);
    ?>
        <?php 
}
?>
        <?php 
echo Html::a('!', '#', ['class' => 'btn btn-primary btn-adm-nestable-view']);
?>
    </p>

    <?php 
echo Adm::widget('GridView', ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'nestable' => ['id' => 'pages-nestable-grid', 'btn' => false, 'nameCol' => 'name', 'parentCol' => false, 'orderBy' => SORT_ASC], 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'image', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    if ($model->image) {
        return Html::img($model->image, ['style' => 'max-width: 100px;max-height:100px;']);
    }
}, 'width' => '100px'], 'name', 'code', ['class' => 'app\\widgets\\BooleanColumn', 'attribute' => 'active', 'update' => ['updated_at' => time()], 'tableName' => $searchModel::tableName(), 'visible' => $show], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{update} {delete}', 'width' => '70px']]]);