@@ -6,47 +6,47 @@ discard block |
||
6 | 6 | */ |
7 | 7 | class AddCourseToSession |
8 | 8 | { |
9 | - /** |
|
10 | - * Searches a course, given a search string and a type of search box |
|
11 | - * @param string $needle Search string |
|
12 | - * @param string $type Type of search box ('single' or anything else) |
|
13 | - * @return xajaxResponse XajaxResponse |
|
14 | - * @assert ('abc', 'single') !== null |
|
15 | - * @assert ('abc', 'multiple') !== null |
|
16 | - */ |
|
17 | - public static function search_courses($needle, $type) |
|
18 | - { |
|
19 | - global $tbl_session_rel_course, $id_session; |
|
9 | + /** |
|
10 | + * Searches a course, given a search string and a type of search box |
|
11 | + * @param string $needle Search string |
|
12 | + * @param string $type Type of search box ('single' or anything else) |
|
13 | + * @return xajaxResponse XajaxResponse |
|
14 | + * @assert ('abc', 'single') !== null |
|
15 | + * @assert ('abc', 'multiple') !== null |
|
16 | + */ |
|
17 | + public static function search_courses($needle, $type) |
|
18 | + { |
|
19 | + global $tbl_session_rel_course, $id_session; |
|
20 | 20 | $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); |
21 | - $course_title = null; |
|
22 | - $xajax_response = new xajaxResponse(); |
|
23 | - $return = ''; |
|
24 | - if(!empty($needle) && !empty($type)) { |
|
25 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
26 | - $charset = api_get_system_encoding(); |
|
27 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
21 | + $course_title = null; |
|
22 | + $xajax_response = new xajaxResponse(); |
|
23 | + $return = ''; |
|
24 | + if(!empty($needle) && !empty($type)) { |
|
25 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
26 | + $charset = api_get_system_encoding(); |
|
27 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
28 | 28 | |
29 | - $cond_course_code = ''; |
|
30 | - if (!empty($id_session)) { |
|
31 | - $id_session = intval($id_session); |
|
32 | - // check course_code from session_rel_course table |
|
33 | - $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.' |
|
29 | + $cond_course_code = ''; |
|
30 | + if (!empty($id_session)) { |
|
31 | + $id_session = intval($id_session); |
|
32 | + // check course_code from session_rel_course table |
|
33 | + $sql = 'SELECT c_id FROM '.$tbl_session_rel_course.' |
|
34 | 34 | WHERE session_id = '.$id_session; |
35 | - $res = Database::query($sql); |
|
36 | - $course_codes = ''; |
|
37 | - if (Database::num_rows($res) > 0) { |
|
38 | - while ($row = Database::fetch_row($res)) { |
|
39 | - $course_codes .= '\''.$row[0].'\','; |
|
40 | - } |
|
41 | - $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
35 | + $res = Database::query($sql); |
|
36 | + $course_codes = ''; |
|
37 | + if (Database::num_rows($res) > 0) { |
|
38 | + while ($row = Database::fetch_row($res)) { |
|
39 | + $course_codes .= '\''.$row[0].'\','; |
|
40 | + } |
|
41 | + $course_codes = substr($course_codes,0,(strlen($course_codes)-1)); |
|
42 | 42 | |
43 | - $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
|
44 | - } |
|
45 | - } |
|
43 | + $cond_course_code = ' AND course.id NOT IN('.$course_codes.') '; |
|
44 | + } |
|
45 | + } |
|
46 | 46 | |
47 | 47 | if ($type == 'single') { |
48 | - // search users where username or firstname or lastname begins likes $needle |
|
49 | - $sql = 'SELECT |
|
48 | + // search users where username or firstname or lastname begins likes $needle |
|
49 | + $sql = 'SELECT |
|
50 | 50 | course.code, |
51 | 51 | course.visual_code, |
52 | 52 | course.title, |
@@ -58,21 +58,21 @@ discard block |
||
58 | 58 | WHERE |
59 | 59 | course.visual_code LIKE "'.$needle.'%" OR |
60 | 60 | course.title LIKE "'.$needle.'%"'; |
61 | - } else { |
|
62 | - $sql = 'SELECT course.code, course.visual_code, course.title |
|
61 | + } else { |
|
62 | + $sql = 'SELECT course.code, course.visual_code, course.title |
|
63 | 63 | FROM '.$tbl_course.' course |
64 | 64 | WHERE |
65 | 65 | course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.' |
66 | 66 | ORDER BY course.code '; |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - if (api_is_multiple_url_enabled()) { |
|
70 | - $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
71 | - $access_url_id = api_get_current_access_url_id(); |
|
72 | - if ($access_url_id != -1){ |
|
69 | + if (api_is_multiple_url_enabled()) { |
|
70 | + $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); |
|
71 | + $access_url_id = api_get_current_access_url_id(); |
|
72 | + if ($access_url_id != -1){ |
|
73 | 73 | |
74 | - if ($type=='single') { |
|
75 | - $sql = 'SELECT |
|
74 | + if ($type=='single') { |
|
75 | + $sql = 'SELECT |
|
76 | 76 | course.code, |
77 | 77 | course.visual_code, |
78 | 78 | course.title, |
@@ -87,41 +87,41 @@ discard block |
||
87 | 87 | access_url_id = '.$access_url_id.' AND |
88 | 88 | (course.visual_code LIKE "'.$needle.'%" OR |
89 | 89 | course.title LIKE "'.$needle.'%" )'; |
90 | - } else { |
|
91 | - $sql = 'SELECT course.code, course.visual_code, course.title |
|
90 | + } else { |
|
91 | + $sql = 'SELECT course.code, course.visual_code, course.title |
|
92 | 92 | FROM '.$tbl_course.' course, '.$tbl_course_rel_access_url.' url_course |
93 | 93 | WHERE |
94 | 94 | url_course.c_id = course.id AND |
95 | 95 | access_url_id = '.$access_url_id.' AND |
96 | 96 | course.visual_code LIKE "'.$needle.'%" '.$cond_course_code.' |
97 | 97 | ORDER BY course.code '; |
98 | - } |
|
99 | - } |
|
100 | - } |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | - $rs = Database::query($sql); |
|
103 | - $course_list = array(); |
|
102 | + $rs = Database::query($sql); |
|
103 | + $course_list = array(); |
|
104 | 104 | if ($type == 'single') { |
105 | - while ($course = Database :: fetch_array($rs)) { |
|
106 | - $course_list[] = $course['code']; |
|
107 | - $course_title=str_replace("'","\'",$course_title); |
|
108 | - $return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['code'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />'; |
|
109 | - } |
|
110 | - $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
111 | - } else { |
|
112 | - $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
113 | - while($course = Database :: fetch_array($rs)) { |
|
114 | - $course_list[] = $course['code']; |
|
115 | - $course_title=str_replace("'","\'",$course_title); |
|
116 | - $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
117 | - } |
|
118 | - $return .= '</select>'; |
|
105 | + while ($course = Database :: fetch_array($rs)) { |
|
106 | + $course_list[] = $course['code']; |
|
107 | + $course_title=str_replace("'","\'",$course_title); |
|
108 | + $return .= '<a href="javascript: void(0);" onclick="javascript: add_course_to_session(\''.$course['code'].'\',\''.$course_title.' ('.$course['visual_code'].')'.'\')">'.$course['title'].' ('.$course['visual_code'].')</a><br />'; |
|
109 | + } |
|
110 | + $xajax_response -> addAssign('ajax_list_courses_single','innerHTML',api_utf8_encode($return)); |
|
111 | + } else { |
|
112 | + $return .= '<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
113 | + while($course = Database :: fetch_array($rs)) { |
|
114 | + $course_list[] = $course['code']; |
|
115 | + $course_title=str_replace("'","\'",$course_title); |
|
116 | + $return .= '<option value="'.$course['code'].'" title="'.htmlspecialchars($course['title'].' ('.$course['visual_code'].')',ENT_QUOTES).'">'.$course['title'].' ('.$course['visual_code'].')</option>'; |
|
117 | + } |
|
118 | + $return .= '</select>'; |
|
119 | 119 | |
120 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
121 | - } |
|
122 | - } |
|
123 | - $_SESSION['course_list'] = $course_list; |
|
120 | + $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
121 | + } |
|
122 | + } |
|
123 | + $_SESSION['course_list'] = $course_list; |
|
124 | 124 | |
125 | - return $xajax_response; |
|
126 | - } |
|
125 | + return $xajax_response; |
|
126 | + } |
|
127 | 127 | } |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Export tabular data to XML-file |
|
119 | - * @param array Simple array of data to put in XML |
|
120 | - * @param string Name of file to be given to the user |
|
121 | - * @param string Name of common tag to place each line in |
|
122 | - * @param string Name of the root element. A root element should always be given. |
|
123 | - * @param string Encoding in which the data is provided |
|
124 | - */ |
|
118 | + * Export tabular data to XML-file |
|
119 | + * @param array Simple array of data to put in XML |
|
120 | + * @param string Name of file to be given to the user |
|
121 | + * @param string Name of common tag to place each line in |
|
122 | + * @param string Name of the root element. A root element should always be given. |
|
123 | + * @param string Encoding in which the data is provided |
|
124 | + */ |
|
125 | 125 | public static function arrayToXml( |
126 | 126 | $data, |
127 | 127 | $filename = 'export', |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | foreach ($data as $row) { |
201 | 201 | $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>'; |
202 | 202 | if (is_array($row['value'])) { |
203 | - $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
203 | + $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n"; |
|
204 | 204 | $string .= str_repeat("\t",$level).'</'.$row['name'].'>'; |
205 | 205 | } else { |
206 | 206 | $string .= $row['value']; |
@@ -25,29 +25,29 @@ |
||
25 | 25 | function search_courses($needle,$type) |
26 | 26 | { |
27 | 27 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
28 | - $xajax_response = new xajaxResponse(); |
|
29 | - $return = ''; |
|
30 | - if(!empty($needle) && !empty($type)) { |
|
31 | - // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
32 | - $charset = api_get_system_encoding(); |
|
33 | - $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
34 | - $needle = Database::escape_string($needle); |
|
28 | + $xajax_response = new xajaxResponse(); |
|
29 | + $return = ''; |
|
30 | + if(!empty($needle) && !empty($type)) { |
|
31 | + // xajax send utf8 datas... datas in db can be non-utf8 datas |
|
32 | + $charset = api_get_system_encoding(); |
|
33 | + $needle = api_convert_encoding($needle, $charset, 'utf-8'); |
|
34 | + $needle = Database::escape_string($needle); |
|
35 | 35 | |
36 | - $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; |
|
36 | + $sql = 'SELECT * FROM '.$tbl_session.' WHERE name LIKE "'.$needle.'%" ORDER BY id'; |
|
37 | 37 | |
38 | - $rs = Database::query($sql); |
|
39 | - $course_list = array(); |
|
38 | + $rs = Database::query($sql); |
|
39 | + $course_list = array(); |
|
40 | 40 | |
41 | - $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
42 | - while($course = Database :: fetch_array($rs)) { |
|
43 | - $course_list[] = $course['id']; |
|
44 | - $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
45 | - } |
|
46 | - $return .= '</select>'; |
|
47 | - $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
48 | - } |
|
49 | - $_SESSION['course_list'] = $course_list; |
|
41 | + $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">'; |
|
42 | + while($course = Database :: fetch_array($rs)) { |
|
43 | + $course_list[] = $course['id']; |
|
44 | + $return .= '<option value="'.$course['id'].'" title="'.htmlspecialchars($course['name'],ENT_QUOTES).'">'.$course['name'].'</option>'; |
|
45 | + } |
|
46 | + $return .= '</select>'; |
|
47 | + $xajax_response -> addAssign('ajax_list_courses_multiple','innerHTML',api_utf8_encode($return)); |
|
48 | + } |
|
49 | + $_SESSION['course_list'] = $course_list; |
|
50 | 50 | |
51 | - return $xajax_response; |
|
52 | - } |
|
51 | + return $xajax_response; |
|
52 | + } |
|
53 | 53 | } |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * Displays the title + grid |
53 | 53 | */ |
54 | - public function display() |
|
54 | + public function display() |
|
55 | 55 | { |
56 | - // action links |
|
57 | - echo '<div class="actions" style="margin-bottom:20px">'; |
|
56 | + // action links |
|
57 | + echo '<div class="actions" style="margin-bottom:20px">'; |
|
58 | 58 | echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
59 | - echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>'; |
|
60 | - echo '</div>'; |
|
59 | + echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>'; |
|
60 | + echo '</div>'; |
|
61 | 61 | echo Display::grid_html('grade_model'); |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * Returns a Form validator Obj |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | $form->addElement('hidden', 'maxvalue', '100'); |
119 | - $form->addElement('hidden', 'minvalue', '0'); |
|
119 | + $form->addElement('hidden', 'minvalue', '0'); |
|
120 | 120 | $renderer = & $form->defaultRenderer(); |
121 | 121 | |
122 | 122 | $component_array = array(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Setting the rules |
194 | 194 | $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); |
195 | 195 | |
196 | - return $form; |
|
196 | + return $form; |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function save($params, $show_query = false) |
218 | 218 | { |
219 | - $id = parent::save($params, $show_query); |
|
220 | - if (!empty($id)) { |
|
219 | + $id = parent::save($params, $show_query); |
|
220 | + if (!empty($id)) { |
|
221 | 221 | foreach ($params['components'] as $component) { |
222 | 222 | if (!empty($component['title']) && !empty($component['percentage']) && !empty($component['acronym'])) { |
223 | 223 | $obj = new GradeModelComponents(); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id()); |
231 | - return $id; |
|
231 | + return $id; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function delete($id) |
259 | 259 | { |
260 | - parent::delete($id); |
|
260 | + parent::delete($id); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', $default_value = null) |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | /** |
306 | 306 | * GradeModelComponents constructor. |
307 | 307 | */ |
308 | - public function __construct() |
|
308 | + public function __construct() |
|
309 | 309 | { |
310 | 310 | parent::__construct(); |
311 | 311 | $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS); |
312 | - } |
|
312 | + } |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * @param array $params |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function save($params, $show_query = false) |
320 | 320 | { |
321 | - $id = parent::save($params, $show_query); |
|
321 | + $id = parent::save($params, $show_query); |
|
322 | 322 | |
323 | 323 | return $id; |
324 | 324 | } |
@@ -137,7 +137,7 @@ |
||
137 | 137 | array('\r', '\n', '\x3c', '\x3e', '\x26'), |
138 | 138 | addslashes($var) |
139 | 139 | ).'"'; |
140 | - case 'array': |
|
140 | + case 'array': |
|
141 | 141 | // Arrays in JSON can't be associative. If the array is empty or if it |
142 | 142 | // has sequential whole number keys starting with 0, it's not associative |
143 | 143 | // so we can go ahead and convert it as an array. |
@@ -47,20 +47,20 @@ discard block |
||
47 | 47 | $navigation['myprofile']['url'] = api_get_path(WEB_CODE_PATH).'auth/profile.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '' ); |
48 | 48 | $navigation['myprofile']['title'] = get_lang('ModifyProfile'); |
49 | 49 | $navigation['myprofile']['key'] = 'profile'; |
50 | - // Link to my agenda |
|
50 | + // Link to my agenda |
|
51 | 51 | $navigation['myagenda']['url'] = api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?type=personal'; |
52 | 52 | $navigation['myagenda']['title'] = get_lang('MyAgenda'); |
53 | 53 | $navigation['myagenda']['key'] = 'agenda'; |
54 | 54 | |
55 | - // Gradebook |
|
56 | - if (api_get_setting('gradebook_enable') == 'true') { |
|
55 | + // Gradebook |
|
56 | + if (api_get_setting('gradebook_enable') == 'true') { |
|
57 | 57 | $navigation['mygradebook']['url'] = api_get_path(WEB_CODE_PATH).'gradebook/gradebook.php'.(!empty($_course['path']) ? '?coursePath='.$_course['path'].'&courseCode='.$_course['official_code'] : '' ); |
58 | 58 | $navigation['mygradebook']['title'] = get_lang('MyGradebook'); |
59 | 59 | $navigation['mygradebook']['key'] = 'gradebook'; |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | - // Reporting |
|
63 | - if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) { |
|
62 | + // Reporting |
|
63 | + if (api_is_allowed_to_create_course() || api_is_drh() || api_is_session_admin()) { |
|
64 | 64 | // Link to my space |
65 | 65 | $navigation['session_my_space']['url'] = api_get_path(WEB_CODE_PATH).'mySpace/'.(api_is_drh()?'session.php':''); |
66 | 66 | $navigation['session_my_space']['title'] = get_lang('MySpace'); |
@@ -84,21 +84,21 @@ discard block |
||
84 | 84 | $navigation['session_my_progress']['key'] = 'my-progress'; |
85 | 85 | } |
86 | 86 | |
87 | - // Social |
|
88 | - if (api_get_setting('allow_social_tool')=='true') { |
|
87 | + // Social |
|
88 | + if (api_get_setting('allow_social_tool')=='true') { |
|
89 | 89 | $navigation['social']['url'] = api_get_path(WEB_CODE_PATH).'social/home.php'; |
90 | 90 | $navigation['social']['title'] = get_lang('SocialNetwork'); |
91 | 91 | $navigation['social']['key'] = 'social-network'; |
92 | - } |
|
92 | + } |
|
93 | 93 | |
94 | - // Dashboard |
|
95 | - if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
|
94 | + // Dashboard |
|
95 | + if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
|
96 | 96 | $navigation['dashboard']['url'] = api_get_path(WEB_CODE_PATH).'dashboard/index.php'; |
97 | 97 | $navigation['dashboard']['title'] = get_lang('Dashboard'); |
98 | 98 | $navigation['dashboard']['key'] = 'dashboard'; |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - // Reports |
|
101 | + // Reports |
|
102 | 102 | /* |
103 | 103 | if (api_is_platform_admin() || api_is_drh() || api_is_session_admin()) { |
104 | 104 | $navigation['reports']['url'] = api_get_path(WEB_CODE_PATH).'reports/index.php'; |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | } |
122 | 122 | // End Custom Tabs |
123 | 123 | |
124 | - // Platform administration |
|
125 | - if (api_is_platform_admin(true)) { |
|
124 | + // Platform administration |
|
125 | + if (api_is_platform_admin(true)) { |
|
126 | 126 | $navigation['platform_admin']['url'] = api_get_path(WEB_CODE_PATH).'admin/'; |
127 | 127 | $navigation['platform_admin']['title'] = get_lang('PlatformAdmin'); |
128 | 128 | $navigation['platform_admin']['key'] = 'admin'; |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | - return $navigation; |
|
131 | + return $navigation; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | if ($number && |
255 | 255 | (api_get_setting('showonline', 'world') == 'true' && !$user_id) || |
256 | 256 | (api_get_setting('showonline', 'users') == 'true' && $user_id) |
257 | - ) |
|
257 | + ) |
|
258 | 258 | { |
259 | 259 | $html .= '<li><a href="'.api_get_path(WEB_PATH).'whoisonline.php" target="_self" title="'.get_lang('UsersOnline').'" >'. |
260 | 260 | Display::return_icon('user.png', get_lang('UsersOnline'), array(), ICON_SIZE_TINY).' '.$number.'</a></li>'; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | (is_array($_course) && |
266 | 266 | api_get_setting('showonline', 'course') == 'true' && isset($_course['sysCode']) |
267 | 267 | ) |
268 | - ) |
|
268 | + ) |
|
269 | 269 | { |
270 | 270 | $html .= '<li><a href="'.api_get_path(WEB_PATH).'whoisonline.php?cidReq='.$_course['sysCode'].'" target="_self">'. |
271 | 271 | Display::return_icon('course.png', get_lang('UsersOnline').' '.get_lang('InThisCourse'), array(), ICON_SIZE_TINY).' '.$number_online_in_course.' </a></li>'; |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | - // Reports |
|
379 | + // Reports |
|
380 | 380 | if (!empty($possible_tabs['reports'])) { |
381 | 381 | if (api_get_setting('show_tabs', 'reports') == 'true') { |
382 | 382 | if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin()) && Rights::hasRight('show_tabs:reports')) { |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $navigation_item_my_courses['title'] = get_lang('MyCourses'); |
624 | 624 | $navigation_item_my_courses['url'] = api_get_path(WEB_PATH).'user_portal.php'; |
625 | 625 | $navigation[] = $navigation_item_my_courses; |
626 | - */ |
|
626 | + */ |
|
627 | 627 | $navigation[] = $navigation_item; |
628 | 628 | } |
629 | 629 |
@@ -1320,10 +1320,10 @@ discard block |
||
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | $sql .= ' FROM ' . Database::get_main_table(TABLE_MAIN_USER) . ' as user ' |
1323 | - . ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1323 | + . ' LEFT JOIN ' . Database::get_main_table(TABLE_MAIN_COURSE_USER) . ' as course_rel_user |
|
1324 | 1324 | ON user.user_id = course_rel_user.user_id AND |
1325 | 1325 | course_rel_user.relation_type <> ' . COURSE_RELATION_TYPE_RRHH . ' ' |
1326 | - . " INNER JOIN $course_table course ON course_rel_user.c_id = course.id "; |
|
1326 | + . " INNER JOIN $course_table course ON course_rel_user.c_id = course.id "; |
|
1327 | 1327 | |
1328 | 1328 | if (!empty($course_code)) { |
1329 | 1329 | $sql .= ' AND course_rel_user.c_id="' . $courseId . '"'; |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | |
1666 | 1666 | // We get the coach for the given course in a given session. |
1667 | 1667 | $sql = 'SELECT user_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . |
1668 | - ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1668 | + ' WHERE session_id ="' . $session_id . '" AND c_id="' . $courseId . '" AND status = 2'; |
|
1669 | 1669 | $rs = Database::query($sql); |
1670 | 1670 | while ($user = Database::fetch_array($rs)) { |
1671 | 1671 | $user_info = api_get_user_info($user['user_id']); |
@@ -3374,13 +3374,13 @@ discard block |
||
3374 | 3374 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3375 | 3375 | if ($load_dirs) { |
3376 | 3376 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3377 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3377 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3378 | 3378 | $params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']); |
3379 | 3379 | } |
3380 | 3380 | }else{ |
3381 | 3381 | if ($course_info['visibility'] != COURSE_VISIBILITY_CLOSED && $load_dirs) { |
3382 | 3382 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3383 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3383 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3384 | 3384 | $params['document'] .= Display::div('', ['id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container']); |
3385 | 3385 | } |
3386 | 3386 | } |
@@ -3563,7 +3563,7 @@ discard block |
||
3563 | 3563 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3564 | 3564 | if($load_dirs){ |
3565 | 3565 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3566 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3566 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3567 | 3567 | $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
3568 | 3568 | } |
3569 | 3569 | } |
@@ -3701,7 +3701,7 @@ discard block |
||
3701 | 3701 | $params['edit_actions'] .= api_get_path(WEB_CODE_PATH) . 'course_info/infocours.php?cidReq=' . $course['code']; |
3702 | 3702 | if($load_dirs){ |
3703 | 3703 | $params['document'] = '<a id="document_preview_' . $course_info['real_id'] . '_0" class="document_preview btn btn-default btn-sm" href="javascript:void(0);">' |
3704 | - . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3704 | + . Display::returnFontAwesomeIcon('folder-open') . '</a>'; |
|
3705 | 3705 | $params['document'] .= Display::div('', array('id' => 'document_result_' . $course_info['real_id'] . '_0', 'class' => 'document_preview_container')); |
3706 | 3706 | } |
3707 | 3707 | } |
@@ -4010,7 +4010,7 @@ discard block |
||
4010 | 4010 | } |
4011 | 4011 | |
4012 | 4012 | $session_title .= isset($course['special_course']) ? ' ' . |
4013 | - Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
4013 | + Display::return_icon('klipper.png', get_lang('CourseAutoRegister')) : ''; |
|
4014 | 4014 | |
4015 | 4015 | $params['title'] = $session_title; |
4016 | 4016 | $params['extra'] = ''; |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | $sublanguage_folder_error = false; |
67 | 67 | |
68 | 68 | if (isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) { |
69 | - $language_name = SubLanguageManager::get_name_of_language_by_id ($_GET['id']); |
|
70 | - $sub_language_name = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']); |
|
71 | - $all_data_of_language = SubLanguageManager::get_all_information_of_language($_GET['id']); |
|
72 | - $all_data_of_sublanguage = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']); |
|
73 | - $sub_language_file = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder']; |
|
69 | + $language_name = SubLanguageManager::get_name_of_language_by_id ($_GET['id']); |
|
70 | + $sub_language_name = SubLanguageManager::get_name_of_language_by_id ($_GET['sub_language_id']); |
|
71 | + $all_data_of_language = SubLanguageManager::get_all_information_of_language($_GET['id']); |
|
72 | + $all_data_of_sublanguage = SubLanguageManager::get_all_information_of_language($_GET['sub_language_id']); |
|
73 | + $sub_language_file = api_get_path(SYS_LANG_PATH).$all_data_of_sublanguage['dokeos_folder']; |
|
74 | 74 | |
75 | - if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) { |
|
76 | - $sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable'); |
|
77 | - } |
|
78 | - if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) { |
|
79 | - $language_id_exist = true; |
|
80 | - } else { |
|
81 | - $language_id_exist = false; |
|
82 | - } |
|
75 | + if (!file_exists($sub_language_file) || !is_writable($sub_language_file)) { |
|
76 | + $sublanguage_folder_error = $sub_language_file.' '.get_lang('IsNotWritable'); |
|
77 | + } |
|
78 | + if (SubLanguageManager::check_if_exist_language_by_id($_GET['id'])===true) { |
|
79 | + $language_id_exist = true; |
|
80 | + } else { |
|
81 | + $language_id_exist = false; |
|
82 | + } |
|
83 | 83 | } else { |
84 | - $language_name=''; |
|
85 | - $language_id_exist=false; |
|
84 | + $language_name=''; |
|
85 | + $language_id_exist=false; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $intro = sprintf(get_lang('RegisterTermsOfSubLanguageForX'), strtolower($sub_language_name)); |
89 | 89 | $path_folder = api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder']; |
90 | 90 | |
91 | 91 | if (!is_dir($path_folder) || strlen($all_data_of_language['dokeos_folder'])==0) { |
92 | - api_not_allowed(true); |
|
92 | + api_not_allowed(true); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | Display :: display_header($language_name); |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | echo '</div>'; |
102 | 102 | |
103 | 103 | if (!empty($_SESSION['msg'])) { |
104 | - echo $_SESSION['msg']; |
|
105 | - unset($_SESSION['msg']); |
|
104 | + echo $_SESSION['msg']; |
|
105 | + unset($_SESSION['msg']); |
|
106 | 106 | } else { |
107 | - echo '<br />'; |
|
107 | + echo '<br />'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | echo $html; |
123 | 123 | echo '<br /><br /><br />'; |
124 | 124 | if (!empty($sublanguage_folder_error)) { |
125 | - Display::display_warning_message($sublanguage_folder_error); |
|
125 | + Display::display_warning_message($sublanguage_folder_error); |
|
126 | 126 | } |
127 | 127 | echo '<div id="div_message_information_id"> </div>'; |
128 | 128 | |
@@ -136,186 +136,186 @@ discard block |
||
136 | 136 | * @return array |
137 | 137 | */ |
138 | 138 | function search_language_term( |
139 | - $term, |
|
140 | - $search_in_variable = true, |
|
141 | - $search_in_english = true, |
|
142 | - $search_in_parent = true, |
|
143 | - $search_in_sub_language = true |
|
139 | + $term, |
|
140 | + $search_in_variable = true, |
|
141 | + $search_in_english = true, |
|
142 | + $search_in_parent = true, |
|
143 | + $search_in_sub_language = true |
|
144 | 144 | ) { |
145 | - //These the $_REQUEST['id'] and the $_REQUEST['sub_language_id'] variables are process in global.inc.php (LOAD LANGUAGE FILES SECTION) |
|
146 | - /* |
|
145 | + //These the $_REQUEST['id'] and the $_REQUEST['sub_language_id'] variables are process in global.inc.php (LOAD LANGUAGE FILES SECTION) |
|
146 | + /* |
|
147 | 147 | These 4 arrays are set in global.inc.php with the condition that will be load from sub_language.php or sub_language_ajax.inc.php |
148 | 148 | $english_language_array |
149 | 149 | $parent_language_array |
150 | 150 | $sub_language_array |
151 | 151 | $language_files_to_load |
152 | 152 | */ |
153 | - global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array; |
|
154 | - $language_files_to_load_keys = array_flip($language_files_to_load); |
|
155 | - $array_to_search = $parent_language_array; |
|
156 | - $list_info = array(); |
|
157 | - $term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i'; |
|
158 | - //@todo optimize this foreach |
|
159 | - foreach ($language_files_to_load as $lang_file) { |
|
160 | - //searching in parent language of the sub language |
|
161 | - if ($search_in_parent) { |
|
162 | - $variables = $parent_language_array[$lang_file]; |
|
163 | - foreach ($variables as $parent_name_variable =>$parent_variable_value) { |
|
164 | - //arrays are avoided |
|
165 | - if (is_array($parent_variable_value)) { |
|
166 | - continue; |
|
167 | - } |
|
168 | - $founded = false; |
|
169 | - // searching the item in the parent tool |
|
170 | - if (preg_match($term,$parent_variable_value)!==0) { |
|
171 | - $founded = true; |
|
172 | - } |
|
173 | - if ($founded) { |
|
174 | - //loading variable from the english array |
|
175 | - $sub_language_name_variable = $sub_language_array[$lang_file][$parent_name_variable]; |
|
176 | - //loading variable from the english array |
|
177 | - $english_name_variable = $english_language_array[$lang_file][$parent_name_variable]; |
|
153 | + global $language_files_to_load, $sub_language_array, $english_language_array, $parent_language_array; |
|
154 | + $language_files_to_load_keys = array_flip($language_files_to_load); |
|
155 | + $array_to_search = $parent_language_array; |
|
156 | + $list_info = array(); |
|
157 | + $term='/'.Security::remove_XSS(trim($_REQUEST['txt_search_word'])).'/i'; |
|
158 | + //@todo optimize this foreach |
|
159 | + foreach ($language_files_to_load as $lang_file) { |
|
160 | + //searching in parent language of the sub language |
|
161 | + if ($search_in_parent) { |
|
162 | + $variables = $parent_language_array[$lang_file]; |
|
163 | + foreach ($variables as $parent_name_variable =>$parent_variable_value) { |
|
164 | + //arrays are avoided |
|
165 | + if (is_array($parent_variable_value)) { |
|
166 | + continue; |
|
167 | + } |
|
168 | + $founded = false; |
|
169 | + // searching the item in the parent tool |
|
170 | + if (preg_match($term,$parent_variable_value)!==0) { |
|
171 | + $founded = true; |
|
172 | + } |
|
173 | + if ($founded) { |
|
174 | + //loading variable from the english array |
|
175 | + $sub_language_name_variable = $sub_language_array[$lang_file][$parent_name_variable]; |
|
176 | + //loading variable from the english array |
|
177 | + $english_name_variable = $english_language_array[$lang_file][$parent_name_variable]; |
|
178 | 178 | |
179 | - //config buttons |
|
180 | - /*if (strlen($english_name_variable)>1500) { |
|
179 | + //config buttons |
|
180 | + /*if (strlen($english_name_variable)>1500) { |
|
181 | 181 | $size =20; |
182 | 182 | } else { |
183 | 183 | $size =4; |
184 | 184 | }*/ |
185 | 185 | |
186 | - $obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>'; |
|
187 | - $obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'" />'.get_lang('Save').'</button>'; |
|
186 | + $obj_text='<textarea rows="10" cols="40" name="txt|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$parent_name_variable.'" >'.$sub_language_name_variable.'</textarea>'; |
|
187 | + $obj_button='<button class="save" type="button" name="btn|'.$parent_name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$parent_name_variable.'" />'.get_lang('Save').'</button>'; |
|
188 | 188 | |
189 | - $list_info[] = array( |
|
190 | - $lang_file . '.inc.php', |
|
191 | - $parent_name_variable, |
|
192 | - $english_name_variable, |
|
193 | - $parent_variable_value, |
|
194 | - $obj_text, |
|
195 | - $obj_button |
|
196 | - ); |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
189 | + $list_info[] = array( |
|
190 | + $lang_file . '.inc.php', |
|
191 | + $parent_name_variable, |
|
192 | + $english_name_variable, |
|
193 | + $parent_variable_value, |
|
194 | + $obj_text, |
|
195 | + $obj_button |
|
196 | + ); |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | 200 | |
201 | - //search in english |
|
202 | - if ($search_in_english || $search_in_variable) { |
|
203 | - $variables = $english_language_array[$lang_file]; |
|
204 | - foreach ($variables as $name_variable =>$variable_value) { |
|
205 | - if (is_array($variable_value)) { |
|
206 | - continue; |
|
207 | - } |
|
201 | + //search in english |
|
202 | + if ($search_in_english || $search_in_variable) { |
|
203 | + $variables = $english_language_array[$lang_file]; |
|
204 | + foreach ($variables as $name_variable =>$variable_value) { |
|
205 | + if (is_array($variable_value)) { |
|
206 | + continue; |
|
207 | + } |
|
208 | 208 | |
209 | - if (is_array($variable_value)) |
|
210 | - echo $lang_file; |
|
211 | - $founded = false; |
|
212 | - if ($search_in_english && $search_in_variable) { |
|
213 | - // searching the item in the parent tool |
|
214 | - if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) { |
|
215 | - $founded = true; |
|
216 | - } |
|
217 | - } else { |
|
218 | - if ($search_in_english) { |
|
219 | - if (preg_match($term,$variable_value)!==0) { |
|
220 | - $founded = true; |
|
221 | - } |
|
222 | - } else { |
|
223 | - if (preg_match($term,$name_variable)!==0) { |
|
224 | - $founded = true; |
|
225 | - } |
|
226 | - } |
|
227 | - } |
|
209 | + if (is_array($variable_value)) |
|
210 | + echo $lang_file; |
|
211 | + $founded = false; |
|
212 | + if ($search_in_english && $search_in_variable) { |
|
213 | + // searching the item in the parent tool |
|
214 | + if (preg_match($term,$variable_value)!==0 || preg_match($term,$name_variable)!==0 ) { |
|
215 | + $founded = true; |
|
216 | + } |
|
217 | + } else { |
|
218 | + if ($search_in_english) { |
|
219 | + if (preg_match($term,$variable_value)!==0) { |
|
220 | + $founded = true; |
|
221 | + } |
|
222 | + } else { |
|
223 | + if (preg_match($term,$name_variable)!==0) { |
|
224 | + $founded = true; |
|
225 | + } |
|
226 | + } |
|
227 | + } |
|
228 | 228 | |
229 | - if ($founded) { |
|
230 | - //loading variable from the english array |
|
231 | - $sub_language_name_variable = null; |
|
232 | - if (isset($sub_language_array[$lang_file][$name_variable])) { |
|
233 | - $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable]; |
|
234 | - } |
|
235 | - $parent_variable_value = null; |
|
236 | - if (isset($parent_language_array[$lang_file][$name_variable])) { |
|
237 | - $parent_variable_value = $parent_language_array[$lang_file][$name_variable]; |
|
238 | - } |
|
239 | - //config buttons |
|
240 | - $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'. |
|
241 | - $sub_language_name_variable.' |
|
229 | + if ($founded) { |
|
230 | + //loading variable from the english array |
|
231 | + $sub_language_name_variable = null; |
|
232 | + if (isset($sub_language_array[$lang_file][$name_variable])) { |
|
233 | + $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable]; |
|
234 | + } |
|
235 | + $parent_variable_value = null; |
|
236 | + if (isset($parent_language_array[$lang_file][$name_variable])) { |
|
237 | + $parent_variable_value = $parent_language_array[$lang_file][$name_variable]; |
|
238 | + } |
|
239 | + //config buttons |
|
240 | + $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'. |
|
241 | + $sub_language_name_variable.' |
|
242 | 242 | </textarea>'; |
243 | - $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'" />'.get_lang('Save').'</button>'; |
|
243 | + $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'" />'.get_lang('Save').'</button>'; |
|
244 | 244 | |
245 | - //loading variable from the english array |
|
246 | - $english_name_variable = $english_language_array[$lang_file][$name_variable]; |
|
245 | + //loading variable from the english array |
|
246 | + $english_name_variable = $english_language_array[$lang_file][$name_variable]; |
|
247 | 247 | |
248 | - $list_info[] = array( |
|
249 | - $lang_file . '.inc.php', |
|
250 | - $name_variable, |
|
251 | - $english_name_variable, |
|
252 | - $parent_variable_value, |
|
253 | - $obj_text, |
|
254 | - $obj_button |
|
255 | - ); |
|
256 | - } |
|
257 | - } |
|
258 | - } |
|
248 | + $list_info[] = array( |
|
249 | + $lang_file . '.inc.php', |
|
250 | + $name_variable, |
|
251 | + $english_name_variable, |
|
252 | + $parent_variable_value, |
|
253 | + $obj_text, |
|
254 | + $obj_button |
|
255 | + ); |
|
256 | + } |
|
257 | + } |
|
258 | + } |
|
259 | 259 | |
260 | - // Search in sub language |
|
261 | - if ($search_in_sub_language) { |
|
262 | - $variables = $sub_language_array[$lang_file]; |
|
263 | - foreach ($variables as $name_variable =>$variable_value) { |
|
264 | - if (is_array($parent_variable_value)) { |
|
265 | - continue; |
|
266 | - } |
|
260 | + // Search in sub language |
|
261 | + if ($search_in_sub_language) { |
|
262 | + $variables = $sub_language_array[$lang_file]; |
|
263 | + foreach ($variables as $name_variable =>$variable_value) { |
|
264 | + if (is_array($parent_variable_value)) { |
|
265 | + continue; |
|
266 | + } |
|
267 | 267 | |
268 | - if (is_array($variable_value)) { |
|
269 | - continue; |
|
270 | - } |
|
268 | + if (is_array($variable_value)) { |
|
269 | + continue; |
|
270 | + } |
|
271 | 271 | |
272 | - $founded = false; |
|
273 | - // searching the item in the parent tool |
|
274 | - if (preg_match($term,$variable_value)!==0) { |
|
275 | - $founded = true; |
|
276 | - } |
|
277 | - if ($founded) { |
|
278 | - //loading variable from the english array |
|
279 | - $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable]; |
|
280 | - $parent_variable_value = $parent_language_array[$lang_file][$name_variable]; |
|
281 | - //config buttons |
|
282 | - $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>'; |
|
283 | - $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'" />'.get_lang('Save').'</button>'; |
|
272 | + $founded = false; |
|
273 | + // searching the item in the parent tool |
|
274 | + if (preg_match($term,$variable_value)!==0) { |
|
275 | + $founded = true; |
|
276 | + } |
|
277 | + if ($founded) { |
|
278 | + //loading variable from the english array |
|
279 | + $sub_language_name_variable = $sub_language_array[$lang_file][$name_variable]; |
|
280 | + $parent_variable_value = $parent_language_array[$lang_file][$name_variable]; |
|
281 | + //config buttons |
|
282 | + $obj_text='<textarea rows="10" cols="40" name="txt|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="txtid_'.$language_files_to_load_keys[$lang_file].'_'.$name_variable.'" >'.$sub_language_name_variable.'</textarea>'; |
|
283 | + $obj_button='<button class="save" type="button" name="btn|'.$name_variable.'|'.$language_files_to_load_keys[$lang_file].'" id="btnid_'.$name_variable.'" />'.get_lang('Save').'</button>'; |
|
284 | 284 | |
285 | - //loading variable from the english array |
|
286 | - $english_name_variable = $english_language_array[$lang_file][$name_variable]; |
|
287 | - $list_info[]=array($lang_file.'.inc.php', |
|
288 | - $name_variable, |
|
289 | - $english_name_variable, |
|
290 | - $parent_variable_value,$obj_text,$obj_button); |
|
291 | - } |
|
292 | - } |
|
293 | - } |
|
294 | - } |
|
285 | + //loading variable from the english array |
|
286 | + $english_name_variable = $english_language_array[$lang_file][$name_variable]; |
|
287 | + $list_info[]=array($lang_file.'.inc.php', |
|
288 | + $name_variable, |
|
289 | + $english_name_variable, |
|
290 | + $parent_variable_value,$obj_text,$obj_button); |
|
291 | + } |
|
292 | + } |
|
293 | + } |
|
294 | + } |
|
295 | 295 | |
296 | - $list_info = array_unique_dimensional($list_info); |
|
297 | - return $list_info; |
|
296 | + $list_info = array_unique_dimensional($list_info); |
|
297 | + return $list_info; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // Allow see data in sort table |
301 | 301 | $list_info = array(); |
302 | 302 | if (isset($_REQUEST['txt_search_word'])) { |
303 | - //@todo fix to accept a char with 1 char |
|
304 | - if (strlen(trim($_REQUEST['txt_search_word']))>2) { |
|
305 | - $list_info = search_language_term( |
|
306 | - $_REQUEST['txt_search_word'], |
|
307 | - true, |
|
308 | - true, |
|
309 | - true, |
|
310 | - true |
|
311 | - ); |
|
312 | - } |
|
303 | + //@todo fix to accept a char with 1 char |
|
304 | + if (strlen(trim($_REQUEST['txt_search_word']))>2) { |
|
305 | + $list_info = search_language_term( |
|
306 | + $_REQUEST['txt_search_word'], |
|
307 | + true, |
|
308 | + true, |
|
309 | + true, |
|
310 | + true |
|
311 | + ); |
|
312 | + } |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | $parameters = array( |
316 | - 'id' => intval($_GET['id']), |
|
317 | - 'sub_language_id' => intval($_GET['sub_language_id']), |
|
318 | - 'txt_search_word' => $txt_search_word |
|
316 | + 'id' => intval($_GET['id']), |
|
317 | + 'sub_language_id' => intval($_GET['sub_language_id']), |
|
318 | + 'txt_search_word' => $txt_search_word |
|
319 | 319 | ); |
320 | 320 | $table = new SortableTableFromArrayConfig($list_info, 1,20,'data_info'); |
321 | 321 | $table->set_additional_parameters($parameters); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $sessionId = api_get_session_id(); |
66 | 66 | |
67 | 67 | if (api_is_in_group()) { |
68 | - $group_properties = GroupManager::get_group_properties($group_id); |
|
68 | + $group_properties = GroupManager::get_group_properties($group_id); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $dir = '/'; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $_GET['id'], |
78 | 78 | api_get_course_id(), |
79 | 79 | true, |
80 | - 0 |
|
80 | + 0 |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | if (!empty($sessionId) && empty($document_data)) { |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | ); |
90 | 90 | } |
91 | 91 | |
92 | - $document_id = $document_data['id']; |
|
93 | - $file = $document_data['path']; |
|
94 | - $parent_id = DocumentManager::get_document_id($course_info, dirname($file)); |
|
95 | - $dir = dirname($document_data['path']); |
|
96 | - $dir_original = $dir; |
|
97 | - $doc = basename($file); |
|
98 | - $readonly = $document_data['readonly']; |
|
92 | + $document_id = $document_data['id']; |
|
93 | + $file = $document_data['path']; |
|
94 | + $parent_id = DocumentManager::get_document_id($course_info, dirname($file)); |
|
95 | + $dir = dirname($document_data['path']); |
|
96 | + $dir_original = $dir; |
|
97 | + $doc = basename($file); |
|
98 | + $readonly = $document_data['readonly']; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | if (empty($document_data)) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | // Level correction for group documents. |
119 | 119 | if (!empty($group_properties['directory'])) { |
120 | - $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; |
|
120 | + $count_dir = $count_dir > 0 ? $count_dir - 1 : 0; |
|
121 | 121 | } |
122 | 122 | $relative_url = ''; |
123 | 123 | for ($i = 0; $i < ($count_dir); $i++) { |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | ); |
140 | 140 | |
141 | 141 | if ($is_certificate_mode) { |
142 | - $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
143 | - $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
144 | - $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
142 | + $editorConfig['CreateDocumentDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
143 | + $editorConfig['CreateDocumentWebDir'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'; |
|
144 | + $editorConfig['BaseHref'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | $is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights']|| |
148 | - DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId); |
|
148 | + DocumentManager::is_my_shared_folder(api_get_user_id(), $dir, $sessionId); |
|
149 | 149 | $noPHP_SELF = true; |
150 | 150 | |
151 | 151 | /* Other initialization code */ |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | 'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), |
159 | 159 | 'name' => get_lang('GroupSpace'), |
160 | 160 | ); |
161 | - $group_document = true; |
|
162 | - $noPHP_SELF = true; |
|
161 | + $group_document = true; |
|
162 | + $noPHP_SELF = true; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | if (!$is_certificate_mode) { |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | |
194 | 194 | //TODO:check the below code and his funcionality |
195 | 195 | if (!api_is_allowed_to_edit()) { |
196 | - if (DocumentManager::check_readonly($course_info, $user_id, $file)) { |
|
197 | - api_not_allowed(); |
|
198 | - } |
|
196 | + if (DocumentManager::check_readonly($course_info, $user_id, $file)) { |
|
197 | + api_not_allowed(); |
|
198 | + } |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /* MAIN TOOL CODE */ |
@@ -203,18 +203,18 @@ discard block |
||
203 | 203 | /* Code to change the comment */ |
204 | 204 | |
205 | 205 | if (isset($_POST['comment'])) { |
206 | - // Fixing the path if it is wrong |
|
207 | - $comment = trim($_POST['comment']); |
|
208 | - $title = trim($_POST['title']); |
|
206 | + // Fixing the path if it is wrong |
|
207 | + $comment = trim($_POST['comment']); |
|
208 | + $title = trim($_POST['title']); |
|
209 | 209 | |
210 | 210 | // Just in case see BT#3525 |
211 | 211 | if (empty($title)) { |
212 | - $title = $document_data['title']; |
|
213 | - } |
|
212 | + $title = $document_data['title']; |
|
213 | + } |
|
214 | 214 | |
215 | - if (empty($title)) { |
|
216 | - $title = get_document_title($_POST['filename']); |
|
217 | - } |
|
215 | + if (empty($title)) { |
|
216 | + $title = get_document_title($_POST['filename']); |
|
217 | + } |
|
218 | 218 | |
219 | 219 | if (!empty($document_id)) { |
220 | 220 | $params = [ |
@@ -226,43 +226,43 @@ discard block |
||
226 | 226 | $params, |
227 | 227 | ['c_id = ? AND id = ?' => [$course_id, $document_id]] |
228 | 228 | ); |
229 | - Display::addFlash(Display::return_message(get_lang('fileModified'))); |
|
229 | + Display::addFlash(Display::return_message(get_lang('fileModified'))); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
233 | 233 | /* WYSIWYG HTML EDITOR - Program Logic */ |
234 | 234 | if ($is_allowed_to_edit) { |
235 | - if (isset($_POST['formSent']) && $_POST['formSent'] == 1) { |
|
235 | + if (isset($_POST['formSent']) && $_POST['formSent'] == 1) { |
|
236 | 236 | |
237 | - $filename = stripslashes($_POST['filename']); |
|
237 | + $filename = stripslashes($_POST['filename']); |
|
238 | 238 | $extension = $_POST['extension']; |
239 | - $content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null; |
|
240 | - $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY); |
|
239 | + $content = isset($_POST['content']) ? trim(str_replace(array("\r", "\n"), '', stripslashes($_POST['content']))) : null; |
|
240 | + $content = Security::remove_XSS($content, COURSEMANAGERLOWSECURITY); |
|
241 | 241 | |
242 | 242 | if ($dir == '/') { |
243 | 243 | $dir = ''; |
244 | 244 | } |
245 | 245 | |
246 | - $file = $dir.'/'.$filename.'.'.$extension; |
|
247 | - $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
248 | - $read_only_flag = empty($read_only_flag) ? 0 : 1; |
|
246 | + $file = $dir.'/'.$filename.'.'.$extension; |
|
247 | + $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
248 | + $read_only_flag = empty($read_only_flag) ? 0 : 1; |
|
249 | 249 | |
250 | - if (empty($filename)) { |
|
250 | + if (empty($filename)) { |
|
251 | 251 | Display::addFlash(Display::return_message(get_lang('NoFileName'), 'warning')); |
252 | - } else { |
|
252 | + } else { |
|
253 | 253 | |
254 | - $file_size = filesize($document_data['absolute_path']); |
|
254 | + $file_size = filesize($document_data['absolute_path']); |
|
255 | 255 | |
256 | - if ($read_only_flag == 0) { |
|
257 | - if (!empty($content)) { |
|
258 | - if ($fp = @fopen($document_data['absolute_path'], 'w')) { |
|
259 | - // For flv player, change absolute path temporarily to prevent from erasing it in the following lines |
|
260 | - $content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content); |
|
261 | - fputs($fp, $content); |
|
262 | - fclose($fp); |
|
256 | + if ($read_only_flag == 0) { |
|
257 | + if (!empty($content)) { |
|
258 | + if ($fp = @fopen($document_data['absolute_path'], 'w')) { |
|
259 | + // For flv player, change absolute path temporarily to prevent from erasing it in the following lines |
|
260 | + $content = str_replace(array('flv=h', 'flv=/'), array('flv=h|', 'flv=/|'), $content); |
|
261 | + fputs($fp, $content); |
|
262 | + fclose($fp); |
|
263 | 263 | |
264 | 264 | $filepath = $document_data['absolute_parent_path']; |
265 | - /* |
|
265 | + /* |
|
266 | 266 | if (!is_dir($filepath.'css')) { |
267 | 267 | mkdir($filepath.'css', api_get_permissions_for_new_directories()); |
268 | 268 | $doc_id = add_document($_course, $dir.'css', 'folder', 0, 'css'); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | ); |
293 | 293 | }*/ |
294 | 294 | |
295 | - /*if (!is_file($filepath.'css/frames.css')) { |
|
295 | + /*if (!is_file($filepath.'css/frames.css')) { |
|
296 | 296 | $platform_theme = api_get_setting('stylesheets'); |
297 | 297 | if (file_exists(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css')) { |
298 | 298 | copy(api_get_path(SYS_CODE_PATH).'css/'.$platform_theme.'/frames.css', $filepath.'css/frames.css'); |
@@ -330,54 +330,54 @@ discard block |
||
330 | 330 | } |
331 | 331 | }*/ |
332 | 332 | |
333 | - // "WHAT'S NEW" notification: update table item_property |
|
334 | - $document_id = DocumentManager::get_document_id($_course, $file); |
|
335 | - |
|
336 | - if ($document_id) { |
|
337 | - update_existing_document( |
|
338 | - $_course, |
|
339 | - $document_id, |
|
340 | - $file_size, |
|
341 | - $read_only_flag |
|
342 | - ); |
|
343 | - api_item_property_update( |
|
344 | - $_course, |
|
345 | - TOOL_DOCUMENT, |
|
346 | - $document_id, |
|
347 | - 'DocumentUpdated', |
|
348 | - api_get_user_id(), |
|
349 | - null, |
|
350 | - null, |
|
351 | - null, |
|
352 | - null, |
|
353 | - $sessionId |
|
354 | - ); |
|
355 | - // Update parent folders |
|
356 | - item_property_update_on_folder( |
|
357 | - $_course, |
|
358 | - $dir, |
|
359 | - api_get_user_id() |
|
360 | - ); |
|
361 | - header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':'')); |
|
362 | - exit; |
|
363 | - } else { |
|
333 | + // "WHAT'S NEW" notification: update table item_property |
|
334 | + $document_id = DocumentManager::get_document_id($_course, $file); |
|
335 | + |
|
336 | + if ($document_id) { |
|
337 | + update_existing_document( |
|
338 | + $_course, |
|
339 | + $document_id, |
|
340 | + $file_size, |
|
341 | + $read_only_flag |
|
342 | + ); |
|
343 | + api_item_property_update( |
|
344 | + $_course, |
|
345 | + TOOL_DOCUMENT, |
|
346 | + $document_id, |
|
347 | + 'DocumentUpdated', |
|
348 | + api_get_user_id(), |
|
349 | + null, |
|
350 | + null, |
|
351 | + null, |
|
352 | + null, |
|
353 | + $sessionId |
|
354 | + ); |
|
355 | + // Update parent folders |
|
356 | + item_property_update_on_folder( |
|
357 | + $_course, |
|
358 | + $dir, |
|
359 | + api_get_user_id() |
|
360 | + ); |
|
361 | + header('Location: document.php?id=' . $document_data['parent_id'] . '&' . api_get_cidreq() . ($is_certificate_mode?'&curdirpath=/certificates&selectcat=1':'')); |
|
362 | + exit; |
|
363 | + } else { |
|
364 | 364 | Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning')); |
365 | - } |
|
366 | - } else { |
|
365 | + } |
|
366 | + } else { |
|
367 | 367 | Display::addFlash(Display::return_message(get_lang('Impossible'), 'warning')); |
368 | - } |
|
369 | - } else { |
|
370 | - if ($document_id) { |
|
368 | + } |
|
369 | + } else { |
|
370 | + if ($document_id) { |
|
371 | 371 | update_existing_document($_course, $document_id, $file_size, $read_only_flag); |
372 | - } |
|
373 | - } |
|
374 | - } else { |
|
372 | + } |
|
373 | + } |
|
374 | + } else { |
|
375 | 375 | if ($document_id) { |
376 | 376 | update_existing_document($_course, $document_id, $file_size, $read_only_flag); |
377 | 377 | } |
378 | - } |
|
379 | - } |
|
380 | - } |
|
378 | + } |
|
379 | + } |
|
380 | + } |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | // Replace relative paths by absolute web paths (e.g. './' => 'http://www.chamilo.org/courses/ABC/document/') |
@@ -431,35 +431,35 @@ discard block |
||
431 | 431 | api_get_group_id() |
432 | 432 | ) |
433 | 433 | ) { |
434 | - $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq(); |
|
434 | + $action = api_get_self().'?id='.$document_data['id'].'&'.api_get_cidreq(); |
|
435 | 435 | if ($is_certificate_mode) { |
436 | 436 | $action .= '&curdirpath=/certificates&selectcat=1'; |
437 | 437 | } |
438 | - $form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical')); |
|
439 | - |
|
440 | - // Form title |
|
441 | - $form->addElement('header', $nameTools); |
|
442 | - $form->addElement('hidden', 'filename'); |
|
443 | - $form->addElement('hidden', 'extension'); |
|
444 | - $form->addElement('hidden', 'file_path'); |
|
445 | - $form->addElement('hidden', 'commentPath'); |
|
446 | - $form->addElement('hidden', 'showedit'); |
|
447 | - $form->addElement('hidden', 'origin'); |
|
448 | - $form->addElement('hidden', 'origin_opt'); |
|
438 | + $form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-vertical')); |
|
439 | + |
|
440 | + // Form title |
|
441 | + $form->addElement('header', $nameTools); |
|
442 | + $form->addElement('hidden', 'filename'); |
|
443 | + $form->addElement('hidden', 'extension'); |
|
444 | + $form->addElement('hidden', 'file_path'); |
|
445 | + $form->addElement('hidden', 'commentPath'); |
|
446 | + $form->addElement('hidden', 'showedit'); |
|
447 | + $form->addElement('hidden', 'origin'); |
|
448 | + $form->addElement('hidden', 'origin_opt'); |
|
449 | 449 | $form->addText('title', get_lang('Title'), true, array('cols-size' => [2, 10, 0], 'autofocus')); |
450 | 450 | |
451 | - $defaults['title'] = $document_data['title']; |
|
451 | + $defaults['title'] = $document_data['title']; |
|
452 | 452 | |
453 | - $form->addElement('hidden', 'formSent'); |
|
454 | - $defaults['formSent'] = 1; |
|
453 | + $form->addElement('hidden', 'formSent'); |
|
454 | + $defaults['formSent'] = 1; |
|
455 | 455 | |
456 | - $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
456 | + $read_only_flag = isset($_POST['readonly']) ? $_POST['readonly'] : null; |
|
457 | 457 | |
458 | - // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor. |
|
459 | - // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573 |
|
460 | - $defaults['content'] = str_replace('<!--[', '<!-- [', $content); |
|
458 | + // Desactivation of IE proprietary commenting tags inside the text before loading it on the online editor. |
|
459 | + // This fix has been proposed by Hubert Borderiou, see Bug #573, http://support.chamilo.org/issues/573 |
|
460 | + $defaults['content'] = str_replace('<!--[', '<!-- [', $content); |
|
461 | 461 | |
462 | - // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved. |
|
462 | + // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved. |
|
463 | 463 | |
464 | 464 | $showSystemFolders = api_get_course_setting('show_system_folders'); |
465 | 465 | $condition = stripos($dir, '/HotPotatoes_files') === false; |
@@ -467,44 +467,44 @@ discard block |
||
467 | 467 | $condition = true; |
468 | 468 | } |
469 | 469 | |
470 | - if (($extension == 'htm' || $extension == 'html') && $condition) { |
|
471 | - if (empty($readonly) && $readonly == 0) { |
|
470 | + if (($extension == 'htm' || $extension == 'html') && $condition) { |
|
471 | + if (empty($readonly) && $readonly == 0) { |
|
472 | 472 | $form->addHtmlEditor('content', '', true, true, $editorConfig); |
473 | - } |
|
474 | - } |
|
473 | + } |
|
474 | + } |
|
475 | 475 | |
476 | - if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) { |
|
477 | - // Updated on field |
|
476 | + if (!$group_document && !DocumentManager::is_my_shared_folder(api_get_user_id(), $currentDirPath, $sessionId)) { |
|
477 | + // Updated on field |
|
478 | 478 | $display_date = date_to_str_ago($last_edit_date). |
479 | - ' <span class="dropbox_date">'.api_format_date(api_get_local_time($last_edit_date)).'</span>'; |
|
480 | - $form->addElement('static', null, get_lang('UpdatedOn'), $display_date); |
|
481 | - } |
|
479 | + ' <span class="dropbox_date">'.api_format_date(api_get_local_time($last_edit_date)).'</span>'; |
|
480 | + $form->addElement('static', null, get_lang('UpdatedOn'), $display_date); |
|
481 | + } |
|
482 | 482 | |
483 | - $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]); |
|
483 | + $form->addElement('textarea', 'comment', get_lang('Comment'), ['cols-size' => [2, 10, 0]]); |
|
484 | 484 | |
485 | - if ($owner_id == api_get_user_id() || api_is_platform_admin()) { |
|
486 | - $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly')); |
|
487 | - if ($readonly == 1) { |
|
488 | - $checked->setChecked(true); |
|
489 | - } |
|
490 | - } |
|
485 | + if ($owner_id == api_get_user_id() || api_is_platform_admin()) { |
|
486 | + $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly')); |
|
487 | + if ($readonly == 1) { |
|
488 | + $checked->setChecked(true); |
|
489 | + } |
|
490 | + } |
|
491 | 491 | |
492 | - if ($is_certificate_mode) { |
|
493 | - $form->addButtonUpdate(get_lang('SaveCertificate')); |
|
492 | + if ($is_certificate_mode) { |
|
493 | + $form->addButtonUpdate(get_lang('SaveCertificate')); |
|
494 | 494 | } else { |
495 | - $form->addButtonUpdate(get_lang('SaveDocument')); |
|
495 | + $form->addButtonUpdate(get_lang('SaveDocument')); |
|
496 | 496 | } |
497 | 497 | |
498 | - $defaults['filename'] = $filename; |
|
499 | - $defaults['extension'] = $extension; |
|
500 | - $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null; |
|
501 | - $defaults['commentPath'] = $file; |
|
502 | - $defaults['renameTo'] = $file_name; |
|
503 | - $defaults['comment'] = $document_data['comment']; |
|
504 | - $defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null; |
|
505 | - $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null; |
|
498 | + $defaults['filename'] = $filename; |
|
499 | + $defaults['extension'] = $extension; |
|
500 | + $defaults['file_path'] = isset($_GET['file']) ? Security::remove_XSS($_GET['file']) : null; |
|
501 | + $defaults['commentPath'] = $file; |
|
502 | + $defaults['renameTo'] = $file_name; |
|
503 | + $defaults['comment'] = $document_data['comment']; |
|
504 | + $defaults['origin'] = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null; |
|
505 | + $defaults['origin_opt'] = isset($_GET['origin_opt']) ? Security::remove_XSS($_GET['origin_opt']) : null; |
|
506 | 506 | |
507 | - $form->setDefaults($defaults); |
|
507 | + $form->setDefaults($defaults); |
|
508 | 508 | |
509 | 509 | show_return( |
510 | 510 | $parent_id, |
@@ -514,25 +514,25 @@ discard block |
||
514 | 514 | $is_certificate_mode |
515 | 515 | ); |
516 | 516 | |
517 | - if ($is_certificate_mode) { |
|
518 | - $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate( |
|
519 | - api_get_user_id(), |
|
520 | - api_get_course_id() |
|
521 | - ); |
|
522 | - $str_info = ''; |
|
523 | - foreach ($all_information_by_create_certificate[0] as $info_value) { |
|
524 | - $str_info .= $info_value.'<br/>'; |
|
525 | - } |
|
526 | - $create_certificate=get_lang('CreateCertificateWithTags'); |
|
527 | - Display::display_normal_message( |
|
528 | - $create_certificate.': <br /><br />'.$str_info, |
|
529 | - false |
|
530 | - ); |
|
531 | - } |
|
532 | - |
|
533 | - if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){ |
|
534 | - Display::display_warning_message(get_lang('BrowserDontSupportsSVG')); |
|
535 | - } |
|
517 | + if ($is_certificate_mode) { |
|
518 | + $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate( |
|
519 | + api_get_user_id(), |
|
520 | + api_get_course_id() |
|
521 | + ); |
|
522 | + $str_info = ''; |
|
523 | + foreach ($all_information_by_create_certificate[0] as $info_value) { |
|
524 | + $str_info .= $info_value.'<br/>'; |
|
525 | + } |
|
526 | + $create_certificate=get_lang('CreateCertificateWithTags'); |
|
527 | + Display::display_normal_message( |
|
528 | + $create_certificate.': <br /><br />'.$str_info, |
|
529 | + false |
|
530 | + ); |
|
531 | + } |
|
532 | + |
|
533 | + if ($extension=='svg' && !api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true'){ |
|
534 | + Display::display_warning_message(get_lang('BrowserDontSupportsSVG')); |
|
535 | + } |
|
536 | 536 | echo '<div class="row" style="overflow:hidden"> |
537 | 537 | <div id="template_col" class="col-md-2"> |
538 | 538 | <div class="panel panel-default"> |
@@ -560,58 +560,58 @@ discard block |
||
560 | 560 | */ |
561 | 561 | function change_name($base_work_dir, $source_file, $rename_to, $dir, $doc) |
562 | 562 | { |
563 | - $file_name_for_change = $base_work_dir.$dir.$source_file; |
|
563 | + $file_name_for_change = $base_work_dir.$dir.$source_file; |
|
564 | 564 | $rename_to = disable_dangerous_file($rename_to); // Avoid renaming to .htaccess file |
565 | - $rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API |
|
566 | - |
|
567 | - if ($rename_to) { |
|
568 | - if (isset($dir) && $dir != '') { |
|
569 | - $source_file = $dir.$source_file; |
|
570 | - $new_full_file_name = dirname($source_file).'/'.$rename_to; |
|
571 | - } else { |
|
572 | - $source_file = '/'.$source_file; |
|
573 | - $new_full_file_name = '/'.$rename_to; |
|
574 | - } |
|
575 | - |
|
576 | - update_db_info('update', $source_file, $new_full_file_name); // fileManage API |
|
565 | + $rename_to = my_rename($file_name_for_change, stripslashes($rename_to)); // fileManage API |
|
566 | + |
|
567 | + if ($rename_to) { |
|
568 | + if (isset($dir) && $dir != '') { |
|
569 | + $source_file = $dir.$source_file; |
|
570 | + $new_full_file_name = dirname($source_file).'/'.$rename_to; |
|
571 | + } else { |
|
572 | + $source_file = '/'.$source_file; |
|
573 | + $new_full_file_name = '/'.$rename_to; |
|
574 | + } |
|
575 | + |
|
576 | + update_db_info('update', $source_file, $new_full_file_name); // fileManage API |
|
577 | 577 | Display::addFlash(Display::return_message(get_lang('fileModified'))); |
578 | 578 | |
579 | - return true; |
|
580 | - } else { |
|
579 | + return true; |
|
580 | + } else { |
|
581 | 581 | Display::addFlash(Display::return_message(get_lang('FileExists'))); |
582 | - } |
|
582 | + } |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | //return button back to |
586 | 586 | function show_return($document_id, $path, $call_from_tool='', $slide_id=0, $is_certificate_mode=false) |
587 | 587 | { |
588 | 588 | global $parent_id; |
589 | - echo '<div class="actions">'; |
|
589 | + echo '<div class="actions">'; |
|
590 | 590 | |
591 | 591 | $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq().'&id='.$parent_id; |
592 | 592 | |
593 | - if ($is_certificate_mode) { |
|
594 | - $selectedCategory = (isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : ''); |
|
595 | - echo '<a href="document.php?curdirpath='. $selectedCategory .'&selectcat=' . $selectedCategory .'">'. |
|
593 | + if ($is_certificate_mode) { |
|
594 | + $selectedCategory = (isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : ''); |
|
595 | + echo '<a href="document.php?curdirpath='. $selectedCategory .'&selectcat=' . $selectedCategory .'">'. |
|
596 | 596 | Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
597 | - } elseif($call_from_tool=='slideshow') { |
|
598 | - echo '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'. |
|
597 | + } elseif($call_from_tool=='slideshow') { |
|
598 | + echo '<a href="'.api_get_path(WEB_PATH).'main/document/slideshow.php?slide_id='.$slide_id.'&curdirpath='.Security::remove_XSS(urlencode($_GET['curdirpath'])).'">'. |
|
599 | 599 | Display::return_icon('slideshow.png', get_lang('BackTo').' '.get_lang('ViewSlideshow'),'',ICON_SIZE_MEDIUM).'</a>'; |
600 | - } elseif($call_from_tool=='editdraw') { |
|
601 | - echo '<a href="'.$url.'">'. |
|
600 | + } elseif($call_from_tool=='editdraw') { |
|
601 | + echo '<a href="'.$url.'">'. |
|
602 | 602 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
603 | - echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>'; |
|
604 | - } elseif($call_from_tool=='editodf') { |
|
603 | + echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Draw'), array(), 32).'</a>'; |
|
604 | + } elseif($call_from_tool=='editodf') { |
|
605 | 605 | echo '<a href="'.$url.'">'. |
606 | 606 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
607 | 607 | echo '<a href="javascript:history.back(1)">'.Display::return_icon('draw.png', get_lang('BackTo').' '.get_lang('Write'), array(), 32).'</a>'; |
608 | 608 | } elseif($call_from_tool=='editpaint'){ |
609 | - echo '<a href="'.$url.'">'. |
|
609 | + echo '<a href="'.$url.'">'. |
|
610 | 610 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), array(), ICON_SIZE_MEDIUM).'</a>'; |
611 | - echo '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>'; |
|
612 | - } else { |
|
613 | - echo '<a href="'.$url.'">'. |
|
611 | + echo '<a href="javascript:history.back(1)">'.Display::return_icon('paint.png', get_lang('BackTo').' '.get_lang('Paint'), array(), 32).'</a>'; |
|
612 | + } else { |
|
613 | + echo '<a href="'.$url.'">'. |
|
614 | 614 | Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
615 | - } |
|
616 | - echo '</div>'; |
|
615 | + } |
|
616 | + echo '</div>'; |
|
617 | 617 | } |