本文整理匯總了PHP中enrol_plugin::can_delete_instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP enrol_plugin::can_delete_instance方法的具體用法?PHP enrol_plugin::can_delete_instance怎麽用?PHP enrol_plugin::can_delete_instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類enrol_plugin
的用法示例。
在下文中一共展示了enrol_plugin::can_delete_instance方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: col_edit
/**
* Generate the edit column.
*
* @param \stdClass $tool event data.
* @return string
*/
public function col_edit($tool)
{
global $OUTPUT;
$buttons = array();
$instance = new \stdClass();
$instance->id = $tool->enrolid;
$instance->courseid = $tool->courseid;
$instance->enrol = 'lti';
$instance->status = $tool->status;
$strdelete = get_string('delete');
$strenable = get_string('enable');
$strdisable = get_string('disable');
$url = new \moodle_url('/enrol/lti/index.php', array('sesskey' => sesskey(), 'courseid' => $this->courseid));
if ($this->ltiplugin->can_delete_instance($instance)) {
$aurl = new \moodle_url($url, array('action' => 'delete', 'instanceid' => $instance->id));
$buttons[] = $OUTPUT->action_icon($aurl, new \pix_icon('t/delete', $strdelete, 'core', array('class' => 'iconsmall')));
}
if ($this->ltienabled && $this->ltiplugin->can_hide_show_instance($instance)) {
if ($instance->status == ENROL_INSTANCE_ENABLED) {
$aurl = new \moodle_url($url, array('action' => 'disable', 'instanceid' => $instance->id));
$buttons[] = $OUTPUT->action_icon($aurl, new \pix_icon('t/hide', $strdisable, 'core', array('class' => 'iconsmall')));
} else {
if ($instance->status == ENROL_INSTANCE_DISABLED) {
$aurl = new \moodle_url($url, array('action' => 'enable', 'instanceid' => $instance->id));
$buttons[] = $OUTPUT->action_icon($aurl, new \pix_icon('t/show', $strenable, 'core', array('class' => 'iconsmall')));
}
}
}
if ($this->ltienabled && $this->canconfig) {
$linkparams = array('courseid' => $instance->courseid, 'id' => $instance->id, 'type' => $instance->enrol, 'returnurl' => new \moodle_url('/enrol/lti/index.php', array('courseid' => $this->courseid)));
$editlink = new \moodle_url("/enrol/editinstance.php", $linkparams);
$buttons[] = $OUTPUT->action_icon($editlink, new \pix_icon('t/edit', get_string('edit'), 'core', array('class' => 'iconsmall')));
}
return implode(' ', $buttons);
}