Ejemplo n.º 1
0
 public function search($params)
 {
     $query = Country::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->andFilterWhere([Country::tableName() . '.status' => '1']);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['Id' => $this->Id, 'status' => $this->status, 'createdOn' => $this->createdOn, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'countryCode', $this->countryCode]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::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]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'image', $this->image]);
     return $dataProvider;
 }
Ejemplo n.º 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::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(['country_id' => $this->country_id, 'status' => $this->status, 'ordering' => $this->ordering]);
     $query->andFilterWhere(['like', 'country_code', $this->country_code])->andFilterWhere(['like', 'country_code_2', $this->country_code_2])->andFilterWhere(['like', 'name_GB', $this->name_GB])->andFilterWhere(['like', 'name_RU', $this->name_RU]);
     return $dataProvider;
 }
Ejemplo n.º 4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::find()->notDeleted();
     $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, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'deleted' => $this->deleted]);
     $query->andFilterWhere(['like', 'iso2', $this->iso2])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'long_name', $this->long_name])->andFilterWhere(['like', 'iso3', $this->iso3])->andFilterWhere(['like', 'numcode', $this->numcode])->andFilterWhere(['like', 'un_member', $this->un_member])->andFilterWhere(['like', 'calling_code', $this->calling_code])->andFilterWhere(['like', 'cctld', $this->cctld]);
     return $dataProvider;
 }
Ejemplo n.º 5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Country::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, 'create_at' => $this->create_at, 'update_at' => $this->update_at, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'country', $this->country]);
     return $dataProvider;
 }
Ejemplo n.º 6
0
 public function actionCountry()
 {
     $this->stdout('Request API: Countries.', Console::FG_GREEN);
     $data = TravelPayoutsApi::getCountries();
     $_count = count($data);
     $this->stdout(' Get: ' . $_count . ' Countries.' . PHP_EOL, Console::FG_GREEN);
     Console::startProgress(0, $_count);
     $count = 0;
     $count_ = 0;
     foreach ($data as $value) {
         $name_translations = $value->name_translations;
         unset($value->name_translations);
         $country = Country::find()->where(['code' => $value->code])->one();
         if (!$country) {
             $this->stdout($value->code . ' ', Console::FG_YELLOW);
             $country = new Country();
             $country->attributes = (array) $value;
             $local = ['en-GB', 'en-AU', 'en-CA', 'en-NZ', 'en-IE', 'en-SG', 'en-IN'];
             foreach ($name_translations as $_key => $_name) {
                 if (array_search($_key, $local) === false) {
                     $country['name_' . $_key] = trim($_name);
                 }
             }
             if (!$country->save()) {
                 print_r($value);
                 print_r($country->errors);
                 return Controller::EXIT_CODE_ERROR;
             }
             $count++;
         } else {
             Console::updateProgress(++$count_, $_count);
         }
     }
     Console::endProgress();
     $this->stdout(PHP_EOL . 'Added: ' . $count . ' Countries.' . PHP_EOL, Console::FG_BLUE);
     return Controller::EXIT_CODE_NORMAL;
 }
Ejemplo n.º 7
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CountryModel::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'thumbnail', $this->thumbnail]);
     return $dataProvider;
 }
Ejemplo n.º 8
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Arbiter::find();
     $country = new Country();
     $arbiterTable = Arbiter::tableName();
     $countryTable = Country::tableName();
     $query->joinWith(['country' => function ($query) use($countryTable) {
         $query->from(['country' => $countryTable]);
     }]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     // enable sorting for the related columns
     $addSortAttributes = ["country.name"];
     foreach ($addSortAttributes as $addSortAttribute) {
         $dataProvider->sort->attributes[$addSortAttribute] = ['asc' => [$addSortAttribute => SORT_ASC], 'desc' => [$addSortAttribute => SORT_DESC]];
     }
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(["{$arbiterTable}.id" => $this->id]);
     $query->andFilterWhere(['like', "{$arbiterTable}.name", $this->name])->andFilterWhere(['like', 'country.name', $this->getAttribute('country.name')]);
     return $dataProvider;
 }
Ejemplo n.º 9
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Coach::find();
     $country = new Country();
     $coachTable = Coach::tableName();
     $countryTable = Country::tableName();
     $query->joinWith(['country' => function ($query) use($countryTable) {
         $query->from(['country' => $countryTable]);
     }]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     // enable sorting for the related columns
     $addSortAttributes = ["country.name"];
     foreach ($addSortAttributes as $addSortAttribute) {
         $dataProvider->sort->attributes[$addSortAttribute] = ['asc' => [$addSortAttribute => SORT_ASC], 'desc' => [$addSortAttribute => SORT_DESC]];
     }
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(["{$coachTable}.id" => $this->id, 'birthday' => $this->birthday, 'country_id' => $this->country_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', "{$coachTable}.name", $this->name])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'position', $this->position])->andFilterWhere(['like', 'notes', $this->notes])->andFilterWhere(['like', 'player_carrer', $this->player_carrer])->andFilterWhere(['like', 'coach_carrer', $this->coach_carrer])->andFilterWhere(['like', 'image', $this->image])->andFilterWhere(['like', 'country.name', $this->getAttribute('country.name')]);
     return $dataProvider;
 }
Ejemplo n.º 10
0
?>

<div class="command-form">

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

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

    <?php 
$availableCountries = [];
if (!$model->isNewRecord) {
    $country = Country::findOne($model->country_id);
    if (isset($country->id)) {
        $availableCountries = [$country->id => $country->name];
    }
}
echo $form->field($model, 'country_id')->widget(SelectizeDropDownList::classname(), ['loadUrl' => Url::to(['country/country-part-list']), 'items' => $availableCountries, 'options' => ['multiple' => false], 'clientOptions' => ['valueField' => 'value', 'labelField' => 'text', 'persist' => false]]);
?>

    <?php 
$pluginOptions = ['showUpload' => false, 'showRemove' => false, 'overwriteInitial' => true, 'browseLabel' => "Обзор...", 'allowedFileExtensions' => ['jpg', 'gif', 'png']];
$icon = $model->getAsset();
if (!$model->isNewRecord && $icon->getFileUrl()) {
    $pluginOptions['initialPreview'] = [Html::img($icon->getFileUrl())];
}
echo $form->field($model, 'icon')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*', 'multiple' => false], 'pluginOptions' => $pluginOptions]);
?>
Ejemplo n.º 11
0
echo $form->field($model, 'team_id')->dropDownList(DotaTeam::getTeamsListDropDown(), [$model->team_id, 'prompt' => '-- Select --']);
?>

    <?//= $form->field($model, 'profileurl')->textInput(['maxlength' => true]) ?>

    <?//= $form->field($model, 'timecreated')->textInput() ?>

    <?//= $form->field($model, 'avatar')->textInput(['maxlength' => true]) ?>

    <?//= $form->field($model, 'avatarmedium')->textInput(['maxlength' => true]) ?>

    <?//= $form->field($model, 'avatarfull')->textInput(['maxlength' => true]) ?>

    <?//= $form->field($model, 'country_id')->textInput() ?>
    <?php 
echo $form->field($model, 'country_id')->dropDownList(Country::getLeaguesListDropDown(), [$model->country_id]);
?>
    
    <?php 
echo $form->field($model, 'role_id')->dropDownList(DotaPlayerRole::getRolesListDropDown(), [$model->role_id]);
?>
    
    <?php 
echo $form->field($model, 'status')->dropDownList($model->statusValues, [$model->status]);
?>
    
    <?php 
echo $form->field($model, 'imageFiles')->fileInput();
?>
    <?php 
if ($model->foto != '') {
Ejemplo n.º 12
0
 /**
  * Finds the Country model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Country the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Country::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 13
0
 public function actionUpdate()
 {
     $errors = Country::updatePopulation('UA', rand(100000, 999999));
     return $this->render('update', ['errors' => $errors]);
 }
Ejemplo n.º 14
0
 /**
  * Display list of countries in json format
  *
  * @param string $q Query for search
  * @return mixed Json data
  */
 public function actionCountryPartList($query = null)
 {
     if ($query == null) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     $search = urldecode($query);
     $query = new Query();
     $query->select('id as value, name as text')->from(Country::tableName())->where(['like', 'name', $search])->orderBy(['name' => SORT_ASC])->limit(10);
     $command = $query->createCommand();
     $data = $command->queryAll();
     $out = array_values($data);
     header("Content-type: text/html; charset=utf-8");
     echo Json::encode($out);
 }
Ejemplo n.º 15
0
 public function getCountries()
 {
     //$criteria = new CDbCriteria();
     //$criteria->condition='status = 1';
     //$criteria->order = 'countryName ASC';
     $countryModel = Country::find()->where(['status' => 1])->orderBy(['countryName' => SORT_ASC])->all();
     //model()->findAll($criteria);
     $form->field($model, 'parent_id')->dropDownList(ArrayHelper::map(Product::find()->all(), 'countryID', 'countryName'));
     if ($countryModel) {
         $countryList = ArrayHelper::map($countryModel, 'countryID', 'countryName');
         //            $countryList = Html::listData($countryModel, 'countryID', 'countryName');
         return $countryList;
     }
     return false;
 }
Ejemplo n.º 16
0
 /**
  * [prepPayPalData description]
  *
  * Maps data from the two forms into the way the paypal component expects it.
  * 
  * @version 0.5.1
  * @since  0.5.1
  * @param  Purchase $param_data
  * @param  CCFormat $cc_data
  * @return array
  */
 private function prepPayPalData(Purchase $param_data, CCFormat $cc_data)
 {
     // todo This iteration is Paypal only. - DJE : 2015-04-11
     // Process the CC transaction
     $return_data['Address'] = ['City' => $param_data->getAttribute('city'), 'CountryCode' => Country::find('value')->where(['id' => $param_data->getAttribute('country_id')])->one()->getAttribute('key'), 'Line1' => $param_data->getAttribute('street_1'), 'Line2' => $param_data->getAttribute('street_2'), 'PostalCode' => $param_data->getAttribute('postal'), 'State' => $param_data->getAttribute('prov')];
     // Process the CC transaction
     $return_data['CreditCard'] = ['Cvv2' => $cc_data['cvv2'], 'FirstName' => $param_data->getAttribute('f_name'), 'LastName' => $param_data->getAttribute('l_name'), 'Month' => $cc_data['exp_month'], 'Number' => $cc_data['number'], 'Type' => $cc_data['type'], 'Year' => $cc_data['exp_year']];
     $subtotal = [];
     $subtotal[0] = isset(\Yii::$app->request->post()['Purchase']['time_amount_id']) ? TimeAmountOptions::find('value')->where(['id' => \Yii::$app->request->post()['Purchase']['time_amount_id']])->one()->getAttribute('cost') : 0;
     $subtotal[1] = isset(\Yii::$app->request->post()['Purchase']['device_count_id']) ? DeviceCountOptions::find('value')->where(['id' => \Yii::$app->request->post()['Purchase']['device_count_id']])->one()->getAttribute('cost') : 0;
     $return_data['Details']['SubTotal'] = array_sum($subtotal);
     return $return_data;
 }
Ejemplo n.º 17
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Country;
/* @var $this yii\web\View */
/* @var $model common\models\City */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="city-form">

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

    <?php 
echo $form->field($model, 'country_id')->dropDownList(Country::getMap());
?>

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

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Ejemplo n.º 18
0
 public function getShipfromname()
 {
     return $this->hasOne(\common\models\Country::className(), ['Cry_id' => 'shipfrom']);
 }
Ejemplo n.º 19
0
<?php 
echo $form->field($purchase_mdl, 'street_1')->label(false)->textInput(['maxlength' => 45, 'placeholder' => 'Street 1']);
?>

<?php 
echo $form->field($purchase_mdl, 'street_2')->label(false)->textInput(['maxlength' => 45, 'placeholder' => 'Street 2']);
?>

<?php 
echo $form->field($purchase_mdl, 'city')->label(false)->textInput(['maxlength' => 45, 'placeholder' => 'City']);
?>

<?php 
echo $form->field($purchase_mdl, 'prov')->label(false)->textInput(['maxlength' => 45, 'placeholder' => 'State / Prov.']);
?>

<?php 
echo $form->field($purchase_mdl, 'postal')->label(false)->textInput(['maxlength' => 45, 'placeholder' => 'ZIP / Postal Code']);
?>

<div class="form-group field-purchase-type required">
    <div class="col-sm-6 col-sm-offset-3">
        <?php 
echo Html::activeDropDownList($purchase_mdl, 'country_id', ArrayHelper::map(Country::find()->all(), 'id', 'value'), ['prompt' => '--Select Country--', 'class' => 'form-control']);
?>
    </div>
</div>

<?php 
echo $form->field($purchase_mdl, 'user_id')->label(false)->hiddenInput(['value' => Yii::$app->user->getIdentity()->getAttribute('id')]);
Ejemplo n.º 20
0
 /**
  * Updates an existing Hotel model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     //$this->allowAccess(Hotel::checkAccess($id));
     $model = $this->findModel($id);
     $languages = Lang::getAll();
     $roomTypes = RoomType::getRoomTypes();
     $department = Department::getAll();
     $modelHotelDepartmentMapping = new HotelDepartmentMapping();
     $modelHotelData = HotelData::getByHotelId($id);
     if (!$modelHotelData) {
         $modelHotelData = new HotelData();
     }
     $availableRooms = HotelRoomTypeMapping::getRoomTypesIdByHotelId($id);
     $hotelDepartments = HotelDepartmentMapping::getByHotelId($id);
     $modelHotelRoomTypeMapping = new HotelRoomTypeMapping();
     $countries = Country::getAllCountries();
     $savePath = Yii::getAlias($model::FILE_PATH);
     $imageDataProvider = new ArrayDataProvider(['models' => Image::getImagesByHotelId($id)]);
     if ($model->load(Yii::$app->request->post())) {
         //            $modelCity = City::getOrCreateByNameAndCountryId($_POST['Hotel']['cityName'], $model->country_id);
         //            $model->city_id = $modelCity->id;
         if ($model->save()) {
             foreach ($_POST['HotelRoomTypeMapping']['room_type_id'] as $roomTypeId) {
                 $hotelRoomTypeMappings = HotelRoomTypeMapping::getRoomTypeByHotelIdAndRoomTypeId($id, $roomTypeId);
                 if (!$hotelRoomTypeMappings) {
                     $modelHotelRoomTypeMapping = new HotelRoomTypeMapping();
                     $modelHotelRoomTypeMapping->setAttribute('hotel_id', $model->getAttribute('id'));
                     $modelHotelRoomTypeMapping->setAttribute('room_type_id', $roomTypeId);
                     $modelHotelRoomTypeMapping->save();
                 } elseif ($hotelRoomTypeMappings->getAttribute('deleted') === ActiveRecord::STATUS_DELETED) {
                     $hotelRoomTypeMappings->setAttribute('deleted', ActiveRecord::STATUS_NOT_DELETED);
                     $hotelRoomTypeMappings->save();
                 }
             }
             foreach ($languages as $key => $language) {
                 $modelHotelData = HotelData::getByLanguageIdAndHotelId($language->local, $id);
                 if ($modelHotelData) {
                     $modelHotelData->setAttribute('lang_id', Yii::$app->request->post('HotelData')['lang_id'][$key]);
                     $modelHotelData->setAttribute('description', Yii::$app->request->post('HotelData')['description'][$key]);
                     $modelHotelData->setAttribute('location', Yii::$app->request->post('HotelData')['location'][$key]);
                     $modelHotelData->setAttribute('price_information', Yii::$app->request->post('HotelData')['price_information'][$key]);
                     $modelHotelData->setAttribute('other', Yii::$app->request->post('HotelData')['other'][$key]);
                     $modelHotelData->save();
                 } else {
                     $modelHotelData = new HotelData();
                     $modelHotelData->setAttribute('hotel_id', $id);
                     $modelHotelData->setAttribute('lang_id', Yii::$app->request->post('HotelData')['lang_id'][$key]);
                     $modelHotelData->setAttribute('description', Yii::$app->request->post('HotelData')['description'][$key]);
                     $modelHotelData->setAttribute('location', Yii::$app->request->post('HotelData')['location'][$key]);
                     $modelHotelData->setAttribute('price_information', Yii::$app->request->post('HotelData')['price_information'][$key]);
                     $modelHotelData->setAttribute('other', Yii::$app->request->post('HotelData')['other'][$key]);
                     $modelHotelData->save();
                 }
             }
             foreach ($availableRooms as $room) {
                 if (!in_array($room, $_POST['HotelRoomTypeMapping']['room_type_id'])) {
                     $hotelRoomTypeMapping = HotelRoomTypeMapping::getRoomTypeByHotelIdAndRoomTypeId($id, $room);
                     $hotelRoomTypeMapping->setAttribute('deleted', ActiveRecord::STATUS_DELETED);
                     $hotelRoomTypeMapping->save();
                 }
             }
             foreach ($_POST['HotelDepartmentMapping']['department_id'] as $departmentId) {
                 $hotelDepartmentMapping = HotelDepartmentMapping::getByHotelIdAndDepartmentId($id, $departmentId);
                 if (!$hotelDepartmentMapping) {
                     $modelHotelDepartmentMapping = new HotelDepartmentMapping();
                     $modelHotelDepartmentMapping->setAttribute('hotel_id', $model->getAttribute('id'));
                     $modelHotelDepartmentMapping->setAttribute('department_id', $departmentId);
                     $modelHotelDepartmentMapping->save();
                 } elseif ($hotelDepartmentMapping->getAttribute('deleted') === ActiveRecord::STATUS_DELETED) {
                     $hotelDepartmentMapping->setAttribute('deleted', ActiveRecord::STATUS_NOT_DELETED);
                     $hotelDepartmentMapping->save();
                 }
             }
             foreach ($hotelDepartments as $department) {
                 if (!in_array($department, $_POST['HotelDepartmentMapping']['department_id'])) {
                     $modelHotelDepartmentMapping = HotelDepartmentMapping::getByHotelIdAndDepartmentId($id, $department);
                     $modelHotelDepartmentMapping->setAttribute('deleted', ActiveRecord::STATUS_DELETED);
                     $modelHotelDepartmentMapping->save();
                 }
             }
             $files = $model->loadFiles($model->fileAttribute);
             if ($files !== false) {
                 foreach ($files as $file) {
                     if ($file->saveAs($savePath . $file->name)) {
                         $image = new Image();
                         $image->setAttribute('name', $file->name);
                         $image->setAttribute('hotel_id', $id);
                         $image->setAttribute('path', $model::FILE_PATH . $file->name);
                         $image->save();
                     }
                 }
             }
             if ($model->preview_image_id === 0 || $model->preview_image_id === null) {
                 $model->setAttribute('preview_image_id', !empty($image) ? $image->id : $model::IMAGE_NOT_SET);
                 $model->save();
             }
             return $this->redirect(['view', 'id' => $model->id]);
         }
     }
     return $this->render('update', ['model' => $model, 'modelHotelData' => $modelHotelData, 'modelHotelRoomTypeMapping' => $modelHotelRoomTypeMapping, 'roomTypes' => $roomTypes, 'countries' => $countries, 'availableRooms' => $availableRooms, 'hotelDepartments' => $hotelDepartments, 'imageDataProvider' => $imageDataProvider, 'department' => $department, 'modelHotelDepartmentMapping' => $modelHotelDepartmentMapping, 'languages' => $languages]);
 }
Ejemplo n.º 21
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCountry()
 {
     return $this->hasOne(Country::className(), ['id' => 'country_id']);
 }
Ejemplo n.º 22
0
/* @var $searchModel app\models\CitySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Cities';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="city-index">

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

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

    <?php 
Pjax::begin();
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', ['attribute' => 'country_id', 'value' => function ($data) {
    return $data->country ? $data->country->name : null;
}, 'filter' => Country::getMap()], ['class' => 'yii\\grid\\ActionColumn']]]);
Pjax::end();
?>

</div>
Ejemplo n.º 23
0
?>

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

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

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

    <?php 
echo $form->field($model, 'country_id')->dropDownList(Country::getMapWithHeader(['Germany']), ['prompt' => Yii::t('general', 'Please select')]);
?>

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

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

    <?php 
echo $form->field($model, 'special_request')->textarea(['rows' => 6]);
?>

    <div class="form-group">
Ejemplo n.º 24
0
echo $form->field($model, 'position')->textInput(['maxlength' => true]);
?>
    
    <?php 
echo $form->field($model, 'notes')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['fullscreen', 'table', 'video', 'fontcolor']]]);
?>

    <?php 
echo $form->field($model, 'player_carrer')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['fullscreen', 'table', 'video', 'fontcolor']]]);
?>

    <?php 
echo $form->field($model, 'coach_carrer')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['fullscreen', 'table', 'video', 'fontcolor']]]);
?>

    <?php 
echo $form->field($model, 'country_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Country::find()->orderBy(['name' => SORT_ASC])->all(), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите страну...'], 'pluginOptions' => ['allowClear' => true]]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Добавить' : 'Изменить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

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

</div>
Ejemplo n.º 25
0
$this->registerJsFile('@web/js/grid/main.js', ['depends' => ['yii\\web\\JqueryAsset']]);
?>
<div class="registration-index">
    <?php 
$gridColumns = [['class' => '\\kartik\\grid\\SerialColumn'], ['class' => '\\kartik\\grid\\ActionColumn', 'template' => '{view} {update} {cancel} {delete}', 'buttons' => ['cancel' => function ($key, $model) {
    $customUrl = Yii::$app->getUrlManager()->createUrl(['registration/cancel-admin', 'id' => $model->id]);
    return Html::a('<span class="glyphicon glyphicon-ban-circle"></span>', $customUrl, ['title' => Yii::t('app', 'Cancel'), 'data-pjax' => '0', 'confirm' => Yii::t('app', 'Do you really want cancel registration?')]);
}, 'delete' => function ($key, $model) {
    $customUrl = Yii::$app->getUrlManager()->createUrl(['registration/delete-admin', 'id' => $model->id]);
    return Html::a('<span class="glyphicon glyphicon-trash"></span>', $customUrl, ['title' => Yii::t('app', 'Delete'), 'data-pjax' => '0', 'confirm' => Yii::t('app', 'Do you really want delete registration?')]);
}], 'header' => '<span class="glyphicon glyphicon-info-sign"></span>', 'headerOptions' => ['style' => 'min-width:50px;']], ['attribute' => 'status', 'value' => function ($data) {
    return array_key_exists($data->status, Registration::$reverseStatus) ? Registration::$reverseStatus[$data->status] : null;
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => Registration::$statusNames + ['' => 'All']], 'headerOptions' => ['style' => 'min-width:115px;']], 'code', ['attribute' => 'title', 'value' => function ($data) {
    return Yii::t('general', $data->title);
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => Registration::getTitles(), 'options' => ['prompt' => Yii::t('general', 'All')]], 'width' => '250px'], 'first_name', 'last_name', 'company', 'department', 'street', 'zip', 'city', ['attribute' => 'country_id', 'value' => function ($data) {
    return $data->country ? $data->country->name : null;
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => Country::getMap(), 'options' => ['prompt' => Yii::t('general', 'All')]], 'headerOptions' => ['style' => 'min-width:150px;']], 'email:email', 'phone', ['attribute' => 'department_id', 'value' => function ($data) {
    return $data->departmentRel ? $data->departmentRel->name : null;
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => Department::getMap(), 'options' => ['prompt' => Yii::t('general', 'All')]], 'width' => '250px'], ['attribute' => 'hotel_id', 'value' => function ($data) {
    return $data->hotel ? $data->hotel->name : null;
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => Hotel::getMap(), 'options' => ['prompt' => Yii::t('general', 'All')]], 'headerOptions' => ['style' => 'min-width:155px;']], ['attribute' => 'check_in', 'format' => ['date', 'php:d/m/Y'], 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => Registration::getCheckIn(), 'options' => ['prompt' => Yii::t('general', 'All')]], 'headerOptions' => ['style' => 'min-width:115px;']], ['attribute' => 'check_out', 'format' => ['date', 'php:d/m/Y'], 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => Registration::getCheckOut(), 'options' => ['prompt' => Yii::t('general', 'All')]], 'headerOptions' => ['style' => 'min-width:115px;']], ['attribute' => 'room_type_id', 'value' => function ($data) {
    return $data->roomType ? $data->roomType->name : null;
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => \common\models\RoomType::getMap(), 'options' => ['prompt' => Yii::t('general', 'All')]]], ['attribute' => 'room_rate', 'value' => function ($data) {
    return Registration::generateRoomRate($data->room_rate);
}, 'format' => 'raw'], ['attribute' => 'special_request', 'hidden' => true], ['attribute' => 'updated_at', 'format' => ['date', 'php:h:i:s A d-m-Y']], ['attribute' => 'id', 'hiddenFromExport' => true, 'headerOptions' => ['style' => 'min-width:80px;']]];
// Generate a bootstrap responsive striped table with row highlighted on hover
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'responsive' => true, 'hover' => true, 'columns' => $gridColumns, 'pjax' => true, 'resizableColumns' => false, 'toolbar' => [Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['index'], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid')]), '{export}', '{toggleData}'], 'toggleDataOptions' => ['default' => 'all'], 'panelBeforeTemplate' => '<div class="pull-right"><div class="btn-toolbar kv-grid-toolbar" role="toolbar"><span class="pager-mini">{pager}</span>{toolbar}</div></div>{before}<div class="clearfix"></div>', 'panelAfterTemplate' => '{after}<span class="pager-mini clearfix">{pager}</span>', 'panel' => ['type' => GridView::TYPE_PRIMARY, 'heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-user"></i> Registrations</h3>', 'before' => Html::a('<i class="glyphicon glyphicon-list-alt"></i> Hotel Rooming List', ['hotel-rooming'], ['class' => 'btn btn-primary']), 'footer' => false], 'exportConfig' => [GridView::EXCEL => [], GridView::CSV => ['config' => ['colDelimiter' => ';', 'rowDelimiter' => "\r\n"]], GridView::PDF => []], 'beforeHeader' => [['columns' => [['options' => ['colspan' => 3]], ['content' => 'Personal Data', 'options' => ['colspan' => 12, 'class' => 'text-center warning']], ['content' => 'Hotel Information', 'options' => ['colspan' => 6, 'class' => 'text-center warning']]], 'options' => ['class' => 'skip-export']]]]);
?>

</div>