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


PHP format_module_intro函数代码示例

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


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

示例1: display_folder

    /**
     * Returns html to display the content of mod_folder
     * (Description, folder files and optionally Edit button)
     *
     * @param stdClass $folder record from 'folder' table (please note
     *     it may not contain fields 'revision' and 'timemodified')
     * @return string
     */
    public function display_folder(stdClass $folder) {
        $output = '';
        $folderinstances = get_fast_modinfo($folder->course)->get_instances_of('folder');
        if (!isset($folderinstances[$folder->id]) ||
                !($cm = $folderinstances[$folder->id]) ||
                !$cm->uservisible ||
                !($context = context_module::instance($cm->id)) ||
                !has_capability('mod/folder:view', $context)) {
            // some error in parameters or module is not visible to the user
            // don't throw any errors in renderer, just return empty string
            return $output;
        }

        if (trim($folder->intro)) {
            if ($folder->display != FOLDER_DISPLAY_INLINE) {
                $output .= $this->output->box(format_module_intro('folder', $folder, $cm->id),
                        'generalbox', 'intro');
            } else if ($cm->showdescription) {
                // for "display inline" do not filter, filters run at display time.
                $output .= format_module_intro('folder', $folder, $cm->id, false);
            }
        }

        $output .= $this->output->box($this->render(new folder_tree($folder, $cm)),
                'generalbox foldertree');

        // Do not append the edit button on the course page.
        if ($folder->display != FOLDER_DISPLAY_INLINE && has_capability('mod/folder:managefiles', $context)) {
            $output .= $this->output->container(
                    $this->output->single_button(new moodle_url('/mod/folder/edit.php',
                    array('id' => $cm->id)), get_string('edit')),
                    'mdl-align folder-edit-button');
        }
        return $output;
    }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:43,代码来源:renderer.php

示例2: get_media_html

 /**
  * Get media html for resource.
  *
  * @param $resource
  * @param $context
  * @param \cm_info $cm
  * @return string
  */
 private function get_media_html($resource, $context, \cm_info $cm)
 {
     global $OUTPUT, $PAGE;
     $fs = get_file_storage();
     $files = $fs->get_area_files($context->id, 'mod_resource', 'content', 0, 'sortorder DESC, id ASC', false);
     if (count($files) < 1) {
         $content = $OUTPUT->notification(get_string('filenotfound', 'resource'));
     } else {
         $file = reset($files);
         unset($files);
         $mediarenderer = $PAGE->get_renderer('core', 'media');
         $embedoptions = array(\core_media::OPTION_TRUSTED => true, \core_media::OPTION_BLOCK => true);
         $path = '/' . $context->id . '/mod_resource/content/' . $resource->revision . $file->get_filepath() . $file->get_filename();
         $moodleurl = new \moodle_url('/pluginfile.php' . $path);
         $embedhtml = $mediarenderer->embed_url($moodleurl, $resource->name, 0, 0, $embedoptions);
         // Modal title.
         $content = "<h5 class='snap-lightbox-title'>" . format_string($resource->name) . "</h5>";
         // Grid me up.
         if (!empty($resource->intro)) {
             $lightboxgrid = "<div class='col-sm-8'>{$embedhtml}</div>";
             $lightboxgrid .= "<div class='col-sm-4 snap-lightbox-description'>" . format_module_intro('resource', $resource, $cm->id) . "</div>";
         } else {
             $lightboxgrid = "<div class='col-sm-12'>{$embedhtml}</div>";
         }
         $content .= "<div class='row'>{$lightboxgrid}</div>";
     }
     return $content;
 }
开发者ID:pramithkm,项目名称:moodle-theme_snap,代码行数:36,代码来源:mediaresource_controller.php

示例3: outputIntro

function outputIntro($url, $course, $cm, $resop)
{
    global $PAGE, $OUTPUT;
    // Print the page header.
    $PAGE->set_url($url);
    /*assign module does set_url here and the rest in own class ?
     * we try it first without own class and traditional output
     * */
    $PAGE->set_title(format_string($resop->name));
    $PAGE->set_heading(format_string($course->fullname));
    /*
     * Other things you may want to set - remove if not needed.
     * $PAGE->set_cacheable(false);
     * $PAGE->set_focuscontrol('some-html-id');
     * $PAGE->add_body_class('resop-'.$somevar);
     */
    // Output starts here.
    echo $OUTPUT->header();
    // Conditions to show the intro can change to look for own settings or whatever.
    if ($resop->intro) {
        echo $OUTPUT->box(format_module_intro('resop', $resop, $cm->id), 'generalbox mod_introbox', 'resopintro');
    }
    // Replace the following lines with you own code.
    //wahrscheinlich sollte ich hier einen renderer einsetzen, aber die Thematik ist mir im moment
    //zu komplex
    //echo $OUTPUT->heading(get_string('modulename','resop'));
    echo $OUTPUT->box_start();
    //show some links if no action is set
    //var_dump($urlparams);
}
开发者ID:Roemke,项目名称:resop,代码行数:30,代码来源:delete.php

示例4: render_ratingallocate_header

 /**
  * Render the header.
  *
  * @param ratingallocate_header $header
  * @return string
  */
 public function render_ratingallocate_header(ratingallocate_header $header)
 {
     $o = '';
     $this->page->set_heading($this->page->course->fullname);
     $this->page->requires->css('/mod/ratingallocate/styles.css');
     $o .= $this->output->header();
     $heading = format_string($header->ratingallocate->name, false, array('context' => $header->context));
     $o .= $this->output->heading($heading);
     if ($header->showintro) {
         $intro_text = format_module_intro('ratingallocate', $header->ratingallocate, $header->coursemoduleid);
         if ($intro_text) {
             $o .= $this->output->box_start('generalbox boxaligncenter', 'intro');
             $o .= $intro_text;
             $o .= $this->output->box_end();
         }
     }
     //$o .= $this->notifications;
     if (!empty($this->notifications)) {
         $o .= $this->output->box_start('box generalbox boxaligncenter');
         foreach ($this->notifications as $elem) {
             $o .= html_writer::div(format_text($elem));
         }
         $o .= $this->output->box_end();
     }
     return $o;
 }
开发者ID:Kathrin84,项目名称:moodle-mod_ratingallocate,代码行数:32,代码来源:renderer.php

示例5: display_folder

 /**
  * Returns html to display the content of mod_folder
  * (Description, folder files and optionally Edit button)
  *
  * @param stdClass $folder record from 'folder' table (please note
  *     it may not contain fields 'revision' and 'timemodified')
  * @return string
  */
 public function display_folder(stdClass $folder)
 {
     $output = '';
     $folderinstances = get_fast_modinfo($folder->course)->get_instances_of('folder');
     if (!isset($folderinstances[$folder->id]) || !($cm = $folderinstances[$folder->id]) || !($context = context_module::instance($cm->id))) {
         // Some error in parameters.
         // Don't throw any errors in renderer, just return empty string.
         // Capability to view module must be checked before calling renderer.
         return $output;
     }
     if (trim($folder->intro)) {
         if ($folder->display != FOLDER_DISPLAY_INLINE) {
             $output .= $this->output->box(format_module_intro('folder', $folder, $cm->id), 'generalbox', 'intro');
         } else {
             if ($cm->showdescription) {
                 // for "display inline" do not filter, filters run at display time.
                 $output .= format_module_intro('folder', $folder, $cm->id, false);
             }
         }
     }
     $foldertree = new folder_tree($folder, $cm);
     if ($folder->display == FOLDER_DISPLAY_INLINE) {
         // Display module name as the name of the root directory.
         $foldertree->dir['dirname'] = $cm->get_formatted_name();
     }
     $output .= $this->output->box($this->render($foldertree), 'generalbox foldertree');
     // Do not append the edit button on the course page.
     if ($folder->display != FOLDER_DISPLAY_INLINE && has_capability('mod/folder:managefiles', $context)) {
         $output .= $this->output->container($this->output->single_button(new moodle_url('/mod/folder/edit.php', array('id' => $cm->id)), get_string('edit')), 'mdl-align folder-edit-button');
     }
     return $output;
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:40,代码来源:renderer.php

示例6: video_header

 /**
  * Renders the videofile page header.
  *
  * @param videofile videofile
  * @return string
  */
 public function video_header($videofile)
 {
     global $CFG;
     $output = '';
     $name = format_string($videofile->get_instance()->name, true, $videofile->get_course());
     $title = $this->page->course->shortname . ': ' . $name;
     $coursemoduleid = $videofile->get_course_module()->id;
     $context = context_module::instance($coursemoduleid);
     // Add videojs css and js files.
     $this->page->requires->css('/mod/videofile/video-js-4.6.3/video-js.min.css');
     $this->page->requires->js('/mod/videofile/video-js-4.6.3/video.js', true);
     // Set the videojs flash fallback url.
     $swfurl = new moodle_url('/mod/videofile/video-js-4.6.3/video-js.swf');
     $this->page->requires->js_init_code('videojs.options.flash.swf = "' . $swfurl . '";');
     // Yui module handles responsive mode video resizing.
     if ($videofile->get_instance()->responsive) {
         $config = get_config('videofile');
         $this->page->requires->yui_module('moodle-mod_videofile-videojs', 'M.mod_videofile.videojs.init', array($videofile->get_instance()->id, $swfurl, $videofile->get_instance()->width, $videofile->get_instance()->height, (bool) $config->limitdimensions));
     }
     // Header setup.
     $this->page->set_title($title);
     $this->page->set_heading($this->page->course->fullname);
     $output .= $this->output->header();
     $output .= $this->output->heading($name, 3);
     if (!empty($videofile->get_instance()->intro)) {
         $output .= $this->output->box_start('generalbox boxaligncenter', 'intro');
         $output .= format_module_intro('videofile', $videofile->get_instance(), $coursemoduleid);
         $output .= $this->output->box_end();
     }
     return $output;
 }
开发者ID:jneubauer,项目名称:moodle-mod_videofile,代码行数:37,代码来源:renderer.php

示例7: update_event_timedue

 /**
  *
  */
 public static function update_event_timedue($data)
 {
     global $DB;
     if (!empty($data->timedue)) {
         $event = new \stdClass();
         $event->name = $data->name;
         $event->description = format_module_intro('dataform', $data, $data->coursemodule);
         $event->timestart = $data->timedue;
         if ($event->id = $DB->get_field('event', 'id', array('modulename' => 'dataform', 'instance' => $data->id))) {
             $calendarevent = \calendar_event::load($event->id);
             $calendarevent->update($event);
         } else {
             $event->courseid = $data->course;
             $event->groupid = 0;
             $event->userid = 0;
             $event->modulename = 'dataform';
             $event->instance = $data->id;
             $event->eventtype = 'due';
             $event->timeduration = 0;
             $event->visible = $DB->get_field('course_modules', 'visible', array('module' => $data->module, 'instance' => $data->id));
             \calendar_event::create($event);
         }
     } else {
         $DB->delete_records('event', array('modulename' => 'dataform', 'instance' => $data->id, 'eventtype' => 'due'));
     }
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:29,代码来源:calendar_event.php

示例8: introduction

 /**
  * Return introduction
  */
 public function introduction()
 {
     $output = '';
     if (trim($this->hotquestion->instance->intro)) {
         $output .= $this->box_start('generalbox boxaligncenter', 'intro');
         $output .= format_module_intro('hotquestion', $this->hotquestion->instance, $this->hotquestion->cm->id);
         $output .= $this->box_end();
     }
     return $output;
 }
开发者ID:hit-moodle,项目名称:moodle-mod_hotquestion,代码行数:13,代码来源:renderer.php

示例9: easycastms_print_intro

function easycastms_print_intro($easycastms_media, $cm, $course, $ignoresettings = false)
{
    global $OUTPUT;
    if (!$ignoresettings) {
        if (trim(strip_tags($easycastms_media->intro))) {
            echo $OUTPUT->box_start('mod_introbox', 'easycastmsintro');
            echo format_module_intro('easycastms', $easycastms_media, $cm->id);
            echo $OUTPUT->box_end();
        }
    }
}
开发者ID:bdpz,项目名称:moodle-mod_easycastms,代码行数:11,代码来源:locallib.php

示例10: label_get_coursemodule_info

/**
 * Given a course_module object, this function returns any
 * "extra" information that may be needed when printing
 * this activity in a course listing.
 * See get_array_of_activities() in course/lib.php
 */
function label_get_coursemodule_info($coursemodule)
{
    global $DB;
    if ($label = $DB->get_record('label', array('id' => $coursemodule->instance), 'id, name, intro, introformat')) {
        if (empty($label->name)) {
            // label name missing, fix it
            $label->name = "label{$label->id}";
            $DB->set_field('label', 'name', $label->name, array('id' => $label->id));
        }
        $info = new object();
        // no filtering hre because this info is cached and filtered later
        $info->extra = urlencode(format_module_intro('label', $label, $coursemodule->id, false));
        $info->name = urlencode($label->name);
        return $info;
    } else {
        return null;
    }
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:24,代码来源:lib.php

示例11: view

 /**
  * @param $course
  * @param $cm
  * @param $forum
  * @param context_module $context
  * @author Mark Nielsen
  */
 public function view($course, $cm, $forum, context_module $context)
 {
     global $USER, $DB, $OUTPUT;
     require_once __DIR__ . '/lib/discussion/sort.php';
     $config = get_config('hsuforum');
     $mode = optional_param('mode', 0, PARAM_INT);
     // Display mode (for single forum)
     $page = optional_param('page', 0, PARAM_INT);
     // which page to show
     $forumicon = "<img src='" . $OUTPUT->pix_url('icon', 'hsuforum') . "' alt='' class='iconlarge activityicon'/> ";
     echo '<div id="hsuforum-header"><h2>' . $forumicon . format_string($forum->name) . '</h2>';
     if (!empty($forum->intro)) {
         echo '<div class="hsuforum_introduction">' . format_module_intro('hsuforum', $forum, $cm->id) . '</div>';
     }
     echo "</div>";
     // Update activity group mode changes here.
     groups_get_activity_group($cm, true);
     $dsort = hsuforum_lib_discussion_sort::get_from_session($forum, $context);
     $dsort->set_key(optional_param('dsortkey', $dsort->get_key(), PARAM_ALPHA));
     hsuforum_lib_discussion_sort::set_to_session($dsort);
     if (!empty($forum->blockafter) && !empty($forum->blockperiod)) {
         $a = new stdClass();
         $a->blockafter = $forum->blockafter;
         $a->blockperiod = get_string('secondstotime' . $forum->blockperiod);
         echo $OUTPUT->notification(get_string('thisforumisthrottled', 'hsuforum', $a));
     }
     if ($forum->type == 'qanda' && !has_capability('moodle/course:manageactivities', $context)) {
         echo $OUTPUT->notification(get_string('qandanotify', 'hsuforum'));
     }
     switch ($forum->type) {
         case 'eachuser':
             if (hsuforum_user_can_post_discussion($forum, null, -1, $cm)) {
                 echo '<p class="mdl-align">';
                 print_string("allowsdiscussions", "hsuforum");
                 echo '</p>';
             }
             // Fall through to following cases.
         // Fall through to following cases.
         case 'blog':
         default:
             hsuforum_print_latest_discussions($course, $forum, -1, $dsort->get_sort_sql(), -1, -1, $page, $config->manydiscussions, $cm);
             break;
     }
 }
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:51,代码来源:renderer.php

示例12: view_intro

 function view_intro()
 {
     global $CFG, $USER, $OUTPUT, $DB;
     echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro');
     echo format_module_intro('assignment', $this->assignment, $this->cm->id);
     if ($this->import_checklist_plugin()) {
         $extra = $DB->get_record('assignment_uploadpdf', array('assignment' => $this->assignment->id));
         if ($extra->checklist) {
             $checklist = $DB->get_record('checklist', array('id' => $extra->checklist));
             if ($checklist) {
                 $chklink = $CFG->wwwroot . '/mod/checklist/view.php?checklist=' . $checklist->id;
                 echo '<div><a href="' . $chklink . '" target="_blank"><div style="float: left; dispaly: inline; margin-left: 40px; margin-right: 20px;">' . $checklist->name . ': </div>';
                 checklist_class::print_user_progressbar($checklist->id, $USER->id);
                 echo '</a></div>';
             }
         }
     }
     echo $OUTPUT->box_end();
 }
开发者ID:margeauxphillips,项目名称:moodle-uploadpdf,代码行数:19,代码来源:assignment.class.php

示例13: view_intro

 /**
  * Display the interview, used by view.php
  *
  * This in turn calls the methods producing individual parts of the page
  */
 function view_intro($interview, $cm)
 {
     global $OUTPUT;
     echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro');
     echo format_module_intro('interview', $interview, $cm->id);
     // If a place or professor has been established it's shown in another box
     if ($interview->location or $interview->teacher) {
         if (!empty($interview->location)) {
             echo '<b>';
             echo get_string('location', 'interview');
             echo '</b>';
             echo ': ' . $interview->location;
         }
         if (!empty($interview->teacher)) {
             echo '<br/>';
             echo '<b>';
             echo get_string('teacher', 'interview');
             echo '</b>';
             echo ': ' . $interview->teacher;
         }
     }
     echo $OUTPUT->box_end();
 }
开发者ID:eriko,项目名称:interview,代码行数:28,代码来源:renderer.php

示例14: get_string

        echo get_string('feedbackclose', 'feedback').': ';
        echo '</span>';
        echo '<span class="feedback_info_value">';
        echo userdate($feedback->timeclose);
        echo '</span>';
        echo $OUTPUT->box_end();
    }
    echo $OUTPUT->box_end();
}

if (has_capability('mod/feedback:edititems', $context)) {
    echo $OUTPUT->heading(get_string('description', 'feedback'), 4);
}
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
$options = (object)array('noclean'=>true);
echo format_module_intro('feedback', $feedback, $cm->id);
echo $OUTPUT->box_end();

if (has_capability('mod/feedback:edititems', $context)) {
    require_once($CFG->libdir . '/filelib.php');

    $page_after_submit_output = file_rewrite_pluginfile_urls($feedback->page_after_submit,
                                                            'pluginfile.php',
                                                            $context->id,
                                                            'mod_feedback',
                                                            'page_after_submit',
                                                            0);

    echo $OUTPUT->heading(get_string("page_after_submit", "feedback"), 4);
    echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
    echo format_text($page_after_submit_output,
开发者ID:verbazend,项目名称:AWFA,代码行数:31,代码来源:view.php

示例15: forum_print_latest_discussions

        case 'blog':
            if (!empty($forum->intro)) {
                echo $OUTPUT->box(format_module_intro('forum', $forum, $cm->id), 'generalbox', 'intro');
            }
            echo '<br />';
            if (!empty($showall)) {
                forum_print_latest_discussions($course, $forum, 0, 'plain', '', -1, -1, -1, 0, $cm);
            } else {
                forum_print_latest_discussions($course, $forum, -1, 'plain', '', -1, -1, $page, $CFG->forum_manydiscussions, $cm);
            }
            break;

        default:
            if (!empty($forum->intro)) {
                echo $OUTPUT->box(format_module_intro('forum', $forum, $cm->id), 'generalbox', 'intro');
            }
            echo '<br />';
            if (!empty($showall)) {
                forum_print_latest_discussions($course, $forum, 0, 'header', '', -1, -1, -1, 0, $cm);
            } else {
                forum_print_latest_discussions($course, $forum, -1, 'header', '', -1, -1, $page, $CFG->forum_manydiscussions, $cm);
            }


            break;
    }

    echo $OUTPUT->footer($course);

开发者ID:ncsu-delta,项目名称:moodle,代码行数:28,代码来源:view.php


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