@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | // section (for the tabs) |
20 | 20 | $this_section = SECTION_COURSES; |
21 | -$current_course_tool = TOOL_WIKI; |
|
21 | +$current_course_tool = TOOL_WIKI; |
|
22 | 22 | |
23 | 23 | $course_id = api_get_course_int_id(); |
24 | 24 | $session_id = api_get_session_id(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $groupId = api_get_group_id(); |
28 | 28 | |
29 | 29 | // additional style information |
30 | -$htmlHeadXtra[] ='<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'wiki/css/default.css"/>'; |
|
30 | +$htmlHeadXtra[] = '<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'wiki/css/default.css"/>'; |
|
31 | 31 | |
32 | 32 | // javascript for advanced parameters menu |
33 | 33 | $htmlHeadXtra[] = '<script> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | //ensure this tool in groups whe it's private or deactivated |
73 | 73 | if ($group_properties['wiki_state'] == 0) { |
74 | 74 | api_not_allowed(); |
75 | - } elseif ($group_properties['wiki_state']==2) { |
|
75 | + } elseif ($group_properties['wiki_state'] == 2) { |
|
76 | 76 | if (!api_is_allowed_to_edit(false, true) and |
77 | 77 | !GroupManager :: is_user_in_group(api_get_user_id(), api_get_group_id()) |
78 | 78 | ) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $is_allowed_to_edit = api_is_allowed_to_edit(false, true); |
85 | 85 | |
86 | 86 | // The page we are dealing with |
87 | -$page = isset($_GET['title']) ? $_GET['title']: 'index'; |
|
87 | +$page = isset($_GET['title']) ? $_GET['title'] : 'index'; |
|
88 | 88 | $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'showpage'; |
89 | 89 | $view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null; |
90 | 90 |
@@ -1878,7 +1878,7 @@ discard block |
||
1878 | 1878 | $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />'; |
1879 | 1879 | if($session_id==0){ |
1880 | 1880 | $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />'; |
1881 | - }else{ |
|
1881 | + } else{ |
|
1882 | 1882 | $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />'; |
1883 | 1883 | } |
1884 | 1884 | $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />'; |
@@ -2261,8 +2261,7 @@ discard block |
||
2261 | 2261 | s1.reflink = s2.reflink AND |
2262 | 2262 | ".$groupfilter.$condition_session.")"; |
2263 | 2263 | // warning don't use group by reflink because don't return the last version |
2264 | - } |
|
2265 | - else { |
|
2264 | + } else { |
|
2266 | 2265 | $sql = " SELECT * FROM ".$tbl_wiki." s1 |
2267 | 2266 | WHERE |
2268 | 2267 | s1.c_id = $course_id AND |
@@ -3696,8 +3695,7 @@ discard block |
||
3696 | 3695 | '.api_htmlentities($obj->title).'</a>'; |
3697 | 3696 | if ($obj->user_id <>0) { |
3698 | 3697 | $row[] = UserManager::getUserProfileLink($userinfo); |
3699 | - } |
|
3700 | - else { |
|
3698 | + } else { |
|
3701 | 3699 | $row[] = get_lang('Anonymous').' ('.api_htmlentities($obj->user_ip).')'; |
3702 | 3700 | } |
3703 | 3701 | $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get()); |
@@ -3932,8 +3930,7 @@ discard block |
||
3932 | 3930 | api_htmlentities($obj->title).'</a>'; |
3933 | 3931 | if ($obj->user_id <>0) { |
3934 | 3932 | $row[] = UserManager::getUserProfileLink($userinfo); |
3935 | - } |
|
3936 | - else { |
|
3933 | + } else { |
|
3937 | 3934 | $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')'; |
3938 | 3935 | } |
3939 | 3936 | $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * This function saves a change in a wiki page |
259 | 259 | * @author Patrick Cool <[email protected]>, Ghent University |
260 | 260 | * @param array $values |
261 | - * @return language string saying that the changes are stored |
|
261 | + * @return string string saying that the changes are stored |
|
262 | 262 | **/ |
263 | 263 | public function save_wiki($values) |
264 | 264 | { |
@@ -1196,6 +1196,7 @@ discard block |
||
1196 | 1196 | * Checks if this navigation tab has to be set to active |
1197 | 1197 | * @author Patrick Cool <[email protected]>, Ghent University |
1198 | 1198 | * |
1199 | + * @param string $paramwk |
|
1199 | 1200 | * @return string html code |
1200 | 1201 | */ |
1201 | 1202 | public function is_active_navigation_tab($paramwk) |
@@ -1711,6 +1712,7 @@ discard block |
||
1711 | 1712 | |
1712 | 1713 | /** |
1713 | 1714 | * Sends pending e-mails |
1715 | + * @param string $type |
|
1714 | 1716 | */ |
1715 | 1717 | public function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='') |
1716 | 1718 | { |
@@ -2011,6 +2013,7 @@ discard block |
||
2011 | 2013 | |
2012 | 2014 | /** |
2013 | 2015 | * Exports the wiki page to PDF |
2016 | + * @param string $course_code |
|
2014 | 2017 | */ |
2015 | 2018 | public function export_to_pdf($id, $course_code) |
2016 | 2019 | { |
@@ -2478,6 +2481,7 @@ discard block |
||
2478 | 2481 | /** |
2479 | 2482 | * Draws an HTML form select with the given options |
2480 | 2483 | * |
2484 | + * @param string $name |
|
2481 | 2485 | */ |
2482 | 2486 | public function make_select($name,$values,$checked='') |
2483 | 2487 | { |
@@ -2514,7 +2518,7 @@ discard block |
||
2514 | 2518 | /** |
2515 | 2519 | * Get wiki information |
2516 | 2520 | * @param int|bool wiki id |
2517 | - * @return array wiki data |
|
2521 | + * @return string wiki data |
|
2518 | 2522 | */ |
2519 | 2523 | public function getWikiDataFromDb($id) |
2520 | 2524 | { |
@@ -2561,6 +2565,7 @@ discard block |
||
2561 | 2565 | * Get wiki information |
2562 | 2566 | * @param string wiki id |
2563 | 2567 | * @param int $courseId |
2568 | + * @param string $title |
|
2564 | 2569 | * @return array wiki data |
2565 | 2570 | */ |
2566 | 2571 | public function getPageByTitle($title, $courseId = null) |
@@ -2593,6 +2598,8 @@ discard block |
||
2593 | 2598 | * @param int $courseId |
2594 | 2599 | * @param string |
2595 | 2600 | * @param string |
2601 | + * @param string $groupfilter |
|
2602 | + * @param string $condition_session |
|
2596 | 2603 | * @return bool |
2597 | 2604 | */ |
2598 | 2605 | public function deletePage($title, $courseId, $groupfilter = null, $condition_session = null) |
@@ -3644,6 +3651,7 @@ discard block |
||
3644 | 3651 | |
3645 | 3652 | /** |
3646 | 3653 | * Show all pages |
3654 | + * @param string $action |
|
3647 | 3655 | */ |
3648 | 3656 | public function allPages($action) |
3649 | 3657 | { |
@@ -4200,7 +4208,7 @@ discard block |
||
4200 | 4208 | |
4201 | 4209 | /** |
4202 | 4210 | * Restore page |
4203 | - * @return bool |
|
4211 | + * @return false|null |
|
4204 | 4212 | */ |
4205 | 4213 | public function restorePage() |
4206 | 4214 | { |
@@ -4302,7 +4310,7 @@ discard block |
||
4302 | 4310 | } |
4303 | 4311 | |
4304 | 4312 | /** |
4305 | - * @param int|bool $wikiId |
|
4313 | + * @param false|string $wikiId |
|
4306 | 4314 | */ |
4307 | 4315 | public function setWikiData($wikiId) |
4308 | 4316 | { |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | **/ |
100 | 100 | public function links_to($input) |
101 | 101 | { |
102 | - $input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE); |
|
102 | + $input_array = preg_split("/(\[\[|\]\])/", $input, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
103 | 103 | $all_links = array(); |
104 | 104 | |
105 | 105 | foreach ($input_array as $key=>$value) { |
106 | - if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' && |
|
107 | - isset($input_array[$key+1]) && $input_array[$key+1] == ']]' |
|
106 | + if (isset($input_array[$key - 1]) && $input_array[$key - 1] == '[[' && |
|
107 | + isset($input_array[$key + 1]) && $input_array[$key + 1] == ']]' |
|
108 | 108 | ) { |
109 | 109 | if (api_strpos($value, "|") !== false) { |
110 | 110 | $full_link_array = explode("|", $value); |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | $link = trim($value); |
115 | 115 | $title = trim($value); |
116 | 116 | } |
117 | - unset($input_array[$key-1]); |
|
118 | - unset($input_array[$key+1]); |
|
117 | + unset($input_array[$key - 1]); |
|
118 | + unset($input_array[$key + 1]); |
|
119 | 119 | //replace blank spaces by _ within the links. But to remove links at the end add a blank space |
120 | - $all_links[]= Database::escape_string(str_replace(' ','_',$link)).' '; |
|
120 | + $all_links[] = Database::escape_string(str_replace(' ', '_', $link)).' '; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | $output = implode($all_links); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | **/ |
171 | 171 | public function detect_ftp_link($input) |
172 | 172 | { |
173 | - $ftplink='href="ftp'; |
|
173 | + $ftplink = 'href="ftp'; |
|
174 | 174 | $ftplinkStyle = 'class="wiki_ftp_link" href="ftp'; |
175 | 175 | $output = str_replace($ftplink, $ftplinkStyle, $input); |
176 | 176 | |
@@ -215,21 +215,21 @@ discard block |
||
215 | 215 | { |
216 | 216 | $groupId = api_get_group_id(); |
217 | 217 | //now doubles brackets |
218 | - $input_array = preg_split("/(\[\[|\]\])/",$input,-1, PREG_SPLIT_DELIM_CAPTURE); |
|
218 | + $input_array = preg_split("/(\[\[|\]\])/", $input, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
219 | 219 | |
220 | 220 | foreach ($input_array as $key => $value) { |
221 | 221 | //now doubles brackets |
222 | - if (isset($input_array[$key-1]) && $input_array[$key-1] == '[[' AND |
|
223 | - $input_array[$key+1] == ']]' |
|
222 | + if (isset($input_array[$key - 1]) && $input_array[$key - 1] == '[[' AND |
|
223 | + $input_array[$key + 1] == ']]' |
|
224 | 224 | ) { |
225 | 225 | // now full wikilink |
226 | - if (api_strpos($value, "|") !== false){ |
|
227 | - $full_link_array=explode("|", $value); |
|
228 | - $link=trim(strip_tags($full_link_array[0])); |
|
229 | - $title=trim($full_link_array[1]); |
|
226 | + if (api_strpos($value, "|") !== false) { |
|
227 | + $full_link_array = explode("|", $value); |
|
228 | + $link = trim(strip_tags($full_link_array[0])); |
|
229 | + $title = trim($full_link_array[1]); |
|
230 | 230 | } else { |
231 | - $link=trim(strip_tags($value)); |
|
232 | - $title=trim($value); |
|
231 | + $link = trim(strip_tags($value)); |
|
232 | + $title = trim($value); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | //if wikilink is homepage |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | // note: checkreflink checks if the link is still free. If it is not used then it returns true, if it is used, then it returns false. Now the title may be different |
244 | - if (self::checktitle(strtolower(str_replace(' ','_',$link)))) { |
|
244 | + if (self::checktitle(strtolower(str_replace(' ', '_', $link)))) { |
|
245 | 245 | $link = api_html_entity_decode($link); |
246 | - $input_array[$key]='<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=addnew&title='.Security::remove_XSS($link).'&group_id='.$groupId.'" class="new_wiki_link">'.$title.'</a>'; |
|
246 | + $input_array[$key] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=addnew&title='.Security::remove_XSS($link).'&group_id='.$groupId.'" class="new_wiki_link">'.$title.'</a>'; |
|
247 | 247 | } else { |
248 | - $input_array[$key]='<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=showpage&title='.urlencode(strtolower(str_replace(' ','_',$link))).'&group_id='.$groupId.'" class="wiki_link">'.$title.'</a>'; |
|
248 | + $input_array[$key] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=showpage&title='.urlencode(strtolower(str_replace(' ', '_', $link))).'&group_id='.$groupId.'" class="wiki_link">'.$title.'</a>'; |
|
249 | 249 | } |
250 | - unset($input_array[$key-1]); |
|
251 | - unset($input_array[$key+1]); |
|
250 | + unset($input_array[$key - 1]); |
|
251 | + unset($input_array[$key + 1]); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | $output = implode('', $input_array); |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | // are not made here, but through the interce buttons |
295 | 295 | |
296 | 296 | // cleaning the variables |
297 | - if (api_get_setting('htmlpurifier_wiki') == 'true'){ |
|
297 | + if (api_get_setting('htmlpurifier_wiki') == 'true') { |
|
298 | 298 | //$purifier = new HTMLPurifier(); |
299 | 299 | $values['content'] = Security::remove_XSS($values['content']); |
300 | 300 | } |
301 | - $version = intval($values['version']) + 1 ; |
|
301 | + $version = intval($values['version']) + 1; |
|
302 | 302 | $linkTo = self::links_to($values['content']); //and check links content |
303 | 303 | |
304 | 304 | //cleaning config variables |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $_clean['startdate_assig'] = null; |
322 | 322 | } |
323 | 323 | |
324 | - if (isset($values['initenddate']) && $values['initenddate']==1) { |
|
324 | + if (isset($values['initenddate']) && $values['initenddate'] == 1) { |
|
325 | 325 | $_clean['enddate_assig'] = $values['enddate_assig']; |
326 | 326 | } else { |
327 | 327 | $_clean['enddate_assig'] = null; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | if (!empty($values['max_text']) || !empty($values['max_version'])) { |
335 | - $_clean['max_text'] = $values['max_text']; |
|
335 | + $_clean['max_text'] = $values['max_text']; |
|
336 | 336 | $_clean['max_version'] = $values['max_version']; |
337 | 337 | } |
338 | 338 | |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | $groupId |
384 | 384 | ); |
385 | 385 | |
386 | - if ($values['page_id']== 0) { |
|
386 | + if ($values['page_id'] == 0) { |
|
387 | 387 | $sql = 'UPDATE '.$tbl_wiki.' SET page_id="'.$id.'" |
388 | 388 | WHERE c_id = '.$course_id.' AND iid ="'.$id.'"'; |
389 | 389 | Database::query($sql); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $_course = $this->courseInfo; |
468 | 468 | $r_user_id = api_get_user_id(); |
469 | 469 | $r_dtime = api_get_utc_datetime(); |
470 | - $r_version = $r_version+1; |
|
470 | + $r_version = $r_version + 1; |
|
471 | 471 | $r_comment = get_lang('RestoredFromVersion').': '.$c_version; |
472 | 472 | $session_id = api_get_session_id(); |
473 | 473 | $course_id = api_get_course_int_id(); |
@@ -572,9 +572,9 @@ discard block |
||
572 | 572 | // Unlike ordinary pages of pages of assignments. |
573 | 573 | // Allow create a ordinary page although there is a assignment with the same name |
574 | 574 | if ($_clean['assignment'] == 2 || $_clean['assignment'] == 1) { |
575 | - $page = str_replace(' ','_',$values['title']."_uass".$assig_user_id); |
|
575 | + $page = str_replace(' ', '_', $values['title']."_uass".$assig_user_id); |
|
576 | 576 | } else { |
577 | - $page = str_replace(' ','_',$values['title']); |
|
577 | + $page = str_replace(' ', '_', $values['title']); |
|
578 | 578 | } |
579 | 579 | $_clean['reflink'] = $page; |
580 | 580 | $_clean['title'] = trim($values['title']); |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | */ |
729 | 729 | public function setForm($form, $row = array()) |
730 | 730 | { |
731 | - $toolBar = api_is_allowed_to_edit(null,true) |
|
731 | + $toolBar = api_is_allowed_to_edit(null, true) |
|
732 | 732 | ? array('ToolbarSet' => 'Wiki', 'Width' => '100%', 'Height' => '400') |
733 | 733 | : array('ToolbarSet' => 'WikiStudent', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student'); |
734 | 734 | |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | |
740 | 740 | $form->addElement('select', 'progress', get_lang('Progress'), $progress); |
741 | 741 | |
742 | - if ((api_is_allowed_to_edit(false,true) || |
|
742 | + if ((api_is_allowed_to_edit(false, true) || |
|
743 | 743 | api_is_platform_admin()) && |
744 | 744 | isset($row['reflink']) && $row['reflink'] != 'index' |
745 | 745 | ) { |
@@ -879,13 +879,13 @@ discard block |
||
879 | 879 | if ($newtitle) { |
880 | 880 | $pageMIX = $newtitle; //display the page after it is created |
881 | 881 | } else { |
882 | - $pageMIX = $page;//display current page |
|
882 | + $pageMIX = $page; //display current page |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | $filter = null; |
886 | 886 | if (isset($_GET['view']) && $_GET['view']) { |
887 | 887 | $_clean['view'] = Database::escape_string($_GET['view']); |
888 | - $filter =' AND w.id="'.$_clean['view'].'"'; |
|
888 | + $filter = ' AND w.id="'.$_clean['view'].'"'; |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | // First, check page visibility in the first page version |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | $groupInfo = GroupManager::get_group_properties(api_get_group_id()); |
930 | 930 | |
931 | 931 | // if both are empty and we are displaying the index page then we display the default text. |
932 | - if ($row['content']=='' && $row['title']=='' && $page=='index') { |
|
932 | + if ($row['content'] == '' && $row['title'] == '' && $page == 'index') { |
|
933 | 933 | |
934 | 934 | if (api_is_allowed_to_edit(false, true) || |
935 | 935 | api_is_platform_admin() || |
@@ -937,8 +937,8 @@ discard block |
||
937 | 937 | api_is_allowed_in_course() |
938 | 938 | ) { |
939 | 939 | //Table structure for better export to pdf |
940 | - $default_table_for_content_Start='<table align="center" border="0"><tr><td align="center">'; |
|
941 | - $default_table_for_content_End='</td></tr></table>'; |
|
940 | + $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">'; |
|
941 | + $default_table_for_content_End = '</td></tr></table>'; |
|
942 | 942 | $content = $default_table_for_content_Start. |
943 | 943 | sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)). |
944 | 944 | $default_table_for_content_End; |
@@ -953,23 +953,23 @@ discard block |
||
953 | 953 | |
954 | 954 | //assignment mode: identify page type |
955 | 955 | $icon_assignment = null; |
956 | - if ($row['assignment']==1) { |
|
957 | - $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL); |
|
958 | - } elseif($row['assignment']==2) { |
|
959 | - $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); |
|
956 | + if ($row['assignment'] == 1) { |
|
957 | + $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL); |
|
958 | + } elseif ($row['assignment'] == 2) { |
|
959 | + $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | //task mode |
963 | 963 | $icon_task = null; |
964 | 964 | if (!empty($row['task'])) { |
965 | - $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL); |
|
965 | + $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | // Show page. Show page to all users if isn't hide page. Mode assignments: if student is the author, can view |
969 | 969 | if ($KeyVisibility == "1" || |
970 | 970 | api_is_allowed_to_edit(false, true) || |
971 | 971 | api_is_platform_admin() || |
972 | - ($row['assignment'] == 2 && $KeyVisibility=="0" && (api_get_user_id() == $row['user_id'])) || |
|
972 | + ($row['assignment'] == 2 && $KeyVisibility == "0" && (api_get_user_id() == $row['user_id'])) || |
|
973 | 973 | api_is_allowed_in_course() |
974 | 974 | ) { |
975 | 975 | $actionsLeft = ''; |
@@ -995,13 +995,13 @@ discard block |
||
995 | 995 | $protect_page = null; |
996 | 996 | $lock_unlock_protect = null; |
997 | 997 | // page action: protecting (locking) the page |
998 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
999 | - if (self::check_protect_page()==1) { |
|
998 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
999 | + if (self::check_protect_page() == 1) { |
|
1000 | 1000 | $protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_MEDIUM); |
1001 | - $lock_unlock_protect='unlock'; |
|
1001 | + $lock_unlock_protect = 'unlock'; |
|
1002 | 1002 | } else { |
1003 | 1003 | $protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_MEDIUM); |
1004 | - $lock_unlock_protect='lock'; |
|
1004 | + $lock_unlock_protect = 'lock'; |
|
1005 | 1005 | } |
1006 | 1006 | } |
1007 | 1007 | |
@@ -1013,13 +1013,13 @@ discard block |
||
1013 | 1013 | $visibility_page = null; |
1014 | 1014 | $lock_unlock_visibility = null; |
1015 | 1015 | //page action: visibility |
1016 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
1016 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
1017 | 1017 | if (self::check_visibility_page() == 1) { |
1018 | - $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'),'', ICON_SIZE_MEDIUM); |
|
1018 | + $visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'), '', ICON_SIZE_MEDIUM); |
|
1019 | 1019 | $lock_unlock_visibility = 'invisible'; |
1020 | 1020 | |
1021 | 1021 | } else { |
1022 | - $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'),'', ICON_SIZE_MEDIUM); |
|
1022 | + $visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'), '', ICON_SIZE_MEDIUM); |
|
1023 | 1023 | $lock_unlock_visibility = 'visible'; |
1024 | 1024 | } |
1025 | 1025 | } |
@@ -1031,11 +1031,11 @@ discard block |
||
1031 | 1031 | |
1032 | 1032 | //page action: notification |
1033 | 1033 | if (api_is_allowed_to_session_edit()) { |
1034 | - if (self::check_notify_page($page)==1) { |
|
1035 | - $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_MEDIUM); |
|
1034 | + if (self::check_notify_page($page) == 1) { |
|
1035 | + $notify_page = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_MEDIUM); |
|
1036 | 1036 | $lock_unlock_notify_page = 'unlocknotify'; |
1037 | 1037 | } else { |
1038 | - $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_MEDIUM); |
|
1038 | + $notify_page = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_MEDIUM); |
|
1039 | 1039 | $lock_unlock_notify_page = 'locknotify'; |
1040 | 1040 | } |
1041 | 1041 | } |
@@ -1047,33 +1047,33 @@ discard block |
||
1047 | 1047 | ) { |
1048 | 1048 | // menu discuss page |
1049 | 1049 | $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=discuss&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('discuss').'>'. |
1050 | - Display::return_icon('discuss.png',get_lang('DiscussThisPage'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1050 | + Display::return_icon('discuss.png', get_lang('DiscussThisPage'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | //menu history |
1054 | 1054 | $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=history&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('history').'>'. |
1055 | - Display::return_icon('history.png',get_lang('ShowPageHistory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1055 | + Display::return_icon('history.png', get_lang('ShowPageHistory'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1056 | 1056 | //menu linkspages |
1057 | 1057 | $actionsRight .= '<a href="index.php?'.api_get_cidreq().'action=links&title='.api_htmlentities(urlencode($page)).'" '.self::is_active_navigation_tab('links').'>'. |
1058 | - Display::return_icon('what_link_here.png',get_lang('LinksPages'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1058 | + Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1059 | 1059 | |
1060 | 1060 | //menu delete wikipage |
1061 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
1061 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
1062 | 1062 | $actionsRight .= '<a href="index.php?action=delete&'.api_get_cidreq().'&title='.api_htmlentities(urlencode($page)).'"'.self::is_active_navigation_tab('delete').'>'. |
1063 | - Display::return_icon('delete.png',get_lang('DeleteThisPage'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1063 | + Display::return_icon('delete.png', get_lang('DeleteThisPage'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=showpage&actionpage='.$lock_unlock_notify_page.'&title='.api_htmlentities(urlencode($page)).'">'. |
1067 | 1067 | $notify_page.'</a>'; |
1068 | 1068 | |
1069 | 1069 | // Page action: copy last version to doc area |
1070 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
1070 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
1071 | 1071 | $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export2doc&wiki_id='.$row['id'].'">'. |
1072 | 1072 | Display::return_icon('export_to_documents.png', get_lang('ExportToDocArea'), '', ICON_SIZE_MEDIUM).'</a>'; |
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | $actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf&wiki_id='.$row['id'].'">'. |
1076 | - Display::return_icon('pdf.png',get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1076 | + Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1077 | 1077 | |
1078 | 1078 | $unoconv = api_get_configuration_value('unoconv.binaries'); |
1079 | 1079 | if ($unoconv) { |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | ) |
1127 | 1127 | ); |
1128 | 1128 | |
1129 | - $footerWiki = '<div id="wikifooter">'.get_lang('Progress').': '.($row['progress']*10).'% '.get_lang('Rating').': '.$row['score'].' '.get_lang('Words').': '.self::word_count($content).'</div>'; |
|
1129 | + $footerWiki = '<div id="wikifooter">'.get_lang('Progress').': '.($row['progress'] * 10).'% '.get_lang('Rating').': '.$row['score'].' '.get_lang('Words').': '.self::word_count($content).'</div>'; |
|
1130 | 1130 | |
1131 | 1131 | echo Display::panel($pageWiki, $pageTitle, $footerWiki); |
1132 | 1132 | } //end filter visibility |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | |
1151 | 1151 | # strip all html tags |
1152 | 1152 | $wc = strip_tags($document); |
1153 | - $wc = html_entity_decode($wc, ENT_NOQUOTES, 'UTF-8');// TODO:test also old html_entity_decode(utf8_encode($wc)) |
|
1153 | + $wc = html_entity_decode($wc, ENT_NOQUOTES, 'UTF-8'); // TODO:test also old html_entity_decode(utf8_encode($wc)) |
|
1154 | 1154 | |
1155 | 1155 | # remove 'words' that don't consist of alphanumerical characters or punctuation. And fix accents and some letters |
1156 | 1156 | $pattern = "#[^(\w|\d|\'|\"|\.|\!|\?|;|,|\\|\/|\-|:|\&|@|á|é|í|ó|ú|à|è|ì|ò|ù|ä|ë|ï|ö|ü|Á|É|Í|Ó|Ú|À|È|Ò|Ù|Ä|Ë|Ï|Ö|Ü|â|ê|î|ô|û|Â|Ê|Î|Ô|Û|ñ|Ñ|ç|Ç)]+#"; |
@@ -1183,15 +1183,15 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | $course_id = api_get_course_int_id(); |
1185 | 1185 | |
1186 | - $sql='SELECT id FROM '.$tbl_wiki.' |
|
1186 | + $sql = 'SELECT id FROM '.$tbl_wiki.' |
|
1187 | 1187 | WHERE |
1188 | 1188 | c_id = '.$course_id.' AND |
1189 | 1189 | title="'.Database::escape_string($title).'" AND |
1190 | 1190 | '.$groupfilter.$condition_session.' |
1191 | 1191 | ORDER BY id ASC'; |
1192 | - $result=Database::query($sql); |
|
1193 | - $cant=Database::num_rows($result); |
|
1194 | - if ($cant>0) { |
|
1192 | + $result = Database::query($sql); |
|
1193 | + $cant = Database::num_rows($result); |
|
1194 | + if ($cant > 0) { |
|
1195 | 1195 | return true; |
1196 | 1196 | } else { |
1197 | 1197 | return false; |
@@ -1273,20 +1273,20 @@ discard block |
||
1273 | 1273 | $page = $this->page; |
1274 | 1274 | |
1275 | 1275 | $course_id = api_get_course_int_id(); |
1276 | - $sql='SELECT * FROM '.$tbl_wiki.' |
|
1276 | + $sql = 'SELECT * FROM '.$tbl_wiki.' |
|
1277 | 1277 | WHERE |
1278 | 1278 | c_id = '.$course_id.' AND |
1279 | 1279 | reflink="'.Database::escape_string($page).'" AND |
1280 | 1280 | '.$groupfilter.$condition_session.' |
1281 | 1281 | ORDER BY id ASC'; |
1282 | 1282 | |
1283 | - $result=Database::query($sql); |
|
1284 | - $row=Database::fetch_array($result); |
|
1283 | + $result = Database::query($sql); |
|
1284 | + $row = Database::fetch_array($result); |
|
1285 | 1285 | $status_editlock = $row['editlock']; |
1286 | 1286 | $id = $row['page_id']; |
1287 | 1287 | |
1288 | 1288 | ///change status |
1289 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
1289 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
1290 | 1290 | if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lock' && $status_editlock == 0) { |
1291 | 1291 | $status_editlock = 1; |
1292 | 1292 | } |
@@ -1298,13 +1298,13 @@ discard block |
||
1298 | 1298 | WHERE c_id = '.$course_id.' AND page_id="'.$id.'"'; |
1299 | 1299 | Database::query($sql); |
1300 | 1300 | |
1301 | - $sql='SELECT * FROM '.$tbl_wiki.' |
|
1301 | + $sql = 'SELECT * FROM '.$tbl_wiki.' |
|
1302 | 1302 | WHERE |
1303 | 1303 | c_id = '.$course_id.' AND |
1304 | 1304 | reflink="'.Database::escape_string($page).'" AND |
1305 | 1305 | '.$groupfilter.$condition_session.' |
1306 | 1306 | ORDER BY id ASC'; |
1307 | - $result=Database::query($sql); |
|
1307 | + $result = Database::query($sql); |
|
1308 | 1308 | $row = Database::fetch_array($result); |
1309 | 1309 | } |
1310 | 1310 | |
@@ -1335,13 +1335,13 @@ discard block |
||
1335 | 1335 | $row = Database::fetch_array($result); |
1336 | 1336 | $status_visibility = $row['visibility']; |
1337 | 1337 | //change status |
1338 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
1339 | - if (isset($_GET['actionpage']) && $_GET['actionpage']=='visible' && $status_visibility==0) { |
|
1340 | - $status_visibility=1; |
|
1338 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
1339 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'visible' && $status_visibility == 0) { |
|
1340 | + $status_visibility = 1; |
|
1341 | 1341 | |
1342 | 1342 | } |
1343 | - if (isset($_GET['actionpage']) && $_GET['actionpage']=='invisible' && $status_visibility==1) { |
|
1344 | - $status_visibility=0; |
|
1343 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'invisible' && $status_visibility == 1) { |
|
1344 | + $status_visibility = 0; |
|
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | $sql = 'UPDATE '.$tbl_wiki.' SET visibility="'.Database::escape_string($status_visibility).'" |
@@ -1358,12 +1358,12 @@ discard block |
||
1358 | 1358 | reflink="'.Database::escape_string($page).'" AND |
1359 | 1359 | '.$groupfilter.$condition_session.' |
1360 | 1360 | ORDER BY id ASC'; |
1361 | - $result=Database::query($sql); |
|
1361 | + $result = Database::query($sql); |
|
1362 | 1362 | $row = Database::fetch_array($result); |
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | if (empty($row['id'])) { |
1366 | - $row['visibility']= 1; |
|
1366 | + $row['visibility'] = 1; |
|
1367 | 1367 | } |
1368 | 1368 | |
1369 | 1369 | //show status |
@@ -1390,18 +1390,18 @@ discard block |
||
1390 | 1390 | reflink="'.Database::escape_string($page).'" AND |
1391 | 1391 | '.$groupfilter.$condition_session.' |
1392 | 1392 | ORDER BY id ASC'; |
1393 | - $result=Database::query($sql); |
|
1394 | - $row=Database::fetch_array($result); |
|
1393 | + $result = Database::query($sql); |
|
1394 | + $row = Database::fetch_array($result); |
|
1395 | 1395 | |
1396 | 1396 | $status_visibility_disc = $row['visibility_disc']; |
1397 | 1397 | |
1398 | 1398 | //change status |
1399 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
1400 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='showdisc' && $status_visibility_disc==0) { |
|
1401 | - $status_visibility_disc=1; |
|
1399 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
1400 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'showdisc' && $status_visibility_disc == 0) { |
|
1401 | + $status_visibility_disc = 1; |
|
1402 | 1402 | } |
1403 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='hidedisc' && $status_visibility_disc==1) { |
|
1404 | - $status_visibility_disc=0; |
|
1403 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'hidedisc' && $status_visibility_disc == 1) { |
|
1404 | + $status_visibility_disc = 0; |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | 1407 | $sql = 'UPDATE '.$tbl_wiki.' SET visibility_disc="'.Database::escape_string($status_visibility_disc).'" |
@@ -1449,14 +1449,14 @@ discard block |
||
1449 | 1449 | $result = Database::query($sql); |
1450 | 1450 | $row = Database::fetch_array($result); |
1451 | 1451 | |
1452 | - $status_addlock_disc=$row['addlock_disc']; |
|
1452 | + $status_addlock_disc = $row['addlock_disc']; |
|
1453 | 1453 | |
1454 | 1454 | //change status |
1455 | 1455 | if (api_is_allowed_to_edit() || api_is_platform_admin()) { |
1456 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockdisc' && $status_addlock_disc==0) { |
|
1456 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockdisc' && $status_addlock_disc == 0) { |
|
1457 | 1457 | $status_addlock_disc = 1; |
1458 | 1458 | } |
1459 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlockdisc' && $status_addlock_disc==1) { |
|
1459 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockdisc' && $status_addlock_disc == 1) { |
|
1460 | 1460 | $status_addlock_disc = 0; |
1461 | 1461 | } |
1462 | 1462 | |
@@ -1478,8 +1478,8 @@ discard block |
||
1478 | 1478 | reflink="'.Database::escape_string($page).'" AND |
1479 | 1479 | '.$groupfilter.$condition_session.' |
1480 | 1480 | ORDER BY id ASC'; |
1481 | - $result=Database::query($sql); |
|
1482 | - $row=Database::fetch_array($result); |
|
1481 | + $result = Database::query($sql); |
|
1482 | + $row = Database::fetch_array($result); |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | 1485 | return $row['addlock_disc']; |
@@ -1504,17 +1504,17 @@ discard block |
||
1504 | 1504 | reflink="'.Database::escape_string($page).'" AND |
1505 | 1505 | '.$groupfilter.$condition_session.' |
1506 | 1506 | ORDER BY id ASC'; |
1507 | - $result=Database::query($sql); |
|
1508 | - $row=Database::fetch_array($result); |
|
1509 | - $status_ratinglock_disc=$row['ratinglock_disc']; |
|
1507 | + $result = Database::query($sql); |
|
1508 | + $row = Database::fetch_array($result); |
|
1509 | + $status_ratinglock_disc = $row['ratinglock_disc']; |
|
1510 | 1510 | |
1511 | 1511 | //change status |
1512 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
1513 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='lockrating' && $status_ratinglock_disc==0) { |
|
1514 | - $status_ratinglock_disc=1; |
|
1512 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
1513 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'lockrating' && $status_ratinglock_disc == 0) { |
|
1514 | + $status_ratinglock_disc = 1; |
|
1515 | 1515 | } |
1516 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlockrating' && $status_ratinglock_disc==1) { |
|
1517 | - $status_ratinglock_disc=0; |
|
1516 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlockrating' && $status_ratinglock_disc == 1) { |
|
1517 | + $status_ratinglock_disc = 0; |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | $sql = 'UPDATE '.$tbl_wiki.' |
@@ -1530,14 +1530,14 @@ discard block |
||
1530 | 1530 | // these three lines remain necessary. They do that by changing the |
1531 | 1531 | // page state is made when you press the button and not have to wait |
1532 | 1532 | // to change his page |
1533 | - $sql='SELECT * FROM '.$tbl_wiki.' |
|
1533 | + $sql = 'SELECT * FROM '.$tbl_wiki.' |
|
1534 | 1534 | WHERE |
1535 | 1535 | c_id = '.$course_id.' AND |
1536 | 1536 | reflink="'.Database::escape_string($page).'" AND |
1537 | 1537 | '.$groupfilter.$condition_session.' |
1538 | 1538 | ORDER BY id ASC'; |
1539 | - $result=Database::query($sql); |
|
1540 | - $row=Database::fetch_array($result); |
|
1539 | + $result = Database::query($sql); |
|
1540 | + $row = Database::fetch_array($result); |
|
1541 | 1541 | } |
1542 | 1542 | |
1543 | 1543 | return $row['ratinglock_disc']; |
@@ -1562,24 +1562,24 @@ discard block |
||
1562 | 1562 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
1563 | 1563 | WHERE c_id = '.$course_id.' AND reflink="'.$reflink.'" AND '.$groupfilter.$condition_session.' |
1564 | 1564 | ORDER BY id ASC'; |
1565 | - $result=Database::query($sql); |
|
1566 | - $row=Database::fetch_array($result); |
|
1565 | + $result = Database::query($sql); |
|
1566 | + $row = Database::fetch_array($result); |
|
1567 | 1567 | $id = $row['id']; |
1568 | - $sql='SELECT * FROM '.$tbl_wiki_mailcue.' |
|
1568 | + $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.' |
|
1569 | 1569 | WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="P"'; |
1570 | - $result=Database::query($sql); |
|
1571 | - $row=Database::fetch_array($result); |
|
1570 | + $result = Database::query($sql); |
|
1571 | + $row = Database::fetch_array($result); |
|
1572 | 1572 | |
1573 | 1573 | $idm = $row['id']; |
1574 | 1574 | |
1575 | 1575 | if (empty($idm)) { |
1576 | - $status_notify=0; |
|
1576 | + $status_notify = 0; |
|
1577 | 1577 | } else { |
1578 | - $status_notify=1; |
|
1578 | + $status_notify = 1; |
|
1579 | 1579 | } |
1580 | 1580 | |
1581 | 1581 | // Change status |
1582 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotify' && $status_notify==0) { |
|
1582 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotify' && $status_notify == 0) { |
|
1583 | 1583 | $sql = "SELECT id FROM $tbl_wiki_mailcue |
1584 | 1584 | WHERE c_id = $course_id AND id = $id AND user_id = $userId"; |
1585 | 1585 | $result = Database::query($sql); |
@@ -1588,18 +1588,18 @@ discard block |
||
1588 | 1588 | $exist = true; |
1589 | 1589 | } |
1590 | 1590 | if ($exist == false) { |
1591 | - $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES |
|
1591 | + $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES |
|
1592 | 1592 | ($course_id, '".$id."','".api_get_user_id()."','P','".$groupId."','".$session_id."')"; |
1593 | 1593 | Database::query($sql); |
1594 | 1594 | } |
1595 | - $status_notify=1; |
|
1595 | + $status_notify = 1; |
|
1596 | 1596 | } |
1597 | 1597 | |
1598 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotify' && $status_notify==1) { |
|
1598 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlocknotify' && $status_notify == 1) { |
|
1599 | 1599 | $sql = 'DELETE FROM '.$tbl_wiki_mailcue.' |
1600 | 1600 | WHERE id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="P" AND c_id = '.$course_id; |
1601 | 1601 | Database::query($sql); |
1602 | - $status_notify=0; |
|
1602 | + $status_notify = 0; |
|
1603 | 1603 | } |
1604 | 1604 | |
1605 | 1605 | return $status_notify; |
@@ -1625,9 +1625,9 @@ discard block |
||
1625 | 1625 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
1626 | 1626 | WHERE c_id = '.$course_id.' AND reflink="'.$reflink.'" AND '.$groupfilter.$condition_session.' |
1627 | 1627 | ORDER BY id ASC'; |
1628 | - $result=Database::query($sql); |
|
1629 | - $row=Database::fetch_array($result); |
|
1630 | - $id=$row['id']; |
|
1628 | + $result = Database::query($sql); |
|
1629 | + $row = Database::fetch_array($result); |
|
1630 | + $id = $row['id']; |
|
1631 | 1631 | $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.' |
1632 | 1632 | WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D"'; |
1633 | 1633 | $result = Database::query($sql); |
@@ -1635,23 +1635,23 @@ discard block |
||
1635 | 1635 | $idm = $row['id']; |
1636 | 1636 | |
1637 | 1637 | if (empty($idm)) { |
1638 | - $status_notify_disc=0; |
|
1638 | + $status_notify_disc = 0; |
|
1639 | 1639 | } else { |
1640 | - $status_notify_disc=1; |
|
1640 | + $status_notify_disc = 1; |
|
1641 | 1641 | } |
1642 | 1642 | |
1643 | 1643 | //change status |
1644 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotifydisc' && $status_notify_disc==0) { |
|
1645 | - $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES |
|
1644 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotifydisc' && $status_notify_disc == 0) { |
|
1645 | + $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, id, user_id, type, group_id, session_id) VALUES |
|
1646 | 1646 | ($course_id, '".$id."','".api_get_user_id()."','D','".$groupId."','".$session_id."')"; |
1647 | 1647 | Database::query($sql); |
1648 | - $status_notify_disc=1; |
|
1648 | + $status_notify_disc = 1; |
|
1649 | 1649 | } |
1650 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='unlocknotifydisc' && $status_notify_disc==1) { |
|
1650 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'unlocknotifydisc' && $status_notify_disc == 1) { |
|
1651 | 1651 | $sql = 'DELETE FROM '.$tbl_wiki_mailcue.' |
1652 | 1652 | WHERE c_id = '.$course_id.' AND id="'.$id.'" AND user_id="'.api_get_user_id().'" AND type="D" AND c_id = '.$course_id; |
1653 | 1653 | Database::query($sql); |
1654 | - $status_notify_disc=0; |
|
1654 | + $status_notify_disc = 0; |
|
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | return $status_notify_disc; |
@@ -1666,7 +1666,7 @@ discard block |
||
1666 | 1666 | $tbl_wiki_mailcue = $this->tbl_wiki_mailcue; |
1667 | 1667 | $course_id = api_get_course_int_id(); |
1668 | 1668 | $groupId = api_get_group_id(); |
1669 | - $session_id=api_get_session_id(); |
|
1669 | + $session_id = api_get_session_id(); |
|
1670 | 1670 | |
1671 | 1671 | $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.' |
1672 | 1672 | WHERE |
@@ -1675,31 +1675,31 @@ discard block |
||
1675 | 1675 | type="F" AND |
1676 | 1676 | group_id="'.$groupId.'" AND |
1677 | 1677 | session_id="'.$session_id.'"'; |
1678 | - $result=Database::query($sql); |
|
1679 | - $row=Database::fetch_array($result); |
|
1678 | + $result = Database::query($sql); |
|
1679 | + $row = Database::fetch_array($result); |
|
1680 | 1680 | |
1681 | - $idm=$row['user_id']; |
|
1681 | + $idm = $row['user_id']; |
|
1682 | 1682 | |
1683 | 1683 | if (empty($idm)) { |
1684 | - $status_notify_all=0; |
|
1684 | + $status_notify_all = 0; |
|
1685 | 1685 | } else { |
1686 | - $status_notify_all=1; |
|
1686 | + $status_notify_all = 1; |
|
1687 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | //change status |
1690 | - if (isset($_GET['actionpage']) && $_GET['actionpage'] =='locknotifyall' && $status_notify_all==0) { |
|
1691 | - $sql="INSERT INTO ".$tbl_wiki_mailcue." (c_id, user_id, type, group_id, session_id) VALUES |
|
1690 | + if (isset($_GET['actionpage']) && $_GET['actionpage'] == 'locknotifyall' && $status_notify_all == 0) { |
|
1691 | + $sql = "INSERT INTO ".$tbl_wiki_mailcue." (c_id, user_id, type, group_id, session_id) VALUES |
|
1692 | 1692 | ($course_id, '".api_get_user_id()."','F','".$groupId."','".$session_id."')"; |
1693 | 1693 | Database::query($sql); |
1694 | - $status_notify_all=1; |
|
1694 | + $status_notify_all = 1; |
|
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | if (isset($_GET['actionpage']) && |
1698 | 1698 | isset($_GET['actionpage']) && |
1699 | - $_GET['actionpage'] =='unlocknotifyall' && |
|
1699 | + $_GET['actionpage'] == 'unlocknotifyall' && |
|
1700 | 1700 | $status_notify_all == 1 |
1701 | 1701 | ) { |
1702 | - $sql ='DELETE FROM '.$tbl_wiki_mailcue.' |
|
1702 | + $sql = 'DELETE FROM '.$tbl_wiki_mailcue.' |
|
1703 | 1703 | WHERE |
1704 | 1704 | c_id = '.$course_id.' AND |
1705 | 1705 | user_id="'.api_get_user_id().'" AND |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | session_id="'.$session_id.'" AND |
1709 | 1709 | c_id = '.$course_id; |
1710 | 1710 | Database::query($sql); |
1711 | - $status_notify_all=0; |
|
1711 | + $status_notify_all = 0; |
|
1712 | 1712 | } |
1713 | 1713 | |
1714 | 1714 | //show status |
@@ -1718,7 +1718,7 @@ discard block |
||
1718 | 1718 | /** |
1719 | 1719 | * Sends pending e-mails |
1720 | 1720 | */ |
1721 | - public function check_emailcue($id_or_ref, $type, $lastime='', $lastuser='') |
|
1721 | + public function check_emailcue($id_or_ref, $type, $lastime = '', $lastuser = '') |
|
1722 | 1722 | { |
1723 | 1723 | $tbl_wiki_mailcue = $this->tbl_wiki_mailcue; |
1724 | 1724 | $tbl_wiki = $this->tbl_wiki; |
@@ -1726,14 +1726,14 @@ discard block |
||
1726 | 1726 | $groupfilter = $this->groupfilter; |
1727 | 1727 | $_course = $this->courseInfo; |
1728 | 1728 | $groupId = api_get_group_id(); |
1729 | - $session_id=api_get_session_id(); |
|
1729 | + $session_id = api_get_session_id(); |
|
1730 | 1730 | $course_id = api_get_course_int_id(); |
1731 | 1731 | |
1732 | - $group_properties = GroupManager :: get_group_properties($groupId); |
|
1732 | + $group_properties = GroupManager :: get_group_properties($groupId); |
|
1733 | 1733 | $group_name = $group_properties['name']; |
1734 | 1734 | $allow_send_mail = false; //define the variable to below |
1735 | 1735 | $email_assignment = null; |
1736 | - if ($type=='P') { |
|
1736 | + if ($type == 'P') { |
|
1737 | 1737 | //if modifying a wiki page |
1738 | 1738 | //first, current author and time |
1739 | 1739 | //Who is the author? |
@@ -1744,22 +1744,22 @@ discard block |
||
1744 | 1744 | $year = substr($lastime, 0, 4); |
1745 | 1745 | $month = substr($lastime, 5, 2); |
1746 | 1746 | $day = substr($lastime, 8, 2); |
1747 | - $hours=substr($lastime, 11,2); |
|
1748 | - $minutes=substr($lastime, 14,2); |
|
1749 | - $seconds=substr($lastime, 17,2); |
|
1750 | - $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds; |
|
1747 | + $hours = substr($lastime, 11, 2); |
|
1748 | + $minutes = substr($lastime, 14, 2); |
|
1749 | + $seconds = substr($lastime, 17, 2); |
|
1750 | + $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds; |
|
1751 | 1751 | |
1752 | 1752 | //second, extract data from first reg |
1753 | 1753 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
1754 | 1754 | WHERE c_id = '.$course_id.' AND reflink="'.$id_or_ref.'" AND '.$groupfilter.$condition_session.' |
1755 | 1755 | ORDER BY id ASC'; |
1756 | - $result=Database::query($sql); |
|
1757 | - $row=Database::fetch_array($result); |
|
1756 | + $result = Database::query($sql); |
|
1757 | + $row = Database::fetch_array($result); |
|
1758 | 1758 | |
1759 | - $id=$row['id']; |
|
1760 | - $email_page_name=$row['title']; |
|
1761 | - if ($row['visibility']==1) { |
|
1762 | - $allow_send_mail=true; //if visibility off - notify off |
|
1759 | + $id = $row['id']; |
|
1760 | + $email_page_name = $row['title']; |
|
1761 | + if ($row['visibility'] == 1) { |
|
1762 | + $allow_send_mail = true; //if visibility off - notify off |
|
1763 | 1763 | $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.' |
1764 | 1764 | WHERE |
1765 | 1765 | c_id = '.$course_id.' AND |
@@ -1769,10 +1769,10 @@ discard block |
||
1769 | 1769 | group_id="'.$groupId.'" AND |
1770 | 1770 | session_id="'.$session_id.'"'; |
1771 | 1771 | //type: P=page, D=discuss, F=full. |
1772 | - $result=Database::query($sql); |
|
1773 | - $emailtext=get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki'); |
|
1772 | + $result = Database::query($sql); |
|
1773 | + $emailtext = get_lang('EmailWikipageModified').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki'); |
|
1774 | 1774 | } |
1775 | - } elseif ($type=='D') { |
|
1775 | + } elseif ($type == 'D') { |
|
1776 | 1776 | //if added a post to discuss |
1777 | 1777 | |
1778 | 1778 | //first, current author and time |
@@ -1784,25 +1784,25 @@ discard block |
||
1784 | 1784 | $year = substr($lastime, 0, 4); |
1785 | 1785 | $month = substr($lastime, 5, 2); |
1786 | 1786 | $day = substr($lastime, 8, 2); |
1787 | - $hours=substr($lastime, 11,2); |
|
1788 | - $minutes=substr($lastime, 14,2); |
|
1789 | - $seconds=substr($lastime, 17,2); |
|
1790 | - $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds; |
|
1787 | + $hours = substr($lastime, 11, 2); |
|
1788 | + $minutes = substr($lastime, 14, 2); |
|
1789 | + $seconds = substr($lastime, 17, 2); |
|
1790 | + $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds; |
|
1791 | 1791 | |
1792 | 1792 | //second, extract data from first reg |
1793 | 1793 | |
1794 | - $id=$id_or_ref; //$id_or_ref is id from tblwiki |
|
1794 | + $id = $id_or_ref; //$id_or_ref is id from tblwiki |
|
1795 | 1795 | |
1796 | 1796 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
1797 | 1797 | WHERE c_id = '.$course_id.' AND id="'.$id.'" |
1798 | 1798 | ORDER BY id ASC'; |
1799 | 1799 | |
1800 | - $result=Database::query($sql); |
|
1801 | - $row=Database::fetch_array($result); |
|
1800 | + $result = Database::query($sql); |
|
1801 | + $row = Database::fetch_array($result); |
|
1802 | 1802 | |
1803 | - $email_page_name=$row['title']; |
|
1804 | - if ($row['visibility_disc']==1) { |
|
1805 | - $allow_send_mail=true; //if visibility off - notify off |
|
1803 | + $email_page_name = $row['title']; |
|
1804 | + if ($row['visibility_disc'] == 1) { |
|
1805 | + $allow_send_mail = true; //if visibility off - notify off |
|
1806 | 1806 | $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.' |
1807 | 1807 | WHERE |
1808 | 1808 | c_id = '.$course_id.' AND |
@@ -1813,22 +1813,22 @@ discard block |
||
1813 | 1813 | session_id="'.$session_id.'"'; |
1814 | 1814 | //type: P=page, D=discuss, F=full |
1815 | 1815 | $result = Database::query($sql); |
1816 | - $emailtext=get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki'); |
|
1816 | + $emailtext = get_lang('EmailWikiPageDiscAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('Wiki'); |
|
1817 | 1817 | } |
1818 | - } elseif($type=='A') { |
|
1818 | + } elseif ($type == 'A') { |
|
1819 | 1819 | //for added pages |
1820 | - $id=0; //for tbl_wiki_mailcue |
|
1820 | + $id = 0; //for tbl_wiki_mailcue |
|
1821 | 1821 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
1822 | 1822 | WHERE c_id = '.$course_id.' |
1823 | 1823 | ORDER BY id DESC'; //the added is always the last |
1824 | 1824 | |
1825 | - $result=Database::query($sql); |
|
1826 | - $row=Database::fetch_array($result); |
|
1827 | - $email_page_name=$row['title']; |
|
1825 | + $result = Database::query($sql); |
|
1826 | + $row = Database::fetch_array($result); |
|
1827 | + $email_page_name = $row['title']; |
|
1828 | 1828 | |
1829 | 1829 | //Who is the author? |
1830 | 1830 | $userinfo = api_get_user_info($row['user_id']); |
1831 | - $email_user_author= get_lang('AddedBy').': '.$userinfo['complete_name']; |
|
1831 | + $email_user_author = get_lang('AddedBy').': '.$userinfo['complete_name']; |
|
1832 | 1832 | |
1833 | 1833 | //When ? |
1834 | 1834 | $year = substr($row['dtime'], 0, 4); |
@@ -1837,33 +1837,33 @@ discard block |
||
1837 | 1837 | $hours = substr($row['dtime'], 11, 2); |
1838 | 1838 | $minutes = substr($row['dtime'], 14, 2); |
1839 | 1839 | $seconds = substr($row['dtime'], 17, 2); |
1840 | - $email_date_changes=$day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds; |
|
1841 | - |
|
1842 | - if($row['assignment']==0) { |
|
1843 | - $allow_send_mail=true; |
|
1844 | - } elseif($row['assignment']==1) { |
|
1845 | - $email_assignment=get_lang('AssignmentDescExtra').' ('.get_lang('AssignmentMode').')'; |
|
1846 | - $allow_send_mail=true; |
|
1847 | - } elseif($row['assignment']==2) { |
|
1848 | - $allow_send_mail=false; //Mode tasks: avoids notifications to all users about all users |
|
1840 | + $email_date_changes = $day.' '.$month.' '.$year.' '.$hours.":".$minutes.":".$seconds; |
|
1841 | + |
|
1842 | + if ($row['assignment'] == 0) { |
|
1843 | + $allow_send_mail = true; |
|
1844 | + } elseif ($row['assignment'] == 1) { |
|
1845 | + $email_assignment = get_lang('AssignmentDescExtra').' ('.get_lang('AssignmentMode').')'; |
|
1846 | + $allow_send_mail = true; |
|
1847 | + } elseif ($row['assignment'] == 2) { |
|
1848 | + $allow_send_mail = false; //Mode tasks: avoids notifications to all users about all users |
|
1849 | 1849 | } |
1850 | 1850 | |
1851 | 1851 | $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.' |
1852 | 1852 | WHERE c_id = '.$course_id.' AND id="'.$id.'" AND type="F" AND group_id="'.$groupId.'" AND session_id="'.$session_id.'"'; |
1853 | 1853 | //type: P=page, D=discuss, F=full |
1854 | - $result=Database::query($sql); |
|
1854 | + $result = Database::query($sql); |
|
1855 | 1855 | |
1856 | - $emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '. get_lang('Wiki'); |
|
1857 | - } elseif ($type=='E') { |
|
1858 | - $id=0; |
|
1859 | - $allow_send_mail=true; |
|
1856 | + $emailtext = get_lang('EmailWikiPageAdded').' <strong>'.$email_page_name.'</strong> '.get_lang('In').' '.get_lang('Wiki'); |
|
1857 | + } elseif ($type == 'E') { |
|
1858 | + $id = 0; |
|
1859 | + $allow_send_mail = true; |
|
1860 | 1860 | |
1861 | 1861 | //Who is the author? |
1862 | - $userinfo = api_get_user_info(api_get_user_id()); //current user |
|
1862 | + $userinfo = api_get_user_info(api_get_user_id()); //current user |
|
1863 | 1863 | $email_user_author = get_lang('DeletedBy').': '.$userinfo['complete_name']; |
1864 | 1864 | //When ? |
1865 | - $today = date('r'); //current time |
|
1866 | - $email_date_changes=$today; |
|
1865 | + $today = date('r'); //current time |
|
1866 | + $email_date_changes = $today; |
|
1867 | 1867 | |
1868 | 1868 | $sql = 'SELECT * FROM '.$tbl_wiki_mailcue.' |
1869 | 1869 | WHERE |
@@ -1877,16 +1877,16 @@ discard block |
||
1877 | 1877 | ///make and send email |
1878 | 1878 | if ($allow_send_mail) { |
1879 | 1879 | while ($row = Database::fetch_array($result)) { |
1880 | - $userinfo = api_get_user_info($row['user_id']); //$row['user_id'] obtained from tbl_wiki_mailcue |
|
1880 | + $userinfo = api_get_user_info($row['user_id']); //$row['user_id'] obtained from tbl_wiki_mailcue |
|
1881 | 1881 | $name_to = $userinfo['complete_name']; |
1882 | 1882 | $email_to = $userinfo['email']; |
1883 | 1883 | $sender_name = api_get_setting('emailAdministrator'); |
1884 | 1884 | $sender_email = api_get_setting('emailAdministrator'); |
1885 | 1885 | $email_subject = get_lang('EmailWikiChanges').' - '.$_course['official_code']; |
1886 | 1886 | $email_body = get_lang('DearUser').' '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).',<br /><br />'; |
1887 | - if($session_id==0){ |
|
1887 | + if ($session_id == 0) { |
|
1888 | 1888 | $email_body .= $emailtext.' <strong>'.$_course['name'].' - '.$group_name.'</strong><br /><br /><br />'; |
1889 | - }else{ |
|
1889 | + } else { |
|
1890 | 1890 | $email_body .= $emailtext.' <strong>'.$_course['name'].' ('.api_get_session_name(api_get_session_id()).') - '.$group_name.'</strong><br /><br /><br />'; |
1891 | 1891 | } |
1892 | 1892 | $email_body .= $email_user_author.' ('.$email_date_changes.')<br /><br /><br />'; |
@@ -1964,23 +1964,23 @@ discard block |
||
1964 | 1964 | $template); |
1965 | 1965 | |
1966 | 1966 | if (0 != $groupId) { |
1967 | - $groupPart = '_group' . $groupId; // and add groupId to put the same document title in different groups |
|
1968 | - $group_properties = GroupManager :: get_group_properties($groupId); |
|
1967 | + $groupPart = '_group'.$groupId; // and add groupId to put the same document title in different groups |
|
1968 | + $group_properties = GroupManager :: get_group_properties($groupId); |
|
1969 | 1969 | $groupPath = $group_properties['directory']; |
1970 | 1970 | } else { |
1971 | 1971 | $groupPart = ''; |
1972 | - $groupPath =''; |
|
1972 | + $groupPath = ''; |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | - $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path(). '/document'.$groupPath; |
|
1976 | - $exportFile = api_replace_dangerous_char($wikiTitle) . $groupPart; |
|
1975 | + $exportDir = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/document'.$groupPath; |
|
1976 | + $exportFile = api_replace_dangerous_char($wikiTitle).$groupPart; |
|
1977 | 1977 | $wikiContents = trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $wikiContents)); |
1978 | 1978 | //TODO: put link instead of title |
1979 | 1979 | |
1980 | 1980 | $wikiContents = str_replace('{CONTENT}', $wikiContents, $template); |
1981 | 1981 | |
1982 | 1982 | // replace relative path by absolute path for courses, so you can see items into this page wiki (images, mp3, etc..) exported in documents |
1983 | - if (api_strpos($wikiContents,'../..'.api_get_path(REL_COURSE_PATH)) !== false) { |
|
1983 | + if (api_strpos($wikiContents, '../..'.api_get_path(REL_COURSE_PATH)) !== false) { |
|
1984 | 1984 | $web_course_path = api_get_path(WEB_COURSE_PATH); |
1985 | 1985 | $wikiContents = str_replace('../..'.api_get_path(REL_COURSE_PATH), $web_course_path, $wikiContents); |
1986 | 1986 | } |
@@ -1991,8 +1991,8 @@ discard block |
||
1991 | 1991 | $i++; |
1992 | 1992 | } |
1993 | 1993 | |
1994 | - $wikiFileName = $exportFile . '_' . $i . '.html'; |
|
1995 | - $exportPath = $exportDir . '/' . $wikiFileName; |
|
1994 | + $wikiFileName = $exportFile.'_'.$i.'.html'; |
|
1995 | + $exportPath = $exportDir.'/'.$wikiFileName; |
|
1996 | 1996 | |
1997 | 1997 | file_put_contents($exportPath, $wikiContents); |
1998 | 1998 | $doc_id = add_document( |
@@ -2037,14 +2037,14 @@ discard block |
||
2037 | 2037 | $content_pdf = api_html_entity_decode($data['content'], ENT_QUOTES, api_get_system_encoding()); |
2038 | 2038 | |
2039 | 2039 | //clean wiki links |
2040 | - $content_pdf=trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $content_pdf)); |
|
2040 | + $content_pdf = trim(preg_replace("/\[[\[]?([^\]|]*)[|]?([^|\]]*)\][\]]?/", "$1", $content_pdf)); |
|
2041 | 2041 | //TODO: It should be better to display the link insted of the tile but it is hard for [[title]] links |
2042 | 2042 | |
2043 | 2043 | $title_pdf = api_html_entity_decode($data['title'], ENT_QUOTES, api_get_system_encoding()); |
2044 | 2044 | $title_pdf = api_utf8_encode($title_pdf, api_get_system_encoding()); |
2045 | 2045 | $content_pdf = api_utf8_encode($content_pdf, api_get_system_encoding()); |
2046 | 2046 | |
2047 | - $html=' |
|
2047 | + $html = ' |
|
2048 | 2048 | <!-- defines the headers/footers - this must occur before the headers/footers are set --> |
2049 | 2049 | |
2050 | 2050 | <!--mpdf |
@@ -2103,9 +2103,9 @@ discard block |
||
2103 | 2103 | $groupId = api_get_group_id(); |
2104 | 2104 | $groupInfo = GroupManager::get_group_properties($groupId); |
2105 | 2105 | |
2106 | - if ($groupId==0) { |
|
2106 | + if ($groupId == 0) { |
|
2107 | 2107 | //extract course members |
2108 | - if(!empty($session_id)) { |
|
2108 | + if (!empty($session_id)) { |
|
2109 | 2109 | $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id); |
2110 | 2110 | } else { |
2111 | 2111 | $a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), 0); |
@@ -2131,7 +2131,7 @@ discard block |
||
2131 | 2131 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES)); |
2132 | 2132 | $name = $userinfo['complete_name']." - ".$username; |
2133 | 2133 | |
2134 | - $photo = '<img src="' . $userinfo['avatar'] . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />'; |
|
2134 | + $photo = '<img src="'.$userinfo['avatar'].'" alt="'.$name.'" width="40" height="50" align="top" title="'.$name.'" />'; |
|
2135 | 2135 | |
2136 | 2136 | // teacher assignment title |
2137 | 2137 | $title_orig = $values['title']; |
@@ -2161,7 +2161,7 @@ discard block |
||
2161 | 2161 | $userPicture = UserManager::getUserPicture($assig_user_id); |
2162 | 2162 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES)); |
2163 | 2163 | $name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname'])." . ".$username; |
2164 | - $photo= '<img src="'.$userPicture.'" alt="'.$name.'" width="40" height="50" align="bottom" title="'.$name.'" />'; |
|
2164 | + $photo = '<img src="'.$userPicture.'" alt="'.$name.'" width="40" height="50" align="bottom" title="'.$name.'" />'; |
|
2165 | 2165 | |
2166 | 2166 | $is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $groupInfo['iid']); //student is tutor |
2167 | 2167 | $is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $groupInfo['iid']) && |
@@ -2169,17 +2169,17 @@ discard block |
||
2169 | 2169 | // student is tutor and member |
2170 | 2170 | |
2171 | 2171 | if ($is_tutor_and_member) { |
2172 | - $status_in_group=get_lang('GroupTutorAndMember'); |
|
2172 | + $status_in_group = get_lang('GroupTutorAndMember'); |
|
2173 | 2173 | } else { |
2174 | - if($is_tutor_of_group) { |
|
2175 | - $status_in_group=get_lang('GroupTutor'); |
|
2174 | + if ($is_tutor_of_group) { |
|
2175 | + $status_in_group = get_lang('GroupTutor'); |
|
2176 | 2176 | } else { |
2177 | - $status_in_group=" "; //get_lang('GroupStandardMember') |
|
2177 | + $status_in_group = " "; //get_lang('GroupStandardMember') |
|
2178 | 2178 | } |
2179 | 2179 | } |
2180 | 2180 | |
2181 | - if ($assignment_type==1) { |
|
2182 | - $values['title']= $title_orig; |
|
2181 | + if ($assignment_type == 1) { |
|
2182 | + $values['title'] = $title_orig; |
|
2183 | 2183 | $values['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6"> |
2184 | 2184 | <table border="0"> |
2185 | 2185 | <tr><td style="font-size:24px">'.get_lang('AssignmentWork').'</td></tr> |
@@ -2195,7 +2195,7 @@ discard block |
||
2195 | 2195 | ). |
2196 | 2196 | ' [['.Security::remove_XSS($_POST['title'])."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</li>'; |
2197 | 2197 | //don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name) |
2198 | - $values['assignment']=2; |
|
2198 | + $values['assignment'] = 2; |
|
2199 | 2199 | } |
2200 | 2200 | $this->assig_user_id = $assig_user_id; |
2201 | 2201 | self::save_new_wiki($values); |
@@ -2204,12 +2204,12 @@ discard block |
||
2204 | 2204 | |
2205 | 2205 | foreach ($a_users_to_add as $o_user_to_add) { |
2206 | 2206 | if ($o_user_to_add['user_id'] == $userId) { |
2207 | - $assig_user_id=$o_user_to_add['user_id']; |
|
2207 | + $assig_user_id = $o_user_to_add['user_id']; |
|
2208 | 2208 | if ($assignment_type == 1) { |
2209 | - $values['title']= $title_orig; |
|
2210 | - $values['comment']=get_lang('AssignmentDesc'); |
|
2209 | + $values['title'] = $title_orig; |
|
2210 | + $values['comment'] = get_lang('AssignmentDesc'); |
|
2211 | 2211 | sort($all_students_pages); |
2212 | - $values['content']=$content_orig_A.$content_orig_B.'<br/> |
|
2212 | + $values['content'] = $content_orig_A.$content_orig_B.'<br/> |
|
2213 | 2213 | <div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6"> |
2214 | 2214 | '.get_lang('AssignmentLinkstoStudentsPage').' |
2215 | 2215 | </div><br/> |
@@ -2217,7 +2217,7 @@ discard block |
||
2217 | 2217 | <ol>'.implode($all_students_pages).'</ol> |
2218 | 2218 | </div> |
2219 | 2219 | <br/>'; |
2220 | - $values['assignment']=1; |
|
2220 | + $values['assignment'] = 1; |
|
2221 | 2221 | } |
2222 | 2222 | $this->assig_user_id = $assig_user_id; |
2223 | 2223 | self::save_new_wiki($values); |
@@ -2231,7 +2231,7 @@ discard block |
||
2231 | 2231 | * @param int Whether to search the contents (1) or just the titles (0) |
2232 | 2232 | * @param int |
2233 | 2233 | */ |
2234 | - public function display_wiki_search_results($search_term, $search_content=0, $all_vers=0) |
|
2234 | + public function display_wiki_search_results($search_term, $search_content = 0, $all_vers = 0) |
|
2235 | 2235 | { |
2236 | 2236 | $tbl_wiki = $this->tbl_wiki; |
2237 | 2237 | $condition_session = $this->condition_session; |
@@ -2243,9 +2243,9 @@ discard block |
||
2243 | 2243 | echo '</legend>'; |
2244 | 2244 | |
2245 | 2245 | //only by professors when page is hidden |
2246 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
2247 | - if ($all_vers=='1') { |
|
2248 | - if ($search_content=='1') { |
|
2246 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
2247 | + if ($all_vers == '1') { |
|
2248 | + if ($search_content == '1') { |
|
2249 | 2249 | $sql = "SELECT * FROM ".$tbl_wiki." |
2250 | 2250 | WHERE |
2251 | 2251 | c_id = $course_id AND |
@@ -2262,7 +2262,7 @@ discard block |
||
2262 | 2262 | //search all pages and all versions |
2263 | 2263 | } |
2264 | 2264 | } else { |
2265 | - if ($search_content=='1') { |
|
2265 | + if ($search_content == '1') { |
|
2266 | 2266 | $sql = "SELECT * FROM ".$tbl_wiki." s1 |
2267 | 2267 | WHERE |
2268 | 2268 | s1.c_id = $course_id AND |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | //search all pages and all versions |
2314 | 2314 | } |
2315 | 2315 | } else { |
2316 | - if($search_content=='1') { |
|
2316 | + if ($search_content == '1') { |
|
2317 | 2317 | $sql = "SELECT * FROM ".$tbl_wiki." s1 |
2318 | 2318 | WHERE |
2319 | 2319 | s1.c_id = $course_id AND |
@@ -2361,17 +2361,17 @@ discard block |
||
2361 | 2361 | $seconds = substr($obj->dtime, 17, 2); |
2362 | 2362 | |
2363 | 2363 | //get type assignment icon |
2364 | - if($obj->assignment==1) { |
|
2365 | - $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL); |
|
2366 | - } elseif ($obj->assignment==2) { |
|
2367 | - $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); |
|
2368 | - } elseif ($obj->assignment==0) { |
|
2364 | + if ($obj->assignment == 1) { |
|
2365 | + $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); |
|
2366 | + } elseif ($obj->assignment == 2) { |
|
2367 | + $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
|
2368 | + } elseif ($obj->assignment == 0) { |
|
2369 | 2369 | $ShowAssignment = Display::return_icon('px_transparent.gif'); |
2370 | 2370 | } |
2371 | 2371 | $row = array(); |
2372 | 2372 | $row[] = $ShowAssignment; |
2373 | 2373 | |
2374 | - if($all_vers=='1') { |
|
2374 | + if ($all_vers == '1') { |
|
2375 | 2375 | $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&view='.$obj->id.'&session_id='.api_htmlentities(urlencode($_GET['$session_id'])).'&group_id='.api_htmlentities(urlencode($_GET['group_id'])).'">'. |
2376 | 2376 | api_htmlentities($obj->title).'</a>'; |
2377 | 2377 | } else { |
@@ -2382,21 +2382,21 @@ discard block |
||
2382 | 2382 | $row[] = ($obj->user_id != 0 && $userinfo !== false) ? UserManager::getUserProfileLink($userinfo) : get_lang('Anonymous').' ('.$obj->user_ip.')'; |
2383 | 2383 | $row[] = $year.'-'.$month.'-'.$day.' '.$hours.":".$minutes.":".$seconds; |
2384 | 2384 | |
2385 | - if ($all_vers=='1') { |
|
2385 | + if ($all_vers == '1') { |
|
2386 | 2386 | $row[] = $obj->version; |
2387 | 2387 | } else { |
2388 | 2388 | $showdelete = ''; |
2389 | - if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) { |
|
2390 | - $showdelete=' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
2391 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL); |
|
2389 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
2390 | + $showdelete = ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
2391 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
2392 | 2392 | } |
2393 | 2393 | $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=edit&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
2394 | - Display::return_icon('edit.png', get_lang('EditPage'),'',ICON_SIZE_SMALL).'</a> |
|
2394 | + Display::return_icon('edit.png', get_lang('EditPage'), '', ICON_SIZE_SMALL).'</a> |
|
2395 | 2395 | <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=discuss&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
2396 | - Display::return_icon('discuss.png', get_lang('Discuss'),'',ICON_SIZE_SMALL).'</a> |
|
2396 | + Display::return_icon('discuss.png', get_lang('Discuss'), '', ICON_SIZE_SMALL).'</a> |
|
2397 | 2397 | <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=history&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
2398 | - Display::return_icon('history.png', get_lang('History'),'',ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=links&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
2399 | - Display::return_icon('what_link_here.png', get_lang('LinksPages'),'',ICON_SIZE_SMALL).'</a>'.$showdelete; |
|
2398 | + Display::return_icon('history.png', get_lang('History'), '', ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=links&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
2399 | + Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_SMALL).'</a>'.$showdelete; |
|
2400 | 2400 | } |
2401 | 2401 | $rows[] = $row; |
2402 | 2402 | } |
@@ -2421,16 +2421,16 @@ discard block |
||
2421 | 2421 | 'all_vers' => $all_vers, |
2422 | 2422 | ) |
2423 | 2423 | ); |
2424 | - $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;')); |
|
2425 | - $table->set_header(1,get_lang('Title'), true); |
|
2424 | + $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;')); |
|
2425 | + $table->set_header(1, get_lang('Title'), true); |
|
2426 | 2426 | if ($all_vers == '1') { |
2427 | - $table->set_header(2,get_lang('Author'), true); |
|
2428 | - $table->set_header(3,get_lang('Date'), true); |
|
2429 | - $table->set_header(4,get_lang('Version'), true); |
|
2427 | + $table->set_header(2, get_lang('Author'), true); |
|
2428 | + $table->set_header(3, get_lang('Date'), true); |
|
2429 | + $table->set_header(4, get_lang('Version'), true); |
|
2430 | 2430 | } else { |
2431 | - $table->set_header(2,get_lang('Author').' ('.get_lang('LastVersion').')', true); |
|
2432 | - $table->set_header(3,get_lang('Date').' ('.get_lang('LastVersion').')', true); |
|
2433 | - $table->set_header(4,get_lang('Actions'), false, array ('style' => 'width:130px;')); |
|
2431 | + $table->set_header(2, get_lang('Author').' ('.get_lang('LastVersion').')', true); |
|
2432 | + $table->set_header(3, get_lang('Date').' ('.get_lang('LastVersion').')', true); |
|
2433 | + $table->set_header(4, get_lang('Actions'), false, array('style' => 'width:130px;')); |
|
2434 | 2434 | } |
2435 | 2435 | $table->display(); |
2436 | 2436 | } else { |
@@ -2443,14 +2443,14 @@ discard block |
||
2443 | 2443 | * @todo replace this function with the formvalidator datepicker |
2444 | 2444 | * |
2445 | 2445 | */ |
2446 | - public function draw_date_picker($prefix,$default='') |
|
2446 | + public function draw_date_picker($prefix, $default = '') |
|
2447 | 2447 | { |
2448 | 2448 | if (empty($default)) { |
2449 | 2449 | $default = date('Y-m-d H:i:s'); |
2450 | 2450 | } |
2451 | 2451 | $parts = explode(' ', $default); |
2452 | - list($d_year,$d_month,$d_day) = explode('-',$parts[0]); |
|
2453 | - list($d_hour,$d_minute) = explode(':',$parts[1]); |
|
2452 | + list($d_year, $d_month, $d_day) = explode('-', $parts[0]); |
|
2453 | + list($d_hour, $d_minute) = explode(':', $parts[1]); |
|
2454 | 2454 | |
2455 | 2455 | $month_list = array( |
2456 | 2456 | 1 => get_lang('JanuaryLong'), |
@@ -2467,9 +2467,9 @@ discard block |
||
2467 | 2467 | 12 => get_lang('DecemberLong'), |
2468 | 2468 | ); |
2469 | 2469 | |
2470 | - $minute = range(10,59); |
|
2471 | - array_unshift($minute,'00','01','02','03','04','05','06','07','08','09'); |
|
2472 | - $date_form = self::make_select($prefix.'_day', array_combine(range(1,31),range(1,31)), $d_day); |
|
2470 | + $minute = range(10, 59); |
|
2471 | + array_unshift($minute, '00', '01', '02', '03', '04', '05', '06', '07', '08', '09'); |
|
2472 | + $date_form = self::make_select($prefix.'_day', array_combine(range(1, 31), range(1, 31)), $d_day); |
|
2473 | 2473 | $date_form .= self::make_select($prefix.'_month', $month_list, $d_month); |
2474 | 2474 | $date_form .= self::make_select( |
2475 | 2475 | $prefix.'_year', |
@@ -2482,7 +2482,7 @@ discard block |
||
2482 | 2482 | ), |
2483 | 2483 | $d_year |
2484 | 2484 | ).' '; |
2485 | - $date_form .= self::make_select($prefix.'_hour', array_combine(range(0,23),range(0,23)), $d_hour).' : '; |
|
2485 | + $date_form .= self::make_select($prefix.'_hour', array_combine(range(0, 23), range(0, 23)), $d_hour).' : '; |
|
2486 | 2486 | $date_form .= self::make_select($prefix.'_minute', $minute, $d_minute); |
2487 | 2487 | |
2488 | 2488 | return $date_form; |
@@ -2492,11 +2492,11 @@ discard block |
||
2492 | 2492 | * Draws an HTML form select with the given options |
2493 | 2493 | * |
2494 | 2494 | */ |
2495 | - public function make_select($name,$values,$checked='') |
|
2495 | + public function make_select($name, $values, $checked = '') |
|
2496 | 2496 | { |
2497 | 2497 | $output = '<select name="'.$name.'" id="'.$name.'">'; |
2498 | - foreach($values as $key => $value) { |
|
2499 | - $output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>'; |
|
2498 | + foreach ($values as $key => $value) { |
|
2499 | + $output .= '<option value="'.$key.'" '.(($checked == $key) ? 'selected="selected"' : '').'>'.$value.'</option>'; |
|
2500 | 2500 | } |
2501 | 2501 | $output .= '</select>'; |
2502 | 2502 | return $output; |
@@ -2520,7 +2520,7 @@ discard block |
||
2520 | 2520 | */ |
2521 | 2521 | public function two_digits($number) |
2522 | 2522 | { |
2523 | - $number = (int)$number; |
|
2523 | + $number = (int) $number; |
|
2524 | 2524 | return ($number < 10) ? '0'.$number : $number; |
2525 | 2525 | } |
2526 | 2526 | |
@@ -2541,7 +2541,7 @@ discard block |
||
2541 | 2541 | WHERE c_id = '.$course_id.' AND id = '.$id.' '; |
2542 | 2542 | $result = Database::query($sql); |
2543 | 2543 | $data = array(); |
2544 | - while ($row=Database::fetch_array($result,'ASSOC')) { |
|
2544 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
2545 | 2545 | $data = $row; |
2546 | 2546 | } |
2547 | 2547 | return $data; |
@@ -2595,7 +2595,7 @@ discard block |
||
2595 | 2595 | $result = Database::query($sql); |
2596 | 2596 | $data = array(); |
2597 | 2597 | if (Database::num_rows($result)) { |
2598 | - $data = Database::fetch_array($result,'ASSOC'); |
|
2598 | + $data = Database::fetch_array($result, 'ASSOC'); |
|
2599 | 2599 | } |
2600 | 2600 | |
2601 | 2601 | return $data; |
@@ -2689,9 +2689,9 @@ discard block |
||
2689 | 2689 | $result = self::getAllWiki(); |
2690 | 2690 | if (!empty($result)) { |
2691 | 2691 | foreach ($result as $is_editing_block) { |
2692 | - $max_edit_time = 1200; // 20 minutes |
|
2693 | - $timestamp_edit = strtotime($is_editing_block['time_edit']); |
|
2694 | - $time_editing = time()-$timestamp_edit; |
|
2692 | + $max_edit_time = 1200; // 20 minutes |
|
2693 | + $timestamp_edit = strtotime($is_editing_block['time_edit']); |
|
2694 | + $time_editing = time() - $timestamp_edit; |
|
2695 | 2695 | |
2696 | 2696 | // First prevent concurrent users and double version |
2697 | 2697 | if ($is_editing_block['is_editing'] == $userId) { |
@@ -2700,7 +2700,7 @@ discard block |
||
2700 | 2700 | Session::erase('_version'); |
2701 | 2701 | } |
2702 | 2702 | // Second checks if has exceeded the time that a page may be available or if a page was edited and saved by its author |
2703 | - if ($time_editing > $max_edit_time || ($is_editing_block['is_editing'] == $userId && $action!='edit')) { |
|
2703 | + if ($time_editing > $max_edit_time || ($is_editing_block['is_editing'] == $userId && $action != 'edit')) { |
|
2704 | 2704 | self::updateWikiIsEditing($is_editing_block['is_editing']); |
2705 | 2705 | } |
2706 | 2706 | } |
@@ -2748,7 +2748,7 @@ discard block |
||
2748 | 2748 | FROM ".$tbl_wiki." |
2749 | 2749 | WHERE c_id = $course_id AND ".$groupfilter.$condition_session.""; |
2750 | 2750 | |
2751 | - $allpages=Database::query($sql); |
|
2751 | + $allpages = Database::query($sql); |
|
2752 | 2752 | while ($row = Database::fetch_array($allpages)) { |
2753 | 2753 | $total_versions = $row['TOTAL_VERS']; |
2754 | 2754 | $total_visits = intval($row['TOTAL_VISITS']); |
@@ -2758,30 +2758,30 @@ discard block |
||
2758 | 2758 | WHERE c_id = $course_id AND ".$groupfilter.$condition_session.""; |
2759 | 2759 | $allpages = Database::query($sql); |
2760 | 2760 | |
2761 | - while ($row=Database::fetch_array($allpages)) { |
|
2761 | + while ($row = Database::fetch_array($allpages)) { |
|
2762 | 2762 | $total_words = $total_words + self::word_count($row['content']); |
2763 | - $total_links = $total_links+substr_count($row['content'], "href="); |
|
2764 | - $total_links_anchors = $total_links_anchors+substr_count($row['content'], 'href="#'); |
|
2765 | - $total_links_mail = $total_links_mail+substr_count($row['content'], 'href="mailto'); |
|
2766 | - $total_links_ftp = $total_links_ftp+substr_count($row['content'], 'href="ftp'); |
|
2767 | - $total_links_irc = $total_links_irc+substr_count($row['content'], 'href="irc'); |
|
2768 | - $total_links_news = $total_links_news+substr_count($row['content'], 'href="news'); |
|
2769 | - $total_wlinks = $total_wlinks+substr_count($row['content'], "[["); |
|
2770 | - $total_images = $total_images+substr_count($row['content'], "<img"); |
|
2763 | + $total_links = $total_links + substr_count($row['content'], "href="); |
|
2764 | + $total_links_anchors = $total_links_anchors + substr_count($row['content'], 'href="#'); |
|
2765 | + $total_links_mail = $total_links_mail + substr_count($row['content'], 'href="mailto'); |
|
2766 | + $total_links_ftp = $total_links_ftp + substr_count($row['content'], 'href="ftp'); |
|
2767 | + $total_links_irc = $total_links_irc + substr_count($row['content'], 'href="irc'); |
|
2768 | + $total_links_news = $total_links_news + substr_count($row['content'], 'href="news'); |
|
2769 | + $total_wlinks = $total_wlinks + substr_count($row['content'], "[["); |
|
2770 | + $total_images = $total_images + substr_count($row['content'], "<img"); |
|
2771 | 2771 | $clean_total_flash = preg_replace('/player.swf/', ' ', $row['content']); |
2772 | - $total_flash = $total_flash+substr_count($clean_total_flash, '.swf"'); |
|
2772 | + $total_flash = $total_flash + substr_count($clean_total_flash, '.swf"'); |
|
2773 | 2773 | //.swf" end quotes prevent insert swf through flvplayer (is not counted) |
2774 | - $total_mp3 = $total_mp3+substr_count($row['content'], ".mp3"); |
|
2775 | - $total_flv_p = $total_flv_p+substr_count($row['content'], ".flv"); |
|
2776 | - $total_flv = $total_flv_p/5; |
|
2777 | - $total_youtube = $total_youtube+substr_count($row['content'], "http://www.youtube.com"); |
|
2778 | - $total_multimedia = $total_multimedia+substr_count($row['content'], "video/x-msvideo"); |
|
2779 | - $total_tables = $total_tables+substr_count($row['content'], "<table"); |
|
2774 | + $total_mp3 = $total_mp3 + substr_count($row['content'], ".mp3"); |
|
2775 | + $total_flv_p = $total_flv_p + substr_count($row['content'], ".flv"); |
|
2776 | + $total_flv = $total_flv_p / 5; |
|
2777 | + $total_youtube = $total_youtube + substr_count($row['content'], "http://www.youtube.com"); |
|
2778 | + $total_multimedia = $total_multimedia + substr_count($row['content'], "video/x-msvideo"); |
|
2779 | + $total_tables = $total_tables + substr_count($row['content'], "<table"); |
|
2780 | 2780 | } |
2781 | 2781 | |
2782 | 2782 | //check only last version of all pages (current page) |
2783 | 2783 | |
2784 | - $sql =' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV |
|
2784 | + $sql = ' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV |
|
2785 | 2785 | FROM '.$tbl_wiki.' s1 |
2786 | 2786 | WHERE s1.c_id = '.$course_id.' AND id=( |
2787 | 2787 | SELECT MAX(s2.id) |
@@ -2792,9 +2792,9 @@ discard block |
||
2792 | 2792 | '.$groupfilter.' AND |
2793 | 2793 | session_id='.$session_id.')'; |
2794 | 2794 | $allpages = Database::query($sql); |
2795 | - while ($row=Database::fetch_array($allpages)) { |
|
2796 | - $total_pages = $row['TOTAL_PAGES']; |
|
2797 | - $total_visits_lv = intval($row['TOTAL_VISITS_LV']); |
|
2795 | + while ($row = Database::fetch_array($allpages)) { |
|
2796 | + $total_pages = $row['TOTAL_PAGES']; |
|
2797 | + $total_visits_lv = intval($row['TOTAL_VISITS_LV']); |
|
2798 | 2798 | } |
2799 | 2799 | |
2800 | 2800 | $total_words_lv = 0; |
@@ -2826,29 +2826,29 @@ discard block |
||
2826 | 2826 | )'; |
2827 | 2827 | $allpages = Database::query($sql); |
2828 | 2828 | |
2829 | - while ($row=Database::fetch_array($allpages)) { |
|
2830 | - $total_words_lv = $total_words_lv+ self::word_count($row['content']); |
|
2831 | - $total_links_lv = $total_links_lv+substr_count($row['content'], "href="); |
|
2832 | - $total_links_anchors_lv = $total_links_anchors_lv+substr_count($row['content'], 'href="#'); |
|
2833 | - $total_links_mail_lv = $total_links_mail_lv+substr_count($row['content'], 'href="mailto'); |
|
2834 | - $total_links_ftp_lv = $total_links_ftp_lv+substr_count($row['content'], 'href="ftp'); |
|
2835 | - $total_links_irc_lv = $total_links_irc_lv+substr_count($row['content'], 'href="irc'); |
|
2836 | - $total_links_news_lv = $total_links_news_lv+substr_count($row['content'], 'href="news'); |
|
2837 | - $total_wlinks_lv = $total_wlinks_lv+substr_count($row['content'], "[["); |
|
2838 | - $total_images_lv = $total_images_lv+substr_count($row['content'], "<img"); |
|
2829 | + while ($row = Database::fetch_array($allpages)) { |
|
2830 | + $total_words_lv = $total_words_lv + self::word_count($row['content']); |
|
2831 | + $total_links_lv = $total_links_lv + substr_count($row['content'], "href="); |
|
2832 | + $total_links_anchors_lv = $total_links_anchors_lv + substr_count($row['content'], 'href="#'); |
|
2833 | + $total_links_mail_lv = $total_links_mail_lv + substr_count($row['content'], 'href="mailto'); |
|
2834 | + $total_links_ftp_lv = $total_links_ftp_lv + substr_count($row['content'], 'href="ftp'); |
|
2835 | + $total_links_irc_lv = $total_links_irc_lv + substr_count($row['content'], 'href="irc'); |
|
2836 | + $total_links_news_lv = $total_links_news_lv + substr_count($row['content'], 'href="news'); |
|
2837 | + $total_wlinks_lv = $total_wlinks_lv + substr_count($row['content'], "[["); |
|
2838 | + $total_images_lv = $total_images_lv + substr_count($row['content'], "<img"); |
|
2839 | 2839 | $clean_total_flash_lv = preg_replace('/player.swf/', ' ', $row['content']); |
2840 | - $total_flash_lv = $total_flash_lv+substr_count($clean_total_flash_lv, '.swf"'); |
|
2840 | + $total_flash_lv = $total_flash_lv + substr_count($clean_total_flash_lv, '.swf"'); |
|
2841 | 2841 | //.swf" end quotes prevent insert swf through flvplayer (is not counted) |
2842 | - $total_mp3_lv = $total_mp3_lv+substr_count($row['content'], ".mp3"); |
|
2843 | - $total_flv_p_lv = $total_flv_p_lv+substr_count($row['content'], ".flv"); |
|
2844 | - $total_flv_lv = $total_flv_p_lv/5; |
|
2845 | - $total_youtube_lv = $total_youtube_lv+substr_count($row['content'], "http://www.youtube.com"); |
|
2846 | - $total_multimedia_lv = $total_multimedia_lv+substr_count($row['content'], "video/x-msvideo"); |
|
2847 | - $total_tables_lv = $total_tables_lv+substr_count($row['content'], "<table"); |
|
2842 | + $total_mp3_lv = $total_mp3_lv + substr_count($row['content'], ".mp3"); |
|
2843 | + $total_flv_p_lv = $total_flv_p_lv + substr_count($row['content'], ".flv"); |
|
2844 | + $total_flv_lv = $total_flv_p_lv / 5; |
|
2845 | + $total_youtube_lv = $total_youtube_lv + substr_count($row['content'], "http://www.youtube.com"); |
|
2846 | + $total_multimedia_lv = $total_multimedia_lv + substr_count($row['content'], "video/x-msvideo"); |
|
2847 | + $total_tables_lv = $total_tables_lv + substr_count($row['content'], "<table"); |
|
2848 | 2848 | } |
2849 | 2849 | |
2850 | 2850 | //Total pages edited at this time |
2851 | - $total_editing_now=0; |
|
2851 | + $total_editing_now = 0; |
|
2852 | 2852 | $sql = 'SELECT *, COUNT(*) AS TOTAL_EDITING_NOW |
2853 | 2853 | FROM '.$tbl_wiki.' s1 |
2854 | 2854 | WHERE is_editing!=0 AND s1.c_id = '.$course_id.' AND |
@@ -2863,66 +2863,66 @@ discard block |
||
2863 | 2863 | )'; |
2864 | 2864 | |
2865 | 2865 | // Can not use group by because the mark is set in the latest version |
2866 | - $allpages=Database::query($sql); |
|
2867 | - while ($row=Database::fetch_array($allpages)) { |
|
2868 | - $total_editing_now = $row['TOTAL_EDITING_NOW']; |
|
2866 | + $allpages = Database::query($sql); |
|
2867 | + while ($row = Database::fetch_array($allpages)) { |
|
2868 | + $total_editing_now = $row['TOTAL_EDITING_NOW']; |
|
2869 | 2869 | } |
2870 | 2870 | |
2871 | 2871 | // Total hidden pages |
2872 | - $total_hidden=0; |
|
2872 | + $total_hidden = 0; |
|
2873 | 2873 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
2874 | 2874 | WHERE c_id = '.$course_id.' AND visibility=0 AND '.$groupfilter.$condition_session.' |
2875 | 2875 | GROUP BY reflink'; |
2876 | 2876 | // or group by page_id. As the mark of hidden places it in all versions of the page, I can use group by to see the first |
2877 | - $allpages=Database::query($sql); |
|
2878 | - while ($row=Database::fetch_array($allpages)) { |
|
2879 | - $total_hidden = $total_hidden+1; |
|
2877 | + $allpages = Database::query($sql); |
|
2878 | + while ($row = Database::fetch_array($allpages)) { |
|
2879 | + $total_hidden = $total_hidden + 1; |
|
2880 | 2880 | } |
2881 | 2881 | |
2882 | 2882 | //Total protect pages |
2883 | - $total_protected=0; |
|
2883 | + $total_protected = 0; |
|
2884 | 2884 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
2885 | 2885 | WHERE c_id = '.$course_id.' AND editlock=1 AND '.$groupfilter.$condition_session.' |
2886 | 2886 | GROUP BY reflink'; |
2887 | 2887 | // or group by page_id. As the mark of protected page is the first version of the page, I can use group by |
2888 | 2888 | |
2889 | - $allpages=Database::query($sql); |
|
2890 | - while ($row=Database::fetch_array($allpages)) { |
|
2891 | - $total_protected = $total_protected+1; |
|
2889 | + $allpages = Database::query($sql); |
|
2890 | + while ($row = Database::fetch_array($allpages)) { |
|
2891 | + $total_protected = $total_protected + 1; |
|
2892 | 2892 | } |
2893 | 2893 | |
2894 | 2894 | // Total empty versions. |
2895 | - $total_empty_content=0; |
|
2895 | + $total_empty_content = 0; |
|
2896 | 2896 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
2897 | 2897 | WHERE |
2898 | 2898 | c_id = '.$course_id.' AND |
2899 | 2899 | content="" AND |
2900 | 2900 | '.$groupfilter.$condition_session.''; |
2901 | 2901 | $allpages = Database::query($sql); |
2902 | - while ($row=Database::fetch_array($allpages)) { |
|
2903 | - $total_empty_content = $total_empty_content+1; |
|
2902 | + while ($row = Database::fetch_array($allpages)) { |
|
2903 | + $total_empty_content = $total_empty_content + 1; |
|
2904 | 2904 | } |
2905 | 2905 | |
2906 | 2906 | //Total empty pages (last version) |
2907 | 2907 | |
2908 | - $total_empty_content_lv=0; |
|
2908 | + $total_empty_content_lv = 0; |
|
2909 | 2909 | $sql = 'SELECT * FROM '.$tbl_wiki.' s1 |
2910 | 2910 | WHERE s1.c_id = '.$course_id.' AND content="" AND id=( |
2911 | 2911 | SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 |
2912 | 2912 | WHERE s1.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')'; |
2913 | - $allpages=Database::query($sql); |
|
2913 | + $allpages = Database::query($sql); |
|
2914 | 2914 | while ($row = Database::fetch_array($allpages)) { |
2915 | - $total_empty_content_lv = $total_empty_content_lv+1; |
|
2915 | + $total_empty_content_lv = $total_empty_content_lv + 1; |
|
2916 | 2916 | } |
2917 | 2917 | |
2918 | 2918 | // Total locked discuss pages |
2919 | - $total_lock_disc=0; |
|
2919 | + $total_lock_disc = 0; |
|
2920 | 2920 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
2921 | 2921 | WHERE c_id = '.$course_id.' AND addlock_disc=0 AND '.$groupfilter.$condition_session.' |
2922 | 2922 | GROUP BY reflink';//group by because mark lock in all vers, then always is ok |
2923 | - $allpages=Database::query($sql); |
|
2923 | + $allpages = Database::query($sql); |
|
2924 | 2924 | while ($row = Database::fetch_array($allpages)) { |
2925 | - $total_lock_disc = $total_lock_disc+1; |
|
2925 | + $total_lock_disc = $total_lock_disc + 1; |
|
2926 | 2926 | } |
2927 | 2927 | |
2928 | 2928 | // Total hidden discuss pages. |
@@ -2933,7 +2933,7 @@ discard block |
||
2933 | 2933 | //group by because mark lock in all vers, then always is ok |
2934 | 2934 | $allpages = Database::query($sql); |
2935 | 2935 | while ($row = Database::fetch_array($allpages)) { |
2936 | - $total_hidden_disc = $total_hidden_disc+1; |
|
2936 | + $total_hidden_disc = $total_hidden_disc + 1; |
|
2937 | 2937 | } |
2938 | 2938 | |
2939 | 2939 | //Total versions with any short comment by user or system |
@@ -2941,44 +2941,44 @@ discard block |
||
2941 | 2941 | $total_comment_version = 0; |
2942 | 2942 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
2943 | 2943 | WHERE c_id = '.$course_id.' AND comment!="" AND '.$groupfilter.$condition_session.''; |
2944 | - $allpages=Database::query($sql); |
|
2944 | + $allpages = Database::query($sql); |
|
2945 | 2945 | while ($row = Database::fetch_array($allpages)) { |
2946 | - $total_comment_version = $total_comment_version+1; |
|
2946 | + $total_comment_version = $total_comment_version + 1; |
|
2947 | 2947 | } |
2948 | 2948 | |
2949 | 2949 | // Total pages that can only be scored by teachers. |
2950 | 2950 | |
2951 | - $total_only_teachers_rating=0; |
|
2951 | + $total_only_teachers_rating = 0; |
|
2952 | 2952 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
2953 | 2953 | WHERE c_id = '.$course_id.' AND |
2954 | 2954 | ratinglock_disc = 0 AND |
2955 | 2955 | '.$groupfilter.$condition_session.' |
2956 | 2956 | GROUP BY reflink';//group by because mark lock in all vers, then always is ok |
2957 | - $allpages=Database::query($sql); |
|
2958 | - while ($row=Database::fetch_array($allpages)) { |
|
2959 | - $total_only_teachers_rating = $total_only_teachers_rating+1; |
|
2957 | + $allpages = Database::query($sql); |
|
2958 | + while ($row = Database::fetch_array($allpages)) { |
|
2959 | + $total_only_teachers_rating = $total_only_teachers_rating + 1; |
|
2960 | 2960 | } |
2961 | 2961 | |
2962 | 2962 | // Total pages scored by peers |
2963 | 2963 | // put always this line alfter check num all pages and num pages rated by teachers |
2964 | - $total_rating_by_peers=$total_pages-$total_only_teachers_rating; |
|
2964 | + $total_rating_by_peers = $total_pages - $total_only_teachers_rating; |
|
2965 | 2965 | |
2966 | 2966 | //Total pages identified as standard task |
2967 | 2967 | |
2968 | - $total_task=0; |
|
2969 | - $sql='SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' |
|
2968 | + $total_task = 0; |
|
2969 | + $sql = 'SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' |
|
2970 | 2970 | WHERE '.$tbl_wiki_conf.'.c_id = '.$course_id.' AND |
2971 | 2971 | '.$tbl_wiki_conf.'.task!="" AND |
2972 | 2972 | '.$tbl_wiki_conf.'.page_id='.$tbl_wiki.'.page_id AND |
2973 | 2973 | '.$tbl_wiki.'.'.$groupfilter.$condition_session; |
2974 | 2974 | $allpages = Database::query($sql); |
2975 | - while ($row=Database::fetch_array($allpages)) { |
|
2976 | - $total_task=$total_task+1; |
|
2975 | + while ($row = Database::fetch_array($allpages)) { |
|
2976 | + $total_task = $total_task + 1; |
|
2977 | 2977 | } |
2978 | 2978 | |
2979 | 2979 | //Total pages identified as teacher page (wiki portfolio mode - individual assignment) |
2980 | 2980 | |
2981 | - $total_teacher_assignment=0; |
|
2981 | + $total_teacher_assignment = 0; |
|
2982 | 2982 | $sql = 'SELECT * FROM '.$tbl_wiki.' s1 |
2983 | 2983 | WHERE s1.c_id = '.$course_id.' AND assignment=1 AND id=( |
2984 | 2984 | SELECT MAX(s2.id) |
@@ -2988,20 +2988,20 @@ discard block |
||
2988 | 2988 | //mark all versions, but do not use group by reflink because y want the pages not versions |
2989 | 2989 | $allpages = Database::query($sql); |
2990 | 2990 | while ($row = Database::fetch_array($allpages)) { |
2991 | - $total_teacher_assignment=$total_teacher_assignment+1; |
|
2991 | + $total_teacher_assignment = $total_teacher_assignment + 1; |
|
2992 | 2992 | } |
2993 | 2993 | |
2994 | 2994 | //Total pages identifies as student page (wiki portfolio mode - individual assignment) |
2995 | 2995 | |
2996 | - $total_student_assignment=0; |
|
2996 | + $total_student_assignment = 0; |
|
2997 | 2997 | $sql = 'SELECT * FROM '.$tbl_wiki.' s1 |
2998 | 2998 | WHERE s1.c_id = '.$course_id.' AND assignment=2 AND |
2999 | 2999 | id=(SELECT MAX(s2.id) FROM '.$tbl_wiki.' s2 |
3000 | 3000 | WHERE s2.c_id = '.$course_id.' AND s1.reflink = s2.reflink AND '.$groupfilter.' AND session_id='.$session_id.')'; |
3001 | 3001 | //mark all versions, but do not use group by reflink because y want the pages not versions |
3002 | - $allpages=Database::query($sql); |
|
3003 | - while ($row=Database::fetch_array($allpages)) { |
|
3004 | - $total_student_assignment = $total_student_assignment+1; |
|
3002 | + $allpages = Database::query($sql); |
|
3003 | + while ($row = Database::fetch_array($allpages)) { |
|
3004 | + $total_student_assignment = $total_student_assignment + 1; |
|
3005 | 3005 | } |
3006 | 3006 | |
3007 | 3007 | //Current Wiki status add new pages |
@@ -3010,14 +3010,14 @@ discard block |
||
3010 | 3010 | GROUP BY addlock';//group by because mark 0 in all vers, then always is ok |
3011 | 3011 | $allpages = Database::query($sql); |
3012 | 3012 | $wiki_add_lock = null; |
3013 | - while ($row=Database::fetch_array($allpages)) { |
|
3014 | - $wiki_add_lock=$row['addlock']; |
|
3013 | + while ($row = Database::fetch_array($allpages)) { |
|
3014 | + $wiki_add_lock = $row['addlock']; |
|
3015 | 3015 | } |
3016 | 3016 | |
3017 | - if ($wiki_add_lock==1) { |
|
3018 | - $status_add_new_pag=get_lang('Yes'); |
|
3017 | + if ($wiki_add_lock == 1) { |
|
3018 | + $status_add_new_pag = get_lang('Yes'); |
|
3019 | 3019 | } else { |
3020 | - $status_add_new_pag=get_lang('No'); |
|
3020 | + $status_add_new_pag = get_lang('No'); |
|
3021 | 3021 | } |
3022 | 3022 | |
3023 | 3023 | //Creation date of the oldest wiki page and version |
@@ -3040,7 +3040,7 @@ discard block |
||
3040 | 3040 | ORDER BY dtime DESC |
3041 | 3041 | LIMIT 1'; |
3042 | 3042 | $allpages = Database::query($sql); |
3043 | - while ($row=Database::fetch_array($allpages)) { |
|
3043 | + while ($row = Database::fetch_array($allpages)) { |
|
3044 | 3044 | $last_wiki_date = $row['dtime']; |
3045 | 3045 | } |
3046 | 3046 | |
@@ -3053,18 +3053,18 @@ discard block |
||
3053 | 3053 | // Do not use "count" because using "group by", would give a wrong value |
3054 | 3054 | $allpages = Database::query($sql); |
3055 | 3055 | $total_score = 0; |
3056 | - while ($row=Database::fetch_array($allpages)) { |
|
3057 | - $total_score = $total_score+$row['TOTAL_SCORE']; |
|
3056 | + while ($row = Database::fetch_array($allpages)) { |
|
3057 | + $total_score = $total_score + $row['TOTAL_SCORE']; |
|
3058 | 3058 | } |
3059 | 3059 | |
3060 | 3060 | if (!empty($total_pages)) { |
3061 | - $media_score = $total_score/$total_pages; |
|
3061 | + $media_score = $total_score / $total_pages; |
|
3062 | 3062 | //put always this line alfter check num all pages |
3063 | 3063 | } |
3064 | 3064 | |
3065 | 3065 | // Average user progress in his pages. |
3066 | 3066 | |
3067 | - $media_progress=0; |
|
3067 | + $media_progress = 0; |
|
3068 | 3068 | $sql = 'SELECT *, SUM(progress) AS TOTAL_PROGRESS |
3069 | 3069 | FROM '.$tbl_wiki.' s1 |
3070 | 3070 | WHERE s1.c_id = '.$course_id.' AND id= |
@@ -3078,24 +3078,24 @@ discard block |
||
3078 | 3078 | // As the value is only the latest version I can not use group by |
3079 | 3079 | $allpages = Database::query($sql); |
3080 | 3080 | while ($row = Database::fetch_array($allpages)) { |
3081 | - $total_progress = $row['TOTAL_PROGRESS']; |
|
3081 | + $total_progress = $row['TOTAL_PROGRESS']; |
|
3082 | 3082 | } |
3083 | 3083 | |
3084 | 3084 | if (!empty($total_pages)) { |
3085 | - $media_progress=$total_progress/$total_pages; |
|
3085 | + $media_progress = $total_progress / $total_pages; |
|
3086 | 3086 | //put always this line alfter check num all pages |
3087 | 3087 | } |
3088 | 3088 | |
3089 | 3089 | //Total users that have participated in the Wiki |
3090 | 3090 | |
3091 | - $total_users=0; |
|
3091 | + $total_users = 0; |
|
3092 | 3092 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
3093 | 3093 | WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
3094 | 3094 | GROUP BY user_id'; |
3095 | 3095 | //as the mark of user it in all versions of the page, I can use group by to see the first |
3096 | - $allpages=Database::query($sql); |
|
3097 | - while ($row=Database::fetch_array($allpages)) { |
|
3098 | - $total_users = $total_users+1; |
|
3096 | + $allpages = Database::query($sql); |
|
3097 | + while ($row = Database::fetch_array($allpages)) { |
|
3098 | + $total_users = $total_users + 1; |
|
3099 | 3099 | } |
3100 | 3100 | |
3101 | 3101 | // Total of different IP addresses that have participated in the wiki |
@@ -3103,9 +3103,9 @@ discard block |
||
3103 | 3103 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
3104 | 3104 | WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
3105 | 3105 | GROUP BY user_ip'; |
3106 | - $allpages=Database::query($sql); |
|
3107 | - while ($row=Database::fetch_array($allpages)) { |
|
3108 | - $total_ip = $total_ip+1; |
|
3106 | + $allpages = Database::query($sql); |
|
3107 | + while ($row = Database::fetch_array($allpages)) { |
|
3108 | + $total_ip = $total_ip + 1; |
|
3109 | 3109 | } |
3110 | 3110 | |
3111 | 3111 | echo '<table class="data_table">'; |
@@ -3297,18 +3297,18 @@ discard block |
||
3297 | 3297 | $userinfo = api_get_user_info($obj->user_id); |
3298 | 3298 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES); |
3299 | 3299 | $row = array(); |
3300 | - if ($obj->user_id != 0 && $userinfo !== false) { |
|
3300 | + if ($obj->user_id != 0 && $userinfo !== false) { |
|
3301 | 3301 | $row[] = UserManager::getUserProfileLink($userinfo).' |
3302 | 3302 | <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.urlencode($obj->user_id). |
3303 | 3303 | '&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'"></a>'; |
3304 | 3304 | } else { |
3305 | 3305 | $row[] = get_lang('Anonymous').' ('.$obj->user_ip.')'; |
3306 | 3306 | } |
3307 | - $row[] ='<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.urlencode($obj->user_id).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.$obj->NUM_EDIT.'</a>'; |
|
3307 | + $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.urlencode($obj->user_id).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'.$obj->NUM_EDIT.'</a>'; |
|
3308 | 3308 | $rows[] = $row; |
3309 | 3309 | } |
3310 | 3310 | |
3311 | - $table = new SortableTableFromArrayConfig($rows,1,10,'MostActiveUsersA_table','','','DESC'); |
|
3311 | + $table = new SortableTableFromArrayConfig($rows, 1, 10, 'MostActiveUsersA_table', '', '', 'DESC'); |
|
3312 | 3312 | $table->set_additional_parameters( |
3313 | 3313 | array( |
3314 | 3314 | 'cidReq' => Security::remove_XSS($_GET['cidReq']), |
@@ -3317,8 +3317,8 @@ discard block |
||
3317 | 3317 | 'group_id' => Security::remove_XSS($_GET['group_id']) |
3318 | 3318 | ) |
3319 | 3319 | ); |
3320 | - $table->set_header(0,get_lang('Author'), true); |
|
3321 | - $table->set_header(1,get_lang('Contributions'), true,array ('style' => 'width:30px;')); |
|
3320 | + $table->set_header(0, get_lang('Author'), true); |
|
3321 | + $table->set_header(1, get_lang('Contributions'), true, array('style' => 'width:30px;')); |
|
3322 | 3322 | $table->display(); |
3323 | 3323 | } |
3324 | 3324 | } |
@@ -3334,8 +3334,8 @@ discard block |
||
3334 | 3334 | $groupfilter = $this->groupfilter; |
3335 | 3335 | $tbl_wiki_discuss = $this->tbl_wiki_discuss; |
3336 | 3336 | |
3337 | - if (api_get_session_id()!=0 && |
|
3338 | - api_is_allowed_to_session_edit(false,true)==false |
|
3337 | + if (api_get_session_id() != 0 && |
|
3338 | + api_is_allowed_to_session_edit(false, true) == false |
|
3339 | 3339 | ) { |
3340 | 3340 | api_not_allowed(); |
3341 | 3341 | } |
@@ -3396,9 +3396,9 @@ discard block |
||
3396 | 3396 | //mode assignment: previous to show page type |
3397 | 3397 | $icon_assignment = null; |
3398 | 3398 | if ($row['assignment'] == 1) { |
3399 | - $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL); |
|
3399 | + $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL); |
|
3400 | 3400 | } elseif ($row['assignment'] == 2) { |
3401 | - $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL); |
|
3401 | + $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL); |
|
3402 | 3402 | } |
3403 | 3403 | |
3404 | 3404 | $countWPost = null; |
@@ -3413,19 +3413,19 @@ discard block |
||
3413 | 3413 | if ($row['visibility_disc'] == 1 || |
3414 | 3414 | api_is_allowed_to_edit(false, true) || |
3415 | 3415 | api_is_platform_admin() || |
3416 | - ($row['assignment'] == 2 && $row['visibility_disc']==0 && (api_get_user_id()==$row['user_id'])) |
|
3416 | + ($row['assignment'] == 2 && $row['visibility_disc'] == 0 && (api_get_user_id() == $row['user_id'])) |
|
3417 | 3417 | ) { |
3418 | 3418 | echo '<div id="wikititle">'; |
3419 | 3419 | // discussion action: protecting (locking) the discussion |
3420 | 3420 | $addlock_disc = null; |
3421 | 3421 | $lock_unlock_disc = null; |
3422 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
3422 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
3423 | 3423 | if (self::check_addlock_discuss() == 1) { |
3424 | - $addlock_disc = Display::return_icon('unlock.png', get_lang('UnlockDiscussExtra'),'',ICON_SIZE_SMALL); |
|
3425 | - $lock_unlock_disc ='unlockdisc'; |
|
3424 | + $addlock_disc = Display::return_icon('unlock.png', get_lang('UnlockDiscussExtra'), '', ICON_SIZE_SMALL); |
|
3425 | + $lock_unlock_disc = 'unlockdisc'; |
|
3426 | 3426 | } else { |
3427 | - $addlock_disc = Display::return_icon('lock.png', get_lang('LockDiscussExtra'),'',ICON_SIZE_SMALL); |
|
3428 | - $lock_unlock_disc ='lockdisc'; |
|
3427 | + $addlock_disc = Display::return_icon('lock.png', get_lang('LockDiscussExtra'), '', ICON_SIZE_SMALL); |
|
3428 | + $lock_unlock_disc = 'lockdisc'; |
|
3429 | 3429 | } |
3430 | 3430 | } |
3431 | 3431 | echo '<span style="float:right">'; |
@@ -3436,12 +3436,12 @@ discard block |
||
3436 | 3436 | $visibility_disc = null; |
3437 | 3437 | $hide_show_disc = null; |
3438 | 3438 | if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
3439 | - if (self::check_visibility_discuss()==1) { |
|
3439 | + if (self::check_visibility_discuss() == 1) { |
|
3440 | 3440 | /// TODO: Fix Mode assignments: If is hidden, show discussion to student only if student is the author |
3441 | - $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'),'',ICON_SIZE_SMALL); |
|
3441 | + $visibility_disc = Display::return_icon('visible.png', get_lang('ShowDiscussExtra'), '', ICON_SIZE_SMALL); |
|
3442 | 3442 | $hide_show_disc = 'hidedisc'; |
3443 | 3443 | } else { |
3444 | - $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'),'',ICON_SIZE_SMALL); |
|
3444 | + $visibility_disc = Display::return_icon('invisible.png', get_lang('HideDiscussExtra'), '', ICON_SIZE_SMALL); |
|
3445 | 3445 | $hide_show_disc = 'showdisc'; |
3446 | 3446 | } |
3447 | 3447 | } |
@@ -3454,10 +3454,10 @@ discard block |
||
3454 | 3454 | $ratinglock_disc = null; |
3455 | 3455 | if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
3456 | 3456 | if (self::check_ratinglock_discuss() == 1) { |
3457 | - $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'),'',ICON_SIZE_SMALL); |
|
3457 | + $ratinglock_disc = Display::return_icon('star.png', get_lang('UnlockRatingDiscussExtra'), '', ICON_SIZE_SMALL); |
|
3458 | 3458 | $lock_unlock_rating_disc = 'unlockrating'; |
3459 | 3459 | } else { |
3460 | - $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'),'',ICON_SIZE_SMALL); |
|
3460 | + $ratinglock_disc = Display::return_icon('star_na.png', get_lang('LockRatingDiscussExtra'), '', ICON_SIZE_SMALL); |
|
3461 | 3461 | $lock_unlock_rating_disc = 'lockrating'; |
3462 | 3462 | } |
3463 | 3463 | } |
@@ -3468,11 +3468,11 @@ discard block |
||
3468 | 3468 | |
3469 | 3469 | //discussion action: email notification |
3470 | 3470 | if (self::check_notify_discuss($page) == 1) { |
3471 | - $notify_disc= Display::return_icon('messagebox_info.png', get_lang('NotifyDiscussByEmail'),'',ICON_SIZE_SMALL); |
|
3472 | - $lock_unlock_notify_disc='unlocknotifydisc'; |
|
3471 | + $notify_disc = Display::return_icon('messagebox_info.png', get_lang('NotifyDiscussByEmail'), '', ICON_SIZE_SMALL); |
|
3472 | + $lock_unlock_notify_disc = 'unlocknotifydisc'; |
|
3473 | 3473 | } else { |
3474 | - $notify_disc= Display::return_icon('mail.png', get_lang('CancelNotifyDiscussByEmail'),'',ICON_SIZE_SMALL); |
|
3475 | - $lock_unlock_notify_disc='locknotifydisc'; |
|
3474 | + $notify_disc = Display::return_icon('mail.png', get_lang('CancelNotifyDiscussByEmail'), '', ICON_SIZE_SMALL); |
|
3475 | + $lock_unlock_notify_disc = 'locknotifydisc'; |
|
3476 | 3476 | } |
3477 | 3477 | echo '<span style="float:right">'; |
3478 | 3478 | echo '<a href="index.php?action=discuss&actionpage='.$lock_unlock_notify_disc.'&title='.api_htmlentities(urlencode($page)).'">'.$notify_disc.'</a>'; |
@@ -3481,26 +3481,26 @@ discard block |
||
3481 | 3481 | echo $icon_assignment.' '.api_htmlentities($row['title']); |
3482 | 3482 | |
3483 | 3483 | if ($lastuserinfo !== false) { |
3484 | - echo ' (' . get_lang('MostRecentVersionBy') . ' ' . UserManager::getUserProfileLink($lastuserinfo) . ' ' . $lastversiondate . $countWPost . ')' . $avg_WPost_score . ' '; //TODO: read average score |
|
3484 | + echo ' ('.get_lang('MostRecentVersionBy').' '.UserManager::getUserProfileLink($lastuserinfo).' '.$lastversiondate.$countWPost.')'.$avg_WPost_score.' '; //TODO: read average score |
|
3485 | 3485 | } |
3486 | 3486 | |
3487 | 3487 | echo '</div>'; |
3488 | - if ($row['addlock_disc']==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
3488 | + if ($row['addlock_disc'] == 1 || api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
3489 | 3489 | //show comments but students can't add theirs |
3490 | 3490 | ?> |
3491 | 3491 | <form name="form1" method="post" action=""> |
3492 | 3492 | <table> |
3493 | 3493 | <tr> |
3494 | - <td valign="top" ><?php echo get_lang('Comments');?>:</td> |
|
3495 | - <?php echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">';//prevent double post ?> |
|
3494 | + <td valign="top" ><?php echo get_lang('Comments'); ?>:</td> |
|
3495 | + <?php echo '<input type="hidden" name="wpost_id" value="'.md5(uniqid(rand(), true)).'">'; //prevent double post ?> |
|
3496 | 3496 | <td><textarea name="comment" cols="80" rows="5" id="comment"></textarea></td> |
3497 | 3497 | </tr> |
3498 | 3498 | <tr> |
3499 | 3499 | <?php |
3500 | 3500 | //check if rating is allowed |
3501 | - if ($row['ratinglock_disc']==1 || api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
3501 | + if ($row['ratinglock_disc'] == 1 || api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
3502 | 3502 | ?> |
3503 | - <td><?php echo get_lang('Rating');?>: </td> |
|
3503 | + <td><?php echo get_lang('Rating'); ?>: </td> |
|
3504 | 3504 | <td valign="top"><select name="rating" id="rating"> |
3505 | 3505 | <option value="-" selected>-</option> |
3506 | 3506 | <option value="0">0</option> |
@@ -3517,7 +3517,7 @@ discard block |
||
3517 | 3517 | </select></td> |
3518 | 3518 | <?php |
3519 | 3519 | } else { |
3520 | - echo '<input type=hidden name="rating" value="-">';// must pass a default value to avoid rate automatically |
|
3520 | + echo '<input type=hidden name="rating" value="-">'; // must pass a default value to avoid rate automatically |
|
3521 | 3521 | } |
3522 | 3522 | ?> |
3523 | 3523 | </tr> |
@@ -3557,12 +3557,12 @@ discard block |
||
3557 | 3557 | $sql = "SELECT * FROM $tbl_wiki_discuss |
3558 | 3558 | WHERE c_id = $course_id AND publication_id='".$id."' AND NOT p_score='-'"; |
3559 | 3559 | $result3 = Database::query($sql); |
3560 | - $countWPost_score= Database::num_rows($result3); |
|
3560 | + $countWPost_score = Database::num_rows($result3); |
|
3561 | 3561 | |
3562 | - echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score;// |
|
3562 | + echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score; // |
|
3563 | 3563 | |
3564 | - if ($countWPost_score!=0) { |
|
3565 | - $avg_WPost_score = round($row2['sumWPost'] / $countWPost_score,2).' / 10'; |
|
3564 | + if ($countWPost_score != 0) { |
|
3565 | + $avg_WPost_score = round($row2['sumWPost'] / $countWPost_score, 2).' / 10'; |
|
3566 | 3566 | } else { |
3567 | 3567 | $avg_WPost_score = $countWPost_score; |
3568 | 3568 | } |
@@ -3580,16 +3580,16 @@ discard block |
||
3580 | 3580 | |
3581 | 3581 | echo '<hr noshade size="1">'; |
3582 | 3582 | |
3583 | - while ($row=Database::fetch_array($result)) { |
|
3583 | + while ($row = Database::fetch_array($result)) { |
|
3584 | 3584 | $userinfo = api_get_user_info($row['userc_id']); |
3585 | - if (($userinfo['status'])=="5") { |
|
3586 | - $author_status=get_lang('Student'); |
|
3585 | + if (($userinfo['status']) == "5") { |
|
3586 | + $author_status = get_lang('Student'); |
|
3587 | 3587 | } else { |
3588 | - $author_status=get_lang('Teacher'); |
|
3588 | + $author_status = get_lang('Teacher'); |
|
3589 | 3589 | } |
3590 | 3590 | |
3591 | 3591 | $name = $userinfo['complete_name']; |
3592 | - $author_photo= '<img src="'.$userinfo['avatar'].'" alt="'.api_htmlentities($name).'" width="40" height="50" align="top" title="'.api_htmlentities($name).'" />'; |
|
3592 | + $author_photo = '<img src="'.$userinfo['avatar'].'" alt="'.api_htmlentities($name).'" width="40" height="50" align="top" title="'.api_htmlentities($name).'" />'; |
|
3593 | 3593 | |
3594 | 3594 | //stars |
3595 | 3595 | $p_score = $row['p_score']; |
@@ -3635,7 +3635,7 @@ discard block |
||
3635 | 3635 | if ($userinfo !== false) { |
3636 | 3636 | $userProfile = UserManager::getUserProfileLink($userinfo); |
3637 | 3637 | } |
3638 | - echo '<td style=" color:#999999">' . $userProfile . ' (' . $author_status . ') '. |
|
3638 | + echo '<td style=" color:#999999">'.$userProfile.' ('.$author_status.') '. |
|
3639 | 3639 | api_get_local_time($row['dtime'], null, date_default_timezone_get()). |
3640 | 3640 | ' - '.get_lang('Rating').': '.$row['p_score'].' '.$imagerating.' </td>'; |
3641 | 3641 | echo '</tr>'; |
@@ -3672,7 +3672,7 @@ discard block |
||
3672 | 3672 | } |
3673 | 3673 | echo '</div>'; |
3674 | 3674 | |
3675 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden |
|
3675 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden |
|
3676 | 3676 | $sql = 'SELECT * |
3677 | 3677 | FROM '.$tbl_wiki.' s1 |
3678 | 3678 | WHERE s1.c_id = '.$course_id.' AND id=( |
@@ -3698,11 +3698,11 @@ discard block |
||
3698 | 3698 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES); |
3699 | 3699 | |
3700 | 3700 | //get type assignment icon |
3701 | - if ($obj->assignment==1) { |
|
3702 | - $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL); |
|
3703 | - } elseif ($obj->assignment==2) { |
|
3704 | - $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); |
|
3705 | - } elseif ($obj->assignment==0) { |
|
3701 | + if ($obj->assignment == 1) { |
|
3702 | + $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); |
|
3703 | + } elseif ($obj->assignment == 2) { |
|
3704 | + $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
|
3705 | + } elseif ($obj->assignment == 0) { |
|
3706 | 3706 | $ShowAssignment = Display::return_icon('px_transparent.gif'); |
3707 | 3707 | } |
3708 | 3708 | |
@@ -3725,29 +3725,29 @@ discard block |
||
3725 | 3725 | } |
3726 | 3726 | $row[] = api_get_local_time($obj->dtime, null, date_default_timezone_get()); |
3727 | 3727 | $showdelete = ''; |
3728 | - if (api_is_allowed_to_edit(false,true)|| api_is_platform_admin()) { |
|
3729 | - $showdelete =' <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
3730 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL); |
|
3728 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
3729 | + $showdelete = ' <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=delete&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
3730 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
3731 | 3731 | } |
3732 | - if (api_is_allowed_to_session_edit(false,true) ) { |
|
3732 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
3733 | 3733 | $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=edit&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
3734 | - Display::return_icon('edit.png', get_lang('EditPage'),'',ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=discuss&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
3735 | - Display::return_icon('discuss.png', get_lang('Discuss'),'',ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=history&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
3736 | - Display::return_icon('history.png', get_lang('History'),'',ICON_SIZE_SMALL).'</a> |
|
3734 | + Display::return_icon('edit.png', get_lang('EditPage'), '', ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=discuss&title='.api_htmlentities(urlencode($obj->reflink)).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
3735 | + Display::return_icon('discuss.png', get_lang('Discuss'), '', ICON_SIZE_SMALL).'</a> <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=history&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
3736 | + Display::return_icon('history.png', get_lang('History'), '', ICON_SIZE_SMALL).'</a> |
|
3737 | 3737 | <a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=links&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
3738 | - Display::return_icon('what_link_here.png', get_lang('LinksPages'),'',ICON_SIZE_SMALL).'</a>'.$showdelete; |
|
3738 | + Display::return_icon('what_link_here.png', get_lang('LinksPages'), '', ICON_SIZE_SMALL).'</a>'.$showdelete; |
|
3739 | 3739 | } |
3740 | 3740 | $rows[] = $row; |
3741 | 3741 | } |
3742 | 3742 | |
3743 | - $table = new SortableTableFromArrayConfig($rows,1,10,'AllPages_table','','','ASC'); |
|
3744 | - $table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']),'action'=>Security::remove_XSS($action),'group_id'=>Security::remove_XSS($_GET['group_id']))); |
|
3745 | - $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;')); |
|
3746 | - $table->set_header(1,get_lang('Title'), true); |
|
3747 | - $table->set_header(2,get_lang('Author').' ('.get_lang('LastVersion').')', true); |
|
3748 | - $table->set_header(3,get_lang('Date').' ('.get_lang('LastVersion').')', true); |
|
3749 | - if (api_is_allowed_to_session_edit(false,true) ) { |
|
3750 | - $table->set_header(4,get_lang('Actions'), true, array ('style' => 'width:130px;')); |
|
3743 | + $table = new SortableTableFromArrayConfig($rows, 1, 10, 'AllPages_table', '', '', 'ASC'); |
|
3744 | + $table->set_additional_parameters(array('cidReq' =>Security::remove_XSS($_GET['cidReq']), 'action'=>Security::remove_XSS($action), 'group_id'=>Security::remove_XSS($_GET['group_id']))); |
|
3745 | + $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;')); |
|
3746 | + $table->set_header(1, get_lang('Title'), true); |
|
3747 | + $table->set_header(2, get_lang('Author').' ('.get_lang('LastVersion').')', true); |
|
3748 | + $table->set_header(3, get_lang('Date').' ('.get_lang('LastVersion').')', true); |
|
3749 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
3750 | + $table->set_header(4, get_lang('Actions'), true, array('style' => 'width:130px;')); |
|
3751 | 3751 | } |
3752 | 3752 | $table->display(); |
3753 | 3753 | } |
@@ -3767,13 +3767,13 @@ discard block |
||
3767 | 3767 | $groupfilter = $this->groupfilter; |
3768 | 3768 | $tbl_wiki_conf = $this->tbl_wiki_conf; |
3769 | 3769 | |
3770 | - if (api_is_allowed_to_session_edit(false,true) ) { |
|
3771 | - if (self::check_notify_all()==1) { |
|
3772 | - $notify_all= Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'),'',ICON_SIZE_SMALL).' '.get_lang('NotNotifyChanges'); |
|
3773 | - $lock_unlock_notify_all='unlocknotifyall'; |
|
3770 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
3771 | + if (self::check_notify_all() == 1) { |
|
3772 | + $notify_all = Display::return_icon('messagebox_info.png', get_lang('NotifyByEmail'), '', ICON_SIZE_SMALL).' '.get_lang('NotNotifyChanges'); |
|
3773 | + $lock_unlock_notify_all = 'unlocknotifyall'; |
|
3774 | 3774 | } else { |
3775 | - $notify_all=Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'),'',ICON_SIZE_SMALL).' '.get_lang('NotifyChanges'); |
|
3776 | - $lock_unlock_notify_all='locknotifyall'; |
|
3775 | + $notify_all = Display::return_icon('mail.png', get_lang('CancelNotifyByEmail'), '', ICON_SIZE_SMALL).' '.get_lang('NotifyChanges'); |
|
3776 | + $lock_unlock_notify_all = 'locknotifyall'; |
|
3777 | 3777 | } |
3778 | 3778 | } |
3779 | 3779 | |
@@ -3781,7 +3781,7 @@ discard block |
||
3781 | 3781 | echo '<a href="index.php?action=recentchanges&actionpage='.$lock_unlock_notify_all.'&title='.api_htmlentities(urlencode($page)).'">'.$notify_all.'</a>'; |
3782 | 3782 | echo '</span>'.get_lang('RecentChanges').'</div>'; |
3783 | 3783 | |
3784 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden |
|
3784 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden |
|
3785 | 3785 | $sql = 'SELECT * FROM '.$tbl_wiki.', '.$tbl_wiki_conf.' |
3786 | 3786 | WHERE '.$tbl_wiki_conf.'.c_id= '.$course_id.' AND |
3787 | 3787 | '.$tbl_wiki.'.c_id= '.$course_id.' AND |
@@ -3809,19 +3809,19 @@ discard block |
||
3809 | 3809 | $userinfo = api_get_user_info($obj->user_id); |
3810 | 3810 | |
3811 | 3811 | //get type assignment icon |
3812 | - if ($obj->assignment==1) { |
|
3813 | - $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL); |
|
3814 | - } elseif ($obj->assignment==2) { |
|
3815 | - $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); |
|
3816 | - } elseif ($obj->assignment==0) { |
|
3817 | - $ShowAssignment=Display::return_icon('px_transparent.gif'); |
|
3812 | + if ($obj->assignment == 1) { |
|
3813 | + $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); |
|
3814 | + } elseif ($obj->assignment == 2) { |
|
3815 | + $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
|
3816 | + } elseif ($obj->assignment == 0) { |
|
3817 | + $ShowAssignment = Display::return_icon('px_transparent.gif'); |
|
3818 | 3818 | } |
3819 | 3819 | |
3820 | 3820 | // Get icon task |
3821 | 3821 | if (!empty($obj->task)) { |
3822 | - $icon_task=Display::return_icon('wiki_task.png', get_lang('StandardTask'),'',ICON_SIZE_SMALL); |
|
3822 | + $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL); |
|
3823 | 3823 | } else { |
3824 | - $icon_task=Display::return_icon('px_transparent.gif'); |
|
3824 | + $icon_task = Display::return_icon('px_transparent.gif'); |
|
3825 | 3825 | } |
3826 | 3826 | |
3827 | 3827 | $row = array(); |
@@ -3829,7 +3829,7 @@ discard block |
||
3829 | 3829 | $row[] = $ShowAssignment.$icon_task; |
3830 | 3830 | $row[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&view='.$obj->id.'&session_id='.api_get_session_id().'&group_id='.api_get_group_id().'">'. |
3831 | 3831 | api_htmlentities($obj->title).'</a>'; |
3832 | - $row[] = $obj->version>1 ? get_lang('EditedBy') : get_lang('AddedBy'); |
|
3832 | + $row[] = $obj->version > 1 ? get_lang('EditedBy') : get_lang('AddedBy'); |
|
3833 | 3833 | if ($userinfo !== false) { |
3834 | 3834 | $row[] = UserManager::getUserProfileLink($userinfo); |
3835 | 3835 | } else { |
@@ -3838,7 +3838,7 @@ discard block |
||
3838 | 3838 | $rows[] = $row; |
3839 | 3839 | } |
3840 | 3840 | |
3841 | - $table = new SortableTableFromArrayConfig($rows,0,10,'RecentPages_table','','','DESC'); |
|
3841 | + $table = new SortableTableFromArrayConfig($rows, 0, 10, 'RecentPages_table', '', '', 'DESC'); |
|
3842 | 3842 | $table->set_additional_parameters( |
3843 | 3843 | array( |
3844 | 3844 | 'cidReq' =>api_get_course_id(), |
@@ -3847,11 +3847,11 @@ discard block |
||
3847 | 3847 | 'group_id' => api_get_group_id() |
3848 | 3848 | ) |
3849 | 3849 | ); |
3850 | - $table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;')); |
|
3851 | - $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;')); |
|
3852 | - $table->set_header(2,get_lang('Title'), true); |
|
3853 | - $table->set_header(3,get_lang('Actions'), true, array ('style' => 'width:80px;')); |
|
3854 | - $table->set_header(4,get_lang('Author'), true); |
|
3850 | + $table->set_header(0, get_lang('Date'), true, array('style' => 'width:200px;')); |
|
3851 | + $table->set_header(1, get_lang('Type'), true, array('style' => 'width:30px;')); |
|
3852 | + $table->set_header(2, get_lang('Title'), true); |
|
3853 | + $table->set_header(3, get_lang('Actions'), true, array('style' => 'width:80px;')); |
|
3854 | + $table->set_header(4, get_lang('Author'), true); |
|
3855 | 3855 | $table->display(); |
3856 | 3856 | } |
3857 | 3857 | } |
@@ -3883,17 +3883,17 @@ discard block |
||
3883 | 3883 | |
3884 | 3884 | //get type assignment icon |
3885 | 3885 | $ShowAssignment = ''; |
3886 | - if ($row['assignment']==1) { |
|
3887 | - $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL); |
|
3888 | - } elseif ($row['assignment']==2) { |
|
3889 | - $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); |
|
3890 | - } elseif ($row['assignment']==0) { |
|
3891 | - $ShowAssignment=Display::return_icon('px_transparent.gif'); |
|
3886 | + if ($row['assignment'] == 1) { |
|
3887 | + $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); |
|
3888 | + } elseif ($row['assignment'] == 2) { |
|
3889 | + $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
|
3890 | + } elseif ($row['assignment'] == 0) { |
|
3891 | + $ShowAssignment = Display::return_icon('px_transparent.gif'); |
|
3892 | 3892 | } |
3893 | 3893 | |
3894 | 3894 | //fix Title to reflink (link Main Page) |
3895 | - if ($page==get_lang('DefaultTitle')) { |
|
3896 | - $page='index'; |
|
3895 | + if ($page == get_lang('DefaultTitle')) { |
|
3896 | + $page = 'index'; |
|
3897 | 3897 | } |
3898 | 3898 | |
3899 | 3899 | echo '<div id="wikititle">'; |
@@ -3904,11 +3904,11 @@ discard block |
||
3904 | 3904 | //fix index to title Main page into linksto |
3905 | 3905 | |
3906 | 3906 | if ($page == 'index') { |
3907 | - $page = str_replace(' ','_',get_lang('DefaultTitle')); |
|
3907 | + $page = str_replace(' ', '_', get_lang('DefaultTitle')); |
|
3908 | 3908 | } |
3909 | 3909 | |
3910 | 3910 | //table |
3911 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
3911 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
3912 | 3912 | //only by professors if page is hidden |
3913 | 3913 | $sql = "SELECT * FROM ".$tbl_wiki." s1 |
3914 | 3914 | WHERE s1.c_id = $course_id AND linksto LIKE '%".Database::escape_string($page)."%' AND id=( |
@@ -3935,10 +3935,10 @@ discard block |
||
3935 | 3935 | //get time |
3936 | 3936 | $year = substr($obj->dtime, 0, 4); |
3937 | 3937 | $month = substr($obj->dtime, 5, 2); |
3938 | - $day = substr($obj->dtime, 8, 2); |
|
3939 | - $hours = substr($obj->dtime, 11,2); |
|
3940 | - $minutes = substr($obj->dtime, 14,2); |
|
3941 | - $seconds = substr($obj->dtime, 17,2); |
|
3938 | + $day = substr($obj->dtime, 8, 2); |
|
3939 | + $hours = substr($obj->dtime, 11, 2); |
|
3940 | + $minutes = substr($obj->dtime, 14, 2); |
|
3941 | + $seconds = substr($obj->dtime, 17, 2); |
|
3942 | 3942 | |
3943 | 3943 | //get type assignment icon |
3944 | 3944 | if ($obj->assignment == 1) { |
@@ -3950,7 +3950,7 @@ discard block |
||
3950 | 3950 | } |
3951 | 3951 | |
3952 | 3952 | $row = array(); |
3953 | - $row[] =$ShowAssignment; |
|
3953 | + $row[] = $ShowAssignment; |
|
3954 | 3954 | $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode($obj->reflink)).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
3955 | 3955 | api_htmlentities($obj->title).'</a>'; |
3956 | 3956 | if ($userinfo !== false) { |
@@ -4057,13 +4057,13 @@ discard block |
||
4057 | 4057 | $userId = intval($userId); |
4058 | 4058 | $userinfo = api_get_user_info($userId); |
4059 | 4059 | if ($userinfo !== false) { |
4060 | - echo '<div class="actions">' . get_lang('UserContributions') . ': ' . UserManager::getUserProfileLink($userinfo) . |
|
4061 | - '<a href="' . api_get_self() . '?cidReq=' . $_course['code'] . '&action=usercontrib&user_id=' . $userId . |
|
4062 | - '&session_id=' . $this->session_id . '&group_id=' . $this->group_id . '">' . |
|
4060 | + echo '<div class="actions">'.get_lang('UserContributions').': '.UserManager::getUserProfileLink($userinfo). |
|
4061 | + '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=usercontrib&user_id='.$userId. |
|
4062 | + '&session_id='.$this->session_id.'&group_id='.$this->group_id.'">'. |
|
4063 | 4063 | '</a></div>'; |
4064 | 4064 | } |
4065 | 4065 | |
4066 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
4066 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
4067 | 4067 | //only by professors if page is hidden |
4068 | 4068 | $sql = 'SELECT * FROM '.$tbl_wiki.' |
4069 | 4069 | WHERE |
@@ -4088,19 +4088,19 @@ discard block |
||
4088 | 4088 | // Get time |
4089 | 4089 | $year = substr($obj->dtime, 0, 4); |
4090 | 4090 | $month = substr($obj->dtime, 5, 2); |
4091 | - $day = substr($obj->dtime, 8, 2); |
|
4092 | - $hours = substr($obj->dtime, 11,2); |
|
4093 | - $minutes = substr($obj->dtime, 14,2); |
|
4094 | - $seconds = substr($obj->dtime, 17,2); |
|
4091 | + $day = substr($obj->dtime, 8, 2); |
|
4092 | + $hours = substr($obj->dtime, 11, 2); |
|
4093 | + $minutes = substr($obj->dtime, 14, 2); |
|
4094 | + $seconds = substr($obj->dtime, 17, 2); |
|
4095 | 4095 | |
4096 | 4096 | //get type assignment icon |
4097 | 4097 | $ShowAssignment = ''; |
4098 | - if ($obj->assignment==1) { |
|
4099 | - $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL); |
|
4100 | - } elseif ($obj->assignment==2) { |
|
4101 | - $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); |
|
4102 | - } elseif ($obj->assignment==0) { |
|
4103 | - $ShowAssignment= Display::return_icon('px_transparent.gif'); |
|
4098 | + if ($obj->assignment == 1) { |
|
4099 | + $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL); |
|
4100 | + } elseif ($obj->assignment == 2) { |
|
4101 | + $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
|
4102 | + } elseif ($obj->assignment == 0) { |
|
4103 | + $ShowAssignment = Display::return_icon('px_transparent.gif'); |
|
4104 | 4104 | } |
4105 | 4105 | |
4106 | 4106 | $row = array(); |
@@ -4116,7 +4116,7 @@ discard block |
||
4116 | 4116 | |
4117 | 4117 | } |
4118 | 4118 | |
4119 | - $table = new SortableTableFromArrayConfig($rows,2,10,'UsersContributions_table','','','ASC'); |
|
4119 | + $table = new SortableTableFromArrayConfig($rows, 2, 10, 'UsersContributions_table', '', '', 'ASC'); |
|
4120 | 4120 | $table->set_additional_parameters( |
4121 | 4121 | array( |
4122 | 4122 | 'cidReq' => Security::remove_XSS($_GET['cidReq']), |
@@ -4126,13 +4126,13 @@ discard block |
||
4126 | 4126 | 'group_id' => intval($_GET['group_id']), |
4127 | 4127 | ) |
4128 | 4128 | ); |
4129 | - $table->set_header(0,get_lang('Date'), true, array ('style' => 'width:200px;')); |
|
4130 | - $table->set_header(1,get_lang('Type'), true, array ('style' => 'width:30px;')); |
|
4131 | - $table->set_header(2,get_lang('Title'), true, array ('style' => 'width:200px;')); |
|
4132 | - $table->set_header(3,get_lang('Version'), true, array ('style' => 'width:30px;')); |
|
4133 | - $table->set_header(4,get_lang('Comment'), true, array ('style' => 'width:200px;')); |
|
4134 | - $table->set_header(5,get_lang('Progress'), true, array ('style' => 'width:30px;')); |
|
4135 | - $table->set_header(6,get_lang('Rating'), true, array ('style' => 'width:30px;')); |
|
4129 | + $table->set_header(0, get_lang('Date'), true, array('style' => 'width:200px;')); |
|
4130 | + $table->set_header(1, get_lang('Type'), true, array('style' => 'width:30px;')); |
|
4131 | + $table->set_header(2, get_lang('Title'), true, array('style' => 'width:200px;')); |
|
4132 | + $table->set_header(3, get_lang('Version'), true, array('style' => 'width:30px;')); |
|
4133 | + $table->set_header(4, get_lang('Comment'), true, array('style' => 'width:200px;')); |
|
4134 | + $table->set_header(5, get_lang('Progress'), true, array('style' => 'width:30px;')); |
|
4135 | + $table->set_header(6, get_lang('Rating'), true, array('style' => 'width:30px;')); |
|
4136 | 4136 | $table->display(); |
4137 | 4137 | } |
4138 | 4138 | } |
@@ -4150,7 +4150,7 @@ discard block |
||
4150 | 4150 | |
4151 | 4151 | echo '<div class="actions">'.get_lang('MostChangedPages').'</div>'; |
4152 | 4152 | |
4153 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden |
|
4153 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden |
|
4154 | 4154 | $sql = 'SELECT *, MAX(version) AS MAX FROM '.$tbl_wiki.' |
4155 | 4155 | WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
4156 | 4156 | GROUP BY reflink';//TODO:check MAX and group by return last version |
@@ -4168,12 +4168,12 @@ discard block |
||
4168 | 4168 | while ($obj = Database::fetch_object($allpages)) { |
4169 | 4169 | //get type assignment icon |
4170 | 4170 | $ShowAssignment = ''; |
4171 | - if ($obj->assignment==1) { |
|
4172 | - $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL); |
|
4173 | - } elseif ($obj->assignment==2) { |
|
4174 | - $ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); |
|
4175 | - } elseif ($obj->assignment==0) { |
|
4176 | - $ShowAssignment= Display::return_icon('px_transparent.gif'); |
|
4171 | + if ($obj->assignment == 1) { |
|
4172 | + $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); |
|
4173 | + } elseif ($obj->assignment == 2) { |
|
4174 | + $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
|
4175 | + } elseif ($obj->assignment == 0) { |
|
4176 | + $ShowAssignment = Display::return_icon('px_transparent.gif'); |
|
4177 | 4177 | } |
4178 | 4178 | |
4179 | 4179 | $row = array(); |
@@ -4201,9 +4201,9 @@ discard block |
||
4201 | 4201 | 'group_id' => intval($_GET['group_id']), |
4202 | 4202 | ) |
4203 | 4203 | ); |
4204 | - $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;')); |
|
4205 | - $table->set_header(1,get_lang('Title'), true); |
|
4206 | - $table->set_header(2,get_lang('Changes'), true); |
|
4204 | + $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;')); |
|
4205 | + $table->set_header(1, get_lang('Title'), true); |
|
4206 | + $table->set_header(2, get_lang('Changes'), true); |
|
4207 | 4207 | $table->display(); |
4208 | 4208 | } |
4209 | 4209 | } |
@@ -4228,7 +4228,7 @@ discard block |
||
4228 | 4228 | /* Only teachers and platform admin can edit the index page. |
4229 | 4229 | Only teachers and platform admin can edit an assignment teacher*/ |
4230 | 4230 | if (($current_row['reflink'] == 'index' || $current_row['reflink'] == '' || $current_row['assignment'] == 1) && |
4231 | - (!api_is_allowed_to_edit(false,true) && $this->group_id == 0) |
|
4231 | + (!api_is_allowed_to_edit(false, true) && $this->group_id == 0) |
|
4232 | 4232 | ) { |
4233 | 4233 | Display::addFlash( |
4234 | 4234 | Display::display_normal_message(get_lang('OnlyEditPagesCourseManager'), false, true) |
@@ -4239,7 +4239,7 @@ discard block |
||
4239 | 4239 | if ($current_row['group_id'] != 0) { |
4240 | 4240 | $groupInfo = GroupManager::get_group_properties($this->group_id); |
4241 | 4241 | //Only teacher, platform admin and group members can edit a wiki group |
4242 | - if (api_is_allowed_to_edit(false,true) || |
|
4242 | + if (api_is_allowed_to_edit(false, true) || |
|
4243 | 4243 | api_is_platform_admin() || |
4244 | 4244 | GroupManager :: is_user_in_group($userId, $groupInfo['iid']) || |
4245 | 4245 | api_is_allowed_in_course() |
@@ -4258,9 +4258,9 @@ discard block |
||
4258 | 4258 | //$icon_assignment = null; |
4259 | 4259 | if ($current_row['assignment'] == 1) { |
4260 | 4260 | Display::addFlash(Display::display_normal_message(get_lang('EditAssignmentWarning'), false, true)); |
4261 | - } elseif($current_row['assignment']==2) { |
|
4262 | - if (($userId == $current_row['user_id'])==false) { |
|
4263 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
4261 | + } elseif ($current_row['assignment'] == 2) { |
|
4262 | + if (($userId == $current_row['user_id']) == false) { |
|
4263 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
4264 | 4264 | $PassEdit = true; |
4265 | 4265 | } else { |
4266 | 4266 | Display::addFlash(Display::display_warning_message(get_lang('LockByTeacher'), false, true)); |
@@ -4274,11 +4274,11 @@ discard block |
||
4274 | 4274 | //show editor if edit is allowed |
4275 | 4275 | if ($PassEdit) { |
4276 | 4276 | if ($current_row['editlock'] == 1 && |
4277 | - (api_is_allowed_to_edit(false,true)==false || api_is_platform_admin()==false) |
|
4277 | + (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false) |
|
4278 | 4278 | ) { |
4279 | 4279 | Display::addFlash(Display::display_normal_message(get_lang('PageLockedExtra'), false, true)); |
4280 | 4280 | } else { |
4281 | - if ($last_row['is_editing']!=0 && $last_row['is_editing'] != $userId) { |
|
4281 | + if ($last_row['is_editing'] != 0 && $last_row['is_editing'] != $userId) { |
|
4282 | 4282 | // Checking for concurrent users |
4283 | 4283 | $timestamp_edit = strtotime($last_row['time_edit']); |
4284 | 4284 | $time_editing = time() - $timestamp_edit; |
@@ -4287,7 +4287,7 @@ discard block |
||
4287 | 4287 | $userinfo = api_get_user_info($last_row['is_editing']); |
4288 | 4288 | $is_being_edited = get_lang('ThisPageisBeginEditedBy').' <a href='.$userinfo['profile_url'].'>'. |
4289 | 4289 | Display::tag('span', $userinfo['complete_name_with_username']). |
4290 | - get_lang('ThisPageisBeginEditedTryLater').' '.date( "i",$rest_time).' '.get_lang('MinMinutes'); |
|
4290 | + get_lang('ThisPageisBeginEditedTryLater').' '.date("i", $rest_time).' '.get_lang('MinMinutes'); |
|
4291 | 4291 | Display::addFlash(Display::display_normal_message($is_being_edited, false, true)); |
4292 | 4292 | } else { |
4293 | 4293 | Display::addFlash(Display::display_confirmation_message( |
@@ -4395,9 +4395,9 @@ discard block |
||
4395 | 4395 | GROUP BY reflink |
4396 | 4396 | ORDER BY reflink ASC'; |
4397 | 4397 | $allpages = Database::query($sql); |
4398 | - while ($row=Database::fetch_array($allpages)) { |
|
4399 | - if ($row['reflink']=='index') { |
|
4400 | - $row['reflink']=str_replace(' ', '_', get_lang('DefaultTitle')); |
|
4398 | + while ($row = Database::fetch_array($allpages)) { |
|
4399 | + if ($row['reflink'] == 'index') { |
|
4400 | + $row['reflink'] = str_replace(' ', '_', get_lang('DefaultTitle')); |
|
4401 | 4401 | } |
4402 | 4402 | $pages[] = $row['reflink']; |
4403 | 4403 | } |
@@ -4415,16 +4415,16 @@ discard block |
||
4415 | 4415 | |
4416 | 4416 | $allpages = Database::query($sql); |
4417 | 4417 | |
4418 | - while ($row=Database::fetch_array($allpages)) { |
|
4418 | + while ($row = Database::fetch_array($allpages)) { |
|
4419 | 4419 | //remove self reference |
4420 | - $row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"])); |
|
4420 | + $row['linksto'] = str_replace($row["reflink"], " ", trim($row["linksto"])); |
|
4421 | 4421 | $refs = explode(" ", trim($row["linksto"])); |
4422 | 4422 | |
4423 | 4423 | // Find linksto into reflink. If found ->page is linked |
4424 | 4424 | foreach ($refs as $v) { |
4425 | 4425 | if (in_array($v, $pages)) { |
4426 | - if (trim($v)!="") { |
|
4427 | - $linked[]=$v; |
|
4426 | + if (trim($v) != "") { |
|
4427 | + $linked[] = $v; |
|
4428 | 4428 | } |
4429 | 4429 | } |
4430 | 4430 | } |
@@ -4436,12 +4436,12 @@ discard block |
||
4436 | 4436 | $rows = array(); |
4437 | 4437 | foreach ($linked as $linked_show) { |
4438 | 4438 | $row = array(); |
4439 | - $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode(str_replace('_',' ',$linked_show))).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
4440 | - str_replace('_',' ',$linked_show).'</a>'; |
|
4439 | + $row[] = '<a href="'.api_get_self().'?cidReq='.$_course['code'].'&action=showpage&title='.api_htmlentities(urlencode(str_replace('_', ' ', $linked_show))).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'">'. |
|
4440 | + str_replace('_', ' ', $linked_show).'</a>'; |
|
4441 | 4441 | $rows[] = $row; |
4442 | 4442 | } |
4443 | 4443 | |
4444 | - $table = new SortableTableFromArrayConfig($rows,0,10,'LinkedPages_table','','','DESC'); |
|
4444 | + $table = new SortableTableFromArrayConfig($rows, 0, 10, 'LinkedPages_table', '', '', 'DESC'); |
|
4445 | 4445 | $table->set_additional_parameters( |
4446 | 4446 | array( |
4447 | 4447 | 'cidReq' => Security::remove_XSS($_GET['cidReq']), |
@@ -4450,7 +4450,7 @@ discard block |
||
4450 | 4450 | 'group_id' => intval($_GET['group_id']), |
4451 | 4451 | ) |
4452 | 4452 | ); |
4453 | - $table->set_header(0,get_lang('Title'), true); |
|
4453 | + $table->set_header(0, get_lang('Title'), true); |
|
4454 | 4454 | $table->display(); |
4455 | 4455 | } |
4456 | 4456 | |
@@ -4475,8 +4475,8 @@ discard block |
||
4475 | 4475 | WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
4476 | 4476 | GROUP BY reflink |
4477 | 4477 | ORDER BY reflink ASC'; |
4478 | - $allpages=Database::query($sql); |
|
4479 | - while ($row=Database::fetch_array($allpages)) { |
|
4478 | + $allpages = Database::query($sql); |
|
4479 | + while ($row = Database::fetch_array($allpages)) { |
|
4480 | 4480 | $pages[] = $row['reflink']; |
4481 | 4481 | } |
4482 | 4482 | |
@@ -4491,14 +4491,14 @@ discard block |
||
4491 | 4491 | )'; |
4492 | 4492 | $allpages = Database::query($sql); |
4493 | 4493 | $array_refs_linked = array(); |
4494 | - while ($row=Database::fetch_array($allpages)) { |
|
4495 | - $row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference |
|
4494 | + while ($row = Database::fetch_array($allpages)) { |
|
4495 | + $row['linksto'] = str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference |
|
4496 | 4496 | $refs = explode(" ", trim($row["linksto"])); |
4497 | - foreach ($refs as $ref_linked){ |
|
4498 | - if ($ref_linked==str_replace(' ','_',get_lang('DefaultTitle'))) { |
|
4499 | - $ref_linked='index'; |
|
4497 | + foreach ($refs as $ref_linked) { |
|
4498 | + if ($ref_linked == str_replace(' ', '_', get_lang('DefaultTitle'))) { |
|
4499 | + $ref_linked = 'index'; |
|
4500 | 4500 | } |
4501 | - $array_refs_linked[]= $ref_linked; |
|
4501 | + $array_refs_linked[] = $ref_linked; |
|
4502 | 4502 | } |
4503 | 4503 | } |
4504 | 4504 | |
@@ -4520,20 +4520,20 @@ discard block |
||
4520 | 4520 | '.$groupfilter.$condition_session.' AND |
4521 | 4521 | reflink="'.Database::escape_string($orphaned_show).'" |
4522 | 4522 | GROUP BY reflink'; |
4523 | - $allpages=Database::query($sql); |
|
4524 | - while ($row=Database::fetch_array($allpages)) { |
|
4525 | - $orphaned_title=$row['title']; |
|
4526 | - $orphaned_visibility=$row['visibility']; |
|
4527 | - if ($row['assignment']==1) { |
|
4528 | - $ShowAssignment=Display::return_icon('wiki_assignment.png','','',ICON_SIZE_SMALL); |
|
4529 | - } elseif ($row['assignment']==2) { |
|
4530 | - $ShowAssignment=Display::return_icon('wiki_work.png','','',ICON_SIZE_SMALL); |
|
4531 | - } elseif ($row['assignment']==0) { |
|
4532 | - $ShowAssignment= Display::return_icon('px_transparent.gif'); |
|
4523 | + $allpages = Database::query($sql); |
|
4524 | + while ($row = Database::fetch_array($allpages)) { |
|
4525 | + $orphaned_title = $row['title']; |
|
4526 | + $orphaned_visibility = $row['visibility']; |
|
4527 | + if ($row['assignment'] == 1) { |
|
4528 | + $ShowAssignment = Display::return_icon('wiki_assignment.png', '', '', ICON_SIZE_SMALL); |
|
4529 | + } elseif ($row['assignment'] == 2) { |
|
4530 | + $ShowAssignment = Display::return_icon('wiki_work.png', '', '', ICON_SIZE_SMALL); |
|
4531 | + } elseif ($row['assignment'] == 0) { |
|
4532 | + $ShowAssignment = Display::return_icon('px_transparent.gif'); |
|
4533 | 4533 | } |
4534 | 4534 | } |
4535 | 4535 | |
4536 | - if (!api_is_allowed_to_edit(false,true) || !api_is_platform_admin() && $orphaned_visibility==0){ |
|
4536 | + if (!api_is_allowed_to_edit(false, true) || !api_is_platform_admin() && $orphaned_visibility == 0) { |
|
4537 | 4537 | continue; |
4538 | 4538 | } |
4539 | 4539 | |
@@ -4545,7 +4545,7 @@ discard block |
||
4545 | 4545 | $rows[] = $row; |
4546 | 4546 | } |
4547 | 4547 | |
4548 | - $table = new SortableTableFromArrayConfig($rows,1, 10, 'OrphanedPages_table','','','DESC'); |
|
4548 | + $table = new SortableTableFromArrayConfig($rows, 1, 10, 'OrphanedPages_table', '', '', 'DESC'); |
|
4549 | 4549 | $table->set_additional_parameters( |
4550 | 4550 | array( |
4551 | 4551 | 'cidReq' => Security::remove_XSS($_GET['cidReq']), |
@@ -4554,8 +4554,8 @@ discard block |
||
4554 | 4554 | 'group_id' => intval($_GET['group_id']), |
4555 | 4555 | ) |
4556 | 4556 | ); |
4557 | - $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;')); |
|
4558 | - $table->set_header(1,get_lang('Title'), true); |
|
4557 | + $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;')); |
|
4558 | + $table->set_header(1, get_lang('Title'), true); |
|
4559 | 4559 | $table->display(); |
4560 | 4560 | } |
4561 | 4561 | |
@@ -4577,11 +4577,11 @@ discard block |
||
4577 | 4577 | WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
4578 | 4578 | GROUP BY reflink |
4579 | 4579 | ORDER BY reflink ASC'; |
4580 | - $allpages=Database::query($sql); |
|
4580 | + $allpages = Database::query($sql); |
|
4581 | 4581 | |
4582 | - while ($row=Database::fetch_array($allpages)) { |
|
4583 | - if ($row['reflink']=='index'){ |
|
4584 | - $row['reflink']=str_replace(' ','_',get_lang('DefaultTitle')); |
|
4582 | + while ($row = Database::fetch_array($allpages)) { |
|
4583 | + if ($row['reflink'] == 'index') { |
|
4584 | + $row['reflink'] = str_replace(' ', '_', get_lang('DefaultTitle')); |
|
4585 | 4585 | } |
4586 | 4586 | $pages[] = $row['reflink']; |
4587 | 4587 | } |
@@ -4595,31 +4595,31 @@ discard block |
||
4595 | 4595 | |
4596 | 4596 | $allpages = Database::query($sql); |
4597 | 4597 | |
4598 | - while ($row=Database::fetch_array($allpages)) { |
|
4598 | + while ($row = Database::fetch_array($allpages)) { |
|
4599 | 4599 | $refs = explode(" ", trim($row["linksto"])); |
4600 | 4600 | // Find linksto into reflink. If not found ->page is wanted |
4601 | 4601 | foreach ($refs as $v) { |
4602 | 4602 | |
4603 | 4603 | if (!in_array($v, $pages)) { |
4604 | - if (trim($v)!="") { |
|
4605 | - $wanted[]=$v; |
|
4604 | + if (trim($v) != "") { |
|
4605 | + $wanted[] = $v; |
|
4606 | 4606 | } |
4607 | 4607 | } |
4608 | 4608 | } |
4609 | 4609 | } |
4610 | 4610 | |
4611 | - $wanted = array_unique($wanted);//make a unique list |
|
4611 | + $wanted = array_unique($wanted); //make a unique list |
|
4612 | 4612 | |
4613 | 4613 | //show table |
4614 | 4614 | $rows = array(); |
4615 | 4615 | foreach ($wanted as $wanted_show) { |
4616 | 4616 | $row = array(); |
4617 | 4617 | $wanted_show = Security::remove_XSS($wanted_show); |
4618 | - $row[] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?cidReq=&action=addnew&title='.str_replace('_',' ',$wanted_show).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" class="new_wiki_link">'.str_replace('_',' ',$wanted_show).'</a>';//meter un remove xss en lugar de htmlentities |
|
4618 | + $row[] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?cidReq=&action=addnew&title='.str_replace('_', ' ', $wanted_show).'&session_id='.api_htmlentities($_GET['session_id']).'&group_id='.api_htmlentities($_GET['group_id']).'" class="new_wiki_link">'.str_replace('_', ' ', $wanted_show).'</a>'; //meter un remove xss en lugar de htmlentities |
|
4619 | 4619 | $rows[] = $row; |
4620 | 4620 | } |
4621 | 4621 | |
4622 | - $table = new SortableTableFromArrayConfig($rows,0,10,'WantedPages_table','','','DESC'); |
|
4622 | + $table = new SortableTableFromArrayConfig($rows, 0, 10, 'WantedPages_table', '', '', 'DESC'); |
|
4623 | 4623 | $table->set_additional_parameters( |
4624 | 4624 | array( |
4625 | 4625 | 'cidReq' => Security::remove_XSS($_GET['cidReq']), |
@@ -4628,7 +4628,7 @@ discard block |
||
4628 | 4628 | 'group_id' => intval($_GET['group_id']), |
4629 | 4629 | ) |
4630 | 4630 | ); |
4631 | - $table->set_header(0,get_lang('Title'), true); |
|
4631 | + $table->set_header(0, get_lang('Title'), true); |
|
4632 | 4632 | $table->display(); |
4633 | 4633 | } |
4634 | 4634 | |
@@ -4645,7 +4645,7 @@ discard block |
||
4645 | 4645 | |
4646 | 4646 | echo '<div class="actions">'.get_lang('MostVisitedPages').'</div>'; |
4647 | 4647 | |
4648 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { //only by professors if page is hidden |
|
4648 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { //only by professors if page is hidden |
|
4649 | 4649 | $sql = 'SELECT *, SUM(hits) AS tsum FROM '.$tbl_wiki.' |
4650 | 4650 | WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' |
4651 | 4651 | GROUP BY reflink'; |
@@ -4666,11 +4666,11 @@ discard block |
||
4666 | 4666 | while ($obj = Database::fetch_object($allpages)) { |
4667 | 4667 | //get type assignment icon |
4668 | 4668 | $ShowAssignment = ''; |
4669 | - if ($obj->assignment==1) { |
|
4670 | - $ShowAssignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'),'',ICON_SIZE_SMALL); |
|
4671 | - } elseif ($obj->assignment==2) { |
|
4672 | - $ShowAssignment=$ShowAssignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWork'),'',ICON_SIZE_SMALL); |
|
4673 | - } elseif ($obj->assignment==0) { |
|
4669 | + if ($obj->assignment == 1) { |
|
4670 | + $ShowAssignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDesc'), '', ICON_SIZE_SMALL); |
|
4671 | + } elseif ($obj->assignment == 2) { |
|
4672 | + $ShowAssignment = $ShowAssignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL); |
|
4673 | + } elseif ($obj->assignment == 0) { |
|
4674 | 4674 | $ShowAssignment = Display::return_icon('px_transparent.gif'); |
4675 | 4675 | } |
4676 | 4676 | |
@@ -4699,7 +4699,7 @@ discard block |
||
4699 | 4699 | 'group_id' => intval($_GET['group_id']), |
4700 | 4700 | ) |
4701 | 4701 | ); |
4702 | - $table->set_header(0,get_lang('Type'), true, array ('style' => 'width:30px;')); |
|
4702 | + $table->set_header(0, get_lang('Type'), true, array('style' => 'width:30px;')); |
|
4703 | 4703 | $table->set_header(1, get_lang('Title'), true); |
4704 | 4704 | $table->set_header(2, get_lang('Visits'), true); |
4705 | 4705 | $table->display(); |
@@ -4724,8 +4724,8 @@ discard block |
||
4724 | 4724 | |
4725 | 4725 | if (api_is_allowed_to_session_edit(false, true) && api_is_allowed_to_edit()) { |
4726 | 4726 | // menu add page |
4727 | - $actionsLeft .= '<a href="index.php?cidReq=' . $_course['id'] . '&action=addnew&session_id=' . $session_id . '&group_id=' . $groupId . '"' . self::is_active_navigation_tab('addnew').'>' |
|
4728 | - . Display::return_icon('add.png', get_lang('AddNew'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
4727 | + $actionsLeft .= '<a href="index.php?cidReq='.$_course['id'].'&action=addnew&session_id='.$session_id.'&group_id='.$groupId.'"'.self::is_active_navigation_tab('addnew').'>' |
|
4728 | + . Display::return_icon('add.png', get_lang('AddNew'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
4729 | 4729 | } |
4730 | 4730 | |
4731 | 4731 | $lock_unlock_addnew = null; |
@@ -4733,12 +4733,12 @@ discard block |
||
4733 | 4733 | |
4734 | 4734 | if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
4735 | 4735 | // page action: enable or disable the adding of new pages |
4736 | - if (self::check_addnewpagelock()==0) { |
|
4736 | + if (self::check_addnewpagelock() == 0) { |
|
4737 | 4737 | $protect_addnewpage = Display::return_icon('off.png', get_lang('AddOptionProtected')); |
4738 | - $lock_unlock_addnew ='unlockaddnew'; |
|
4738 | + $lock_unlock_addnew = 'unlockaddnew'; |
|
4739 | 4739 | } else { |
4740 | 4740 | $protect_addnewpage = Display::return_icon('on.png', get_lang('AddOptionUnprotected')); |
4741 | - $lock_unlock_addnew ='lockaddnew'; |
|
4741 | + $lock_unlock_addnew = 'lockaddnew'; |
|
4742 | 4742 | } |
4743 | 4743 | } |
4744 | 4744 | |
@@ -4774,7 +4774,7 @@ discard block |
||
4774 | 4774 | return; |
4775 | 4775 | } |
4776 | 4776 | |
4777 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
4777 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
4778 | 4778 | Display::addFlash('<div id="wikititle">'.get_lang('DeletePageHistory').'</div>'); |
4779 | 4779 | |
4780 | 4780 | if ($page == "index") { |
@@ -4816,7 +4816,7 @@ discard block |
||
4816 | 4816 | $userId = api_get_user_id(); |
4817 | 4817 | |
4818 | 4818 | if (api_get_session_id() != 0 && |
4819 | - api_is_allowed_to_session_edit(false,true) == false |
|
4819 | + api_is_allowed_to_session_edit(false, true) == false |
|
4820 | 4820 | ) { |
4821 | 4821 | api_not_allowed(); |
4822 | 4822 | } |
@@ -4839,12 +4839,12 @@ discard block |
||
4839 | 4839 | Display::display_error_message(get_lang('MustSelectPage'), false, true) |
4840 | 4840 | ); |
4841 | 4841 | return; |
4842 | - } elseif ($row['content']=='' && $row['title']=='' && $page=='index') { |
|
4842 | + } elseif ($row['content'] == '' && $row['title'] == '' && $page == 'index') { |
|
4843 | 4843 | |
4844 | 4844 | // Table structure for better export to pdf |
4845 | 4845 | $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">'; |
4846 | 4846 | $default_table_for_content_End = '</td></tr></table>'; |
4847 | - $content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'),api_get_path(WEB_IMG_PATH)).$default_table_for_content_End; |
|
4847 | + $content = $default_table_for_content_Start.sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)).$default_table_for_content_End; |
|
4848 | 4848 | $title = get_lang('DefaultTitle'); |
4849 | 4849 | $page_id = 0; |
4850 | 4850 | } else { |
@@ -4871,7 +4871,7 @@ discard block |
||
4871 | 4871 | if (!empty($groupId)) { |
4872 | 4872 | $groupInfo = GroupManager::get_group_properties($groupId); |
4873 | 4873 | //Only teacher, platform admin and group members can edit a wiki group |
4874 | - if (api_is_allowed_to_edit(false,true) || |
|
4874 | + if (api_is_allowed_to_edit(false, true) || |
|
4875 | 4875 | api_is_platform_admin() || |
4876 | 4876 | GroupManager :: is_user_in_group($userId, $groupInfo['iid']) |
4877 | 4877 | ) { |
@@ -4884,7 +4884,7 @@ discard block |
||
4884 | 4884 | ); |
4885 | 4885 | } |
4886 | 4886 | } else { |
4887 | - $PassEdit=true; |
|
4887 | + $PassEdit = true; |
|
4888 | 4888 | } |
4889 | 4889 | |
4890 | 4890 | $icon_assignment = null; |
@@ -4894,10 +4894,10 @@ discard block |
||
4894 | 4894 | Display::return_message(get_lang('EditAssignmentWarning')) |
4895 | 4895 | ); |
4896 | 4896 | |
4897 | - $icon_assignment=Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'),'',ICON_SIZE_SMALL); |
|
4897 | + $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL); |
|
4898 | 4898 | } elseif ($row['assignment'] == 2) { |
4899 | - $icon_assignment=Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'),'',ICON_SIZE_SMALL); |
|
4900 | - if (($userId == $row['user_id'])==false) { |
|
4899 | + $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL); |
|
4900 | + if (($userId == $row['user_id']) == false) { |
|
4901 | 4901 | if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
4902 | 4902 | $PassEdit = true; |
4903 | 4903 | } else { |
@@ -4917,7 +4917,7 @@ discard block |
||
4917 | 4917 | if ($PassEdit) { |
4918 | 4918 | //show editor if edit is allowed <<<<< |
4919 | 4919 | if ($row['editlock'] == 1 && |
4920 | - (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin()==false) |
|
4920 | + (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false) |
|
4921 | 4921 | ) { |
4922 | 4922 | Display::addFlash( |
4923 | 4923 | Display::return_message( |
@@ -4927,7 +4927,7 @@ discard block |
||
4927 | 4927 | } else { |
4928 | 4928 | // Check tasks |
4929 | 4929 | |
4930 | - if (!empty($row['startdate_assig']) && time() < api_strtotime($row['startdate_assig']) |
|
4930 | + if (!empty($row['startdate_assig']) && time() < api_strtotime($row['startdate_assig']) |
|
4931 | 4931 | ) { |
4932 | 4932 | $message = get_lang('TheTaskDoesNotBeginUntil').': '.api_get_local_time($row['startdate_assig']); |
4933 | 4933 | |
@@ -4945,7 +4945,7 @@ discard block |
||
4945 | 4945 | |
4946 | 4946 | if (!empty($row['enddate_assig']) && |
4947 | 4947 | time() > strtotime($row['enddate_assig']) && |
4948 | - $row['delayedsubmit']==0 |
|
4948 | + $row['delayedsubmit'] == 0 |
|
4949 | 4949 | ) { |
4950 | 4950 | $message = get_lang('TheDeadlineHasBeenCompleted').': '.api_get_local_time($row['enddate_assig']); |
4951 | 4951 | Display::addFlash( |
@@ -4954,20 +4954,20 @@ discard block |
||
4954 | 4954 | 'warning' |
4955 | 4955 | ) |
4956 | 4956 | ); |
4957 | - if (!api_is_allowed_to_edit(false,true)) { |
|
4957 | + if (!api_is_allowed_to_edit(false, true)) { |
|
4958 | 4958 | $this->redirectHome(); |
4959 | 4959 | } |
4960 | 4960 | } |
4961 | 4961 | |
4962 | - if (!empty($row['max_version']) && $row['version']>=$row['max_version']) { |
|
4963 | - $message=get_lang('HasReachedMaxiNumVersions'); |
|
4962 | + if (!empty($row['max_version']) && $row['version'] >= $row['max_version']) { |
|
4963 | + $message = get_lang('HasReachedMaxiNumVersions'); |
|
4964 | 4964 | Display::addFlash( |
4965 | 4965 | Display::return_message( |
4966 | 4966 | $message, |
4967 | 4967 | 'warning' |
4968 | 4968 | ) |
4969 | 4969 | ); |
4970 | - if (!api_is_allowed_to_edit(false,true)) { |
|
4970 | + if (!api_is_allowed_to_edit(false, true)) { |
|
4971 | 4971 | $this->redirectHome(); |
4972 | 4972 | } |
4973 | 4973 | } |
@@ -4980,7 +4980,7 @@ discard block |
||
4980 | 4980 | 'warning' |
4981 | 4981 | ) |
4982 | 4982 | ); |
4983 | - if (!api_is_allowed_to_edit(false,true)) { |
|
4983 | + if (!api_is_allowed_to_edit(false, true)) { |
|
4984 | 4984 | $this->redirectHome(); |
4985 | 4985 | } |
4986 | 4986 | } |
@@ -4988,7 +4988,7 @@ discard block |
||
4988 | 4988 | if (!empty($row['task'])) { |
4989 | 4989 | //previous change 0 by text |
4990 | 4990 | if (!empty($row['startdate_assig'])) { |
4991 | - $message_task_startdate =get_lang('No'); |
|
4991 | + $message_task_startdate = get_lang('No'); |
|
4992 | 4992 | } else { |
4993 | 4993 | $message_task_startdate = api_get_local_time($row['startdate_assig']); |
4994 | 4994 | } |
@@ -4999,31 +4999,31 @@ discard block |
||
4999 | 4999 | $message_task_enddate = api_get_local_time($row['enddate_assig']); |
5000 | 5000 | } |
5001 | 5001 | |
5002 | - if ($row['delayedsubmit']==0) { |
|
5003 | - $message_task_delayedsubmit=get_lang('No'); |
|
5002 | + if ($row['delayedsubmit'] == 0) { |
|
5003 | + $message_task_delayedsubmit = get_lang('No'); |
|
5004 | 5004 | } else { |
5005 | - $message_task_delayedsubmit=get_lang('Yes'); |
|
5005 | + $message_task_delayedsubmit = get_lang('Yes'); |
|
5006 | 5006 | } |
5007 | 5007 | |
5008 | - if ($row['max_version']==0) { |
|
5009 | - $message_task_max_version=get_lang('No'); |
|
5008 | + if ($row['max_version'] == 0) { |
|
5009 | + $message_task_max_version = get_lang('No'); |
|
5010 | 5010 | } else { |
5011 | - $message_task_max_version=$row['max_version']; |
|
5011 | + $message_task_max_version = $row['max_version']; |
|
5012 | 5012 | } |
5013 | 5013 | |
5014 | - if ($row['max_text']==0) { |
|
5015 | - $message_task_max_text=get_lang('No'); |
|
5014 | + if ($row['max_text'] == 0) { |
|
5015 | + $message_task_max_text = get_lang('No'); |
|
5016 | 5016 | } else { |
5017 | - $message_task_max_text=$row['max_text']; |
|
5017 | + $message_task_max_text = $row['max_text']; |
|
5018 | 5018 | } |
5019 | 5019 | |
5020 | 5020 | // Comp message |
5021 | - $message_task='<b>'.get_lang('DescriptionOfTheTask').'</b><p>'.$row['task'].'</p><hr>'; |
|
5022 | - $message_task.='<p>'.get_lang('StartDate').': '.$message_task_startdate.'</p>'; |
|
5023 | - $message_task.='<p>'.get_lang('EndDate').': '.$message_task_enddate; |
|
5024 | - $message_task.=' ('.get_lang('AllowLaterSends').') '.$message_task_delayedsubmit.'</p>'; |
|
5025 | - $message_task.='<p>'.get_lang('OtherSettings').': '.get_lang('NMaxVersion').': '.$message_task_max_version; |
|
5026 | - $message_task.=' '.get_lang('NMaxWords').': '.$message_task_max_text; |
|
5021 | + $message_task = '<b>'.get_lang('DescriptionOfTheTask').'</b><p>'.$row['task'].'</p><hr>'; |
|
5022 | + $message_task .= '<p>'.get_lang('StartDate').': '.$message_task_startdate.'</p>'; |
|
5023 | + $message_task .= '<p>'.get_lang('EndDate').': '.$message_task_enddate; |
|
5024 | + $message_task .= ' ('.get_lang('AllowLaterSends').') '.$message_task_delayedsubmit.'</p>'; |
|
5025 | + $message_task .= '<p>'.get_lang('OtherSettings').': '.get_lang('NMaxVersion').': '.$message_task_max_version; |
|
5026 | + $message_task .= ' '.get_lang('NMaxWords').': '.$message_task_max_text; |
|
5027 | 5027 | // Display message |
5028 | 5028 | Display::addFlash( |
5029 | 5029 | Display::return_message( |
@@ -5034,11 +5034,11 @@ discard block |
||
5034 | 5034 | |
5035 | 5035 | $feedback_message = ''; |
5036 | 5036 | if ($row['progress'] == $row['fprogress1'] && !empty($row['fprogress1'])) { |
5037 | - $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback1']).'</p>'; |
|
5037 | + $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback1']).'</p>'; |
|
5038 | 5038 | } elseif ($row['progress'] == $row['fprogress2'] && !empty($row['fprogress2'])) { |
5039 | - $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback2']).'</p>'; |
|
5039 | + $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback2']).'</p>'; |
|
5040 | 5040 | } elseif ($row['progress'] == $row['fprogress3'] && !empty($row['fprogress3'])) { |
5041 | - $feedback_message='<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback3']).'</p>'; |
|
5041 | + $feedback_message = '<b>'.get_lang('Feedback').'</b><p>'.api_htmlentities($row['feedback3']).'</p>'; |
|
5042 | 5042 | } |
5043 | 5043 | |
5044 | 5044 | if (!empty($feedback_message)) { |
@@ -5063,15 +5063,15 @@ discard block |
||
5063 | 5063 | WHERE c_id = '.$course_id.' AND id="'.$row['id'].'"'; |
5064 | 5064 | Database::query($sql); |
5065 | 5065 | } elseif ($row['is_editing'] != $userId) { |
5066 | - $timestamp_edit=strtotime($row['time_edit']); |
|
5066 | + $timestamp_edit = strtotime($row['time_edit']); |
|
5067 | 5067 | $time_editing = time() - $timestamp_edit; |
5068 | 5068 | $max_edit_time = 1200; // 20 minutes |
5069 | 5069 | $rest_time = $max_edit_time - $time_editing; |
5070 | 5070 | |
5071 | 5071 | $userinfo = api_get_user_info($row['is_editing']); |
5072 | 5072 | if ($userinfo !== false) { |
5073 | - $is_being_edited = get_lang('ThisPageisBeginEditedBy') . ' ' . UserManager::getUserProfileLink($userinfo) . ' |
|
5074 | - ' . get_lang('ThisPageisBeginEditedTryLater') . ' ' . date("i", $rest_time) . ' ' . get_lang('MinMinutes') . ''; |
|
5073 | + $is_being_edited = get_lang('ThisPageisBeginEditedBy').' '.UserManager::getUserProfileLink($userinfo).' |
|
5074 | + ' . get_lang('ThisPageisBeginEditedTryLater').' '.date("i", $rest_time).' '.get_lang('MinMinutes').''; |
|
5075 | 5075 | } |
5076 | 5076 | |
5077 | 5077 | Display::addFlash( |
@@ -5088,7 +5088,7 @@ discard block |
||
5088 | 5088 | // Form. |
5089 | 5089 | $url = api_get_self().'?action=edit&title='.urlencode($page).'&session_id='.api_get_session_id().'&group_id='.api_get_group_id().'&'.api_get_cidreq(); |
5090 | 5090 | $form = new FormValidator('wiki', 'post', $url); |
5091 | - $form->addElement('header', $icon_assignment.str_repeat(' ',3).api_htmlentities($title)); |
|
5091 | + $form->addElement('header', $icon_assignment.str_repeat(' ', 3).api_htmlentities($title)); |
|
5092 | 5092 | self::setForm($form, $row); |
5093 | 5093 | $form->addElement('hidden', 'title'); |
5094 | 5094 | $form->addElement('button', 'SaveWikiChange', get_lang('Save')); |
@@ -5174,7 +5174,7 @@ discard block |
||
5174 | 5174 | $KeyAssignment = null; |
5175 | 5175 | $KeyTitle = null; |
5176 | 5176 | $KeyUserId = null; |
5177 | - while ($row=Database::fetch_array($result)) { |
|
5177 | + while ($row = Database::fetch_array($result)) { |
|
5178 | 5178 | $KeyVisibility = $row['visibility']; |
5179 | 5179 | $KeyAssignment = $row['assignment']; |
5180 | 5180 | $KeyTitle = $row['title']; |
@@ -5183,7 +5183,7 @@ discard block |
||
5183 | 5183 | $icon_assignment = null; |
5184 | 5184 | if ($KeyAssignment == 1) { |
5185 | 5185 | $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL); |
5186 | - } elseif($KeyAssignment == 2) { |
|
5186 | + } elseif ($KeyAssignment == 2) { |
|
5187 | 5187 | $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL); |
5188 | 5188 | } |
5189 | 5189 | |
@@ -5191,10 +5191,10 @@ discard block |
||
5191 | 5191 | |
5192 | 5192 | //if the page is hidden and is a job only sees its author and professor |
5193 | 5193 | if ($KeyVisibility == 1 || |
5194 | - api_is_allowed_to_edit(false,true) || |
|
5194 | + api_is_allowed_to_edit(false, true) || |
|
5195 | 5195 | api_is_platform_admin() || |
5196 | 5196 | ( |
5197 | - $KeyAssignment==2 && $KeyVisibility==0 && |
|
5197 | + $KeyAssignment == 2 && $KeyVisibility == 0 && |
|
5198 | 5198 | ($userId == $KeyUserId) |
5199 | 5199 | ) |
5200 | 5200 | ) { |
@@ -5224,7 +5224,7 @@ discard block |
||
5224 | 5224 | get_lang('ShowDifferences').' '.get_lang('WordsDiff').'</button>'; |
5225 | 5225 | echo '<br/><br/>'; |
5226 | 5226 | |
5227 | - $counter=0; |
|
5227 | + $counter = 0; |
|
5228 | 5228 | $total_versions = Database::num_rows($result); |
5229 | 5229 | |
5230 | 5230 | while ($row = Database::fetch_array($result)) { |
@@ -5232,10 +5232,10 @@ discard block |
||
5232 | 5232 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username']), ENT_QUOTES); |
5233 | 5233 | |
5234 | 5234 | echo '<li style="margin-bottom: 5px;">'; |
5235 | - ($counter==0) ? $oldstyle='style="visibility: hidden;"':$oldstyle=''; |
|
5236 | - ($counter==0) ? $newchecked=' checked': $newchecked=''; |
|
5237 | - ($counter==$total_versions-1) ? $newstyle='style="visibility: hidden;"':$newstyle=''; |
|
5238 | - ($counter==1) ? $oldchecked=' checked':$oldchecked=''; |
|
5235 | + ($counter == 0) ? $oldstyle = 'style="visibility: hidden;"' : $oldstyle = ''; |
|
5236 | + ($counter == 0) ? $newchecked = ' checked' : $newchecked = ''; |
|
5237 | + ($counter == $total_versions - 1) ? $newstyle = 'style="visibility: hidden;"' : $newstyle = ''; |
|
5238 | + ($counter == 1) ? $oldchecked = ' checked' : $oldchecked = ''; |
|
5239 | 5239 | echo '<input name="old" value="'.$row['id'].'" type="radio" '.$oldstyle.' '.$oldchecked.'/> '; |
5240 | 5240 | echo '<input name="new" value="'.$row['id'].'" type="radio" '.$newstyle.' '.$newchecked.'/> '; |
5241 | 5241 | echo '<a href="'.api_get_self().'?action=showpage&title='.api_htmlentities(urlencode($page)).'&view='.$row['id'].'">'; |
@@ -5255,8 +5255,8 @@ discard block |
||
5255 | 5255 | $comment = api_substr($comment, 0, 100); |
5256 | 5256 | if ($comment !== false) { |
5257 | 5257 | $comment = api_htmlentities($comment); |
5258 | - echo get_lang('Comments').': ' . $comment; |
|
5259 | - if (api_strlen($row['comment'])>100) { |
|
5258 | + echo get_lang('Comments').': '.$comment; |
|
5259 | + if (api_strlen($row['comment']) > 100) { |
|
5260 | 5260 | echo '... '; |
5261 | 5261 | } |
5262 | 5262 | } |
@@ -5282,8 +5282,8 @@ discard block |
||
5282 | 5282 | |
5283 | 5283 | $sql_new = "SELECT * FROM $tbl_wiki |
5284 | 5284 | WHERE c_id = $course_id AND id='".Database::escape_string($_POST['new'])."'"; |
5285 | - $result_new=Database::query($sql_new); |
|
5286 | - $version_new=Database::fetch_array($result_new); |
|
5285 | + $result_new = Database::query($sql_new); |
|
5286 | + $version_new = Database::fetch_array($result_new); |
|
5287 | 5287 | $oldTime = isset($version_old['dtime']) ? $version_old['dtime'] : null; |
5288 | 5288 | $oldContent = isset($version_old['content']) ? $version_old['content'] : null; |
5289 | 5289 | |
@@ -5310,9 +5310,9 @@ discard block |
||
5310 | 5310 | |
5311 | 5311 | |
5312 | 5312 | if (isset($_POST['HistoryDifferences'])) { |
5313 | - echo '<table>'.diff($oldContent, $version_new['content'], true, 'format_table_line' ).'</table>'; // format_line mode is better for words |
|
5313 | + echo '<table>'.diff($oldContent, $version_new['content'], true, 'format_table_line').'</table>'; // format_line mode is better for words |
|
5314 | 5314 | echo '<br />'; |
5315 | - echo '<strong>'.get_lang('Legend').'</strong><div class="diff">' . "\n"; |
|
5315 | + echo '<strong>'.get_lang('Legend').'</strong><div class="diff">'."\n"; |
|
5316 | 5316 | echo '<table><tr>'; |
5317 | 5317 | echo '<td>'; |
5318 | 5318 | echo '</td><td>'; |
@@ -5331,7 +5331,7 @@ discard block |
||
5331 | 5331 | $renderer = new Text_Diff_Renderer_inline(); |
5332 | 5332 | echo '<style>del{background:#fcc}ins{background:#cfc}</style>'.$renderer->render($diff); // Code inline |
5333 | 5333 | echo '<br />'; |
5334 | - echo '<strong>'.get_lang('Legend').'</strong><div class="diff">' . "\n"; |
|
5334 | + echo '<strong>'.get_lang('Legend').'</strong><div class="diff">'."\n"; |
|
5335 | 5335 | echo '<table><tr>'; |
5336 | 5336 | echo '<td>'; |
5337 | 5337 | echo '</td><td>'; |
@@ -5379,7 +5379,7 @@ discard block |
||
5379 | 5379 | echo '<td style="vertical-align:top">'; |
5380 | 5380 | echo '<ul>'; |
5381 | 5381 | // Submenu Statistics |
5382 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
5382 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
5383 | 5383 | echo '<li><a href="index.php?cidReq='.$_course['id'].'&action=statistics&session_id='.$session_id.'&group_id='.$groupId.'">'.get_lang('Statistics').'</a></li>'; |
5384 | 5384 | } |
5385 | 5385 | echo ' </ul>'; |
@@ -5452,7 +5452,7 @@ discard block |
||
5452 | 5452 | break; |
5453 | 5453 | case 'deletewiki': |
5454 | 5454 | $title = '<div class="actions">'.get_lang('DeleteWiki').'</div>'; |
5455 | - if (api_is_allowed_to_edit(false,true) || api_is_platform_admin()) { |
|
5455 | + if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) { |
|
5456 | 5456 | $message = get_lang('ConfirmDeleteWiki'); |
5457 | 5457 | $message .= '<p> |
5458 | 5458 | <a href="index.php?'.api_get_cidreq().'">'.get_lang('No').'</a> |
@@ -5483,7 +5483,7 @@ discard block |
||
5483 | 5483 | self::getLinks($page); |
5484 | 5484 | break; |
5485 | 5485 | case 'addnew': |
5486 | - if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) { |
|
5486 | + if (api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false) { |
|
5487 | 5487 | api_not_allowed(); |
5488 | 5488 | } |
5489 | 5489 | $groupInfo = GroupManager::get_group_properties(api_get_group_id()); |
@@ -5491,7 +5491,7 @@ discard block |
||
5491 | 5491 | echo '<br/>'; |
5492 | 5492 | //first, check if page index was created. chektitle=false |
5493 | 5493 | if (self::checktitle('index')) { |
5494 | - if (api_is_allowed_to_edit(false,true) || |
|
5494 | + if (api_is_allowed_to_edit(false, true) || |
|
5495 | 5495 | api_is_platform_admin() || |
5496 | 5496 | GroupManager::is_user_in_group(api_get_user_id(), $groupInfo['iid']) || |
5497 | 5497 | api_is_allowed_in_course() |
@@ -5500,11 +5500,11 @@ discard block |
||
5500 | 5500 | } else { |
5501 | 5501 | Display::addFlash(Display::display_normal_message(get_lang('WikiStandBy'), false, true)); |
5502 | 5502 | } |
5503 | - } elseif (self::check_addnewpagelock()==0 && (api_is_allowed_to_edit(false, true)==false || api_is_platform_admin()==false)) { |
|
5503 | + } elseif (self::check_addnewpagelock() == 0 && (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)) { |
|
5504 | 5504 | Display::addFlash(Display::display_error_message(get_lang('AddPagesLocked'), false, true)); |
5505 | 5505 | } else { |
5506 | 5506 | $groupInfo = GroupManager::get_group_properties(api_get_group_id()); |
5507 | - if (api_is_allowed_to_edit(false,true) || |
|
5507 | + if (api_is_allowed_to_edit(false, true) || |
|
5508 | 5508 | api_is_platform_admin() || |
5509 | 5509 | GroupManager::is_user_in_group(api_get_user_id(), $groupInfo['iid']) || |
5510 | 5510 | $_GET['group_id'] == 0 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $doc_url = str_replace(' ', '+', $doc_url); |
32 | 32 | $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url; |
33 | 33 | |
34 | -if (! isset($_course)) { |
|
34 | +if (!isset($_course)) { |
|
35 | 35 | api_not_allowed(true); |
36 | 36 | } |
37 | 37 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | exit; |
52 | 52 | } |
53 | 53 | |
54 | -$tbl_forum_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT); |
|
54 | +$tbl_forum_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT); |
|
55 | 55 | $tbl_forum_post = Database::get_course_table(TABLE_FORUM_POST); |
56 | 56 | |
57 | 57 | $course_id = api_get_course_int_id(); |
58 | -$courseInfo = api_get_course_info_by_id($course_id); |
|
58 | +$courseInfo = api_get_course_info_by_id($course_id); |
|
59 | 59 | |
60 | 60 | // launch event |
61 | 61 | Event::event_download($doc_url); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | api_get_session_id() |
86 | 86 | ); |
87 | 87 | |
88 | -if ($forum_thread_visibility==1 && $forum_forum_visibility==1) { |
|
88 | +if ($forum_thread_visibility == 1 && $forum_forum_visibility == 1) { |
|
89 | 89 | if (Security::check_abs_path( |
90 | 90 | $full_file_name, |
91 | 91 | api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/upload/forum/') |
@@ -457,8 +457,8 @@ |
||
457 | 457 | |
458 | 458 | // The post has been displayed => it can be removed from the what's new array |
459 | 459 | if (isset($whatsnew_post_info[$forumId][$threadId][$row['post_id']])) { |
460 | - unset($whatsnew_post_info[$forumId][$threadId][$row['post_id']]); |
|
461 | - unset($_SESSION['whatsnew_post_info'][$forumId][$threadId][$row['post_id']]); |
|
460 | + unset($whatsnew_post_info[$forumId][$threadId][$row['post_id']]); |
|
461 | + unset($_SESSION['whatsnew_post_info'][$forumId][$threadId][$row['post_id']]); |
|
462 | 462 | } |
463 | 463 | echo "</table>"; |
464 | 464 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @package chamilo.forum |
22 | 22 | */ |
23 | 23 | |
24 | -$forumUrl = api_get_path(WEB_CODE_PATH) . 'forum/'; |
|
24 | +$forumUrl = api_get_path(WEB_CODE_PATH).'forum/'; |
|
25 | 25 | $_user = api_get_user_info(); |
26 | 26 | $sortDirection = isset($_GET['posts_order']) && $_GET['posts_order'] === 'desc' ? 'DESC' : 'ASC'; |
27 | 27 | $rows = getPosts($current_forum, $_GET['thread'], $sortDirection, true); |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | // Are we in a lp ? |
43 | 43 | $origin = ''; |
44 | 44 | if (isset($_GET['origin'])) { |
45 | - $origin = Security::remove_XSS($_GET['origin']); |
|
45 | + $origin = Security::remove_XSS($_GET['origin']); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // Delete attachment file. |
49 | 49 | if ( |
50 | 50 | isset($_GET['action']) && |
51 | - $_GET['action']=='delete_attach' && |
|
51 | + $_GET['action'] == 'delete_attach' && |
|
52 | 52 | isset($_GET['id_attach']) |
53 | 53 | ) { |
54 | 54 | delete_attachment(0, $_GET['id_attach']); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | // Displaying the thread (structure) |
61 | 61 | |
62 | -$thread_structure = "<div class=\"structure\">" .get_lang('Structure')."</div>"; |
|
62 | +$thread_structure = "<div class=\"structure\">".get_lang('Structure')."</div>"; |
|
63 | 63 | $counter = 0; |
64 | 64 | $count = 0; |
65 | 65 | $prev_next_array = array(); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | foreach ($rows as $post) { |
72 | 72 | $counter++; |
73 | 73 | $indent = $post['indent_cnt'] * '20'; |
74 | - $thread_structure .= "<div style=\"margin-left: " . $indent . "px;\">"; |
|
74 | + $thread_structure .= "<div style=\"margin-left: ".$indent."px;\">"; |
|
75 | 75 | |
76 | 76 | if ( |
77 | 77 | !empty($whatsnew_post_info[$forumId][$post['thread_id']]) && |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | $counter == 1 AND !isset($_GET['post']) |
90 | 90 | ) |
91 | 91 | ) { |
92 | - $thread_structure .= '<strong>' .prepare4display($post['post_title']) . '</strong>'; |
|
92 | + $thread_structure .= '<strong>'.prepare4display($post['post_title']).'</strong>'; |
|
93 | 93 | $prev_next_array[] = $post['post_id']; |
94 | 94 | } else { |
95 | 95 | $count_loop = ($count == 0) ? '&id=1' : ''; |
96 | 96 | $thread_structure .= Display::url( |
97 | 97 | prepare4display($post['post_title']), |
98 | - 'viewthread.php?' . api_get_cidreq() . "$count_loop&" . http_build_query([ |
|
98 | + 'viewthread.php?'.api_get_cidreq()."$count_loop&".http_build_query([ |
|
99 | 99 | 'forum' => $forumId, |
100 | 100 | 'thread' => $threadId, |
101 | 101 | 'post' => $post['post_id'] |
@@ -151,43 +151,43 @@ discard block |
||
151 | 151 | $class_next = ''; |
152 | 152 | |
153 | 153 | // Links |
154 | -$first_href = $forumUrl . 'viewthread.php?' . api_get_cidreq() . |
|
155 | - '&forum=' . $forumId . '&thread=' . $threadId . |
|
156 | - '&gradebook=' . $gradebook . '&id=1&post=' . $prev_next_array[0]; |
|
157 | -$last_href = $forumUrl . 'viewthread.php?' . api_get_cidreq() . |
|
158 | - '&forum=' . $forumId . '&thread=' . $threadId . |
|
159 | - '&gradebook=' . $gradebook . '&post=' . $prev_next_array[$max-1]; |
|
160 | -$prev_href = $forumUrl . 'viewthread.php?' . api_get_cidreq() . |
|
161 | - '&forum=' . $forumId . '&thread=' . $threadId . |
|
162 | - '&gradebook=' . $gradebook . '&post=' . $prev_next_array[$prev_id]; |
|
163 | -$next_href = $forumUrl . 'viewthread.php?' . api_get_cidreq() . |
|
164 | - '&forum=' . $forumId . '&thread=' . $threadId . |
|
165 | - '&post=' . $prev_next_array[$next_id]; |
|
154 | +$first_href = $forumUrl.'viewthread.php?'.api_get_cidreq(). |
|
155 | + '&forum='.$forumId.'&thread='.$threadId. |
|
156 | + '&gradebook='.$gradebook.'&id=1&post='.$prev_next_array[0]; |
|
157 | +$last_href = $forumUrl.'viewthread.php?'.api_get_cidreq(). |
|
158 | + '&forum='.$forumId.'&thread='.$threadId. |
|
159 | + '&gradebook='.$gradebook.'&post='.$prev_next_array[$max - 1]; |
|
160 | +$prev_href = $forumUrl.'viewthread.php?'.api_get_cidreq(). |
|
161 | + '&forum='.$forumId.'&thread='.$threadId. |
|
162 | + '&gradebook='.$gradebook.'&post='.$prev_next_array[$prev_id]; |
|
163 | +$next_href = $forumUrl.'viewthread.php?'.api_get_cidreq(). |
|
164 | + '&forum='.$forumId.'&thread='.$threadId. |
|
165 | + '&post='.$prev_next_array[$next_id]; |
|
166 | 166 | |
167 | 167 | echo '<center style="margin-top: 10px; margin-bottom: 10px;">'; |
168 | 168 | // Go to: first and previous |
169 | 169 | if (((int) $current_id) > 0) { |
170 | - echo '<a href="' . $first_href . '" ' . $class . ' title=' . |
|
171 | - $first_message . '>' . $first_img . ' ' . $first_message .'</a>'; |
|
172 | - echo '<a href="' . $prev_href . '" ' . $class_prev . ' title=' . |
|
173 | - $prev_message . '>' . $prev_img . ' ' . $prev_message . '</a>'; |
|
170 | + echo '<a href="'.$first_href.'" '.$class.' title='. |
|
171 | + $first_message.'>'.$first_img.' '.$first_message.'</a>'; |
|
172 | + echo '<a href="'.$prev_href.'" '.$class_prev.' title='. |
|
173 | + $prev_message.'>'.$prev_img.' '.$prev_message.'</a>'; |
|
174 | 174 | } else { |
175 | - echo '<strong class="text-muted">' . |
|
176 | - $first_img . ' ' . $first_message . '</strong>'; |
|
177 | - echo '<strong class="text-muted">' . |
|
178 | - $prev_img . ' ' . $prev_message . '</strong>'; |
|
175 | + echo '<strong class="text-muted">'. |
|
176 | + $first_img.' '.$first_message.'</strong>'; |
|
177 | + echo '<strong class="text-muted">'. |
|
178 | + $prev_img.' '.$prev_message.'</strong>'; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | // Current counter |
182 | -echo ' [ ' . ($current_id + 1) . ' / ' . $max . ' ] '; |
|
182 | +echo ' [ '.($current_id + 1).' / '.$max.' ] '; |
|
183 | 183 | |
184 | 184 | // Go to: next and last |
185 | 185 | if (($current_id + 1) < $max) { |
186 | - echo '<a href="' . $next_href . '" ' . $class_next . ' title=' . $next_message . '>' . $next_message . ' ' . $next_img . '</a>'; |
|
187 | - echo '<a href="' . $last_href . '" ' . $class . ' title=' . $last_message . '>' . $last_message . ' ' . $last_img . '</a>'; |
|
186 | + echo '<a href="'.$next_href.'" '.$class_next.' title='.$next_message.'>'.$next_message.' '.$next_img.'</a>'; |
|
187 | + echo '<a href="'.$last_href.'" '.$class.' title='.$last_message.'>'.$last_message.' '.$last_img.'</a>'; |
|
188 | 188 | } else { |
189 | - echo '<strong class="text-muted">' . $next_message . ' ' . $next_img . '</strong>'; |
|
190 | - echo '<strong class="text-muted">' . $last_message . ' ' . $last_img . '</strong>'; |
|
189 | + echo '<strong class="text-muted">'.$next_message.' '.$next_img.'</strong>'; |
|
190 | + echo '<strong class="text-muted">'.$last_message.' '.$last_img.'</strong>'; |
|
191 | 191 | } |
192 | 192 | echo '</center>'; |
193 | 193 | |
@@ -221,18 +221,18 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | if (api_get_course_setting('allow_user_image_forum')) { |
224 | - echo '<br />' . display_user_image($rows[$display_post_id]['user_id'], $name, $origin) . '<br />'; |
|
224 | + echo '<br />'.display_user_image($rows[$display_post_id]['user_id'], $name, $origin).'<br />'; |
|
225 | 225 | } |
226 | 226 | echo display_user_link( |
227 | 227 | $rows[$display_post_id]['user_id'], |
228 | 228 | $name, |
229 | 229 | $origin, |
230 | 230 | $username |
231 | -) . "<br />"; |
|
231 | +)."<br />"; |
|
232 | 232 | |
233 | 233 | echo api_convert_and_format_date( |
234 | 234 | $rows[$display_post_id]['post_date'] |
235 | -) . '<br /><br />'; |
|
235 | +).'<br /><br />'; |
|
236 | 236 | // Get attach id |
237 | 237 | $attachment_list = get_attachment($display_post_id); |
238 | 238 | $id_attach = !empty($attachment_list) ? $attachment_list['id'] : ''; |
@@ -252,16 +252,16 @@ discard block |
||
252 | 252 | ) |
253 | 253 | ) { |
254 | 254 | if ($locked == false) { |
255 | - echo "<a href=\"editpost.php?" . api_get_cidreq() . |
|
256 | - "&forum=" . $forumId . "&thread=" . $threadId . |
|
257 | - "&post=" . $rows[$display_post_id]['post_id'] . |
|
258 | - "&id_attach=" . $id_attach . "\">" . |
|
255 | + echo "<a href=\"editpost.php?".api_get_cidreq(). |
|
256 | + "&forum=".$forumId."&thread=".$threadId. |
|
257 | + "&post=".$rows[$display_post_id]['post_id']. |
|
258 | + "&id_attach=".$id_attach."\">". |
|
259 | 259 | Display::return_icon( |
260 | 260 | 'edit.png', |
261 | 261 | get_lang('Edit'), |
262 | 262 | array(), |
263 | 263 | ICON_SIZE_SMALL |
264 | - ) . '</a>'; |
|
264 | + ).'</a>'; |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | sort($id_posts, SORT_NUMERIC); |
278 | 278 | reset($id_posts); |
279 | 279 | // The post minor |
280 | - $post_minor = (int)$id_posts[0]; |
|
280 | + $post_minor = (int) $id_posts[0]; |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | if ( |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | !(api_is_course_coach() && $current_forum['session_id'] != $sessionId) |
287 | 287 | ) { |
288 | 288 | if ($locked == false) { |
289 | - echo "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . |
|
290 | - "&forum=" . $forumId . "&thread=" . $threadId . |
|
291 | - "&action=delete&content=post&id=" . |
|
292 | - $rows[$display_post_id]['post_id'] . |
|
293 | - "\" onclick=\"javascript:if(!confirm('" . |
|
294 | - addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) . |
|
295 | - "')) return false;\">" . Display::return_icon( |
|
289 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq(). |
|
290 | + "&forum=".$forumId."&thread=".$threadId. |
|
291 | + "&action=delete&content=post&id=". |
|
292 | + $rows[$display_post_id]['post_id']. |
|
293 | + "\" onclick=\"javascript:if(!confirm('". |
|
294 | + addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)). |
|
295 | + "')) return false;\">".Display::return_icon( |
|
296 | 296 | 'delete.png', |
297 | 297 | get_lang('Delete'), |
298 | 298 | array(), |
@@ -311,16 +311,16 @@ discard block |
||
311 | 311 | ); |
312 | 312 | |
313 | 313 | if (!isset($_GET['id']) && $post_id > $post_minor) { |
314 | - echo "<a href=\"viewthread.php?" . api_get_cidreq() . |
|
315 | - "&forum=" . $forumId . "&thread=" . $threadId . |
|
316 | - "&action=move&post=" . |
|
317 | - $rows[$display_post_id]['post_id'] . "\">" . |
|
314 | + echo "<a href=\"viewthread.php?".api_get_cidreq(). |
|
315 | + "&forum=".$forumId."&thread=".$threadId. |
|
316 | + "&action=move&post=". |
|
317 | + $rows[$display_post_id]['post_id']."\">". |
|
318 | 318 | Display::return_icon( |
319 | 319 | 'move.png', |
320 | 320 | get_lang('MovePost'), |
321 | 321 | array(), |
322 | 322 | ICON_SIZE_SMALL |
323 | - ) . "</a>"; |
|
323 | + )."</a>"; |
|
324 | 324 | |
325 | 325 | } |
326 | 326 | } |
@@ -343,16 +343,16 @@ discard block |
||
343 | 343 | ); |
344 | 344 | |
345 | 345 | if ($locked == false) { |
346 | - echo "<a href=\"forumqualify.php?" . api_get_cidreq() . |
|
347 | - "&forum=" . $forumId . "&thread=" . $threadId . |
|
348 | - "&action=list&post=" . $rows[$display_post_id]['post_id'] . |
|
349 | - "&user=" . $rows[$display_post_id]['user_id'] . "&user_id=" . |
|
350 | - $rows[$display_post_id]['user_id'] . "&origin=" . $origin . |
|
351 | - "&idtextqualify=" . $current_qualify_thread . |
|
352 | - "\" >" . Display::return_icon( |
|
346 | + echo "<a href=\"forumqualify.php?".api_get_cidreq(). |
|
347 | + "&forum=".$forumId."&thread=".$threadId. |
|
348 | + "&action=list&post=".$rows[$display_post_id]['post_id']. |
|
349 | + "&user=".$rows[$display_post_id]['user_id']."&user_id=". |
|
350 | + $rows[$display_post_id]['user_id']."&origin=".$origin. |
|
351 | + "&idtextqualify=".$current_qualify_thread. |
|
352 | + "\" >".Display::return_icon( |
|
353 | 353 | 'quiz.gif', |
354 | 354 | get_lang('Qualify') |
355 | - ) . "</a>"; |
|
355 | + )."</a>"; |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
@@ -364,33 +364,33 @@ discard block |
||
364 | 364 | ($current_forum['allow_anonymous'] == 1 && !$_user['user_id']) |
365 | 365 | ) { |
366 | 366 | if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { |
367 | - echo '<a href="reply.php?' . api_get_cidreq() . |
|
368 | - '&forum=' . $forumId . '&thread=' . $threadId . |
|
369 | - '&post=' . $rows[$display_post_id]['post_id'] . |
|
370 | - '&action=replymessage">' . |
|
367 | + echo '<a href="reply.php?'.api_get_cidreq(). |
|
368 | + '&forum='.$forumId.'&thread='.$threadId. |
|
369 | + '&post='.$rows[$display_post_id]['post_id']. |
|
370 | + '&action=replymessage">'. |
|
371 | 371 | Display::return_icon( |
372 | 372 | 'message_reply_forum.png', |
373 | 373 | get_lang('ReplyToMessage') |
374 | - ) . "</a>"; |
|
375 | - echo '<a href="reply.php?' . api_get_cidreq() . |
|
376 | - '&forum=' . $forumId . '&thread=' . $threadId . |
|
377 | - '&post=' . $rows[$display_post_id]['post_id'] . |
|
378 | - '&action=quote">' . |
|
374 | + )."</a>"; |
|
375 | + echo '<a href="reply.php?'.api_get_cidreq(). |
|
376 | + '&forum='.$forumId.'&thread='.$threadId. |
|
377 | + '&post='.$rows[$display_post_id]['post_id']. |
|
378 | + '&action=quote">'. |
|
379 | 379 | Display::return_icon( |
380 | 380 | 'quote.gif', |
381 | 381 | get_lang('QuoteMessage') |
382 | - ) . "</a>"; |
|
382 | + )."</a>"; |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | } else { |
386 | 386 | if ($current_forum_category && $current_forum_category['locked'] == 1) { |
387 | - echo get_lang('ForumcategoryLocked') . '<br />'; |
|
387 | + echo get_lang('ForumcategoryLocked').'<br />'; |
|
388 | 388 | } |
389 | 389 | if ($current_forum['locked'] == 1) { |
390 | - echo get_lang('ForumLocked') . '<br />'; |
|
390 | + echo get_lang('ForumLocked').'<br />'; |
|
391 | 391 | } |
392 | 392 | if ($current_thread['locked'] == 1) { |
393 | - echo get_lang('ThreadLocked') . '<br />'; |
|
393 | + echo get_lang('ThreadLocked').'<br />'; |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | |
@@ -409,17 +409,17 @@ discard block |
||
409 | 409 | $rows[$display_post_id]['post_notification'] == '1' AND |
410 | 410 | $rows[$display_post_id]['poster_id'] == $_user['user_id'] |
411 | 411 | ) { |
412 | - $post_image .= Display::return_icon('forumnotification.gif',get_lang('YouWillBeNotified')); |
|
412 | + $post_image .= Display::return_icon('forumnotification.gif', get_lang('YouWillBeNotified')); |
|
413 | 413 | } |
414 | 414 | // The post title |
415 | -echo "<td class=\"$titleclass\">" . |
|
416 | - prepare4display($rows[$display_post_id]['post_title']) . "</td>"; |
|
415 | +echo "<td class=\"$titleclass\">". |
|
416 | + prepare4display($rows[$display_post_id]['post_title'])."</td>"; |
|
417 | 417 | echo "</tr>"; |
418 | 418 | |
419 | 419 | // The post message |
420 | 420 | echo "<tr>"; |
421 | -echo "<td class=\"$messageclass\">" . |
|
422 | - prepare4display($rows[$display_post_id]['post_text']) . "</td>"; |
|
421 | +echo "<td class=\"$messageclass\">". |
|
422 | + prepare4display($rows[$display_post_id]['post_text'])."</td>"; |
|
423 | 423 | echo "</tr>"; |
424 | 424 | |
425 | 425 | // The check if there is an attachment |
@@ -432,21 +432,21 @@ discard block |
||
432 | 432 | echo Display::return_icon('attachment.gif', get_lang('Attachment')); |
433 | 433 | echo '<a href="download.php?file='; |
434 | 434 | echo $realname; |
435 | - echo ' "> ' . $user_filename . ' </a>'; |
|
436 | - echo '<span class="forum_attach_comment">' . |
|
437 | - Security::remove_XSS($attachment['comment'], STUDENT) . '</span>'; |
|
435 | + echo ' "> '.$user_filename.' </a>'; |
|
436 | + echo '<span class="forum_attach_comment">'. |
|
437 | + Security::remove_XSS($attachment['comment'], STUDENT).'</span>'; |
|
438 | 438 | |
439 | 439 | if ( |
440 | - ($current_forum['allow_edit'] == 1 &&$rows[$display_post_id]['user_id'] == $_user['user_id']) || |
|
440 | + ($current_forum['allow_edit'] == 1 && $rows[$display_post_id]['user_id'] == $_user['user_id']) || |
|
441 | 441 | (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) |
442 | 442 | ) { |
443 | - echo ' <a href="' . api_get_self() . '?' . |
|
444 | - api_get_cidreq() . '&action=delete_attach&id_attach=' .$attachment['id'] . '&forum=' . $forumId . |
|
445 | - '&thread=' . $threadId . |
|
446 | - '" onclick="javascript:if(!confirm(\'' . |
|
443 | + echo ' <a href="'.api_get_self().'?'. |
|
444 | + api_get_cidreq().'&action=delete_attach&id_attach='.$attachment['id'].'&forum='.$forumId. |
|
445 | + '&thread='.$threadId. |
|
446 | + '" onclick="javascript:if(!confirm(\''. |
|
447 | 447 | addslashes(api_htmlentities( |
448 | 448 | get_lang('ConfirmYourChoice'), ENT_QUOTES) |
449 | - ) . '\')) return false;">' . Display::return_icon( |
|
449 | + ).'\')) return false;">'.Display::return_icon( |
|
450 | 450 | 'delete.gif', |
451 | 451 | get_lang('Delete') |
452 | 452 | ).'</a><br />'; |
@@ -81,7 +81,7 @@ |
||
81 | 81 | echo "<tr>"; |
82 | 82 | echo "<td rowspan=\"2\" class=\"forum_message_left\">"; |
83 | 83 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $row['username']), ENT_QUOTES); |
84 | - if ($row['user_id']=='0') { |
|
84 | + if ($row['user_id'] == '0') { |
|
85 | 85 | $name = $row['poster_name']; |
86 | 86 | } else { |
87 | 87 | $name = api_get_person_name($row['firstname'], $row['lastname']); |
@@ -500,7 +500,7 @@ |
||
500 | 500 | $html .= '</div>'; |
501 | 501 | $html .= '</div></div>'; |
502 | 502 | } |
503 | - echo $html; |
|
503 | + echo $html; |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | if (count($forum_list) == 0) { |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | $origin = ''; |
53 | 53 | |
54 | 54 | if (isset($_GET['origin'])) { |
55 | - $origin = Security::remove_XSS($_GET['origin']); |
|
55 | + $origin = Security::remove_XSS($_GET['origin']); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /* Header and Breadcrumbs */ |
59 | 59 | $gradebook = null; |
60 | 60 | if (isset($_SESSION['gradebook'])) { |
61 | - $gradebook= $_SESSION['gradebook']; |
|
61 | + $gradebook = $_SESSION['gradebook']; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | if (!empty($gradebook) && $gradebook == 'view') { |
65 | - $interbreadcrumb[] = array ( |
|
65 | + $interbreadcrumb[] = array( |
|
66 | 66 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
67 | 67 | 'name' => get_lang('ToolGradebook') |
68 | 68 | ); |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | |
73 | 73 | $current_forum_category = get_forum_categories($_GET['forumcategory']); |
74 | 74 | $interbreadcrumb[] = array( |
75 | - 'url' => 'index.php?gradebook=' . $gradebook . '&search=' |
|
75 | + 'url' => 'index.php?gradebook='.$gradebook.'&search=' |
|
76 | 76 | . Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')), |
77 | 77 | 'name' => get_lang('Forum') |
78 | 78 | ); |
79 | 79 | |
80 | 80 | if (!empty($_GET['action']) && !empty($_GET['content'])) { |
81 | - if ($_GET['action']=='add' && $_GET['content']=='forum' ) { |
|
81 | + if ($_GET['action'] == 'add' && $_GET['content'] == 'forum') { |
|
82 | 82 | $interbreadcrumb[] = array( |
83 | - 'url' => 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='. $current_forum_category['cat_id'], |
|
83 | + 'url' => 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.$current_forum_category['cat_id'], |
|
84 | 84 | 'name' => $current_forum_category['cat_title'] |
85 | 85 | ); |
86 | 86 | $interbreadcrumb[] = array( |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | // then the user is not allowed here. |
111 | 111 | if ( |
112 | 112 | !api_is_allowed_to_edit(false, true) AND |
113 | - ( $current_forum_category && $current_forum_category['visibility'] == 0) |
|
113 | + ($current_forum_category && $current_forum_category['visibility'] == 0) |
|
114 | 114 | ) { |
115 | 115 | api_not_allowed(); |
116 | 116 | } |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | $html .= '<div class="actions">'; |
121 | 121 | $html .= '<a href="index.php?gradebook='.$gradebook.'&'.api_get_cidreq().'">'. |
122 | 122 | Display::return_icon('back.png', get_lang('BackToForumOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
123 | -if (api_is_allowed_to_edit(false,true)) { |
|
124 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' |
|
125 | - . $current_forum_category['cat_id'] . '&action=add&content=forum"> ' |
|
126 | - . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM) . '</a>'; |
|
123 | +if (api_is_allowed_to_edit(false, true)) { |
|
124 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory=' |
|
125 | + . $current_forum_category['cat_id'].'&action=add&content=forum"> ' |
|
126 | + . Display::return_icon('new_forum.png', get_lang('AddForum'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
127 | 127 | } |
128 | 128 | $html .= search_link(); |
129 | 129 | $html .= '</div>'; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $forum_categories_list = ''; |
184 | 184 | $forumId = $forum_category['cat_id']; |
185 | 185 | $forumTitle = $forum_category['cat_title']; |
186 | - $linkForumCategory = 'viewforumcategory.php?' . api_get_cidreq() . '&forumcategory=' . strval(intval($forumId)); |
|
186 | + $linkForumCategory = 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.strval(intval($forumId)); |
|
187 | 187 | $descriptionCategory = $forum_category['cat_comment']; |
188 | 188 | $icoCategory = Display::return_icon( |
189 | 189 | 'forum_blue.png', |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | |
195 | 195 | if (api_is_allowed_to_edit(false, true) && !($forum_category['session_id'] == 0 && $sessionId != 0)) { |
196 | 196 | |
197 | - $iconsEdit = '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' |
|
198 | - . Security::remove_XSS($_GET['forumcategory']) . '&action=edit&content=forumcategory&id=' |
|
199 | - . '' . $forumId . '">' |
|
200 | - . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
201 | - $iconsEdit .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' |
|
197 | + $iconsEdit = '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory=' |
|
198 | + . Security::remove_XSS($_GET['forumcategory']).'&action=edit&content=forumcategory&id=' |
|
199 | + . ''.$forumId.'">' |
|
200 | + . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>'; |
|
201 | + $iconsEdit .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory=' |
|
202 | 202 | . Security::remove_XSS($_GET['forumcategory']) |
203 | - . '&action=delete&content=forumcategory&id=' . $forumId |
|
203 | + . '&action=delete&content=forumcategory&id='.$forumId |
|
204 | 204 | . "\" onclick=\"javascript:if(!confirm('" |
205 | 205 | . addslashes(api_htmlentities(get_lang('DeleteForumCategory'), ENT_QUOTES)) |
206 | - . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) |
|
206 | + . "')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) |
|
207 | 207 | . '</a>'; |
208 | 208 | $iconsEdit .= return_visible_invisible_icon( |
209 | 209 | 'forumcategory', $forum_category['cat_id'], |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | ); |
244 | 244 | |
245 | 245 | |
246 | - if ($descriptionCategory != '' && trim($descriptionCategory)!= ' ') { |
|
246 | + if ($descriptionCategory != '' && trim($descriptionCategory) != ' ') { |
|
247 | 247 | $html .= '<div class="forum-description">'.$descriptionCategory.'</div>'; |
248 | 248 | } |
249 | 249 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | // SHOULD WE SHOW THIS PARTICULAR FORUM |
268 | 268 | // you are teacher => show forum |
269 | 269 | |
270 | - if (api_is_allowed_to_edit(false,true)) { |
|
270 | + if (api_is_allowed_to_edit(false, true)) { |
|
271 | 271 | //echo 'teacher'; |
272 | 272 | $show_forum = true; |
273 | 273 | } else { |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | ? $all_groups[$forum['forum_of_group']]['id'] |
335 | 335 | : null; |
336 | 336 | $group_title = api_substr($my_all_groups_forum_name, 0, 30); |
337 | - $forum_title_group_addition = ' (<a href="../group/group_space.php?' . api_get_cidreq() |
|
338 | - . '&gidReq=' . $my_all_groups_forum_id . '" class="forum_group_link">' |
|
339 | - . get_lang('GoTo') . ' ' . $group_title . '</a>)'; |
|
337 | + $forum_title_group_addition = ' (<a href="../group/group_space.php?'.api_get_cidreq() |
|
338 | + . '&gidReq='.$my_all_groups_forum_id.'" class="forum_group_link">' |
|
339 | + . get_lang('GoTo').' '.$group_title.'</a>)'; |
|
340 | 340 | } else { |
341 | 341 | $forum_title_group_addition = ''; |
342 | 342 | } |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $html .= '<div class="row">'; |
355 | 355 | $html .= '<div class="col-md-6">'; |
356 | 356 | $html .= '<div class="col-md-3">'; |
357 | - $html .= '<div class="number-post">'.$forum_image .'<p>' . $my_number_threads . ' ' . get_lang('ForumThreads') . '</p></div>'; |
|
357 | + $html .= '<div class="number-post">'.$forum_image.'<p>'.$my_number_threads.' '.get_lang('ForumThreads').'</p></div>'; |
|
358 | 358 | $html .= '</div>'; |
359 | 359 | |
360 | 360 | $html .= '<div class="col-md-9">'; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | 'a', |
370 | 370 | $forum['forum_title'].$session_displayed, |
371 | 371 | array( |
372 | - 'href' => 'viewforum.php?' . api_get_cidreq() |
|
372 | + 'href' => 'viewforum.php?'.api_get_cidreq() |
|
373 | 373 | . "&gidReq={$forum['forum_of_group']}&forum={$forum['forum_id']}&search=" |
374 | 374 | . Security::remove_XSS(urlencode(isset($_GET['search']) ? $_GET['search'] : '')), |
375 | 375 | 'class' => empty($forum['visibility']) ? 'text-muted' : null |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | ); |
378 | 378 | $html .= Display::tag( |
379 | 379 | 'h3', |
380 | - $linkForum . ' ' . $forum_title_group_addition, |
|
380 | + $linkForum.' '.$forum_title_group_addition, |
|
381 | 381 | array( |
382 | 382 | 'class' => 'title' |
383 | 383 | ) |
@@ -393,19 +393,19 @@ discard block |
||
393 | 393 | $html .= '</div>'; |
394 | 394 | $html .= '<div class="col-md-6">'; |
395 | 395 | |
396 | - $iconEmpty=''; |
|
396 | + $iconEmpty = ''; |
|
397 | 397 | |
398 | 398 | // The number of topics and posts. |
399 | 399 | if ($forum['forum_of_group'] !== '0') { |
400 | 400 | $newPost = ''; |
401 | 401 | if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) { |
402 | - $newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL); |
|
402 | + $newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL); |
|
403 | 403 | } else { |
404 | 404 | $newPost = $iconEmpty; |
405 | 405 | } |
406 | 406 | } else { |
407 | 407 | if (is_array($my_whatsnew_post_info) && !empty($my_whatsnew_post_info)) { |
408 | - $newPost = ' ' . Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL); |
|
408 | + $newPost = ' '.Display::return_icon('alert.png', get_lang('Forum'), null, ICON_SIZE_SMALL); |
|
409 | 409 | } else { |
410 | 410 | $newPost = $iconEmpty; |
411 | 411 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | $html .= '<div class="row">'; |
415 | 415 | $html .= '<div class="col-md-2">'; |
416 | - $html .= $newPost . '</div>'; |
|
416 | + $html .= $newPost.'</div>'; |
|
417 | 417 | |
418 | 418 | $poster_id = 0; |
419 | 419 | $name = ''; |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | } |
429 | 429 | $html .= '<div class="col-md-6">'; |
430 | 430 | if (!empty($forum['last_post_id'])) { |
431 | - $html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' '; |
|
431 | + $html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY).' '; |
|
432 | 432 | $html .= api_convert_and_format_date($forum['last_post_date']) |
433 | - . ' ' . get_lang('By') . ' ' |
|
433 | + . ' '.get_lang('By').' ' |
|
434 | 434 | . display_user_link($poster_id, $name); |
435 | 435 | } |
436 | 436 | $html .= '</div>'; |
@@ -440,13 +440,13 @@ discard block |
||
440 | 440 | api_is_allowed_to_edit(false, true) && |
441 | 441 | !($forum['session_id'] == 0 && $sessionId != 0) |
442 | 442 | ) { |
443 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' |
|
443 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory=' |
|
444 | 444 | . Security::remove_XSS($_GET['forumcategory']) |
445 | - . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">' |
|
446 | - . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
447 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' |
|
445 | + . '&action=edit&content=forum&id='.$forum['forum_id'].'">' |
|
446 | + . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>'; |
|
447 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory=' |
|
448 | 448 | . Security::remove_XSS($_GET['forumcategory']) |
449 | - . '&action=delete&content=forum&id=' . $forum['forum_id'] |
|
449 | + . '&action=delete&content=forum&id='.$forum['forum_id'] |
|
450 | 450 | . "\" onclick=\"javascript:if(!confirm('" |
451 | 451 | . addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES)) |
452 | 452 | . "')) return false;\">" |
@@ -470,15 +470,15 @@ discard block |
||
470 | 470 | $iconnotify = 'notification_mail_na.png'; |
471 | 471 | |
472 | 472 | if (is_array(isset($_SESSION['forum_notification']['forum']) ? $_SESSION['forum_notification']['forum'] : null)) { |
473 | - if (in_array($forum['forum_id'],$_SESSION['forum_notification']['forum'])) { |
|
473 | + if (in_array($forum['forum_id'], $_SESSION['forum_notification']['forum'])) { |
|
474 | 474 | $iconnotify = 'notification_mail.png'; |
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | 478 | if (!api_is_anonymous()) { |
479 | - $html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&forumcategory=' |
|
480 | - . Security::remove_XSS($_GET['forumcategory']) . '&action=notify&content=forum&id=' |
|
481 | - . $forum['forum_id'] . '">' . Display::return_icon($iconnotify, get_lang('NotifyMe')) . '</a>'; |
|
479 | + $html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&forumcategory=' |
|
480 | + . Security::remove_XSS($_GET['forumcategory']).'&action=notify&content=forum&id=' |
|
481 | + . $forum['forum_id'].'">'.Display::return_icon($iconnotify, get_lang('NotifyMe')).'</a>'; |
|
482 | 482 | } |
483 | 483 | $html .= '</div>'; |
484 | 484 | $html .= '</div>'; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | // Are we in a lp ? |
29 | 29 | $origin = ''; |
30 | 30 | if (isset($_GET['origin'])) { |
31 | - $origin = Security::remove_XSS($_GET['origin']); |
|
31 | + $origin = Security::remove_XSS($_GET['origin']); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /* MAIN DISPLAY SECTION */ |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | |
46 | 46 | /* Header and Breadcrumbs */ |
47 | 47 | |
48 | -if (isset($_SESSION['gradebook'])){ |
|
48 | +if (isset($_SESSION['gradebook'])) { |
|
49 | 49 | $gradebook = $_SESSION['gradebook']; |
50 | 50 | } |
51 | 51 | |
52 | 52 | if (!empty($gradebook) && $gradebook == 'view') { |
53 | - $interbreadcrumb[] = array ( |
|
53 | + $interbreadcrumb[] = array( |
|
54 | 54 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
55 | 55 | 'name' => get_lang('ToolGradebook') |
56 | 56 | ); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | echo "\t<tr>\n\t\t<th style=\"padding-left:5px;\" align=\"left\" colspan=\"6\">"; |
184 | 184 | echo '<span class="forum_title">'.prepare4display($current_thread['thread_title']).'</span><br />'; |
185 | 185 | |
186 | - if ($origin!='learnpath') { |
|
186 | + if ($origin != 'learnpath') { |
|
187 | 187 | echo '<span class="forum_low_description">'.prepare4display($current_forum_category['cat_title']).' - '; |
188 | 188 | } |
189 | 189 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | require_once '../inc/global.inc.php'; |
9 | -$current_course_tool = TOOL_COURSE_MAINTENANCE; |
|
9 | +$current_course_tool = TOOL_COURSE_MAINTENANCE; |
|
10 | 10 | $this_section = SECTION_COURSES; |
11 | 11 | |
12 | 12 | $nameTools = get_lang('Maintenance'); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | <div class="sectioncomment"><?php echo get_lang('DescriptionRecycleCourse'); ?></div> |
41 | 41 | |
42 | 42 | <div class="sectiontitle"><?php Display::display_icon('delete.gif', get_lang('DelCourse')); ?> <a href="../course_info/delete_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('DelCourse'); ?></a></div> |
43 | -<div class="sectioncomment"><?php echo get_lang('DescriptionDeleteCourse'); ?></div> |
|
43 | +<div class="sectioncomment"><?php echo get_lang('DescriptionDeleteCourse'); ?></div> |
|
44 | 44 | |
45 | 45 | <?php |
46 | 46 | // Footer |
@@ -87,7 +87,7 @@ |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | if ($pluginLegal) { |
90 | - header('Location:' .$url); |
|
90 | + header('Location:'.$url); |
|
91 | 91 | exit; |
92 | 92 | } |
93 | 93 | } |