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


PHP groups_get_all_groupings函数代码示例

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


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

示例1: definition

 function definition()
 {
     global $COURSE;
     $mform =& $this->_form;
     $mform->addElement('text', 'name', get_string('groupselectname', 'groupselect'), array('size' => '64'));
     $mform->setType('name', PARAM_TEXT);
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addElement('htmleditor', 'intro', get_string('intro', 'groupselect'));
     $mform->setType('intro', PARAM_RAW);
     $mform->addRule('intro', get_string('required'), 'required', null, 'client');
     $mform->setHelpButton('intro', array('questions', 'richtext'), false, 'editorhelpbutton');
     $options = array();
     $options[0] = get_string('fromallgroups', 'groupselect');
     if ($groupings = groups_get_all_groupings($COURSE->id)) {
         foreach ($groupings as $grouping) {
             $options[$grouping->id] = format_string($grouping->name);
         }
     }
     $mform->addElement('select', 'targetgrouping', get_string('targetgrouping', 'groupselect'), $options);
     $mform->addElement('passwordunmask', 'password', get_string('password', 'groupselect'), 'maxlength="254" size="24"');
     $mform->setType('password', PARAM_RAW);
     $mform->addElement('text', 'maxmembers', get_string('maxmembers', 'groupselect'), array('size' => '4'));
     $mform->setType('maxmembers', PARAM_INT);
     $mform->setDefault('maxmembers', 0);
     $mform->addElement('date_time_selector', 'timeavailable', get_string('timeavailable', 'groupselect'), array('optional' => true));
     $mform->setDefault('timeavailable', 0);
     $mform->addElement('date_time_selector', 'timedue', get_string('timedue', 'groupselect'), array('optional' => true));
     $mform->setDefault('timedue', 0);
     $features = array('groups' => true, 'groupings' => true, 'groupmembersonly' => true, 'outcomes' => false, 'gradecat' => false, 'idnumber' => false);
     $this->standard_coursemodule_elements($features);
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
 }
开发者ID:rwijaya,项目名称:moodle-mod_groupselect,代码行数:34,代码来源:mod_form.php

示例2: definition

 /**
  * Definition of administration form
  */
 protected function definition()
 {
     global $CFG, $DB, $PAGE;
     $mform = $this->_form;
     $mform->addElement('hidden', 'id');
     $mform->setDefault('id', $this->_customdata['id']);
     $mform->setType('id', PARAM_INT);
     $this->context = \context_module::instance($this->_customdata['id']);
     $cm = get_coursemodule_from_id('grouptool', $this->_customdata['id']);
     $course = $DB->get_record('course', array('id' => $cm->course));
     $grouptool = $DB->get_record('grouptool', array('id' => $cm->instance), '*', MUST_EXIST);
     $coursecontext = \context_course::instance($cm->course);
     foreach ($this->_customdata['selected'] as $select) {
         $mform->addElement('hidden', 'selected[' . $select . ']');
         $mform->setDefault('selected[' . $select . ']', $select);
         $mform->setType('selected[' . $select . ']', PARAM_INT);
     }
     $mform->addElement('hidden', 'tab');
     $mform->setDefault('tab', 'group_admin');
     $mform->setType('tab', PARAM_TEXT);
     $mform->addElement('hidden', 'courseid');
     $mform->setDefault('courseid', $course->id);
     $mform->setType('courseid', PARAM_INT);
     $mform->addElement('hidden', 'bulkaction');
     $mform->setDefault('bulkaction', 'grouping');
     $mform->setType('bulkaction', PARAM_TEXT);
     $mform->addElement('hidden', 'start_bulkaction');
     $mform->setDefault('start_bulkaction', 1);
     $mform->setType('start_bulkaction', PARAM_BOOL);
     $groupingel = $mform->createElement('selectgroups', 'target', get_string('groupingselect', 'grouptool'));
     $options = array('' => get_string('choose', 'grouptool'));
     $options['-1'] = get_string('onenewgrouping', 'grouptool');
     $options['-2'] = get_string('onenewgroupingpergroup', 'grouptool');
     $groupingel->addOptGroup("", $options);
     if ($groupings = groups_get_all_groupings($course->id)) {
         $options = array();
         foreach ($groupings as $grouping) {
             $options[$grouping->id] = strip_tags(format_string($grouping->name));
         }
         $groupingel->addOptGroup("————————————————————————", $options);
     }
     $mform->addElement($groupingel);
     $mform->addHelpButton('target', 'groupingselect', 'grouptool');
     $mform->addElement('text', 'name', get_string('groupingname', 'group'));
     $mform->setType('name', PARAM_MULTILANG);
     $mform->disabledif('name', 'target', 'noteq', '-1');
     $grp = array();
     $grp[] = $mform->createElement('submit', 'createGroupings', get_string('create_assign_groupings', 'grouptool'));
     $grp[] = $mform->createElement('cancel');
     $mform->addGroup($grp, 'actionbuttons', '', array(' '), false);
     $mform->setType('actionbuttons', PARAM_RAW);
 }
开发者ID:rimacher,项目名称:moodle-mod_grouptool,代码行数:55,代码来源:groupings_creation_form.php

示例3: definition

 function definition()
 {
     global $DB, $PAGE, $OUTPUT;
     $id = optional_param('id', 0, PARAM_INT);
     $a = optional_param('a', 0, PARAM_INT);
     if ($id) {
         if (!($cm = get_coursemodule_from_id('blended', $id))) {
             print_error("Course Module ID was incorrect");
         }
         if (!($course = get_course($cm->course))) {
             print_error("Course is misconfigured");
         }
         if (!($blended = $DB->get_record('blended', array('id' => $cm->instance)))) {
             print_error("Course module is incorrect");
         }
         if (!($context = context_course::instance($course->id))) {
             print_error("Context ID is incorrect");
         }
     } else {
         if (!($blended = $DB->get_record('blended', array('id' => $a)))) {
             print_error("Course module is incorrect");
         }
         if (!($course = $DB->get_record('course', array('id' => $blended->course)))) {
             print_error("Course is misconfigured");
         }
         if (!($cm = get_coursemodule_from_instance("blended", $blended->id, $course->id))) {
             print_error("Course Module ID was incorrect");
         }
         if (!($context = context_course::instance($course->id))) {
             print_error("Context ID is incorrect");
         }
     }
     $form =& $this->_form;
     $t = 0;
     $agrupamientos = array();
     $agrupamientos[$t] = 'Eliga';
     if ($groups = groups_get_all_groupings($course->id)) {
         foreach ($groups as $group) {
             $t++;
             $agrupamientos[$t] = $group->name;
         }
     }
     //Select Elements
     $form->addElement('select', 'grouping', get_string('select_grouping', 'blended'), $agrupamientos);
 }
开发者ID:juacas,项目名称:moodle-mod_blended,代码行数:45,代码来源:grouping_form.php

示例4: fn_sg_get_all_groups

/**
 * Get all FN Site Groups. If a course is specified, and the course is using the FN Site
 * Groups enrolment plug-in, then return the groups currently in use in the course.
 *
 * @param int    $courseid   The id of the requested course
 * @param int    $userid     The id of the requested user or all.
 * @param int    $groupingid The id of the requested grouping or all.
 * @param string $fields     The fields to return or all.
 * @return array
 */
function fn_sg_get_all_groups($courseid = SITEID, $userid = 0, $groupingid = 0, $fields = 'g.*')
{
    global $CFG;
    if (!($course = get_record('course', 'id', $courseid, null, null, null, null, 'id,enrol'))) {
        return false;
    }
    if ($courseid != SITEID && fn_sg_course_uses_sgenrol($course)) {
        /// Get site groups used in course.
        $agroups = false;
    } else {
        $agroups = groups_get_all_groups(SITEID, $userid, $groupingid, $fields);
    }
    if (!is_array($agroups)) {
        $agroups = array();
    }
    if (!($groupings = groups_get_all_groupings(SITEID))) {
        $groupings = array();
    }
    $groups = array();
    foreach ($groupings as $groupingid => $grouping) {
        $groups['g_' . $groupingid] = $grouping;
        if ($ggroups = groups_get_all_groups(SITEID, $userid, $groupingid, $fields)) {
            foreach ($ggroups as $ggroupid => $ggroup) {
                $ggroup->name = ' - ' . $ggroup->name;
                $groups[$ggroupid] = $ggroup;
                unset($agroups[$ggroupid]);
            }
        }
    }
    $nogrouping = new Object();
    $nogrouping->id = 0;
    $nogrouping->name = 'NOT IN GROUPING';
    foreach ($agroups as $agroup) {
        $agroup->name = ' - ' . $agroup->name;
    }
    if (!empty($agroups)) {
        $groups = $groups + array('g_0' => $nogrouping) + $agroups;
    }
    return $groups;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:50,代码来源:lib.php

示例5: ss_print_section


//.........这里部分代码省略.........
            if ($ismoving) {
                echo '<a title="'.$strmovefull.'"'.
                     ' href="'.$CFG->wwwroot.'/course/mod.php?moveto='.$mod->id.'&amp;sesskey='.sesskey().'">'.
                     '<img class="movetarget" src="'.$OUTPUT->pix_url('movehere') . '" '.
                     ' alt="'.$strmovehere.'" /></a><br />
                     ';
            }

            $classes = array('mod-indent');
            if (!empty($mod->indent)) {
                $classes[] = 'mod-indent-'.$mod->indent;
                if ($mod->indent > 15) {
                    $classes[] = 'mod-indent-huge';
                }
            }
            echo html_writer::start_tag('div', array('class'=>join(' ', $classes)));

            $extra = '';
            if (!empty($modinfo->cms[$modnumber]->extra)) {
                $extra = $modinfo->cms[$modnumber]->extra;
            }
            
            if ($mod->modname == "label") {
                if ($accessiblebutdim || !$mod->uservisible) {
                    echo '<div class="dimmed_text"><span class="accesshide">'.
                        get_string('hiddenfromstudents').'</span>';
                } else {
                    echo '<div>';
                }
                echo format_text($extra, FORMAT_HTML, $labelformatoptions);
                echo "</div>";
                if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
                    if (!isset($groupings)) {
                        $groupings = groups_get_all_groupings($course->id);
                    }
                    echo " <span class=\"groupinglabel\">(".format_string($groupings[$mod->groupingid]->name).')</span>';
                }

            } else { // Normal activity
                $instancename = format_string($modinfo->cms[$modnumber]->name, true,  $course->id);
              #  echo format_string($modinfo->cms[$modnumber]->intro, true,  $course->id);
              #  echo format_string($modinfo->cms[$modnumber]->name, true,  $course->id);
              #  print_r($modinfo->cms[$modnumber]);

                $customicon = $modinfo->cms[$modnumber]->icon;
                if (!empty($customicon)) {
                    if (substr($customicon, 0, 4) === 'mod/') {
                        list($modname, $iconname) = explode('/', substr($customicon, 4), 2);
                        $icon = $OUTPUT->pix_url($iconname, $modname);
                    } else {
                        $icon = $OUTPUT->pix_url($customicon);
                    }
                } else {
                    $icon = $OUTPUT->pix_url('icon', $mod->modname);
                }

                //Accessibility: for files get description via icon, this is very ugly hack!
                $altname = '';
                $altname = $mod->modfullname;
                if (!empty($customicon)) {
                    $archetype = plugin_supports('mod', $mod->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
                    if ($archetype == MOD_ARCHETYPE_RESOURCE) {
                        $mimetype = mimeinfo_from_icon('type', $customicon);
                        $altname = get_mimetype_description($mimetype);
                    }
                }
开发者ID:noisyjerm,项目名称:moodle-course_format_slides,代码行数:67,代码来源:lib.php

示例6: send_response

 /**
  * Send the details of the newly created activity back to the client browser
  *
  * @param cm_info $mod details of the mod just created
  */
 protected function send_response($mod)
 {
     global $OUTPUT;
     $resp = new stdClass();
     $resp->error = self::ERROR_OK;
     $resp->icon = $mod->get_icon_url()->out();
     $resp->name = $mod->name;
     $resp->link = $mod->get_url()->out();
     $resp->elementid = 'module-' . $mod->id;
     $resp->commands = make_editing_buttons($mod, true, true, 0, $mod->sectionnum);
     $resp->onclick = $mod->get_on_click();
     // if using groupings, then display grouping name
     if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', $this->context)) {
         $groupings = groups_get_all_groupings($this->course->id);
         $resp->groupingname = format_string($groupings[$mod->groupingid]->name);
     }
     echo $OUTPUT->header();
     echo json_encode($resp);
     die;
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:25,代码来源:dnduploadlib.php

示例7: definition

 /**
  * Form Definition
  */
 function definition()
 {
     global $CFG, $COURSE;
     $mform =& $this->_form;
     $mform->addElement('header', 'autogroup', get_string('general'));
     $mform->addElement('text', 'namingscheme', get_string('namingscheme', 'group'));
     $mform->addHelpButton('namingscheme', 'namingscheme', 'group');
     $mform->addRule('namingscheme', get_string('required'), 'required', null, 'client');
     $mform->setType('namingscheme', PARAM_TEXT);
     // There must not be duplicate group names in course.
     $template = get_string('grouptemplate', 'group');
     $gname = groups_parse_name($template, 0);
     if (!groups_get_group_by_name($COURSE->id, $gname)) {
         $mform->setDefault('namingscheme', $template);
     }
     $options = array('groups' => get_string('numgroups', 'group'), 'members' => get_string('nummembers', 'group'));
     $mform->addElement('select', 'groupby', get_string('groupby', 'group'), $options);
     $mform->addElement('text', 'number', get_string('number', 'group'), 'maxlength="4" size="4"');
     $mform->setType('number', PARAM_INT);
     $mform->addRule('number', null, 'numeric', null, 'client');
     $mform->addRule('number', get_string('required'), 'required', null, 'client');
     $mform->addElement('header', 'groupmembershdr', get_string('groupmembers', 'group'));
     $mform->setExpanded('groupmembershdr', true);
     $options = array(0 => get_string('all'));
     $options += $this->_customdata['roles'];
     $mform->addElement('select', 'roleid', get_string('selectfromrole', 'group'), $options);
     $student = get_archetype_roles('student');
     $student = reset($student);
     if ($student and array_key_exists($student->id, $options)) {
         $mform->setDefault('roleid', $student->id);
     }
     if ($cohorts = cohort_get_available_cohorts(context_course::instance($COURSE->id), COHORT_WITH_ENROLLED_MEMBERS_ONLY)) {
         $options = array(0 => get_string('anycohort', 'cohort'));
         foreach ($cohorts as $c) {
             $options[$c->id] = format_string($c->name, true, context::instance_by_id($c->contextid));
         }
         $mform->addElement('select', 'cohortid', get_string('selectfromcohort', 'cohort'), $options);
         $mform->setDefault('cohortid', '0');
     } else {
         $mform->addElement('hidden', 'cohortid');
         $mform->setType('cohortid', PARAM_INT);
         $mform->setConstant('cohortid', '0');
     }
     if ($groupings = groups_get_all_groupings($COURSE->id)) {
         $options = array();
         $options[0] = get_string('none');
         foreach ($groupings as $grouping) {
             $options[$grouping->id] = format_string($grouping->name);
         }
         $mform->addElement('select', 'groupingid', get_string('selectfromgrouping', 'group'), $options);
         $mform->setDefault('groupingid', 0);
         $mform->disabledIf('groupingid', 'notingroup', 'checked');
     } else {
         $mform->addElement('hidden', 'groupingid');
         $mform->setType('groupingid', PARAM_INT);
         $mform->setConstant('groupingid', 0);
     }
     if ($groups = groups_get_all_groups($COURSE->id)) {
         $options = array();
         $options[0] = get_string('none');
         foreach ($groups as $group) {
             $options[$group->id] = format_string($group->name);
         }
         $mform->addElement('select', 'groupid', get_string('selectfromgroup', 'group'), $options);
         $mform->setDefault('groupid', 0);
         $mform->disabledIf('groupid', 'notingroup', 'checked');
     } else {
         $mform->addElement('hidden', 'groupid');
         $mform->setType('groupid', PARAM_INT);
         $mform->setConstant('groupid', 0);
     }
     $options = array('no' => get_string('noallocation', 'group'), 'random' => get_string('random', 'group'), 'firstname' => get_string('byfirstname', 'group'), 'lastname' => get_string('bylastname', 'group'), 'idnumber' => get_string('byidnumber', 'group'));
     $mform->addElement('select', 'allocateby', get_string('allocateby', 'group'), $options);
     $mform->setDefault('allocateby', 'random');
     $mform->addElement('checkbox', 'nosmallgroups', get_string('nosmallgroups', 'group'));
     $mform->disabledIf('nosmallgroups', 'groupby', 'noteq', 'members');
     $mform->addElement('checkbox', 'notingroup', get_string('notingroup', 'group'));
     $mform->disabledIf('notingroup', 'groupingid', 'neq', 0);
     $mform->disabledIf('notingroup', 'groupid', 'neq', 0);
     $mform->addElement('header', 'groupinghdr', get_string('grouping', 'group'));
     $options = array('0' => get_string('nogrouping', 'group'), '-1' => get_string('newgrouping', 'group'));
     if ($groupings = groups_get_all_groupings($COURSE->id)) {
         foreach ($groupings as $grouping) {
             $options[$grouping->id] = strip_tags(format_string($grouping->name));
         }
     }
     $mform->addElement('select', 'grouping', get_string('createingrouping', 'group'), $options);
     if ($groupings) {
         $mform->setDefault('grouping', '-1');
     }
     $mform->addElement('text', 'groupingname', get_string('groupingname', 'group'), $options);
     $mform->setType('groupingname', PARAM_TEXT);
     $mform->disabledIf('groupingname', 'grouping', 'noteq', '-1');
     $mform->addElement('hidden', 'courseid');
     $mform->setType('courseid', PARAM_INT);
     $mform->addElement('hidden', 'seed');
     $mform->setType('seed', PARAM_INT);
//.........这里部分代码省略.........
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:101,代码来源:autogroup_form.php

示例8: course_section_cm_name

 /**
  * Renders html to display a name with the link to the course module on a course page
  *
  * If module is unavailable for user but still needs to be displayed
  * in the list, just the name is returned without a link
  *
  * Note, that for course modules that never have separate pages (i.e. labels)
  * this function return an empty string
  *
  * @param cm_info $mod
  * @param array $displayoptions
  * @return string
  */
 public function course_section_cm_name(cm_info $mod, $displayoptions = array())
 {
     global $CFG;
     $output = '';
     if (!$mod->uservisible && (empty($mod->showavailability) || empty($mod->availableinfo))) {
         // nothing to be displayed to the user
         return $output;
     }
     $url = $mod->get_url();
     if (!$url) {
         return $output;
     }
     //Accessibility: for files get description via icon, this is very ugly hack!
     $instancename = $mod->get_formatted_name();
     $altname = $mod->modfullname;
     // Avoid unnecessary duplication: if e.g. a forum name already
     // includes the word forum (or Forum, etc) then it is unhelpful
     // to include that in the accessible description that is added.
     if (false !== strpos(core_text::strtolower($instancename), core_text::strtolower($altname))) {
         $altname = '';
     }
     // File type after name, for alphabetic lists (screen reader).
     if ($altname) {
         $altname = get_accesshide(' ' . $altname);
     }
     // For items which are hidden but available to current user
     // ($mod->uservisible), we show those as dimmed only if the user has
     // viewhiddenactivities, so that teachers see 'items which might not
     // be available to some students' dimmed but students do not see 'item
     // which is actually available to current student' dimmed.
     $linkclasses = '';
     $accesstext = '';
     $textclasses = '';
     if ($mod->uservisible) {
         $conditionalhidden = $this->is_cm_conditionally_hidden($mod);
         $accessiblebutdim = (!$mod->visible || $conditionalhidden) && has_capability('moodle/course:viewhiddenactivities', context_course::instance($mod->course));
         if ($accessiblebutdim) {
             $linkclasses .= ' dimmed';
             $textclasses .= ' dimmed_text';
             if ($conditionalhidden) {
                 $linkclasses .= ' conditionalhidden';
                 $textclasses .= ' conditionalhidden';
             }
             // Show accessibility note only if user can access the module himself.
             $accesstext = get_accesshide(get_string('hiddenfromstudents') . ':' . $mod->modfullname);
         }
     } else {
         $linkclasses .= ' dimmed';
         $textclasses .= ' dimmed_text';
     }
     // Get on-click attribute value if specified and decode the onclick - it
     // has already been encoded for display (puke).
     $onclick = htmlspecialchars_decode($mod->get_on_click(), ENT_QUOTES);
     $groupinglabel = '';
     if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', context_course::instance($mod->course))) {
         $groupings = groups_get_all_groupings($mod->course);
         $groupinglabel = html_writer::tag('span', '(' . format_string($groupings[$mod->groupingid]->name) . ')', array('class' => 'groupinglabel ' . $textclasses));
     }
     // Display link itself.
     $activitylink = html_writer::empty_tag('img', array('src' => $mod->get_icon_url(), 'class' => 'iconlarge activityicon', 'alt' => ' ', 'role' => 'presentation')) . $accesstext . html_writer::tag('span', $instancename . $altname, array('class' => 'instancename'));
     if ($mod->uservisible) {
         $output .= html_writer::link($url, $activitylink, array('class' => $linkclasses, 'onclick' => $onclick)) . $groupinglabel;
     } else {
         // We may be displaying this just in order to show information
         // about visibility, without the actual link ($mod->uservisible)
         $output .= html_writer::tag('div', $activitylink, array('class' => $textclasses)) . $groupinglabel;
     }
     return $output;
 }
开发者ID:helenagarcia90,项目名称:moodle,代码行数:82,代码来源:renderer.php

示例9: print_section_newsroom

function print_section_newsroom($course, $section, $mods, $modnamesused, $absolute = false, $width = "100%")
{
    /// Prints a section full of activity modules
    global $CFG, $USER;
    static $initialised;
    static $groupbuttons;
    static $groupbuttonslink;
    static $isediting;
    static $ismoving;
    static $strmovehere;
    static $strmovefull;
    static $strunreadpostsone;
    static $usetracking;
    static $groupings;
    if (!isset($initialised)) {
        $groupbuttons = ($course->groupmode or !$course->groupmodeforce);
        $groupbuttonslink = !$course->groupmodeforce;
        $isediting = isediting($course->id);
        $ismoving = $isediting && ismoving($course->id);
        if ($ismoving) {
            $strmovehere = get_string("movehere");
            $strmovefull = strip_tags(get_string("movefull", "", "'{$USER->activitycopyname}'"));
        }
        include_once $CFG->dirroot . '/mod/forum/lib.php';
        if ($usetracking = forum_tp_can_track_forums()) {
            $strunreadpostsone = get_string('unreadpostsone', 'forum');
        }
        $initialised = true;
    }
    $labelformatoptions = new object();
    $labelformatoptions->noclean = true;
    /// Casting $course->modinfo to string prevents one notice when the field is null
    $modinfo = get_fast_modinfo($course);
    //Acccessibility: replace table with list <ul>, but don't output empty list.
    if (!empty($section->sequence)) {
        // Fix bug #5027, don't want style=\"width:$width\".
        echo "<ul class=\"section img-text\">\n";
        $sectionmods = explode(",", $section->sequence);
        foreach ($sectionmods as $modnumber) {
            if (empty($mods[$modnumber])) {
                continue;
            }
            $mod = $mods[$modnumber];
            if ($ismoving and $mod->id == $USER->activitycopy) {
                // do not display moving mod
                continue;
            }
            if (isset($modinfo->cms[$modnumber])) {
                if (!$modinfo->cms[$modnumber]->uservisible) {
                    // visibility shortcut
                    continue;
                }
            } else {
                if (!file_exists("{$CFG->dirroot}/mod/{$mod->modname}/lib.php")) {
                    // module not installed
                    continue;
                }
                if (!coursemodule_visible_for_user($mod)) {
                    // full visibility check
                    continue;
                }
            }
            // The magic! ... if indent == 1 then ... hide module
            if ($mod->indent == 1) {
                $hiddemodule = 'hidden';
            } else {
                $hiddemodule = '';
            }
            echo '<li class="activity ' . $mod->modname . ' ' . $hiddemodule . '" id="module-' . $modnumber . '">';
            // Unique ID
            if ($ismoving) {
                echo '<a title="' . $strmovefull . '"' . ' href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img class="movetarget" src="' . $CFG->pixpath . '/movehere.gif" ' . ' alt="' . $strmovehere . '" /></a><br />
                     ';
            }
            if ($mod->indent) {
                print_spacer(12, 20 * $mod->indent, false);
            }
            $extra = '';
            if (!empty($modinfo->cms[$modnumber]->extra)) {
                $extra = $modinfo->cms[$modnumber]->extra;
            }
            if ($mod->modname == "label") {
                echo "<span class=\"";
                if (!$mod->visible) {
                    echo 'dimmed_text';
                } else {
                    echo 'label';
                }
                echo '">';
                echo format_text($extra, FORMAT_HTML, $labelformatoptions);
                echo "</span>";
                if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
                    if (!isset($groupings)) {
                        $groupings = groups_get_all_groupings($course->id);
                    }
                    echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
                }
            } else {
                // Normal activity
                $instancename = format_string($modinfo->cms[$modnumber]->name, true, $course->id);
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:format.php

示例10: stdClass

}
// END UCLA MOD - CCLE-2769
// Trigger mod_created event with information about this module.
$eventdata = new stdClass();
$eventdata->modulename = $data->modulename;
$eventdata->name = $data->name;
$eventdata->cmid = $data->coursemodule;
$eventdata->courseid = $course->id;
$eventdata->userid = $USER->id;
events_trigger('mod_created', $eventdata);
add_to_log($course->id, "course", "add mod", "../mod/{$data->modulename}/view.php?id={$data->coursemodule}", "{$data->modulename} {$data->instance}");
add_to_log($course->id, $data->modulename, "add", "view.php?id={$data->coursemodule}", "{$data->instance}", $data->coursemodule);
rebuild_course_cache($course->id);
$resp = new stdClass();
$resp->error = 0;
$resp->icon = $icon;
$resp->name = $displayname;
$resp->link = new moodle_url("/mod/{$data->modulename}/view.php", array('id' => $data->coursemodule)) . '';
$resp->elementid = 'module-' . $data->coursemodule;
// START UCLA MOD - CCLE-2769 - Drag and drop file upload block on M2
// get name of grouping (if any)
if (!empty($groupingid)) {
    $groupings = groups_get_all_groupings($course->id);
    $resp->groupname = format_string($groupings[$groupingid]->name);
}
// END UCLA MOD - CCLE-2769
$data->id = $data->coursemodule;
$data->groupmodelink = false;
// Resources never have group modes
$resp->commands = make_editing_buttons($data, true, true, 0, $section);
echo json_encode($resp);
开发者ID:rlorenzo,项目名称:moodle-block_dndupload,代码行数:31,代码来源:upload.php

示例11: definition

    /**
     * Called to define this moodle form
     *
     * @return void
     */
    function definition() {
        global $CFG, $DB, $PAGE;
        $mform = $this->_form;

        $mform->addElement('header', 'general', get_string('general', 'form'));

        $mform->addElement('text', 'name', get_string('assignmentname', 'assign'), array('size'=>'64'));
        if (!empty($CFG->formatstringstriptags)) {
            $mform->setType('name', PARAM_TEXT);
        } else {
            $mform->setType('name', PARAM_CLEANHTML);
        }
        $mform->addRule('name', null, 'required', null, 'client');

        $this->add_intro_editor(true, get_string('description', 'assign'));

        $ctx = null;
        if ($this->current && $this->current->coursemodule) {
            $cm = get_coursemodule_from_instance('assign', $this->current->id, 0, false, MUST_EXIST);
            $ctx = context_module::instance($cm->id);
        }
        $assignment = new assign($ctx, null, null);
        if ($this->current && $this->current->course) {
            if (!$ctx) {
                $ctx = context_course::instance($this->current->course);
            }
            $assignment->set_course($DB->get_record('course', array('id'=>$this->current->course), '*', MUST_EXIST));
        }

        $config = get_config('assign');

        $mform->addElement('header', 'general', get_string('settings', 'assign'));
        $mform->addElement('date_time_selector', 'allowsubmissionsfromdate', get_string('allowsubmissionsfromdate', 'assign'), array('optional'=>true));
        $mform->addHelpButton('allowsubmissionsfromdate', 'allowsubmissionsfromdate', 'assign');
        $mform->setDefault('allowsubmissionsfromdate', time());
        $mform->addElement('date_time_selector', 'duedate', get_string('duedate', 'assign'), array('optional'=>true));
        $mform->addHelpButton('duedate', 'duedate', 'assign');
        $mform->setDefault('duedate', time()+7*24*3600);
        $mform->addElement('date_time_selector', 'cutoffdate', get_string('cutoffdate', 'assign'), array('optional'=>true));
        $mform->addHelpButton('cutoffdate', 'cutoffdate', 'assign');
        $mform->setDefault('cutoffdate', time()+7*24*3600);
        $mform->addElement('selectyesno', 'alwaysshowdescription', get_string('alwaysshowdescription', 'assign'));
        $mform->addHelpButton('alwaysshowdescription', 'alwaysshowdescription', 'assign');
        $mform->setDefault('alwaysshowdescription', 1);
        $mform->addElement('selectyesno', 'submissiondrafts', get_string('submissiondrafts', 'assign'));
        $mform->addHelpButton('submissiondrafts', 'submissiondrafts', 'assign');
        $mform->setDefault('submissiondrafts', 0);
        // submission statement
        if (empty($config->requiresubmissionstatement)) {
            $mform->addElement('selectyesno', 'requiresubmissionstatement', get_string('requiresubmissionstatement', 'assign'));
            $mform->setDefault('requiresubmissionstatement', 0);
            $mform->addHelpButton('requiresubmissionstatement', 'requiresubmissionstatement', 'assign');
        } else {
            $mform->addElement('hidden', 'requiresubmissionstatement', 1);
        }

        $mform->addElement('selectyesno', 'sendnotifications', get_string('sendnotifications', 'assign'));
        $mform->addHelpButton('sendnotifications', 'sendnotifications', 'assign');
        $mform->setDefault('sendnotifications', 1);
        $mform->addElement('selectyesno', 'sendlatenotifications', get_string('sendlatenotifications', 'assign'));
        $mform->addHelpButton('sendlatenotifications', 'sendlatenotifications', 'assign');
        $mform->setDefault('sendlatenotifications', 1);
        $mform->disabledIf('sendlatenotifications', 'sendnotifications', 'eq', 1);
        $mform->addElement('selectyesno', 'teamsubmission', get_string('teamsubmission', 'assign'));
        $mform->addHelpButton('teamsubmission', 'teamsubmission', 'assign');
        $mform->setDefault('teamsubmission', 0);
        $mform->addElement('selectyesno', 'requireallteammemberssubmit', get_string('requireallteammemberssubmit', 'assign'));
        $mform->addHelpButton('requireallteammemberssubmit', 'requireallteammemberssubmit', 'assign');
        $mform->setDefault('requireallteammemberssubmit', 0);
        $mform->disabledIf('requireallteammemberssubmit', 'teamsubmission', 'eq', 0);
        $mform->disabledIf('requireallteammemberssubmit', 'submissiondrafts', 'eq', 0);

        $groupings = groups_get_all_groupings($assignment->get_course()->id);
        $options = array();
        $options[0] = get_string('none');
        foreach ($groupings as $grouping) {
            $options[$grouping->id] = $grouping->name;
        }
        $mform->addElement('select', 'teamsubmissiongroupingid', get_string('teamsubmissiongroupingid', 'assign'), $options);
        $mform->addHelpButton('teamsubmissiongroupingid', 'teamsubmissiongroupingid', 'assign');
        $mform->setDefault('teamsubmissiongroupingid', 0);
        $mform->disabledIf('teamsubmissiongroupingid', 'teamsubmission', 'eq', 0);

        $mform->addElement('selectyesno', 'blindmarking', get_string('blindmarking', 'assign'));
        $mform->addHelpButton('blindmarking', 'blindmarking', 'assign');
        $mform->setDefault('blindmarking', 0);
        if ($assignment->has_submissions_or_grades() ) {
            $mform->freeze('blindmarking');
        }


        // plagiarism enabling form
        if (!empty($CFG->enableplagiarism)) {
            /** Include plagiarismlib.php */
            require_once($CFG->libdir . '/plagiarismlib.php');
//.........这里部分代码省略.........
开发者ID:JP-Git,项目名称:moodle,代码行数:101,代码来源:mod_form.php

示例12: course_section_cm

 /**
  * Renders HTML to display one course module in a course section
  *
  * This includes link, content, availability, completion info and additional information
  * that module type wants to display (i.e. number of unread forum posts)
  *
  * This function calls:
  * {@link core_course_renderer::course_section_cm_name()}
  * {@link cm_info::get_after_link()}
  * {@link core_course_renderer::course_section_cm_text()}
  * {@link core_course_renderer::course_section_cm_availability()}
  * {@link core_course_renderer::course_section_cm_completion()}
  * {@link course_get_cm_edit_actions()}
  * {@link core_course_renderer::course_section_cm_edit_actions()}
  *
  * @param \stdClass $course
  * @param \completion_info $completioninfo
  * @param \cm_info $mod
  * @param int|null $sectionreturn
  * @param array $displayoptions
  * @return string
  */
 public function course_section_cm($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions = array())
 {
     global $COURSE;
     $output = '';
     // We return empty string (because course module will not be displayed at all)
     // if:
     // 1) The activity is not visible to users
     // and
     // 2) The 'availableinfo' is empty, i.e. the activity was
     // hidden in a way that leaves no info, such as using the
     // eye icon.
     if (!$mod->uservisible && empty($mod->availableinfo)) {
         return $output;
     }
     $output .= '<div class="asset-wrapper">';
     // TODO - add if can edit.
     // Drop section notice.
     $output .= '<a class="snap-move-note" href="#">' . get_string('movehere', 'theme_snap') . '</a>';
     // Start the div for the activity content.
     $output .= "<div class='activityinstance'>";
     // Display the link to the module (or do nothing if module has no url).
     $cmname = $this->course_section_cm_name($mod, $displayoptions);
     $assetlink = '';
     // SHAME - For moodles ajax show/hide call to work it needs activityinstance > a to add a class of dimmed to.
     // This dimmed class is of course inaccessible junk.
     if (!empty($cmname)) {
         $assetlink = '<a></a><h4 class="snap-asset-link">' . $cmname . '</h4>';
     }
     // Asset content.
     $contentpart = $this->course_section_cm_text($mod, $displayoptions);
     // Activity/resource type.
     $snapmodtype = $this->get_mod_type($mod)[0];
     $assetmeta = "<span class='snap-assettype'>" . $snapmodtype . "</span>";
     // Groups, Restriction and all that jazz metadata.
     // Completion tracking.
     $completiontracking = $this->course_section_cm_completion($course, $completioninfo, $mod, $displayoptions);
     // Due date, feedback available and all the nice snap things.
     $snapcompletiondata = $this->module_meta_html($mod);
     $assetcompletionmeta = "<div class='snap-completion-meta'>" . $completiontracking . $snapcompletiondata . "</div>";
     // Draft status - always output, shown via css of parent.
     $assetrestrictions = "<div class='draft-tag text text-warning'>" . get_string('draft', 'theme_snap') . "</div>";
     $canmanagegroups = has_capability('moodle/course:managegroups', context_course::instance($mod->course));
     if ($canmanagegroups && $mod->effectivegroupmode != NOGROUPS) {
         if ($mod->effectivegroupmode == VISIBLEGROUPS) {
             $groupinfo = get_string('groupsvisible');
         } else {
             if ($mod->effectivegroupmode == SEPARATEGROUPS) {
                 $groupinfo = get_string('groupsseparate');
             }
         }
         $assetrestrictions .= "<div class='text'>{$groupinfo}</div>";
     }
     // TODO - ask what this is...
     if (!empty($mod->groupingid) && $canmanagegroups) {
         // Grouping label.
         $groupings = groups_get_all_groupings($mod->course);
         $assetrestrictions .= "<div class='text text-danger'>" . format_string($groupings[$mod->groupingid]->name) . "</div>";
         // TBD - add a title to show this is the Grouping...
     }
     $canviewhidden = has_capability('moodle/course:viewhiddenactivities', $mod->context);
     // If the module isn't available, or we are a teacher (can view hidden activities) then get availability
     // info.
     $availabilityinfo = '';
     if (!$mod->available || $canviewhidden) {
         $availabilityinfo = $this->course_section_cm_availability($mod, $displayoptions);
     }
     if ($availabilityinfo !== '') {
         $conditionalinfo = get_string('conditional', 'theme_snap');
         $assetrestrictions .= "<div class='text text-danger'>{$conditionalinfo}.{$availabilityinfo}</div>";
     }
     $assetrestrictions = "<div class='snap-restrictions-meta'>{$assetrestrictions}</div>";
     $assetmeta .= $assetcompletionmeta . $assetrestrictions;
     // Build output.
     $postcontent = '<div class="snap-asset-meta" data-cmid="' . $mod->id . '">' . $mod->afterlink . $assetmeta . '</div>';
     $output .= $assetlink . $contentpart . $postcontent;
     // Bail at this point if we aren't using a supported format. (Folder view is only partially supported).
     $supported = ['folderview', 'topics', 'weeks', 'site'];
     if (!in_array($COURSE->format, $supported)) {
//.........这里部分代码省略.........
开发者ID:pramithkm,项目名称:moodle-theme_snap,代码行数:101,代码来源:course_renderer.php

示例13: get_groupings

 /**
  * Gets a grouping array for display
  *
  * @return array
  */
 protected function get_groupings()
 {
     // get the courseid from the module's course context
     if (get_class($this->context) == 'context_course') {
         // if the context defined for the form is a context course just get its id
         $courseid = $this->context->instanceid;
     } else {
         $cmcontext = context_module::instance($this->_cm->id);
         $coursecontext = $cmcontext->get_course_context(false);
         $courseid = $coursecontext->instanceid;
     }
     $groupings = groups_get_all_groupings($courseid);
     // create an array with just the grouping id and name
     $retgroupings = array();
     $retgroupings[''] = get_string('none');
     foreach ($groupings as $grouping) {
         $retgroupings[$grouping->id] = $grouping->name;
     }
     return $retgroupings;
 }
开发者ID:Kathrin84,项目名称:moodle-mod_activequiz,代码行数:25,代码来源:mod_form.php

示例14: get_sql_filter

 /**
  * get_sql_filter
  *
  * @param xxx $data
  * @return xxx
  */
 function get_sql_filter($data)
 {
     global $DB, $hotpot;
     $filter = '';
     $params = array();
     if (($value = $data['value']) && ($operator = $data['operator'])) {
         $userids = array();
         if (substr($value, 0, 5) == 'group') {
             if (substr($value, 5, 3) == 'ing') {
                 $gids = groups_get_all_groupings($hotpot->course->id);
                 $gid = intval(substr($value, 8));
                 if ($gids && array_key_exists($gid, $gids) && ($members = groups_get_grouping_members($gid))) {
                     $userids = array_keys($members);
                 }
             } else {
                 $gids = groups_get_all_groups($hotpot->course->id);
                 $gid = intval(substr($value, 5));
                 if ($gids && array_key_exists($gid, $gids) && ($members = groups_get_members($gid))) {
                     $userids = array_keys($members);
                 }
             }
         }
         if (count($userids)) {
             switch ($operator) {
                 case 1:
                     // is equal to
                     list($filter, $params) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED, '', true);
                     break;
                 case 2:
                     // isn't equal to
                     list($filter, $params) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED, '', false);
                     break;
             }
             if ($filter) {
                 $filter = 'id ' . $filter;
             }
         }
     }
     // no userids found
     return array($filter, $params);
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:47,代码来源:userfiltering.php

示例15: foreach

    echo '<div class="ui-widget" style="text-align:center;"><div style="display:inline-block; padding-left:10px; padding-right:10px;" class="ui-state-highlight ui-corner-all"><p>' . $feedback . '</p></div></div>';
} else {
    echo <<<HTML
<div id="predicate">
</div>
<div style="text-align:center;margin:10px;"><button type="button" onclick="addNewCriterion();">Add New Criterion</button>&nbsp;<button type="button" onclick="buildTeams();"><strong>Build Teams</strong></button>&nbsp;<button type="button" onclick="resetTeams();">Reset Teams</button></div>
<div style="text-align:center;margin:10px;">Number of teams: <span class="stepper">2</span></div>
<div style="text-align:center;">Prioritize: <select id="prioritise"><option value="numbers" selected="selected">equal team numbers</option><option value="criteria">most criteria met</option></select></div>
<div id="unassigned"><h2>Unassigned to teams</h2><button type="button" onclick="assignRandomly();">Assign Randomly</button><div class="sortable">
HTML;
    foreach ($students as $s) {
        $answeredstate = !isset($responses[$s->id]) || empty($responses[$s->id]) ? 'unanswered' : 'answered';
        echo "<div id=\"student-{$s->id}\" class=\"student ui-state-default {$answeredstate}\">{$s->firstname}&nbsp;{$s->lastname}</div>";
    }
    $groupings = "";
    foreach (groups_get_all_groupings($course->id) as $grping) {
        $groupings .= "<option value=\"{$grping->id}\">{$grping->name}</option>";
    }
    echo <<<HTML
</div></div><div id="teams"></div>
<div style="text-align:center;margin:15px 50px 0px;border-top:1px solid black;padding-top:15px;">
    <button type="button" onclick="\$('#createGroupsForm').slideDown(300);" style="font-size:1.5em;font-weight:bold;">Create Groups</button>
    <div style="display:none" id="createGroupsForm"><p>Are you sure you want to create your groups now? This action cannot be undone.</p>
        <table style="margin:auto;">
            <tr><th scope="row"><label for="groupingName">Grouping Name</label></th><td><input type="text" id="groupingName"></td></tr>
            <tr><td colspan="2" style="text-align:center;font-size:0.8em">or...</td></tr>
            <tr><th scope="row"><label for="groupingSelect">Add To Grouping</label></th><td><select id="groupingSelect">{$groupings}</select></td></tr>
            <tr><th scope="row"><label for="inheritGroupingName">Prefix Team Names with Grouping Name</label></th><td style="text-align:left;"><input type="checkbox" checked="checked" name="inheritGroupingName" id="inheritGroupingName" value="1" /></td></tr>
            <tr><td colspan="2" style="text-align:center;font-size:0.8em">or...</td></tr>
            <tr><th scope="row"><label for="nogrouping">Don't assign groups to a Grouping</label></th><td style="text-align:left;"><input type="checkbox" name="nogrouping" id="nogrouping" value="1" /></td></tr>
        </table>
开发者ID:netspotau,项目名称:moodle-mod_teambuilder,代码行数:31,代码来源:build.php


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