本文整理汇总了PHP中print_object函数的典型用法代码示例。如果您正苦于以下问题:PHP print_object函数的具体用法?PHP print_object怎么用?PHP print_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: game_importsnakes_do
function game_importsnakes_do($newrec)
{
if (!insert_record('game_snakes_database', $newrec)) {
print_object($newrec);
error("Can't insert to table game_snakes_database");
}
}
示例2: update_questionbank
function update_questionbank()
{
global $USER, $FULLME;
$myurl = new moodle_url($FULLME);
$myurl->param('first', 'second');
//print_object($myurl->get_query_string());
//notice('die please');
$qid = optional_param('qid', null);
$theQuestion = optional_param('question', null);
if (empty($theQuestion)) {
return;
}
$question = get_record('memorybank_bank', 'id', $qid);
print_object($question);
$question->question = optional_param('question', null);
$question->answer = optional_param('answer', null);
$question->reference = optional_param('reference', null);
$question->initialgrade = optional_param('initialgrade', 4);
$question->category = optional_param('category', 0);
$question->visible = optional_param('visible', 0);
$initviewtime = optional_param('initviewtime', 0);
$question->initviewtime = make_timestamp($initviewtime['year'], $initviewtime['month'], $initviewtime['day'], $initviewtime['hour'], $initviewtime['minute']);
$question->modifiedby = $USER->id;
$question->timemodified = time();
print_object($question);
update_record('memorybank_bank', $question);
}
示例3: game_insert_category_and_question_ids
function game_insert_category_and_question_ids($course, $backup_unique_code, $instances = null)
{
global $CFG;
// Insert categories used by games
$sql = "SELECT DISTINCT g.questioncategoryid as id\n FROM {$CFG->prefix}game g\n WHERE g.course={$course}";
if (($recs = get_records_sql($sql)) == false) {
return true;
}
$status = true;
$table = 'question_categories';
foreach ($recs as $rec) {
if ($rec->id == 0) {
continue;
}
$select = "backup_code='{$backup_unique_code}' AND table_name='{$table}' AND old_id = '{$rec->id}'";
if (($found = get_record_select('backup_ids', $select)) != false) {
continue;
}
unset($newrec);
$newrec->backup_code = $backup_unique_code;
$newrec->table_name = $table;
$newrec->old_id = $rec->id;
$newrec->info = '';
if (!insert_record('backup_ids', $newrec)) {
print_object($newrec);
error("game_insert_category_and_question_ids: Can't insert to backup_ids");
}
}
return $status;
}
示例4: game_importsnakes_do
function game_importsnakes_do($newrec)
{
global $DB;
if (!$DB->insert_record('game_snakes_database', $newrec)) {
print_object($newrec);
print_error("Can't insert to table game_snakes_database");
}
}
示例5: local_course_notification_cron
function local_course_notification_cron()
{
global $DB;
$runtime = time();
echo "Running course notification cron at " . date('D M Y h:m:s', $runtime) . "\n";
// Generate automatic reports.
// Training reaching lifetime/expired.
if ($checkcourses = $DB->get_records_sql('SELECT * from {local_course_notification} where expiryduration!=0')) {
// We have some courses which we need to check against.
foreach ($checkcourses as $checkcourse) {
$course = $DB->get_record('course', array('id' => $checkcourse->courseid));
if (!$course->visible) {
// Don not send course notification for inactive course
continue;
}
$expiredtext = "";
$expiringtext = "";
$latetext = "";
echo "Get completion information for course: {$checkcourse->courseid} of company: {$checkcourse->companyid} \n";
$sql = 'SELECT cc.* FROM {course_completions} cc' . ' JOIN {company_users} cu ON cu.userid = cc.userid ' . 'WHERE cc.course=:courseid AND cu.companyid = :companyid';
$company = $DB->get_record('company', array('id' => $checkcourse->companyid, 'suspended' => 0));
if (!$company) {
echo "Either Company not exist or suspended";
continue;
}
if ($coursecompletions = $DB->get_records_sql($sql, array('courseid' => $checkcourse->courseid, 'companyid' => $checkcourse->companyid))) {
print_object($coursecompletions);
// Get the course information.
foreach ($coursecompletions as $completion) {
if (!empty($completion->timeenrolled) && empty($completion->timecompleted)) {
$user = $DB->get_record('user', array('id' => $completion->userid));
// Send course overdue email to user
/* echo "current time:-" . $runtime;
echo "<br>Timeenrol:-" . $completion->timeenrolled;
echo "<br>expiryduration:-" . $checkcourse->expiryduration;
echo "<br>warnexpire:-" . $checkcourse->warnexpire;
echo "warncourseoverdue:-" . $checkcourse->warncourseoverdue; */
if ($checkcourse->warncourseoverdue && $completion->timeenrolled + $checkcourse->expiryduration < $runtime && $runtime <= $completion->timeenrolled + $checkcourse->expiryduration + $checkcourse->warncourseoverdue) {
echo "<br>Sending course overdue email to {$user->email} \n";
EmailTemplate::send('expire', array('course' => $course, 'user' => $user));
/*$expiredtext .= $user->firstname . ' ' . $user->lastname . ', ' . $user->email . ' - ' .
date('D M Y', $completion->timecompleted) . "\n";*/
} else {
if ($checkcourse->warnexpire && $completion->timeenrolled + $checkcourse->expiryduration <= $checkcourse->warnexpire + $runtime && $completion->timeenrolled + $checkcourse->expiryduration > $runtime) {
echo "<br>Sending expiry warning email to {$user->email} \n";
EmailTemplate::send('expiry_warn_user', array('course' => $course, 'user' => $user));
/*$expiringtext .= $user->firstname . ' ' . $user->lastname . ', ' . $user->email . ' - ' .
date('D M Y', $completion->timecompleted) . "\n";*/
}
}
}
}
}
}
}
}
示例6: omrprocess
/**
* REmove previous log.txt, omr_result[*].txt
* Enter description here ...
* @param record $scan @see table blended_scans
* @throws OMRError
*/
function omrprocess($scan)
{
global $CFG;
global $scansfoldername;
mtrace("Entering OMR phase.");
$scan->status = JOB_STATE_BUSY;
set_field('blended_scans', 'status', $scan->status, 'id', $scan->id);
$scan->timestatus = time();
set_field('blended_scans', 'timestatus', $scan->timestatus, 'id', $scan->id);
//update_record('blended_scans', $scan);
$strresultlink = get_string('resultlink', 'blended');
$rutaorigen = blended_getOMRSourcePath($scan);
$rutafieldset = blended_getOMRFieldsetDir($scan);
$rutadestino = blended_getOMRTargetPath($scan);
$logfile = blended_getOMRInputLogFilePath($scan);
mtrace("Processing Scan: {$scan->scan_name}");
mtrace(" located at: {$rutaorigen}");
mtrace(" fieldset at: {$rutafieldset}");
mtrace(" target at: {$rutadestino} \n");
try {
/**
* Clean previous results in case of a previous error and a relaunch
*/
blended_delete_log_file($scan);
blended_delete_scan_results($scan);
/**
* Execute the recognition process
*/
list($status, $output) = blended_execute_omr_recognition($rutaorigen, $rutadestino, $rutafieldset);
mtrace("Command executed. Status Code =");
print_r($status);
if ($status != 'OK') {
$error = new OMRError($status, OMRError::OMRPROCESS_FAILED);
throw $error;
} else {
$statusMsg = "Command executed. Status Code = 0";
print_object($output);
register_status($scan->id, $statusMsg, $output, JOB_STATE_FINISHED);
//register_scannedjob($rutascandir,$jobid,$scan->course);
$scan->status = JOB_STATE_FINISHED;
register_scannedjob($scan);
}
} catch (OMRError $e) {
mtrace("Fatal OMR Error: " . $e->getMessage());
register_exception($e, $scan->id);
} catch (ResultsError $e) {
mtrace("ResultsError: " . $e->getMessage());
register_exception($e, $scan->id);
}
return;
}
示例7: get_string
/**
*
* @global type $CFG
* @param string $str
* @param string $lang
* @param string $component
* @return string
*/
function get_string($str, $lang = 'en', $component = 'core')
{
global $CFG;
$string = array();
if (!file_exists($CFG->dirlang . $lang . '/' . $component . '.php')) {
print_object('File does not exist');
} else {
include $CFG->dirlang . $lang . '/' . $component . '.php';
if (empty($str)) {
print_object('String can\'t be empty');
} else {
return $string[$str];
}
}
}
示例8: helpmenow_wiziq_api
function helpmenow_wiziq_api($method, $params)
{
global $CFG;
$signature = array();
$signature['access_key'] = $CFG->helpmenow_wiziq_access_key;
$signature['timestamp'] = time();
$signature['method'] = $method;
$signature['signature'] = helpmenow_wiziq_api_signature($signature);
$params = array_merge($signature, $params);
$ch = curl_init();
curl_setopt_array($ch, array(CURLOPT_POSTFIELDS => http_build_query($params, '', '&'), CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLINFO_HEADER_OUT => true, CURLOPT_URL => HELPMENOW_WIZIQ_API_URL . "?method={$method}"));
$response = curl_exec($ch);
curl_close($ch);
if (debugging()) {
print_object($response);
}
return new SimpleXMLElement($response);
}
示例9: getallhiddenrecipients
function getallhiddenrecipients($cid, $bid)
{
global $sid;
$debug = false;
if ($cid == 1) {
$blockcontext = get_context_instance(CONTEXT_SYSTEM, $sid);
} else {
$blockcontext = get_context_instance(CONTEXT_BLOCK, $bid);
}
$hiddenrecipients = get_users_by_capability($blockcontext, 'block/contact_form:hiddenrecipient', 'u.id, u.firstname, u.lastname, u.email, u.mailformat', 'u.lastname ASC', '', '', '', '', false);
if ($debug) {
echo '****** Written from line ' . __LINE__ . ' of ' . __FILE__ . ' ********<br />';
echo '<hr />';
echo 'hiddencollector (block/contact_form:hiddenrecipients)<br />';
print_object($hiddenrecipients);
}
return $hiddenrecipients;
}
示例10: definition
/**
* Defines forms elements
*/
public function definition()
{
global $mods;
print_object($mods);
$mform = $this->_form;
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('text', 'name', get_string('jcodename', 'jcode'), array('size' => '64'));
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
$mform->setType('name', PARAM_CLEAN);
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->addHelpButton('name', 'jcodename', 'jcode');
$this->add_intro_editor();
$mform->addElement('text', 'parameters', get_string('parameters', 'jcode'));
$mform->addRule('parameters', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->addElement('text', 'correctanswer', get_string('correctanswer', 'jcode'), array('size' => '128'));
$ctx = null;
if ($this->current && $this->current->coursemodule) {
$cm = get_coursemodule_from_instance('jcode', $this->current->id, 0, false, MUST_EXIST);
$ctx = context_module::instance($cm->id);
}
if ($this->current && $this->current->course) {
if (!$ctx) {
$ctx = context_course::instance($this->current->course);
}
}
if (empty($entry->id)) {
$entry = new stdClass();
$entry->id = null;
}
$name = get_string('resubmit', 'jcode');
$mform->addElement('selectyesno', 'resubmit', $name);
$name = get_string('timeavaliable', 'jcode');
$mform->addElement('date_time_selector', 'timeavaliable', $name, array('optional' => true));
$name = get_string('timedue', 'jcode');
$mform->addElement('date_time_selector', 'timedue', $name, array('optional' => true));
$this->standard_grading_coursemodule_elements();
$this->standard_coursemodule_elements();
$this->add_action_buttons();
}
示例11: render_opendesktop_loginform
/**
* Render login form to start OpenVirtualDekstop
* @param opendesktop_loginform The form to render
* @return string
*/
public function render_opendesktop_loginform(opendesktop_loginform $formdata)
{
global $CFG, $USER;
$o = '';
$sessioninfo = $formdata->session->get_config();
$sessval = $formdata->session->sessionstatus($CFG->opendesktop_useprefix . $USER->username);
if ($sessioninfo == false) {
$o .= $this->output->error_text(get_string('connecterror', 'opendesktop'));
} else {
$o .= $this->output->box_start('boxaligncenter ');
$o .= print_object($formdata->params['sessionmode']);
$formattributes = array();
$formattributes['id'] = 'opendesktop_sessionlogin';
$formattributes['class'] = 'opendesktopconnect';
$formattributes['action'] = $formdata->session->sessurl . '/startsession.php';
$formattributes['method'] = 'post';
$formattributes['name'] = 'launchopendesktop';
$o .= html_writer::start_tag('form', $formattributes);
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'client', 'value' => 'browser'));
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'quality', 'value' => $formdata->opendesktop->quality));
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'timezone', 'id' => 'timezone', 'value' => ''));
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'login', 'value' => $CFG->opendesktop_useprefix . $USER->username));
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'language', 'value' => $formdata->opendesktop->languagesetting));
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'password', 'id' => 'passwd', 'value' => $formdata->session->randpass));
$o .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'session_mode', 'id' => 'session_mode', 'value' => $formdata->params['sessionmode']));
$o .= html_writer::start_tag('span', array('id' => 'loading_div', 'class' => 'loading_div'));
$o .= html_writer::empty_tag('img', array('src' => 'pix/loading.div', 'alt' => 'Loading...', 'title' => 'Loading...', 'height' => '25', 'width' => '25'));
$o .= html_writer::end_tag('span');
$o .= html_writer::start_tag('span', array('id' => 'launch_buttons', 'class' => 'launch_buttons'));
$o .= html_writer::empty_tag('input', array('type' => 'button', 'class' => 'failed_button', 'id' => 'failed_button', 'value' => 'ERROR'));
$o .= html_writer::tag('span', '<a href="http://www.java.com/download/">Click here to install the free Java-Plugin</a></span>', array('class' => 'java_download'));
$o .= html_writer::empty_tag('input', array('type' => 'submit', 'id' => 'launch_button', 'class' => 'launch_button', 'value' => get_string('logintoyourdesktop', 'opendesktop')));
$o .= html_writer::end_tag('span');
$o .= html_writer::end_tag('form');
if ($formdata->opendesktop->windowmode == 'frame') {
$o .= html_writer::tag('div', '<script type="text/javascript">document.launchopendesktop.submit();</script>');
}
$o .= $this->output->box_end();
}
return $o;
}
示例12: game_bookquiz_check_questions
function game_bookquiz_check_questions($id, $game, $attempt, $bookquiz, $context)
{
global $USER, $DB;
$scoreattempt = optional_param('scoreattempt', 0, PARAM_INT);
$responses = data_submitted();
$questionlist = $responses->questionids;
$questions = game_sudoku_getquestions($questionlist);
$grades = game_grade_questions($questions);
$scorequestion = 0;
$scoreattempt = 0;
$chapterid = required_param('chapterid', PARAM_INT);
$nextchapterid = required_param('nextchapterid', PARAM_INT);
foreach ($questions as $question) {
if (!array_key_exists($question->id, $grades)) {
//no answered
continue;
}
$grade = $grades[$question->id];
if ($grade->grade < 0.5) {
continue;
}
//found one correct answer
if (!$DB->get_field('game_bookquiz_chapters', 'id', array('attemptid' => $attempt->id, 'chapterid' => $chapterid))) {
$newrec = new stdClass();
$newrec->attemptid = $attempt->id;
$newrec->chapterid = $chapterid;
if (!$DB->insert_record('game_bookquiz_chapters', $newrec, false)) {
print_object($newrec);
print_error("Can't insert to table game_bookquiz_chapters");
}
}
//Have to go to next page.
$bookquiz->lastchapterid = $nextchapterid;
$scorequestion = 1;
break;
}
$query = new stdClass();
$query->id = 0;
$query->attemptid = $attempt->id;
$query->gameid = $game->id;
$query->userid = $USER->id;
$query->sourcemodule = 'question';
$query->questionid = $question->id;
$query->glossaryentryid = 0;
$query->questiontext = $question->questiontext;
$query->timelastattempt = time();
game_update_queries($game, $attempt, $query, $scorequestion, '');
game_updateattempts($game, $attempt, $scoreattempt, 0);
game_bookquiz_continue($id, $game, $attempt, $bookquiz, $bookquiz->lastchapterid, $context);
}
示例13: generate_questions
public function generate_questions($courses, $modules)
{
global $DB, $CFG;
if (!is_null($this->get('questions_per_course')) && count($courses) > 0 && is_array($courses)) {
require_once $CFG->libdir . '/questionlib.php';
require_once $CFG->dirroot . '/mod/quiz/editlib.php';
$questions = array();
$questionsmenu = question_type_menu();
$questiontypes = array();
foreach ($questionsmenu as $qtype => $qname) {
$questiontypes[] = $qtype;
}
// Add the questions
foreach ($courses as $courseid) {
$questions[$courseid] = array();
for ($i = 0; $i < $this->get('questions_per_course'); $i++) {
$qtype = $questiontypes[array_rand($questiontypes)];
// Only the following types are supported right now. Hang around for more!
$supported_types = array('match', 'essay', 'multianswer', 'multichoice', 'shortanswer', 'numerical', 'truefalse', 'calculated');
$qtype = $supported_types[array_rand($supported_types)];
if ($qtype == 'calculated') {
continue;
}
$classname = "question_{$qtype}_qtype";
if ($qtype == 'multianswer') {
$classname = "embedded_cloze_qtype";
}
$question = new $classname();
$question->qtype = $qtype;
$questions[$courseid][] = $question->generate_test("question{$qtype}-{$i}", $courseid);
$this->verbose("Generated a question of type {$qtype} for course id {$courseid}.");
}
}
// Assign questions to quizzes, if such exist
if (!empty($modules['quiz']) && !empty($questions) && !is_null($this->get('questions_per_quiz'))) {
$quizzes = $modules['quiz'];
// Cannot assign more questions per quiz than are available, so determine which is the largest
$questions_per_quiz = max(count($questions), $this->get('questions_per_quiz'));
foreach ($quizzes as $quiz) {
$questions_added = array();
for ($i = 0; $i < $questions_per_quiz; $i++) {
// Add a random question to the quiz
do {
if (empty($quiz->course)) {
print_object($quizzes);
die;
}
$random = rand(0, count($questions[$quiz->course]));
} while (in_array($random, $questions_added) || !array_key_exists($random, $questions[$quiz->course]));
if (!quiz_add_quiz_question($questions[$quiz->course][$random]->id, $quiz)) {
// Could not add question to quiz!! report error
if (!$this->get('quiet')) {
echo "WARNING: Could not add question id {$random} to quiz id {$quiz->id}{$this->eolchar}";
}
} else {
$this->verbose("Adding question id {$random} to quiz id {$quiz->id}.");
$questions_added[] = $random;
}
}
}
}
return $questions;
}
return null;
}
示例14: _paintPassFail
/**
* Private method. Used by printPass/Fail/Skip/Error.
*/
function _paintPassFail($passorfail, $message, $stacktrace = null, $debuginfo = null)
{
global $CFG, $OUTPUT;
echo $OUTPUT->box_start($passorfail . ' generalbox ');
$url = $this->_htmlEntities($this->_stripParameterFromUrl(qualified_me(), 'path'));
echo '<b class="', $passorfail, '">', $this->get_string($passorfail), '</b>: ';
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
$file = array_shift($breadcrumb);
$pathbits = preg_split('/\\/|\\\\/', substr($file, strlen($CFG->dirroot) + 1));
$file = array_pop($pathbits);
$folder = '';
foreach ($pathbits as $pathbit) {
$folder .= $pathbit . '/';
echo "<a href=\"{$url}path={$folder}\" title=\"{$this->strrunonlyfolder}\">{$pathbit}</a>/";
}
echo "<a href=\"{$url}path={$folder}{$file}\" title=\"{$this->strrunonlyfile}\">{$file}</a>";
echo $this->strseparator, implode($this->strseparator, $breadcrumb);
echo '<br />', $this->_htmlEntities($message), "\n\n";
if (!empty($debuginfo)) {
print_object('Debug info:');
print_object($debuginfo);
}
if ($stacktrace) {
$dotsadded = false;
$interestinglines = 0;
$filteredstacktrace = array();
foreach ($stacktrace as $frame) {
if (empty($frame['file']) || strpos($frame['file'], 'simpletestlib') === false && strpos($frame['file'], 'simpletestcoveragelib') === false && strpos($frame['file'], 'tool/unittest') === false) {
$filteredstacktrace[] = $frame;
$interestinglines += 1;
$dotsadded = false;
} else {
if (!$dotsadded) {
$filteredstacktrace[] = array('line' => '...', 'file' => '...');
$dotsadded = true;
}
}
}
if ($interestinglines > 1 || $passorfail == 'exception' && $interestinglines > 0) {
echo '<div class="notifytiny">' . format_backtrace($filteredstacktrace) . "</div>\n\n";
}
}
echo $OUTPUT->box_end();
flush();
}
示例15: pear_handle_error
/**
* Callback called when PEAR throws an error
*
* @param PEAR_Error $error
*/
function pear_handle_error($error)
{
echo '<strong>' . $error->GetMessage() . '</strong> ' . $error->getUserInfo();
echo '<br /> <strong>Backtrace </strong>:';
print_object($error->backtrace);
}