Commit 2ad8eaef authored by Andrew Robert Nicols's avatar Andrew Robert Nicols
Browse files

Refactor view/index.php to correctly set view options for each view (Fixes #627966).



I've also removed some old variables which don't seem to be used any more.

To fix this bug, I've moved the loop through of the users views. Whereas
before, the loop was only entered into if there were course groups, the
loop is always hit now.

While this is less efficient if the site has disabled public profile views,
and the user has no course groups, it's more effective if either of these
cases is true, and allows for easier expansion in the future.
Signed-off-by: default avatarAndrew Robert Nicols <andrew.nicols@luns.net.uk>
parent 5c4945fb
......@@ -46,19 +46,15 @@ $data = View::get_myviews_data($limit, $offset);
$userid = $USER->get('id');
/* Get a list of groups that the user belongs to which views can
be sumitted. */
if (!$tutorgroupdata = group_get_user_course_groups()) {
$tutorgroupdata = array();
}
else {
$options = array();
foreach ($data->data as &$view) {
if (empty($view['submittedto'])) {
$view['submitto'] = view_group_submission_form($view['id'], $tutorgroupdata);
}
if ($view['type'] == 'profile' && get_config('allowpublicprofiles')) {
$view['togglepublic'] = togglepublic_form($view['id']);
}
be submitted. */
$tutorgroupdata = group_get_user_course_groups();
foreach ($data->data as &$view) {
if ($tutorgroupdata && empty($view['submittedto'])) {
$view['submitto'] = view_group_submission_form($view['id'], $tutorgroupdata);
}
if ($view['type'] == 'profile' && get_config('allowpublicprofiles')) {
$view['togglepublic'] = togglepublic_form($view['id']);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment