public function get_data()
 {
     $data = parent::get_data();
     if ($data !== null && $this->currentcourses) {
         $data->selectedcourses = $this->currentcourses->get_selected_courses();
     }
     return $data;
 }
 public function get_data()
 {
     $data = parent::get_data();
     if ($data) {
         $data->text = $data->text['text'];
     }
     return $data;
 }
 /**
  * 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;
 }
 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;
 }
 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;
 }
 /**
  *
  */
 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;
 }
 /**
  * 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;
 }
Exemple #8
0
 /**
  * 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;
 }
Exemple #9
0
 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;
 }
 /**
  *
  */
 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;
 }
 /**
  * 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;
 }
 /**
  * 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);
             }
         }
     }
 }
 /**
  *
  */
 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;
 }
Exemple #14
0
 /**
  * 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;
 }
 /**
  * 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;
 }
Exemple #16
0
 /**
  * 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
  */
 public 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);
     $formdata = array('id' => $this->get_course_module()->id, 'selectedusers' => $users);
     $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 = array('userscount' => count($userlist), 'usershtml' => $usershtml);
     list($sort, $params) = users_order_by_sql();
     $markers = get_users_by_capability($this->get_context(), 'mod/assign:grade', '', $sort);
     $markerlist = array();
     foreach ($markers as $marker) {
         $markerlist[$marker->id] = fullname($marker);
     }
     $formparams['markers'] = $markerlist;
     $mform = new mod_assign_batch_set_allocatedmarker_form(null, $formparams);
     $mform->set_data($formdata);
     // Initialises the hidden elements.
     $header = new assign_header($this->get_instance(), $this->get_context(), $this->show_intro(), $this->get_course_module()->id, get_string('setmarkingallocation', 'assign'));
     $o .= $this->get_renderer()->render($header);
     $o .= $this->get_renderer()->render(new assign_form('setworkflowstate', $mform));
     $o .= $this->view_footer();
     \mod_assign\event\batch_set_marker_allocation_viewed::create_from_assign($this)->trigger();
     return $o;
 }
Exemple #17
0
 /**
  * Retrieves the data of the submitted form.
  *
  * @return stdClass
  */
 public function get_data()
 {
     $data = parent::get_data();
     if ($data && !empty($this->_customdata->istool)) {
         // Content item checkbox is disabled in tool settings, so this cannot be edited. Just unset it.
         unset($data->lti_contentitem);
     }
     return $data;
 }
Exemple #18
0
 function get_data()
 {
     global $DB;
     $data = parent::get_data();
     if (!empty($data) && !is_numeric($data->user)) {
         //retrieve username
         $user = $DB->get_record('user', array('username' => $data->user), 'id');
         $data->user = $user->id;
     }
     return $data;
 }
 public function get_data()
 {
     $data = parent::get_data();
     if ($data !== null && isset($this->currentcourses)) {
         $data->selectedcourse = $this->currentcourses->get_selected_course();
         $data->courseid = $data->selectedcourse->id;
     }
     if ($data) {
         if ($data->short_summary_editor) {
             $data->short_description = $data->short_summary_editor["text"];
         }
         if ($data->summary_editor) {
             $data->long_description = $data->summary_editor["text"];
         }
     }
     return $data;
 }
 function get_data($slashed = true)
 {
     $data = parent::get_data($slashed);
     return $data;
 }
Exemple #21
0
 /**
  * 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
  */
 public function get_data()
 {
     $data = parent::get_data();
     if (!empty($data->saveguide)) {
         $data->status = gradingform_controller::DEFINITION_STATUS_READY;
     } else {
         if (!empty($data->saveguidedraft)) {
             $data->status = gradingform_controller::DEFINITION_STATUS_DRAFT;
         }
     }
     return $data;
 }
 public function get_data()
 {
     $data = parent::get_data();
     if ($data) {
         if ($data->body_editor) {
             $data->body = $data->body_editor;
         }
     }
     return $data;
 }
Exemple #23
0
 function get_data() {
     $data = parent::get_data();
     if ($data) {
         $data->format = $data->text['format'];
         $data->text = $data->text['text'];
     }
     return $data;
 }
 function get_data()
 {
     if (($data = parent::get_data()) === null) {
         return null;
     }
     return $this->addRequiredMembersToData($data);
 }
Exemple #25
0
 /**
  * Used to reformat the data from the editor component
  *
  * @return stdClass
  */
 function get_data()
 {
     $data = parent::get_data();
     if ($data !== null and isset($data->description)) {
         $data->descriptionformat = $data->description['format'];
         $data->description = $data->description['text'];
     }
     return $data;
 }
 function get_data()
 {
     $data = parent::get_data();
     if ($data) {
         $data->descriptionformat = $data->description['format'];
         $data->description = $data->description['text'];
     }
     return $data;
 }
Exemple #27
0
    public function get_data() {
        $data = parent::get_data();

        if (!empty($this->_customdata->submission->id)) {
            $itemid = $this->_customdata->submission->id;
        } else {
            $itemid = null; //TODO: this is wrong, itemid MUST be known when saving files!! (skodak)
        }

        if ($data) {
            $editoroptions = $this->get_editor_options();
            switch ($this->_customdata->assignment->assignmenttype) {
                case 'upload' :
                case 'uploadsingle' :
                    $data = file_postupdate_standard_filemanager($data, 'files', $editoroptions, $this->_customdata->context, 'mod_assignment', 'response', $itemid);
                    break;
                default :
                    break;
            }
            $data = file_postupdate_standard_editor($data, 'submissioncomment', $editoroptions, $this->_customdata->context, $editoroptions['component'], $editoroptions['filearea'], $itemid);
        }
        return $data;
    }
 public function get_data()
 {
     $data = parent::get_data();
     return $data;
 }
 function get_data()
 {
     $data = parent::get_data();
     if (isset($data->subscribetocourse) && !array_keys($data->user, 1)) {
         $data = false;
     }
     return $data;
 }
 function get_data($slashed = true)
 {
     $data = parent::get_data($slashed);
     if ($data == NULL) {
         return $data;
     }
     if (!empty($data->IssueDate)) {
         $data->IssueDate = date("Y-m-d\\TH:i:s.000\\Z", $data->IssueDate);
     } else {
         $data->IssueDate = '0000-00-00T00:00:00.000Z';
     }
     return $data;
 }