本文整理汇总了PHP中cm_info::set_after_link方法的典型用法代码示例。如果您正苦于以下问题:PHP cm_info::set_after_link方法的具体用法?PHP cm_info::set_after_link怎么用?PHP cm_info::set_after_link使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cm_info
的用法示例。
在下文中一共展示了cm_info::set_after_link方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: facetoface_cm_info_view
//.........这里部分代码省略.........
$sessiondate .= userdate($date->timestart, get_string('strftimedate'));
if (!empty($sessiontime)) {
$sessiontime .= html_writer::empty_tag('br');
}
$sessiontime .= userdate($date->timestart, get_string('strftimetime')) . ' - ' . userdate($date->timefinish, get_string('strftimetime'));
}
} else {
$sessiondate = get_string('wait-listed', 'facetoface');
$sessiontime = get_string('wait-listed', 'facetoface');
}
$location = ' ';
$customfielddata = facetoface_get_customfielddata($session->id);
if (!empty($customfielddata['location'])) {
$location = ' ' . $customfielddata['location']->data;
}
$venue = ' ';
if (!empty($customfielddata['venue'])) {
$venue = ' ' . $customfielddata['venue']->data;
}
// Don't include the link to view attendees if user is lacking capability.
$attendeeslink = '';
if (has_capability('mod/facetoface:viewattendees', context_course::instance($cm->course))) {
$strattendees = get_string('seeattendees', 'facetoface');
$attendeesurl = new moodle_url('/mod/facetoface/attendees.php', array('s' => $session->id));
$attendeeslink = ' ' . html_writer::link($attendeesurl, $strattendees, array('class' => 'f2fsessionlinks f2fviewattendees', 'title' => $strattendees));
}
// Don't include the link to cancel a session if it has already occurred.
$cancellink = '';
if (!facetoface_has_session_started($session, $timenow)) {
$strcancel = get_string('cancelbooking', 'facetoface');
$cancelurl = new moodle_url('/mod/facetoface/cancelsignup.php', array('s' => $session->id));
$cancellink = ' ' . html_writer::link($cancelurl, $strcancel, array('class' => 'f2fsessionlinks f2fcancel', 'title' => $strcancel));
}
// Add table data.
$table->data[] = array(get_string('bookingstatus', 'facetoface') . ': ');
$table->data[] = array($location, $venue, $sessiondate, $sessiontime);
$table->data[] = array(html_writer::tag('span', get_string('options', 'facetoface') . ': ' . html_writer::link(new moodle_url('/mod/facetoface/signup.php', array('s' => $session->id)), get_string('moreinfo', 'facetoface'), array('class' => 'f2fsessionlinks f2fsessioninfolink', 'title' => get_string('moreinfo', 'facetoface'))) . "{$attendeeslink}{$cancellink}"));
$table->data[] = array($htmlviewallsessions);
}
} else {
if ($facetoface->display > 0 && ($sessions = facetoface_get_sessions($facetoface->id))) {
$table->data[] = array(get_string('signupforsession', 'facetoface'));
$count = 0;
foreach ($sessions as $session) {
// Don't display past or in-progress sessions.
if ($session->datetimeknown && facetoface_has_session_started($session, $timenow)) {
continue;
}
// Don't diisplay full sessions.
if (!facetoface_session_has_capacity($session, $contextmodule)) {
continue;
}
// Check display count.
$count++;
if ($count > $facetoface->display) {
break;
}
$multiday = '';
$sessiondate = '';
$sessiontime = '';
if ($session->datetimeknown) {
if (empty($session->sessiondates)) {
$sessiondate = get_string('unknowndate', 'facetoface');
$sessiontime = get_string('unknowntime', 'facetoface');
} else {
$sessiondate = userdate($session->sessiondates[0]->timestart, get_string('strftimedate'));
$sessiontime = userdate($session->sessiondates[0]->timestart, get_string('strftimetime')) . ' - ' . userdate($session->sessiondates[0]->timefinish, get_string('strftimetime'));
if (count($session->sessiondates) > 1) {
$multiday = ' (' . get_string('multiday', 'facetoface') . ')';
}
}
} else {
$sessiondate = get_string('wait-listed', 'facetoface');
}
$locationstr = '';
$customfielddata = facetoface_get_customfielddata($session->id);
if (!empty($customfielddata['location']) && trim($customfielddata['location']->data) != '') {
$locationstr = $customfielddata['location']->data . ', ';
}
if ($cm->uservisible) {
$signupurl = new moodle_url('/mod/facetoface/signup.php', array('s' => $session->id));
$row = array(html_writer::link($signupurl, "{$locationstr} {$sessiondate} {$sessiontime} {$multiday}", array('class' => 'f2fsessiontime')));
} else {
$row = array(html_writer::tag('span', "{$locationstr} {$sessiondate} {$sessiontime} {$multiday}", array('class' => 'f2fsessiontime')));
}
// Add to table.
$table->data[] = $row;
}
if ($cm->uservisible) {
$table->data[] = array($htmlviewallsessions);
} else {
$table->data[] = array($strviewallsessions);
}
} else {
// Nothing to display to this user.
return;
}
}
$cm->set_after_link(html_writer::table($table));
}
示例2: opencast_cm_info_view
function opencast_cm_info_view(cm_info $cm) {
$details = $cm->customdata;
if ($details) {
$cm->set_after_link(' ' . html_writer::tag('span', $details,
array('class' => 'resourcelinkdetails')));
}
}
示例3: mod_subcourse_cm_info_view
/**
* This will provide summary info about the user's grade in the subcourse below the link on
* the course/view.php page
*
* @param cm_info $cm
* @return void
*/
function mod_subcourse_cm_info_view(cm_info $cm)
{
global $USER, $CFG;
$html = '';
require_once $CFG->dirroot . '/grade/querylib.php';
$currentgrade = grade_get_course_grade($USER->id, $cm->course);
$html .= html_writer::empty_tag('br');
$html .= html_writer::start_tag('span');
$html .= get_string('currentgrade', 'subcourse') . ' ' . $currentgrade->str_grade;
$html .= html_writer::end_tag('span');
$cm->set_after_link($html);
}
示例4: dialogue_cm_info_view
/**
* Adds information about unread messages, that is only required for the course view page (and
* similar), to the course-module object.
* @param cm_info $cm Course-module object
*/
function dialogue_cm_info_view(cm_info $cm)
{
global $CFG;
require_once $CFG->dirroot . '/mod/dialogue/locallib.php';
// Get tracking status (once per request)
static $initialised;
static $usetracking, $strunreadmessagesone;
if (!isset($initialised)) {
if ($usetracking = dialogue_can_track_dialogue()) {
$strunreadmessagesone = get_string('unreadmessagesone', 'dialogue');
}
$initialised = true;
}
if ($usetracking) {
$unread = dialogue_cm_unread_total(new \mod_dialogue\dialogue($cm));
if ($unread) {
$out = '<span class="unread"> <a href="' . $cm->url . '">';
if ($unread == 1) {
$out .= $strunreadmessagesone;
} else {
$out .= get_string('unreadmessagesnumber', 'dialogue', $unread);
}
$out .= '</a></span>';
$cm->set_after_link($out);
}
}
}
示例5: mod_forumng_cm_info_view
function mod_forumng_cm_info_view(cm_info $cm)
{
global $CFG;
require_once $CFG->dirroot . '/mod/forumng/mod_forumng.php';
static $forums = null;
if ($forums === null) {
// Read tracking is for real users only
if (mod_forumng::enabled_read_tracking() && !isguestuser() && isloggedin()) {
$forums = mod_forumng::get_course_forums($cm->get_course(), 0, mod_forumng::UNREAD_BINARY);
} else {
$forums = array();
}
}
// If current forum is listed, check whether it's unread or not
if (array_key_exists($cm->instance, $forums)) {
if ($forums[$cm->instance]->has_unread_discussions()) {
$cm->set_after_link('<span class="unread">' . get_string('hasunreadposts', 'forumng') . '</span>');
}
}
}
示例6: collaborate_cm_info_view
/**
* Collaborate course module info - meeting times.
*
* @param cm_info $cm
*/
function collaborate_cm_info_view(cm_info $cm)
{
global $PAGE;
$renderer = $PAGE->get_renderer('mod_collaborate');
$times = local::get_times($cm->instance);
$o = html_writer::tag('span', $renderer->meeting_times($times), ['class' => 'label label-info']);
$cm->set_after_link($o);
}
示例7: mod_giportfolio_cm_info_view
function mod_giportfolio_cm_info_view(cm_info $cm)
{
global $USER, $DB;
static $enabled = null;
if ($enabled === null) {
$enabled = get_config('giportfolio', 'contributioncount');
}
if (!$enabled) {
return;
}
if (!has_capability('mod/giportfolio:submitportfolio', context_module::instance($cm->id))) {
return;
}
$count = $DB->count_records('giportfolio_contributions', array('giportfolioid' => $cm->instance, 'userid' => $USER->id));
$count = get_string('contributions', 'mod_giportfolio') . ' ' . html_writer::tag('span', $count, array('class' => 'count-inner'));
$count = html_writer::tag('span', $count, array('class' => 'giportfolio-count'));
$cm->set_after_link($count);
}
示例8: 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);
}
}
}