Completed
Push — 1.11.x ( 7ffd51...902ebd )
by José
50:21 queued 21:28
created
main/session/add_users_to_session.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -628,8 +628,8 @@
 block discarded – undo
628 628
     </div>
629 629
     <form name="formulaire" method="post"
630 630
           action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($addProcess)) {
631
-              echo '&add=true';
632
-          } ?>" <?php if ($ajax_search) {
631
+                echo '&add=true';
632
+            } ?>" <?php if ($ajax_search) {
633 633
         echo ' onsubmit="valide();"';
634 634
     } ?>>
635 635
         <?php echo '<legend>'.$tool_name.' ('.$session_info['name'].') </legend>'; ?>
Please login to merge, or discard this patch.
main/user/add_users_to_session.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
                 <div id="content_source">
539 539
                 <?php
540 540
                 if (!($add_type == 'multiple')) {
541
-                  ?>
541
+                    ?>
542 542
                   <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
543 543
                   <div id="ajax_list_users_single"></div>
544 544
                   <?php
@@ -547,12 +547,12 @@  discard block
 block discarded – undo
547 547
                 <div id="ajax_list_users_multiple">
548 548
                 <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" class="span5">
549 549
                   <?php
550
-                  foreach ($nosessionUsersList as $uid => $enreg) {
551
-                  ?>
550
+                    foreach ($nosessionUsersList as $uid => $enreg) {
551
+                    ?>
552 552
                       <option value="<?php echo $uid; ?>" <?php if (in_array($uid, $UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option>
553 553
                   <?php
554
-                  }
555
-                  ?>
554
+                    }
555
+                    ?>
556 556
                 </select>
557 557
                 </div>
558 558
                     <input type="checkbox" onchange="checked_in_no_session(this.checked);" name="user_with_any_session" id="user_with_any_session_id">
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                 <?php
561 561
                 }
562 562
                 unset($nosessionUsersList);
563
-               ?>
563
+                ?>
564 564
             </div>
565 565
         </div>
566 566
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -488,7 +488,10 @@  discard block
 block discarded – undo
488 488
     <div class="actions">
489 489
         <?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>&nbsp;|&nbsp;<?php echo $link_add_group; ?>
490 490
     </div>
491
-    <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
491
+    <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($_GET['add'])) {
492
+    echo '&add=true';
493
+}
494
+?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
492 495
     <?php echo '<legend>'.$tool_name.' ('.$session->getName().') </legend>'; ?>
493 496
     <?php
494 497
     if ($add_type === 'multiple') {
@@ -549,7 +552,10 @@  discard block
 block discarded – undo
549 552
                   <?php
550 553
                   foreach ($nosessionUsersList as $uid => $enreg) {
551 554
                   ?>
552
-                      <option value="<?php echo $uid; ?>" <?php if (in_array($uid, $UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option>
555
+                      <option value="<?php echo $uid; ?>" <?php if (in_array($uid, $UserList)) {
556
+    echo 'selected="selected"';
557
+}
558
+?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option>
553 559
                   <?php
554 560
                   }
555 561
                   ?>
Please login to merge, or discard this patch.
main/tracking/question_course_report.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -14,20 +14,20 @@  discard block
 block discarded – undo
14 14
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_session_general_coach || $is_sessionAdmin;
15 15
 
16 16
 if (!$is_allowedToTrack) {
17
-	Display::display_header(null);
18
-	api_not_allowed();
19
-	Display::display_footer();
17
+    Display::display_header(null);
18
+    api_not_allowed();
19
+    Display::display_footer();
20 20
 }
21 21
 
22 22
 $export_to_xls = false;
23 23
 if (isset($_GET['export'])) {
24
-	$export_to_xls = true;
24
+    $export_to_xls = true;
25 25
 }
26 26
 
27 27
 if (api_is_platform_admin()) {
28
-	$global = true;
28
+    $global = true;
29 29
 } else {
30
-	$global = false;
30
+    $global = false;
31 31
 }
32 32
 $global = true;
33 33
 
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
 $session_id = isset($_REQUEST['session_id']) ? intval($_REQUEST['session_id']) : null;
46 46
 
47 47
 if (empty($session_id)) {
48
-	$temp_course_list = CourseManager::get_courses_list();
48
+    $temp_course_list = CourseManager::get_courses_list();
49 49
 } else {
50
-	$temp_course_list = SessionManager::get_course_list_by_session_id($session_id);
50
+    $temp_course_list = SessionManager::get_course_list_by_session_id($session_id);
51 51
 }
52 52
 
53 53
 foreach ($temp_course_list  as $temp_course_item) {
54
-	$course_item = api_get_course_info($temp_course_item['code']);
55
-	$course_select_list[$temp_course_item['code']] = $course_item['title'];
54
+    $course_item = api_get_course_info($temp_course_item['code']);
55
+    $course_select_list[$temp_course_item['code']] = $course_item['title'];
56 56
 }
57 57
 
58 58
 //Get session list
@@ -95,132 +95,132 @@  discard block
 block discarded – undo
95 95
 $course_info = api_get_course_info($course_code);
96 96
 
97 97
 if (!empty($course_info)) {
98
-	$list = new LearnpathList('', $course_code);
99
-	$lp_list = $list->get_flat_list();
98
+    $list = new LearnpathList('', $course_code);
99
+    $lp_list = $list->get_flat_list();
100 100
 
101
-	$main_question_list = array();
101
+    $main_question_list = array();
102 102
 
103
-	foreach ($lp_list as $lp_id => $lp) {
103
+    foreach ($lp_list as $lp_id => $lp) {
104 104
         $exercise_list = Event::get_all_exercises_from_lp(
105 105
             $lp_id,
106 106
             $course_info['real_id']
107 107
         );
108 108
 
109
-		foreach ($exercise_list as $exercise) {
110
-			$my_exercise = new Exercise($course_info['real_id']);
111
-			$my_exercise->read($exercise['path']);
112
-			$question_list = $my_exercise->selectQuestionList();
113
-
114
-			$exercise_stats = Event::get_all_exercise_event_from_lp(
115
-				$exercise['path'],
116
-				$course_info['real_id'],
117
-				$session_id
118
-			);
119
-
120
-			foreach ($question_list as $question_id) {
121
-				$question_data = Question::read($question_id);
122
-				$main_question_list[$question_id] = $question_data;
123
-				$quantity_exercises = 0;
124
-				$question_result = 0;
125
-
126
-				foreach ($exercise_stats as $stats) {
127
-					if (!empty($stats['question_list'])) {
128
-						foreach ($stats['question_list'] as $my_question_stat) {
129
-							if ($question_id == $my_question_stat['question_id']) {
130
-								$question_result = $question_result + $my_question_stat['marks'];
131
-								$quantity_exercises++;
132
-							}
133
-						}
134
-					}
135
-				}
136
-
137
-				if (!empty($quantity_exercises)) {
138
-					// Score % average
139
-					$main_question_list[$question_id]->results = ($question_result / ($quantity_exercises));
140
-				} else {
141
-					$main_question_list[$question_id]->results = 0;
142
-				}
143
-
144
-				$main_question_list[$question_id]->quantity = $quantity_exercises;
145
-			}
146
-		}
147
-	}
109
+        foreach ($exercise_list as $exercise) {
110
+            $my_exercise = new Exercise($course_info['real_id']);
111
+            $my_exercise->read($exercise['path']);
112
+            $question_list = $my_exercise->selectQuestionList();
113
+
114
+            $exercise_stats = Event::get_all_exercise_event_from_lp(
115
+                $exercise['path'],
116
+                $course_info['real_id'],
117
+                $session_id
118
+            );
119
+
120
+            foreach ($question_list as $question_id) {
121
+                $question_data = Question::read($question_id);
122
+                $main_question_list[$question_id] = $question_data;
123
+                $quantity_exercises = 0;
124
+                $question_result = 0;
125
+
126
+                foreach ($exercise_stats as $stats) {
127
+                    if (!empty($stats['question_list'])) {
128
+                        foreach ($stats['question_list'] as $my_question_stat) {
129
+                            if ($question_id == $my_question_stat['question_id']) {
130
+                                $question_result = $question_result + $my_question_stat['marks'];
131
+                                $quantity_exercises++;
132
+                            }
133
+                        }
134
+                    }
135
+                }
136
+
137
+                if (!empty($quantity_exercises)) {
138
+                    // Score % average
139
+                    $main_question_list[$question_id]->results = ($question_result / ($quantity_exercises));
140
+                } else {
141
+                    $main_question_list[$question_id]->results = 0;
142
+                }
143
+
144
+                $main_question_list[$question_id]->quantity = $quantity_exercises;
145
+            }
146
+        }
147
+    }
148 148
 }
149 149
 
150 150
 if (!$export_to_xls) {
151
-	Display::display_header(get_lang("MySpace"));
152
-	echo '<div class="actions">';
153
-	if ($global) {
154
-		echo MySpace::getTopMenu();
155
-	} else {
156
-		echo '<div style="float:left; clear:left">
151
+    Display::display_header(get_lang("MySpace"));
152
+    echo '<div class="actions">';
153
+    if ($global) {
154
+        echo MySpace::getTopMenu();
155
+    } else {
156
+        echo '<div style="float:left; clear:left">
157 157
 				<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.
158 158
                     get_lang('StudentsTracking').'</a>&nbsp;|
159 159
 				<a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.
160 160
                     get_lang('CourseTracking').'</a>&nbsp;';
161
-		echo '</div>';
162
-	}
163
-	echo '</div>';
161
+        echo '</div>';
162
+    }
163
+    echo '</div>';
164 164
 
165
-	if (api_is_platform_admin()) {
166
-		echo MySpace::getAdminActions();
167
-	}
168
-	echo '<br />';
169
-	echo '<h2>'.get_lang('LPQuestionListResults').'</h2>';
165
+    if (api_is_platform_admin()) {
166
+        echo MySpace::getAdminActions();
167
+    }
168
+    echo '<br />';
169
+    echo '<h2>'.get_lang('LPQuestionListResults').'</h2>';
170 170
 
171
-	$form->display();
171
+    $form->display();
172 172
 
173
-	if (empty($course_code)) {
174
-		echo Display::return_message(get_lang('PleaseSelectACourse'), 'warning');
175
-	}
173
+    if (empty($course_code)) {
174
+        echo Display::return_message(get_lang('PleaseSelectACourse'), 'warning');
175
+    }
176 176
 }
177 177
 
178 178
 $course_average = array();
179 179
 $counter = 0;
180 180
 
181 181
 if (!empty($main_question_list) && is_array($main_question_list)) {
182
-	$html_result .= '<table  class="data_table">';
183
-	$html_result .= '<tr><th>'.get_lang('Question').
182
+    $html_result .= '<table  class="data_table">';
183
+    $html_result .= '<tr><th>'.get_lang('Question').
184 184
                     Display::return_icon('info3.gif', get_lang('QuestionsAreTakenFromLPExercises'), array('align' => 'absmiddle', 'hspace' => '3px')).'</th>';
185
-	$html_result .= '<th>'.$course_info['visual_code'].' '.get_lang('AverageScore').Display::return_icon('info3.gif', get_lang('AllStudentsAttemptsAreConsidered'), array('align' => 'absmiddle', 'hspace' => '3px')).' </th>';
186
-	$html_result .= '<th>'.get_lang('Quantity').'</th>';
187
-
188
-	foreach ($main_question_list as $question) {
189
-		$total_student = 0;
190
-		$counter++;
191
-		$s_css_class = 'row_even';
192
-		if ($counter % 2 == 0) {
193
-			$s_css_class = 'row_odd';
194
-		}
195
-		$html_result .= "<tr class='$s_css_class'>
185
+    $html_result .= '<th>'.$course_info['visual_code'].' '.get_lang('AverageScore').Display::return_icon('info3.gif', get_lang('AllStudentsAttemptsAreConsidered'), array('align' => 'absmiddle', 'hspace' => '3px')).' </th>';
186
+    $html_result .= '<th>'.get_lang('Quantity').'</th>';
187
+
188
+    foreach ($main_question_list as $question) {
189
+        $total_student = 0;
190
+        $counter++;
191
+        $s_css_class = 'row_even';
192
+        if ($counter % 2 == 0) {
193
+            $s_css_class = 'row_odd';
194
+        }
195
+        $html_result .= "<tr class='$s_css_class'>
196 196
 							<td >";
197
-		$question_title = trim($question->question);
198
-		if (empty($question_title)) {
199
-			$html_result .= get_lang('Untitled').' '.get_lang('Question').' #'.$question->id;
200
-		} else {
201
-			$html_result .= $question->question;
202
-		}
203
-
204
-		$html_result .= "</td>";
205
-		$html_result .= "<td>";
206
-		$html_result .= round($question->results, 2).' / '.$question->weighting;
207
-		$html_result .= "</td>";
208
-
209
-		$html_result .= "<td>";
210
-		$html_result .= $question->quantity;
211
-		$html_result .= "</td>";
212
-	}
213
-
214
-	$html_result .= "</tr>";
215
-	$html_result .= '</table>';
197
+        $question_title = trim($question->question);
198
+        if (empty($question_title)) {
199
+            $html_result .= get_lang('Untitled').' '.get_lang('Question').' #'.$question->id;
200
+        } else {
201
+            $html_result .= $question->question;
202
+        }
203
+
204
+        $html_result .= "</td>";
205
+        $html_result .= "<td>";
206
+        $html_result .= round($question->results, 2).' / '.$question->weighting;
207
+        $html_result .= "</td>";
208
+
209
+        $html_result .= "<td>";
210
+        $html_result .= $question->quantity;
211
+        $html_result .= "</td>";
212
+    }
213
+
214
+    $html_result .= "</tr>";
215
+    $html_result .= '</table>';
216 216
 } else {
217
-	if (!empty($course_code)) {
218
-		echo Display::return_message(get_lang('NoResults'), 'warning');
219
-	}
217
+    if (!empty($course_code)) {
218
+        echo Display::return_message(get_lang('NoResults'), 'warning');
219
+    }
220 220
 }
221 221
 
222 222
 if (!$export_to_xls) {
223
-	echo $html_result;
223
+    echo $html_result;
224 224
 }
225 225
 
226 226
 Display::display_footer();
Please login to merge, or discard this patch.
main/session/add_courses_to_session.php 1 patch
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -205,7 +205,10 @@  discard block
 block discarded – undo
205 205
 
206 206
 unset($Courses);
207 207
 ?>
208
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
208
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if (!empty($_GET['add'])) {
209
+    echo '&add=true';
210
+}
211
+?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
209 212
     <legend><?php echo $tool_name.' ('.$session_info['name'].')'; ?></legend>
210 213
     <input type="hidden" name="formSent" value="1" />
211 214
     <div id="multiple-add-session" class="row">
@@ -222,7 +225,10 @@  discard block
 block discarded – undo
222 225
                 <div id="ajax_list_courses_multiple">
223 226
                     <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control">
224 227
                         <?php foreach ($nosessionCourses as $enreg) { ?>
225
-                            <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')', ENT_QUOTES).'"'; if (in_array($enreg['code'], $CourseList)) echo 'selected="selected"'; ?>>
228
+                            <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')', ENT_QUOTES).'"'; if (in_array($enreg['code'], $CourseList)) {
229
+    echo 'selected="selected"';
230
+}
231
+?>>
226 232
                                 <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
227 233
                             </option>
228 234
                         <?php } ?>
Please login to merge, or discard this patch.
main/inc/lib/sessionmanager.lib.php 5 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1944,7 +1944,7 @@
 block discarded – undo
1944 1944
         foreach ($user_list as $enreg_user) {
1945 1945
             $isUserSubscribed = self::isUserSubscribedAsStudent($id_session, $enreg_user);
1946 1946
             if ($isUserSubscribed === false) {
1947
-                $enreg_user = (int)$enreg_user;
1947
+                $enreg_user = (int) $enreg_user;
1948 1948
                 $nbr_users++;
1949 1949
                 $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at)
1950 1950
                         VALUES (0, $id_session, $enreg_user, '".api_get_utc_datetime()."')";
Please login to merge, or discard this patch.
Doc Comments   +21 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1770,7 +1770,7 @@  discard block
 block discarded – undo
1770 1770
      * @param array $user_list
1771 1771
      * @param int $session_visibility
1772 1772
      * @param bool $empty_users
1773
-     * @return bool
1773
+     * @return false|null
1774 1774
      */
1775 1775
     public static function subscribe_users_to_session(
1776 1776
         $id_session,
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
      * @param array $courseInfo
2116 2116
      * @param int $status
2117 2117
      * @param bool $updateTotal
2118
-     * @return bool
2118
+     * @return false|null
2119 2119
      */
2120 2120
     public static function removeUsersFromCourseSession(
2121 2121
         $userList,
@@ -2181,7 +2181,7 @@  discard block
 block discarded – undo
2181 2181
      * @param string $course_code
2182 2182
      * @param int $session_visibility
2183 2183
      * @param bool $removeUsersNotInList
2184
-     * @return bool
2184
+     * @return false|null
2185 2185
      */
2186 2186
     public static function subscribe_users_to_session_course(
2187 2187
         $user_list,
@@ -2364,7 +2364,7 @@  discard block
 block discarded – undo
2364 2364
      * @param   bool $removeExistingCoursesWithUsers Whether to unsubscribe
2365 2365
      * existing courses and users (true, default) or not (false)
2366 2366
      * @param bool $copyEvaluation from base course to session course
2367
-     * @return    void    Nothing, or false on error
2367
+     * @return    false|null    Nothing, or false on error
2368 2368
      * */
2369 2369
     public static function add_courses_to_session(
2370 2370
         $sessionId,
@@ -2673,7 +2673,7 @@  discard block
 block discarded – undo
2673 2673
      * @param int $fieldType Field's type
2674 2674
      * @param string $displayText Field's language var name
2675 2675
      * @param string $default Field's default value
2676
-     * @return int     new extra field id
2676
+     * @return boolean     new extra field id
2677 2677
      */
2678 2678
     public static function create_session_extra_field(
2679 2679
         $variable,
@@ -2767,7 +2767,7 @@  discard block
 block discarded – undo
2767 2767
      * @param integer        year_end
2768 2768
      * @param integer        month_end
2769 2769
      * @param integer        day_end
2770
-     * @return int session ID
2770
+     * @return string|false session ID
2771 2771
      * */
2772 2772
     public static function create_category_session(
2773 2773
         $sname,
@@ -2843,7 +2843,7 @@  discard block
 block discarded – undo
2843 2843
      * @param integer        year_end
2844 2844
      * @param integer        month_end
2845 2845
      * @param integer        day_end
2846
-     * @return bool
2846
+     * @return string|boolean
2847 2847
      * The parameter id is a primary key
2848 2848
      * */
2849 2849
     public static function edit_category_session(
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
      * @param	array	id_checked
2908 2908
      * @param	bool	include delete session
2909 2909
      * @param	bool	optional, true if the function is called by a webservice, false otherwise.
2910
-     * @return	void	Nothing, or false on error
2910
+     * @return	boolean	Nothing, or false on error
2911 2911
      * The parameters is a array to delete sessions
2912 2912
      * */
2913 2913
     public static function delete_session_category($id_checked, $delete_session = false, $from_ws = false)
@@ -3677,8 +3677,8 @@  discard block
 block discarded – undo
3677 3677
     /**
3678 3678
      * Gets the list of courses by session filtered by access_url
3679 3679
      *
3680
-     * @param $userId
3681
-     * @param $sessionId
3680
+     * @param integer $userId
3681
+     * @param null|integer $sessionId
3682 3682
      * @param null $from
3683 3683
      * @param null $limit
3684 3684
      * @param null $column
@@ -3802,6 +3802,7 @@  discard block
 block discarded – undo
3802 3802
     /**
3803 3803
      * Gets the count of courses by session filtered by access_url
3804 3804
      * @param int session id
3805
+     * @param integer $session_id
3805 3806
      * @return array list of courses
3806 3807
      */
3807 3808
     public static function getCourseCountBySessionId($session_id, $keyword = null)
@@ -4056,6 +4057,7 @@  discard block
 block discarded – undo
4056 4057
      * Updates a session status
4057 4058
      * @param	int 	session id
4058 4059
      * @param	int 	status
4060
+     * @param integer $status
4059 4061
      */
4060 4062
     public static function set_session_status($session_id, $status)
4061 4063
     {
@@ -4248,6 +4250,7 @@  discard block
 block discarded – undo
4248 4250
     /**
4249 4251
      * Get the number of sessions
4250 4252
      * @param  int ID of the URL we want to filter on (optional)
4253
+     * @param integer $access_url_id
4251 4254
      * @return int Number of sessions
4252 4255
      */
4253 4256
     public static function count_sessions($access_url_id = null)
@@ -4268,7 +4271,7 @@  discard block
 block discarded – undo
4268 4271
      * Protect a session to be edited.
4269 4272
      * @param int $id
4270 4273
      * @param bool $checkSession
4271
-     * @return mixed | bool true if pass the check, api_not_allowed otherwise
4274
+     * @return boolean|null | bool true if pass the check, api_not_allowed otherwise
4272 4275
      */
4273 4276
     public static function protectSession($id, $checkSession = true)
4274 4277
     {
@@ -4376,7 +4379,7 @@  discard block
 block discarded – undo
4376 4379
 
4377 4380
     /**
4378 4381
      * @param $id
4379
-     * @return bool
4382
+     * @return null|boolean
4380 4383
      */
4381 4384
     public static function protect_teacher_session_edit($id)
4382 4385
     {
@@ -4453,7 +4456,7 @@  discard block
 block discarded – undo
4453 4456
      *  true: if the session exists it will be updated.
4454 4457
      *  false: if session exists a new session will be created adding a counter session1, session2, etc
4455 4458
      * @param int $defaultUserId
4456
-     * @param mixed $logger
4459
+     * @param Logger $logger
4457 4460
      * @param array $extraFields convert a file row to an extra field. Example in CSV file there's a SessionID then it will
4458 4461
      * converted to extra_external_session_id if you set this: array('SessionId' => 'extra_external_session_id')
4459 4462
      * @param string $extraFieldId
@@ -5992,7 +5995,7 @@  discard block
 block discarded – undo
5992 5995
     /**
5993 5996
      * Get the list of course tools that have to be dealt with in case of
5994 5997
      * registering any course to a session
5995
-     * @return array The list of tools to be dealt with (literal names)
5998
+     * @return string[] The list of tools to be dealt with (literal names)
5996 5999
      */
5997 6000
     public static function getCourseToolToBeManaged()
5998 6001
     {
@@ -6006,7 +6009,7 @@  discard block
 block discarded – undo
6006 6009
      * Calls the methods bound to each tool when a course is registered into a session
6007 6010
      * @param int $sessionId
6008 6011
      * @param int $courseId
6009
-     * @return void
6012
+     * @return boolean|null
6010 6013
      */
6011 6014
     public static function installCourse($sessionId, $courseId)
6012 6015
     {
@@ -6664,6 +6667,7 @@  discard block
 block discarded – undo
6664 6667
      * @param int $categoryId The internal ID of the session category
6665 6668
      * @param string $target Value to search for in the session field values
6666 6669
      * @param array $extraFields A list of fields to be scanned and returned
6670
+     * @param DateTime $publicationDate
6667 6671
      * @return mixed
6668 6672
      */
6669 6673
     public static function getShortSessionListAndExtraByCategory(
@@ -8139,7 +8143,7 @@  discard block
 block discarded – undo
8139 8143
     /**
8140 8144
      * Get link to the admin page for this session
8141 8145
      * @param   int $id Session ID
8142
-     * @return mixed    URL to the admin page to manage the session, or false on error
8146
+     * @return false|string    URL to the admin page to manage the session, or false on error
8143 8147
      */
8144 8148
     public static function getAdminPath($id)
8145 8149
     {
@@ -8156,7 +8160,7 @@  discard block
 block discarded – undo
8156 8160
      * If a course is provided, build the link to the course
8157 8161
      * @param   int $id Session ID
8158 8162
      * @param   int $courseId Course ID (optional) in case the link has to send straight to the course
8159
-     * @return mixed    URL to the page to use the session, or false on error
8163
+     * @return false|string    URL to the page to use the session, or false on error
8160 8164
      */
8161 8165
     public static function getPath($id, $courseId = 0)
8162 8166
     {
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                         true
582 582
                     );
583 583
                 }
584
-                 $url = api_get_path(WEB_CODE_PATH)."session/resume_session.php?id_session=".$session['id'];
584
+                    $url = api_get_path(WEB_CODE_PATH)."session/resume_session.php?id_session=".$session['id'];
585 585
                 if (api_is_drh()) {
586 586
                     $url = api_get_path(WEB_CODE_PATH)."session/about.php?session_id=".$session['id'];
587 587
                 }
@@ -2063,16 +2063,16 @@  discard block
 block discarded – undo
2063 2063
         return $existingUsers;
2064 2064
     }
2065 2065
 
2066
-     /**
2067
-     * Returns user list of the current users subscribed in the course-session
2068
-     * @param array $sessionList
2069
-     * @param array $courseList
2070
-     * @param int $status
2071
-     * @param int $start
2072
-     * @param int $limit
2073
-     *
2074
-     * @return array
2075
-     */
2066
+        /**
2067
+         * Returns user list of the current users subscribed in the course-session
2068
+         * @param array $sessionList
2069
+         * @param array $courseList
2070
+         * @param int $status
2071
+         * @param int $start
2072
+         * @param int $limit
2073
+         *
2074
+         * @return array
2075
+         */
2076 2076
     public static function getUsersByCourseAndSessionList(
2077 2077
         $sessionList,
2078 2078
         $courseList,
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4691,7 +4691,8 @@  discard block
 block discarded – undo
4691 4691
                     if ($debug) {
4692 4692
                         if ($session_id) {
4693 4693
                             foreach ($enreg as $key => $value) {
4694
-                                if (substr($key, 0, 6) == 'extra_') { //an extra field
4694
+                                if (substr($key, 0, 6) == 'extra_') {
4695
+//an extra field
4695 4696
                                     self::update_session_extra_field_value($session_id, substr($key, 6), $value);
4696 4697
                                 }
4697 4698
                             }
@@ -4738,7 +4739,8 @@  discard block
 block discarded – undo
4738 4739
 
4739 4740
                         if ($session_id) {
4740 4741
                             foreach ($enreg as $key => $value) {
4741
-                                if (substr($key, 0, 6) == 'extra_') { //an extra field
4742
+                                if (substr($key, 0, 6) == 'extra_') {
4743
+//an extra field
4742 4744
                                     self::update_session_extra_field_value($session_id, substr($key, 6), $value);
4743 4745
                                 }
4744 4746
                             }
@@ -4836,7 +4838,8 @@  discard block
 block discarded – undo
4836 4838
                             Database::update($tbl_session, $params, array('id = ?' => $session_id));
4837 4839
 
4838 4840
                             foreach ($enreg as $key => $value) {
4839
-                                if (substr($key, 0, 6) == 'extra_') { //an extra field
4841
+                                if (substr($key, 0, 6) == 'extra_') {
4842
+//an extra field
4840 4843
                                     self::update_session_extra_field_value($session_id, substr($key, 6), $value);
4841 4844
                                 }
4842 4845
                             }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 $duration = intval($duration);
239 239
 
240 240
                 if (!empty($duration)) {
241
-                    $sql = "UPDATE $tbl_session SET
241
+                    $sql = "update $tbl_session SET
242 242
                         access_start_date = NULL,
243 243
                         access_end_date = NULL,
244 244
                         display_start_date = NULL,
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     WHERE id = $session_id";
250 250
                     Database::query($sql);
251 251
                 } else {
252
-                    $sql = "UPDATE $tbl_session
252
+                    $sql = "update $tbl_session
253 253
                         SET duration = 0
254 254
                         WHERE id = $session_id";
255 255
                     Database::query($sql);
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
         Database::query("DELETE FROM $trackCourseAccess WHERE session_id IN($id_checked)");
1728 1728
         Database::query("DELETE FROM $trackAccess WHERE access_session_id IN($id_checked)");
1729 1729
 
1730
-        $sql = "UPDATE $ticket SET session_id = NULL WHERE session_id IN ($id_checked)";
1730
+        $sql = "update $ticket SET session_id = NULL WHERE session_id IN ($id_checked)";
1731 1731
         Database::query($sql);
1732 1732
 
1733 1733
         $sql = "DELETE FROM $tbl_session WHERE id IN ($id_checked)";
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
     {
1763 1763
         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
1764 1764
         $id = intval($id);
1765
-        $sql = "UPDATE $tbl_session 
1765
+        $sql = "update $tbl_session 
1766 1766
                 SET promotion_id = 0
1767 1767
                 WHERE promotion_id = $id";
1768 1768
         if (Database::query($sql)) {
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
             $rs = Database::query($sql);
1985 1985
             list($nbr_users) = Database::fetch_array($rs);
1986 1986
             // update the session-course relation to add the users total
1987
-            $sql = "UPDATE $tbl_session_rel_course SET nbr_users = $nbr_users
1987
+            $sql = "update $tbl_session_rel_course SET nbr_users = $nbr_users
1988 1988
                     WHERE session_id = $id_session AND c_id = $courseId";
1989 1989
             Database::query($sql);
1990 1990
         }
@@ -2013,11 +2013,11 @@  discard block
 block discarded – undo
2013 2013
         $nbr_users = count($user_list);
2014 2014
         if ($empty_users) {
2015 2015
             // update number of users in the session
2016
-            $sql = "UPDATE $tbl_session SET nbr_users= $nbr_users
2016
+            $sql = "update $tbl_session SET nbr_users= $nbr_users
2017 2017
                     WHERE id = $id_session ";
2018 2018
             Database::query($sql);
2019 2019
         } else {
2020
-            $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + $nbr_users
2020
+            $sql = "update $tbl_session SET nbr_users = nbr_users + $nbr_users
2021 2021
                     WHERE id = $id_session";
2022 2022
             Database::query($sql);
2023 2023
         }
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
         if (!is_null($start) && !is_null($limit)) {
2110 2110
             $start = (int) $start;
2111 2111
             $limit = (int) $limit;
2112
-            $sql .= "LIMIT $start, $limit";
2112
+            $sql .= "limit $start, $limit";
2113 2113
         }
2114 2114
         $result = Database::query($sql);
2115 2115
         $existingUsers = array();
@@ -2176,7 +2176,7 @@  discard block
 block discarded – undo
2176 2176
             list($userCount) = Database::fetch_array($result);
2177 2177
 
2178 2178
             // update the session-course relation to add the users total
2179
-            $sql = "UPDATE $tableSessionCourse
2179
+            $sql = "update $tableSessionCourse
2180 2180
                     SET nbr_users = $userCount
2181 2181
                     WHERE
2182 2182
                         session_id = $sessionId AND
@@ -2283,7 +2283,7 @@  discard block
 block discarded – undo
2283 2283
                         VALUES ($session_id, $enreg_user, '".api_get_utc_datetime()."')";
2284 2284
                 Database::query($sql);
2285 2285
 
2286
-                $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1
2286
+                $sql = "update $tbl_session SET nbr_users = nbr_users + 1
2287 2287
                         WHERE id = $session_id ";
2288 2288
                 Database::query($sql);
2289 2289
             }
@@ -2296,7 +2296,7 @@  discard block
 block discarded – undo
2296 2296
         $rs = Database::query($sql);
2297 2297
         list($nbr_users) = Database::fetch_array($rs);
2298 2298
         // update the session-course relation to add the users total
2299
-        $sql = "UPDATE $tbl_session_rel_course
2299
+        $sql = "update $tbl_session_rel_course
2300 2300
                 SET nbr_users = $nbr_users
2301 2301
                 WHERE session_id = $session_id AND c_id = $courseId";
2302 2302
         Database::query($sql);
@@ -2328,7 +2328,7 @@  discard block
 block discarded – undo
2328 2328
         $return = Database::affected_rows($result);
2329 2329
 
2330 2330
         // Update number of users
2331
-        $sql = "UPDATE $tbl_session
2331
+        $sql = "update $tbl_session
2332 2332
                 SET nbr_users = nbr_users - $return
2333 2333
                 WHERE id = $session_id ";
2334 2334
         Database::query($sql);
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 
2357 2357
                 if (Database::affected_rows($result)) {
2358 2358
                     // Update number of users in this relation
2359
-                    $sql = "UPDATE $tbl_session_rel_course SET 
2359
+                    $sql = "update $tbl_session_rel_course SET 
2360 2360
                             nbr_users = nbr_users - 1
2361 2361
                             WHERE session_id = $session_id AND c_id = $courseId";
2362 2362
                     Database::query($sql);
@@ -2611,14 +2611,14 @@  discard block
 block discarded – undo
2611 2611
                         $nbr_users++;
2612 2612
                     }
2613 2613
                 }
2614
-                $sql = "UPDATE $tbl_session_rel_course
2614
+                $sql = "update $tbl_session_rel_course
2615 2615
                         SET nbr_users = $nbr_users
2616 2616
                         WHERE session_id = $sessionId AND c_id = $courseId";
2617 2617
                 Database::query($sql);
2618 2618
             }
2619 2619
         }
2620 2620
 
2621
-        $sql = "UPDATE $tbl_session
2621
+        $sql = "update $tbl_session
2622 2622
                 SET nbr_courses = $nbr_courses
2623 2623
                 WHERE id = $sessionId";
2624 2624
         Database::query($sql);
@@ -2670,7 +2670,7 @@  discard block
 block discarded – undo
2670 2670
 
2671 2671
         if ($nb_affected > 0) {
2672 2672
             // Update number of courses in the session
2673
-            $sql = "UPDATE $tbl_session SET nbr_courses= nbr_courses - $nb_affected
2673
+            $sql = "update $tbl_session SET nbr_courses= nbr_courses - $nb_affected
2674 2674
                     WHERE id = $session_id";
2675 2675
             Database::query($sql);
2676 2676
             return true;
@@ -2896,14 +2896,14 @@  discard block
 block discarded – undo
2896 2896
             return $msg;
2897 2897
         }
2898 2898
         if ($date_end <> null) {
2899
-            $sql = "UPDATE $tbl_session_category
2899
+            $sql = "update $tbl_session_category
2900 2900
                     SET
2901 2901
                         name = '".Database::escape_string($name)."',
2902 2902
                         date_start = '$date_start' ,
2903 2903
                         date_end = '$date_end'
2904 2904
                     WHERE id= $id";
2905 2905
         } else {
2906
-            $sql = "UPDATE $tbl_session_category SET
2906
+            $sql = "update $tbl_session_category SET
2907 2907
                         name = '".Database::escape_string($name)."',
2908 2908
                         date_start = '$date_start',
2909 2909
                         date_end = NULL
@@ -2933,7 +2933,7 @@  discard block
 block discarded – undo
2933 2933
         }
2934 2934
 
2935 2935
         //Setting session_category_id to 0
2936
-        $sql = "UPDATE $tbl_session SET session_category_id = NULL
2936
+        $sql = "update $tbl_session SET session_category_id = NULL
2937 2937
                 WHERE session_category_id IN (".$id_checked.")";
2938 2938
         Database::query($sql);
2939 2939
 
@@ -3046,7 +3046,7 @@  discard block
 block discarded – undo
3046 3046
         if (!is_null($from) && !is_null($to)) {
3047 3047
             $to = intval($to);
3048 3048
             $from = intval($from);
3049
-            $sql_query .= "LIMIT $from, $to";
3049
+            $sql_query .= "limit $from, $to";
3050 3050
         }
3051 3051
 
3052 3052
         $sql_result = Database::query($sql_query);
@@ -3153,7 +3153,7 @@  discard block
 block discarded – undo
3153 3153
                 // The user is already subscribed to the session. Change the
3154 3154
                 // record so the user is NOT a coach for this course anymore
3155 3155
                 // and then exit
3156
-                $sql = "UPDATE $tblSessionRelCourseRelUser
3156
+                $sql = "update $tblSessionRelCourseRelUser
3157 3157
                         SET status = 0
3158 3158
                         WHERE
3159 3159
                             session_id = $sessionId AND
@@ -3188,7 +3188,7 @@  discard block
 block discarded – undo
3188 3188
 
3189 3189
         // Then update or insert.
3190 3190
         if (Database::num_rows($rs_check) > 0) {
3191
-            $sql = "UPDATE $tblSessionRelCourseRelUser SET status = 2
3191
+            $sql = "update $tblSessionRelCourseRelUser SET status = 2
3192 3192
                     WHERE
3193 3193
                         session_id = $sessionId AND
3194 3194
                         c_id = $courseId AND
@@ -3625,7 +3625,7 @@  discard block
 block discarded – undo
3625 3625
         }
3626 3626
 
3627 3627
         // select the courses
3628
-        $sql = "SELECT $sqlSelect
3628
+        $sql = "select $sqlSelect
3629 3629
                 FROM $tbl_course c
3630 3630
                 INNER JOIN $tbl_session_rel_course src
3631 3631
                 ON (c.id = src.c_id)
@@ -3880,7 +3880,7 @@  discard block
 block discarded – undo
3880 3880
             $selectedField = 'count(1) AS count';
3881 3881
         }
3882 3882
 
3883
-        $sql = "SELECT $selectedField
3883
+        $sql = "select $selectedField
3884 3884
                 FROM $tbl_user u
3885 3885
                 INNER JOIN $tbl_session_rel_user su
3886 3886
                 ON u.user_id = su.user_id AND
@@ -4195,7 +4195,7 @@  discard block
 block discarded – undo
4195 4195
                                 $quiz_table = Database::get_course_table(TABLE_QUIZ_TEST);
4196 4196
                                 $course_id = $course_info['real_id'];
4197 4197
                                 //@todo check this query
4198
-                                $sql = "UPDATE $quiz_table SET active = 0
4198
+                                $sql = "update $quiz_table SET active = 0
4199 4199
                                         WHERE c_id = $course_id AND session_id = $sid";
4200 4200
                                 Database::query($sql);
4201 4201
                             }
@@ -4803,7 +4803,7 @@  discard block
 block discarded – undo
4803 4803
                             $session_id = $sessionId;
4804 4804
                             if (!empty($enreg['SessionName'])) {
4805 4805
                                 $sessionName = Database::escape_string($enreg['SessionName']);
4806
-                                $sql = "UPDATE $tbl_session SET name = '$sessionName' WHERE id = $session_id";
4806
+                                $sql = "update $tbl_session SET name = '$sessionName' WHERE id = $session_id";
4807 4807
                                 Database::query($sql);
4808 4808
                             }
4809 4809
                         } else {
@@ -5341,7 +5341,7 @@  discard block
 block discarded – undo
5341 5341
                 }
5342 5342
                 $access_url_id = api_get_current_access_url_id();
5343 5343
                 UrlManager::add_session_to_url($session_id, $access_url_id);
5344
-                $sql = "UPDATE $tbl_session SET nbr_users = '$user_counter', nbr_courses = '$course_counter' 
5344
+                $sql = "update $tbl_session SET nbr_users = '$user_counter', nbr_courses = '$course_counter' 
5345 5345
                         WHERE id = '$session_id'";
5346 5346
                 Database::query($sql);
5347 5347
             }
@@ -5521,7 +5521,7 @@  discard block
 block discarded – undo
5521 5521
         if (isset($from) && isset($numberItems)) {
5522 5522
             $from = intval($from);
5523 5523
             $numberItems = intval($numberItems);
5524
-            $limitCondition = "LIMIT $from, $numberItems";
5524
+            $limitCondition = "limit $from, $numberItems";
5525 5525
         }
5526 5526
 
5527 5527
         $urlId = api_get_current_access_url_id();
@@ -6272,7 +6272,7 @@  discard block
 block discarded – undo
6272 6272
             }
6273 6273
             $position[$course['code']] = $course['position'];
6274 6274
             // Saving current order.
6275
-            $sql = "UPDATE $table SET position = $count
6275
+            $sql = "update $table SET position = $count
6276 6276
                     WHERE session_id = $sessionId AND c_id = '".$course['real_id']."'";
6277 6277
             Database::query($sql);
6278 6278
             $count++;
@@ -6305,11 +6305,11 @@  discard block
 block discarded – undo
6305 6305
             }
6306 6306
         }
6307 6307
 
6308
-        $sql1 = "UPDATE $table SET position = '".intval($nextOrder)."'
6308
+        $sql1 = "update $table SET position = '".intval($nextOrder)."'
6309 6309
                  WHERE session_id = $sessionId AND c_id =  $thisCourseCode";
6310 6310
         Database::query($sql1);
6311 6311
 
6312
-        $sql2 = "UPDATE $table SET position = '".intval($thisOrder)."'
6312
+        $sql2 = "update $table SET position = '".intval($thisOrder)."'
6313 6313
                  WHERE session_id = $sessionId AND c_id = $nextId";
6314 6314
         Database::query($sql2);
6315 6315
 
Please login to merge, or discard this patch.
main/inc/lib/ScheduledAnnouncement.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -312,7 +312,7 @@
 block discarded – undo
312 312
     }
313 313
 
314 314
     /**
315
-     * @return array
315
+     * @return string[]
316 316
      */
317 317
     public function getTags()
318 318
     {
Please login to merge, or discard this patch.
main/session/scheduled_announcement.php 1 patch
Switch Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -43,26 +43,26 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 switch ($action) {
46
-    case 'run':
47
-        $messagesSent = $object->sendPendingMessages();
46
+        case 'run':
47
+            $messagesSent = $object->sendPendingMessages();
48
+
49
+            Display::addFlash(
50
+                Display::return_message(
51
+                    get_lang('MessageSent').': '.$messagesSent,
52
+                    'confirmation'
53
+                )
54
+            );
55
+            $content = $object->getGrid($sessionId);
48 56
 
49
-        Display::addFlash(
50
-            Display::return_message(
51
-                get_lang('MessageSent').': '.$messagesSent,
52
-                'confirmation'
53
-            )
54
-        );
55
-        $content = $object->getGrid($sessionId);
57
+            break;
58
+        case 'add':
59
+            $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&session_id='.$sessionId;
60
+            $form = $object->returnForm($url, 'add', $sessionInfo);
56 61
 
57
-        break;
58
-    case 'add':
59
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&session_id='.$sessionId;
60
-        $form = $object->returnForm($url, 'add', $sessionInfo);
61
-
62
-        // The validation or display
63
-        if ($form->validate()) {
64
-            $values = $form->getSubmitValues();
65
-            switch ($values['type']) {
62
+            // The validation or display
63
+            if ($form->validate()) {
64
+                $values = $form->getSubmitValues();
65
+                switch ($values['type']) {
66 66
                 case 'base_date':
67 67
                     $numberDays = (int) $values['days'];
68 68
                     switch ($values['base_date']) {
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
                             $baseDate = new DateTime($sessionInfo['access_end_date']);
74 74
                             break;
75 75
                     }
76
-                    $interval = new DateInterval('P'.$numberDays.'D');
77
-                    switch ($values['moment_type']) {
76
+                        $interval = new DateInterval('P'.$numberDays.'D');
77
+                        switch ($values['moment_type']) {
78 78
                         case 'after':
79 79
                             $newDate = $baseDate->add($interval);
80 80
                             break;
81 81
                         case 'before':
82 82
                             $newDate = $baseDate->sub($interval);
83 83
                             break;
84
-                    }
84
+                        }
85 85
                     $values['date'] = $newDate->format('Y-m-d h:i:s');
86 86
                     break;
87
-                case 'specific_date':
88
-                    $values['date'] = api_get_utc_datetime($values['date']);
89
-                    break;
87
+                    case 'specific_date':
88
+                        $values['date'] = api_get_utc_datetime($values['date']);
89
+                        break;
90 90
             }
91 91
 
92 92
             $res = $object->save($values);
@@ -110,34 +110,34 @@  discard block
 block discarded – undo
110 110
             $content .= $form->returnForm();
111 111
         }
112 112
         break;
113
-    case 'edit':
114
-        // Action handling: Editing
115
-        $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']).'&session_id='.$sessionId;
116
-        $form = $object->returnSimpleForm($url, 'edit', $sessionInfo);
117
-        if ($form->validate()) {
118
-            $values = $form->getSubmitValues();
119
-            $values['id'] = $id;
120
-            $values['sent'] = isset($values['sent']) ? 1 : '';
121
-            $values['date'] = api_get_utc_datetime($values['date']);
122
-            $res = $object->update($values);
123
-
124
-            Display::addFlash(Display::return_message(
125
-                get_lang('Updated'),
126
-                'confirmation'
127
-            ));
128
-        }
129
-        $item = $object->get($id);
130
-        $item['date'] = api_get_local_time($item['date']);
131
-        $form->setDefaults($item);
132
-        $content = $form->returnForm();
133
-        break;
134
-    case 'delete':
135
-        $object->delete($_GET['id']);
136
-        $content = $object->getGrid($sessionId);
137
-        break;
138
-    default:
139
-        $content = $object->getGrid($sessionId);
140
-        break;
113
+        case 'edit':
114
+            // Action handling: Editing
115
+            $url  = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']).'&session_id='.$sessionId;
116
+            $form = $object->returnSimpleForm($url, 'edit', $sessionInfo);
117
+            if ($form->validate()) {
118
+                $values = $form->getSubmitValues();
119
+                $values['id'] = $id;
120
+                $values['sent'] = isset($values['sent']) ? 1 : '';
121
+                $values['date'] = api_get_utc_datetime($values['date']);
122
+                $res = $object->update($values);
123
+
124
+                Display::addFlash(Display::return_message(
125
+                    get_lang('Updated'),
126
+                    'confirmation'
127
+                ));
128
+            }
129
+            $item = $object->get($id);
130
+            $item['date'] = api_get_local_time($item['date']);
131
+            $form->setDefaults($item);
132
+            $content = $form->returnForm();
133
+            break;
134
+        case 'delete':
135
+            $object->delete($_GET['id']);
136
+            $content = $object->getGrid($sessionId);
137
+            break;
138
+        default:
139
+            $content = $object->getGrid($sessionId);
140
+            break;
141 141
 }
142 142
 
143 143
 $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_programmed_announcements&session_id='.$sessionId;
Please login to merge, or discard this patch.
main/lp/aiccItem.class.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -34,6 +34,7 @@
 block discarded – undo
34 34
      * object from database records or from the array given as second parameter
35 35
      * @param	string	Type of construction needed ('db' or 'config', default = 'config')
36 36
      * @param	mixed	Depending on the type given, DB id for the lp_item or parameters array
37
+     * @param integer $course_id
37 38
      */
38 39
     public function __construct($type = 'config', $params = array(), $course_id = null)
39 40
     {
Please login to merge, or discard this patch.
main/forum/newthread.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
         });
135 135
     });
136 136
     </script>
137
-JS;
137
+js;
138 138
 
139 139
 $form = show_add_post_form(
140 140
     $current_forum,
Please login to merge, or discard this patch.