bold
+XXX;
+
+ $settings->add(new admin_setting_heading('lamslesson_validation', get_string('validationinfo', 'lamslesson'),
+ $html));
+}
+
Index: moodle/mod/lamslesson/styles.css
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/styles.css,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/styles.css 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1 @@
+.path-mod-lamslesson .smalltext {font-size: 0.75em;}
Index: moodle/mod/lamslesson/userinfo.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/userinfo.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/userinfo.php 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,46 @@
+libdir.'/datalib.php');
+ global $DB;
+
+ if(!isset($CFG->lamslesson_serverid)||!isset($CFG->lamslesson_serverkey))
+ {
+ header('HTTP/1.1 401 Unauthenticated');
+ exit(1);
+ }
+ $plaintext = trim($_GET['ts']).trim($_GET['un']).trim($CFG->lamslesson_serverid).trim($CFG->lamslesson_serverkey);
+ $hash = sha1(strtolower($plaintext));
+ if($hash!=$_GET['hs']){
+ header('HTTP/1.1 401 Unauthenticated');
+ exit(1);
+ }
+
+ //OK, the caller is authenticated. Now let's fulfill its request.
+ //What it needs is user info in CSV format. It should be like this:
+ //username,first name,last name,job title, department, organisation,
+ //address,phone,fax,mobile,email
+ $user = $DB->get_record('user', array('username'=>$_GET['un']));
+
+ //return false if none found
+ if(!$user){
+ header('HTTP/1.1 401 Unauthenticated');
+ exit(1);
+ }
+ $array = array('',$user->firstname,$user->lastname,$user->address,$user->city,'','',$user->country,$user->phone1,'','',$user->email,$user->country,substr($user->lang,0,2));
+ $comma_separated = implode(",", $array);//need more sophiscated algorithm to generate CSV formatted string
+ echo $comma_separated;
+
+?>
\ No newline at end of file
Index: moodle/mod/lamslesson/view.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/view.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/view.php 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,119 @@
+.
+
+
+/**
+ * Prints a particular instance of lamslesson
+ *
+ * You can have a rather longer description of the file as well,
+ * if you like, and it can span multiple lines.
+ *
+ * @package mod_lamslesson
+ * @copyright 2011 LAMS Foundation - Ernie Ghiglione (ernieg@lamsfoundation.org)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
+ */
+
+/// (Replace lamslesson with the name of your module and remove this line)
+
+require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
+require_once(dirname(__FILE__).'/lib.php');
+
+$id = optional_param('id', 0, PARAM_INT); // course_module ID, or
+$n = optional_param('n', 0, PARAM_INT); // lamslesson instance ID - it should be named as the first character of the module
+
+if ($id) {
+ $cm = get_coursemodule_from_id('lamslesson', $id, 0, false, MUST_EXIST);
+ $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
+ $lamslesson = $DB->get_record('lamslesson', array('id' => $cm->instance), '*', MUST_EXIST);
+} elseif ($n) {
+ $lamslesson = $DB->get_record('lamslesson', array('id' => $n), '*', MUST_EXIST);
+ $course = $DB->get_record('course', array('id' => $lamslesson->course), '*', MUST_EXIST);
+ $cm = get_coursemodule_from_instance('lamslesson', $lamslesson->id, $course->id, false, MUST_EXIST);
+} else {
+ print_error('You must specify a course_module ID or an instance ID');
+}
+
+require_login($course, true, $cm);
+
+$context = get_context_instance(CONTEXT_MODULE, $cm->id);
+$locale = lamslesson_get_locale($course->id);
+
+add_to_log($course->id, 'lamslesson', 'view', "view.php?id=$cm->id", $lamslesson->name, $cm->id);
+
+/// Print the page header
+
+$PAGE->set_url('/mod/lamslesson/view.php', array('id' => $cm->id));
+$PAGE->set_title($lamslesson->name);
+$PAGE->set_heading($course->shortname);
+$PAGE->set_button(update_module_button($cm->id, $course->id, get_string('modulename', 'lamslesson')));
+
+
+// Main page
+$options_html = '';
+$canmanage = has_capability('mod/lamslesson:manage', $context);
+
+// Log the lamslesson view.
+add_to_log($course->id, "lamslesson", "view lamslesson", "view.php?id=$cm->id", "$lamslesson->id", $cm->id);
+
+// Get raw data
+//print("ID:" . $cm->instance);
+//$lessons = $DB->get_records('lamslesson', 'id', $cm->instance);
+
+
+// Check capabilities
+
+$canparticipate = has_capability('mod/lamslesson:participate', $context);
+if ($canparticipate) {
+
+ if ($canmanage) {
+
+ }
+
+}
+
+
+// Output starts here
+echo $OUTPUT->header();
+
+// Main LAMS region
+echo $OUTPUT->heading($lamslesson->name);
+echo $OUTPUT->box_start('generalbox', 'instructions');
+echo '';
+echo format_module_intro('lamslesson', $lamslesson, $cm->id);
+echo '
';
+echo '
';
+echo '' . get_string('lastmodified', 'lamslesson') . ": " . userdate($lamslesson->timemodified) .'';
+echo $OUTPUT->box_end();
+
+echo $OUTPUT->box_start('generalbox', 'intro');
+if ($canparticipate) {
+ $learnerurl = lamslesson_get_url($USER->username, $locale['lang'], $locale['country'], $lamslesson->lesson_id, $course->id, $course->fullname, $course->timecreated, LAMSLESSON_PARAM_LEARNER_METHOD);
+ echo '';
+ echo $OUTPUT->action_link($learnerurl, get_string('openlesson', 'lamslesson'), new popup_action('click', $learnerurl, '', array('height' => 600, 'width' => 996)));
+ echo '
';
+}
+if ($canmanage) {
+ $monitorurl = lamslesson_get_url($USER->username, $locale['lang'], $locale['country'], $lamslesson->lesson_id, $course->id, $course->fullname, $course->timecreated, LAMSLESSON_PARAM_MONITOR_METHOD);
+ echo '';
+ echo $OUTPUT->action_link($monitorurl, get_string('openmonitor', 'lamslesson'), new popup_action('click', $monitorurl, '', array('height' => 600, 'width' => 996)));
+ echo '
';
+}
+echo $OUTPUT->box_end();
+// echo html_writer::table($table);
+//print_table($table);
+// Finish the page
+echo $OUTPUT->footer();
Index: moodle/mod/lamslesson/db/access.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/db/access.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/db/access.php 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,73 @@
+.
+
+
+/**
+ * Capability definitions for the lamslesson module
+ *
+ * The capabilities are loaded into the database table when the module is
+ * installed or updated. Whenever the capability definitions are updated,
+ * the module version number should be bumped up.
+ *
+ * The system has four possible values for a capability:
+ * CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (not set).
+ *
+ * It is important that capability names are unique. The naming convention
+ * for capabilities that are specific to modules and blocks is as follows:
+ * [mod/block]/:
+ *
+ * component_name should be the same as the directory name of the mod or block.
+ *
+ * Core moodle capabilities are defined thus:
+ * moodle/:
+ *
+ * Examples: mod/forum:viewpost
+ * block/recent_activity:view
+ * moodle/site:deleteuser
+ *
+ * The variable name for the capability definitions array is $capabilities
+ *
+ * @package mod_lamslesson
+ * @copyright 2011 LAMS Foundation - Ernie Ghiglione (ernieg@lamsfoundation.org)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$capabilities = array(
+
+ 'mod/lamslesson:participate' => array(
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'student' => CAP_ALLOW
+ )
+ ),
+
+ 'mod/lamslesson:manage' => array(
+ 'captype' => 'write',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'legacy' => array(
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'admin' => CAP_ALLOW
+
+ )
+ ),
+
+);
+
Index: moodle/mod/lamslesson/db/install.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/db/install.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/db/install.php 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,34 @@
+.
+
+/**
+ * This file replaces the legacy STATEMENTS section in db/install.xml,
+ * lib.php/modulename_install() post installation hook and partially defaults.php
+ *
+ * @package mod_lamslesson
+ * @copyright 2011 LAMS Foundation - Ernie Ghiglione (ernieg@lamsfoundation.org)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
+ */
+
+/**
+ * Post installation procedure
+ */
+function xmldb_lamslesson_install() {
+
+ /// insert here code to perform some actions
+
+}
Index: moodle/mod/lamslesson/db/install.xml
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/db/install.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/db/install.xml 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: moodle/mod/lamslesson/db/log.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/db/log.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/db/log.php 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,38 @@
+.
+
+/**
+ * Definition of log events
+ * NOTE: this is an example how to insert log event during installation/update.
+ * It is not really essential to know about it, but these logs were created as example
+ * in the previous 1.9 NEWMODULE.
+ *
+ * @package mod_lamslesson
+ * @copyright 2011 LAMS Foundation - Ernie Ghiglione (ernieg@lamsfoundation.org)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+global $DB;
+
+$logs = array(
+ array('module'=>'lamslesson', 'action'=>'add', 'mtable'=>'lamslesson', 'field'=>'name'),
+ array('module'=>'lamslesson', 'action'=>'update', 'mtable'=>'lamslesson', 'field'=>'name'),
+ array('module'=>'lamslesson', 'action'=>'view', 'mtable'=>'lamslesson', 'field'=>'name'),
+ array('module'=>'lamslesson', 'action'=>'view all', 'mtable'=>'lamslesson', 'field'=>'name')
+);
Index: moodle/mod/lamslesson/db/upgrade.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/db/upgrade.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/db/upgrade.php 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,157 @@
+.
+
+
+/**
+ * This file keeps track of upgrades to the lamslesson module
+ *
+ * Sometimes, changes between versions involve alterations to database
+ * structures and other major things that may break installations. The upgrade
+ * function in this file will attempt to perform all the necessary actions to
+ * upgrade your older installation to the current version. If there's something
+ * it cannot do itself, it will tell you what you need to do. The commands in
+ * here will all be database-neutral, using the functions defined in DLL libraries.
+ *
+ * @package mod_lamslesson
+ * @copyright 2011 LAMS Foundation - Ernie Ghiglione (ernieg@lamsfoundation.org)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * xmldb_lamslesson_upgrade
+ *
+ * @param int $oldversion
+ * @return bool
+ */
+function xmldb_lamslesson_upgrade($oldversion) {
+
+ global $DB;
+
+ $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
+
+/// And upgrade begins here. For each one, you'll need one
+/// block of code similar to the next one. Please, delete
+/// this comment lines once this file start handling proper
+/// upgrade code.
+
+/// if ($oldversion < YYYYMMDD00) { //New version in version.php
+///
+/// }
+
+/// Lines below (this included) MUST BE DELETED once you get the first version
+/// of your module ready to be installed. They are here only
+/// for demonstrative purposes and to show how the lamslesson
+/// iself has been upgraded.
+
+/// For each upgrade block, the file lamslesson/version.php
+/// needs to be updated . Such change allows Moodle to know
+/// that this file has to be processed.
+
+/// To know more about how to write correct DB upgrade scripts it's
+/// highly recommended to read information available at:
+/// http://docs.moodle.org/en/Development:XMLDB_Documentation
+/// and to play with the XMLDB Editor (in the admin menu) and its
+/// PHP generation posibilities.
+
+/// First example, some fields were added to install.xml on 2007/04/01
+ if ($oldversion < 2007040100) {
+
+ /// Define field course to be added to lamslesson
+ $table = new xmldb_table('lamslesson');
+ $field = new xmldb_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'id');
+
+ /// Add field course
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ /// Define field intro to be added to lamslesson
+ $table = new xmldb_table('lamslesson');
+ $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null,'name');
+
+ /// Add field intro
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ /// Define field introformat to be added to lamslesson
+ $table = new xmldb_table('lamslesson');
+ $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
+ 'intro');
+
+ /// Add field introformat
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+ }
+
+/// Second example, some hours later, the same day 2007/04/01
+/// two more fields and one index were added to install.xml (note the micro increment
+/// "01" in the last two digits of the version
+ if ($oldversion < 2007040101) {
+
+ /// Define field timecreated to be added to lamslesson
+ $table = new xmldb_table('lamslesson');
+ $field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
+ 'introformat');
+
+ /// Add field timecreated
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ /// Define field timemodified to be added to lamslesson
+ $table = new xmldb_table('lamslesson');
+ $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
+ 'timecreated');
+
+ /// Add field timemodified
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ /// Define index course (not unique) to be added to lamslesson
+ $table = new xmldb_table('lamslesson');
+ $index = new xmldb_index('courseindex', XMLDB_INDEX_NOTUNIQUE, array('course'));
+
+ /// Add index to course field
+ if (!$dbman->index_exists($table, $index)) {
+ $dbman->add_index($table, $index);
+ }
+
+ }
+
+/// Third example, the next day, 2007/04/02 (with the trailing 00), some actions were performed to install.php,
+/// related with the module
+ if ($oldversion < 2007040200) {
+ /// insert here code to perform some actions (same as in install.php)
+ }
+
+/// And that's all. Please, examine and understand the 3 example blocks above. Also
+/// it's interesting to look how other modules are using this script. Remember that
+/// the basic idea is to have "blocks" of code (each one being executed only once,
+/// when the module version (version.php) is updated.
+
+/// Lines above (this included) MUST BE DELETED once you get the first version of
+/// yout module working. Each time you need to modify something in the module (DB
+/// related, you'll raise the version and add one upgrade block here.
+
+/// Final return of upgrade result (true, all went good) to Moodle.
+ return true;
+}
Index: moodle/mod/lamslesson/lang/en/lamslesson.php
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/lang/en/lamslesson.php,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/lang/en/lamslesson.php 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,90 @@
+.
+
+
+/**
+ * English strings for lamslesson
+ *
+ * You can have a rather longer description of the file as well,
+ * if you like, and it can span multiple lines.
+ *
+ * @package mod_lamslesson
+ * @copyright 2011 LAMS Foundation - Ernie Ghiglione (ernieg@lamsfoundation.org)
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$string['modulename'] = 'LAMS Lesson';
+$string['modulenameplural'] = 'LAMS Lessons';
+$string['modulename_help'] = 'The LAMS Lesson module allows teachers to create LAMS lessons in Moodle.';
+$string['modulename_link'] = 'lamslesson';
+$string['lamslessonfieldset'] = 'Custom example fieldset';
+$string['lamslessonname'] = 'Lesson name';
+$string['lamslessonname_help'] = 'This is the content of the help tooltip associated with the lamslessonname field. Markdown syntax is supported.';
+$string['lamslesson'] = 'LAMS Lesson';
+$string['pluginadministration'] = 'LAMS Lesson administration';
+$string['pluginname'] = 'LAMS Lesson';
+$string['selectsequence'] = 'Select sequence';
+$string['availablesequences'] = 'Sequences';
+$string['openauthor'] = 'Author new LAMS lessons';
+
+// Admin interface
+$string['adminheader'] = 'LAMS Server Configuration';
+$string['admindescription'] = 'Configure your LAMS server settings. Make sure that the values you enter here correspond with the once you already entered in your LAMS server. Otherwise the integration might not work.';
+
+$string['serverurl'] = 'LAMS Server URL:';
+$string['serverurlinfo'] = 'Here you need to enter the URL for your LAMS server. ie: http://localhost:8080/lams/.';
+
+$string['serverid'] = 'Server ID:';
+$string['serveridinfo'] = 'What is the Server ID you entered in your LAMS server?';
+
+$string['serverkey'] = 'Server Key:';
+$string['serverkeyinfo'] = 'What is the Server Key you entered in your LAMS server?';
+
+$string['requestsource'] = 'Moodle instance name:';
+$string['requestsourceinfo'] = 'What is the name of your Moodle instance?. This value will appear after saving a sequence and will be used to prompt the user to "return to ". So here you can put the name you give your Moodle server. ie: "Virtual Campus"';
+
+$string['validationbutton'] = "Validate settings";
+$string['validationinfo'] = 'Press the button to validate your settings.';
+
+
+//
+
+$string['notsetup'] = 'Configuration is not complete';
+
+
+// Labels for errors when calling LAMS Server
+$string['restcall503'] = 'Call to LAMS failed: received an HTTP status of 503. This might mean that LAMS is unavailable. Please wait a minute and try again, or contact your system administrator.';
+$string['restcall403'] = 'Call to LAMS failed: received an HTTP status of 403 Forbidden. Please check the configurations settings and/or contact your system administrator.';
+$string['restcall400'] = 'Call to LAMS failed: received an HTTP status of 400 Bad Request. Please check the configurations settings and/or contact your system administrator.';
+$string['restcall500'] = 'Call to LAMS failed: received an HTTP status of 500 Internal Error. Please check the configurations settings and/or contact your system administrator.';
+$string['restcalldefault'] = 'Call to LAMS failed: received an HTTP status of: $a';
+$string['restcallfail'] = 'Call to LAMS failed: received no response or connection was refused. Please check that you have the correct LAMS server URL and that it is online.';
+
+$string['sequencenotselected'] = 'You must select a sequence to proceed.';
+
+// view.php
+
+$string['nolessons'] = 'There are no LAMS lessons yet in this instance.';
+$string['lessonname'] = 'Lesson name';
+$string['links'] = 'Links';
+$string['introduction'] = 'Introduction';
+$string['openmonitor'] = 'Monitor this lesson';
+$string['lastmodified'] = 'Last modified';
+$string['openlesson'] = 'Click here to open the lesson now';
+$string['empty'] = 'empty';
Index: moodle/mod/lamslesson/pix/icon.gif
===================================================================
RCS file: /usr/local/cvsroot/moodle/mod/lamslesson/pix/icon.gif,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ moodle/mod/lamslesson/pix/icon.gif 16 Jan 2011 23:29:52 -0000 1.1
@@ -0,0 +1,5 @@
+GIF89a �l ;71SMB\VI^WKd\PngWojXqkZpppzp_{q^vvw{xm�yf�zh�}k�}i��m��n��l�����u�����p��r��q����u��v�����~��y��y��|������������������������������������������������������������������������´�������������Ż�ɻ�п��������������ȱ�ȥ����ɦ�ͱ�Ͷ�̩�ͬ����Ϋ�������Э�Ю�Ե�Դ�յ��ؽ����غ���������������������������������������������������������������������������������������������������������������!�Created with GIMP !�
+ , ����;���BHl"%��gcdiejl��El%k]l.9�-I+=D1hBk(',�
+Z\F`_07*!K� Gab��bM�
+S��U� ���W�$O��Y�@h/�d@��v`�$�hvXt$�$��&"
+ ;
\ No newline at end of file