@@ -34,21 +34,21 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | // "Link" type |
| 36 | 36 | if ($_REQUEST['format'] == 'link') { |
| 37 | - // converting post vars to get uri |
|
| 38 | - $params = ''; |
|
| 39 | - $kv = array(); |
|
| 40 | - foreach ($_POST as $key => $value) |
|
| 41 | - if ($key != 'format') |
|
| 42 | - $kv[] = $key.'='.urlencode($value); |
|
| 43 | - $query_string = join("&", $kv); |
|
| 44 | - die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>'); |
|
| 37 | + // converting post vars to get uri |
|
| 38 | + $params = ''; |
|
| 39 | + $kv = array(); |
|
| 40 | + foreach ($_POST as $key => $value) |
|
| 41 | + if ($key != 'format') |
|
| 42 | + $kv[] = $key.'='.urlencode($value); |
|
| 43 | + $query_string = join("&", $kv); |
|
| 44 | + die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if ($_REQUEST['format'] == 'directlink') { |
| 48 | - foreach (array('jquery.dataTables.min.js') as $js) |
|
| 49 | - $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n"; |
|
| 48 | + foreach (array('jquery.dataTables.min.js') as $js) |
|
| 49 | + $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n"; |
|
| 50 | 50 | |
| 51 | - $htmlCSSXtra[] = 'dataTable.css'; |
|
| 51 | + $htmlCSSXtra[] = 'dataTable.css'; |
|
| 52 | 52 | |
| 53 | 53 | ?> |
| 54 | 54 | <script type="text/javascript"> |
@@ -63,62 +63,62 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | </script> |
| 65 | 65 | <?php |
| 66 | - Display::display_header($tool_name); |
|
| 67 | - echo '<div id="result" class="result">'; |
|
| 66 | + Display::display_header($tool_name); |
|
| 67 | + echo '<div id="result" class="result">'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // outputing a link to csv file instead of outputing csv data directly |
| 71 | 71 | if ($_REQUEST['format'] == 'csv') { |
| 72 | - // converting post vars to get uri |
|
| 73 | - $params = ''; |
|
| 74 | - $kv = array(); |
|
| 75 | - foreach ($_POST as $key => $value) |
|
| 76 | - if ($key != 'format') |
|
| 77 | - $kv[] = $key.'='.urlencode($value); |
|
| 78 | - $query_string = join("&", $kv); |
|
| 79 | - die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>'); |
|
| 72 | + // converting post vars to get uri |
|
| 73 | + $params = ''; |
|
| 74 | + $kv = array(); |
|
| 75 | + foreach ($_POST as $key => $value) |
|
| 76 | + if ($key != 'format') |
|
| 77 | + $kv[] = $key.'='.urlencode($value); |
|
| 78 | + $query_string = join("&", $kv); |
|
| 79 | + die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>'); |
|
| 80 | 80 | } else if ($_REQUEST['format'] == 'downloadcsv') { |
| 81 | - if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') == false)) { |
|
| 82 | - header("Pragma: must-revalidate"); |
|
| 83 | - header("Cache-Control: must-revalidate"); |
|
| 84 | - header("Content-type: application/vnd.ms-excel"); |
|
| 85 | - } |
|
| 86 | - else { |
|
| 87 | - header("Content-type: text/csv"); |
|
| 88 | - } |
|
| 89 | - $date = date("Y-m-d"); |
|
| 90 | - $filename = "reporting-$date.csv"; |
|
| 91 | - header("Content-Disposition: attachment; filename=$filename"); |
|
| 92 | - $_REQUEST['format'] = 'csv'; |
|
| 81 | + if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') == false)) { |
|
| 82 | + header("Pragma: must-revalidate"); |
|
| 83 | + header("Cache-Control: must-revalidate"); |
|
| 84 | + header("Content-type: application/vnd.ms-excel"); |
|
| 85 | + } |
|
| 86 | + else { |
|
| 87 | + header("Content-type: text/csv"); |
|
| 88 | + } |
|
| 89 | + $date = date("Y-m-d"); |
|
| 90 | + $filename = "reporting-$date.csv"; |
|
| 91 | + header("Content-Disposition: attachment; filename=$filename"); |
|
| 92 | + $_REQUEST['format'] = 'csv'; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | if (is_array($reports_template[$_REQUEST['type']])) { |
| 98 | - $query = $reports_template[$_REQUEST['type']]['getSQL'](); |
|
| 99 | - if (! is_array($query)) |
|
| 100 | - $query = array($query); |
|
| 101 | - if ($_REQUEST['format'] == 'sql') |
|
| 102 | - die(var_export($query, true)); |
|
| 98 | + $query = $reports_template[$_REQUEST['type']]['getSQL'](); |
|
| 99 | + if (! is_array($query)) |
|
| 100 | + $query = array($query); |
|
| 101 | + if ($_REQUEST['format'] == 'sql') |
|
| 102 | + die(var_export($query, true)); |
|
| 103 | 103 | |
| 104 | - $result = multiquery_query($query); |
|
| 104 | + $result = multiquery_query($query); |
|
| 105 | 105 | |
| 106 | 106 | |
| 107 | - // check number of result |
|
| 108 | - $numberOfResult = multiquery_num_rows($result); |
|
| 109 | - if ($numberOfResult == 0) { |
|
| 110 | - // This case should be taken care of by the display template itself, we should let the script run |
|
| 111 | - //die(get_lang('NoDataAvailable')); |
|
| 112 | - } |
|
| 107 | + // check number of result |
|
| 108 | + $numberOfResult = multiquery_num_rows($result); |
|
| 109 | + if ($numberOfResult == 0) { |
|
| 110 | + // This case should be taken care of by the display template itself, we should let the script run |
|
| 111 | + //die(get_lang('NoDataAvailable')); |
|
| 112 | + } |
|
| 113 | 113 | } else { |
| 114 | - die('<b>'.get_lang('ErrorWhileBuildingReport').'</b>'); |
|
| 114 | + die('<b>'.get_lang('ErrorWhileBuildingReport').'</b>'); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') { |
| 118 | - if (isset($reports_template[$_REQUEST['type']]['html_header'])) { |
|
| 119 | - echo $reports_template[$_REQUEST['type']]['html_header']; |
|
| 120 | - } |
|
| 121 | - echo '<script type="text/javascript" charset="utf-8"> |
|
| 118 | + if (isset($reports_template[$_REQUEST['type']]['html_header'])) { |
|
| 119 | + echo $reports_template[$_REQUEST['type']]['html_header']; |
|
| 120 | + } |
|
| 121 | + echo '<script type="text/javascript" charset="utf-8"> |
|
| 122 | 122 | $(document).ready(function() { |
| 123 | 123 | |
| 124 | 124 | $("#reportsData'.$idsuffix.'").dataTable({ |
@@ -143,50 +143,50 @@ discard block |
||
| 143 | 143 | }); |
| 144 | 144 | } ); |
| 145 | 145 | </script>'; |
| 146 | - echo '<table id="reportsData'.$idsuffix.'" class="display">'; // FIXME style |
|
| 147 | - |
|
| 148 | - // counting fields |
|
| 149 | - $nfields = multiquery_num_fields($result); |
|
| 150 | - $columns = array(); |
|
| 151 | - $columns_islink = array(); |
|
| 152 | - echo '<thead><tr>'; |
|
| 153 | - for ($i=0; $i < $nfields; $i++) { |
|
| 154 | - $columns[$i] = multiquery_field_name($result, $i); |
|
| 155 | - if (substr($columns[$i], -5, 5) != '_link') { |
|
| 156 | - $column_islink[$i] = false; |
|
| 157 | - echo '<th>'.$columns[$i].'</th>'; |
|
| 158 | - } else |
|
| 159 | - $columns_islink[$i] = true; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - // checking resolving link column id |
|
| 163 | - $columns_flip = array_flip($columns); |
|
| 164 | - $columns_link = array(); |
|
| 165 | - for ($i=0; $i < $nfields; $i++) |
|
| 166 | - if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip)) |
|
| 167 | - $columns_link[$i] = $columns_flip[$columns[$i].'_link']; |
|
| 168 | - else |
|
| 169 | - $columns_link[$i] = ''; |
|
| 170 | - echo '</tr></thead><tbody>'; |
|
| 171 | - while ($row = multiquery_fetch_row($result)) { |
|
| 172 | - echo '<tr>'; |
|
| 173 | - for ($i = 0; $i<$nfields; $i++) |
|
| 174 | - if (!$columns_islink[$i]){ // ignore links |
|
| 175 | - if ($columns_link[$i] != '') // link is defined |
|
| 176 | - if (substr($columns_link[$i],0,10) == 'javascript') { |
|
| 177 | - echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>'; |
|
| 178 | - } |
|
| 179 | - else { |
|
| 180 | - echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>'; |
|
| 181 | - } |
|
| 182 | - else |
|
| 183 | - echo '<td>'.$row[$i].'</td>'; |
|
| 184 | - } |
|
| 185 | - echo "</tr>\n"; |
|
| 186 | - } |
|
| 187 | - echo '</tbody></table>'; |
|
| 188 | - if ($_REQUEST['format'] == 'directlink') { |
|
| 189 | - echo '</div> |
|
| 146 | + echo '<table id="reportsData'.$idsuffix.'" class="display">'; // FIXME style |
|
| 147 | + |
|
| 148 | + // counting fields |
|
| 149 | + $nfields = multiquery_num_fields($result); |
|
| 150 | + $columns = array(); |
|
| 151 | + $columns_islink = array(); |
|
| 152 | + echo '<thead><tr>'; |
|
| 153 | + for ($i=0; $i < $nfields; $i++) { |
|
| 154 | + $columns[$i] = multiquery_field_name($result, $i); |
|
| 155 | + if (substr($columns[$i], -5, 5) != '_link') { |
|
| 156 | + $column_islink[$i] = false; |
|
| 157 | + echo '<th>'.$columns[$i].'</th>'; |
|
| 158 | + } else |
|
| 159 | + $columns_islink[$i] = true; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + // checking resolving link column id |
|
| 163 | + $columns_flip = array_flip($columns); |
|
| 164 | + $columns_link = array(); |
|
| 165 | + for ($i=0; $i < $nfields; $i++) |
|
| 166 | + if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip)) |
|
| 167 | + $columns_link[$i] = $columns_flip[$columns[$i].'_link']; |
|
| 168 | + else |
|
| 169 | + $columns_link[$i] = ''; |
|
| 170 | + echo '</tr></thead><tbody>'; |
|
| 171 | + while ($row = multiquery_fetch_row($result)) { |
|
| 172 | + echo '<tr>'; |
|
| 173 | + for ($i = 0; $i<$nfields; $i++) |
|
| 174 | + if (!$columns_islink[$i]){ // ignore links |
|
| 175 | + if ($columns_link[$i] != '') // link is defined |
|
| 176 | + if (substr($columns_link[$i],0,10) == 'javascript') { |
|
| 177 | + echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>'; |
|
| 178 | + } |
|
| 179 | + else { |
|
| 180 | + echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>'; |
|
| 181 | + } |
|
| 182 | + else |
|
| 183 | + echo '<td>'.$row[$i].'</td>'; |
|
| 184 | + } |
|
| 185 | + echo "</tr>\n"; |
|
| 186 | + } |
|
| 187 | + echo '</tbody></table>'; |
|
| 188 | + if ($_REQUEST['format'] == 'directlink') { |
|
| 189 | + echo '</div> |
|
| 190 | 190 | <div id="result2" class="result" style="margin: 50px;"> |
| 191 | 191 | </div> |
| 192 | 192 | <div id="result3" class="result" style="margin: 100px;"> |
@@ -194,36 +194,36 @@ discard block |
||
| 194 | 194 | <div id="result4" class="result" style="margin: 150px;"> |
| 195 | 195 | </div>'; |
| 196 | 196 | |
| 197 | - Display::display_footer(); |
|
| 197 | + Display::display_footer(); |
|
| 198 | 198 | |
| 199 | - } |
|
| 199 | + } |
|
| 200 | 200 | } else if ($_REQUEST['format'] == 'csv') { |
| 201 | - $nfields = multiquery_num_fields($result); |
|
| 202 | - $columns = array(); |
|
| 203 | - $columns_islink = array(); |
|
| 204 | - for ($i=0; $i < $nfields; $i++) { |
|
| 205 | - $columns[$i] = multiquery_field_name($result, $i); |
|
| 206 | - if (substr($columns[$i], -5, 5) != '_link') { |
|
| 207 | - $column_islink[$i] = false; |
|
| 208 | - echo csv_escaping($columns[$i]).','; |
|
| 209 | - } else |
|
| 210 | - $columns_islink[$i] = true; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - echo "\n"; |
|
| 214 | - while ($row = multiquery_fetch_row($result)) { |
|
| 215 | - for ($i = 0; $i<$nfields; $i++) |
|
| 216 | - if (!$columns_islink[$i]) // ignore links |
|
| 217 | - echo csv_escaping($row[$i]).','; // fixme |
|
| 218 | - echo "\n"; |
|
| 219 | - } |
|
| 201 | + $nfields = multiquery_num_fields($result); |
|
| 202 | + $columns = array(); |
|
| 203 | + $columns_islink = array(); |
|
| 204 | + for ($i=0; $i < $nfields; $i++) { |
|
| 205 | + $columns[$i] = multiquery_field_name($result, $i); |
|
| 206 | + if (substr($columns[$i], -5, 5) != '_link') { |
|
| 207 | + $column_islink[$i] = false; |
|
| 208 | + echo csv_escaping($columns[$i]).','; |
|
| 209 | + } else |
|
| 210 | + $columns_islink[$i] = true; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + echo "\n"; |
|
| 214 | + while ($row = multiquery_fetch_row($result)) { |
|
| 215 | + for ($i = 0; $i<$nfields; $i++) |
|
| 216 | + if (!$columns_islink[$i]) // ignore links |
|
| 217 | + echo csv_escaping($row[$i]).','; // fixme |
|
| 218 | + echo "\n"; |
|
| 219 | + } |
|
| 220 | 220 | } else die(get_lang('UnknownFormat')); |
| 221 | 221 | |
| 222 | 222 | function csv_escaping($value, $csv_separator = ',') { |
| 223 | - $value = str_replace('"','""',$value); |
|
| 224 | - if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value) ) { |
|
| 225 | - $value = '"'.$value.'"'; |
|
| 226 | - } |
|
| 227 | - return $value; |
|
| 223 | + $value = str_replace('"','""',$value); |
|
| 224 | + if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value) ) { |
|
| 225 | + $value = '"'.$value.'"'; |
|
| 226 | + } |
|
| 227 | + return $value; |
|
| 228 | 228 | } |
| 229 | 229 | ?> |
@@ -113,23 +113,23 @@ discard block |
||
| 113 | 113 | $form->addGroup($html_results_enabled); |
| 114 | 114 | // Validate form |
| 115 | 115 | if ($form->validate()) { |
| 116 | - $check = Security::check_token('post'); |
|
| 117 | - if ($check) { |
|
| 118 | - $user = $form->exportValues(); |
|
| 119 | - $email = $userInfo['email']; |
|
| 116 | + $check = Security::check_token('post'); |
|
| 117 | + if ($check) { |
|
| 118 | + $user = $form->exportValues(); |
|
| 119 | + $email = $userInfo['email']; |
|
| 120 | 120 | $username = $userInfo['username']; |
| 121 | - $send_mail = intval($user['mail']['send_mail']); |
|
| 121 | + $send_mail = intval($user['mail']['send_mail']); |
|
| 122 | 122 | $auth_source = PLATFORM_AUTH_SOURCE; |
| 123 | 123 | |
| 124 | 124 | $resetPassword = $user['password']['password_auto'] == '1' ? 0 : 2; |
| 125 | 125 | |
| 126 | - if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') { |
|
| 127 | - //$auth_source = $user['password']['auth_source']; |
|
| 128 | - //$password = 'PLACEHOLDER'; |
|
| 129 | - } else { |
|
| 130 | - //$auth_source = PLATFORM_AUTH_SOURCE; |
|
| 131 | - //$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
| 132 | - } |
|
| 126 | + if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') { |
|
| 127 | + //$auth_source = $user['password']['auth_source']; |
|
| 128 | + //$password = 'PLACEHOLDER'; |
|
| 129 | + } else { |
|
| 130 | + //$auth_source = PLATFORM_AUTH_SOURCE; |
|
| 131 | + //$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | 134 | $auth_source = $userInfo['auth_source']; |
| 135 | 135 | $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password']; |
@@ -157,18 +157,18 @@ discard block |
||
| 157 | 157 | $resetPassword |
| 158 | 158 | ); |
| 159 | 159 | |
| 160 | - if (!empty($email) && $send_mail) { |
|
| 161 | - $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName'); |
|
| 162 | - $portal_url = api_get_path(WEB_PATH); |
|
| 163 | - if (api_is_multiple_url_enabled()) { |
|
| 164 | - $access_url_id = api_get_current_access_url_id(); |
|
| 165 | - if ($access_url_id != -1) { |
|
| 166 | - $url = api_get_access_url($access_url_id); |
|
| 167 | - $portal_url = $url['url']; |
|
| 168 | - } |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n". |
|
| 160 | + if (!empty($email) && $send_mail) { |
|
| 161 | + $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName'); |
|
| 162 | + $portal_url = api_get_path(WEB_PATH); |
|
| 163 | + if (api_is_multiple_url_enabled()) { |
|
| 164 | + $access_url_id = api_get_current_access_url_id(); |
|
| 165 | + if ($access_url_id != -1) { |
|
| 166 | + $url = api_get_access_url($access_url_id); |
|
| 167 | + $portal_url = $url['url']; |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n". |
|
| 172 | 172 | get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n". |
| 173 | 173 | get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" . |
| 174 | 174 | get_lang('Address') ." ". api_get_setting('siteName') ." ". |
@@ -181,26 +181,26 @@ discard block |
||
| 181 | 181 | api_get_setting('administratorTelephone')."\n" . |
| 182 | 182 | get_lang('Email') ." : ".api_get_setting('emailAdministrator'); |
| 183 | 183 | |
| 184 | - api_mail_html( |
|
| 184 | + api_mail_html( |
|
| 185 | 185 | api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), |
| 186 | 186 | $email, |
| 187 | 187 | $emailsubject, |
| 188 | 188 | $emailbody |
| 189 | 189 | ); |
| 190 | - } |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | - Security::clear_token(); |
|
| 192 | + Security::clear_token(); |
|
| 193 | 193 | $tok = Security::get_token(); |
| 194 | 194 | header('Location: '.$url.'&message=1'); |
| 195 | 195 | exit(); |
| 196 | - } |
|
| 196 | + } |
|
| 197 | 197 | } else { |
| 198 | - if (isset($_POST['submit'])) { |
|
| 199 | - Security::clear_token(); |
|
| 200 | - } |
|
| 201 | - $token = Security::get_token(); |
|
| 202 | - $form->addElement('hidden', 'sec_token'); |
|
| 203 | - $form->setConstants(array('sec_token' => $token)); |
|
| 198 | + if (isset($_POST['submit'])) { |
|
| 199 | + Security::clear_token(); |
|
| 200 | + } |
|
| 201 | + $token = Security::get_token(); |
|
| 202 | + $form->addElement('hidden', 'sec_token'); |
|
| 203 | + $form->setConstants(array('sec_token' => $token)); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | $interbreadcrumb[] = array( |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | Display::display_header($tool_name); |
| 213 | 213 | |
| 214 | 214 | if (isset($_REQUEST['message'])) { |
| 215 | - Display::display_normal_message(get_lang('Updated')); |
|
| 215 | + Display::display_normal_message(get_lang('Updated')); |
|
| 216 | 216 | } |
| 217 | 217 | $form->display(); |
| 218 | 218 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if ($is_drh) { |
| 105 | - $view = 'drh'; |
|
| 105 | + $view = 'drh'; |
|
| 106 | 106 | $menu_items[] = Display::url(Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), '#'); |
| 107 | 107 | $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php'); |
| 108 | 108 | $menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | echo "</div><br />"; |
| 144 | 144 | } |
| 145 | 145 | } else { |
| 146 | - echo Display::url( |
|
| 146 | + echo Display::url( |
|
| 147 | 147 | Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM), |
| 148 | 148 | api_get_path(WEB_CODE_PATH)."auth/my_progress.php" |
| 149 | 149 | ); |
@@ -397,11 +397,11 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | // Send the csv file if asked |
| 399 | 399 | if ($export_csv) { |
| 400 | - ob_end_clean(); |
|
| 401 | - Export :: arrayToCsv($csv_content, 'reporting_index'); |
|
| 402 | - exit; |
|
| 400 | + ob_end_clean(); |
|
| 401 | + Export :: arrayToCsv($csv_content, 'reporting_index'); |
|
| 402 | + exit; |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | if (!$export_csv) { |
| 406 | - Display::display_footer(); |
|
| 406 | + Display::display_footer(); |
|
| 407 | 407 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); |
| 20 | 20 | |
| 21 | 21 | if (isset($_GET["id_student"])) { |
| 22 | - $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang('Students')); |
|
| 22 | + $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang('Students')); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | Display :: display_header($nameTools); |
@@ -41,26 +41,26 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | 43 | if (isset($_POST['export'])) { |
| 44 | - $order_clause = api_is_western_name_order(PERSON_NAME_DATA_EXPORT) ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname'; |
|
| 44 | + $order_clause = api_is_western_name_order(PERSON_NAME_DATA_EXPORT) ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname'; |
|
| 45 | 45 | } else { |
| 46 | - $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname'; |
|
| 46 | + $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (isset($_GET["id_student"])) { |
| 50 | - $id_student = intval($_GET["id_student"]); |
|
| 51 | - $sql_coachs = "SELECT DISTINCT srcru.user_id as id_coach |
|
| 50 | + $id_student = intval($_GET["id_student"]); |
|
| 51 | + $sql_coachs = "SELECT DISTINCT srcru.user_id as id_coach |
|
| 52 | 52 | FROM $tbl_session_rel_course_rel_user as srcru |
| 53 | 53 | WHERE srcru.user_id='$id_student' AND srcru.status=2"; |
| 54 | 54 | } else { |
| 55 | - if (api_is_platform_admin()) { |
|
| 56 | - $sql_coachs = "SELECT DISTINCT |
|
| 55 | + if (api_is_platform_admin()) { |
|
| 56 | + $sql_coachs = "SELECT DISTINCT |
|
| 57 | 57 | srcru.user_id as id_coach, user_id, lastname, firstname |
| 58 | 58 | FROM $tbl_user, $tbl_session_rel_course_rel_user srcru |
| 59 | 59 | WHERE |
| 60 | 60 | srcru.user_id=user_id AND |
| 61 | 61 | srcru.status=2 ".$order_clause; |
| 62 | - } else { |
|
| 63 | - $sql_coachs = "SELECT DISTINCT user_id as id_coach, user.user_id, lastname, firstname |
|
| 62 | + } else { |
|
| 63 | + $sql_coachs = "SELECT DISTINCT user_id as id_coach, user.user_id, lastname, firstname |
|
| 64 | 64 | FROM |
| 65 | 65 | $tbl_user as user, |
| 66 | 66 | $tbl_session_rel_course_user as srcu, |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | srcu.user_id = user.user_id AND |
| 75 | 75 | srcu.status = 2 |
| 76 | 76 | ".$order_clause; |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $result_coachs = Database::query($sql_coachs); |
| 81 | 81 | |
| 82 | 82 | if (api_is_western_name_order()) { |
| 83 | - echo '<table class="data_table"> |
|
| 83 | + echo '<table class="data_table"> |
|
| 84 | 84 | <tr> |
| 85 | 85 | <th>'.get_lang('FirstName').'</th> |
| 86 | 86 | <th>'.get_lang('LastName').'</th> |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | <th>'.get_lang('Students').'</th> |
| 90 | 90 | </tr>'; |
| 91 | 91 | } else { |
| 92 | - echo '<table class="data_table"> |
|
| 92 | + echo '<table class="data_table"> |
|
| 93 | 93 | <tr> |
| 94 | 94 | <th>'.get_lang('LastName').'</th> |
| 95 | 95 | <th>'.get_lang('FirstName').'</th> |
@@ -100,79 +100,79 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) { |
| 103 | - $header[] = get_lang('FirstName', ''); |
|
| 104 | - $header[] = get_lang('LastName', ''); |
|
| 103 | + $header[] = get_lang('FirstName', ''); |
|
| 104 | + $header[] = get_lang('LastName', ''); |
|
| 105 | 105 | } else { |
| 106 | - $header[] = get_lang('LastName', ''); |
|
| 107 | - $header[] = get_lang('FirstName', ''); |
|
| 106 | + $header[] = get_lang('LastName', ''); |
|
| 107 | + $header[] = get_lang('FirstName', ''); |
|
| 108 | 108 | } |
| 109 | 109 | $header[] = get_lang('ConnectionTime', ''); |
| 110 | 110 | |
| 111 | 111 | if (Database::num_rows($result_coachs) > 0) { |
| 112 | - while ($coachs = Database::fetch_array($result_coachs)) { |
|
| 113 | - $id_coach = $coachs["id_coach"]; |
|
| 112 | + while ($coachs = Database::fetch_array($result_coachs)) { |
|
| 113 | + $id_coach = $coachs["id_coach"]; |
|
| 114 | 114 | |
| 115 | - if (isset($_GET["id_student"])) { |
|
| 116 | - $sql_infos_coach = "SELECT lastname, firstname |
|
| 115 | + if (isset($_GET["id_student"])) { |
|
| 116 | + $sql_infos_coach = "SELECT lastname, firstname |
|
| 117 | 117 | FROM $tbl_user |
| 118 | 118 | WHERE user_id='$id_coach'"; |
| 119 | - $result_coachs_infos = Database::query($sql_infos_coach); |
|
| 120 | - $lastname = Database::result($result_coachs_infos, 0, "lastname"); |
|
| 121 | - $firstname = Database::result($result_coachs_infos, 0, "firstname"); |
|
| 122 | - } else { |
|
| 123 | - $lastname = $coachs["lastname"]; |
|
| 124 | - $firstname = $coachs["firstname"]; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - $sql_connection_time = "SELECT login_date, logout_date |
|
| 119 | + $result_coachs_infos = Database::query($sql_infos_coach); |
|
| 120 | + $lastname = Database::result($result_coachs_infos, 0, "lastname"); |
|
| 121 | + $firstname = Database::result($result_coachs_infos, 0, "firstname"); |
|
| 122 | + } else { |
|
| 123 | + $lastname = $coachs["lastname"]; |
|
| 124 | + $firstname = $coachs["firstname"]; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + $sql_connection_time = "SELECT login_date, logout_date |
|
| 128 | 128 | FROM $tbl_track_login |
| 129 | 129 | WHERE login_user_id ='$id_coach' AND logout_date <> 'null'"; |
| 130 | - $result_connection_time = Database::query($sql_connection_time); |
|
| 131 | - |
|
| 132 | - $nb_seconds = 0; |
|
| 133 | - while ($connections = Database::fetch_array($result_connection_time)) { |
|
| 134 | - $login_date = $connections["login_date"]; |
|
| 135 | - $logout_date = $connections["logout_date"]; |
|
| 136 | - $timestamp_login_date = strtotime($login_date); |
|
| 137 | - $timestamp_logout_date = strtotime($logout_date); |
|
| 138 | - $nb_seconds += ($timestamp_logout_date - $timestamp_login_date); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - if ($nb_seconds == 0) { |
|
| 142 | - $s_connection_time = ''; |
|
| 143 | - } else { |
|
| 144 | - $s_connection_time = api_time_to_hms($nb_seconds); |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - if ($i % 2 == 0) { |
|
| 148 | - $css_class = "row_odd"; |
|
| 149 | - if ($i % 20 == 0 && $i != 0) { |
|
| 150 | - if (api_is_western_name_order()) { |
|
| 151 | - echo '<tr> |
|
| 130 | + $result_connection_time = Database::query($sql_connection_time); |
|
| 131 | + |
|
| 132 | + $nb_seconds = 0; |
|
| 133 | + while ($connections = Database::fetch_array($result_connection_time)) { |
|
| 134 | + $login_date = $connections["login_date"]; |
|
| 135 | + $logout_date = $connections["logout_date"]; |
|
| 136 | + $timestamp_login_date = strtotime($login_date); |
|
| 137 | + $timestamp_logout_date = strtotime($logout_date); |
|
| 138 | + $nb_seconds += ($timestamp_logout_date - $timestamp_login_date); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + if ($nb_seconds == 0) { |
|
| 142 | + $s_connection_time = ''; |
|
| 143 | + } else { |
|
| 144 | + $s_connection_time = api_time_to_hms($nb_seconds); |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + if ($i % 2 == 0) { |
|
| 148 | + $css_class = "row_odd"; |
|
| 149 | + if ($i % 20 == 0 && $i != 0) { |
|
| 150 | + if (api_is_western_name_order()) { |
|
| 151 | + echo '<tr> |
|
| 152 | 152 | <th>'.get_lang('FirstName').'</th> |
| 153 | 153 | <th>'.get_lang('LastName').'</th> |
| 154 | 154 | <th>'.get_lang('ConnectionTime').'</th> |
| 155 | 155 | <th>'.get_lang('AdminCourses').'</th> |
| 156 | 156 | <th>'.get_lang('Students').'</th> |
| 157 | 157 | </tr>'; |
| 158 | - } else { |
|
| 159 | - echo '<tr> |
|
| 158 | + } else { |
|
| 159 | + echo '<tr> |
|
| 160 | 160 | <th>'.get_lang('LastName').'</th> |
| 161 | 161 | <th>'.get_lang('FirstName').'</th> |
| 162 | 162 | <th>'.get_lang('ConnectionTime').'</th> |
| 163 | 163 | <th>'.get_lang('AdminCourses').'</th> |
| 164 | 164 | <th>'.get_lang('Students').'</th> |
| 165 | 165 | </tr>'; |
| 166 | - } |
|
| 167 | - } |
|
| 168 | - } else { |
|
| 169 | - $css_class = "row_even"; |
|
| 170 | - } |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | + } else { |
|
| 169 | + $css_class = "row_even"; |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - $i++; |
|
| 172 | + $i++; |
|
| 173 | 173 | |
| 174 | - if (api_is_western_name_order()) { |
|
| 175 | - echo '<tr class="'.$css_class.'"> |
|
| 174 | + if (api_is_western_name_order()) { |
|
| 175 | + echo '<tr class="'.$css_class.'"> |
|
| 176 | 176 | <td>'.$firstname.'</td><td>'.$lastname.'</td><td>'.$s_connection_time.'</td> |
| 177 | 177 | <td> |
| 178 | 178 | <a href="course.php?type=coach&user_id='.$id_coach.'"> |
@@ -185,8 +185,8 @@ discard block |
||
| 185 | 185 | </a> |
| 186 | 186 | </td> |
| 187 | 187 | </tr>'; |
| 188 | - } else { |
|
| 189 | - echo '<tr class="'.$css_class.'"> |
|
| 188 | + } else { |
|
| 189 | + echo '<tr class="'.$css_class.'"> |
|
| 190 | 190 | <td>'.$lastname.'</td><td>'.$firstname.'</td> |
| 191 | 191 | <td>'.$s_connection_time.'</td> |
| 192 | 192 | <td> |
@@ -197,25 +197,25 @@ discard block |
||
| 197 | 197 | '.Display::return_icon('2rightarrow.png', get_lang('Details')).'</a> |
| 198 | 198 | </td> |
| 199 | 199 | </tr>'; |
| 200 | - } |
|
| 201 | - |
|
| 202 | - if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) { |
|
| 203 | - $data[$id_coach]["firstname"] = $firstname; |
|
| 204 | - $data[$id_coach]["lastname"] = $lastname; |
|
| 205 | - } else { |
|
| 206 | - $data[$id_coach]["lastname"] = $lastname; |
|
| 207 | - $data[$id_coach]["firstname"] = $firstname; |
|
| 208 | - } |
|
| 209 | - $data[$id_coach]["connection_time"] = $s_connection_time; |
|
| 210 | - } |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) { |
|
| 203 | + $data[$id_coach]["firstname"] = $firstname; |
|
| 204 | + $data[$id_coach]["lastname"] = $lastname; |
|
| 205 | + } else { |
|
| 206 | + $data[$id_coach]["lastname"] = $lastname; |
|
| 207 | + $data[$id_coach]["firstname"] = $firstname; |
|
| 208 | + } |
|
| 209 | + $data[$id_coach]["connection_time"] = $s_connection_time; |
|
| 210 | + } |
|
| 211 | 211 | } else { |
| 212 | - // No results |
|
| 213 | - echo '<tr><td colspan="5">'.get_lang("NoResult").'</td></tr>'; |
|
| 212 | + // No results |
|
| 213 | + echo '<tr><td colspan="5">'.get_lang("NoResult").'</td></tr>'; |
|
| 214 | 214 | } |
| 215 | 215 | echo '</table>'; |
| 216 | 216 | |
| 217 | 217 | if (isset($_POST['export'])){ |
| 218 | - export_csv($header, $data, 'coaches.csv'); |
|
| 218 | + export_csv($header, $data, 'coaches.csv'); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | echo "<br /><br />"; |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace')); |
| 19 | 19 | $id_session = ''; |
| 20 | 20 | if (isset($_GET['id_session']) && $_GET['id_session'] != '') { |
| 21 | - $id_session = intval($_GET['id_session']); |
|
| 22 | - $interbreadcrumb[] = array ('url' => 'session.php', 'name' => get_lang('Sessions')); |
|
| 23 | - $interbreadcrumb[] = array ('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course')); |
|
| 21 | + $id_session = intval($_GET['id_session']); |
|
| 22 | + $interbreadcrumb[] = array ('url' => 'session.php', 'name' => get_lang('Sessions')); |
|
| 23 | + $interbreadcrumb[] = array ('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course')); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | // Set this option to true to enforce strict purification for usenames. |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } else { |
| 45 | - api_not_allowed(true); |
|
| 45 | + api_not_allowed(true); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | set_time_limit(0); |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | Display :: display_header($tool_name); |
| 88 | 88 | |
| 89 | 89 | if ($_FILES['import_file']['size'] == 0 && $_POST) { |
| 90 | - Display::display_error_message(get_lang('ThisFieldIsRequired')); |
|
| 90 | + Display::display_error_message(get_lang('ThisFieldIsRequired')); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if (count($errors) != 0) { |
| 94 | - $error_message = '<ul>'; |
|
| 95 | - foreach ($errors as $index => $error_user) { |
|
| 96 | - $error_message .= '<li><strong>'.$error_user['error'].'</strong>: '; |
|
| 97 | - $error_message .= api_get_person_name($error_user['FirstName'], $error_user['LastName']); |
|
| 98 | - $error_message .= '</li>'; |
|
| 99 | - } |
|
| 100 | - $error_message .= '</ul>'; |
|
| 101 | - Display :: display_error_message($error_message, false); |
|
| 94 | + $error_message = '<ul>'; |
|
| 95 | + foreach ($errors as $index => $error_user) { |
|
| 96 | + $error_message .= '<li><strong>'.$error_user['error'].'</strong>: '; |
|
| 97 | + $error_message .= api_get_person_name($error_user['FirstName'], $error_user['LastName']); |
|
| 98 | + $error_message .= '</li>'; |
|
| 99 | + } |
|
| 100 | + $error_message .= '</ul>'; |
|
| 101 | + Display :: display_error_message($error_message, false); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $form = new FormValidator('user_import'); |
@@ -36,8 +36,8 @@ |
||
| 36 | 36 | |
| 37 | 37 | function count_courses() |
| 38 | 38 | { |
| 39 | - global $nb_courses; |
|
| 40 | - return $nb_courses; |
|
| 39 | + global $nb_courses; |
|
| 40 | + return $nb_courses; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | //checking if the current coach is the admin coach |
@@ -457,8 +457,8 @@ |
||
| 457 | 457 | |
| 458 | 458 | // The post has been displayed => it can be removed from the what's new array |
| 459 | 459 | if (isset($whatsnew_post_info[$forumId][$threadId][$row['post_id']])) { |
| 460 | - unset($whatsnew_post_info[$forumId][$threadId][$row['post_id']]); |
|
| 461 | - unset($_SESSION['whatsnew_post_info'][$forumId][$threadId][$row['post_id']]); |
|
| 460 | + unset($whatsnew_post_info[$forumId][$threadId][$row['post_id']]); |
|
| 461 | + unset($_SESSION['whatsnew_post_info'][$forumId][$threadId][$row['post_id']]); |
|
| 462 | 462 | } |
| 463 | 463 | echo "</table>"; |
| 464 | 464 | |
@@ -500,7 +500,7 @@ |
||
| 500 | 500 | $html .= '</div>'; |
| 501 | 501 | $html .= '</div></div>'; |
| 502 | 502 | } |
| 503 | - echo $html; |
|
| 503 | + echo $html; |
|
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | if (count($forum_list) == 0) { |
@@ -10,11 +10,11 @@ discard block |
||
| 10 | 10 | $this_section = SECTION_COURSES; |
| 11 | 11 | |
| 12 | 12 | if (isset($_GET['session']) && $_GET['session']) { |
| 13 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/'; |
|
| 14 | - $_cid = true; |
|
| 15 | - $is_courseAdmin = true; |
|
| 13 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/'; |
|
| 14 | + $_cid = true; |
|
| 15 | + $is_courseAdmin = true; |
|
| 16 | 16 | } else { |
| 17 | - $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
|
| 17 | + $archive_path = api_get_path(SYS_ARCHIVE_PATH); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | $archive_file = isset($_GET['archive']) ? $_GET['archive'] : null; |
@@ -23,20 +23,20 @@ discard block |
||
| 23 | 23 | list($extension) = getextension($archive_file); |
| 24 | 24 | |
| 25 | 25 | if (empty($extension) || !file_exists($archive_path.$archive_file)) { |
| 26 | - exit; |
|
| 26 | + exit; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $extension = strtolower($extension); |
| 30 | 30 | $content_type = ''; |
| 31 | 31 | |
| 32 | 32 | if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) { |
| 33 | - $content_type = 'application/force-download'; |
|
| 33 | + $content_type = 'application/force-download'; |
|
| 34 | 34 | } elseif ($extension == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) { |
| 35 | - $content_type = 'application/force-download'; |
|
| 35 | + $content_type = 'application/force-download'; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (empty($content_type)) { |
| 39 | - api_not_allowed(true); |
|
| 39 | + api_not_allowed(true); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if (Security::check_abs_path($archive_path.$archive_file, $archive_path)) { |