Пример #1
0
 protected static function get_data($groupid)
 {
     global $USER;
     if (!defined('GROUP')) {
         define('GROUP', $groupid);
     }
     // get the currently requested group
     $group = group_current_group();
     $role = group_user_access($group->id);
     if ($role) {
         // For group members, display a list of views that others have
         // shared to the group
         $data['sharedviews'] = View::get_sharedviews_data(null, 0, $group->id);
         if (group_user_can_assess_submitted_views($group->id, $USER->get('id'))) {
             // Display a list of views submitted to the group
             $data['allsubmittedviews'] = View::get_submitted_views($group->id);
         }
     }
     if (group_allows_submission($group->grouptype) && ($userviewdata = View::get_user_views())) {
         // A user can submit more than one view to the same group, but no view can be
         // submitted to more than one group.
         // Display a list of views this user has submitted to this group, and a submission
         // form containing drop-down of their unsubmitted views.
         $data['mysubmittedviews'] = View::get_submitted_views($group->id, $USER->get('id'));
         if (!empty($data['mysubmittedviews'])) {
             foreach ($data['mysubmittedviews'] as &$v) {
                 $url = get_config('wwwroot') . 'view/view.php?id=' . $v['id'];
                 if ($v['submittedtime']) {
                     $v['strsubmitted'] = get_string('youhavesubmittedon', 'view', $url, $v['title'], format_date($v['submittedtime']));
                 } else {
                     $v['strsubmitted'] = get_string('youhavesubmitted', 'view', $url, $v['title']);
                 }
             }
         }
         $data['group_view_submission_form'] = group_view_submission_form($group->id, $userviewdata);
     }
     $data['group'] = $group;
     return $data;
 }
Пример #2
0
function group_display_settings($group)
{
    $string = get_string('membershiptype.' . $group->jointype, 'group');
    if (group_allows_submission($group->grouptype)) {
        $string .= ', ' . get_string('allowssubmissions', 'group');
    }
    if ($group->public) {
        $string .= ', ' . get_string('publiclyvisible', 'group');
    }
    return $string;
}