• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_all_mods函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_content

 function get_content()
 {
     global $USER, $CFG;
     // TODO: FIX: HACK: (any other tags I should add? :P)
     // Hacker's improvised caching scheme: avoid fetching the mod
     // data from db if the course format has already fetched them
     if (!isset($GLOBALS['modnamesplural']) || !isset($GLOBALS['modnamesused'])) {
         require_once $CFG->dirroot . '/course/lib.php';
         if (!empty($this->instance)) {
             get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
         }
     } else {
         $modnamesplural = $GLOBALS['modnamesplural'];
         $modnamesused = $GLOBALS['modnamesused'];
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if (isset($modnamesused) && $modnamesused) {
         foreach ($modnamesused as $modname => $modfullname) {
             if ($modname != 'label') {
                 $this->content->items[] = '<a href="' . $CFG->wwwroot . '/mod/' . $modname . '/index.php?id=' . $this->instance->pageid . '">' . $modnamesplural[$modname] . '</a>';
                 $this->content->icons[] = '<img src="' . $CFG->modpixpath . '/' . $modname . '/icon.gif" class="icon" alt="" />';
             }
         }
     }
     return $this->content;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:32,代码来源:block_activity_modules.php


示例2: definition

    function definition() {
        global $DB, $USER, $CFG;

        $mform = & $this->_form;

        $mform->addElement('header', 'crformheader', get_string('usermodactions', 'block_cobalt_reports'), '');

        $columns = $DB->get_columns('user');

        $modules = array();

        // Fix for http://tracker.moodle.org/browse/CONTRIB-2945
        require_once($CFG->dirroot . "/course/lib.php");
        get_all_mods($this->_customdata['report']->courseid, $mods, $modnames, $modnamesplural, $modnamesused);

        if ($mods) {
            foreach ($mods as $m) {
                $instance = $DB->get_record("$m->modname", array("id" => "$m->instance"));
                $modules[$m->id] = $instance->name;
            }
        }

        $mform->addElement('select', 'cmid', get_string('module', 'block_cobalt_reports'), $modules);

        $this->_customdata['compclass']->add_form_elements($mform, $this);

        // buttons
        $this->add_action_buttons(true, get_string('add'));
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:29,代码来源:form.php


示例3: edit_form_add

 public function edit_form_add(&$mform)
 {
     global $COURSE, $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     get_all_mods($COURSE->id, $mods, $modnames, $modnamesplural, $modnamesusesd);
     $modinfo = unserialize((string) $COURSE->modinfo);
     $modules = array();
     foreach ($mods as $mod) {
         $instancename = urldecode($modinfo[$mod->id]->name);
         $instancename = format_string($instancename, true, $COURSE->id);
         $modules[$mod->id] = shorten_text($mod->modfullname . ': ' . $instancename, 28);
     }
     natcasesort($modules);
     // Add our choose option to the front
     $options = array(0 => get_string('choose', 'pagemenu')) + $modules;
     $mform->addElement('select', 'moduleid', get_string('addmodule', 'pagemenu'), $options);
     $mform->setType('moduleid', PARAM_INT);
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:18,代码来源:module.class.php


示例4: definition

 function definition()
 {
     global $USER, $CFG, $db;
     $mform =& $this->_form;
     $mform->addElement('header', '', get_string('usermodactions', 'block_configurable_reports'), '');
     $columns = $db->MetaColumns($CFG->prefix . 'user');
     $modules = array();
     get_all_mods($this->_customdata['report']->courseid, $mods, $modnames, $modnamesplural, $modnamesused);
     if ($mods) {
         foreach ($mods as $m) {
             $instance = get_record("{$m->modname}", "id", "{$m->instance}");
             $modules[$m->id] = $instance->name;
         }
     }
     $mform->addElement('select', 'cmid', get_string('module', 'block_configurable_reports'), $modules);
     $this->_customdata['compclass']->add_form_elements($mform, $this);
     // buttons
     $this->add_action_buttons(true, get_string('add'));
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:19,代码来源:form.php


示例5: cms_render

function cms_render($pagedata, $course)
{
    global $sections, $USER;
    // Insert dynamic content
    // content marked as private should be shown with a special style to people with editing rights
    // and should not be shown to others
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    $canedit = has_capability('format/cms:editpage', $context, $USER->id);
    $private = $canedit ? '<div class="private">$1</div>' : '';
    $search = array("#\\[\\[INCLUDE (.+?)\\]\\]#ie", "#\\[\\[SCRIPT (.+?)\\]\\]#ie", "#\\[\\[PAGE (.+?)\\]\\]#ie", "#\\[\\[NEWS\\]\\]#ie", "#\\[\\[PRIVATE (.+?)\\]\\]#is", "#\\[\\[TOC\\]\\]#ie", "#\\[\\[([^\\[\\]]+?)\\s*\\|\\s*(.+?)\\]\\]#es", "#\\._\\.#ie");
    $replace = array('cms_safe_include("$1", true)', 'cms_safe_include("$1", false)', 'cms_include_page("$1", $course)', 'cms_render_news($course)', $private, 'cms_print_toc($pagedata->id)', 'cms_render_link("$1" ,"$2")', '');
    $body = preg_replace($search, $replace, $pagedata->body);
    // Search sections.
    preg_match_all("/{#section([0-9]+)}/i", $body, $match);
    $cmssections = $match[1];
    // At this point allow only course level not site level.
    if (!empty($cmssections)) {
        foreach ($cmssections as $cmssection) {
            if (!empty($sections[$cmssection])) {
                $thissection = $sections[$cmssection];
            } else {
                unset($thissection);
                // make sure that the section doesn't exist.
                if (!record_exists('course_sections', 'section', $cmssection, 'course', $course->id)) {
                    $thissection->course = $course->id;
                    // Create a new section structure
                    $thissection->section = $cmssection;
                    $thissection->summary = '';
                    $thissection->visible = 1;
                    if (!($thissection->id = insert_record('course_sections', $thissection))) {
                        notify('Error inserting new topic!');
                    }
                } else {
                    $thissection = get_record('course_sections', 'course', $course->id, 'section', $cmssection);
                }
            }
            if (!empty($thissection)) {
                if (empty($mods)) {
                    get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
                }
                $showsection = ($canedit or $thissection->visible or !$course->hiddensections);
                if ($showsection) {
                    $content = '<div id="cms-section-' . $cmssection . '">';
                    $content .= cms_get_section($course, $thissection, $mods, $modnamesused);
                    if (isediting($course->id)) {
                        $content .= cms_section_add_menus($course, $cmssection, $modnames, false);
                    }
                    $content .= '</div>';
                    $body = preg_replace("/{#section{$cmssection}}/", $content, $body);
                }
            } else {
                $body = preg_replace("/{#section{$cmssection}}/", "", $body);
            }
        }
    }
    $options = new stdClass();
    $options->noclean = true;
    return format_text(stripslashes($body), FORMAT_HTML, $options);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:59,代码来源:cmslib.php


示例6: sections

 function sections($config)
 {
     global $COURSE, $CFG, $USER, $THEME;
     // probably inefficient, but it works
     get_all_mods($COURSE->id, $mods, $modnames, $modnamesplural, $modnamesused);
     // sections
     $sections = get_all_sections($COURSE->id);
     // name for sections
     $sectionname = get_string("name{$COURSE->format}", "format_{$COURSE->format}");
     // TODO: this fallback should be unnecessary
     if ($sectionname == "[[name{$COURSE->format}]]") {
         $sectionname = get_string("name{$COURSE->format}");
     }
     $return = array();
     // check what the course format is like
     // highlight for current week or highlighted topic
     if (in_array($COURSE->format, array('weeks', 'weekscss'))) {
         $format = 'week';
         $highlight = ceil((time() - $COURSE->startdate) / 604800);
     } else {
         $format = 'topic';
         $highlight = $COURSE->marker;
     }
     $modinfo = unserialize($COURSE->modinfo);
     // I think $display is the section currently being displayed
     // Why are we calling course_set_display?
     // For Moodle 2.0 we should just use $PAGE and check type
     // and also $PAGE->activityrecord
     $path = str_replace($CFG->httpswwwroot . '/', '', $CFG->pagepath);
     if (substr($path, 0, 7) == 'course/') {
         //TODO: this code is hackish, we shouldn't use course_set_display
         # get current section being displayed
         $week = optional_param('week', -1, PARAM_INT);
         if ($week != -1) {
             // the course format should already be doing this
             $display = course_set_display($COURSE->id, $week);
         } else {
             if (isset($USER->display[$COURSE->id])) {
                 $display = $USER->display[$COURSE->id];
             } else {
                 $display = course_set_display($COURSE->id, 0);
             }
         }
     } elseif (substr($path, 0, 4) == 'mod/') {
         // Moodle 2: use $PAGE->activityrecord->section;
         $id = optional_param('id', -1, PARAM_INT);
         if ($id == -1) {
             $display = 0;
         } else {
             $sql = "select section from {$CFG->prefix}course_sections where id=(select section from {$CFG->prefix}course_modules where id={$id})";
             $row = get_record_sql($sql);
             $display = $row->section;
         }
     } else {
         $display = 0;
     }
     foreach ($sections as $section) {
         // don't show the flowing sections
         if (!($section->visible && $section->section && $section->section <= $COURSE->numsections)) {
             continue;
         }
         $text = trim($section->summary);
         if (empty($text)) {
             $text = ucwords($sectionname) . " " . $section->section;
         } else {
             $text = $this->truncate_html(filter_text($text, $COURSE->id), $config);
         }
         // expand section if it's the one currently displayed
         $expand = false;
         if ($section->section == $display) {
             $expand = true;
         }
         $sectionstyle = 'yui_menu_icon_section';
         // highlight marked section
         if ($section->section == $highlight) {
             $sectionstyle .= ' highlight';
         }
         $iconpath = $CFG->wwwroot;
         if ($THEME->custompix) {
             $iconpath .= "/theme/" . current_theme() . "/pix";
         } else {
             $iconpath .= '/pix';
             //$iconpath .= '/';
         }
         $iconpath = $CFG->wwwroot . "/theme/" . current_theme() . "/pix";
         // decide what URL we want to use
         // A lot of this should really be done by the course format
         //
         // = intoaction config values =
         // * 'introhide' link to the section page (this effectively
         //   hides the other sections
         // * 'introscroll' link to the fragment id of the section on
         //   on the current page
         // whether or not any of the sections are hidden
         $hidden = false;
         foreach (array('topic', 'week') as $param) {
             if (isset($_GET[$param]) && $_GET[$param] != 'all') {
                 $hidden = true;
             }
         }
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:outline.php


示例7: offline_get_dynamic_files

/**
 * Retrieve all dynamic files
 *
 * @return string[] The array of dynamic files
 */
function offline_get_dynamic_files()
{
    global $CFG, $COURSE, $USER, $DB;
    require_once $CFG->dirroot . '/course/lib.php';
    // Include homepage and accessible course pages
    $files = array('.', $CFG->wwwroot . '/', $CFG->wwwroot . '/index.php', $CFG->wwwroot . '/lib/offline/go_offline.js', $CFG->wwwroot . '/user/editadvanced.php?id=' . $USER->id);
    // get all accessible courses
    if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() and empty($CFG->disablemycourses)) {
        $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', array('summary'));
    } else {
        if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() or $DB->count_records('course') <= FRONTPAGECOURSELIMIT) {
            $categories = get_child_categories(0);
            if (is_array($categories) && count($categories) == 1) {
                $category = array_shift($categories);
                $courses = get_courses_wmanagers($category->id, 'c.sortorder ASC', array('password', 'summary', 'currency'));
            } else {
                $courses = get_courses_wmanagers('all', 'c.sortorder ASC', array('password', 'summary', 'currency'));
            }
            unset($categories);
        }
    }
    // make sure the course is visible and retrieve other modules and main course pages
    foreach ($courses as $course) {
        if ($course->visible == 1 || has_capability('moodle/course:viewhiddencourses', $course->context)) {
            $files[] = $CFG->wwwroot . '/course/view.php?id=' . $course->id;
            //Get all the module main pages
            foreach (get_list_of_plugins() as $module) {
                if ($module != 'label') {
                    $files[] = $CFG->wwwroot . '/mod/' . $module . '/index.php?id=' . $course->id;
                }
            }
            //Get all the relevant forums
            require_once $CFG->dirroot . '/mod/forum/lib.php';
            $forums = forum_get_readable_forums($USER->id, $course->id);
            foreach ($forums as $forum) {
                $files[] = $CFG->wwwroot . '/mod/forum/view.php?f=' . $forum->id;
            }
            $modinfo =& get_fast_modinfo($course);
            get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
            foreach ($mods as $mod) {
                if ($mod->modname == 'forum') {
                    $files[] = $CFG->wwwroot . '/mod/forum/view.php?id=' . $mod->id;
                    $cm = get_coursemodule_from_id('forum', $mod->id);
                    $discussions = forum_get_discussions($cm);
                    foreach ($discussions as $d) {
                        $files[] = $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $d->discussion;
                    }
                }
            }
            //Get all the relevant assignments
            foreach ($modinfo->instances['assignment'] as $cm) {
                if (!$cm->uservisible) {
                    continue;
                }
                $files[] = $CFG->wwwroot . '/mod/assignment/view.php?id=' . $cm->id;
            }
        }
    }
    $files = str_replace('&amp;', '&', $files);
    return $files;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:66,代码来源:lib.php


示例8: get_course_modules

 /**
  * Generate the list of modules for the given course.
  *
  * @param stdClass $course The course to get modules for
  */
 protected function get_course_modules($course)
 {
     global $CFG;
     $mods = $modnames = $modnamesplural = $modnamesused = array();
     // This function is included when we include course/lib.php at the top
     // of this file
     get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
     $resources = array();
     $activities = array();
     foreach ($modnames as $modname => $modnamestr) {
         if (!course_allowed_module($course, $modname)) {
             continue;
         }
         $libfile = "{$CFG->dirroot}/mod/{$modname}/lib.php";
         if (!file_exists($libfile)) {
             continue;
         }
         include_once $libfile;
         $gettypesfunc = $modname . '_get_types';
         if (function_exists($gettypesfunc)) {
             $types = $gettypesfunc();
             foreach ($types as $type) {
                 if (!isset($type->modclass) || !isset($type->typestr)) {
                     debugging('Incorrect activity type in ' . $modname);
                     continue;
                 }
                 if ($type->modclass == MOD_CLASS_RESOURCE) {
                     $resources[html_entity_decode($type->type, ENT_QUOTES, 'UTF-8')] = $type->typestr;
                 } else {
                     $activities[html_entity_decode($type->type, ENT_QUOTES, 'UTF-8')] = $type->typestr;
                 }
             }
         } else {
             $archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
             if ($archetype == MOD_ARCHETYPE_RESOURCE) {
                 $resources[$modname] = $modnamestr;
             } else {
                 // all other archetypes are considered activity
                 $activities[$modname] = $modnamestr;
             }
         }
     }
     return array($resources, $activities);
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:49,代码来源:navigationlib.php


示例9: certificate_get_mods

/**
 * Get all the modules
 *
 * @return array
 */
function certificate_get_mods()
{
    global $COURSE, $CFG, $DB;
    $strtopic = get_string("topic");
    $strweek = get_string("week");
    $strsection = get_string("section");
    // Collect modules data
    get_all_mods($COURSE->id, $mods, $modnames, $modnamesplural, $modnamesused);
    $modules = array();
    $sections = get_all_sections($COURSE->id);
    // Sort everything the same as the course
    for ($i = 0; $i <= $COURSE->numsections; $i++) {
        // should always be true
        if (isset($sections[$i])) {
            $section = $sections[$i];
            if ($section->sequence) {
                switch ($COURSE->format) {
                    case "topics":
                        $sectionlabel = $strtopic;
                        break;
                    case "weeks":
                        $sectionlabel = $strweek;
                        break;
                    default:
                        $sectionlabel = $strsection;
                }
                $sectionmods = explode(",", $section->sequence);
                foreach ($sectionmods as $sectionmod) {
                    if (empty($mods[$sectionmod])) {
                        continue;
                    }
                    $mod = $mods[$sectionmod];
                    $mod->courseid = $COURSE->id;
                    $instance = $DB->get_record($mod->modname, array('id' => $mod->instance));
                    if ($grade_items = grade_get_grade_items_for_activity($mod)) {
                        $mod_item = grade_get_grades($COURSE->id, 'mod', $mod->modname, $mod->instance);
                        $item = reset($mod_item->items);
                        if (isset($item->grademax)) {
                            $modules[$mod->id] = $sectionlabel . ' ' . $section->section . ' : ' . $instance->name;
                        }
                    }
                }
            }
        }
    }
    return $modules;
}
开发者ID:noisyjerm,项目名称:moodle-mod_certificate,代码行数:52,代码来源:lib.php


示例10: render_subpage

 /**
  * Render contents of main part of subpage
  * @param mod_subpage $subpage
  * @param course_modinfo $modinfo
  * @param array $sections
  * @param boolean $editing whether the user is allowed to edit this page
  * @param int $moveitem (currently not used)
  * @param boolean $movesection whether the user is allowed to move sections
  * @return string html for display
  */
 public function render_subpage($subpage, $modinfo, $sections, $editing, $moveitem, $movesection)
 {
     global $PAGE, $OUTPUT, $CFG, $USER;
     $this->subpagecm = $subpage->get_course_module()->id;
     if (!empty($USER->activitycopy) && $movesection) {
         $content = $this->render_cancel_link($this->subpagecm);
     } else {
         $content = '';
     }
     $content .= $this->render_intro($subpage);
     $streditsummary = get_string('editsummary');
     $strdelete = get_string('delete');
     if ($editing) {
         $strmoveup = get_string('moveup');
         $strmovedown = get_string('movedown');
         $strhide = get_string('hide');
         $strshow = get_string('show');
         $strstealth = get_string('stealth', 'subpage');
         $strunstealth = get_string('unstealth', 'subpage');
     }
     $coursecontext = get_context_instance(CONTEXT_COURSE, $subpage->get_course()->id);
     get_all_mods($subpage->get_course()->id, $mods, $modnames, $modnamesplural, $modnamesused);
     foreach ($mods as $modid => $unused) {
         if (!isset($modinfo->cms[$modid])) {
             rebuild_course_cache($subpage->get_course()->id);
             $modinfo =& get_fast_modinfo($subpage->get_course());
             debugging('Rebuilding course cache', DEBUG_DEVELOPER);
             break;
         }
     }
     $lastpageorder = $subpage->get_last_section_pageorder();
     if ($subpage->get_course()->format == 'weeks') {
         $content .= html_writer::start_tag('ul', array('class' => 'weeks'));
     } else {
         $content .= html_writer::start_tag('ul', array('class' => 'topics'));
     }
     foreach ($sections as $section) {
         // Check to see whether cms within the section are visible or not
         // If all cms are not visible then we don't show the section at all,
         // unless editing
         $visible = false;
         if ($section->sequence) {
             // get cm_info for this resources
             $instances = explode(',', $section->sequence);
         } else {
             $instances = array();
         }
         foreach ($instances as $instance) {
             $cm = $modinfo->get_cm($instance);
             // check to see whether cm is visible
             if ($cm->uservisible) {
                 $visible = true;
                 break;
             }
         }
         // If section is empty so should be hidden, record that in object
         $section->autohide = !$visible;
         $content .= html_writer::start_tag('li', array('class' => 'section main clearfix', 'id' => 'section-' . $section->section));
         $content .= html_writer::tag('div', '&nbsp;', array('class' => 'left side'));
         $content .= html_writer::start_tag('div', array('class' => 'right side'));
         if ($editing && has_capability('moodle/course:update', $coursecontext)) {
             // Show the hide/show eye
             if ($section->visible) {
                 $content .= html_writer::start_tag('a', array('href' => 'view.php?id=' . $subpage->get_course_module()->id . '&hide=' . $section->section . '&sesskey=' . sesskey() . '#section-' . $section->id, 'title' => $strhide));
                 $content .= html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/hide'), 'class' => 'icon hide', 'alt' => $strhide));
                 $content .= html_writer::end_tag('a');
             } else {
                 $content .= html_writer::start_tag('a', array('href' => 'view.php?id=' . $subpage->get_course_module()->id . '&show=' . $section->section . '&sesskey=' . sesskey() . '#section-' . $section->id, 'title' => $strshow));
                 $content .= html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/show'), 'class' => 'icon show', 'alt' => $strshow));
                 $content .= html_writer::end_tag('a');
             }
             // Show the stealth/unstealth section link
             if ($section->stealth) {
                 $content .= html_writer::start_tag('form', array('method' => 'post', 'action' => 'stealth.php'));
                 $content .= html_writer::start_tag('div');
                 $content .= html_writer::empty_tag('input', array('name' => 'id', 'value' => $subpage->get_course_module()->id, 'type' => 'hidden'));
                 $content .= html_writer::empty_tag('input', array('name' => 'sesskey', 'value' => sesskey(), 'type' => 'hidden'));
                 $content .= html_writer::empty_tag('input', array('name' => 'unstealth', 'value' => $section->id, 'type' => 'hidden'));
                 $content .= html_writer::empty_tag('input', array('name' => 'icon', 'src' => $OUTPUT->pix_url('unstealth', 'mod_subpage'), 'type' => 'image', 'title' => $strunstealth, 'alt' => $strunstealth));
                 $content .= html_writer::end_tag('div');
                 $content .= html_writer::end_tag('form');
             } else {
                 $content .= html_writer::start_tag('form', array('method' => 'post', 'action' => 'stealth.php'));
                 $content .= html_writer::start_tag('div');
                 $content .= html_writer::empty_tag('input', array('name' => 'id', 'value' => $subpage->get_course_module()->id, 'type' => 'hidden'));
                 $content .= html_writer::empty_tag('input', array('name' => 'sesskey', 'value' => sesskey(), 'type' => 'hidden'));
                 $content .= html_writer::empty_tag('input', array('name' => 'stealth', 'value' => $section->id, 'type' => 'hidden'));
                 $content .= html_writer::empty_tag('input', array('name' => 'icon', 'src' => $OUTPUT->pix_url('stealth', 'mod_subpage'), 'type' => 'image', 'title' => $strstealth, 'alt' => $strstealth));
                 $content .= html_writer::end_tag('div');
                 $content .= html_writer::end_tag('form');
//.........这里部分代码省略.........
开发者ID:nadavkav,项目名称:moodle-mod_subpage,代码行数:101,代码来源:renderer.php


示例11: print_student_grade

/** 
 * Simply prints all grade of one student from all modules from a given course
 * used in the grade book for student view, and grade button under user profile
 * @param int $userid;
 * @param int $courseid;
 */
function print_student_grade($user, $course)
{
    global $CFG;
    if (!empty($user)) {
        $grades[$user->id] = array();
        // Collect all grades in this array
        $gradeshtml[$user->id] = array();
        // Collect all grades html formatted in this array
        $totals[$user->id] = array();
        // Collect all totals in this array
    }
    $strmax = get_string("maximumshort");
    /// Collect modules data
    get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
    /// Search through all the modules, pulling out grade data
    $sections = get_all_sections($course->id);
    // Sort everything the same as the course
    // prints table
    // flag for detecting whether to print table header or not
    $nograde = 0;
    for ($i = 0; $i <= $course->numsections; $i++) {
        if (isset($sections[$i])) {
            // should always be true
            $section = $sections[$i];
            if ($section->sequence) {
                $sectionmods = explode(",", $section->sequence);
                foreach ($sectionmods as $sectionmod) {
                    $mod = $mods[$sectionmod];
                    if (empty($mod->modname)) {
                        continue;
                        // Just in case, see MDL-7150
                    }
                    if (!($instance = get_record($mod->modname, 'id', $mod->instance))) {
                        continue;
                    }
                    if (!($cm = get_coursemodule_from_instance($mod->modname, $mod->instance))) {
                        continue;
                    }
                    if (!$cm->visible) {
                        $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
                        if (!has_capability('moodle/course:viewhiddenactivities', $modcontext)) {
                            continue;
                        }
                    }
                    $libfile = "{$CFG->dirroot}/mod/{$mod->modname}/lib.php";
                    if (file_exists($libfile)) {
                        require_once $libfile;
                        $gradefunction = $mod->modname . '_grades';
                        if (function_exists($gradefunction)) {
                            // Skip modules without grade function
                            if ($modgrades = $gradefunction($mod->instance)) {
                                if (!empty($modgrades->maxgrade)) {
                                    if ($mod->visible) {
                                        $maxgrade = $modgrades->maxgrade;
                                    } else {
                                        $maxgrade = $modgrades->maxgrade;
                                    }
                                } else {
                                    $maxgrade = '';
                                }
                                if ($maxgrade) {
                                    if (!$nograde) {
                                        echo '<table align="center" class="grades"><tr><th scope="col">' . get_string('activity') . '</th><th scope="col">' . get_string('yourgrade', 'grades') . '</th><th scope="col">' . get_string('maxgrade', 'grades') . '</th></tr>';
                                    }
                                    $nograde++;
                                    $link_id = grade_get_module_link($course->id, $mod->instance, $mod->module);
                                    $link = $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $link_id->id;
                                    echo '<tr>';
                                    if (!empty($modgrades->grades[$user->id])) {
                                        $currentgrade = $modgrades->grades[$user->id];
                                        echo "<td><a href='{$link}'>{$mod->modfullname}: " . format_string($instance->name, true) . "</a></td><td>{$currentgrade}</td><td>{$maxgrade}</td>";
                                    } else {
                                        echo "<td><a href='{$link}'>{$mod->modfullname}: " . format_string($instance->name, true) . "</a></td><td>" . get_string('nograde') . "</td><td>{$maxgrade}</td>";
                                    }
                                    echo '</tr>';
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // a new Moodle nesting record? ;-)
    if ($nograde) {
        echo '</table>';
    }
}
开发者ID:veritech,项目名称:pare-project,代码行数:94,代码来源:lib.php


示例12: allmetadata_print_big_search_form

function allmetadata_print_big_search_form($course)
{
    global $CFG;
    global $words, $subject, $searchcourseid, $phrase, $user, $userid, $modname, $fullwords, $notwords, $datefrom, $dateto;
    print_simple_box(get_string('searchallmetadataintro', 'allmetadata'), 'center', '', '', 'searchbox', 'intro');
    print_simple_box_start("center");
    echo "<script type=\"text/javascript\" language=\"javascript\">\n";
    echo "var timefromitems = ['fromday','frommonth','fromyear','fromhour', 'fromminute'];\n";
    echo "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n";
    echo "</script>\n";
    echo '<form name="search" action="search_allmetadata.php" method="get">';
    echo '<input type="hidden" value="' . $course->id . '" name="id" alt="">';
    echo '<table cellpadding="10" class="searchbox" id="form">';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchwords', 'allmetadata') . ':</td>';
    echo '<td class="c1"><input type="text" size="35" name="words" value="' . s($words) . '" alt=""></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchphrase', 'allmetadata') . ':</td>';
    echo '<td class="c1"><input type="text" size="35" name="phrase" value="' . s($phrase) . '" alt=""></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchnotwords', 'allmetadata') . ':</td>';
    echo '<td class="c1"><input type="text" size="35" name="notwords" value="' . s($notwords) . '" alt=""></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchfullwords', 'allmetadata') . ':</td>';
    echo '<td class="c1"><input type="text" size="35" name="fullwords" value="' . s($fullwords) . '" alt=""></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchdatefrom', 'allmetadata') . ':</td>';
    echo '<td class="c1">';
    echo '<input name="timefromrestrict" type="checkbox" value="1" alt="' . get_string('searchdatefrom', 'allmetadata') . '" onclick="return lockoptions(\'search\', \'timefromrestrict\', timefromitems)" /> ';
    if (empty($dateto)) {
        $datefrom = make_timestamp(2000, 1, 1, 0, 0, 0);
    }
    print_date_selector('fromday', 'frommonth', 'fromyear', $datefrom);
    print_time_selector('fromhour', 'fromminute', $datefrom);
    echo '<input type="hidden" name="hfromday" value="0" />';
    echo '<input type="hidden" name="hfrommonth" value="0" />';
    echo '<input type="hidden" name="hfromyear" value="0" />';
    echo '<input type="hidden" name="hfromhour" value="0" />';
    echo '<input type="hidden" name="hfromminute" value="0" />';
    echo '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchdateto', 'allmetadata') . ':</td>';
    echo '<td class="c1">';
    echo '<input name="timetorestrict" type="checkbox" value="1" alt="' . get_string('searchdateto', 'allmetadata') . '" onclick="return lockoptions(\'search\', \'timetorestrict\', timetoitems)" /> ';
    if (empty($dateto)) {
        $dateto = time() + 3600;
    }
    print_date_selector('today', 'tomonth', 'toyear', $dateto);
    print_time_selector('tohour', 'tominute', $dateto);
    echo '<input type="hidden" name="htoday" value="0" />';
    echo '<input type="hidden" name="htomonth" value="0" />';
    echo '<input type="hidden" name="htoyear" value="0" />';
    echo '<input type="hidden" name="htohour" value="0" />';
    echo '<input type="hidden" name="htominute" value="0" />';
    echo '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchsubject', 'allmetadata') . ':</td>';
    echo '<td class="c1"><input type="text" size="35" name="subject" value="' . s($subject) . '" alt=""></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchuser', 'allmetadata') . ':</td>';
    echo '<td class="c1"><input type="text" size="35" name="user" value="' . s($user) . '" alt=""></td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchwhichmetadatas', 'allmetadata') . ':</td>';
    echo '<td class="c1">';
    //Metadata Modules available
    //function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modnamesused)
    $allmods = get_all_mods($course->id, &$mods, &$modnames, &$modnamesplural, &$modnamesused);
    $metamods = array();
    if (array_key_exists("metadatadc", $modnamesplural)) {
        $metamods = array_merge(array("metadatadc" => get_string('modulenameplural', 'metadatadc')), $metamods);
        //array_unshift($metamods, get_string('modulenameplural', 'metadatadc'));
    }
    if (array_key_exists("metadatalom", $modnamesplural)) {
        $metamods = array_merge(array("metadatalom" => get_string('modulenameplural', 'metadatalom')), $metamods);
        //array_unshift($metamods, get_string('modulenameplural', 'metadatalom'));
    }
    if (count($metamods) == 1) {
        //choose_from_menu($options, $name, $selected='', $nothing='choose', $script='', $nothingvalue='0', $return=false, $disabled=false, $tabindex=0)
        choose_from_menu($metamods, 'metamodname', '', 'choose', '');
    } elseif (count($metamods) > 1) {
        array_unshift($metamods, get_string('allmetadata', 'allmetadata'));
        choose_from_menu($metamods, 'metamodname', '', 'choose', '');
    } else {
        echo '<strong>' . get_string('nometadata', 'allmetadata') . '</strong>';
    }
    echo '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td class="c0">' . get_string('searchwhichcourse', 'allmetadata') . ':</td>';
    echo '<td class="c1">';
    //Courses available
    //get_courses($categoryid="all", $sort="c.sortorder ASC", $fields="c.*")
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:search_allmetadata.php


示例13: display

 function display()
 {
     global $CFG, $PAGE, $COURSE;
     require_capability('moodle/course:manageactivities', $this->context);
     get_all_mods($COURSE->id, $mods, $modnames, $modnamesplural, $modnamesused);
     // Right now storing modules in a section corresponding to the current
     // page - probably should all be section 0 though
     if ($COURSE->id == SITEID) {
         $section = 1;
         // Front page only has section 1 - so use 1 as default
     } else {
         if (isset($page->id)) {
             $section = $page->id;
         } else {
             $section = 0;
         }
     }
     $PAGE->print_tabs('activities');
     print_box_start('boxwidthwide boxaligncenter pageeditingtable', 'editing-table');
     print_section_add_menus($COURSE, $section, $modnames);
     if (!empty($modnamesused)) {
         $modinfo = get_fast_modinfo($COURSE);
         $vars = new stdClass();
         $vars->delete = get_string("delete");
         $vars->update = get_string("update");
         $vars->sesskey = sesskey();
         foreach ($modnamesused as $module => $modnamestr) {
             $orderby = 'i.name';
             $fields = 'i.id, i.name, m.name ' . sql_as() . ' module, c.id ' . sql_as() . 'cmid, c.visible';
             // Going to be executing SQL that could fail on purpose - avoid debug messages
             $debug = $CFG->debug;
             // Store current value
             $CFG->debug = false;
             // disable_debugging() doesn't seem to work
             // Check for field named type
             if (execute_sql("SELECT type FROM {$CFG->prefix}{$module} WHERE 1 = 2", false)) {
                 // Has type - incorperate it into the sql
                 $orderby = "i.type, {$orderby}";
                 $fields = "{$fields}, i.type";
             }
             // Restore debug value
             $CFG->debug = $debug;
             $instances = get_records_sql("SELECT {$fields}\n                                                FROM {$CFG->prefix}course_modules c,\n                                                     {$CFG->prefix}modules m,\n                                                     {$CFG->prefix}{$module} i\n                                               WHERE i.course = {$COURSE->id}\n                                                 AND m.name = '{$module}'\n                                                 AND c.instance = i.id\n                                                 AND c.module = m.id\n                                            ORDER BY {$orderby}");
             if (!empty($instances)) {
                 $lasttype = '';
                 print "<h2><a href=\"{$CFG->wwwroot}/mod/{$module}/index.php?id={$COURSE->id}\">{$modnamestr}</a></h2>\n";
                 print "<ul class=\"activity-list\">\n";
                 foreach ($instances as $instance) {
                     if (!empty($instance->type) and $lasttype != $instance->type) {
                         if (!empty($lasttype)) {
                             // Switching types and it isn't the first time, close previously opened list
                             print "</ul>\n</li>\n";
                         }
                         // Try to get a name for the type (check module first)
                         $strtype = get_string($instance->type, $module);
                         if (strpos($strtype, '[') !== false) {
                             $strtype = get_string($module . ':' . $instance->type, 'format_page');
                         }
                         print "<li><div class=\"plus-minus\"><p><span class=\"no-space\"><strong>{$strtype}</strong></span></p></div>\n<ul>\n";
                         $lasttype = $instance->type;
                     }
                     if (!empty($modinfo->cms[$instance->cmid]->icon)) {
                         $icon = "{$CFG->pixpath}/" . urldecode($modinfo->cms[$instance->cmid]->icon);
                     } else {
                         $icon = "{$CFG->modpixpath}/{$module}/icon.gif";
                     }
                     if (empty($instance->visible)) {
                         $linkclass = ' class="dimmed"';
                     } else {
                         $linkclass = '';
                     }
                     print '<li>';
                     print '<img src="' . $icon . '" class="icon" />';
                     print "<a{$linkclass} href=\"{$CFG->wwwroot}/mod/{$module}/view.php?id={$instance->cmid}\">" . format_string(strip_tags($instance->name), true, $COURSE->id) . '</a>&nbsp;';
                     print '<span class="commands">';
                     print "<a title=\"{$vars->update}\" href=\"{$CFG->wwwroot}/course/mod.php?update={$instance->cmid}&amp;sesskey={$vars->sesskey}\">";
                     print "<img src=\"{$CFG->pixpath}/t/edit.gif\" class=\"icon-edit\" alt=\"{$vars->update}\" /></a>&nbsp;";
                     print "<a title=\"{$vars->delete}\" href=\"{$CFG->wwwroot}/course/format/page/format.php?id={$COURSE->id}&amp;action=deletemod&amp;sesskey={$vars->sesskey}&amp;cmid={$instance->cmid}\">";
                     print "<img src=\"{$CFG->pixpath}/t/delete.gif\" class=\"icon-edit\" alt=\"{$vars->delete}\" /></a></span>";
                     print "</li>\n";
                 }
                 if (!empty($lasttype)) {
                     // Close type list since we know it was opened
                     print "</ul>\n</li>\n";
                 }
                 print "</ul>\n";
             }
         }
     } else {
         print_box(get_string('noacivitiesfound', 'format_page'));
     }
     print_box_end();
 }
开发者ID:NextEinstein,项目名称:riverhills,代码行数:93,代码来源:activities.php


示例14: get_course_mods

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_all_page_ids函数代码示例发布时间:2022-05-15
下一篇:
PHP get_all_keys函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap