Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-tool_lifecycle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-tool_lifecycle
Commits
1c70de06
Commit
1c70de06
authored
3 years ago
by
Laur0r
Browse files
Options
Downloads
Patches
Plain Diff
Add filter to view.php
parent
970932c4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
classes/local/table/interaction_attention_table.php
+19
-5
19 additions, 5 deletions
classes/local/table/interaction_attention_table.php
classes/view_controller.php
+2
-2
2 additions, 2 deletions
classes/view_controller.php
view.php
+23
-1
23 additions, 1 deletion
view.php
with
44 additions
and
8 deletions
classes/local/table/interaction_attention_table.php
+
19
−
5
View file @
1c70de06
...
...
@@ -45,9 +45,9 @@ class interaction_attention_table extends interaction_table {
* @param int $uniqueid Unique id of this table.
* @param int[] $courseids List of ids for courses that require attention.
*/
public
function
__construct
(
$uniqueid
,
$courseids
)
{
public
function
__construct
(
$uniqueid
,
$courseids
,
$filterdata
)
{
parent
::
__construct
(
$uniqueid
);
global
$PAGE
;
global
$PAGE
,
$DB
;
$fields
=
"p.id as processid, c.id as courseid, c.fullname as coursefullname, c.shortname as courseshortname, "
.
"c.startdate, cc.name as category , s.id as stepinstanceid, s.instancename as stepinstancename, "
.
...
...
@@ -59,13 +59,27 @@ class interaction_attention_table extends interaction_table {
'left join {course_categories} cc on c.category = cc.id'
;
$ids
=
implode
(
','
,
$courseids
);
$where
=
'FALSE'
;
$where
=
[
'FALSE'
]
;
if
(
$ids
)
{
$where
=
'p.courseid IN ('
.
$ids
.
')'
;
$where
=
[
'p.courseid IN ('
.
$ids
.
')'
];
}
$params
=
[];
if
(
$filterdata
)
{
if
(
$filterdata
&&
$filterdata
->
shortname
)
{
$where
[]
=
$DB
->
sql_like
(
'c.shortname'
,
':shortname'
,
false
,
false
);
$params
[
'shortname'
]
=
'%'
.
$DB
->
sql_like_escape
(
$filterdata
->
shortname
)
.
'%'
;
}
if
(
$filterdata
&&
$filterdata
->
fullname
)
{
$where
[]
=
$DB
->
sql_like
(
'c.fullname'
,
':fullname'
,
false
,
false
);
$params
[
'fullname'
]
=
'%'
.
$DB
->
sql_like_escape
(
$filterdata
->
fullname
)
.
'%'
;
}
}
$this
->
column_nosort
=
array
(
'status'
,
'tools'
);
$this
->
set_sql
(
$fields
,
$from
,
$where
,
[]
);
$this
->
set_sql
(
$fields
,
$from
,
join
(
" AND "
,
$where
)
,
$params
);
$this
->
define_baseurl
(
$PAGE
->
url
);
$this
->
init
();
}
...
...
This diff is collapsed.
Click to expand it.
classes/view_controller.php
+
2
−
2
View file @
1c70de06
...
...
@@ -52,7 +52,7 @@ class view_controller {
* @throws \dml_exception
* @throws \invalid_parameter_exception
*/
public
function
handle_view
(
$renderer
)
{
public
function
handle_view
(
$renderer
,
$filterdata
)
{
global
$DB
;
$courses
=
get_user_capability_course
(
'tool/lifecycle:managecourses'
,
null
,
false
);
...
...
@@ -91,7 +91,7 @@ class view_controller {
}
echo
$renderer
->
heading
(
get_string
(
'tablecoursesrequiringattention'
,
'tool_lifecycle'
),
3
);
$table1
=
new
interaction_attention_table
(
'tool_lifecycle_interaction'
,
$requiresinteraction
);
$table1
=
new
interaction_attention_table
(
'tool_lifecycle_interaction'
,
$requiresinteraction
,
$filterdata
);
echo
$renderer
->
box_start
(
"managing_courses_tables"
);
$table1
->
out
(
50
,
false
);
...
...
This diff is collapsed.
Click to expand it.
view.php
+
23
−
1
View file @
1c70de06
...
...
@@ -63,6 +63,28 @@ $renderer = $PAGE->get_renderer('tool_lifecycle');
echo
$renderer
->
header
();
$controller
->
handle_view
(
$renderer
);
$mform
=
new
\tool_lifecycle\local\form\form_backups_filter
();
// Cache handling.
$cache
=
cache
::
make
(
'tool_lifecycle'
,
'mformdata'
);
if
(
$mform
->
is_cancelled
())
{
$cache
->
delete
(
'coursebackups_filter'
);
redirect
(
$PAGE
->
url
);
}
else
if
(
$data
=
$mform
->
get_data
())
{
$cache
->
set
(
'coursebackups_filter'
,
$data
);
}
else
{
$data
=
$cache
->
get
(
'coursebackups_filter'
);
if
(
$data
)
{
$mform
->
set_data
(
$data
);
}
}
echo
'<br>'
;
$mform
->
display
();
echo
'<br>'
;
$controller
->
handle_view
(
$renderer
,
$data
);
echo
$renderer
->
footer
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment