当前位置: 首页>>代码示例>>PHP>>正文


PHP print_error函数代码示例

本文整理汇总了PHP中print_error函数的典型用法代码示例。如果您正苦于以下问题:PHP print_error函数的具体用法?PHP print_error怎么用?PHP print_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: not_found

function not_found($courseid)
{
    global $CFG;
    header('HTTP/1.0 404 not found');
    print_error('filenotfound', 'error', $CFG->wwwroot . '/course/view.php?id=' . $courseid);
    //this is not displayed on IIS??
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:7,代码来源:sendfile.php

示例2: user_signup

 /**
  * Sign up a new user ready for confirmation.
  * Password is passed in plaintext.
  *
  * @param object $user new user object
  * @param boolean $notify print notice with link and terminate
  */
 function user_signup($user, $notify = true)
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/user/profile/lib.php';
     $user->password = hash_internal_user_password($user->password);
     $user->id = $DB->insert_record('user', $user);
     /// Save any custom profile field information
     profile_save_data($user);
     $user = $DB->get_record('user', array('id' => $user->id));
     events_trigger('user_created', $user);
     if (!send_confirmation_email($user)) {
         print_error('auth_emailnoemail', 'auth_email');
     }
     if ($notify) {
         global $CFG, $PAGE, $OUTPUT;
         $emailconfirm = get_string('emailconfirm');
         $PAGE->navbar->add($emailconfirm);
         $PAGE->set_title($emailconfirm);
         $PAGE->set_heading($PAGE->course->fullname);
         echo $OUTPUT->header();
         notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
     } else {
         return true;
     }
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:32,代码来源:auth.php

示例3: moodleform_mod

 function moodleform_mod($current, $section, $cm, $course)
 {
     global $CFG;
     $this->current = $current;
     $this->_instance = $current->instance;
     $this->_section = $section;
     $this->_cm = $cm;
     if ($this->_cm) {
         $this->context = context_module::instance($this->_cm->id);
     } else {
         $this->context = context_course::instance($course->id);
     }
     // Set the course format.
     require_once $CFG->dirroot . '/course/format/lib.php';
     $this->courseformat = course_get_format($course);
     // Guess module name
     $matches = array();
     if (!preg_match('/^mod_([^_]+)_mod_form$/', get_class($this), $matches)) {
         debugging('Use $modname parameter or rename form to mod_xx_mod_form, where xx is name of your module');
         print_error('unknownmodulename');
     }
     $this->_modname = $matches[1];
     $this->init_features();
     parent::moodleform('modedit.php');
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:25,代码来源:moodleform_mod.php

示例4: definition

 function definition()
 {
     global $CFG, $DB;
     $mform =& $this->_form;
     $strrequired = get_string('required');
     //-------------------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('name'), array('size' => '64'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     if (!($options = $DB->get_records_menu("survey", array("template" => 0), "name", "id, name"))) {
         print_error('cannotfindsurveytmpt', 'survey');
     }
     foreach ($options as $id => $name) {
         $options[$id] = get_string($name, "survey");
     }
     $options = array('' => get_string('choose') . '...') + $options;
     $mform->addElement('select', 'template', get_string("surveytype", "survey"), $options);
     $mform->addRule('template', $strrequired, 'required', null, 'client');
     $mform->addHelpButton('template', 'surveytype', 'survey');
     $this->standard_intro_elements(get_string('customintro', 'survey'));
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------------------------------
     // buttons
     $this->add_action_buttons();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:30,代码来源:mod_form.php

示例5: question_attempt_not_found

function question_attempt_not_found()
{
    global $CFG;
    header('HTTP/1.0 404 not found');
    print_error('filenotfound', 'error', $CFG->wwwroot);
    //this is not displayed on IIS??
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:7,代码来源:file.php

示例6: quiz_create_attempt

/**
 * Creates an object to represent a new attempt at a quiz
 *
 * Creates an attempt object to represent an attempt at the quiz by the current
 * user starting at the current time. The ->id field is not set. The object is
 * NOT written to the database.
 *
 * @param object $quiz the quiz to create an attempt for.
 * @param int $attemptnumber the sequence number for the attempt.
 * @param object $lastattempt the previous attempt by this user, if any. Only needed
 *         if $attemptnumber > 1 and $quiz->attemptonlast is true.
 * @param int $timenow the time the attempt was started at.
 * @param bool $ispreview whether this new attempt is a preview.
 *
 * @return object the newly created attempt object.
 */
function quiz_create_attempt($quiz, $attemptnumber, $lastattempt, $timenow, $ispreview = false)
{
    global $USER;
    if ($attemptnumber == 1 || !$quiz->attemptonlast) {
        // We are not building on last attempt so create a new attempt.
        $attempt = new stdClass();
        $attempt->quiz = $quiz->id;
        $attempt->userid = $USER->id;
        $attempt->preview = 0;
        $attempt->layout = quiz_clean_layout($quiz->questions, true);
        if ($quiz->shufflequestions) {
            $attempt->layout = quiz_repaginate($attempt->layout, $quiz->questionsperpage, true);
        }
    } else {
        // Build on last attempt.
        if (empty($lastattempt)) {
            print_error('cannotfindprevattempt', 'quiz');
        }
        $attempt = $lastattempt;
    }
    $attempt->attempt = $attemptnumber;
    $attempt->timestart = $timenow;
    $attempt->timefinish = 0;
    $attempt->timemodified = $timenow;
    // If this is a preview, mark it as such.
    if ($ispreview) {
        $attempt->preview = 1;
    }
    return $attempt;
}
开发者ID:rosenclever,项目名称:moodle,代码行数:46,代码来源:locallib.php

示例7: open

 function open()
 {
     if ($this->_debug) {
         echo "Connecting to host ";
     }
     $host = $this->_hostname;
     $port = $this->_port;
     if ($this->_debug) {
         echo "[{$host}:{$port}]..";
     }
     // open the connection to the FirstClass server
     $conn = fsockopen($host, $port, $errno, $errstr, 5);
     if (!$conn) {
         print_error('auth_fcconnfail', 'auth_fc', '', array($errno, $errstr));
         return false;
     }
     // We are connected
     if ($this->_debug) {
         echo "connected!";
     }
     // Read connection message.
     $line = fgets($conn);
     //+0
     $line = fgets($conn);
     //new line
     // store the connection in this class, so we can use it later
     $this->_conn =& $conn;
     return true;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:29,代码来源:fcFPP.php

示例8: game_millionaire_html_getquestions

/**
 * This page export the game millionaire to html
 * 
 * @author  bdaloukas
 * @version $Id: exporthtml_millionaire.php,v 1.14 2012/07/25 11:16:03 bdaloukas Exp $
 * @package game
 **/
function game_millionaire_html_getquestions($game, $context, &$maxanswers, &$countofquestions, &$retfeedback, $destdir, &$files)
{
    global $CFG, $DB, $USER;
    $maxanswers = 0;
    $countofquestions = 0;
    $files = array();
    if ($game->sourcemodule != 'quiz' and $game->sourcemodule != 'question') {
        print_error(get_string('millionaire_sourcemodule_must_quiz_question', 'game', get_string('modulename', 'quiz')) . ' ' . get_string('modulename', $game->sourcemodule));
    }
    if ($game->sourcemodule == 'quiz') {
        if ($game->quizid == 0) {
            print_error(get_string('must_select_quiz', 'game'));
        }
        $select = "qtype='multichoice' AND quiz='{$game->quizid}' " . " AND qqi.question=q.id";
        $table = "{question} q,{quiz_question_instances} qqi";
    } else {
        if ($game->questioncategoryid == 0) {
            print_error(get_string('must_select_questioncategory', 'game'));
        }
        //include subcategories
        $select = 'category=' . $game->questioncategoryid;
        if ($game->subcategories) {
            $cats = question_categorylist($game->questioncategoryid);
            if (strpos($cats, ',') > 0) {
                $select = 'category in (' . $cats . ')';
            }
        }
        $select .= " AND qtype='multichoice'";
        $table = "{question} q";
    }
    $select .= " AND q.hidden=0";
    $sql = "SELECT q.id as id, q.questiontext FROM {$table} WHERE {$select}";
    $recs = $DB->get_records_sql($sql);
    $ret = '';
    $retfeedback = '';
    foreach ($recs as $rec) {
        $recs2 = $DB->get_records('question_answers', array('question' => $rec->id), 'fraction DESC', 'id,answer,feedback');
        //Must parse the questiontext and get the name of files.
        $line = $rec->questiontext;
        $line = game_export_split_files($game->course, $context, 'questiontext', $rec->id, $rec->questiontext, $destdir, $files);
        $linefeedback = '';
        foreach ($recs2 as $rec2) {
            $line .= '#' . str_replace(array('"', '#'), array("'", ' '), game_export_split_files($game->course, $context, 'answer', $rec2->id, $rec2->answer, $destdir, $files));
            $linefeedback .= '#' . str_replace(array('"', '#'), array("'", ' '), $rec2->feedback);
        }
        if ($ret != '') {
            $ret .= ",\r";
        }
        $ret .= '"' . base64_encode($line) . '"';
        if ($retfeedback != '') {
            $retfeedback .= ",\r";
        }
        $retfeedback .= '"' . base64_encode($linefeedback) . '"';
        if (count($recs2) > $maxanswers) {
            $maxanswers = count($recs2);
        }
        $countofquestions++;
    }
    return $ret;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:67,代码来源:exporthtml_millionaire.php

示例9: get_userinfo

 /**
  * Returns the user information for 'external' users. In this case the
  * attributes provided by Shibboleth
  *
  * @return array $result Associative array of user data
  */
 function get_userinfo($username)
 {
     // reads user information from shibboleth attributes and return it in array()
     global $CFG;
     // Check whether we have got all the essential attributes
     if (empty($_SERVER[$this->config->user_attribute])) {
         print_error('shib_not_all_attributes_error', 'auth', '', "'" . $this->config->user_attribute . "' ('" . $_SERVER[$this->config->user_attribute] . "'), '" . $this->config->field_map_firstname . "' ('" . $_SERVER[$this->config->field_map_firstname] . "'), '" . $this->config->field_map_lastname . "' ('" . $_SERVER[$this->config->field_map_lastname] . "') and '" . $this->config->field_map_email . "' ('" . $_SERVER[$this->config->field_map_email] . "')");
     }
     $attrmap = $this->get_attributes();
     $result = array();
     $search_attribs = array();
     foreach ($attrmap as $key => $value) {
         // Check if attribute is present
         if (!isset($_SERVER[$value])) {
             $result[$key] = '';
             continue;
         }
         // Make usename lowercase
         if ($key == 'username') {
             $result[$key] = strtolower($this->get_first_string($_SERVER[$value]));
         } else {
             $result[$key] = $this->get_first_string($_SERVER[$value]);
         }
     }
     // Provide an API to modify the information to fit the Moodle internal
     // data representation
     if ($this->config->convert_data && $this->config->convert_data != '' && is_readable($this->config->convert_data)) {
         // Include a custom file outside the Moodle dir to
         // modify the variable $moodleattributes
         include $this->config->convert_data;
     }
     return $result;
 }
开发者ID:r007,项目名称:PMoodle,代码行数:39,代码来源:auth.php

示例10: execute

 public function execute()
 {
     global $DB;
     $action = $this->arguments[0];
     $modulename = $this->arguments[1];
     // name of the module (in English)
     // Does module exists?
     if (!empty($modulename)) {
         if (!($module = $DB->get_record('modules', array('name' => $modulename)))) {
             print_error('moduledoesnotexist', 'error');
         }
     }
     switch ($action) {
         case 'show':
             $DB->set_field('modules', 'visible', '1', array('id' => $module->id));
             // Show module.
             break;
         case 'hide':
             $DB->set_field('modules', 'visible', '0', array('id' => $module->id));
             // Hide module.
             break;
         case 'delete':
             // Delete module from DB. Should we also delete it from disk?
             if ($this->expandedOptions['force']) {
                 // Delete module from disk too!
             }
             break;
     }
 }
开发者ID:dariogs,项目名称:moosh,代码行数:29,代码来源:ModuleManage.php

示例11: resource_base

 /**
  * Constructor for the base resource class
  *
  * Constructor for the base resource class.
  * If cmid is set create the cm, course, resource objects.
  * and do some checks to make sure people can be here, and so on.
  *
  * @param cmid   integer, the current course module id - not set for new resources
  */
 function resource_base($cmid = 0)
 {
     global $CFG, $COURSE, $DB;
     $this->navlinks = array();
     if ($cmid) {
         if (!($this->cm = get_coursemodule_from_id('resource', $cmid))) {
             print_error('invalidcoursemodule');
         }
         if (!($this->course = $DB->get_record("course", array("id" => $this->cm->course)))) {
             print_error('coursemisconf');
         }
         if (!($this->resource = $DB->get_record("resource", array("id" => $this->cm->instance)))) {
             print_error('invalidid', 'resource');
         }
         $this->strresource = get_string("modulename", "resource");
         $this->strresources = get_string("modulenameplural", "resource");
         if (!$this->cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $this->cm->id))) {
             $pagetitle = strip_tags($this->course->shortname . ': ' . $this->strresource);
             $navigation = build_navigation($this->navlinks, $this->cm);
             print_header($pagetitle, $this->course->fullname, $navigation, "", "", true, '', navmenu($this->course, $this->cm));
             notice(get_string("activityiscurrentlyhidden"), "{$CFG->wwwroot}/course/view.php?id={$this->course->id}");
         }
     } else {
         $this->course = $COURSE;
     }
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:35,代码来源:lib.php

示例12: load_options

 /**
  * Loads the $options array into class properties
  * Possible options (these options are in addition to the standard autocomplete options
  *
  * contextlevel               The ELIS context level to search.possible values: 1001-1006
  *
  * instance fields            A list of fields from the instance table to search on. This should be an array like
  *                            (fieldname => label). For example array('idnumber'=>'IDNumber','firstname'=>'First Name')
  *
  * forced_custom_field_vals   An array like field_shortname => value that can be used to restrict results to
  *                            ones that have specific values for specific custom fields. Note that any fields
  *                            you enter here MUST be valid fields for the specified context level, and must be
  *                            included in the 'custom_fields' option (or have the 'custom_fields' set to '*')
  *
  * custom_fields              A list of the shortnames of custom fields to allow for searching. Note that this is NOT
  *                            the fields which will end up being searched/displayed - but those available for searching.
  *                            The actual list of fields to search/display is configured by an administration using
  *                            the configuration interface.
  *                            This can be an array of field shortnames, or '*' for all applicable fields.
  *
  * @param  array  $options   The options array passed into the class
  */
 public function load_options($options)
 {
     global $CFG, $DB;
     //instance fields - fields to search from the instance's table
     if (!isset($options['instance_fields'])) {
         print_error('autocomplete_noinstance', 'local_elisprogram');
     }
     $this->instance_fields = $options['instance_fields'];
     //get instance contextid
     if (!isset($options['contextlevel']) || !isset($this->context_level_map[$options['contextlevel']])) {
         print_error('autocomplete_nocontext', 'local_elisprogram');
     }
     $this->instancetable = $this->tablemap[$this->context_level_map[$options['contextlevel']]];
     $this->contextlevel = $options['contextlevel'];
     if (!empty($options['forced_custom_field_vals']) && is_array($options['forced_custom_field_vals'])) {
         $this->forced_custom_vals = $options['forced_custom_field_vals'];
     }
     //fetch info for custom fields
     if (!empty($options['custom_fields']) && (is_array($options['custom_fields']) || $options['custom_fields'] === '*')) {
         $sql = 'SELECT f.id, f.name, f.shortname, f.datatype ' . 'FROM {local_eliscore_field} f' . ' JOIN {local_eliscore_field_clevels} c ON c.fieldid=f.id' . ' WHERE (f.datatype="char" OR f.datatype="text") AND c.contextlevel=' . $options['contextlevel'];
         if (is_array($options['custom_fields'])) {
             $ids = implode('","', $options['custom_fields']);
             $sql .= ' AND f.shortname IN ("' . $ids . '")';
         }
         $custom_fields = $DB->get_records_sql($sql);
         if (is_array($custom_fields)) {
             foreach ($custom_fields as $field) {
                 $field_info = array('fieldid' => $field->id, 'label' => $field->name, 'shortname' => $field->shortname, 'datatype' => $field->datatype);
                 $this->custom_fields[$field->shortname] = $field_info;
             }
         }
     }
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:55,代码来源:autocomplete_eliswithcustomfields.php

示例13: cegep_sisdb_init

function cegep_sisdb_init()
{
    global $CFG, $enroldb, $sisdb, $sisdbsource;
    // Verify if external database enrolment is enabled
    if (!in_array('database', explode(',', $CFG->enrol_plugins_enabled))) {
        print_error('errorenroldbnotavailable', 'block_cegep');
    }
    // Prepare external enrolment database connection
    if ($enroldb = enroldb_connect()) {
        $enroldb->Execute("SET NAMES 'utf8'");
    } else {
        error_log('[ENROL_DB] Could not make a connection');
        print_error('dbconnectionfailed', 'error');
    }
    // Prepare external SIS database connection
    if ($sisdb = sisdb_connect()) {
        $sisdb->Execute("SET NAMES 'utf8'");
    } else {
        error_log('[SIS_DB] Could not make a connection');
        print_error('dbconnectionfailed', 'error');
    }
    // Prepare external SIS source database connection
    if ($sisdbsource = sisdbsource_connect()) {
        //$sisdbsource->Execute("SET NAMES 'utf8'");
    } else {
        error_log('[SIS_DB_SOURCE] Could not make a connection');
        print_error('dbconnectionfailed', 'error');
    }
}
开发者ID:jcharaoui,项目名称:moodle-cegep,代码行数:29,代码来源:lib.php

示例14: organizer_make_infobox

function organizer_make_infobox($params, $organizer, $context, &$popups)
{
    global $PAGE;
    user_preference_allow_ajax_update('mod_organizer_showpasttimeslots', PARAM_BOOL);
    user_preference_allow_ajax_update('mod_organizer_showmyslotsonly', PARAM_BOOL);
    user_preference_allow_ajax_update('mod_organizer_showfreeslotsonly', PARAM_BOOL);
    $PAGE->requires->js_init_call('M.mod_organizer.init_infobox');
    $output = '';
    if ($organizer->alwaysshowdescription || time() > $organizer->allowregistrationsfromdate) {
        $output = organizer_make_description_section($organizer);
    }
    switch ($params['mode']) {
        case ORGANIZER_TAB_APPOINTMENTS_VIEW:
            break;
        case ORGANIZER_TAB_STUDENT_VIEW:
            $output .= organizer_make_myapp_section($params, $organizer, organizer_get_last_user_appointment($organizer), $popups);
            break;
        case ORGANIZER_TAB_REGISTRATION_STATUS_VIEW:
            $output .= organizer_make_reminder_section($params, $context);
            break;
        default:
            print_error("Wrong view mode: {$params['mode']}");
    }
    $output .= organizer_make_slotoptions_section($params);
    $output .= organizer_make_messages_section($params);
    return $output;
}
开发者ID:nmisic,项目名称:moodle-mod_organizer,代码行数:27,代码来源:infobox.php

示例15: execute_query

 public function execute_query($sql, $cursortype = SQLSRV_CURSOR_FORWARD)
 {
     $sqldirective = strtoupper(substr($sql, 0, strpos($sql, ' ')));
     switch ($sqldirective) {
         case 'SELECT':
             $type = SQL_QUERY_SELECT;
             break;
         case 'INSERT':
             $type = SQL_QUERY_INSERT;
             break;
         case 'UPDATE':
             $type = SQL_QUERY_UPDATE;
             break;
         case 'DELETE':
             $type = SQL_QUERY_UPDATE;
             break;
         default:
             print_error('unknownsqldirective', 'block_vmoodle');
             return false;
     }
     $this->query_start($sql, null, $type);
     $result = sqlsrv_query($this->sqlsrv, $sql, null, array('Scrollable' => $cursortype));
     $this->query_end($result);
     return $result;
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:25,代码来源:sqlsrv_itop_moodle_database.php


注:本文中的print_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。