Exemple #1
0
 public function actionUpdate($id = 0)
 {
     //      $out = ['status' => 'err', 'error' => 'Unknown error'];
     if (\Yii::$app->user->isGuest) {
         throw new NotFoundHttpException();
     }
     $r = new Request();
     if ($r->post('Company')['id']) {
         $id = $r->post('Company')['id'];
     }
     //      vd($r->post('Company'));
     $userID = \Yii::$app->user->getId();
     if ($id) {
         $company = Company::findOne(['id' => $id, 'user_id' => $userID]);
     } else {
         $company = new Company();
         //        \Yii::$app->session->setFlash('error', 'Company ID is required.');
         //        $this->redirect(array('view','id'=>$company));
         //        $this->redirect(array('index'));
         //        return;
     }
     //        vd($company);
     if ($company) {
         if ($company->load($r->post())) {
             $company->user_id = $userID;
             if ($company->validate() && $company->save()) {
                 //vd([$r->post(),$order->attributes]);
                 //          $out = [
                 //            'status' => 'ok',
                 //            'order' => $order->id,
                 //            'user' => $order->user_id,
                 //            'sum' => $order->price / 100,
                 //          ];
                 //          $this->redirect(array('view','id'=>$company));
             } else {
                 //          vd($company->errors);
                 \Yii::$app->session->setFlash('error', array_values($company->errors)[0][0]);
                 //          $out['error'] = array_values($order->errors)[0][0];
                 //vd($order->errors);
             }
         }
     } else {
         \Yii::$app->session->setFlash('error', 'Такой компании не существует');
         $this->redirect(array('index'));
         return;
     }
     return $this->render('update', ['company' => $company]);
     //      \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     //      return $out;
     /*vd(['get' => $r->getQueryParams() ,
       'post' => $r->post(),
       'order' => $order],1); //*/
 }
 public function actionEdit($id)
 {
     $model = Company::findOne($id);
     if ($model) {
         throw new NotFoundHttpException();
     }
     return $this->showForm($this->updateWithPostRequest($model));
 }
 /**
  * Creates data provider instance with search query applied
  * @return ActiveDataProvider
  */
 public function search()
 {
     $query = Company::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'address', $this->address]);
     return $dataProvider;
 }
 public function actionSave()
 {
     $model = new OrderSaver(['modelClass' => Company::className()]);
     if ($model->load(\Yii::$app->request->post())) {
         if ($model->validate()) {
             $model->save();
             \Yii::$app->session->setFlash('success', 'Порядок отображения успешно сохранен.');
         } else {
             \Yii::$app->session->setFlash('danger', 'Порядок сохранить не удалось.');
         }
     }
     return $this->render('save', ['model' => $model]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Company::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }
Exemple #6
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Company::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'slider_amount' => $this->slider_amount, 'created_date' => $this->created_date, 'last_modified_date' => $this->last_modified_date]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'about_us', $this->about_us])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'longitude', $this->longitude])->andFilterWhere(['like', 'latitude', $this->latitude])->andFilterWhere(['like', 'twitter_url', $this->twitter_url])->andFilterWhere(['like', 'facebook_url', $this->facebook_url])->andFilterWhere(['like', 'instagram_url', $this->instagram_url])->andFilterWhere(['like', 'gplus_url', $this->gplus_url])->andFilterWhere(['like', 'terms_and_condition', $this->terms_and_condition])->andFilterWhere(['like', 'purchashing_guide', $this->purchashing_guide])->andFilterWhere(['like', 'payment_guide', $this->payment_guide])->andFilterWhere(['like', 'delivery_guide', $this->delivery_guide])->andFilterWhere(['like', 'return_policy', $this->return_policy])->andFilterWhere(['like', 'privacy_policy', $this->privacy_policy])->andFilterWhere(['like', 'logo_path', $this->logo_path])->andFilterWhere(['like', 'favicon_path', $this->favicon_path])->andFilterWhere(['like', 'email_1', $this->email_1])->andFilterWhere(['like', 'email_2', $this->email_2])->andFilterWhere(['like', 'meta_tag', $this->meta_tag])->andFilterWhere(['like', 'meta_description', $this->meta_description])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'last_modified_by', $this->last_modified_by]);
     return $dataProvider;
 }
 /**
  * Регистрация пользователя.
  *
  * @return string
  */
 public function actionSignup()
 {
     $this->layout = 'single';
     if (!\Yii::$app->user->isGuest) {
         $this->goHome();
     }
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $company = new Company();
         if (!$company->save()) {
             // Невозможно создать компанию.
             $this->redirect('/signup');
         }
         // Установка дефолтных типов отказов от заявки.
         $defaultRefuseTypesLead = new DefaultRefuseTypesLeadInstallEvent();
         $defaultRefuseTypesLead->setCompanyId($company->getCompanyId());
         $this->trigger(self::EVENT_SIGNUP, $defaultRefuseTypesLead);
         $user = $model->signup($company->getCompanyId());
         if (Yii::$app->getUser()->login($user)) {
             return \Yii::$app->getResponse()->redirect('/');
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
    <small class="help-block"><span class="glyphicon glyphicon-info-sign"></span> Для получения информации о занятости
        переговрных помещений в других ВКС, дата и время совещания должны быть указаны полностью
    </small>

    <div class="form-group">

        <div class="row">

            <div class="col-lg-5">

                <div class="btn-group-vertical btn-block"
                     style="overflow-x: hidden; overflow-y: scroll; max-height: 300px">

                    <?php 
foreach (Company::find()->orderBy('order')->all() as $company) {
    ?>

                        <?php 
    echo Html::button($company->name, ['class' => 'btn btn-default vks-company', 'data' => ['id' => (string) $company->primaryKey, 'toggle' => 'tooltip', 'placement' => 'left', 'container' => '#vks-participants', 'title' => $company->address]]);
    ?>

                    <?php 
}
?>

                </div>

            </div>

            <div class="col-lg-7">
Exemple #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCompany()
 {
     return $this->hasOne(Company::className(), ['id' => 'company_id']);
 }
Exemple #10
0
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\JobsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '职位管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="jobs-index">

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

    <p>
        <?php 
echo Html::a('添加', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['attribute' => 'company_id', 'value' => function ($model) {
    $rtn = \common\models\Company::findModel($model->id);
    if ($rtn) {
        return $rtn->name;
    }
    return "未知";
}], 'zhiweiming', 'gongzuodiqu', 'zhiweixinzi', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Exemple #11
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Jobs */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="jobs-form">

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

    <?php 
echo $form->field($model, 'company_id')->dropDownList(yii\helpers\ArrayHelper::map(\common\models\Company::allCompany(), 'id', 'name'));
?>

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

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

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

    <?php 
Exemple #12
0
<div class="vks-room-form col-md-6">

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

    <?php 
echo $form->field($model, 'name');
?>

    <?php 
echo $form->field($model, 'shortName');
?>

    <?php 
echo $form->field($model, 'companyId')->widget(Select2::className(), ['data' => ViewHelper::items(Company::className(), '_id', 'name')]);
?>

    <?php 
echo $form->field($model, 'ahuConfirmation')->checkbox();
?>

    <?php 
echo $form->field($model, 'confirmPersonId')->widget(Select2::className(), ['data' => $model::confirmPersonList(), 'options' => ['placeholder' => 'Выберите пользователя ...'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <?php 
echo $form->field($model, 'supportEmailsInput');
?>

    <?php 
 /**
  * Finds the Faq model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Faq the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Company::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #14
0
 public function searchCompanyByContact($contactUserId)
 {
     $query = Company::find()->select('company.*')->innerJoin('contact', '`company`.`id` = `contact`.`company_id`')->where(['contact.user_id' => $contactUserId]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     return $dataProvider;
 }
 public function actionTest()
 {
     return Company::initCompanyTables();
 }
Exemple #16
0
 /**
  * @return array
  */
 public function rules()
 {
     return [[['name', 'shortName'], 'required'], ['companyId', 'exist', 'targetClass' => Company::className(), 'targetAttribute' => '_id'], ['ahuConfirmation', 'boolean'], ['ahuConfirmation', 'filter', 'filter' => function ($value) {
         return boolval($value);
     }], ['confirmPersonId', 'exist', 'targetClass' => User::className(), 'targetAttribute' => '_id'], ['supportEmailsInput', function ($attribute) {
         if ($this->{$attribute} === "") {
             $this->supportEmails = [];
             return;
         }
         $value = explode(';', trim($this->{$attribute}, ';'));
         $validator = new EachValidator(['rule' => ['email']]);
         if ($validator->validate($value)) {
             $this->supportEmails = $value;
         } else {
             $this->addError($attribute, "Неверный формат");
         }
     }, 'skipOnEmpty' => false], ['ipAddress', 'match', 'pattern' => '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/'], [['phone', 'contact', 'model', 'gatekeeperNumber', 'note'], 'safe'], [['companyId', 'confirmPersonId'], MongoIdValidator::className(), 'forceFormat' => 'object']];
 }
Exemple #17
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\Company;
use common\components\helpers\ViewHelper;
/* @var $this yii\web\View */
/* @var $model \app\models\VksParticipantSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Переговорные комнаты';
?>
<div class="vks-room-index">

    <div class="page-header"><h2><?php 
echo $this->title;
?>
</h2></div>

    <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span>', ['create'], ['class' => 'btn btn-sm btn-default']);
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $model, 'columns' => ['shortName', ['filter' => ViewHelper::items(Company::className(), '_id', 'name'), 'attribute' => 'companyId', 'value' => 'company.name'], 'ipAddress', 'note:ntext', ['class' => 'yii\\grid\\ActionColumn', 'contentOptions' => ['width' => '70px;']]]]);
?>

</div>
 public function actions()
 {
     return ['index' => ['class' => SearchAction::className(), 'modelClass' => VksCompanySearch::className()], 'create' => ['class' => CreateAction::className(), 'modelClass' => Company::className()], 'update' => ['class' => UpdateAction::className(), 'modelClass' => Company::className()], 'delete' => ['class' => DeleteAction::className(), 'modelClass' => Company::className()]];
 }