Commit ba4a83b7 by dianc

Merge remote-tracking branch 'origin/development' into development

# Conflicts:
#	backend/modules/theme/views/category/_form.php
parents 9f2151e4 a8682a9a
...@@ -34,6 +34,12 @@ $config = [ ...@@ -34,6 +34,12 @@ $config = [
], ],
], ],
'modules' => [ 'modules' => [
'business' => [
'class' => 'backend\modules\business\Module',
],
'location' => [
'class' => 'backend\modules\location\Module',
],
'i18n' => [ 'i18n' => [
'class' => 'backend\modules\i18n\Module', 'class' => 'backend\modules\i18n\Module',
'defaultRoute' => 'i18n-message/index' 'defaultRoute' => 'i18n-message/index'
......
<?php
namespace backend\modules\business;
/**
* business module definition class
*/
class Module extends \yii\base\Module
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'backend\modules\business\controllers';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}
<?php
namespace backend\modules\business\controllers;
use yii\web\Controller;
/**
* Default controller for the `business` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}
<div class="business-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>
<?php
namespace backend\modules\location;
/**
* location module definition class
*/
class Module extends \yii\base\Module
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'backend\modules\location\controllers';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}
<?php
namespace backend\modules\location\controllers;
use yii\web\Controller;
/**
* Default controller for the `location` module
*/
class DefaultController extends Controller
{
/**
* Renders the index view for the module
* @return string
*/
public function actionIndex()
{
return $this->render('index');
}
}
<div class="location-default-index">
<h1><?= $this->context->action->uniqueId ?></h1>
<p>
This is the view content for action "<?= $this->context->action->id ?>".
The action belongs to the controller "<?= get_class($this->context) ?>"
in the "<?= $this->context->module->id ?>" module.
</p>
<p>
You may customize this page by editing the following file:<br>
<code><?= __FILE__ ?></code>
</p>
</div>
...@@ -30,57 +30,56 @@ use trntv\filekit\widget\Upload; ...@@ -30,57 +30,56 @@ use trntv\filekit\widget\Upload;
<div class="page-header"> <div class="page-header">
<h3>Info</h3> <h3>Info</h3>
</div> </div>
<div class="row">
<div class="row"> <div class="col-md-6">
<div class="col-md-6">
<?php echo $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'description')->textarea(['rows' => '7']) ?>
</div> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
<div class="row"> </div>
<div class="col-md-6"> </div>
<?= $form->field($model, 'image')->widget( <div class="row">
Upload::className(), <div class="col-md-6">
[
'url' => ['/file-storage/upload'],
])->label('Image');
?>
</div>
</div>
<div class="row"> <?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]) ?>
<div class="col-md-6">
<?= $form->field($model, 'status')->dropDownList($model::statuses(), ['prompt' => '']) ?>
</div>
</div>
<div class="form-group"> </div>
<?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div> </div>
<div class="row">
<div class="col-md-6">
<?php echo $form->field($model, 'description')->textarea(['rows' => '7']) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'image')->widget(
Upload::className(),
[
'url' => ['/file-storage/upload'],
])->label('Image');
?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'status')->dropDownList($model::statuses(), ['prompt' => '']) ?>
</div>
</div>
<div class="form-group">
<?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend',
'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div>
<div class="tab-pane fade in" id="files"> <div class="tab-pane fade in" id="files">
<div class="page-header"> <div class="page-header">
<h3>Files</h3> <h3>Files</h3>
</div> </div>
</div> </div>
</div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </div>
</div>
<?php
use yii\db\Migration;
class m160831_080848_location extends Migration
{
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%state}}', [
'id' => $this->primaryKey(),
'name' => $this->string(1024)->notNull(),
'slug' => $this->string(1024),
'status' => $this->smallInteger(6),
'created_at' => $this->integer(11),
'updated_at' => $this->integer(11),
], $tableOptions);
$this->createTable('{{%district}}', [
'id' => $this->primaryKey(),
'state_id' => $this->integer()->notNull(),
'name' => $this->string(1024)->notNull(),
'slug' => $this->string(1024),
'status' => $this->smallInteger(6),
'created_at' => $this->integer(11),
'updated_at' => $this->integer(11),
], $tableOptions);
$this->createIndex('idx_state_name', '{{%state}}', 'name');
$this->createIndex('idx_district_name', '{{%district}}', 'name');
$this->addForeignKey('fk_state_id', '{{%district}}', 'state_id', '{{%state}}', 'id', 'RESTRICT', 'RESTRICT');
}
public function safeDown()
{
$this->dropForeignKey('fk_state_id', '{{%district}}');
$this->dropIndex('idx_district_name', '{{%district}}');
$this->dropIndex('idx_state_name', '{{%state}}');
$this->dropTable('{{%district}}');
$this->dropTable('{{%state}}');
}
}
<?php
use yii\db\Migration;
class m160831_092919_business extends Migration
{
public function safeUp()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%business}}', [
'id' => $this->primaryKey(),
'category_id' => $this->integer(),
'district_id' => $this->integer(),
'domain_name' => $this->string(255)->notNull(),
'name' => $this->string(512)->notNull(),
'slug' => $this->string(1024),
'address' => $this->string(1024)->notNull(),
'landmark' => $this->string(500),
'mobile_no' => $this->string(512)->notNull(),
'toll_free_no' => $this->string(512),
'contact_no' => $this->string(150),
'fax' => $this->string(512),
'email' => $this->string(1024)->notNull(),
'description' => $this->text(),
'logo_base_url' => $this->string(1024),
'logo_path' => $this->string(1024),
'latitude' => $this->string(30),
'logitude' => $this->string(30),
'status' => $this->smallInteger(6),
'created_at' => $this->integer(11),
'updated_at' => $this->integer(11),
], $tableOptions);
$this->createIndex('idx_business_domain_name', '{{%business}}', 'domain_name');
$this->createIndex('idx_business_email', '{{%business}}', 'email');
$this->addForeignKey('fk_category_id', '{{%business}}', 'category_id', '{{%category}}', 'id', 'RESTRICT', 'RESTRICT');
$this->addForeignKey('fk_district_id', '{{%business}}', 'district_id', '{{%district}}', 'id', 'RESTRICT', 'RESTRICT');
}
public function safeDown()
{
$this->dropForeignKey('fk_district_id', '{{%business}}');
$this->dropForeignKey('fk_category_id', '{{%business}}');
$this->dropIndex('idx_business_email', '{{%business}}');
$this->dropIndex('idx_business_domain_name', '{{%business}}');
$this->dropTable('{{%business}}');
}
}
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "{{%business}}".
*
* @property integer $id
* @property integer $category_id
* @property integer $district_id
* @property string $domain_name
* @property string $name
* @property string $slug
* @property string $address
* @property string $landmark
* @property string $mobile_no
* @property string $toll_free_no
* @property string $contact_no
* @property string $fax
* @property string $email
* @property string $description
* @property string $logo_base_url
* @property string $logo_path
* @property string $latitude
* @property string $logitude
* @property integer $status
* @property integer $created_at
* @property integer $updated_at
*
* @property Category $category
* @property District $district
*/
class Business extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%business}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['category_id', 'district_id', 'status', 'created_at', 'updated_at'], 'integer'],
[['domain_name', 'name', 'address', 'mobile_no', 'email'], 'required'],
[['description'], 'string'],
[['domain_name'], 'string', 'max' => 255],
[['name', 'mobile_no', 'toll_free_no', 'fax'], 'string', 'max' => 512],
[['slug', 'address', 'email', 'logo_base_url', 'logo_path'], 'string', 'max' => 1024],
[['landmark'], 'string', 'max' => 500],
[['contact_no'], 'string', 'max' => 150],
[['latitude', 'logitude'], 'string', 'max' => 30],
[['category_id'], 'exist', 'skipOnError' => true, 'targetClass' => Category::className(), 'targetAttribute' => ['category_id' => 'id']],
[['district_id'], 'exist', 'skipOnError' => true, 'targetClass' => District::className(), 'targetAttribute' => ['district_id' => 'id']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('common', 'ID'),
'category_id' => Yii::t('common', 'Category ID'),
'district_id' => Yii::t('common', 'District ID'),
'domain_name' => Yii::t('common', 'Domain Name'),
'name' => Yii::t('common', 'Name'),
'slug' => Yii::t('common', 'Slug'),
'address' => Yii::t('common', 'Address'),
'landmark' => Yii::t('common', 'Landmark'),
'mobile_no' => Yii::t('common', 'Mobile No'),
'toll_free_no' => Yii::t('common', 'Toll Free No'),
'contact_no' => Yii::t('common', 'Contact No'),
'fax' => Yii::t('common', 'Fax'),
'email' => Yii::t('common', 'Email'),
'description' => Yii::t('common', 'Description'),
'logo_base_url' => Yii::t('common', 'Logo Base Url'),
'logo_path' => Yii::t('common', 'Logo Path'),
'latitude' => Yii::t('common', 'Latitude'),
'logitude' => Yii::t('common', 'Logitude'),
'status' => Yii::t('common', 'Status'),
'created_at' => Yii::t('common', 'Created At'),
'updated_at' => Yii::t('common', 'Updated At'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCategory()
{
return $this->hasOne(Category::className(), ['id' => 'category_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getDistrict()
{
return $this->hasOne(District::className(), ['id' => 'district_id']);
}
/**
* @inheritdoc
* @return \common\models\query\BusinessQuery the active query used by this AR class.
*/
public static function find()
{
return new \common\models\query\BusinessQuery(get_called_class());
}
}
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "{{%district}}".
*
* @property integer $id
* @property integer $state_id
* @property string $name
* @property string $slug
* @property integer $status
* @property integer $created_at
* @property integer $updated_at
*
* @property Business[] $businesses
* @property State $state
*/
class District extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%district}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['state_id', 'name'], 'required'],
[['state_id', 'status', 'created_at', 'updated_at'], 'integer'],
[['name', 'slug'], 'string', 'max' => 1024],
[['state_id'], 'exist', 'skipOnError' => true, 'targetClass' => State::className(), 'targetAttribute' => ['state_id' => 'id']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('common', 'ID'),
'state_id' => Yii::t('common', 'State ID'),
'name' => Yii::t('common', 'Name'),
'slug' => Yii::t('common', 'Slug'),
'status' => Yii::t('common', 'Status'),
'created_at' => Yii::t('common', 'Created At'),
'updated_at' => Yii::t('common', 'Updated At'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getBusinesses()
{
return $this->hasMany(Business::className(), ['district_id' => 'id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getState()
{
return $this->hasOne(State::className(), ['id' => 'state_id']);
}
/**
* @inheritdoc
* @return \common\models\query\DistrictQuery the active query used by this AR class.
*/
public static function find()
{
return new \common\models\query\DistrictQuery(get_called_class());
}
}
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "{{%state}}".
*
* @property integer $id
* @property string $name
* @property string $slug
* @property integer $status
* @property integer $created_at
* @property integer $updated_at
*
* @property District[] $districts
*/
class State extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return '{{%state}}';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['name'], 'required'],
[['status', 'created_at', 'updated_at'], 'integer'],
[['name', 'slug'], 'string', 'max' => 1024],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('common', 'ID'),
'name' => Yii::t('common', 'Name'),
'slug' => Yii::t('common', 'Slug'),
'status' => Yii::t('common', 'Status'),
'created_at' => Yii::t('common', 'Created At'),
'updated_at' => Yii::t('common', 'Updated At'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getDistricts()
{
return $this->hasMany(District::className(), ['state_id' => 'id']);
}
/**
* @inheritdoc
* @return \common\models\query\StateQuery the active query used by this AR class.
*/
public static function find()
{
return new \common\models\query\StateQuery(get_called_class());
}
}
<?php
namespace common\models\query;
/**
* This is the ActiveQuery class for [[\common\models\Business]].
*
* @see \common\models\Business
*/
class BusinessQuery extends \yii\db\ActiveQuery
{
/*public function active()
{
return $this->andWhere('[[status]]=1');
}*/
/**
* @inheritdoc
* @return \common\models\Business[]|array
*/
public function all($db = null)
{
return parent::all($db);
}
/**
* @inheritdoc
* @return \common\models\Business|array|null
*/
public function one($db = null)
{
return parent::one($db);
}
}
<?php
namespace common\models\query;
/**
* This is the ActiveQuery class for [[\common\models\District]].
*
* @see \common\models\District
*/
class DistrictQuery extends \yii\db\ActiveQuery
{
/*public function active()
{
return $this->andWhere('[[status]]=1');
}*/
/**
* @inheritdoc
* @return \common\models\District[]|array
*/
public function all($db = null)
{
return parent::all($db);
}
/**
* @inheritdoc
* @return \common\models\District|array|null
*/
public function one($db = null)
{
return parent::one($db);
}
}
<?php
namespace common\models\query;
/**
* This is the ActiveQuery class for [[\common\models\State]].
*
* @see \common\models\State
*/
class StateQuery extends \yii\db\ActiveQuery
{
/*public function active()
{
return $this->andWhere('[[status]]=1');
}*/
/**
* @inheritdoc
* @return \common\models\State[]|array
*/
public function all($db = null)
{
return parent::all($db);
}
/**
* @inheritdoc
* @return \common\models\State|array|null
*/
public function one($db = null)
{
return parent::one($db);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment