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


PHP groups_get_course_group函数代码示例

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


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

示例1: definition

 /**
  * Definition method.
  */
 public function definition()
 {
     global $COURSE;
     $mform = $this->_form;
     if (isset($this->_customdata)) {
         // Hardcoding plugin names here is hacky.
         $features = $this->_customdata;
     } else {
         $features = array();
     }
     // Course id needs to be passed for auth purposes.
     $mform->addElement('hidden', 'id', optional_param('id', 0, PARAM_INT));
     $mform->setType('id', PARAM_INT);
     $mform->addElement('header', 'general', get_string('pluginname', 'gradeimport_direct'));
     // Data upload from copy/paste.
     $mform->addElement('textarea', 'userdata', 'Data', array('rows' => 10, 'class' => 'gradeimport_data_area'));
     $mform->addRule('userdata', null, 'required');
     $mform->setType('userdata', PARAM_RAW);
     $encodings = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
     if (!empty($features['verbosescales'])) {
         $options = array(1 => get_string('yes'), 0 => get_string('no'));
         $mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options);
     }
     $options = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
     $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options);
     $mform->setType('previewrows', PARAM_INT);
     $mform->addElement('hidden', 'groupid', groups_get_course_group($COURSE));
     $mform->setType('groupid', PARAM_INT);
     $this->add_action_buttons(false, get_string('uploadgrades', 'grades'));
 }
开发者ID:jtibbetts,项目名称:moodle,代码行数:34,代码来源:import_form.php

示例2: export_for_template

 /**
  * Export the data.
  *
  * @param renderer_base $output
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     global $CFG, $DB, $PAGE;
     $context = context_course::instance($this->courseid);
     $data = new stdClass();
     $data->userid = $this->userid;
     $data->competencyid = $this->competencyid;
     $data->courseid = $this->courseid;
     $data->baseurl = $this->baseurl;
     $data->groupselector = '';
     if (has_any_capability(array('moodle/competency:usercompetencyview', 'moodle/competency:coursecompetencymanage'), $context)) {
         $course = $DB->get_record('course', array('id' => $this->courseid));
         $currentgroup = groups_get_course_group($course, true);
         if ($currentgroup !== false) {
             $select = groups_allgroups_course_menu($course, $PAGE->url, true, $currentgroup);
             $data->groupselector = $select;
         }
         // Fetch showactive.
         $defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
         $showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
         $showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $context);
         $users = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup, 'u.*', null, 0, 0, $showonlyactiveenrol);
         $data->users = array();
         foreach ($users as $user) {
             $exporter = new user_summary_exporter($user);
             $user = $exporter->export($output);
             if ($user->id == $this->userid) {
                 $user->selected = true;
             }
             $data->users[] = $user;
         }
         $data->hasusers = true;
     } else {
         $data->users = array();
         $data->hasusers = false;
     }
     $coursecompetencies = \core_competency\api::list_course_competencies($this->courseid);
     $data->competencies = array();
     $contextcache = array();
     foreach ($coursecompetencies as $coursecompetency) {
         $frameworkid = $coursecompetency['competency']->get_competencyframeworkid();
         if (!isset($contextcache[$frameworkid])) {
             $contextcache[$frameworkid] = $coursecompetency['competency']->get_context();
         }
         $context = $contextcache[$frameworkid];
         $coursecompetencycontext = $context;
         $exporter = new competency_exporter($coursecompetency['competency'], array('context' => $coursecompetencycontext));
         $competency = $exporter->export($output);
         if ($competency->id == $this->competencyid) {
             $competency->selected = true;
         }
         $data->competencies[] = $competency;
     }
     $data->hascompetencies = count($data->competencies);
     return $data;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:62,代码来源:user_competency_course_navigation.php

示例3: __construct

 public function __construct()
 {
     global $DB;
     parent::__construct(get_string('gradedistributionbar', 'gradereport_visual'));
     $this->layout = visualization::LAYOUT_AXIS;
     $this->layoutsettings = null;
     //array('false', 'true');
     $this->nodeshape = visualization::SHAPE_VERTICAL_BAR;
     $this->xaxis = 'grade';
     $this->yaxis = 'students';
     $this->xaxislabelformat = '0\\%';
     //$this->xaxismax = 100 + grade_distribution::RANGE;
     //$this->xaxismin = grade_distribution::RANGE;
     $this->xaxisxoffset = -27;
     $this->xaxislabel = get_string('grade', 'gradereport_visual');
     if ($this->percent) {
         $this->yaxislabelformat = '0\\%';
         $this->yaxislabel = get_string('percentstudents', 'gradereport_visual');
     } else {
         $this->yaxislabel = get_string('numberstudents', 'gradereport_visual');
     }
     $this->title = get_string('gradedistribution:title', 'gradereport_visual');
     $this->capability = 'gradereport/visual:vis:grade_distribution_bar';
     $this->usegroups = true;
     $options = array();
     foreach (groups_get_all_groups(required_param('id')) as $groupkey => $group) {
         $options[$groupkey] = grade_report_visual::truncate($group->name);
     }
     $options[0] = 'All Groups';
     if (isset($DB) && !is_null($DB)) {
         $course = $DB->get_record('course', array('id' => required_param('id')));
     } else {
         $course = get_record('course', 'id', required_param('id'));
     }
     if (!$course) {
         print_error('nocourseid');
     }
     $active = groups_get_course_group($course, true);
     if (!$active) {
         $active = 0;
     }
     $this->selector = new selector('group', $options, $active);
     $this->selectors = array($this->selector);
     $this->colorencoder = new encoder(encoder::ENCODER_COLOR, 'item');
     $this->encoders = array($this->colorencoder);
     $this->itemlegend = new legend($this->colorencoder, array(get_string('coursetotal', 'grades')));
     $this->legends = array($this->itemlegend);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:48,代码来源:visual_grade_distribution_bar.php

示例4: progress_report_extend_navigation

/**
 * This function extends the navigation with the report items
 *
 * @param navigation_node $navigation The navigation node to extend
 * @param stdClass $course The course to object for the report
 * @param stdClass $context The context of the course
 */
function progress_report_extend_navigation($navigation, $course, $context)
{
    global $CFG, $OUTPUT;
    $showonnavigation = has_capability('coursereport/progress:view', $context);
    $group = groups_get_course_group($course, true);
    // Supposed to verify group
    if ($group === 0 && $course->groupmode == SEPARATEGROUPS) {
        $showonnavigation = $showonnavigation && has_capability('moodle/site:accessallgroups', $context);
    }
    $completion = new completion_info($course);
    $showonnavigation = $showonnavigation && $completion->is_enabled() && count($completion->get_activities()) > 0;
    if ($showonnavigation) {
        $url = new moodle_url('/course/report/progress/index.php', array('course' => $course->id));
        $navigation->add(get_string('pluginname', 'coursereport_progress'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
    }
}
开发者ID:vuchannguyen,项目名称:web,代码行数:23,代码来源:lib.php

示例5: definition

 function definition()
 {
     global $COURSE;
     $mform =& $this->_form;
     if (isset($this->_customdata)) {
         // hardcoding plugin names here is hacky
         $features = $this->_customdata;
     } else {
         $features = array();
     }
     // course id needs to be passed for auth purposes
     $mform->addElement('header', 'general', get_string('importfile', 'grades'));
     // file upload
     $mform->addElement('filepicker', 'userfile', get_string('file'));
     $mform->addRule('userfile', null, 'required');
     $encodings = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
     if (!empty($features['includeseparator'])) {
         $radio = array();
         $radio[] = $mform->createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
         $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
         $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcolon', 'grades'), 'colon');
         $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepsemicolon', 'grades'), 'semicolon');
         $mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
         $mform->setDefault('separator', 'comma');
     }
     if (!empty($features['verbosescales'])) {
         $options = array(1 => get_string('yes'), 0 => get_string('no'));
         $mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options);
     }
     $options = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
     $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options);
     // TODO: localize
     $mform->setType('previewrows', PARAM_INT);
     $mform->addElement('hidden', 'groupid', groups_get_course_group($COURSE));
     $mform->setType('groupid', PARAM_INT);
     $this->add_action_buttons(false, get_string('uploadgrades', 'grades'));
 }
开发者ID:eduagdo,项目名称:reservasalas,代码行数:38,代码来源:import_form.php

示例6: get_string

$datestring->secs = get_string('secs');
if ($mode !== null) {
    $mode = (int) $mode;
    $SESSION->userindexmode = $mode;
} else {
    if (isset($SESSION->userindexmode)) {
        $mode = (int) $SESSION->userindexmode;
    } else {
        $mode = MODE_BRIEF;
    }
}
// Check to see if groups are being used in this course
// and if so, set $currentgroup to reflect the current group.
$groupmode = groups_get_course_groupmode($course);
// Groups are being used.
$currentgroup = groups_get_course_group($course, true);
if (!$currentgroup) {
    // To make some other functions work better later.
    $currentgroup = null;
}
$isseparategroups = ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context));
$PAGE->set_title("{$course->shortname}: " . get_string('participants'));
$PAGE->set_heading($course->fullname);
$PAGE->set_pagetype('course-view-' . $course->format);
$PAGE->add_body_class('path-user');
// So we can style it independently.
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('participants'));
echo '<div class="userlist">';
if ($isseparategroups and !$currentgroup) {
开发者ID:educakanchay,项目名称:campus,代码行数:31,代码来源:index.php

示例7: add_course_essentials

 /**
  * Adds essential course nodes to the navigation for the given course.
  *
  * This method adds nodes such as reports, blogs and participants
  *
  * @param navigation_node $coursenode
  * @param stdClass $course
  * @return bool returns true on successful addition of a node.
  */
 public function add_course_essentials($coursenode, stdClass $course)
 {
     global $CFG, $SITE;
     if ($course->id == $SITE->id) {
         return $this->add_front_page_course_essentials($coursenode, $course);
     }
     if ($coursenode == false || !$coursenode instanceof navigation_node || $coursenode->get('participants', navigation_node::TYPE_CONTAINER)) {
         return true;
     }
     //Participants
     if (has_capability('moodle/course:viewparticipants', $this->page->context)) {
         $participants = $coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id=' . $course->id), self::TYPE_CONTAINER, get_string('participants'), 'participants');
         if (!empty($CFG->enableblogs)) {
             if (($CFG->bloglevel == BLOG_GLOBAL_LEVEL or $CFG->bloglevel == BLOG_SITE_LEVEL and (isloggedin() and !isguestuser())) and has_capability('moodle/blog:view', context_system::instance())) {
                 $blogsurls = new moodle_url('/blog/index.php');
                 if ($currentgroup = groups_get_course_group($course, true)) {
                     $blogsurls->param('groupid', $currentgroup);
                 } else {
                     $blogsurls->param('courseid', $course->id);
                 }
                 $participants->add(get_string('blogscourse', 'blog'), $blogsurls->out(), self::TYPE_SETTING, null, 'courseblogs');
             }
         }
         if (!empty($CFG->enablenotes) && (has_capability('moodle/notes:manage', $this->page->context) || has_capability('moodle/notes:view', $this->page->context))) {
             $participants->add(get_string('notes', 'notes'), new moodle_url('/notes/index.php', array('filtertype' => 'course', 'filterselect' => $course->id)), self::TYPE_SETTING, null, 'currentcoursenotes');
         }
     } else {
         if (count($this->extendforuser) > 0 || $this->page->course->id == $course->id) {
             $participants = $coursenode->add(get_string('participants'), null, self::TYPE_CONTAINER, get_string('participants'), 'participants');
         }
     }
     // Badges.
     if (!empty($CFG->enablebadges) && !empty($CFG->badges_allowcoursebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
         $url = new moodle_url('/badges/view.php', array('type' => 2, 'id' => $course->id));
         $coursenode->add(get_string('coursebadges', 'badges'), null, navigation_node::TYPE_CONTAINER, null, 'coursebadges');
         $coursenode->get('coursebadges')->add(get_string('badgesview', 'badges'), $url, navigation_node::TYPE_SETTING, null, 'badgesview', new pix_icon('i/badge', get_string('badgesview', 'badges')));
     }
     return true;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:48,代码来源:navigationlib.php

示例8: require_login

if ($format !== '') {
    $url->param('format', $format);
}
if ($start !== 0) {
    $url->param('start', $start);
}
$PAGE->set_url($url);
$PAGE->set_pagelayout('report');

require_login($course);

// Check basic permission
require_capability('report/progress:view',$context);

// Get group mode
$group = groups_get_course_group($course,true); // Supposed to verify group
if ($group===0 && $course->groupmode==SEPARATEGROUPS) {
    require_capability('moodle/site:accessallgroups',$context);
}

// Get data on activities and progress of all users, and give error if we've
// nothing to display (no users or no activities)
$reportsurl = $CFG->wwwroot.'/course/report.php?id='.$course->id;
$completion = new completion_info($course);
$activities = $completion->get_activities();

// Generate where clause
$where = array();
$where_params = array();

if ($sifirst !== 'all') {
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:index.php

示例9: groups_print_course_menu

/**
 * Print group menu selector for course level.
 *
 * @global object
 * @global object
 * @param object $course course object
 * @param string $urlroot return address
 * @param boolean $return return as string instead of printing
 * @return mixed void or string depending on $return param
 */
function groups_print_course_menu($course, $urlroot, $return = false)
{
    global $CFG, $USER, $SESSION, $OUTPUT;
    if (!($groupmode = $course->groupmode)) {
        if ($return) {
            return '';
        } else {
            return;
        }
    }
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $context)) {
        $allowedgroups = groups_get_all_groups($course->id, 0, $course->defaultgroupingid);
        // detect changes related to groups and fix active group
        if (!empty($SESSION->activegroup[$course->id][VISIBLEGROUPS][0])) {
            if (!array_key_exists($SESSION->activegroup[$course->id][VISIBLEGROUPS][0], $allowedgroups)) {
                // active does not exist anymore
                unset($SESSION->activegroup[$course->id][VISIBLEGROUPS][0]);
            }
        }
        if (!empty($SESSION->activegroup[$course->id]['aag'][0])) {
            if (!array_key_exists($SESSION->activegroup[$course->id]['aag'][0], $allowedgroups)) {
                // active group does not exist anymore
                unset($SESSION->activegroup[$course->id]['aag'][0]);
            }
        }
    } else {
        $allowedgroups = groups_get_all_groups($course->id, $USER->id, $course->defaultgroupingid);
        // detect changes related to groups and fix active group
        if (isset($SESSION->activegroup[$course->id][SEPARATEGROUPS][0])) {
            if ($SESSION->activegroup[$course->id][SEPARATEGROUPS][0] == 0) {
                if ($allowedgroups) {
                    // somebody must have assigned at least one group, we can select it now - yay!
                    unset($SESSION->activegroup[$course->id][SEPARATEGROUPS][0]);
                }
            } else {
                if (!array_key_exists($SESSION->activegroup[$course->id][SEPARATEGROUPS][0], $allowedgroups)) {
                    // active group not allowed or does not exist anymore
                    unset($SESSION->activegroup[$course->id][SEPARATEGROUPS][0]);
                }
            }
        }
    }
    $activegroup = groups_get_course_group($course, true);
    $groupsmenu = array();
    if (!$allowedgroups or $groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $context)) {
        $groupsmenu[0] = get_string('allparticipants');
    }
    if ($allowedgroups) {
        foreach ($allowedgroups as $group) {
            $groupsmenu[$group->id] = format_string($group->name);
        }
    }
    if ($groupmode == VISIBLEGROUPS) {
        $grouplabel = get_string('groupsvisible');
    } else {
        $grouplabel = get_string('groupsseparate');
    }
    if (count($groupsmenu) == 1) {
        $groupname = reset($groupsmenu);
        $output = $grouplabel . ': ' . $groupname;
    } else {
        $select = new single_select(new moodle_url($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:vuchannguyen,项目名称:web,代码行数:83,代码来源:grouplib.php

示例10: definition

 function definition()
 {
     global $CFG, $COURSE;
     $mform =& $this->_form;
     // this is an array of headers
     $header = $this->_customdata['header'];
     // course id
     $mform->addElement('header', 'general', get_string('identifier', 'grades'));
     $mapfromoptions = array();
     if ($header) {
         foreach ($header as $i => $h) {
             $mapfromoptions[$i] = s($h);
         }
     }
     $mform->addElement('select', 'mapfrom', get_string('mapfrom', 'grades'), $mapfromoptions);
     $maptooptions = array('userid' => get_string('userid', 'grades'), 'username' => get_string('username'), 'useridnumber' => get_string('idnumber'), 'useremail' => get_string('email'), '0' => get_string('ignore', 'grades'));
     $mform->addElement('select', 'mapto', get_string('mapto', 'grades'), $maptooptions);
     $mform->addElement('header', 'general', get_string('mappings', 'grades'));
     // Add a feedback option.
     $feedbacks = array();
     if ($gradeitems = $this->_customdata['gradeitems']) {
         foreach ($gradeitems as $itemid => $itemname) {
             $feedbacks['feedback_' . $itemid] = get_string('feedbackforgradeitems', 'grades', $itemname);
         }
     }
     if ($header) {
         $i = 0;
         // index
         foreach ($header as $h) {
             $h = trim($h);
             // This is what each header maps to.
             $headermapsto = array(get_string('others', 'grades') => array('0' => get_string('ignore', 'grades'), 'new' => get_string('newitem', 'grades')), get_string('gradeitems', 'grades') => $gradeitems, get_string('feedbacks', 'grades') => $feedbacks);
             $mform->addElement('selectgroups', 'mapping_' . $i, s($h), $headermapsto);
             $i++;
         }
     }
     // course id needs to be passed for auth purposes
     $mform->addElement('hidden', 'map', 1);
     $mform->setType('map', PARAM_INT);
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'iid');
     $mform->setType('iid', PARAM_INT);
     $mform->addElement('hidden', 'importcode');
     $mform->setType('importcode', PARAM_FILE);
     $mform->addElement('hidden', 'verbosescales', 1);
     $mform->setType('verbosescales', PARAM_INT);
     $mform->addElement('hidden', 'groupid', groups_get_course_group($COURSE));
     $mform->setType('groupid', PARAM_INT);
     $this->add_action_buttons(false, get_string('uploadgrades', 'grades'));
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:51,代码来源:grade_import_form.php

示例11: setup_groups

 /**
  * Sets up this object's group variables, mainly to restrict the selection of users to display.
  */
 function setup_groups()
 {
     global $CFG;
     /// find out current groups mode
     if ($this->groupmode = groups_get_course_groupmode($this->course)) {
         $this->currentgroup = groups_get_course_group($this->course, true);
         $this->group_selector = groups_print_course_menu($this->course, $this->pbarurl, true);
         if ($this->groupmode == SEPARATEGROUPS and !$this->currentgroup and !has_capability('moodle/site:accessallgroups', $this->context)) {
             $this->currentgroup = -2;
             // means can not accesss any groups at all
         }
         if ($this->currentgroup) {
             $this->groupsql = " JOIN {$CFG->prefix}groups_members gm ON gm.userid = u.id ";
             $this->groupwheresql = " AND gm.groupid = {$this->currentgroup} ";
         }
     }
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:20,代码来源:lib.php

示例12: get_content

 function get_content()
 {
     global $CFG, $SITE, $USER, $DB;
     if (empty($CFG->usetags) || empty($CFG->bloglevel)) {
         $this->content->text = '';
         return $this->content;
     }
     if (empty($this->config->timewithin)) {
         $this->config->timewithin = BLOGDEFAULTTIMEWITHIN;
     }
     if (empty($this->config->numberoftags)) {
         $this->config->numberoftags = BLOGDEFAULTNUMBEROFTAGS;
     }
     if (empty($this->config->sort)) {
         $this->config->sort = BLOGDEFAULTSORT;
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     /// Get a list of tags
     $timewithin = time() - $this->config->timewithin * 24 * 60 * 60;
     /// convert to seconds
     // admins should be able to read all tags
     $type = '';
     if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) {
         $type = " AND (p.publishstate = 'site' or p.publishstate='public')";
     }
     $sql = "SELECT t.id, t.tagtype, t.rawname, t.name, COUNT(DISTINCT ti.id) AS ct\n                   FROM {tag} t, {tag_instance} ti, {post} p\n                  WHERE t.id = ti.tagid AND p.id = ti.itemid\n                        {$type}\n                        AND ti.itemtype = 'post'\n                        AND ti.timemodified > {$timewithin}\n               GROUP BY t.id, t.tagtype, t.name, t.rawname\n               ORDER BY ct DESC, t.name ASC";
     if ($tags = $DB->get_records_sql($sql, null, 0, $this->config->numberoftags)) {
         /// There are 2 things to do:
         /// 1. tags with the same count should have the same size class
         /// 2. however many tags we have should be spread evenly over the
         ///    20 size classes
         $totaltags = count($tags);
         $currenttag = 0;
         $size = 20;
         $lasttagct = -1;
         $etags = array();
         foreach ($tags as $tag) {
             $currenttag++;
             if ($currenttag == 1) {
                 $lasttagct = $tag->ct;
                 $size = 20;
             } else {
                 if ($tag->ct != $lasttagct) {
                     $lasttagct = $tag->ct;
                     $size = 20 - (int) (($currenttag - 1) / $totaltags * 20);
                 }
             }
             $tag->class = "{$tag->tagtype} s{$size}";
             $etags[] = $tag;
         }
         /// Now we sort the tag display order
         $CFG->tagsort = $this->config->sort;
         usort($etags, "blog_tags_sort");
         /// Finally we create the output
         /// Accessibility: markup as a list.
         $this->content->text .= "\n<ul class='inline-list'>\n";
         foreach ($etags as $tag) {
             switch ($CFG->bloglevel) {
                 case BLOG_USER_LEVEL:
                     $filtertype = 'user';
                     $filterselect = $USER->id;
                     break;
                 case BLOG_GROUP_LEVEL:
                     $filtertype = 'group';
                     $filterselect = groups_get_course_group($this->page->course);
                     break;
                 case BLOG_COURSE_LEVEL:
                     $filtertype = 'course';
                     $filterselect = $this->page->course->id;
                     break;
                 default:
                     if ($this->page->course->id != SITEID) {
                         $filtertype = 'course';
                         $filterselect = $this->page->course->id;
                     } else {
                         $filtertype = 'site';
                         $filterselect = SITEID;
                     }
                     break;
             }
             $link = $CFG->wwwroot . '/blog/index.php?filtertype=' . $filtertype . '&amp;filterselect=' . $filterselect . '&amp;tagid=' . $tag->id;
             $this->content->text .= '<li><a href="' . $link . '" ' . 'class="' . $tag->class . '" ' . 'title="' . get_string('numberofentries', 'blog', $tag->ct) . '">' . tag_display_name($tag) . '</a></li> ';
         }
         $this->content->text .= "\n</ul>\n";
     }
     return $this->content;
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:92,代码来源:block_blog_tags.php

示例13: print_error

// course id
if (!($course = get_record('course', 'id', $id))) {
    print_error('nocourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $id);
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/txt:view', $context);
$strgrades = get_string('grades', 'grades');
$actionstr = get_string('modulename', 'gradeexport_txt');
$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
print_header($course->shortname . ': ' . get_string('grades'), $course->fullname, $navigation);
print_grade_plugin_selector($id, 'export', 'txt');
if (!empty($CFG->gradepublishing)) {
    $CFG->gradepublishing = has_capability('gradeexport/txt:publish', $context);
}
$mform = new grade_export_form(null, array('includeseparator' => true, 'publishing' => true));
// process post information
if ($data = $mform->get_data()) {
    $export = new grade_export_txt($course, groups_get_course_group($course));
    // print the grades on screen for feedback
    $export->process_form($data);
    $export->print_continue();
    $export->display_preview();
    print_footer($course);
    exit;
}
groups_print_course_menu($course, 'index.php?id=' . $id);
echo '<div class="clearer"></div>';
$mform->display();
print_footer();
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:index.php

示例14: get_content

 function get_content()
 {
     global $COURSE, $CFG, $USER;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $filteropt = new stdClass();
     $filteropt->overflowdiv = true;
     if ($this->content_is_trusted()) {
         // fancy html allowed only on course, category and system blocks.
         $filteropt->noclean = true;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $usegroupmenu = true;
     if (has_capability('moodle/site:accessallgroups', context_course::instance($COURSE->id))) {
         $usegroupmenu = true;
     } else {
         $usergroupings = groups_get_user_groups($COURSE->id, $USER->id);
         if (count($usergroupings) == 1) {
             $usergroups = array_pop($usergroupings);
             if (count($usergroups) == 1) {
                 $usegroupmenu = false;
                 $uniquegroup = array_pop($usergroups);
             }
         }
     }
     $coursegroups = groups_get_all_groups($COURSE->id);
     if ($coursegroups && $usegroupmenu) {
         $this->content->text .= groups_print_course_menu($COURSE, $CFG->wwwroot . '/course/view.php?id=' . $COURSE->id, true);
     }
     $gid = 0 + groups_get_course_group($COURSE, $USER->id);
     if (@$uniquegroup && !$gid) {
         $gid = $uniquegroup;
     }
     $textkeys = array('text_all');
     if (!empty($coursegroups)) {
         $textkeys[] = 'text_' . $gid;
     }
     foreach ($textkeys as $tk) {
         if (isset($this->config->{$tk})) {
             $format = FORMAT_HTML;
             // Check to see if the format has been properly set on the config
             $formatkey = str_replace('text_', 'format_', $tk);
             if (isset($this->config->{$formatkey})) {
                 $format = $this->config->{$formatkey};
             }
             // rewrite url
             $this->config->{$tk} = file_rewrite_pluginfile_urls($this->config->{$tk}, 'pluginfile.php', $this->context->id, 'block_groupspecifichtml', 'content', NULL);
             // Default to FORMAT_HTML which is what will have been used before the
             // editor was properly implemented for the block.
             $this->content->text .= format_text($this->config->{$tk}, $format, $filteropt);
         } else {
             $this->content->text .= '';
         }
     }
     $this->content->footer = '';
     unset($filteropt);
     // memory footprint
     if (empty($this->content->text)) {
         $this->content->text = '&nbsp;';
     }
     return $this->content;
 }
开发者ID:actXc,项目名称:moodle-block_groupspecifichtml,代码行数:64,代码来源:block_groupspecifichtml.php

示例15: required_param

 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require __DIR__ . '/../../config.php';
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);
$manager = block_xp_manager::get($courseid);
$context = $manager->get_context();
if (!$manager->can_view_ladder_page()) {
    throw new moodle_exception('nopermissions', '', '', 'view_ladder_page');
}
// Some stuff.
$url = new moodle_url('/blocks/xp/ladder.php', array('courseid' => $courseid));
$strladder = get_string('ladder', 'block_xp');
// Page info.
$PAGE->set_context($context);
$PAGE->set_pagelayout('course');
$PAGE->set_title($strladder);
$PAGE->set_heading($COURSE->fullname);
$PAGE->set_url($url);
$manager = block_xp_manager::get($courseid);
$group = groups_get_course_group($manager->get_course(), true);
$renderer = $PAGE->get_renderer('block_xp');
echo $OUTPUT->header();
echo $OUTPUT->heading($strladder);
echo $renderer->navigation($manager, 'ladder');
echo $renderer->notices($manager);
groups_print_course_menu($manager->get_course(), $url);
$table = new block_xp_ladder_table('block_xp_ladder', $courseid, $group, array('identitymode' => $manager->get_config('identitymode'), 'rankmode' => $manager->get_config('rankmode'), 'neighboursonly' => $manager->get_config('neighbours') > 0, 'neighboursabove' => $manager->get_config('neighbours'), 'neighboursbelow' => $manager->get_config('neighbours')));
$table->define_baseurl($url);
echo $table->out(20, false);
echo $OUTPUT->footer();
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:31,代码来源:ladder.php


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