本文整理汇总了PHP中print_single_button函数的典型用法代码示例。如果您正苦于以下问题:PHP print_single_button函数的具体用法?PHP print_single_button怎么用?PHP print_single_button使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_single_button函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notice_okcancel
/**
* Print a message along with "Ok" link for the user to continue and "Cancel" link to close window.
*
* @param string $message The text to display
* @param string $linkok The link to take the user to if they choose "Ok"
* TODO Document remaining arguments
*/
function notice_okcancel($message, $linkok, $optionsok = NULL, $methodok = 'post')
{
global $CFG;
$message = clean_text($message);
$linkok = clean_text($linkok);
print_box_start('generalbox', 'notice');
echo '<p>' . $message . '</p>';
echo '<div class="buttons">';
print_single_button($linkok, $optionsok, get_string('ok'), $methodok, $CFG->framename);
close_window_button('cancel');
echo '</div>';
print_box_end();
}
示例2: output
function output()
{
global $CFG;
$stradd = get_string('add');
$manualform = '<input type="text" name="tag" /><input type="submit" value="' . $stradd . '" />';
$manualform = $this->enclose_in_form($manualform);
$iptcform = '';
$deleteform = '';
$tags = array();
if ($tagrecords = get_records_select('lightboxgallery_image_meta', $this->sql_select(), 'description', 'id,description')) {
$errorlevel = error_reporting(E_PARSE);
$textlib = textlib_get_instance();
foreach ($tagrecords as $tagrecord) {
$tags[$tagrecord->id] = $tagrecord->description;
//$textlib->typo3cs->utf8_decode($tagrecord->description, 'iso-8859-1');
}
error_reporting($errorlevel);
}
$path = $CFG->dataroot . '/' . $this->gallery->course . '/' . $this->gallery->folder . '/' . $this->image;
$size = getimagesize($path, $info);
if (isset($info['APP13'])) {
$iptc = iptcparse($info['APP13']);
if (isset($iptc['2#025'])) {
$iptcform = '<input type="hidden" name="iptc" value="1" />';
sort($iptc['2#025']);
foreach ($iptc['2#025'] as $tag) {
$tag = strtolower($tag);
$exists = $tags && in_array($tag, array_values($tags));
//eric 將 htmlentities($tag); 改為htmlentities($tag,ENT_QUOTES,'UTF-8')
$tag = htmlentities($tag, ENT_QUOTES, 'UTF-8');
$iptcform .= '<label ' . ($exists ? 'class="tag-exists"' : '') . '><input type="checkbox" name="iptctags[]" value="' . $tag . '" />' . $tag . '</label><br />';
}
$iptcform .= '<input type="submit" value="' . $stradd . '" />';
$iptcform = '<span class="tag-head"> ' . get_string('tagsiptc', 'lightboxgallery') . '</span>' . $this->enclose_in_form($iptcform);
}
}
$iptcform .= print_single_button($CFG->wwwroot . '/mod/lightboxgallery/edit/tag/import.php', array('id' => $this->gallery->id), get_string('tagsimport', 'lightboxgallery'), 'post', '_self', true);
if ($tags) {
$deleteform = '<input type="hidden" name="delete" value="1" />';
foreach ($tags as $tagid => $tagname) {
//eric 將 htmlentities($tagname) 改為 htmlentities($tagname, ENT_QUOTES,'UTF-8')
$deleteform .= '<label><input type="checkbox" name="deletetags[]" value="' . $tagid . '" />' . htmlentities($tagname, ENT_QUOTES, 'UTF-8') . '</label><br />';
}
$deleteform .= '<input type="submit" value="' . get_string('remove') . '" />';
$deleteform = '<span class="tag-head"> ' . get_string('tagscurrent', 'lightboxgallery') . '</span>' . $this->enclose_in_form($deleteform);
}
return $manualform . $iptcform . $deleteform;
}
示例3: test_print_single_button
public function test_print_single_button()
{
global $PAGE, $CFG;
// Basic params, absolute URL
$link = 'http://www.test.com/index.php';
$options = array('param1' => 'value1');
$label = 'OK';
$method = 'get';
$return = true;
$tooltip = '';
$disabled = false;
$jsconfirmmessage = '';
$formid = '';
$html = print_single_button($link, $options, $label, $method, '', $return, $tooltip, $disabled, $jsconfirmmessage, $formid);
$this->assert(new ContainsTagWithAttributes('form', array('method' => $method, 'action' => $link)), $html);
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'param1', 'value' => 'value1')), $html);
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => 'OK')), $html);
// URL with & params
$newlink = $link . '?param1=value1&param2=value2';
$html = print_single_button($newlink, $options, $label, $method, '', $return, $tooltip, $disabled, $jsconfirmmessage, $formid);
$this->assert(new ContainsTagWithAttributes('form', array('method' => $method, 'action' => $link)), $html);
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'param1', 'value' => 'value1')), $html);
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => 'OK')), $html);
// URL with & params
$newlink = $link . '?param1=value1¶m2=value2';
$html = print_single_button($newlink, $options, $label, $method, '', $return, $tooltip, $disabled, $jsconfirmmessage, $formid);
$this->assert(new ContainsTagWithAttributes('form', array('method' => $method, 'action' => $link)), $html);
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'param1', 'value' => 'value1')), $html);
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => 'OK')), $html);
// relative URL with & params
$newlink = 'index.php?param1=value1¶m2=value2';
$PAGE->set_url('index.php');
$html = print_single_button($newlink, $options, $label, $method, '', $return, $tooltip, $disabled, $jsconfirmmessage, $formid);
$this->assert(new ContainsTagWithAttributes('form', array('method' => $method, 'action' => $CFG->wwwroot . '/index.php')), $html);
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'hidden', 'name' => 'param1', 'value' => 'value1')), $html);
$this->assert(new ContainsTagWithAttributes('input', array('type' => 'submit', 'value' => 'OK')), $html);
}
示例4: print_options_form
function print_options_form($quiz, $cm, $attempts, $lowlimit = 0, $pagesize = 10)
{
global $CFG, $USER;
echo '<div class="controls">';
echo '<form id="options" action="report.php" method="post">';
echo '<fieldset class="invisiblefieldset">';
echo '<p class="quiz-report-options">' . get_string('analysisoptions', 'quiz') . ': </p>';
echo '<input type="hidden" name="id" value="' . $cm->id . '" />';
echo '<input type="hidden" name="q" value="' . $quiz->id . '" />';
echo '<input type="hidden" name="mode" value="analysis" />';
echo '<p><label for="menuattemptselection">' . get_string('attemptselection', 'quiz_analysis') . '</label> ';
$options = array(QUIZ_ALLATTEMPTS => get_string("attemptsall", 'quiz_analysis'), QUIZ_HIGHESTATTEMPT => get_string("attemptshighest", 'quiz_analysis'), QUIZ_FIRSTATTEMPT => get_string("attemptsfirst", 'quiz_analysis'), QUIZ_LASTATTEMPT => get_string("attemptslast", 'quiz_analysis'));
choose_from_menu($options, "attemptselection", "{$attempts}", "");
echo '</p>';
echo '<p><label for="lowmarklimit">' . get_string('lowmarkslimit', 'quiz_analysis') . '</label> ';
echo '<input type="text" id="lowmarklimit" name="lowmarklimit" size="1" value="' . $lowlimit . '" /> % </p>';
echo '<p><label for="pagesize">' . get_string('pagesize', 'quiz_analysis') . '</label> ';
echo '<input type="text" id="pagesize" name="pagesize" size="1" value="' . $pagesize . '" /></p>';
echo '<p><input type="submit" value="' . get_string('go') . '" />';
helpbutton("analysisoptions", get_string("analysisoptions", 'quiz_analysis'), 'quiz');
echo '</p>';
echo '</fieldset>';
echo '</form>';
echo '</div>';
echo "\n";
echo '<table class="boxaligncenter"><tr>';
$options = array();
$options["id"] = "{$cm->id}";
$options["q"] = "{$quiz->id}";
$options["mode"] = "analysis";
$options['sesskey'] = $USER->sesskey;
$options["noheader"] = "yes";
echo '<td>';
$options["download"] = "ODS";
print_single_button("report.php", $options, get_string("downloadods"));
echo "</td>\n";
echo '<td>';
$options["download"] = "Excel";
print_single_button("report.php", $options, get_string("downloadexcel"));
echo "</td>\n";
if (file_exists("{$CFG->libdir}/phpdocwriter/lib/include.php")) {
echo '<td>';
$options["download"] = "OOo";
print_single_button("report.php", $options, get_string("downloadooo", "quiz_analysis"));
echo "</td>\n";
}
echo '<td>';
$options["download"] = "CSV";
print_single_button('report.php', $options, get_string("downloadtext"));
echo "</td>\n";
echo "<td>";
helpbutton('analysisdownload', get_string('analysisdownload', 'quiz_analysis'), 'quiz');
echo "</td>\n";
echo '</tr></table>';
}
示例5: get_completion_page
function get_completion_page($crsid)
{
global $CFG;
$output = '';
$crs = new course($crsid);
$table = new stdClass();
$elements = $crs->get_completion_elements();
if ($elements) {
$columns = array('idnumber' => get_string('completion_idnumber', 'block_curr_admin'), 'name' => get_string('completion_name', 'block_curr_admin'), 'description' => get_string('completion_description', 'block_curr_admin'), 'completion_grade' => get_string('completion_grade', 'block_curr_admin'), 'required' => get_string('required', 'block_curr_admin'));
foreach ($columns as $column => $cdesc) {
$columndir = "ASC";
$columnicon = $columndir == "ASC" ? "down" : "up";
$columnicon = " <img src=\"{$CFG->pixpath}/t/{$columnicon}.gif\" alt=\"\" />";
${$column} = $cdesc;
$table->head[] = ${$column};
$table->align[] = "left";
$table->wrap[] = false;
}
$table->head[] = "";
$table->align[] = "center";
$table->wrap[] = true;
foreach ($elements as $element) {
$deletebutton = '<a href="index.php?s=crs&section=curr&action=delem&id=' . $crs->id . '&elemid=' . $element->id . '">' . '<img src="pix/delete.gif" alt="Delete" title="Delete" /></a>';
$editbutton = '<a href="index.php?s=crs&section=curr&action=eelem&id=' . $crs->id . '&elemid=' . $element->id . '">' . '<img src="pix/edit.gif" alt="Edit" title="Edit" /></a>';
$newarr = array();
foreach ($columns as $column => $cdesc) {
if ($column == 'required') {
$newarr[] = empty($element->required) ? get_string('no') : get_string('yes');
} else {
$newarr[] = $element->{$column};
}
}
$newarr[] = $editbutton . ' ' . $deletebutton;
$table->data[] = $newarr;
}
$output .= print_table($table, true);
} else {
$output .= '<div align="center">' . get_string('no_completion_elements', 'block_curr_admin') . '</div>';
}
$output .= '<br clear="all" />' . "\n";
$output .= '<div align="center">';
$options = array('s' => 'crs', 'section' => 'curr', 'action' => 'celem', 'id' => $crs->id);
$output .= print_single_button('index.php', $options, 'Add Element', 'get', '_self', true, 'Add New Element');
$output .= '</div>';
return $output;
}
示例6: print_continue
/**
* Either prints a "Export" box, which will redirect the user to the download page,
* or prints the URL for the published data.
* @return void
*/
function print_continue()
{
global $CFG;
$params = $this->get_export_params();
print_heading(get_string('export', 'grades'));
echo '<div class="gradeexportlink">';
if (!$this->userkey) {
// this button should trigger a download prompt
print_single_button($CFG->wwwroot . '/grade/export/' . $this->plugin . '/export.php', $params, get_string('download', 'admin'));
} else {
$paramstr = '';
$sep = '?';
foreach ($params as $name => $value) {
$paramstr .= $sep . $name . '=' . $value;
$sep = '&';
}
$link = $CFG->wwwroot . '/grade/export/' . $this->plugin . '/dump.php' . $paramstr . '&key=' . $this->userkey;
echo get_string('download', 'admin') . ': <a href="' . $link . '">' . $link . '</a>';
}
echo '</div>';
}
示例7: print_single_button
echo "\t\t\t<object type=\"text/html\" data=\"preview.php?preview={$theme}\" height=\"200\" width=\"400\">{$theme}</object>\n\t\t</td>\n";
}
}
if ($CFG->theme == $theme) {
echo "\t\t" . '<td valign="top" style="border-style:solid; border-width:1px; border-color:#555555">' . "\n";
} else {
echo "\t\t" . '<td valign="top">' . "\n";
}
if (isset($THEME->sheets)) {
echo "\t\t\t" . '<p style="font-size:1.5em;font-weight:bold;">' . $theme . '</p>' . "\n";
} else {
echo "\t\t\t" . '<p style="font-size:1.5em;font-weight:bold;color:red;">' . $theme . ' (Moodle 1.4)</p>' . "\n";
}
if ($screenshot or $readme) {
echo "\t\t\t<ul>\n";
if (!$USER->screenreader) {
echo "\t\t\t\t<li><a href=\"preview.php?preview={$theme}\">{$strpreview}</a></li>\n";
}
echo $screenshot . $readme;
echo "\t\t\t</ul>\n";
}
$options = null;
$options['choose'] = $theme;
$options['sesskey'] = $sesskey;
echo "\t\t\t" . print_single_button('index.php', $options, $strchoose, 'get', null, true) . "\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";
}
echo "</table>\n";
$THEME = $original_theme;
admin_externalpage_print_footer();
示例8: quiz_print_question_list
//.........这里部分代码省略.........
?>
" />
<?php
echo $pageurl->hidden_params_out();
?>
<input type="hidden" name="savechanges" value="save" />
<?php
echo '<input type="text" name="g' . $question->id . '" id="inputq' . $question->id . '" size="' . ($quiz->decimalpoints + 2) . '" value="' . (0 + $quiz->grades[$qnum]) . '" tabindex="' . ($lastindex + $qno) . '" />';
?>
<input type="submit" class="pointssubmitbutton" value="<?php
echo $strsave;
?>
" />
</fieldset>
<?php
if ($question->qtype == 'random') {
echo '<a href="' . $questionurl->out() . '" class="configurerandomquestion">' . get_string("configurerandomquestion", "quiz") . '</a>';
}
?>
</div>
</form>
</div>
<?php
} else {
if ($reordertool) {
if ($qnum) {
?>
<div class="qorder">
<?php
echo '<input type="text" name="o' . $question->id . '" size="2" value="' . (10 * $count + 10) . '" tabindex="' . ($lastindex + $qno) . '" />';
?>
<!-- <input type="submit" class="pointssubmitbutton" value="<?php
echo $strsave;
?>
" /> -->
</div>
<?php
}
}
}
?>
<div class="questioncontentcontainer">
<?php
if ($question->qtype == 'random') {
// it is a random question
if (!$reordertool) {
quiz_print_randomquestion($question, $pageurl, $quiz, $quiz_qbanktool);
} else {
quiz_print_randomquestion_reordertool($question, $pageurl, $quiz);
}
} else {
// it is a single question
if (!$reordertool) {
quiz_print_singlequestion($question, $returnurl, $quiz);
} else {
quiz_print_singlequestion_reordertool($question, $returnurl, $quiz);
}
}
?>
</div>
</div>
</div>
</div>
<?php
/* Display question end */
$count++;
$sumgrade += $quiz->grades[$qnum];
}
}
//a page break: end the existing page.
if ($qnum == 0) {
if ($pageopen) {
if (!$reordertool && !($quiz->shufflequestions && $i < $questiontotalcount - 1)) {
quiz_print_pagecontrols($quiz, $pageurl, $pagecount, $hasattempts);
} else {
if ($i < $questiontotalcount - 1) {
//do not include the last page break for reordering
//to avoid creating a new extra page in the end
echo '<input type="hidden" name="opg' . $pagecount . '" size="2" value="' . (10 * $count + 10) . '" />';
}
}
echo "</div></div>";
if (!$reordertool && !$quiz->shufflequestions) {
echo "<div class=\"addpage\">";
print_single_button($pageurl->out(true), array('cmid' => $quiz->cmid, 'courseid' => $quiz->course, 'addpage' => $count, 'sesskey' => sesskey()), get_string('addpagehere', 'quiz'), 'get', '_self', false, '', $hasattempts);
echo "</div>";
}
$pageopen = false;
$count++;
}
}
}
if ($reordertool) {
echo $reordercontrolsbottom;
echo '</div></form>';
}
return $sumgrade;
}
示例9: switch
echo '<div class="heightcontainer">';
switch ($view) {
case 'day':
calendar_show_day($day, $mon, $yr, $courses, $groups, $users, $courseid);
break;
case 'month':
calendar_show_month_detailed($mon, $yr, $courses, $groups, $users, $courseid);
break;
case 'upcoming':
calendar_show_upcoming_events($courses, $groups, $users, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS), $courseid);
break;
}
//Link to calendar export page
echo '<div class="bottom">';
if (!empty($CFG->enablecalendarexport)) {
print_single_button('export.php', array('course' => $courseid), get_string('exportcalendar', 'calendar'));
if (!empty($USER->id)) {
$authtoken = sha1($USER->username . $USER->password . $CFG->calendar_exportsalt);
$usernameencoded = urlencode($USER->username);
echo "<a href=\"export_execute.php?preset_what=all&preset_time=recentupcoming&username={$usernameencoded}&authtoken={$authtoken}\">" . '<img src="' . $CFG->pixpath . '/i/ical.gif" height="14" width="36" ' . 'alt="' . get_string('ical', 'calendar') . '" ' . 'title="' . get_string('quickdownloadcalendar', 'calendar') . '" />' . '</a>';
}
}
echo '</div>';
echo '</div>';
echo '</td>';
// END: Main column
// START: Last column (3-month display)
echo '<td class="sidecalendar">';
list($prevmon, $prevyr) = calendar_sub_month($mon, $yr);
list($nextmon, $nextyr) = calendar_add_month($mon, $yr);
$getvars = 'id=' . $courseid . '&cal_d=' . $day . '&cal_m=' . $mon . '&cal_y=' . $yr;
示例10: display
function display()
{
global $CFG;
/// Set up generic stuff first, including checking for access
parent::display();
/// Set up some shorthand variables
$cm = $this->cm;
$course = $this->course;
$resource = $this->resource;
require_once $CFG->libdir . '/filelib.php';
$subdir = optional_param('subdir', '', PARAM_PATH);
$resource->reference = clean_param($resource->reference, PARAM_PATH);
$formatoptions = new object();
$formatoptions->noclean = true;
$formatoptions->para = false;
// MDL-12061, <p> in html editor breaks xhtml strict
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
if ($resource->reference) {
$relativepath = "{$course->id}/{$resource->reference}";
} else {
$relativepath = "{$course->id}";
}
if ($subdir) {
$relativepath = "{$relativepath}{$subdir}";
if (stripos($relativepath, 'backupdata') !== FALSE or stripos($relativepath, $CFG->moddata) !== FALSE) {
error("Access not allowed!");
}
$subs = explode('/', $subdir);
array_shift($subs);
$countsubs = count($subs);
$count = 0;
$backsub = '';
foreach ($subs as $sub) {
$count++;
if ($count < $countsubs) {
$backsub .= "/{$sub}";
$this->navlinks[] = array('name' => $sub, 'link' => "view.php?id={$cm->id}", 'type' => 'title');
} else {
$this->navlinks[] = array('name' => $sub, 'link' => '', 'type' => 'title');
}
}
}
$pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
$update = update_module_button($cm->id, $course->id, $this->strresource);
if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $course->id))) {
$options = array('id' => $course->id, 'wdir' => '/' . $resource->reference . $subdir);
$editfiles = print_single_button("{$CFG->wwwroot}/files/index.php", $options, get_string("editfiles"), 'get', '', true);
$update = $editfiles . $update;
}
$navigation = build_navigation($this->navlinks, $cm);
print_header($pagetitle, $course->fullname, $navigation, "", "", true, $update, navmenu($course, $cm));
if (trim(strip_tags($resource->summary))) {
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
print_spacer(10, 10);
}
$files = get_directory_list("{$CFG->dataroot}/{$relativepath}", array($CFG->moddata, 'backupdata'), false, true, true);
if (!$files) {
print_heading(get_string("nofilesyet"));
print_footer($course);
exit;
}
print_simple_box_start("center", "", "", '0');
$strftime = get_string('strftimedatetime');
$strname = get_string("name");
$strsize = get_string("size");
$strmodified = get_string("modified");
$strfolder = get_string("folder");
$strfile = get_string("file");
echo '<table cellpadding="4" cellspacing="1" class="files" summary="">';
echo "<tr><th class=\"header name\" scope=\"col\">{$strname}</th>" . "<th align=\"right\" colspan=\"2\" class=\"header size\" scope=\"col\">{$strsize}</th>" . "<th align=\"right\" class=\"header date\" scope=\"col\">{$strmodified}</th>" . "</tr>";
foreach ($files as $file) {
if (is_dir("{$CFG->dataroot}/{$relativepath}/{$file}")) {
// Must be a directory
$icon = "folder.gif";
$relativeurl = "/view.php?blah";
$filesize = display_size(get_directory_size("{$CFG->dataroot}/{$relativepath}/{$file}"));
} else {
$icon = mimeinfo("icon", $file);
$relativeurl = get_file_url("{$relativepath}/{$file}");
$filesize = display_size(filesize("{$CFG->dataroot}/{$relativepath}/{$file}"));
}
if ($icon == 'folder.gif') {
echo '<tr class="folder">';
echo '<td class="name">';
echo "<a href=\"view.php?id={$cm->id}&subdir={$subdir}/{$file}\">";
echo "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfolder}\" /> {$file}</a>";
} else {
echo '<tr class="file">';
echo '<td class="name">';
link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" /> {$file}", 450, 600, '');
}
echo '</td>';
echo '<td> </td>';
echo '<td align="right" class="size">';
echo $filesize;
echo '</td>';
echo '<td align="right" class="date">';
echo userdate(filemtime("{$CFG->dataroot}/{$relativepath}/{$file}"), $strftime);
echo '</td>';
echo '</tr>';
//.........这里部分代码省略.........
示例11: print_heading
print_heading(format_string($category->name) . ' ' . profile_category_icons($category));
if (count($table->data)) {
print_table($table);
} else {
notify($strnofields);
}
}
/// End of $categories foreach
echo '<hr />';
echo '<div class="profileeditor">';
/// Create a new field link
$options = profile_list_datatypes();
popup_form($CFG->wwwroot . '/user/profile/index.php?id=0&action=editfield&datatype=', $options, 'newfieldform', '', 'choose', '', '', false, 'self', $strcreatefield);
/// Create a new category link
$options = array('action' => 'editcategory');
print_single_button('index.php', $options, get_string('profilecreatecategory', 'admin'));
echo '</div>';
admin_externalpage_print_footer();
die;
/***** Some functions relevant to this script *****/
/**
* Create a string containing the editing icons for the user profile categories
* @param object the category object
* @return string the icon string
*/
function profile_category_icons($category)
{
global $CFG, $USER;
$strdelete = get_string('delete');
$strmoveup = get_string('moveup');
$strmovedown = get_string('movedown');
示例12: elseif
} elseif ($certrecord->certdate == 0) {
///Create certificate
if (empty($action)) {
view_header($course, $certificate, $cm);
if ($certificate->delivery == 0) {
echo '<p align="center">' . get_string('openwindow', 'certificate') . '</p>';
} elseif ($certificate->delivery == 1) {
echo '<p align="center">' . get_string('opendownload', 'certificate') . '</p>';
} elseif ($certificate->delivery == 2) {
echo '<p align="center">' . get_string('openemail', 'certificate') . '</p>';
}
$opt = new stdclass();
$opt->id = $cm->id;
$opt->action = 'get';
echo '<center>';
print_single_button('view.php', $opt, $strgetcertificate, 'get', '_blank');
echo '</center>';
add_to_log($course->id, 'certificate', 'received', "view.php?id={$cm->id}", $certificate->id, $cm->id);
print_footer(NULL, $course);
exit;
}
certificate_issue($course, $certificate, $certrecord, $cm);
// update certrecord as issued
}
// Output to pdf
certificate_file_area($USER->id);
$filesafe = clean_filename($certificate->name . '.pdf');
$file = $CFG->dataroot . '/' . $course->id . '/moddata/certificate/' . $certificate->id . '/' . $USER->id . '/' . $filesafe;
if ($certificate->savecert == 1) {
$pdf->Output($file, 'F');
//save as file
示例13: print_error
if (!ims_save_serialized_file($resourcedir . '/moodle_inx.ser', $items)) {
print_error('errorcreatingfile', 'error', '', 'moodle_inx.ser');
}
/// Create the HASH file (moodle_hash.ser - where the hash of the ims is stored serialized) file
$hash = $resource_obj->calculatefilehash($resourcefile);
if (!ims_save_serialized_file($resourcedir . '/moodle_hash.ser', $hash)) {
print_error('errorcreatingfile', 'error', '', 'moodle_hash.ser');
}
/// End button (go to view mode)
echo '<center>';
print_simple_box(get_string('imspackageloaded', 'resource'), 'center');
$link = $CFG->wwwroot . '/mod/resource/view.php';
$options['r'] = $resource->id;
$label = get_string('viewims', 'resource');
$method = 'post';
print_single_button($link, $options, $label, $method);
echo '</center>';
///
/// End of main process, where everything is deployed
///
/// Print the footer of the page
print_footer();
///
/// Common and useful functions used by the body of the script
///
/*** This function will return a tree of manifests (xmlized) as they are
* found and extracted from one manifest file. The first manifest in the
* will be the main one, while the rest will be submanifests. In the
* future (when IMS CP suppors it, external submanifest will be detected
* and retrieved here too). See IMS specs for more info.
*/
示例14: restore_precheck
//.........这里部分代码省略.........
$xml_file = $CFG->dataroot . "/temp/backup/" . $backup_unique_code . "/moodle.xml";
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("checkingbackup") . '</li>';
}
if (!($status = restore_check_moodle_file($xml_file))) {
if (!is_file($xml_file)) {
$errorstr = 'Error checking backup file. moodle.xml not found at root level of zip file.';
} else {
$errorstr = 'Error checking backup file. moodle.xml is incorrect or corrupted.';
}
if (!defined('RESTORE_SILENTLY')) {
notify($errorstr);
} else {
return false;
}
}
}
$info = "";
$course_header = "";
//Now read the info tag (all)
if ($status) {
if (!defined('RESTORE_SILENTLY')) {
echo "<li>" . get_string("readinginfofrombackup") . '</li>';
}
//Reading info from file
$info = restore_read_xml_info($xml_file);
//Reading course_header from file
$course_header = restore_read_xml_course_header($xml_file);
if (!is_object($course_header)) {
// ensure we fail if there is no course header
$course_header = false;
}
}
if (!defined('RESTORE_SILENTLY')) {
//End the main ul
echo "</ul>\n";
//End the main table
echo "</td></tr>";
echo "</table>";
}
//We compare Moodle's versions
if ($CFG->version < $info->backup_moodle_version && $status) {
$message = new object();
$message->serverversion = $CFG->version;
$message->serverrelease = $CFG->release;
$message->backupversion = $info->backup_moodle_version;
$message->backuprelease = $info->backup_moodle_release;
print_simple_box(get_string('noticenewerbackup', '', $message), "center", "70%", '', "20", "noticebox");
}
//Now we print in other table, the backup and the course it contains info
if ($info and $course_header and $status) {
//First, the course info
if (!defined('RESTORE_SILENTLY')) {
$status = restore_print_course_header($course_header);
}
//Now, the backup info
if ($status) {
if (!defined('RESTORE_SILENTLY')) {
$status = restore_print_info($info);
}
}
}
//Save course header and info into php session
if ($status) {
$SESSION->info = $info;
$SESSION->course_header = $course_header;
}
//Finally, a little form to continue
//with some hidden fields
if ($status) {
if (!defined('RESTORE_SILENTLY')) {
echo "<br /><div style='text-align:center'>";
$hidden["backup_unique_code"] = $backup_unique_code;
$hidden["launch"] = "form";
$hidden["file"] = $file;
$hidden["id"] = $id;
print_single_button("restore.php", $hidden, get_string("continue"), "post");
echo "</div>";
} else {
if (empty($noredirect)) {
// in 2.0 we must not print "Continue" redirect link here, because ppl click on it and the execution gets interrupted on next page!!!
// imo RESTORE_SILENTLY is an ugly hack :-P
$sillystr = get_string('donotclickcontinue');
redirect($CFG->wwwroot . '/backup/restore.php?backup_unique_code=' . $backup_unique_code . '&launch=form&file=' . $file . '&id=' . $id, $sillystr, 0);
} else {
return $backup_unique_code;
}
}
}
if (!$status) {
if (!defined('RESTORE_SILENTLY')) {
error("An error has ocurred");
} else {
$errorstr = "An error has occured";
// helpful! :P
return false;
}
}
return true;
}
示例15: choose_from_menu
}
choose_from_menu($displaylist, "moveto", "", get_string("moveselectedcoursesto"), "javascript: submitFormById('movecourses')");
echo '<input type="hidden" name="id" value="' . $category->id . '" />';
if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM, SITEID)) and $numcourses > 1) {
print_submit_button('deletecourses', 'Delete Selected Courses', null);
}
echo '</td></tr>';
}
echo '</table>';
echo '</div></form>';
echo '<br />';
}
}
echo '<div class="buttons">';
if (has_capability('moodle/category:update', get_context_instance(CONTEXT_SYSTEM)) and $numcourses > 1) {
/// Print button to re-sort courses by name
unset($options);
$options['id'] = $category->id;
$options['resort'] = 'name';
$options['sesskey'] = $USER->sesskey;
print_single_button('category.php', $options, get_string('resortcoursesbyname'), 'get');
}
if (has_capability('moodle/course:create', $context)) {
/// Print button to create a new course
unset($options);
$options['category'] = $category->id;
print_single_button('edit.php', $options, get_string('addnewcourse'), 'get');
}
echo '</div>';
print_course_search();
print_footer();