Completed
Push — 1.11.x ( 69878b...1da93a )
by José
64:32 queued 39:16
created
main/admin/teachers_time_by_session_report.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $cidReset = true;
13 13
 
14 14
 require_once '../inc/global.inc.php';
15
-require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php';
15
+require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
16 16
 
17 17
 if (!api_is_platform_admin(true) && !api_is_teacher()) {
18 18
     api_not_allowed(true);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
     foreach ($sessionCourses as $sessionCourse) {
49 49
         $course = $sessionCourse->getCourse();
50
-        $coursesInfo[$course->getId()] =  $course->getCode();
50
+        $coursesInfo[$course->getId()] = $course->getCode();
51 51
         $criteria = Criteria::create()->where(
52 52
             Criteria::expr()->eq("status", Session::COACH)
53 53
         );
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
                 ];
71 71
             }
72 72
 
73
-            $usersInfo[$user->getId()][$course->getId() . '_number_of_students'] = null;
74
-            $usersInfo[$user->getId()][$course->getId() . '_number_of_works'] = null;
75
-            $usersInfo[$user->getId()][$course->getId() . '_last_work'] = null;
76
-            $usersInfo[$user->getId()][$course->getId() . '_time_spent_of_course'] = null;
73
+            $usersInfo[$user->getId()][$course->getId().'_number_of_students'] = null;
74
+            $usersInfo[$user->getId()][$course->getId().'_number_of_works'] = null;
75
+            $usersInfo[$user->getId()][$course->getId().'_last_work'] = null;
76
+            $usersInfo[$user->getId()][$course->getId().'_time_spent_of_course'] = null;
77 77
 
78 78
             if (!$session->hasCoachInCourseWithStatus($user, $course)) {
79 79
                 continue;
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
                 ->getRepository('ChamiloCourseBundle:CStudentPublication')
84 84
                 ->findByTeacher($user, $course, $session->getId());
85 85
 
86
-            $usersInfo[$user->getId()][$course->getId() . '_number_of_students'] = $sessionCourse->getNbrUsers();
87
-            $usersInfo[$user->getId()][$course->getId() . '_number_of_works'] = count($works);
88
-            $usersInfo[$user->getId()][$course->getId() . '_time_spent_of_course'] = api_time_to_hms(
86
+            $usersInfo[$user->getId()][$course->getId().'_number_of_students'] = $sessionCourse->getNbrUsers();
87
+            $usersInfo[$user->getId()][$course->getId().'_number_of_works'] = count($works);
88
+            $usersInfo[$user->getId()][$course->getId().'_time_spent_of_course'] = api_time_to_hms(
89 89
                 Tracking::get_time_spent_on_the_course($user->getId(), $course->getId(), $session->getId())
90 90
             );
91 91
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
             $lastFormattedDate = api_format_date($lastWork->getSentDate()->getTimestamp(), DATE_TIME_FORMAT_SHORT);
99 99
 
100
-            $usersInfo[$user->getId()][$course->getId() . '_last_work'] = api_format_date(
100
+            $usersInfo[$user->getId()][$course->getId().'_last_work'] = api_format_date(
101 101
                 $lastWork->getSentDate()->getTimestamp(),
102 102
                 DATE_TIME_FORMAT_SHORT
103 103
             );
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 }
107 107
 
108 108
 if (isset($_GET['export']) && $session && ($coursesInfo && $usersInfo)) {
109
-    $fileName = get_lang('TeacherTimeReport') . ' ' . api_get_local_time();
109
+    $fileName = get_lang('TeacherTimeReport').' '.api_get_local_time();
110 110
 
111 111
     $dataToExport = [];
112 112
     $dataToExport[] = [$toolName, $session->getName()];
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 }
168 168
 
169 169
 $this_section = SECTION_PLATFORM_ADMIN;
170
-$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH) . 'mySpace/', 'name' => get_lang('Reporting')];
170
+$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH).'mySpace/', 'name' => get_lang('Reporting')];
171 171
 $interbreadcrumb[] = [
172
-    'url' => api_get_path(WEB_CODE_PATH) . 'mySpace/session.php',
172
+    'url' => api_get_path(WEB_CODE_PATH).'mySpace/session.php',
173 173
     'name' => get_lang('FollowedSessions')
174 174
 ];
175 175
 
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
     $actions = [
180 180
         Display::url(
181 181
             Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM),
182
-            api_get_self() . '?' . http_build_query(['export' => 'csv', 'session' => $session->getId()])
182
+            api_get_self().'?'.http_build_query(['export' => 'csv', 'session' => $session->getId()])
183 183
         ),
184 184
         Display::url(
185 185
             Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM),
186
-            api_get_self() . '?' . http_build_query(['export' => 'xls', 'session' => $session->getId()])
186
+            api_get_self().'?'.http_build_query(['export' => 'xls', 'session' => $session->getId()])
187 187
         )
188 188
     ];
189 189
 }
Please login to merge, or discard this patch.
main/group/group_category.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 
8 8
 require_once '../inc/global.inc.php';
9 9
 $this_section = SECTION_COURSES;
10
-$current_course_tool  = TOOL_GROUP;
10
+$current_course_tool = TOOL_GROUP;
11 11
 
12 12
 // Notice for unauthorized people.
13 13
 api_protect_course_script(true);
14 14
 
15
-if (!api_is_allowed_to_edit(false,true) ||
15
+if (!api_is_allowed_to_edit(false, true) ||
16 16
     !(isset ($_GET['id']) ||
17 17
     isset ($_POST['id']) ||
18 18
     isset ($_GET['action']) ||
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             'groups_per_user' => 1,
60 60
             'doc_state' => GroupManager::TOOL_PRIVATE,
61 61
             'work_state' => GroupManager::TOOL_PRIVATE,
62
-            'wiki_state' => GroupManager::TOOL_PRIVATE ,
62
+            'wiki_state' => GroupManager::TOOL_PRIVATE,
63 63
             'chat_state' => GroupManager::TOOL_PRIVATE,
64 64
             'calendar_state' => GroupManager::TOOL_PRIVATE,
65 65
             'announcements_state'=> GroupManager::TOOL_PRIVATE,
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     // Groups per user
115 115
     $possible_values = array();
116
-    for ($i = 1; $i <= 10; $i ++) {
116
+    for ($i = 1; $i <= 10; $i++) {
117 117
         $possible_values[$i] = $i;
118 118
     }
119 119
     $possible_values[GroupManager::GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All');
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
     $form->addElement('html', '<div class="col-md-6">');
140 140
     // Description
141
-    $form->addElement('textarea', 'description', get_lang('Description'), array ('rows' => 6));
141
+    $form->addElement('textarea', 'description', get_lang('Description'), array('rows' => 6));
142 142
     $form->addElement('html', '</div>');
143 143
     $form->addElement('html', '</div>');
144 144
 } else {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 $form->addGroup(
159 159
     $group,
160 160
     '',
161
-    Display::return_icon('user.png', get_lang('GroupSelfRegistration')) . ' ' . get_lang('GroupSelfRegistration'),
161
+    Display::return_icon('user.png', get_lang('GroupSelfRegistration')).' '.get_lang('GroupSelfRegistration'),
162 162
     null,
163 163
     false
164 164
 );
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 $form->addGroup(
173 173
     $group,
174 174
     '',
175
-    Display::return_icon('folder.png', get_lang('GroupDocument')) . ' ' . get_lang('GroupDocument'),
175
+    Display::return_icon('folder.png', get_lang('GroupDocument')).' '.get_lang('GroupDocument'),
176 176
     null,
177 177
     false
178 178
 );
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 $form->addGroup(
187 187
     $group,
188 188
     '',
189
-    Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('GroupWork'),
189
+    Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupWork'),
190 190
     '',
191 191
     false);
192 192
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 $form->addGroup(
200 200
     $group,
201 201
     '',
202
-    Display::return_icon('agenda.png', get_lang('GroupCalendar')) . ' ' . get_lang('GroupCalendar'),
202
+    Display::return_icon('agenda.png', get_lang('GroupCalendar')).' '.get_lang('GroupCalendar'),
203 203
     null,
204 204
     false
205 205
 );
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 $form->addGroup(
217 217
     $group,
218 218
     '',
219
-    Display::return_icon('announce.png', get_lang('GroupAnnouncements')) . ' ' . get_lang('GroupAnnouncements'),
219
+    Display::return_icon('announce.png', get_lang('GroupAnnouncements')).' '.get_lang('GroupAnnouncements'),
220 220
     null,
221 221
     false
222 222
 );
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 $form->addGroup(
231 231
     $group,
232 232
     '',
233
-    Display::return_icon('forum.png', get_lang('GroupForum')) . ' ' . get_lang('GroupForum'),
233
+    Display::return_icon('forum.png', get_lang('GroupForum')).' '.get_lang('GroupForum'),
234 234
     null,
235 235
     false
236 236
 );
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 $form->addGroup(
245 245
     $group,
246 246
     '',
247
-    Display::return_icon('wiki.png', get_lang('GroupWiki')) . ' ' . get_lang('GroupWiki'),
247
+    Display::return_icon('wiki.png', get_lang('GroupWiki')).' '.get_lang('GroupWiki'),
248 248
     null,
249 249
     false
250 250
 );
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 $form->addGroup(
259 259
     $group,
260 260
     '',
261
-    Display::return_icon('chat.png', get_lang('Chat')) . ' ' . get_lang('Chat'),
261
+    Display::return_icon('chat.png', get_lang('Chat')).' '.get_lang('Chat'),
262 262
     null,
263 263
     false
264 264
 );
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 // actions bar
334 334
 echo '<div class="actions">';
335 335
 echo '<a href="group.php">'.
336
-    Display::return_icon('back.png', get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM).'</a>';
336
+    Display::return_icon('back.png', get_lang('BackToGroupList'), '', ICON_SIZE_MEDIUM).'</a>';
337 337
 echo '</div>';
338 338
 
339 339
 $defaults = $category;
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     isset ($_GET['action']) ||
19 19
     isset ($_POST['action']))
20 20
 ) {
21
-	api_not_allowed();
21
+    api_not_allowed();
22 22
 }
23 23
 
24 24
 /**
@@ -86,30 +86,30 @@  discard block
 block discarded – undo
86 86
 
87 87
 // Build the form
88 88
 if (isset($_GET['id'])) {
89
-	// Update settings of existing category
90
-	$action = 'update_settings';
89
+    // Update settings of existing category
90
+    $action = 'update_settings';
91 91
     $form = new FormValidator(
92 92
         'group_category',
93 93
         'post',
94 94
         api_get_self().'?id='.$category['id'].'&'.api_get_cidreq()
95 95
     );
96
-	$form->addElement('hidden', 'id');
96
+    $form->addElement('hidden', 'id');
97 97
 } else {
98 98
     // Checks if the field was created in the table Category. It creates it if is neccesary
99 99
     $table_category = Database :: get_course_table(TABLE_GROUP_CATEGORY);
100 100
     if (!Database::query("SELECT wiki_state FROM $table_category WHERE c_id = $course_id")) {
101 101
         Database::query("ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1' WHERE c_id = $course_id");
102 102
     }
103
-	// Create a new category
104
-	$action = 'add_category';
105
-	$form = new FormValidator('group_category');
103
+    // Create a new category
104
+    $action = 'add_category';
105
+    $form = new FormValidator('group_category');
106 106
 }
107 107
 
108 108
 // If categories allowed, show title & description field
109 109
 if (api_get_setting('allow_group_categories') == 'true') {
110 110
     $form->addElement('header', $nameTools);
111 111
     $form->addElement('html', '<div class="row"><div class="col-md-6">');
112
-	$form->addText('title', get_lang('Title'));
112
+    $form->addText('title', get_lang('Title'));
113 113
 
114 114
     // Groups per user
115 115
     $possible_values = array();
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
     $form->addElement('html', '</div>');
143 143
     $form->addElement('html', '</div>');
144 144
 } else {
145
-	$form->addElement('hidden', 'title');
146
-	$form->addElement('hidden', 'description');
145
+    $form->addElement('hidden', 'title');
146
+    $form->addElement('hidden', 'description');
147 147
 }
148 148
 
149 149
 $form->addElement('header', get_lang('DefaultSettingsForNewGroups'));
Please login to merge, or discard this patch.
main/upload/upload.document.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
  */
48 48
 //user has submitted a file
49 49
 if (isset($_FILES['user_upload'])) {
50
-	$upload_ok = process_uploaded_file($_FILES['user_upload']);
51
-	if ($upload_ok) {
52
-		//file got on the server without problems, now process it
50
+    $upload_ok = process_uploaded_file($_FILES['user_upload']);
51
+    if ($upload_ok) {
52
+        //file got on the server without problems, now process it
53 53
         $new_path = handle_uploaded_document(
54 54
             $_course,
55 55
             $_FILES['user_upload'],
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
             $_POST['unzip'],
62 62
             $_POST['if_exists']
63 63
         );
64
-    	$new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : '';
65
-    	$new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : '';
64
+        $new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : '';
65
+        $new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : '';
66 66
 
67
-    	if ($new_path && ($new_comment || $new_title))
68
-    	if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
69
-        	$table_document = Database::get_course_table(TABLE_DOCUMENT);
70
-        	$ct = '';
67
+        if ($new_path && ($new_comment || $new_title))
68
+        if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
69
+            $table_document = Database::get_course_table(TABLE_DOCUMENT);
70
+            $ct = '';
71 71
             if ($new_comment) {
72 72
                 $ct .= ", comment='$new_comment'";
73 73
             }
74 74
             if ($new_title) {
75 75
                 $ct .= ", title='$new_title'";
76 76
             }
77
-        	Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
78
-    	}
77
+            Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
78
+        }
79 79
         //check for missing images in html files
80 80
         $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
81 81
         if ($missing_files) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 //they want to create a directory
134 134
 if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
135 135
     $added_slash = $path == '/' ? '' : '/';
136
-	$dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']);
136
+    $dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']);
137 137
     $created_dir = create_unexisting_directory(
138 138
         $_course,
139 139
         api_get_user_id(),
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 }
154 154
 
155 155
 if (isset($_GET['createdir'])) {
156
-	//create the form that asks for the directory name
157
-	$new_folder_text = '<form action="'.api_get_self().'" method="POST">';
158
-	$new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>';
159
-	$new_folder_text .= get_lang('NewDir') .' ';
160
-	$new_folder_text .= '<input type="text" name="dirname"/>';
161
-	$new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>';
162
-	$new_folder_text .= '</form>';
163
-	//show the form
164
-	Display::display_normal_message($new_folder_text);
156
+    //create the form that asks for the directory name
157
+    $new_folder_text = '<form action="'.api_get_self().'" method="POST">';
158
+    $new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>';
159
+    $new_folder_text .= get_lang('NewDir') .' ';
160
+    $new_folder_text .= '<input type="text" name="dirname"/>';
161
+    $new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>';
162
+    $new_folder_text .= '</form>';
163
+    //show the form
164
+    Display::display_normal_message($new_folder_text);
165 165
 } else {	//give them a link to create a directory
166 166
 ?>
167 167
 	<p>
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 $_course = api_get_course_info();
14
-$courseDir = $_course['path'] . "/document";
14
+$courseDir = $_course['path']."/document";
15 15
 $sys_course_path = api_get_path(SYS_COURSE_PATH);
16
-$base_work_dir = $sys_course_path . $courseDir;
16
+$base_work_dir = $sys_course_path.$courseDir;
17 17
 $noPHP_SELF = true;
18 18
 $max_filled_space = DocumentManager::get_course_quota();
19 19
 
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
  */
36 36
 $nameTools = get_lang('UplUploadDocument');
37 37
 $interbreadcrumb[] = array(
38
-    "url" => api_get_path(WEB_CODE_PATH)."document/document.php?curdirpath=" . urlencode($path) . '&'.api_get_cidreq(),
38
+    "url" => api_get_path(WEB_CODE_PATH)."document/document.php?curdirpath=".urlencode($path).'&'.api_get_cidreq(),
39 39
     "name" => $langDocuments
40 40
 );
41 41
 Display::display_header($nameTools, "Doc");
42 42
 //show the title
43
-api_display_tool_title($nameTools . $add_group_to_title);
43
+api_display_tool_title($nameTools.$add_group_to_title);
44 44
 
45 45
 /**
46 46
  * Process
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             if ($new_title) {
75 75
                 $ct .= ", title='$new_title'";
76 76
             }
77
-        	Database::query("UPDATE $table_document SET" . substr($ct, 1) ." WHERE id = '$docid'");
77
+        	Database::query("UPDATE $table_document SET".substr($ct, 1)." WHERE id = '$docid'");
78 78
     	}
79 79
         //check for missing images in html files
80 80
         $missing_files = check_for_missing_files($base_work_dir.$_POST['curdirpath'].$new_path);
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
         replace_img_path_in_html_file(
125 125
             $_POST['img_file_path'],
126 126
             $paths_to_replace_in_file,
127
-            $base_work_dir . $_POST['related_file']
127
+            $base_work_dir.$_POST['related_file']
128 128
         );
129 129
         //update parent folders
130 130
         item_property_update_on_folder($_course, $_POST['curdirpath'], $_user['user_id']);
131 131
     }
132 132
 }
133 133
 //they want to create a directory
134
-if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
134
+if (isset($_POST['create_dir']) && $_POST['dirname'] != '') {
135 135
     $added_slash = $path == '/' ? '' : '/';
136 136
 	$dir_name = $path.$added_slash.api_replace_dangerous_char($_POST['dirname']);
137 137
     $created_dir = create_unexisting_directory(
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	//create the form that asks for the directory name
157 157
 	$new_folder_text = '<form action="'.api_get_self().'" method="POST">';
158 158
 	$new_folder_text .= '<input type="hidden" name="curdirpath" value="'.$path.'"/>';
159
-	$new_folder_text .= get_lang('NewDir') .' ';
159
+	$new_folder_text .= get_lang('NewDir').' ';
160 160
 	$new_folder_text .= '<input type="text" name="dirname"/>';
161 161
 	$new_folder_text .= '<input type="submit" name="create_dir" value="'.get_lang('Ok').'"/>';
162 162
 	$new_folder_text .= '</form>';
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	<p>
168 168
         <a href="<?php echo api_get_self(); ?>?path=<?php echo $path; ?>&amp;createdir=1">
169 169
             <?php echo Display::return_icon('new_folder.gif'); ?>
170
-            <?php echo(get_lang('CreateDir'));?>
170
+            <?php echo(get_lang('CreateDir')); ?>
171 171
         </a>
172 172
     </p>
173 173
 <?php
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 </td>
191 191
 </tr>
192 192
 <tr>
193
-<td><?php echo get_lang('Title');?></td>
193
+<td><?php echo get_lang('Title'); ?></td>
194 194
 <td><input type="text" size="20" name="title" style="width:300px;"></td>
195 195
 </tr>
196 196
 <tr>
197
-<td valign="top"><?php echo get_lang('Comment');?></td>
197
+<td valign="top"><?php echo get_lang('Comment'); ?></td>
198 198
 <td><textarea rows="3" cols="20" name="comment" wrap="virtual" style="width:300px;"></textarea></td>
199 199
 </tr>
200 200
 <tr>
@@ -202,21 +202,21 @@  discard block
 block discarded – undo
202 202
 <?php echo get_lang('Options'); ?>
203 203
 </td>
204 204
 <td>
205
-- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress'));?><br/>
206
-- <?php echo (get_lang('UplWhatIfFileExists'));?><br/>
207
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong'));?>" checked="checked"/>  <?php echo (get_lang('UplDoNothing'));?><br/>
208
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong'));?>"/> <?php echo (get_lang('UplOverwrite'));?><br/>
209
-&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong'));?>"/> <?php echo (get_lang('UplRename'));?>
205
+- <input type="checkbox" name="unzip" value="1" onclick="check_unzip()"/> <?php echo(get_lang('Uncompress')); ?><br/>
206
+- <?php echo (get_lang('UplWhatIfFileExists')); ?><br/>
207
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="nothing" title="<?php echo (get_lang('UplDoNothingLong')); ?>" checked="checked"/>  <?php echo (get_lang('UplDoNothing')); ?><br/>
208
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="overwrite" title="<?php echo (get_lang('UplOverwriteLong')); ?>"/> <?php echo (get_lang('UplOverwrite')); ?><br/>
209
+&nbsp;&nbsp;&nbsp;<input type="radio" name="if_exists" value="rename" title="<?php echo (get_lang('UplRenameLong')); ?>"/> <?php echo (get_lang('UplRename')); ?>
210 210
 </td>
211 211
 </tr>
212 212
 </table>
213 213
 
214
-<input type="submit" value="<?php echo(get_lang('Ok'));?>">
214
+<input type="submit" value="<?php echo(get_lang('Ok')); ?>">
215 215
 </form>
216 216
 <!-- end upload form -->
217 217
 
218 218
  <!-- so they can get back to the documents   -->
219
- <p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p>
219
+ <p><?php echo (get_lang('Back')); ?> <?php echo (get_lang('To')); ?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview')); ?></a></p>
220 220
 <?php
221 221
 
222 222
 Display::display_footer();
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,9 +64,10 @@
 block discarded – undo
64 64
     	$new_comment = isset($_POST['comment']) ? Database::escape_string(trim($_POST['comment'])) : '';
65 65
     	$new_title = isset($_POST['title']) ? Database::escape_string(trim($_POST['title'])) : '';
66 66
 
67
-    	if ($new_path && ($new_comment || $new_title))
68
-    	if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
67
+    	if ($new_path && ($new_comment || $new_title)) {
68
+    	    	if (($docid = DocumentManager::get_document_id($_course, $new_path))) {
69 69
         	$table_document = Database::get_course_table(TABLE_DOCUMENT);
70
+    	}
70 71
         	$ct = '';
71 72
             if ($new_comment) {
72 73
                 $ct .= ", comment='$new_comment'";
Please login to merge, or discard this patch.
main/exercise/adminhp.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 */
8 8
 require_once '../inc/global.inc.php';
9 9
 
10
-$this_section=SECTION_COURSES;
10
+$this_section = SECTION_COURSES;
11 11
 
12 12
 $_course = api_get_course_info();
13 13
 
14 14
 if (isset($_REQUEST["cancel"])) {
15
-    if ($_REQUEST["cancel"]==get_lang('Cancel')) {
15
+    if ($_REQUEST["cancel"] == get_lang('Cancel')) {
16 16
         header("Location: exercise.php");
17 17
         exit;
18 18
     }
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 
21 21
 $newName = !empty($_REQUEST['newName']) ? $_REQUEST['newName'] : '';
22 22
 $hotpotatoesName = !empty($_REQUEST['hotpotatoesName']) ? Security::remove_XSS($_REQUEST['hotpotatoesName']) : '';
23
-$is_allowedToEdit=api_is_allowed_to_edit(null,true);
23
+$is_allowedToEdit = api_is_allowed_to_edit(null, true);
24 24
 
25 25
 // document path
26
-$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
26
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
27 27
 
28 28
 // picture path
29
-$picturePath=$documentPath.'/images';
29
+$picturePath = $documentPath.'/images';
30 30
 
31 31
 // audio path
32
-$audioPath=$documentPath.'/audio';
32
+$audioPath = $documentPath.'/audio';
33 33
 
34 34
 // Database table definitions
35 35
 if (!$is_allowedToEdit) {
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 if (isset($_SESSION['gradebook'])) {
40
-    $gradebook=	$_SESSION['gradebook'];
40
+    $gradebook = $_SESSION['gradebook'];
41 41
 }
42 42
 
43
-if (!empty($gradebook) && $gradebook=='view') {
44
-    $interbreadcrumb[]= array (
43
+if (!empty($gradebook) && $gradebook == 'view') {
44
+    $interbreadcrumb[] = array(
45 45
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
46 46
         'name' => get_lang('ToolGradebook'),
47 47
     );
48 48
 }
49 49
 
50
-$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises'));
50
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
51 51
 
52 52
 $nameTools = get_lang('adminHP');
53 53
 
54
-Display::display_header($nameTools,"Exercise");
54
+Display::display_header($nameTools, "Exercise");
55 55
 
56 56
 /** @todo probably wrong !!!! */
57 57
 require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php';
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 
65 65
 <?php
66 66
 if (isset($newName)) {
67
-    if ($newName!="") {
67
+    if ($newName != "") {
68 68
         //alter database record for that test
69
-        SetComment($hotpotatoesName,$newName);
69
+        SetComment($hotpotatoesName, $newName);
70 70
         echo "<script language='Javascript' type='text/javascript'> window.location='exercise.php'; </script>";
71 71
     }
72 72
 }
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 $lstrComment = '';
79 79
 $lstrComment = GetComment($hotpotatoesName);
80 80
 if ($lstrComment == '') {
81
-    $lstrComment = GetQuizName($hotpotatoesName,$documentPath);
81
+    $lstrComment = GetQuizName($hotpotatoesName, $documentPath);
82 82
 }
83 83
 if ($lstrComment == '') {
84
-    $lstrComment = basename($hotpotatoesName,$documentPath);
84
+    $lstrComment = basename($hotpotatoesName, $documentPath);
85 85
 }
86 86
 
87 87
 echo $lstrComment;
Please login to merge, or discard this patch.
main/exercise/hotspot.class.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -12,31 +12,31 @@  discard block
 block discarded – undo
12 12
  **/
13 13
 class HotSpot extends Question
14 14
 {
15
-	public static $typePicture = 'hotspot.png';
16
-	public static $explanationLangVar = 'HotSpot';
15
+    public static $typePicture = 'hotspot.png';
16
+    public static $explanationLangVar = 'HotSpot';
17 17
 
18 18
     /**
19 19
      * HotSpot constructor.
20 20
      */
21
-	public function __construct()
22
-	{
23
-		parent::__construct();
24
-		$this->type = HOT_SPOT;
25
-	}
26
-
27
-	public function display()
28
-	{
29
-	}
30
-
31
-	/**
32
-	 * @param FormValidator $form
33
-	 * @param int $fck_config
34
-	 */
35
-	public function createForm (&$form, $fck_config=0)
36
-	{
37
-		parent::createForm($form, $fck_config);
38
-
39
-		if (!isset($_GET['editQuestion'])) {
21
+    public function __construct()
22
+    {
23
+        parent::__construct();
24
+        $this->type = HOT_SPOT;
25
+    }
26
+
27
+    public function display()
28
+    {
29
+    }
30
+
31
+    /**
32
+     * @param FormValidator $form
33
+     * @param int $fck_config
34
+     */
35
+    public function createForm (&$form, $fck_config=0)
36
+    {
37
+        parent::createForm($form, $fck_config);
38
+
39
+        if (!isset($_GET['editQuestion'])) {
40 40
             $form->addElement(
41 41
                 'file',
42 42
                 'imageUpload',
@@ -46,54 +46,54 @@  discard block
 block discarded – undo
46 46
                 )
47 47
             );
48 48
 
49
-			// setting the save button here and not in the question class.php
50
-			// Saving a question
51
-			$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52
-			//$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
-			$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
54
-			$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55
-		} else {
56
-			// setting the save button here and not in the question class.php
57
-			// Editing a question
58
-			$form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
59
-		}
60
-	}
61
-
62
-	/**
63
-	 * @param FormValidator $form
64
-	 * @param null $objExercise
65
-	 * @return null|false
66
-	 */
67
-	public function processCreation($form, $objExercise = null)
68
-	{
69
-		$file_info = $form->getSubmitValue('imageUpload');
70
-		$_course = api_get_course_info();
71
-		parent::processCreation($form, $objExercise);
72
-
73
-		if(!empty($file_info['tmp_name'])) {
74
-			$this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75
-			$documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76
-			$picturePath   = $documentPath.'/images';
77
-
78
-			// fixed width ang height
79
-			if (file_exists($picturePath.'/'.$this->picture)) {
80
-				$this->resizePicture('width', 800);
81
-				$this->save();
82
-			} else {
83
-				return false;
84
-			}
85
-		}
86
-	}
87
-
88
-	function createAnswersForm($form)
89
-	{
90
-		// nothing
91
-	}
92
-
93
-	function processAnswersCreation($form)
94
-	{
95
-		// nothing
96
-	}
49
+            // setting the save button here and not in the question class.php
50
+            // Saving a question
51
+            $form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52
+            //$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
+            $form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
54
+            $form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55
+        } else {
56
+            // setting the save button here and not in the question class.php
57
+            // Editing a question
58
+            $form->addButtonUpdate(get_lang('ModifyExercise'), 'submitQuestion');
59
+        }
60
+    }
61
+
62
+    /**
63
+     * @param FormValidator $form
64
+     * @param null $objExercise
65
+     * @return null|false
66
+     */
67
+    public function processCreation($form, $objExercise = null)
68
+    {
69
+        $file_info = $form->getSubmitValue('imageUpload');
70
+        $_course = api_get_course_info();
71
+        parent::processCreation($form, $objExercise);
72
+
73
+        if(!empty($file_info['tmp_name'])) {
74
+            $this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75
+            $documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76
+            $picturePath   = $documentPath.'/images';
77
+
78
+            // fixed width ang height
79
+            if (file_exists($picturePath.'/'.$this->picture)) {
80
+                $this->resizePicture('width', 800);
81
+                $this->save();
82
+            } else {
83
+                return false;
84
+            }
85
+        }
86
+    }
87
+
88
+    function createAnswersForm($form)
89
+    {
90
+        // nothing
91
+    }
92
+
93
+    function processAnswersCreation($form)
94
+    {
95
+        // nothing
96
+    }
97 97
 }
98 98
 
99 99
 /**
@@ -101,38 +101,38 @@  discard block
 block discarded – undo
101 101
  */
102 102
 class HotSpotDelineation extends HotSpot
103 103
 {
104
-	public static $typePicture = 'hotspot-delineation.png';
105
-	public static $explanationLangVar = 'HotspotDelineation';
104
+    public static $typePicture = 'hotspot-delineation.png';
105
+    public static $explanationLangVar = 'HotspotDelineation';
106 106
 
107 107
     /**
108 108
      * HotSpotDelineation constructor.
109 109
      */
110
-	public function __construct()
111
-	{
112
-		parent::__construct();
113
-		$this -> type = HOT_SPOT_DELINEATION;
114
-
115
-	}
116
-
117
-	function createForm(&$form, $fck_config=0)
118
-	{
119
-		parent::createForm ($form, $fck_config);
120
-	}
121
-
122
-	function processCreation ($form, $objExercise = null)
123
-	{
124
-		$file_info = $form -> getSubmitValue('imageUpload');
125
-		parent::processCreation ($form, $objExercise);
126
-	}
127
-
128
-	function createAnswersForm ($form)
129
-	{
130
-		parent::createAnswersForm ($form);
131
-	}
132
-
133
-	function processAnswersCreation ($form)
134
-	{
135
-		parent::processAnswersCreation ($form);
136
-	}
110
+    public function __construct()
111
+    {
112
+        parent::__construct();
113
+        $this -> type = HOT_SPOT_DELINEATION;
114
+
115
+    }
116
+
117
+    function createForm(&$form, $fck_config=0)
118
+    {
119
+        parent::createForm ($form, $fck_config);
120
+    }
121
+
122
+    function processCreation ($form, $objExercise = null)
123
+    {
124
+        $file_info = $form -> getSubmitValue('imageUpload');
125
+        parent::processCreation ($form, $objExercise);
126
+    }
127
+
128
+    function createAnswersForm ($form)
129
+    {
130
+        parent::createAnswersForm ($form);
131
+    }
132
+
133
+    function processAnswersCreation ($form)
134
+    {
135
+        parent::processAnswersCreation ($form);
136
+    }
137 137
 }
138 138
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param FormValidator $form
33 33
 	 * @param int $fck_config
34 34
 	 */
35
-	public function createForm (&$form, $fck_config=0)
35
+	public function createForm(&$form, $fck_config = 0)
36 36
 	{
37 37
 		parent::createForm($form, $fck_config);
38 38
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			// Saving a question
51 51
 			$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
52 52
 			//$form->addButtonSave(get_lang('GoToQuestion'), 'submitQuestion');
53
-			$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif'));
53
+			$form->addRule('imageUpload', get_lang('OnlyImagesAllowed'), 'filetype', array('jpg', 'jpeg', 'png', 'gif'));
54 54
 			$form->addRule('imageUpload', get_lang('NoImage'), 'uploadedfile');
55 55
 		} else {
56 56
 			// setting the save button here and not in the question class.php
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		$_course = api_get_course_info();
71 71
 		parent::processCreation($form, $objExercise);
72 72
 
73
-		if(!empty($file_info['tmp_name'])) {
73
+		if (!empty($file_info['tmp_name'])) {
74 74
 			$this->uploadPicture($file_info['tmp_name'], $file_info['name']);
75 75
 			$documentPath  = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
76 76
 			$picturePath   = $documentPath.'/images';
@@ -114,25 +114,25 @@  discard block
 block discarded – undo
114 114
 
115 115
 	}
116 116
 
117
-	function createForm(&$form, $fck_config=0)
117
+	function createForm(&$form, $fck_config = 0)
118 118
 	{
119
-		parent::createForm ($form, $fck_config);
119
+		parent::createForm($form, $fck_config);
120 120
 	}
121 121
 
122
-	function processCreation ($form, $objExercise = null)
122
+	function processCreation($form, $objExercise = null)
123 123
 	{
124 124
 		$file_info = $form -> getSubmitValue('imageUpload');
125
-		parent::processCreation ($form, $objExercise);
125
+		parent::processCreation($form, $objExercise);
126 126
 	}
127 127
 
128
-	function createAnswersForm ($form)
128
+	function createAnswersForm($form)
129 129
 	{
130
-		parent::createAnswersForm ($form);
130
+		parent::createAnswersForm($form);
131 131
 	}
132 132
 
133
-	function processAnswersCreation ($form)
133
+	function processAnswersCreation($form)
134 134
 	{
135
-		parent::processAnswersCreation ($form);
135
+		parent::processAnswersCreation($form);
136 136
 	}
137 137
 }
138 138
 
Please login to merge, or discard this patch.
main/inc/lib/blog.lib.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1103,7 +1103,7 @@
 block discarded – undo
1103 1103
      * @param String $type
1104 1104
      * @param Integer $blog_id
1105 1105
      * @param Integer $item_id
1106
-     * @return array
1106
+     * @return double
1107 1107
      */
1108 1108
     public static function display_rating($type, $blog_id, $item_id)
1109 1109
     {
Please login to merge, or discard this patch.
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1007,8 +1007,9 @@  discard block
 block discarded – undo
1007 1007
             $blog_post_actions .= '</a>';
1008 1008
         }
1009 1009
 
1010
-        if (api_is_allowed('BLOG_' . $blog_id, 'article_rate'))
1011
-            $rating_select = Blog::display_rating_form('post',$blog_id,$post_id);
1010
+        if (api_is_allowed('BLOG_' . $blog_id, 'article_rate')) {
1011
+                    $rating_select = Blog::display_rating_form('post',$blog_id,$post_id);
1012
+        }
1012 1013
 
1013 1014
         $blog_post_text=stripslashes($blog_post_text);
1014 1015
 
@@ -1652,8 +1653,9 @@  discard block
 block discarded – undo
1652 1653
 
1653 1654
                         $arrPermissions = array();
1654 1655
 
1655
-                        while ($row = Database::fetch_array($result))
1656
-                            $arrPermissions[] = $row['action'];
1656
+                        while ($row = Database::fetch_array($result)) {
1657
+                                                    $arrPermissions[] = $row['action'];
1658
+                        }
1657 1659
 
1658 1660
                             echo '<tr>';
1659 1661
                             echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ':&nbsp;&nbsp;</td>';
@@ -2329,8 +2331,9 @@  discard block
 block discarded – undo
2329 2331
         //Handle leap year
2330 2332
         $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
2331 2333
 
2332
-        if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
2333
-            $numberofdays[2] = 29;
2334
+        if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0)) {
2335
+                    $numberofdays[2] = 29;
2336
+        }
2334 2337
 
2335 2338
         //Get the first day of the month
2336 2339
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
@@ -2360,8 +2363,9 @@  discard block
 block discarded – undo
2360 2363
         if( Database::num_rows($result) > 0) {
2361 2364
             while($blog_post = Database::fetch_array($result)) {
2362 2365
                 // If the day of this post is not yet in the array, add it.
2363
-                if (!in_array($blog_post['post_day'], $posts))
2364
-                    $posts[] = $blog_post['post_day'];
2366
+                if (!in_array($blog_post['post_day'], $posts)) {
2367
+                                    $posts[] = $blog_post['post_day'];
2368
+                }
2365 2369
             }
2366 2370
         }
2367 2371
 
@@ -2400,8 +2404,9 @@  discard block
 block discarded – undo
2400 2404
 
2401 2405
         echo "<tr>";
2402 2406
 
2403
-        for($ii = 1; $ii < 8; $ii ++)
2404
-            echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
2407
+        for($ii = 1; $ii < 8; $ii ++) {
2408
+                    echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
2409
+        }
2405 2410
 
2406 2411
         echo "</tr>";
2407 2412
 
@@ -2411,8 +2416,9 @@  discard block
 block discarded – undo
2411 2416
         while ($curday <= $numberofdays[$month]) {
2412 2417
             echo "<tr>";
2413 2418
             for ($ii = 0; $ii < 7; $ii ++) {
2414
-                if (($curday == -1) && ($ii == $startdayofweek))
2415
-                    $curday = 1;
2419
+                if (($curday == -1) && ($ii == $startdayofweek)) {
2420
+                                    $curday = 1;
2421
+                }
2416 2422
 
2417 2423
                 if (($curday > 0) && ($curday <= $numberofdays[$month])) {
2418 2424
                     $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\"";
@@ -2426,10 +2432,11 @@  discard block
 block discarded – undo
2426 2432
                     echo "<td " . $class.">";
2427 2433
 
2428 2434
                     // If there are posts on this day, create a filter link.
2429
-                    if(in_array($curday, $posts))
2430
-                        echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>';
2431
-                    else
2432
-                        echo $dayheader;
2435
+                    if(in_array($curday, $posts)) {
2436
+                                            echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>';
2437
+                    } else {
2438
+                                            echo $dayheader;
2439
+                    }
2433 2440
 
2434 2441
                     if (count($tasks) > 0) {
2435 2442
                         if (isset($tasks[$curday]) && is_array($tasks[$curday])) {
@@ -2444,8 +2451,9 @@  discard block
 block discarded – undo
2444 2451
 
2445 2452
                     echo "</td>";
2446 2453
                     $curday ++;
2447
-                } else
2448
-                    echo "<td>&nbsp;</td>";
2454
+                } else {
2455
+                                    echo "<td>&nbsp;</td>";
2456
+                }
2449 2457
             }
2450 2458
             echo "</tr>";
2451 2459
         }
Please login to merge, or discard this patch.
Indentation   +92 added lines, -93 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@  discard block
 block discarded – undo
6 6
  *
7 7
  * Contains several functions dealing with displaying,
8 8
  * editing,... of a blog
9
-
10 9
  * @package chamilo.blogs
11 10
  * @author Toon Keppens <[email protected]>
12 11
  * @author Julio Montoya - Cleaning code
@@ -335,7 +334,7 @@  discard block
 block discarded – undo
335 334
                     // Storing the attachments if any
336 335
                     if ($result) {
337 336
                         $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size, blog_id,comment_id) '.
338
-                               "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."',  '".$blog_id."', '0' )";
337
+                                "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."',  '".$blog_id."', '0' )";
339 338
                         Database::query($sql);
340 339
                         $id = Database::insert_id();
341 340
                         if ($id) {
@@ -479,7 +478,7 @@  discard block
 block discarded – undo
479 478
                     // Storing the attachments if any
480 479
                     if ($result) {
481 480
                         $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '.
482
-                             "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."',  '".$blog_id."', '".$last_id."'  )";
481
+                                "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."',  '".$blog_id."', '".$last_id."'  )";
483 482
                         Database::query($sql);
484 483
 
485 484
                         $id = Database::insert_id();
@@ -1398,10 +1397,10 @@  discard block
 block discarded – undo
1398 1397
             echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />';
1399 1398
             echo "<table class=\"data_table\">";
1400 1399
             echo	"<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
1401
-                     "<th width='240'><b>",get_lang('Title'),"</b></th>",
1402
-                     "<th><b>",get_lang('Description'),"</b></th>",
1403
-                     "<th><b>",get_lang('Color'),"</b></th>",
1404
-                     "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1400
+                        "<th width='240'><b>",get_lang('Title'),"</b></th>",
1401
+                        "<th><b>",get_lang('Description'),"</b></th>",
1402
+                        "<th><b>",get_lang('Color'),"</b></th>",
1403
+                        "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1405 1404
                 "</tr>";
1406 1405
 
1407 1406
 
@@ -1433,14 +1432,14 @@  discard block
 block discarded – undo
1433 1432
                 echo '<td width="50">';
1434 1433
                 echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=edit&task_id='.$task['task_id'].'">';
1435 1434
                 echo Display::return_icon('edit.png', get_lang('EditTask'));
1436
-                      echo "</a>";
1437
-                      echo '<a href="'.$delete_link.'"';
1438
-                      echo $delete_confirm;
1439
-                       echo '>';
1435
+                        echo "</a>";
1436
+                        echo '<a href="'.$delete_link.'"';
1437
+                        echo $delete_confirm;
1438
+                        echo '>';
1440 1439
                         echo Display::return_icon($delete_icon, $delete_title);
1441
-                       echo "</a>";
1442
-                     echo '</td>';
1443
-                   echo '</tr>';
1440
+                        echo "</a>";
1441
+                        echo '</td>';
1442
+                    echo '</tr>';
1444 1443
             }
1445 1444
             echo "</table>";
1446 1445
         }
@@ -1464,11 +1463,11 @@  discard block
 block discarded – undo
1464 1463
         echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />';
1465 1464
         echo "<table class=\"data_table\">";
1466 1465
         echo	"<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
1467
-                 "<th width='240'><b>",get_lang('Member'),"</b></th>",
1468
-                 "<th><b>",get_lang('Task'),"</b></th>",
1469
-                 "<th><b>",get_lang('Description'),"</b></th>",
1470
-                 "<th><b>",get_lang('TargetDate'),"</b></th>",
1471
-                 "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1466
+                    "<th width='240'><b>",get_lang('Member'),"</b></th>",
1467
+                    "<th><b>",get_lang('Task'),"</b></th>",
1468
+                    "<th><b>",get_lang('Description'),"</b></th>",
1469
+                    "<th><b>",get_lang('TargetDate'),"</b></th>",
1470
+                    "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1472 1471
             "</tr>";
1473 1472
 
1474 1473
         $course_id = api_get_course_int_id();
@@ -2316,7 +2315,7 @@  discard block
 block discarded – undo
2316 2315
      * @param Integer $year: the 4-digit year indication e.g. 2005
2317 2316
      *
2318 2317
      * @return html code
2319
-    */
2318
+     */
2320 2319
     public static function display_minimonthcalendar($month, $year, $blog_id)
2321 2320
     {
2322 2321
         // Init
@@ -2609,34 +2608,34 @@  discard block
 block discarded – undo
2609 2608
  */
2610 2609
 function get_blog_attachment($blog_id, $post_id=null,$comment_id=null)
2611 2610
 {
2612
-	$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2613
-
2614
-	$blog_id = intval($blog_id);
2615
-	$comment_id = intval($comment_id);
2616
-	$post_id = intval($post_id);
2617
-	$row=array();
2618
-	$where='';
2619
-	if (!empty ($post_id) && is_numeric($post_id)) {
2620
-		$where.=' AND post_id ="'.$post_id.'" ';
2621
-	}
2622
-
2623
-	if (!empty ($comment_id) && is_numeric($comment_id)) {
2624
-		if (!empty ($post_id)) {
2625
-			$where.= ' AND ';
2626
-		}
2627
-		$where.=' comment_id ="'.$comment_id.'" ';
2628
-	}
2611
+    $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2612
+
2613
+    $blog_id = intval($blog_id);
2614
+    $comment_id = intval($comment_id);
2615
+    $post_id = intval($post_id);
2616
+    $row=array();
2617
+    $where='';
2618
+    if (!empty ($post_id) && is_numeric($post_id)) {
2619
+        $where.=' AND post_id ="'.$post_id.'" ';
2620
+    }
2621
+
2622
+    if (!empty ($comment_id) && is_numeric($comment_id)) {
2623
+        if (!empty ($post_id)) {
2624
+            $where.= ' AND ';
2625
+        }
2626
+        $where.=' comment_id ="'.$comment_id.'" ';
2627
+    }
2629 2628
 
2630 2629
     $course_id = api_get_course_int_id();
2631 2630
 
2632
-	$sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.'
2631
+    $sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.'
2633 2632
 	        WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'"  '.$where;
2634 2633
 
2635
-	$result=Database::query($sql);
2636
-	if (Database::num_rows($result)!=0) {
2637
-		$row=Database::fetch_array($result);
2638
-	}
2639
-	return $row;
2634
+    $result=Database::query($sql);
2635
+    if (Database::num_rows($result)!=0) {
2636
+        $row=Database::fetch_array($result);
2637
+    }
2638
+    return $row;
2640 2639
 }
2641 2640
 
2642 2641
 /**
@@ -2652,16 +2651,16 @@  discard block
 block discarded – undo
2652 2651
     $post_id = null,
2653 2652
     $comment_id = null
2654 2653
 ) {
2655
-	$_course = api_get_course_info();
2656
-	$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2657
-	$blog_id = intval($blog_id);
2658
-	$comment_id = intval($comment_id);
2659
-	$post_id = intval($post_id);
2654
+    $_course = api_get_course_info();
2655
+    $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2656
+    $blog_id = intval($blog_id);
2657
+    $comment_id = intval($comment_id);
2658
+    $post_id = intval($post_id);
2660 2659
 
2661 2660
     $course_id = api_get_course_int_id();
2662
-	$where = null;
2661
+    $where = null;
2663 2662
 
2664
-	// delete files in DB
2663
+    // delete files in DB
2665 2664
     if (!empty ($post_id) && is_numeric($post_id)) {
2666 2665
         $where .= ' AND post_id ="'.$post_id.'" ';
2667 2666
     }
@@ -2673,25 +2672,25 @@  discard block
 block discarded – undo
2673 2672
         $where .= ' comment_id ="'.$comment_id.'" ';
2674 2673
     }
2675 2674
 
2676
-	// delete all files in directory
2677
-	$courseDir   = $_course['path'].'/upload/blog';
2678
-	$sys_course_path = api_get_path(SYS_COURSE_PATH);
2679
-	$updir = $sys_course_path.$courseDir;
2675
+    // delete all files in directory
2676
+    $courseDir   = $_course['path'].'/upload/blog';
2677
+    $sys_course_path = api_get_path(SYS_COURSE_PATH);
2678
+    $updir = $sys_course_path.$courseDir;
2680 2679
 
2681
-	$sql = 'SELECT path FROM '.$blog_table_attachment.'
2680
+    $sql = 'SELECT path FROM '.$blog_table_attachment.'
2682 2681
 	        WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'"  '.$where;
2683
-	$result=Database::query($sql);
2684
-
2685
-	while ($row=Database::fetch_row($result)) {
2686
-		$file=$updir.'/'.$row[0];
2687
-		if (Security::check_abs_path($file,$updir) )
2688
-		{
2689
-			@ unlink($file);
2690
-		}
2691
-	}
2692
-	$sql = 'DELETE FROM '. $blog_table_attachment.'
2682
+    $result=Database::query($sql);
2683
+
2684
+    while ($row=Database::fetch_row($result)) {
2685
+        $file=$updir.'/'.$row[0];
2686
+        if (Security::check_abs_path($file,$updir) )
2687
+        {
2688
+            @ unlink($file);
2689
+        }
2690
+    }
2691
+    $sql = 'DELETE FROM '. $blog_table_attachment.'
2693 2692
 	        WHERE c_id = '.$course_id.' AND  blog_id ="'.intval($blog_id).'"  '.$where;
2694
-	Database::query($sql);
2693
+    Database::query($sql);
2695 2694
 }
2696 2695
 
2697 2696
 /**
@@ -2707,7 +2706,7 @@  discard block
 block discarded – undo
2707 2706
     $course_id = $course_info['real_id'];
2708 2707
     $user_id = intval($user_id);
2709 2708
 
2710
-	$sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation
2709
+    $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation
2711 2710
 			FROM $tbl_blogs blog
2712 2711
 			INNER JOIN  $tbl_blog_post post
2713 2712
 			ON (blog.blog_id = post.blog_id)
@@ -2716,19 +2715,19 @@  discard block
 block discarded – undo
2716 2715
 				post.c_id = $course_id AND
2717 2716
 				author_id =  $user_id AND visibility = 1
2718 2717
 			ORDER BY post.date_creation DESC ";
2719
-	$result = Database::query($sql);
2720
-	$return_data = '';
2721
-
2722
-	if (Database::num_rows($result)!=0) {
2723
-		while ($row=Database::fetch_array($result)) {
2724
-			$return_data.=  '<div class="clear"></div><br />';
2725
-			$return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>';
2726
-			$return_data.=  '<br / >';
2727
-			$return_data.= $row['full_text'];
2728
-			$return_data.= '<br /><br />';
2729
-		}
2730
-	}
2731
-	return $return_data;
2718
+    $result = Database::query($sql);
2719
+    $return_data = '';
2720
+
2721
+    if (Database::num_rows($result)!=0) {
2722
+        while ($row=Database::fetch_array($result)) {
2723
+            $return_data.=  '<div class="clear"></div><br />';
2724
+            $return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>';
2725
+            $return_data.=  '<br / >';
2726
+            $return_data.= $row['full_text'];
2727
+            $return_data.= '<br /><br />';
2728
+        }
2729
+    }
2730
+    return $return_data;
2732 2731
 }
2733 2732
 
2734 2733
 /**
@@ -2745,7 +2744,7 @@  discard block
 block discarded – undo
2745 2744
     $course_info = api_get_course_info($course_code);
2746 2745
     $course_id = $course_info['real_id'];
2747 2746
 
2748
-	$sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation
2747
+    $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation
2749 2748
 			FROM $tbl_blogs blog INNER JOIN  $tbl_blog_comment comment
2750 2749
 			ON (blog.blog_id = comment.blog_id)
2751 2750
 			WHERE 	blog.c_id = $course_id AND
@@ -2753,17 +2752,17 @@  discard block
 block discarded – undo
2753 2752
 					author_id =  $user_id AND
2754 2753
 					visibility = 1
2755 2754
 			ORDER BY blog_name";
2756
-	$result = Database::query($sql);
2757
-	$return_data = '';
2758
-	if (Database::num_rows($result)!=0) {
2759
-		while ($row=Database::fetch_array($result)) {
2760
-			$return_data.=  '<div class="clear"></div><br />';
2761
-			$return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>';
2762
-			$return_data.=  '<br / >';
2763
-			$return_data.=  $row['comment'];
2764
-			$return_data.=  '<br />';
2765
-		}
2766
-	}
2767
-	return $return_data;
2755
+    $result = Database::query($sql);
2756
+    $return_data = '';
2757
+    if (Database::num_rows($result)!=0) {
2758
+        while ($row=Database::fetch_array($result)) {
2759
+            $return_data.=  '<div class="clear"></div><br />';
2760
+            $return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>';
2761
+            $return_data.=  '<br / >';
2762
+            $return_data.=  $row['comment'];
2763
+            $return_data.=  '<br />';
2764
+        }
2765
+    }
2766
+    return $return_data;
2768 2767
 }
2769 2768
 
Please login to merge, or discard this patch.
Spacing   +370 added lines, -370 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
             $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
30 30
 
31 31
             $sql = "SELECT blog_name
32
-                    FROM " . $tbl_blogs . "
33
-                    WHERE c_id = $course_id AND blog_id = " . intval($blog_id);
32
+                    FROM " . $tbl_blogs."
33
+                    WHERE c_id = $course_id AND blog_id = ".intval($blog_id);
34 34
 
35 35
             $result = Database::query($sql);
36 36
             $blog = Database::fetch_array($result);
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
                 ON (blogs_rel_user.user_id = user.user_id)
83 83
                 WHERE
84 84
                     blogs_rel_user.c_id = $course_id AND
85
-                    blogs_rel_user.blog_id = '" . (int)$blog_id."'";
85
+                    blogs_rel_user.blog_id = '".(int) $blog_id."'";
86 86
         $result = Database::query($sql);
87
-        $blog_members = array ();
87
+        $blog_members = array();
88 88
         while ($user = Database::fetch_array($result)) {
89 89
             $blog_members[$user['user_id']] = api_get_person_name(
90 90
                 $user['firstname'],
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 'blog_name' => $title,
129 129
                 'blog_subtitle' =>  $subtitle,
130 130
                 'date_creation' => $current_date,
131
-                'visibility' => 1 ,
131
+                'visibility' => 1,
132 132
                 'session_id' => $session_id,
133 133
             ];
134 134
             $this_blog_id = Database::insert($tbl_blogs, $params);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
             // Put it on course homepage
167 167
             $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, session_id, target)
168
-                    VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int)$this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id', '')";
168
+                    VALUES ($course_id, '".Database::escape_string($title)."','blog/blog.php?blog_id=".(int) $this_blog_id."','blog.gif','1','0','pastillegris.gif',0,'$session_id', '')";
169 169
             Database::query($sql);
170 170
 
171 171
             $toolId = Database::insert_id();
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                 blog_subtitle = '".Database::escape_string($subtitle)."'
199 199
                 WHERE
200 200
                     c_id = $course_id AND
201
-                    blog_id ='".Database::escape_string((int)$blog_id)."'
201
+                    blog_id ='".Database::escape_string((int) $blog_id)."'
202 202
                 LIMIT 1";
203 203
         Database::query($sql);
204 204
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         // Update course homepage link
215 215
         $sql = "UPDATE $tbl_tool SET
216 216
                 name = '".Database::escape_string($title)."'
217
-                WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int)$blog_id."' 
217
+                WHERE c_id = $course_id AND link = 'blog/blog.php?blog_id=".(int) $blog_id."' 
218 218
                 LIMIT 1";
219 219
         Database::query($sql);
220 220
     }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         Database::query($sql);
258 258
 
259 259
         // Delete blog
260
-        $sql ="DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'";
260
+        $sql = "DELETE FROM $tbl_blogs WHERE c_id = $course_id AND blog_id ='".$blog_id."'";
261 261
         Database::query($sql);
262 262
 
263 263
         // Delete from course homepage
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
         $course_id = $_course['real_id'];
289 289
 
290 290
         $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
291
-        $upload_ok=true;
292
-        $has_attachment=false;
291
+        $upload_ok = true;
292
+        $has_attachment = false;
293 293
         $current_date = api_get_utc_datetime();
294 294
 
295 295
         if (!empty($_FILES['user_upload']['name'])) {
296 296
             $upload_ok = process_uploaded_file($_FILES['user_upload']);
297
-            $has_attachment=true;
297
+            $has_attachment = true;
298 298
         }
299 299
 
300 300
         if ($upload_ok) {
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
             // Create the post
305 305
             $sql = "INSERT INTO $tbl_blogs_posts (c_id, title, full_text, date_creation, blog_id, author_id )
306
-                    VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int)$blog_id."', '".(int)$_user['user_id']."');";
306
+                    VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."','".$current_date."', '".(int) $blog_id."', '".(int) $_user['user_id']."');";
307 307
 
308 308
             Database::query($sql);
309 309
             $last_post_id = Database::insert_id();
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
             }
315 315
 
316 316
             if ($has_attachment) {
317
-                $courseDir   = $_course['path'].'/upload/blog';
317
+                $courseDir = $_course['path'].'/upload/blog';
318 318
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
319 319
                 $updir = $sys_course_path.$courseDir;
320 320
 
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
 
366 366
         // Create the post
367 367
         $sql = "UPDATE $tbl_blogs_posts SET
368
-                title = '" . Database::escape_string($title)."',
368
+                title = '".Database::escape_string($title)."',
369 369
                 full_text = '" . Database::escape_string($full_text)."'
370
-                WHERE c_id = $course_id AND post_id ='".(int)$post_id."' AND blog_id ='".(int)$blog_id."'
370
+                WHERE c_id = $course_id AND post_id ='".(int) $post_id."' AND blog_id ='".(int) $blog_id."'
371 371
                 LIMIT 1 ";
372 372
         Database::query($sql);
373 373
     }
@@ -388,17 +388,17 @@  discard block
 block discarded – undo
388 388
 
389 389
         // Delete ratings on this comment
390 390
         $sql = "DELETE FROM $tbl_blogs_rating
391
-                WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND item_id = '".(int)$post_id."' AND rating_type = 'post'";
391
+                WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND item_id = '".(int) $post_id."' AND rating_type = 'post'";
392 392
         Database::query($sql);
393 393
 
394 394
         // Delete the post
395 395
         $sql = "DELETE FROM $tbl_blogs_posts
396
-                WHERE c_id = $course_id AND post_id = '".(int)$post_id."'";
396
+                WHERE c_id = $course_id AND post_id = '".(int) $post_id."'";
397 397
         Database::query($sql);
398 398
 
399 399
         // Delete the comments
400 400
         $sql = "DELETE FROM $tbl_blogs_comments
401
-                WHERE c_id = $course_id AND post_id = '".(int)$post_id."' AND blog_id = '".(int)$blog_id."'";
401
+                WHERE c_id = $course_id AND post_id = '".(int) $post_id."' AND blog_id = '".(int) $blog_id."'";
402 402
         Database::query($sql);
403 403
 
404 404
         // Delete posts and attachments
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
     ) {
426 426
         $_user = api_get_user_info();
427 427
         $_course = api_get_course_info();
428
-        $blog_table_attachment 	= Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
428
+        $blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
429 429
 
430 430
         $upload_ok = true;
431 431
         $has_attachment = false;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 
435 435
         if (!empty($_FILES['user_upload']['name'])) {
436 436
             $upload_ok = process_uploaded_file($_FILES['user_upload']);
437
-            $has_attachment=true;
437
+            $has_attachment = true;
438 438
         }
439 439
 
440 440
         if ($upload_ok) {
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
             // Create the comment
445 445
             $sql = "INSERT INTO $tbl_blogs_comments (c_id, title, comment, author_id, date_creation, blog_id, post_id, parent_comment_id, task_id )
446
-                    VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int)$_user['user_id']."','".$current_date."', '".(int)$blog_id."', '".(int)$post_id."', '".(int)$parent_id."', '".(int)$task_id."')";
446
+                    VALUES ($course_id, '".Database::escape_string($title)."', '".Database::escape_string($full_text)."', '".(int) $_user['user_id']."','".$current_date."', '".(int) $blog_id."', '".(int) $post_id."', '".(int) $parent_id."', '".(int) $task_id."')";
447 447
             Database::query($sql);
448 448
 
449 449
             // Empty post values, or they are shown on the page again
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             }
456 456
 
457 457
             if ($has_attachment) {
458
-                $courseDir   = $_course['path'].'/upload/blog';
458
+                $courseDir = $_course['path'].'/upload/blog';
459 459
                 $sys_course_path = api_get_path(SYS_COURSE_PATH);
460 460
                 $updir = $sys_course_path.$courseDir;
461 461
 
@@ -466,19 +466,19 @@  discard block
 block discarded – undo
466 466
                 );
467 467
 
468 468
                 // user's file name
469
-                $file_name =$_FILES['user_upload']['name'];
469
+                $file_name = $_FILES['user_upload']['name'];
470 470
 
471 471
                 if (!filter_extension($new_file_name)) {
472 472
                     Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
473 473
                 } else {
474 474
                     $new_file_name = uniqid('');
475
-                    $new_path=$updir.'/'.$new_file_name;
476
-                    $result= @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path);
475
+                    $new_path = $updir.'/'.$new_file_name;
476
+                    $result = @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path);
477 477
                     $comment = Database::escape_string($file_comment);
478 478
 
479 479
                     // Storing the attachments if any
480 480
                     if ($result) {
481
-                        $sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '.
481
+                        $sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '.
482 482
                              "VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."',  '".$blog_id."', '".$last_id."'  )";
483 483
                         Database::query($sql);
484 484
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
         // Create the task
555 555
         $sql = "INSERT INTO $tbl_blogs_tasks (c_id, blog_id, title, description, color, system_task)
556
-                VALUES ($course_id , '".(int)$blog_id."', '" . Database::escape_string($title)."', '" . Database::escape_string($description)."', '" . Database::escape_string($color)."', '0');";
556
+                VALUES ($course_id , '".(int) $blog_id."', '".Database::escape_string($title)."', '".Database::escape_string($description)."', '".Database::escape_string($color)."', '0');";
557 557
         Database::query($sql);
558 558
 
559 559
         $task_id = Database::insert_id();
@@ -563,13 +563,13 @@  discard block
 block discarded – undo
563 563
             Database::query($sql);
564 564
         }
565 565
 
566
-        $tool = 'BLOG_' . $blog_id;
566
+        $tool = 'BLOG_'.$blog_id;
567 567
 
568 568
         if ($articleDelete == 'on') {
569
-            $sql = " INSERT INTO " . $tbl_tasks_permissions . " ( c_id,  task_id, tool, action) VALUES (
570
-                    '" . (int)$course_id . "',
571
-                    '" . (int)$task_id . "',
572
-                    '" . Database::escape_string($tool) . "',
569
+            $sql = " INSERT INTO ".$tbl_tasks_permissions." ( c_id,  task_id, tool, action) VALUES (
570
+                    '" . (int) $course_id."',
571
+                    '" . (int) $task_id."',
572
+                    '" . Database::escape_string($tool)."',
573 573
                     'article_delete'
574 574
                 )";
575 575
             Database::query($sql);
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
 
585 585
         if ($articleEdit == 'on') {
586 586
             $sql = "
587
-                INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES (
588
-                    '" . (int)$course_id . "',
589
-                    '" . (int)$task_id . "',
590
-                    '" . Database::escape_string($tool) . "',
587
+                INSERT INTO " . $tbl_tasks_permissions." (c_id, task_id, tool, action ) VALUES (
588
+                    '" . (int) $course_id."',
589
+                    '" . (int) $task_id."',
590
+                    '" . Database::escape_string($tool)."',
591 591
                     'article_edit'
592 592
                 )";
593 593
             Database::query($sql);
@@ -601,10 +601,10 @@  discard block
 block discarded – undo
601 601
 
602 602
         if ($commentsDelete == 'on') {
603 603
             $sql = "
604
-                INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES (
605
-                    '" . (int)$course_id . "',
606
-                    '" . (int)$task_id . "',
607
-                    '" . Database::escape_string($tool) . "',
604
+                INSERT INTO " . $tbl_tasks_permissions." (c_id, task_id, tool, action ) VALUES (
605
+                    '" . (int) $course_id."',
606
+                    '" . (int) $task_id."',
607
+                    '" . Database::escape_string($tool)."',
608 608
                     'article_comments_delete'
609 609
                 )";
610 610
             Database::query($sql);
@@ -645,20 +645,20 @@  discard block
 block discarded – undo
645 645
                     title = '".Database::escape_string($title)."',
646 646
                     description = '".Database::escape_string($description)."',
647 647
                     color = '".Database::escape_string($color)."'
648
-                WHERE c_id = $course_id AND task_id ='".(int)$task_id."' LIMIT 1";
648
+                WHERE c_id = $course_id AND task_id ='".(int) $task_id."' LIMIT 1";
649 649
         Database::query($sql);
650 650
 
651
-        $tool = 'BLOG_' . $blog_id;
651
+        $tool = 'BLOG_'.$blog_id;
652 652
 
653
-        $sql = "DELETE FROM " . $tbl_tasks_permissions . "
654
-                WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'";
653
+        $sql = "DELETE FROM ".$tbl_tasks_permissions."
654
+                WHERE c_id = $course_id AND task_id = '".(int) $task_id."'";
655 655
         Database::query($sql);
656 656
 
657 657
         if ($articleDelete == 'on') {
658
-            $sql = "INSERT INTO " . $tbl_tasks_permissions . " ( c_id, task_id, tool, action) VALUES (
659
-                    '" . (int)$course_id . "',
660
-                    '" . (int)$task_id . "',
661
-                    '" . Database::escape_string($tool) . "',
658
+            $sql = "INSERT INTO ".$tbl_tasks_permissions." ( c_id, task_id, tool, action) VALUES (
659
+                    '" . (int) $course_id."',
660
+                    '" . (int) $task_id."',
661
+                    '" . Database::escape_string($tool)."',
662 662
                     'article_delete'
663 663
                 )";
664 664
             Database::query($sql);
@@ -671,10 +671,10 @@  discard block
 block discarded – undo
671 671
         }
672 672
 
673 673
         if ($articleEdit == 'on') {
674
-            $sql = "INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES (
675
-                    '" . (int)$course_id . "',
676
-                    '" . (int)$task_id . "',
677
-                    '" . Database::escape_string($tool) . "',
674
+            $sql = "INSERT INTO ".$tbl_tasks_permissions." (c_id, task_id, tool, action) VALUES (
675
+                    '" . (int) $course_id."',
676
+                    '" . (int) $task_id."',
677
+                    '" . Database::escape_string($tool)."',
678 678
                     'article_edit'
679 679
                 )";
680 680
             Database::query($sql);
@@ -687,10 +687,10 @@  discard block
 block discarded – undo
687 687
         }
688 688
 
689 689
         if ($commentsDelete == 'on') {
690
-            $sql = " INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action) VALUES (
691
-                    '" . (int)$course_id . "',
692
-                    '" . (int)$task_id . "',
693
-                    '" . Database::escape_string($tool) . "',
690
+            $sql = " INSERT INTO ".$tbl_tasks_permissions." (c_id, task_id, tool, action) VALUES (
691
+                    '" . (int) $course_id."',
692
+                    '" . (int) $task_id."',
693
+                    '" . Database::escape_string($tool)."',
694 694
                     'article_comments_delete'
695 695
                 )";
696 696
             Database::query($sql);
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 
716 716
         // Delete posts
717 717
         $sql = "DELETE FROM $tbl_blogs_tasks
718
-                WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."'";
718
+                WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND task_id = '".(int) $task_id."'";
719 719
         Database::query($sql);
720 720
     }
721 721
 
@@ -732,9 +732,9 @@  discard block
 block discarded – undo
732 732
         $sql = "DELETE FROM $tbl_blogs_tasks_rel_user
733 733
                 WHERE
734 734
                     c_id = $course_id AND
735
-                    blog_id = '".(int)$blog_id."' AND
736
-                    task_id = '".(int)$task_id."' AND
737
-                    user_id = '".(int)$user_id."'";
735
+                    blog_id = '".(int) $blog_id."' AND
736
+                    task_id = '".(int) $task_id."' AND
737
+                    user_id = '".(int) $user_id."'";
738 738
         Database::query($sql);
739 739
     }
740 740
 
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
         $_user = api_get_user_info();
749 749
 
750 750
         $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
751
-        $tbl_blogs_tasks_rel_user 	= Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
751
+        $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
752 752
         $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
753 753
 
754 754
         $course_id = api_get_course_int_id();
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
                         task.c_id = $course_id AND
766 766
                         blog.c_id = $course_id AND
767 767
                         task_rel_user.c_id = $course_id AND
768
-                        task_rel_user.user_id = ".(int)$_user['user_id']."
768
+                        task_rel_user.user_id = ".(int) $_user['user_id']."
769 769
                     ORDER BY target_date ASC";
770 770
 
771 771
             $result = Database::query($sql);
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
             if (Database::num_rows($result) > 0) {
774 774
                 echo '<ul>';
775 775
                 while ($mytask = Database::fetch_array($result)) {
776
-                    echo '<li><a href="blog.php?action=execute_task&blog_id=' . $mytask['blog_id'] . '&task_id='.stripslashes($mytask['task_id']) . '" title="[Blog: '.stripslashes($mytask['blog_name']) . '] ' . get_lang('ExecuteThisTask') . '">'.stripslashes($mytask['title']) . '</a></li>';
776
+                    echo '<li><a href="blog.php?action=execute_task&blog_id='.$mytask['blog_id'].'&task_id='.stripslashes($mytask['task_id']).'" title="[Blog: '.stripslashes($mytask['blog_name']).'] '.get_lang('ExecuteThisTask').'">'.stripslashes($mytask['title']).'</a></li>';
777 777
                 }
778 778
                 echo '<ul>';
779 779
             } else {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 
798 798
         // Get blog properties
799 799
         $sql = "SELECT blog_name, visibility FROM $tbl_blogs
800
-                WHERE c_id = $course_id AND blog_id='".(int)$blog_id."'";
800
+                WHERE c_id = $course_id AND blog_id='".(int) $blog_id."'";
801 801
         $result = Database::query($sql);
802 802
         $blog = Database::fetch_array($result);
803 803
         $visibility = $blog['visibility'];
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
         if ($visibility == 1) {
807 807
             // Change visibility state, remove from course home.
808 808
             $sql = "UPDATE $tbl_blogs SET visibility = '0'
809
-                    WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1";
809
+                    WHERE c_id = $course_id AND blog_id ='".(int) $blog_id."' LIMIT 1";
810 810
             Database::query($sql);
811 811
 
812 812
             $sql = "DELETE FROM $tbl_tool
@@ -815,11 +815,11 @@  discard block
 block discarded – undo
815 815
         } else {
816 816
             // Change visibility state, add to course home.
817 817
             $sql = "UPDATE $tbl_blogs SET visibility = '1'
818
-                    WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1";
818
+                    WHERE c_id = $course_id AND blog_id ='".(int) $blog_id."' LIMIT 1";
819 819
             Database::query($sql);
820 820
 
821 821
             $sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, target )
822
-                    VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int)$blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')";
822
+                    VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int) $blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')";
823 823
             Database::query($sql);
824 824
             $id = Database::insert_id();
825 825
 
@@ -850,14 +850,14 @@  discard block
 block discarded – undo
850 850
                 FROM $tbl_blogs_posts post
851 851
                 INNER JOIN $tbl_users user
852 852
                 ON post.author_id = user.user_id
853
-                WHERE 	post.blog_id = '".(int)$blog_id."' AND
853
+                WHERE 	post.blog_id = '".(int) $blog_id."' AND
854 854
                         post.c_id = $course_id AND
855 855
                         $filter
856
-                ORDER BY post_id DESC LIMIT 0,".(int)$max_number_of_posts;
856
+                ORDER BY post_id DESC LIMIT 0,".(int) $max_number_of_posts;
857 857
         $result = Database::query($sql);
858 858
 
859 859
         // Display
860
-        if(Database::num_rows($result) > 0) {
860
+        if (Database::num_rows($result) > 0) {
861 861
             $limit = 200;
862 862
             while ($blog_post = Database::fetch_array($result)) {
863 863
                 // Get number of comments
@@ -865,8 +865,8 @@  discard block
 block discarded – undo
865 865
                         FROM $tbl_blogs_comments
866 866
                         WHERE
867 867
                             c_id = $course_id AND
868
-                            blog_id = '".(int)$blog_id."' AND
869
-                            post_id = '" . (int)$blog_post['post_id']."'";
868
+                            blog_id = '".(int) $blog_id."' AND
869
+                            post_id = '" . (int) $blog_post['post_id']."'";
870 870
                 $tmp = Database::query($sql);
871 871
                 $blog_post_comments = Database::fetch_array($tmp);
872 872
 
@@ -877,11 +877,11 @@  discard block
 block discarded – undo
877 877
 
878 878
                 // Create an introduction text (but keep FULL sentences)
879 879
                 $words = 0;
880
-                $blog_post_text_cut = cut($blog_post_text, $limit) ;
880
+                $blog_post_text_cut = cut($blog_post_text, $limit);
881 881
                 $words = strlen($blog_post_text);
882 882
 
883 883
                 if ($words >= $limit) {
884
-                    $readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_' . $blog_post_id . '\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_' . $blog_post_id . '\').style.display=\'none\'">' . get_lang('ReadMore') . '</div>';
884
+                    $readMoreLink = ' <div class="link" onclick="document.getElementById(\'blogpost_text_'.$blog_post_id.'\').style.display=\'block\'; document.getElementById(\'blogpost_introduction_'.$blog_post_id.'\').style.display=\'none\'">'.get_lang('ReadMore').'</div>';
885 885
                     $introduction_text = $blog_post_text_cut;
886 886
                 } else {
887 887
                     $introduction_text = $blog_post_text;
@@ -891,27 +891,27 @@  discard block
 block discarded – undo
891 891
                 $introduction_text = stripslashes($introduction_text);
892 892
 
893 893
                 echo '<div class="blogpost">';
894
-                echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>';
895
-                echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . $blog_post_date . '</a></span>';
896
-                echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">' . $introduction_text.$readMoreLink.'</div>';
897
-                echo '<div class="blogpost_text" id="blogpost_text_' . $blog_post_id . '" style="display: none">' . $blog_post_text . '</div>';
894
+                echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.stripslashes($blog_post['title']).'</a></span>';
895
+                echo '<span class="blogpost_date"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.$blog_post_date.'</a></span>';
896
+                echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">'.$introduction_text.$readMoreLink.'</div>';
897
+                echo '<div class="blogpost_text" id="blogpost_text_'.$blog_post_id.'" style="display: none">'.$blog_post_text.'</div>';
898 898
 
899
-                $file_name_array = get_blog_attachment($blog_id,$blog_post_id,0);
899
+                $file_name_array = get_blog_attachment($blog_id, $blog_post_id, 0);
900 900
 
901 901
                 if (!empty($file_name_array)) {
902 902
                     echo '<br /><br />';
903
-                    echo Display::return_icon('attachment.gif',get_lang('Attachment'));
903
+                    echo Display::return_icon('attachment.gif', get_lang('Attachment'));
904 904
                     echo '<a href="download.php?file=';
905 905
                     echo $file_name_array['path'];
906 906
                     echo ' "> '.$file_name_array['filename'].' </a><br />';
907 907
                     echo '</span>';
908 908
                 }
909 909
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES);
910
-                echo '<span class="blogpost_info">' . get_lang('Author') . ': ' . Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)) .' - <a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '#add_comment" title="' . get_lang('ReadPost') . '" >' . get_lang('Comments') . ': ' . $blog_post_comments['number_of_comments'] . '</a></span>';
910
+                echo '<span class="blogpost_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - <a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'#add_comment" title="'.get_lang('ReadPost').'" >'.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].'</a></span>';
911 911
                 echo '</div>';
912 912
             }
913 913
         } else {
914
-            if($filter == '1=1') {
914
+            if ($filter == '1=1') {
915 915
                 echo get_lang('NoArticles');
916 916
             } else {
917 917
                 echo get_lang('NoArticleMatches');
@@ -925,19 +925,19 @@  discard block
 block discarded – undo
925 925
      * @param Integer $blog_id
926 926
      * @param String $query_string
927 927
      */
928
-    public static function display_search_results ($blog_id, $query_string)
928
+    public static function display_search_results($blog_id, $query_string)
929 929
     {
930 930
         // Init
931 931
         $query_string = Database::escape_string($query_string);
932
-        $query_string_parts = explode(' ',$query_string);
932
+        $query_string_parts = explode(' ', $query_string);
933 933
         $query_string = array();
934 934
         foreach ($query_string_parts as $query_part) {
935
-            $query_string[] = " full_text LIKE '%" . $query_part."%' OR title LIKE '%" . $query_part."%' ";
935
+            $query_string[] = " full_text LIKE '%".$query_part."%' OR title LIKE '%".$query_part."%' ";
936 936
         }
937
-        $query_string = '('.implode('OR',$query_string) . ')';
937
+        $query_string = '('.implode('OR', $query_string).')';
938 938
 
939 939
         // Display the posts
940
-        echo '<span class="blogpost_title">' . get_lang('SearchResults') . '</span>';
940
+        echo '<span class="blogpost_title">'.get_lang('SearchResults').'</span>';
941 941
         Blog::display_blog_posts($blog_id, $query_string);
942 942
     }
943 943
 
@@ -950,14 +950,14 @@  discard block
 block discarded – undo
950 950
     public static function display_day_results($blog_id, $query_string)
951 951
     {
952 952
         $date_output = $query_string;
953
-        $date = explode('-',$query_string);
954
-        $query_string = ' DAYOFMONTH(date_creation) =' . intval($date[2]) . ' AND MONTH(date_creation) =' . intval($date[1]) . ' AND YEAR(date_creation) =' . intval($date[0]);
953
+        $date = explode('-', $query_string);
954
+        $query_string = ' DAYOFMONTH(date_creation) ='.intval($date[2]).' AND MONTH(date_creation) ='.intval($date[1]).' AND YEAR(date_creation) ='.intval($date[0]);
955 955
 
956 956
         // Put date in correct output format
957 957
         $date_output = api_format_date($date_output, DATE_FORMAT_LONG);
958 958
 
959 959
         // Display the posts
960
-        echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>';
960
+        echo '<span class="blogpost_title">'.get_lang('PostsOf').': '.$date_output.'</span>';
961 961
         Blog::display_blog_posts($blog_id, $query_string);
962 962
     }
963 963
 
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
                     ON post.author_id = user.user_id
985 985
                 WHERE
986 986
                     post.c_id = $course_id AND
987
-                    post.blog_id = '".(int)$blog_id."' AND
988
-                    post.post_id = '".(int)$post_id."'
987
+                    post.blog_id = '".(int) $blog_id."' AND
988
+                    post.post_id = '".(int) $post_id."'
989 989
                 ORDER BY post_id DESC";
990 990
         $result = Database::query($sql);
991 991
         $blog_post = Database::fetch_array($result);
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
         // Get number of comments
994 994
         $sql = "SELECT COUNT(1) as number_of_comments
995 995
                 FROM $tbl_blogs_comments
996
-                WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND post_id = '".(int)$post_id."'";
996
+                WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."' AND post_id = '".(int) $post_id."'";
997 997
         $result = Database::query($sql);
998 998
         $blog_post_comments = Database::fetch_array($result);
999 999
 
@@ -1004,34 +1004,34 @@  discard block
 block discarded – undo
1004 1004
 
1005 1005
         $task_id = (isset($_GET['task_id']) && is_numeric($_GET['task_id'])) ? intval($_GET['task_id']) : 0;
1006 1006
 
1007
-        if (api_is_allowed('BLOG_' . $blog_id, 'article_edit', $task_id)) {
1008
-            $blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('EditThisPost') . '">';
1009
-            $blog_post_actions .=  Display::return_icon('edit.png');
1007
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) {
1008
+            $blog_post_actions .= '<a href="blog.php?action=edit_post&blog_id='.$blog_id.'&post_id='.$post_id.'&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang('EditThisPost').'">';
1009
+            $blog_post_actions .= Display::return_icon('edit.png');
1010 1010
             $blog_post_actions .= '</a>';
1011 1011
         }
1012 1012
 
1013
-        if (api_is_allowed('BLOG_' . $blog_id, 'article_delete', $task_id)) {
1014
-            $blog_post_actions .= '<a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $post_id . '&do=delete_article&article_id=' . $blog_post['post_id'] . '&task_id=' . $task_id . '" title="' . get_lang('DeleteThisArticle') . '" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;">';
1013
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) {
1014
+            $blog_post_actions .= '<a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$post_id.'&do=delete_article&article_id='.$blog_post['post_id'].'&task_id='.$task_id.'" title="'.get_lang('DeleteThisArticle').'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;">';
1015 1015
             $blog_post_actions .= Display::return_icon('delete.png');
1016 1016
             $blog_post_actions .= '</a>';
1017 1017
         }
1018 1018
 
1019
-        if (api_is_allowed('BLOG_' . $blog_id, 'article_rate'))
1020
-            $rating_select = Blog::display_rating_form('post',$blog_id,$post_id);
1019
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_rate'))
1020
+            $rating_select = Blog::display_rating_form('post', $blog_id, $post_id);
1021 1021
 
1022
-        $blog_post_text=stripslashes($blog_post_text);
1022
+        $blog_post_text = stripslashes($blog_post_text);
1023 1023
 
1024 1024
         // Display post
1025 1025
         echo '<div class="blogpost">';
1026
-        echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id=' . $blog_id . '&post_id=' . $blog_post['post_id'] . '" title="' . get_lang('ReadPost') . '" >'.stripslashes($blog_post['title']) . '</a></span>';
1027
-        echo '<span class="blogpost_date">' . $blog_post_date . '</span>';
1028
-        echo '<span class="blogpost_text">' . $blog_post_text . '</span><br />';
1026
+        echo '<span class="blogpost_title"><a href="blog.php?action=view_post&blog_id='.$blog_id.'&post_id='.$blog_post['post_id'].'" title="'.get_lang('ReadPost').'" >'.stripslashes($blog_post['title']).'</a></span>';
1027
+        echo '<span class="blogpost_date">'.$blog_post_date.'</span>';
1028
+        echo '<span class="blogpost_text">'.$blog_post_text.'</span><br />';
1029 1029
 
1030 1030
         $file_name_array = get_blog_attachment($blog_id, $post_id);
1031 1031
 
1032 1032
         if (!empty($file_name_array)) {
1033 1033
             echo ' <br />';
1034
-            echo Display::return_icon('attachment.gif',get_lang('Attachment'));
1034
+            echo Display::return_icon('attachment.gif', get_lang('Attachment'));
1035 1035
             echo '<a href="download.php?file=';
1036 1036
             echo $file_name_array['path'];
1037 1037
             echo ' "> '.$file_name_array['filename'].' </a>';
@@ -1042,20 +1042,20 @@  discard block
 block discarded – undo
1042 1042
             echo '<br />';
1043 1043
         }
1044 1044
         $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES);
1045
-        echo '<span class="blogpost_info">'.get_lang('Author').': ' .Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post',$blog_id,$post_id).$rating_select.'</span>';
1046
-        echo '<span class="blogpost_actions">' . $blog_post_actions . '</span>';
1045
+        echo '<span class="blogpost_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username)).' - '.get_lang('Comments').': '.$blog_post_comments['number_of_comments'].' - '.get_lang('Rating').': '.Blog::display_rating('post', $blog_id, $post_id).$rating_select.'</span>';
1046
+        echo '<span class="blogpost_actions">'.$blog_post_actions.'</span>';
1047 1047
         echo '</div>';
1048 1048
 
1049 1049
         // Display comments if there are any
1050
-        if($blog_post_comments['number_of_comments'] > 0) {
1050
+        if ($blog_post_comments['number_of_comments'] > 0) {
1051 1051
             echo '<div class="comments">';
1052
-                echo '<span class="blogpost_title">' . get_lang('Comments') . '</span><br />';
1052
+                echo '<span class="blogpost_title">'.get_lang('Comments').'</span><br />';
1053 1053
                 Blog::get_threaded_comments(0, 0, $blog_id, $post_id, $task_id);
1054 1054
             echo '</div>';
1055 1055
         }
1056 1056
 
1057 1057
         // Display comment form
1058
-        if (api_is_allowed('BLOG_' . $blog_id, 'article_comments_add')) {
1058
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
1059 1059
             Blog::display_new_comment_form($blog_id, $post_id, $blog_post['title']);
1060 1060
         }
1061 1061
     }
@@ -1083,16 +1083,16 @@  discard block
 block discarded – undo
1083 1083
         $sql = "SELECT rating_id FROM $tbl_blogs_rating
1084 1084
                 WHERE
1085 1085
                     c_id = $course_id AND
1086
-                    blog_id = '".(int)$blog_id."' AND
1087
-                    item_id = '".(int)$item_id."' AND
1086
+                    blog_id = '".(int) $blog_id."' AND
1087
+                    item_id = '".(int) $item_id."' AND
1088 1088
                     rating_type = '".Database::escape_string($type)."' AND
1089
-                    user_id = '".(int)$_user['user_id']."'";
1089
+                    user_id = '".(int) $_user['user_id']."'";
1090 1090
         $result = Database::query($sql);
1091 1091
 
1092 1092
         // Add rating
1093 1093
         if (Database::num_rows($result) == 0) {
1094 1094
             $sql = "INSERT INTO $tbl_blogs_rating (c_id, blog_id, rating_type, item_id, user_id, rating )
1095
-                    VALUES ($course_id, '".(int)$blog_id."', '".Database::escape_string($type)."', '".(int)$item_id."', '".(int)$_user['user_id']."', '".Database::escape_string($rating)."')";
1095
+                    VALUES ($course_id, '".(int) $blog_id."', '".Database::escape_string($type)."', '".(int) $item_id."', '".(int) $_user['user_id']."', '".Database::escape_string($rating)."')";
1096 1096
             Database::query($sql);
1097 1097
 
1098 1098
             $id = Database::insert_id();
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
         $sql = "SELECT AVG(rating) as rating FROM $tbl_blogs_rating
1124 1124
                 WHERE
1125 1125
                     c_id = $course_id AND
1126
-                    blog_id = '".(int)$blog_id."' AND
1127
-                    item_id = '".(int)$item_id."' AND
1126
+                    blog_id = '".(int) $blog_id."' AND
1127
+                    item_id = '".(int) $item_id."' AND
1128 1128
                     rating_type = '".Database::escape_string($type)."' ";
1129 1129
         $result = Database::query($sql);
1130 1130
         $result = Database::fetch_array($result);
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
      * @param Integer $blog_id
1140 1140
      * @param integer $post_id
1141 1141
      */
1142
-    public static function display_rating_form ($type, $blog_id, $post_id, $comment_id = NULL)
1142
+    public static function display_rating_form($type, $blog_id, $post_id, $comment_id = NULL)
1143 1143
     {
1144 1144
         $_user = api_get_user_info();
1145 1145
         $tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING);
@@ -1149,14 +1149,14 @@  discard block
 block discarded – undo
1149 1149
             // Check if the user has already rated this post
1150 1150
             $sql = "SELECT rating_id FROM $tbl_blogs_rating
1151 1151
                     WHERE c_id = $course_id AND
1152
-                    blog_id = '".(int)$blog_id."'
1153
-                    AND item_id = '".(int)$post_id."'
1152
+                    blog_id = '".(int) $blog_id."'
1153
+                    AND item_id = '".(int) $post_id."'
1154 1154
                     AND rating_type = '".Database::escape_string($type)."'
1155
-                    AND user_id = '".(int)$_user['user_id']."'";
1155
+                    AND user_id = '".(int) $_user['user_id']."'";
1156 1156
             $result = Database::query($sql);
1157 1157
             // Add rating
1158 1158
             if (Database::num_rows($result) == 0) {
1159
-                return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $post_id . '" name="frm_rating_' . $type . '_' . $post_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $post_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /></form>';
1159
+                return ' - '.get_lang('RateThis').': <form method="get" action="blog.php" style="display: inline" id="frm_rating_'.$type.'_'.$post_id.'" name="frm_rating_'.$type.'_'.$post_id.'"><select name="rating" onchange="document.forms[\'frm_rating_'.$type.'_'.$post_id.'\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="'.$type.'" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="'.$blog_id.'" /><input type="hidden" name="post_id" value="'.$post_id.'" /></form>';
1160 1160
             } else {
1161 1161
                 return '';
1162 1162
             }
@@ -1165,14 +1165,14 @@  discard block
 block discarded – undo
1165 1165
         if ($type = 'comment') {
1166 1166
             // Check if the user has already rated this comment
1167 1167
             $sql = "SELECT rating_id FROM $tbl_blogs_rating
1168
-                    WHERE c_id = $course_id AND blog_id = '".(int)$blog_id ."'
1169
-                    AND item_id = '".(int)$comment_id."'
1168
+                    WHERE c_id = $course_id AND blog_id = '".(int) $blog_id."'
1169
+                    AND item_id = '".(int) $comment_id."'
1170 1170
                     AND rating_type = '".Database::escape_string($type)."'
1171
-                    AND user_id = '".(int)$_user['user_id']."'";
1171
+                    AND user_id = '".(int) $_user['user_id']."'";
1172 1172
             $result = Database::query($sql);
1173 1173
 
1174 1174
             if (Database::num_rows($result) == 0) {
1175
-                return ' - ' . get_lang('RateThis') . ': <form method="get" action="blog.php" style="display: inline" id="frm_rating_' . $type . '_' . $comment_id . '" name="frm_rating_' . $type . '_' . $comment_id . '"><select name="rating" onchange="document.forms[\'frm_rating_' . $type . '_' . $comment_id . '\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="' . $type . '" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="' . $blog_id . '" /><input type="hidden" name="post_id" value="' . $post_id . '" /><input type="hidden" name="comment_id" value="' . $comment_id . '" /></form>';
1175
+                return ' - '.get_lang('RateThis').': <form method="get" action="blog.php" style="display: inline" id="frm_rating_'.$type.'_'.$comment_id.'" name="frm_rating_'.$type.'_'.$comment_id.'"><select name="rating" onchange="document.forms[\'frm_rating_'.$type.'_'.$comment_id.'\'].submit()"><option value="">-</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option></select><input type="hidden" name="action" value="view_post" /><input type="hidden" name="type" value="'.$type.'" /><input type="hidden" name="do" value="rate" /><input type="hidden" name="blog_id" value="'.$blog_id.'" /><input type="hidden" name="post_id" value="'.$post_id.'" /><input type="hidden" name="comment_id" value="'.$comment_id.'" /></form>';
1176 1176
             } else {
1177 1177
                 return '';
1178 1178
             }
@@ -1207,11 +1207,11 @@  discard block
 block discarded – undo
1207 1207
                 WHERE
1208 1208
                     comments.c_id = $course_id AND
1209 1209
                     parent_comment_id = $current AND
1210
-                    comments.blog_id = '".(int)$blog_id."' AND
1211
-                    comments.post_id = '".(int)$post_id."'";
1210
+                    comments.blog_id = '".(int) $blog_id."' AND
1211
+                    comments.post_id = '".(int) $post_id."'";
1212 1212
         $result = Database::query($sql);
1213 1213
 
1214
-        while($comment = Database::fetch_array($result)) {
1214
+        while ($comment = Database::fetch_array($result)) {
1215 1215
             // Select the children recursivly
1216 1216
             $tmp = "SELECT comments.*, user.lastname, user.firstname, user.username
1217 1217
                     FROM $tbl_blogs_comments comments
@@ -1220,8 +1220,8 @@  discard block
 block discarded – undo
1220 1220
                     WHERE
1221 1221
                         comments.c_id = $course_id AND
1222 1222
                         comment_id = $current
1223
-                        AND blog_id = '".(int)$blog_id."'
1224
-                        AND post_id = '".(int)$post_id."'";
1223
+                        AND blog_id = '".(int) $blog_id."'
1224
+                        AND post_id = '".(int) $post_id."'";
1225 1225
             $tmp = Database::query($tmp);
1226 1226
             $tmp = Database::fetch_array($tmp);
1227 1227
             $parent_cat = $tmp['parent_comment_id'];
@@ -1246,22 +1246,22 @@  discard block
 block discarded – undo
1246 1246
             }
1247 1247
 
1248 1248
             if (!is_null($comment['task_id'])) {
1249
-                $border_color = ' border-left: 3px solid #' . $comment['color'];
1249
+                $border_color = ' border-left: 3px solid #'.$comment['color'];
1250 1250
             }
1251 1251
 
1252 1252
             $comment_text = stripslashes($comment_text);
1253 1253
 
1254 1254
             // Output...
1255 1255
             $margin = $current_level * 30;
1256
-            echo '<div class="blogpost_comment" style="margin-left: ' . $margin . 'px;' . $border_color . '">';
1257
-                echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\'' . $comment['comment_id'] . '\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']) . '\'" title="' . get_lang('ReplyToThisComment') . '" >'.stripslashes($comment['title']) . '</a></span>';
1258
-                echo '<span class="blogpost_comment_date">' . $blog_comment_date . '</span>';
1259
-                echo '<span class="blogpost_text">' . $comment_text . '</span>';
1256
+            echo '<div class="blogpost_comment" style="margin-left: '.$margin.'px;'.$border_color.'">';
1257
+                echo '<span class="blogpost_comment_title"><a href="#add_comment" onclick="document.getElementById(\'comment_parent_id\').value=\''.$comment['comment_id'].'\'; document.getElementById(\'comment_title\').value=\'Re: '.addslashes($comment['title']).'\'" title="'.get_lang('ReplyToThisComment').'" >'.stripslashes($comment['title']).'</a></span>';
1258
+                echo '<span class="blogpost_comment_date">'.$blog_comment_date.'</span>';
1259
+                echo '<span class="blogpost_text">'.$comment_text.'</span>';
1260 1260
 
1261
-                $file_name_array = get_blog_attachment($blog_id,$post_id, $comment['comment_id']);
1261
+                $file_name_array = get_blog_attachment($blog_id, $post_id, $comment['comment_id']);
1262 1262
                 if (!empty($file_name_array)) {
1263 1263
                     echo '<br /><br />';
1264
-                    echo Display::return_icon('attachment.gif',get_lang('Attachment'));
1264
+                    echo Display::return_icon('attachment.gif', get_lang('Attachment'));
1265 1265
                     echo '<a href="download.php?file=';
1266 1266
                     echo $file_name_array['path'];
1267 1267
                     echo ' "> '.$file_name_array['filename'].' </a>';
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
                 }
1272 1272
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $comment['username']), ENT_QUOTES);
1273 1273
                 echo '<span class="blogpost_comment_info">'.get_lang('Author').': '.Display::tag('span', api_get_person_name($comment['firstname'], $comment['lastname']), array('title'=>$username)).' - '.get_lang('Rating').': '.Blog::display_rating('comment', $blog_id, $comment['comment_id']).$rating_select.'</span>';
1274
-                echo '<span class="blogpost_actions">' . $blog_comment_actions . '</span>';
1274
+                echo '<span class="blogpost_actions">'.$blog_comment_actions.'</span>';
1275 1275
             echo '</div>';
1276 1276
 
1277 1277
             // Go further down the tree.
@@ -1287,11 +1287,11 @@  discard block
 block discarded – undo
1287 1287
      */
1288 1288
     public static function display_form_new_post($blog_id)
1289 1289
     {
1290
-        if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) {
1290
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) {
1291 1291
             $form = new FormValidator(
1292 1292
                 'add_post',
1293 1293
                 'post',
1294
-                api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=" . $blog_id . "&" . api_get_cidreq(),
1294
+                api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=".$blog_id."&".api_get_cidreq(),
1295 1295
                 null,
1296 1296
                 array('enctype' => 'multipart/form-data')
1297 1297
             );
@@ -1335,8 +1335,8 @@  discard block
 block discarded – undo
1335 1335
                 INNER JOIN $tbl_users user ON post.author_id = user.user_id
1336 1336
                 WHERE
1337 1337
                 post.c_id 			= $course_id AND
1338
-                post.blog_id 		= '".(int)$blog_id ."'
1339
-                AND post.post_id	= '".(int)$post_id."'
1338
+                post.blog_id 		= '".(int) $blog_id."'
1339
+                AND post.post_id	= '".(int) $post_id."'
1340 1340
                 ORDER BY post_id DESC";
1341 1341
         $result = Database::query($sql);
1342 1342
         $blog_post = Database::fetch_array($result);
@@ -1345,7 +1345,7 @@  discard block
 block discarded – undo
1345 1345
         $form = new FormValidator(
1346 1346
             'edit_post',
1347 1347
             'post',
1348
-            api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id=' . intval($_GET['post_id']) . '&blog_id=' . intval($blog_id) . '&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id'])
1348
+            api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id='.intval($_GET['post_id']).'&blog_id='.intval($blog_id).'&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id'])
1349 1349
         );
1350 1350
 
1351 1351
         $form->addHeader(get_lang('EditPost'));
@@ -1377,31 +1377,31 @@  discard block
 block discarded – undo
1377 1377
         global $charset;
1378 1378
         $course_id = api_get_course_int_id();
1379 1379
 
1380
-        if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) {
1380
+        if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) {
1381 1381
             $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
1382 1382
             $counter = 0;
1383 1383
             global $color2;
1384 1384
 
1385 1385
             echo '<div class="actions">';
1386
-            echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=add">';
1386
+            echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$blog_id.'&do=add">';
1387 1387
             echo Display::return_icon('blog_newtasks.gif', get_lang('AddTasks'));
1388
-            echo get_lang('AddTasks') . '</a> ';
1389
-            echo '<a href="' .api_get_self(). '?action=manage_tasks&blog_id=' . $blog_id . '&do=assign">';
1388
+            echo get_lang('AddTasks').'</a> ';
1389
+            echo '<a href="'.api_get_self().'?action=manage_tasks&blog_id='.$blog_id.'&do=assign">';
1390 1390
             echo Display::return_icon('blog_task.gif', get_lang('AssignTasks'));
1391
-            echo get_lang('AssignTasks') . '</a>';
1391
+            echo get_lang('AssignTasks').'</a>';
1392 1392
             ?>
1393 1393
                 <a href="<?php echo api_get_self(); ?>?action=manage_rights&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageRights') ?>">
1394
-                    <?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'),'',ICON_SIZE_SMALL). get_lang('RightsManager') ?></a>
1394
+                    <?php echo Display::return_icon('blog_admin_users.png', get_lang('RightsManager'), '', ICON_SIZE_SMALL).get_lang('RightsManager') ?></a>
1395 1395
             <?php
1396 1396
             echo '</div>';
1397 1397
 
1398
-            echo '<span class="blogpost_title">' . get_lang('TaskList') . '</span><br />';
1398
+            echo '<span class="blogpost_title">'.get_lang('TaskList').'</span><br />';
1399 1399
             echo "<table class=\"data_table\">";
1400 1400
             echo	"<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
1401
-                     "<th width='240'><b>",get_lang('Title'),"</b></th>",
1402
-                     "<th><b>",get_lang('Description'),"</b></th>",
1403
-                     "<th><b>",get_lang('Color'),"</b></th>",
1404
-                     "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1401
+                     "<th width='240'><b>", get_lang('Title'), "</b></th>",
1402
+                     "<th><b>", get_lang('Description'), "</b></th>",
1403
+                     "<th><b>", get_lang('Color'), "</b></th>",
1404
+                     "<th width='50'><b>", get_lang('Modify'), "</b></th>",
1405 1405
                 "</tr>";
1406 1406
 
1407 1407
 
@@ -1413,8 +1413,8 @@  discard block
 block discarded – undo
1413 1413
                         description,
1414 1414
                         color,
1415 1415
                         system_task
1416
-                    FROM " . $tbl_blogs_tasks . "
1417
-                    WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . "
1416
+                    FROM " . $tbl_blogs_tasks."
1417
+                    WHERE c_id = $course_id AND blog_id = ".(int) $blog_id."
1418 1418
                     ORDER BY system_task, title";
1419 1419
             $result = Database::query($sql);
1420 1420
 
@@ -1423,10 +1423,10 @@  discard block
 block discarded – undo
1423 1423
                 $css_class = (($counter % 2) == 0) ? "row_odd" : "row_even";
1424 1424
                 $delete_icon = ($task['system_task'] == '1') ? "delete_na.png" : "delete.png";
1425 1425
                 $delete_title = ($task['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask');
1426
-                $delete_link = ($task['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $task['blog_id'] . '&do=delete&task_id=' . $task['task_id'];
1427
-                $delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"';
1426
+                $delete_link = ($task['system_task'] == '1') ? '#' : api_get_self().'?action=manage_tasks&blog_id='.$task['blog_id'].'&do=delete&task_id='.$task['task_id'];
1427
+                $delete_confirm = ($task['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"';
1428 1428
 
1429
-                echo '<tr class="' . $css_class . '" valign="top">';
1429
+                echo '<tr class="'.$css_class.'" valign="top">';
1430 1430
                 echo '<td width="240">'.Security::remove_XSS($task['title']).'</td>';
1431 1431
                 echo '<td>'.Security::remove_XSS($task['description']).'</td>';
1432 1432
                 echo '<td><span style="background-color: #'.$task['color'].'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td>';
@@ -1452,23 +1452,23 @@  discard block
 block discarded – undo
1452 1452
      *
1453 1453
      * @param Integer $blog_id
1454 1454
      */
1455
-    public static function display_assigned_task_list ($blog_id)
1455
+    public static function display_assigned_task_list($blog_id)
1456 1456
     {
1457 1457
         // Init
1458 1458
         $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
1459 1459
         $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
1460 1460
         $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
1461 1461
         $counter = 0;
1462
-        global $charset,$color2;
1462
+        global $charset, $color2;
1463 1463
 
1464
-        echo '<span class="blogpost_title">' . get_lang('AssignedTasks') . '</span><br />';
1464
+        echo '<span class="blogpost_title">'.get_lang('AssignedTasks').'</span><br />';
1465 1465
         echo "<table class=\"data_table\">";
1466 1466
         echo	"<tr bgcolor=\"$color2\" align=\"center\" valign=\"top\">",
1467
-                 "<th width='240'><b>",get_lang('Member'),"</b></th>",
1468
-                 "<th><b>",get_lang('Task'),"</b></th>",
1469
-                 "<th><b>",get_lang('Description'),"</b></th>",
1470
-                 "<th><b>",get_lang('TargetDate'),"</b></th>",
1471
-                 "<th width='50'><b>",get_lang('Modify'),"</b></th>",
1467
+                 "<th width='240'><b>", get_lang('Member'), "</b></th>",
1468
+                 "<th><b>", get_lang('Task'), "</b></th>",
1469
+                 "<th><b>", get_lang('Description'), "</b></th>",
1470
+                 "<th><b>", get_lang('TargetDate'), "</b></th>",
1471
+                 "<th width='50'><b>", get_lang('Modify'), "</b></th>",
1472 1472
             "</tr>";
1473 1473
 
1474 1474
         $course_id = api_get_course_int_id();
@@ -1480,17 +1480,17 @@  discard block
 block discarded – undo
1480 1480
                 WHERE
1481 1481
                     task_rel_user.c_id = $course_id AND
1482 1482
                     task.c_id = $course_id AND
1483
-                    task_rel_user.blog_id = '".(int)$blog_id."'
1483
+                    task_rel_user.blog_id = '".(int) $blog_id."'
1484 1484
                 ORDER BY target_date ASC";
1485 1485
         $result = Database::query($sql);
1486 1486
 
1487 1487
         while ($assignment = Database::fetch_array($result)) {
1488 1488
             $counter++;
1489
-            $css_class = (($counter % 2)==0) ? "row_odd" : "row_even";
1489
+            $css_class = (($counter % 2) == 0) ? "row_odd" : "row_even";
1490 1490
             $delete_icon = ($assignment['system_task'] == '1') ? "delete_na.png" : "delete.png";
1491 1491
             $delete_title = ($assignment['system_task'] == '1') ? get_lang('DeleteSystemTask') : get_lang('DeleteTask');
1492
-            $delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self() . '?action=manage_tasks&blog_id=' . $assignment['blog_id'] . '&do=delete&task_id=' . $assignment['task_id'];
1493
-            $delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;"';
1492
+            $delete_link = ($assignment['system_task'] == '1') ? '#' : api_get_self().'?action=manage_tasks&blog_id='.$assignment['blog_id'].'&do=delete&task_id='.$assignment['task_id'];
1493
+            $delete_confirm = ($assignment['system_task'] == '1') ? '' : 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;"';
1494 1494
 
1495 1495
             $username = api_htmlentities(sprintf(get_lang('LoginX'), $assignment['username']), ENT_QUOTES);
1496 1496
 
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
      * @author Toon Keppens
1523 1523
      *
1524 1524
      */
1525
-    public static function display_new_task_form ($blog_id)
1525
+    public static function display_new_task_form($blog_id)
1526 1526
     {
1527 1527
         // Init
1528 1528
         $colors = array(
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
         );
1545 1545
 
1546 1546
         // form
1547
-        echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '">';
1547
+        echo '<form name="add_task" method="post" action="blog.php?action=manage_tasks&blog_id='.$blog_id.'">';
1548 1548
 
1549 1549
         // form title
1550 1550
         echo '<legend>'.get_lang('AddTask').'</legend>';
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
         // task title
1553 1553
         echo '	<div class="control-group">
1554 1554
                     <label class="control-label">
1555
-                        <span class="form_required">*</span>' . get_lang('Title') . '
1555
+                        <span class="form_required">*</span>' . get_lang('Title').'
1556 1556
                     </label>
1557 1557
                     <div class="controls">
1558 1558
                         <input name="task_name" type="text" size="70" />
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
         // task comment
1563 1563
         echo '	<div class="control-group">
1564 1564
                     <label class="control-label">
1565
-                        ' . get_lang('Description') . '
1565
+                        ' . get_lang('Description').'
1566 1566
                     </label>
1567 1567
                     <div class="controls">
1568 1568
                         <textarea name="task_description" cols="45"></textarea>
@@ -1572,18 +1572,18 @@  discard block
 block discarded – undo
1572 1572
         // task management
1573 1573
         echo '	<div class="control-group">
1574 1574
                     <label class="control-label">
1575
-                        ' . get_lang('TaskManager') . '
1575
+                        ' . get_lang('TaskManager').'
1576 1576
                     </label>
1577 1577
                     <div class="controls">';
1578 1578
                 echo '<table class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">';
1579 1579
                     echo '<tr>';
1580
-                        echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>';
1581
-                        echo '<th width:223px;>' . get_lang('CommentManager') . '</th>';
1580
+                        echo '<th colspan="2" style="width:223px;">'.get_lang('ArticleManager').'</th>';
1581
+                        echo '<th width:223px;>'.get_lang('CommentManager').'</th>';
1582 1582
                     echo '</tr>';
1583 1583
                     echo '<tr>';
1584
-                        echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>';
1585
-                        echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>';
1586
-                        echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>';
1584
+                        echo '<th style="width:111px;"><label for="articleDelete">'.get_lang('Delete').'</label></th>';
1585
+                        echo '<th style="width:112px;"><label for="articleEdit">'.get_lang('Edit').'</label></th>';
1586
+                        echo '<th style="width:223px;"><label for="commentsDelete">'.get_lang('Delete').'</label></th>';
1587 1587
                     echo '</tr>';
1588 1588
                     echo '<tr>';
1589 1589
                         echo '<td style="text-align:center;"><input id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>';
@@ -1598,13 +1598,13 @@  discard block
 block discarded – undo
1598 1598
         // task color
1599 1599
         echo '	<div class="control-group">
1600 1600
                     <label class="control-label">
1601
-                        ' . get_lang('Color') . '
1601
+                        ' . get_lang('Color').'
1602 1602
                     </label>
1603 1603
                     <div class="controls">';
1604 1604
         echo '<select name="task_color" id="color" style="width: 150px; background-color: #eeeeee" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">';
1605 1605
                 foreach ($colors as $color) {
1606
-                    $style = 'style="background-color: #' . $color . '"';
1607
-                    echo '<option value="' . $color . '" ' . $style . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
1606
+                    $style = 'style="background-color: #'.$color.'"';
1607
+                    echo '<option value="'.$color.'" '.$style.'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
1608 1608
                 }
1609 1609
         echo '</select>';
1610 1610
         echo '		</div>
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
                     <div class="controls">
1616 1616
                             <input type="hidden" name="action" value="" />
1617 1617
                             <input type="hidden" name="new_task_submit" value="true" />
1618
-                        <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button>
1618
+                        <button class="save" type="submit" name="Submit">' . get_lang('Save').'</button>
1619 1619
                     </div>
1620 1620
                 </div>';
1621 1621
         echo '</form>';
@@ -1629,34 +1629,34 @@  discard block
 block discarded – undo
1629 1629
      * @author Toon Keppens
1630 1630
      *
1631 1631
      */
1632
-    public static function display_edit_task_form ($blog_id, $task_id) {
1632
+    public static function display_edit_task_form($blog_id, $task_id) {
1633 1633
         $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
1634 1634
         $course_id = api_get_course_int_id();
1635 1635
 
1636
-        $colors = array('FFFFFF','FFFF99','FFCC99','FF9933','FF6699','CCFF99','CC9966','66FF00', '9966FF', 'CF3F3F', '990033','669933','0033FF','003366','000000');
1636
+        $colors = array('FFFFFF', 'FFFF99', 'FFCC99', 'FF9933', 'FF6699', 'CCFF99', 'CC9966', '66FF00', '9966FF', 'CF3F3F', '990033', '669933', '0033FF', '003366', '000000');
1637 1637
 
1638
-        $sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int)$task_id."'";
1638
+        $sql = "SELECT blog_id, task_id, title, description, color FROM $tbl_blogs_tasks WHERE c_id = $course_id AND task_id = '".(int) $task_id."'";
1639 1639
         $result = Database::query($sql);
1640 1640
         $task = Database::fetch_array($result);
1641 1641
 
1642 1642
         // Display
1643
-        echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id=' . $blog_id . '">
1644
-                    <legend>' . get_lang('EditTask') . '</legend>
1643
+        echo '<form name="edit_task" method="post" action="blog.php?action=manage_tasks&blog_id='.$blog_id.'">
1644
+                    <legend>' . get_lang('EditTask').'</legend>
1645 1645
                     <table width="100%" border="0" cellspacing="2">
1646 1646
                         <tr>
1647
-                       <td align="right">' . get_lang('Title') . ':&nbsp;&nbsp;</td>
1648
-                       <td><input name="task_name" type="text" size="70" value="'.Security::remove_XSS($task['title']) . '" /></td>
1647
+                       <td align="right">' . get_lang('Title').':&nbsp;&nbsp;</td>
1648
+                       <td><input name="task_name" type="text" size="70" value="'.Security::remove_XSS($task['title']).'" /></td>
1649 1649
                         </tr>
1650 1650
                         <tr>
1651
-                       <td align="right">' . get_lang('Description') . ':&nbsp;&nbsp;</td>
1651
+                       <td align="right">' . get_lang('Description').':&nbsp;&nbsp;</td>
1652 1652
                        <td><textarea name="task_description" cols="45">'.Security::remove_XSS($task['description']).'</textarea></td>
1653 1653
                         </tr>';
1654 1654
 
1655 1655
                         /* edit by Kevin Van Den Haute ([email protected]) */
1656 1656
                         $tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
1657 1657
 
1658
-                        $sql = " SELECT id, action FROM " . $tbl_tasks_permissions . "
1659
-                                 WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'";
1658
+                        $sql = " SELECT id, action FROM ".$tbl_tasks_permissions."
1659
+                                 WHERE c_id = $course_id AND task_id = '".(int) $task_id."'";
1660 1660
                         $result = Database::query($sql);
1661 1661
 
1662 1662
                         $arrPermissions = array();
@@ -1665,22 +1665,22 @@  discard block
 block discarded – undo
1665 1665
                             $arrPermissions[] = $row['action'];
1666 1666
 
1667 1667
                             echo '<tr>';
1668
-                            echo '<td style="text-align:right; vertical-align:top;">' . get_lang('TaskManager') . ':&nbsp;&nbsp;</td>';
1668
+                            echo '<td style="text-align:right; vertical-align:top;">'.get_lang('TaskManager').':&nbsp;&nbsp;</td>';
1669 1669
                             echo '<td>';
1670 1670
                                 echo '<table  class="data_table" cellspacing="0" style="border-collapse:collapse; width:446px;">';
1671 1671
                                     echo '<tr>';
1672
-                                        echo '<th colspan="2" style="width:223px;">' . get_lang('ArticleManager') . '</th>';
1673
-                                        echo '<th width:223px;>' . get_lang('CommentManager') . '</th>';
1672
+                                        echo '<th colspan="2" style="width:223px;">'.get_lang('ArticleManager').'</th>';
1673
+                                        echo '<th width:223px;>'.get_lang('CommentManager').'</th>';
1674 1674
                                     echo '</tr>';
1675 1675
                                     echo '<tr>';
1676
-                                        echo '<th style="width:111px;"><label for="articleDelete">' . get_lang('Delete') . '</label></th>';
1677
-                                        echo '<th style="width:112px;"><label for="articleEdit">' . get_lang('Edit') . '</label></th>';
1678
-                                        echo '<th style="width:223px;"><label for="commentsDelete">' . get_lang('Delete') . '</label></th>';
1676
+                                        echo '<th style="width:111px;"><label for="articleDelete">'.get_lang('Delete').'</label></th>';
1677
+                                        echo '<th style="width:112px;"><label for="articleEdit">'.get_lang('Edit').'</label></th>';
1678
+                                        echo '<th style="width:223px;"><label for="commentsDelete">'.get_lang('Delete').'</label></th>';
1679 1679
                                     echo '</tr>';
1680 1680
                                     echo '<tr>';
1681
-                                        echo '<td style="text-align:center;"><input ' . ((in_array('article_delete', $arrPermissions)) ? 'checked ' : '') . 'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>';
1682
-                                        echo '<td style="text-align:center;"><input ' . ((in_array('article_edit', $arrPermissions)) ? 'checked ' : '') . 'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>';
1683
-                                        echo '<td style="text-align:center;"><input ' . ((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '') . 'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>';
1681
+                                        echo '<td style="text-align:center;"><input '.((in_array('article_delete', $arrPermissions)) ? 'checked ' : '').'id="articleDelete" name="chkArticleDelete" type="checkbox" /></td>';
1682
+                                        echo '<td style="text-align:center;"><input '.((in_array('article_edit', $arrPermissions)) ? 'checked ' : '').'id="articleEdit" name="chkArticleEdit" type="checkbox" /></td>';
1683
+                                        echo '<td style="text-align:center;"><input '.((in_array('article_comments_delete', $arrPermissions)) ? 'checked ' : '').'id="commentsDelete" name="chkCommentsDelete" type="checkbox" /></td>';
1684 1684
                                     echo '</tr>';
1685 1685
                                 echo '</table>';
1686 1686
                             echo '</td>';
@@ -1688,13 +1688,13 @@  discard block
 block discarded – undo
1688 1688
                         /* end of edit */
1689 1689
 
1690 1690
                         echo '<tr>
1691
-                       <td align="right">' . get_lang('Color') . ':&nbsp;&nbsp;</td>
1691
+                       <td align="right">' . get_lang('Color').':&nbsp;&nbsp;</td>
1692 1692
                        <td>
1693
-                        <select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'] . '" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">';
1693
+                        <select name="task_color" id="color" style="width: 150px; background-color: #' . $task['color'].'" onchange="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value" onkeypress="document.getElementById(\'color\').style.backgroundColor=\'#\'+document.getElementById(\'color\').value">';
1694 1694
                             foreach ($colors as $color) {
1695 1695
                                 $selected = ($color == $task['color']) ? ' selected' : '';
1696
-                                $style = 'style="background-color: #' . $color . '"';
1697
-                                echo '<option value="' . $color . '" ' . $style . ' ' . $selected . ' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
1696
+                                $style = 'style="background-color: #'.$color.'"';
1697
+                                echo '<option value="'.$color.'" '.$style.' '.$selected.' >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
1698 1698
                             }
1699 1699
         echo '			   </select>
1700 1700
                           </td>
@@ -1703,9 +1703,9 @@  discard block
 block discarded – undo
1703 1703
                             <td align="right">&nbsp;</td>
1704 1704
                             <td><br /><input type="hidden" name="action" value="" />
1705 1705
                             <input type="hidden" name="edit_task_submit" value="true" />
1706
-                            <input type="hidden" name="task_id" value="' . $task['task_id'] . '" />
1707
-                            <input type="hidden" name="blog_id" value="' . $task['blog_id'] . '" />
1708
-                            <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button></td>
1706
+                            <input type="hidden" name="task_id" value="' . $task['task_id'].'" />
1707
+                            <input type="hidden" name="blog_id" value="' . $task['blog_id'].'" />
1708
+                            <button class="save" type="submit" name="Submit">' . get_lang('Save').'</button></td>
1709 1709
                         </tr>
1710 1710
                     </table>
1711 1711
                 </form>';
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
                 FROM $tbl_users user
1728 1728
                 INNER JOIN $tbl_blogs_rel_user blogs_rel_user
1729 1729
                 ON user.user_id = blogs_rel_user.user_id
1730
-                WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int)$blog_id."'";
1730
+                WHERE blogs_rel_user.c_id = $course_id AND blogs_rel_user.blog_id = '".(int) $blog_id."'";
1731 1731
         $result = Database::query($sql);
1732 1732
 
1733 1733
         $options = array();
@@ -1746,7 +1746,7 @@  discard block
 block discarded – undo
1746 1746
                 color,
1747 1747
                 system_task
1748 1748
             FROM $tbl_blogs_tasks
1749
-            WHERE c_id = $course_id AND blog_id = " . (int)$blog_id . "
1749
+            WHERE c_id = $course_id AND blog_id = ".(int) $blog_id."
1750 1750
             ORDER BY system_task, title";
1751 1751
         $result = Database::query($sql);
1752 1752
 
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
      */
1795 1795
     public static function display_edit_assigned_task_form($blog_id, $task_id, $user_id)
1796 1796
     {
1797
-        $tbl_blogs_tasks_rel_user 	= Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
1797
+        $tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
1798 1798
 
1799 1799
         $course_id = api_get_course_int_id();
1800 1800
 
@@ -1803,9 +1803,9 @@  discard block
 block discarded – undo
1803 1803
             SELECT target_date
1804 1804
             FROM $tbl_blogs_tasks_rel_user
1805 1805
             WHERE c_id = $course_id AND
1806
-                  blog_id = '".(int)$blog_id."' AND
1807
-                  user_id = '".(int)$user_id."' AND
1808
-                  task_id = '".(int)$task_id."'";
1806
+                  blog_id = '".(int) $blog_id."' AND
1807
+                  user_id = '".(int) $user_id."' AND
1808
+                  task_id = '".(int) $task_id."'";
1809 1809
         $result = Database::query($sql);
1810 1810
         $row = Database::fetch_assoc($result);
1811 1811
 
@@ -1840,11 +1840,11 @@  discard block
 block discarded – undo
1840 1840
 
1841 1841
         $sql = "
1842 1842
             SELECT COUNT(*) as 'number'
1843
-            FROM " . $tbl_blogs_tasks_rel_user . "
1843
+            FROM " . $tbl_blogs_tasks_rel_user."
1844 1844
             WHERE c_id = $course_id AND
1845
-            blog_id = " . (int)$blog_id . "
1846
-            AND	user_id = " . (int)$user_id . "
1847
-            AND	task_id = " . (int)$task_id . "
1845
+            blog_id = ".(int) $blog_id."
1846
+            AND	user_id = " . (int) $user_id."
1847
+            AND	task_id = " . (int) $task_id."
1848 1848
         ";
1849 1849
 
1850 1850
         $result = Database::query($sql);
@@ -1852,18 +1852,18 @@  discard block
 block discarded – undo
1852 1852
 
1853 1853
         if ($row['number'] == 0) {
1854 1854
             $sql = "
1855
-                INSERT INTO " . $tbl_blogs_tasks_rel_user . " (
1855
+                INSERT INTO " . $tbl_blogs_tasks_rel_user." (
1856 1856
                     c_id,
1857 1857
                     blog_id,
1858 1858
                     user_id,
1859 1859
                     task_id,
1860 1860
                     target_date
1861 1861
                 ) VALUES (
1862
-                    '" . (int)$course_id . "',
1863
-                    '" . (int)$blog_id . "',
1864
-                    '" . (int)$user_id . "',
1865
-                    '" . (int)$task_id . "',
1866
-                    '" . Database::escape_string($target_date) . "'
1862
+                    '" . (int) $course_id."',
1863
+                    '" . (int) $blog_id."',
1864
+                    '" . (int) $user_id."',
1865
+                    '" . (int) $task_id."',
1866
+                    '" . Database::escape_string($target_date)."'
1867 1867
                 )";
1868 1868
 
1869 1869
             Database::query($sql);
@@ -1893,12 +1893,12 @@  discard block
 block discarded – undo
1893 1893
         $course_id = api_get_course_int_id();
1894 1894
 
1895 1895
         $sql = "SELECT COUNT(*) as 'number'
1896
-                FROM " . $tbl_blogs_tasks_rel_user . "
1896
+                FROM " . $tbl_blogs_tasks_rel_user."
1897 1897
                 WHERE
1898 1898
                     c_id = $course_id AND
1899
-                    blog_id = " . (int)$blog_id . " AND
1900
-                    user_id = " . (int)$user_id . " AND
1901
-                    task_id = " . (int)$task_id . "
1899
+                    blog_id = ".(int) $blog_id." AND
1900
+                    user_id = " . (int) $user_id." AND
1901
+                    task_id = " . (int) $task_id."
1902 1902
             ";
1903 1903
 
1904 1904
         $result = Database::query($sql);
@@ -1906,17 +1906,17 @@  discard block
 block discarded – undo
1906 1906
 
1907 1907
         if ($row['number'] == 0 || ($row['number'] != 0 && $task_id == $old_task_id && $user_id == $old_user_id)) {
1908 1908
             $sql = "
1909
-                UPDATE " . $tbl_blogs_tasks_rel_user . "
1909
+                UPDATE " . $tbl_blogs_tasks_rel_user."
1910 1910
                 SET
1911
-                    user_id = " . (int)$user_id . ",
1912
-                    task_id = " . (int)$task_id . ",
1913
-                    target_date = '" . Database::escape_string($target_date) . "'
1911
+                    user_id = " . (int) $user_id.",
1912
+                    task_id = " . (int) $task_id.",
1913
+                    target_date = '" . Database::escape_string($target_date)."'
1914 1914
                 WHERE
1915 1915
                     c_id = $course_id AND
1916
-                    blog_id = " . (int)$blog_id . " AND
1917
-                    user_id = " . (int)$old_user_id . " AND
1918
-                    task_id = " . (int)$old_task_id . " AND
1919
-                    target_date = '" . Database::escape_string($old_target_date) . "'
1916
+                    blog_id = ".(int) $blog_id." AND
1917
+                    user_id = " . (int) $old_user_id." AND
1918
+                    task_id = " . (int) $old_task_id." AND
1919
+                    target_date = '" . Database::escape_string($old_target_date)."'
1920 1920
             ";
1921 1921
             Database::query($sql);
1922 1922
         }
@@ -1937,7 +1937,7 @@  discard block
 block discarded – undo
1937 1937
 
1938 1938
 
1939 1939
         $sql = "SELECT title, description FROM $tbl_blogs_tasks
1940
-                WHERE task_id = '".(int)$task_id."'
1940
+                WHERE task_id = '".(int) $task_id."'
1941 1941
                 AND c_id = $course_id";
1942 1942
         $result = Database::query($sql);
1943 1943
         $row = Database::fetch_assoc($result);
@@ -1945,19 +1945,19 @@  discard block
 block discarded – undo
1945 1945
         $sql = "SELECT post.*, user.lastname, user.firstname, user.username
1946 1946
                 FROM $tbl_blogs_posts post
1947 1947
                 INNER JOIN $tbl_users user ON post.author_id = user.user_id
1948
-                WHERE post.blog_id = '".(int)$blog_id."' AND post.c_id = $course_id
1948
+                WHERE post.blog_id = '".(int) $blog_id."' AND post.c_id = $course_id
1949 1949
                 ORDER BY post_id DESC
1950 1950
                 LIMIT 0, 100";
1951 1951
         $result = Database::query($sql);
1952 1952
 
1953 1953
         // Display
1954
-        echo '<span class="blogpost_title">' . get_lang('SelectTaskArticle') . ' "' . stripslashes($row['title']) . '"</span>';
1955
-        echo '<span style="font-style: italic;"">'.stripslashes($row['description']) . '</span><br><br>';
1954
+        echo '<span class="blogpost_title">'.get_lang('SelectTaskArticle').' "'.stripslashes($row['title']).'"</span>';
1955
+        echo '<span style="font-style: italic;"">'.stripslashes($row['description']).'</span><br><br>';
1956 1956
 
1957 1957
         if (Database::num_rows($result) > 0) {
1958
-            while($blog_post = Database::fetch_array($result)) {
1958
+            while ($blog_post = Database::fetch_array($result)) {
1959 1959
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $blog_post['username']), ENT_QUOTES);
1960
-                echo '<a href="blog.php?action=execute_task&blog_id=' . $blog_id . '&task_id=' . $task_id . '&post_id=' . $blog_post['post_id'] . '#add_comment">'.stripslashes($blog_post['title']) . '</a>, ' . get_lang('WrittenBy') . ' ' . stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))) . '<br />';
1960
+                echo '<a href="blog.php?action=execute_task&blog_id='.$blog_id.'&task_id='.$task_id.'&post_id='.$blog_post['post_id'].'#add_comment">'.stripslashes($blog_post['title']).'</a>, '.get_lang('WrittenBy').' '.stripslashes(Display::tag('span', api_get_person_name($blog_post['firstname'], $blog_post['lastname']), array('title'=>$username))).'<br />';
1961 1961
             }
1962 1962
         } else {
1963 1963
             echo get_lang('NoArticles');
@@ -1981,12 +1981,12 @@  discard block
 block discarded – undo
1981 1981
 
1982 1982
         // Subscribe the user
1983 1983
         $sql = "INSERT INTO $tbl_blogs_rel_user (c_id, blog_id, user_id )
1984
-                VALUES ($course_id, '".(int)$blog_id."', '".(int)$user_id."');";
1984
+                VALUES ($course_id, '".(int) $blog_id."', '".(int) $user_id."');";
1985 1985
         Database::query($sql);
1986 1986
 
1987 1987
         // Give this user basic rights
1988 1988
         $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action)
1989
-                VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_add')";
1989
+                VALUES ($course_id, '".(int) $user_id."','BLOG_".(int) $blog_id."','article_add')";
1990 1990
         Database::query($sql);
1991 1991
 
1992 1992
         $id = Database::insert_id();
@@ -1996,7 +1996,7 @@  discard block
 block discarded – undo
1996 1996
         }
1997 1997
 
1998 1998
         $sql = "INSERT INTO $tbl_user_permissions (c_id, user_id,tool,action)
1999
-                VALUES ($course_id, '".(int)$user_id."','BLOG_" . (int)$blog_id."','article_comments_add')";
1999
+                VALUES ($course_id, '".(int) $user_id."','BLOG_".(int) $blog_id."','article_comments_add')";
2000 2000
         Database::query($sql);
2001 2001
 
2002 2002
         $id = Database::insert_id();
@@ -2022,12 +2022,12 @@  discard block
 block discarded – undo
2022 2022
 
2023 2023
         // Unsubscribe the user
2024 2024
         $sql = "DELETE FROM $tbl_blogs_rel_user
2025
-                WHERE blog_id = '".(int)$blog_id."' AND user_id = '".(int)$user_id."'";
2025
+                WHERE blog_id = '".(int) $blog_id."' AND user_id = '".(int) $user_id."'";
2026 2026
         Database::query($sql);
2027 2027
 
2028 2028
         // Remove this user's permissions.
2029 2029
         $sql = "DELETE FROM $tbl_user_permissions
2030
-                WHERE user_id = '".(int)$user_id."'";
2030
+                WHERE user_id = '".(int) $user_id."'";
2031 2031
         Database::query($sql);
2032 2032
     }
2033 2033
 
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
         $course_id = $_course['real_id'];
2049 2049
 
2050 2050
         $currentCourse = $_course['code'];
2051
-        $tbl_users 			= Database::get_main_table(TABLE_MAIN_USER);
2051
+        $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
2052 2052
         $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER);
2053 2053
 
2054 2054
         echo '<legend>'.get_lang('SubscribeMembers').'</legend>';
@@ -2063,12 +2063,12 @@  discard block
 block discarded – undo
2063 2063
         $result = Database::query($sql);
2064 2064
 
2065 2065
         $blog_member_ids = array();
2066
-        while($user = Database::fetch_array($result)) {
2066
+        while ($user = Database::fetch_array($result)) {
2067 2067
             $blog_member_ids[] = $user['user_id'];
2068 2068
         }
2069 2069
 
2070 2070
         // Set table headers
2071
-        $column_header[] = array ('', false, '');
2071
+        $column_header[] = array('', false, '');
2072 2072
         if ($is_western_name_order) {
2073 2073
             $column_header[] = array(get_lang('FirstName'), true, '');
2074 2074
             $column_header[] = array(get_lang('LastName'), true, '');
@@ -2088,13 +2088,13 @@  discard block
 block discarded – undo
2088 2088
 
2089 2089
         // Add users that are not in this blog to the list.
2090 2090
         foreach ($student_list as $key=>$user) {
2091
-            if(isset($user['id_user'])) {
2091
+            if (isset($user['id_user'])) {
2092 2092
                 $user['user_id'] = $user['id_user'];
2093 2093
             }
2094
-            if(!in_array($user['user_id'],$blog_member_ids)) {
2094
+            if (!in_array($user['user_id'], $blog_member_ids)) {
2095 2095
                 $a_infosUser = api_get_user_info($user['user_id']);
2096
-                $row = array ();
2097
-                $row[] = '<input type="checkbox" name="user[]" value="' . $a_infosUser['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '') . '/>';
2096
+                $row = array();
2097
+                $row[] = '<input type="checkbox" name="user[]" value="'.$a_infosUser['user_id'].'" '.((isset($_GET['selectall']) && $_GET['selectall'] == "subscribe") ? ' checked="checked" ' : '').'/>';
2098 2098
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $a_infosUser["username"]), ENT_QUOTES);
2099 2099
                 if ($is_western_name_order) {
2100 2100
                     $row[] = $a_infosUser["firstname"];
@@ -2106,8 +2106,8 @@  discard block
 block discarded – undo
2106 2106
                 $row[] = Display::icon_mailto_link($a_infosUser["email"]);
2107 2107
 
2108 2108
                 //Link to register users
2109
-                if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']){
2110
-                    $row[] = "<a class=\"btn btn-primary \" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id&register=yes&user_id=" . $a_infosUser["user_id"]."\">" . get_lang('Register')."</a>";
2109
+                if ($a_infosUser["user_id"] != $_SESSION['_user']['user_id']) {
2110
+                    $row[] = "<a class=\"btn btn-primary \" href=\"".api_get_self()."?action=manage_members&blog_id=$blog_id&register=yes&user_id=".$a_infosUser["user_id"]."\">".get_lang('Register')."</a>";
2111 2111
                 } else {
2112 2112
                     $row[] = '';
2113 2113
                 }
@@ -2118,20 +2118,20 @@  discard block
 block discarded – undo
2118 2118
         // Display
2119 2119
         $query_vars['action'] = 'manage_members';
2120 2120
         $query_vars['blog_id'] = $blog_id;
2121
-        echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">';
2122
-            Display::display_sortable_table($column_header, $user_data,null,null,$query_vars);
2121
+        echo '<form method="post" action="blog.php?action=manage_members&blog_id='.$blog_id.'">';
2122
+            Display::display_sortable_table($column_header, $user_data, null, null, $query_vars);
2123 2123
             $link = '';
2124
-            $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']) . '&' : '';
2124
+            $link .= isset ($_GET['action']) ? 'action='.Security::remove_XSS($_GET['action']).'&' : '';
2125 2125
             $link .= "blog_id=$blog_id&";
2126 2126
 
2127
-            echo '<a href="blog.php?' . $link . 'selectall=subscribe">' . get_lang('SelectAll') . '</a> - ';
2128
-            echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> ';
2129
-            echo get_lang('WithSelected') . ' : ';
2127
+            echo '<a href="blog.php?'.$link.'selectall=subscribe">'.get_lang('SelectAll').'</a> - ';
2128
+            echo '<a href="blog.php?'.$link.'">'.get_lang('UnSelectAll').'</a> ';
2129
+            echo get_lang('WithSelected').' : ';
2130 2130
             echo '<select name="action">';
2131
-            echo '<option value="select_subscribe">' . get_lang('Register') . '</option>';
2131
+            echo '<option value="select_subscribe">'.get_lang('Register').'</option>';
2132 2132
             echo '</select>';
2133 2133
             echo '<input type="hidden" name="register" value="true" />';
2134
-            echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>';
2134
+            echo '<button class="save" type="submit">'.get_lang('Ok').'</button>';
2135 2135
         echo '</form>';
2136 2136
     }
2137 2137
 
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
      *
2145 2145
      * @return false|null Form with sortable table with users to unsubcribe from a blog.
2146 2146
      */
2147
-    public static function display_form_user_unsubscribe ($blog_id)
2147
+    public static function display_form_user_unsubscribe($blog_id)
2148 2148
     {
2149 2149
         $_user = api_get_user_info();
2150 2150
         $is_western_name_order = api_is_western_name_order();
@@ -2157,34 +2157,34 @@  discard block
 block discarded – undo
2157 2157
 
2158 2158
         $properties["width"] = "100%";
2159 2159
         //table column titles
2160
-        $column_header[] = array ('', false, '');
2160
+        $column_header[] = array('', false, '');
2161 2161
         if ($is_western_name_order) {
2162
-            $column_header[] = array (get_lang('FirstName'), true, '');
2163
-            $column_header[] = array (get_lang('LastName'), true, '');
2162
+            $column_header[] = array(get_lang('FirstName'), true, '');
2163
+            $column_header[] = array(get_lang('LastName'), true, '');
2164 2164
         } else {
2165
-            $column_header[] = array (get_lang('LastName'), true, '');
2166
-            $column_header[] = array (get_lang('FirstName'), true, '');
2165
+            $column_header[] = array(get_lang('LastName'), true, '');
2166
+            $column_header[] = array(get_lang('FirstName'), true, '');
2167 2167
         }
2168
-        $column_header[] = array (get_lang('Email'), false, '');
2169
-        $column_header[] = array (get_lang('TaskManager'), true, '');
2170
-        $column_header[] = array (get_lang('UnRegister'), false, '');
2168
+        $column_header[] = array(get_lang('Email'), false, '');
2169
+        $column_header[] = array(get_lang('TaskManager'), true, '');
2170
+        $column_header[] = array(get_lang('UnRegister'), false, '');
2171 2171
 
2172 2172
         $course_id = api_get_course_int_id();
2173 2173
 
2174 2174
         $sql = "SELECT user.user_id, user.lastname, user.firstname, user.email, user.username
2175 2175
                 FROM $tbl_users user INNER JOIN $tbl_blogs_rel_user blogs_rel_user
2176 2176
                 ON user.user_id = blogs_rel_user.user_id
2177
-                WHERE blogs_rel_user.c_id = $course_id AND  blogs_rel_user.blog_id = '".(int)$blog_id."'";
2177
+                WHERE blogs_rel_user.c_id = $course_id AND  blogs_rel_user.blog_id = '".(int) $blog_id."'";
2178 2178
 
2179 2179
         if (!($sql_result = Database::query($sql))) {
2180 2180
             return false;
2181 2181
         }
2182 2182
 
2183
-        $user_data = array ();
2183
+        $user_data = array();
2184 2184
 
2185 2185
         while ($myrow = Database::fetch_array($sql_result)) {
2186
-            $row = array ();
2187
-            $row[] = '<input type="checkbox" name="user[]" value="' . $myrow['user_id'] . '" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '') . '/>';
2186
+            $row = array();
2187
+            $row[] = '<input type="checkbox" name="user[]" value="'.$myrow['user_id'].'" '.((isset($_GET['selectall']) && $_GET['selectall'] == "unsubscribe") ? ' checked="checked" ' : '').'/>';
2188 2188
             $username = api_htmlentities(sprintf(get_lang('LoginX'), $myrow["username"]), ENT_QUOTES);
2189 2189
             if ($is_western_name_order) {
2190 2190
                 $row[] = $myrow["firstname"];
@@ -2196,19 +2196,19 @@  discard block
 block discarded – undo
2196 2196
             $row[] = Display::icon_mailto_link($myrow["email"]);
2197 2197
 
2198 2198
             $sql = "SELECT bt.title task
2199
-                    FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER) . " btu
2200
-                    INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS) . " bt
2199
+                    FROM " . Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)." btu
2200
+                    INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS)." bt
2201 2201
                     ON btu.task_id = bt.task_id
2202 2202
                     WHERE 	btu.c_id 	= $course_id  AND
2203 2203
                             bt.c_id 	= $course_id  AND
2204 2204
                             btu.blog_id = $blog_id AND
2205
-                            btu.user_id = " . $myrow['user_id'];
2205
+                            btu.user_id = ".$myrow['user_id'];
2206 2206
             $sql_res = Database::query($sql);
2207 2207
 
2208 2208
             $task = '';
2209 2209
 
2210
-            while($r = Database::fetch_array($sql_res)) {
2211
-                $task .= stripslashes($r['task']) . ', ';
2210
+            while ($r = Database::fetch_array($sql_res)) {
2211
+                $task .= stripslashes($r['task']).', ';
2212 2212
             }
2213 2213
             //echo $task;
2214 2214
             $task = (api_strlen(trim($task)) != 0) ? api_substr($task, 0, api_strlen($task) - 2) : get_lang('Reader');
@@ -2216,7 +2216,7 @@  discard block
 block discarded – undo
2216 2216
             //Link to register users
2217 2217
 
2218 2218
             if ($myrow["user_id"] != $_user['user_id']) {
2219
-                $row[] = "<a class=\"btn btn-primary\" href=\"" .api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=" . $myrow['user_id']."\">" . get_lang('UnRegister')."</a>";
2219
+                $row[] = "<a class=\"btn btn-primary\" href=\"".api_get_self()."?action=manage_members&blog_id=$blog_id&unregister=yes&user_id=".$myrow['user_id']."\">".get_lang('UnRegister')."</a>";
2220 2220
             } else {
2221 2221
                 $row[] = '';
2222 2222
             }
@@ -2226,20 +2226,20 @@  discard block
 block discarded – undo
2226 2226
 
2227 2227
         $query_vars['action'] = 'manage_members';
2228 2228
         $query_vars['blog_id'] = $blog_id;
2229
-        echo '<form method="post" action="blog.php?action=manage_members&blog_id=' . $blog_id . '">';
2230
-        Display::display_sortable_table($column_header, $user_data,null,null,$query_vars);
2229
+        echo '<form method="post" action="blog.php?action=manage_members&blog_id='.$blog_id.'">';
2230
+        Display::display_sortable_table($column_header, $user_data, null, null, $query_vars);
2231 2231
         $link = '';
2232
-        $link .= isset ($_GET['action']) ? 'action=' . Security::remove_XSS($_GET['action']). '&' : '';
2232
+        $link .= isset ($_GET['action']) ? 'action='.Security::remove_XSS($_GET['action']).'&' : '';
2233 2233
         $link .= "blog_id=$blog_id&";
2234 2234
 
2235
-        echo '<a href="blog.php?' . $link . 'selectall=unsubscribe">' . get_lang('SelectAll') . '</a> - ';
2236
-        echo '<a href="blog.php?' . $link . '">' . get_lang('UnSelectAll') . '</a> ';
2237
-        echo get_lang('WithSelected') . ' : ';
2235
+        echo '<a href="blog.php?'.$link.'selectall=unsubscribe">'.get_lang('SelectAll').'</a> - ';
2236
+        echo '<a href="blog.php?'.$link.'">'.get_lang('UnSelectAll').'</a> ';
2237
+        echo get_lang('WithSelected').' : ';
2238 2238
         echo '<select name="action">';
2239
-        echo '<option value="select_unsubscribe">' . get_lang('UnRegister') . '</option>';
2239
+        echo '<option value="select_unsubscribe">'.get_lang('UnRegister').'</option>';
2240 2240
         echo '</select>';
2241 2241
         echo '<input type="hidden" name="unregister" value="true" />';
2242
-        echo '<button class="save" type="submit">' . get_lang('Ok') . '</button>';
2242
+        echo '<button class="save" type="submit">'.get_lang('Ok').'</button>';
2243 2243
         echo '</form>';
2244 2244
     }
2245 2245
 
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
      *
2250 2250
      * @param Integer $blog_id
2251 2251
      */
2252
-    public static function display_form_user_rights ($blog_id)
2252
+    public static function display_form_user_rights($blog_id)
2253 2253
     {
2254 2254
         echo '<legend>'.get_lang('RightsManager').'</legend>';
2255 2255
         echo '<br />';
@@ -2270,7 +2270,7 @@  discard block
 block discarded – undo
2270 2270
         $form = new FormValidator(
2271 2271
             'add_post',
2272 2272
             'post',
2273
-            api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=" . intval($blog_id)  . "&post_id=".intval($post_id)."&".api_get_cidreq(),
2273
+            api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=".intval($blog_id)."&post_id=".intval($post_id)."&".api_get_cidreq(),
2274 2274
             null,
2275 2275
             array('enctype' => 'multipart/form-data')
2276 2276
         );
@@ -2336,21 +2336,21 @@  discard block
 block discarded – undo
2336 2336
         $course_id = api_get_course_int_id();
2337 2337
 
2338 2338
         //Handle leap year
2339
-        $numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
2339
+        $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
2340 2340
 
2341
-        if(($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
2341
+        if (($year % 400 == 0) or ($year % 4 == 0 and $year % 100 <> 0))
2342 2342
             $numberofdays[2] = 29;
2343 2343
 
2344 2344
         //Get the first day of the month
2345 2345
         $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
2346
-        $monthName = $MonthsLong[$month-1];
2346
+        $monthName = $MonthsLong[$month - 1];
2347 2347
 
2348 2348
         //Start the week on monday
2349 2349
         $startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
2350 2350
         $blogId = isset($_GET['blog_id']) ? intval($_GET['blog_id']) : null;
2351 2351
         $filter = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null;
2352
-        $backwardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 1 ? 12 : $month -1)."&year=". ($month == 1 ? $year -1 : $year);
2353
-        $forewardsURL = api_get_self()."?blog_id=" . $blogId."&filter=" . $filter."&month=". ($month == 12 ? 1 : $month +1)."&year=". ($month == 12 ? $year +1 : $year);
2352
+        $backwardsURL = api_get_self()."?blog_id=".$blogId."&filter=".$filter."&month=".($month == 1 ? 12 : $month - 1)."&year=".($month == 1 ? $year - 1 : $year);
2353
+        $forewardsURL = api_get_self()."?blog_id=".$blogId."&filter=".$filter."&month=".($month == 12 ? 1 : $month + 1)."&year=".($month == 12 ? $year + 1 : $year);
2354 2354
 
2355 2355
         // Get posts for this month
2356 2356
         $sql = "SELECT post.*, DAYOFMONTH(date_creation) as post_day, user.lastname, user.firstname
@@ -2359,15 +2359,15 @@  discard block
 block discarded – undo
2359 2359
                 ON post.author_id = user.user_id
2360 2360
                 WHERE
2361 2361
                     post.c_id = $course_id AND
2362
-                    post.blog_id = '".(int)$blog_id."' AND
2363
-                    MONTH(date_creation) = '".(int)$month."' AND
2364
-                    YEAR(date_creation) = '".(int)$year."'
2362
+                    post.blog_id = '".(int) $blog_id."' AND
2363
+                    MONTH(date_creation) = '".(int) $month."' AND
2364
+                    YEAR(date_creation) = '".(int) $year."'
2365 2365
                 ORDER BY date_creation";
2366 2366
         $result = Database::query($sql);
2367 2367
 
2368 2368
         // We will create an array of days on which there are posts.
2369
-        if( Database::num_rows($result) > 0) {
2370
-            while($blog_post = Database::fetch_array($result)) {
2369
+        if (Database::num_rows($result) > 0) {
2370
+            while ($blog_post = Database::fetch_array($result)) {
2371 2371
                 // If the day of this post is not yet in the array, add it.
2372 2372
                 if (!in_array($blog_post['post_day'], $posts))
2373 2373
                     $posts[] = $blog_post['post_day'];
@@ -2384,9 +2384,9 @@  discard block
 block discarded – undo
2384 2384
                     task_rel_user.c_id = $course_id AND
2385 2385
                     task.c_id = $course_id AND
2386 2386
                     blog.c_id = $course_id AND
2387
-                    task_rel_user.user_id = '".(int)$_user['user_id']."' AND
2388
-                    MONTH(target_date) = '".(int)$month."' AND
2389
-                    YEAR(target_date) = '".(int)$year."'
2387
+                    task_rel_user.user_id = '".(int) $_user['user_id']."' AND
2388
+                    MONTH(target_date) = '".(int) $month."' AND
2389
+                    YEAR(target_date) = '".(int) $year."'
2390 2390
                 ORDER BY target_date ASC";
2391 2391
             $result = Database::query($sql);
2392 2392
 
@@ -2409,7 +2409,7 @@  discard block
 block discarded – undo
2409 2409
 
2410 2410
         echo "<tr>";
2411 2411
 
2412
-        for($ii = 1; $ii < 8; $ii ++)
2412
+        for ($ii = 1; $ii < 8; $ii++)
2413 2413
             echo "<td class=\"weekdays\">", $DaysShort[$ii % 7], "</td>";
2414 2414
 
2415 2415
         echo "</tr>";
@@ -2419,24 +2419,24 @@  discard block
 block discarded – undo
2419 2419
 
2420 2420
         while ($curday <= $numberofdays[$month]) {
2421 2421
             echo "<tr>";
2422
-            for ($ii = 0; $ii < 7; $ii ++) {
2422
+            for ($ii = 0; $ii < 7; $ii++) {
2423 2423
                 if (($curday == -1) && ($ii == $startdayofweek))
2424 2424
                     $curday = 1;
2425 2425
 
2426 2426
                 if (($curday > 0) && ($curday <= $numberofdays[$month])) {
2427
-                    $bgcolor = $ii < 5 ? $class="class=\"days_week\"" : $class="class=\"days_weekend\"";
2427
+                    $bgcolor = $ii < 5 ? $class = "class=\"days_week\"" : $class = "class=\"days_weekend\"";
2428 2428
                     $dayheader = "$curday";
2429 2429
 
2430
-                    if(($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) {
2430
+                    if (($curday == $today['mday']) && ($year == $today['year']) && ($month == $today['mon'])) {
2431 2431
                         $dayheader = "$curday";
2432 2432
                         $class = "class=\"days_today\"";
2433 2433
                     }
2434 2434
 
2435
-                    echo "<td " . $class.">";
2435
+                    echo "<td ".$class.">";
2436 2436
 
2437 2437
                     // If there are posts on this day, create a filter link.
2438
-                    if(in_array($curday, $posts))
2439
-                        echo '<a href="blog.php?blog_id=' . $blog_id . '&filter=' . $year . '-' . $month . '-' . $curday . '&month=' . $month . '&year=' . $year . '" title="' . get_lang('ViewPostsOfThisDay') . '">' . $curday . '</a>';
2438
+                    if (in_array($curday, $posts))
2439
+                        echo '<a href="blog.php?blog_id='.$blog_id.'&filter='.$year.'-'.$month.'-'.$curday.'&month='.$month.'&year='.$year.'" title="'.get_lang('ViewPostsOfThisDay').'">'.$curday.'</a>';
2440 2440
                     else
2441 2441
                         echo $dayheader;
2442 2442
 
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
                         if (isset($tasks[$curday]) && is_array($tasks[$curday])) {
2445 2445
                             // Add tasks to calendar
2446 2446
                             foreach ($tasks[$curday] as $task) {
2447
-                                echo '<a href="blog.php?action=execute_task&blog_id=' . $task['blog_id'] . '&task_id='.stripslashes($task['task_id']) . '" title="' . $task['title'] . ' : ' . get_lang('InBlog') . ' : ' . $task['blog_name'] . ' - ' . get_lang('ExecuteThisTask') . '">';
2447
+                                echo '<a href="blog.php?action=execute_task&blog_id='.$task['blog_id'].'&task_id='.stripslashes($task['task_id']).'" title="'.$task['title'].' : '.get_lang('InBlog').' : '.$task['blog_name'].' - '.get_lang('ExecuteThisTask').'">';
2448 2448
                                 echo Display::return_icon('blog_task.gif', get_lang('ExecuteThisTask'));
2449 2449
                                 echo '</a>';
2450 2450
                             }
@@ -2452,7 +2452,7 @@  discard block
 block discarded – undo
2452 2452
                     }
2453 2453
 
2454 2454
                     echo "</td>";
2455
-                    $curday ++;
2455
+                    $curday++;
2456 2456
                 } else
2457 2457
                     echo "<td>&nbsp;</td>";
2458 2458
             }
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
     public static function display_edit_blog_form($blog_id)
2491 2491
     {
2492 2492
         $course_id = api_get_course_int_id();
2493
-        $blog_id= intval($blog_id);
2493
+        $blog_id = intval($blog_id);
2494 2494
         $tbl_blogs = Database::get_course_table(TABLE_BLOGS);
2495 2495
 
2496 2496
         $sql = "SELECT blog_id, blog_name, blog_subtitle
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
             $blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']);
2506 2506
         }
2507 2507
 
2508
-        $form = new FormValidator('edit_blog', 'post','blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id']));
2508
+        $form = new FormValidator('edit_blog', 'post', 'blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id']));
2509 2509
         $form->addElement('header', get_lang('EditBlog'));
2510 2510
         $form->addElement('text', 'blog_name', get_lang('Title'));
2511 2511
         $form->addElement('textarea', 'blog_subtitle', get_lang('SubTitle'));
@@ -2541,8 +2541,8 @@  discard block
 block discarded – undo
2541 2541
         $result = Database::query($sql);
2542 2542
         $list_info = array();
2543 2543
         if (Database::num_rows($result)) {
2544
-            while ($row_project=Database::fetch_row($result)) {
2545
-                $list_info[]=$row_project;
2544
+            while ($row_project = Database::fetch_row($result)) {
2545
+                $list_info[] = $row_project;
2546 2546
             }
2547 2547
         }
2548 2548
 
@@ -2554,35 +2554,35 @@  discard block
 block discarded – undo
2554 2554
                 // Validation when belongs to a session
2555 2555
                 $session_img = api_get_session_image($info_log[4], $_user['status']);
2556 2556
 
2557
-                $url_start_blog = 'blog.php' ."?". "blog_id=".$info_log[3]. "&".api_get_cidreq();
2557
+                $url_start_blog = 'blog.php'."?"."blog_id=".$info_log[3]."&".api_get_cidreq();
2558 2558
                 $title = $info_log[0];
2559 2559
                         $image = Display::return_icon('blog.png', $title);
2560
-                $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">' . $image . '</a></div><a href="'.$url_start_blog.'">' .$title. '</a>' . $session_img;
2560
+                $list_name = '<div style="float: left; width: 35px; height: 22px;"><a href="'.$url_start_blog.'">'.$image.'</a></div><a href="'.$url_start_blog.'">'.$title.'</a>'.$session_img;
2561 2561
 
2562 2562
                 $list_body_blog[] = $list_name;
2563 2563
                 $list_body_blog[] = $info_log[1];
2564 2564
 
2565
-                $visibility_icon=($info_log[2]==0) ? 'invisible' : 'visible';
2566
-                $visibility_info=($info_log[2]==0) ? 'Visible' : 'Invisible';
2567
-                $my_image = '<a href="' .api_get_self(). '?action=edit&blog_id=' . $info_log[3] . '">';
2568
-                                $my_image.= Display::return_icon('edit.png', get_lang('EditBlog'));
2565
+                $visibility_icon = ($info_log[2] == 0) ? 'invisible' : 'visible';
2566
+                $visibility_info = ($info_log[2] == 0) ? 'Visible' : 'Invisible';
2567
+                $my_image = '<a href="'.api_get_self().'?action=edit&blog_id='.$info_log[3].'">';
2568
+                                $my_image .= Display::return_icon('edit.png', get_lang('EditBlog'));
2569 2569
 
2570
-                $my_image.= "</a>";
2571
-                $my_image.= '<a href="' .api_get_self(). '?action=delete&blog_id=' . $info_log[3] . '" ';
2572
-                $my_image.= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >';
2573
-                                $my_image.= Display::return_icon('delete.png', get_lang('DeleteBlog'));
2570
+                $my_image .= "</a>";
2571
+                $my_image .= '<a href="'.api_get_self().'?action=delete&blog_id='.$info_log[3].'" ';
2572
+                $my_image .= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)).'\')) return false;" >';
2573
+                                $my_image .= Display::return_icon('delete.png', get_lang('DeleteBlog'));
2574 2574
 
2575
-                $my_image.= "</a>";
2576
-                $my_image.= '<a href="' .api_get_self(). '?action=visibility&blog_id=' . $info_log[3] . '">';
2577
-                                $my_image.= Display::return_icon($visibility_icon . '.gif', get_lang($visibility_info));
2575
+                $my_image .= "</a>";
2576
+                $my_image .= '<a href="'.api_get_self().'?action=visibility&blog_id='.$info_log[3].'">';
2577
+                                $my_image .= Display::return_icon($visibility_icon.'.gif', get_lang($visibility_info));
2578 2578
 
2579
-                $my_image.= "</a>";
2580
-                $list_body_blog[]=$my_image;
2581
-                $list_content_blog[]=$list_body_blog;
2579
+                $my_image .= "</a>";
2580
+                $list_body_blog[] = $my_image;
2581
+                $list_content_blog[] = $list_body_blog;
2582 2582
                 $list_body_blog = array();
2583 2583
             }
2584 2584
 
2585
-            $table = new SortableTableFromArrayConfig($list_content_blog, 1,20,'project');
2585
+            $table = new SortableTableFromArrayConfig($list_content_blog, 1, 20, 'project');
2586 2586
             $table->set_header(0, get_lang('Title'));
2587 2587
             $table->set_header(1, get_lang('SubTitle'));
2588 2588
             $table->set_header(2, get_lang('Modify'));
@@ -2607,34 +2607,34 @@  discard block
 block discarded – undo
2607 2607
  * @author Julio Montoya
2608 2608
  * @version avril 2008, dokeos 1.8.5
2609 2609
  */
2610
-function get_blog_attachment($blog_id, $post_id=null,$comment_id=null)
2610
+function get_blog_attachment($blog_id, $post_id = null, $comment_id = null)
2611 2611
 {
2612 2612
 	$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
2613 2613
 
2614 2614
 	$blog_id = intval($blog_id);
2615 2615
 	$comment_id = intval($comment_id);
2616 2616
 	$post_id = intval($post_id);
2617
-	$row=array();
2618
-	$where='';
2617
+	$row = array();
2618
+	$where = '';
2619 2619
 	if (!empty ($post_id) && is_numeric($post_id)) {
2620
-		$where.=' AND post_id ="'.$post_id.'" ';
2620
+		$where .= ' AND post_id ="'.$post_id.'" ';
2621 2621
 	}
2622 2622
 
2623 2623
 	if (!empty ($comment_id) && is_numeric($comment_id)) {
2624 2624
 		if (!empty ($post_id)) {
2625
-			$where.= ' AND ';
2625
+			$where .= ' AND ';
2626 2626
 		}
2627
-		$where.=' comment_id ="'.$comment_id.'" ';
2627
+		$where .= ' comment_id ="'.$comment_id.'" ';
2628 2628
 	}
2629 2629
 
2630 2630
     $course_id = api_get_course_int_id();
2631 2631
 
2632
-	$sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.'
2632
+	$sql = 'SELECT path, filename, comment FROM '.$blog_table_attachment.'
2633 2633
 	        WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'"  '.$where;
2634 2634
 
2635
-	$result=Database::query($sql);
2636
-	if (Database::num_rows($result)!=0) {
2637
-		$row=Database::fetch_array($result);
2635
+	$result = Database::query($sql);
2636
+	if (Database::num_rows($result) != 0) {
2637
+		$row = Database::fetch_array($result);
2638 2638
 	}
2639 2639
 	return $row;
2640 2640
 }
@@ -2674,22 +2674,22 @@  discard block
 block discarded – undo
2674 2674
     }
2675 2675
 
2676 2676
 	// delete all files in directory
2677
-	$courseDir   = $_course['path'].'/upload/blog';
2677
+	$courseDir = $_course['path'].'/upload/blog';
2678 2678
 	$sys_course_path = api_get_path(SYS_COURSE_PATH);
2679 2679
 	$updir = $sys_course_path.$courseDir;
2680 2680
 
2681 2681
 	$sql = 'SELECT path FROM '.$blog_table_attachment.'
2682 2682
 	        WHERE c_id = '.$course_id.' AND blog_id ="'.intval($blog_id).'"  '.$where;
2683
-	$result=Database::query($sql);
2683
+	$result = Database::query($sql);
2684 2684
 
2685
-	while ($row=Database::fetch_row($result)) {
2686
-		$file=$updir.'/'.$row[0];
2687
-		if (Security::check_abs_path($file,$updir) )
2685
+	while ($row = Database::fetch_row($result)) {
2686
+		$file = $updir.'/'.$row[0];
2687
+		if (Security::check_abs_path($file, $updir))
2688 2688
 		{
2689 2689
 			@ unlink($file);
2690 2690
 		}
2691 2691
 	}
2692
-	$sql = 'DELETE FROM '. $blog_table_attachment.'
2692
+	$sql = 'DELETE FROM '.$blog_table_attachment.'
2693 2693
 	        WHERE c_id = '.$course_id.' AND  blog_id ="'.intval($blog_id).'"  '.$where;
2694 2694
 	Database::query($sql);
2695 2695
 }
@@ -2719,13 +2719,13 @@  discard block
 block discarded – undo
2719 2719
 	$result = Database::query($sql);
2720 2720
 	$return_data = '';
2721 2721
 
2722
-	if (Database::num_rows($result)!=0) {
2723
-		while ($row=Database::fetch_array($result)) {
2724
-			$return_data.=  '<div class="clear"></div><br />';
2725
-			$return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png',get_lang('BlogPosts')).' '.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>';
2726
-			$return_data.=  '<br / >';
2727
-			$return_data.= $row['full_text'];
2728
-			$return_data.= '<br /><br />';
2722
+	if (Database::num_rows($result) != 0) {
2723
+		while ($row = Database::fetch_array($result)) {
2724
+			$return_data .= '<div class="clear"></div><br />';
2725
+			$return_data .= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.Display::return_icon('blog_article.png', get_lang('BlogPosts')).' '.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.$my_course_id.' " >'.get_lang('SeeBlog').'</a></div></div>';
2726
+			$return_data .= '<br / >';
2727
+			$return_data .= $row['full_text'];
2728
+			$return_data .= '<br /><br />';
2729 2729
 		}
2730 2730
 	}
2731 2731
 	return $return_data;
@@ -2755,13 +2755,13 @@  discard block
 block discarded – undo
2755 2755
 			ORDER BY blog_name";
2756 2756
 	$result = Database::query($sql);
2757 2757
 	$return_data = '';
2758
-	if (Database::num_rows($result)!=0) {
2759
-		while ($row=Database::fetch_array($result)) {
2760
-			$return_data.=  '<div class="clear"></div><br />';
2761
-			$return_data.=  '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>';
2762
-			$return_data.=  '<br / >';
2763
-			$return_data.=  $row['comment'];
2764
-			$return_data.=  '<br />';
2758
+	if (Database::num_rows($result) != 0) {
2759
+		while ($row = Database::fetch_array($result)) {
2760
+			$return_data .= '<div class="clear"></div><br />';
2761
+			$return_data .= '<div class="actions" style="margin-left:5px;margin-right:5px;">'.$row['title'].'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<div style="float:right;margin-top:-18px"><a href="../blog/blog.php?blog_id='.$row['blog_id'].'&gidReq=&cidReq='.Security::remove_XSS($course_code).' " >'.get_lang('SeeBlog').'</a></div></div>';
2762
+			$return_data .= '<br / >';
2763
+			$return_data .= $row['comment'];
2764
+			$return_data .= '<br />';
2765 2765
 		}
2766 2766
 	}
2767 2767
 	return $return_data;
Please login to merge, or discard this patch.
main/inc/lib/grade_model.lib.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -259,10 +259,10 @@
 block discarded – undo
259 259
     }
260 260
 
261 261
     /**
262
-     * @param $form
262
+     * @param CatForm $form
263 263
      * @param string $name
264 264
      * @param null $default_value
265
-     * @return bool
265
+     * @return false|null
266 266
      */
267 267
     public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', $default_value = null)
268 268
     {
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
     /**
52 52
      * Displays the title + grid
53 53
      */
54
-	public function display()
54
+    public function display()
55 55
     {
56
-		// action links
57
-		echo '<div class="actions" style="margin-bottom:20px">';
56
+        // action links
57
+        echo '<div class="actions" style="margin-bottom:20px">';
58 58
         echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'', ICON_SIZE_MEDIUM).'</a>';
59
-		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
60
-		echo '</div>';
59
+        echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
60
+        echo '</div>';
61 61
         echo Display::grid_html('grade_model');
62
-	}
62
+    }
63 63
 
64 64
     /**
65 65
      * Returns a Form validator Obj
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         $form->addElement('hidden', 'maxvalue', '100');
120
-		$form->addElement('hidden', 'minvalue', '0');
120
+        $form->addElement('hidden', 'minvalue', '0');
121 121
         $renderer = & $form->defaultRenderer();
122 122
 
123 123
         $component_array = array();
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         // Setting the rules
193 193
         $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
194 194
 
195
-		return $form;
195
+        return $form;
196 196
     }
197 197
 
198 198
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
      */
256 256
     public function delete($id)
257 257
     {
258
-	    parent::delete($id);
258
+        parent::delete($id);
259 259
     }
260 260
 
261 261
     /**
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
     /**
310 310
      * GradeModelComponents constructor.
311 311
      */
312
-	public function __construct()
312
+    public function __construct()
313 313
     {
314 314
         parent::__construct();
315 315
         $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS);
316
-	}
316
+    }
317 317
 
318 318
     /**
319 319
      * @param array $params
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function save($params, $show_query = false)
324 324
     {
325
-	    $id = parent::save($params, $show_query);
325
+        $id = parent::save($params, $show_query);
326 326
 
327 327
         return $id;
328 328
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function __construct()
17 17
     {
18 18
         parent::__construct();
19
-        $this->table =  Database::get_main_table(TABLE_GRADE_MODEL);
19
+        $this->table = Database::get_main_table(TABLE_GRADE_MODEL);
20 20
     }
21 21
 
22 22
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
 		// action links
57 57
 		echo '<div class="actions" style="margin-bottom:20px">';
58
-        echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'', ICON_SIZE_MEDIUM).'</a>';
58
+        echo '<a href="grade_models.php">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
59 59
 		echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', ICON_SIZE_MEDIUM).'</a>';
60 60
 		echo '</div>';
61 61
         echo Display::grid_html('grade_model');
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             $form->addElement('hidden', 'components['.$i.'][id]', null);
130 130
 
131 131
             $template_percentage =
132
-            '<div id=' . $i . ' style="display: '.(($i<=$nr_items)?'inline':'none').';" class="form-group">                
132
+            '<div id='.$i.' style="display: '.(($i <= $nr_items) ? 'inline' : 'none').';" class="form-group">                
133 133
                 <label for="" class="col-sm-2 control-label">
134 134
                     {label}
135 135
                 </label>
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 
144 144
             $template_title =
145 145
             '&nbsp{element} <!-- BEGIN error --> <span class="form_error">{error}</span><!-- END error -->
146
-             <a href="javascript:plusItem(' . ($counter+1) . ')">
147
-                '.Display::return_icon('add.png', get_lang('Add'), ['id' => 'plus-' . ($counter+1), 'style' => 'display: '.(($counter>=$nr_items) ? 'inline':'none') ]).'
146
+             <a href="javascript:plusItem(' . ($counter + 1).')">
147
+                '.Display::return_icon('add.png', get_lang('Add'), ['id' => 'plus-'.($counter + 1), 'style' => 'display: '.(($counter >= $nr_items) ? 'inline' : 'none')]).'
148 148
             </a>
149
-            <a href="javascript:minItem(' . ($counter) . ')">
150
-                '.Display::return_icon('delete.png', get_lang('Delete'), ['id' => 'min-' . ($counter), 'style' => 'display: '.(($counter>=$nr_items) ? 'inline':'none') ]).'
149
+            <a href="javascript:minItem(' . ($counter).')">
150
+                '.Display::return_icon('delete.png', get_lang('Delete'), ['id' => 'min-'.($counter), 'style' => 'display: '.(($counter >= $nr_items) ? 'inline' : 'none')]).'
151 151
             </a>
152 152
             </div></div>';
153 153
             $renderer->setElementTemplate($template_title, 'components['.$i.'][title]');
Please login to merge, or discard this patch.
main/attendance/attendance_add.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 // error messages
14 14
 if (isset($error)) {
15
-    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
15
+    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
16 16
 }
17 17
 
18 18
 if (!isset($error)) {
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 $form->addElement('hidden', 'sec_token', $token);
29 29
 
30 30
 $form->addText('title', get_lang('Title'), true);
31
-$form->applyFilter('title','html_filter');
31
+$form->applyFilter('title', 'html_filter');
32 32
 $form->addHtmlEditor(
33 33
     'description',
34 34
     get_lang('Description'),
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 if ((api_get_session_id() != 0 && Gradebook::is_active()) || api_get_session_id() == 0) {
42 42
     $form->addButtonAdvancedSettings('id_qualify');
43 43
 
44
-    $form->addElement('html','<div id="id_qualify_options" style="display:none">');
44
+    $form->addElement('html', '<div id="id_qualify_options" style="display:none">');
45 45
 
46 46
     // Qualify Attendance for gradebook option
47 47
     $form->addElement(
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         get_lang('QualifyAttendanceGradebook'),
52 52
         'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'
53 53
     );
54
-    $form->addElement('html','<div id="options_field" style="display:none">');
54
+    $form->addElement('html', '<div id="options_field" style="display:none">');
55 55
 
56 56
     GradebookUtils::load_gradebook_select_in_tool($form);
57 57
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
         'value="0.00" Style="width:40px" onfocus="javascript: this.select();"'
65 65
     );
66 66
     $form->applyFilter('attendance_weight', 'html_filter');
67
-    $form->addElement('html','</div>');
68
-    $form->addElement('html','</div>');
67
+    $form->addElement('html', '</div>');
68
+    $form->addElement('html', '</div>');
69 69
 }
70 70
 $form->addButtonCreate(get_lang('Save'));
71 71
 $form->display();
Please login to merge, or discard this patch.
main/attendance/attendance_edit.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 // error messages
14 14
 if (isset($error)) {
15
-    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
15
+    Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
16 16
 }
17 17
 
18 18
 if (!isset($error)) {
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
 if (Gradebook::is_active()) {
50 50
     if (!empty($attendance_qualify_title) || !empty($attendance_weight)) {
51 51
         $form->addButtonAdvancedSettings('id_qualify');
52
-        $form->addElement('html','<div id="id_qualify_options" style="display:block">');
52
+        $form->addElement('html', '<div id="id_qualify_options" style="display:block">');
53 53
         $form->addElement(
54 54
             'checkbox',
55 55
             'attendance_qualify_gradebook',
56 56
             '',
57 57
             get_lang('QualifyAttendanceGradebook'),
58
-            array('checked'=>'true','onclick'=>'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}')
58
+            array('checked'=>'true', 'onclick'=>'javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}')
59 59
         );
60
-        $form->addElement('html','<div id="options_field" style="display:block">');
60
+        $form->addElement('html', '<div id="options_field" style="display:block">');
61 61
     } else {
62 62
         $form->addButtonAdvancedSettings('id_qualify');
63
-        $form->addElement('html','<div id="id_qualify_options" style="display:none">');
63
+        $form->addElement('html', '<div id="id_qualify_options" style="display:none">');
64 64
         $form->addElement(
65 65
             'checkbox',
66 66
             'attendance_qualify_gradebook',
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             get_lang('QualifyAttendanceGradebook'),
69 69
             'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'
70 70
         );
71
-        $form->addElement('html','<div id="options_field" style="display:none">');
71
+        $form->addElement('html', '<div id="options_field" style="display:none">');
72 72
     }
73 73
     GradebookUtils::load_gradebook_select_in_tool($form);
74 74
     $form->addElement('text', 'attendance_qualify_title', get_lang('TitleColumnGradebook'));
Please login to merge, or discard this patch.