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

PHP get_section_name函数代码示例

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

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



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

示例1: section_title

 /**
  * Generate the section title (with link if section is collapsed)
  *
  * @param int|section_info $section
  * @param stdClass $course The course entry from DB
  * @return string HTML to output.
  */
 public function section_title($section, $course, $supresslink = false)
 {
     $title = get_section_name($course, $section);
     if (!$supresslink) {
         $url = course_get_url($course, $section, array('navigation' => true));
         if ($url) {
             $title = html_writer::link($url, $title);
         }
     }
     return $title;
 }
开发者ID:etarrillo,项目名称:pvflbl,代码行数:18,代码来源:renderer.php


示例2: equella_get_course_contents

function equella_get_course_contents($courseid, $sectionid)
{
    global $DB, $CFG;
    $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
    if ($course->format != 'site') {
        if (!file_exists($CFG->dirroot . '/course/format/' . $course->format . '/lib.php')) {
            throw new moodle_exception('cannotgetcoursecontents', 'webservice', '', null, get_string('courseformatnotfound', 'error', '', $course->format));
        } else {
            require_once $CFG->dirroot . '/course/format/' . $course->format . '/lib.php';
        }
    }
    $context = context_course::instance($course->id, IGNORE_MISSING);
    $coursecontents = new stdClass();
    $coursecontents->id = $course->id;
    $coursecontents->code = $course->idnumber;
    $coursecontents->name = $course->fullname;
    $coursecontents->targetable = false;
    $coursecontents->folders = array();
    if ($course->visible or has_capability('moodle/course:viewhiddencourses', $context)) {
        // retrieve sections
        $modinfo = get_fast_modinfo($course);
        $sections = $modinfo->get_section_info_all();
        // for each sections (first displayed to last displayed)
        foreach ($sections as $key => $section) {
            $sectionvalues = new stdClass();
            if ((int) $section->section == (int) $sectionid) {
                $sectionvalues->selected = true;
            }
            $sectionvalues->id = $section->section;
            $sectionvalues->name = get_section_name($course, $section);
            $sectionvalues->folders = array();
            $sectioncontents = array();
            // foreach ($modinfo->sections[$section->section] as $cmid) {
            // $cm = $modinfo->cms[$cmid];
            // if (!$cm->uservisible) {
            // continue;
            // }
            // $module = array();
            // $module['id'] = $cm->id;
            // $module['name'] = format_string($cm->name, true);
            // $sectioncontents[] = $module;
            // }
            // $sectionvalues->folders = $sectioncontents;
            $coursecontents->folders[] = $sectionvalues;
        }
    }
    return $coursecontents;
}
开发者ID:CTANZ,项目名称:moodle-mod_equella,代码行数:48,代码来源:locallib.php


示例3: createLOFromNative

 /**
  * Function that creates an object \intuitel\SectionLO from the info of the Moodle section (corresponding to a row of table course_sections). If the section summary or sequence of cmids are empty, the function returns NULL
  * @see \intuitel\LOFactory::createLOFromNative()
  * @param stdClass object $section_info corresponding to a row of course_section table in Moodle
  * @return \intuitel\SectionLO | NULL
  */
 function createLOFromNative($section_info)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     // for get_section_name()
     $loId = Intuitel::getIDFactory()->getLoIdfromId('section', $section_info->id);
     if ($this->isSectionEmpty($section_info)) {
         //throw new EmptySectionException('The section is empty');
         $LOsection = null;
     } else {
         $hasParent = Intuitel::getIDFactory()->getLoIdfromId('course', $section_info->course);
         //LOId of the course where the section is
         global $CFG;
         $name = \get_section_name($section_info->course, $section_info);
         // get the previous not empty section id
         $precedingSibId = $this->getPrecedingSib($section_info);
         if ($precedingSibId == null) {
             $hasPrecedingSib = null;
         } else {
             $hasPrecedingSib = Intuitel::getIDFactory()->getLoIdfromId('section', $precedingSibId);
         }
         //create the object with mandatory attributes
         $LOsection = new SectionLO($loId, $name, $hasParent, $hasPrecedingSib);
         //OPTIONAL ATTRIBUTES
         //Get an array with children of the section
         $childrenids = $this->getChildren($section_info);
         $hasChildren = array();
         foreach ($childrenids as $child) {
             $hasChildren[] = Intuitel::getIDFactory()->getLoIdfromId('module', $child);
         }
         $LOsection->sethasChildren($hasChildren);
         //Get the following not empty section
         $followingSibId = $this->getFollowingSib($section_info);
         if ($followingSibId == null) {
             $hasfollowingSib = null;
         } else {
             $hasfollowingSib = Intuitel::getIDFactory()->getLoIdfromId('section', $followingSibId);
         }
         $LOsection->sethasFollowingsib($hasfollowingSib);
         $lang = $this->getLang($section_info);
         $LOsection->setLang($lang);
     }
     return $LOsection;
 }
开发者ID:juacas,项目名称:moodle-block_intuitel,代码行数:50,代码来源:SectionLOFactory.php


示例4: get_activity_tree

/**
 * get_activity_tree :: course_modinfo -> integer -> context -> array
 * @param \course_modinfo $modinfo
 * @param integer $section_number
 * @param \context $context
 * @return array
 */
function get_activity_tree(\course_modinfo $modinfo, $section_number, \context $context)
{
    $completion_info = new \completion_info($modinfo->get_course());
    return F\map(F\filter($modinfo->get_section_info_all(), function (\section_info $section_info) {
        return $section_info->visible;
    }), function (\section_info $section_info) use($completion_info, $section_number, $context) {
        $mods = F\map(F\filter($section_info->modinfo->cms, function (\cm_info $cm_info) use($section_info) {
            global $CFG;
            return ($cm_info->uservisible || $CFG->enableavailability && !empty($cm_info->availableinfo)) && (int) $cm_info->sectionnum === (int) $section_info->section;
        }), function (\cm_info $cm_info) use($completion_info, $context) {
            global $CFG;
            $canComplete = $CFG->enablecompletion && isloggedin() && !isguestuser() && (int) $completion_info->is_enabled($cm_info) === COMPLETION_TRACKING_MANUAL;
            $hasCompleted = false;
            if ($canComplete) {
                $completion_data = $completion_info->get_data($cm_info, true);
                $hasCompleted = F\contains([COMPLETION_COMPLETE, COMPLETION_COMPLETE_PASS], (int) $completion_data->completionstate);
            }
            return (object) ['id' => (int) $cm_info->id, 'name' => $cm_info->name, 'modname' => $cm_info->modname, 'current' => is_current_mod($cm_info, $context), 'available' => $cm_info->available, 'canComplete' => $canComplete, 'hasCompleted' => $hasCompleted];
        });
        return (object) ['id' => (int) $section_info->id, 'section' => (int) $section_info->section, 'name' => \get_section_name($section_info->modinfo->courseid, $section_info->section), 'current' => is_current_section($section_info, $section_number, $context), 'activities' => array_values($mods)];
    });
}
开发者ID:robologo3000,项目名称:block-activity-tree,代码行数:29,代码来源:lib.php


示例5: get_string

    $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) {
        $printsection = '';
        if ($book->section !== $currentsection) {
            if ($book->section) {
                $printsection = get_section_name($course, $book->section);
            }
            if ($currentsection !== '') {
                $table->data[] = 'hr';
            }
            $currentsection = $book->section;
        }
    } else {
        $printsection = html_writer::tag('span', userdate($book->timemodified), array('class' => 'smallinfo'));
    }
    $class = $book->visible ? null : array('class' => 'dimmed');
    // hidden modules are dimmed
    $table->data[] = array($printsection, html_writer::link(new moodle_url('view.php', array('id' => $cm->id)), format_string($book->name), $class), format_module_intro('book', $book, $cm->id));
}
echo html_writer::table($table);
echo $OUTPUT->footer();
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:index.php


示例6: definition

 function definition()
 {
     global $CFG, $COURSE, $USER;
     $mform =& $this->_form;
     $context = context_course::instance($COURSE->id);
     $modinfo = get_fast_modinfo($COURSE);
     $sections = get_all_sections($COURSE->id);
     $mform->addElement('header', 'filters', get_string('managefilters'));
     //TODO: add better string
     $groupoptions = array();
     if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
         // limited group access
         $groups = groups_get_user_groups($COURSE->id);
         $allgroups = groups_get_all_groups($COURSE->id);
         if (!empty($groups[$COURSE->defaultgroupingid])) {
             foreach ($groups[$COURSE->defaultgroupingid] as $groupid) {
                 $groupoptions[$groupid] = format_string($allgroups[$groupid]->name, true, array('context' => $context));
             }
         }
     } else {
         $groupoptions = array('0' => get_string('allgroups'));
         if (has_capability('moodle/site:accessallgroups', $context)) {
             // user can see all groups
             $allgroups = groups_get_all_groups($COURSE->id);
         } else {
             // user can see course level groups
             $allgroups = groups_get_all_groups($COURSE->id, 0, $COURSE->defaultgroupingid);
         }
         foreach ($allgroups as $group) {
             $groupoptions[$group->id] = format_string($group->name, true, array('context' => $context));
         }
     }
     if ($COURSE->id == SITEID) {
         $viewparticipants = has_capability('moodle/site:viewparticipants', context_system::instance());
     } else {
         $viewparticipants = has_capability('moodle/course:viewparticipants', $context);
     }
     if ($viewparticipants) {
         $viewfullnames = has_capability('moodle/site:viewfullnames', context_course::instance($COURSE->id));
         $options = array();
         $options[0] = get_string('allparticipants');
         $options[$CFG->siteguest] = get_string('guestuser');
         if (isset($groupoptions[0])) {
             // can see all enrolled users
             if ($enrolled = get_enrolled_users($context, null, 0, user_picture::fields('u'))) {
                 foreach ($enrolled as $euser) {
                     $options[$euser->id] = fullname($euser, $viewfullnames);
                 }
             }
         } else {
             // can see users from some groups only
             foreach ($groupoptions as $groupid => $unused) {
                 if ($enrolled = get_enrolled_users($context, null, $groupid, user_picture::fields('u'))) {
                     foreach ($enrolled as $euser) {
                         if (!array_key_exists($euser->id, $options)) {
                             $options[$euser->id] = fullname($euser, $viewfullnames);
                         }
                     }
                 }
             }
         }
         $mform->addElement('select', 'user', get_string('participants'), $options);
         $mform->setAdvanced('user');
     }
     $sectiontitle = get_string('sectionname', 'format_' . $COURSE->format);
     $options = array('' => get_string('allactivities'));
     $modsused = array();
     foreach ($modinfo->cms as $cm) {
         if (!$cm->uservisible) {
             continue;
         }
         $modsused[$cm->modname] = true;
     }
     foreach ($modsused as $modname => $unused) {
         $libfile = "{$CFG->dirroot}/mod/{$modname}/lib.php";
         if (!file_exists($libfile)) {
             unset($modsused[$modname]);
             continue;
         }
         include_once $libfile;
         $libfunction = $modname . "_get_recent_mod_activity";
         if (!function_exists($libfunction)) {
             unset($modsused[$modname]);
             continue;
         }
         $options["mod/{$modname}"] = get_string('allmods', '', get_string('modulenameplural', $modname));
     }
     foreach ($modinfo->sections as $section => $cmids) {
         $options["section/{$section}"] = "-- " . get_section_name($COURSE, $sections[$section]) . " --";
         foreach ($cmids as $cmid) {
             $cm = $modinfo->cms[$cmid];
             if (empty($modsused[$cm->modname]) or !$cm->uservisible) {
                 continue;
             }
             $options[$cm->id] = format_string($cm->name);
         }
     }
     $mform->addElement('select', 'modid', get_string('activities'), $options);
     $mform->setAdvanced('modid');
     if ($groupoptions) {
//.........这里部分代码省略.........
开发者ID:nigeli,项目名称:moodle,代码行数:101,代码来源:recent_form.php


示例7: array

        /*$event = \core\event\course_section_updated::create(
                  array(
                      'objectid' => $data->id,
                      'courseid' => $course->id,
                      'context' => $context,
                      'other' => array('sectionnum' => $data->section)
                  )
              );
          $event->trigger();*/
        require_once $CFG->dirroot . '/calendar/lib.php';
        /*if($existentevent = $DB->get_record('event', array('courseid' =>$course->id, 'instance' => $data->section))){
              $event->id = $existentevent->id;
              $DB->update_record('event', $event);
          }else{
              calendar_event::create($event);
          }*/
        $PAGE->navigation->clear_cache();
        redirect(course_get_url($course, $section, array('sr' => $sectionreturn)));
    }
}
// The edit form is displayed for the first time or if there was validation error on the previous step.
$sectionname = get_section_name($course, $sectionnum);
$stredit = get_string('edita', '', " {$sectionname}");
$strsummaryof = get_string('summaryof', '', " {$sectionname}");
$PAGE->set_title($stredit);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($stredit);
echo $OUTPUT->header();
echo $OUTPUT->heading($strsummaryof);
$mform->display();
echo $OUTPUT->footer();
开发者ID:helenagarcia90,项目名称:moodle,代码行数:31,代码来源:editsection.php


示例8: get_string

    $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'));
    echo html_writer::start_tag('div');
    echo html_writer::empty_tag('input', array('type' => 'hidden', 'id' => 'completion_dynamic_change', 'name' => 'completion_dynamic_change', 'value' => '0'));
开发者ID:dibarbado,项目名称:moodle,代码行数:31,代码来源:view.php


示例9: require_login

 }
 require_login($course->id);
 // needed to setup proper $COURSE
 $form->section = $section;
 // The section number itself
 $form->course = $course->id;
 $form->module = $module->id;
 $form->modulename = $module->name;
 $form->instance = "";
 $form->coursemodule = "";
 $form->mode = "add";
 $form->sesskey = !empty($USER->id) ? $USER->sesskey : '';
 if (!empty($type)) {
     $form->type = $type;
 }
 $sectionname = get_section_name($course->format);
 $fullmodulename = get_string("modulename", $module->name);
 if ($form->section && $course->format != 'site') {
     $heading->what = $fullmodulename;
     $heading->to = "{$sectionname} {$form->section}";
     $pageheading = get_string("addinganewto", "moodle", $heading);
 } else {
     $pageheading = get_string("addinganew", "moodle", $fullmodulename);
 }
 $strnav = '';
 $CFG->pagepath = 'mod/' . $module->name;
 if (!empty($type)) {
     $CFG->pagepath .= '/' . $type;
 } else {
     $CFG->pagepath .= '/mod';
 }
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:mod.php


示例10: get_course_contents

    /**
     * Get course contents
     *
     * @param int $courseid course id
     * @param array $options These options are not used yet, might be used in later version
     * @return array
     * @since Moodle 2.2
     */
    public static function get_course_contents($courseid, $options = array()) {
        global $CFG, $DB;
        require_once($CFG->dirroot . "/course/lib.php");

        //validate parameter
        $params = self::validate_parameters(self::get_course_contents_parameters(),
                        array('courseid' => $courseid, 'options' => $options));

        //retrieve the course
        $course = $DB->get_record('course', array('id' => $params['courseid']), '*', MUST_EXIST);

        //check course format exist
        if (!file_exists($CFG->dirroot . '/course/format/' . $course->format . '/lib.php')) {
            throw new moodle_exception('cannotgetcoursecontents', 'webservice', '', null, get_string('courseformatnotfound', 'error', '', $course->format));
        } else {
            require_once($CFG->dirroot . '/course/format/' . $course->format . '/lib.php');
        }

        // now security checks
        $context = context_course::instance($course->id, IGNORE_MISSING);
        try {
            self::validate_context($context);
        } catch (Exception $e) {
            $exceptionparam = new stdClass();
            $exceptionparam->message = $e->getMessage();
            $exceptionparam->courseid = $course->id;
            throw new moodle_exception('errorcoursecontextnotvalid', 'webservice', '', $exceptionparam);
        }

        $canupdatecourse = has_capability('moodle/course:update', $context);

        //create return value
        $coursecontents = array();

        if ($canupdatecourse or $course->visible
                or has_capability('moodle/course:viewhiddencourses', $context)) {

            //retrieve sections
            $modinfo = get_fast_modinfo($course);
            $sections = $modinfo->get_section_info_all();

            //for each sections (first displayed to last displayed)
            $modinfosections = $modinfo->get_sections();
            foreach ($sections as $key => $section) {

                if (!$section->uservisible) {
                    continue;
                }

                // reset $sectioncontents
                $sectionvalues = array();
                $sectionvalues['id'] = $section->id;
                $sectionvalues['name'] = get_section_name($course, $section);
                $sectionvalues['visible'] = $section->visible;
                list($sectionvalues['summary'], $sectionvalues['summaryformat']) =
                        external_format_text($section->summary, $section->summaryformat,
                                $context->id, 'course', 'section', $section->id);
                $sectioncontents = array();

                //for each module of the section
                if (!empty($modinfosections[$section->section])) {
                    foreach ($modinfosections[$section->section] as $cmid) {
                        $cm = $modinfo->cms[$cmid];

                        // stop here if the module is not visible to the user
                        if (!$cm->uservisible) {
                            continue;
                        }

                        $module = array();

                        //common info (for people being able to see the module or availability dates)
                        $module['id'] = $cm->id;
                        $module['name'] = format_string($cm->name, true);
                        $module['modname'] = $cm->modname;
                        $module['modplural'] = $cm->modplural;
                        $module['modicon'] = $cm->get_icon_url()->out(false);
                        $module['indent'] = $cm->indent;

                        $modcontext = context_module::instance($cm->id);

                        if (!empty($cm->showdescription) or $cm->modname == 'label') {
                            // We want to use the external format. However from reading get_formatted_content(), $cm->content format is always FORMAT_HTML.
                            list($module['description'], $descriptionformat) = external_format_text($cm->content,
                                FORMAT_HTML, $modcontext->id, $cm->modname, 'intro', $cm->id);
                        }

                        //url of the module
                        $url = $cm->url;
                        if ($url) { //labels don't have url
                            $module['url'] = $url->out(false);
                        }
//.........这里部分代码省略.........
开发者ID:rwijaya,项目名称:moodle,代码行数:101,代码来源:externallib.php


示例11: get_coursemodule_from_instance

        //Show normal if the mod is visible
        $link = "<a href=\"view.php?id=$lesson->coursemodule\">".format_string($lesson->name,true)."</a>";
    }
    $cm = get_coursemodule_from_instance('lesson', $lesson->id);
    $context = context_module::instance($cm->id);

    if ($lesson->deadline == 0) {
        $due = $strnodeadline;
    } else if ($lesson->deadline > $timenow) {
        $due = userdate($lesson->deadline);
    } else {
        $due = "<font color=\"red\">".userdate($lesson->deadline)."</font>";
    }

    if ($usesections) {
        if (has_capability('mod/lesson:manage', $context)) {
            $grade_value = $lesson->grade;
        } else {
            // it's a student, show their grade
            $grade_value = 0;
            if ($return = lesson_get_user_grades($lesson, $USER->id)) {
                $grade_value = $return[$USER->id]->rawgrade;
            }
        }
        $table->data[] = array (get_section_name($course, $sections[$lesson->section]), $link, $grade_value, $due);
    } else {
        $table->data[] = array ($link, $lesson->grade, $due);
    }
}
echo html_writer::table($table);
echo $OUTPUT->footer();
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:index.php


示例12: array

if ($usesections) {
    $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 ($folders as $folder) {
    $cm = $modinfo->cms[$folder->coursemodule];
    if ($usesections) {
        $printsection = '';
        if ($folder->section !== $currentsection) {
            if ($folder->section) {
                $printsection = get_section_name($course, $folder->section);
            }
            if ($currentsection !== '') {
                $table->data[] = 'hr';
            }
            $currentsection = $folder->section;
        }
    } else {
        $printsection = '<span class="smallinfo">' . userdate($folder->timemodified) . "</span>";
    }
    $class = $folder->visible ? '' : 'class="dimmed"';
    // hidden modules are dimmed
    $table->data[] = array($printsection, "<a {$class} href=\"view.php?id={$cm->id}\">" . format_string($folder->name) . "</a>", format_module_intro('folder', $folder, $cm->id));
}
echo html_writer::table($table);
echo $OUTPUT->footer();
开发者ID:eamador,项目名称:moodle-course-custom-fields,代码行数:31,代码来源:index.php


示例13: course_section_add_cm_control

 /**
  * Renders HTML for the menus to add activities and resources to the current course
  *
  * Note, if theme overwrites this function and it does not use modchooser,
  * see also {@link core_course_renderer::add_modchoosertoggle()}
  *
  * @param stdClass $course
  * @param int $section relative section number (field course_sections.section)
  * @param int $sectionreturn The section to link back to
  * @param array $displayoptions additional display options, for example blocks add
  *     option 'inblock' => true, suggesting to display controls vertically
  * @return string
  */
 function course_section_add_cm_control($course, $section, $sectionreturn = null, $displayoptions = array())
 {
     global $CFG;
     $vertical = !empty($displayoptions['inblock']);
     // check to see if user can add menus and there are modules to add
     if (!has_capability('moodle/course:manageactivities', context_course::instance($course->id)) || !$this->page->user_is_editing() || !($modnames = get_module_types_names()) || empty($modnames)) {
         return '';
     }
     // Retrieve all modules with associated metadata
     $modules = get_module_metadata($course, $modnames, $sectionreturn);
     $urlparams = array('section' => $section);
     // We'll sort resources and activities into two lists
     $activities = array(MOD_CLASS_ACTIVITY => array(), MOD_CLASS_RESOURCE => array());
     foreach ($modules as $module) {
         if (isset($module->types)) {
             // This module has a subtype
             // NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
             $subtypes = array();
             foreach ($module->types as $subtype) {
                 $link = $subtype->link->out(true, $urlparams);
                 $subtypes[$link] = $subtype->title;
             }
             // Sort module subtypes into the list
             $activityclass = MOD_CLASS_ACTIVITY;
             if ($module->archetype == MOD_CLASS_RESOURCE) {
                 $activityclass = MOD_CLASS_RESOURCE;
             }
             if (!empty($module->title)) {
                 // This grouping has a name
                 $activities[$activityclass][] = array($module->title => $subtypes);
             } else {
                 // This grouping does not have a name
                 $activities[$activityclass] = array_merge($activities[$activityclass], $subtypes);
             }
         } else {
             // This module has no subtypes
             $activityclass = MOD_CLASS_ACTIVITY;
             if ($module->archetype == MOD_ARCHETYPE_RESOURCE) {
                 $activityclass = MOD_CLASS_RESOURCE;
             } else {
                 if ($module->archetype === MOD_ARCHETYPE_SYSTEM) {
                     // System modules cannot be added by user, do not add to dropdown
                     continue;
                 }
             }
             $link = $module->link->out(true, $urlparams);
             $activities[$activityclass][$link] = $module->title;
         }
     }
     $straddactivity = get_string('addactivity');
     $straddresource = get_string('addresource');
     $sectionname = get_section_name($course, $section);
     $strresourcelabel = get_string('addresourcetosection', null, $sectionname);
     $stractivitylabel = get_string('addactivitytosection', null, $sectionname);
     $output = html_writer::start_tag('div', array('class' => 'section_add_menus', 'id' => 'add_menus-section-' . $section));
     if (!$vertical) {
         $output .= html_writer::start_tag('div', array('class' => 'horizontal'));
     }
     if (!empty($activities[MOD_CLASS_RESOURCE])) {
         $select = new url_select($activities[MOD_CLASS_RESOURCE], '', array('' => $straddresource), "ressection{$section}");
         $select->set_help_icon('resources');
         $select->set_label($strresourcelabel, array('class' => 'accesshide'));
         $output .= $this->output->render($select);
     }
     if (!empty($activities[MOD_CLASS_ACTIVITY])) {
         $select = new url_select($activities[MOD_CLASS_ACTIVITY], '', array('' => $straddactivity), "section{$section}");
         $select->set_help_icon('activities');
         $select->set_label($stractivitylabel, array('class' => 'accesshide'));
         $output .= $this->output->render($select);
     }
     if (!$vertical) {
         $output .= html_writer::end_tag('div');
     }
     $output .= html_writer::end_tag('div');
     if (course_ajax_enabled($course) && $course->id == $this->page->course->id) {
         // modchooser can be added only for the current course set on the page!
         $straddeither = get_string('addresourceoractivity');
         // The module chooser link
         $modchooser = html_writer::start_tag('div', array('class' => 'mdl-right'));
         $modchooser .= html_writer::start_tag('div', array('class' => 'section-modchooser'));
         $icon = $this->output->pix_icon('t/add', '');
         $span = html_writer::tag('span', $straddeither, array('class' => 'section-modchooser-text'));
         $modchooser .= html_writer::tag('span', $icon . $span, array('class' => 'section-modchooser-link'));
         $modchooser .= html_writer::end_tag('div');
         $modchooser .= html_writer::end_tag('div');
         // Wrap the normal output in a noscript div
         $usemodchooser = get_user_preferences('usemodchooser', $CFG->modchooserdefault);
//.........这里部分代码省略.........
开发者ID:rushi963,项目名称:moodle,代码行数:101,代码来源:renderer.php


示例14: time

$timenow = time();
$strsectionname = get_string('sectionname', 'format_' . $course->format);
$strname = get_string("name");
$table = new html_table();

if ($usesections) {
    $table->head = array($strsectionname, $strname);
} else {
    $table->head = array($strname);
}

foreach ($wikis as $wiki) {
    $linkcss = null;
    if (!$wiki->visible) {
        $linkcss = array('class' => 'dimmed');
    }
    $link = html_writer::link(new moodle_url('/mod/wiki/view.php', array('id' => $wiki->coursemodule)), $wiki->name, $linkcss);

    if ($usesections) {
        $table->data[] = array(get_section_name($course, $wiki->section), $link);
    } else {
        $table->data[] = array($link);
    }
}

echo html_writer::table($table);

/// Finish the page
echo $OUTPUT->footer();
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:29,代码来源:index.php


示例15: get_section_name_from_item

 private static function get_section_name_from_item($item, $fast = false)
 {
     if (isset(self::$coursesections[$item->sectionid])) {
         $section = self::$coursesections[$item->sectionid];
         $section_name = $section->sectionname;
     } else {
         $section = new stdclass();
         $section->course = $item->courseid;
         $section->section = $item->section;
         $section->id = $item->sectionid;
         if ($fast) {
             $section_name = get_string('sectionname', 'format_' . $item->format) . ' ' . $item->section;
         } else {
             $section_name = get_section_name($item->courseid, $section);
         }
         $section->sectionname = $section_name;
         self::$coursesections[$item->sectionid] = $section;
     }
     return $section_name;
 }
开发者ID:CTANZ,项目名称:moodle-mod_equella,代码行数:20,代码来源:externallib.php


示例16: get_string

    $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 ($pages as $page) {
    $cm = $modinfo->cms[$page->coursemodule];
    if ($usesections) {
        $printsection = '';
        if ($page->section !== $currentsection) {
            if ($page->section) {
                $printsection = get_section_name($course, $page->section);
            }
            if ($currentsection !== '') {
                $table->data[] = 'hr';
            }
            $currentsection = $page->section;
        }
    } else {
        $printsection = '<span class="smallinfo">' . userdate($page->timemodified) . "</span>";
    }
    $class = $page->visible ? '' : 'class="dimmed"';
    // hidden modules are dimmed
    $table->data[] = array($printsection, "<a {$class} href=\"view.php?id={$cm->id}\">" . format_string($page->name) . "</a>", format_module_intro('page', $page, $cm->id));
}
echo html_writer::table($table);
echo $OUTPUT->footer();
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:31,代码来源:embeddoc.php


示例17: navigation_add_section

 /**
  * Adds a section to navigation node, loads modules and subsections if necessary
  *
  * @param global_navigation $navigation
  * @param navigation_node $node
  * @param section_info $section
  * @return null|navigation_node
  */
 protected function navigation_add_section($navigation, navigation_node $node, $section)
 {
     if (!$section->uservisible || !$this->is_section_real_available($section)) {
         return null;
     }
     $sectionname = get_section_name($this->get_course(), $section);
     $url = course_get_url($this->get_course(), $section->section, array('navigation' => true));
     $sectionnode = $node->add($sectionname, $url, navigation_node::TYPE_SECTION, null, $section->id);
     $sectionnode->nodetype = navigation_node::NODETYPE_BRANCH;
     $sectionnode->hidden = !$section->visible || !$section->available;
     if ($section->section == $this->get_viewed_section()) {
         $sectionnode->force_open();
     }
     if ($this->section_has_parent($navigation->includesectionnum, $section->section) || $navigation->includesectionnum == $section->section) {
         $modinfo = get_fast_modinfo($this->courseid);
         if (!empty($modinfo->sections[$section->section])) {
             foreach ($modinfo->sections[$section->section] as $cmid) {
                 $this->navigation_add_activity($sectionnode, $modinfo->get_cm($cmid));
             }
         }
         foreach ($modinfo->get_section_info_all() as $subsection) {
             if ($subsection->parent == $section->section && $subsection->section != 0) {
                 $this->navigation_add_section($navigation, $sectionnode, $subsection);
             }
         }
     }
     return $sectionnode;
 }
开发者ID:etarrillo,项目名称:pvflbl,代码行数:36,代码来源:lib.php


示例18: array

    $table->align = array('center', 'left', 'left');
} else {
    $table->head = array($strlastmodified, $strname, $strintro);
    $table->align = array('left', 'left', 'left');
}
$currentsection = '';
foreach ($cms as $cm) {
    if (!isset($resources[$cm->modname][$cm->instance])) {
        continue;
    }
    $resource = $resources[$cm->modname][$cm->instance];
    if ($usesections) {
        $printsection = '';
        if ($cm->sectionnum !== $currentsection) {
            if ($cm->sectionnum) {
                $printsection = get_section_name($course, $sections[$cm->sectionnum]);
            }
            if ($currentsection !== '') {
                $table->data[] = 'hr';
            }
            $currentsection = $cm->sectionnum;
        }
    } else {
        $printsection = '<span class="smallinfo">' . userdate($resource->timemodified) . "</span>";
    }
    $extra = empty($cm->extra) ? '' : $cm->extra;
    if (!empty($cm->icon)) {
        $icon = '<img src="' . $OUTPUT->pix_url($cm->icon) . '" class="activityicon" alt="' . get_string('modulename', $cm->modname) . '" /> ';
    } else {
        $icon = '<img src="' . $OUTPUT->pix_url('icon', $cm->modname) . '" class="activityicon" alt="' . get_string('modulename', $cm->modname) . '" /> ';
    }
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:resources.php


示例19: 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 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_secure_htsrv_url函数代码示例发布时间:2022-05-15
下一篇:
PHP get_search_template函数代码示例发布时间: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