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


PHP cm_info::set_content方法代码示例

本文整理汇总了PHP中cm_info::set_content方法的典型用法代码示例。如果您正苦于以下问题:PHP cm_info::set_content方法的具体用法?PHP cm_info::set_content怎么用?PHP cm_info::set_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cm_info的用法示例。


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

示例1: folder_cm_info_view

/**
 * Overwrites the content in the course-module object with the folder files list
 * if folder.display == FOLDER_DISPLAY_INLINE
 *
 * @param cm_info $cm
 */
function folder_cm_info_view(cm_info $cm)
{
    global $PAGE;
    if ($cm->uservisible && $cm->get_custom_data() && has_capability('mod/folder:view', $cm->context)) {
        // Restore folder object from customdata.
        // Note the field 'customdata' is not empty IF AND ONLY IF we display contens inline.
        // Otherwise the content is default.
        $folder = $cm->get_custom_data();
        $folder->id = (int) $cm->instance;
        $folder->course = (int) $cm->course;
        $folder->display = FOLDER_DISPLAY_INLINE;
        $folder->name = $cm->name;
        if (empty($folder->intro)) {
            $folder->intro = '';
        }
        if (empty($folder->introformat)) {
            $folder->introformat = FORMAT_MOODLE;
        }
        // display folder
        $renderer = $PAGE->get_renderer('mod_folder');
        $cm->set_content($renderer->display_folder($folder));
    }
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:29,代码来源:lib.php

示例2: dataform_cm_info_view

/**
 * Overwrites the content in the course-module object with the Dataform view content
 * if dataform.inlineview is not empty
 *
 * @param cm_info $cm
 */
function dataform_cm_info_view(cm_info $cm)
{
    global $PAGE, $CFG, $OUTPUT;
    if (!$cm->uservisible) {
        return;
    }
    // Default content if not displaying inline view.
    if (!($dataform = $cm->customdata) or empty($dataform->inlineview)) {
        return;
    }
    if (!empty($dataform->embedded)) {
        $content = mod_dataform_dataform::get_content_embedded($dataform->id, $dataform->inlineview);
    } else {
        $content = mod_dataform_dataform::get_content_inline($dataform->id, $dataform->inlineview);
    }
    if (!empty($content)) {
        $cm->set_content($content);
    }
}
开发者ID:parksandwildlife,项目名称:learning,代码行数:25,代码来源:lib.php

示例3: facetoface_cm_info_view


//.........这里部分代码省略.........
                if ($session->datetimeknown) {
                    if (empty($session->sessiondates)) {
                        $sessiondate = get_string('unknowndate', 'facetoface');
                        $sessiontime = get_string('unknowntime', 'facetoface');
                    } else {
                        $sessionobj = facetoface_format_session_times($session->sessiondates[0]->timestart, $session->sessiondates[0]->timefinish, $session->sessiondates[0]->sessiontimezone);
                        if ($sessionobj->startdate == $sessionobj->enddate) {
                            $sessiondate = get_string('sessionstartdateandtime', 'facetoface', $sessionobj);
                        } else {
                            $sessiondate .= get_string('sessionstartfinishdateandtime', 'facetoface', $sessionobj);
                        }
                        if (count($session->sessiondates) > 1) {
                            $multidate = html_writer::start_tag('br') . get_string('multidate', 'facetoface');
                        }
                    }
                } else {
                    $sessiondate = get_string('wait-listed', 'facetoface');
                }

                $locationstring = '';
                $roomdata = $DB->get_record('facetoface_room', array('id' => $session->roomid));
                if (!empty($roomdata)) {
                    $locationstring  = isset($roomdata->name)     ? format_string($roomdata->name)    .', '.html_writer::empty_tag('br') : '';
                    $locationstring .= isset($roomdata->building) ? format_string($roomdata->building).', '.html_writer::empty_tag('br') : '';
                    $locationstring .= isset($roomdata->address)  ? format_string($roomdata->address) .', '.html_writer::empty_tag('br') : '';
                }

                $sessionobject = new stdClass();
                $sessionobject->location = $locationstring;
                $sessionobject->date = $sessiondate;
                $sessionobject->multidate = $multidate;

                if ($session->datetimeknown && (facetoface_has_session_started($session, $timenow)) && facetoface_is_session_in_progress($session, $timenow)) {
                    $sessionsinprogress[] = $sessionobject;
                } else {
                    $sessionobject->options = $options;
                    $sessionobject->moreinfolink = $moreinfolink;
                    $futuresessions[] = $sessionobject;
                }

                $j++;
                if ($j > $facetoface->display) {
                    break;
                }
            }

            if (!empty($sessionsinprogress)) {
                $table .= html_writer::start_tag('tr')
                    . html_writer::tag('td', get_string('sessioninprogress', 'facetoface'), array('class' => 'f2fsessionnotice', 'colspan' => '2'))
                    . html_writer::end_tag('tr');

                foreach ($sessionsinprogress as $session) {
                    $table .= html_writer::start_tag('tr')
                        .html_writer::tag('td', html_writer::tag('span', $session->location.$session->date.$session->multidate, array('class' => 'f2fsessiontime')), array('class' => 'f2fwidth'))
                        .html_writer::tag('td', html_writer::start_tag('table'))
                        .html_writer::tag('tr', html_writer::tag('td', ' '))
                        .html_writer::end_tag('table')
                        .html_writer::end_tag('td')
                        .html_writer::end_tag('tr');
                }
            }

            if (!empty($futuresessions)) {
                $table .= html_writer::start_tag('tr')
                    . html_writer::tag('td', get_string('signupforsession', 'facetoface'), array('class' => 'f2fsessionnotice', 'colspan' => '2'))
                    . html_writer::end_tag('tr');

                foreach ($futuresessions as $session) {
                    $table .= html_writer::start_tag('tr')
                        .html_writer::tag('td', html_writer::tag('span', $session->location.$session->date.$session->multidate, array('class' => 'f2fsessiontime')), array('class' => 'f2fwidth'))
                        .html_writer::tag('td', html_writer::start_tag('table'))
                        .$session->options
                        .$session->moreinfolink
                        .html_writer::end_tag('table')
                        .html_writer::end_tag('td')
                        .html_writer::end_tag('tr');
                }
            }

            $table .= html_writer::start_tag('tr')
                .html_writer::tag('td', ($iseditor || ($coursemodule->visible && $coursemodule->available)) ? $htmlviewallsessions : $strviewallsessions, array('colspan' => '2'))
                .html_writer::end_tag('tr')
                .html_writer::end_tag('table');
        } else {
            // Show only name if session display is set to zero.
            $content = html_writer::tag('span', $htmlviewallsessions, array('class' => 'f2fsessionnotice f2factivityname f2fonepointfive'));
            $coursemodule->set_content($content);
            return;
        }
    } else if (has_capability('mod/facetoface:viewemptyactivities', $contextmodule)) {
        $content = html_writer::tag('span', $htmlviewallsessions, array('class' => 'f2fsessionnotice f2factivityname f2fonepointfive'));
        $coursemodule->set_content($content);
        return;
    } else {
        // Nothing to display to this user.
        $coursemodule->set_content('');
        return;
    }
    $coursemodule->set_content($table);
}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:101,代码来源:lib.php

示例4: activitytask_cm_info_view

/**
 * Called when viewing course page. Adds information to the course-module object.
 *
 * @see: /lib/modinfolib.php  class cm_info
 *
 * Allowed methods:
 * - {@link cm_info::set_after_edit_icons()}
 * - {@link cm_info::set_after_link()}
 * - {@link cm_info::set_content()}
 * - {@link cm_info::set_extra_classes()
 * 
 * @param cm_info $cm Course-module object
 */
function activitytask_cm_info_view(cm_info $cm)
{
    global $USER, $PAGE, $DB;
    //we will create a done button for marking whether or not an item is complete
    $done = '';
    $view = '';
    //create a view button
    if ($cm->customdata) {
        $view = '<a class="activitytask-button-view btn btn-primary"' . ' href="' . new moodle_url('/mod/activitytask/view.php?id=' . $cm->id) . '"' . '>' . get_string('btn_label_view', 'activitytask') . '</a>';
    }
    //let's see if the user has a capability to add an activity instance
    //this indicates that they are a teacher or the like and not a student
    //we don't need to show a done button if the user can edit the instance
    if (!has_capability('mod/activitytask:addinstance', context_course::instance($cm->course))) {
        //pull this users status for this activity
        $params = array('userid' => $USER->id, 'activitytask' => $cm->instance);
        $fields = 'datedone';
        $status = $DB->get_record('activitytask_status', $params, $fields);
        //if not done, then show a button
        if (!$status || !$status->datedone) {
            //add the javascript to make it possible to update using ajax
            $PAGE->requires->js('/mod/activitytask/activitytask.js');
            $done = '<a class="activitytask-button btn btn-primary"' . ' href="' . new moodle_url('/mod/activitytask/markdone.php?id=' . $cm->instance) . '"' . ' >' . get_string('btn_label_done', 'activitytask') . '</a>';
        } else {
            $dt = new DateTime($status->datedone);
            $done = '<span class="activitytask-done">(' . $dt->format('M j') . ')</span>';
        }
    }
    if (!$PAGE->user_is_editing()) {
        //if no view link is set, then the url will be blank
        if (!$cm->url) {
            //we have to add our own icon
            $cm->set_content('<img role="presentation" class="iconlarge activityicon" src="' . $cm->get_icon_url() . '">' . '<span class="instancename">' . $cm->name . '<span class="accesshide "> Activity Task</span>' . '</span>' . $view . $done);
        } else {
            $cm->set_after_link($view . $done);
        }
    }
}
开发者ID:blakekidney,项目名称:moodle-mod_activitytask,代码行数:51,代码来源:lib.php


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