]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19795 Upgraded calls to helpbutton, print_simple_box* and notify
authornicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 04:59:01 +0000 (04:59 +0000)
committernicolasconnault <nicolasconnault>
Tue, 18 Aug 2009 04:59:01 +0000 (04:59 +0000)
enrol/authorize/config_form.php
enrol/authorize/db/upgrade.php
enrol/authorize/enrol.php
enrol/database/enrol.php
enrol/enrol.class.php
enrol/imsenterprise/config.html
enrol/ldap/enrol.php
enrol/mnet/allowed_courses.php
enrol/paypal/enrol.php

index cc2c98249b42d09d4d688e1da353f2ffa01547f9..a8df96869c9fa8a766e4a3cc8ed0c10061df0555 100755 (executable)
@@ -131,7 +131,7 @@ if (!isset($frm->acceptechecktypes)) {
 <tr valign="top">
     <td align="right">an_authcode:</td>
     <td><?php echo $OUTPUT->checkbox(html_select_option::make_checkbox('1', !empty($frm->an_authcode)), 'an_authcode');  ?>
-        <?php helpbutton('authcode', 'authcode', 'enrol/authorize'); ?><br />
+        <?php echo $OUTPUT->help_icon(moodle_help_icon::make('authcode', 'authcode', 'enrol/authorize')); ?><br />
         <?php print_string("adminauthcode", "enrol_authorize") ?></td>
 </tr>
 
@@ -177,20 +177,20 @@ if (!isset($frm->acceptechecktypes)) {
 </tr>
 
 <tr valign="top"><td colspan="2"><h4><?php print_string("adminauthorizeccapture", "enrol_authorize") ?>
-                                     <?php helpbutton('orderreview', 'orderreview', 'enrol/authorize'); ?>
+                                     <?php echo $OUTPUT->help_icon(moodle_help_icon::make('orderreview', 'orderreview', 'enrol/authorize')); ?>
                                  </h4></td></tr>
 
 <tr valign="top">
     <td align="right">an_review:</td>
     <td><?php echo $OUTPUT->checkbox(html_select_option::make_checkbox('1', !empty($frm->an_review)), 'an_review'); ?>
-        <?php helpbutton('review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol/authorize'); ?><br />
+        <?php echo $OUTPUT->help_icon(moodle_help_icon::make('review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol/authorize')); ?><br />
         <?php print_string("adminreview", "enrol_authorize") ?></td>
 </tr>
 
 <tr valign="top">
     <td align="right">an_capture_day:</td>
     <td><input type="text" name="an_capture_day" size="2" maxlength="2" value="<?php p($frm->an_capture_day) ?>" />
-        <?php helpbutton('captureday', get_string('adminhelpcapturetitle', 'enrol_authorize'), 'enrol/authorize'); ?><br />
+        <?php echo $OUTPUT->help_icon(moodle_help_icon::make('captureday', get_string('adminhelpcapturetitle', 'enrol_authorize'), 'enrol/authorize')); ?><br />
         <?php print_string("reviewday", "enrol_authorize", $frm->an_capture_day) ?></td>
 </tr>
 
index 09440a6564ef5df292ae225d0a1e0107af56132b..592ec1b3f7d71aba39e2922f891e4654eab2fb2e 100644 (file)
@@ -21,7 +21,7 @@
 // before any action that may take longer time to finish.
 
 function xmldb_enrol_authorize_upgrade($oldversion) {
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
 
     $dbman = $DB->get_manager();
     $result = true;
@@ -31,7 +31,7 @@ function xmldb_enrol_authorize_upgrade($oldversion) {
     if ($result && $oldversion < 2008020500 && is_enabled_enrol('authorize')) {
         require_once($CFG->dirroot.'/enrol/authorize/localfuncs.php');
         if (!check_curl_available()) {
-            notify("You are using the authorize.net enrolment plugin for payment handling but cUrl is not available.
+            echo $OUTPUT->notification("You are using the authorize.net enrolment plugin for payment handling but cUrl is not available.
                     PHP must be compiled with cURL+SSL support (--with-curl --with-openssl)");
         }
 
index 6e730357727b00f30aecaeb9e6af00d11bf7b27f..08491e7b384707bf5737b3213ef6b2202c126348 100755 (executable)
@@ -453,19 +453,18 @@ class enrolment_plugin_authorize
      * @param object $frm
      * @access public
      */
-    public function config_form($frm)
-    {
-        global $CFG, $DB;
+    public function config_form($frm) {
+        global $CFG, $DB, $OUTPUT;
         $mconfig = get_config('enrol/authorize');
 
         if (!check_curl_available()) {
-            notify('PHP must be compiled with cURL+SSL support (--with-curl --with-openssl)');
+            echo $OUTPUT->notification('PHP must be compiled with cURL+SSL support (--with-curl --with-openssl)');
         }
 
         if (empty($CFG->loginhttps) and substr($CFG->wwwroot, 0, 5) !== 'https') {
             $a = new stdClass;
             $a->url = "$CFG->wwwroot/$CFG->admin/settings.php?section=httpsecurity";
-            notify(get_string('adminconfighttps', 'enrol_authorize', $a));
+            echo $OUTPUT->notification(get_string('adminconfighttps', 'enrol_authorize', $a));
             return; // notice breaks the form and xhtml later
         }
         elseif (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 443) { // MDL-9836
@@ -473,12 +472,12 @@ class enrolment_plugin_authorize
             $wwwsroot = str_replace('http:', 'https:', $wwwsroot);
             $a = new stdClass;
             $a->url = $wwwsroot;
-            notify(get_string('adminconfighttpsgo', 'enrol_authorize', $a));
+            echo $OUTPUT->notification(get_string('adminconfighttpsgo', 'enrol_authorize', $a));
             return; // notice breaks the form and xhtml later
         }
 
         if (optional_param('verifyaccount', 0, PARAM_INT)) {
-            notify(authorize_verify_account());
+            echo $OUTPUT->notification(authorize_verify_account());
         }
 
         if (!empty($frm->an_review)) {
@@ -487,7 +486,7 @@ class enrolment_plugin_authorize
             if ($captureday > 0 || $emailexpired > 0) {
                 $lastcron = $DB->get_field_sql('SELECT max(lastcron) FROM {modules}');
                 if ((time() - intval($lastcron) > 3600 * 24)) {
-                    notify(get_string('admincronsetup', 'enrol_authorize'));
+                    echo $OUTPUT->notification(get_string('admincronsetup', 'enrol_authorize'));
                 }
             }
         }
@@ -496,15 +495,15 @@ class enrolment_plugin_authorize
             $a = new stdClass;
             $a->count = $count;
             $a->url = $CFG->wwwroot."/enrol/authorize/index.php?status=".AN_STATUS_AUTH;
-            notify(get_string('adminpendingorders', 'enrol_authorize', $a));
+            echo $OUTPUT->notification(get_string('adminpendingorders', 'enrol_authorize', $a));
         }
 
         if (data_submitted()) {
             if (empty($mconfig->an_login)) {
-                notify("an_login required");
+                echo $OUTPUT->notification("an_login required");
             }
             if (empty($mconfig->an_tran_key) && empty($mconfig->an_password)) {
-                notify("an_tran_key or an_password required");
+                echo $OUTPUT->notification("an_tran_key or an_password required");
             }
         }
 
index 99c0c2e6962c2912b753807f1dec364c9b3fbf90..78271630dad8553e37495cbdb13ac6bfc9eb8b5c 100644 (file)
@@ -174,13 +174,13 @@ function setup_enrolments(&$user) {
  * used.
  */
 function sync_enrolments($role = null) {
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
     error_reporting(E_ALL);
 
     // Connect to the external database
     $enroldb = $this->enrol_connect();
     if (!$enroldb) {
-        notify("enrol/database cannot connect to server");
+        echo $OUTPUT->notification("enrol/database cannot connect to server");
         return false;
     }
 
@@ -554,7 +554,7 @@ function process_config($config) {
 // you will want to call fix_course_sortorder() after your are done
 // with course creation
 function create_course ($course,$skip_fix_course_sortorder=0){
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
 
     // define a template
     if (!empty($CFG->enrol_db_template)){
@@ -616,7 +616,7 @@ function create_course ($course,$skip_fix_course_sortorder=0){
         add_to_log($newcourseid, "course", "new", "view.php?id=$newcourseid", "enrol/database auto-creation");
     } else {
         trigger_error("Could not create new course $extcourse from  from database");
-        notify("Serious Error! Could not create the new course!");
+        echo $OUTPUT->notification("Serious Error! Could not create the new course!");
         return false;
     }
 
index 97ba121930ef4d492561d2c1e5c4cbb081b5a462..50e719efa7a9e1a75ad598657d3d9e03665cf717 100644 (file)
@@ -6,7 +6,7 @@
 
 class enrolment_factory {
     function factory($enrol = '') {
-        global $CFG;
+        global $CFG, $OUTPUT;
         if (!$enrol) {
             $enrol = $CFG->enrol;
         }
@@ -16,7 +16,7 @@ class enrolment_factory {
             return new $class;
         } else {
             trigger_error("$CFG->dirroot/enrol/$enrol/enrol.php does not exist");
-            notify("Enrolment file $enrol/enrol.php does not exist");
+            echo $OUTPUT->notification("Enrolment file $enrol/enrol.php does not exist");
         }
     }
 }
index 1addc678af498e1a18c2a8d4111f01dee7db48d0..f53c7162208c75731d23ac7e4d6cc91104bb2051 100644 (file)
@@ -38,7 +38,7 @@
         <input type="checkbox" value="1" name="enrol_createnewusers" <?php if ($frm->enrol_createnewusers) echo "checked=\"checked\"" ?> />
     </td>
     <td>
-    <?php helpbutton('createnewusers', 'More detail about this option', 'enrol/imsenterprise'); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('createnewusers', 'More detail about this option', 'enrol/imsenterprise')); ?>
     </td>
 </tr>
 
@@ -48,7 +48,7 @@
         <input type="checkbox" value="1" name="enrol_imsdeleteusers" <?php if ($frm->enrol_imsdeleteusers) echo "checked=\"checked\"" ?> />
     </td>
     <td>
-    <?php helpbutton('deleteusers', 'More detail about this option', 'enrol/imsenterprise'); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('deleteusers', 'More detail about this option', 'enrol/imsenterprise')); ?>
     </td>
 </tr>
 
@@ -78,7 +78,7 @@
         <input type="checkbox" value="1" name="enrol_imssourcedidfallback" <?php if ($frm->enrol_imssourcedidfallback) echo "checked=\"checked\"" ?> />
     </td>
     <td>
-    <?php helpbutton('sourceddidfallback', 'More detail about this option', 'enrol/imsenterprise'); ?>    
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('sourceddidfallback', 'More detail about this option', 'enrol/imsenterprise')); ?>    
     </td>
 </tr>
 <!--
@@ -138,7 +138,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
         <input type="text" <?php echo 'value="'.intval($frm->enrol_truncatecoursecodes).'"' ?> name="enrol_truncatecoursecodes" size="3" maxlength="3" />
     </td>
     <td>
-    <?php helpbutton('truncatecoursecodes', 'More detail about this option', 'enrol/imsenterprise'); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('truncatecoursecodes', 'More detail about this option', 'enrol/imsenterprise')); ?>
     </td>
 </tr>
 
@@ -148,7 +148,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
         <input type="checkbox" value="1" name="enrol_createnewcourses" <?php if ($frm->enrol_createnewcourses) echo "checked=\"checked\"" ?> />
     </td>
     <td>
-    <?php helpbutton('createnewcourses', 'More detail about this option', 'enrol/imsenterprise'); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('createnewcourses', 'More detail about this option', 'enrol/imsenterprise')); ?>
     </td>
 </tr>
 
@@ -158,7 +158,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
         <input type="checkbox" value="1" name="enrol_createnewcategories" <?php if ($frm->enrol_createnewcategories) echo "checked=\"checked\"" ?> />
     </td>
     <td>
-    <?php helpbutton('categorisation', 'More detail about this option', 'enrol/imsenterprise'); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('categorisation', 'More detail about this option', 'enrol/imsenterprise')); ?>
     </td>
 </tr>
 
@@ -168,7 +168,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
         <input type="checkbox" value="1" name="enrol_imsunenrol" <?php if ($frm->enrol_imsunenrol) echo "checked=\"checked\"" ?> />
     </td>
     <td>
-    <?php helpbutton('unenrol', 'More detail about this option', 'enrol/imsenterprise'); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('unenrol', 'More detail about this option', 'enrol/imsenterprise')); ?>
     </td>
 </tr>
 
@@ -180,7 +180,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
     <td align="right"><?php  print_string('restricttarget', 'enrol_imsenterprise') ?>:</td>
     <td colspan="2">
         <input type="text" <?php echo 'value="'.htmlspecialchars($frm->enrol_imsrestricttarget).'"' ?> name="enrol_imsrestricttarget" size="20" maxlength="32" />
-    <?php helpbutton('target', 'More detail about this option', 'enrol/imsenterprise'); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('target', 'More detail about this option', 'enrol/imsenterprise')); ?>
     </td>
 </tr>
 
@@ -190,7 +190,7 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
         <input type="checkbox" value="1" name="enrol_imscapitafix" <?php if ($frm->enrol_imscapitafix) echo "checked=\"checked\"" ?> />
     </td>
     <td>
-    <?php helpbutton('capita', 'More detail about this option', 'enrol/imsenterprise'); ?>
+    <?php echo $OUTPUT->help_icon(moodle_help_icon::make('capita', 'More detail about this option', 'enrol/imsenterprise')); ?>
     </td>
 </tr>
 
index 8a840012b7345aeb361784ba7c71709530d580a6..a886d5663d33570421adf68bb466e90478d10d54 100755 (executable)
@@ -12,7 +12,7 @@ class enrolment_plugin_ldap {
  * This function syncs a user's enrolments with those on the LDAP server.
  */
 function setup_enrolments(&$user) {
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
 
     //error_log('[ENROL_LDAP] setup_enrolments called');
 
@@ -20,7 +20,7 @@ function setup_enrolments(&$user) {
     $ldap_connection = $this->enrol_ldap_connect();
     if (!$ldap_connection) {
         @ldap_close($ldap_connection);
-        notify("[ENROL_LDAP] LDAP-module cannot connect to server: {$CFG->enrol_ldap_host_url}");
+        echo $OUTPUT->notification("[ENROL_LDAP] LDAP-module cannot connect to server: {$CFG->enrol_ldap_host_url}");
         return false;
     }
     
@@ -119,12 +119,12 @@ function setup_enrolments(&$user) {
 
 /// sync enrolments with ldap, create courses if required.
 function sync_enrolments($type, $enrol = false) {
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
 
     // Get the role. If it doesn't exist, that is bad.
     $role = $DB->get_record('role', array('shortname'=>$type));
     if (!$role) {
-        notify("No such role: $type");
+        echo $OUTPUT->notification("No such role: $type");
         return false;
     }
 
@@ -132,7 +132,7 @@ function sync_enrolments($type, $enrol = false) {
     $ldap_connection = $this->enrol_ldap_connect();
     if (!$ldap_connection) {
         @ldap_close($ldap_connection);
-        notify("LDAP-module cannot connect to server: $CFG->ldap_host_url");
+        echo $OUTPUT->notification("LDAP-module cannot connect to server: $CFG->ldap_host_url");
         return false;
     }
     
@@ -416,7 +416,7 @@ function process_config($config) {
 
 function enrol_ldap_connect(){
 /// connects to ldap-server
-    global $CFG;
+    global $CFG, $OUTPUT;
 
     $result = ldap_connect($CFG->enrol_ldap_host_url);
 
@@ -430,14 +430,14 @@ function enrol_ldap_connect(){
                                  $CFG->enrol_ldap_bind_dn, 
                                  $CFG->enrol_ldap_bind_pw );
             if (!$bind) {
-                notify("Error in binding to LDAP server");
+                echo $OUTPUT->notification("Error in binding to LDAP server");
                 trigger_error("Error in binding to LDAP server $!");
             }
 
         }
         return $result;
     } else {
-        notify("LDAP-module cannot connect to server: $CFG->enrol_ldap_host_url");
+        echo $OUTPUT->notification("LDAP-module cannot connect to server: $CFG->enrol_ldap_host_url");
         return false;
     }
 }
@@ -446,19 +446,19 @@ function enrol_ldap_bind($ldap_connection){
 /// makes bind to ldap for searching users
 /// uses ldap_bind_dn or anonymous bind
 
-    global $CFG;
+    global $CFG, $OUTPUT;
 
     if ( ! empty($CFG->enrol_ldap_bind_dn) ){
         //bind with search-user
         if (!ldap_bind($ldap_connection, $CFG->enrol_ldap_bind_dn,$CFG->enrol_ldap_bind_pw)){
-            notify("Error: could not bind ldap with ldap_bind_dn/pw");
+            echo $OUTPUT->notification("Error: could not bind ldap with ldap_bind_dn/pw");
             return false;
         }
 
     } else {
         //bind anonymously 
         if ( !ldap_bind($ldap_connection)){
-            notify("Error: could not bind ldap anonymously");
+            echo $OUTPUT->notification("Error: could not bind ldap anonymously");
             return false;
         }  
     }
@@ -547,7 +547,7 @@ function find_ext_enrolments ($ldap_connection, $memberuid, $role){
 // you will want to call fix_course_sortorder() after your are done
 // with course creation
 function create_course ($course_ext,$skip_fix_course_sortorder=0){
-    global $CFG, $DB;
+    global $CFG, $DB, $OUTPUT;
 
     // override defaults with template course
     if (!empty($CFG->enrol_ldap_template)){
@@ -602,7 +602,7 @@ function create_course ($course_ext,$skip_fix_course_sortorder=0){
         add_to_log($newcourseid, "course", "new", "view.php?id=$newcourseid", "enrol/ldap auto-creation");
     } else {
         error_log("Could not create new course from LDAP from DN:" . $course_ext['dn']);
-        notify("Serious Error! Could not create the new course!");
+        echo $OUTPUT->notification("Serious Error! Could not create the new course!");
         return false;
     }
     
index 0e199c888664037b285dcfb98adf6135deca3d70..caef51cbbf5084f9906b22b0a9f3fa853a41f09e 100644 (file)
@@ -122,7 +122,7 @@ if ($courses = $DB->get_records('course', null, 'shortname', 'id, shortname')) {
 
 
 // output the form
-print_simple_box_start('center','90%','','20');
+echo $OUTPUT->box_start();
 
 ?>
  <div class="allowedcoursesdiv"> 
@@ -249,7 +249,7 @@ if (count($courses) < 1) {
   </div>
 <?php
 
-print_simple_box_end();
+echo $OUTPUT->box_end();
 echo $OUTPUT->footer();
 
 ?>
index 3812ef8eaf15864d6c746f128d7bf6d71ab6d154..a74b9456015595cbcc82d02fe4e131cad3d823d3 100644 (file)
@@ -41,7 +41,7 @@ function print_entry($course) {
             echo $OUTPUT->heading(get_string('costorkey', 'enrol_paypal'));
         }
 
-        print_simple_box_start("center");
+        echo $OUTPUT->box_end();
 
         if ($USER->username == 'guest') { // force login only for guest user, not real users with guest role
             if (empty($CFG->loginhttps)) {
@@ -68,7 +68,7 @@ function print_entry($course) {
             include($CFG->dirroot.'/enrol/paypal/enrol.html');
         }
 
-        print_simple_box_end();
+        echo $OUTPUT->box_end();
 
         if ($course->password) {  // Second option
             $password = '';