' . $result . '
';
}
/**
diff --git a/main/inc/lib/wami-recorder/Wami.swf b/main/inc/lib/wami-recorder/Wami.swf
new file mode 100644
index 0000000000..047bbc39ae
Binary files /dev/null and b/main/inc/lib/wami-recorder/Wami.swf differ
diff --git a/main/inc/lib/wami-recorder/buttons.png b/main/inc/lib/wami-recorder/buttons.png
new file mode 100644
index 0000000000..3520230b03
Binary files /dev/null and b/main/inc/lib/wami-recorder/buttons.png differ
diff --git a/main/inc/lib/wami-recorder/gui.js b/main/inc/lib/wami-recorder/gui.js
new file mode 100644
index 0000000000..5cff480c92
--- /dev/null
+++ b/main/inc/lib/wami-recorder/gui.js
@@ -0,0 +1,349 @@
+var Wami = window.Wami || {};
+
+// Upon a creation of a new Wami.GUI(options), we assume that a WAMI recorder
+// has been initialized.
+Wami.GUI = function(options) {
+ var RECORD_BUTTON = 1;
+ var PLAY_BUTTON = 2;
+
+ setOptions(options);
+ setupDOM();
+
+ var recordButton, playButton;
+ var recordInterval, playInterval;
+
+ function createDiv(id, style) {
+ var div = document.createElement("div");
+ if (id) {
+ div.setAttribute('id', id);
+ }
+ if (style) {
+ div.style.cssText = style;
+ }
+ return div;
+ }
+
+ function setOptions(options) {
+ if (!options.buttonUrl) {
+ options.buttonUrl = "buttons.png";
+ }
+
+ if (typeof options.listen == 'undefined' || options.listen) {
+ listen();
+ }
+ }
+
+ function setupDOM() {
+ var guidiv = createDiv(null,
+ "position: absolute; width: 214px; height: 137px;");
+ document.getElementById(options.id).appendChild(guidiv);
+
+ var rid = Wami.createID();
+ var recordDiv = createDiv(rid,
+ "position: absolute; left: 40px; top: 25px");
+ guidiv.appendChild(recordDiv);
+
+ recordButton = new Button(rid, RECORD_BUTTON, options.buttonUrl);
+ recordButton.onstart = startRecording;
+ recordButton.onstop = stopRecording;
+
+ recordButton.setEnabled(true);
+
+ if (!options.singleButton) {
+ var pid = Wami.createID();
+ var playDiv = createDiv(pid,
+ "position: absolute; right: 40px; top: 25px");
+ guidiv.appendChild(playDiv);
+
+ playButton = new Button(pid, PLAY_BUTTON, options.buttonUrl);
+ playButton.onstart = startPlaying;
+ playButton.onstop = stopPlaying;
+ }
+ }
+
+ /**
+ * These methods are called on clicks from the GUI.
+ */
+ function startRecording() {
+ if (!options.recordUrl) {
+ alert("No record Url specified!");
+ }
+ recordButton.setActivity(0);
+ playButton.setEnabled(false);
+ Wami.startRecording(options.recordUrl,
+ Wami.nameCallback(onRecordStart), Wami
+ .nameCallback(onRecordFinish), Wami
+ .nameCallback(onError));
+ }
+
+ function stopRecording() {
+ Wami.stopRecording();
+ clearInterval(recordInterval);
+ recordButton.setEnabled(true);
+ }
+
+ function startPlaying() {
+ if (!options.playUrl) {
+ alert('No play URL specified!');
+ }
+
+ playButton.setActivity(0);
+ recordButton.setEnabled(false);
+
+ Wami.startPlaying(options.playUrl, Wami.nameCallback(onPlayStart), Wami
+ .nameCallback(onPlayFinish), Wami.nameCallback(onError));
+ }
+
+ function stopPlaying() {
+ Wami.stopPlaying();
+ }
+
+ this.setPlayUrl = function(url) {
+ options.playUrl = url;
+ }
+
+ this.setRecordUrl = function(url) {
+ options.recordUrl = url;
+ }
+
+ this.setPlayEnabled = function(val) {
+ playButton.setEnabled(val);
+ }
+
+ this.setRecordEnabled = function(val) {
+ recordButton.setEnabled(val);
+ }
+
+ /**
+ * Callbacks from the flash indicating certain events
+ */
+
+ function onError(e) {
+ alert(e);
+ }
+
+ function onRecordStart() {
+ recordInterval = setInterval(function() {
+ if (recordButton.isActive()) {
+ var level = Wami.getRecordingLevel();
+ recordButton.setActivity(level);
+ }
+ }, 200);
+ if (options.onRecordStart) {
+ options.onRecordStart();
+ }
+ }
+
+ function onRecordFinish() {
+ playButton.setEnabled(true);
+ if (options.onRecordFinish) {
+ options.onRecordFinish();
+ }
+ }
+
+ function onPlayStart() {
+ playInterval = setInterval(function() {
+ if (playButton.isActive()) {
+ var level = Wami.getPlayingLevel();
+ playButton.setActivity(level);
+ }
+ }, 200);
+ if (options.onPlayStart) {
+ options.onPlayStart();
+ }
+ }
+
+ function onPlayFinish() {
+ clearInterval(playInterval);
+ recordButton.setEnabled(true);
+ playButton.setEnabled(true);
+ if (options.onPlayFinish) {
+ options.onPlayFinish();
+ }
+ }
+
+ function listen() {
+ Wami.startListening();
+ // Continually listening when the window is in focus allows us to
+ // buffer a little audio before the users clicks, since sometimes
+ // people talk too soon. Without "listening", the audio would record
+ // exactly when startRecording() is called.
+ window.onfocus = function() {
+ Wami.startListening();
+ };
+
+ // Note that the use of onfocus and onblur should probably be replaced
+ // with a more robust solution (e.g. jQuery's $(window).focus(...)
+ window.onblur = function() {
+ Wami.stopListening();
+ };
+ }
+
+ function Button(buttonid, type, url) {
+ var self = this;
+ self.active = false;
+ self.type = type;
+
+ init();
+
+ // Get the background button image position
+ // Index: 1) normal 2) pressed 3) mouse-over
+ function background(index) {
+ if (index == 1)
+ return "-56px 0px";
+ if (index == 2)
+ return "0px 0px";
+ if (index == 3)
+ return "-112px 0";
+ alert("Background not found: " + index);
+ }
+
+ // Get the type of meter and its state
+ // Index: 1) enabled 2) meter 3) disabled
+ function meter(index, offset) {
+ var top = 5;
+ if (offset)
+ top += offset;
+ if (self.type == RECORD_BUTTON) {
+ if (index == 1)
+ return "-169px " + top + "px";
+ if (index == 2)
+ return "-189px " + top + "px";
+ if (index == 3)
+ return "-249px " + top + "px";
+ } else {
+ if (index == 1)
+ return "-269px " + top + "px";
+ if (index == 2)
+ return "-298px " + top + "px";
+ if (index == 3)
+ return "-327px " + top + "px";
+ }
+ alert("Meter not found: " + self.type + " " + index);
+ }
+
+ function silhouetteWidth() {
+ if (self.type == RECORD_BUTTON) {
+ return "20px";
+ } else {
+ return "29px";
+ }
+ }
+
+ function mouseHandler(e) {
+ var rightclick;
+ if (!e)
+ var e = window.event;
+ if (e.which)
+ rightclick = (e.which == 3);
+ else if (e.button)
+ rightclick = (e.button == 2);
+
+ if (!rightclick) {
+ if (self.active && self.onstop) {
+ self.active = false;
+ self.onstop();
+ } else if (!self.active && self.onstart) {
+ self.active = true;
+ self.onstart();
+ }
+ }
+ }
+
+ function init() {
+ var div = document.createElement("div");
+ var elem = document.getElementById(buttonid);
+ if (elem) {
+ elem.appendChild(div);
+ } else {
+ alert('Could not find element on page named ' + buttonid);
+ }
+
+ self.guidiv = document.createElement("div");
+ self.guidiv.style.width = '56px';
+ self.guidiv.style.height = '63px';
+ self.guidiv.style.cursor = 'pointer';
+ self.guidiv.style.background = "url(" + url + ") no-repeat";
+ self.guidiv.style.backgroundPosition = background(1);
+ div.appendChild(self.guidiv);
+
+ // margin auto doesn't work in IE quirks mode
+ // http://stackoverflow.com/questions/816343/why-will-this-div-img-not-center-in-ie8
+ // text-align is a hack to force it to work even if you forget the
+ // doctype.
+ self.guidiv.style.textAlign = 'center';
+
+ self.meterDiv = document.createElement("div");
+ self.meterDiv.style.width = silhouetteWidth();
+ self.meterDiv.style.height = '63px';
+ self.meterDiv.style.margin = 'auto';
+ self.meterDiv.style.cursor = 'pointer';
+ self.meterDiv.style.position = 'relative';
+ self.meterDiv.style.background = "url(" + url + ") no-repeat";
+ self.meterDiv.style.backgroundPosition = meter(2);
+ self.guidiv.appendChild(self.meterDiv);
+
+ self.coverDiv = document.createElement("div");
+ self.coverDiv.style.width = silhouetteWidth();
+ self.coverDiv.style.height = '63px';
+ self.coverDiv.style.margin = 'auto';
+ self.coverDiv.style.cursor = 'pointer';
+ self.coverDiv.style.position = 'relative';
+ self.coverDiv.style.background = "url(" + url + ") no-repeat";
+ self.coverDiv.style.backgroundPosition = meter(1);
+ self.meterDiv.appendChild(self.coverDiv);
+
+ self.active = false;
+ self.guidiv.onmousedown = mouseHandler;
+ }
+
+ self.isActive = function() {
+ return self.active;
+ }
+
+ self.setActivity = function(level) {
+ self.guidiv.onmouseout = function() {
+ };
+ self.guidiv.onmouseover = function() {
+ };
+ self.guidiv.style.backgroundPosition = background(2);
+ self.coverDiv.style.backgroundPosition = meter(1, 5);
+ self.meterDiv.style.backgroundPosition = meter(2, 5);
+
+ var totalHeight = 31;
+ var maxHeight = 9;
+
+ // When volume goes up, the black image loses height,
+ // creating the perception of the colored one increasing.
+ var height = (maxHeight + totalHeight - Math.floor(level / 100
+ * totalHeight));
+ self.coverDiv.style.height = height + "px";
+ }
+
+ self.setEnabled = function(enable) {
+ var guidiv = self.guidiv;
+ self.active = false;
+ if (enable) {
+ self.coverDiv.style.backgroundPosition = meter(1);
+ self.meterDiv.style.backgroundPosition = meter(1);
+ guidiv.style.backgroundPosition = background(1);
+ guidiv.onmousedown = mouseHandler;
+ guidiv.onmouseover = function() {
+ guidiv.style.backgroundPosition = background(3);
+ };
+ guidiv.onmouseout = function() {
+ guidiv.style.backgroundPosition = background(1);
+ };
+ } else {
+ self.coverDiv.style.backgroundPosition = meter(3);
+ self.meterDiv.style.backgroundPosition = meter(3);
+ guidiv.style.backgroundPosition = background(1);
+ guidiv.onmousedown = null;
+ guidiv.onmouseout = function() {
+ };
+ guidiv.onmouseover = function() {
+ };
+ }
+ }
+ }
+}
diff --git a/main/inc/lib/wami-recorder/index.html b/main/inc/lib/wami-recorder/index.html
new file mode 100644
index 0000000000..aa7b9c934b
--- /dev/null
+++ b/main/inc/lib/wami-recorder/index.html
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/main/inc/lib/wami-recorder/record_document.php b/main/inc/lib/wami-recorder/record_document.php
new file mode 100644
index 0000000000..6c89cf4614
--- /dev/null
+++ b/main/inc/lib/wami-recorder/record_document.php
@@ -0,0 +1,64 @@
+
\ No newline at end of file
diff --git a/main/inc/lib/wami-recorder/recorder.js b/main/inc/lib/wami-recorder/recorder.js
new file mode 100644
index 0000000000..299e084b46
--- /dev/null
+++ b/main/inc/lib/wami-recorder/recorder.js
@@ -0,0 +1,273 @@
+var Wami = window.Wami || {};
+
+// Returns a (very likely) unique string with of random letters and numbers
+Wami.createID = function() {
+ return "wid" + ("" + 1e10).replace(/[018]/g, function(a) {
+ return (a ^ Math.random() * 16 >> a / 4).toString(16)
+ });
+}
+
+// Creates a named callback in WAMI and returns the name as a string.
+Wami.nameCallback = function(cb, cleanup) {
+ Wami._callbacks = Wami._callbacks || {};
+ var id = Wami.createID();
+ Wami._callbacks[id] = function() {
+ if (cleanup) {
+ Wami._callbacks[id] = null;
+ }
+ cb.apply(null, arguments);
+ };
+ var named = "Wami._callbacks['" + id + "']";
+ return named;
+}
+
+// This method ensures that a WAMI recorder is operational, and that
+// the following API is available in the Wami namespace. All functions
+// must be named (i.e. cannot be anonymous).
+//
+// Wami.startPlaying(url, startfn = null, finishedfn = null, failedfn = null);
+// Wami.stopPlaying()
+//
+// Wami.startRecording(url, startfn = null, finishedfn = null, failedfn = null);
+// Wami.stopRecording()
+//
+// Wami.getRecordingLevel() // Returns a number between 0 and 100
+// Wami.getPlayingLevel() // Returns a number between 0 and 100
+//
+// Wami.hide()
+// Wami.show()
+//
+// Manipulate the WAMI recorder's settings. In Flash
+// we need to check if the microphone permission has been granted.
+// We might also set/return sample rate here, etc.
+//
+// Wami.getSettings();
+// Wami.setSettings(options);
+//
+// Optional way to set up browser so that it's constantly listening
+// This is to prepend audio in case the user starts talking before
+// they click-to-talk.
+//
+// Wami.startListening()
+//
+Wami.setup = function(options) {
+ if (Wami.startRecording) {
+ // Wami's already defined.
+ if (options.onReady) {
+ options.onReady();
+ }
+ return;
+ }
+
+ // Assumes that swfobject.js is included if Wami.swfobject isn't
+ // already defined.
+ Wami.swfobject = Wami.swfobject || swfobject;
+
+ if (!Wami.swfobject) {
+ alert("Unable to find swfobject to help embed the SWF.");
+ }
+
+ var _options;
+ setOptions(options);
+ embedWamiSWF(_options.id, Wami.nameCallback(delegateWamiAPI));
+
+ function supportsTransparency() {
+ // Detecting the OS is a big no-no in Javascript programming, but
+ // I can't think of a better way to know if wmode is supported or
+ // not... since NOT supporting it (like Flash on Ubuntu) is a bug.
+ return (navigator.platform.indexOf("Linux") == -1);
+ }
+
+ function setOptions(options) {
+ // Start with default options
+ _options = {
+ swfUrl : "Wami.swf",
+ onReady : function() {
+ Wami.hide();
+ },
+ onSecurity : checkSecurity,
+ onError : function(error) {
+ alert(error);
+ }
+ };
+
+ if (typeof options == 'undefined') {
+ alert('Need at least an element ID to place the Flash object.');
+ }
+
+ if (typeof options == 'string') {
+ _options.id = options;
+ } else {
+ _options.id = options.id;
+ }
+
+ if (options.swfUrl) {
+ _options.swfUrl = options.swfUrl;
+ }
+
+ if (options.onReady) {
+ _options.onReady = options.onReady;
+ }
+
+ if (options.onLoaded) {
+ _options.onLoaded = options.onLoaded;
+ }
+
+ if (options.onSecurity) {
+ _options.onSecurity = options.onSecurity;
+ }
+
+ if (options.onError) {
+ _options.onError = options.onError;
+ }
+
+ // Create a DIV for the SWF under _options.id
+
+ var container = document.createElement('div');
+ container.style.position = 'absolute';
+ _options.cid = Wami.createID();
+ container.setAttribute('id', _options.cid);
+
+ var swfdiv = document.createElement('div');
+ var id = Wami.createID();
+ swfdiv.setAttribute('id', id);
+
+ container.appendChild(swfdiv);
+ document.getElementById(_options.id).appendChild(container);
+
+ _options.id = id;
+ }
+
+ function checkSecurity() {
+ var settings = Wami.getSettings();
+ if (settings.microphone.granted) {
+ _options.onReady();
+ } else {
+ // Show any Flash settings panel you want:
+ // http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/SecurityPanel.html
+ Wami.showSecurity("privacy", "Wami.show", Wami
+ .nameCallback(_options.onSecurity), Wami
+ .nameCallback(_options.onError));
+ }
+ }
+
+ // Embed the WAMI SWF and call the named callback function when loaded.
+ function embedWamiSWF(id, initfn) {
+ var flashVars = {
+ visible : false,
+ loadedCallback : initfn
+ }
+
+ var params = {
+ allowScriptAccess : "always"
+ }
+
+ if (supportsTransparency()) {
+ params.wmode = "transparent";
+ }
+
+ if (typeof console !== 'undefined') {
+ flashVars.console = true;
+ }
+
+ var version = '10.0.0';
+ document.getElementById(id).innerHTML = "WAMI requires Flash "
+ + version
+ + " or greater
+See http://www.google.com/uds/solutions/dynamicfeed/index.html for further information.
+
\ No newline at end of file
diff --git a/plugin/rss/resources/arrow-bullet.png b/plugin/rss/resources/arrow-bullet.png
new file mode 100644
index 0000000000..bbb5d27e5a
Binary files /dev/null and b/plugin/rss/resources/arrow-bullet.png differ
diff --git a/plugin/rss/resources/color.css b/plugin/rss/resources/color.css
new file mode 100644
index 0000000000..de6366f445
--- /dev/null
+++ b/plugin/rss/resources/color.css
@@ -0,0 +1,41 @@
+
+.gfg-root a:link,
+.gfg-root a:visited,
+.gfg-root a:focus,
+.gfg-root a:active
+{
+ color: #CC0066;
+}
+
+.gfg-subtitle, .gfg-title{
+ background-color: #CC0066 !important;
+ color: #FFFFFF !important;
+}
+
+.gfg-subtitle > a{
+ color: #FFFFFF !important;
+}
+
+.gfg-subtitle > a:hover{
+ color: black !important;
+}
+
+.gfg-root a:hover, .gfg-subtitle:hover {
+ color: black;
+}
+
+.gfg-listentry-odd:hover{
+ background-color: #E9E9F0 !important;
+}
+
+.gfg-listentry-even:hover{
+ background-color: #E9E9F0 !important;
+}
+
+.gfg-horizontal-root .gfg-entry .gf-result, .gfg-horizontal-root .gfg-entry, .gfg-horizontal-root .gf-snippet{
+ background-color: white !important;
+}
+
+.gfg-horizontal-root .gfg-entry {
+ background-color: white !important;
+}
diff --git a/plugin/rss/resources/rss.css b/plugin/rss/resources/rss.css
new file mode 100644
index 0000000000..0657d8a391
--- /dev/null
+++ b/plugin/rss/resources/rss.css
@@ -0,0 +1,103 @@
+@import url(http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css);
+
+.well.sidebar-nav.rss
+{
+}
+
+/*google feeds*/
+
+.gfg-listentry-highlight,
+.gfg-listentry
+{
+ background-position: left center;
+ background-repeat: no-repeat;
+ padding-left: 20px;
+}
+
+.gfg-root a:link,
+.gfg-root a:visited,
+.gfg-root a:focus,
+.gfg-root a:active
+{
+ font-weight: normal;
+ text-decoration: none;
+}
+
+.gfg-root {
+ font-family: Verdana,Geneva,Arial,Helvetica,sans-serif !important;
+ border-left:0px;
+ border-right:0px;
+ border-top:0px ;
+}
+.gfg-listentry {
+ line-height: 14px !important;
+}
+
+.gfg-listentry{
+ white-space: normal;
+}
+
+.gfg-subtitle, .gfg-title{
+ font-weight: bold ;
+}
+
+.gfg-title{
+ display: none;
+}
+
+.gfg-subtitle a:link, .gfg-title a:link{
+ font-weight: bold;
+}
+
+.gfg-root .gfg-entry .gf-result .gf-title{
+ white-space: normal !important;
+}
+
+.gfg-entry{
+ height:9.5em !important;
+ /* border: 1px solid grey;
+ border-radius: 8px 8px 8px 8px;
+ margin:2px;*/
+}
+
+.gfg-root, .gfg-entry, .gf-result, .gf-snippet{
+ background-color: transparent !important;
+}
+
+.gfg-root a:hover, .gfg-subtitle:hover {
+ text-decoration: none;
+}
+
+.gfg-listentry{
+ height: auto;
+ padding-top:4px;
+ padding-bottom: 4px;
+ border-bottom-style: dotted;
+ border-bottom-width: 1px;
+}
+
+.gfg-listentry-odd {
+ background-color: transparent !important;
+}
+
+.gf-author, .gf-relativePublishedDate, .gf-spacer{
+ display:none !important;
+}
+
+.gfg-horizontal-root .gfg-entry .gf-result .gf-snippet {
+ display: block;
+ clear:both;
+}
+
+.gfg-branding{
+ display:none;
+}
+
+.gfg-horizontal-root{
+ height: auto;
+ border:none;
+}
+
+.gfg-horizontal-container{
+ display:inline;
+}
\ No newline at end of file
diff --git a/plugin/search_course/index.php b/plugin/search_course/index.php
new file mode 100644
index 0000000000..f5701a09a4
--- /dev/null
+++ b/plugin/search_course/index.php
@@ -0,0 +1,5 @@
+run();
diff --git a/plugin/search_course/lang/english.php b/plugin/search_course/lang/english.php
new file mode 100644
index 0000000000..4474823a0f
--- /dev/null
+++ b/plugin/search_course/lang/english.php
@@ -0,0 +1,10 @@
+
+ */
+
+$strings['plugin_title'] = "Search Course";
+$strings['plugin_comment'] = "Allow to search the course catalog and register to courses.";
diff --git a/plugin/search_course/lang/french.php b/plugin/search_course/lang/french.php
new file mode 100644
index 0000000000..207b07a15a
--- /dev/null
+++ b/plugin/search_course/lang/french.php
@@ -0,0 +1,10 @@
+
+ */
+
+$strings['plugin_title'] = "Rechercher un cours";
+$strings['plugin_comment'] = "Permets de rechercher un cours dans le catalogue et de s'inscrire.";
\ No newline at end of file
diff --git a/plugin/search_course/lib/register_course_widget.class.php b/plugin/search_course/lib/register_course_widget.class.php
new file mode 100644
index 0000000000..397454f30a
--- /dev/null
+++ b/plugin/search_course/lib/register_course_widget.class.php
@@ -0,0 +1,163 @@
+action_subscribe_user();
+ }
+
+ /**
+ * Handle the subscribe action.
+ *
+ * @return bool
+ */
+ function action_subscribe_user()
+ {
+ $action = self::get('action');
+ if ($action != self::ACTION_SUBSCRIBE)
+ {
+ return false;
+ }
+
+ $course_code = self::post(self::PARAM_SUBSCRIBE);
+ if (empty($course_code))
+ {
+ return false;
+ }
+
+ $registration_code = self::post(self::PARAM_PASSCODE);
+
+ if ($this->subscribe_user($course_code, $registration_code))
+ {
+ Display::display_confirmation_message(get_lang('EnrollToCourseSuccessful'));
+ return;
+ }
+ if (!empty($registration_code))
+ {
+ Display::display_error_message(get_lang('CourseRegistrationCodeIncorrect'));
+ }
+ $this->display_form($course_code);
+ return true;
+ }
+
+ /**
+ * Regiser a user to a course.
+ * Returns true on success, false otherwise.
+ *
+ * @param string $course_code
+ * @param string $registration_code
+ * @param int $user_id
+ * @return bool
+ */
+ function subscribe_user($course_code, $registration_code = '', $user_id = null)
+ {
+ $course = $this->retrieve_course($course_code);
+ $course_regisration_code = $course['registration_code'];
+ if (!empty($course_regisration_code) && $registration_code != $course_regisration_code)
+ {
+ return false;
+ }
+
+ if (empty($user_id))
+ {
+ global $_user;
+ $user_id = $_user['user_id'];
+ }
+
+ return (bool) CourseManager::add_user_to_course($user_id, $course_code);
+ }
+
+ /**
+ * Display the course registration form.
+ * Asks for registration code/password.
+ *
+ * @param string $course_code
+ */
+ function display_form($course_code)
+ {
+ global $stok;
+
+ $course = $this->retrieve_course($course_code);
+ $self = $_SERVER['REQUEST_URI'];
+ $course_code = $course['code'];
+ $course_visual_code = $course['visual_code'];
+ $course_title = $course['title'];
+ $submit_registration_code_label = get_lang("SubmitRegistrationCode");
+ $course_requires_password_label = get_lang('CourseRequiresPassword');
+
+ $result = <<';
+ }
+ else
+ {
+ echo '
';
+ }
+
+ if (RegisterCourseWidget::factory()->run())
+ {
+ $result = true;
+ }
+ else
+ {
+ $result = $this->action_display();
+ }
+
+ echo '
';
+
+ $this->display_footer();
+ return $result;
+ }
+
+ function get_url($action = '')
+ {
+ $self = $_SERVER['PHP_SELF'];
+ $parameters = array();
+ if ($action)
+ {
+ $parameters[self::PARAM_ACTION] = $action;
+ }
+ $parameters = implode('&', $parameters);
+ $parameters = $parameters ? '?' . $parameters : '';
+ return $self . $parameters;
+ }
+
+ /**
+ * Handle the display action
+ */
+ function action_display()
+ {
+ global $charset;
+
+ $search_term = self::post('search_term');
+ if ($search_term)
+ {
+ $search_result_for_label = self::get_lang('SearchResultsFor');
+ $search_term_html = htmlentities($search_term, ENT_QUOTES, $charset);
+ echo "
$search_result_for_label $search_term_html
";
+
+ $courses = $this->retrieve_courses($search_term);
+ $this->display_list($courses);
+ }
+ return true;
+ }
+
+ function display_header()
+ {
+ $search_course_label = self::get_lang('SearchCourse');
+ echo <<
+ ';
+ }
+
+ /**
+ * Display the search course form.
+ */
+ function display_form()
+ {
+ global $stok;
+
+ $search_label = self::get_lang('_search');
+ $self = api_get_self();
+ $search_term = self::post('search_term');
+ $form = <<