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
eac79345
Commit
eac79345
authored
Jan 25, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix UserAdmin and SendHistory
parent
0d6586b6
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
597 additions
and
451 deletions
+597
-451
common/components/ColorActionColumn.php
common/components/ColorActionColumn.php
+3
-1
common/modules/testings/components/MarkBoxAction.php
common/modules/testings/components/MarkBoxAction.php
+64
-0
common/modules/testings/components/MarkBoxBehavior.php
common/modules/testings/components/MarkBoxBehavior.php
+54
-0
common/modules/testings/components/MarkBoxColumn.php
common/modules/testings/components/MarkBoxColumn.php
+190
-166
common/modules/testings/controllers/TestingSendHistoryAdminController.php
...estings/controllers/TestingSendHistoryAdminController.php
+36
-34
common/modules/testings/controllers/TestingUserAdminController.php
...dules/testings/controllers/TestingUserAdminController.php
+18
-102
common/modules/testings/models/SearchTestingSendHistory.php
common/modules/testings/models/SearchTestingSendHistory.php
+77
-0
common/modules/testings/models/TestingSendHistory.php
common/modules/testings/models/TestingSendHistory.php
+4
-3
common/modules/testings/views/testing-answer-admin/manage.php
...on/modules/testings/views/testing-answer-admin/manage.php
+0
-1
common/modules/testings/views/testing-passing-admin/manage.php
...n/modules/testings/views/testing-passing-admin/manage.php
+0
-1
common/modules/testings/views/testing-passing-admin/statistics.php
...dules/testings/views/testing-passing-admin/statistics.php
+0
-1
common/modules/testings/views/testing-question-admin/manage.php
.../modules/testings/views/testing-question-admin/manage.php
+0
-1
common/modules/testings/views/testing-send-history-admin/manage.php
...ules/testings/views/testing-send-history-admin/manage.php
+65
-0
common/modules/testings/views/testing-session-admin/manage.php
...n/modules/testings/views/testing-session-admin/manage.php
+0
-1
common/modules/testings/views/testing-test-admin/manage.php
common/modules/testings/views/testing-test-admin/manage.php
+0
-2
common/modules/testings/views/testing-user-admin/manage.php
common/modules/testings/views/testing-user-admin/manage.php
+86
-91
common/modules/testings/views/testingSendHistoryAdmin/manage.php
...modules/testings/views/testingSendHistoryAdmin/manage.php
+0
-47
No files found.
common/components/ColorActionColumn.php
View file @
eac79345
...
...
@@ -10,7 +10,9 @@ use yii\grid;
class
ColorActionColumn
extends
\yii\grid\ActionColumn
{
public
$contentOptions
=
[
'class'
=>
'color-column'
'class'
=>
'color-column'
,
'style'
=>
'white-space: nowrap;'
,
'align'
=>
'center'
];
protected
function
initDefaultButtons
()
...
...
common/modules/testings/components/MarkBoxAction.php
0 → 100644
View file @
eac79345
<?php
namespace
common\modules\testings\components
;
use
yii\helpers\Json
;
class
MarkBoxAction
extends
\yii\base\Action
{
public
function
run
(
$session
)
{
if
(
isset
(
$_POST
[
'reset'
])
&&
$_POST
[
'reset'
])
{
\Yii
::
$app
->
controller
->
setMarked
(
$session
,
[]);
echo
Json
::
encode
(
array
(
'qty'
=>
0
,
'title'
=>
"Разослать выделенным"
,
));
return
;
}
if
(
!
isset
(
$_POST
[
'data'
])
||
!
is_array
(
$_POST
[
'data'
]))
{
return
;
}
$toggle
=
$_POST
[
'data'
];
$data
=
\Yii
::
$app
->
controller
->
getMarked
(
$session
);
$remove
=
[];
$append
=
[];
foreach
(
$toggle
as
$key
=>
$value
)
{
if
(
$value
)
{
$append
[]
=
$key
;
}
else
{
$remove
[]
=
$key
;
}
}
if
(
!
empty
(
$append
))
{
$data
=
array_merge
(
$data
,
$append
);
}
$data
=
array_unique
(
$data
);
if
(
!
empty
(
$remove
))
{
$data
=
array_diff
(
$data
,
$remove
);
}
\Yii
::
$app
->
controller
->
setMarked
(
$session
,
$data
);
$qty
=
count
(
$data
);
echo
Json
::
encode
([
'qty'
=>
$qty
,
'title'
=>
"Разослать выделенным (
$qty
)"
,
]);
}
}
\ No newline at end of file
common/modules/testings/components/MarkBoxBehavior.php
0 → 100644
View file @
eac79345
<?php
namespace
common\modules\testings\components
;
use
Yii
;
use
yii\base\Behavior
;
class
MarkBoxBehavior
extends
Behavior
{
public
$session_key
=
'notify_session'
;
private
$_marked
;
public
function
getMarked
(
$session
)
{
$session
=
intval
(
$session
);
if
(
!
isset
(
$this
->
_marked
[
$session
]))
{
$session_key
=
$this
->
session_key
.
'_'
.
$session
;
if
(
isset
(
Yii
::
$app
->
session
[
$session_key
]))
{
$data
=
unserialize
(
Yii
::
$app
->
session
[
$session_key
]);
if
(
$data
===
FALSE
)
{
$data
=
[];
}
}
else
{
$data
=
[];
}
$this
->
_marked
[
$session
]
=
$data
;
}
return
$this
->
_marked
[
$session
];
}
public
function
setMarked
(
$session
,
$data
)
{
$session
=
intval
(
$session
);
$session_key
=
$this
->
session_key
.
'_'
.
$session
;
$this
->
_marked
[
$session
]
=
$data
;
Yii
::
$app
->
session
[
$session_key
]
=
serialize
(
$data
);
}
public
function
checkMark
(
$data
,
$row
)
{
return
in_array
(
$data
->
id
,
$this
->
getMarked
());
}
}
\ No newline at end of file
common/modules/testings/components/MarkBoxColumn.php
View file @
eac79345
This diff is collapsed.
Click to expand it.
common/modules/testings/controllers/TestingSendHistoryAdminController.php
View file @
eac79345
<?php
namespace
common\modules\testings\controllers
;
use
Yii
;
use
common\components\AdminController
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
use
common\modules\testings\models\SearchTestingSendHistory
;
class
TestingSendHistoryAdminController
extends
AdminController
{
public
static
function
actionsTitles
()
{
return
array
(
'Manage'
=>
'Управление пользователями'
,
'Resend
D
ublicates'
=>
''
,
'Resend
-d
ublicates'
=>
''
,
);
}
public
function
actionManage
()
public
function
actionManage
(
$session
)
{
if
(
!
Yii
::
app
()
->
request
->
getQuery
(
'session'
))
{
$this
->
pageNotFound
();
}
$searchModel
=
new
SearchTestingSendHistory
();
$dataProvider
=
$searchModel
->
search
(
Yii
::
$app
->
request
->
queryParams
);
$model
=
new
TestingSendHistory
(
'search'
);
$model
->
unsetAttributes
();
if
(
isset
(
$_GET
[
'TestingSendHistory'
]))
{
$model
->
attributes
=
$_GET
[
'TestingSendHistory'
];
}
Yii
::
$app
->
controller
->
page_title
=
'История отправки дубликатов'
;
Yii
::
$app
->
controller
->
breadcrumbs
=
[
'История отправки дубликатов'
,
];
$this
->
render
(
'manage'
,
array
(
'model'
=>
$model
,
'session_id'
=>
Yii
::
app
()
->
request
->
getQuery
(
'session'
)
));
return
$this
->
render
(
'manage'
,
[
'searchModel'
=>
$searchModel
,
'dataProvider'
=>
$dataProvider
,
'session_id'
=>
$session
]);
}
public
function
actionResendDublicates
()
...
...
@@ -83,23 +89,19 @@ class TestingSendHistoryAdminController extends AdminController
}
public
function
loadModel
(
$id
)
{
$model
=
TestingSendHistory
::
model
()
->
findByPk
((
int
)
$id
);
if
(
$model
===
null
)
{
$this
->
pageNotFound
();
/**
* Finds the Faq model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Faq the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected
function
findModel
(
$id
)
{
if
((
$model
=
TestingUser
::
findOne
(
$id
))
!==
null
)
{
return
$model
;
}
else
{
throw
new
NotFoundHttpException
(
'The requested page does not exist.'
);
}
return
$model
;
}
protected
function
performAjaxValidation
(
$model
)
{
if
(
isset
(
$_POST
[
'ajax'
])
&&
$_POST
[
'ajax'
]
===
'testing-sendhistory-form'
)
{
echo
CActiveForm
::
validate
(
$model
);
Yii
::
app
()
->
end
();
}
}
}
}
common/modules/testings/controllers/TestingUserAdminController.php
View file @
eac79345
...
...
@@ -6,16 +6,15 @@ use Yii;
use
common\components\AdminController
;
use
yii\web\NotFoundHttpException
;
use
yii\filters\VerbFilter
;
use
yii\helpers\Json
;
use
common\modules\testings\components\MarkBoxBehavior
;
use
common\modules\testings\models\TestingUser
;
use
common\modules\testings\models\SearchTestingUser
;
use
common\modules\testings\models\SearchTestingUserGroup
;
class
TestingUserAdminController
extends
AdminController
{
private
$_marked
;
{
public
static
function
actionsTitles
()
{
return
array
(
...
...
@@ -25,8 +24,8 @@ class TestingUserAdminController extends AdminController
'Delete'
=>
'Удаление пользователя'
,
'Manage'
=>
'Управление пользователями'
,
'Manage-group'
=>
'Управление группами'
,
'Update
M
ark'
=>
'Пометка пользователй'
,
'Reset
M
ark'
=>
'Сброс пометок'
,
'Update
-m
ark'
=>
'Пометка пользователй'
,
'Reset
-m
ark'
=>
'Сброс пометок'
,
);
}
...
...
@@ -39,6 +38,19 @@ class TestingUserAdminController extends AdminController
'delete'
=>
[
'post'
],
],
],
'marked'
=>
[
'class'
=>
MarkBoxBehavior
::
className
(),
'session_key'
=>
'user-admin'
,
]
];
}
public
function
actions
()
{
return
[
'update-mark'
=>
[
'class'
=>
\common\modules\testings\components\MarkBoxAction
::
className
(),
]
];
}
...
...
@@ -151,102 +163,6 @@ class TestingUserAdminController extends AdminController
]);
}
public
function
getMarked
(
$session
)
{
$session
=
intval
(
$session
);
if
(
!
isset
(
$this
->
_marked
[
$session
]))
{
$session_key
=
'notify_session_'
.
$session
;
if
(
isset
(
Yii
::
$app
->
session
[
$session_key
]))
{
$data
=
unserialize
(
Yii
::
$app
->
session
[
$session_key
]);
if
(
$data
===
FALSE
)
{
$data
=
[];
}
}
else
{
$data
=
[];
}
$this
->
_marked
[
$session
]
=
$data
;
}
return
$this
->
_marked
[
$session
];
}
public
function
setMarked
(
$session
,
$data
)
{
$session
=
intval
(
$session
);
$session_key
=
'notify_session_'
.
$session
;
$this
->
_marked
[
$session
]
=
$data
;
Yii
::
$app
->
session
[
$session_key
]
=
serialize
(
$data
);
}
public
function
checkMark
(
$data
,
$row
)
{
return
in_array
(
$data
->
id
,
$this
->
getMarked
());
}
public
function
actionUpdateMark
(
$session
)
{
if
(
!
isset
(
$_POST
[
'data'
])
||
!
is_array
(
$_POST
[
'data'
]))
{
return
;
}
$toggle
=
$_POST
[
'data'
];
$data
=
$this
->
getMarked
(
$session
);
$remove
=
[];
$append
=
[];
foreach
(
$toggle
as
$key
=>
$value
)
{
if
(
$value
)
{
$append
[]
=
$key
;
}
else
{
$remove
[]
=
$key
;
}
}
if
(
!
empty
(
$append
))
{
$data
=
array_merge
(
$data
,
$append
);
}
$data
=
array_unique
(
$data
);
if
(
!
empty
(
$remove
))
{
$data
=
array_diff
(
$data
,
$remove
);
}
$this
->
setMarked
(
$session
,
$data
);
$qty
=
count
(
$data
);
echo
Json
::
encode
([
'qty'
=>
$qty
,
'title'
=>
"Разослать выделенным (
$qty
)"
,
]);
}
public
function
actionResetMark
(
$session
)
{
$this
->
setMarked
(
$session
,
[]);
echo
Json
::
encode
(
array
(
'qty'
=>
0
,
'title'
=>
"Разослать выделенным"
,
));
}
/**
* Finds the Faq model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
...
...
common/modules/testings/models/SearchTestingSendHistory.php
0 → 100644
View file @
eac79345
<?php
namespace
common\modules\testings\models
;
use
Yii
;
use
yii\base\Model
;
use
yii\data\ActiveDataProvider
;
use
common\modules\testings\models\TestingSendHistory
;
class
SearchTestingSendHistory
extends
TestingSendHistory
{
/**
* @inheritdoc
*/
public
function
rules
()
{
return
[
[[
'id'
,
'session_id'
,
'sended'
,
'user_id'
],
'integer'
],
[[
'id'
,
'email'
,
'session_id'
,
'file'
,
'sended'
,
'user_id'
],
'safe'
],
];
}
/**
* @inheritdoc
*/
public
function
scenarios
()
{
// bypass scenarios() implementation in the parent class
return
Model
::
scenarios
();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public
function
search
(
$params
,
$order
=
null
,
$limit
=
null
)
{
$query
=
TestingSendHistory
::
find
();
$dataProvider
=
new
ActiveDataProvider
([
'query'
=>
$query
,
'pagination'
=>
[
'pageSize'
=>
self
::
PAGE_SIZE
],
'sort'
=>
array
(
'defaultOrder'
=>
'sended DESC'
,
),
]);
$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
,
'email'
=>
$this
->
email
,
'session_id'
=>
Yii
::
$app
->
request
->
get
(
'session'
),
'file'
=>
$this
->
file
,
'sended'
=>
$this
->
sended
,
'user_id'
=>
0
,
]);
if
(
!
empty
(
$order
))
$query
->
orderBy
(
$order
);
if
(
!
empty
(
$limit
))
$query
->
limit
(
$limit
);
return
$dataProvider
;
}
}
\ No newline at end of file
common/modules/testings/models/TestingSendHistory.php
View file @
eac79345
...
...
@@ -5,12 +5,13 @@ namespace common\modules\testings\models;
use
Yii
;
use
yii\behaviors\TimestampBehavior
;
use
yii\db\Expression
;
use
yii\helpers\Url
;
class
TestingSendHistory
extends
\common\components\ActiveRecordModel
{
const
PAGE_SIZE
=
10
;
const
FOLDER_PATH
=
'/upload/dublicates/'
;
const
FOLDER_PATH
=
'/upload
s
/dublicates/'
;
const
OFFSET_EXCEL_ROWS
=
3
;
...
...
@@ -152,12 +153,12 @@ class TestingSendHistory extends \common\components\ActiveRecordModel
public
function
getFilePath
()
{
return
Yii
::
get
PathOfAlias
(
'
webroot'
)
.
self
::
FOLDER_PATH
.
$this
->
file
;
return
Yii
::
get
Alias
(
'@
webroot'
)
.
self
::
FOLDER_PATH
.
$this
->
file
;
}
public
function
getFileUrl
()
{
return
Yii
::
app
()
->
getBaseUrl
(
true
)
.
self
::
FOLDER_PATH
.
$this
->
file
;
return
Url
::
to
([
self
::
FOLDER_PATH
.
$this
->
file
])
;
}
public
function
generateFile
(
$users
,
$session_id
)
...
...
common/modules/testings/views/testing-answer-admin/manage.php
View file @
eac79345
...
...
@@ -57,7 +57,6 @@ if ($question)
[
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{view} {update}'
,
'contentOptions'
=>
[
'style'
=>
'width:60px;'
,
'align'
=>
'center'
],
],
],
]);
?>
...
...
common/modules/testings/views/testing-passing-admin/manage.php
View file @
eac79345
...
...
@@ -131,7 +131,6 @@ use common\modules\testings\models\TestingPassing;
[
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{view} {delete}'
,
'contentOptions'
=>
[
'style'
=>
'width:60px;'
,
'align'
=>
'center'
],
],
],
]);
?>
common/modules/testings/views/testing-passing-admin/statistics.php
View file @
eac79345
...
...
@@ -205,7 +205,6 @@ use common\modules\testings\models\TestingPassing;
[
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{view} {delete}'
,
'contentOptions'
=>
[
'style'
=>
'width:60px;'
,
'align'
=>
'center'
],
],
],
]);
?>
\ No newline at end of file
common/modules/testings/views/testing-question-admin/manage.php
View file @
eac79345
...
...
@@ -155,7 +155,6 @@ $this->registerJs($js, yii\web\View::POS_READY, 'expnd.info');
[
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{view} {update}'
,
'contentOptions'
=>
[
'style'
=>
'width:60px;'
,
'align'
=>
'center'
],
],
],
]);
?>
\ No newline at end of file
common/modules/testings/views/testing-send-history-admin/manage.php
0 → 100644
View file @
eac79345
<?php
use
yii\helpers\Html
;
use
\common\components\zii\AdminGrid
;
use
yii\helpers\Url
;
use
common\modules\testings\models\TestingSendHistory
;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<?php
echo
AdminGrid
::
widget
([
'dataProvider'
=>
$dataProvider
,
// 'filterModel' => $searchModel,
'columns'
=>
[
// ['class' => 'yii\grid\SerialColumn'],
'email'
,
[
'attribute'
=>
'sended'
,
'value'
=>
function
(
$model
)
{
return
date
(
"d.m.Y H:i:s"
,
$model
->
sended
);
}
],
[
'attribute'
=>
'unisender_status'
,
'value'
=>
function
(
$model
)
{
return
TestingSendHistory
::
getStatusTitle
(
$model
->
unisender_status
);
},
'filter'
=>
TestingSendHistory
::
getStatusTitle
(),
],
[
'class'
=>
\common\components\ColorActionColumn
::
className
(),
'template'
=>
'{send} {file}'
,
'buttons'
=>
[
'send'
=>
function
(
$url
,
$model
,
$key
)
{
if
(
$model
->
file
&&
file_exists
(
$model
->
getFilePath
()))
{
return
Html
::
a
(
'<i class="fa fa-envelope fa-lg"></i>'
,
Url
::
to
([
'testings/testing-session-admin/send-message'
,
'id'
=>
$session
->
id
,
'user'
=>
$model
->
id
]),
[
'title'
=>
'Уведомить о тестировании'
,
'data-toggle'
=>
'tooltip'
,
'data-pjax'
=>
'0'
,
]);
}
},
'file'
=>
function
(
$url
,
$model
,
$key
)
{
if
(
$model
->
file
&&
file_exists
(
$model
->
getFilePath
()))
{
return
Html
::
a
(
'<i class="fa fa-file-text-o fa-lg"></i>'
,
$model
->
getFileUrl
(),
[
'title'
=>
'Скачать список доступов'
,
'data-toggle'
=>
'tooltip'
,
'data-pjax'
=>
'0'
,
]);
}
},
]
]
],
]);
?>
\ No newline at end of file
common/modules/testings/views/testing-session-admin/manage.php
View file @
eac79345
...
...
@@ -93,7 +93,6 @@ use \common\components\zii\AdminGrid;
[
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{view} {update}'
,
'contentOptions'
=>
[
'style'
=>
'width:60px;'
,
'align'
=>
'center'
],
],
],
]);
?>
\ No newline at end of file
common/modules/testings/views/testing-test-admin/manage.php
View file @
eac79345
...
...
@@ -6,7 +6,6 @@ use \common\components\zii\AdminGrid;
use
common\modules\testings\models\TestingSession
;
/* @var $this yii\web\View */
/* @var $searchModel common\modules\faq\models\SearchFaq */
/* @var $dataProvider yii\data\ActiveDataProvider */
$session_id
=
null
;
...
...
@@ -75,7 +74,6 @@ if($session)
[
'class'
=>
'common\components\ColorActionColumn'
,
'template'
=>
'{view} {update}'
,
'contentOptions'
=>
[
'style'
=>
'width:60px;'
,
'align'
=>
'center'
],
],
],
]);
?>
...
...
common/modules/testings/views/testing-user-admin/manage.php
View file @
eac79345
...
...
@@ -13,10 +13,21 @@ use common\modules\testings\models\TestingPassing;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$session
=
null
;
if
(
\Yii
::
$app
->
request
->
get
(
'session'
))
{
$session
=
TestingSession
::
findOne
(
\Yii
::
$app
->
request
->
get
(
'session'
));
}
?>
<p>
<?=
Html
::
a
(
'Добавить'
,
[
'create'
],
[
'class'
=>
'btn btn-success'
])
?>
<?php
if
(
$session
)
:
?>
<?=
Html
::
a
(
'Разослать уведомления всем'
,
[
'/testings/testing-session-admin/send-message-to-all'
,
'id'
=>
$session
->
id
],
[
'class'
=>
'btn btn-info'
])
?>
<?=
Html
::
a
(
'История отправки дубликатов'
,
[
'/testings/testing-send-history-admin/manage'
,
'session'
=>
$session
->
id
],
[
'class'
=>
'btn btn-info'
])
?>
<?=
Html
::
a
(
'Импорт пользователей из XLS'
,
[
'/testings/testing-session-admin/import-passings'
,
'id'
=>
$session
->
id
],
[
'class'
=>
'btn btn-info'
])
?>
<?php
endif
;
?>
</p>
<?php
if
(
\Yii
::
$app
->
session
->
hasFlash
(
'flash'
))
:
?>
...
...
@@ -99,104 +110,88 @@ $columns = [
$link
=
''
;
if
(
\Yii
::
$app
->
request
->
get
(
'session'
)
)
{
$
session
=
TestingSession
::
findOne
(
\Yii
::
$app
->
request
->
get
(
'session'
)
);
if
(
$session
)
{
$marked
=
\Yii
::
$app
->
controller
->
getMarked
(
$session
->
id
);
$qty
=
count
(
$marked
);
$style
=
(
$qty
)
?
''
:
'display:none;'
;
$send
=
Html
::
a
(
"Разослать выделенным (
$qty
)"
,
[
'/testings/testing-session-admin/send-message-to-marked'
,
'id'
=>
$session
->
id
],
[
'style'
=>
$style
,
'id'
=>
'sendMarkup'
]
);
$clear
=
Html
::
a
(
"[сброс]"
,
[
'resetMark'
,
'session'
=>
$session
->
id
],
[
'style'
=>
$style
,
'id'
=>
'resetMarkup'
]
);
$link
=
$send
.
' '
.
$clear
;
// array_unshift(
// $columns,
// [
// 'class' => 'MarkBoxColumn'
,
// 'update_url' => Url::to(['update-mark', 'session' => $session->id]),
// ]
// );
foreach
(
$session
->
tests
as
$test
)
{
$columns
=
ArrayHelper
::
merge
(
$columns
,
if
(
$session
)
{
$
marked
=
\Yii
::
$app
->
controller
->
getMarked
(
$session
->
id
);
$qty
=
count
(
$marked
);
$style
=
(
$qty
)
?
''
:
'display:none;'
;
$send
=
Html
::
a
(
"Разослать выделенным (
$qty
)"
,
[
'testings/testing-session-admin/send-message-to-marked'
,
'id'
=>
$session
->
id
],
[
'style'
=>
$style
,
'id'
=>
'sendMarkup'
]
);
$clear
=
Html
::
a
(
"[сброс]"
,
[
'update-mark'
,
'session'
=>
$session
->
id
],
[
'style'
=>
$style
,
'id'
=>
'resetMarkup'
]
);
$link
=
$send
.
' '
.
$clear
.
'<br><br>'
;
echo
$link
;
array_unshift
(
$columns
,
[
'class'
=>
'common\modules\testings\components\MarkBoxColumn'
,
'updateUrl'
=>
Url
::
to
([
'update-mark'
,
'session'
=>
$session
->
id
])
,
]
);
foreach
(
$session
->
tests
as
$test
)
{
$columns
=
ArrayHelper
::
merge
(
$columns
,
[
[
[
'header'
=>
$test
->
name
,
'value'
=>
function
(
$model
)
use
(
$test
)
'header'
=>
$test
->
name
,
'value'
=>
function
(
$model
)
use
(
$test
)
{
$passing
=
TestingPassing
::
find
()
->
where
([
'test_id'
=>
$test
->
id
,
'user_id'
=>
$model
->
id
])
->
one
();
if
(
$passing
)
{
return
Html
::
a
(
"Да"
,
[
"/testings/testing-passing-admin/change-status"
,
"user"
=>
$model
->
id
,
"test"
=>
$test
->
id
],
[
"title"
=>
"Изменить на НЕТ"
]);
}
else
{
$passing
=
TestingPassing
::
find
()
->
where
([
'test_id'
=>
$test
->
id
,
'user_id'
=>
$model
->
id
])
->
one
();
if
(
$passing
)
{
return
Html
::
a
(
"Да"
,
[
"/testings/testing-passing-admin/change-status"
,
"user"
=>
$model
->
id
,
"test"
=>
$test
->
id
],
[
"title"
=>
"Изменить на НЕТ"
]);
}
else
{
return
Html
::
a
(
"Нет"
,
[
"/testings/testing-passing-admin/change-status"
,
"user"
=>
$model
->
id
,
"test"
=>
$test
->
id
],
[
"title"
=>
"Изменить на ДА"
]);
}
},
'format'
=>
'html'
,
]
return
Html
::
a
(
"Нет"
,
[
"/testings/testing-passing-admin/change-status"
,
"user"
=>
$model
->
id
,
"test"
=>
$test
->
id
],
[
"title"
=>
"Изменить на ДА"
]);
}
},
'format'
=>
'html'
,
]
);
}
// $this->tabs = array(
// 'разослать уведомления всем' => $this->createUrl('/testings/testingSessionAdmin/sendMessageToAll',array('id'=>$session->id)),
// 'история отправки дубликатов' => $this->createUrl('/testings/testingSendHistoryAdmin/manage', array('session'=>$session->id)),
// 'импорт пользователей из CSV' => $this->createUrl(
// '/testings/testingSessionAdmin/importPassings',
// array('id'=>$session->id)
// ),
// );
// $buttons = array(
// 'class' => 'CButtonColumn',
// 'template' => '{sendEmail}{view}{update}',
// 'buttons' => array(
// 'sendEmail' => array(
// 'url' => 'array("/testings/testingSessionAdmin/sendMessage","id"=>'.$session->id.',"user"=>$data->id)',
// 'imageUrl' => '/images/icons/mail.png',
// 'options' => array(
// 'title' => 'Уведомить о тестировании',
// ),
// ),
// ),
// );
]
);
}
$buttons
=
[
[
'class'
=>
\common\components\ColorActionColumn
::
className
(),
'template'
=>
'{send} {view} {update}'
,
'buttons'
=>
[
'send'
=>
function
(
$url
,
$model
,
$key
)
use
(
$session
)
{
return
Html
::
a
(
'<i class="fa fa-envelope fa-lg"></i>'
,
Url
::
to
([
'testings/testing-session-admin/send-message'
,
'id'
=>
$session
->
id
,
'user'
=>
$model
->
id
]),
[
'title'
=>
'Уведомить о тестировании'
,
'data-toggle'
=>
'tooltip'
,
'data-pjax'
=>
'0'
,
]);
},
]
]
];
$columns
=
ArrayHelper
::
merge
(
$columns
,
$buttons
);
}
echo
AdminGrid
::
widget
([
'dataProvider'
=>
$dataProvider
,
'filterModel'
=>
$searchModel
,
'columns'
=>
$columns
]);
// $this->widget('AdminGrid', array(
// 'id' => 'testing-user-grid',
// 'dataProvider' => $model->search(),
// 'filter' => $model,
// 'columns' => $columns,
// 'template' => "$link {pagerSelect}{summary}<br/>{pager}<br/>{items}<br/>{pager}",
// ));
\ No newline at end of file
'columns'
=>
$columns
,
]);
\ No newline at end of file
common/modules/testings/views/testingSendHistoryAdmin/manage.php
deleted
100644 → 0
View file @
0d6586b6
<?php
$this
->
tabs
=
array
(
'список назначений тестов пользователям'
=>
$this
->
createUrl
(
'/testings/testingUserAdmin/manage'
,
array
(
'session'
=>
$session_id
)),
);
$this
->
page_title
=
'История отправок дубликатов'
;
$this
->
widget
(
'AdminGrid'
,
array
(
'id'
=>
'testing-sendhistory-grid'
,
'dataProvider'
=>
$model
->
search
(),
'filter'
=>
$model
,
'columns'
=>
array
(
'email'
,
array
(
'name'
=>
'sended'
,
'value'
=>
'date("d.m.Y H:i:s", $data->sended)'
,
),
array
(
'name'
=>
'unisender_status'
,
'value'
=>
'TestingSendHistory::getStatusTitle($data->unisender_status)'
,
'filter'
=>
TestingSendHistory
::
getStatusTitle
(),
'headerHtmlOptions'
=>
array
(
'style'
=>
'width: 360px;'
)
),
array
(
'header'
=>
''
,
'type'
=>
'raw'
,
'value'
=>
function
(
$data
)
{
if
(
$data
->
file
&&
file_exists
(
$data
->
getFilePath
()))
{
$send
=
CHtml
::
link
(
CHtml
::
image
(
'/images/icons/mail.png'
,
'Повторить отправку'
,
array
(
'title'
=>
'Повторить отправку'
)),
'#'
,
array
(
'data-id'
=>
$data
->
id
,
'data-email'
=>
$data
->
email
,
'id'
=>
"resend"
));
$file
=
CHtml
::
link
(
CHtml
::
image
(
'/img/excel_bg.png'
,
'Скачать список доступов'
,
array
(
'title'
=>
'Скачать список доступов'
)),
$data
->
getFileUrl
());
return
$send
.
' '
.
$file
;
}
}
)
),
'template'
=>
"
{
pagerSelect}{summary}<br/>{pager}<br/>{items}<br/>{pager
}
"
,
));
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