From 0236de8e9606d6f269ecec46aba47a8db2878a67 Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Tue, 6 Jul 2021 16:08:32 +0200 Subject: [PATCH] Current version --- db/access.php | 30 +++++++++++++++ db/install.xml | 26 +++++++++++++ index.php | 9 +++++ lang/en/expcontent.php | 13 +++++++ lib.php | 39 +++++++++++++++++++ mod_form.php | 28 ++++++++++++++ pix/icon.gif | Bin 0 -> 1016 bytes settings.php | 34 +++++++++++++++++ version.php | 9 +++++ view.php | 83 +++++++++++++++++++++++++++++++++++++++++ 10 files changed, 271 insertions(+) create mode 100644 db/access.php create mode 100644 db/install.xml create mode 100644 index.php create mode 100644 lang/en/expcontent.php create mode 100644 lib.php create mode 100644 mod_form.php create mode 100644 pix/icon.gif create mode 100644 settings.php create mode 100644 version.php create mode 100644 view.php diff --git a/db/access.php b/db/access.php new file mode 100644 index 0000000..f3c6f96 --- /dev/null +++ b/db/access.php @@ -0,0 +1,30 @@ + array( + 'riskbitmask' => RISK_XSS, + 'captype' => 'write', + 'contextlevel' => CONTEXT_COURSE, + 'archetypes' => array( + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW + ), + 'clonepermissionsfrom' => 'moodle/course:manageactivities' + ), + + 'mod/expcontent:view' => array( + 'captype' => 'read', + 'contextlevel' => CONTEXT_MODULE, + 'archetypes' => array( + 'guest' => CAP_ALLOW, + 'student' => CAP_ALLOW, + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW + ) +) + +); \ No newline at end of file diff --git a/db/install.xml b/db/install.xml new file mode 100644 index 0000000..8d7cf51 --- /dev/null +++ b/db/install.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/index.php b/index.php new file mode 100644 index 0000000..a7a616f --- /dev/null +++ b/index.php @@ -0,0 +1,9 @@ +get_record('course', array('id'=> $id))) { + print_error('Course ID is incorrect'); +} \ No newline at end of file diff --git a/lang/en/expcontent.php b/lang/en/expcontent.php new file mode 100644 index 0000000..7e6c02c --- /dev/null +++ b/lang/en/expcontent.php @@ -0,0 +1,13 @@ +timemodified = time(); + $expcontent->introformat = FORMAT_MOODLE; + + $expcontent->id = $DB->insert_record('expcontent', $expcontent); + + return $expcontent->id; +} + +function expcontent_update_instance($expcontent) { + global $DB; + + $expcontent->timemodified = time(); + $expcontent->id = $expcontent->instance; + + if (! $DB->update_record('expcontent', $expcontent)) { + return false; + } + + return true; +} + +function expcontent_delete_instance($id) { + global $DB; + + if (! $expcontent = $DB->get_record('expcontent', array('id' => $id))) { + return false; + } + + $DB->delete_records('expcontent', array('id' => $id)); + + return true; +} \ No newline at end of file diff --git a/mod_form.php b/mod_form.php new file mode 100644 index 0000000..d2b0574 --- /dev/null +++ b/mod_form.php @@ -0,0 +1,28 @@ +dirroot.'/course/moodleform_mod.php'); +require_once($CFG->dirroot.'/mod/expcontent/lib.php'); + +class mod_expcontent_mod_form extends moodleform_mod { + + function definition() { + global $CFG, $DB, $OUTPUT; + + $mform =& $this->_form; + + $mform->addElement('text', 'name', get_string('name', 'expcontent'), array('size'=>'64')); + $mform->setType('name', PARAM_TEXT); + $mform->addRule('name', null, 'required', null, 'client'); + + $mform->addElement('text', 'contentid', get_string('contentid', 'expcontent'), array('size'=>'64')); + $mform->setType('contentid', PARAM_TEXT); + $mform->addRule('contentid', null, 'required', null, 'client'); + + $this->standard_coursemodule_elements(); + + $this->add_action_buttons(); + + } +} \ No newline at end of file diff --git a/pix/icon.gif b/pix/icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..9bb383227b13ca11e8403c57b88a64c83f37babf GIT binary patch literal 1016 zcmZ?wbhEHbG+;1b_{PAXW94XI=W68WX6o!^>E>(e72xC->J}8?85Zpq8SfvJ5EPdj znwS=oo)epqo0LtXY5M9#kv zv+!op(p%{(Zs)AJQ?TZ4_2vg{eG_{oPw$&LbHeo5lV;AHHh1C7g-f>X+_PiP{$2YH zHf?{@zUy)4?#Fu%9-e&g>8vBq7oU2$;_R#4*Wc~A@&3@!6Gu;;K5^#k>GK!PU%Gth z%C*baZd|*0>(+|z!1!!19A>1P8it#H3T;`x3sn} zF)%VR^mH<{O_(^TwYzuP^zO;CCQh9`Z$9JfMe~;|T{LOw%4N%2R0{lM>D;>{ouM(<)Vxd4RW_ zuaJS|!l|IvrVEP%IzJ{JW)m>#adBi%J!I?1z`nu3eMxH@k414>fg{UYuIe7OII9a! zVkYoem3FN#bUtCJ${81B#PE2I;1bWmCI+*^CoCnlN%>l`H5}?M4va}TE6E(eEB-Iw z9OJ}*P8~MY7t?Ygx-U0Rj#o1KQq!flf`L)x+rIjxkSFWIozO{k`{c~RK+?j3jQ)+B#9A=I?$Zb!o1JBbG75*#{DH5d0hQbfj9xAc*Ut)z?m3d6B%XN0 zpHEu0=p>VSg$BRN3=yLVwQ_cfj!ti5gl2VKunA=9Y0Gh8;M94Sytqi}n8rjF-kB9g zSfmTXO*qZ0zWg{NY~v#G#9}%}03)}b*+C~(Pc6$XBkm~&n6nSM9Bk&~*3gjGTP1M8 xfpt^Fg@#!cn^vBhoBimL;Jno@G*#yR`)TPpeZGy7hBlMVq7J1#4k-=>YXCRGp~nCK literal 0 HcmV?d00001 diff --git a/settings.php b/settings.php new file mode 100644 index 0000000..2a8d552 --- /dev/null +++ b/settings.php @@ -0,0 +1,34 @@ +. + +/** + * Administration settings definitions for the Diary module. + * + * @package mod_diary + * @copyright 2019 AL Rachels (drachels@drachels.com) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ +defined('MOODLE_INTERNAL') || die(); + +if ($ADMIN->fulltree) { + + $settings->add(new admin_setting_heading('mod_expcontent/settings', get_string('settings'), '')); + + $settings->add(new admin_setting_configtext('mod_expcontent/baseurl', + get_string('baseurl', 'expcontent'), + get_string('baseurl_help', 'expcontent'), 'http://expcontent.ahsoka.kumi.systems:7000/', PARAM_TEXT, 15)); + +} \ No newline at end of file diff --git a/version.php b/version.php new file mode 100644 index 0000000..20b4e92 --- /dev/null +++ b/version.php @@ -0,0 +1,9 @@ +version = "2021070600"; +$plugin->component = 'mod_expcontent'; +$plugin->maturity = MATURITY_ALPHA; +$plugin->release = 'v0.0.1'; +$plugin->requires = '2019111800'; \ No newline at end of file diff --git a/view.php b/view.php new file mode 100644 index 0000000..2bb1e19 --- /dev/null +++ b/view.php @@ -0,0 +1,83 @@ +get_record('expcontent', array('id'=> $cm->instance), '*', MUST_EXIST); + +$expconfig = get_config('mod_expcontent'); +$baseurl = $expconfig->baseurl; + +if ($baseurl[-1] != "/") $baseurl += "/"; + +?> + + + + +<?php echo($expcontent->name); ?> + + +
    + +
  • name); ?>
  • +
  • +
+ + +