diff --git a/db/access.php b/db/access.php new file mode 100644 index 0000000..ce8ee2e --- /dev/null +++ b/db/access.php @@ -0,0 +1,33 @@ + + */ + +defined('MOODLE_INTERNAL') || die(); + +$capabilities = [ + 'mod/adleradaptivity:addinstance' => [ + 'riskbitmask' => RISK_XSS, + 'captype' => 'write', + 'contextlevel' => CONTEXT_COURSE, + 'archetypes' => [ + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW, + ], + 'clonepermissionsfrom' => 'moodle/course:manageactivities', + ], + 'mod/adleradaptivity:view' => [ + 'captype' => 'read', + 'contextlevel' => CONTEXT_MODULE, + 'archetypes' => [ + 'guest' => CAP_ALLOW, + 'student' => CAP_ALLOW, + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW, + ], + ], +]; diff --git a/db/install.xml b/db/install.xml new file mode 100644 index 0000000..c49457b --- /dev/null +++ b/db/install.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/index.php b/index.php new file mode 100644 index 0000000..3869c0b --- /dev/null +++ b/index.php @@ -0,0 +1,18 @@ +get_record('course', ['id'=> $id], '*', MUST_EXIST); + +// Require that the user is logged into the course. +require_course_login($course); + +$modinfo = get_fast_modinfo($course); + +foreach ($modinfo->get_instances_of('adleradaptivity') as $instanceid => $cm) { + // Display information about your activity. +} \ No newline at end of file diff --git a/lang/en/adleradaptivity.php b/lang/en/adleradaptivity.php new file mode 100644 index 0000000..44252c0 --- /dev/null +++ b/lang/en/adleradaptivity.php @@ -0,0 +1,17 @@ + + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +$string['pluginname'] = 'Adler Adaptivity Activity Module'; +$string['modulename'] = 'Adler Adaptivity'; +$string['modulenameplural'] = 'Adler Adaptivities'; +$string['modulename_help'] = 'Insert modulename help text here.'; +$string['pluginadministration'] = 'Adler Adaptivity administration'; + +$string['form_field_title'] = 'Element title'; +$string['form_field_intro'] = 'Description (currently unused but required field by moodle)'; diff --git a/lib.php b/lib.php new file mode 100644 index 0000000..a49a056 --- /dev/null +++ b/lib.php @@ -0,0 +1,48 @@ +timemodified = time(); + + $id = $DB->insert_record("adleradaptivity", $instancedata); + + // Update completion date event. This is a default feature activated for all modules (create module -> Activity completion). + $completiontimeexpected = !empty($instancedata->completionexpected) ? $instancedata->completionexpected : null; + completion_api::update_completion_date_event($instancedata->coursemodule, 'adleradaptivity', $id, $completiontimeexpected); + + return $id; + +} + +/** The [modname]_update_instance() function is called when the activity + * editing form is submitted. + * + * @param $instancedata + * @param $mform + * @return bool + */ +function adleradaptivity_update_instance($instancedata, $mform): bool { + +} + +/** The [modname]_delete_instance() function is called when the activity + * deletion is confirmed. It is responsible for removing all data associated + * with the instance. + * + * @param $id + * @return bool + */ +function adleradaptivity_delete_instance($id): bool { + +} diff --git a/mod_form.php b/mod_form.php new file mode 100644 index 0000000..2b8db06 --- /dev/null +++ b/mod_form.php @@ -0,0 +1,29 @@ +dirroot.'/course/moodleform_mod.php'); +require_once($CFG->dirroot.'/mod/adleradaptivity/lib.php'); + +class mod_adleradaptivity_mod_form extends moodleform_mod { + + function definition() { + global $CFG, $DB, $OUTPUT; + + $mform =& $this->_form; + + $mform->addElement('text', 'name', get_string('form_field_title', 'mod_adleradaptivity'), ['size'=>'64']); + $mform->setType('name', PARAM_TEXT); + $mform->addRule('name', null, 'required', null, 'client'); + + $this->standard_intro_elements(get_string('form_field_intro', 'mod_adleradaptivity')); + + +// // Label does not add "Show description" checkbox meaning that 'intro' is always shown on the course page. +// $mform->addElement('hidden', 'showdescription', 1); +// $mform->setType('showdescription', PARAM_INT); + + $this->standard_coursemodule_elements(); + + $this->add_action_buttons(); + } + +} \ No newline at end of file diff --git a/pix/monologo.png b/pix/monologo.png new file mode 100644 index 0000000..1288227 Binary files /dev/null and b/pix/monologo.png differ diff --git a/version.php b/version.php new file mode 100644 index 0000000..348630c --- /dev/null +++ b/version.php @@ -0,0 +1,29 @@ +. + +/** + * Label module version info + * + * @package mod_adleradaptivity + * @copyright 2023, Markus Heck + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->version = 2023062909; +$plugin->requires = 2021051712.05; // Moodle version +$plugin->component = 'mod_adleradaptivity'; // Full name of the plugin (used for diagnostics) +$plugin->maturity = MATURITY_ALPHA; diff --git a/view.php b/view.php new file mode 100644 index 0000000..5856aec --- /dev/null +++ b/view.php @@ -0,0 +1,46 @@ +get_record('adleradaptivity', ['id'=> $cm->instance], '*', MUST_EXIST); + +global $PAGE, $OUTPUT; +require_course_login($course, true, $cm); + + + +//require_once("../../config.php"); +// +$id = optional_param('id',0,PARAM_INT); // Course Module ID, or +//$l = optional_param('l',0,PARAM_INT); // adleradaptivity ID +// +if ($id) { + $PAGE->set_url('/mod/adleradaptivity/view.php', array('id' => $id)); +// if (! $cm = get_coursemodule_from_id('adleradaptivity', $id, 0, true)) { +// throw new \moodle_exception('invalidcoursemodule'); +// } +// +// if (! $course = $DB->get_record("course", array("id"=>$cm->course))) { +// throw new \moodle_exception('coursemisconf'); +// } +// +// if (! $adleradaptivity = $DB->get_record("adleradaptivity", array("id"=>$cm->instance))) { +// throw new \moodle_exception('invalidcoursemodule'); +// } + +//} else { +// $PAGE->set_url('/mod/adleradaptivity/view.php', array('l' => $l)); +// if (! $adleradaptivity = $DB->get_record("adleradaptivity", array("id"=>$l))) { +// throw new \moodle_exception('invalidcoursemodule'); +// } +// if (! $course = $DB->get_record("course", array("id"=>$adleradaptivity->course)) ){ +// throw new \moodle_exception('coursemisconf'); +// } +// if (! $cm = get_coursemodule_from_instance("adleradaptivity", $adleradaptivity->id, $course->id, true)) { +// throw new \moodle_exception('invalidcoursemodule'); +// } +} + +echo $OUTPUT->footer(); \ No newline at end of file