@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | $listAction = api_get_self(); |
18 | 18 | |
19 | -$action = ''; |
|
19 | +$action = ''; |
|
20 | 20 | if (isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit', 'delete', 'add_level'])) { |
21 | 21 | $action = $_GET['action']; |
22 | 22 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | } |
50 | 50 | $formToDisplay = $form->returnForm(); |
51 | 51 | |
52 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
53 | -$interbreadcrumb[] = array ('url' => api_get_self(), 'name' => get_lang('SkillProfile')); |
|
52 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
53 | +$interbreadcrumb[] = array('url' => api_get_self(), 'name' => get_lang('SkillProfile')); |
|
54 | 54 | |
55 | 55 | $tpl = new Template($action); |
56 | 56 | switch ($action) { |
@@ -5,10 +5,10 @@ |
||
5 | 5 | * @author Angel Fernando Quiroz Campos <[email protected]> |
6 | 6 | * @package chamilo.plugin.tour |
7 | 7 | */ |
8 | -require_once __DIR__ . '/config.php'; |
|
8 | +require_once __DIR__.'/config.php'; |
|
9 | 9 | |
10 | -$pluginPath = api_get_path(SYS_PLUGIN_PATH) . 'tour/'; |
|
11 | -$pluginWebPath = api_get_path(WEB_PLUGIN_PATH) . 'tour/'; |
|
10 | +$pluginPath = api_get_path(SYS_PLUGIN_PATH).'tour/'; |
|
11 | +$pluginWebPath = api_get_path(WEB_PLUGIN_PATH).'tour/'; |
|
12 | 12 | |
13 | 13 | $userId = api_get_user_id(); |
14 | 14 |
@@ -129,8 +129,8 @@ |
||
129 | 129 | */ |
130 | 130 | public function getTourConfig() |
131 | 131 | { |
132 | - $pluginPath = api_get_path(SYS_PLUGIN_PATH) . 'tour/'; |
|
133 | - $jsonContent = file_get_contents($pluginPath . 'config/tour.json'); |
|
132 | + $pluginPath = api_get_path(SYS_PLUGIN_PATH).'tour/'; |
|
133 | + $jsonContent = file_get_contents($pluginPath.'config/tour.json'); |
|
134 | 134 | $jsonData = json_decode($jsonContent, true); |
135 | 135 | |
136 | 136 | return $jsonData; |
@@ -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 |
@@ -1244,6 +1244,7 @@ discard block |
||
1244 | 1244 | * Gets the list of courses a specific user is subscribed to |
1245 | 1245 | * @param int User ID |
1246 | 1246 | * @param boolean $fetch_session Whether to get session courses or not - NOT YET IMPLEMENTED |
1247 | + * @param integer $userid |
|
1247 | 1248 | * @return array Array of courses in the form [0]=>('code'=>xxx,'db'=>xxx,'dir'=>xxx,'status'=>d) |
1248 | 1249 | */ |
1249 | 1250 | function api_get_user_courses($userid, $fetch_session = true) |
@@ -3036,7 +3037,7 @@ discard block |
||
3036 | 3037 | * on the session visibility |
3037 | 3038 | * @param bool $tutor Whether to check if the user has the tutor role |
3038 | 3039 | * @param bool $coach Whether to check if the user has the coach role |
3039 | -* @return boolean true: the user has the rights to edit, false: he does not |
|
3040 | +* @return boolean|null true: the user has the rights to edit, false: he does not |
|
3040 | 3041 | */ |
3041 | 3042 | function api_is_allowed_to_session_edit($tutor = false, $coach = false) |
3042 | 3043 | { |
@@ -6656,7 +6657,7 @@ discard block |
||
6656 | 6657 | /** |
6657 | 6658 | * Returns an array of global configuration settings which should be ignored |
6658 | 6659 | * when printing the configuration settings screens |
6659 | - * @return array Array of strings, each identifying one of the excluded settings |
|
6660 | + * @return string[] Array of strings, each identifying one of the excluded settings |
|
6660 | 6661 | */ |
6661 | 6662 | function api_get_locked_settings() { |
6662 | 6663 | return array( |
@@ -6699,6 +6700,7 @@ discard block |
||
6699 | 6700 | * false if he isn't. If the user ID is given and is an integer, then the same |
6700 | 6701 | * ID is simply returned |
6701 | 6702 | * @param integer User ID |
6703 | + * @param integer $user_id |
|
6702 | 6704 | * @return boolean Integer User ID is logged in, or false otherwise |
6703 | 6705 | */ |
6704 | 6706 | function api_user_is_login($user_id = null) { |
@@ -7143,6 +7145,7 @@ discard block |
||
7143 | 7145 | /** |
7144 | 7146 | * Gets memory limit in bytes |
7145 | 7147 | * @param string The memory size (128M, 1G, 1000K, etc) |
7148 | + * @param string $mem |
|
7146 | 7149 | * @return int |
7147 | 7150 | * @assert (null) === false |
7148 | 7151 | * @assert ('1t') === 1099511627776 |
@@ -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 */ |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | define('IS_WINDOWS_OS', api_is_windows_os()); |
265 | 265 | |
266 | 266 | // Checks for installed optional php-extensions. |
267 | -define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
268 | -define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
269 | -define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
267 | +define('INTL_INSTALLED', function_exists('intl_get_error_code')); // intl extension (from PECL), it is installed by default as of PHP 5.3.0 |
|
268 | +define('ICONV_INSTALLED', function_exists('iconv')); // iconv extension, for PHP5 on Windows it is installed by default. |
|
269 | +define('MBSTRING_INSTALLED', function_exists('mb_strlen')); // mbstring extension. |
|
270 | 270 | |
271 | 271 | // Patterns for processing paths. // Examples: |
272 | -define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
273 | -define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
274 | -define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
272 | +define('REPEATED_SLASHES_PURIFIER', '/\/{2,}/'); // $path = preg_replace(REPEATED_SLASHES_PURIFIER, '/', $path); |
|
273 | +define('VALID_WEB_PATH', '/https?:\/\/[^\/]*(\/.*)?/i'); // $is_valid_path = preg_match(VALID_WEB_PATH, $path); |
|
274 | +define('VALID_WEB_SERVER_BASE', '/https?:\/\/[^\/]*/i'); // $new_path = preg_replace(VALID_WEB_SERVER_BASE, $new_base, $path); |
|
275 | 275 | |
276 | 276 | // Constants for api_get_path() and api_get_path_type(), etc. - registered path types. |
277 | 277 | // basic (leaf elements) |
@@ -364,19 +364,19 @@ discard block |
||
364 | 364 | define('LINK_HOTPOTATOES', 9); |
365 | 365 | |
366 | 366 | // Score display types constants |
367 | -define('SCORE_DIV', 1); // X / Y |
|
368 | -define('SCORE_PERCENT', 2); // XX % |
|
369 | -define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
370 | -define('SCORE_AVERAGE', 4); // XX % |
|
371 | -define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
372 | -define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
373 | -define('SCORE_SIMPLE', 7); // X |
|
374 | -define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
375 | -define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
376 | -define('SCORE_CUSTOM', 10); // Good! |
|
377 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
378 | -define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
379 | -define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
367 | +define('SCORE_DIV', 1); // X / Y |
|
368 | +define('SCORE_PERCENT', 2); // XX % |
|
369 | +define('SCORE_DIV_PERCENT', 3); // X / Y (XX %) |
|
370 | +define('SCORE_AVERAGE', 4); // XX % |
|
371 | +define('SCORE_DECIMAL', 5); // 0.50 (X/Y) |
|
372 | +define('SCORE_BAR', 6); // Uses the Display::bar_progress function |
|
373 | +define('SCORE_SIMPLE', 7); // X |
|
374 | +define('SCORE_IGNORE_SPLIT', 8); // ?? |
|
375 | +define('SCORE_DIV_PERCENT_WITH_CUSTOM', 9); // X / Y (XX %) - Good! |
|
376 | +define('SCORE_CUSTOM', 10); // Good! |
|
377 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM', 11); // X - Good! |
|
378 | +define('SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS', 12); // X - Good! |
|
379 | +define('SCORE_ONLY_SCORE', 13); // X - Good! |
|
380 | 380 | |
381 | 381 | define('SCORE_BOTH', 1); |
382 | 382 | define('SCORE_ONLY_DEFAULT', 2); |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | define('TIMELINE_STATUS_INACTIVE', '2'); |
562 | 562 | |
563 | 563 | // Event email template class |
564 | -define ('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
565 | -define ('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
564 | +define('EVENT_EMAIL_TEMPLATE_ACTIVE', 1); |
|
565 | +define('EVENT_EMAIL_TEMPLATE_INACTIVE', 0); |
|
566 | 566 | |
567 | 567 | // Course home |
568 | 568 | define('SHORTCUTS_HORIZONTAL', 0); |
@@ -577,8 +577,8 @@ discard block |
||
577 | 577 | define('FILE_OVERWRITE', 3); |
578 | 578 | define('UTF8_CONVERT', false); //false by default |
579 | 579 | |
580 | -define('DOCUMENT','file'); |
|
581 | -define('FOLDER','folder'); |
|
580 | +define('DOCUMENT', 'file'); |
|
581 | +define('FOLDER', 'folder'); |
|
582 | 582 | |
583 | 583 | define('RESOURCE_DOCUMENT', 'document'); |
584 | 584 | define('RESOURCE_GLOSSARY', 'glossary'); |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | : 'localhost'))); |
679 | 679 | if (isset($_SERVER['SERVER_PORT']) && !strpos($server_name, ':') |
680 | 680 | && (($server_protocol == 'http' |
681 | - && $_SERVER['SERVER_PORT'] != 80 ) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443 ))) { |
|
682 | - $server_name .= ":" . $_SERVER['SERVER_PORT']; |
|
681 | + && $_SERVER['SERVER_PORT'] != 80) || ($server_protocol == 'https' && $_SERVER['SERVER_PORT'] != 443))) { |
|
682 | + $server_name .= ":".$_SERVER['SERVER_PORT']; |
|
683 | 683 | } |
684 | 684 | $root_web = $server_protocol.'://'.$server_name.$root_rel; |
685 | 685 | $root_sys = str_replace('\\', '/', realpath(__DIR__.'/../../../')).'/'; |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | $sys_course_code = |
864 | 864 | isset($_SESSION['_course']['sysCode']) // User is inside a course? |
865 | 865 | ? $_SESSION['_course']['sysCode'] // Yes, then use course's directory name. |
866 | - : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
866 | + : '{SYS_COURSE_CODE}'; // No, then use a fake code, it may be processed later. |
|
867 | 867 | $path = $matches[1].'courses/'.$sys_course_code.'/document/'.str_replace('//', '/', $matches[3].'/'.$matches[2]); |
868 | 868 | } |
869 | 869 | } |
@@ -889,15 +889,15 @@ discard block |
||
889 | 889 | { |
890 | 890 | global $_configuration; |
891 | 891 | $web_root = api_get_path(WEB_PATH); |
892 | - $ext = substr($web_path,strrpos($web_path,'.')); |
|
892 | + $ext = substr($web_path, strrpos($web_path, '.')); |
|
893 | 893 | if (isset($ext[2])) { // faster version of strlen to check if len>2 |
894 | 894 | // Check for CDN definitions |
895 | 895 | if (!empty($_configuration['cdn_enable']) && !empty($ext)) { |
896 | 896 | foreach ($_configuration['cdn'] as $host => $exts) { |
897 | - if (in_array($ext,$exts)) { |
|
897 | + if (in_array($ext, $exts)) { |
|
898 | 898 | //Use host as defined in $_configuration['cdn'], without |
899 | 899 | // trailing slash |
900 | - return str_replace($web_root,$host.'/',$web_path); |
|
900 | + return str_replace($web_root, $host.'/', $web_path); |
|
901 | 901 | } |
902 | 902 | } |
903 | 903 | } |
@@ -1339,10 +1339,10 @@ discard block |
||
1339 | 1339 | |
1340 | 1340 | if (isset($user['email'])) { |
1341 | 1341 | $result['mail'] = isset($user['email']) ? $user['email'] : null; |
1342 | - $result['email'] = isset($user['email'])? $user['email'] : null; |
|
1342 | + $result['email'] = isset($user['email']) ? $user['email'] : null; |
|
1343 | 1343 | } else { |
1344 | 1344 | $result['mail'] = isset($user['mail']) ? $user['mail'] : null; |
1345 | - $result['email'] = isset($user['mail'])? $user['mail'] : null; |
|
1345 | + $result['email'] = isset($user['mail']) ? $user['mail'] : null; |
|
1346 | 1346 | } |
1347 | 1347 | $user_id = intval($user['user_id']); |
1348 | 1348 | // Maintain the user_id index for backwards compatibility |
@@ -1858,7 +1858,7 @@ discard block |
||
1858 | 1858 | foreach ($param_list1 as $key => $enreg) { |
1859 | 1859 | list ($param_list1_keys[$key], $param_list1_vals[$key]) = explode('=', $enreg); |
1860 | 1860 | } |
1861 | - $param_list1 = array ('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1861 | + $param_list1 = array('keys' => $param_list1_keys, 'vals' => $param_list1_vals); |
|
1862 | 1862 | foreach ($param_list2 as $enreg) { |
1863 | 1863 | $enreg = explode('=', $enreg); |
1864 | 1864 | $key = array_search($enreg[0], $param_list1['keys']); |
@@ -1888,7 +1888,7 @@ discard block |
||
1888 | 1888 | $length = 2; |
1889 | 1889 | } |
1890 | 1890 | $password = ''; |
1891 | - for ($i = 0; $i < $length; $i ++) { |
|
1891 | + for ($i = 0; $i < $length; $i++) { |
|
1892 | 1892 | $password .= $characters[rand() % strlen($characters)]; |
1893 | 1893 | } |
1894 | 1894 | return $password; |
@@ -1915,10 +1915,10 @@ discard block |
||
1915 | 1915 | $digits = 0; |
1916 | 1916 | $consequent_characters = 0; |
1917 | 1917 | $previous_character_code = 0; |
1918 | - for ($i = 0; $i < $password_length; $i ++) { |
|
1918 | + for ($i = 0; $i < $password_length; $i++) { |
|
1919 | 1919 | $current_character_code = api_ord(api_substr($password, $i, 1)); |
1920 | 1920 | if ($i && abs($current_character_code - $previous_character_code) <= 1) { |
1921 | - $consequent_characters ++; |
|
1921 | + $consequent_characters++; |
|
1922 | 1922 | if ($consequent_characters == 3) { |
1923 | 1923 | return false; |
1924 | 1924 | } |
@@ -1926,9 +1926,9 @@ discard block |
||
1926 | 1926 | $consequent_characters = 1; |
1927 | 1927 | } |
1928 | 1928 | if ($current_character_code >= 97 && $current_character_code <= 122) { |
1929 | - $letters ++; |
|
1929 | + $letters++; |
|
1930 | 1930 | } elseif ($current_character_code >= 48 && $current_character_code <= 57) { |
1931 | - $digits ++; |
|
1931 | + $digits++; |
|
1932 | 1932 | } else { |
1933 | 1933 | return false; |
1934 | 1934 | } |
@@ -2033,7 +2033,7 @@ discard block |
||
2033 | 2033 | if (empty($session_id)) { return null; } |
2034 | 2034 | } |
2035 | 2035 | $t = Database::get_main_table(TABLE_MAIN_SESSION); |
2036 | - $s = "SELECT name FROM $t WHERE id = ".(int)$session_id; |
|
2036 | + $s = "SELECT name FROM $t WHERE id = ".(int) $session_id; |
|
2037 | 2037 | $r = Database::query($s); |
2038 | 2038 | $c = Database::num_rows($r); |
2039 | 2039 | if ($c > 0) { |
@@ -2058,7 +2058,7 @@ discard block |
||
2058 | 2058 | $sql = "SELECT * FROM $tbl_session WHERE id = $session_id"; |
2059 | 2059 | $result = Database::query($sql); |
2060 | 2060 | |
2061 | - if (Database::num_rows($result)>0) { |
|
2061 | + if (Database::num_rows($result) > 0) { |
|
2062 | 2062 | $data = Database::fetch_array($result, 'ASSOC'); |
2063 | 2063 | } |
2064 | 2064 | } |
@@ -2218,9 +2218,9 @@ discard block |
||
2218 | 2218 | */ |
2219 | 2219 | function api_get_session_image($session_id, $status_id) |
2220 | 2220 | { |
2221 | - $session_id = (int)$session_id; |
|
2221 | + $session_id = (int) $session_id; |
|
2222 | 2222 | $session_img = ''; |
2223 | - if ((int)$status_id != 5) { //check whether is not a student |
|
2223 | + if ((int) $status_id != 5) { //check whether is not a student |
|
2224 | 2224 | if ($session_id > 0) { |
2225 | 2225 | $session_img = " ".Display::return_icon( |
2226 | 2226 | 'star.png', |
@@ -2285,7 +2285,7 @@ discard block |
||
2285 | 2285 | $filename = api_get_path(SYS_PATH).api_get_home_path().'header_extra_content.txt'; |
2286 | 2286 | if (file_exists($filename)) { |
2287 | 2287 | $value = file_get_contents($filename); |
2288 | - return $value ; |
|
2288 | + return $value; |
|
2289 | 2289 | } else { |
2290 | 2290 | return ''; |
2291 | 2291 | } |
@@ -2294,7 +2294,7 @@ discard block |
||
2294 | 2294 | $filename = api_get_path(SYS_PATH).api_get_home_path().'footer_extra_content.txt'; |
2295 | 2295 | if (file_exists($filename)) { |
2296 | 2296 | $value = file_get_contents($filename); |
2297 | - return $value ; |
|
2297 | + return $value; |
|
2298 | 2298 | } else { |
2299 | 2299 | return ''; |
2300 | 2300 | } |
@@ -2488,7 +2488,7 @@ discard block |
||
2488 | 2488 | } |
2489 | 2489 | $group_id = api_get_group_id(); |
2490 | 2490 | $course_id = api_get_course_int_id(); |
2491 | - $course_code= api_get_course_id(); |
|
2491 | + $course_code = api_get_course_id(); |
|
2492 | 2492 | $session_id = api_get_session_id(); |
2493 | 2493 | |
2494 | 2494 | //Group (in course) |
@@ -2496,7 +2496,7 @@ discard block |
||
2496 | 2496 | $group_status = array(); |
2497 | 2497 | $is_subscribed = GroupManager::is_subscribed($user_id, $group_id); |
2498 | 2498 | if ($is_subscribed) { |
2499 | - $group_status = array('id'=> $group_id , 'status' => 'student'); |
|
2499 | + $group_status = array('id'=> $group_id, 'status' => 'student'); |
|
2500 | 2500 | $is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id); |
2501 | 2501 | if ($is_tutor) { |
2502 | 2502 | $group_status['status'] = 'tutor'; |
@@ -2530,7 +2530,7 @@ discard block |
||
2530 | 2530 | } |
2531 | 2531 | $status['session'] = $session_status; |
2532 | 2532 | |
2533 | - } elseif($course_id) { |
|
2533 | + } elseif ($course_id) { |
|
2534 | 2534 | //Course |
2535 | 2535 | $course_status = array(); |
2536 | 2536 | if ($course_id) { |
@@ -2538,7 +2538,7 @@ discard block |
||
2538 | 2538 | |
2539 | 2539 | if ($user_course_status) { |
2540 | 2540 | $course_status = array('id'=> $course_id); |
2541 | - switch($user_course_status) { |
|
2541 | + switch ($user_course_status) { |
|
2542 | 2542 | case 1: |
2543 | 2543 | $course_status['status'] = 'teacher'; |
2544 | 2544 | break; |
@@ -2568,7 +2568,7 @@ discard block |
||
2568 | 2568 | function api_is_course_session_coach($user_id, $courseId, $session_id) |
2569 | 2569 | { |
2570 | 2570 | $session_table = Database::get_main_table(TABLE_MAIN_SESSION); |
2571 | - $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2571 | + $session_rel_course_rel_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
2572 | 2572 | |
2573 | 2573 | $user_id = intval($user_id); |
2574 | 2574 | $session_id = intval($session_id); |
@@ -2642,7 +2642,7 @@ discard block |
||
2642 | 2642 | ORDER BY access_start_date, access_end_date, name"; |
2643 | 2643 | $result = Database::query($sql); |
2644 | 2644 | if (!empty($sessionIsCoach)) { |
2645 | - $sessionIsCoach = array_merge($sessionIsCoach , Database::store_result($result)); |
|
2645 | + $sessionIsCoach = array_merge($sessionIsCoach, Database::store_result($result)); |
|
2646 | 2646 | } else { |
2647 | 2647 | $sessionIsCoach = Database::store_result($result); |
2648 | 2648 | } |
@@ -2819,7 +2819,7 @@ discard block |
||
2819 | 2819 | return ''; |
2820 | 2820 | } |
2821 | 2821 | $sourceurl = substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')); |
2822 | - $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); |
|
2822 | + $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); |
|
2823 | 2823 | //showinframes doesn't handle student view anyway... |
2824 | 2824 | //return ''; |
2825 | 2825 | $is_framed = true; |
@@ -3219,7 +3219,7 @@ discard block |
||
3219 | 3219 | } |
3220 | 3220 | $content .= '<div class="well">'; |
3221 | 3221 | $content .= $form->returnForm(); |
3222 | - $content .='</div>'; |
|
3222 | + $content .= '</div>'; |
|
3223 | 3223 | if (api_is_cas_activated()) { |
3224 | 3224 | $content .= "</div>"; |
3225 | 3225 | } |
@@ -3269,7 +3269,7 @@ discard block |
||
3269 | 3269 | } |
3270 | 3270 | $msg .= '<div class="well">'; |
3271 | 3271 | $msg .= $form->return_form(); |
3272 | - $msg .='</div>'; |
|
3272 | + $msg .= '</div>'; |
|
3273 | 3273 | if (api_is_cas_activated()) { |
3274 | 3274 | $msg .= "</div>"; |
3275 | 3275 | } |
@@ -3306,7 +3306,7 @@ discard block |
||
3306 | 3306 | list ($last_post_date, $last_post_time) = explode(' ', $last_post_datetime); |
3307 | 3307 | list ($year, $month, $day) = explode('-', $last_post_date); |
3308 | 3308 | list ($hour, $min, $sec) = explode(':', $last_post_time); |
3309 | - return mktime((int)$hour, (int)$min, (int)$sec, (int)$month, (int)$day, (int)$year); |
|
3309 | + return mktime((int) $hour, (int) $min, (int) $sec, (int) $month, (int) $day, (int) $year); |
|
3310 | 3310 | } |
3311 | 3311 | |
3312 | 3312 | /** |
@@ -3786,7 +3786,7 @@ discard block |
||
3786 | 3786 | c_id = $course_id AND |
3787 | 3787 | tool = '$tool' |
3788 | 3788 | $session_condition "; |
3789 | - $rs = Database::query($sql); |
|
3789 | + $rs = Database::query($sql); |
|
3790 | 3790 | $list = array(); |
3791 | 3791 | if (Database::num_rows($rs) > 0) { |
3792 | 3792 | while ($row = Database::fetch_array($rs, 'ASSOC')) { |
@@ -3866,7 +3866,7 @@ discard block |
||
3866 | 3866 | tool = '$tool' AND |
3867 | 3867 | ref = $ref |
3868 | 3868 | $sessionCondition"; |
3869 | - $rs = Database::query($sql); |
|
3869 | + $rs = Database::query($sql); |
|
3870 | 3870 | $item_property_id = ''; |
3871 | 3871 | if (Database::num_rows($rs) > 0) { |
3872 | 3872 | $row = Database::fetch_array($rs); |
@@ -3927,7 +3927,7 @@ discard block |
||
3927 | 3927 | if ($result == false) { |
3928 | 3928 | $result = array(); |
3929 | 3929 | } else { |
3930 | - $result = Database::store_result($result,'ASSOC'); |
|
3930 | + $result = Database::store_result($result, 'ASSOC'); |
|
3931 | 3931 | } |
3932 | 3932 | |
3933 | 3933 | return $result; |
@@ -3979,7 +3979,7 @@ discard block |
||
3979 | 3979 | $rs = Database::query($sql); |
3980 | 3980 | $row = array(); |
3981 | 3981 | if (Database::num_rows($rs) > 0) { |
3982 | - $row = Database::fetch_array($rs,'ASSOC'); |
|
3982 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
3983 | 3983 | } |
3984 | 3984 | |
3985 | 3985 | return $row; |
@@ -4015,7 +4015,7 @@ discard block |
||
4015 | 4015 | $languages = $language_list['name']; |
4016 | 4016 | $folder = $language_list['folder']; |
4017 | 4017 | |
4018 | - $ret .= '<select name="' . $name . '" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4018 | + $ret .= '<select name="'.$name.'" id="language_chosen" class="selectpicker show-tick form-control">'; |
|
4019 | 4019 | foreach ($languages as $key => $value) { |
4020 | 4020 | if ($folder[$key] == $default) { |
4021 | 4021 | $selected = ' selected="selected"'; |
@@ -4068,8 +4068,8 @@ discard block |
||
4068 | 4068 | //--> |
4069 | 4069 | </script>'; |
4070 | 4070 | $html .= '<form id="lang_form" name="lang_form" method="post" action="'.api_get_self().'">'; |
4071 | - $html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>'; |
|
4072 | - $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4071 | + $html .= '<label style="display: none;" for="language_list">'.get_lang('Language').'</label>'; |
|
4072 | + $html .= '<select id="language_list" class="selectpicker show-tick form-control" name="language_list" >'; |
|
4073 | 4073 | |
4074 | 4074 | foreach ($original_languages as $key => $value) { |
4075 | 4075 | if ($folder[$key] == $user_selected_language) { |
@@ -4077,13 +4077,13 @@ discard block |
||
4077 | 4077 | } else { |
4078 | 4078 | $option_end = '>'; |
4079 | 4079 | } |
4080 | - $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4080 | + $html .= '<option value="'.api_get_self().'?language='.$folder[$key].'"'.$option_end; |
|
4081 | 4081 | //echo substr($value, 0, 16); // Cut string to keep 800x600 aspect. |
4082 | - $html .= $value.'</option>'; |
|
4082 | + $html .= $value.'</option>'; |
|
4083 | 4083 | } |
4084 | - $html .= '</select>'; |
|
4085 | - $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4086 | - $html .= '</form>'; |
|
4084 | + $html .= '</select>'; |
|
4085 | + $html .= '<noscript><input type="submit" name="user_select_language" value="'.get_lang('Ok').'" /></noscript>'; |
|
4086 | + $html .= '</form>'; |
|
4087 | 4087 | return $html; |
4088 | 4088 | } |
4089 | 4089 | |
@@ -4300,7 +4300,7 @@ discard block |
||
4300 | 4300 | * Note: Directory names (names of themes) in the file system should contain ASCII-characters only. |
4301 | 4301 | */ |
4302 | 4302 | function api_get_themes() { |
4303 | - $cssdir = api_get_path(SYS_CSS_PATH) . 'themes/'; |
|
4303 | + $cssdir = api_get_path(SYS_CSS_PATH).'themes/'; |
|
4304 | 4304 | $list_dir = array(); |
4305 | 4305 | $list_name = array(); |
4306 | 4306 | |
@@ -4477,7 +4477,7 @@ discard block |
||
4477 | 4477 | if (is_file($dirname) || is_link($dirname)) { |
4478 | 4478 | $res = unlink($dirname); |
4479 | 4479 | if ($res === false) { |
4480 | - 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); |
|
4480 | + 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); |
|
4481 | 4481 | } |
4482 | 4482 | return $res; |
4483 | 4483 | } |
@@ -4514,7 +4514,7 @@ discard block |
||
4514 | 4514 | if ($delete_only_content_in_folder == false) { |
4515 | 4515 | $res = rmdir($dirname); |
4516 | 4516 | if ($res === false) { |
4517 | - 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); |
|
4517 | + 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); |
|
4518 | 4518 | } |
4519 | 4519 | } |
4520 | 4520 | return $res; |
@@ -4599,7 +4599,7 @@ discard block |
||
4599 | 4599 | |
4600 | 4600 | $course_id = $course_info['real_id']; |
4601 | 4601 | |
4602 | - $folders = explode(DIRECTORY_SEPARATOR,str_replace($base_path_document.DIRECTORY_SEPARATOR,'',$pathname)); |
|
4602 | + $folders = explode(DIRECTORY_SEPARATOR, str_replace($base_path_document.DIRECTORY_SEPARATOR, '', $pathname)); |
|
4603 | 4603 | |
4604 | 4604 | $new_pathname = $base_path_document; |
4605 | 4605 | $path = ''; |
@@ -4617,7 +4617,7 @@ discard block |
||
4617 | 4617 | path = '$path' AND |
4618 | 4618 | filetype = 'folder' AND |
4619 | 4619 | session_id = '$session_id'"; |
4620 | - $rs1 = Database::query($sql); |
|
4620 | + $rs1 = Database::query($sql); |
|
4621 | 4621 | $num_rows = Database::num_rows($rs1); |
4622 | 4622 | |
4623 | 4623 | if ($num_rows == 0) { |
@@ -4777,7 +4777,7 @@ discard block |
||
4777 | 4777 | foreach (array('key', 'value1', 'value2', 'value3') as $var) { |
4778 | 4778 | $$var = isset($match[++$i]) ? $match[$i] : ''; |
4779 | 4779 | } |
4780 | - $value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3; |
|
4780 | + $value = stripslashes(substr($value1, 1, -1)).stripslashes(substr($value2, 1, -1)).$value3; |
|
4781 | 4781 | |
4782 | 4782 | // Parse array syntax. |
4783 | 4783 | $keys = preg_split('/\]?\[/', rtrim($key, ']')); |
@@ -4817,7 +4817,7 @@ discard block |
||
4817 | 4817 | */ |
4818 | 4818 | function api_get_version() { |
4819 | 4819 | global $_configuration; |
4820 | - return (string)$_configuration['system_version']; |
|
4820 | + return (string) $_configuration['system_version']; |
|
4821 | 4821 | } |
4822 | 4822 | |
4823 | 4823 | /** |
@@ -4944,7 +4944,7 @@ discard block |
||
4944 | 4944 | $t_settings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
4945 | 4945 | $var = Database::escape_string($var); |
4946 | 4946 | $value = Database::escape_string($value); |
4947 | - $access_url = (int)$access_url; |
|
4947 | + $access_url = (int) $access_url; |
|
4948 | 4948 | if (empty($access_url)) { $access_url = 1; } |
4949 | 4949 | $select = "SELECT id FROM $t_settings WHERE variable = '$var' "; |
4950 | 4950 | if (!empty($subvar)) { |
@@ -4965,7 +4965,7 @@ discard block |
||
4965 | 4965 | // Found item for this access_url. |
4966 | 4966 | $row = Database::fetch_array($res); |
4967 | 4967 | $sql = "UPDATE $t_settings SET selected_value = '$value' |
4968 | - WHERE id = ".$row['id'] ; |
|
4968 | + WHERE id = ".$row['id']; |
|
4969 | 4969 | Database::query($sql); |
4970 | 4970 | } else { |
4971 | 4971 | // Item not found for this access_url, we have to check if it exist with access_url = 1 |
@@ -4985,11 +4985,11 @@ discard block |
||
4985 | 4985 | $row = Database::fetch_array($res); |
4986 | 4986 | $insert = "INSERT INTO $t_settings (variable, subkey, type,category, selected_value, title, comment, scope, subkeytext, access_url) |
4987 | 4987 | VALUES |
4988 | - ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
4989 | - "'".$row['type']."','".$row['category']."'," . |
|
4990 | - "'$value','".$row['title']."'," . |
|
4991 | - "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
4992 | - "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)"; |
|
4988 | + ('".$row['variable']."',".(!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
4989 | + "'".$row['type']."','".$row['category']."',". |
|
4990 | + "'$value','".$row['title']."',". |
|
4991 | + "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
4992 | + "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url)"; |
|
4993 | 4993 | Database::query($insert); |
4994 | 4994 | } else { // Such a setting does not exist. |
4995 | 4995 | error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0); |
@@ -5009,16 +5009,16 @@ discard block |
||
5009 | 5009 | if ($row['access_url_changeable'] == 1) { |
5010 | 5010 | $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES |
5011 | 5011 | ('".$row['variable']."',". |
5012 | - (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL")."," . |
|
5013 | - "'".$row['type']."','".$row['category']."'," . |
|
5014 | - "'$value','".$row['title']."'," . |
|
5012 | + (!empty($row['subkey']) ? "'".$row['subkey']."'" : "NULL").",". |
|
5013 | + "'".$row['type']."','".$row['category']."',". |
|
5014 | + "'$value','".$row['title']."',". |
|
5015 | 5015 | "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",". |
5016 | - (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," . |
|
5016 | + (!empty($row['scope']) ? "'".$row['scope']."'" : "NULL").",". |
|
5017 | 5017 | "".(!empty($row['subkeytext']) ? "'".$row['subkeytext']."'" : "NULL").",$access_url,".$row['access_url_changeable'].")"; |
5018 | 5018 | Database::query($insert); |
5019 | 5019 | } |
5020 | 5020 | } else { // Such a setting does not exist. |
5021 | - error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0); |
|
5021 | + error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ', 0); |
|
5022 | 5022 | } |
5023 | 5023 | } |
5024 | 5024 | } |
@@ -5046,10 +5046,10 @@ discard block |
||
5046 | 5046 | $value = Database::escape_string($value); |
5047 | 5047 | $sql = "UPDATE $t_s SET selected_value = '$value' |
5048 | 5048 | WHERE category = '$category' AND access_url = $access_url"; |
5049 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5049 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5050 | 5050 | $sql .= " AND ( "; |
5051 | 5051 | $i = 0; |
5052 | - foreach ($fieldtype as $type){ |
|
5052 | + foreach ($fieldtype as $type) { |
|
5053 | 5053 | if ($i > 0) { |
5054 | 5054 | $sql .= ' OR '; |
5055 | 5055 | } |
@@ -5064,10 +5064,10 @@ discard block |
||
5064 | 5064 | } else { |
5065 | 5065 | $sql = "UPDATE $t_s SET selected_value = NULL |
5066 | 5066 | WHERE category = '$category' AND access_url = $access_url"; |
5067 | - if (is_array($fieldtype) && count($fieldtype)>0) { |
|
5067 | + if (is_array($fieldtype) && count($fieldtype) > 0) { |
|
5068 | 5068 | $sql .= " AND ( "; |
5069 | 5069 | $i = 0; |
5070 | - foreach ($fieldtype as $type){ |
|
5070 | + foreach ($fieldtype as $type) { |
|
5071 | 5071 | if ($i > 0) { |
5072 | 5072 | $sql .= ' OR '; |
5073 | 5073 | } |
@@ -5200,7 +5200,7 @@ discard block |
||
5200 | 5200 | $sql .= " ORDER BY 1,2 ASC"; |
5201 | 5201 | } |
5202 | 5202 | $result = Database::query($sql); |
5203 | - $result = Database::store_result($result,'ASSOC'); |
|
5203 | + $result = Database::store_result($result, 'ASSOC'); |
|
5204 | 5204 | return $result; |
5205 | 5205 | } |
5206 | 5206 | |
@@ -5213,7 +5213,7 @@ discard block |
||
5213 | 5213 | function & api_get_settings_categories($exceptions = array(), $access_url = 1) { |
5214 | 5214 | $access_url = (int) $access_url; |
5215 | 5215 | $t_cs = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT); |
5216 | - $list = "'".implode("','",$exceptions)."'"; |
|
5216 | + $list = "'".implode("','", $exceptions)."'"; |
|
5217 | 5217 | $sql = "SELECT DISTINCT category FROM $t_cs WHERE category is NOT NULL "; |
5218 | 5218 | if ($list != "'',''" && $list != "''" && !empty($list)) { |
5219 | 5219 | $sql .= " AND category NOT IN ($list) "; |
@@ -5325,12 +5325,12 @@ discard block |
||
5325 | 5325 | |
5326 | 5326 | // Item not found for this access_url, we have to check if the whole thing is missing |
5327 | 5327 | // (in which case we ignore the insert) or if there *is* a record but just for access_url = 1 |
5328 | - $insert = "INSERT INTO $t_settings " . |
|
5329 | - "(variable,selected_value," . |
|
5330 | - "type,category," . |
|
5331 | - "subkey,title," . |
|
5332 | - "comment,scope," . |
|
5333 | - "subkeytext,access_url,access_url_changeable)" . |
|
5328 | + $insert = "INSERT INTO $t_settings ". |
|
5329 | + "(variable,selected_value,". |
|
5330 | + "type,category,". |
|
5331 | + "subkey,title,". |
|
5332 | + "comment,scope,". |
|
5333 | + "subkeytext,access_url,access_url_changeable)". |
|
5334 | 5334 | " VALUES ('$var','$val',"; |
5335 | 5335 | if (isset($type)) { |
5336 | 5336 | $type = Database::escape_string($type); |
@@ -5496,7 +5496,7 @@ discard block |
||
5496 | 5496 | $result = Database::query($sql); |
5497 | 5497 | |
5498 | 5498 | //if ($row = Database::fetch_array($result)) { |
5499 | - if (Database::num_rows($result) > 0 ) { |
|
5499 | + if (Database::num_rows($result) > 0) { |
|
5500 | 5500 | $is_courseMember = true; |
5501 | 5501 | $is_courseTutor = true; |
5502 | 5502 | $is_courseCoach = true; |
@@ -5680,8 +5680,8 @@ discard block |
||
5680 | 5680 | { |
5681 | 5681 | $tbl_rel_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
5682 | 5682 | if (!empty($user_id) && !empty($courseId)) { |
5683 | - $user_id = intval($user_id); |
|
5684 | - $courseId = intval($courseId); |
|
5683 | + $user_id = intval($user_id); |
|
5684 | + $courseId = intval($courseId); |
|
5685 | 5685 | $sql = 'SELECT status |
5686 | 5686 | FROM '.$tbl_rel_course_user.' |
5687 | 5687 | WHERE user_id='.$user_id.' AND c_id = '.$courseId; |
@@ -5793,7 +5793,7 @@ discard block |
||
5793 | 5793 | } else { |
5794 | 5794 | return false; |
5795 | 5795 | } |
5796 | - return strtolower(substr((string)$os, 0, 3 )) == 'win'; |
|
5796 | + return strtolower(substr((string) $os, 0, 3)) == 'win'; |
|
5797 | 5797 | } |
5798 | 5798 | |
5799 | 5799 | /** |
@@ -6322,7 +6322,7 @@ discard block |
||
6322 | 6322 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6323 | 6323 | $libraries = array(); |
6324 | 6324 | if ($include_jqgrid) { |
6325 | - $libraries[]='jqgrid'; |
|
6325 | + $libraries[] = 'jqgrid'; |
|
6326 | 6326 | } |
6327 | 6327 | return api_get_jquery_libraries_js($libraries); |
6328 | 6328 | } |
@@ -6346,12 +6346,12 @@ discard block |
||
6346 | 6346 | |
6347 | 6347 | //jqgrid js and css |
6348 | 6348 | if (in_array('jqgrid', $libraries)) { |
6349 | - $languaje = 'en'; |
|
6349 | + $languaje = 'en'; |
|
6350 | 6350 | $platform_isocode = strtolower(api_get_language_isocode()); |
6351 | 6351 | |
6352 | 6352 | //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
6353 | 6353 | $jqgrid_langs = array( |
6354 | - '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' |
|
6354 | + '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' |
|
6355 | 6355 | ); |
6356 | 6356 | |
6357 | 6357 | if (in_array($platform_isocode, $jqgrid_langs)) { |
@@ -6382,7 +6382,7 @@ discard block |
||
6382 | 6382 | |
6383 | 6383 | // jquery datepicker |
6384 | 6384 | if (in_array('datepicker', $libraries)) { |
6385 | - $languaje = 'en-GB'; |
|
6385 | + $languaje = 'en-GB'; |
|
6386 | 6386 | $platform_isocode = strtolower(api_get_language_isocode()); |
6387 | 6387 | |
6388 | 6388 | // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n |
@@ -6548,7 +6548,7 @@ discard block |
||
6548 | 6548 | * @return void |
6549 | 6549 | */ |
6550 | 6550 | function api_check_php_version($my_inc_path = null) { |
6551 | - if (!function_exists('version_compare') || version_compare( phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6551 | + if (!function_exists('version_compare') || version_compare(phpversion(), REQUIRED_PHP_VERSION, '<')) { |
|
6552 | 6552 | $global_error_code = 1; |
6553 | 6553 | // Incorrect PHP version |
6554 | 6554 | $global_page = $my_inc_path.'global_error_message.inc.php'; |
@@ -6564,7 +6564,7 @@ discard block |
||
6564 | 6564 | */ |
6565 | 6565 | function api_check_archive_dir() { |
6566 | 6566 | if (is_dir(api_get_path(SYS_ARCHIVE_PATH)) && !is_writable(api_get_path(SYS_ARCHIVE_PATH))) { |
6567 | - $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'),'warning'); |
|
6567 | + $message = Display::return_message(get_lang('ArchivesDirectoryNotWriteableContactAdmin'), 'warning'); |
|
6568 | 6568 | api_not_allowed(true, $message); |
6569 | 6569 | } |
6570 | 6570 | } |
@@ -6629,7 +6629,7 @@ discard block |
||
6629 | 6629 | * @author Jorge Frisancho Jibaja <[email protected]>, USIL - Some changes to allow the use of real IP using reverse proxy |
6630 | 6630 | * @version CEV CHANGE 24APR2012 |
6631 | 6631 | */ |
6632 | -function api_get_real_ip(){ |
|
6632 | +function api_get_real_ip() { |
|
6633 | 6633 | // Guess the IP if behind a reverse proxy |
6634 | 6634 | global $debug; |
6635 | 6635 | $ip = trim($_SERVER['REMOTE_ADDR']); |
@@ -6655,23 +6655,23 @@ discard block |
||
6655 | 6655 | * @author Yannick Warnier for improvements and managment of multiple ranges |
6656 | 6656 | * @todo check for IPv6 support |
6657 | 6657 | */ |
6658 | -function api_check_ip_in_range($ip,$range) |
|
6658 | +function api_check_ip_in_range($ip, $range) |
|
6659 | 6659 | { |
6660 | 6660 | if (empty($ip) or empty($range)) { |
6661 | 6661 | return false; |
6662 | 6662 | } |
6663 | - $ip_ip = ip2long ($ip); |
|
6663 | + $ip_ip = ip2long($ip); |
|
6664 | 6664 | // divide range param into array of elements |
6665 | - if (strpos($range,',')!==false) { |
|
6666 | - $ranges = explode(',',$range); |
|
6665 | + if (strpos($range, ',') !== false) { |
|
6666 | + $ranges = explode(',', $range); |
|
6667 | 6667 | } else { |
6668 | 6668 | $ranges = array($range); |
6669 | 6669 | } |
6670 | 6670 | foreach ($ranges as $range) { |
6671 | 6671 | $range = trim($range); |
6672 | 6672 | if (empty($range)) { continue; } |
6673 | - if (strpos($range,'/')===false) { |
|
6674 | - if (strcmp($ip,$range)===0) { |
|
6673 | + if (strpos($range, '/') === false) { |
|
6674 | + if (strcmp($ip, $range) === 0) { |
|
6675 | 6675 | return true; // there is a direct IP match, return OK |
6676 | 6676 | } |
6677 | 6677 | continue; //otherwise, get to the next range |
@@ -6679,7 +6679,7 @@ discard block |
||
6679 | 6679 | // the range contains a "/", so analyse completely |
6680 | 6680 | list ($net, $mask) = explode("/", $range); |
6681 | 6681 | |
6682 | - $ip_net = ip2long ($net); |
|
6682 | + $ip_net = ip2long($net); |
|
6683 | 6683 | // mask binary magic |
6684 | 6684 | $ip_mask = ~((1 << (32 - $mask)) - 1); |
6685 | 6685 | |
@@ -7041,14 +7041,14 @@ discard block |
||
7041 | 7041 | * @assert (0) === true |
7042 | 7042 | * @assert ('1G') === true |
7043 | 7043 | */ |
7044 | -function api_set_memory_limit($mem){ |
|
7044 | +function api_set_memory_limit($mem) { |
|
7045 | 7045 | //if ini_set() not available, this function is useless |
7046 | 7046 | if (!function_exists('ini_set') || is_null($mem) || $mem == -1) { |
7047 | 7047 | return false; |
7048 | 7048 | } |
7049 | 7049 | |
7050 | 7050 | $memory_limit = ini_get('memory_limit'); |
7051 | - if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)){ |
|
7051 | + if (api_get_bytes_memory_limit($mem) > api_get_bytes_memory_limit($memory_limit)) { |
|
7052 | 7052 | ini_set('memory_limit', $mem); |
7053 | 7053 | return true; |
7054 | 7054 | } |
@@ -7065,21 +7065,21 @@ discard block |
||
7065 | 7065 | * @assert ('1m') === 1048576 |
7066 | 7066 | * @assert ('100k') === 102400 |
7067 | 7067 | */ |
7068 | -function api_get_bytes_memory_limit($mem){ |
|
7069 | - $size = strtolower(substr($mem,-1)); |
|
7068 | +function api_get_bytes_memory_limit($mem) { |
|
7069 | + $size = strtolower(substr($mem, -1)); |
|
7070 | 7070 | |
7071 | 7071 | switch ($size) { |
7072 | 7072 | case 't': |
7073 | - $mem = intval(substr($mem,-1))*1024*1024*1024*1024; |
|
7073 | + $mem = intval(substr($mem, -1)) * 1024 * 1024 * 1024 * 1024; |
|
7074 | 7074 | break; |
7075 | 7075 | case 'g': |
7076 | - $mem = intval(substr($mem,0,-1))*1024*1024*1024; |
|
7076 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024 * 1024; |
|
7077 | 7077 | break; |
7078 | 7078 | case 'm': |
7079 | - $mem = intval(substr($mem,0,-1))*1024*1024; |
|
7079 | + $mem = intval(substr($mem, 0, -1)) * 1024 * 1024; |
|
7080 | 7080 | break; |
7081 | 7081 | case 'k': |
7082 | - $mem = intval(substr($mem,0,-1))*1024; |
|
7082 | + $mem = intval(substr($mem, 0, -1)) * 1024; |
|
7083 | 7083 | break; |
7084 | 7084 | default: |
7085 | 7085 | // we assume it's integer only |
@@ -7133,7 +7133,7 @@ discard block |
||
7133 | 7133 | ); |
7134 | 7134 | |
7135 | 7135 | $js = api_get_asset('pwstrength-bootstrap/dist/pwstrength-bootstrap.min.js'); |
7136 | - $js .= "<script> |
|
7136 | + $js .= "<script> |
|
7137 | 7137 | var verdicts = ['".implode("','", $verdicts)."']; |
7138 | 7138 | var errorMessages = { |
7139 | 7139 | password_to_short : \"" . get_lang('PasswordIsTooShort')."\", |
@@ -7189,7 +7189,7 @@ discard block |
||
7189 | 7189 | return false; |
7190 | 7190 | } |
7191 | 7191 | $minutesToBlock = api_get_setting('captcha_time_to_block'); |
7192 | - $time = time() + $minutesToBlock*60; |
|
7192 | + $time = time() + $minutesToBlock * 60; |
|
7193 | 7193 | UserManager::update_extra_field_value( |
7194 | 7194 | $userInfo['user_id'], |
7195 | 7195 | 'captcha_blocked_until_date', |
@@ -7263,7 +7263,7 @@ discard block |
||
7263 | 7263 | $out_res = str_replace('"', "''", $out_res); |
7264 | 7264 | } |
7265 | 7265 | // avoid text stuck together when tags are removed, adding a space after > |
7266 | - $out_res = str_replace (">", "> ", $out_res); |
|
7266 | + $out_res = str_replace(">", "> ", $out_res); |
|
7267 | 7267 | $out_res = strip_tags($out_res); |
7268 | 7268 | |
7269 | 7269 | return $out_res; |
@@ -7376,12 +7376,12 @@ discard block |
||
7376 | 7376 | { |
7377 | 7377 | // Clean query |
7378 | 7378 | $bt = debug_backtrace(); |
7379 | - $caller = array_shift($bt);; |
|
7379 | + $caller = array_shift($bt); ; |
|
7380 | 7380 | if ($dump == 1) { |
7381 | 7381 | $string = print_r($string, 1); |
7382 | 7382 | } else { |
7383 | 7383 | $string = str_replace(array("\r", "\n", "\t", "\10"), '', $string); |
7384 | - $string = str_replace(' ',' ', $string); |
|
7384 | + $string = str_replace(' ', ' ', $string); |
|
7385 | 7385 | } |
7386 | 7386 | |
7387 | 7387 | error_log("-------------------------------------"); |
@@ -7491,7 +7491,7 @@ discard block |
||
7491 | 7491 | $body = get_lang('PortalName').': '.api_get_path(WEB_PATH)." \n "; |
7492 | 7492 | $body .= get_lang('PortalLimitType').': '.$limitName." \n "; |
7493 | 7493 | if (isset($hostingParams[$limitName])) { |
7494 | - $body .= get_lang('Value') . ': ' . $hostingParams[$limitName]; |
|
7494 | + $body .= get_lang('Value').': '.$hostingParams[$limitName]; |
|
7495 | 7495 | } |
7496 | 7496 | api_mail_html(null, $email, $subject, $body); |
7497 | 7497 | } |
@@ -7623,7 +7623,7 @@ discard block |
||
7623 | 7623 | */ |
7624 | 7624 | function api_set_site_use_cookie_warning_cookie() |
7625 | 7625 | { |
7626 | - setcookie("ChamiloUsesCookies", "ok", time()+31556926); |
|
7626 | + setcookie("ChamiloUsesCookies", "ok", time() + 31556926); |
|
7627 | 7627 | } |
7628 | 7628 | |
7629 | 7629 | /** |
@@ -7671,10 +7671,10 @@ discard block |
||
7671 | 7671 | return false; |
7672 | 7672 | } |
7673 | 7673 | |
7674 | - $fullPath = $parentDirectory . api_replace_dangerous_char($name); |
|
7674 | + $fullPath = $parentDirectory.api_replace_dangerous_char($name); |
|
7675 | 7675 | |
7676 | 7676 | if (mkdir($fullPath, api_get_permissions_for_new_directories(), true)) { |
7677 | - $fp = fopen($fullPath . '/index.html', 'w'); |
|
7677 | + $fp = fopen($fullPath.'/index.html', 'w'); |
|
7678 | 7678 | |
7679 | 7679 | if ($fp) { |
7680 | 7680 | if (fwrite($fp, '<html><head></head><body></body></html>')) { |
@@ -7739,7 +7739,7 @@ discard block |
||
7739 | 7739 | $mail->SMTPSecure = $platform_email['SMTP_SECURE']; |
7740 | 7740 | } |
7741 | 7741 | } |
7742 | - $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG'])?$platform_email['SMTP_DEBUG']:0; |
|
7742 | + $mail->SMTPDebug = isset($platform_email['SMTP_DEBUG']) ? $platform_email['SMTP_DEBUG'] : 0; |
|
7743 | 7743 | |
7744 | 7744 | // 5 = low, 1 = high |
7745 | 7745 | $mail->Priority = 3; |
@@ -7891,11 +7891,11 @@ discard block |
||
7891 | 7891 | error_log('ERROR: mail not sent to '.$recipient_name.' ('.$recipient_email.') because of '.$mail->ErrorInfo.'<br />'); |
7892 | 7892 | if ($mail->SMTPDebug) { |
7893 | 7893 | error_log( |
7894 | - "Connection details :: " . |
|
7895 | - "Protocol: " . $mail->Mailer . ' :: ' . |
|
7896 | - "Host/Port: " . $mail->Host . ':' . $mail->Port . ' :: ' . |
|
7897 | - "Authent/Open: " . ($mail->SMTPAuth?'Authent':'Open') . ' :: ' . |
|
7898 | - ($mail->SMTPAuth?" User/Pass: " . $mail->Username . ':' . $mail->Password:'') |
|
7894 | + "Connection details :: ". |
|
7895 | + "Protocol: ".$mail->Mailer.' :: '. |
|
7896 | + "Host/Port: ".$mail->Host.':'.$mail->Port.' :: '. |
|
7897 | + "Authent/Open: ".($mail->SMTPAuth ? 'Authent' : 'Open').' :: '. |
|
7898 | + ($mail->SMTPAuth ? " User/Pass: ".$mail->Username.':'.$mail->Password : '') |
|
7899 | 7899 | ); |
7900 | 7900 | } |
7901 | 7901 | return 0; |
@@ -7966,13 +7966,13 @@ discard block |
||
7966 | 7966 | * @return array |
7967 | 7967 | * |
7968 | 7968 | */ |
7969 | -function api_unique_multidim_array($array, $key){ |
|
7969 | +function api_unique_multidim_array($array, $key) { |
|
7970 | 7970 | $temp_array = []; |
7971 | 7971 | $i = 0; |
7972 | 7972 | $key_array = []; |
7973 | 7973 | |
7974 | - foreach($array as $val){ |
|
7975 | - if(!in_array($val[$key],$key_array)){ |
|
7974 | + foreach ($array as $val) { |
|
7975 | + if (!in_array($val[$key], $key_array)) { |
|
7976 | 7976 | $key_array[$i] = $val[$key]; |
7977 | 7977 | $temp_array[$i] = $val; |
7978 | 7978 | } |
@@ -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"); |