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


PHP data_submitted函数代码示例

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


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

示例1: __construct

 function __construct($userid)
 {
     $this->name = get_string('admin_academic', 'block_student_gradeviewer');
     $this->userid = $userid;
     $this->type = 'academics';
     $this->debug = get_config('', 'block_student_gradeviewer_debug');
     $this->input_fields = array('year', 'college', 'major');
     // Assign the path here
     $values = array_map(array($this, 'na_or_empty'), $this->input_fields);
     //Pull this the categories from a form submission rather the url params
     if ($data = data_submitted()) {
         $p = isset($data->path) ? $data->path : $this->year . '/' . $this->college . '/' . $this->major;
     } else {
         $p = optional_param('path', 'NA');
     }
     if ($p != 'NA') {
         $this->path = $p;
         $fields = explode('/', $p);
         foreach ($this->input_fields as $index => $field) {
             $this->{$field} = $fields[$index];
         }
     } else {
         if (array_reduce($values, 'empty_reduce_check', true)) {
             $this->path = 'NA';
         } else {
             $this->path = implode('/', $values);
         }
     }
     $this->capabilities = array('block/student_gradeviewer:academicadmin');
 }
开发者ID:rrusso,项目名称:EARS,代码行数:30,代码来源:admin_academics.php

示例2: get_field

 /**
  * get_field
  *
  * @param xxx $fieldname
  * @param xxx $advanced
  * @return xxx
  */
 function get_field($fieldname, $advanced)
 {
     // hotpot version of standard function
     $default = get_user_preferences('hotpot_' . $fieldname, '');
     $rawdata = data_submitted();
     if ($rawdata && isset($rawdata->{$fieldname}) && !is_array($rawdata->{$fieldname})) {
         $default = optional_param($fieldname, $default, PARAM_ALPHANUM);
     }
     unset($rawdata);
     switch ($fieldname) {
         case 'group':
         case 'grouping':
             return new hotpot_filter_group($fieldname, $advanced, $default);
         case 'grade':
             $label = get_string('grade');
             return new hotpot_filter_grade($fieldname, $label, $advanced, $default);
         case 'timemodified':
             $label = get_string('time', 'quiz');
             return new user_filter_date($fieldname, $label, $advanced, $fieldname);
         case 'status':
             return new hotpot_filter_status($fieldname, $advanced, $default);
         case 'duration':
             $label = get_string('duration', 'mod_hotpot');
             return new hotpot_filter_duration($fieldname, $label, $advanced, $default);
         case 'penalties':
             $label = get_string('penalties', 'mod_hotpot');
             return new hotpot_filter_number($fieldname, $label, $advanced, $default);
         case 'score':
             $label = get_string('score', 'quiz');
             return new hotpot_filter_number($fieldname, $label, $advanced, $default);
         default:
             // other fields (e.g. from user record)
             return parent::get_field($fieldname, $advanced);
     }
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:42,代码来源:userfiltering.php

示例3: process_feedback

 function process_feedback($formdata = null)
 {
     if (!($feedback = data_submitted()) or !confirm_sesskey()) {
         // No incoming data?
         return false;
     }
     $userid = required_param('userid', PARAM_INT);
     $offset = required_param('offset', PARAM_INT);
     $mform = $this->display_submission($offset, $userid, false);
     parent::process_feedback($mform);
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:11,代码来源:assignment.class.php

示例4: loginpage_hook

 /**
  * Provides a hook into the login page.
  *
  * @param object &$frm Form object.
  * @param object &$user User object.
  */
 public function loginpage_hook(&$frm, &$user)
 {
     global $DB;
     if (empty($frm)) {
         $frm = data_submitted();
     }
     if (empty($frm)) {
         return true;
     }
     $autoappend = get_config('auth_oidc', 'autoappend');
     if (empty($autoappend)) {
         // If we're not doing autoappend, just let things flow naturally.
         return true;
     }
     $username = $frm->username;
     $password = $frm->password;
     $auth = 'oidc';
     $existinguser = $DB->get_record('user', ['username' => $username]);
     if (!empty($existinguser)) {
         // We don't want to prevent access to existing accounts.
         return true;
     }
     $username .= $autoappend;
     $success = $this->user_login($username, $password);
     if ($success !== true) {
         // No o365 user, continue normally.
         return false;
     }
     $existinguser = $DB->get_record('user', ['username' => $username]);
     if (!empty($existinguser)) {
         $user = $existinguser;
         return true;
     }
     // The user is authenticated but user creation may be disabled.
     if (!empty($CFG->authpreventaccountcreation)) {
         $failurereason = AUTH_LOGIN_UNAUTHORISED;
         // Trigger login failed event.
         $event = \core\event\user_login_failed::create(array('other' => array('username' => $username, 'reason' => $failurereason)));
         $event->trigger();
         error_log('[client ' . getremoteaddr() . "]  {$CFG->wwwroot}  Unknown user, can not create new accounts:  {$username}  " . $_SERVER['HTTP_USER_AGENT']);
         return false;
     }
     $user = create_user_record($username, $password, $auth);
     return true;
 }
开发者ID:jamesmcq,项目名称:o365-moodle,代码行数:51,代码来源:rocreds.php

示例5: process_feedback

 function process_feedback()
 {
     global $USER;
     if (!($feedback = data_submitted())) {
         // No incoming data?
         return false;
     }
     ///For save and next, we need to know the userid to save, and the userid to go
     ///We use a new hidden field in the form, and set it to -1. If it's set, we use this
     ///as the userid to store
     if ((int) $feedback->saveuserid !== -1) {
         $feedback->userid = $feedback->saveuserid;
     }
     if (!empty($feedback->cancel)) {
         // User hit cancel button
         return false;
     }
     $submission = $this->get_submission($feedback->userid, true);
     // Get or make one
     $submission->grade = $feedback->grade;
     $submission->submissioncomment = $feedback->submissioncomment;
     $submission->format = $feedback->format;
     $submission->teacher = $USER->id;
     $submission->mailed = 0;
     // Make sure mail goes out (again, even)
     $submission->timemarked = time();
     unset($submission->data1);
     // Don't need to update this.
     unset($submission->data2);
     // Don't need to update this.
     if (empty($submission->timemodified)) {
         // eg for offline assignments
         $submission->timemodified = time();
     }
     if (!update_record('assignment_submissions', $submission)) {
         return false;
     }
     add_to_log($this->course->id, 'assignment', 'update grades', 'submissions.php?id=' . $this->assignment->id . '&user=' . $feedback->userid, $feedback->userid, $this->cm->id);
     return $submission;
 }
开发者ID:veritech,项目名称:pare-project,代码行数:40,代码来源:assignment.class.php

示例6: invoke

 /**
  * Invoke method, every class will have its own
  * returns true/false on completion, setting both
  * errormsg and output as necessary
  */
 function invoke()
 {
     parent::invoke();
     $result = true;
     /// Set own core attributes
     $this->does_generate = ACTION_NONE;
     //$this->does_generate = ACTION_GENERATE_HTML;
     /// These are always here
     global $CFG, $XMLDB;
     /// Do the job, setting result as needed
     if (!data_submitted()) {
         ///Basic prevention
         print_error('wrongcall', 'error');
     }
     /// Get parameters
     $dirpath = required_param('dir', PARAM_PATH);
     $dirpath = $CFG->dirroot . $dirpath;
     $comment = required_param('comment', PARAM_CLEAN);
     $comment = $comment;
     /// Set comment and recalculate hash
     $editeddir =& $XMLDB->editeddirs[$dirpath];
     $structure =& $editeddir->xml_file->getStructure();
     $structure->setComment($comment);
     $structure->calculateHash(true);
     /// If the hash has changed from the original one, change the version
     /// and mark the structure as changed
     $origdir =& $XMLDB->dbdirs[$dirpath];
     $origstructure =& $origdir->xml_file->getStructure();
     if ($structure->getHash() != $origstructure->getHash()) {
         $structure->setVersion(userdate(time(), '%Y%m%d', 99, false));
         $structure->setChanged(true);
     }
     /// Launch postaction if exists (leave this here!)
     if ($this->getPostAction() && $result) {
         return $this->launch($this->getPostAction());
     }
     /// Return ok if arrived here
     return $result;
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:44,代码来源:edit_xml_file_save.class.php

示例7: groups_get_activity_group

}
$PAGE->set_title($data->name);
$PAGE->set_heading($course->fullname);
/// Check to see if groups are being used here
$currentgroup = groups_get_activity_group($cm);
$groupmode = groups_get_activity_groupmode($cm);
if ($currentgroup) {
    $groupselect = " AND groupid = '{$currentgroup}'";
    $groupparam = "&groupid={$currentgroup}";
} else {
    $groupselect = "";
    $groupparam = "";
    $currentgroup = 0;
}
/// Process incoming data for adding/updating records
if ($datarecord = data_submitted() and confirm_sesskey()) {
    $ignorenames = array('MAX_FILE_SIZE', 'sesskey', 'd', 'rid', 'saveandview', 'cancel');
    // strings to be ignored in input data
    if ($rid) {
        /// Update some records
        /// All student edits are marked unapproved by default
        $record = $DB->get_record('data_records', array('id' => $rid));
        /// reset approved flag after student edit
        if (!has_capability('mod/data:approve', $context)) {
            $record->approved = 0;
        }
        $record->groupid = $currentgroup;
        $record->timemodified = time();
        $DB->update_record('data_records', $record);
        /// Update all content
        $field = NULL;
开发者ID:nigeldaley,项目名称:moodle,代码行数:31,代码来源:edit.php

示例8: print_error

    exit;
}
if ($id) {
    if (!($view = get_record('block_exabeporview', 'id', $id, 'userid', $USER->id))) {
        print_error("wrongviewid", "block_exabis_eportfolio");
    }
} else {
    $view = null;
}
$returnurl = $CFG->wwwroot . '/blocks/exabis_eportfolio/views_list.php?courseid=' . $courseid;
// delete item
if ($action == 'delete') {
    if (!$view) {
        print_error("bookmarknotfound", "block_exabis_eportfolio");
    }
    if (data_submitted() && $confirm && confirm_sesskey()) {
        delete_records('block_exabeporviewblock', 'viewid', $view->id);
        $status = delete_records('block_exabeporview', 'id', $view->id);
        add_to_log(SITEID, 'blog', 'delete', 'views_mod.php?courseid=' . $courseid . '&id=' . $view->id . '&action=delete&confirm=1', $view->name);
        if (!$status) {
            print_error('deleteposterror', 'block_exabis_eportfolio', $returnurl);
        }
        redirect($returnurl);
    } else {
        $optionsyes = array('id' => $id, 'action' => 'delete', 'confirm' => 1, 'sesskey' => sesskey(), 'courseid' => $courseid);
        $optionsno = array('courseid' => $courseid);
        block_exabis_eportfolio_print_header('views');
        echo '<br />';
        notice_yesno(get_string("deleteconfirm", "block_exabis_eportfolio"), 'views_mod.php', 'views_list.php', $optionsyes, $optionsno, 'post', 'get');
        print_footer();
        die;
开发者ID:nickpro,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:views_mod.php

示例9: get_string

    grade_report_grader::process_action($target, $action);
}
$reportname = get_string('pluginname', 'gradereport_grader');
/// Print header
print_grade_page_head($COURSE->id, 'report', 'grader', $reportname, false, $buttons);
//Initialise the grader report object that produces the table
//the class grade_report_grader_ajax was removed as part of MDL-21562
$report = new grade_report_grader($courseid, $gpr, $context, $page, $sortitemid);
// make sure separate group does not prevent view
if ($report->currentgroup == -2) {
    echo $OUTPUT->heading(get_string("notingroup"));
    echo $OUTPUT->footer();
    exit;
}
/// processing posted grades & feedback here
if ($data = data_submitted() and confirm_sesskey() and has_capability('moodle/grade:edit', $context)) {
    $warnings = $report->process_data($data);
} else {
    $warnings = array();
}
// final grades MUST be loaded after the processing
$report->load_users();
$numusers = $report->get_numusers();
$report->load_final_grades();
echo $report->group_selector;
echo '<div class="clearer"></div>';
// echo $report->get_toggles_html();
//show warnings if any
foreach ($warnings as $warning) {
    echo $OUTPUT->notification($warning);
}
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:index.php

示例10: array

if ($action == 'delchoice' and confirm_sesskey() and is_enrolled($context, NULL, 'mod/choice:choose') and $choice->allowupdate and $choiceavailable) {
    $answercount = $DB->count_records('choice_answers', array('choiceid' => $choice->id, 'userid' => $USER->id));
    if ($answercount > 0) {
        $DB->delete_records('choice_answers', array('choiceid' => $choice->id, 'userid' => $USER->id));
        // Update completion state
        $completion = new completion_info($course);
        if ($completion->is_enabled($cm) && $choice->completionsubmit) {
            $completion->update_state($cm, COMPLETION_INCOMPLETE);
        }
        redirect("view.php?id={$cm->id}");
    }
}
$PAGE->set_title($choice->name);
$PAGE->set_heading($course->fullname);
/// Submit any new data if there is any
if (data_submitted() && is_enrolled($context, NULL, 'mod/choice:choose') && confirm_sesskey()) {
    $timenow = time();
    if (has_capability('mod/choice:deleteresponses', $context) && $action == 'delete') {
        //some responses need to be deleted
        choice_delete_responses($attemptids, $choice, $cm, $course);
        //delete responses.
        redirect("view.php?id={$cm->id}");
    }
    // Redirection after all POSTs breaks block editing, we need to be more specific!
    if ($choice->allowmultiple) {
        $answer = optional_param_array('answer', array(), PARAM_INT);
    } else {
        $answer = optional_param('answer', '', PARAM_INT);
    }
    if (!$choiceavailable) {
        $reason = current(array_keys($warnings));
开发者ID:pzhu2004,项目名称:moodle,代码行数:31,代码来源:view.php

示例11: print_header_simple

print_header_simple(format_string($elluminate->name), '', $navigation, '', '', true, $buttontext, navmenu($course, $cm));
/// Delete a preload file for this meeting.
if (!empty($delete)) {
    if (!empty($elluminate->meetingid)) {
        if ($preload = elluminate_list_meeting_preloads($elluminate->meetingid)) {
            if ($preload->presentationid == $delete) {
                /// Delete the preload from the meeting.
                if (!elluminate_delete_preload($preload->presentationid, $elluminate->meetingid)) {
                    error(get_string('preloaddeleteerror', 'elluminate'));
                }
                redirect($CFG->wwwroot . '/mod/elluminate/view.php?id=' . $cm->id, get_string('preloaddeletesuccess', 'elluminate'), 5);
            }
        }
    }
}
if (($data = data_submitted($CFG->wwwroot . '/mod/elluminate/preload.php')) && confirm_sesskey()) {
    if (!empty($_FILES['whiteboard'])) {
        $filepath = $_FILES['whiteboard']['tmp_name'];
        $filesize = $_FILES['whiteboard']['size'];
        //This was put in to handle apostrophes in the filename when magic quotes is no turned on.
        $actual_filename = $data->userfilename;
        $search = array("<", ">", "&", "#", "%", "\"", "\\", "|", "'");
        $replace = '';
        $filename = str_replace($search, $replace, $actual_filename);
        /// Make sure the file uses a valid whiteboard preload file extension.
        if (!eregi('\\.([a-zA-Z0-9]+)$', $filename, $match)) {
            error(get_string('preloadnofileextension', 'elluminate'));
        }
        if (!isset($match[1])) {
            error(get_string('preloadnofileextension', 'elluminate'));
        }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:preload.php

示例12: required_param

* @package feedback
*/
require_once "../../config.php";
require_once "lib.php";
$id = required_param('id', PARAM_INT);
$completedid = optional_param('completedid', false, PARAM_INT);
$preservevalues = optional_param('preservevalues', 0, PARAM_INT);
$courseid = optional_param('courseid', false, PARAM_INT);
$gopage = optional_param('gopage', -1, PARAM_INT);
$lastpage = optional_param('lastpage', false, PARAM_INT);
$startitempos = optional_param('startitempos', 0, PARAM_INT);
$lastitempos = optional_param('lastitempos', 0, PARAM_INT);
$anonymous_response = optional_param('anonymous_response', 0, PARAM_INT);
//arb
$highlightrequired = false;
if ($formdata = data_submitted('nomatch') and !confirm_sesskey()) {
    error('no sesskey defined');
}
//if the use hit enter into a textfield so the form should not submit
if (isset($formdata->sesskey) and !isset($formdata->savevalues) and !isset($formdata->gonextpage) and !isset($formdata->gopreviouspage)) {
    $gopage = $formdata->lastpage;
}
if (isset($formdata->savevalues)) {
    $savevalues = true;
} else {
    $savevalues = false;
}
if ($gopage < 0 and !$savevalues) {
    if (isset($formdata->gonextpage)) {
        $gopage = $lastpage + 1;
        $gonextpage = true;
开发者ID:kai707,项目名称:ITSA-backup,代码行数:31,代码来源:complete.php

示例13: array

     if ($edit) {
         $settings = array();
         $settings['name'] = $fromform->name;
         if (!$instance->readonly) {
             foreach ($configs as $config) {
                 if (isset($fromform->{$config})) {
                     $settings[$config] = $fromform->{$config};
                 } else {
                     $settings[$config] = null;
                 }
             }
         }
         $success = $instance->set_option($settings);
     } else {
         $success = repository::static_function($plugin, 'create', $plugin, 0, $context, $fromform);
         $data = data_submitted();
     }
     if ($success) {
         redirect($parenturl);
     } else {
         print_error('instancenotsaved', 'repository', $parenturl);
     }
     exit;
 } else {
     echo $OUTPUT->header();
     echo $OUTPUT->heading(get_string('configplugin', 'repository_' . $plugin));
     echo $OUTPUT->box_start();
     $mform->display();
     echo $OUTPUT->box_end();
     $return = false;
 }
开发者ID:nmicha,项目名称:moodle,代码行数:31,代码来源:repositoryinstance.php

示例14: redirect

<?php

// $Id: index.php,v 1.16.4.1 2008/02/01 05:48:43 moodler Exp $
require '../config.php';
if ($form = data_submitted('nomatch')) {
    // form submitted, do not check referer (original page unknown)!
    /// Only deal with real users
    if (!isloggedin()) {
        redirect($CFG->wwwroot);
    }
    /// Work out who to send the message to
    if (!($admin = get_admin())) {
        error('Could not find an admin user!');
    }
    $supportuser = new object();
    $supportuser->email = $CFG->supportemail ? $CFG->supportemail : $admin->email;
    $supportuser->firstname = $CFG->supportname ? $CFG->supportname : $admin->firstname;
    $supportuser->lastname = $CFG->supportname ? '' : $admin->lastname;
    $supportuser->maildisplay = true;
    /// Send the email and redirect
    email_to_user($supportuser, $USER, 'Error: ' . $form->referer . ' -> ' . $form->requested, $form->text);
    redirect($CFG->wwwroot . '/course/', 'Message sent, thanks', 3);
    exit;
}
$site = get_site();
$redirecturl = empty($_SERVER['REDIRECT_URL']) ? '' : $_SERVER['REDIRECT_URL'];
$httpreferer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
$requesturi = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'];
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
print_header($site->fullname . ':Error', $site->fullname . ': Error 404', 'Error 404 - File not Found', '');
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:index.php

示例15: get_mnet_environment

$mnet = get_mnet_environment();
if (!extension_loaded('openssl')) {
    echo $OUTPUT->header();
    set_config('mnet_dispatcher_mode', 'off');
    print_error('requiresopenssl', 'mnet');
}
if (!function_exists('curl_init')) {
    echo $OUTPUT->header();
    set_config('mnet_dispatcher_mode', 'off');
    print_error('nocurl', 'mnet');
}
if (!isset($CFG->mnet_dispatcher_mode)) {
    set_config('mnet_dispatcher_mode', 'off');
}
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
    if (!empty($form->submit) && $form->submit == get_string('savechanges')) {
        if (in_array($form->mode, array("off", "strict", "dangerous"))) {
            if (set_config('mnet_dispatcher_mode', $form->mode)) {
                redirect('index.php', get_string('changessaved'));
            } else {
                print_error('invalidaction', '', 'index.php');
            }
        }
    } elseif (!empty($form->submit) && $form->submit == get_string('delete')) {
        $mnet->get_private_key();
        $SESSION->mnet_confirm_delete_key = md5(sha1($mnet->keypair['keypair_PEM'])) . ':' . time();
        $formcontinue = new single_button(new moodle_url('index.php', array('confirm' => md5($mnet->public_key))), get_string('yes'));
        $formcancel = new single_button(new moodle_url('index.php', array()), get_string('no'));
        echo $OUTPUT->confirm(get_string("deletekeycheck", "mnet"), $formcontinue, $formcancel);
        exit;
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:index.php


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