]> git.mjollnir.org Git - moodle.git/commitdiff
coding style fixes MDL-6954
authorskodak <skodak>
Thu, 9 Nov 2006 21:58:12 +0000 (21:58 +0000)
committerskodak <skodak>
Thu, 9 Nov 2006 21:58:12 +0000 (21:58 +0000)
course/request.php
course/request_form.php

index 38524a2924fb49aea579980fc882c0bc0903b25a..a01f5b95c4f9d7a387b8b9d8c2f0ab5f3e4ec73e 100644 (file)
@@ -19,9 +19,9 @@
     $requestform = new course_request_form('request.php');
 
     $strtitle = get_string('courserequest');
-    print_header($strtitle,$strtitle,$strtitle, $requestform->focus());
+    print_header($strtitle, $strtitle, $strtitle, $requestform->focus());
 
-    print_simple_box_start("center");
+    print_simple_box_start('center');
     print_string('courserequestintro');
     print_simple_box_end();
 
@@ -30,7 +30,7 @@
 
         $data->requester = $USER->id;
 
-        if (insert_record('course_request',$data)) {
+        if (insert_record('course_request', $data)) {
             notice(get_string('courserequestsuccess'));
         } else {
             notice(get_string('courserequestfailed'));
@@ -38,7 +38,6 @@
         print_footer();
         exit;
 
-
     }
 
 
@@ -49,5 +48,4 @@
     exit;
 
 
-
 ?>
\ No newline at end of file
index bc7be363296ce36edff505520c2a69d4a90d5629..ff2429b08bc51ac5e515eb404b2b3eca080c8ece 100644 (file)
@@ -1,44 +1,46 @@
-<?php
+<?php  // $Id$
+
 include_once $CFG->libdir.'/formslib.php';
+
 class course_request_form extends moodleform {
     function definition() {
-        $mform    =& $this->_form;
+        $mform =& $this->_form;
 
-        $mform->addElement('text','fullname',get_string("fullname"),'maxlength="254" size="50"');
-        $mform->addRule('fullname',get_string('missingshortname'),'required', null, 'client');
+        $mform->addElement('text', 'fullname', get_string('fullname'), 'maxlength="254" size="50"');
+        $mform->addRule('fullname', get_string('missingshortname'), 'required', null, 'client');
         $mform->setType('fullname', PARAM_TEXT);
 
-        $mform->addElement('text','shortname',get_string("shortname"),'maxlength="15" size="10"');
-        $mform->addRule('shortname',get_string('missingfullname'),'required', null, 'client');
+        $mform->addElement('text', 'shortname', get_string('shortname'), 'maxlength="15" size="10"');
+        $mform->addRule('shortname', get_string('missingfullname'), 'required', null, 'client');
         $mform->setType('shortname', PARAM_TEXT);
 
-        $mform->addElement('htmleditor','summary',get_string("summary"),array('rows'=>'15','cols'=>'50'));
-        $mform->addRule('summary',get_string('missingsummary'),'required', null, 'client');
+        $mform->addElement('htmleditor', 'summary', get_string('summary'), array('rows'=>'15', 'cols'=>'50'));
+        $mform->addRule('summary', get_string('missingsummary'), 'required', null, 'client');
         $mform->setType('summary', PARAM_RAW);
 
-        $mform->addElement('textarea','reason',get_string("courserequestreason"),array('rows'=>'15','cols'=>'50'));
-        $mform->addRule('reason',get_string('missingreqreason'),'required', null, 'client');
+        $mform->addElement('textarea', 'reason', get_string('courserequestreason'), array('rows'=>'15', 'cols'=>'50'));
+        $mform->addRule('reason', get_string('missingreqreason'), 'required', null, 'client');
         $mform->setType('reason', PARAM_TEXT);
 
-        $mform->addElement('text','password',get_string("enrolmentkey"),'size="25"');
+        $mform->addElement('text', 'password', get_string('enrolmentkey'), 'size="25"');
         $mform->setType('password', PARAM_RAW);
 
 
-        $mform->addElement('submit','',get_string("savechanges"));
+        $mform->addElement('submit', '', get_string('savechanges'));
     }
 
     function validation($data) {
-        $errors=array();
+        $errors = array();
         $foundcourses = null;
         $foundreqcourses = null;
 
         if (!empty($data['shortname'])) {
-            $foundcourses = get_records("course", "shortname", $data['shortname']);
-            $foundreqcourses = get_records("course_request", "shortname", $data['shortname']);
+            $foundcourses = get_records('course', 'shortname', $data['shortname']);
+            $foundreqcourses = get_records('course_request', 'shortname', $data['shortname']);
         }
         if (!empty($foundreqcourses)) {
             if (!empty($foundcourses)) {
-                $foundcourses = array_merge($foundcourses,$foundreqcourses);
+                $foundcourses = array_merge($foundcourses, $foundreqcourses);
             } else {
                 $foundcourses = $foundreqcourses;
             }
@@ -57,20 +59,19 @@ class course_request_form extends moodleform {
                 }
                 $foundcoursenamestring = addslashes(implode(',', $foundcoursenames));
 
-                $errors["shortname"] = get_string("shortnametaken", "", $foundcoursenamestring);
+                $errors['shortname'] = get_string('shortnametaken', '', $foundcoursenamestring);
                 if (!empty($pending)) {
-                    $errors["shortname"] .= get_string('starpending');
+                    $errors['shortname'] .= get_string('starpending');
                 }
             }
         }
-        if (0==count($errors)){
+        if (0 == count($errors)){
             return true;
-        }else {
+        } else {
             return $errors;
         }
 
     }
 
-
 }
 ?>
\ No newline at end of file