Completed
Pull Request — 1.11.x (#1661)
by José
27:18
created
main/lp/aiccItem.class.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 default:
49 49
                      //if($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function
50 50
                      foreach ($params as $a => $value) {
51
-                         switch ($a) {
51
+                            switch ($a) {
52 52
                             case 'system_id':
53 53
                                 $this->identifier = Database::escape_string(strtolower($value));
54 54
                                 break;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
                             case 'web_launch':
83 83
                                 $this->parameters = Database::escape_string($value);
84 84
                                 break;
85
-                         }
86
-                     }
85
+                            }
86
+                        }
87 87
 
88 88
                     return true;
89 89
             }
Please login to merge, or discard this patch.
main/lp/scormOrganization.class.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
                     //if ($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function.
39 39
                     $children = $element->childNodes;
40 40
                     foreach ($children as $child) {
41
-                         switch ($child->nodeType) {
41
+                            switch ($child->nodeType) {
42 42
                             case XML_ELEMENT_NODE:
43 43
                                 switch ($child->tagName) {
44 44
                                     case 'item':
45 45
                                          $oItem = new scormItem('manifest', $child);
46
-                                         if ($oItem->identifier != '') {
46
+                                            if ($oItem->identifier != '') {
47 47
                                             $this->items[$oItem->identifier] = $oItem;
48
-                                         }
48
+                                            }
49 49
                                         break;
50 50
                                     case 'metadata':
51 51
                                         $this->metadata = new scormMetadata('manifest', $child);
@@ -58,24 +58,24 @@  discard block
 block discarded – undo
58 58
                                         break;
59 59
                                 }
60 60
                                 break;
61
-                             case XML_TEXT_NODE:
61
+                                case XML_TEXT_NODE:
62 62
                                  break;
63
-                         }
63
+                            }
64 64
                     }
65 65
 
66 66
                     if ($element->hasAttributes()) {
67
-                         $attributes = $element->attributes;
68
-                         //$keep_href = '';
69
-                         foreach ($attributes as $attrib) {
70
-                             switch ($attrib->name) {
71
-                                 case 'identifier':
67
+                            $attributes = $element->attributes;
68
+                            //$keep_href = '';
69
+                            foreach ($attributes as $attrib) {
70
+                                switch ($attrib->name) {
71
+                                    case 'identifier':
72 72
                                      $this->identifier = $attrib->value;
73
-                                     break;
74
-                                 case 'structure':
73
+                                        break;
74
+                                    case 'structure':
75 75
                                      $this->structure = $attrib->value;
76
-                                     break;
77
-                             }
78
-                         }
76
+                                        break;
77
+                                }
78
+                            }
79 79
                     }
80 80
 
81 81
                     return true;
Please login to merge, or discard this patch.
main/lp/aicc.class.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
         }
321 321
     }
322 322
 
323
-     /**
324
-     * Intermediate to import_package only to allow import from local zip files
325
-     * @param	string	Path to the zip file, from the dokeos sys root
326
-     * @param	string	Current path (optional)
327
-     * @return string	Absolute path to the AICC description files or empty string on error
328
-     */
323
+        /**
324
+         * Intermediate to import_package only to allow import from local zip files
325
+         * @param	string	Path to the zip file, from the dokeos sys root
326
+         * @param	string	Current path (optional)
327
+         * @return string	Absolute path to the AICC description files or empty string on error
328
+         */
329 329
     function import_local_package($file_path, $current_dir = '')
330 330
     {
331 331
         // TODO: Prepare info as given by the $_FILES[''] vector.
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
         $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/
356 356
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Current_dir = '.$current_dir, 0); }
357 357
 
358
-         //$uploaded_filename = $_FILES['userFile']['name'];
358
+            //$uploaded_filename = $_FILES['userFile']['name'];
359 359
         // Get the name of the zip file without the extension.
360 360
         if ($this->debug > 0) { error_log('New LP - aicc::import_package() - Received zip file name: '.$zip_file_path, 0); }
361 361
         $file_info = pathinfo($zip_file_name);
Please login to merge, or discard this patch.
main/lp/aicc_api.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
           <?php
143 143
             $who = addslashes(api_get_person_name($_user['firstName'], $_user['lastName']));
144 144
             echo "result='$who';";
145
-          ?>
145
+            ?>
146 146
     }else if(param == 'cmi.core.lesson_location'){
147 147
         result=lesson_location;
148 148
     }else if(param == 'cmi.core.total_time'){
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
           <?php
199 199
             $who = addslashes(api_get_person_name($_user['firstName'], $_user['lastName']));
200 200
             echo "result='$who';";
201
-          ?>	break;
201
+            ?>	break;
202 202
         case 'cmi.core.lesson_location'	:
203 203
             result='';
204 204
             break;
@@ -322,12 +322,12 @@  discard block
 block discarded – undo
322 322
 }
323 323
 <?php
324 324
 /**
325
- * Chamilo-specific code that deals with event handling and inter-frames
326
- * messaging/refreshing.
327
- * Note that from now on, the Chamilo JS code in this library will act as
328
- * a controller, of the MVC pattern, and receive all requests for frame
329
- * updates, then redispatch to any frame concerned.
330
- */
325
+     * Chamilo-specific code that deals with event handling and inter-frames
326
+     * messaging/refreshing.
327
+     * Note that from now on, the Chamilo JS code in this library will act as
328
+     * a controller, of the MVC pattern, and receive all requests for frame
329
+     * updates, then redispatch to any frame concerned.
330
+     */
331 331
 ?>
332 332
 /**
333 333
  * Defining the AJAX-object class to be made available from other frames.
Please login to merge, or discard this patch.
main/lp/scormMetadata.class.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -39,60 +39,60 @@
 block discarded – undo
39 39
                 case 'manifest': // Do the same as the default.
40 40
                      $children = $element->childNodes;
41 41
                     foreach ($children as $child) {
42
-                         switch ($child->nodeType) {
43
-                             case XML_ELEMENT_NODE:
42
+                            switch ($child->nodeType) {
43
+                                case XML_ELEMENT_NODE:
44 44
                                 // Could be 'lom', 'schema', 'schemaversion' or 'location'.
45 45
                                  switch ($child->tagName) {
46
-                                     case 'lom':
46
+                                        case 'lom':
47 47
                                          $childchildren = $child->childNodes;
48
-                                         foreach ($childchildren as $childchild) {
49
-                                             $this->lom = $childchild->nodeValue;
50
-                                         }
51
-                                         break;
52
-                                     case 'schema':
48
+                                            foreach ($childchildren as $childchild) {
49
+                                                $this->lom = $childchild->nodeValue;
50
+                                            }
51
+                                            break;
52
+                                        case 'schema':
53 53
                                          $childchildren = $child->childNodes;
54
-                                         foreach ($childchildren as $childchild) {
55
-                                             // There is generally only one child here.
56
-                                             $this->schema = $childchild->nodeValue;
57
-                                         }
58
-                                         break;
59
-                                     case 'schemaversion':
54
+                                            foreach ($childchildren as $childchild) {
55
+                                                // There is generally only one child here.
56
+                                                $this->schema = $childchild->nodeValue;
57
+                                            }
58
+                                            break;
59
+                                        case 'schemaversion':
60 60
                                          $childchildren = $child->childNodes;
61
-                                         foreach ($childchildren as $childchild) {
62
-                                             // There is generally only one child here.
63
-                                             $this->schemaversion = $childchild->nodeValue;
64
-                                         }
65
-                                         break;
66
-                                     case 'location':
61
+                                            foreach ($childchildren as $childchild) {
62
+                                                // There is generally only one child here.
63
+                                                $this->schemaversion = $childchild->nodeValue;
64
+                                            }
65
+                                            break;
66
+                                        case 'location':
67 67
                                          $childchildren = $child->childNodes;
68
-                                         foreach ($childchildren as $childchild) {
69
-                                             // There is generally only one child here.
70
-                                             $this->location = $childchild->nodeValue;
71
-                                         }
72
-                                         break;
73
-                                 }
74
-                                 break;
75
-                             case XML_TEXT_NODE:
68
+                                            foreach ($childchildren as $childchild) {
69
+                                                // There is generally only one child here.
70
+                                                $this->location = $childchild->nodeValue;
71
+                                            }
72
+                                            break;
73
+                                    }
74
+                                    break;
75
+                                case XML_TEXT_NODE:
76 76
                                  if (trim($child->textContent) != '') {
77
-                                     if (count($children == 1)) {
78
-                                         // If this is the only child at this level and it is a content... save differently.
79
-                                         $this->text = $child->textContent;
80
-                                     } else {
81
-                                         $this->text[$element->tagName] = $child->textContent;
82
-                                     }
83
-                                 }
84
-                                 break;
85
-                         }
86
-                     }
87
-                     $attributes = $element->attributes;
88
-                     //$keep_href = '';
89
-                     if (is_array($attributes)) {
90
-                         foreach ($attributes as $attrib) {
91
-                             if (trim($attrib->value) != ''){
92
-                                 $this->attribs[$attrib->name] = $attrib->value;
93
-                             }
94
-                         }
95
-                     }
77
+                                        if (count($children == 1)) {
78
+                                            // If this is the only child at this level and it is a content... save differently.
79
+                                            $this->text = $child->textContent;
80
+                                        } else {
81
+                                            $this->text[$element->tagName] = $child->textContent;
82
+                                        }
83
+                                    }
84
+                                    break;
85
+                            }
86
+                        }
87
+                        $attributes = $element->attributes;
88
+                        //$keep_href = '';
89
+                        if (is_array($attributes)) {
90
+                            foreach ($attributes as $attrib) {
91
+                                if (trim($attrib->value) != ''){
92
+                                    $this->attribs[$attrib->name] = $attrib->value;
93
+                                }
94
+                            }
95
+                        }
96 96
                     return true;
97 97
                     //break;
98 98
             }
Please login to merge, or discard this patch.
main/lp/lp_impress.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     api_get_group_id()
37 37
 );
38 38
 if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) {
39
-     api_not_allowed();
39
+        api_not_allowed();
40 40
 }
41 41
 
42 42
 if (empty($_SESSION['oLP'])) {
Please login to merge, or discard this patch.
main/gradebook/lib/be/learnpathlink.class.php 1 patch
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -9,261 +9,261 @@
 block discarded – undo
9 9
  */
10 10
 class LearnpathLink extends AbstractLink
11 11
 {
12
-	private $course_info = null;
13
-	private $learnpath_table = null;
14
-	private $learnpath_data = null;
15
-
16
-	/**
17
-	 * Constructor
18
-	 */
19
-	public function __construct()
20
-	{
21
-		parent::__construct();
22
-		$this->set_type(LINK_LEARNPATH);
23
-	}
24
-
25
-	/**
26
-	 * Generate an array of learnpaths that a teacher hasn't created a link for.
27
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
28
-	 */
29
-	public function get_not_created_links()
30
-	{
31
-		return false;
32
-		if (empty($this->course_code))
33
-			die('Error in get_not_created_links() : course code not set');
34
-
35
-		$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
36
-
37
-		$sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp
12
+    private $course_info = null;
13
+    private $learnpath_table = null;
14
+    private $learnpath_data = null;
15
+
16
+    /**
17
+     * Constructor
18
+     */
19
+    public function __construct()
20
+    {
21
+        parent::__construct();
22
+        $this->set_type(LINK_LEARNPATH);
23
+    }
24
+
25
+    /**
26
+     * Generate an array of learnpaths that a teacher hasn't created a link for.
27
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
28
+     */
29
+    public function get_not_created_links()
30
+    {
31
+        return false;
32
+        if (empty($this->course_code))
33
+            die('Error in get_not_created_links() : course code not set');
34
+
35
+        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
36
+
37
+        $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp
38 38
 				WHERE c_id = '.$this->course_id.' AND id NOT IN '
39
-			.' (SELECT ref_id FROM '.$tbl_grade_links
40
-			.' WHERE type = '.LINK_LEARNPATH
41
-			." AND course_code = '".$this->get_course_code()."'"
42
-			.') AND lp.session_id='.api_get_session_id().'';
43
-
44
-		$result = Database::query($sql);
45
-
46
-		$cats=array();
47
-		while ($data=Database::fetch_array($result)) {
48
-			$cats[] = array ($data['id'], $data['name']);
49
-		}
50
-
51
-		return $cats;
52
-	}
53
-
54
-	/**
55
-	 * Generate an array of all learnpaths available.
56
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
57
-	 */
58
-	public function get_all_links()
59
-	{
60
-		if (empty($this->course_code))
61
-			die('Error in get_not_created_links() : course code not set');
62
-
63
-		$session_id = api_get_session_id();
64
-		if (empty($session_id)) {
65
-			$session_condition = api_get_session_condition(0, true);
66
-		} else {
67
-			$session_condition = api_get_session_condition($session_id, true, true);
68
-		}
69
-
70
-		$sql = 'SELECT id, name FROM '.$this->get_learnpath_table().'
39
+            .' (SELECT ref_id FROM '.$tbl_grade_links
40
+            .' WHERE type = '.LINK_LEARNPATH
41
+            ." AND course_code = '".$this->get_course_code()."'"
42
+            .') AND lp.session_id='.api_get_session_id().'';
43
+
44
+        $result = Database::query($sql);
45
+
46
+        $cats=array();
47
+        while ($data=Database::fetch_array($result)) {
48
+            $cats[] = array ($data['id'], $data['name']);
49
+        }
50
+
51
+        return $cats;
52
+    }
53
+
54
+    /**
55
+     * Generate an array of all learnpaths available.
56
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
57
+     */
58
+    public function get_all_links()
59
+    {
60
+        if (empty($this->course_code))
61
+            die('Error in get_not_created_links() : course code not set');
62
+
63
+        $session_id = api_get_session_id();
64
+        if (empty($session_id)) {
65
+            $session_condition = api_get_session_condition(0, true);
66
+        } else {
67
+            $session_condition = api_get_session_condition($session_id, true, true);
68
+        }
69
+
70
+        $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().'
71 71
                 WHERE c_id = '.$this->course_id.' '.$session_condition.' ';
72
-		$result = Database::query($sql);
72
+        $result = Database::query($sql);
73 73
 
74
-		$cats = array();
75
-		while ($data=Database::fetch_array($result)) {
76
-			$cats[] = array ($data['id'], $data['name']);
77
-		}
74
+        $cats = array();
75
+        while ($data=Database::fetch_array($result)) {
76
+            $cats[] = array ($data['id'], $data['name']);
77
+        }
78 78
 
79
-		return $cats;
80
-	}
79
+        return $cats;
80
+    }
81 81
 
82 82
 
83
-	/**
84
-	 * Has anyone used this learnpath yet ?
85
-	 */
86
-	public function has_results()
87
-	{
88
-		$tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
89
-		$sql = "SELECT count(id) AS number FROM $tbl_stats
83
+    /**
84
+     * Has anyone used this learnpath yet ?
85
+     */
86
+    public function has_results()
87
+    {
88
+        $tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
89
+        $sql = "SELECT count(id) AS number FROM $tbl_stats
90 90
 				WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id();
91
-		$result = Database::query($sql);
92
-		$number = Database::fetch_array($result,'NUM');
93
-		return ($number[0] != 0);
94
-	}
95
-
96
-	/**
97
-	 * Get the progress of this learnpath. Only the last attempt are taken into account.
98
-	 * @param $stud_id student id (default: all students who have results - then the average is returned)
99
-	 * @return	array (score, max) if student is given
100
-	 * 			array (sum of scores, number of scores) otherwise
101
-	 * 			or null if no scores available
102
-	 */
103
-	public function calc_score($stud_id = null, $type = null)
104
-	{
105
-		$tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
106
-		$session_id = api_get_session_id();
107
-
108
-		$sql = "SELECT * FROM $tbl_stats
91
+        $result = Database::query($sql);
92
+        $number = Database::fetch_array($result,'NUM');
93
+        return ($number[0] != 0);
94
+    }
95
+
96
+    /**
97
+     * Get the progress of this learnpath. Only the last attempt are taken into account.
98
+     * @param $stud_id student id (default: all students who have results - then the average is returned)
99
+     * @return	array (score, max) if student is given
100
+     * 			array (sum of scores, number of scores) otherwise
101
+     * 			or null if no scores available
102
+     */
103
+    public function calc_score($stud_id = null, $type = null)
104
+    {
105
+        $tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
106
+        $session_id = api_get_session_id();
107
+
108
+        $sql = "SELECT * FROM $tbl_stats
109 109
                 WHERE
110 110
                 	c_id = ".$this->course_id." AND
111 111
                     lp_id = ".$this->get_ref_id()." AND
112 112
                     session_id = $session_id ";
113 113
 
114
-		if (isset($stud_id))
115
-			$sql .= ' AND user_id = '.intval($stud_id);
116
-
117
-		// order by id, that way the student's first attempt is accessed first
118
-		$sql .= ' ORDER BY view_count DESC';
119
-
120
-		$scores = Database::query($sql);
121
-		// for 1 student
122
-		if (isset($stud_id)) {
123
-			if ($data = Database::fetch_assoc($scores)) {
124
-				return array ($data['progress'], 100);
125
-			} else
126
-				return null;
127
-		} else {
128
-			// all students -> get average
129
-			$students = array();  // user list, needed to make sure we only
130
-			// take first attempts into account
131
-			$rescount = 0;
132
-			$sum = 0;
133
-			$bestResult = 0;
134
-			$sumResult = 0;
135
-			while ($data = Database::fetch_array($scores)) {
136
-				if (!(array_key_exists($data['user_id'], $students))) {
137
-					$students[$data['user_id']] = $data['progress'];
138
-					$rescount++;
139
-					$sum += $data['progress'] / 100;
140
-					$sumResult += $data['progress'];
141
-
142
-					if ($data['progress'] > $bestResult) {
143
-						$bestResult = $data['progress'];
144
-					}
145
-				}
146
-			}
147
-
148
-			if ($rescount == 0) {
149
-				return null;
150
-			} else {
151
-
152
-				switch ($type) {
153
-					case 'best':
154
-						return array($bestResult, 100);
155
-						break;
156
-					case 'average':
157
-						return array($sumResult/$rescount, 100);
158
-						break;
159
-					case 'ranking':
160
-						return AbstractLink::getCurrentUserRanking($stud_id, $students);
161
-						break;
162
-					default:
163
-						return array($sum, $rescount);
164
-						break;
165
-				}
166
-			}
167
-		}
168
-	}
169
-
170
-	/**
171
-	 * Get URL where to go to if the user clicks on the link.
172
-	 */
173
-	public function get_link()
174
-	{
175
-		$session_id = api_get_session_id();
176
-		$url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view';
177
-
178
-		if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
179
-			$url .= '&action=view&lp_id='.$this->get_ref_id();
180
-		} else {
181
-			$url .= '&action=build&lp_id='.$this->get_ref_id();
182
-		}
183
-		return $url;
184
-	}
185
-
186
-	/**
187
-	 * Get name to display: same as learnpath title
188
-	 */
189
-	public function get_name()
190
-	{
191
-		$data = $this->get_learnpath_data();
192
-		return $data['name'];
193
-	}
194
-
195
-	/**
196
-	 * Get description to display: same as learnpath description
197
-	 */
198
-	public function get_description()
199
-	{
200
-		$data = $this->get_learnpath_data();
201
-		return $data['description'];
202
-	}
203
-
204
-	/**
205
-	 * Check if this still links to a learnpath
206
-	 */
207
-	public function is_valid_link() {
208
-		$sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().'
114
+        if (isset($stud_id))
115
+            $sql .= ' AND user_id = '.intval($stud_id);
116
+
117
+        // order by id, that way the student's first attempt is accessed first
118
+        $sql .= ' ORDER BY view_count DESC';
119
+
120
+        $scores = Database::query($sql);
121
+        // for 1 student
122
+        if (isset($stud_id)) {
123
+            if ($data = Database::fetch_assoc($scores)) {
124
+                return array ($data['progress'], 100);
125
+            } else
126
+                return null;
127
+        } else {
128
+            // all students -> get average
129
+            $students = array();  // user list, needed to make sure we only
130
+            // take first attempts into account
131
+            $rescount = 0;
132
+            $sum = 0;
133
+            $bestResult = 0;
134
+            $sumResult = 0;
135
+            while ($data = Database::fetch_array($scores)) {
136
+                if (!(array_key_exists($data['user_id'], $students))) {
137
+                    $students[$data['user_id']] = $data['progress'];
138
+                    $rescount++;
139
+                    $sum += $data['progress'] / 100;
140
+                    $sumResult += $data['progress'];
141
+
142
+                    if ($data['progress'] > $bestResult) {
143
+                        $bestResult = $data['progress'];
144
+                    }
145
+                }
146
+            }
147
+
148
+            if ($rescount == 0) {
149
+                return null;
150
+            } else {
151
+
152
+                switch ($type) {
153
+                    case 'best':
154
+                        return array($bestResult, 100);
155
+                        break;
156
+                    case 'average':
157
+                        return array($sumResult/$rescount, 100);
158
+                        break;
159
+                    case 'ranking':
160
+                        return AbstractLink::getCurrentUserRanking($stud_id, $students);
161
+                        break;
162
+                    default:
163
+                        return array($sum, $rescount);
164
+                        break;
165
+                }
166
+            }
167
+        }
168
+    }
169
+
170
+    /**
171
+     * Get URL where to go to if the user clicks on the link.
172
+     */
173
+    public function get_link()
174
+    {
175
+        $session_id = api_get_session_id();
176
+        $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view';
177
+
178
+        if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
179
+            $url .= '&action=view&lp_id='.$this->get_ref_id();
180
+        } else {
181
+            $url .= '&action=build&lp_id='.$this->get_ref_id();
182
+        }
183
+        return $url;
184
+    }
185
+
186
+    /**
187
+     * Get name to display: same as learnpath title
188
+     */
189
+    public function get_name()
190
+    {
191
+        $data = $this->get_learnpath_data();
192
+        return $data['name'];
193
+    }
194
+
195
+    /**
196
+     * Get description to display: same as learnpath description
197
+     */
198
+    public function get_description()
199
+    {
200
+        $data = $this->get_learnpath_data();
201
+        return $data['description'];
202
+    }
203
+
204
+    /**
205
+     * Check if this still links to a learnpath
206
+     */
207
+    public function is_valid_link() {
208
+        $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().'
209 209
                 WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
210
-		$result = Database::query($sql);
211
-		$number = Database::fetch_row($result,'NUM');
212
-		return ($number[0] != 0);
213
-	}
214
-
215
-	public function get_type_name()
216
-	{
217
-		return get_lang('LearningPaths');
218
-	}
219
-
220
-	public function needs_name_and_description()
221
-	{
222
-		return false;
223
-	}
224
-
225
-	public function needs_max()
226
-	{
227
-		return false;
228
-	}
229
-
230
-	public function needs_results()
231
-	{
232
-		return false;
233
-	}
234
-
235
-	public function is_allowed_to_change_name()
236
-	{
237
-		return false;
238
-	}
239
-
240
-	// INTERNAL FUNCTIONS
241
-
242
-	/**
243
-	 * Lazy load function to get the database table of the learnpath
244
-	 */
245
-	private function get_learnpath_table()
246
-	{
247
-		$this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN);
248
-		return $this->learnpath_table;
249
-	}
250
-
251
-	/**
252
-	 * Lazy load function to get the database contents of this learnpath
253
-	 */
254
-	private function get_learnpath_data()
255
-	{
256
-		if (!isset($this->learnpath_data)) {
257
-			$sql = 'SELECT * FROM '.$this->get_learnpath_table().'
210
+        $result = Database::query($sql);
211
+        $number = Database::fetch_row($result,'NUM');
212
+        return ($number[0] != 0);
213
+    }
214
+
215
+    public function get_type_name()
216
+    {
217
+        return get_lang('LearningPaths');
218
+    }
219
+
220
+    public function needs_name_and_description()
221
+    {
222
+        return false;
223
+    }
224
+
225
+    public function needs_max()
226
+    {
227
+        return false;
228
+    }
229
+
230
+    public function needs_results()
231
+    {
232
+        return false;
233
+    }
234
+
235
+    public function is_allowed_to_change_name()
236
+    {
237
+        return false;
238
+    }
239
+
240
+    // INTERNAL FUNCTIONS
241
+
242
+    /**
243
+     * Lazy load function to get the database table of the learnpath
244
+     */
245
+    private function get_learnpath_table()
246
+    {
247
+        $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN);
248
+        return $this->learnpath_table;
249
+    }
250
+
251
+    /**
252
+     * Lazy load function to get the database contents of this learnpath
253
+     */
254
+    private function get_learnpath_data()
255
+    {
256
+        if (!isset($this->learnpath_data)) {
257
+            $sql = 'SELECT * FROM '.$this->get_learnpath_table().'
258 258
                     WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
259
-			$result = Database::query($sql);
260
-			$this->learnpath_data = Database::fetch_array($result);
261
-		}
262
-		return $this->learnpath_data;
263
-	}
264
-
265
-	public function get_icon_name()
266
-	{
267
-		return 'learnpath';
268
-	}
259
+            $result = Database::query($sql);
260
+            $this->learnpath_data = Database::fetch_array($result);
261
+        }
262
+        return $this->learnpath_data;
263
+    }
264
+
265
+    public function get_icon_name()
266
+    {
267
+        return 'learnpath';
268
+    }
269 269
 }
Please login to merge, or discard this patch.
main/search/index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 $this_section =  SECTION_COURSES;
11 11
 
12 12
 if (extension_loaded('xapian')) {
13
-	require '../lp/lp_list_search.php';
13
+    require '../lp/lp_list_search.php';
14 14
 } else {
15 15
     Display::display_header(get_lang('Search'));
16 16
     Display::display_error_message(get_lang('SearchXapianModuleNotInstalled'));
Please login to merge, or discard this patch.
main/gradebook/gradebook_add_user.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 $newstudents = $evaluation[0]->get_not_subscribed_students();
19 19
 
20 20
 if (count($newstudents) == '0') {
21
-	header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
22
-	exit;
21
+    header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
22
+    exit;
23 23
 }
24 24
 $add_user_form = new EvalForm(
25 25
     EvalForm :: TYPE_ADD_USERS_TO_EVAL,
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 
68 68
 $interbreadcrumb[]= array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('Gradebook'));
69 69
 $interbreadcrumb[]= array(
70
-	'url' => 'gradebook_view_result.php?selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
71
-	'name' => get_lang('ViewResult')
70
+    'url' => 'gradebook_view_result.php?selecteval=' .Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
71
+    'name' => get_lang('ViewResult')
72 72
 );
73 73
 Display :: display_header(get_lang('AddUserToEval'));
74 74
 if (isset ($_GET['erroroneuser'])){
75
-	Display :: display_warning_message(get_lang('AtLeastOneUser'),false);
75
+    Display :: display_warning_message(get_lang('AtLeastOneUser'),false);
76 76
 }
77 77
 DisplayGradebook :: display_header_result($evaluation[0], null, 0,0);
78 78
 echo '<div class="main">';
Please login to merge, or discard this patch.