Ejemplo n.º 1
0
 /**
  * @return string
  */
 public function run()
 {
     if (Yii::$app->request->isPost) {
         $setting = Yii::$app->request->post('Setting');
         if (isset($_FILES['Setting'])) {
             foreach ($_FILES['Setting']['name'] as $key => $value) {
                 $model = Setting::findOne(['code' => $key]);
                 $model->file = UploadedFile::getInstance($model, $key);
                 if ($model->file != null && $model->upload()) {
                     $model->updateAttributes(['value' => $value]);
                 }
             }
         }
         if ($setting != null) {
             foreach ($setting as $key => $value) {
                 if ($value !== '' || $value != null) {
                     if (is_array($value)) {
                         Setting::updateAll(['value' => implode(",", $value)], ['code' => $key]);
                     } else {
                         Setting::updateAll(['value' => $value], ['code' => $key]);
                     }
                 }
             }
         }
         Yii::$app->session->setFlash('alert', ['body' => Yii::t('setting', 'Settings has been successfully saved'), 'options' => ['class' => 'alert-success']]);
     }
     if (Module::hasMultiLanguage()) {
         $title = Translate::setting();
     } else {
         $title = Yii::t('setting', 'Setting');
     }
     $currentSetting = Setting::findOne(['code' => $this->id]);
     return $this->controller->render('index', ['title' => $title, 'code' => $currentSetting !== null ? $currentSetting->code : null]);
 }
 /**
  * Returns a list of behaviors that this component should behave as.
  *
  * Child classes may override this method to specify the behaviors they want to behave as.
  *
  * The return value of this method should be an array of behavior objects or configurations
  * indexed by behavior names. A behavior configuration can be either a string specifying
  * the behavior class or an array of the following structure:
  *
  * ```php
  * 'behaviorName' => [
  *     'class' => 'BehaviorClass',
  *     'property1' => 'value1',
  *     'property2' => 'value2',
  * ]
  * ```
  *
  * Note that a behavior class must extend from [[Behavior]]. Behavior names can be strings
  * or integers. If the former, they uniquely identify the behaviors. If the latter, the corresponding
  * behaviors are anonymous and their properties and methods will NOT be made available via the component
  * (however, the behaviors can still respond to the component's events).
  *
  * Behaviors declared in this method will be attached to the component automatically (on demand).
  *
  * @return array the behavior configurations.
  */
 public function behaviors()
 {
     $behaviors = ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]];
     if (Module::hasUserRole()) {
         $behaviors['role'] = ['class' => \navatech\role\filters\RoleFilter::className(), 'name' => Translate::x_management([Translate::language()]), 'actions' => ['index' => Translate::lists(), 'delete' => Translate::delete()]];
     }
     return $behaviors;
 }
Ejemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['POST']]], 'access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@']]]]];
     if (Module::hasUserRole()) {
         if (Module::hasMultiLanguage()) {
             return ArrayHelper::merge($behaviors, ['role' => ['class' => RoleFilter::className(), 'name' => Translate::setting(), 'actions' => ['index' => Translate::index(), 'create' => Translate::create(), 'update' => Translate::update(), 'delete' => Translate::delete()]]]);
         } else {
             return ArrayHelper::merge($behaviors, ['role' => ['class' => RoleFilter::className(), 'name' => 'Setting', 'actions' => ['index' => Yii::t('setting', 'List'), 'create' => Yii::t('setting', 'Create'), 'update' => Yii::t('setting', 'Update'), 'delete' => Yii::t('setting', 'Delete')]]]);
         }
     } else {
         return $behaviors;
     }
 }
Ejemplo n.º 4
0
<?php

use navatech\language\models\Language;
use navatech\language\Translate;
use yii\web\View;
/* @var $this View */
/* @var $model Language */
$this->params['breadcrumbs'][] = ['label' => Translate::language(), 'url' => ['list']];
$this->params['breadcrumbs'][] = Translate::update();
?>
<div class="navatech-language">
	<div class="col-sm-12">
		<div class="page-header">
			<h1><?php 
echo Translate::language();
?>
				<small>
					<i class="ace-icon fa fa-angle-double-right"></i> <?php 
echo Translate::update();
?>
				</small>
			</h1>
		</div>
		<div class="space-6"></div>
		<?php 
echo $this->render('_form', ['model' => $model]);
?>
	</div>
</div>
Ejemplo n.º 5
0
?>
				<small>
					<i class="ace-icon fa fa-angle-double-right"></i> <?php 
echo Translate::list_x([Translate::language()]);
?>
				</small>
			</h1>
		</div>
		<div class="space-6"></div>
		<p>
			<?php 
echo Html::a(Translate::add_a_new_x([Translate::language()]), ['create'], ['class' => 'btn btn-success']);
?>
		</p>
		<?php 
echo GridView::widget(['id' => 'language', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'export' => false, 'responsive' => true, 'hover' => true, 'pjax' => true, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'name', 'vAlign' => 'middle'], ['attribute' => 'code', 'vAlign' => 'middle'], ['attribute' => 'country', 'vAlign' => 'middle'], ['class' => 'kartik\\grid\\BooleanColumn', 'trueLabel' => Translate::in_use(), 'falseLabel' => Translate::not_in_use(), 'attribute' => 'status', 'vAlign' => 'middle'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{delete}']]]);
?>
	</div>
</div>
<script>
	<?php 
if (Yii::$app->getSession()->hasFlash('message')) {
    ?>
	alert('<?php 
    echo Yii::$app->getSession()->getFlash('message');
    ?>
');
	<?php 
}
?>
</script>
Ejemplo n.º 6
0
 * @time    2:35 CH
 */
use kartik\grid\GridView;
use navatech\language\models\PhraseSearch;
use navatech\language\Translate;
use yii\data\ActiveDataProvider;
use yii\web\View;
/* @var $this View */
/* @var $searchModel PhraseSearch */
/* @var $dataProvider ActiveDataProvider */
$this->title = Translate::list_x(Translate::phrase());
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="navatech-language">
	<div class="col-sm-12">
		<div class="page-header">
			<h1><?php 
echo Translate::phrase();
?>
				<small><i class="ace-icon fa fa-angle-double-right"></i> <?php 
echo Translate::list_x(Translate::phrase());
?>
				</small>
			</h1>
		</div>
		<div class="space-6"></div>
		<?php 
echo GridView::widget(['id' => 'phrase', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'responsive' => true, 'hover' => true, 'pjax' => true, 'export' => false, 'columns' => $searchModel->phraseColumns()]);
?>
	</div>
</div>
 /**
  * @return array attribute labels (name => label)
  * @see generateAttributeLabel()
  */
 public function attributeLabels()
 {
     return ['id' => 'No.', 'phrase_id' => Translate::phrase(), 'language_id' => Translate::language(), 'value' => Translate::translate()];
 }
Ejemplo n.º 8
0
 /**
  * @return array attribute labels (name => label)
  * @see generateAttributeLabel()
  */
 public function attributeLabels()
 {
     return ['id' => 'No.', 'name' => Translate::name(), 'code' => Translate::code(), 'country' => Translate::country(), 'status' => Translate::status()];
 }
Ejemplo n.º 9
0
<?php

use navatech\language\models\Language;
use navatech\language\Translate;
use yii\web\View;
/* @var $this View */
/* @var $model Language */
$this->params['breadcrumbs'][] = ['label' => Translate::language(), 'url' => ['list']];
$this->params['breadcrumbs'][] = Translate::create();
?>
<div class="navatech-language">
	<div class="col-sm-12">
		<div class="page-header">
			<h1><?php 
echo Translate::language();
?>
				<small>
					<i class="ace-icon fa fa-angle-double-right"></i> <?php 
echo Translate::add_a_new();
?>
				</small>
			</h1>
		</div>
		<div class="space-6"></div>
		<?php 
echo $this->render('_form', ['model' => $model]);
?>
	</div>
</div>

Ejemplo n.º 10
0
echo $form->field($model, 'code')->textInput(['maxlength' => true]);
?>

		<?php 
echo $form->field($model, 'country')->textInput(['maxlength' => true]);
?>

		<?php 
echo $form->field($model, 'status')->dropDownList([0 => Translate::not_in_use(), 1 => Translate::in_use()], ['prompt' => Translate::choose_status()]);
?>

	</div>
</div>
<div class="clearfix form-actions">
	<div class="col-md-offset-3 col-md-6">
		<button class="btn btn-info" type="submit">
			<i class="ace-icon fa fa-check bigger-110"></i>
			<?php 
echo Translate::save();
?>
		</button>
		<button class="btn btn-back" type="reset">
			<i class="ace-icon fa fa-arrow-left bigger-110"></i>
			<?php 
echo Translate::back();
?>
		</button>
	</div>
</div>
<?php 
ActiveForm::end();