本文整理汇总了PHP中cm_info::get_icon_url方法的典型用法代码示例。如果您正苦于以下问题:PHP cm_info::get_icon_url方法的具体用法?PHP cm_info::get_icon_url怎么用?PHP cm_info::get_icon_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cm_info
的用法示例。
在下文中一共展示了cm_info::get_icon_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_response
/**
* Send the details of the newly created activity back to the client browser
*
* @param cm_info $mod details of the mod just created
*/
protected function send_response($mod)
{
global $OUTPUT;
$resp = new stdClass();
$resp->error = self::ERROR_OK;
$resp->icon = $mod->get_icon_url()->out();
$resp->name = $mod->name;
$resp->link = $mod->get_url()->out();
$resp->elementid = 'module-' . $mod->id;
$resp->commands = make_editing_buttons($mod, true, true, 0, $mod->sectionnum);
$resp->onclick = $mod->get_on_click();
// if using groupings, then display grouping name
if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', $this->context)) {
$groupings = groups_get_all_groupings($this->course->id);
$resp->groupingname = format_string($groupings[$mod->groupingid]->name);
}
echo $OUTPUT->header();
echo json_encode($resp);
die;
}
示例2: send_response
/**
* Send the details of the newly created activity back to the client browser
*
* @param cm_info $mod details of the mod just created
*/
protected function send_response($mod)
{
global $OUTPUT;
$resp = new stdClass();
$resp->error = self::ERROR_OK;
$resp->icon = $mod->get_icon_url()->out();
$resp->name = $mod->name;
$resp->link = $mod->get_url()->out();
$resp->elementid = 'module-' . $mod->id;
$resp->commands = make_editing_buttons($mod, true, true, 0, $mod->sectionnum);
$resp->onclick = $mod->get_on_click();
echo $OUTPUT->header();
echo json_encode($resp);
die;
}
示例3: send_response
/**
* Send the details of the newly created activity back to the client browser
*
* @param cm_info $mod details of the mod just created
*/
protected function send_response($mod)
{
global $OUTPUT, $PAGE;
$courserenderer = $PAGE->get_renderer('core', 'course');
$resp = new stdClass();
$resp->error = self::ERROR_OK;
$resp->icon = $mod->get_icon_url()->out();
$resp->name = $mod->name;
if ($mod->has_view()) {
$resp->link = $mod->get_url()->out();
} else {
$resp->link = null;
}
$resp->content = $mod->get_content();
$resp->elementid = 'module-' . $mod->id;
$actions = course_get_cm_edit_actions($mod, 0, $mod->sectionnum);
$resp->commands = ' ' . $courserenderer->course_section_cm_edit_actions($actions);
$resp->onclick = $mod->get_on_click();
$resp->visible = $mod->visible;
// if using groupings, then display grouping name
if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', $this->context)) {
$groupings = groups_get_all_groupings($this->course->id);
$resp->groupingname = format_string($groupings[$mod->groupingid]->name);
}
echo $OUTPUT->header();
echo json_encode($resp);
die;
}
示例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);
}
}
}