public function actionUser()
 {
     echo 'Start Input User :';
     $username = $this->prompt("Username: "******"Email: ");
     //接收邮箱
     $role = $this->prompt("Role: ");
     //接收用户类型
     $password = $this->prompt("Password: "******"{$e}\r\n";
             }
         }
         return 1;
     }
     return 0;
 }
 public function testUser()
 {
     $user = new \common\models\User();
     $user->email = "*****@*****.**";
     $user->password_hash = "1234";
     $user->username = "******";
     $this->assertTrue($user->save());
     $this->assertTrue($user->username === '<p>xss;</p>');
 }
 public function testUser()
 {
     $user = new \common\models\User();
     $user->email = "*****@*****.**";
     $user->password_hash = "1234";
     $user->username = "******";
     $saved = $user->save();
     $this->assertTrue($user->username === '<script>alert('xss');</script>');
 }
 public function safeUp()
 {
     $user = new \common\models\User();
     $user->username = '******';
     $user->email = '*****@*****.**';
     $user->setPassword('demo');
     $user->generateAuthKey();
     $user->generatePasswordResetToken();
     $user->save();
 }
Exemple #5
0
 public function editProfile()
 {
     if ($this->validate()) {
         $User = new \common\models\User();
         if (!empty($this->newpassword)) {
             $this->password_hash = $User->setPasswordShop($this->newpassword);
         }
         return $this->save(false);
     }
     return false;
 }
 public function up()
 {
     $tableOptions = null;
     if ($this->db->driverName === 'mysql') {
         $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
     }
     $this->createTable('{{%user}}', ['id' => Schema::TYPE_PK, 'username' => Schema::TYPE_STRING . ' NOT NULL ', 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', 'password_hash' => Schema::TYPE_STRING . ' NOT NULL', 'password_reset_token' => Schema::TYPE_STRING, 'email' => Schema::TYPE_STRING . ' NOT NULL', 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', 'created_at' => Schema::TYPE_INTEGER . ' NOT NULL', 'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL'], $tableOptions);
     $user = new \common\models\User();
     $user->username = '******';
     $user->email = '*****@*****.**';
     $user->generateAuthKey();
     $user->setPassword('demo');
     return $user->insert();
 }
Exemple #7
0
 public function signup()
 {
     if ($this->validate()) {
         $user = new \common\models\User();
         $user->username = $this->username;
         $user->email = $this->email;
         $user->setPassword('123456');
         $user->generateAuthKey();
         $user->status = 10;
         if ($user->save()) {
             return $user;
         }
     }
     return null;
 }
 /**
  * Displays a single Post model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     Yii::$app->session['post_id'] = $id;
     $querykomen = Comment::find()->where(['post_id' => $id]);
     $hitungkomen = clone $querykomen;
     $page = new Pagination(['totalCount' => $hitungkomen->count()]);
     $komen = $querykomen->offset($page->offset)->limit($page->limit)->all();
     $namaKomen = "";
     foreach ($komen as $komens) {
         $namaKomen = $komens->nama;
     }
     $nama = $this->findModel($id)->nama;
     $usr = new \common\models\User();
     $fotoPost = $usr->find()->where(['nama' => $nama])->all();
     $fotoKomen = $usr->find()->where(['nama' => $namaKomen])->all();
     return $this->render('view', ['model' => $this->findModel($id), 'komen' => $komen, 'fotoPost' => $fotoPost, 'fotoKomen' => $fotoKomen, 'page' => $page]);
 }
 public function actionValidate_txn()
 {
     //  $propBooking=new PropBooking;
     $ipnObject = new \frontend\components\IpnListener();
     $ipnObject->use_sandbox = true;
     //$model = \common\models\User::findOne(['id'=>5]);
     //$model->save(FALSE);
     try {
         $ipnObject->requirePostMethod();
         $verified = $ipnObject->processIpn();
         //echo $verified;
     } catch (\Exception $e) {
         error_log($e->getMessage());
         exit(0);
     }
     if ($verified) {
         if (!empty($_REQUEST)) {
             //$txnId=$_REQUEST['txn_id'];
             // $bookingCheck=  PropBooking::model()->find("pb_txnno='$txnId'");
             $model = new \common\models\User();
             $user = $model->saveUser($_REQUEST);
             $userAddressModel = new \common\models\UserAddress();
             $userAddressModel->user_id = $user->id;
             $userAddressModel->save();
             $userProfileModel = new \common\models\UserProfile();
             $userProfileModel->user_id = $user->id;
             $userProfileModel->save();
             $transactionModel = new \common\models\UserTransaction();
             $transactionDetails = $transactionModel->saveTransaction($user->id, $_REQUEST);
             $subscriptionModel = new \common\models\Subscription();
             $subscriptionDetails = $subscriptionModel->saveSubscription($user->id, $transactionDetails->id, $_REQUEST);
             $customData = explode('||', $_REQUEST['custom']);
             if (isset($customData[5]) && $customData[5] != '') {
                 $couponModel = new \common\models\CouponHistory();
                 $couponModel->saveHistory($user->id, $_REQUEST, $transactionDetails->txn_id);
             }
         }
         return $this->redirect(['index']);
         //$resultAmnt=$this->property_model->check_price($price, $id);
     } else {
         //$this->payment_cancelled();
         //echo "payment is not verified";
     }
 }
Exemple #10
0
 public function save($runValidation = true, $attributeNames = NULL)
 {
     $is = false;
     try {
         if ($this->validate()) {
             $user = new \common\models\User();
             $user->username = $this->username;
             $user->email = $this->email;
             if ($this->isNewRecord) {
                 $user->setPassword($this->password);
                 $user->generateAuthKey();
                 $user->status = $this->status == 1 ? 10 : 0;
                 if ($user->save()) {
                     $this->save_assignment($user->id);
                 }
             }
         }
         $is = true;
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     return true;
 }
 private function setRoot()
 {
     $model = \common\models\User::find()->andWhere('id = 1')->one();
     if (empty($model)) {
         $model = new \common\models\User();
         $model->id = 1;
         $model->username = '******';
         $model->password = '******';
         $model->email = '*****@*****.**';
         $model->status = 10;
         $model->language = 'en-US';
         $model->setPassword($model->password);
         $model->generateAuthKey();
         $model->save(false);
     }
 }
use common\widgets\elfinder\InputFile;
use yii\bootstrap\Modal;
use mihaildev\elfinder\ElFinder;
use yii\web\JsExpression;
/**
 * @var yii\web\View $this
 * @var common\models\Post $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="post-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Заголовок...', 'maxlength' => 255]], 'intro' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => \vova07\imperavi\Widget::className(), 'options' => ['settings' => ['toolbarFixed' => false, 'minHeight' => 100, 'plugins' => ['elfinder', 'fontcolor']]]], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => \vova07\imperavi\Widget::className(), 'options' => ['settings' => ['toolbarFixed' => false, 'minHeight' => 100]]], 'user_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\User::find()->all(), 'id', 'username'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'category_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\PostCategory::find()->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'state_index' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => (new common\models\Post())->getStateIndexList(), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'main_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Главная...']], 'noforeign_id' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Noforeign ID...', 'maxlength' => 11]], 'created_datetime' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATETIME]], 'start_date' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATE]], 'start_time' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_TIME]], 'preview_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'news']], 'doc_file' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'news']]]]);
/*
        ?>
        <script>
              if (!RedactorPlugins) var RedactorPlugins = {};
              RedactorPlugins.elfinder = function()
              {
                  return {
                      init: function()
                      {
                          var elfinder = this.button.add('elfinder', 'Elfinder');
                          this.button.setAwesome('elfinder', 'fa-elfinder');
                          this.button.addCallback(elfinder, this.elfinder.openElfinder);
                      },
                      openElfinder: function()
                      {
Exemple #13
0
                </div>
           <div class="tab-pane vertical-pad" id="photo">

             <?php 
echo $form->field($model, 'image')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png']]]);
?>
           </div> <!-- end of upload photo tab -->
           <div class="form-group">
               <?php 
echo Html::submitButton(Yii::t('frontend', 'Save Settings'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
           </div>
         </div> <!-- end tab content -->
         </div> <!--end left col -->
         <div class="col-md-4">
           <?php 
if ($model->avatar != '') {
    echo '<img src="' . Yii::getAlias('@web') . '/uploads/avatar/sqr_' . $model->avatar . '" class="profile-image"/>';
} else {
    echo \cebe\gravatar\Gravatar::widget(['email' => common\models\User::find()->where(['id' => Yii::$app->user->getId()])->one()->email, 'options' => ['class' => 'profile-image', 'alt' => common\models\User::find()->where(['id' => Yii::$app->user->getId()])->one()->username], 'size' => 128]);
}
?>
           
           
         </div> <!--end rt col -->
    <?php 
ActiveForm::end();
?>

</div>
Exemple #14
0
    <section class="col-lg-9 connectedSortable ui-sortable">                                    

        <!-- Chat box -->
        <?php 
echo \sintret\chat\ChatRoom::widget(['url' => Url::to(['/ajax/send-chat']), 'userModel' => \common\models\User::className(), 'userField' => 'avatarImage']);
?>
        <!-- To Do List -->        
        <?php 
echo \sintret\todolist\ListView::widget(['url' => Url::to(['/ajax/todolist'])]);
?>

    </section><!-- /.Left col -->
    <div class="col-md-3">
        <?php 
$phone = [];
$users = common\models\User::find()->where(['status' => common\models\User::STATUS_ACTIVE])->all();
if ($users) {
    foreach ($users as $user) {
        if ($user->phone) {
            $invite[] = "{ id : '{$user->phone}', invite_type : 'PHONE' }";
        }
        $invite[] = "{ id : '{$user->email}', invite_type : 'EMAIL' }";
    }
}
$invites = implode(",", $invite);
//echo $invites;
?>


        <div class="col-md-12">
            <div class="box box-solid">
Exemple #15
0
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\bootstrap\Modal;
/* @var $this yii\web\View */
/* @var $model backend\models\Assignroles */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="assignroles-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
$user = new common\models\User();
?>
    <?php 
$dept = new common\models\Departments();
?>
    <?php 
$dept2 = \common\models\Departments::find()->all();
?>
    <?php 
$dept3count = \common\models\Assignroledetail::find()->where(['assignid' => $model->recid])->count();
$dept3 = \common\models\Assignroledetail::find()->where(['assignid' => $model->recid])->all();
?>
    <?php 
$role = new common\models\Roles();
?>
    
Exemple #16
0
    <?php 
$form = ActiveForm::begin(['id' => 'LocationNew', 'layout' => 'horizontal', 'enableClientValidation' => true, 'errorSummaryCssClass' => 'error-summary alert alert-error']);
?>

    <div class="">
        <?php 
$this->beginBlock('main');
?>

        <p>
            
			<?php 
echo $form->field($model, 'id')->textInput();
?>
			<?php 
echo $form->field($model, 'user_id')->dropDownList(\yii\helpers\ArrayHelper::map(common\models\User::find()->all(), 'id', 'id'), ['prompt' => 'Select']);
?>
			<?php 
echo $form->field($model, 'event_id')->dropDownList(\yii\helpers\ArrayHelper::map(common\models\event\Event::find()->all(), 'id', 'id'), ['prompt' => 'Select']);
?>
			<?php 
echo $form->field($model, 'provider_id')->dropDownList(\yii\helpers\ArrayHelper::map(common\models\location\LocationProvider::find()->all(), 'id', 'id'), ['prompt' => 'Select']);
?>
			<?php 
echo $form->field($model, 'title_from_provider')->textInput(['maxlength' => true]);
?>
			<?php 
echo $form->field($model, 'title_from_API')->textInput(['maxlength' => true]);
?>
			<?php 
echo $form->field($model, 'latitude')->textInput(['maxlength' => true]);
 /**
  * Registers a new user account. If registration was successful it will set flash message.
  *
  * @return bool
  */
 public function temporary()
 {
     /** @var User $user */
     $user = new \common\models\User();
     $user->username = '******' . substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 10)), 0, 10);
     $user->auth_key = Yii::$app->security->generateRandomString();
     $user->password_hash = Yii::$app->security->generateRandomString() . '_' . time();
     $user->password = Yii::$app->security->generateRandomString() . '_' . time();
     $user->email = Yii::$app->security->generateRandomString() . '@' . substr(str_shuffle(str_repeat("abcdefghijklmnopq", 4)), 0, 4) . '.com';
     $user->generatePasswordResetToken();
     $user->is_provider = 0;
     $user->registered_by();
     $user->generateInviteHash();
     $user->generatePhoneVerificationHash();
     $user->generateRoleCode();
     $user->created_at = time();
     $user->updated_at = time();
     $user->status = 10;
     if (!$user->temporary()) {
         return false;
     }
     return $user;
 }
Exemple #18
0
use kartik\select2\Select2;
use kartik\file\FileInput;
/* @var $this yii\web\View */
/* @var $student common\models\Student */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="student-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>


    <?php 
echo $form->field($student, 'user_id')->dropDownList(common\models\User::getMappedArray());
?>

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

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

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

    <?php 
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
/**
 * @var yii\web\View $this
 * @var common\models\Post $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="post-search">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'action' => ['index'], 'method' => 'get']);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Заголовок...', 'maxlength' => 255]], 'user_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\User::find()->all(), 'id', 'username'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'category_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\PostCategory::find()->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'state_index' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => (new common\models\Post())->getStateIndexList(), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'main_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Главная...']], 'noforeign_id' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Noforeign ID...', 'maxlength' => 11]], 'created_datetime' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATETIME]], 'start_date' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATE]], 'start_time' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_TIME]]]]);
?>
    <div class="form-group">
        <?php 
echo Html::a(Yii::t('app', 'Reset'), ['index'], ['class' => 'btn btn-default', 'style' => 'margin-left: 15px; margin-right: 10px']);
?>
        <?php 
echo Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']);
?>
    </div>

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

</div>
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
/**
 * @var yii\web\View $this
 * @var common\models\Order $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="order-search">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'action' => ['index'], 'method' => 'get']);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 2, 'attributes' => ['user_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\User::find()->all(), 'id', 'username'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'status_index' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => (new common\models\Order())->getStatusIndexList(), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]]]]);
?>
    <div class="form-group">
        <?php 
echo Html::a(Yii::t('app', 'Reset'), ['index'], ['class' => 'btn btn-default', 'style' => 'margin-left: 15px; margin-right: 10px']);
?>
        <?php 
echo Html::submitButton(Yii::t('app', Yii::t('app', 'Search')), ['class' => 'btn btn-default', 'onclick' => ' $.pjax.reload({container: "#w2", data: $("#w0").serialize()  }); return false;']);
?>
  
    </div>

    <?php 
ActiveForm::end();
?>
Exemple #21
0
 */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Events', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="event-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
$dataArray = $model->getAttributes();
$dataArray['phone'] = implode(', ', $model->getPhone());
$dataArray['mobile'] = implode(', ', $model->getMobile());
$dataArray['cityname'] = common\models\City::findOne($model->cityId)->name;
$dataArray['createdBy'] = common\models\User::findOne($model->createdBy)->firstname;
$dataArray['updatedBy'] = common\models\User::findOne($model->updatedBy)->firstname;
$dataArray['sourcename'] = $model->sourcename;
$dataArray['description'] = strip_tags(HTMLPurifier::process($model->description));
$dataArray['guid'] = 'http://timescity.com' . $model->guid;
?>

    <?php 
echo DetailView::widget(['model' => $dataArray, 'attributes' => ['name', ['attribute' => 'cityname', 'label' => 'City'], ['attribute' => 'sourcename', 'label' => 'Source'], ['attribute' => 'startDate', 'label' => 'Start Date', 'format' => 'date'], ['attribute' => 'endDate', 'label' => 'End Date', 'format' => 'date'], ['attribute' => 'startTime', 'label' => 'Start Time'], ['attribute' => 'endTime', 'label' => 'End Time'], 'description:ntext', 'phone', 'mobile', 'contactName', 'email:email', ['attribute' => 'url', 'label' => 'Event URL/Website', 'format' => 'url'], ['attribute' => 'shopurl', 'label' => 'FB URL', 'format' => 'url'], 'price', 'guid:url', 'createdOn', 'createdBy', 'updatedOn', 'updatedBy']]);
?>
    
    <?php 
echo WorkflowButtonsView::widget(['view' => $this, 'model' => $model]);
?>
</div>
Exemple #22
0
 /**
  * get user sysem integral by user id
  * @param int $userId
  * @return number <number, \backend\models\user>
  */
 public static function getUserSysIntegral($userId)
 {
     $user = new \common\models\User();
     return $user->getUserSysIntegral($userId);
 }
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
use common\widgets\edit\InputFile;
use common\widgets\edit\Redactor;
/**
 * @var yii\web\View $this
 * @var common\models\Order $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="order-form">

    <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['user_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\User::find()->all(), 'id', 'username'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'status_index' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => (new common\models\Order())->getStatusIndexList(), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'summ' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Сумма заказа...']], 'created_datetime' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATETIME]], 'finished_datetime' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATETIME]]]]);
echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']);
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']);
ActiveForm::end();
?>

</div>
Exemple #24
0
<?php

$params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php');
return ['as access' => ['class' => yii\filters\AccessControl::className(), 'rules' => [['actions' => ['login', 'error'], 'allow' => true, 'roles' => ['?']], ['allow' => true, 'matchCallback' => function ($rule, $action) {
    if (common\models\User::findOne(Yii::$app->user->id)) {
        return common\models\User::findOne(Yii::$app->user->id)->role->name === 'admin';
    }
}]]], 'id' => 'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\\controllers', 'bootstrap' => ['log'], 'modules' => [], 'components' => ['request' => ['csrfParam' => '_backendCSRF', 'csrfCookie' => ['httpOnly' => true, 'path' => '/admin']], 'user' => ['identityClass' => 'common\\models\\User', 'enableAutoLogin' => true, 'identityCookie' => ['name' => '_backendIdentity', 'path' => '/admin', 'httpOnly' => true]], 'session' => ['name' => 'BACKENDSESSID', 'cookieParams' => ['path' => '/admin']], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'errorHandler' => ['errorAction' => 'site/error'], 'urlManager' => ['class' => 'yii\\web\\UrlManager', 'showScriptName' => false, 'enablePrettyUrl' => true, 'rules' => ['<action:(login|logout)>' => 'site/<action>', '<controller:\\w+>/<id:\\d+>' => '<controller>/view', '<controller:\\w+>/<action:\\w+>/<id:\\d+>' => '<controller>/<action>', '<controller:\\w+>/<action:\\w+>' => '<controller>/<action>']]], 'params' => $params];
Exemple #25
0
         // return ['class' => 'success', ];
         return ['style' => ' color:white; background-color:#BDBDBD; font-family:"Comic Sans MS"; '];
     }
 }, 'columns' => [['attribute' => '#', 'contentOptions' => ['style' => 'width: 50px;'], 'format' => 'raw', 'value' => function ($model, $index, $key) {
     if ($model->date == " ") {
         return "Total";
     } else {
         return ++$key;
         // ++ dnum enq vor 0-ic chsksi hamarakalumy
     }
 }], ['attribute' => 'user', 'value' => function ($model) {
     if ($model->date == " ") {
         return " ";
     } else {
         $user_id = $model->user_id;
         return common\models\User::findIdentity($user_id)->username;
     }
 }], ['attribute' => 'revenue', 'value' => function ($model) {
     return number_format($model->revenue);
 }], ['attribute' => 'expense_on_goods', 'value' => function ($model) {
     return number_format($model->expense_on_goods);
 }], ['attribute' => 'other_expenses', 'value' => function ($model) {
     return number_format($model->other_expenses);
 }], ['attribute' => 'salary', 'value' => function ($model) {
     return number_format($model->salary);
 }], ['attribute' => 'day_type', 'value' => function ($model) {
     if ($model->date == " ") {
         return " ";
     } else {
         return $model->day_type ? "Working day" : "Non-working day";
     }
 /**
  * 生成管理员
  * @param type $db
  */
 private function insertAdmin($db)
 {
     $username = LsYii::getPostValue('username');
     $password = LsYii::getPostValue('password');
     $email = LsYii::getPostValue('email');
     $tbPre = $db->tablePrefix;
     $user = new \common\models\User();
     $user->scenario = 'create';
     $user->username = $username;
     $user->password = $password;
     $user->email = $email;
     $user->role = 'administrator';
     $user->status = Constants::Status_Enable;
     $user->save();
 }
Exemple #27
0
use kartik\widgets\ActiveForm;
use kartik\select2\Select2;
// or kartik\select2\Select2
use kartik\checkbox\CheckboxX;
use yii\web\JsExpression;
use yii\helpers\ArrayHelper;
use yii\data\Pagination;
use common\models\CsServices;
use frontend\widgets\ServiceBox;
use dosamigos\google\maps\LatLng;
use dosamigos\google\maps\overlays\InfoWindow;
use dosamigos\google\maps\overlays\Marker;
use dosamigos\google\maps\Map;
use dosamigos\google\maps\overlays\Circle;
$model = common\models\User::findOne(1);
$model2 = common\models\User::findOne(22);
$coord = new LatLng(['lat' => $model->location->lat, 'lng' => $model->location->lng]);
$map = new Map(['center' => $coord, 'zoom' => 10]);
$map->width = '100%';
$map->height = '431';
// Lets add a marker now
$marker = new Marker(['position' => $coord, 'title' => 'My Home Town']);
// Lets add a marker now
$circle = new Circle(['center' => $coord, 'radius' => 3000]);
// Add marker to the map
$map->addOverlay($marker);
$map->addOverlay($circle);
$map2 = new Map(['center' => $coord, 'zoom' => 14]);
$map2->width = '100%';
$map2->height = '176';
// Lets add a marker now
Exemple #28
0
 public static function getUserIdByUsername($usename)
 {
     $model = new \common\models\User();
     $userId = $model->findIdByUsername($usename);
     if (!empty($userId)) {
         return $userId->id;
     } else {
         return '';
     }
 }