本文整理汇总了PHP中cm_info::set_name方法的典型用法代码示例。如果您正苦于以下问题:PHP cm_info::set_name方法的具体用法?PHP cm_info::set_name怎么用?PHP cm_info::set_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cm_info
的用法示例。
在下文中一共展示了cm_info::set_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: facetoface_cm_info_view
/**
* Called when viewing course page.
*
* @param cm_info $coursemodule
*/
function facetoface_cm_info_view(cm_info $coursemodule) {
global $USER, $DB;
if (!($facetoface = $DB->get_record('facetoface', array('id' => $coursemodule->instance)))) {
return null;
}
$coursemodule->set_name($facetoface->name);
$contextmodule = context_module::instance($coursemodule->id);
if (!has_capability('mod/facetoface:view', $contextmodule)) {
return null; // Not allowed to view this activity.
}
$contextcourse = context_course::instance($coursemodule->course);
// Can view attendees.
$viewattendees = has_capability('mod/facetoface:viewattendees', $contextcourse);
// Can see "view all sessions" link even if activity is hidden/currently unavailable.
$iseditor = has_any_capability(array('mod/facetoface:viewattendees', 'mod/facetoface:editsessions',
'mod/facetoface:addattendees', 'mod/facetoface:addattendees',
'mod/facetoface:takeattendance'), $contextcourse);
$table = html_writer::start_tag('table', array('class' => 'table90 inlinetable'));
$timenow = time();
$strviewallsessions = get_string('viewallsessions', 'facetoface');
$sessions_url = new moodle_url('/mod/facetoface/view.php', array('f' => $facetoface->id));
$htmlviewallsessions = html_writer::link($sessions_url, $strviewallsessions, array('class' => 'f2fsessionlinks f2fviewallsessions', 'title' => $strviewallsessions));
if ($submissions = facetoface_get_user_submissions($facetoface->id, $USER->id)) {
// User has signedup for the instance.
if (!$facetoface->multiplesessions) {
// First submission only.
$submissions = array(array_shift($submissions));
}
foreach ($submissions as $submission) {
if ($session = facetoface_get_session($submission->sessionid)) {
$allowcancellation = false;
if ($session->datetimeknown && facetoface_has_session_started($session, $timenow) && facetoface_is_session_in_progress($session, $timenow)) {
$status = get_string('sessioninprogress', 'facetoface');
if ($submission->statuscode == MDL_F2F_STATUS_WAITLISTED) {
$allowcancellation = true;
}
} else if ($session->datetimeknown && facetoface_has_session_started($session, $timenow)) {
$status = get_string('sessionover', 'facetoface');
if ($submission->statuscode == MDL_F2F_STATUS_WAITLISTED) {
$allowcancellation = true;
}
} else {
$status = get_string('bookingstatus', 'facetoface');
}
$sessiondates = '';
if ($session->datetimeknown) {
foreach ($session->sessiondates as $date) {
if (!empty($sessiondates)) {
$sessiondates .= html_writer::empty_tag('br');
}
$sessionobj = facetoface_format_session_times($date->timestart, $date->timefinish, $date->sessiontimezone);
if ($sessionobj->startdate == $sessionobj->enddate) {
$sessiondates .= get_string('sessionstartdateandtime', 'facetoface', $sessionobj);
} else {
$sessiondates .= get_string('sessionstartfinishdateandtime', 'facetoface', $sessionobj);
}
}
} else {
$sessiondates = get_string('wait-listed', 'facetoface');
}
$span = html_writer::tag('span', get_string('options', 'facetoface').':', array('class' => 'f2fsessionnotice'));
$options = html_writer::tag('tr', html_writer::tag('td', ' '));
// Don't include the link to cancel a session if it has already occurred.
$moreinfolink = '';
$cancellink = '';
$strcancelbooking = get_string('cancelbooking', 'facetoface');
$cancel_url = new moodle_url('/mod/facetoface/cancelsignup.php', array('s' => $session->id));
if (!facetoface_has_session_started($session, $timenow)) {
$strmoreinfo = get_string('moreinfo', 'facetoface');
$signup_url = new moodle_url('/mod/facetoface/signup.php', array('s' => $session->id));
$moreinfolink = html_writer::tag('tr', html_writer::tag('td', html_writer::link($signup_url, $strmoreinfo, array('class' => 'f2fsessionlinks f2fsessioninfolink', 'title' => $strmoreinfo))));
$cancellink = html_writer::tag('tr', html_writer::tag('td', html_writer::link($cancel_url, $strcancelbooking, array('class' => 'f2fsessionlinks f2fviewallsessions', 'title' => $strcancelbooking))));
$options = html_writer::tag('tr', html_writer::tag('td', $span));
} else {
// Session is started.
if ($allowcancellation) {
$cancellink = html_writer::tag('tr', html_writer::tag('td', html_writer::link($cancel_url, $strcancelbooking, array('class' => 'f2fsessionlinks f2fviewallsessions', 'title' => $strcancelbooking))));
}
}
// Get room data.
$roomtext = '';
$roomdata = $DB->get_record('facetoface_room', array('id' => $session->roomid));
//.........这里部分代码省略.........