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
7e189071
Commit
7e189071
authored
Jan 23, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix questions manage
parent
feb69412
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
42 deletions
+26
-42
common/modules/testings/controllers/TestingQuestionAdminController.php
...s/testings/controllers/TestingQuestionAdminController.php
+24
-39
common/modules/testings/views/testing-question-admin/manage.php
.../modules/testings/views/testing-question-admin/manage.php
+2
-3
No files found.
common/modules/testings/controllers/TestingQuestionAdminController.php
View file @
7e189071
...
@@ -6,6 +6,7 @@ use Yii;
...
@@ -6,6 +6,7 @@ use Yii;
use
common\components\AdminController
;
use
common\components\AdminController
;
use
yii\web\NotFoundHttpException
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
use
yii\filters\VerbFilter
;
use
yii\helpers\ArrayHelper
;
use
common\modules\testings\models\TestingQuestion
;
use
common\modules\testings\models\TestingQuestion
;
use
common\modules\testings\models\SearchTestingQuestion
;
use
common\modules\testings\models\SearchTestingQuestion
;
...
@@ -92,47 +93,29 @@ class TestingQuestionAdminController extends AdminController
...
@@ -92,47 +93,29 @@ class TestingQuestionAdminController extends AdminController
return
$this
->
redirect
([
'manage'
]);
return
$this
->
redirect
([
'manage'
]);
}
}
//
public function actionManage()
public
function
actionManage
()
//
{
{
// $questions = array();//Вопросы с предупреждением о картинках
$questions
=
[];
// //
$param = 'карт, изобр, изображение, скриншот, картинка, схема, рисунок, рис';
$param
=
'карт, изобр, изображение, скриншот, картинка, схема, рисунок, рис'
;
// $param = trim(Setting::getValue('testings_questions_with_picture'));
// $param = trim(Setting::getValue('testings_questions_with_picture'));
// $words = empty($param) ? array() : explode(',', trim($param));
// $db = Yii::app()->db;
// if( isset($_GET['test']) && !empty($words)) {
// $where = array();
// for ($i = 0; $i < count($words); $i++) {
// $where[] = sprintf('%s LIKE trim(%s)',
// $db->quoteColumnName('text'),
// $db->quoteValue('%'.trim($words[$i]).'%'));
// }
// $where = implode(' OR ', $where);
// $sql = "SELECT id, `text` FROM testings_questions WHERE test_id = :test_id AND ($where)";
// $rows = $db->createCommand($sql)->queryAll(true, array('test_id' => $_GET['test']));
// foreach($rows as $row) {
// $questions[$row['id']] = $row['text'];
// }
// }
// $model=new TestingQuestion('search');
// $model->unsetAttributes();
// if(isset($_GET['TestingQuestion']))
// {
// $model->attributes = $_GET['TestingQuestion'];
// }
// $this->render('manage', array(
// 'model' => $model,
// 'questions' => $questions,
// 'questions_param' => $param,
// ));
// }
public
function
actionManage
()
$words
=
empty
(
$param
)
?
array
()
:
explode
(
','
,
trim
(
$param
));
if
(
Yii
::
$app
->
request
->
get
(
'test'
)
&&
!
empty
(
$words
))
{
$query
=
TestingQuestion
::
find
();
for
(
$i
=
0
;
$i
<
count
(
$words
);
$i
++
)
{
{
$query
->
orWhere
([
'like'
,
'text'
,
trim
(
$words
[
$i
])]);
}
$query
->
andWhere
([
'test_id'
=>
Yii
::
$app
->
request
->
get
(
'test'
)]);
$questions
=
ArrayHelper
::
map
(
$query
->
all
(),
'id'
,
'text'
);
}
$searchModel
=
new
SearchTestingQuestion
();
$searchModel
=
new
SearchTestingQuestion
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
...
@@ -144,6 +127,8 @@ class TestingQuestionAdminController extends AdminController
...
@@ -144,6 +127,8 @@ class TestingQuestionAdminController extends AdminController
return
$this
->
render
(
'manage'
,
[
return
$this
->
render
(
'manage'
,
[
'searchModel'
=>
$searchModel
,
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
'dataProvider'
=>
$dataProvider
,
'questions'
=>
$questions
,
'questions_param'
=>
$param
,
]);
]);
}
}
...
...
common/modules/testings/views/testing-question-admin/manage.php
View file @
7e189071
...
@@ -28,8 +28,7 @@ $("#message_expand").one("click", function (e) {
...
@@ -28,8 +28,7 @@ $("#message_expand").one("click", function (e) {
e.preventDefault();
e.preventDefault();
var el = $(this).hide();
var el = $(this).hide();
el.parent(".message")
$('#list_expand').show();
.css({height: "auto", overflow: "auto"});
});
});
EOD;
EOD;
...
@@ -41,7 +40,7 @@ $this->registerJs($js, yii\web\View::POS_READY, 'expnd.info');
...
@@ -41,7 +40,7 @@ $this->registerJs($js, yii\web\View::POS_READY, 'expnd.info');
<a
href=
"#"
id=
"message_expand"
>
Показать
</a>
<a
href=
"#"
id=
"message_expand"
>
Показать
</a>
<p>
Имеются вопросы со словами:
<b>
&
laquo
<?php
echo
Html
::
encode
(
$questions_param
);
?>
&
raquo
</b></p>
<p>
Имеются вопросы со словами:
<b>
&
laquo
<?php
echo
Html
::
encode
(
$questions_param
);
?>
&
raquo
</b></p>
<br/><br/>
<br/><br/>
<ul>
<ul
style=
"display:none;"
id=
"list_expand"
>
<?php
foreach
(
$questions
as
$id
=>
$text
)
:
?>
<?php
foreach
(
$questions
as
$id
=>
$text
)
:
?>
<li>
<?php
echo
Html
::
a
(
Html
::
encode
(
$text
),
[
'update'
,
'id'
=>
$id
]);
?>
</li>
<li>
<?php
echo
Html
::
a
(
Html
::
encode
(
$text
),
[
'update'
,
'id'
=>
$id
]);
?>
</li>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
...
...
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