当前位置: 首页>>代码示例>>PHP>>正文


PHP groups_get_activity_group函数代码示例

本文整理汇总了PHP中groups_get_activity_group函数的典型用法代码示例。如果您正苦于以下问题:PHP groups_get_activity_group函数的具体用法?PHP groups_get_activity_group怎么用?PHP groups_get_activity_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了groups_get_activity_group函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: choice_get_response_data

 function choice_get_response_data($choice, $cm, $groupmode)
 {
     global $CFG, $USER;
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     /// Get the current group
     if ($groupmode > 0) {
         $currentgroup = groups_get_activity_group($cm);
     } else {
         $currentgroup = 0;
     }
     /// Initialise the returned array, which is a matrix:  $allresponses[responseid][userid] = responseobject
     $allresponses = array();
     /// First get all the users who have access here
     /// To start with we assume they are all "unanswered" then move them later
     $allresponses[0] = get_users_by_capability($context, 'mod/choice:choose', 'u.id, u.picture, u.firstname, u.lastname, u.idnumber', 'u.firstname ASC', '', '', $currentgroup, '', false, true);
     /// Get all the recorded responses for this choice
     $rawresponses = get_records('choice_answers', 'choiceid', $choice->id);
     /// Use the responses to move users into the correct column
     if ($rawresponses) {
         foreach ($rawresponses as $response) {
             if (isset($allresponses[0][$response->userid])) {
                 // This person is enrolled and in correct group
                 $allresponses[0][$response->userid]->timemodified = $response->timemodified;
                 $allresponses[$response->optionid][$response->userid] = clone $allresponses[0][$response->userid];
                 unset($allresponses[0][$response->userid]);
                 // Remove from unanswered column
             }
         }
     }
     return $allresponses;
 }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:linker.php

示例2: page_index

    public function page_index() {
        global $CFG;
        $output = '';
        // Checking wiki instance
        if (!$wiki = wiki_get_wiki($this->page->cm->instance)) {
            return false;
        }

        // @TODO: Fix call to wiki_get_subwiki_by_group
        $gid = groups_get_activity_group($this->page->cm);
        $gid = !empty($gid) ? $gid : 0;
        if (!$subwiki = wiki_get_subwiki_by_group($this->page->cm->instance, $gid)) {
            return false;
        }
        $swid = $subwiki->id;
        $pages = wiki_get_page_list($swid);
        $selectoptions = array();
        foreach ($pages as $page) {
            $selectoptions[$page->id] = $page->title;
        }
        $label = get_string('pageindex', 'wiki') . ': ';
        $select = new single_select(new moodle_url('/mod/wiki/view.php'), 'pageid', $selectoptions);
        $select->label = $label;
        return $this->output->container($this->output->render($select), 'wiki_index');
    }
开发者ID:nigeldaley,项目名称:moodle,代码行数:25,代码来源:renderer.php

示例3: init

 /**
  * Initialises table
  */
 public function init()
 {
     $cm = $this->feedbackstructure->get_cm();
     $this->uniqueid = 'feedback-showentry-anon-list-' . $cm->instance;
     // There potentially can be both tables with anonymouns and non-anonymous responses on
     // the same page (for example when feedback anonymity was changed after some people
     // already responded). In this case we need to distinguish tables' pagination parameters.
     $this->request[TABLE_VAR_PAGE] = 'apage';
     $tablecolumns = ['random_response'];
     $tableheaders = [get_string('response_nr', 'feedback')];
     if ($this->feedbackstructure->get_feedback()->course == SITEID && !$this->feedbackstructure->get_courseid()) {
         $tablecolumns[] = 'courseid';
         $tableheaders[] = get_string('course');
     }
     $this->define_columns($tablecolumns);
     $this->define_headers($tableheaders);
     $this->sortable(true, 'random_response');
     $this->collapsible(true);
     $this->set_attribute('id', 'showentryanontable');
     $params = ['instance' => $cm->instance, 'anon' => FEEDBACK_ANONYMOUS_YES, 'courseid' => $this->feedbackstructure->get_courseid()];
     $fields = 'c.id, c.random_response, c.courseid';
     $from = '{feedback_completed} c';
     $where = 'c.anonymous_response = :anon AND c.feedback = :instance';
     if ($this->feedbackstructure->get_courseid()) {
         $where .= ' AND c.courseid = :courseid';
     }
     $group = groups_get_activity_group($this->feedbackstructure->get_cm(), true);
     if ($group) {
         $where .= ' AND c.userid IN (SELECT g.userid FROM {groups_members} g WHERE g.groupid = :group)';
         $params['group'] = $group;
     }
     $this->set_sql($fields, $from, $where, $params);
     $this->set_count_sql("SELECT COUNT(c.id) FROM {$from} WHERE {$where}", $params);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:37,代码来源:responses_anon_table.php

示例4: load_relevant_students

    /**
     * Get information about which students to show in the report.
     * @param object $cm the coures module.
     * @return an array with four elements:
     *      0 => integer the current group id (0 for none).
     *      1 => array ids of all the students in this course.
     *      2 => array ids of all the students in the current group.
     *      3 => array ids of all the students to show in the report. Will be the
     *              same as either element 1 or 2.
     */
    protected function load_relevant_students($cm) {
        $currentgroup = groups_get_activity_group($cm, true);

        if (!$students = get_users_by_capability($this->context,
                array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),
                'u.id, 1', '', '', '', '', '', false)) {
            $students = array();
        } else {
            $students = array_keys($students);
        }

        if (empty($currentgroup)) {
            return array($currentgroup, $students, array(), $students);
        }

        // We have a currently selected group.
        if (!$groupstudents = get_users_by_capability($this->context,
                array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),
                'u.id, 1', '', '', '', $currentgroup, '', false)) {
            $groupstudents = array();
        } else {
            $groupstudents = array_keys($groupstudents);
        }

        return array($currentgroup, $students, $groupstudents, $groupstudents);
    }
开发者ID:rolandovanegas,项目名称:moodle,代码行数:36,代码来源:attemptsreport.php

示例5: get_current_group

 /**
  * Get the current group for the user user looking at the report.
  *
  * @param object $cm the course_module information.
  * @param object $coures the course settings.
  * @param context $context the quiz context.
  * @return int the current group id, if applicable. 0 for all users,
  *      NO_GROUPS_ALLOWED if the user cannot see any group.
  */
 public function get_current_group($cm, $course, $context)
 {
     $groupmode = groups_get_activity_groupmode($cm, $course);
     $currentgroup = groups_get_activity_group($cm, true);
     if ($groupmode == SEPARATEGROUPS && !$currentgroup && !has_capability('moodle/site:accessallgroups', $context)) {
         $currentgroup = self::NO_GROUPS_ALLOWED;
     }
     return $currentgroup;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:18,代码来源:default.php

示例6: __construct

 public function __construct($recordorid, $options = array())
 {
     global $USER;
     parent::__construct($recordorid, $options);
     $this->cm = get_coursemodule_from_instance('mediagallery', $this->record->id);
     if (!empty($this->cm)) {
         $this->context = \context_module::instance($this->cm->id);
         $this->options['currentgroup'] = groups_get_activity_group($this->cm, true);
         $this->options['groupmode'] = groups_get_activity_groupmode($this->cm);
         $this->options['groups'] = groups_get_all_groups($this->cm->course, $USER->id, $this->cm->groupingid);
     }
 }
开发者ID:eSrem,项目名称:moodle-mod_mediagallery,代码行数:12,代码来源:collection.php

示例7: login_user

 /**
  * Log the current user into a chat room in the given chat.
  *
  * @param int $chatid the chat instance id
  * @param int $groupid the user group id
  * @return array of warnings and the chat unique session id
  * @since Moodle 3.0
  * @throws moodle_exception
  */
 public static function login_user($chatid, $groupid = 0)
 {
     global $DB;
     $params = self::validate_parameters(self::login_user_parameters(), array('chatid' => $chatid, 'groupid' => $groupid));
     $warnings = array();
     // Request and permission validation.
     $chat = $DB->get_record('chat', array('id' => $params['chatid']), '*', MUST_EXIST);
     list($course, $cm) = get_course_and_cm_from_instance($chat, 'chat');
     $context = context_module::instance($cm->id);
     self::validate_context($context);
     require_capability('mod/chat:chat', $context);
     if (!empty($params['groupid'])) {
         $groupid = $params['groupid'];
         // Determine is the group is visible to user.
         if (!groups_group_visible($groupid, $course, $cm)) {
             throw new moodle_exception('notingroup');
         }
     } else {
         // Check to see if groups are being used here.
         if ($groupmode = groups_get_activity_groupmode($cm)) {
             $groupid = groups_get_activity_group($cm);
             // Determine is the group is visible to user (this is particullary for the group 0).
             if (!groups_group_visible($groupid, $course, $cm)) {
                 throw new moodle_exception('notingroup');
             }
         } else {
             $groupid = 0;
         }
     }
     // Get the unique chat session id.
     // Since we are going to use the chat via Web Service requests we set the ajax version (since it's the most similar).
     if (!($chatsid = chat_login_user($chat->id, 'ajax', $groupid, $course))) {
         throw moodle_exception('cantlogin', 'chat');
     }
     $result = array();
     $result['chatsid'] = $chatsid;
     $result['warnings'] = $warnings;
     return $result;
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:48,代码来源:external.php

示例8: forum_print_latest_discussions

/**
 * Prints the discussion view screen for a forum.
 *
 * @global object
 * @global object
 * @param object $course The current course object.
 * @param object $forum Forum to be printed.
 * @param int $maxdiscussions .
 * @param string $displayformat The display format to use (optional).
 * @param string $sort Sort arguments for database query (optional).
 * @param int $groupmode Group mode of the forum (optional).
 * @param void $unused (originally current group)
 * @param int $page Page mode, page to display (optional).
 * @param int $perpage The maximum number of discussions per page(optional)
 *
 */
function forum_print_latest_discussions($course, $forum, $maxdiscussions=-1, $displayformat='plain', $sort='',
                                        $currentgroup=-1, $groupmode=-1, $page=-1, $perpage=100, $cm=NULL) {
    global $CFG, $USER, $OUTPUT;

    if (!$cm) {
        if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $forum->course)) {
            print_error('invalidcoursemodule');
        }
    }
    $context = context_module::instance($cm->id);

    if (empty($sort)) {
        $sort = "d.timemodified DESC";
    }

    $olddiscussionlink = false;

 // Sort out some defaults
    if ($perpage <= 0) {
        $perpage = 0;
        $page    = -1;
    }

    if ($maxdiscussions == 0) {
        // all discussions - backwards compatibility
        $page    = -1;
        $perpage = 0;
        if ($displayformat == 'plain') {
            $displayformat = 'header';  // Abbreviate display by default
        }

    } else if ($maxdiscussions > 0) {
        $page    = -1;
        $perpage = $maxdiscussions;
    }

    $fullpost = false;
    if ($displayformat == 'plain') {
        $fullpost = true;
    }


// Decide if current user is allowed to see ALL the current discussions or not

// First check the group stuff
    if ($currentgroup == -1 or $groupmode == -1) {
        $groupmode    = groups_get_activity_groupmode($cm, $course);
        $currentgroup = groups_get_activity_group($cm);
    }

    $groups = array(); //cache

// If the user can post discussions, then this is a good place to put the
// button for it. We do not show the button if we are showing site news
// and the current user is a guest.

    $canstart = forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context);
    if (!$canstart and $forum->type !== 'news') {
        if (isguestuser() or !isloggedin()) {
            $canstart = true;
        }
        if (!is_enrolled($context) and !is_viewing($context)) {
            // allow guests and not-logged-in to see the button - they are prompted to log in after clicking the link
            // normal users with temporary guest access see this button too, they are asked to enrol instead
            // do not show the button to users with suspended enrolments here
            $canstart = enrol_selfenrol_available($course->id);
        }
    }

    if ($canstart) {
        echo '<div class="singlebutton forumaddnew">';
        echo "<form id=\"newdiscussionform\" method=\"get\" action=\"$CFG->wwwroot/mod/forum/post.php\">";
        echo '<div>';
        echo "<input type=\"hidden\" name=\"forum\" value=\"$forum->id\" />";
        switch ($forum->type) {
            case 'news':
            case 'blog':
                $buttonadd = get_string('addanewtopic', 'forum');
                break;
            case 'qanda':
                $buttonadd = get_string('addanewquestion', 'forum');
                break;
            default:
                $buttonadd = get_string('addanewdiscussion', 'forum');
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:lib.php

示例9: __construct

 /**
  * overridden constructor keeps a reference to the assignment class that is displaying this table
  *
  * @param assign $assignment The assignment class
  * @param int $perpage how many per page
  * @param string $filter The current filter
  * @param int $rowoffset For showing a subsequent page of results
  * @param bool $quickgrading Is this table wrapped in a quickgrading form?
  * @param string $downloadfilename
  */
 public function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgrading, $downloadfilename = null)
 {
     global $CFG, $PAGE, $DB, $USER;
     parent::__construct('mod_assign_grading');
     $this->is_persistent(true);
     $this->assignment = $assignment;
     // Check permissions up front.
     $this->hasgrantextension = has_capability('mod/assign:grantextension', $this->assignment->get_context());
     $this->hasgrade = $this->assignment->can_grade();
     // Check if we have the elevated view capablities to see the blind details.
     $this->hasviewblind = has_capability('mod/assign:viewblinddetails', $this->assignment->get_context());
     foreach ($assignment->get_feedback_plugins() as $plugin) {
         if ($plugin->is_visible() && $plugin->is_enabled()) {
             foreach ($plugin->get_grading_batch_operations() as $action => $description) {
                 if (empty($this->plugingradingbatchoperations)) {
                     $this->plugingradingbatchoperations[$plugin->get_type()] = array();
                 }
                 $this->plugingradingbatchoperations[$plugin->get_type()][$action] = $description;
             }
         }
     }
     $this->perpage = $perpage;
     $this->quickgrading = $quickgrading && $this->hasgrade;
     $this->output = $PAGE->get_renderer('mod_assign');
     $urlparams = array('action' => 'grading', 'id' => $assignment->get_course_module()->id);
     $url = new moodle_url($CFG->wwwroot . '/mod/assign/view.php', $urlparams);
     $this->define_baseurl($url);
     // Do some business - then set the sql.
     $currentgroup = groups_get_activity_group($assignment->get_course_module(), true);
     if ($rowoffset) {
         $this->rownum = $rowoffset - 1;
     }
     $users = array_keys($assignment->list_participants($currentgroup, true));
     if (count($users) == 0) {
         // Insert a record that will never match to the sql is still valid.
         $users[] = -1;
     }
     $params = array();
     $params['assignmentid1'] = (int) $this->assignment->get_instance()->id;
     $params['assignmentid2'] = (int) $this->assignment->get_instance()->id;
     $params['assignmentid3'] = (int) $this->assignment->get_instance()->id;
     $extrauserfields = get_extra_user_fields($this->assignment->get_context());
     $fields = user_picture::fields('u', $extrauserfields) . ', ';
     $fields .= 'u.id as userid, ';
     $fields .= 's.status as status, ';
     $fields .= 's.id as submissionid, ';
     $fields .= 's.timecreated as firstsubmission, ';
     $fields .= 's.timemodified as timesubmitted, ';
     $fields .= 's.attemptnumber as attemptnumber, ';
     $fields .= 'g.id as gradeid, ';
     $fields .= 'g.grade as grade, ';
     $fields .= 'g.timemodified as timemarked, ';
     $fields .= 'g.timecreated as firstmarked, ';
     $fields .= 'uf.mailed as mailed, ';
     $fields .= 'uf.locked as locked, ';
     $fields .= 'uf.extensionduedate as extensionduedate, ';
     $fields .= 'uf.workflowstate as workflowstate, ';
     $fields .= 'uf.allocatedmarker as allocatedmarker ';
     $from = '{user} u
                      LEFT JOIN {assign_submission} s
                             ON u.id = s.userid
                            AND s.assignment = :assignmentid1
                            AND s.latest = 1
                      LEFT JOIN {assign_grades} g
                             ON u.id = g.userid
                            AND g.assignment = :assignmentid2 ';
     // For group submissions we don't immediately create an entry in the assign_submission table for each user,
     // instead the userid is set to 0. In this case we use a different query to retrieve the grade for the user.
     if ($this->assignment->get_instance()->teamsubmission) {
         $params['assignmentid4'] = (int) $this->assignment->get_instance()->id;
         $grademaxattempt = 'SELECT mxg.userid, MAX(mxg.attemptnumber) AS maxattempt
                               FROM {assign_grades} mxg
                              WHERE mxg.assignment = :assignmentid4
                           GROUP BY mxg.userid';
         $from .= 'LEFT JOIN (' . $grademaxattempt . ') gmx
                          ON u.id = gmx.userid
                         AND g.attemptnumber = gmx.maxattempt ';
     } else {
         $from .= 'AND g.attemptnumber = s.attemptnumber ';
     }
     $from .= 'LEFT JOIN {assign_user_flags} uf
                      ON u.id = uf.userid
                     AND uf.assignment = :assignmentid3';
     $userparams = array();
     $userindex = 0;
     list($userwhere, $userparams) = $DB->get_in_or_equal($users, SQL_PARAMS_NAMED, 'user');
     $where = 'u.id ' . $userwhere;
     $params = array_merge($params, $userparams);
     // The filters do not make sense when there are no submissions, so do not apply them.
     if ($this->assignment->is_any_submission_plugin_enabled()) {
//.........这里部分代码省略.........
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:101,代码来源:gradingtable.php

示例10: error

        }
    } else {
        if ($elluminate->groupmode != 0 && $elluminate->groupparentid == 0) {
            if (!($cm = get_coursemodule_from_instance('elluminate', $elluminate->id, $course->id))) {
                error('Course Module ID was incorrect');
            }
        } else {
            error('Elluminate Live! Group Error');
        }
    }
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/elluminate:managepreloads', $context);
/// Check to see if groups are being used here
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
if (empty($currentgroup)) {
    $currentgroup = 0;
}
if (empty($elluminate->meetingid) && $elluminate->groupmode != 0) {
    elluminate_group_instance_check($elluminate, $cm->id);
}
$baseurl = $CFG->wwwroot . '/mod/elluminate/preload.php?id=' . $elluminate->id;
/// Print the page header
$strelluminates = get_string('modulenameplural', 'elluminate');
$strelluminate = get_string('modulename', 'elluminate');
$straddpreload = get_string('addpreload', 'elluminate');
$strdelpreload = get_string('deletewhiteboardpreload', 'elluminate');
$buttontext = update_module_button($cm->id, $course->id, $strelluminate);
$navigation = build_navigation(empty($delete) ? $straddpreload : $strdelpreload, $cm);
print_header_simple(format_string($elluminate->name), '', $navigation, '', '', true, $buttontext, navmenu($course, $cm));
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:preload.php

示例11: groups_print_activity_menu

/**
 * Print group menu selector for activity.
 *
 * @category group
 * @param stdClass|cm_info $cm course module object
 * @param string|moodle_url $urlroot return address that users get to if they choose an option;
 *   should include any parameters needed, e.g. "$CFG->wwwroot/mod/forum/view.php?id=34"
 * @param bool $return return as string instead of printing
 * @param bool $hideallparticipants If true, this prevents the 'All participants'
 *   option from appearing in cases where it normally would. This is intended for
 *   use only by activities that cannot display all groups together. (Note that
 *   selecting this option does not prevent groups_get_activity_group from
 *   returning 0; it will still do that if the user has chosen 'all participants'
 *   in another activity, or not chosen anything.)
 * @return mixed void or string depending on $return param
 */
function groups_print_activity_menu($cm, $urlroot, $return = false, $hideallparticipants = false)
{
    global $USER, $OUTPUT;
    if ($urlroot instanceof moodle_url) {
        // no changes necessary
    } else {
        if (strpos($urlroot, 'http') !== 0) {
            // Will also work for https
            // Display error if urlroot is not absolute (this causes the non-JS version to break)
            debugging('groups_print_activity_menu requires absolute URL for ' . '$urlroot, not <tt>' . s($urlroot) . '</tt>. Example: ' . 'groups_print_activity_menu($cm, $CFG->wwwroot . \'/mod/mymodule/view.php?id=13\');', DEBUG_DEVELOPER);
        }
        $urlroot = new moodle_url($urlroot);
    }
    if (!($groupmode = groups_get_activity_groupmode($cm))) {
        if ($return) {
            return '';
        } else {
            return;
        }
    }
    $context = context_module::instance($cm->id);
    $aag = has_capability('moodle/site:accessallgroups', $context);
    $usergroups = array();
    if ($groupmode == VISIBLEGROUPS or $aag) {
        $allowedgroups = groups_get_all_groups($cm->course, 0, $cm->groupingid);
        // any group in grouping
        // Get user's own groups and put to the top.
        $usergroups = groups_get_all_groups($cm->course, $USER->id, $cm->groupingid);
    } else {
        $allowedgroups = groups_get_all_groups($cm->course, $USER->id, $cm->groupingid);
        // only assigned groups
    }
    $activegroup = groups_get_activity_group($cm, true, $allowedgroups);
    $groupsmenu = array();
    if ((!$allowedgroups or $groupmode == VISIBLEGROUPS or $aag) and !$hideallparticipants) {
        $groupsmenu[0] = get_string('allparticipants');
    }
    $groupsmenu += groups_sort_menu_options($allowedgroups, $usergroups);
    if ($groupmode == VISIBLEGROUPS) {
        $grouplabel = get_string('groupsvisible');
    } else {
        $grouplabel = get_string('groupsseparate');
    }
    if ($aag and $cm->groupingid) {
        if ($grouping = groups_get_grouping($cm->groupingid)) {
            $grouplabel = $grouplabel . ' (' . format_string($grouping->name) . ')';
        }
    }
    if (count($groupsmenu) == 1) {
        $groupname = reset($groupsmenu);
        $output = $grouplabel . ': ' . $groupname;
    } else {
        $select = new single_select($urlroot, 'group', $groupsmenu, $activegroup, null, 'selectgroup');
        $select->label = $grouplabel;
        $output = $OUTPUT->render($select);
    }
    $output = '<div class="groupselector">' . $output . '</div>';
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:79,代码来源:grouplib.php

示例12: display_submissions

    /**
     *  Display all the submissions ready for grading
     *
     * @global object
     * @global object
     * @global object
     * @global object
     * @param string $message
     * @return bool|void
     */
    function display_submissions($message='') {
        global $CFG, $DB, $USER, $DB, $OUTPUT, $PAGE;
        require_once($CFG->libdir.'/gradelib.php');

        /* first we check to see if the form has just been submitted
         * to request user_preference updates
         */

       $filters = array(self::FILTER_ALL             => get_string('all'),
                        self::FILTER_SUBMITTED       => get_string('submitted', 'assignment'),
                        self::FILTER_REQUIRE_GRADING => get_string('requiregrading', 'assignment'));

        $updatepref = optional_param('updatepref', 0, PARAM_INT);

        if (isset($_POST['updatepref'])){
            $perpage = optional_param('perpage', 10, PARAM_INT);
            $perpage = ($perpage <= 0) ? 10 : $perpage ;
            $filter = optional_param('filter', 0, PARAM_INT);
            set_user_preference('assignment_perpage', $perpage);
            set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL));
            set_user_preference('assignment_filter', $filter);
        }

        /* next we get perpage and quickgrade (allow quick grade) params
         * from database
         */
        $perpage    = get_user_preferences('assignment_perpage', 10);
        $quickgrade = get_user_preferences('assignment_quickgrade', 0);
        $filter = get_user_preferences('assignment_filter', 0);
        $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id);

        if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) {
            $uses_outcomes = true;
        } else {
            $uses_outcomes = false;
        }

        $page    = optional_param('page', 0, PARAM_INT);
        $strsaveallfeedback = get_string('saveallfeedback', 'assignment');

    /// Some shortcuts to make the code read better

        $course     = $this->course;
        $assignment = $this->assignment;
        $cm         = $this->cm;

        $tabindex = 1; //tabindex for quick grading tabbing; Not working for dropdowns yet
        add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id='.$this->cm->id, $this->assignment->id, $this->cm->id);

        $PAGE->set_title(format_string($this->assignment->name,true));
        $PAGE->set_heading($this->course->fullname);
        echo $OUTPUT->header();

        echo '<div class="usersubmissions">';

        //hook to allow plagiarism plugins to update status/print links.
        plagiarism_update_status($this->course, $this->cm);

        /// Print quickgrade form around the table
        if ($quickgrade) {
            $formattrs = array();
            $formattrs['action'] = new moodle_url('/mod/assignment/submissions.php');
            $formattrs['id'] = 'fastg';
            $formattrs['method'] = 'post';

            echo html_writer::start_tag('form', $formattrs);
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'id',      'value'=> $this->cm->id));
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'mode',    'value'=> 'fastgrade'));
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'page',    'value'=> $page));
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=> sesskey()));
        }

        $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
        if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
            echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'
                . get_string('seeallcoursegrades', 'grades') . '</a></div>';
        }

        if (!empty($message)) {
            echo $message;   // display messages here if any
        }

        $context = get_context_instance(CONTEXT_MODULE, $cm->id);

    /// Check to see if groups are being used in this assignment

        /// find out current groups mode
        $groupmode = groups_get_activity_groupmode($cm);
        $currentgroup = groups_get_activity_group($cm, true);
        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id);
//.........这里部分代码省略.........
开发者ID:nuckey,项目名称:moodle,代码行数:101,代码来源:lib.php

示例13: choicegroup_extend_settings_navigation

/**
 * Adds module specific settings to the settings block
 *
 * @param settings_navigation $settings The settings navigation object
 * @param navigation_node $choicegroupnode The node to add module settings to
 */
function choicegroup_extend_settings_navigation(settings_navigation $settings, navigation_node $choicegroupnode)
{
    global $PAGE;
    if (has_capability('mod/choicegroup:readresponses', $PAGE->cm->context)) {
        $groupmode = groups_get_activity_groupmode($PAGE->cm);
        if ($groupmode) {
            groups_get_activity_group($PAGE->cm, true);
        }
        if (!($choicegroup = choicegroup_get_choicegroup($PAGE->cm->instance))) {
            print_error('invalidcoursemodule');
            return false;
        }
        $allresponses = choicegroup_get_response_data($choicegroup, $PAGE->cm, $groupmode);
        // Big function, approx 6 SQL calls per user
        $responsecount = 0;
        $respondents = array();
        foreach ($allresponses as $optionid => $userlist) {
            if ($optionid) {
                $responsecount += count($userlist);
                if ($choicegroup->multipleenrollmentspossible) {
                    foreach ($userlist as $user) {
                        if (!in_array($user->id, $respondents)) {
                            $respondents[] = $user->id;
                        }
                    }
                }
            }
        }
        $viewallresponsestext = get_string("viewallresponses", "choicegroup", $responsecount);
        if ($choicegroup->multipleenrollmentspossible == 1) {
            $viewallresponsestext .= ' ' . get_string("byparticipants", "choicegroup", count($respondents));
        }
        $choicegroupnode->add($viewallresponsestext, new moodle_url('/mod/choicegroup/report.php', array('id' => $PAGE->cm->id)));
    }
}
开发者ID:RicardoMaurici,项目名称:moodle-mod_choicegroup,代码行数:41,代码来源:lib.php

示例14: stdClass

    // Load up the $post variable.
    $post = new stdClass();
    $post->course = $course->id;
    $post->forum = $forum->id;
    $post->discussion = 0;
    // ie discussion # not defined yet
    $post->parent = 0;
    $post->subject = '';
    $post->userid = $USER->id;
    $post->message = '';
    $post->messageformat = editors_get_preferred_format();
    $post->messagetrust = 0;
    if (isset($groupid)) {
        $post->groupid = $groupid;
    } else {
        $post->groupid = groups_get_activity_group($cm);
    }
    forum_set_return();
} else {
    if (!empty($reply)) {
        // User is writing a new reply
        if (!($parent = forum_get_post_full($reply))) {
            print_error('invalidparentpostid', 'forum');
        }
        if (!($discussion = $DB->get_record("forum_discussions", array("id" => $parent->discussion)))) {
            print_error('notpartofdiscussion', 'forum');
        }
        if (!($forum = $DB->get_record("forum", array("id" => $discussion->forum)))) {
            print_error('invalidforumid', 'forum');
        }
        if (!($course = $DB->get_record("course", array("id" => $discussion->course)))) {
开发者ID:njorth,项目名称:marginalia,代码行数:31,代码来源:post.php

示例15: calc_sessgroupslist_sesstype

 private function calc_sessgroupslist_sesstype()
 {
     global $SESSION;
     if (!array_key_exists('attsessiontype', $SESSION)) {
         $SESSION->attsessiontype = array($this->cm->course => self::SESSTYPE_ALL);
     } else {
         if (!array_key_exists($this->cm->course, $SESSION->attsessiontype)) {
             $SESSION->attsessiontype[$this->cm->course] = self::SESSTYPE_ALL;
         }
     }
     $group = optional_param('group', self::SESSTYPE_NO_VALUE, PARAM_INT);
     if ($this->selectortype == self::SELECTOR_SESS_TYPE) {
         if ($group > self::SESSTYPE_NO_VALUE) {
             $SESSION->attsessiontype[$this->cm->course] = $group;
             if ($group > self::SESSTYPE_ALL) {
                 // Set activegroup in $SESSION.
                 groups_get_activity_group($this->cm, true);
             } else {
                 // Reset activegroup in $SESSION.
                 unset($SESSION->activegroup[$this->cm->course][VISIBLEGROUPS][$this->cm->groupingid]);
                 unset($SESSION->activegroup[$this->cm->course]['aag'][$this->cm->groupingid]);
                 unset($SESSION->activegroup[$this->cm->course][SEPARATEGROUPS][$this->cm->groupingid]);
             }
             $this->sesstype = $group;
         } else {
             $this->sesstype = $SESSION->attsessiontype[$this->cm->course];
         }
     } else {
         if ($this->selectortype == self::SELECTOR_GROUP) {
             if ($group == 0) {
                 $SESSION->attsessiontype[$this->cm->course] = self::SESSTYPE_ALL;
                 $this->sesstype = self::SESSTYPE_ALL;
             } else {
                 if ($group > 0) {
                     $SESSION->attsessiontype[$this->cm->course] = $group;
                     $this->sesstype = $group;
                 } else {
                     $this->sesstype = $SESSION->attsessiontype[$this->cm->course];
                 }
             }
         }
     }
     if (is_null($this->sessgroupslist)) {
         $this->calc_sessgroupslist();
     }
     // For example, we set SESSTYPE_ALL but user can access only to limited set of groups.
     if (!array_key_exists($this->sesstype, $this->sessgroupslist)) {
         reset($this->sessgroupslist);
         $this->sesstype = key($this->sessgroupslist);
     }
 }
开发者ID:webcursosuai,项目名称:moodle-mod_attendance,代码行数:51,代码来源:locallib.php


注:本文中的groups_get_activity_group函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。