本文整理汇总了PHP中portfolio_add_button::render方法的典型用法代码示例。如果您正苦于以下问题:PHP portfolio_add_button::render方法的具体用法?PHP portfolio_add_button::render怎么用?PHP portfolio_add_button::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portfolio_add_button
的用法示例。
在下文中一共展示了portfolio_add_button::render方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
if ($iscomplete) {
$completesessions++;
}
$sessionend = $message->timestamp;
$sessionusers = array();
$sessionusers[$message->userid] = 1;
}
$lasttime = $message->timestamp;
}
echo '</div>';
if (!empty($CFG->enableportfolios) && $canexportsess) {
require_once($CFG->libdir . '/portfoliolib.php');
$button = new portfolio_add_button();
$button->set_callback_options('chat_portfolio_caller', array('id' => $cm->id), 'mod_chat');
$button->render(null, get_string('addalltoportfolio', 'portfolio'));
}
if (!$showall and $completesessions == 0) {
echo html_writer::start_tag('p');
echo get_string('no_complete_sessions_found', 'chat') . ' ';
echo html_writer::link('report.php?id='.$cm->id.'&show_all=1', get_string('list_all_sessions', 'chat'));
echo html_writer::end_tag('p');
}
// Finish the page.
echo $OUTPUT->footer();
示例2: view
function view()
{
global $OUTPUT, $CFG, $USER, $PAGE;
$edit = optional_param('edit', 0, PARAM_BOOL);
$saved = optional_param('saved', 0, PARAM_BOOL);
$context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
require_capability('mod/assignment:view', $context);
$submission = $this->get_submission($USER->id, false);
//Guest can not submit nor edit an assignment (bug: 4604)
if (!is_enrolled($this->context, $USER, 'mod/assignment:submit')) {
$editable = false;
} else {
$editable = $this->isopen() && (!$submission || $this->assignment->resubmit || !$submission->timemarked);
}
$editmode = ($editable and $edit);
if ($editmode) {
// prepare form and process submitted data
$editoroptions = array('noclean' => false, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->course->maxbytes);
$data = new stdClass();
$data->id = $this->cm->id;
$data->edit = 1;
if ($submission) {
$data->sid = $submission->id;
$data->text = $submission->data1;
$data->textformat = $submission->data2;
} else {
$data->sid = NULL;
$data->text = '';
$data->textformat = NULL;
}
$data = file_prepare_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', $this->filearea, $data->sid);
$mform = new mod_assignment_online_edit_form(null, array($data, $editoroptions));
if ($mform->is_cancelled()) {
redirect($PAGE->url);
}
if ($data = $mform->get_data()) {
$submission = $this->get_submission($USER->id, true);
//create the submission if needed & its id
$data = file_postupdate_standard_editor($data, 'text', $editoroptions, $this->context, 'mod_assignment', $this->filearea, $submission->id);
$submission = $this->update_submission($data);
//TODO fix log actions - needs db upgrade
add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
$this->email_teachers($submission);
//redirect to get updated submission date and word count
redirect(new moodle_url($PAGE->url, array('saved' => 1)));
}
}
add_to_log($this->course->id, "assignment", "view", "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id);
/// print header, etc. and display form if needed
if ($editmode) {
$this->view_header(get_string('editmysubmission', 'assignment'));
} else {
$this->view_header();
}
$this->view_intro();
$this->view_dates();
if ($saved) {
echo $OUTPUT->notification(get_string('submissionsaved', 'assignment'), 'notifysuccess');
}
if (is_enrolled($this->context, $USER)) {
if ($editmode) {
echo $OUTPUT->box_start('generalbox', 'onlineenter');
$mform->display();
} else {
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter', 'online');
if ($submission && has_capability('mod/assignment:exportownsubmission', $this->context)) {
$text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'mod_assignment', $this->filearea, $submission->id);
echo format_text($text, $submission->data2, array('overflowdiv' => true));
if ($CFG->enableportfolios) {
require_once $CFG->libdir . '/portfoliolib.php';
$button = new portfolio_add_button();
$button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/locallib.php');
$fs = get_file_storage();
if ($files = $fs->get_area_files($this->context->id, 'mod_assignment', $this->filearea, $submission->id, "timemodified", false)) {
$button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
} else {
$button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
}
$button->render();
}
} else {
if ($this->isopen()) {
//fix for #4206
echo '<div style="text-align:center">' . get_string('emptysubmission', 'assignment') . '</div>';
}
}
}
echo $OUTPUT->box_end();
if (!$editmode && $editable) {
if (!empty($submission)) {
$submitbutton = "editmysubmission";
} else {
$submitbutton = "addsubmission";
}
echo "<div style='text-align:center'>";
echo $OUTPUT->single_button(new moodle_url('view.php', array('id' => $this->cm->id, 'edit' => '1')), get_string($submitbutton, 'assignment'));
echo "</div>";
}
}
$this->view_feedback();
//.........这里部分代码省略.........
示例3: view
function view()
{
global $USER;
$edit = optional_param('edit', 0, PARAM_BOOL);
$saved = optional_param('saved', 0, PARAM_BOOL);
$context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
require_capability('mod/assignment:view', $context);
$submission = $this->get_submission();
//Guest can not submit nor edit an assignment (bug: 4604)
if (!has_capability('mod/assignment:submit', $context)) {
$editable = null;
} else {
$editable = $this->isopen() && (!$submission || $this->assignment->resubmit || !$submission->timemarked);
}
$editmode = ($editable and $edit);
if ($editmode) {
//guest can not edit or submit assignment
if (!has_capability('mod/assignment:submit', $context)) {
print_error('guestnosubmit', 'assignment');
}
}
add_to_log($this->course->id, "assignment", "view", "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id);
/// prepare form and process submitted data
$mform = new mod_assignment_online_edit_form();
$defaults = new object();
$defaults->id = $this->cm->id;
if (!empty($submission)) {
if ($this->usehtmleditor) {
$options = new object();
$options->smiley = false;
$options->filter = false;
$defaults->text = format_text($submission->data1, $submission->data2, $options);
$defaults->format = FORMAT_HTML;
} else {
$defaults->text = $submission->data1;
$defaults->format = $submission->data2;
}
}
$mform->set_data($defaults);
if ($mform->is_cancelled()) {
redirect('view.php?id=' . $this->cm->id);
}
if ($data = $mform->get_data()) {
// No incoming data?
if ($editable && $this->update_submission($data)) {
//TODO fix log actions - needs db upgrade
$submission = $this->get_submission();
add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
$this->email_teachers($submission);
//redirect to get updated submission date and word count
redirect('view.php?id=' . $this->cm->id . '&saved=1');
} else {
// TODO: add better error message
notify(get_string("error"));
//submitting not allowed!
}
}
/// print header, etc. and display form if needed
if ($editmode) {
$this->view_header(get_string('editmysubmission', 'assignment'));
} else {
$this->view_header();
}
$this->view_intro();
$this->view_dates();
if ($saved) {
notify(get_string('submissionsaved', 'assignment'), 'notifysuccess');
}
if (has_capability('mod/assignment:submit', $context)) {
if ($editmode) {
print_box_start('generalbox', 'online');
$mform->display();
} else {
print_box_start('generalbox boxwidthwide boxaligncenter', 'online');
if ($submission && has_capability('mod/assignment:exportownsubmission', $this->context)) {
echo format_text($submission->data1, $submission->data2);
$button = new portfolio_add_button();
$button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/lib.php');
$button->render();
} else {
if (!has_capability('mod/assignment:submit', $context)) {
//fix for #4604
echo '<div style="text-align:center">' . get_string('guestnosubmit', 'assignment') . '</div>';
} else {
if ($this->isopen()) {
//fix for #4206
echo '<div style="text-align:center">' . get_string('emptysubmission', 'assignment') . '</div>';
}
}
}
}
print_box_end();
if (!$editmode && $editable) {
echo "<div style='text-align:center'>";
print_single_button('view.php', array('id' => $this->cm->id, 'edit' => '1'), get_string('editmysubmission', 'assignment'));
echo "</div>";
}
}
$this->view_feedback();
$this->view_footer();
//.........这里部分代码省略.........
示例4: array
echo $OUTPUT->box_start('glossarydisplay generalbox');
?>
<form action="exportfile.php" method="post">
<table border="0" cellpadding="6" cellspacing="6" width="100%">
<tr><td align="center">
<input type="submit" value="<?php
p($strexportfile);
?>
" />
</td></tr></table>
<div>
<input type="hidden" name="id" value="<?php
p($id);
?>
" />
<input type="hidden" name="cat" value="<?php
p($cat);
?>
" />
</div>
</form>
<?php
// don't need cap check here, we share with the general export.
if ($DB->count_records('glossary_entries', array('glossaryid' => $glossary->id))) {
require_once $CFG->libdir . '/portfoliolib.php';
$button = new portfolio_add_button();
$button->set_callback_options('glossary_csv_portfolio_caller', array('id' => $cm->id), '/mod/glossary/lib.php');
$button->render();
}
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
示例5: add_button
public static function add_button($resource, $format = null, $return = false)
{
if (!has_capability('mod/resource:exportresource', get_context_instance(CONTEXT_MODULE, $resource->cm->id))) {
return;
}
if (!is_callable(array($resource, 'portfolio_prepare_package')) || !is_callable(array($resource, 'portfolio_get_sha1'))) {
debugging(get_string('portfolionotimplemented', 'resource'));
return false;
}
$callersupports = array(self::type_to_format($resource->resource->type));
if ($resource->resource->type == 'file') {
// $callersupports = array(portfolio_format_from_file($file);
}
$button = new portfolio_add_button();
$button->set_callback_options('resource_portfolio_caller', array('id' => $resource->cm->instance), '/mod/resource/lib.php');
$button->set_formats($callersupports);
if ($return) {
return $button->to_html($format);
}
$button->render($format);
}