@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | define('TABLE_TOUR_LOG', 'plugin_tour_log'); |
11 | 11 | |
12 | -require_once api_get_path(SYS_PATH) . 'main/inc/global.inc.php'; |
|
13 | -require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php'; |
|
14 | -require_once api_get_path(SYS_PLUGIN_PATH) . 'tour/src/tour_plugin.class.php'; |
|
12 | +require_once api_get_path(SYS_PATH).'main/inc/global.inc.php'; |
|
13 | +require_once api_get_path(LIBRARY_PATH).'plugin.class.php'; |
|
14 | +require_once api_get_path(SYS_PLUGIN_PATH).'tour/src/tour_plugin.class.php'; |
|
15 | 15 | // Edit the config/tour.json file to add more pages or more elements to the guide |
@@ -6,8 +6,8 @@ |
||
6 | 6 | * @package chamilo.plugin.tour |
7 | 7 | */ |
8 | 8 | require_once __DIR__.'/../../../main/inc/global.inc.php'; |
9 | -require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php'; |
|
10 | -require_once api_get_path(SYS_PLUGIN_PATH) . 'tour/src/tour_plugin.class.php'; |
|
9 | +require_once api_get_path(LIBRARY_PATH).'plugin.class.php'; |
|
10 | +require_once api_get_path(SYS_PLUGIN_PATH).'tour/src/tour_plugin.class.php'; |
|
11 | 11 | |
12 | 12 | if (!api_is_anonymous()) { |
13 | 13 | $currentPageClass = isset($_GET['page_class']) ? $_GET['page_class'] : ''; |
@@ -50,26 +50,26 @@ discard block |
||
50 | 50 | // Please, do not modify this dirname formatting |
51 | 51 | |
52 | 52 | if (strstr($dir, '..')) { |
53 | - $dir = '/'; |
|
53 | + $dir = '/'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if ($dir[0] == '.') { |
57 | - $dir = substr($dir, 1); |
|
57 | + $dir = substr($dir, 1); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if ($dir[0] != '/') { |
61 | - $dir = '/'.$dir; |
|
61 | + $dir = '/'.$dir; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | if ($dir[strlen($dir) - 1] != '/') { |
65 | - $dir .= '/'; |
|
65 | + $dir .= '/'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
69 | 69 | |
70 | 70 | if (!is_dir($filepath)) { |
71 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
72 | - $dir = '/'; |
|
71 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
72 | + $dir = '/'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $groupId = api_get_group_id(); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] || |
100 | - DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id())) |
|
100 | + DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id())) |
|
101 | 101 | ) { |
102 | 102 | api_not_allowed(true); |
103 | 103 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | // Interbreadcrumb for the current directory root path |
116 | 116 | if (empty($document_data['parents'])) { |
117 | - $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); |
|
117 | + $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); |
|
118 | 118 | } else { |
119 | 119 | foreach ($document_data['parents'] as $document_sub_data) { |
120 | 120 | $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); |
@@ -147,17 +147,17 @@ discard block |
||
147 | 147 | $locktitle="false"; |
148 | 148 | |
149 | 149 | if ($_SERVER['HTTP_HOST']=="localhost") { |
150 | - $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
151 | - if (!file_exists($path_and_file)) { |
|
152 | - $crossdomain='<?xml version="1.0"?> |
|
150 | + $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
151 | + if (!file_exists($path_and_file)) { |
|
152 | + $crossdomain='<?xml version="1.0"?> |
|
153 | 153 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
154 | 154 | <cross-domain-policy> |
155 | 155 | <allow-access-from domain="cdn.pixlr.com" /> |
156 | 156 | <site-control permitted-cross-domain-policies="master-only"/> |
157 | 157 | <allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/> |
158 | 158 | </cross-domain-policy>';//more open domain="*" |
159 | - @file_put_contents($path_and_file, $crossdomain); |
|
160 | - } |
|
159 | + @file_put_contents($path_and_file, $crossdomain); |
|
160 | + } |
|
161 | 161 | $credentials = "true"; |
162 | 162 | } else { |
163 | 163 | $credentials = "false"; |
@@ -129,27 +129,27 @@ |
||
129 | 129 | |
130 | 130 | // pixlr |
131 | 131 | // max size 1 Mb ?? |
132 | -$title = urlencode(utf8_encode(get_lang('NewImage')));//TODO:check |
|
132 | +$title = urlencode(utf8_encode(get_lang('NewImage'))); //TODO:check |
|
133 | 133 | // |
134 | 134 | $image = Display::returnIconPath('canvas1024x768.png'); |
135 | 135 | // |
136 | 136 | $pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
137 | -$langpixlr = api_get_language_isocode(); |
|
137 | +$langpixlr = api_get_language_isocode(); |
|
138 | 138 | $langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr; |
139 | -$loc=$langpixlr;// deprecated ?? TODO:check pixlr read user browser |
|
140 | - |
|
141 | -$exit_path=api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php'; |
|
142 | -$_SESSION['exit_pixlr']=$document_data['path']; |
|
143 | -$referrer="Chamilo"; |
|
144 | -$target_path=api_get_path(WEB_CODE_PATH).'document/save_pixlr.php'; |
|
145 | -$target=$target_path; |
|
146 | -$locktarget="true"; |
|
147 | -$locktitle="false"; |
|
148 | - |
|
149 | -if ($_SERVER['HTTP_HOST']=="localhost") { |
|
150 | - $path_and_file= api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
139 | +$loc = $langpixlr; // deprecated ?? TODO:check pixlr read user browser |
|
140 | + |
|
141 | +$exit_path = api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php'; |
|
142 | +$_SESSION['exit_pixlr'] = $document_data['path']; |
|
143 | +$referrer = "Chamilo"; |
|
144 | +$target_path = api_get_path(WEB_CODE_PATH).'document/save_pixlr.php'; |
|
145 | +$target = $target_path; |
|
146 | +$locktarget = "true"; |
|
147 | +$locktitle = "false"; |
|
148 | + |
|
149 | +if ($_SERVER['HTTP_HOST'] == "localhost") { |
|
150 | + $path_and_file = api_get_path(SYS_PATH).'/crossdomain.xml'; |
|
151 | 151 | if (!file_exists($path_and_file)) { |
152 | - $crossdomain='<?xml version="1.0"?> |
|
152 | + $crossdomain = '<?xml version="1.0"?> |
|
153 | 153 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
154 | 154 | <cross-domain-policy> |
155 | 155 | <allow-access-from domain="cdn.pixlr.com" /> |
@@ -10,166 +10,166 @@ |
||
10 | 10 | */ |
11 | 11 | class ResultTable extends SortableTable |
12 | 12 | { |
13 | - private $datagen; |
|
14 | - private $evaluation; |
|
15 | - private $allresults; |
|
16 | - private $iscourse; |
|
17 | - |
|
18 | - /** |
|
19 | - * Constructor |
|
20 | - */ |
|
13 | + private $datagen; |
|
14 | + private $evaluation; |
|
15 | + private $allresults; |
|
16 | + private $iscourse; |
|
17 | + |
|
18 | + /** |
|
19 | + * Constructor |
|
20 | + */ |
|
21 | 21 | public function __construct($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false) |
22 | - { |
|
23 | - parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1); |
|
24 | - |
|
25 | - $this->datagen = new ResultsDataGenerator($evaluation, $results, true); |
|
26 | - |
|
27 | - $this->evaluation = $evaluation; |
|
28 | - $this->iscourse = $iscourse; |
|
29 | - $this->forprint = $forprint; |
|
30 | - |
|
31 | - if (isset ($addparams)) { |
|
32 | - $this->set_additional_parameters($addparams); |
|
33 | - } |
|
34 | - $scoredisplay = ScoreDisplay :: instance(); |
|
35 | - $column= 0; |
|
36 | - if ($this->iscourse == '1') { |
|
37 | - $this->set_header($column++, '', false); |
|
38 | - $this->set_form_actions(array ( |
|
39 | - 'delete' => get_lang('Delete') |
|
40 | - )); |
|
41 | - } |
|
42 | - if (api_is_western_name_order()) { |
|
43 | - $this->set_header($column++, get_lang('FirstName')); |
|
44 | - $this->set_header($column++, get_lang('LastName')); |
|
45 | - } else { |
|
46 | - $this->set_header($column++, get_lang('LastName')); |
|
47 | - $this->set_header($column++, get_lang('FirstName')); |
|
48 | - } |
|
49 | - $this->set_header($column++, get_lang('Score')); |
|
50 | - if ($scoredisplay->is_custom()) { |
|
51 | - $this->set_header($column++, get_lang('Display')); |
|
52 | - } |
|
53 | - if (!$this->forprint) { |
|
54 | - $this->set_header($column++, get_lang('Modify'),false); |
|
55 | - } |
|
22 | + { |
|
23 | + parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1); |
|
24 | + |
|
25 | + $this->datagen = new ResultsDataGenerator($evaluation, $results, true); |
|
26 | + |
|
27 | + $this->evaluation = $evaluation; |
|
28 | + $this->iscourse = $iscourse; |
|
29 | + $this->forprint = $forprint; |
|
30 | + |
|
31 | + if (isset ($addparams)) { |
|
32 | + $this->set_additional_parameters($addparams); |
|
33 | + } |
|
34 | + $scoredisplay = ScoreDisplay :: instance(); |
|
35 | + $column= 0; |
|
36 | + if ($this->iscourse == '1') { |
|
37 | + $this->set_header($column++, '', false); |
|
38 | + $this->set_form_actions(array ( |
|
39 | + 'delete' => get_lang('Delete') |
|
40 | + )); |
|
41 | + } |
|
42 | + if (api_is_western_name_order()) { |
|
43 | + $this->set_header($column++, get_lang('FirstName')); |
|
44 | + $this->set_header($column++, get_lang('LastName')); |
|
45 | + } else { |
|
46 | + $this->set_header($column++, get_lang('LastName')); |
|
47 | + $this->set_header($column++, get_lang('FirstName')); |
|
48 | + } |
|
49 | + $this->set_header($column++, get_lang('Score')); |
|
50 | + if ($scoredisplay->is_custom()) { |
|
51 | + $this->set_header($column++, get_lang('Display')); |
|
52 | + } |
|
53 | + if (!$this->forprint) { |
|
54 | + $this->set_header($column++, get_lang('Modify'),false); |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Function used by SortableTable to get total number of items in the table |
|
61 | - */ |
|
62 | - public function get_total_number_of_items () |
|
59 | + /** |
|
60 | + * Function used by SortableTable to get total number of items in the table |
|
61 | + */ |
|
62 | + public function get_total_number_of_items () |
|
63 | 63 | { |
64 | - return $this->datagen->get_total_results_count(); |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Function used by SortableTable to generate the data to display |
|
69 | - */ |
|
70 | - public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) { |
|
71 | - |
|
72 | - $is_western_name_order = api_is_western_name_order(); |
|
73 | - $scoredisplay = ScoreDisplay :: instance(); |
|
74 | - |
|
75 | - // determine sorting type |
|
76 | - $col_adjust = $this->iscourse == '1' ? 1 : 0; |
|
77 | - |
|
78 | - switch ($this->column) { |
|
79 | - // first name or last name |
|
80 | - case (0 + $col_adjust): |
|
81 | - if ($is_western_name_order) { |
|
82 | - $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME; |
|
83 | - } else { |
|
84 | - $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME; |
|
85 | - } |
|
86 | - break; |
|
64 | + return $this->datagen->get_total_results_count(); |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Function used by SortableTable to generate the data to display |
|
69 | + */ |
|
70 | + public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) { |
|
71 | + |
|
72 | + $is_western_name_order = api_is_western_name_order(); |
|
73 | + $scoredisplay = ScoreDisplay :: instance(); |
|
74 | + |
|
75 | + // determine sorting type |
|
76 | + $col_adjust = $this->iscourse == '1' ? 1 : 0; |
|
77 | + |
|
78 | + switch ($this->column) { |
|
87 | 79 | // first name or last name |
88 | - case (1 + $col_adjust): |
|
89 | - if ($is_western_name_order) { |
|
90 | - $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME; |
|
91 | - } else { |
|
92 | - $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME; |
|
93 | - } |
|
94 | - break; |
|
80 | + case (0 + $col_adjust): |
|
81 | + if ($is_western_name_order) { |
|
82 | + $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME; |
|
83 | + } else { |
|
84 | + $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME; |
|
85 | + } |
|
86 | + break; |
|
87 | + // first name or last name |
|
88 | + case (1 + $col_adjust): |
|
89 | + if ($is_western_name_order) { |
|
90 | + $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME; |
|
91 | + } else { |
|
92 | + $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME; |
|
93 | + } |
|
94 | + break; |
|
95 | 95 | //Score |
96 | - case (2 + $col_adjust): |
|
97 | - $sorting = ResultsDataGenerator :: RDG_SORT_SCORE; |
|
98 | - break; |
|
99 | - case (3 + $col_adjust): |
|
100 | - $sorting = ResultsDataGenerator :: RDG_SORT_MASK; |
|
101 | - break; |
|
102 | - } |
|
103 | - |
|
104 | - if ($this->direction == 'DESC') { |
|
105 | - $sorting |= ResultsDataGenerator :: RDG_SORT_DESC; |
|
106 | - } else { |
|
107 | - $sorting |= ResultsDataGenerator :: RDG_SORT_ASC; |
|
108 | - } |
|
109 | - |
|
110 | - $data_array = $this->datagen->get_data($sorting, $from, $this->per_page); |
|
111 | - |
|
112 | - // generate the data to display |
|
113 | - $sortable_data = array(); |
|
114 | - foreach ($data_array as $item) { |
|
115 | - $row = array (); |
|
116 | - if ($this->iscourse == '1') { |
|
117 | - $row[] = $item['result_id']; |
|
118 | - } |
|
119 | - if ($is_western_name_order) { |
|
120 | - $row[] = $item['firstname']; |
|
121 | - $row[] = $item['lastname']; |
|
122 | - } else { |
|
123 | - $row[] = $item['lastname']; |
|
124 | - $row[] = $item['firstname']; |
|
125 | - } |
|
126 | - |
|
127 | - $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']); |
|
96 | + case (2 + $col_adjust): |
|
97 | + $sorting = ResultsDataGenerator :: RDG_SORT_SCORE; |
|
98 | + break; |
|
99 | + case (3 + $col_adjust): |
|
100 | + $sorting = ResultsDataGenerator :: RDG_SORT_MASK; |
|
101 | + break; |
|
102 | + } |
|
103 | + |
|
104 | + if ($this->direction == 'DESC') { |
|
105 | + $sorting |= ResultsDataGenerator :: RDG_SORT_DESC; |
|
106 | + } else { |
|
107 | + $sorting |= ResultsDataGenerator :: RDG_SORT_ASC; |
|
108 | + } |
|
109 | + |
|
110 | + $data_array = $this->datagen->get_data($sorting, $from, $this->per_page); |
|
111 | + |
|
112 | + // generate the data to display |
|
113 | + $sortable_data = array(); |
|
114 | + foreach ($data_array as $item) { |
|
115 | + $row = array (); |
|
116 | + if ($this->iscourse == '1') { |
|
117 | + $row[] = $item['result_id']; |
|
118 | + } |
|
119 | + if ($is_western_name_order) { |
|
120 | + $row[] = $item['firstname']; |
|
121 | + $row[] = $item['lastname']; |
|
122 | + } else { |
|
123 | + $row[] = $item['lastname']; |
|
124 | + $row[] = $item['firstname']; |
|
125 | + } |
|
126 | + |
|
127 | + $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']); |
|
128 | 128 | //$row[] = Display::bar_progress($item['percentage_score'], true); |
129 | - if ($scoredisplay->is_custom()) { |
|
130 | - $row[] = $item['display']; |
|
131 | - } |
|
132 | - if (!$this->forprint) { |
|
133 | - $row[] = $this->build_edit_column ($item); |
|
134 | - } |
|
135 | - $sortable_data[] = $row; |
|
136 | - } |
|
137 | - |
|
138 | - return $sortable_data; |
|
139 | - } |
|
140 | - |
|
141 | - private function build_edit_column ($item) |
|
142 | - { |
|
143 | - $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); |
|
144 | - $locked_status = $this->evaluation->get_locked(); |
|
145 | - if (api_is_allowed_to_edit(null, true) && $locked_status == 0) { |
|
146 | - //api_is_course_admin() |
|
147 | - $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
148 | - Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>'; |
|
149 | - $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
150 | - Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>'; |
|
151 | - } |
|
152 | - |
|
153 | - if ($this->evaluation->get_course_code() == null) { |
|
154 | - $edit_column .= ' <a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">'; |
|
155 | - $edit_column .= Display::return_icon('delete.png', get_lang('Delete')); |
|
156 | - $edit_column .= '</a>'; |
|
157 | - $edit_column .= ' <a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">'; |
|
158 | - $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics')); |
|
159 | - $edit_column .= '</a>'; |
|
160 | - } |
|
161 | - |
|
162 | - // Evaluation's origin is a link |
|
163 | - if ($this->evaluation->get_category_id() < 0) { |
|
164 | - $link = LinkFactory::get_evaluation_link($this->evaluation->get_id()); |
|
165 | - $doc_url = $link->get_view_url($item['id']); |
|
166 | - |
|
167 | - if ($doc_url != null) { |
|
168 | - $edit_column .= ' <a href="'. $doc_url . '" target="_blank">'; |
|
169 | - $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>'; |
|
170 | - } |
|
171 | - } |
|
172 | - |
|
173 | - return $edit_column; |
|
174 | - } |
|
129 | + if ($scoredisplay->is_custom()) { |
|
130 | + $row[] = $item['display']; |
|
131 | + } |
|
132 | + if (!$this->forprint) { |
|
133 | + $row[] = $this->build_edit_column ($item); |
|
134 | + } |
|
135 | + $sortable_data[] = $row; |
|
136 | + } |
|
137 | + |
|
138 | + return $sortable_data; |
|
139 | + } |
|
140 | + |
|
141 | + private function build_edit_column ($item) |
|
142 | + { |
|
143 | + $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); |
|
144 | + $locked_status = $this->evaluation->get_locked(); |
|
145 | + if (api_is_allowed_to_edit(null, true) && $locked_status == 0) { |
|
146 | + //api_is_course_admin() |
|
147 | + $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
148 | + Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>'; |
|
149 | + $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
150 | + Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>'; |
|
151 | + } |
|
152 | + |
|
153 | + if ($this->evaluation->get_course_code() == null) { |
|
154 | + $edit_column .= ' <a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">'; |
|
155 | + $edit_column .= Display::return_icon('delete.png', get_lang('Delete')); |
|
156 | + $edit_column .= '</a>'; |
|
157 | + $edit_column .= ' <a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">'; |
|
158 | + $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics')); |
|
159 | + $edit_column .= '</a>'; |
|
160 | + } |
|
161 | + |
|
162 | + // Evaluation's origin is a link |
|
163 | + if ($this->evaluation->get_category_id() < 0) { |
|
164 | + $link = LinkFactory::get_evaluation_link($this->evaluation->get_id()); |
|
165 | + $doc_url = $link->get_view_url($item['id']); |
|
166 | + |
|
167 | + if ($doc_url != null) { |
|
168 | + $edit_column .= ' <a href="'. $doc_url . '" target="_blank">'; |
|
169 | + $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>'; |
|
170 | + } |
|
171 | + } |
|
172 | + |
|
173 | + return $edit_column; |
|
174 | + } |
|
175 | 175 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Constructor |
20 | 20 | */ |
21 | - public function __construct($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false) |
|
21 | + public function __construct($evaluation, $results = array(), $iscourse, $addparams = null, $forprint = false) |
|
22 | 22 | { |
23 | 23 | parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1); |
24 | 24 | |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | $this->iscourse = $iscourse; |
29 | 29 | $this->forprint = $forprint; |
30 | 30 | |
31 | - if (isset ($addparams)) { |
|
31 | + if (isset ($addparams)) { |
|
32 | 32 | $this->set_additional_parameters($addparams); |
33 | 33 | } |
34 | 34 | $scoredisplay = ScoreDisplay :: instance(); |
35 | - $column= 0; |
|
35 | + $column = 0; |
|
36 | 36 | if ($this->iscourse == '1') { |
37 | 37 | $this->set_header($column++, '', false); |
38 | - $this->set_form_actions(array ( |
|
38 | + $this->set_form_actions(array( |
|
39 | 39 | 'delete' => get_lang('Delete') |
40 | 40 | )); |
41 | 41 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->set_header($column++, get_lang('Display')); |
52 | 52 | } |
53 | 53 | if (!$this->forprint) { |
54 | - $this->set_header($column++, get_lang('Modify'),false); |
|
54 | + $this->set_header($column++, get_lang('Modify'), false); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * Function used by SortableTable to get total number of items in the table |
61 | 61 | */ |
62 | - public function get_total_number_of_items () |
|
62 | + public function get_total_number_of_items() |
|
63 | 63 | { |
64 | 64 | return $this->datagen->get_total_results_count(); |
65 | 65 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | // generate the data to display |
113 | 113 | $sortable_data = array(); |
114 | 114 | foreach ($data_array as $item) { |
115 | - $row = array (); |
|
115 | + $row = array(); |
|
116 | 116 | if ($this->iscourse == '1') { |
117 | 117 | $row[] = $item['result_id']; |
118 | 118 | } |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | $row[] = $item['firstname']; |
125 | 125 | } |
126 | 126 | |
127 | - $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']); |
|
127 | + $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']); |
|
128 | 128 | //$row[] = Display::bar_progress($item['percentage_score'], true); |
129 | 129 | if ($scoredisplay->is_custom()) { |
130 | 130 | $row[] = $item['display']; |
131 | 131 | } |
132 | 132 | if (!$this->forprint) { |
133 | - $row[] = $this->build_edit_column ($item); |
|
133 | + $row[] = $this->build_edit_column($item); |
|
134 | 134 | } |
135 | 135 | $sortable_data[] = $row; |
136 | 136 | } |
@@ -138,23 +138,23 @@ discard block |
||
138 | 138 | return $sortable_data; |
139 | 139 | } |
140 | 140 | |
141 | - private function build_edit_column ($item) |
|
141 | + private function build_edit_column($item) |
|
142 | 142 | { |
143 | 143 | $status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); |
144 | 144 | $locked_status = $this->evaluation->get_locked(); |
145 | 145 | if (api_is_allowed_to_edit(null, true) && $locked_status == 0) { |
146 | 146 | //api_is_course_admin() |
147 | - $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
148 | - Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>'; |
|
149 | - $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
150 | - Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>'; |
|
147 | + $edit_column = '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
148 | + Display::return_icon('edit.png', get_lang('Modify'), '', '22').'</a>'; |
|
149 | + $edit_column .= ' <a href="'.api_get_self().'?delete_mark='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'. |
|
150 | + Display::return_icon('delete.png', get_lang('Delete'), '', '22').'</a>'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | if ($this->evaluation->get_course_code() == null) { |
154 | - $edit_column .= ' <a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">'; |
|
154 | + $edit_column .= ' <a href="'.api_get_self().'?resultdelete='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'" onclick="return confirmationuser();">'; |
|
155 | 155 | $edit_column .= Display::return_icon('delete.png', get_lang('Delete')); |
156 | 156 | $edit_column .= '</a>'; |
157 | - $edit_column .= ' <a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">'; |
|
157 | + $edit_column .= ' <a href="user_stats.php?userid='.$item['id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'; |
|
158 | 158 | $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics')); |
159 | 159 | $edit_column .= '</a>'; |
160 | 160 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $doc_url = $link->get_view_url($item['id']); |
166 | 166 | |
167 | 167 | if ($doc_url != null) { |
168 | - $edit_column .= ' <a href="'. $doc_url . '" target="_blank">'; |
|
168 | + $edit_column .= ' <a href="'.$doc_url.'" target="_blank">'; |
|
169 | 169 | $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>'; |
170 | 170 | } |
171 | 171 | } |
@@ -625,7 +625,6 @@ discard block |
||
625 | 625 | * The other configuration parameters have not been changed. |
626 | 626 | * |
627 | 627 | * This is how we can get most used paths, for common purpose: |
628 | - |
|
629 | 628 | * api_get_path(REL_PATH) /chamilo/ |
630 | 629 | * api_get_path(REL_COURSE_PATH) /chamilo/courses/ |
631 | 630 | * api_get_path(REL_CODE_PATH) /chamilo/main/ |
@@ -1803,7 +1802,6 @@ discard block |
||
1803 | 1802 | |
1804 | 1803 | /** |
1805 | 1804 | * Returns the current course info array. |
1806 | - |
|
1807 | 1805 | * Now if the course_code is given, the returned array gives info about that |
1808 | 1806 | * particular course, not specially the current one. |
1809 | 1807 | * @param int $id Numeric ID of the course |
@@ -2734,7 +2732,7 @@ discard block |
||
2734 | 2732 | switch ($session_user_status) { |
2735 | 2733 | case 0: |
2736 | 2734 | $session_status['status'] = 'student'; |
2737 | - break; |
|
2735 | + break; |
|
2738 | 2736 | case 2: |
2739 | 2737 | $session_status['status'] = 'coach'; |
2740 | 2738 | break; |
@@ -6492,7 +6490,7 @@ discard block |
||
6492 | 6490 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6493 | 6491 | $libraries = array(); |
6494 | 6492 | if ($include_jqgrid) { |
6495 | - $libraries[]='jqgrid'; |
|
6493 | + $libraries[]='jqgrid'; |
|
6496 | 6494 | } |
6497 | 6495 | return api_get_jquery_libraries_js($libraries); |
6498 | 6496 | } |
@@ -1701,7 +1701,9 @@ discard block |
||
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | global $_course; |
1704 | - if ($_course == '-1') $_course = array(); |
|
1704 | + if ($_course == '-1') { |
|
1705 | + $_course = array(); |
|
1706 | + } |
|
1705 | 1707 | return $_course; |
1706 | 1708 | } |
1707 | 1709 | |
@@ -4154,18 +4156,21 @@ discard block |
||
4154 | 4156 | switch ($lang_type) { |
4155 | 4157 | case 'platform_lang': |
4156 | 4158 | $temp_lang = api_get_setting('platformLanguage'); |
4157 | - if (!empty($temp_lang)) |
|
4158 | - $return = $temp_lang; |
|
4159 | + if (!empty($temp_lang)) { |
|
4160 | + $return = $temp_lang; |
|
4161 | + } |
|
4159 | 4162 | break; |
4160 | 4163 | case 'user_profil_lang': |
4161 | 4164 | $_user = api_get_user_info(); |
4162 | 4165 | |
4163 | - if (isset($_user['language']) && !empty($_user['language'])) |
|
4164 | - $return = $_user['language']; |
|
4166 | + if (isset($_user['language']) && !empty($_user['language'])) { |
|
4167 | + $return = $_user['language']; |
|
4168 | + } |
|
4165 | 4169 | break; |
4166 | 4170 | case 'user_selected_lang': |
4167 | - if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) |
|
4168 | - $return = $_SESSION['user_language_choice']; |
|
4171 | + if (isset($_SESSION['user_language_choice']) && !empty($_SESSION['user_language_choice'])) { |
|
4172 | + $return = $_SESSION['user_language_choice']; |
|
4173 | + } |
|
4169 | 4174 | break; |
4170 | 4175 | case 'course_lang': |
4171 | 4176 | global $_course; |
@@ -5434,8 +5439,7 @@ discard block |
||
5434 | 5439 | $is_courseAdmin = false; |
5435 | 5440 | $is_courseCoach = true; |
5436 | 5441 | $is_sessionAdmin = false; |
5437 | - } |
|
5438 | - elseif ($row[0]['session_admin_id'] == $userid) { |
|
5442 | + } elseif ($row[0]['session_admin_id'] == $userid) { |
|
5439 | 5443 | $is_courseMember = false; |
5440 | 5444 | $is_courseTutor = false; |
5441 | 5445 | $is_courseAdmin = false; |
@@ -5778,8 +5782,7 @@ discard block |
||
5778 | 5782 | elseif (isset($_ENV['OS'])) { |
5779 | 5783 | // Sometimes $_ENV['OS'] may not be present (bugs?) |
5780 | 5784 | $os = $_ENV['OS']; |
5781 | - } |
|
5782 | - elseif (defined('PHP_OS')) { |
|
5785 | + } elseif (defined('PHP_OS')) { |
|
5783 | 5786 | // PHP_OS means on which OS PHP was compiled, this is why |
5784 | 5787 | // using PHP_OS is the last choice for detection. |
5785 | 5788 | $os = PHP_OS; |
@@ -5843,12 +5846,10 @@ discard block |
||
5843 | 5846 | if ($delta_width > $delta_height) { |
5844 | 5847 | $result['width'] = ceil($image_width * $resize_factor_height); |
5845 | 5848 | $result['height'] = ceil($image_height * $resize_factor_height); |
5846 | - } |
|
5847 | - elseif ($delta_width < $delta_height) { |
|
5849 | + } elseif ($delta_width < $delta_height) { |
|
5848 | 5850 | $result['width'] = ceil($image_width * $resize_factor_width); |
5849 | 5851 | $result['height'] = ceil($image_height * $resize_factor_width); |
5850 | - } |
|
5851 | - else { |
|
5852 | + } else { |
|
5852 | 5853 | $result['width'] = ceil($target_width); |
5853 | 5854 | $result['height'] = ceil($target_height); |
5854 | 5855 | } |
@@ -6629,7 +6630,9 @@ discard block |
||
6629 | 6630 | } |
6630 | 6631 | $ip = trim($ip1); |
6631 | 6632 | } |
6632 | - if (!empty($debug)) error_log('Real IP: '.$ip); |
|
6633 | + if (!empty($debug)) { |
|
6634 | + error_log('Real IP: '.$ip); |
|
6635 | + } |
|
6633 | 6636 | return $ip; |
6634 | 6637 | } |
6635 | 6638 |
@@ -1240,6 +1240,7 @@ discard block |
||
1240 | 1240 | * Gets the list of courses a specific user is subscribed to |
1241 | 1241 | * @param int User ID |
1242 | 1242 | * @param boolean $fetch_session Whether to get session courses or not - NOT YET IMPLEMENTED |
1243 | + * @param integer $userid |
|
1243 | 1244 | * @return array Array of courses in the form [0]=>('code'=>xxx,'db'=>xxx,'dir'=>xxx,'status'=>d) |
1244 | 1245 | */ |
1245 | 1246 | function api_get_user_courses($userid, $fetch_session = true) |
@@ -2949,7 +2950,7 @@ discard block |
||
2949 | 2950 | * on the session visibility |
2950 | 2951 | * @param bool $tutor Whether to check if the user has the tutor role |
2951 | 2952 | * @param bool $coach Whether to check if the user has the coach role |
2952 | -* @return boolean true: the user has the rights to edit, false: he does not |
|
2953 | +* @return boolean|null true: the user has the rights to edit, false: he does not |
|
2953 | 2954 | */ |
2954 | 2955 | function api_is_allowed_to_session_edit($tutor = false, $coach = false) |
2955 | 2956 | { |
@@ -6606,7 +6607,7 @@ discard block |
||
6606 | 6607 | /** |
6607 | 6608 | * Returns an array of global configuration settings which should be ignored |
6608 | 6609 | * when printing the configuration settings screens |
6609 | - * @return array Array of strings, each identifying one of the excluded settings |
|
6610 | + * @return string[] Array of strings, each identifying one of the excluded settings |
|
6610 | 6611 | */ |
6611 | 6612 | function api_get_locked_settings() { |
6612 | 6613 | return array( |
@@ -6647,6 +6648,7 @@ discard block |
||
6647 | 6648 | * false if he isn't. If the user ID is given and is an integer, then the same |
6648 | 6649 | * ID is simply returned |
6649 | 6650 | * @param integer User ID |
6651 | + * @param integer $user_id |
|
6650 | 6652 | * @return boolean Integer User ID is logged in, or false otherwise |
6651 | 6653 | */ |
6652 | 6654 | function api_user_is_login($user_id = null) { |
@@ -7091,6 +7093,7 @@ discard block |
||
7091 | 7093 | /** |
7092 | 7094 | * Gets memory limit in bytes |
7093 | 7095 | * @param string The memory size (128M, 1G, 1000K, etc) |
7096 | + * @param string $mem |
|
7094 | 7097 | * @return int |
7095 | 7098 | * @assert (null) === false |
7096 | 7099 | * @assert ('1t') === 1099511627776 |
@@ -8033,7 +8036,7 @@ discard block |
||
8033 | 8036 | /** |
8034 | 8037 | * Like strip_tags(), but leaves an additional space and removes only the given tags |
8035 | 8038 | * @param string $string |
8036 | - * @param array $tags Tags to be removed |
|
8039 | + * @param string[] $tags Tags to be removed |
|
8037 | 8040 | * @return string The original string without the given tags |
8038 | 8041 | */ |
8039 | 8042 | function stripGivenTags($string, $tags) { |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | define('PLATFORM_ADMIN', 11); |
39 | 39 | define('SESSION_COURSE_COACH', 12); |
40 | 40 | define('SESSION_GENERAL_COACH', 13); |
41 | -define('COURSE_STUDENT', 14); //student subscribed in a course |
|
42 | -define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
41 | +define('COURSE_STUDENT', 14); //student subscribed in a course |
|
42 | +define('SESSION_STUDENT', 15); //student subscribed in a session course |
|
43 | 43 | define('COURSE_TUTOR', 16); // student is tutor of a course (NOT in session) |
44 | 44 | define('STUDENT_BOSS', 17); // student is boss |
45 | 45 | define('INVITEE', 20); |
46 | 46 | |
47 | 47 | // Table of status |
48 | -$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
49 | -$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
50 | -$_status_list[DRH] = 'drh'; // 4 |
|
51 | -$_status_list[STUDENT] = 'user'; // 5 |
|
52 | -$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
53 | -$_status_list[INVITEE] = 'invited'; // 20 |
|
48 | +$_status_list[COURSEMANAGER] = 'teacher'; // 1 |
|
49 | +$_status_list[SESSIONADMIN] = 'session_admin'; // 3 |
|
50 | +$_status_list[DRH] = 'drh'; // 4 |
|
51 | +$_status_list[STUDENT] = 'user'; // 5 |
|
52 | +$_status_list[ANONYMOUS] = 'anonymous'; // 6 |
|
53 | +$_status_list[INVITEE] = 'invited'; // 20 |
|
54 | 54 | |
55 | 55 | // COURSE VISIBILITY CONSTANTS |
56 | 56 | /** only visible for course admin */ |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | define('IS_WINDOWS_OS', api_is_windows_os()); |
261 | 261 | |
262 | 262 | // Checks for installed optional php-extensions. |
263 | -define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
264 | -define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
265 | -define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
263 | +define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
264 | +define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
265 | +define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
266 | 266 | |
267 | 267 | // Patterns for processing paths. // Examples: |
268 | -define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
269 | -define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
270 | -define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
268 | +define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
269 | +define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
270 | +define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
271 | 271 | |
272 | 272 | // Constants for api_get_path() and api_get_path_type(), etc. - registered path types. |
273 | 273 | // basic (leaf elements) |
@@ -360,19 +360,19 @@ discard block |
||
360 | 360 | define('LINK_HOTPOTATOES', 9); |
361 | 361 | |
362 | 362 | // Score display types constants |
363 | -define('SCORE_DIV', 1); // X / Y |
|
364 | -define('SCORE_PERCENT', 2); // XX % |
|
365 | -define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
366 | -define('SCORE_AVERAGE', 4); // XX % |
|
367 | -define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
368 | -define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
369 | -define('SCORE_SIMPLE', 7); // X |
|
370 | -define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
371 | -define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
372 | -define('SCORE_CUSTOM', 10); // Good! |
|
373 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
374 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
375 | -define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
363 | +define('SCORE_DIV', 1); // X / Y |
|
364 | +define('SCORE_PERCENT', 2); // XX % |
|
365 | +define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
366 | +define('SCORE_AVERAGE', 4); // XX % |
|
367 | +define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
368 | +define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
369 | +define('SCORE_SIMPLE', 7); // X |
|
370 | +define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
371 | +define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
372 | +define('SCORE_CUSTOM', 10); // Good! |
|
373 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
374 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
375 | +define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
376 | 376 | |
377 | 377 | define('SCORE_BOTH', 1); |
378 | 378 | define('SCORE_ONLY_DEFAULT', 2); |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | define('TIMELINE_STATUS_INACTIVE', '2'); |
557 | 557 | |
558 | 558 | // Event email template class |
559 | -define ('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
560 | -define ('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
559 | +define('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
560 | +define('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
561 | 561 | |
562 | 562 | // Course home |
563 | 563 | define('SHORTCUTS_HORIZONTAL', 0); |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | define('FILE_OVERWRITE', 3); |
573 | 573 | define('UTF8_CONVERT', false); //false by default |
574 | 574 | |
575 | -define('DOCUMENT','file'); |
|
576 | -define('FOLDER','folder'); |
|
575 | +define('DOCUMENT', 'file'); |
|
576 | +define('FOLDER', 'folder'); |
|
577 | 577 | |
578 | 578 | define('RESOURCE_DOCUMENT', 'document'); |
579 | 579 | define('RESOURCE_GLOSSARY', 'glossary'); |
@@ -674,8 +674,8 @@ discard block |
||
674 | 674 | : 'localhost'))); |
675 | 675 | if (isset($_SERVER['SERVER_PORT']) && !strpos($server_name, ':') |
676 | 676 | && (($server_protocol == 'http' |
677 | - && $_SERVER['SERVER_PORT'] != 80 ) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443 ))) { |
|
678 | - $server_name .= ":" . $_SERVER['SERVER_PORT']; |
|
677 | + && $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443))) { |
|
678 | + $server_name .= ":".$_SERVER['SERVER_PORT']; |
|
679 | 679 | } |
680 | 680 | $root_web = $server_protocol.'://'.$server_name.$root_rel; |
681 | 681 | $root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/'; |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | $sys_course_code = |
860 | 860 | isset($_SESSION['_course']['sysCode']) // User is inside a course? |
861 | 861 | ? $_SESSION['_course']['sysCode'] // Yes, then use course's directory name. |
862 | - : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
862 | + : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
863 | 863 | $path = $matches[1].'courses/'.$sys_course_code.'/document/'.str_replace('//', '/', $matches[3].'/'.$matches[2]); |
864 | 864 | } |
865 | 865 | } |
@@ -885,15 +885,15 @@ discard block |
||
885 | 885 | { |
886 | 886 | global $_configuration; |
887 | 887 | $web_root = api_get_path(WEB_PATH); |
888 | - $ext = substr($web_path,strrpos($web_path,'.')); |
|
888 | + $ext = substr($web_path, strrpos($web_path, '.')); |
|
889 | 889 | if (isset($ext[2])) { // faster version of strlen to check if len>2 |
890 | 890 | // Check for CDN definitions |
891 | 891 | if (!empty($_configuration['cdn_enable']) && !empty($ext)) { |
892 | 892 | foreach ($_configuration['cdn'] as $host => $exts) { |
893 | - if (in_array($ext,$exts)) { |
|
893 | + if (in_array($ext, $exts)) { |
|
894 | 894 | //Use host as defined in $_configuration['cdn'], without |
895 | 895 | // trailing slash |
896 | - return str_replace($web_root,$host.'/',$web_path); |
|
896 | + return str_replace($web_root, $host.'/', $web_path); |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | } |
@@ -1335,10 +1335,10 @@ discard block |
||
1335 | 1335 | |
1336 | 1336 | if (isset($user['email'])) { |
1337 | 1337 | $result['mail'] = isset($user['email']) ? $user['email'] : null; |
1338 | - $result['email'] = isset($user['email'])? $user['email'] : null; |
|
1338 | + $result['email'] = isset($user['email']) ? $user['email'] : null; |
|
1339 | 1339 | } else { |
1340 | 1340 | $result['mail'] = isset($user['mail']) ? $user['mail'] : null; |
1341 | - $result['email'] = isset($user['mail'])? $user['mail'] : null; |
|
1341 | + $result['email'] = isset($user['mail']) ? $user['mail'] : null; |
|
1342 | 1342 | } |
1343 | 1343 | $user_id = intval($user['user_id']); |
1344 | 1344 | // Maintain the user_id index for backwards compatibility |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | foreach ($param_list1 as $key => $enreg) { |
1855 | 1855 | list ($param_list1_keys[$key], $param_list1_vals[$key]) = explode('=', $enreg); |
1856 | 1856 | } |
1857 | - $param_list1 = array ('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1857 | + $param_list1 = array('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1858 | 1858 | foreach ($param_list2 as $enreg) { |
1859 | 1859 | $enreg = explode('=', $enreg); |
1860 | 1860 | $key = array_search($enreg[0], $param_list1['keys']); |
@@ -1884,7 +1884,7 @@ discard block |
||
1884 | 1884 | $length = 2; |
1885 | 1885 | } |
1886 | 1886 | $password = ''; |
1887 | - for ($i = 0; $i < $length; $i ++) { |
|
1887 | + for ($i = 0; $i < $length; $i++) { |
|
1888 | 1888 | $password .= $characters[rand() % strlen($characters)]; |
1889 | 1889 | } |
1890 | 1890 | return $password; |
@@ -1911,10 +1911,10 @@ discard block |
||
1911 | 1911 | $digits = 0; |
1912 | 1912 | $consequent_characters = 0; |
1913 | 1913 | $previous_character_code = 0; |
1914 | - for ($i = 0; $i < $password_length; $i ++) { |
|
1914 | + for ($i = 0; $i < $password_length; $i++) { |
|
1915 | 1915 | $current_character_code = api_ord(api_substr($password, $i, 1)); |
1916 | 1916 | if ($i && abs($current_character_code - $previous_character_code) <= 1) { |
1917 | - $consequent_characters ++; |
|
1917 | + $consequent_characters++; |
|
1918 | 1918 | if ($consequent_characters == 3) { |
1919 | 1919 | return false; |
1920 | 1920 | } |
@@ -1922,9 +1922,9 @@ discard block |
||
1922 | 1922 | $consequent_characters = 1; |
1923 | 1923 | } |
1924 | 1924 | if ($current_character_code >= 97 && $current_character_code <= 122) { |
1925 | - $letters ++; |
|
1925 | + $letters++; |
|
1926 | 1926 | } elseif ($current_character_code >= 48 && $current_character_code <= 57) { |
1927 | - $digits ++; |
|
1927 | + $digits++; |
|
1928 | 1928 | } else { |
1929 | 1929 | return false; |
1930 | 1930 | } |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | if (empty($session_id)) { return null; } |
2030 | 2030 | } |
2031 | 2031 | $t = Database::get_main_table(TABLE_MAIN_SESSION); |
2032 | - $s = "SELECT name FROM $t WHERE id = ".(int)$session_id; |
|
2032 | + $s = "SELECT name FROM $t WHERE id = ".(int) $session_id; |
|
2033 | 2033 | $r = Database::query($s); |
2034 | 2034 | $c = Database::num_rows($r); |
2035 | 2035 | if ($c > 0) { |
@@ -2054,7 +2054,7 @@ discard block |
||
2054 | 2054 | $sql = "SELECT * FROM $tbl_session WHERE id = $session_id"; |
2055 | 2055 | $result = Database::query($sql); |
2056 | 2056 | |
2057 | - if (Database::num_rows($result)>0) { |
|
2057 | + if (Database::num_rows($result) > 0) { |
|
2058 | 2058 | $data = Database::fetch_array($result, 'ASSOC'); |
2059 | 2059 | } |
2060 | 2060 | } |
@@ -2214,9 +2214,9 @@ discard block |
||
2214 | 2214 | */ |
2215 | 2215 | function api_get_session_image($session_id, $status_id) |
2216 | 2216 | { |
2217 | - $session_id = (int)$session_id; |
|
2217 | + $session_id = (int) $session_id; |
|
2218 | 2218 | $session_img = ''; |
2219 | - if ((int)$status_id != 5) { //check whether is not a student |
|
2219 | + if ((int) $status_id != 5) { //check whether is not a student |
|
2220 | 2220 | if ($session_id > 0) { |
2221 | 2221 | $session_img = " ".Display::return_icon( |
2222 | 2222 | 'star.png', |
@@ -2281,7 +2281,7 @@ discard block |
||
2281 | 2281 | $filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt'; |
2282 | 2282 | if (file_exists($filename)) { |
2283 | 2283 | $value = file_get_contents($filename); |
2284 | - return $value ; |
|
2284 | + return $value; |
|
2285 | 2285 | } else { |
2286 | 2286 | return ''; |
2287 | 2287 | } |
@@ -2290,7 +2290,7 @@ discard block |
||
2290 | 2290 | $filename = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt'; |
2291 | 2291 | if (file_exists($filename)) { |
2292 | 2292 | $value = file_get_contents($filename); |
2293 | - return $value ; |
|
2293 | + return $value; |
|
2294 | 2294 | } else { |
2295 | 2295 | return ''; |
2296 | 2296 | } |
@@ -2484,7 +2484,7 @@ discard block |
||
2484 | 2484 | } |
2485 | 2485 | $group_id = api_get_group_id(); |
2486 | 2486 | $course_id = api_get_course_int_id(); |
2487 | - $course_code= api_get_course_id(); |
|
2487 | + $course_code = api_get_course_id(); |
|
2488 | 2488 | $session_id = api_get_session_id(); |
2489 | 2489 | |
2490 | 2490 | //Group (in course) |
@@ -2492,7 +2492,7 @@ discard block |
||
2492 | 2492 | $group_status = array(); |
2493 | 2493 | $is_subscribed = GroupManager::is_subscribed($user_id, $group_id); |
2494 | 2494 | if ($is_subscribed) { |
2495 | - $group_status = array('id'=> $group_id , 'status' => 'student'); |
|
2495 | + $group_status = array('id'=> $group_id, 'status' => 'student'); |
|
2496 | 2496 | $is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id); |
2497 | 2497 | if ($is_tutor) { |
2498 | 2498 | $group_status['status'] = 'tutor'; |
@@ -2526,7 +2526,7 @@ discard block |
||
2526 | 2526 | } |
2527 | 2527 | $status['session'] = $session_status; |
2528 | 2528 | |
2529 | - } elseif($course_id) { |
|
2529 | + } elseif ($course_id) { |
|
2530 | 2530 | //Course |
2531 | 2531 | $course_status = array(); |
2532 | 2532 | if ($course_id) { |
@@ -2534,7 +2534,7 @@ discard block |
||
2534 | 2534 | |
2535 | 2535 | if ($user_course_status) { |
2536 | 2536 | $course_status = array('id'=> $course_id); |
2537 | - switch($user_course_status) { |
|
2537 | + switch ($user_course_status) { |
|
2538 | 2538 | case 1: |
2539 | 2539 | $course_status['status'] = 'teacher'; |
2540 | 2540 | break; |
@@ -2564,7 +2564,7 @@ discard block |
||
2564 | 2564 | function api_is_course_session_coach($user_id, $courseId, $session_id) |
2565 | 2565 | { |
2566 | 2566 | $session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
2567 | - $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2567 | + $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2568 | 2568 | |
2569 | 2569 | $user_id = intval($user_id); |
2570 | 2570 | $session_id = intval($session_id); |
@@ -2638,7 +2638,7 @@ discard block |
||
2638 | 2638 | ORDER BY access_start_date, access_end_date, name"; |
2639 | 2639 | $result = Database::query($sql); |
2640 | 2640 | if (!empty($sessionIsCoach)) { |
2641 | - $sessionIsCoach = array_merge($sessionIsCoach , Database::store_result($result)); |
|
2641 | + $sessionIsCoach = array_merge($sessionIsCoach, Database::store_result($result)); |
|
2642 | 2642 | } else { |
2643 | 2643 | $sessionIsCoach = Database::store_result($result); |
2644 | 2644 | } |
@@ -2815,7 +2815,7 @@ discard block |
||
2815 | 2815 | return ''; |
2816 | 2816 | } |
2817 | 2817 | $sourceurl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')); |
2818 | - $sourceurl = str_replace('lp/lp_header.php', 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview']=='studentview' ? 'false' : 'true'), $sourceurl); |
|
2818 | + $sourceurl = str_replace('lp/lp_header.php', 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.intval($_GET['lp_id']).'&isStudentView='.($_SESSION['studentview'] == 'studentview' ? 'false' : 'true'), $sourceurl); |
|
2819 | 2819 | //showinframes doesn't handle student view anyway... |
2820 | 2820 | //return ''; |
2821 | 2821 | $is_framed = true; |
@@ -3225,7 +3225,7 @@ discard block |
||
3225 | 3225 | } |
3226 | 3226 | $content .= '<div class="well">'; |
3227 | 3227 | $content .= $form->returnForm(); |
3228 | - $content .='</div>'; |
|
3228 | + $content .= '</div>'; |
|
3229 | 3229 | if (api_is_cas_activated()) { |
3230 | 3230 | $content .= "</div>"; |
3231 | 3231 | } |
@@ -3277,7 +3277,7 @@ discard block |
||
3277 | 3277 | } |
3278 | 3278 | $msg .= '<div class="well">'; |
3279 | 3279 | $msg .= $form->return_form(); |
3280 | - $msg .='</div>'; |
|
3280 | + $msg .= '</div>'; |
|
3281 | 3281 | if ($casEnabled) { |
3282 | 3282 | $msg .= "</div>"; |
3283 | 3283 | } |
@@ -3314,7 +3314,7 @@ discard block |
||
3314 | 3314 | list ($last_post_date, $last_post_time) = explode(' ', $last_post_datetime); |
3315 | 3315 | list ($year, $month, $day) = explode('-', $last_post_date); |
3316 | 3316 | list ($hour, $min, $sec) = explode(':', $last_post_time); |
3317 | - return mktime((int)$hour, (int)$min, (int)$sec, (int)$month, (int)$day, (int)$year); |
|
3317 | + return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year); |
|
3318 | 3318 | } |
3319 | 3319 | |
3320 | 3320 | /** |
@@ -3794,7 +3794,7 @@ discard block |
||
3794 | 3794 | c_id = $course_id AND |
3795 | 3795 | tool = '$tool' |
3796 | 3796 | $session_condition "; |
3797 | - $rs = Database::query($sql); |
|
3797 | + $rs = Database::query($sql); |
|
3798 | 3798 | $list = array(); |
3799 | 3799 | if (Database::num_rows($rs) > 0) { |
3800 | 3800 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -3874,7 +3874,7 @@ discard block |
||
3874 | 3874 | tool = '$tool' AND |
3875 | 3875 | ref = $ref |
3876 | 3876 | $sessionCondition"; |
3877 | - $rs = Database::query($sql); |
|
3877 | + $rs = Database::query($sql); |
|
3878 | 3878 | $item_property_id = ''; |
3879 | 3879 | if (Database::num_rows($rs) > 0) { |
3880 | 3880 | $row = Database::fetch_array($rs); |
@@ -3935,7 +3935,7 @@ discard block |
||
3935 | 3935 | if ($result == false) { |
3936 | 3936 | $result = array(); |
3937 | 3937 | } else { |
3938 | - $result = Database::store_result($result,'ASSOC'); |
|
3938 | + $result = Database::store_result($result, 'ASSOC'); |
|
3939 | 3939 | } |
3940 | 3940 | |
3941 | 3941 | return $result; |
@@ -3987,7 +3987,7 @@ discard block |
||
3987 | 3987 | $rs = Database::query($sql); |
3988 | 3988 | $row = array(); |
3989 | 3989 | if (Database::num_rows($rs) > 0) { |
3990 | - $row = Database::fetch_array($rs,'ASSOC'); |
|
3990 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
3991 | 3991 | } |
3992 | 3992 | |
3993 | 3993 | return $row; |
@@ -4023,7 +4023,7 @@ discard block |
||
4023 | 4023 | $languages = $language_list['name']; |
4024 | 4024 | $folder = $language_list['folder']; |
4025 | 4025 | |
4026 | - $ret .= '<select name="' . $name . '" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4026 | + $ret .= '<select name="'.$name.'" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4027 | 4027 | foreach ($languages as $key => $value) { |
4028 | 4028 | if ($folder[$key] == $default) { |
4029 | 4029 | $selected = ' selected="selected"'; |
@@ -4076,8 +4076,8 @@ discard block |
||
4076 | 4076 | //--> |
4077 | 4077 | </script>'; |
4078 | 4078 | $html .= '<form id="lang_form" name="lang_form" method="post" action="'.api_get_self().'">'; |
4079 | - $html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>'; |
|
4080 | - $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4079 | + $html .= '<label style="display: none;" for="language_list">'.get_lang('Language').'</label>'; |
|
4080 | + $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4081 | 4081 | |
4082 | 4082 | foreach ($original_languages as $key => $value) { |
4083 | 4083 | if ($folder[$key] == $user_selected_language) { |
@@ -4085,13 +4085,13 @@ discard block |
||
4085 | 4085 | } else { |
4086 | 4086 | $option_end = '>'; |
4087 | 4087 | } |
4088 | - $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4088 | + $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4089 | 4089 | //echo substr($value, 0, 16); // Cut string to keep 800x600 aspect. |
4090 | - $html .= $value.'</option>'; |
|
4090 | + $html .= $value.'</option>'; |
|
4091 | 4091 | } |
4092 | - $html .= '</select>'; |
|
4093 | - $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4094 | - $html .= '</form>'; |
|
4092 | + $html .= '</select>'; |
|
4093 | + $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4094 | + $html .= '</form>'; |
|
4095 | 4095 | return $html; |
4096 | 4096 | } |
4097 | 4097 | |
@@ -4308,7 +4308,7 @@ discard block |
||
4308 | 4308 | * Note: Directory names (names of themes) in the file system should contain ASCII-characters only. |
4309 | 4309 | */ |
4310 | 4310 | function api_get_themes() { |
4311 | - $cssdir = api_get_path(SYS_CSS_PATH) . 'themes/'; |
|
4311 | + $cssdir = api_get_path(SYS_CSS_PATH).'themes/'; |
|
4312 | 4312 | $list_dir = array(); |
4313 | 4313 | $list_name = array(); |
4314 | 4314 | |
@@ -4485,7 +4485,7 @@ discard block |
||
4485 | 4485 | if (is_file($dirname) || is_link($dirname)) { |
4486 | 4486 | $res = unlink($dirname); |
4487 | 4487 | if ($res === false) { |
4488 | - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
4488 | + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'Error not recorded because track_errors is off in your php.ini'), 0); |
|
4489 | 4489 | } |
4490 | 4490 | return $res; |
4491 | 4491 | } |
@@ -4522,7 +4522,7 @@ discard block |
||
4522 | 4522 | if ($delete_only_content_in_folder == false) { |
4523 | 4523 | $res = rmdir($dirname); |
4524 | 4524 | if ($res === false) { |
4525 | - error_log(__FILE__.' line '.__LINE__.': '.((bool)ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
4525 | + error_log(__FILE__.' line '.__LINE__.': '.((bool) ini_get('track_errors') ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
4526 | 4526 | } |
4527 | 4527 | } |
4528 | 4528 | return $res; |
@@ -4607,7 +4607,7 @@ discard block |
||
4607 | 4607 | |
4608 | 4608 | $course_id = $course_info['real_id']; |
4609 | 4609 | |
4610 | - $folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname)); |
|
4610 | + $folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname)); |
|
4611 | 4611 | |
4612 | 4612 | $new_pathname = $base_path_document; |
4613 | 4613 | $path = ''; |
@@ -4625,7 +4625,7 @@ discard block |
||
4625 | 4625 | path = '$path' AND |
4626 | 4626 | filetype = 'folder' AND |
4627 | 4627 | session_id = '$session_id'"; |
4628 | - $rs1 = Database::query($sql); |
|
4628 | + $rs1 = Database::query($sql); |
|
4629 | 4629 | $num_rows = Database::num_rows($rs1); |
4630 | 4630 | |
4631 | 4631 | if ($num_rows == 0) { |
@@ -4785,7 +4785,7 @@ discard block |
||
4785 | 4785 | foreach (array('key', 'value1', 'value2', 'value3') as $var) { |
4786 | 4786 | $$var = isset($match[++$i]) ? $match[$i] : ''; |
4787 | 4787 | } |
4788 | - $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3; |
|
4788 | + $value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3; |
|
4789 | 4789 | |
4790 | 4790 | // Parse array syntax. |
4791 | 4791 | $keys = preg_split('/\]?\[/', rtrim($key, ']')); |
@@ -4825,7 +4825,7 @@ discard block |
||
4825 | 4825 | */ |
4826 | 4826 | function api_get_version() { |
4827 | 4827 | global $_configuration; |
4828 | - return (string)$_configuration['system_version']; |
|
4828 | + return (string) $_configuration['system_version']; |
|
4829 | 4829 | } |
4830 | 4830 | |
4831 | 4831 | /** |
@@ -4952,7 +4952,7 @@ discard block |
||
4952 | 4952 | $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
4953 | 4953 | $var = Database::escape_string($var); |
4954 | 4954 | $value = Database::escape_string($value); |
4955 | - $access_url = (int)$access_url; |
|
4955 | + $access_url = (int) $access_url; |
|
4956 | 4956 | if (empty($access_url)) { $access_url = 1; } |
4957 | 4957 | $select = "SELECT id FROM $t_settings WHERE variable = '$var' "; |
4958 | 4958 | if (!empty($subvar)) { |
@@ -4973,7 +4973,7 @@ discard block |
||
4973 | 4973 | // Found item for this access_url. |
4974 | 4974 | $row = Database::fetch_array($res); |
4975 | 4975 | $sql = "UPDATE $t_settings SET selected_value = '$value' |
4976 | - WHERE id = ".$row['id'] ; |
|
4976 | + WHERE id = ".$row['id']; |
|
4977 | 4977 | Database::query($sql); |
4978 | 4978 | } else { |
4979 | 4979 | // Item not found for this access_url, we have to check if it exist with access_url = 1 |
@@ -4993,11 +4993,11 @@ discard block |
||
4993 | 4993 | $row = Database::fetch_array($res); |
4994 | 4994 | $insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url) |
4995 | 4995 | VALUES |
4996 | - ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
4997 | - "'".$row['type']."','".$row['category']."'," . |
|
4998 | - "'$value','".$row['title']."'," . |
|
4999 | - "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5000 | - "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)"; |
|
4996 | + ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
4997 | + "'".$row['type']."','".$row['category']."',". |
|
4998 | + "'$value','".$row['title']."',". |
|
4999 | + "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5000 | + "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)"; |
|
5001 | 5001 | Database::query($insert); |
5002 | 5002 | } else { // Such a setting does not exist. |
5003 | 5003 | error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0); |
@@ -5017,16 +5017,16 @@ discard block |
||
5017 | 5017 | if ($row['access_url_changeable'] == 1) { |
5018 | 5018 | $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES |
5019 | 5019 | ('".$row['variable']."',". |
5020 | - (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
5021 | - "'".$row['type']."','".$row['category']."'," . |
|
5022 | - "'$value','".$row['title']."'," . |
|
5020 | + (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
5021 | + "'".$row['type']."','".$row['category']."',". |
|
5022 | + "'$value','".$row['title']."',". |
|
5023 | 5023 | "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",". |
5024 | - (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5024 | + (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5025 | 5025 | "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")"; |
5026 | 5026 | Database::query($insert); |
5027 | 5027 | } |
5028 | 5028 | } else { // Such a setting does not exist. |
5029 | - error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0); |
|
5029 | + error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ', 0); |
|
5030 | 5030 | } |
5031 | 5031 | } |
5032 | 5032 | } |
@@ -5054,10 +5054,10 @@ discard block |
||
5054 | 5054 | $value = Database::escape_string($value); |
5055 | 5055 | $sql = "UPDATE $t_s SET selected_value = '$value' |
5056 | 5056 | WHERE category = '$category' AND access_url = $access_url"; |
5057 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5057 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5058 | 5058 | $sql .= " AND ( "; |
5059 | 5059 | $i = 0; |
5060 | - foreach ($fieldtype as $type){ |
|
5060 | + foreach ($fieldtype as $type) { |
|
5061 | 5061 | if ($i > 0) { |
5062 | 5062 | $sql .= ' OR '; |
5063 | 5063 | } |
@@ -5072,10 +5072,10 @@ discard block |
||
5072 | 5072 | } else { |
5073 | 5073 | $sql = "UPDATE $t_s SET selected_value = NULL |
5074 | 5074 | WHERE category = '$category' AND access_url = $access_url"; |
5075 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5075 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5076 | 5076 | $sql .= " AND ( "; |
5077 | 5077 | $i = 0; |
5078 | - foreach ($fieldtype as $type){ |
|
5078 | + foreach ($fieldtype as $type) { |
|
5079 | 5079 | if ($i > 0) { |
5080 | 5080 | $sql .= ' OR '; |
5081 | 5081 | } |
@@ -5208,7 +5208,7 @@ discard block |
||
5208 | 5208 | $sql .= " ORDER BY 1,2 ASC"; |
5209 | 5209 | } |
5210 | 5210 | $result = Database::query($sql); |
5211 | - $result = Database::store_result($result,'ASSOC'); |
|
5211 | + $result = Database::store_result($result, 'ASSOC'); |
|
5212 | 5212 | return $result; |
5213 | 5213 | } |
5214 | 5214 | |
@@ -5221,7 +5221,7 @@ discard block |
||
5221 | 5221 | function & api_get_settings_categories($exceptions = array(), $access_url = 1) { |
5222 | 5222 | $access_url = (int) $access_url; |
5223 | 5223 | $t_cs = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
5224 | - $list = "'".implode("','",$exceptions)."'"; |
|
5224 | + $list = "'".implode("','", $exceptions)."'"; |
|
5225 | 5225 | $sql = "SELECT DISTINCT category FROM $t_cs WHERE category is NOT NULL "; |
5226 | 5226 | if ($list != "'',''" && $list != "''" && !empty($list)) { |
5227 | 5227 | $sql .= " AND category NOT IN ($list) "; |
@@ -5333,12 +5333,12 @@ discard block |
||
5333 | 5333 | |
5334 | 5334 | // Item not found for this access_url, we have to check if the whole thing is missing |
5335 | 5335 | // (in which case we ignore the insert) or if there *is* a record but just for access_url = 1 |
5336 | - $insert = "INSERT INTO $t_settings " . |
|
5337 | - "(variable,selected_value," . |
|
5338 | - "type,category," . |
|
5339 | - "subkey,title," . |
|
5340 | - "comment,scope," . |
|
5341 | - "subkeytext,access_url,access_url_changeable)" . |
|
5336 | + $insert = "INSERT INTO $t_settings ". |
|
5337 | + "(variable,selected_value,". |
|
5338 | + "type,category,". |
|
5339 | + "subkey,title,". |
|
5340 | + "comment,scope,". |
|
5341 | + "subkeytext,access_url,access_url_changeable)". |
|
5342 | 5342 | " VALUES ('$var','$val',"; |
5343 | 5343 | if (isset($type)) { |
5344 | 5344 | $type = Database::escape_string($type); |
@@ -5504,7 +5504,7 @@ discard block |
||
5504 | 5504 | $result = Database::query($sql); |
5505 | 5505 | |
5506 | 5506 | //if ($row = Database::fetch_array($result)) { |
5507 | - if (Database::num_rows($result) > 0 ) { |
|
5507 | + if (Database::num_rows($result) > 0) { |
|
5508 | 5508 | $is_courseMember = true; |
5509 | 5509 | $is_courseTutor = true; |
5510 | 5510 | $is_courseCoach = true; |
@@ -5688,8 +5688,8 @@ discard block |
||
5688 | 5688 | { |
5689 | 5689 | $tbl_rel_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
5690 | 5690 | if (!empty($user_id) && !empty($courseId)) { |
5691 | - $user_id = intval($user_id); |
|
5692 | - $courseId = intval($courseId); |
|
5691 | + $user_id = intval($user_id); |
|
5692 | + $courseId = intval($courseId); |
|
5693 | 5693 | $sql = 'SELECT status |
5694 | 5694 | FROM '.$tbl_rel_course_user.' |
5695 | 5695 | WHERE user_id='.$user_id.' AND c_id = '.$courseId; |
@@ -5801,7 +5801,7 @@ discard block |
||
5801 | 5801 | } else { |
5802 | 5802 | return false; |
5803 | 5803 | } |
5804 | - return strtolower(substr((string)$os, 0, 3 )) == 'win'; |
|
5804 | + return strtolower(substr((string) $os, 0, 3)) == 'win'; |
|
5805 | 5805 | } |
5806 | 5806 | |
5807 | 5807 | /** |
@@ -6357,7 +6357,7 @@ discard block |
||
6357 | 6357 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6358 | 6358 | $libraries = array(); |
6359 | 6359 | if ($include_jqgrid) { |
6360 | - $libraries[]='jqgrid'; |
|
6360 | + $libraries[] = 'jqgrid'; |
|
6361 | 6361 | } |
6362 | 6362 | return api_get_jquery_libraries_js($libraries); |
6363 | 6363 | } |
@@ -6381,12 +6381,12 @@ discard block |
||
6381 | 6381 | |
6382 | 6382 | //jqgrid js and css |
6383 | 6383 | if (in_array('jqgrid', $libraries)) { |
6384 | - $languaje = 'en'; |
|
6384 | + $languaje = 'en'; |
|
6385 | 6385 | $platform_isocode = strtolower(api_get_language_isocode()); |
6386 | 6386 | |
6387 | 6387 | //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
6388 | 6388 | $jqgrid_langs = array( |
6389 | - 'bg', 'bg1251', 'cat','cn','cs','da','de','el','en','es','fa','fi','fr','gl','he','hu','is','it','ja','nl','no','pl','pt-br','pt','ro','ru','sk','sr','sv','tr','ua' |
|
6389 | + 'bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua' |
|
6390 | 6390 | ); |
6391 | 6391 | |
6392 | 6392 | if (in_array($platform_isocode, $jqgrid_langs)) { |
@@ -6417,7 +6417,7 @@ discard block |
||
6417 | 6417 | |
6418 | 6418 | // jquery datepicker |
6419 | 6419 | if (in_array('datepicker', $libraries)) { |
6420 | - $languaje = 'en-GB'; |
|
6420 | + $languaje = 'en-GB'; |
|
6421 | 6421 | $platform_isocode = strtolower(api_get_language_isocode()); |
6422 | 6422 | |
6423 | 6423 | // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
@@ -6583,7 +6583,7 @@ discard block |
||
6583 | 6583 | * @return void |
6584 | 6584 | */ |
6585 | 6585 | function api_check_php_version($my_inc_path = null) { |
6586 | - if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6586 | + if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6587 | 6587 | $global_error_code = 1; |
6588 | 6588 | // Incorrect PHP version |
6589 | 6589 | $global_page = $my_inc_path.'global_error_message.inc.php'; |
@@ -6599,7 +6599,7 @@ discard block |
||
6599 | 6599 | */ |
6600 | 6600 | function api_check_archive_dir() { |
6601 | 6601 | if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) { |
6602 | - $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning'); |
|
6602 | + $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning'); |
|
6603 | 6603 | api_not_allowed(true, $message); |
6604 | 6604 | } |
6605 | 6605 | } |
@@ -6662,7 +6662,7 @@ discard block |
||
6662 | 6662 | * @author Jorge Frisancho Jibaja <[email protected]>, USIL - Some changes to allow the use of real IP using reverse proxy |
6663 | 6663 | * @version CEV CHANGE 24APR2012 |
6664 | 6664 | */ |
6665 | -function api_get_real_ip(){ |
|
6665 | +function api_get_real_ip() { |
|
6666 | 6666 | // Guess the IP if behind a reverse proxy |
6667 | 6667 | global $debug; |
6668 | 6668 | $ip = trim($_SERVER['REMOTE_ADDR']); |
@@ -6688,23 +6688,23 @@ discard block |
||
6688 | 6688 | * @author Yannick Warnier for improvements and managment of multiple ranges |
6689 | 6689 | * @todo check for IPv6 support |
6690 | 6690 | */ |
6691 | -function api_check_ip_in_range($ip,$range) |
|
6691 | +function api_check_ip_in_range($ip, $range) |
|
6692 | 6692 | { |
6693 | 6693 | if (empty($ip) or empty($range)) { |
6694 | 6694 | return false; |
6695 | 6695 | } |
6696 | - $ip_ip = ip2long ($ip); |
|
6696 | + $ip_ip = ip2long($ip); |
|
6697 | 6697 | // divide range param into array of elements |
6698 | - if (strpos($range,',')!==false) { |
|
6699 | - $ranges = explode(',',$range); |
|
6698 | + if (strpos($range, ',') !== false) { |
|
6699 | + $ranges = explode(',', $range); |
|
6700 | 6700 | } else { |
6701 | 6701 | $ranges = array($range); |
6702 | 6702 | } |
6703 | 6703 | foreach ($ranges as $range) { |
6704 | 6704 | $range = trim($range); |
6705 | 6705 | if (empty($range)) { continue; } |
6706 | - if (strpos($range,'/')===false) { |
|
6707 | - if (strcmp($ip,$range)===0) { |
|
6706 | + if (strpos($range, '/') === false) { |
|
6707 | + if (strcmp($ip, $range) === 0) { |
|
6708 | 6708 | return true; // there is a direct IP match, return OK |
6709 | 6709 | } |
6710 | 6710 | continue; //otherwise, get to the next range |
@@ -6712,7 +6712,7 @@ discard block |
||
6712 | 6712 | // the range contains a "/", so analyse completely |
6713 | 6713 | list ($net, $mask) = explode("/", $range); |
6714 | 6714 | |
6715 | - $ip_net = ip2long ($net); |
|
6715 | + $ip_net = ip2long($net); |
|
6716 | 6716 | // mask binary magic |
6717 | 6717 | $ip_mask = ~((1 << (32 - $mask)) - 1); |
6718 | 6718 | |
@@ -7074,14 +7074,14 @@ discard block |
||
7074 | 7074 | * @assert (0) === true |
7075 | 7075 | * @assert ('1G') === true |
7076 | 7076 | */ |
7077 | -function api_set_memory_limit($mem){ |
|
7077 | +function api_set_memory_limit($mem) { |
|
7078 | 7078 | //if ini_set() not available, this function is useless |
7079 | 7079 | if (!function_exists('ini_set') || is_null($mem) || $mem == -1) { |
7080 | 7080 | return false; |
7081 | 7081 | } |
7082 | 7082 | |
7083 | 7083 | $memory_limit = ini_get('memory_limit'); |
7084 | - if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){ |
|
7084 | + if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) { |
|
7085 | 7085 | ini_set('memory_limit', $mem); |
7086 | 7086 | return true; |
7087 | 7087 | } |
@@ -7098,21 +7098,21 @@ discard block |
||
7098 | 7098 | * @assert ('1m') === 1048576 |
7099 | 7099 | * @assert ('100k') === 102400 |
7100 | 7100 | */ |
7101 | -function api_get_bytes_memory_limit($mem){ |
|
7102 | - $size = strtolower(substr($mem,-1)); |
|
7101 | +function api_get_bytes_memory_limit($mem) { |
|
7102 | + $size = strtolower(substr($mem, -1)); |
|
7103 | 7103 | |
7104 | 7104 | switch ($size) { |
7105 | 7105 | case 't': |
7106 | - $mem = intval(substr($mem,-1))*1024*1024*1024*1024; |
|
7106 | + $mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024; |
|
7107 | 7107 | break; |
7108 | 7108 | case 'g': |
7109 | - $mem = intval(substr($mem,0,-1))*1024*1024*1024; |
|
7109 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024; |
|
7110 | 7110 | break; |
7111 | 7111 | case 'm': |
7112 | - $mem = intval(substr($mem,0,-1))*1024*1024; |
|
7112 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024; |
|
7113 | 7113 | break; |
7114 | 7114 | case 'k': |
7115 | - $mem = intval(substr($mem,0,-1))*1024; |
|
7115 | + $mem = intval(substr($mem, 0, -1)) * 1024; |
|
7116 | 7116 | break; |
7117 | 7117 | default: |
7118 | 7118 | // we assume it's integer only |
@@ -7166,7 +7166,7 @@ discard block |
||
7166 | 7166 | ); |
7167 | 7167 | |
7168 | 7168 | $js = api_get_asset('pwstrength-bootstrap/dist/pwstrength-bootstrap.min.js'); |
7169 | - $js .= "<script> |
|
7169 | + $js .= "<script> |
|
7170 | 7170 | var verdicts = ['".implode("','", $verdicts)."']; |
7171 | 7171 | var errorMessages = { |
7172 | 7172 | password_to_short : \"" . get_lang('PasswordIsTooShort')."\", |
@@ -7222,7 +7222,7 @@ discard block |
||
7222 | 7222 | return false; |
7223 | 7223 | } |
7224 | 7224 | $minutesToBlock = api_get_setting('captcha_time_to_block'); |
7225 | - $time = time() + $minutesToBlock*60; |
|
7225 | + $time = time() + $minutesToBlock * 60; |
|
7226 | 7226 | UserManager::update_extra_field_value( |
7227 | 7227 | $userInfo['user_id'], |
7228 | 7228 | 'captcha_blocked_until_date', |
@@ -7296,7 +7296,7 @@ discard block |
||
7296 | 7296 | $out_res = str_replace('"', "''", $out_res); |
7297 | 7297 | } |
7298 | 7298 | // avoid text stuck together when tags are removed, adding a space after > |
7299 | - $out_res = str_replace (">", "> ", $out_res); |
|
7299 | + $out_res = str_replace(">", "> ", $out_res); |
|
7300 | 7300 | $out_res = strip_tags($out_res); |
7301 | 7301 | |
7302 | 7302 | return $out_res; |
@@ -7409,12 +7409,12 @@ discard block |
||
7409 | 7409 | { |
7410 | 7410 | // Clean query |
7411 | 7411 | $bt = debug_backtrace(); |
7412 | - $caller = array_shift($bt);; |
|
7412 | + $caller = array_shift($bt); ; |
|
7413 | 7413 | if ($dump == 1) { |
7414 | 7414 | $string = print_r($string, 1); |
7415 | 7415 | } else { |
7416 | 7416 | $string = str_replace(array("\r", "\n", "\t", "\10"), '', $string); |
7417 | - $string = str_replace(' ',' ', $string); |
|
7417 | + $string = str_replace(' ', ' ', $string); |
|
7418 | 7418 | } |
7419 | 7419 | |
7420 | 7420 | error_log("-------------------------------------"); |
@@ -7524,7 +7524,7 @@ discard block |
||
7524 | 7524 | $body = get_lang('PortalName').': '.api_get_path(WEB_PATH)." \n "; |
7525 | 7525 | $body .= get_lang('PortalLimitType').': '.$limitName." \n "; |
7526 | 7526 | if (isset($hostingParams[$limitName])) { |
7527 | - $body .= get_lang('Value') . ': ' . $hostingParams[$limitName]; |
|
7527 | + $body .= get_lang('Value').': '.$hostingParams[$limitName]; |
|
7528 | 7528 | } |
7529 | 7529 | api_mail_html(null, $email, $subject, $body); |
7530 | 7530 | } |
@@ -7656,7 +7656,7 @@ discard block |
||
7656 | 7656 | */ |
7657 | 7657 | function api_set_site_use_cookie_warning_cookie() |
7658 | 7658 | { |
7659 | - setcookie("ChamiloUsesCookies", "ok", time()+31556926); |
|
7659 | + setcookie("ChamiloUsesCookies", "ok", time() + 31556926); |
|
7660 | 7660 | } |
7661 | 7661 | |
7662 | 7662 | /** |
@@ -7704,10 +7704,10 @@ discard block |
||
7704 | 7704 | return false; |
7705 | 7705 | } |
7706 | 7706 | |
7707 | - $fullPath = $parentDirectory . api_replace_dangerous_char($name); |
|
7707 | + $fullPath = $parentDirectory.api_replace_dangerous_char($name); |
|
7708 | 7708 | |
7709 | 7709 | if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) { |
7710 | - $fp = fopen($fullPath . '/index.html', 'w'); |
|
7710 | + $fp = fopen($fullPath.'/index.html', 'w'); |
|
7711 | 7711 | |
7712 | 7712 | if ($fp) { |
7713 | 7713 | if (fwrite($fp, '<html><head></head><body></body></html>')) { |
@@ -7772,7 +7772,7 @@ discard block |
||
7772 | 7772 | $mail->SMTPSecure = $platform_email['SMTP_SECURE']; |
7773 | 7773 | } |
7774 | 7774 | } |
7775 | - $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG'])?$platform_email['SMTP_DEBUG']:0; |
|
7775 | + $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG']) ? $platform_email['SMTP_DEBUG'] : 0; |
|
7776 | 7776 | |
7777 | 7777 | // 5 = low, 1 = high |
7778 | 7778 | $mail->Priority = 3; |
@@ -7924,11 +7924,11 @@ discard block |
||
7924 | 7924 | error_log('ERROR: mail not sent to '.$recipient_name.' ('.$recipient_email.') because of '.$mail->ErrorInfo.'<br />'); |
7925 | 7925 | if ($mail->SMTPDebug) { |
7926 | 7926 | error_log( |
7927 | - "Connection details :: " . |
|
7928 | - "Protocol: " . $mail->Mailer . ' :: ' . |
|
7929 | - "Host/Port: " . $mail->Host . ':' . $mail->Port . ' :: ' . |
|
7930 | - "Authent/Open: " . ($mail->SMTPAuth?'Authent':'Open') . ' :: ' . |
|
7931 | - ($mail->SMTPAuth?" User/Pass: " . $mail->Username . ':' . $mail->Password:'') |
|
7927 | + "Connection details :: ". |
|
7928 | + "Protocol: ".$mail->Mailer.' :: '. |
|
7929 | + "Host/Port: ".$mail->Host.':'.$mail->Port.' :: '. |
|
7930 | + "Authent/Open: ".($mail->SMTPAuth ? 'Authent' : 'Open').' :: '. |
|
7931 | + ($mail->SMTPAuth ? " User/Pass: ".$mail->Username.':'.$mail->Password : '') |
|
7932 | 7932 | ); |
7933 | 7933 | } |
7934 | 7934 | return 0; |
@@ -7999,13 +7999,13 @@ discard block |
||
7999 | 7999 | * @return array |
8000 | 8000 | * |
8001 | 8001 | */ |
8002 | -function api_unique_multidim_array($array, $key){ |
|
8002 | +function api_unique_multidim_array($array, $key) { |
|
8003 | 8003 | $temp_array = []; |
8004 | 8004 | $i = 0; |
8005 | 8005 | $key_array = []; |
8006 | 8006 | |
8007 | - foreach($array as $val){ |
|
8008 | - if(!in_array($val[$key],$key_array)){ |
|
8007 | + foreach ($array as $val) { |
|
8008 | + if (!in_array($val[$key], $key_array)) { |
|
8009 | 8009 | $key_array[$i] = $val[$key]; |
8010 | 8010 | $temp_array[$i] = $val; |
8011 | 8011 | } |
@@ -8038,9 +8038,9 @@ discard block |
||
8038 | 8038 | */ |
8039 | 8039 | function stripGivenTags($string, $tags) { |
8040 | 8040 | foreach ($tags as $tag) { |
8041 | - $string2 = preg_replace('#</' . $tag . '[^>]*>#i', ' ', $string); |
|
8041 | + $string2 = preg_replace('#</'.$tag.'[^>]*>#i', ' ', $string); |
|
8042 | 8042 | if ($string2 != $string) { |
8043 | - $string = preg_replace('/<' . $tag . '[^>]*>/i', ' ', $string2); |
|
8043 | + $string = preg_replace('/<'.$tag.'[^>]*>/i', ' ', $string2); |
|
8044 | 8044 | } |
8045 | 8045 | } |
8046 | 8046 | return $string; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (Database::num_rows($result) == 0) { |
214 | 214 | $condition = ''; |
215 | 215 | } else { |
216 | - //great, there is an specific auto launch for this session we leave the $condition |
|
216 | + //great, there is an specific auto launch for this session we leave the $condition |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $lp_data = Database::fetch_array($result,'ASSOC'); |
226 | 226 | if (!empty($lp_data['id'])) { |
227 | 227 | if (api_is_platform_admin() || api_is_allowed_to_edit()) { |
228 | - $show_autolaunch_lp_warning = true; |
|
228 | + $show_autolaunch_lp_warning = true; |
|
229 | 229 | } else { |
230 | 230 | $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
231 | 231 | if (!isset($_SESSION[$session_key])) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | //if (!isset($_SESSION[$forumKey])) { |
255 | 255 | //redirecting to the LP |
256 | 256 | $url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&id_session='.$session_id; |
257 | - // $_SESSION[$forumKey] = true; |
|
257 | + // $_SESSION[$forumKey] = true; |
|
258 | 258 | header("Location: $url"); |
259 | 259 | exit; |
260 | 260 | //} |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | if (api_get_setting('course.homepage_view') == 'activity' || |
281 | 281 | api_get_setting('course.homepage_view') == 'activity_big' |
282 | 282 | ) { |
283 | - require 'activity.php'; |
|
283 | + require 'activity.php'; |
|
284 | 284 | } elseif (api_get_setting('course.homepage_view') == '2column') { |
285 | - require '2column.php'; |
|
285 | + require '2column.php'; |
|
286 | 286 | } elseif (api_get_setting('course.homepage_view') == '3column') { |
287 | - require '3column.php'; |
|
287 | + require '3column.php'; |
|
288 | 288 | } elseif (api_get_setting('course.homepage_view') == 'vertical_activity') { |
289 | - require 'vertical_activity.php'; |
|
289 | + require 'vertical_activity.php'; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | $content = '<div id="course_tools">'.$content.'</div>'; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | //unset($_SESSION['oLP']); |
42 | 42 | //unset($_SESSION['lpobject']); |
43 | 43 | |
44 | -$htmlHeadXtra[] ='<script> |
|
44 | +$htmlHeadXtra[] = '<script> |
|
45 | 45 | /* option show/hide thematic-block */ |
46 | 46 | $(document).ready(function(){ |
47 | 47 | $("#thematic-show").click(function(){ |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
210 | 210 | if (!isset($_SESSION[$session_key])) { |
211 | 211 | //redirecting to the LP |
212 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&id_session=' . $session_id; |
|
212 | + $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&id_session='.$session_id; |
|
213 | 213 | $_SESSION[$session_key] = true; |
214 | 214 | header("Location: $url"); |
215 | 215 | exit; |
@@ -220,13 +220,13 @@ discard block |
||
220 | 220 | $course_id = api_get_course_int_id(); |
221 | 221 | $condition = ''; |
222 | 222 | if (!empty($session_id)) { |
223 | - $condition = api_get_session_condition($session_id); |
|
223 | + $condition = api_get_session_condition($session_id); |
|
224 | 224 | $sql = "SELECT id FROM $lp_table |
225 | 225 | WHERE c_id = $course_id AND autolaunch = 1 $condition |
226 | 226 | LIMIT 1"; |
227 | 227 | $result = Database::query($sql); |
228 | 228 | //If we found nothing in the session we just called the session_id = 0 autolaunch |
229 | - if (Database::num_rows($result) == 0) { |
|
229 | + if (Database::num_rows($result) == 0) { |
|
230 | 230 | $condition = ''; |
231 | 231 | } else { |
232 | 232 | //great, there is an specific auto launch for this session we leave the $condition |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | WHERE c_id = $course_id AND autolaunch = 1 $condition |
238 | 238 | LIMIT 1"; |
239 | 239 | $result = Database::query($sql); |
240 | - if (Database::num_rows($result) > 0) { |
|
241 | - $lp_data = Database::fetch_array($result,'ASSOC'); |
|
240 | + if (Database::num_rows($result) > 0) { |
|
241 | + $lp_data = Database::fetch_array($result, 'ASSOC'); |
|
242 | 242 | if (!empty($lp_data['id'])) { |
243 | 243 | if (api_is_platform_admin() || api_is_allowed_to_edit()) { |
244 | 244 | $show_autolaunch_lp_warning = true; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
247 | 247 | if (!isset($_SESSION[$session_key])) { |
248 | 248 | //redirecting to the LP |
249 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&action=view&lp_id=' . $lp_data['id']; |
|
249 | + $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['id']; |
|
250 | 250 | |
251 | 251 | $_SESSION[$session_key] = true; |
252 | 252 | header("Location: $url"); |
@@ -219,7 +219,7 @@ |
||
219 | 219 | */ |
220 | 220 | public function getEntityIdentifier() |
221 | 221 | { |
222 | - return 'GenjFaqBundle:Question:' . $this->getId(); |
|
222 | + return 'GenjFaqBundle:Question:'.$this->getId(); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @param string $rank |
95 | 95 | * |
96 | - * @return Question |
|
96 | + * @return Category |
|
97 | 97 | */ |
98 | 98 | public function setRank($rank) |
99 | 99 | { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | /** |
202 | 202 | * Get questions |
203 | 203 | * |
204 | - * @return \Doctrine\Common\Collections\Collection |
|
204 | + * @return Question[] |
|
205 | 205 | */ |
206 | 206 | public function getQuestions() |
207 | 207 | { |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | $interbreadcrumb[] = array('url' => api_get_self().'?'.api_get_cidreq(), 'name' => get_lang('CustomizeIcons')); |
47 | 47 | $toolName = $tool['name']; |
48 | 48 | |
49 | - $currentUrl = api_get_self().'?action=edit_icon&id=' . $id.'&'.api_get_cidreq(); |
|
49 | + $currentUrl = api_get_self().'?action=edit_icon&id='.$id.'&'.api_get_cidreq(); |
|
50 | 50 | |
51 | 51 | $form = new FormValidator('icon_edit', 'post', $currentUrl); |
52 | 52 | $form->addElement('header', get_lang('EditIcon')); |
53 | 53 | $form->addHtml('<div class="col-md-7">'); |
54 | 54 | $form->addElement('text', 'name', get_lang('Name')); |
55 | 55 | $form->addElement('text', 'link', get_lang('Links')); |
56 | - $allowed_picture_types = array ('jpg', 'jpeg', 'png'); |
|
56 | + $allowed_picture_types = array('jpg', 'jpeg', 'png'); |
|
57 | 57 | $form->addElement('file', 'icon', get_lang('CustomIcon')); |
58 | 58 | $form->addRule('icon', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types); |
59 | 59 | $form->addElement( |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $iconsTools .= Display::page_header(get_lang('CustomizeIcons'), null, 'h4'); |
119 | 119 | $iconsTools .= '<div class="row">'; |
120 | 120 | foreach ($toolList as $tool) { |
121 | - $toolIconName = 'Tool' . api_underscore_to_camel_case($tool['name']); |
|
121 | + $toolIconName = 'Tool'.api_underscore_to_camel_case($tool['name']); |
|
122 | 122 | $toolIconName = isset($$toolIconName) ? get_lang($toolIconName) : $tool['name']; |
123 | 123 | |
124 | 124 | $iconsTools .= '<div class="col-md-2">'; |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | |
141 | 141 | $delete = (!empty($tool['custom_icon'])) ? "<a class=\"btn btn-default\" onclick=\"javascript: |
142 | 142 | if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)). |
143 | - "')) return false;\" href=\"". api_get_self() . '?action=delete_icon&id=' . $tool['iid'] . '&'.api_get_cidreq()."\"> |
|
143 | + "')) return false;\" href=\"".api_get_self().'?action=delete_icon&id='.$tool['iid'].'&'.api_get_cidreq()."\"> |
|
144 | 144 | <em class=\"fa fa-trash-o\"></em></a>" : ""; |
145 | - $edit = '<a class="btn btn-default" href="' . api_get_self() . '?action=edit_icon&id=' . $tool['iid'] . '&'.api_get_cidreq().'"><em class="fa fa-pencil"></em></a>'; |
|
145 | + $edit = '<a class="btn btn-default" href="'.api_get_self().'?action=edit_icon&id='.$tool['iid'].'&'.api_get_cidreq().'"><em class="fa fa-pencil"></em></a>'; |
|
146 | 146 | |
147 | - $iconsTools .= '<div class="icon-tools">'. $icon . '</div>'; |
|
148 | - $iconsTools .= '<div class="name-tools">' . $toolIconName . '</div>'; |
|
149 | - $iconsTools .= '<div class="toolbar">' . $edit . $delete . '</div>'; |
|
147 | + $iconsTools .= '<div class="icon-tools">'.$icon.'</div>'; |
|
148 | + $iconsTools .= '<div class="name-tools">'.$toolIconName.'</div>'; |
|
149 | + $iconsTools .= '<div class="toolbar">'.$edit.$delete.'</div>'; |
|
150 | 150 | $iconsTools .= '</div>'; |
151 | 151 | $iconsTools .= '</div>'; |
152 | 152 | } |