本文整理汇总了PHP中print_continue函数的典型用法代码示例。如果您正苦于以下问题:PHP print_continue函数的具体用法?PHP print_continue怎么用?PHP print_continue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_continue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: commentwall_init
/**
* Comment wall initialisation.
*/
function commentwall_init()
{
global $CFG, $db, $function, $metatags, $template;
// Add meta tags
$metatags .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}mod/commentwall/commentwall.js\"><!-- commentwall js --></script>";
// Define some templates
templates_add_context('commentwallobject', 'mod/commentwall/template');
templates_add_context('commentwallfooter', 'mod/commentwall/footer');
templates_add_context('css', 'mod/commentwall/css');
// Set up the database
$tables = $db->Metatables();
if (!in_array($CFG->prefix . "commentwall", $tables)) {
if (file_exists($CFG->dirroot . "mod/commentwall/{$CFG->dbtype}.sql")) {
modify_database($CFG->dirroot . "mod/commentwall/{$CFG->dbtype}.sql");
//reload system
header_redirect($CFG->wwwroot);
} else {
error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg commentwall. See the mod/commentwall directory.");
}
print_continue($CFG->wwwroot);
exit;
}
// Add configuration options
$function['userdetails:edit:details'][] = $CFG->dirroot . "mod/commentwall/lib/commentwall_settings.php";
}
示例2: generic_comments_init
function generic_comments_init()
{
global $CFG, $db, $function, $metatags, $template;
$metatags .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}mod/generic_comments/generic_comments.js\"><!-- generic_comments js --></script>";
// create the generic_comments and generic watchlist table
$tables = $db->Metatables();
if (!in_array($CFG->prefix . "comments", $tables) || !in_array($CFG->prefix . "watchlist", $tables)) {
if (file_exists($CFG->dirroot . "mod/generic_comments/{$CFG->dbtype}.sql")) {
modify_database($CFG->dirroot . "mod/generic_comments/{$CFG->dbtype}.sql");
//reload system
header_redirect($CFG->wwwroot);
} else {
error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg generic comments. See the mod/generic_comments directory.");
}
print_continue("index.php");
exit;
}
$function['comments:init'][] = $CFG->dirroot . "mod/generic_comments/comments_actions.php";
$function['permissions:check'][] = $CFG->dirroot . "mod/generic_comments/permissions_check.php";
// Add annotation support
display_set_display_annotation_function("file::file", "generic_comments_displayobjectannotations");
display_set_display_annotation_function("mediastream::media", "generic_comments_displayobjectannotations");
// Register file river hook (if there)
if (function_exists('river_save_event')) {
river_register_friendlyname_hook('file::file', 'generic_comments_get_friendly_name');
}
templates_add_context('embeddedcomments', 'mod/generic_comments/comments');
templates_add_context('embeddedcomment', 'mod/generic_comments/comment');
templates_add_context('css', 'mod/generic_comments/css', true, false);
}
示例3: apply
function apply($discussion, $all, $selected, $formdata)
{
global $COURSE, $USER, $CFG;
// Begin with standard text
$a = (object) array('name' => fullname($USER, true));
$allhtml = "<head>";
foreach ($CFG->stylesheets as $stylesheet) {
$allhtml .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />' . "\n";
}
$allhtml .= "</head>\n<body id='forumng-email'>\n";
$preface = get_string('forward_preface', 'forumng', $a);
$allhtml .= $preface;
$alltext = format_text_email($preface, FORMAT_HTML);
// Include intro if specified
if (!preg_match('~^(<br[^>]*>|<p>|</p>|\\s)*$~', $formdata->message)) {
$alltext .= "\n" . forum_cron::EMAIL_DIVIDER . "\n";
$allhtml .= '<hr size="1" noshade="noshade" />';
// Add intro
$message = trusttext_strip(stripslashes($formdata->message));
$allhtml .= format_text($message, $formdata->format);
$alltext .= format_text_email($message, $formdata->format);
}
// Get list of all post ids in discussion order
$alltext .= "\n" . forum_cron::EMAIL_DIVIDER . "\n";
$allhtml .= '<hr size="1" noshade="noshade" />';
$poststext = '';
$postshtml = '';
$discussion->build_selected_posts_email($selected, $poststext, $postshtml);
$alltext .= $poststext;
$allhtml .= $postshtml . '</body>';
$emails = preg_split('~[; ]+~', $formdata->email);
$subject = stripslashes($formdata->subject);
foreach ($emails as $email) {
$fakeuser = (object) array('email' => $email, 'mailformat' => 1, 'id' => 0);
$from = $USER;
$from->maildisplay = 999;
// Nasty hack required for OU moodle
if (!email_to_user($fakeuser, $from, $subject, $alltext, $allhtml)) {
print_error('error_forwardemail', 'forumng', $formdata->email);
}
}
// Log that it was sent
$discussion->log('forward discussion', $formdata->email);
if (!empty($formdata->ccme)) {
if (!email_to_user($USER, $from, $subject, $alltext, $allhtml)) {
print_error('error_forwardemail', 'forumng', $USER->email);
}
}
$discussion->print_subpage_header($this->get_page_name());
print_box(get_string('forward_done', 'forumng'));
print_continue('../../discuss.php?' . $discussion->get_link_params(forum::PARAM_PLAIN));
print_footer($COURSE);
}
示例4: search_quiz_attempts_regs
/**
*
* Enter description here ...
* @param unknown_type $blended
* @param $USER $user
*/
function search_quiz_attempts_regs($blended, $user)
{
global $DB;
//print_object($USER);
$quiz_attempts = null;
// $quiz_attempts = get_records($table='quiz_attempts', $field='userid', $value=$user->id,'timefinish DESC');
$quiz_attempts = $DB->get_records('quiz_attempts', array('userid' => 'timefinish DESC'));
if ($quiz_attempts == null) {
echo "<center>";
echo 'No se han encontrado cuestionarios evaluados para este usuario.';
echo "</center>";
$continue = "../../course/view.php?id={$blended->course}";
print_continue($continue);
//debugging('No se han encontrado cuestionarios evaluados para este usuario.');
}
return $quiz_attempts;
}
示例5: csverror
function csverror($message, $link = '')
{
global $CFG, $SESSION;
print_header(get_string('error'));
echo '<br />';
$message = clean_text($message);
print_simple_box('<span style="font-family:monospace;color:#000000;">' . $message . '</span>', 'center', '', '#FFBBBB', 5, 'errorbox');
if (!$link) {
if (!empty($SESSION->fromurl)) {
$link = $SESSION->fromurl;
unset($SESSION->fromurl);
} else {
$link = $CFG->wwwroot . '/';
}
}
print_continue($link);
print_footer();
die;
}
示例6: widget_init
function widget_init()
{
global $CFG, $function, $db, $METATABLES;
$function['init'][] = $CFG->dirroot . "mod/widget/init.php";
// Initialise the 'allcontent' widget array - i.e., widgets where Javascript is allowed
if (!isset($CFG->widgets->allcontent)) {
$CFG->widgets->allcontent = array();
}
// register the widgets that this module provides
$CFG->widgets->list[] = array('name' => gettext("Text box"), 'description' => gettext("Displays the text of your choice."), 'type' => "widget::text");
if (!in_array($CFG->prefix . "widget_data", $METATABLES) || !in_array($CFG->prefix . "widgets", $METATABLES)) {
if (file_exists($CFG->dirroot . "mod/widget/{$CFG->dbtype}.sql")) {
modify_database($CFG->dirroot . "mod/widget/{$CFG->dbtype}.sql");
//reload system
header_redirect($CFG->wwwroot);
} else {
error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg widgets. See the mod/widget directory.");
}
print_continue("index.php");
exit;
}
// Delete users
listen_for_event("user", "delete", "widget_user_delete");
}
示例7: optional_param
$search = optional_param('search', '', PARAM_RAW);
$replace = optional_param('replace', '', PARAM_RAW);
###################################################################
admin_externalpage_print_header();
print_heading('Search and replace text throughout the whole database');
if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) {
/// Print a form
print_simple_box_start('center');
echo '<div align="center">';
echo '<form action="replace.php" method="post">';
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
echo 'Search whole database for: <input type="text" name="search" /><br />';
echo 'Replace with this string: <input type="text" name="replace" /><br />';
echo '<input type="submit" value="Yes, do it now" /><br />';
echo '</form>';
echo '</div>';
print_simple_box_end();
admin_externalpage_print_footer();
die;
}
print_simple_box_start('center');
if (!db_replace($search, $replace)) {
error('An error has occured during this process');
}
print_simple_box_end();
/// Rebuild course cache which might be incorrect now
notify('Rebuilding course cache...');
rebuild_course_cache();
notify('...finished');
print_continue('index.php');
admin_externalpage_print_footer();
示例8: upgrade_blocks_plugins
//.........这里部分代码省略.........
notify('Upgrading block ' . $block->name . ' from ' . $currblock->version . ' to ' . $block->version . ' FAILED!');
}
echo '<hr />';
} else {
upgrade_log_start();
error('Version mismatch: block ' . $block->name . ' can\'t downgrade ' . $currblock->version . ' -> ' . $block->version . '!');
}
}
} else {
// block not installed yet, so install it
// If it allows multiples, start with it enabled
if ($blockobj->instance_allow_multiple()) {
$block->multiple = 1;
}
// Set the block cron on install
$block->cron = !empty($blockobj->cron) ? $blockobj->cron : 0;
// [pj] Normally this would be inline in the if, but we need to
// check for NULL (necessary for 4.0.5 <= PHP < 4.2.0)
$conflictblock = array_search($blocktitle, $blocktitles);
if ($conflictblock !== false && $conflictblock !== NULL) {
// Duplicate block titles are not allowed, they confuse people
// AND PHP's associative arrays ;)
error('<strong>Naming conflict</strong>: block <strong>' . $block->name . '</strong> has the same title with an existing block, <strong>' . $conflictblock . '</strong>!');
}
if (empty($updated_blocks)) {
$strblocksetup = get_string('blocksetup');
print_header($strblocksetup, $strblocksetup, build_navigation(array(array('name' => $strblocksetup, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript(), false, ' ', ' ');
}
$updated_blocks = true;
upgrade_log_start();
print_heading($block->name);
$db->debug = true;
@set_time_limit(0);
// To allow slow databases to complete the long SQL
/// Both old .sql files and new install.xml are supported
/// but we priorize install.xml (XMLDB) if present
$status = false;
if (file_exists($fullblock . '/db/install.xml')) {
$status = install_from_xmldb_file($fullblock . '/db/install.xml');
//New method
} else {
if (file_exists($fullblock . '/db/' . $CFG->dbtype . '.sql')) {
$status = modify_database($fullblock . '/db/' . $CFG->dbtype . '.sql');
//Old method
} else {
$status = true;
}
}
$db->debug = false;
if ($status) {
if ($block->id = insert_record('block', $block)) {
$blockobj->after_install();
$component = 'block/' . $block->name;
if (!update_capabilities($component)) {
notify('Could not set up ' . $block->name . ' capabilities!');
}
events_update_definition($component);
notify(get_string('blocksuccess', '', $blocktitle), 'notifysuccess');
echo '<hr />';
} else {
error($block->name . ' block could not be added to the block list!');
}
} else {
error('Block ' . $block->name . ' tables could NOT be set up successfully!');
}
}
$blocktitles[$block->name] = $blocktitle;
}
if (!empty($notices)) {
upgrade_log_start();
foreach ($notices as $notice) {
notify($notice);
}
}
// Finally, if we are in the first_install of BLOCKS (this means that we are
// upgrading from Moodle < 1.3), put blocks in all existing courses.
if ($first_install) {
upgrade_log_start();
//Iterate over each course
if ($courses = get_records('course')) {
foreach ($courses as $course) {
$page = page_create_object(PAGE_COURSE_VIEW, $course->id);
blocks_repopulate_page($page);
}
}
}
if (!empty($CFG->siteblocksadded)) {
/// This is a once-off hack to make a proper upgrade
upgrade_log_start();
$page = page_create_object(PAGE_COURSE_VIEW, SITEID);
blocks_repopulate_page($page);
delete_records('config', 'name', 'siteblocksadded');
}
upgrade_log_finish();
if (!empty($updated_blocks)) {
print_continue($continueto);
print_footer('none');
die;
}
}
示例9: theme_setup
theme_setup($choose);
admin_externalpage_print_header();
print_heading(get_string("themesaved"));
if (file_exists("{$choose}/README.html")) {
print_simple_box_start("center");
readfile("{$choose}/README.html");
print_simple_box_end();
} else {
if (file_exists("{$choose}/README.txt")) {
print_simple_box_start("center");
$file = file("{$choose}/README.txt");
echo format_text(implode('', $file), FORMAT_MOODLE);
print_simple_box_end();
}
}
print_continue("{$CFG->wwwroot}/");
admin_externalpage_print_footer();
exit;
} else {
error("Could not set the theme!");
}
}
admin_externalpage_print_header('themeselector');
print_heading($strthemes);
$themes = get_list_of_plugins("theme");
$sesskey = !empty($USER->id) ? $USER->sesskey : '';
echo "<table style=\"margin-left:auto;margin-right:auto;\" cellpadding=\"7\" cellspacing=\"5\">\n";
if (!$USER->screenreader) {
echo "\t<tr class=\"generaltableheader\">\n\t\t<th scope=\"col\">{$strtheme}</th>\n";
echo "\t\t<th scope=\"col\">{$strinfo}</th>\n\t</tr>\n";
}
示例10: delete_file
function delete_file()
{
global $CFG;
$file = required_param('file', PARAM_FILE);
$userid = required_param('userid', PARAM_INT);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$mode = optional_param('mode', '', PARAM_ALPHA);
$offset = optional_param('offset', 0, PARAM_INT);
require_login($this->course->id, false, $this->cm);
if (empty($mode)) {
$urlreturn = 'view.php';
$optionsreturn = array('id' => $this->cm->id);
$returnurl = 'view.php?id=' . $this->cm->id;
} else {
$urlreturn = 'submissions.php';
$optionsreturn = array('id' => $this->cm->id, 'offset' => $offset, 'mode' => $mode, 'userid' => $userid);
$returnurl = "submissions.php?id={$this->cm->id}&offset={$offset}&mode={$mode}&userid={$userid}";
}
if (!($submission = $this->get_submission($userid)) or !$this->can_delete_files($submission)) {
// can not delete
$this->view_header(get_string('delete'));
notify(get_string('cannotdeletefiles', 'assignment'));
print_continue($returnurl);
$this->view_footer();
die;
}
$dir = $this->file_area_name($userid);
if (!data_submitted('nomatch') or !$confirm or !confirm_sesskey()) {
$optionsyes = array('id' => $this->cm->id, 'file' => $file, 'userid' => $userid, 'confirm' => 1, 'sesskey' => sesskey(), 'mode' => $mode, 'offset' => $offset, 'sesskey' => sesskey());
if (empty($mode)) {
$this->view_header(get_string('delete'));
} else {
print_header(get_string('delete'));
}
print_heading(get_string('delete'));
notice_yesno(get_string('confirmdeletefile', 'assignment', $file), 'delete.php', $urlreturn, $optionsyes, $optionsreturn, 'post', 'get');
if (empty($mode)) {
$this->view_footer();
} else {
print_footer('none');
}
die;
}
$filepath = $CFG->dataroot . '/' . $dir . '/' . $file;
if (file_exists($filepath)) {
if (@unlink($filepath)) {
$updated = new object();
$updated->id = $submission->id;
$updated->timemodified = time();
if (update_record('assignment_submissions', $updated)) {
add_to_log($this->course->id, 'assignment', 'upload', 'view.php?a=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
$submission = $this->get_submission($userid);
$this->update_grade($submission);
}
redirect($returnurl);
}
}
// print delete error
if (empty($mode)) {
$this->view_header(get_string('delete'));
} else {
print_header(get_string('delete'));
}
notify(get_string('deletefilefailed', 'assignment'));
print_continue($returnurl);
if (empty($mode)) {
$this->view_footer();
} else {
print_footer('none');
}
die;
}
示例11: stdClass
if ($PermissionGranted) {
$dbentry = new stdClass();
$dbentry->id = $entry->id;
$dbentry->glossaryid = $mainglossary->id;
$dbentry->sourceglossaryid = $glossary->id;
if (!update_record('glossary_entries', $dbentry)) {
error('Could not export the entry to the main glossary');
} else {
print_simple_box_start('center', '60%');
echo '<p align="center"><font size="3">' . $entryexported . '</font></p></font>';
print_continue('view.php?id=' . $cm->id . '&mode=entry&hook=' . $entry->id);
print_simple_box_end();
print_footer();
redirect('view.php?id=' . $cm->id . '&mode=entry&hook=' . $entry->id);
die;
}
} else {
print_simple_box_start('center', '60%', '#FFBBBB');
echo '<p align="center"><font size="3">' . $entryalreadyexist . '</font></p></font>';
echo '<p align="center">';
print_continue('view.php?id=' . $cm->id . '&mode=entry&hook=' . $entry->id);
print_simple_box_end();
}
}
} else {
print_simple_box_start('center', '60%', '#FFBBBB');
notice('A weird error was found while trying to export this entry. Operation cancelled.');
print_continue('view.php?id=' . $cm->id . '&mode=entry&hook=' . $entry->id);
print_simple_box_end();
}
print_footer();
示例12: wiki_export_html
function wiki_export_html(&$WS)
{
global $CFG;
check_dir_exists("{$CFG->dataroot}/temp", true);
check_dir_exists("{$CFG->dataroot}/temp/html", true);
check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}", true);
check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/atachments", true);
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}", true);
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata", true);
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}", true);
//export contents
wiki_export_html_content($WS);
//export attached files
$flist = list_directories_and_files("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}");
if ($flist != null) {
foreach ($flist as $fil) {
$from_file = "{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}/{$fil}";
$to_file = "{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/atachments/{$fil}";
copy($from_file, $to_file);
}
}
//zip file name
$times = time();
$name = $WS->dfwiki->name . '-' . $times . '.zip';
$cleanzipname = clean_filename($name);
//List of files and directories
$filelist = list_directories_and_files("{$CFG->dataroot}/temp/html");
//Convert them to full paths
$files = array();
if ($filelist != null) {
foreach ($filelist as $file) {
$files[] = "{$CFG->dataroot}/temp/html/{$file}";
}
}
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}", true);
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/exportedhtml", true);
$destination = "{$CFG->dataroot}/{$WS->dfwiki->course}/exportedhtml/{$cleanzipname}";
$status = zip_files($files, $destination);
//delete the folder created in temp
$filelist2 = list_directories_and_files("{$CFG->dataroot}/temp/html");
if ($filelist2 != null) {
$del = delete_dir_contents("{$CFG->dataroot}/temp/html");
}
//show it all to be albe to download the file
$prop = null;
$prop->class = "textcenter";
wiki_div_start($prop);
wiki_size_text(get_string("exporthtmlcorrectly", "wiki"), 2);
wiki_div_end();
$prop = null;
$prop->border = "0";
$prop->class = "boxaligncenter";
$prop->classtd = "nwikileftnow";
wiki_table_start($prop);
$wdir = '/exportedhtml';
$fileurl = "{$wdir}/{$cleanzipname}";
$ffurl = "/file.php?file=/{$WS->cm->course}{$fileurl}";
$icon = mimeinfo("icon", $cleanzipname);
link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" alt=\"File\" />", 480, 640);
echo "\n" . ' ';
link_to_popup_window($ffurl, "display", htmlspecialchars($cleanzipname), 480, 640);
$prop = null;
$prop->class = "nwikileftnow";
wiki_change_row($prop);
echo ' ';
wiki_table_end();
$prop = null;
$prop->border = "0";
$prop->class = "boxaligncenter";
$prop->classtd = "nwikileftnow";
wiki_table_start($prop);
$prop = null;
$prop->id = "form";
$prop->method = "post";
$prop->action = '../xml/index.php?id=' . $WS->dfwiki->course . '&wdir=/exportedhtml';
wiki_form_start($prop);
wiki_div_start();
$prop = null;
$prop->name = "dfform[viewexported]";
$prop->value = get_string('viewexported', 'wiki');
wiki_input_submit($prop);
wiki_div_end();
wiki_form_end();
wiki_change_column();
print_continue("{$CFG->wwwroot}/mod/wiki/view.php?id={$WS->cm->id}");
wiki_table_end();
}
示例13: grade_import_commit
/**
* given an import code, commits all entries in buffer tables
* (grade_import_value and grade_import_newitem)
* If this function is called, we assume that all data collected
* up to this point is fine and we can go ahead and commit
* @param int courseid - id of the course
* @param string importcode - import batch identifier
* @param feedback print feedback and continue button
* @return bool success
*/
function grade_import_commit($courseid, $importcode, $importfeedback = true, $verbose = true)
{
global $CFG, $USER, $DB;
$commitstart = time();
// start time in case we need to roll back
$newitemids = array();
// array to hold new grade_item ids from grade_import_newitem table, mapping array
/// first select distinct new grade_items with this batch
$params = array($importcode, $USER->id);
if ($newitems = $DB->get_records_sql("SELECT *\n FROM {grade_import_newitem}\n WHERE importcode = ? AND importer=?", $params)) {
// instances of the new grade_items created, cached
// in case grade_update fails, so that we can remove them
$instances = array();
$failed = false;
foreach ($newitems as $newitem) {
// get all grades with this item
if ($grades = $DB->get_records('grade_import_values', array('newgradeitem' => $newitem->id))) {
/// create a new grade item for this - must use false as second param!
/// TODO: we need some bounds here too
$gradeitem = new grade_item(array('courseid' => $courseid, 'itemtype' => 'manual', 'itemname' => $newitem->itemname), false);
$gradeitem->insert('import');
$instances[] = $gradeitem;
// insert each individual grade to this new grade item
foreach ($grades as $grade) {
if (!$gradeitem->update_final_grade($grade->userid, $grade->finalgrade, 'import', $grade->feedback, FORMAT_MOODLE)) {
$failed = true;
break 2;
}
}
}
}
if ($failed) {
foreach ($instances as $instance) {
$gradeitem->delete('import');
}
import_cleanup($importcode);
return false;
}
}
/// then find all existing items
if ($gradeitems = $DB->get_records_sql("SELECT DISTINCT (itemid)\n FROM {grade_import_values}\n WHERE importcode = ? AND importer=? AND itemid > 0", array($importcode, $USER->id))) {
$modifieditems = array();
foreach ($gradeitems as $itemid => $notused) {
if (!($gradeitem = new grade_item(array('id' => $itemid)))) {
// not supposed to happen, but just in case
import_cleanup($importcode);
return false;
}
// get all grades with this item
if ($grades = $DB->get_records('grade_import_values', array('itemid' => $itemid))) {
// make the grades array for update_grade
foreach ($grades as $grade) {
if (!$importfeedback) {
$grade->feedback = false;
// ignore it
}
if (!$gradeitem->update_final_grade($grade->userid, $grade->finalgrade, 'import', $grade->feedback)) {
$failed = 1;
break 2;
}
}
//$itemdetails -> idnumber = $gradeitem->idnumber;
$modifieditems[] = $itemid;
}
if (!empty($failed)) {
import_cleanup($importcode);
return false;
}
}
}
if ($verbose) {
notify(get_string('importsuccess', 'grades'), 'notifysuccess');
$unenrolledusers = get_unenrolled_users_in_import($importcode, $courseid);
if ($unenrolledusers) {
$list = "<ul>\n";
foreach ($unenrolledusers as $u) {
$u->fullname = fullname($u);
$list .= '<li>' . get_string('usergrade', 'grades', $u) . '</li>';
}
$list .= "</ul>\n";
notify(get_string('unenrolledusersinimport', 'grades', $list), 'notifysuccess');
}
print_continue($CFG->wwwroot . '/grade/index.php?id=' . $courseid);
}
// clean up
import_cleanup($importcode);
return true;
}
示例14: get_record_sql
/**
* Get a single record as an object using the specified SQL statement
*
* A LIMIT is normally added to only look for 1 record
* If debugging is OFF only the first record is returned even if there is
* more than one matching record!
*
* @uses $CFG
* @uses $db
* @param string $sql The SQL string you wish to be executed.
* @param array $values If using placeholder ?s in the $sql, pass values here.
* @return Found record as object. False if not found or error
*/
function get_record_sql($sql, $values = null, $expectmultiple = false, $nolimit = false)
{
global $db, $CFG;
if (isset($CFG->debug) && $CFG->debug > 7 && !$expectmultiple) {
// Debugging mode - don't use limit
$limit = '';
} else {
if ($nolimit) {
$limit = '';
} else {
$limit = ' LIMIT 1';
// Workaround - limit to one record
}
}
if (defined('ELGG_PERFDB')) {
global $PERF;
$PERF->dbqueries++;
}
$rs = false;
if (!empty($values) && is_array($values) && count($values) > 0) {
$stmt = $db->Prepare($sql . $limit);
$rs = $db->Execute($stmt, $values);
} else {
$rs = $db->Execute($sql . $limit);
}
if (!$rs) {
if (isset($CFG->debug) and $CFG->debug > 7) {
// Debugging mode - print checks
notify($db->ErrorMsg() . '<br /><br />' . $sql . $limit);
}
if (!empty($CFG->dblogerror)) {
$debug = debug_backtrace();
foreach ($debug as $d) {
if (strpos($d['file'], 'datalib') === false) {
error_log("SQL " . $db->ErrorMsg() . " in {$d['file']} on line {$d['line']}. STATEMENT: {$sql}{$limit}");
break;
}
}
}
return false;
}
if (!($recordcount = $rs->RecordCount())) {
return false;
// Found no records
}
if ($recordcount == 1) {
// Found one record
return (object) $rs->fields;
} else {
// Error: found more than one record
notify('Error: Turn off debugging to hide this error.');
notify($sql . $limit);
if ($records = $rs->GetAssoc(true)) {
notify('Found more than one record in get_record_sql !');
print_object($records);
} else {
notify('Very strange error in get_record_sql !');
print_object($rs);
}
print_continue("{$CFG->wwwroot}/{$CFG->admin}/config.php");
}
}
示例15: error
}
if (!$qformat->exportpostprocess()) {
// In case anything needs to be done after
error($txt->exporterror, "{$CFG->wwwroot}/question/export.php?courseid={$course->id}&category={$category->id}");
}
echo "<hr />";
// link to download the finished file
$file_ext = $qformat->export_file_extension();
if ($CFG->slasharguments) {
$efile = "{$CFG->wwwroot}/file.php/" . $qformat->question_get_export_dir() . "/{$exportfilename}" . $file_ext . "?forcedownload=1";
} else {
$efile = "{$CFG->wwwroot}/file.php?file=/" . $qformat->question_get_export_dir() . "/{$exportfilename}" . $file_ext . "&forcedownload=1";
}
echo "<p><div class=\"boxaligncenter\"><a href=\"{$efile}\">{$txt->download}</a></div></p>";
echo "<p><div class=\"boxaligncenter\"><font size=\"-1\">{$txt->downloadextra}</font></div></p>";
print_continue("edit.php?courseid={$course->id}");
print_footer($course);
exit;
}
/// Display upload form
// get valid formats to generate dropdown list
$fileformatnames = get_import_export_formats('export');
// get filename
if (empty($exportfilename)) {
$exportfilename = default_export_filename($course, $category);
}
print_heading_with_help($txt->exportquestions, 'export', 'quiz');
print_box_start('generalbox boxwidthnormal boxaligncenter');
?>
<form enctype="multipart/form-data" method="post" action="export.php">