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


PHP course_format_uses_sections函数代码示例

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


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

示例1: get_string

$strbook = get_string('modulename', 'mod_book');
$strname = get_string('name');
$strintro = get_string('moduleintro');
$strlastmodified = get_string('lastmodified');
$PAGE->set_url('/mod/book/index.php', array('id' => $course->id));
$PAGE->set_title($course->shortname . ': ' . $strbooks);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strbooks);
echo $OUTPUT->header();
\mod_book\event\course_module_instance_list_viewed::create_from_course($course)->trigger();
// Get all the appropriate data
if (!($books = get_all_instances_in_course('book', $course))) {
    notice(get_string('thereareno', 'moodle', $strbooks), "{$CFG->wwwroot}/course/view.php?id={$course->id}");
    die;
}
$usesections = course_format_uses_sections($course->format);
$table = new html_table();
$table->attributes['class'] = 'generaltable mod_index';
if ($usesections) {
    $strsectionname = get_string('sectionname', 'format_' . $course->format);
    $table->head = array($strsectionname, $strname, $strintro);
    $table->align = array('center', 'left', 'left');
} else {
    $table->head = array($strlastmodified, $strname, $strintro);
    $table->align = array('left', 'left', 'left');
}
$modinfo = get_fast_modinfo($course);
$currentsection = '';
foreach ($books as $book) {
    $cm = $modinfo->get_cm($book->coursemodule);
    if ($usesections) {
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:index.php

示例2: view_course_index

 /**
  * View a summary listing of all assignments in the current course.
  *
  * @return string
  */
 private function view_course_index()
 {
     global $USER;
     $o = '';
     $course = $this->get_course();
     $strplural = get_string('modulenameplural', 'assign');
     if (!($cms = get_coursemodules_in_course('assign', $course->id, 'm.duedate'))) {
         $o .= $this->get_renderer()->notification(get_string('thereareno', 'moodle', $strplural));
         $o .= $this->get_renderer()->continue_button(new moodle_url('/course/view.php', array('id' => $course->id)));
         return $o;
     }
     $strsectionname = '';
     $usesections = course_format_uses_sections($course->format);
     $modinfo = get_fast_modinfo($course);
     if ($usesections) {
         $strsectionname = get_string('sectionname', 'format_' . $course->format);
         $sections = $modinfo->get_section_info_all();
     }
     $courseindexsummary = new assign_course_index_summary($usesections, $strsectionname);
     $timenow = time();
     $currentsection = '';
     foreach ($modinfo->instances['assign'] as $cm) {
         if (!$cm->uservisible) {
             continue;
         }
         $timedue = $cms[$cm->id]->duedate;
         $sectionname = '';
         if ($usesections && $cm->sectionnum) {
             $sectionname = get_section_name($course, $sections[$cm->sectionnum]);
         }
         $submitted = '';
         $context = context_module::instance($cm->id);
         $assignment = new assign($context, $cm, $course);
         if (has_capability('mod/assign:grade', $context)) {
             $submitted = $assignment->count_submissions_with_status(ASSIGN_SUBMISSION_STATUS_SUBMITTED);
         } else {
             if (has_capability('mod/assign:submit', $context)) {
                 $usersubmission = $assignment->get_user_submission($USER->id, false);
                 if (!empty($usersubmission->status)) {
                     $submitted = get_string('submissionstatus_' . $usersubmission->status, 'assign');
                 } else {
                     $submitted = get_string('submissionstatus_', 'assign');
                 }
             }
         }
         $gradinginfo = grade_get_grades($course->id, 'mod', 'assign', $cm->instance, $USER->id);
         if (isset($gradinginfo->items[0]->grades[$USER->id]) && !$gradinginfo->items[0]->grades[$USER->id]->hidden) {
             $grade = $gradinginfo->items[0]->grades[$USER->id]->str_grade;
         } else {
             $grade = '-';
         }
         $courseindexsummary->add_assign_info($cm->id, $cm->name, $sectionname, $timedue, $submitted, $grade);
     }
     $o .= $this->get_renderer()->render($courseindexsummary);
     $o .= $this->view_footer();
     return $o;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:62,代码来源:locallib.php

示例3: array

if ($completion->is_enabled()) {
    $PAGE->requires->string_for_js('completion-title-manual-y', 'completion');
    $PAGE->requires->string_for_js('completion-title-manual-n', 'completion');
    $PAGE->requires->string_for_js('completion-alt-manual-y', 'completion');
    $PAGE->requires->string_for_js('completion-alt-manual-n', 'completion');
    $PAGE->requires->js_init_call('M.core_completion.init');
}
// We are currently keeping the button here from 1.x to help new teachers figure out
// what to do, even though the link also appears in the course admin block.  It also
// means you can back out of a situation where you removed the admin block. :)
if ($PAGE->user_allowed_editing()) {
    $buttons = $OUTPUT->edit_button($PAGE->url);
    $PAGE->set_button($buttons);
}
// If viewing a section, make the title more specific
if ($section and $section > 0 and course_format_uses_sections($course->format)) {
    $sectionname = get_string('sectionname', "format_{$course->format}");
    $sectiontitle = get_section_name($course, $section);
    $PAGE->set_title(get_string('coursesectiontitle', 'moodle', array('course' => $course->fullname, 'sectiontitle' => $sectiontitle, 'sectionname' => $sectionname)));
} else {
    $PAGE->set_title(get_string('coursetitle', 'moodle', array('course' => $course->fullname)));
}
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
if ($completion->is_enabled()) {
    // This value tracks whether there has been a dynamic change to the page.
    // It is used so that if a user does this - (a) set some tickmarks, (b)
    // go to another page, (c) clicks Back button - the page will
    // automatically reload. Otherwise it would start with the wrong tick
    // values.
    echo html_writer::start_tag('form', array('action' => '.', 'method' => 'get'));
开发者ID:dibarbado,项目名称:moodle,代码行数:31,代码来源:view.php

示例4: include_course_ajax

/**
 * Include the relevant javascript and language strings for the resource
 * toolbox YUI module
 *
 * @param integer $id The ID of the course being applied to
 * @param array $usedmodules An array containing the names of the modules in use on the page
 * @param array $enabledmodules An array containing the names of the enabled (visible) modules on this site
 * @param stdClass $config An object containing configuration parameters for ajax modules including:
 *          * resourceurl   The URL to post changes to for resource changes
 *          * sectionurl    The URL to post changes to for section changes
 *          * pageparams    Additional parameters to pass through in the post
 * @return bool
 */
function include_course_ajax($course, $usedmodules = array(), $enabledmodules = null, $config = null)
{
    global $CFG, $PAGE, $SITE;
    // Ensure that ajax should be included
    if (!course_ajax_enabled($course)) {
        return false;
    }
    if (!$config) {
        $config = new stdClass();
    }
    // The URL to use for resource changes
    if (!isset($config->resourceurl)) {
        $config->resourceurl = '/course/rest.php';
    }
    // The URL to use for section changes
    if (!isset($config->sectionurl)) {
        $config->sectionurl = '/course/rest.php';
    }
    // Any additional parameters which need to be included on page submission
    if (!isset($config->pageparams)) {
        $config->pageparams = array();
    }
    // Include toolboxes
    $PAGE->requires->yui_module('moodle-course-toolboxes', 'M.course.init_resource_toolbox', array(array('courseid' => $course->id, 'ajaxurl' => $config->resourceurl, 'config' => $config)));
    $PAGE->requires->yui_module('moodle-course-toolboxes', 'M.course.init_section_toolbox', array(array('courseid' => $course->id, 'format' => $course->format, 'ajaxurl' => $config->sectionurl, 'config' => $config)));
    // Include course dragdrop
    if (course_format_uses_sections($course->format)) {
        $PAGE->requires->yui_module('moodle-course-dragdrop', 'M.course.init_section_dragdrop', array(array('courseid' => $course->id, 'ajaxurl' => $config->sectionurl, 'config' => $config)), null, true);
        $PAGE->requires->yui_module('moodle-course-dragdrop', 'M.course.init_resource_dragdrop', array(array('courseid' => $course->id, 'ajaxurl' => $config->resourceurl, 'config' => $config)), null, true);
    }
    // Require various strings for the command toolbox
    $PAGE->requires->strings_for_js(array('moveleft', 'deletechecktype', 'deletechecktypename', 'edittitle', 'edittitleinstructions', 'show', 'hide', 'groupsnone', 'groupsvisible', 'groupsseparate', 'clicktochangeinbrackets', 'markthistopic', 'markedthistopic', 'movesection', 'movecoursemodule', 'movecoursesection', 'movecontent', 'tocontent', 'emptydragdropregion', 'afterresource', 'aftersection', 'totopofsection'), 'moodle');
    // Include section-specific strings for formats which support sections.
    if (course_format_uses_sections($course->format)) {
        $PAGE->requires->strings_for_js(array('showfromothers', 'hidefromothers'), 'format_' . $course->format);
    }
    // For confirming resource deletion we need the name of the module in question
    foreach ($usedmodules as $module => $modname) {
        $PAGE->requires->string_for_js('pluginname', $module);
    }
    // Load drag and drop upload AJAX.
    require_once $CFG->dirroot . '/course/dnduploadlib.php';
    dndupload_add_to_course($course, $enabledmodules);
    return true;
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:58,代码来源:lib.php

示例5: add_to_log

        $infoid = $coursesections->id;
        $logparam .= '&sectionid='. $infoid;
    }
    add_to_log($course->id, 'course', $loglabel, "view.php?". $logparam, $infoid);

    $course->format = clean_param($course->format, PARAM_ALPHA);
    if (!file_exists($CFG->dirroot.'/course/format/'.$course->format.'/format.php')) {
        $course->format = 'weeks';  // Default format is weeks
    }

    $PAGE->set_pagelayout('course');
    $PAGE->set_pagetype('course-view-' . $course->format);
    $PAGE->set_other_editing_capability('moodle/course:update');
    $PAGE->set_other_editing_capability('moodle/course:manageactivities');
    $PAGE->set_other_editing_capability('moodle/course:activityvisibility');
    if (course_format_uses_sections($course->format)) {
        $PAGE->set_other_editing_capability('moodle/course:sectionvisibility');
    }

    if ($reset_user_allowed_editing) {
        // ugly hack
        unset($PAGE->_user_allowed_editing);
    }

    if (!isset($USER->editing)) {
        $USER->editing = 0;
    }
    if ($PAGE->user_allowed_editing()) {
        if (($edit == 1) and confirm_sesskey()) {
            $USER->editing = 1;
            // Redirect to site root if Editing is toggled on frontpage
开发者ID:ncsu-delta,项目名称:moodle,代码行数:31,代码来源:view.php

示例6: include_course_ajax

 /**
  * Include the relevant javascript and language strings for the resource
  * toolbox YUI module
  *
  * @param integer $id The ID of the course being applied to
  * @param array $usedmodules An array containing the names of the modules in use on the page
  * @param array $enabledmodules An array containing the names of the enabled (visible) modules on this site
  * @param stdClass $config An object containing configuration parameters for ajax modules including:
  *          * resourceurl   The URL to post changes to for resource changes
  *          * sectionurl    The URL to post changes to for section changes
  *          * pageparams    Additional parameters to pass through in the post
  * @return bool
  */
 protected static function include_course_ajax($course, $usedmodules = array(), $enabledmodules = null, $config = null)
 {
     global $CFG, $PAGE;
     // Only include course AJAX for supported formats.
     if (!course_ajax_enabled($course)) {
         return false;
     }
     // Require various strings for the command toolbox.
     $PAGE->requires->strings_for_js(['afterresource', 'aftersection', 'clicktochangeinbrackets', 'deletechecktype', 'deletechecktypename', 'edittitle', 'edittitleinstructions', 'emptydragdropregion', 'groupsnone', 'groupsvisible', 'groupsseparate', 'hide', 'markthistopic', 'markedthistopic', 'moveleft', 'movesection', 'movecoursemodule', 'movecoursesection', 'movecontent', 'show', 'tocontent', 'totopofsection'], 'moodle');
     $PAGE->requires->strings_for_js(['error:failedtochangesectionvisibility', 'error:failedtohighlightsection', 'error:failedtochangeassetvisibility', 'error:failedtoduplicateasset'], 'theme_snap');
     // Include section-specific strings for formats which support sections.
     if (course_format_uses_sections($course->format)) {
         $PAGE->requires->strings_for_js(array('showfromothers', 'hidefromothers'), 'format_' . $course->format);
     }
     // For confirming resource deletion we need the name of the module in question.
     foreach ($usedmodules as $module => $modname) {
         $PAGE->requires->string_for_js('pluginname', $module);
     }
     // Load drag and drop upload AJAX.
     require_once $CFG->dirroot . '/course/dnduploadlib.php';
     self::dndupload_add_to_course($course, $enabledmodules);
     return true;
 }
开发者ID:pramithkm,项目名称:moodle-theme_snap,代码行数:36,代码来源:shared.php

示例7: render_instance_table

 /**
  * Render table of collaborate instances.
  *
  * @param $course
  * @param $strname
  * @return string
  */
 public function render_instance_table($course, $strname)
 {
     $usesections = course_format_uses_sections($course->format);
     $table = new html_table();
     $table->attributes['class'] = 'generaltable mod_index';
     if ($usesections) {
         $strsectionname = get_string('sectionname', 'format_' . $course->format);
         $table->head = array($strsectionname, $strname);
         $table->align = array('center', 'left');
     } else {
         $table->head = array($strname);
         $table->align = array('left');
     }
     $modinfo = get_fast_modinfo($course);
     $currentsection = '';
     foreach ($modinfo->instances['collaborate'] as $cm) {
         $row = array();
         if ($usesections) {
             if ($cm->sectionnum !== $currentsection) {
                 if ($cm->sectionnum) {
                     $row[] = get_section_name($course, $cm->sectionnum);
                 } else {
                     $row[] = '';
                 }
                 if ($currentsection !== '') {
                     $table->data[] = 'hr';
                 }
                 $currentsection = $cm->sectionnum;
             } else {
                 $row[] = '';
             }
         }
         $class = $cm->visible ? null : array('class' => 'dimmed');
         $row[] = html_writer::link(new moodle_url('view.php', array('id' => $cm->id)), $cm->get_formatted_name(), $class);
         $table->data[] = $row;
     }
     return html_writer::table($table);
 }
开发者ID:mpetrowi,项目名称:moodle-mod_collaborate,代码行数:45,代码来源:renderer.php

示例8: get_string

$respondusws_strlastmodified = get_string("lastmodified");
$respondusws_renderer_file = dirname(__FILE__) . "/renderer.php";
if (is_readable($respondusws_renderer_file)) {
    $respondusws_output = $PAGE->get_renderer("mod_respondusws");
} else {
    $respondusws_output = $OUTPUT;
}
$PAGE->set_title($respondusws_strmodules);
$PAGE->set_heading($respondusws_course->fullname);
$PAGE->navbar->add($respondusws_strmodules);
echo $respondusws_output->header();
$respondusws_modules = get_all_instances_in_course("respondusws", $respondusws_course);
if (!$respondusws_modules) {
    print_error("noinstances", "respondusws", "{$CFG->dirroot}/course/view.php?id={$respondusws_course->id}");
}
$respondusws_usesections = course_format_uses_sections($respondusws_course->format);
if ($respondusws_usesections) {
    if (respondusws_floatcompare($CFG->version, 2012120300, 2) >= 0) {
        $modinfo = get_fast_modinfo($respondusws_course->id);
        $respondusws_sections = $modinfo->get_section_info_all();
    } else {
        $respondusws_sections = get_all_sections($respondusws_course->id);
    }
}
$respondusws_table = new html_table();
$respondusws_table->attributes["class"] = "generaltable_mod_index";
if ($respondusws_usesections) {
    $respondusws_table->head = array($respondusws_strsectionname, $respondusws_strname, $strintro);
    $respondusws_table->align = array("center", "left", "left");
} else {
    $respondusws_table->head = array($respondusws_strlastmodified, $respondusws_strname, $strintro);
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:31,代码来源:index.php


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