Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test-project
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Junaid Rahman pv
test-project
Commits
d967f25f
Commit
d967f25f
authored
Sep 08, 2016
by
Junaid Rahman pv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified website module
parent
9defc564
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
38 additions
and
75 deletions
+38
-75
web.php
backend/config/web.php
+0
-3
WebsiteController.php
backend/controllers/WebsiteController.php
+10
-3
WebsiteSearch.php
backend/models/search/WebsiteSearch.php
+1
-1
Module.php
backend/modules/website/Module.php
+0
-24
DefaultController.php
backend/modules/website/controllers/DefaultController.php
+0
-20
index.php
backend/modules/website/views/default/index.php
+0
-12
common.php
backend/views/layouts/common.php
+1
-1
_form.php
backend/views/website/_form.php
+0
-0
_search.php
backend/views/website/_search.php
+0
-0
create.php
backend/views/website/create.php
+0
-0
index.php
backend/views/website/index.php
+1
-1
update.php
backend/views/website/update.php
+0
-0
view.php
backend/views/website/view.php
+0
-0
m160907_100248_website.php
common/migrations/db/m160907_100248_website.php
+3
-6
Website.php
common/models/Website.php
+22
-4
No files found.
backend/config/web.php
View file @
d967f25f
...
...
@@ -46,9 +46,6 @@ $config = [
],
'location'
=>
[
'class'
=>
'backend\modules\location\Module'
,
],
'website'
=>
[
'class'
=>
'backend\modules\website\Module'
,
]
],
...
...
backend/
modules/website/
controllers/WebsiteController.php
→
backend/controllers/WebsiteController.php
View file @
d967f25f
<?php
namespace
backend\
modules\website\
controllers
;
namespace
backend\controllers
;
use
Yii
;
use
common\models\website
;
use
backend\mod
ules\website\mod
els\search\WebsiteSearch
;
use
backend\models\search\WebsiteSearch
;
use
yii\web\Controller
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
...
...
@@ -14,6 +14,8 @@ use yii\filters\VerbFilter;
*/
class
WebsiteController
extends
Controller
{
public
function
behaviors
()
{
return
[
...
...
@@ -61,9 +63,14 @@ class WebsiteController extends Controller
public
function
actionCreate
()
{
$model
=
new
website
();
$searchModel
=
new
WebsiteSearch
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
if
(
$model
->
load
(
Yii
::
$app
->
request
->
post
())
&&
$model
->
save
())
{
return
$this
->
redirect
([
'view'
,
'id'
=>
$model
->
id
]);
return
$this
->
redirect
(
'index'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
]);
}
else
{
return
$this
->
render
(
'create'
,
[
'model'
=>
$model
,
...
...
backend/mod
ules/website/mod
els/search/WebsiteSearch.php
→
backend/models/search/WebsiteSearch.php
View file @
d967f25f
<?php
namespace
backend\mod
ules\website\mod
els\search
;
namespace
backend\models\search
;
use
Yii
;
use
yii\base\Model
;
...
...
backend/modules/website/Module.php
deleted
100644 → 0
View file @
9defc564
<?php
namespace
backend\modules\website
;
/**
* website module definition class
*/
class
Module
extends
\yii\base\Module
{
/**
* @inheritdoc
*/
public
$controllerNamespace
=
'backend\modules\website\controllers'
;
/**
* @inheritdoc
*/
public
function
init
()
{
parent
::
init
();
// custom initialization code goes here
}
}
backend/modules/website/controllers/DefaultController.php
deleted
100644 → 0
View file @
9defc564
<?php
namespace
backend\modules\website\controllers
;
use
yii\web\Controller
;
/**
* Default controller for the `website` module
*/
class
DefaultController
extends
Controller
{
/**
* Renders the index view for the module
* @return string
*/
public
function
actionIndex
()
{
return
$this
->
render
(
'index'
);
}
}
backend/modules/website/views/default/index.php
deleted
100644 → 0
View file @
9defc564
<div
class=
"website-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>
backend/views/layouts/common.php
View file @
d967f25f
...
...
@@ -210,7 +210,7 @@ $bundle = BackendAsset::register($this);
[
'label'
=>
Yii
::
t
(
'backend'
,
'Website'
),
'icon'
=>
'<i class="fa fa-globe"></i>'
,
'url'
=>
[
'/website
/website
'
],
'url'
=>
[
'/website'
],
'visible'
=>
Yii
::
$app
->
user
->
can
(
'administrator'
)
],
[
...
...
backend/
modules/website/
views/website/_form.php
→
backend/views/website/_form.php
View file @
d967f25f
File moved
backend/
modules/website/
views/website/_search.php
→
backend/views/website/_search.php
View file @
d967f25f
File moved
backend/
modules/website/
views/website/create.php
→
backend/views/website/create.php
View file @
d967f25f
File moved
backend/
modules/website/
views/website/index.php
→
backend/views/website/index.php
View file @
d967f25f
...
...
@@ -4,7 +4,7 @@ use yii\helpers\Html;
use
yii\grid\GridView
;
/* @var $this yii\web\View */
/* @var $searchModel backend\mod
ules\website\mod
els\search\WebsiteSearch */
/* @var $searchModel backend\models\search\WebsiteSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this
->
title
=
Yii
::
t
(
'backend'
,
'Websites'
);
...
...
backend/
modules/website/
views/website/update.php
→
backend/views/website/update.php
View file @
d967f25f
File moved
backend/
modules/website/
views/website/view.php
→
backend/views/website/view.php
View file @
d967f25f
File moved
common/migrations/db/m160907_100248_website.php
View file @
d967f25f
...
...
@@ -12,28 +12,25 @@ class m160907_100248_website extends Migration
}
$this
->
createTable
(
'{{%website}}'
,
[
'id'
=>
$this
->
primaryKey
(),
'business_id'
=>
$this
->
integer
(),
'theme_id'
=>
$this
->
integer
(),
'domain_name'
=>
$this
->
string
(
255
)
->
notNull
(),
'expiry_date'
=>
$this
->
string
(
11
)
->
notNull
(),
'status'
=>
$this
->
smallInteger
(
6
),
'expiry_date'
=>
$this
->
integer
(
11
),
'created_at'
=>
$this
->
integer
(
11
),
'updated_at'
=>
$this
->
integer
(
11
),
],
$tableOptions
);
$this
->
createIndex
(
'idx_domain_name'
,
'{{%website}}'
,
'domain_name'
);
$this
->
addForeignKey
(
'fk_theme_id'
,
'{{%website}}'
,
'theme_id'
,
'{{%theme}}'
,
'id'
,
'RESTRICT'
,
'RESTRICT'
);
$this
->
addForeignKey
(
'fk_website_theme'
,
'{{%website}}'
,
'theme_id'
,
'{{%theme}}'
,
'id'
,
'RESTRICT'
,
'RESTRICT'
);
}
public
function
safeDown
()
{
$this
->
dropForeignKey
(
'fk_
theme_id
'
,
'{{%website}}'
);
$this
->
dropForeignKey
(
'fk_
website_theme
'
,
'{{%website}}'
);
$this
->
dropIndex
(
'idx_domain_name'
,
'{{%website}}'
);
...
...
common/models/Website.php
View file @
d967f25f
...
...
@@ -4,6 +4,7 @@ namespace common\models;
use
Yii
;
use
yii\behaviors\TimestampBehavior
;
use
MongoDB\BSON\UTCDatetime
;
/**
* This is the model class for table "{{%website}}".
...
...
@@ -49,10 +50,16 @@ class Website extends \yii\db\ActiveRecord
public
function
rules
()
{
return
[
[[
'business_id'
,
'theme_id'
,
'status'
,
'expiry_date'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'business_id'
,
'theme_id'
,
'status'
,
'expiry_date'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'domain_name'
],
'required'
],
[[
'domain_name'
],
'string'
,
'max'
=>
255
],
[[
'theme_id'
],
'exist'
,
'skipOnError'
=>
true
,
'targetClass'
=>
Theme
::
className
(),
'targetAttribute'
=>
[
'theme_id'
=>
'id'
]],
[
[
'theme_id'
],
'exist'
,
'skipOnError'
=>
true
,
'targetClass'
=>
Theme
::
className
(),
'targetAttribute'
=>
[
'theme_id'
=>
'id'
]
],
];
}
...
...
@@ -63,8 +70,8 @@ class Website extends \yii\db\ActiveRecord
{
return
[
'id'
=>
Yii
::
t
(
'common'
,
'ID'
),
'business_id'
=>
Yii
::
t
(
'common'
,
'Business
ID
'
),
'theme_id'
=>
Yii
::
t
(
'common'
,
'Theme
ID
'
),
'business_id'
=>
Yii
::
t
(
'common'
,
'Business'
),
'theme_id'
=>
Yii
::
t
(
'common'
,
'Theme'
),
'domain_name'
=>
Yii
::
t
(
'common'
,
'Domain Name'
),
'status'
=>
Yii
::
t
(
'common'
,
'Status'
),
'expiry_date'
=>
Yii
::
t
(
'common'
,
'Expiry Date'
),
...
...
@@ -101,4 +108,15 @@ class Website extends \yii\db\ActiveRecord
self
::
STATUS_IN_ACTIVE
=>
Yii
::
t
(
'common'
,
'In Active'
),
];
}
public
function
beforeSave
(
$insert
)
{
if
(
parent
::
beforeSave
(
$insert
))
{
$expiry_date
=
date
(
'Y-m-d'
,
strtotime
(
'+1 years'
));
$this
->
expiry_date
=
strtotime
(
$expiry_date
);
return
true
;
}
else
{
return
false
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment