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


PHP course_get_url函数代码示例

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


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

示例1: render_section_links

 /**
  * Render a series of section links.
  *
  * @param stdClass $course The course we are rendering for.
  * @param array $sections An array of section objects to render.
  * @param bool|int The section to provide a jump to link for.
  * @return string The HTML to display.
  */
 public function render_section_links(stdClass $course, array $sections, $jumptosection = false)
 {
     $html = html_writer::start_tag('ol', array('class' => 'inline-list'));
     foreach ($sections as $section) {
         $attributes = array();
         if (!$section->visible) {
             $attributes['class'] = 'dimmed';
         }
         $html .= html_writer::start_tag('li');
         $sectiontext = $section->section;
         if ($section->highlight) {
             $sectiontext = html_writer::tag('strong', $sectiontext);
         }
         $html .= html_writer::link(course_get_url($course, $section->section), $sectiontext, $attributes);
         $html .= html_writer::end_tag('li') . ' ';
     }
     $html .= html_writer::end_tag('ol');
     if ($jumptosection && isset($sections[$jumptosection])) {
         if ($course->format == 'weeks') {
             $linktext = new lang_string('jumptocurrentweek', 'block_section_links');
         } else {
             if ($course->format == 'topics') {
                 $linktext = new lang_string('jumptocurrenttopic', 'block_section_links');
             }
         }
         $attributes = array();
         if (!$sections[$jumptosection]->visible) {
             $attributes['class'] = 'dimmed';
         }
         $html .= html_writer::link(course_get_url($course, $jumptosection), $linktext, $attributes);
     }
     return $html;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:41,代码来源:renderer.php

示例2: __construct

 /**
  * course_action_section_highlight constructor.
  * @param stdClass $course
  * @param stdClass $section - Note this is the section we want to affect via the url param.
  * @param bool $onsectionpage
  */
 public function __construct($course, $section, $onsectionpage = false)
 {
     if ($onsectionpage) {
         $baseurl = course_get_url($course, $section->section);
     } else {
         $baseurl = course_get_url($course);
     }
     $baseurl->param('sesskey', sesskey());
     $coursecontext = context_course::instance($course->id);
     $isstealth = isset($course->numsections) && $section->section > $course->numsections;
     if ($course->format === 'topics') {
         if (!$isstealth && has_capability('moodle/course:setcurrentsection', $coursecontext)) {
             $url = clone $baseurl;
             $marker = optional_param('marker', '', PARAM_INT);
             $marker = $marker === '' ? $course->marker : $marker;
             // Note if the new target section is 0 then it means the requested action is to have no current section
             // highlighted.
             if ($marker == $section->section || $section->section === 0) {
                 // Show the lightbulb.
                 $this->title = get_string('markedthistopic');
                 $url->param('marker', 0);
                 $this->url = $url;
                 $this->class .= ' snap-marked';
             } else {
                 $this->title = get_string('markthistopic');
                 $url->param('marker', $section->section);
                 $this->url = $url;
                 $this->class .= ' snap-marker';
             }
         }
     }
 }
开发者ID:pramithkm,项目名称:moodle-theme_snap,代码行数:38,代码来源:course_action_section_highlight.php

示例3: __construct

 public function __construct($course, $section, $onsectionpage = false)
 {
     if ($onsectionpage) {
         $baseurl = course_get_url($course, $section->section);
     } else {
         $baseurl = course_get_url($course);
     }
     $baseurl->param('sesskey', sesskey());
     $coursecontext = context_course::instance($course->id);
     $isstealth = isset($course->numsections) && $section->section > $course->numsections;
     $url = clone $baseurl;
     if (!$isstealth && has_capability('moodle/course:sectionvisibility', $coursecontext)) {
         if ($section->visible) {
             // Show the hide/show eye.
             $this->title = get_string('hidefromothers', 'format_' . $course->format);
             $url->param('hide', $section->section);
             $this->url = $url;
             $this->class .= ' snap-hide';
         } else {
             $this->title = get_string('showfromothers', 'format_' . $course->format);
             $url->param('show', $section->section);
             $this->url = $url;
             $this->class .= ' snap-show';
         }
     }
 }
开发者ID:pramithkm,项目名称:moodle-theme_snap,代码行数:26,代码来源:course_action_section_visibility.php

示例4: section_edit_controls

 /**
  * Generate the edit controls of a section
  *
  * @param stdClass $course The course entry from DB
  * @param stdClass $section The course_section entry from DB
  * @param bool $onsectionpage true if being printed on a section page
  * @return array of links with edit controls
  */
 protected function section_edit_controls($course, $section, $onsectionpage = false)
 {
     global $PAGE;
     if (!$PAGE->user_is_editing()) {
         return array();
     }
     $coursecontext = context_course::instance($course->id);
     if ($onsectionpage) {
         $url = course_get_url($course, $section->section);
     } else {
         $url = course_get_url($course);
     }
     $url->param('sesskey', sesskey());
     $controls = array();
     if (has_capability('moodle/course:setcurrentsection', $coursecontext)) {
         if ($course->marker == $section->section) {
             // Show the "light globe" on/off.
             $url->param('marker', 0);
             $controls[] = html_writer::link($url, html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marked'), 'class' => 'icon ', 'alt' => get_string('markedthistopic'))), array('title' => get_string('markedthistopic'), 'class' => 'editing_highlight'));
         } else {
             $url->param('marker', $section->section);
             $controls[] = html_writer::link($url, html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marker'), 'class' => 'icon', 'alt' => get_string('markthistopic'))), array('title' => get_string('markthistopic'), 'class' => 'editing_highlight'));
         }
     }
     return array_merge($controls, parent::section_edit_controls($course, $section, $onsectionpage));
 }
开发者ID:edwinp-catalyst-eu,项目名称:course-format-2.7-development,代码行数:34,代码来源:renderer.php

示例5: get_nav_links

 public function get_nav_links($course, $sections, $sectionno)
 {
     // FIXME: This is really evil and should by using the navigation API.
     $course = \course_get_format($course)->get_course();
     $left = 'left';
     $right = 'right';
     if (\right_to_left()) {
         $temp = $left;
         $left = $right;
         $right = $temp;
     }
     $previousarrow = '<i class="fa fa-chevron-circle-' . $left . '"></i>';
     $nextarrow = '<i class="fa fa-chevron-circle-' . $right . '"></i>';
     $canviewhidden = \has_capability('moodle/course:viewhiddensections', \context_course::instance($course->id)) or !$course->hiddensections;
     $links = array('previous' => '', 'next' => '');
     $back = $sectionno - 1;
     while ($back > 0 and empty($links['previous'])) {
         if ($canviewhidden || $sections[$back]->uservisible) {
             $params = array('id' => 'previous_section');
             if (!$sections[$back]->visible) {
                 $params['class'] = 'dimmed_text';
             }
             $previouslink = \html_writer::start_tag('div', array('class' => 'nav_icon'));
             $previouslink .= $previousarrow;
             $previouslink .= \html_writer::end_tag('div');
             $previouslink .= \html_writer::start_tag('span', array('class' => 'text'));
             $previouslink .= \html_writer::start_tag('span', array('class' => 'nav_guide'));
             $previouslink .= \get_string('previoussection', 'theme_essential');
             $previouslink .= \html_writer::end_tag('span');
             $previouslink .= \html_writer::empty_tag('br');
             $previouslink .= \get_section_name($course, $sections[$back]);
             $previouslink .= \html_writer::end_tag('span');
             $links['previous'] = \html_writer::link(course_get_url($course, $back), $previouslink, $params);
         }
         $back--;
     }
     $forward = $sectionno + 1;
     while ($forward <= $course->numsections and empty($links['next'])) {
         if ($canviewhidden || $sections[$forward]->uservisible) {
             $params = array('id' => 'next_section');
             if (!$sections[$forward]->visible) {
                 $params['class'] = 'dimmed_text';
             }
             $nextlink = \html_writer::start_tag('div', array('class' => 'nav_icon'));
             $nextlink .= $nextarrow;
             $nextlink .= \html_writer::end_tag('div');
             $nextlink .= \html_writer::start_tag('span', array('class' => 'text'));
             $nextlink .= \html_writer::start_tag('span', array('class' => 'nav_guide'));
             $nextlink .= \get_string('nextsection', 'theme_essential');
             $nextlink .= \html_writer::end_tag('span');
             $nextlink .= \html_writer::empty_tag('br');
             $nextlink .= \get_section_name($course, $sections[$forward]);
             $nextlink .= \html_writer::end_tag('span');
             $links['next'] = \html_writer::link(course_get_url($course, $forward), $nextlink, $params);
         }
         $forward++;
     }
     return $links;
 }
开发者ID:ging,项目名称:moodle-theme_essential,代码行数:59,代码来源:format_renderer_toolbox.php

示例6: addsection_action

 /**
  * Add a new section with the provided title and (optional) summary
  *
  * @return string
  */
 public function addsection_action()
 {
     global $CFG, $PAGE, $DB;
     require_once $CFG->dirroot . '/course/lib.php';
     $sectioname = required_param('newsection', PARAM_TEXT);
     $summary = optional_param('summary', '', PARAM_RAW);
     require_sesskey();
     $courseid = $PAGE->context->get_course_context()->instanceid;
     $course = course_get_format($courseid)->get_course();
     $course->numsections++;
     course_get_format($course)->update_course_format_options(array('numsections' => $course->numsections));
     course_create_sections_if_missing($course, range(0, $course->numsections));
     $modinfo = get_fast_modinfo($course);
     $section = $modinfo->get_section_info($course->numsections, MUST_EXIST);
     $DB->set_field('course_sections', 'name', $sectioname, array('id' => $section->id));
     $DB->set_field('course_sections', 'summary', $summary, array('id' => $section->id));
     $DB->set_field('course_sections', 'summaryformat', FORMAT_HTML, array('id' => $section->id));
     rebuild_course_cache($course->id);
     redirect(course_get_url($course, $section->section));
 }
开发者ID:nadavkav,项目名称:moodle-theme_snap,代码行数:25,代码来源:addsection_controller.php

示例7: display_stopwatch

    public function display_stopwatch(cm_info $cm, $stopwatch)
    {
        // TODO strings!!!!
        $timecompleted = '';
        if (($userrecord = mod_stopwatch_get_user_record($cm)) && $userrecord->duration) {
            $class = 'class="stopped"';
            $timevalue = mod_stopwatch_duration_to_string($userrecord->duration);
            $started = $userrecord->timecreated - $userrecord->duration;
            $completed = $userrecord->timecreated;
            // timecreated is when the record was created and it was created when user completed the module.
            $timestarted = $this->print_times($started, $completed);
            $stoplabel = 'Adjust';
        } else {
            $this->page->requires->js_init_call('M.mod_stopwatch.init', array($cm->id), true);
            $class = '';
            $timevalue = '';
            $timestarted = $this->print_times(time());
            $stoplabel = 'I\'m finished!';
        }
        $sesskey = sesskey();
        $action = new moodle_url('/mod/stopwatch/view.php');
        $str = <<<EOD
<form id="stopwatchform" method="POST" action="{$action}" {$class}>
    <input type="hidden" name="sesskey" value="{$sesskey}" />
    <input type="hidden" name="id" value="{$cm->id}" />
    <input type="hidden" name="cmd" value="updateduration" />
    <div class="clockface">
        <input id="clock" name="durationstr" value="{$timevalue}" class="clockdisplay" />
        <input id="reset" type="button" value="Reset" class="graybutton" />
        <div class="timestartedcompleted">{$timestarted}</div>
    </div>
    <br/>
    <input id="start" type="button" value="Start" class="greenbutton" />
    <input id="resume" type="button" value="Resume" class="bigstopwatchbutton greenbutton" />
    <input id="pause" type="button" value="Pause" class="bigstopwatchbutton yellowbutton" />
    <input id="stop" type="submit" value="{$stoplabel}" class="bigstopwatchbutton redbutton" />
EOD;
        $str .= '</form><br/>';
        $str .= $this->output->single_button(course_get_url($cm->course), get_string('back'), 'GET');
        return $str;
    }
开发者ID:marinaglancy,项目名称:moodle-mod_stopwatch,代码行数:41,代码来源:renderer.php

示例8: require_login

                        require_login($course, false, $cm);
                        $coursecontext = context_course::instance($course->id);
                        $modcontext = context_module::instance($cm->id);
                        require_capability('moodle/course:manageactivities', $modcontext);
                        $section = $DB->get_record('course_sections', array('id' => $cm->section), '*', MUST_EXIST);
                        $USER->activitycopy = $copy;
                        $USER->activitycopycourse = $cm->course;
                        $USER->activitycopyname = $cm->name;
                        $USER->activitycopysectionreturn = $sectionreturn;
                        redirect(course_get_url($course, $section->section, array('sr' => $sectionreturn)));
                    } else {
                        if (!empty($cancelcopy) and confirm_sesskey()) {
                            // value = course module
                            $courseid = $USER->activitycopycourse;
                            $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
                            $cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true, IGNORE_MISSING);
                            $sectionreturn = $USER->activitycopysectionreturn;
                            unset($USER->activitycopy);
                            unset($USER->activitycopycourse);
                            unset($USER->activitycopyname);
                            unset($USER->activitycopysectionreturn);
                            redirect(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)));
                        } else {
                            print_error('unknowaction');
                        }
                    }
                }
            }
        }
    }
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:31,代码来源:mod.php

示例9: stdClass

    exit;
}
$scoidstr = '&amp;scoid=' . $sco->id;
$modestr = '&amp;mode=' . $mode;
$SESSION->scorm = new stdClass();
$SESSION->scorm->scoid = $sco->id;
$SESSION->scorm->scormstatus = 'Not Initialized';
$SESSION->scorm->scormmode = $mode;
$SESSION->scorm->attempt = $attempt;
// Mark module viewed.
$completion = new completion_info($course);
$completion->set_module_viewed($cm);
// Print the page header.
if (empty($scorm->popup) || $displaymode == 'popup') {
    // Redirect back to the correct section if one section per page is being used.
    $exiturl = course_get_url($course, $cm->sectionnum);
    $exitlink = html_writer::link($exiturl, $strexit, array('title' => $strexit));
    $PAGE->set_button($exitlink);
}
$PAGE->requires->data_for_js('scormplayerdata', array('launch' => false, 'currentorg' => '', 'sco' => 0, 'scorm' => 0, 'courseid' => $scorm->course, 'cwidth' => $scorm->width, 'cheight' => $scorm->height, 'popupoptions' => $scorm->options), true);
$PAGE->requires->js('/mod/scorm/request.js', true);
$PAGE->requires->js('/lib/cookies.js', true);
if (file_exists($CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . '.js')) {
    $PAGE->requires->js('/mod/scorm/datamodels/' . $scorm->version . '.js', true);
} else {
    $PAGE->requires->js('/mod/scorm/datamodels/scorm_12.js', true);
}
echo $OUTPUT->header();
if (!empty($scorm->displayactivityname)) {
    echo $OUTPUT->heading(format_string($scorm->name));
}
开发者ID:Keneth1212,项目名称:moodle,代码行数:31,代码来源:player.php

示例10: inplace_editable_render_section_name

 /**
  * Prepares the templateable object to display section name
  *
  * @param \section_info|\stdClass $section
  * @param bool $linkifneeded
  * @param bool $editable
  * @param null|lang_string|string $edithint
  * @param null|lang_string|string $editlabel
  * @return \core\output\inplace_editable
  */
 public function inplace_editable_render_section_name($section, $linkifneeded = true, $editable = null, $edithint = null, $editlabel = null)
 {
     global $USER, $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     if ($editable === null) {
         $editable = !empty($USER->editing) && has_capability('moodle/course:update', context_course::instance($section->course));
     }
     $displayvalue = $title = get_section_name($section->course, $section);
     if ($linkifneeded) {
         // Display link under the section name if the course format setting is to display one section per page.
         $url = course_get_url($section->course, $section->section, array('navigation' => true));
         if ($url) {
             $displayvalue = html_writer::link($url, $title);
         }
         $itemtype = 'sectionname';
     } else {
         // If $linkifneeded==false, we never display the link (this is used when rendering the section header).
         // Itemtype 'sectionnamenl' (nl=no link) will tell the callback that link should not be rendered -
         // there is no other way callback can know where we display the section name.
         $itemtype = 'sectionnamenl';
     }
     if (empty($edithint)) {
         $edithint = new lang_string('editsectionname');
     }
     if (empty($editlabel)) {
         $editlabel = new lang_string('newsectionname', '', $title);
     }
     return new \core\output\inplace_editable('format_' . $this->format, $itemtype, $section->id, $editable, $displayvalue, $section->name, $edithint, $editlabel);
 }
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:39,代码来源:lib.php

示例11: foreach

// restored copy of the module
$newcmid = null;
$tasks = $rc->get_plan()->get_tasks();
foreach ($tasks as $task) {
    if (is_subclass_of($task, 'restore_activity_task')) {
        if ($task->get_old_contextid() == $cmcontext->id) {
            $newcmid = $task->get_moduleid();
            break;
        }
    }
}
// if we know the cmid of the new course module, let us move it
// right below the original one. otherwise it will stay at the
// end of the section
if ($newcmid) {
    $newcm = get_coursemodule_from_id('', $newcmid, $course->id, true, MUST_EXIST);
    moveto_module($newcm, $section, $cm);
    moveto_module($cm, $section, $newcm);
}
$rc->destroy();
if (empty($CFG->keeptempdirectoriesonbackup)) {
    fulldelete($backupbasepath);
}
echo $output->header();
if ($newcmid) {
    echo $output->confirm(get_string('duplicatesuccess', 'core', $a), new single_button(new moodle_url('/course/modedit.php', array('update' => $newcmid, 'sr' => $sectionreturn)), get_string('duplicatecontedit'), 'get'), new single_button(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)), get_string('duplicatecontcourse'), 'get'));
} else {
    echo $output->notification(get_string('duplicatesuccess', 'core', $a), 'notifysuccess');
    echo $output->continue_button(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)));
}
echo $output->footer();
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:modduplicate.php

示例12: require_login

require_login($course, false, $cm);
require_capability('mod/folder:managefiles', $context);

$PAGE->set_url('/mod/folder/edit.php', array('id' => $cm->id));
$PAGE->set_title($course->shortname.': '.$folder->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_activity_record($folder);

$data = new stdClass();
$data->id = $cm->id;
$options = array('subdirs'=>1, 'maxbytes'=>$CFG->maxbytes, 'maxfiles'=>-1, 'accepted_types'=>'*');
file_prepare_standard_filemanager($data, 'files', $options, $context, 'mod_folder', 'content', 0);

$mform = new mod_folder_edit_form(null, array('data'=>$data, 'options'=>$options));
if ($folder->display == FOLDER_DISPLAY_INLINE) {
    $redirecturl = course_get_url($cm->course, $cm->sectionnum);
} else {
    $redirecturl = new moodle_url('/mod/folder/view.php', array('id' => $cm->id));
}

if ($mform->is_cancelled()) {
    redirect($redirecturl);

} else if ($formdata = $mform->get_data()) {
    $formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'mod_folder', 'content', 0);
    $DB->set_field('folder', 'revision', $folder->revision+1, array('id'=>$folder->id));

    // Update the variable of the folder revision so we can pass it as an accurate snapshot later.
    $folder->revision = $folder->revision + 1;

    $params = array(
开发者ID:rwijaya,项目名称:moodle,代码行数:31,代码来源:edit.php

示例13: section_nav_selection

 /**
  * Generate the html for the 'Jump to' menu on a single section page.
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections The course_sections entries from the DB
  * @param $displaysection the current displayed section number.
  *
  * @return string HTML to output.
  */
 protected function section_nav_selection($course, $sections, $displaysection)
 {
     global $CFG;
     $o = '';
     $sectionmenu = array();
     $sectionmenu[course_get_url($course)->out(false)] = get_string('maincoursepage');
     $modinfo = get_fast_modinfo($course);
     $section = 1;
     while ($section <= $course->numsections) {
         $thissection = $modinfo->get_section_info($section);
         $showsection = $thissection->uservisible or !$course->hiddensections;
         if ($showsection && $section != $displaysection && ($url = course_get_url($course, $section))) {
             $sectionmenu[$url->out(false)] = get_section_name($course, $section);
         }
         $section++;
     }
     $select = new url_select($sectionmenu, '', array('' => get_string('jumpto')));
     $select->class = 'jumpmenu';
     $select->formid = 'sectionmenu';
     $o .= $this->output->render($select);
     return $o;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:renderer.php

示例14: print_single_section_page

 /**
  * Output the html for a single section page .
  *
  * @param stdClass $course The course entry from DB
  * @param array $sections (argument not used)
  * @param array $mods (argument not used)
  * @param array $modnames (argument not used)
  * @param array $modnamesused (argument not used)
  * @param int $displaysection The section number in the course which is being displayed
  */
 public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
 {
     global $PAGE;
     $modinfo = get_fast_modinfo($course);
     $course = course_get_format($course)->get_course();
     // Can we view the section in question?
     if (!($sectioninfo = $modinfo->get_section_info($displaysection))) {
         // This section doesn't exist
         print_error('unknowncoursesection', 'error', null, $course->fullname);
         return;
     }
     if (!$sectioninfo->uservisible) {
         if (!$course->hiddensections) {
             echo $this->start_section_list();
             echo $this->section_hidden($displaysection);
             echo $this->end_section_list();
         }
         // Can't view this section.
         return;
     }
     // Copy activity clipboard..
     echo $this->course_activity_clipboard($course, $displaysection);
     $thissection = $modinfo->get_section_info(0);
     if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
         echo $this->start_section_list();
         echo $this->section_header($thissection, $course, true, $displaysection);
         print_section($course, $thissection, null, null, true, "100%", false, $displaysection);
         if ($PAGE->user_is_editing()) {
             print_section_add_menus($course, 0, null, false, false, $displaysection);
         }
         echo $this->section_footer();
         echo $this->end_section_list();
     }
     // Start single-section div
     echo html_writer::start_tag('div', array('class' => 'single-section'));
     // The requested section page.
     $thissection = $modinfo->get_section_info($displaysection);
     // Title with section navigation links.
     $sectionnavlinks = $this->get_nav_links($course, $modinfo->get_section_info_all(), $displaysection);
     $sectiontitle = '';
     $sectiontitle .= html_writer::start_tag('div', array('class' => 'section-navigation header headingblock'));
     $sectiontitle .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
     $sectiontitle .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
     // Title attributes
     $titleattr = 'mdl-align title';
     if (!$thissection->visible) {
         $titleattr .= ' dimmed_text';
     }
     $sectiontitle .= html_writer::tag('div', get_section_name($course, $displaysection), array('class' => $titleattr));
     $sectiontitle .= html_writer::end_tag('div');
     echo $sectiontitle;
     // Now the list of sections..
     echo $this->start_section_list();
     echo $this->section_header($thissection, $course, true, $displaysection);
     // Show completion help icon.
     $completioninfo = new completion_info($course);
     echo $completioninfo->display_help_icon();
     print_section($course, $thissection, null, null, true, '100%', false, $displaysection);
     if ($PAGE->user_is_editing()) {
         print_section_add_menus($course, $displaysection, null, false, false, $displaysection);
     }
     echo $this->section_footer();
     echo $this->end_section_list();
     // Display section bottom navigation.
     $courselink = html_writer::link(course_get_url($course), get_string('returntomaincoursepage'));
     $sectionbottomnav = '';
     $sectionbottomnav .= html_writer::start_tag('div', array('class' => 'section-navigation mdl-bottom'));
     $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
     $sectionbottomnav .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
     $sectionbottomnav .= html_writer::tag('div', $courselink, array('class' => 'mdl-align'));
     $sectionbottomnav .= html_writer::end_tag('div');
     echo $sectionbottomnav;
     // close single-section div.
     echo html_writer::end_tag('div');
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:85,代码来源:renderer.php

示例15: report_comments_getusercomments

function report_comments_getusercomments($userid, $sort = 'date')
{
    global $CFG, $DB;
    $user = $DB->get_record('user', array('id' => $userid), 'firstname, lastname');
    $url = new moodle_url('/user/view.php', array('id' => $userid));
    $fullname = html_writer::link($url, $user->firstname . ' ' . $user->lastname);
    $formatoptions = array('overflowdiv' => true);
    $strftimeformat = get_string('strftimerecentfull', 'langconfig');
    $comments = $DB->get_records('comments', array('userid' => $userid), 'timecreated DESC');
    foreach ($comments as $comment) {
        $comment->fullname = $fullname;
        $comment->time = userdate($comment->timecreated, $strftimeformat);
        $context = context::instance_by_id($comment->contextid, IGNORE_MISSING);
        if (!$context) {
            continue;
        }
        $contexturl = '';
        switch ($context->contextlevel) {
            case CONTEXT_BLOCK:
                debugging('Block: ' . $context->instanceid);
                break;
            case CONTEXT_MODULE:
                $cm = get_coursemodule_from_id('', $context->instanceid);
                $course = get_course($cm->course);
                $contexturl = course_get_url($course);
                $comment->fullname = html_writer::link($contexturl, $course->fullname);
                $base = core_component::get_component_directory('mod_' . $cm->modname);
                if (file_exists("{$base}/view.php")) {
                    $base = substr($base, strlen($CFG->dirroot));
                    $contexturl = new moodle_url("{$base}/view.php", array('id' => $cm->id));
                }
                break;
            case CONTEXT_COURSE:
                $course = get_course($context->instanceid);
                $contexturl = course_get_url($course);
                $comment->fullname = html_writer::link($contexturl, $course->fullname);
                break;
            default:
                debugging('Default context: ' . $context->instanceid);
        }
        $comment->content = html_writer::link($contexturl, format_text($comment->content, $comment->format, $formatoptions));
    }
    return $comments;
}
开发者ID:ewallah,项目名称:moodle-report_comments,代码行数:44,代码来源:lib.php


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