Exemplo n.º 1
0
function sp_utility_nestedArrayCollapse($the_array)
{
    $out = array();
    foreach ($the_array as $a) {
        if (is_array($a)) {
            $out = array_merge($out, sp_utility_nestedArrayCollapse($a));
        } else {
            $out[] = $a;
        }
    }
    return $out;
}
Exemplo n.º 2
0
					} catch(err) { }
			    })}
			})
		}
	}
</script>' . "\n";
echo "<table width='100%'><tr>";
echo "<td id='studyplan-review-left-column' valign='top'>";
if (groups_get_course_groupmode($course)) {
    echo get_string('groups', 'studyplan') . "<br>\n";
    echo "<select name=\"group\" onchange=\"studyplanGroupSelectorChanged(this)\">";
    if (has_capability('mod/studyplan:showallgroups', context_module::instance($PAGE->cm->id))) {
        print "<option value=\"0\">" . get_string('allparticipants', 'studyplan') . "</option>\n";
        $groups = groups_get_all_groups($course->id);
    } else {
        $groups = sp_utility_nestedArrayCollapse(groups_get_user_groups($course->id));
    }
    foreach ($groups as $g) {
        if (gettype($g) == "object") {
            $g_id = $g->id;
            $g_name = $g->name;
        } else {
            $g_id = $g;
            $g_name = groups_get_group_name($g);
        }
        $s = "";
        if ($g_id == $groupid) {
            $s = ' selected="selected" ';
        }
        print "<option value=\"{$g_id}\"  {$s}>" . htmlentities($g_name) . "</option>\n";
    }