本文整理汇总了PHP中moodleform::get_data方法的典型用法代码示例。如果您正苦于以下问题:PHP moodleform::get_data方法的具体用法?PHP moodleform::get_data怎么用?PHP moodleform::get_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moodleform
的用法示例。
在下文中一共展示了moodleform::get_data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_data
public function get_data()
{
$data = parent::get_data();
if ($data !== null && $this->currentcourses) {
$data->selectedcourses = $this->currentcourses->get_selected_courses();
}
return $data;
}
示例2: get_data
public function get_data()
{
$data = parent::get_data();
if ($data) {
$data->text = $data->text['text'];
}
return $data;
}
示例3:
/**
* Used to reformat the data from the editor component
*
* @return stdClass
*/
function get_data()
{
$data = parent::get_data();
/*if ($data !== null) {
//$data->messageformat = $data->message_editor['format'];
//$data->message = clean_text($data->message_editor['text'], $data->messageformat);
}*/
return $data;
}
示例4: get_data
public function get_data()
{
$data = parent::get_data();
if ($data) {
$data->title = '';
$data->description = '';
if ($this->title) {
$data->title = $this->title;
}
if ($this->description) {
$data->description = $this->description;
}
}
return $data;
}
示例5: array
function get_data($slashed = true)
{
$data = parent::get_data($slashed);
if ($data) {
$data->inputfile = array();
$data->outputfile = array();
foreach (array_keys($data->feedback) as $key) {
$prop = "inputfile[{$key}]";
$data->inputfile[$key] = $data->{$prop};
unset($data->{$prop});
$prop = "outputfile[{$key}]";
$data->outputfile[$key] = $data->{$prop};
unset($data->{$prop});
}
}
return $data;
}
示例6: get_data
/**
*
*/
public function get_data()
{
if ($data = parent::get_data()) {
// Collate pattern replacements.
$replacements = array();
$i = 0;
while (isset($data->{"enable{$i}"})) {
if (!$data->{"enable{$i}"}) {
$i++;
continue;
}
$replacements[$data->{"pattern{$i}"}] = $data->{"replacement{$i}"};
$i++;
}
$data->replacements = $replacements ? $replacements : null;
}
return $data;
}
示例7: foreach
/**
* Return submitted data if properly submitted or returns NULL if validation fails or
* if there is no submitted data.
*
* @return object submitted data; NULL if not valid or not submitted or cancelled
*/
function get_data()
{
$data = parent::get_data();
if ($data !== null) {
$editoroptions = $this->_customdata['editoroptions'];
if (!empty($data->usedefaultname)) {
$data->name = null;
}
$data = file_postupdate_standard_editor($data, 'summary', $editoroptions, $editoroptions['context'], 'course', 'section', $data->id);
$course = $this->_customdata['course'];
foreach (course_get_format($course)->section_format_options() as $option => $unused) {
// fix issue with unset checkboxes not being returned at all
if (!isset($data->{$option})) {
$data->{$option} = null;
}
}
}
return $data;
}
示例8: init
/**
* After filters have been added, you can
* initialze the form and handle submitted data
*
* @return mr_html_filter
* @throws coding_exception
*/
public function init()
{
if (empty($this->filters)) {
throw new coding_exception('Must add filters');
}
if (empty($this->mform)) {
$this->mform = $this->helper->load($this->formpath, array($this->url, $this), false);
if ($data = $this->mform->get_data()) {
if (!empty($data->resetbutton)) {
foreach ($this->filters as $filter) {
$filter->preferences_delete();
}
} else {
foreach ($this->filters as $filter) {
$filter->preferences_update($data);
}
}
redirect($this->url);
}
}
return $this;
}
示例9: get_data
public function get_data()
{
$data = parent::get_data();
// Update the data to handle the descriptiontype dropdown. (The type
// is not explicitly stored, we just set or unset relevant fields.)
if ($data) {
switch ($data->descriptiontype) {
case 'lang':
unset($data->description);
break;
case 'custom':
unset($data->corestring);
break;
default:
unset($data->description);
unset($data->corestring);
break;
}
unset($data->descriptiontype);
}
return $data;
}
示例10: get_data
/**
*
*/
public function get_data()
{
if ($data = parent::get_data()) {
// Collate submission settings.
$settings = array();
// Submission display.
if (!empty($data->submissiondisplay)) {
$settings['display'] = $data->submissiondisplay;
}
// Buttons.
$buttons = $this->_view->get_submission_buttons();
foreach ($buttons as $name) {
$buttonenable = $name . 'buttonenable';
if (!empty($data->{$buttonenable})) {
$buttoncontent = $name . 'button_label';
$settings[$name] = !empty($data->{$buttoncontent}) ? $data->{$buttoncontent} : null;
}
}
// Submission Redirect.
if (!empty($data->submissionredirect)) {
$settings['redirect'] = $data->submissionredirect;
}
if (!empty($data->submissiontimeout)) {
$settings['timeout'] = $data->submissiontimeout;
}
if (!empty($data->submissionmessage)) {
$settings['message'] = $data->submissionmessage;
}
$data->submission = $settings;
}
return $data;
}
示例11: get_data
/**
* Get the submitted data.
*
* @return Array with levels and levelsdata.
*/
public function get_data()
{
$mform =& $this->_form;
$data = parent::get_data();
if (!$data) {
return $data;
}
// Rearranging the information.
$newdata = array('levels' => $data->levels, 'levelsdata' => null);
$newdata['levelsdata'] = array('usealgo' => $data->usealgo, 'base' => $data->basexp, 'coef' => $data->coefxp, 'xp' => array('1' => 0), 'desc' => array('1' => ''));
for ($i = 2; $i <= $data->levels; $i++) {
$newdata['levelsdata']['xp'][$i] = $data->{'lvlxp_' . $i};
$newdata['levelsdata']['desc'][$i] = $data->{'lvldesc_' . $i};
}
return $newdata;
}
示例12: edit
/**
* Edit the plugin instance
*
* @param object $plugin
*/
public final function edit($report_id, $plugin_id, $reportfield_id)
{
global $CFG, $PARSER, $USER;
//get the report field record
$reportfield = $this->dbc->get_report_field_data($reportfield_id);
// include the moodle form library
require_once $CFG->libdir . '/formslib.php';
//include ilp_formslib
require_once $CFG->dirroot . '/blocks/ilp/classes/ilp_formslib.class.php';
// get the name of the evidence class being edited
$classname = get_class($this) . '_mform';
// include the moodle form for this table
include_once "{$CFG->dirroot}/blocks/ilp/classes/form_elements/plugins/{$classname}.php";
if (!class_exists($classname)) {
print_error('noeditilpform', 'block_ilp', '', get_class($this));
}
if (!empty($reportfield->id)) {
$plugin = $this->dbc->get_form_element_plugin($reportfield->plugin_id);
//get the form element data from the plugin table
$form_element = $this->dbc->get_form_element_by_reportfield($plugin->tablename, $reportfield->id);
$non_attrib = array('id', 'timemodified', 'timecreated');
if (!empty($form_element)) {
foreach ($form_element as $attrib => $value) {
if (!in_array($attrib, $non_attrib)) {
$reportfield->{$attrib} = $value;
}
}
}
$this->return_data($reportfield);
} else {
//new element - check for config file
if (file_exists($this->local_config_file)) {
$reportfield->optionlist = self::itemlist_flatten(parse_ini_file($this->local_config_file));
}
}
// instantiate the form and load the data
$this->mform = new $classname($report_id, $plugin_id, $USER->id);
$this->mform->set_data($reportfield);
//enter a back u
$backurl = $CFG->wwwroot . "/blocks/ilp/actions/edit_prompt.php?report_id={$report_id}";
//was the form cancelled?
if ($this->mform->is_cancelled()) {
//send the user back
redirect($backurl, get_string('returnreportprompt', 'block_ilp'), ILP_REDIRECT_DELAY);
}
//was the form submitted?
// has the form been submitted?
if ($this->mform->is_submitted()) {
// check the validation rules
if ($this->mform->is_validated()) {
//get the form data submitted
$formdata = $this->mform->get_data();
$formdata->audit_type = $this->audit_type();
// process the data
$success = $this->mform->process_data($formdata);
//if saving the data was not successful
if (!$success) {
//print an error message
print_error(get_string("fieldcreationerror", 'block_ilp'), 'block_ilp');
}
if ($this->mform->is_submitted()) {
//return the user to the
$return_url = $CFG->wwwroot . "/blocks/ilp/actions/edit_prompt.php?report_id={$report_id}";
redirect($return_url, get_string("fieldcreationsuc", 'block_ilp'), ILP_REDIRECT_DELAY);
}
}
}
}
示例13: get_data
/**
*
*/
public function get_data()
{
if ($data = parent::get_data()) {
if ($content = $this->get_data_default_content($data)) {
$data->defaultcontent = $content;
} else {
$data->defaultcontent = null;
}
}
return $data;
}
示例14: view_batch_markingallocation
/**
* Shows a form that allows the allocated marker for selected submissions to be changed.
*
* @param moodleform $mform Set to a grading batch operations form
* @return string - the page to view after processing these actions
*/
private function view_batch_markingallocation($mform)
{
global $CFG, $DB;
require_once $CFG->dirroot . '/mod/assign/batchsetallocatedmarkerform.php';
$o = '';
$submitteddata = $mform->get_data();
$users = $submitteddata->selectedusers;
$userlist = explode(',', $users);
$formparams = array('cm' => $this->get_course_module()->id, 'users' => $userlist, 'context' => $this->get_context());
$usershtml = '';
$usercount = 0;
$extrauserfields = get_extra_user_fields($this->get_context());
foreach ($userlist as $userid) {
if ($usercount >= 5) {
$usershtml .= get_string('moreusers', 'assign', count($userlist) - 5);
break;
}
$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
$usershtml .= $this->get_renderer()->render(new assign_user_summary($user, $this->get_course()->id, has_capability('moodle/site:viewfullnames', $this->get_course_context()), $this->is_blind_marking(), $this->get_uniqueid_for_user($user->id), $extrauserfields, !$this->is_active_user($userid)));
$usercount += 1;
}
$formparams['usershtml'] = $usershtml;
$markers = get_users_by_capability($this->get_context(), 'mod/assign:grade');
$markerlist = array();
foreach ($markers as $marker) {
$markerlist[$marker->id] = fullname($marker);
}
$formparams['markers'] = $markerlist;
$mform = new mod_assign_batch_set_allocatedmarker_form(null, $formparams);
$o .= $this->get_renderer()->header();
$o .= $this->get_renderer()->render(new assign_form('setworkflowstate', $mform));
$o .= $this->view_footer();
$this->add_to_log('view batch set marker allocation', get_string('viewbatchmarkingallocation', 'assign'));
return $o;
}
示例15: get_data
/**
* Overrides the mform get_data method.
*
* Created to force a value since the validation method does not work with multiple checkbox.
*
* @return stdClass form data object.
*/
public function get_data()
{
global $CFG;
$data = parent::get_data();
if ($data && $this->_customdata['multipledisplaytypes']) {
if (count(array_filter($data->display)) == 0) {
// Ensure that a value was selected as the export plugins expect at least one value.
if ($CFG->grade_export_displaytype == GRADE_DISPLAY_TYPE_LETTER) {
$data->display['letter'] = GRADE_DISPLAY_TYPE_LETTER;
} else {
if ($CFG->grade_export_displaytype == GRADE_DISPLAY_TYPE_PERCENTAGE) {
$data->display['percentage'] = GRADE_DISPLAY_TYPE_PERCENTAGE;
} else {
$data->display['real'] = GRADE_DISPLAY_TYPE_REAL;
}
}
}
}
return $data;
}