Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
d55a1fcf
Commit
d55a1fcf
authored
Feb 19, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#925 - Создать каркас модуля тестирования
parent
2f792aa6
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
121 additions
and
222 deletions
+121
-222
common/modules/school/forms/CourseForm.php
common/modules/school/forms/CourseForm.php
+3
-0
common/modules/school/forms/LessonForm.php
common/modules/school/forms/LessonForm.php
+2
-0
common/modules/school/models/Courses.php
common/modules/school/models/Courses.php
+8
-1
common/modules/school/models/Lessons.php
common/modules/school/models/Lessons.php
+9
-3
common/modules/school/views/lesson/view.php
common/modules/school/views/lesson/view.php
+14
-10
common/modules/testings/controllers/TestController.php
common/modules/testings/controllers/TestController.php
+2
-2
common/modules/testings/models/Passing.php
common/modules/testings/models/Passing.php
+19
-202
common/modules/testings/views/test/info.php
common/modules/testings/views/test/info.php
+4
-4
console/migrations/m160218_175646_add_test_in_school.php
console/migrations/m160218_175646_add_test_in_school.php
+20
-0
console/migrations/m160218_184352_update_passings_table.php
console/migrations/m160218_184352_update_passings_table.php
+38
-0
frontend/config/main.php
frontend/config/main.php
+2
-0
No files found.
common/modules/school/forms/CourseForm.php
View file @
d55a1fcf
<?php
use
yii\helpers\Html
;
use
yii\helpers\ArrayHelper
;
use
kartik\file\FileInput
;
use
yii\helpers\Url
;
use
common\modules\school\models\Courses
;
use
common\modules\testings\models\Test
;
if
(
$model
->
image
)
{
$image
=
"<div class='file-widget'>"
.
FileInput
::
widget
([
...
...
@@ -30,6 +32,7 @@ else {
}
$elements
=
[
'test_id'
=>
[
'type'
=>
'dropdownlist'
,
'items'
=>
ArrayHelper
::
map
(
Test
::
find
()
->
all
(),
'id'
,
'name'
,
'session.name'
),
'empty'
=>
'Не задан'
],
'title'
=>
[
'type'
=>
'text'
],
'description'
=>
[
'type'
=>
'textarea'
],
'description_for_course'
=>
[
'type'
=>
'textarea'
],
...
...
common/modules/school/forms/LessonForm.php
View file @
d55a1fcf
...
...
@@ -2,8 +2,10 @@
use
yii\helpers\ArrayHelper
;
use
common\modules\school\models\Courses
;
use
common\modules\testings\models\Test
;
$elements
=
[
'test_id'
=>
[
'type'
=>
'dropdownlist'
,
'items'
=>
ArrayHelper
::
map
(
Test
::
find
()
->
all
(),
'id'
,
'name'
,
'session.name'
),
'empty'
=>
'Не задан'
],
'title'
=>
[
'type'
=>
'text'
],
'video_id'
=>
[
'type'
=>
'text'
],
'text'
=>
[
'type'
=>
'textarea'
],
...
...
common/modules/school/models/Courses.php
View file @
d55a1fcf
...
...
@@ -5,6 +5,7 @@ namespace common\modules\school\models;
use
Yii
;
use
common\modules\school\models\Lessons
;
use
common\modules\testings\models\Test
;
class
Courses
extends
\common\components\ActiveRecordModel
{
...
...
@@ -39,6 +40,7 @@ class Courses extends \common\components\ActiveRecordModel
public
function
attributeLabels
()
{
return
[
'test_id'
=>
'Тест'
,
'title'
=>
'Заголовок'
,
'description'
=>
'Описание'
,
'type'
=>
'Тип курса'
,
...
...
@@ -55,7 +57,7 @@ class Courses extends \common\components\ActiveRecordModel
{
return
[
[[
'title'
,
'description'
,
'type'
],
'required'
],
[[
'type'
,
'spec_proposition'
],
'integer'
],
[[
'type'
,
'spec_proposition'
,
'test_id'
],
'integer'
],
[[
'title'
],
'string'
,
'max'
=>
150
],
[[
'image'
],
'string'
,
'max'
=>
100
],
[[
'description'
,
'description_for_course'
],
'safe'
],
...
...
@@ -91,6 +93,11 @@ class Courses extends \common\components\ActiveRecordModel
return
$this
->
hasMany
(
Lessons
::
className
(),
[
'course_id'
=>
'id'
]);
}
public
function
getTest
()
{
return
$this
->
hasOne
(
Test
::
className
(),
[
'id'
=>
'test_id'
]);
}
public
function
getPath
()
{
return
Yii
::
getAlias
(
'@frontend/web'
)
.
self
::
IMAGES_FOLDER
;
...
...
common/modules/school/models/Lessons.php
View file @
d55a1fcf
...
...
@@ -3,8 +3,8 @@
namespace
common\modules\school\models
;
use
common\modules\school\components\Utilities
;
use
common\modules\school\models\Courses
;
use
common\modules\testings\models\Test
;
/**
* This is the model class for table "testings_questions_image".
...
...
@@ -30,7 +30,7 @@ class Lessons extends \common\components\ActiveRecordModel
public
function
name
()
{
return
'
Изображения для вопросов
'
;
return
'
Уроки
'
;
}
/**
...
...
@@ -42,7 +42,7 @@ class Lessons extends \common\components\ActiveRecordModel
[[
'title'
,
'video_id'
,
'course_id'
,
'number'
],
'required'
],
[[
'title'
],
'string'
,
'max'
=>
150
],
[[
'video_id'
],
'string'
,
'max'
=>
100
],
[[
'course_id'
,
'number'
],
'integer'
],
[[
'course_id'
,
'number'
,
'test_id'
],
'integer'
],
[[
'text'
],
'safe'
],
[[
'filesUpload'
],
'file'
,
'skipOnEmpty'
=>
true
,
'extensions'
=>
'png, jpg, jpeg, gif, rar, ai, ppt, doc, docx'
],
];
...
...
@@ -55,6 +55,7 @@ class Lessons extends \common\components\ActiveRecordModel
{
return
[
'id'
=>
'ID'
,
'test_id'
=>
'Тест'
,
'title'
=>
'Заголовок'
,
'text'
=>
'Полезные материалы'
,
'video_id'
=>
'Код видео'
,
...
...
@@ -108,6 +109,11 @@ class Lessons extends \common\components\ActiveRecordModel
{
return
$this
->
hasMany
(
LessonImage
::
className
(),
[
'lesson_id'
=>
'id'
]);
}
public
function
getTest
()
{
return
$this
->
hasOne
(
Test
::
className
(),
[
'id'
=>
'test_id'
]);
}
public
function
getPath
()
{
...
...
common/modules/school/views/lesson/view.php
View file @
d55a1fcf
<?php
use
yii\web\View
;
use
yii\helpers\Url
;
use
common\modules\users\widgets\UserBoxWidget
;
use
common\modules\school\assets\WidgetAssetBundle
;
use
yii\web\View
;
WidgetAssetBundle
::
register
(
$this
);
?>
...
...
@@ -73,21 +75,23 @@ WidgetAssetBundle::register($this);
</section>
<section
class=
"vc-cont"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-4 col-xs-5 col-sm-12"
>
<a
href=
"#"
class=
"vc_bt_quit_less"
>
Завершить урок
</a>
</div>
<div
class=
"col-md-8 col-xs-7 col-sm-12"
>
<div
class=
"vc_quit_txt"
>
Чтобы завершить урок, выполните задание.
</div>
<?php
if
(
$model
->
test
)
:
?>
<div
class=
"row"
>
<div
class=
"col-md-4 col-xs-5 col-sm-12"
>
<a
href=
"
<?=
Url
::
to
([
'/testing/info/'
.
$model
->
test_id
])
?>
"
class=
"vc_bt_quit_less"
>
Завершить урок
</a>
</div>
<div
class=
"col-md-8 col-xs-7 col-sm-12"
>
<div
class=
"vc_quit_txt"
>
Чтобы завершить урок, выполните задание.
</div>
</div>
</div>
<
/div
>
<div
class=
"row"
>
<
?php
endif
;
?
>
<
!-- <
div class="row">
<div class="col-md-12 col-xs-12 col-sm-12">
<div class="vc_green_inf">
<span>Тестирование успешно пройдено. Вы набрали 99 999 балов.<br> Оставляйте комментарии, что бы увеличить Ваш рейтинг.</span>
</div>
</div>
</div>
</div>
-->
<?php
if
(
$model
->
text
)
:
?>
<div
class=
"row"
>
...
...
common/modules/testings/controllers/TestController.php
View file @
d55a1fcf
...
...
@@ -27,7 +27,7 @@ class TestController extends \common\components\BaseController
public
function
actionInfo
(
$id
)
{
$
passing
=
$this
->
findModel
(
$id
);
$
model
=
$this
->
findModel
(
$id
);
if
(
$model
...
...
@@ -553,7 +553,7 @@ class TestController extends \common\components\BaseController
*/
protected
function
findModel
(
$id
)
{
if
((
$model
=
Passing
::
findOne
(
$id
))
!==
null
)
{
if
((
$model
=
Test
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
...
...
common/modules/testings/models/Passing.php
View file @
d55a1fcf
...
...
@@ -12,28 +12,24 @@ class Passing extends \common\components\ActiveRecordModel
{
const
PAGE_SIZE
=
10
;
const
FAIL
ED
=
0
;
const
START
ED
=
0
;
const
PASSED
=
1
;
const
MISTAKE
=
2
;
const
STARTED
=
3
;
const
AUTH
=
4
;
const
NOT_STARTED
=
5
;
const
MISTAKE
=
8
;
const
FAILED
=
9
;
const
PASSING_PERCENT_RIGHT_CENTER
=
50
;
const
PASSING_PERCENT_RIGHT_ALMOST
=
75
;
const
PASSING_PERCENT_RIGHT_ALL
=
100
;
public
static
$state_list
=
[
self
::
NOT_STARTED
=>
'Не сдавал
'
,
self
::
STARTED
=>
'Начал тестирование
'
,
self
::
FAILED
=>
'Не сдал'
,
self
::
PASSED
=>
'Сдал'
,
self
::
MISTAKE
=>
'Ошибка'
,
self
::
STARTED
=>
'Начал тестирование'
,
self
::
AUTH
=>
'Не авторизован'
,
];
public
static
$answer_list
=
[
self
::
FAIL
ED
=>
'Не верно'
,
self
::
START
ED
=>
'Не верно'
,
self
::
PASSED
=>
'Верно'
,
];
...
...
@@ -54,12 +50,6 @@ class Passing extends \common\components\ActiveRecordModel
public
function
behaviors
()
{
return
[
[
'class'
=>
TimestampBehavior
::
className
(),
'createdAtAttribute'
=>
'create_date'
,
'updatedAtAttribute'
=>
null
,
'value'
=>
new
Expression
(
'NOW()'
),
],
];
}
...
...
@@ -123,132 +113,20 @@ class Passing extends \common\components\ActiveRecordModel
return
$count
;
}
public
function
buildSearchCriteria
()
{
$criteria
=
new
CDbCriteria
();
$criteria
->
compare
(
'id'
,
$this
->
id
);
$criteria
->
compare
(
'user_id'
,
$this
->
user_id
);
$criteria
->
compare
(
'test_id'
,
$this
->
test_id
);
//$criteria->compare('is_passed', $this->is_passed);
$criteria
->
compare
(
'create_date'
,
$this
->
create_date
,
true
);
$tpassing
=
Yii
::
app
()
->
request
->
getQuery
(
'TestingPassing'
);
$pass_date
=
'CONCAT( RIGHT( LEFT( pass_date, 10 ) , 4 ) , "-", TRIM(
TRAILING CONCAT( ".", SUBSTRING_INDEX( LEFT( pass_date, 10 ) , ".", -1 ) )
FROM TRIM(
LEADING CONCAT( SUBSTRING_INDEX( LEFT( pass_date, 10 ) , ".", 1 ) , "." )
FROM LEFT( pass_date, 10 ) ) ) , "-", LEFT( pass_date, 2 ) )'
;
if
((
$tpassing
[
'pass_date'
])
&&
(
Yii
::
app
()
->
request
->
getQuery
(
'date_to'
)))
{
$criteria
->
addCondition
(
$pass_date
.
' BETWEEN "'
.
$tpassing
[
'pass_date'
]
.
'" AND "'
.
Yii
::
app
()
->
request
->
getQuery
(
'date_to'
)
.
'"'
);
}
elseif
(
Yii
::
app
()
->
request
->
getQuery
(
'date_to'
))
{
$criteria
->
addCondition
(
$pass_date
.
' < "'
.
Yii
::
app
()
->
request
->
getQuery
(
'date_to'
)
.
'"'
);
}
elseif
(
$tpassing
[
'pass_date'
])
{
$criteria
->
addCondition
(
$pass_date
.
' > "'
.
Yii
::
app
()
->
request
->
getQuery
(
'pass_date'
)
.
'"'
);
}
if
(
Yii
::
app
()
->
request
->
getQuery
(
'status_is_null'
))
{
$criteria
->
addCondition
(
'is_passed is null'
);
}
$criteria
->
with
=
array
(
'user'
,
'test'
,
'mistake'
);
$criteria
->
order
=
'user.last_name, user.first_name, user.patronymic, test.name'
;
$criteria
->
together
=
true
;
if
(
$this
->
is_passed
==
4
)
{
$criteria
->
addCondition
(
'user.create_date > "2014-06-05 00:00:00"'
);
$criteria
->
addCondition
(
'user.is_auth = 0'
);
}
elseif
(
$this
->
is_passed
==
3
)
{
$criteria
->
addCondition
(
'is_passed = 0'
);
$criteria
->
addCondition
(
'pass_date is null'
);
$criteria
->
addCondition
(
'mistake.passing_id is null'
);
}
elseif
(
$this
->
is_passed
==
2
)
{
$criteria
->
addCondition
(
'mistake.passing_id = t.id'
);
}
elseif
(
$this
->
is_passed
==
1
)
{
$criteria
->
addCondition
(
'is_passed = 1'
);
$criteria
->
addCondition
(
'mistake.passing_id is null'
);
}
elseif
(
$this
->
is_passed
===
'0'
)
{
$criteria
->
addCondition
(
'is_passed = 0'
);
$criteria
->
addCondition
(
'pass_date is not null'
);
$criteria
->
addCondition
(
'mistake.passing_id is null'
);
}
elseif
(
$this
->
is_passed
==
5
)
{
$criteria
->
addCondition
(
'is_passed is null'
);
$criteria
->
addCondition
(
'mistake.passing_id is null'
);
}
$criteria
->
compare
(
'test.session_id'
,
Yii
::
app
()
->
request
->
getQuery
(
'session'
));
if
(
isset
(
$_GET
[
'email'
])
&&
$_GET
[
'email'
])
{
$criteria
->
compare
(
'user.email'
,
$_GET
[
'email'
],
true
);
$criteria
->
together
=
true
;
}
if
(
isset
(
$_GET
[
'company_name'
])
&&
$_GET
[
'company_name'
])
{
$criteria
->
compare
(
'user.company_name'
,
$_GET
[
'company_name'
],
true
);
$criteria
->
together
=
true
;
}
if
(
isset
(
$_GET
[
'fio'
])
&&
$_GET
[
'fio'
])
{
$criteria
->
compare
(
'user.last_name'
,
$_GET
[
'fio'
],
true
);
$criteria
->
together
=
true
;
}
if
(
Yii
::
app
()
->
user
->
getRole
()
==
'schneider_electric'
)
{
$criteria
->
compare
(
'user.tki'
,
Yii
::
app
()
->
user
->
getName
(),
true
);
$criteria
->
together
=
true
;
}
return
$criteria
;
}
public
function
getGammas
()
{
$cr
=
new
CDbCriteria
;
$cr
->
with
=
'questions.passings.passing'
;
$cr
->
addCondition
(
'passing.id = :passing_id'
);
$cr
->
group
=
't.id'
;
$cr
->
distinct
=
true
;
$cr
->
params
=
array
(
':passing_id'
=>
$this
->
id
,
);
$cr
->
select
=
'gamma.*'
;
return
TestingGamma
::
model
()
->
findAll
(
$cr
);
}
public
function
gammaPercent
(
$gamma_id
)
{
public
function
getPercent
()
{
$all
=
0
;
$right
=
0
;
foreach
(
$this
->
questions
as
$pq
)
{
if
(
$pq
->
question
->
gamma_id
==
$gamma_id
)
{
$all
++
;
if
(
$pq
->
isRight
)
{
$right
++
;
}
}
}
return
(
$all
<>
0
)
?
ceil
(
$right
*
100
/
$all
)
:
"- "
;
}
public
function
getPercent
()
{
$all
=
0
;
$right
=
0
;
foreach
(
$this
->
questions
as
$pq
)
{
foreach
(
$this
->
questions
as
$pq
)
{
$all
++
;
if
(
$pq
->
isRight
)
{
if
(
$pq
->
isRight
)
{
$right
++
;
}
}
return
(
$all
<>
0
)
?
ceil
(
$right
*
100
/
$all
)
:
"- "
;
}
...
...
@@ -259,11 +137,11 @@ FROM LEFT( pass_date, 10 ) ) ) , "-", LEFT( pass_date, 2 ) )';
public
function
getMessageStep
()
{
$list
=
array
(
self
::
PASSING_PERCENT_RIGHT_ALL
=>
Setting
::
getValue
(
'message_passing_percent_right_all'
),
self
::
PASSING_PERCENT_RIGHT_ALMOST
=>
Setting
::
getValue
(
'message_passing_percent_right_almost'
),
self
::
PASSING_PERCENT_RIGHT_CENTER
=>
Setting
::
getValue
(
'message_passing_percent_right_center'
),
)
;
$list
=
[
self
::
PASSING_PERCENT_RIGHT_ALL
=>
Setting
s
::
getValue
(
'message_passing_percent_right_all'
),
self
::
PASSING_PERCENT_RIGHT_ALMOST
=>
Setting
s
::
getValue
(
'message_passing_percent_right_almost'
),
self
::
PASSING_PERCENT_RIGHT_CENTER
=>
Setting
s
::
getValue
(
'message_passing_percent_right_center'
),
]
;
foreach
(
$list
as
$percent
=>
$message
)
{
...
...
@@ -276,7 +154,8 @@ FROM LEFT( pass_date, 10 ) ) ) , "-", LEFT( pass_date, 2 ) )';
return
;
}
public
function
getTime
()
{
public
function
getTime
()
{
if
(
$this
->
pass_date_start
&&
$this
->
pass_date
)
{
return
(
strtotime
(
$this
->
pass_date
)
-
strtotime
(
$this
->
pass_date_start
));
...
...
@@ -291,68 +170,6 @@ FROM LEFT( pass_date, 10 ) ) ) , "-", LEFT( pass_date, 2 ) )';
}
}
public
function
recountPassResult
()
{
if
(
$this
->
percent
>=
$this
->
test
->
pass_percent
)
{
$this
->
is_passed
=
self
::
PASSED
;
}
else
{
$this
->
is_passed
=
self
::
FAILED
;
}
return
true
;
}
public
function
getStatus
()
{
$user
=
User
::
findOne
(
$this
->
user_id
);
if
((
strtotime
(
$user
->
create_date
)
>
mktime
(
0
,
0
,
0
,
6
,
5
,
2014
))
&&
(
$user
->
is_auth
==
0
))
{
return
self
::
AUTH
;
}
elseif
(
$this
->
mistake
)
{
return
self
::
MISTAKE
;
}
elseif
((
$this
->
is_passed
===
'0'
)
&&
(
$this
->
pass_date
===
null
)
&&
$this
->
attempt
<
$this
->
test
->
attempt
&&
strtotime
(
$this
->
pass_date_start
)
+
(
$this
->
test
->
minutes
*
60
)
>=
time
())
{
return
self
::
STARTED
;
}
elseif
(
$this
->
is_passed
===
0
&&
(
$this
->
attempt
>
$this
->
test
->
attempt
||
strtotime
(
$this
->
pass_date_start
)
+
(
$this
->
test
->
minutes
*
60
)
>=
time
()))
{
return
self
::
FAILED
;
}
elseif
(
$this
->
is_passed
===
NULL
)
{
return
self
::
NOT_STARTED
;
}
else
{
return
$this
->
is_passed
;
}
}
public
function
sendNotAttempt
(
$message
)
{
$body
=
Setting
::
getValue
(
'email_not_attempt_body'
);
$subject
=
'Тестирование - обращение '
.
uniqid
();
$test
=
$this
->
test
;
$session
=
$test
->
session
;
$user
=
$this
->
user
;
$mailer_letter
=
MailerLetter
::
model
();
$body
=
$mailer_letter
->
compileText
(
$body
,
array
(
'fio_user_link'
=>
CHtml
::
link
(
$user
->
fio
,
Yii
::
app
()
->
request
->
hostInfo
.
Yii
::
app
()
->
urlManager
->
createUrl
(
'/testings/testingUserAdmin/view'
,
array
(
'id'
=>
$this
->
user_id
))),
'session_name'
=>
$session
->
name
,
'test_name'
=>
$test
->
name
,
'message'
=>
$message
,
'session_users_link'
=>
CHtml
::
link
(
'пользователи'
,
Yii
::
app
()
->
request
->
hostInfo
.
Yii
::
app
()
->
urlManager
->
createUrl
(
'/testings/testingUserAdmin/manage'
,
array
(
'session'
=>
$session
->
id
))),
'attempt_link'
=>
CHtml
::
link
(
'переназначить'
,
Yii
::
app
()
->
request
->
hostInfo
.
Yii
::
app
()
->
urlManager
->
createUrl
(
'/testings/TestingPassingAdmin/reAttempt'
,
array
(
'id'
=>
$this
->
id
))),
));
unset
(
$mailer_letter
);
return
MailerModule
::
sendMailUniSender
(
Setting
::
getValue
(
'not_attempt_email'
),
$subject
,
$body
);
}
public
static
function
declOfNum
(
$number
,
$titles
)
{
$cases
=
array
(
2
,
0
,
1
,
1
,
1
,
2
);
...
...
common/modules/testings/views/test/info.php
View file @
d55a1fcf
...
...
@@ -8,7 +8,7 @@ use yii\helpers\Html;
<div
class=
"row"
>
<div
class=
"col-md-12 col-xs-12 col-sm-12"
>
<strong>
Тест:
</strong>
<p>
<?=
$model
->
test
->
name
?>
</p>
<p>
<?=
$model
->
name
?>
</p>
</div>
</div>
</div>
...
...
@@ -18,18 +18,18 @@ use yii\helpers\Html;
<div
class=
"row"
>
<div
class=
"col-md-12 col-xs-12 col-sm-12"
>
<h1
class=
"successfully_title"
>
Вы собираетесь сдать экзамен:
</h1>
<h6>
«
<?=
$model
->
test
->
name
?>
»
</h6>
<h6>
«
<?=
$model
->
name
?>
»
</h6>
</div>
</div>
<div
class=
"test_parameters"
>
<div
class=
"row"
>
<div
class=
"col-md-6 col-xs-6 col-sm-12"
>
<img
src=
"/images/icon/test_parameters_icon_1.png"
height=
"83"
width=
"70"
alt=
""
>
<h4>
<?=
$model
->
test
->
minutes
?>
минут
</h4>
<h4>
<?=
$model
->
minutes
?>
минут
</h4>
</div>
<div
class=
"col-md-6 col-xs-6 col-sm-12"
>
<img
src=
"/images/icon/test_parameters_icon_2.png"
height=
"83"
width=
"62"
alt=
""
>
<h4>
<?=
$model
->
test
->
questions
?>
вопросов
</h4>
<h4>
<?=
$model
->
questions
?>
вопросов
</h4>
</div>
</div>
</div>
...
...
console/migrations/m160218_175646_add_test_in_school.php
0 → 100644
View file @
d55a1fcf
<?php
use
yii\db\Schema
;
use
yii\db\Migration
;
class
m160218_175646_add_test_in_school
extends
Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public
function
safeUp
()
{
$this
->
addColumn
(
'courses'
,
'test_id'
,
Schema
::
TYPE_INTEGER
.
"(11) DEFAULT NULL AFTER `id`"
);
$this
->
addColumn
(
'lessons'
,
'test_id'
,
Schema
::
TYPE_INTEGER
.
"(11) DEFAULT NULL AFTER `id`"
);
}
public
function
safeDown
()
{
$this
->
dropColumn
(
'courses'
,
'test_id'
);
$this
->
dropColumn
(
'lessons'
,
'test_id'
);
}
}
console/migrations/m160218_184352_update_passings_table.php
0 → 100644
View file @
d55a1fcf
<?php
use
yii\db\Schema
;
use
yii\db\Migration
;
class
m160218_184352_update_passings_table
extends
Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public
function
safeUp
()
{
$this
->
renameColumn
(
'testings_passings'
,
'percent_rights'
,
'points'
);
$this
->
renameColumn
(
'testings_passings'
,
'pass_date'
,
'start_date'
);
$this
->
renameColumn
(
'testings_passings'
,
'is_passed'
,
'status'
);
$this
->
dropColumn
(
'testings_passings'
,
'create_date'
);
$this
->
dropColumn
(
'testings_passings'
,
'pass_date_start'
);
$this
->
alterColumn
(
'testings_passings'
,
'status'
,
Schema
::
TYPE_INTEGER
.
'(4) NOT NULL DEFAULT 0'
);
$this
->
alterColumn
(
'testings_passings'
,
'points'
,
Schema
::
TYPE_INTEGER
.
'(11) NOT NULL DEFAULT 0'
);
}
public
function
safeDown
()
{
$this
->
renameColumn
(
'testings_passings'
,
'points'
,
'percent_rights'
);
$this
->
renameColumn
(
'testings_passings'
,
'start_date'
,
'pass_date'
);
$this
->
renameColumn
(
'testings_passings'
,
'status'
,
'is_passed'
);
$this
->
addColumn
(
'testings_passings'
,
'create_date'
,
Schema
::
TYPE_TIMESTAMP
.
' NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
);
$this
->
addColumn
(
'testings_passings'
,
'pass_date_start'
,
Schema
::
TYPE_STRING
.
'(22) NOT NULL'
);
$this
->
alterColumn
(
'testings_passings'
,
'is_passed'
,
'tinyint(1) DEFAULT NULL'
);
$this
->
alterColumn
(
'testings_passings'
,
'percent_rights'
,
Schema
::
TYPE_INTEGER
.
'(11) NOT NULL'
);
}
}
frontend/config/main.php
View file @
d55a1fcf
...
...
@@ -157,6 +157,8 @@ return [
'blog'
=>
'blog/post/index'
,
'blog/tag/<tag>'
=>
'blog/post/tag'
,
'blog/<url>'
=>
'blog/post/view'
,
'testing/<_a>/<id:\d+>'
=>
'testings/test/<_a>'
,
'testing/<_a>'
=>
'testings/test/<_a>'
,
'school'
=>
'school/course/index'
,
'school/course/<id>'
=>
'school/course/view'
,
'school/lesson/<id>'
=>
'school/lesson/view'
,
...
...
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