@@ -80,7 +80,7 @@ |
||
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Validates the received active connection data with the database |
83 | - * @return bool Return the loginFailed variable value to local.inc.php |
|
83 | + * @return null|false Return the loginFailed variable value to local.inc.php |
|
84 | 84 | */ |
85 | 85 | public function check_user() |
86 | 86 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() |
36 | 36 | { |
37 | - $this->protocol = api_get_setting('sso_authentication_protocol'); |
|
37 | + $this->protocol = api_get_setting('sso_authentication_protocol'); |
|
38 | 38 | // There can be multiple domains, so make sure to take only the first |
39 | 39 | // This might be later extended with a decision process |
40 | 40 | $domains = explode(',', api_get_setting('sso_authentication_domain')); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $this->auth_uri = api_get_setting('sso_authentication_auth_uri'); |
43 | 43 | $this->deauth_uri = api_get_setting('sso_authentication_unauth_uri'); |
44 | 44 | //cut the string to avoid recursive URL construction in case of failure |
45 | - $this->referer = $this->protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'],0,strpos($_SERVER['REQUEST_URI'],'sso')); |
|
45 | + $this->referer = $this->protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'sso')); |
|
46 | 46 | $this->deauth_url = $this->protocol.$this->domain.$this->deauth_uri; |
47 | 47 | $this->master_url = $this->protocol.$this->domain.$this->auth_uri; |
48 | 48 | $this->referrer_uri = base64_encode($_SERVER['REQUEST_URI']); |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | ) { |
131 | 131 | //error_log('user n password are ok'); |
132 | 132 | //Check if the account is active (not locked) |
133 | - if ($uData['active']=='1') { |
|
133 | + if ($uData['active'] == '1') { |
|
134 | 134 | // check if the expiration date has not been reached |
135 | 135 | if (empty($uData['expiration_date']) |
136 | 136 | or $uData['expiration_date'] > date('Y-m-d H:i:s') |
137 | - or $uData['expiration_date']=='0000-00-00 00:00:00') { |
|
137 | + or $uData['expiration_date'] == '0000-00-00 00:00:00') { |
|
138 | 138 | |
139 | 139 | //If Multiple URL is enabled |
140 | 140 | if (api_get_multiple_access_url()) { |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | // the user credentials are OK, which |
169 | 169 | // should be protection enough |
170 | 170 | // against evil URL spoofing... |
171 | - $sso_target = api_get_path(WEB_PATH) . base64_decode($sso['ruri']); |
|
171 | + $sso_target = api_get_path(WEB_PATH).base64_decode($sso['ruri']); |
|
172 | 172 | } else { |
173 | - $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) . 'index.php'; |
|
173 | + $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH).'index.php'; |
|
174 | 174 | } |
175 | - header('Location: '. $sso_target); |
|
175 | + header('Location: '.$sso_target); |
|
176 | 176 | exit; |
177 | 177 | } else { |
178 | 178 | // user does not have permission for this site |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | $userId = intval($userId); |
287 | 287 | |
288 | 288 | if ($asAdmin && api_is_platform_admin(true)) { |
289 | - return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$userId"; |
|
289 | + return api_get_path(WEB_CODE_PATH)."admin/user_edit.php?user_id=$userId"; |
|
290 | 290 | } |
291 | 291 | |
292 | - return api_get_path(WEB_CODE_PATH) . 'auth/profile.php'; |
|
292 | + return api_get_path(WEB_CODE_PATH).'auth/profile.php'; |
|
293 | 293 | } |
294 | 294 | } |
@@ -173,7 +173,7 @@ |
||
173 | 173 | |
174 | 174 | /** |
175 | 175 | * @param array $file |
176 | - * @return bool|string |
|
176 | + * @return string|false |
|
177 | 177 | */ |
178 | 178 | public static function import_uploaded_file($file) |
179 | 179 | { |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | while (($file = readdir($handle)) !== false) { |
24 | 24 | if ($file != "." && $file != ".." && |
25 | 25 | strpos($file, 'CourseArchiver_') === 0 && |
26 | - is_dir($dir . '/' . $file) |
|
26 | + is_dir($dir.'/'.$file) |
|
27 | 27 | ) { |
28 | - rmdirr($dir . '/' . $file); |
|
28 | + rmdirr($dir.'/'.$file); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | closedir($handle); |
@@ -43,48 +43,48 @@ discard block |
||
43 | 43 | CourseArchiver::clean_backup_dir(); |
44 | 44 | |
45 | 45 | // Create a temp directory |
46 | - $tmp_dir_name = 'CourseArchiver_' . api_get_unique_id(); |
|
47 | - $backup_dir = api_get_path(SYS_ARCHIVE_PATH) . $tmp_dir_name . '/'; |
|
46 | + $tmp_dir_name = 'CourseArchiver_'.api_get_unique_id(); |
|
47 | + $backup_dir = api_get_path(SYS_ARCHIVE_PATH).$tmp_dir_name.'/'; |
|
48 | 48 | |
49 | 49 | // All course-information will be stored in course_info.dat |
50 | - $course_info_file = $backup_dir . 'course_info.dat'; |
|
50 | + $course_info_file = $backup_dir.'course_info.dat'; |
|
51 | 51 | $zip_dir = api_get_path(SYS_ARCHIVE_PATH); |
52 | 52 | $user = api_get_user_info(); |
53 | 53 | $date = new DateTime(api_get_local_time()); |
54 | - $zip_file = $user['user_id'] . '_' . $course->code . '_' . $date->format('Ymd-His') . '.zip'; |
|
54 | + $zip_file = $user['user_id'].'_'.$course->code.'_'.$date->format('Ymd-His').'.zip'; |
|
55 | 55 | $php_errormsg = ''; |
56 | 56 | $res = @mkdir($backup_dir, $perm_dirs); |
57 | 57 | if ($res === false) { |
58 | 58 | //TODO set and handle an error message telling the user to review the permissions on the archive directory |
59 | - error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini') . ' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0); |
|
59 | + error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini').' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0); |
|
60 | 60 | } |
61 | 61 | // Write the course-object to the file |
62 | 62 | $fp = @fopen($course_info_file, 'w'); |
63 | 63 | if ($fp === false) { |
64 | - error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
64 | + error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $res = @fwrite($fp, base64_encode(serialize($course))); |
68 | 68 | if ($res === false) { |
69 | - error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
69 | + error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $res = @fclose($fp); |
73 | 73 | if ($res === false) { |
74 | - error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
74 | + error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // Copy all documents to the temp-dir |
78 | 78 | if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) { |
79 | 79 | foreach ($course->resources[RESOURCE_DOCUMENT] as $document) { |
80 | 80 | if ($document->file_type == DOCUMENT) { |
81 | - $doc_dir = $backup_dir . $document->path; |
|
81 | + $doc_dir = $backup_dir.$document->path; |
|
82 | 82 | @mkdir(dirname($doc_dir), $perm_dirs, true); |
83 | - if (file_exists($course->path . $document->path)) { |
|
84 | - copy($course->path . $document->path, $doc_dir); |
|
83 | + if (file_exists($course->path.$document->path)) { |
|
84 | + copy($course->path.$document->path, $doc_dir); |
|
85 | 85 | } |
86 | 86 | } else { |
87 | - @mkdir($backup_dir . $document->path, $perm_dirs, true); |
|
87 | + @mkdir($backup_dir.$document->path, $perm_dirs, true); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | } |
@@ -92,49 +92,49 @@ discard block |
||
92 | 92 | // Copy all scorm documents to the temp-dir |
93 | 93 | if (isset($course->resources[RESOURCE_SCORM]) && is_array($course->resources[RESOURCE_SCORM])) { |
94 | 94 | foreach ($course->resources[RESOURCE_SCORM] as $document) { |
95 | - $doc_dir = dirname($backup_dir . $document->path); |
|
95 | + $doc_dir = dirname($backup_dir.$document->path); |
|
96 | 96 | @mkdir($doc_dir, $perm_dirs, true); |
97 | - copyDirTo($course->path . $document->path, $doc_dir, false); |
|
97 | + copyDirTo($course->path.$document->path, $doc_dir, false); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | 101 | // Copy calendar attachments. |
102 | 102 | |
103 | 103 | if (isset($course->resources[RESOURCE_EVENT]) && is_array($course->resources[RESOURCE_EVENT])) { |
104 | - $doc_dir = dirname($backup_dir . '/upload/calendar/'); |
|
104 | + $doc_dir = dirname($backup_dir.'/upload/calendar/'); |
|
105 | 105 | @mkdir($doc_dir, $perm_dirs, true); |
106 | - copyDirTo($course->path . 'upload/calendar/', $doc_dir, false); |
|
106 | + copyDirTo($course->path.'upload/calendar/', $doc_dir, false); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | // Copy Learning path author image. |
110 | 110 | if (isset($course->resources[RESOURCE_LEARNPATH]) && is_array($course->resources[RESOURCE_LEARNPATH])) { |
111 | - $doc_dir = dirname($backup_dir . '/upload/learning_path/'); |
|
111 | + $doc_dir = dirname($backup_dir.'/upload/learning_path/'); |
|
112 | 112 | @mkdir($doc_dir, $perm_dirs, true); |
113 | - copyDirTo($course->path . 'upload/learning_path/', $doc_dir, false); |
|
113 | + copyDirTo($course->path.'upload/learning_path/', $doc_dir, false); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // Copy announcements attachments. |
117 | 117 | if (isset($course->resources[RESOURCE_ANNOUNCEMENT]) && is_array($course->resources[RESOURCE_ANNOUNCEMENT])) { |
118 | - $doc_dir = dirname($backup_dir . '/upload/announcements/'); |
|
118 | + $doc_dir = dirname($backup_dir.'/upload/announcements/'); |
|
119 | 119 | @mkdir($doc_dir, $perm_dirs, true); |
120 | - copyDirTo($course->path . 'upload/announcements/', $doc_dir, false); |
|
120 | + copyDirTo($course->path.'upload/announcements/', $doc_dir, false); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // Copy work folders (only folders) |
124 | 124 | if (isset($course->resources[RESOURCE_WORK]) && is_array($course->resources[RESOURCE_WORK])) { |
125 | - $doc_dir = dirname($backup_dir . '/upload/work/'); |
|
125 | + $doc_dir = dirname($backup_dir.'/upload/work/'); |
|
126 | 126 | @mkdir($doc_dir, $perm_dirs, true); |
127 | 127 | // @todo: adjust to only create subdirs, but not copy files |
128 | - copyDirTo($course->path . 'upload/work/', $doc_dir, false); |
|
128 | + copyDirTo($course->path.'upload/work/', $doc_dir, false); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | // Zip the course-contents |
132 | - $zip = new PclZip($zip_dir . $zip_file); |
|
133 | - $zip->create($zip_dir . $tmp_dir_name, PCLZIP_OPT_REMOVE_PATH, $zip_dir . $tmp_dir_name . '/'); |
|
132 | + $zip = new PclZip($zip_dir.$zip_file); |
|
133 | + $zip->create($zip_dir.$tmp_dir_name, PCLZIP_OPT_REMOVE_PATH, $zip_dir.$tmp_dir_name.'/'); |
|
134 | 134 | //$zip->deleteByIndex(0); |
135 | 135 | // Remove the temp-dir. |
136 | 136 | rmdirr($backup_dir); |
137 | - return '' . $zip_file; |
|
137 | + return ''.$zip_file; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | global $dateTimeFormatLong; |
147 | 147 | $backup_files = array(); |
148 | - $dirname = api_get_path(SYS_ARCHIVE_PATH) . ''; |
|
148 | + $dirname = api_get_path(SYS_ARCHIVE_PATH).''; |
|
149 | 149 | if ($dir = opendir($dirname)) { |
150 | 150 | while (($file = readdir($dir)) !== false) { |
151 | 151 | $file_parts = explode('_', $file); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $date = $file_parts[0]; |
157 | 157 | $ext = isset($file_parts[1]) ? $file_parts[1] : null; |
158 | 158 | if ($ext == 'zip' && ($user_id != null && $owner_id == $user_id || $user_id == null)) { |
159 | - $date = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2) . ' ' . substr($date, 9, 2) . ':' . substr($date, 11, 2) . ':' . substr($date, 13, 2); |
|
159 | + $date = substr($date, 0, 4).'-'.substr($date, 4, 2).'-'.substr($date, 6, 2).' '.substr($date, 9, 2).':'.substr($date, 11, 2).':'.substr($date, 13, 2); |
|
160 | 160 | $backup_files[] = array( |
161 | 161 | 'file' => $file, |
162 | 162 | 'date' => $date, |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public static function import_uploaded_file($file) |
179 | 179 | { |
180 | - $new_filename = uniqid('') . '.zip'; |
|
180 | + $new_filename = uniqid('').'.zip'; |
|
181 | 181 | $new_dir = api_get_path(SYS_ARCHIVE_PATH); |
182 | 182 | if (is_dir($new_dir) && is_writable($new_dir)) { |
183 | 183 | move_uploaded_file($file, api_get_path(SYS_ARCHIVE_PATH).$new_filename); |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | { |
201 | 201 | CourseArchiver::clean_backup_dir(); |
202 | 202 | // Create a temp directory |
203 | - $tmp_dir_name = 'CourseArchiver_' . uniqid(''); |
|
204 | - $unzip_dir = api_get_path(SYS_ARCHIVE_PATH) . '' . $tmp_dir_name; |
|
203 | + $tmp_dir_name = 'CourseArchiver_'.uniqid(''); |
|
204 | + $unzip_dir = api_get_path(SYS_ARCHIVE_PATH).''.$tmp_dir_name; |
|
205 | 205 | @mkdir($unzip_dir, api_get_permissions_for_new_directories(), true); |
206 | - @copy(api_get_path(SYS_ARCHIVE_PATH) . '' . $filename, $unzip_dir . '/backup.zip'); |
|
206 | + @copy(api_get_path(SYS_ARCHIVE_PATH).''.$filename, $unzip_dir.'/backup.zip'); |
|
207 | 207 | // unzip the archive |
208 | - $zip = new PclZip($unzip_dir . '/backup.zip'); |
|
208 | + $zip = new PclZip($unzip_dir.'/backup.zip'); |
|
209 | 209 | @chdir($unzip_dir); |
210 | 210 | $zip->extract(PCLZIP_OPT_TEMP_FILE_ON); |
211 | 211 | // remove the archive-file |
212 | 212 | if ($delete) { |
213 | - @unlink(api_get_path(SYS_ARCHIVE_PATH) . '' . $filename); |
|
213 | + @unlink(api_get_path(SYS_ARCHIVE_PATH).''.$filename); |
|
214 | 214 | } |
215 | 215 | // read the course |
216 | 216 | if (!is_file('course_info.dat')) { |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * course |
35 | 35 | * @param string $type 'full_backup' or 'select_items' |
36 | 36 | * |
37 | - * @return bool |
|
37 | + * @return false|null |
|
38 | 38 | * |
39 | 39 | * @assert (null) === false |
40 | 40 | */ |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public function recycle_glossary() |
161 | 161 | { |
162 | 162 | if ($this->course->has_resources(RESOURCE_GLOSSARY)) { |
163 | - $table_glossary = Database::get_course_table(TABLE_GLOSSARY); |
|
163 | + $table_glossary = Database::get_course_table(TABLE_GLOSSARY); |
|
164 | 164 | $ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_GLOSSARY]))); |
165 | 165 | if (!empty($ids)) { |
166 | 166 | $sql = "DELETE FROM ".$table_glossary." |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | if (trim($learnpath->path) != '') { |
557 | 557 | // when $learnpath->path value is incorrect for some reason. |
558 | 558 | // The directory trat contains files of the SCORM package is to be deleted. |
559 | - $scorm_package_dir = realpath($this->course->path . 'scorm/' . $learnpath->path); |
|
559 | + $scorm_package_dir = realpath($this->course->path.'scorm/'.$learnpath->path); |
|
560 | 560 | rmdirr($scorm_package_dir); |
561 | 561 | } |
562 | 562 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | foreach ($resources[RESOURCE_THEMATIC] as $last_id => $thematic) { |
633 | 633 | if (is_numeric($last_id)) { |
634 | 634 | |
635 | - foreach($thematic->thematic_advance_list as $thematic_advance) { |
|
635 | + foreach ($thematic->thematic_advance_list as $thematic_advance) { |
|
636 | 636 | $cond = array( |
637 | 637 | 'id = ? AND c_id = ?' => array( |
638 | 638 | $thematic_advance['id'], |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | Database::delete($table_thematic_advance, $cond); |
650 | 650 | } |
651 | 651 | |
652 | - foreach($thematic->thematic_plan_list as $thematic_plan) { |
|
652 | + foreach ($thematic->thematic_plan_list as $thematic_plan) { |
|
653 | 653 | $cond = array( |
654 | 654 | 'id = ? AND c_id = ?' => array( |
655 | 655 | $thematic_plan['id'], |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | 'ThematicDeleted', |
679 | 679 | api_get_user_id() |
680 | 680 | ); |
681 | - Database::delete($table_thematic,$cond); |
|
681 | + Database::delete($table_thematic, $cond); |
|
682 | 682 | } |
683 | 683 | } |
684 | 684 | } |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | $resources = $this->course->resources; |
697 | 697 | foreach ($resources[RESOURCE_ATTENDANCE] as $last_id => $obj) { |
698 | 698 | if (is_numeric($last_id)) { |
699 | - foreach($obj->attendance_calendar as $attendance_calendar) { |
|
699 | + foreach ($obj->attendance_calendar as $attendance_calendar) { |
|
700 | 700 | $cond = array('id = ? AND c_id = ? '=>array($attendance_calendar['id'], $this->course_id)); |
701 | 701 | Database::delete($table_attendance_calendar, $cond); |
702 | 702 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | public function recycle_work($session_id = 0) |
721 | 721 | { |
722 | 722 | if ($this->course->has_resources(RESOURCE_WORK)) { |
723 | - $table_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); |
|
723 | + $table_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); |
|
724 | 724 | $table_work_assignment = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT); |
725 | 725 | |
726 | 726 | $resources = $this->course->resources; |
@@ -47,6 +47,9 @@ |
||
47 | 47 | |
48 | 48 | /* FUNCTIONS */ |
49 | 49 | |
50 | +/** |
|
51 | + * @param string $name |
|
52 | + */ |
|
50 | 53 | function make_select_session_list($name, $sessions, $attr = array()) |
51 | 54 | { |
52 | 55 | $attributes = ''; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | $cidReset = true; |
13 | 13 | require_once '../inc/global.inc.php'; |
14 | -$current_course_tool = TOOL_COURSE_MAINTENANCE; |
|
14 | +$current_course_tool = TOOL_COURSE_MAINTENANCE; |
|
15 | 15 | |
16 | 16 | api_protect_global_admin_script(); |
17 | 17 | api_protect_limit_for_session_admin(); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | function display_form() |
84 | 84 | { |
85 | - $html = ''; |
|
85 | + $html = ''; |
|
86 | 86 | $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC')); |
87 | 87 | |
88 | 88 | // Actions |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | //destination |
111 | 111 | $html .= '<div class="form-group">'; |
112 | - $html .= '<label class="col-sm-2 control-label">' . get_lang('DestinationCoursesFromSession') . ': </label>'; |
|
112 | + $html .= '<label class="col-sm-2 control-label">'.get_lang('DestinationCoursesFromSession').': </label>'; |
|
113 | 113 | $html .= '<div class="col-sm-5" id="ajax_sessions_list_destination">'; |
114 | 114 | $html .= '<select class="form-control" name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">'; |
115 | 115 | $html .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option></select ></div>'; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;"><em class="fa fa-files-o"></em> '.get_lang('CopyCourse').'</button>'; |
132 | 132 | |
133 | 133 | // Add Security token |
134 | - $html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">'; |
|
134 | + $html .= '<input type="hidden" value="'.Security::get_token().'" name="sec_token">'; |
|
135 | 135 | $html .= '</div></div>'; |
136 | 136 | |
137 | 137 | $html .= '</form>'; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | /* HTML head extra */ |
231 | 231 | |
232 | -$htmlHeadXtra[] = $xajax->getJavascript( api_get_path(WEB_LIBRARY_PATH).'xajax/'); |
|
232 | +$htmlHeadXtra[] = $xajax->getJavascript(api_get_path(WEB_LIBRARY_PATH).'xajax/'); |
|
233 | 233 | $htmlHeadXtra[] = '<script type="text/javascript"> |
234 | 234 | function checkSelected(id_select,id_radio,id_title,id_destination) { |
235 | 235 | var num=0; |
@@ -299,22 +299,22 @@ discard block |
||
299 | 299 | display_form(); |
300 | 300 | } else { |
301 | 301 | |
302 | - $arr_course_origin = array(); |
|
302 | + $arr_course_origin = array(); |
|
303 | 303 | $arr_course_destination = array(); |
304 | - $destination_session = ''; |
|
305 | - $origin_session = ''; |
|
304 | + $destination_session = ''; |
|
305 | + $origin_session = ''; |
|
306 | 306 | |
307 | 307 | if (isset($_POST['SessionCoursesListOrigin'])) { |
308 | - $arr_course_origin = $_POST['SessionCoursesListOrigin']; |
|
308 | + $arr_course_origin = $_POST['SessionCoursesListOrigin']; |
|
309 | 309 | } |
310 | 310 | if (isset($_POST['SessionCoursesListDestination'])) { |
311 | 311 | $arr_course_destination = $_POST['SessionCoursesListDestination']; |
312 | 312 | } |
313 | 313 | if (isset($_POST['sessions_list_destination'])) { |
314 | - $destination_session = $_POST['sessions_list_destination']; |
|
314 | + $destination_session = $_POST['sessions_list_destination']; |
|
315 | 315 | } |
316 | 316 | if (isset($_POST['sessions_list_origin'])) { |
317 | - $origin_session = $_POST['sessions_list_origin']; |
|
317 | + $origin_session = $_POST['sessions_list_origin']; |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | if ((is_array($arr_course_origin) && count($arr_course_origin) > 0) && !empty($destination_session)) { |
@@ -354,22 +354,22 @@ discard block |
||
354 | 354 | Display::display_normal_message(get_lang('ToExportDocumentsWithGlossaryYouHaveToSelectGlossary')); |
355 | 355 | } |
356 | 356 | |
357 | - $arr_course_origin = array(); |
|
357 | + $arr_course_origin = array(); |
|
358 | 358 | $arr_course_destination = array(); |
359 | - $destination_session = ''; |
|
360 | - $origin_session = ''; |
|
359 | + $destination_session = ''; |
|
360 | + $origin_session = ''; |
|
361 | 361 | |
362 | 362 | if (isset($_POST['SessionCoursesListOrigin'])) { |
363 | - $arr_course_origin = $_POST['SessionCoursesListOrigin']; |
|
363 | + $arr_course_origin = $_POST['SessionCoursesListOrigin']; |
|
364 | 364 | } |
365 | 365 | if (isset($_POST['SessionCoursesListDestination'])) { |
366 | 366 | $arr_course_destination = $_POST['SessionCoursesListDestination']; |
367 | 367 | } |
368 | 368 | if (isset($_POST['sessions_list_destination'])) { |
369 | - $destination_session = $_POST['sessions_list_destination']; |
|
369 | + $destination_session = $_POST['sessions_list_destination']; |
|
370 | 370 | } |
371 | 371 | if (isset($_POST['sessions_list_origin'])) { |
372 | - $origin_session = $_POST['sessions_list_origin']; |
|
372 | + $origin_session = $_POST['sessions_list_origin']; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | if ((is_array($arr_course_origin) && count($arr_course_origin) > 0) && !empty($destination_session)) { |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | $cb = new CourseBuilder('', $course_origin); |
379 | 379 | $course = $cb->build($origin_session, $arr_course_origin[0], $with_base_content); |
380 | 380 | //$hiddenFields['same_file_name_option'] = $_POST['same_file_name_option']; |
381 | - $hiddenFields['destination_course'] = $arr_course_destination[0]; |
|
382 | - $hiddenFields['origin_course'] = $arr_course_origin[0]; |
|
383 | - $hiddenFields['destination_session'] = $destination_session; |
|
384 | - $hiddenFields['origin_session'] = $origin_session; |
|
381 | + $hiddenFields['destination_course'] = $arr_course_destination[0]; |
|
382 | + $hiddenFields['origin_course'] = $arr_course_origin[0]; |
|
383 | + $hiddenFields['destination_session'] = $destination_session; |
|
384 | + $hiddenFields['origin_session'] = $origin_session; |
|
385 | 385 | // Add token to Course select form |
386 | 386 | $hiddenFields['sec_token'] = Security::get_token(); |
387 | 387 |
@@ -327,7 +327,7 @@ |
||
327 | 327 | * @param array $arr1 first array |
328 | 328 | * @param array $arr2 second array |
329 | 329 | * |
330 | - * @return array difference between the two arrays |
|
330 | + * @return string difference between the two arrays |
|
331 | 331 | */ |
332 | 332 | function diff($arr1, $arr2) |
333 | 333 | { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | // A student should not be able to download a root shared directory |
53 | 53 | if (($path == '/shared_folder' || |
54 | - $path == '/shared_folder_session_' . api_get_session_id()) && |
|
54 | + $path == '/shared_folder_session_'.api_get_session_id()) && |
|
55 | 55 | (!api_is_allowed_to_edit() || !api_is_platform_admin()) |
56 | 56 | ) { |
57 | 57 | api_not_allowed(true); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | (props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND |
150 | 150 | docs.c_id = ".$courseId." "; |
151 | 151 | |
152 | - $sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId); |
|
152 | + $sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId); |
|
153 | 153 | |
154 | 154 | $result = Database::query($sql); |
155 | 155 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $groupCondition |
215 | 215 | "; |
216 | 216 | |
217 | - $sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId); |
|
217 | + $sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId); |
|
218 | 218 | $result = Database::query($sql); |
219 | 219 | |
220 | 220 | $files = array(); |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | // Add all files in our final array to the zipfile |
295 | 295 | for ($i = 0; $i < count($files_for_zipfile); $i++) { |
296 | 296 | $zip->add( |
297 | - $sysCoursePath . $courseInfo['path'] . '/document' . $files_for_zipfile[$i], |
|
297 | + $sysCoursePath.$courseInfo['path'].'/document'.$files_for_zipfile[$i], |
|
298 | 298 | PCLZIP_OPT_REMOVE_PATH, |
299 | - $sysCoursePath . $courseInfo['path'] . '/document' . $remove_dir, |
|
299 | + $sysCoursePath.$courseInfo['path'].'/document'.$remove_dir, |
|
300 | 300 | PCLZIP_CB_PRE_ADD, |
301 | 301 | 'fixDocumentNameCallback' |
302 | 302 | ); |
@@ -95,7 +95,7 @@ |
||
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Get the progress of this learnpath. Only the last attempt are taken into account. |
98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
98 | + * @param integer $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | 99 | * @return array (score, max) if student is given |
100 | 100 | * array (sum of scores, number of scores) otherwise |
101 | 101 | * or null if no scores available |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | |
44 | 44 | $result = Database::query($sql); |
45 | 45 | |
46 | - $cats=array(); |
|
47 | - while ($data=Database::fetch_array($result)) { |
|
48 | - $cats[] = array ($data['id'], $data['name']); |
|
46 | + $cats = array(); |
|
47 | + while ($data = Database::fetch_array($result)) { |
|
48 | + $cats[] = array($data['id'], $data['name']); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $cats; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | $result = Database::query($sql); |
73 | 73 | |
74 | 74 | $cats = array(); |
75 | - while ($data=Database::fetch_array($result)) { |
|
76 | - $cats[] = array ($data['id'], $data['name']); |
|
75 | + while ($data = Database::fetch_array($result)) { |
|
76 | + $cats[] = array($data['id'], $data['name']); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $cats; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $sql = "SELECT count(id) AS number FROM $tbl_stats |
90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
91 | 91 | $result = Database::query($sql); |
92 | - $number = Database::fetch_array($result,'NUM'); |
|
92 | + $number = Database::fetch_array($result, 'NUM'); |
|
93 | 93 | return ($number[0] != 0); |
94 | 94 | } |
95 | 95 | |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | // for 1 student |
122 | 122 | if (isset($stud_id)) { |
123 | 123 | if ($data = Database::fetch_assoc($scores)) { |
124 | - return array ($data['progress'], 100); |
|
124 | + return array($data['progress'], 100); |
|
125 | 125 | } else |
126 | 126 | return null; |
127 | 127 | } else { |
128 | 128 | // all students -> get average |
129 | - $students = array(); // user list, needed to make sure we only |
|
129 | + $students = array(); // user list, needed to make sure we only |
|
130 | 130 | // take first attempts into account |
131 | 131 | $rescount = 0; |
132 | 132 | $sum = 0; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return array($bestResult, 100); |
155 | 155 | break; |
156 | 156 | case 'average': |
157 | - return array($sumResult/$rescount, 100); |
|
157 | + return array($sumResult / $rescount, 100); |
|
158 | 158 | break; |
159 | 159 | case 'ranking': |
160 | 160 | return AbstractLink::getCurrentUserRanking($stud_id, $students); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
208 | 208 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
209 | 209 | $result = Database::query($sql); |
210 | - $number = Database::fetch_row($result,'NUM'); |
|
210 | + $number = Database::fetch_row($result, 'NUM'); |
|
211 | 211 | return ($number[0] != 0); |
212 | 212 | } |
213 | 213 |
@@ -32,6 +32,8 @@ discard block |
||
32 | 32 | * @param array $evals |
33 | 33 | * @param array $links |
34 | 34 | * @param null $addparams |
35 | + * @param boolean $showTeacherView |
|
36 | + * @param integer $userId |
|
35 | 37 | */ |
36 | 38 | public function __construct( |
37 | 39 | $currentcat, |
@@ -895,7 +897,7 @@ discard block |
||
895 | 897 | |
896 | 898 | /** |
897 | 899 | * @param $item |
898 | - * @return mixed |
|
900 | + * @return string|null |
|
899 | 901 | */ |
900 | 902 | private function build_course_code($item) |
901 | 903 | { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->set_additional_parameters($addparams); |
72 | 72 | } |
73 | 73 | |
74 | - $column= 0; |
|
74 | + $column = 0; |
|
75 | 75 | if ($this->teacherView) { |
76 | 76 | if ($this->exportToPdf == false) { |
77 | 77 | $this->set_header($column++, '', '', 'width="25px"'); |
@@ -283,13 +283,13 @@ discard block |
||
283 | 283 | $main_categories[$item->get_id()]['name'] = $item->get_name(); |
284 | 284 | } else { |
285 | 285 | $name = $this->build_name_link($item, $type); |
286 | - $row[] = $invisibility_span_open.$name. $invisibility_span_close; |
|
286 | + $row[] = $invisibility_span_open.$name.$invisibility_span_close; |
|
287 | 287 | $main_categories[$item->get_id()]['name'] = $name; |
288 | 288 | } |
289 | 289 | |
290 | 290 | $this->dataForGraph['categories'][] = $item->get_name(); |
291 | 291 | |
292 | - $main_categories[$item->get_id()]['weight']= $item->get_weight(); |
|
292 | + $main_categories[$item->get_id()]['weight'] = $item->get_weight(); |
|
293 | 293 | $total_categories_weight += $item->get_weight(); |
294 | 294 | |
295 | 295 | // Description. |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | ); |
310 | 310 | |
311 | 311 | if ($this->teacherView) { |
312 | - $row[] = $invisibility_span_open .Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close; |
|
312 | + $row[] = $invisibility_span_open.Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close; |
|
313 | 313 | } else { |
314 | - $row[] = $invisibility_span_open .$weight.$invisibility_span_close; |
|
314 | + $row[] = $invisibility_span_open.$weight.$invisibility_span_close; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | $category_weight = $item->get_weight(); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | |
338 | 338 | if (!empty($score[1])) { |
339 | 339 | $completeScore = $scoredisplay->display_score($score, SCORE_DIV_PERCENT); |
340 | - $score = $score[0]/$score[1]*$item->get_weight(); |
|
340 | + $score = $score[0] / $score[1] * $item->get_weight(); |
|
341 | 341 | $score = $scoredisplay->display_score(array($score, null), SCORE_SIMPLE); |
342 | 342 | $scoreToDisplay = Display::tip($score, $completeScore); |
343 | 343 | } else { |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | $totalResultAverageValue = strip_tags($scoredisplay->display_score($totalResult, SCORE_AVERAGE)); |
374 | 374 | $this->dataForGraph['my_result'][] = (float) str_replace('%', '', $totalResultAverageValue); |
375 | 375 | $totalAverageValue = strip_tags($scoredisplay->display_score($totalAverage, SCORE_AVERAGE)); |
376 | - $this->dataForGraph['average'][] = (float) str_replace('%', '', $totalAverageValue); |
|
376 | + $this->dataForGraph['average'][] = (float) str_replace('%', '', $totalAverageValue); |
|
377 | 377 | // Ranking |
378 | 378 | $row[] = $ranking; |
379 | 379 | // Best |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px')); |
457 | 457 | |
458 | 458 | // Name. |
459 | - $row[] = $invisibility_span_open." ".$this->build_name_link($item, $type) . $invisibility_span_close; |
|
459 | + $row[] = $invisibility_span_open." ".$this->build_name_link($item, $type).$invisibility_span_close; |
|
460 | 460 | |
461 | 461 | // Description. |
462 | 462 | if ($this->exportToPdf == false) { |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | // Students get the results and certificates columns |
495 | 495 | $eval_n_links = array_merge($alleval, $alllink); |
496 | 496 | |
497 | - if (count($eval_n_links)> 0) { |
|
497 | + if (count($eval_n_links) > 0) { |
|
498 | 498 | $value_data = isset($data[4]) ? $data[4] : null; |
499 | 499 | |
500 | 500 | if (!is_null($value_data)) { |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $row = array( |
594 | 594 | null, |
595 | 595 | null, |
596 | - '<strong>' . get_lang('Total') . '</strong>', |
|
596 | + '<strong>'.get_lang('Total').'</strong>', |
|
597 | 597 | null, |
598 | 598 | $total |
599 | 599 | ); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | if ($this->exportToPdf) { |
664 | 664 | $row = array( |
665 | 665 | null, |
666 | - '<h3>' . get_lang('Total') . '</h3>', |
|
666 | + '<h3>'.get_lang('Total').'</h3>', |
|
667 | 667 | $main_weight, |
668 | 668 | $totalResult, |
669 | 669 | $totalRanking, |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | } else { |
674 | 674 | $row = array( |
675 | 675 | null, |
676 | - '<h3>' . get_lang('Total') . '</h3>', |
|
676 | + '<h3>'.get_lang('Total').'</h3>', |
|
677 | 677 | null, |
678 | 678 | $main_weight, |
679 | 679 | $totalResult, |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | } |
689 | 689 | |
690 | 690 | // Warning messages |
691 | - $view = isset($_GET['view']) ? $_GET['view']: null; |
|
691 | + $view = isset($_GET['view']) ? $_GET['view'] : null; |
|
692 | 692 | |
693 | 693 | if ($this->teacherView) { |
694 | 694 | if (isset($_GET['selectcat']) && |
@@ -701,14 +701,14 @@ discard block |
||
701 | 701 | $weight_category = intval($this->build_weight($category[0])); |
702 | 702 | |
703 | 703 | $course_code = $this->build_course_code($category[0]); |
704 | - $weight_total_links = round($weight_total_links); |
|
704 | + $weight_total_links = round($weight_total_links); |
|
705 | 705 | |
706 | 706 | if ($weight_total_links > $weight_category || |
707 | 707 | $weight_total_links < $weight_category || |
708 | 708 | $weight_total_links > $weight_category |
709 | 709 | ) { |
710 | 710 | $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category); |
711 | - $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'. |
|
711 | + $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'. |
|
712 | 712 | Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>'; |
713 | 713 | $warning_message .= $modify_icons; |
714 | 714 | Display::display_warning_message($warning_message, false); |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | ); |
722 | 722 | |
723 | 723 | if (!empty($content_html)) { |
724 | - $new_content = explode('</head>',$content_html['content']); |
|
724 | + $new_content = explode('</head>', $content_html['content']); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | if (empty($new_content[0])) { |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | is_array($course_codes) |
756 | 756 | ) { |
757 | 757 | $warning_message = ''; |
758 | - for ($x = 0; $x<count($weight_categories);$x++) { |
|
758 | + for ($x = 0; $x < count($weight_categories); $x++) { |
|
759 | 759 | $weight_category = intval($weight_categories[$x]); |
760 | 760 | $certificate_min_score = intval($certificate_min_scores[$x]); |
761 | 761 | $course_code = $course_codes[$x]; |
@@ -763,12 +763,12 @@ discard block |
||
763 | 763 | if (empty($certificate_min_score) || |
764 | 764 | ($certificate_min_score > $weight_category) |
765 | 765 | ) { |
766 | - $warning_message .= $course_code .' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'<br />'; |
|
766 | + $warning_message .= $course_code.' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'<br />'; |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | |
770 | 770 | if (!empty($warning_message)) { |
771 | - Display::display_warning_message($warning_message,false); |
|
771 | + Display::display_warning_message($warning_message, false); |
|
772 | 772 | } |
773 | 773 | } |
774 | 774 | } |
@@ -812,15 +812,15 @@ discard block |
||
812 | 812 | $pChart->Antialias = false; |
813 | 813 | |
814 | 814 | /* Add a border to the picture */ |
815 | - $pChart->drawRectangle(0,0,$xSize-10,$ySize-10,array("R"=>0,"G"=>0,"B"=>0)); |
|
815 | + $pChart->drawRectangle(0, 0, $xSize - 10, $ySize - 10, array("R"=>0, "G"=>0, "B"=>0)); |
|
816 | 816 | |
817 | - $pChart->drawText(10,16,get_lang('Results'),array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT)); |
|
817 | + $pChart->drawText(10, 16, get_lang('Results'), array("FontSize"=>11, "Align"=>TEXT_ALIGN_BOTTOMLEFT)); |
|
818 | 818 | |
819 | - $pChart->setGraphArea(50, 30, $xSize-50, $ySize-50); |
|
819 | + $pChart->setGraphArea(50, 30, $xSize - 50, $ySize - 50); |
|
820 | 820 | |
821 | 821 | $pChart->setFontProperties( |
822 | 822 | array( |
823 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
823 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
824 | 824 | 'FontSize' => 10, |
825 | 825 | ) |
826 | 826 | ); |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | |
841 | 841 | /* Draw the line chart */ |
842 | 842 | $pChart->drawLineChart(); |
843 | - $pChart->drawPlotChart(array("DisplayValues"=>TRUE,"PlotBorder"=>TRUE,"BorderSize"=>2,"Surrounding"=>-60,"BorderAlpha"=>80)); |
|
843 | + $pChart->drawPlotChart(array("DisplayValues"=>TRUE, "PlotBorder"=>TRUE, "BorderSize"=>2, "Surrounding"=>-60, "BorderAlpha"=>80)); |
|
844 | 844 | |
845 | 845 | /* Write the chart legend */ |
846 | 846 | $pChart->drawLegend( |
@@ -860,13 +860,13 @@ discard block |
||
860 | 860 | $chartHash = $myCache->getHash($dataSet); |
861 | 861 | |
862 | 862 | $myCache->writeToCache($chartHash, $pChart); |
863 | - $imgSysPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
863 | + $imgSysPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
864 | 864 | $myCache->saveFromCache($chartHash, $imgSysPath); |
865 | - $imgWebPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
865 | + $imgWebPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
866 | 866 | |
867 | 867 | if (file_exists($imgSysPath)) { |
868 | 868 | $result = '<div id="contentArea" style="text-align: center;" >'; |
869 | - $result .= '<img src="' . $imgWebPath.'" >'; |
|
869 | + $result .= '<img src="'.$imgWebPath.'" >'; |
|
870 | 870 | $result .= '</div>'; |
871 | 871 | return $result; |
872 | 872 | } |
@@ -911,13 +911,13 @@ discard block |
||
911 | 911 | switch ($item->get_item_type()) { |
912 | 912 | // category |
913 | 913 | case 'C' : |
914 | - return 'CATE' . $item->get_id(); |
|
914 | + return 'CATE'.$item->get_id(); |
|
915 | 915 | // evaluation |
916 | 916 | case 'E' : |
917 | - return 'EVAL' . $item->get_id(); |
|
917 | + return 'EVAL'.$item->get_id(); |
|
918 | 918 | // link |
919 | 919 | case 'L' : |
920 | - return 'LINK' . $item->get_id(); |
|
920 | + return 'LINK'.$item->get_id(); |
|
921 | 921 | } |
922 | 922 | } |
923 | 923 | |
@@ -945,20 +945,20 @@ discard block |
||
945 | 945 | switch ($item->get_item_type()) { |
946 | 946 | // category |
947 | 947 | case 'C' : |
948 | - $prms_uri='?selectcat=' . $item->get_id() . '&view='.$view; |
|
948 | + $prms_uri = '?selectcat='.$item->get_id().'&view='.$view; |
|
949 | 949 | |
950 | 950 | if (isset($_GET['isStudentView'])) { |
951 | - if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) { |
|
952 | - $prms_uri=$prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']); |
|
951 | + if (isset($is_student) || (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview')) { |
|
952 | + $prms_uri = $prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']); |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | |
956 | 956 | $cat = new Category(); |
957 | - $show_message=$cat->show_message_resource_delete($item->get_course_code()); |
|
957 | + $show_message = $cat->show_message_resource_delete($item->get_course_code()); |
|
958 | 958 | return ' <a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).$prms_uri.'">' |
959 | 959 | . $item->get_name() |
960 | 960 | . '</a>' |
961 | - . ($item->is_course() ? ' [' . $item->get_course_code() . ']'.$show_message : ''); |
|
961 | + . ($item->is_course() ? ' ['.$item->get_course_code().']'.$show_message : ''); |
|
962 | 962 | // evaluation |
963 | 963 | case 'E' : |
964 | 964 | $cat = new Category(); |
@@ -966,10 +966,10 @@ discard block |
||
966 | 966 | $show_message = $cat->show_message_resource_delete($course_id); |
967 | 967 | |
968 | 968 | // course/platform admin can go to the view_results page |
969 | - if (api_is_allowed_to_edit() && $show_message===false) { |
|
969 | + if (api_is_allowed_to_edit() && $show_message === false) { |
|
970 | 970 | if ($item->get_type() == 'presence') { |
971 | 971 | return ' ' |
972 | - . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval=' . $item->get_id() . '">' |
|
972 | + . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval='.$item->get_id().'">' |
|
973 | 973 | . $item->get_name() |
974 | 974 | . '</a>'; |
975 | 975 | } else { |
@@ -978,20 +978,20 @@ discard block |
||
978 | 978 | $extra = ''; |
979 | 979 | } |
980 | 980 | return ' ' |
981 | - . '<a href="gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
981 | + . '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
982 | 982 | . $item->get_name() |
983 | 983 | . '</a> '.$extra; |
984 | 984 | } |
985 | - } elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) { |
|
985 | + } elseif (ScoreDisplay :: instance()->is_custom() && $show_message === false) { |
|
986 | 986 | // students can go to the statistics page (if custom display enabled) |
987 | 987 | return ' ' |
988 | - . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
988 | + . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
989 | 989 | . $item->get_name() |
990 | 990 | . '</a>'; |
991 | 991 | |
992 | 992 | } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay :: instance()->is_custom()) { |
993 | 993 | return ' ' |
994 | - . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
994 | + . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
995 | 995 | . $item->get_name() |
996 | 996 | . '</a>'; |
997 | 997 | } else { |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | $url = $item->get_link(); |
1007 | 1007 | |
1008 | 1008 | if (isset($url) && $show_message === false) { |
1009 | - $text = ' <a href="' . $item->get_link() . '">' |
|
1009 | + $text = ' <a href="'.$item->get_link().'">' |
|
1010 | 1010 | . $item->get_name() |
1011 | 1011 | . '</a>'; |
1012 | 1012 | } else { |
@@ -72,6 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Get actual array data |
75 | + * @param integer $count |
|
75 | 76 | * @return array 2-dimensional array - each array contains the elements: |
76 | 77 | * 0: eval/link object |
77 | 78 | * 1: item name |
@@ -285,7 +286,7 @@ discard block |
||
285 | 286 | |
286 | 287 | /** |
287 | 288 | * @param $item |
288 | - * @param $ignore_score_color |
|
289 | + * @param boolean $ignore_score_color |
|
289 | 290 | * @return string |
290 | 291 | */ |
291 | 292 | private function build_average_column($item, $ignore_score_color) |
@@ -306,7 +307,7 @@ discard block |
||
306 | 307 | |
307 | 308 | /** |
308 | 309 | * @param $item |
309 | - * @param $ignore_score_color |
|
310 | + * @param boolean $ignore_score_color |
|
310 | 311 | * @return string |
311 | 312 | */ |
312 | 313 | private function build_result_column($item, $ignore_score_color) |
@@ -323,7 +324,7 @@ discard block |
||
323 | 324 | |
324 | 325 | /** |
325 | 326 | * @param $item |
326 | - * @param $ignore_score_color |
|
327 | + * @param boolean $ignore_score_color |
|
327 | 328 | * @return string |
328 | 329 | */ |
329 | 330 | private function build_mask_column($item, $ignore_score_color) |
@@ -339,7 +340,7 @@ discard block |
||
339 | 340 | |
340 | 341 | /** |
341 | 342 | * @param $coursecode |
342 | - * @return mixed |
|
343 | + * @return string |
|
343 | 344 | */ |
344 | 345 | private function get_course_name_from_code_cached($coursecode) |
345 | 346 | { |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | } |
52 | 52 | if (count($result) == 0) { |
53 | - $evals_filtered=$evals; |
|
53 | + $evals_filtered = $evals; |
|
54 | 54 | } else { |
55 | - $evals_filtered=$evals_filtered_copy; |
|
55 | + $evals_filtered = $evals_filtered_copy; |
|
56 | 56 | } |
57 | 57 | $this->items = array_merge($evals_filtered, $links); |
58 | 58 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | // do some checks on count, redefine if invalid value |
87 | 87 | if (!isset($count)) { |
88 | - $count = count ($this->items) - $start; |
|
88 | + $count = count($this->items) - $start; |
|
89 | 89 | } |
90 | 90 | if ($count < 0) { |
91 | 91 | $count = 0; |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | } elseif ($sorting & self :: UDG_SORT_AVERAGE) { |
105 | 105 | // if user sorts on average scores, first calculate them and cache them |
106 | 106 | foreach ($allitems as $item) { |
107 | - $this->avgcache[$item->get_item_type() . $item->get_id()]= $item->calc_score(); |
|
107 | + $this->avgcache[$item->get_item_type().$item->get_id()] = $item->calc_score(); |
|
108 | 108 | } |
109 | 109 | usort($allitems, array('UserDataGenerator', 'sort_by_average')); |
110 | 110 | } elseif ($sorting & self :: UDG_SORT_SCORE) { |
111 | 111 | // if user sorts on student's scores, first calculate them and cache them |
112 | 112 | foreach ($allitems as $item) { |
113 | - $this->scorecache[$item->get_item_type() . $item->get_id()] |
|
113 | + $this->scorecache[$item->get_item_type().$item->get_id()] |
|
114 | 114 | = $item->calc_score($this->userid); |
115 | 115 | } |
116 | 116 | usort($allitems, array('UserDataGenerator', 'sort_by_score')); |
117 | 117 | } elseif ($sorting & self :: UDG_SORT_MASK) { |
118 | 118 | // if user sorts on student's masks, first calculate scores and cache them |
119 | 119 | foreach ($allitems as $item) { |
120 | - $this->scorecache[$item->get_item_type() . $item->get_id()] |
|
120 | + $this->scorecache[$item->get_item_type().$item->get_id()] |
|
121 | 121 | = $item->calc_score($this->userid); |
122 | 122 | } |
123 | 123 | usort($allitems, array('UserDataGenerator', 'sort_by_mask')); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // fill score cache if not done yet |
133 | 133 | if (!isset ($this->scorecache)) { |
134 | 134 | foreach ($visibleitems as $item) { |
135 | - $this->scorecache[$item->get_item_type() . $item->get_id()] |
|
135 | + $this->scorecache[$item->get_item_type().$item->get_id()] |
|
136 | 136 | = $item->calc_score($this->userid); |
137 | 137 | } |
138 | 138 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $scoredisplay = ScoreDisplay :: instance(); |
142 | 142 | $data = array(); |
143 | 143 | foreach ($visibleitems as $item) { |
144 | - $row = array (); |
|
144 | + $row = array(); |
|
145 | 145 | $row[] = $item; |
146 | 146 | $row[] = $item->get_name(); |
147 | 147 | $row[] = $this->build_course_name($item); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | function sort_by_type($item1, $item2) |
164 | 164 | { |
165 | 165 | if ($item1->get_item_type() == $item2->get_item_type()) { |
166 | - return $this->sort_by_name($item1,$item2); |
|
166 | + return $this->sort_by_name($item1, $item2); |
|
167 | 167 | } else { |
168 | 168 | return ($item1->get_item_type() < $item2->get_item_type() ? -1 : 1); |
169 | 169 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | function sort_by_name($item1, $item2) |
205 | 205 | { |
206 | - return api_strnatcmp($item1->get_name(),$item2->get_name()); |
|
206 | + return api_strnatcmp($item1->get_name(), $item2->get_name()); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | */ |
214 | 214 | function sort_by_average($item1, $item2) |
215 | 215 | { |
216 | - $score1 = $this->avgcache[$item1->get_item_type() . $item1->get_id()]; |
|
217 | - $score2 = $this->avgcache[$item2->get_item_type() . $item2->get_id()]; |
|
216 | + $score1 = $this->avgcache[$item1->get_item_type().$item1->get_id()]; |
|
217 | + $score2 = $this->avgcache[$item2->get_item_type().$item2->get_id()]; |
|
218 | 218 | |
219 | 219 | return $this->compare_scores($score1, $score2); |
220 | 220 | } |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | */ |
227 | 227 | function sort_by_score($item1, $item2) |
228 | 228 | { |
229 | - $score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()]; |
|
230 | - $score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()]; |
|
229 | + $score1 = $this->scorecache[$item1->get_item_type().$item1->get_id()]; |
|
230 | + $score2 = $this->scorecache[$item2->get_item_type().$item2->get_id()]; |
|
231 | 231 | |
232 | 232 | return $this->compare_scores($score1, $score2); |
233 | 233 | } |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | */ |
240 | 240 | function sort_by_mask($item1, $item2) |
241 | 241 | { |
242 | - $score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()]; |
|
243 | - $score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()]; |
|
242 | + $score1 = $this->scorecache[$item1->get_item_type().$item1->get_id()]; |
|
243 | + $score2 = $this->scorecache[$item2->get_item_type().$item2->get_id()]; |
|
244 | 244 | |
245 | 245 | return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2); |
246 | 246 | } |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | return (isset($score2) ? 1 : 0); |
257 | 257 | } elseif (!isset($score2)) { |
258 | 258 | return -1; |
259 | - } elseif (($score1[0]/$score1[1]) == ($score2[0]/$score2[1])) { |
|
259 | + } elseif (($score1[0] / $score1[1]) == ($score2[0] / $score2[1])) { |
|
260 | 260 | return 0; |
261 | 261 | } else { |
262 | - return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1); |
|
262 | + return (($score1[0] / $score1[1]) < ($score2[0] / $score2[1]) ? -1 : 1); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | private function build_average_column($item, $ignore_score_color) |
292 | 292 | { |
293 | 293 | if (isset($this->avgcache)) { |
294 | - $avgscore = $this->avgcache[$item->get_item_type() . $item->get_id()]; |
|
294 | + $avgscore = $this->avgcache[$item->get_item_type().$item->get_id()]; |
|
295 | 295 | } else { |
296 | 296 | $avgscore = $item->calc_score(); |
297 | 297 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | private function build_result_column($item, $ignore_score_color) |
313 | 313 | { |
314 | - $studscore = $this->scorecache[$item->get_item_type() . $item->get_id()]; |
|
314 | + $studscore = $this->scorecache[$item->get_item_type().$item->get_id()]; |
|
315 | 315 | $scoredisplay = ScoreDisplay :: instance(); |
316 | 316 | $displaytype = SCORE_DIV_PERCENT; |
317 | 317 | if ($ignore_score_color) { |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | */ |
329 | 329 | private function build_mask_column($item, $ignore_score_color) |
330 | 330 | { |
331 | - $studscore = $this->scorecache[$item->get_item_type() . $item->get_id()]; |
|
331 | + $studscore = $this->scorecache[$item->get_item_type().$item->get_id()]; |
|
332 | 332 | $scoredisplay = ScoreDisplay :: instance(); |
333 | 333 | $displaytype = SCORE_DIV_PERCENT; |
334 | 334 | if ($ignore_score_color) { |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | if (isset ($this->categorycache) |
363 | 363 | && isset ($this->categorycache[$category_id])) { |
364 | 364 | return $this->categorycache[$category_id]; |
365 | - }else { |
|
365 | + } else { |
|
366 | 366 | $cat = Category::load($category_id); |
367 | - if (isset($cat)){ |
|
367 | + if (isset($cat)) { |
|
368 | 368 | $this->categorycache[$category_id] = $cat[0]; |
369 | 369 | return $cat[0]; |
370 | - }else |
|
370 | + } else |
|
371 | 371 | return null; |
372 | 372 | } |
373 | 373 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | private function get_category_name_to_display($cat) |
380 | 380 | { |
381 | 381 | if (isset($cat)) { |
382 | - if ($cat->get_parent_id() == '0' || $cat->get_parent_id() == null){ |
|
382 | + if ($cat->get_parent_id() == '0' || $cat->get_parent_id() == null) { |
|
383 | 383 | return ''; |
384 | 384 | } else { |
385 | 385 | return $cat->get_name(); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * Search sessions by name, based on a search string |
25 | 25 | * @param string Search string |
26 | 26 | * @param int Deprecated param |
27 | - * @return string Xajax response block |
|
27 | + * @return xajaxResponse Xajax response block |
|
28 | 28 | * @assert () === false |
29 | 29 | */ |
30 | 30 | function search_sessions($needle, $id) |
@@ -44,17 +44,17 @@ |
||
44 | 44 | ORDER BY name, id |
45 | 45 | LIMIT 11'; |
46 | 46 | $rs = Database::query($sql); |
47 | - $i=0; |
|
47 | + $i = 0; |
|
48 | 48 | while ($session = Database :: fetch_array($rs)) { |
49 | 49 | $i++; |
50 | - if ($i<=10) { |
|
50 | + if ($i <= 10) { |
|
51 | 51 | $return .= '<a href="#" onclick="add_user_to_url(\''.addslashes($session['id']).'\',\''.addslashes($session['name']).' ('.addslashes($session['id']).')'.'\')">'.$session['name'].' </a><br />'; |
52 | 52 | } else { |
53 | 53 | $return .= '...<br />'; |
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
57 | - $xajax_response -> addAssign('ajax_list_courses','innerHTML',api_utf8_encode($return)); |
|
57 | + $xajax_response -> addAssign('ajax_list_courses', 'innerHTML', api_utf8_encode($return)); |
|
58 | 58 | return $xajax_response; |
59 | 59 | } |
60 | 60 | } |