@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $form = new FormValidator( |
| 25 | 25 | 'filter', |
| 26 | 26 | 'post', |
| 27 | - 'index.php?action=attendance_sheet_list&' . api_get_cidreq().'&attendance_id=' . $attendance_id, |
|
| 27 | + 'index.php?action=attendance_sheet_list&'.api_get_cidreq().'&attendance_id='.$attendance_id, |
|
| 28 | 28 | null, |
| 29 | 29 | array(), |
| 30 | 30 | 'inline' |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | <th width="100px"><?php echo get_lang('AttendancesFaults')?></th> |
| 218 | 218 | </tr> |
| 219 | 219 | <tr class="tableFloatingHeaderOriginal" > |
| 220 | - <th width="10px"><?php echo '#';?></th> |
|
| 220 | + <th width="10px"><?php echo '#'; ?></th> |
|
| 221 | 221 | <th width="10px"><?php echo get_lang('Photo')?></th> |
| 222 | 222 | <th width="150px"><?php echo get_lang('LastName')?></th> |
| 223 | 223 | <th width="140px"><?php echo get_lang('FirstName')?></th> |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | foreach ($users_in_course as $data) { |
| 232 | 232 | $faults = 0; |
| 233 | 233 | if ($i % 2 == 0) { |
| 234 | - $class='row_odd'; |
|
| 234 | + $class = 'row_odd'; |
|
| 235 | 235 | } else { |
| 236 | - $class='row_even'; |
|
| 236 | + $class = 'row_even'; |
|
| 237 | 237 | } |
| 238 | 238 | $username = api_htmlentities(sprintf(get_lang('LoginX'), $data['username']), ENT_QUOTES); |
| 239 | 239 | ?> |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | <td><span title="<?php echo $username ?>"><?php echo $data['lastname'] ?></span></td> |
| 244 | 244 | <td><?php echo $data['firstname'] ?></td> |
| 245 | 245 | <td> |
| 246 | - <div class="attendance-faults-bar" style="background-color:<?php echo (!empty($data['result_color_bar'])?$data['result_color_bar']:'none') ?>"> |
|
| 246 | + <div class="attendance-faults-bar" style="background-color:<?php echo (!empty($data['result_color_bar']) ? $data['result_color_bar'] : 'none') ?>"> |
|
| 247 | 247 | <?php echo $data['attendance_result'] ?> |
| 248 | 248 | </div> |
| 249 | 249 | </td> |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | foreach ($attendant_calendar as $calendar) { |
| 266 | 266 | $date = $calendar['date']; |
| 267 | 267 | $time = $calendar['time']; |
| 268 | - $datetime = '<div class="grey">'. $date . ' - ' . $time . '</div>'; |
|
| 268 | + $datetime = '<div class="grey">'.$date.' - '.$time.'</div>'; |
|
| 269 | 269 | |
| 270 | 270 | $img_lock = Display::return_icon( |
| 271 | 271 | 'lock-closed.png', |
@@ -274,21 +274,21 @@ discard block |
||
| 274 | 274 | ); |
| 275 | 275 | |
| 276 | 276 | if (!empty($calendar['done_attendance'])) { |
| 277 | - $datetime = '<div class="blue">' . $date . ' - ' . $time . '</div>'; |
|
| 277 | + $datetime = '<div class="blue">'.$date.' - '.$time.'</div>'; |
|
| 278 | 278 | } |
| 279 | 279 | $disabled_check = 'disabled = "true"'; |
| 280 | 280 | $input_hidden = '<input type="hidden" id="hidden_input_'.$calendar['id'].'" name="hidden_input[]" value="" disabled />'; |
| 281 | 281 | if ($next_attendance_calendar_id == $calendar['id']) { |
| 282 | 282 | $input_hidden = '<input type="hidden" id="hidden_input_'.$calendar['id'].'" name="hidden_input[]" value="'.$calendar['id'].'" />'; |
| 283 | 283 | $disabled_check = ''; |
| 284 | - $img_lock = Display::return_icon('lock-closed.png',get_lang('DateLock'),array('class'=>'img_unlock','id'=>'datetime_column_'.$calendar['id'])); |
|
| 284 | + $img_lock = Display::return_icon('lock-closed.png', get_lang('DateLock'), array('class'=>'img_unlock', 'id'=>'datetime_column_'.$calendar['id'])); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | $result .= '<th>'; |
| 288 | 288 | $result .= '<div class="date-attendance">'.$datetime.' '; |
| 289 | 289 | |
| 290 | 290 | if (api_is_allowed_to_edit(null, true)) { |
| 291 | - $result .= '<span id="attendance_lock" style="cursor:pointer">'.(!$is_locked_attendance || api_is_platform_admin()?$img_lock:'').'</span>'; |
|
| 291 | + $result .= '<span id="attendance_lock" style="cursor:pointer">'.(!$is_locked_attendance || api_is_platform_admin() ? $img_lock : '').'</span>'; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | if ($is_locked_attendance == false) { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | } else { |
| 301 | 301 | $result = '<th width="2000px"><span><a href="index.php?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.'">'; |
| 302 | - $result .= Display::return_icon('attendance_calendar.png',get_lang('AttendanceCalendar'),'',ICON_SIZE_MEDIUM).' '.get_lang('GoToAttendanceCalendar').'</a></span></th>'; |
|
| 302 | + $result .= Display::return_icon('attendance_calendar.png', get_lang('AttendanceCalendar'), '', ICON_SIZE_MEDIUM).' '.get_lang('GoToAttendanceCalendar').'</a></span></th>'; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | echo '<tr class="tableFloatingHeader row_odd" style="position: absolute; top: 0px; left: 0px; visibility: hidden; margin:0px;padding:0px">'; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $i = 0; |
| 314 | 314 | foreach ($users_in_course as $user) { |
| 315 | 315 | $class = ''; |
| 316 | - if ($i%2 == 0) { |
|
| 316 | + if ($i % 2 == 0) { |
|
| 317 | 317 | $class = 'row_even'; |
| 318 | 318 | } else { |
| 319 | 319 | $class = 'row_odd'; |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | echo '<input type="checkbox" name="check_presence['.$calendar['id'].'][]" value="'.$user['user_id'].'" '.$disabled.' '.$checked.' />'; |
| 361 | 361 | echo '<span class="anchor_'.$calendar['id'].'"></span>'; |
| 362 | 362 | } else { |
| 363 | - echo $presence ? Display::return_icon('checkbox_on.gif',get_lang('Presence')) : Display::return_icon('checkbox_off.gif',get_lang('Presence')); |
|
| 363 | + echo $presence ? Display::return_icon('checkbox_on.gif', get_lang('Presence')) : Display::return_icon('checkbox_off.gif', get_lang('Presence')); |
|
| 364 | 364 | } |
| 365 | 365 | } else { |
| 366 | 366 | switch ($presence) { |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | </td>'; |
| 392 | 392 | } |
| 393 | 393 | echo '</tr>'; |
| 394 | - $i++ ; |
|
| 394 | + $i++; |
|
| 395 | 395 | } |
| 396 | 396 | echo '</tbody></table>'; |
| 397 | 397 | echo '</div></div>'; |
@@ -419,13 +419,13 @@ discard block |
||
| 419 | 419 | echo Display::page_header(get_lang('AttendanceSheetReport')); |
| 420 | 420 | // View for students |
| 421 | 421 | ?> |
| 422 | - <?php if(!empty($users_presence)) { ?> |
|
| 422 | + <?php if (!empty($users_presence)) { ?> |
|
| 423 | 423 | <div> |
| 424 | 424 | <table width="250px;"> |
| 425 | 425 | <tr> |
| 426 | 426 | <td><?php echo get_lang('ToAttend').': ' ?></td> |
| 427 | 427 | <td> |
| 428 | - <center><div class="attendance-faults-bar" style="background-color:<?php echo (!empty($faults['color_bar'])?$faults['color_bar']:'none') ?>"> |
|
| 428 | + <center><div class="attendance-faults-bar" style="background-color:<?php echo (!empty($faults['color_bar']) ? $faults['color_bar'] : 'none') ?>"> |
|
| 429 | 429 | <?php echo $faults['faults'].'/'.$faults['total'].' ('.$faults['faults_porcent'].'%)' ?></div></center> |
| 430 | 430 | </td> |
| 431 | 431 | </tr> |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $i = 0; |
| 443 | 443 | foreach ($users_presence[$user_id] as $presence) { |
| 444 | 444 | $class = ''; |
| 445 | - if ($i%2==0) { |
|
| 445 | + if ($i % 2 == 0) { |
|
| 446 | 446 | $class = 'row_even'; |
| 447 | 447 | } else { |
| 448 | 448 | $class = 'row_odd'; |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | ?> |
| 451 | 451 | <tr class="<?php echo $class ?>"> |
| 452 | 452 | <td> |
| 453 | - <?php echo $presence['presence'] ? Display::return_icon('checkbox_on.gif',get_lang('Presence')) : Display::return_icon('checkbox_off.gif',get_lang('Presence')) ?> |
|
| 453 | + <?php echo $presence['presence'] ? Display::return_icon('checkbox_on.gif', get_lang('Presence')) : Display::return_icon('checkbox_off.gif', get_lang('Presence')) ?> |
|
| 454 | 454 | <?php echo " ".$presence['date_time'] ?> |
| 455 | 455 | </td> |
| 456 | 456 | </tr> |
@@ -311,8 +311,8 @@ discard block |
||
| 311 | 311 | $extend_link = ''; |
| 312 | 312 | if (!empty($inter_num)) { |
| 313 | 313 | $extend_link = Display::url( |
| 314 | - Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
| 315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
| 314 | + Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
| 315 | + api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
| 316 | 316 | ); |
| 317 | 317 | } |
| 318 | 318 | $title = $row['mytitle']; |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | case 'last_30_days': |
| 1320 | 1320 | $new_date = date('Y-m-d H:i:s', strtotime('-30 day')); |
| 1321 | 1321 | $condition_time = ' AND (login_date >= "'.$new_date.'" AND logout_date <= "'.$today.'") '; |
| 1322 | - break; |
|
| 1322 | + break; |
|
| 1323 | 1323 | case 'custom': |
| 1324 | 1324 | if (!empty($start_date) && !empty($end_date)) { |
| 1325 | 1325 | $start_date = Database::escape_string($start_date); |
@@ -1329,10 +1329,10 @@ discard block |
||
| 1329 | 1329 | break; |
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | - $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
| 1332 | + $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
| 1333 | 1333 | FROM '.$tbl_track_login.' |
| 1334 | 1334 | WHERE '.$userCondition.$condition_time; |
| 1335 | - $rs = Database::query($sql); |
|
| 1335 | + $rs = Database::query($sql); |
|
| 1336 | 1336 | $row = Database::fetch_array($rs, 'ASSOC'); |
| 1337 | 1337 | $diff = $row['diff']; |
| 1338 | 1338 | |
@@ -1354,18 +1354,18 @@ discard block |
||
| 1354 | 1354 | public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0) |
| 1355 | 1355 | { |
| 1356 | 1356 | $courseId = intval($courseId); |
| 1357 | - $session_id = intval($session_id); |
|
| 1358 | - |
|
| 1359 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1360 | - if (is_array($user_id)) { |
|
| 1361 | - $user_id = array_map('intval', $user_id); |
|
| 1362 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
| 1363 | - } else { |
|
| 1364 | - $user_id = intval($user_id); |
|
| 1365 | - $condition_user = " AND user_id = $user_id "; |
|
| 1366 | - } |
|
| 1367 | - |
|
| 1368 | - $sql = "SELECT |
|
| 1357 | + $session_id = intval($session_id); |
|
| 1358 | + |
|
| 1359 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1360 | + if (is_array($user_id)) { |
|
| 1361 | + $user_id = array_map('intval', $user_id); |
|
| 1362 | + $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
| 1363 | + } else { |
|
| 1364 | + $user_id = intval($user_id); |
|
| 1365 | + $condition_user = " AND user_id = $user_id "; |
|
| 1366 | + } |
|
| 1367 | + |
|
| 1368 | + $sql = "SELECT |
|
| 1369 | 1369 | SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds |
| 1370 | 1370 | FROM $tbl_track_course |
| 1371 | 1371 | WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) "; |
@@ -1381,9 +1381,9 @@ discard block |
||
| 1381 | 1381 | $sql .= $condition_user; |
| 1382 | 1382 | |
| 1383 | 1383 | $rs = Database::query($sql); |
| 1384 | - $row = Database::fetch_array($rs); |
|
| 1384 | + $row = Database::fetch_array($rs); |
|
| 1385 | 1385 | |
| 1386 | - return $row['nb_seconds']; |
|
| 1386 | + return $row['nb_seconds']; |
|
| 1387 | 1387 | } |
| 1388 | 1388 | |
| 1389 | 1389 | /** |
@@ -1394,25 +1394,25 @@ discard block |
||
| 1394 | 1394 | */ |
| 1395 | 1395 | public static function get_first_connection_date($student_id) |
| 1396 | 1396 | { |
| 1397 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
| 1398 | - $sql = 'SELECT login_date |
|
| 1397 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
| 1398 | + $sql = 'SELECT login_date |
|
| 1399 | 1399 | FROM ' . $tbl_track_login . ' |
| 1400 | 1400 | WHERE login_user_id = ' . intval($student_id) . ' |
| 1401 | 1401 | ORDER BY login_date ASC |
| 1402 | 1402 | LIMIT 0,1'; |
| 1403 | 1403 | |
| 1404 | - $rs = Database::query($sql); |
|
| 1405 | - if (Database::num_rows($rs)>0) { |
|
| 1406 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
| 1404 | + $rs = Database::query($sql); |
|
| 1405 | + if (Database::num_rows($rs)>0) { |
|
| 1406 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
| 1407 | 1407 | return api_convert_and_format_date( |
| 1408 | 1408 | $first_login_date, |
| 1409 | 1409 | DATE_FORMAT_SHORT, |
| 1410 | 1410 | date_default_timezone_get() |
| 1411 | 1411 | ); |
| 1412 | - } |
|
| 1413 | - } |
|
| 1412 | + } |
|
| 1413 | + } |
|
| 1414 | 1414 | |
| 1415 | - return false; |
|
| 1415 | + return false; |
|
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | 1418 | /** |
@@ -1425,38 +1425,38 @@ discard block |
||
| 1425 | 1425 | */ |
| 1426 | 1426 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
| 1427 | 1427 | { |
| 1428 | - $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
| 1429 | - $sql = 'SELECT login_date |
|
| 1428 | + $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
| 1429 | + $sql = 'SELECT login_date |
|
| 1430 | 1430 | FROM ' . $table . ' |
| 1431 | 1431 | WHERE login_user_id = ' . intval($student_id) . ' |
| 1432 | 1432 | ORDER BY login_date |
| 1433 | 1433 | DESC LIMIT 0,1'; |
| 1434 | 1434 | |
| 1435 | - $rs = Database::query($sql); |
|
| 1436 | - if (Database::num_rows($rs) > 0) { |
|
| 1437 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
| 1438 | - $last_login_date = api_get_local_time($last_login_date); |
|
| 1439 | - if ($return_timestamp) { |
|
| 1440 | - return api_strtotime($last_login_date,'UTC'); |
|
| 1441 | - } else { |
|
| 1442 | - if (!$warning_message) { |
|
| 1443 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1444 | - } else { |
|
| 1445 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
| 1446 | - $currentTimestamp = time(); |
|
| 1447 | - |
|
| 1448 | - //If the last connection is > than 7 days, the text is red |
|
| 1449 | - //345600 = 7 days in seconds |
|
| 1450 | - if ($currentTimestamp - $timestamp > 604800) { |
|
| 1451 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
| 1452 | - } else { |
|
| 1453 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1454 | - } |
|
| 1455 | - } |
|
| 1456 | - } |
|
| 1457 | - } |
|
| 1458 | - } |
|
| 1459 | - return false; |
|
| 1435 | + $rs = Database::query($sql); |
|
| 1436 | + if (Database::num_rows($rs) > 0) { |
|
| 1437 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
| 1438 | + $last_login_date = api_get_local_time($last_login_date); |
|
| 1439 | + if ($return_timestamp) { |
|
| 1440 | + return api_strtotime($last_login_date,'UTC'); |
|
| 1441 | + } else { |
|
| 1442 | + if (!$warning_message) { |
|
| 1443 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1444 | + } else { |
|
| 1445 | + $timestamp = api_strtotime($last_login_date,'UTC'); |
|
| 1446 | + $currentTimestamp = time(); |
|
| 1447 | + |
|
| 1448 | + //If the last connection is > than 7 days, the text is red |
|
| 1449 | + //345600 = 7 days in seconds |
|
| 1450 | + if ($currentTimestamp - $timestamp > 604800) { |
|
| 1451 | + return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
| 1452 | + } else { |
|
| 1453 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1454 | + } |
|
| 1455 | + } |
|
| 1456 | + } |
|
| 1457 | + } |
|
| 1458 | + } |
|
| 1459 | + return false; |
|
| 1460 | 1460 | } |
| 1461 | 1461 | |
| 1462 | 1462 | /** |
@@ -1510,30 +1510,30 @@ discard block |
||
| 1510 | 1510 | $session_id = 0, |
| 1511 | 1511 | $convert_date = true |
| 1512 | 1512 | ) { |
| 1513 | - $student_id = intval($student_id); |
|
| 1513 | + $student_id = intval($student_id); |
|
| 1514 | 1514 | $courseId = intval($courseId); |
| 1515 | - $session_id = intval($session_id); |
|
| 1515 | + $session_id = intval($session_id); |
|
| 1516 | 1516 | |
| 1517 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1518 | - $sql = 'SELECT login_course_date |
|
| 1517 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1518 | + $sql = 'SELECT login_course_date |
|
| 1519 | 1519 | FROM '.$tbl_track_login.' |
| 1520 | 1520 | WHERE |
| 1521 | 1521 | user_id = '.$student_id.' AND |
| 1522 | 1522 | c_id = '.$courseId.' AND |
| 1523 | 1523 | session_id = '.$session_id.' |
| 1524 | 1524 | ORDER BY login_course_date ASC LIMIT 0,1'; |
| 1525 | - $rs = Database::query($sql); |
|
| 1526 | - if (Database::num_rows($rs) > 0) { |
|
| 1527 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
| 1528 | - if ($convert_date) { |
|
| 1529 | - return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
| 1530 | - } else { |
|
| 1531 | - return $first_login_date; |
|
| 1532 | - } |
|
| 1533 | - } |
|
| 1534 | - } |
|
| 1535 | - |
|
| 1536 | - return false; |
|
| 1525 | + $rs = Database::query($sql); |
|
| 1526 | + if (Database::num_rows($rs) > 0) { |
|
| 1527 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
| 1528 | + if ($convert_date) { |
|
| 1529 | + return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
| 1530 | + } else { |
|
| 1531 | + return $first_login_date; |
|
| 1532 | + } |
|
| 1533 | + } |
|
| 1534 | + } |
|
| 1535 | + |
|
| 1536 | + return false; |
|
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | /** |
@@ -1549,13 +1549,13 @@ discard block |
||
| 1549 | 1549 | $session_id = 0, |
| 1550 | 1550 | $convert_date = true |
| 1551 | 1551 | ) { |
| 1552 | - // protect data |
|
| 1553 | - $student_id = intval($student_id); |
|
| 1552 | + // protect data |
|
| 1553 | + $student_id = intval($student_id); |
|
| 1554 | 1554 | $courseId = $courseInfo['real_id']; |
| 1555 | - $session_id = intval($session_id); |
|
| 1555 | + $session_id = intval($session_id); |
|
| 1556 | 1556 | |
| 1557 | - $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 1558 | - $sql = 'SELECT access_date |
|
| 1557 | + $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 1558 | + $sql = 'SELECT access_date |
|
| 1559 | 1559 | FROM '.$tbl_track_e_access.' |
| 1560 | 1560 | WHERE access_user_id = '.$student_id.' AND |
| 1561 | 1561 | c_id = "'.$courseId.'" AND |
@@ -1563,39 +1563,39 @@ discard block |
||
| 1563 | 1563 | ORDER BY access_date DESC |
| 1564 | 1564 | LIMIT 0,1'; |
| 1565 | 1565 | |
| 1566 | - $rs = Database::query($sql); |
|
| 1567 | - if (Database::num_rows($rs) > 0) { |
|
| 1568 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
| 1566 | + $rs = Database::query($sql); |
|
| 1567 | + if (Database::num_rows($rs) > 0) { |
|
| 1568 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
| 1569 | 1569 | if (empty($last_login_date) || $last_login_date == '0000-00-00 00:00:00') { |
| 1570 | 1570 | return false; |
| 1571 | 1571 | } |
| 1572 | 1572 | //see #5736 |
| 1573 | 1573 | $last_login_date_timestamp = api_strtotime($last_login_date); |
| 1574 | - $now = time(); |
|
| 1575 | - //If the last connection is > than 7 days, the text is red |
|
| 1576 | - //345600 = 7 days in seconds |
|
| 1577 | - if ($now - $last_login_date_timestamp > 604800) { |
|
| 1578 | - if ($convert_date) { |
|
| 1574 | + $now = time(); |
|
| 1575 | + //If the last connection is > than 7 days, the text is red |
|
| 1576 | + //345600 = 7 days in seconds |
|
| 1577 | + if ($now - $last_login_date_timestamp > 604800) { |
|
| 1578 | + if ($convert_date) { |
|
| 1579 | 1579 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
| 1580 | 1580 | $icon = api_is_allowed_to_edit() ? |
| 1581 | 1581 | '<a href="'.api_get_path(REL_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'"> |
| 1582 | 1582 | '.Display::return_icon('messagebox_warning.gif').' |
| 1583 | 1583 | </a>' |
| 1584 | 1584 | : null; |
| 1585 | - return $icon. Display::label($last_login_date, 'warning'); |
|
| 1586 | - } else { |
|
| 1587 | - return $last_login_date; |
|
| 1588 | - } |
|
| 1589 | - } else { |
|
| 1590 | - if ($convert_date) { |
|
| 1591 | - return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1592 | - } else { |
|
| 1593 | - return $last_login_date; |
|
| 1594 | - } |
|
| 1595 | - } |
|
| 1596 | - } |
|
| 1597 | - } |
|
| 1598 | - return false; |
|
| 1585 | + return $icon. Display::label($last_login_date, 'warning'); |
|
| 1586 | + } else { |
|
| 1587 | + return $last_login_date; |
|
| 1588 | + } |
|
| 1589 | + } else { |
|
| 1590 | + if ($convert_date) { |
|
| 1591 | + return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
| 1592 | + } else { |
|
| 1593 | + return $last_login_date; |
|
| 1594 | + } |
|
| 1595 | + } |
|
| 1596 | + } |
|
| 1597 | + } |
|
| 1598 | + return false; |
|
| 1599 | 1599 | } |
| 1600 | 1600 | |
| 1601 | 1601 | /** |
@@ -1608,36 +1608,36 @@ discard block |
||
| 1608 | 1608 | */ |
| 1609 | 1609 | public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null) |
| 1610 | 1610 | { |
| 1611 | - if ($start < 0) { |
|
| 1612 | - $start = 0; |
|
| 1613 | - } |
|
| 1614 | - if (!isset($stop) or ($stop < 0)) { |
|
| 1615 | - $stop = api_get_utc_datetime(); |
|
| 1616 | - } |
|
| 1611 | + if ($start < 0) { |
|
| 1612 | + $start = 0; |
|
| 1613 | + } |
|
| 1614 | + if (!isset($stop) or ($stop < 0)) { |
|
| 1615 | + $stop = api_get_utc_datetime(); |
|
| 1616 | + } |
|
| 1617 | 1617 | |
| 1618 | 1618 | $start = Database::escape_string($start); |
| 1619 | 1619 | $stop = Database::escape_string($stop); |
| 1620 | 1620 | |
| 1621 | - $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
| 1621 | + $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
| 1622 | 1622 | |
| 1623 | 1623 | $courseId = intval($courseId); |
| 1624 | - $session_id = intval($session_id); |
|
| 1625 | - $count = 0; |
|
| 1624 | + $session_id = intval($session_id); |
|
| 1625 | + $count = 0; |
|
| 1626 | 1626 | |
| 1627 | - $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1628 | - $sql = "SELECT count(*) as count_connections |
|
| 1627 | + $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
| 1628 | + $sql = "SELECT count(*) as count_connections |
|
| 1629 | 1629 | FROM $tbl_track_e_course_access |
| 1630 | 1630 | WHERE |
| 1631 | 1631 | c_id = $courseId AND |
| 1632 | 1632 | session_id = $session_id |
| 1633 | 1633 | $month_filter"; |
| 1634 | - $rs = Database::query($sql); |
|
| 1635 | - if (Database::num_rows($rs)>0) { |
|
| 1636 | - $row = Database::fetch_object($rs); |
|
| 1637 | - $count = $row->count_connections; |
|
| 1638 | - } |
|
| 1634 | + $rs = Database::query($sql); |
|
| 1635 | + if (Database::num_rows($rs)>0) { |
|
| 1636 | + $row = Database::fetch_object($rs); |
|
| 1637 | + $count = $row->count_connections; |
|
| 1638 | + } |
|
| 1639 | 1639 | |
| 1640 | - return $count; |
|
| 1640 | + return $count; |
|
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | 1643 | /** |
@@ -1648,25 +1648,25 @@ discard block |
||
| 1648 | 1648 | */ |
| 1649 | 1649 | public static function count_course_per_student($user_id, $include_sessions = true) |
| 1650 | 1650 | { |
| 1651 | - $user_id = intval($user_id); |
|
| 1652 | - $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
| 1653 | - $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 1651 | + $user_id = intval($user_id); |
|
| 1652 | + $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
| 1653 | + $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
| 1654 | 1654 | |
| 1655 | - $sql = 'SELECT DISTINCT c_id |
|
| 1655 | + $sql = 'SELECT DISTINCT c_id |
|
| 1656 | 1656 | FROM ' . $tbl_course_rel_user . ' |
| 1657 | 1657 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
| 1658 | - $rs = Database::query($sql); |
|
| 1659 | - $nb_courses = Database::num_rows($rs); |
|
| 1658 | + $rs = Database::query($sql); |
|
| 1659 | + $nb_courses = Database::num_rows($rs); |
|
| 1660 | 1660 | |
| 1661 | - if ($include_sessions) { |
|
| 1662 | - $sql = 'SELECT DISTINCT c_id |
|
| 1661 | + if ($include_sessions) { |
|
| 1662 | + $sql = 'SELECT DISTINCT c_id |
|
| 1663 | 1663 | FROM ' . $tbl_session_course_rel_user . ' |
| 1664 | 1664 | WHERE user_id = ' . $user_id; |
| 1665 | - $rs = Database::query($sql); |
|
| 1666 | - $nb_courses += Database::num_rows($rs); |
|
| 1667 | - } |
|
| 1665 | + $rs = Database::query($sql); |
|
| 1666 | + $nb_courses += Database::num_rows($rs); |
|
| 1667 | + } |
|
| 1668 | 1668 | |
| 1669 | - return $nb_courses; |
|
| 1669 | + return $nb_courses; |
|
| 1670 | 1670 | } |
| 1671 | 1671 | |
| 1672 | 1672 | /** |
@@ -1697,25 +1697,25 @@ discard block |
||
| 1697 | 1697 | $into_lp = 0 |
| 1698 | 1698 | ) { |
| 1699 | 1699 | $course_code = Database::escape_string($course_code); |
| 1700 | - $course_info = api_get_course_info($course_code); |
|
| 1701 | - if (!empty($course_info)) { |
|
| 1702 | - // table definition |
|
| 1703 | - $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 1704 | - $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 1705 | - |
|
| 1706 | - // Compose a filter based on optional exercise given |
|
| 1707 | - $condition_quiz = ""; |
|
| 1708 | - if (!empty($exercise_id)) { |
|
| 1709 | - $exercise_id = intval($exercise_id); |
|
| 1710 | - $condition_quiz =" AND id = $exercise_id "; |
|
| 1711 | - } |
|
| 1712 | - |
|
| 1713 | - // Compose a filter based on optional session id given |
|
| 1714 | - $condition_session = ""; |
|
| 1715 | - if (isset($session_id)) { |
|
| 1716 | - $session_id = intval($session_id); |
|
| 1717 | - $condition_session = " AND session_id = $session_id "; |
|
| 1718 | - } |
|
| 1700 | + $course_info = api_get_course_info($course_code); |
|
| 1701 | + if (!empty($course_info)) { |
|
| 1702 | + // table definition |
|
| 1703 | + $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
| 1704 | + $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 1705 | + |
|
| 1706 | + // Compose a filter based on optional exercise given |
|
| 1707 | + $condition_quiz = ""; |
|
| 1708 | + if (!empty($exercise_id)) { |
|
| 1709 | + $exercise_id = intval($exercise_id); |
|
| 1710 | + $condition_quiz =" AND id = $exercise_id "; |
|
| 1711 | + } |
|
| 1712 | + |
|
| 1713 | + // Compose a filter based on optional session id given |
|
| 1714 | + $condition_session = ""; |
|
| 1715 | + if (isset($session_id)) { |
|
| 1716 | + $session_id = intval($session_id); |
|
| 1717 | + $condition_session = " AND session_id = $session_id "; |
|
| 1718 | + } |
|
| 1719 | 1719 | if ($active_filter == 1) { |
| 1720 | 1720 | $condition_active = 'AND active <> -1'; |
| 1721 | 1721 | } elseif ($active_filter == 0) { |
@@ -1731,25 +1731,25 @@ discard block |
||
| 1731 | 1731 | $select_lp_id = ', orig_lp_id as lp_id '; |
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | - $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
| 1734 | + $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
| 1735 | 1735 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz "; |
| 1736 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
| 1736 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
| 1737 | 1737 | |
| 1738 | - if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
| 1739 | - if (is_array($student_id)) { |
|
| 1738 | + if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
| 1739 | + if (is_array($student_id)) { |
|
| 1740 | 1740 | $student_id = array_map('intval', $student_id); |
| 1741 | - $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
| 1742 | - } else { |
|
| 1741 | + $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
| 1742 | + } else { |
|
| 1743 | 1743 | $student_id = intval($student_id); |
| 1744 | - $condition_user = " AND exe_user_id = '$student_id' "; |
|
| 1745 | - } |
|
| 1744 | + $condition_user = " AND exe_user_id = '$student_id' "; |
|
| 1745 | + } |
|
| 1746 | 1746 | |
| 1747 | - if (empty($exercise_id)) { |
|
| 1748 | - $sql = "SELECT id FROM $tbl_course_quiz |
|
| 1747 | + if (empty($exercise_id)) { |
|
| 1748 | + $sql = "SELECT id FROM $tbl_course_quiz |
|
| 1749 | 1749 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz"; |
| 1750 | 1750 | $result = Database::query($sql); |
| 1751 | 1751 | $exercise_list = array(); |
| 1752 | - $exercise_id = null; |
|
| 1752 | + $exercise_id = null; |
|
| 1753 | 1753 | if (Database::num_rows($result)) { |
| 1754 | 1754 | while ($row = Database::fetch_array($result)) { |
| 1755 | 1755 | $exercise_list[] = $row['id']; |
@@ -1758,11 +1758,11 @@ discard block |
||
| 1758 | 1758 | if (!empty($exercise_list)) { |
| 1759 | 1759 | $exercise_id = implode("','",$exercise_list); |
| 1760 | 1760 | } |
| 1761 | - } |
|
| 1761 | + } |
|
| 1762 | 1762 | |
| 1763 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
| 1763 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
| 1764 | 1764 | |
| 1765 | - $sql = "SELECT |
|
| 1765 | + $sql = "SELECT |
|
| 1766 | 1766 | SUM(exe_result/exe_weighting*100) as avg_score, |
| 1767 | 1767 | COUNT(*) as num_attempts |
| 1768 | 1768 | $select_lp_id |
@@ -1776,20 +1776,20 @@ discard block |
||
| 1776 | 1776 | $condition_into_lp |
| 1777 | 1777 | ORDER BY exe_date DESC"; |
| 1778 | 1778 | |
| 1779 | - $res = Database::query($sql); |
|
| 1780 | - $row = Database::fetch_array($res); |
|
| 1781 | - $quiz_avg_score = null; |
|
| 1779 | + $res = Database::query($sql); |
|
| 1780 | + $row = Database::fetch_array($res); |
|
| 1781 | + $quiz_avg_score = null; |
|
| 1782 | 1782 | |
| 1783 | - if (!empty($row['avg_score'])) { |
|
| 1784 | - $quiz_avg_score = round($row['avg_score'],2); |
|
| 1785 | - } |
|
| 1783 | + if (!empty($row['avg_score'])) { |
|
| 1784 | + $quiz_avg_score = round($row['avg_score'],2); |
|
| 1785 | + } |
|
| 1786 | 1786 | |
| 1787 | - if(!empty($row['num_attempts'])) { |
|
| 1788 | - $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
| 1789 | - } |
|
| 1790 | - if (is_array($student_id)) { |
|
| 1791 | - $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
| 1792 | - } |
|
| 1787 | + if(!empty($row['num_attempts'])) { |
|
| 1788 | + $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
| 1789 | + } |
|
| 1790 | + if (is_array($student_id)) { |
|
| 1791 | + $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
| 1792 | + } |
|
| 1793 | 1793 | if ($into_lp == 0) { |
| 1794 | 1794 | return $quiz_avg_score; |
| 1795 | 1795 | } else { |
@@ -1812,9 +1812,9 @@ discard block |
||
| 1812 | 1812 | return array($quiz_avg_score, null); |
| 1813 | 1813 | } |
| 1814 | 1814 | } |
| 1815 | - } |
|
| 1816 | - } |
|
| 1817 | - return null; |
|
| 1815 | + } |
|
| 1816 | + } |
|
| 1817 | + return null; |
|
| 1818 | 1818 | } |
| 1819 | 1819 | |
| 1820 | 1820 | /** |
@@ -1847,15 +1847,15 @@ discard block |
||
| 1847 | 1847 | $find_all_lp = 0 |
| 1848 | 1848 | ) { |
| 1849 | 1849 | $courseId = intval($courseId); |
| 1850 | - $student_id = intval($student_id); |
|
| 1851 | - $exercise_id = intval($exercise_id); |
|
| 1852 | - $session_id = intval($session_id); |
|
| 1850 | + $student_id = intval($student_id); |
|
| 1851 | + $exercise_id = intval($exercise_id); |
|
| 1852 | + $session_id = intval($session_id); |
|
| 1853 | 1853 | |
| 1854 | - $lp_id = intval($lp_id); |
|
| 1854 | + $lp_id = intval($lp_id); |
|
| 1855 | 1855 | $lp_item_id = intval($lp_item_id); |
| 1856 | - $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 1856 | + $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
| 1857 | 1857 | |
| 1858 | - $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
| 1858 | + $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
| 1859 | 1859 | WHERE ex.c_id = $courseId |
| 1860 | 1860 | AND ex.exe_exo_id = $exercise_id |
| 1861 | 1861 | AND status = '' |
@@ -1870,11 +1870,11 @@ discard block |
||
| 1870 | 1870 | AND orig_lp_item_id = $lp_item_id"; |
| 1871 | 1871 | } |
| 1872 | 1872 | |
| 1873 | - $rs = Database::query($sql); |
|
| 1874 | - $row = Database::fetch_row($rs); |
|
| 1875 | - $count_attempts = $row[0]; |
|
| 1873 | + $rs = Database::query($sql); |
|
| 1874 | + $row = Database::fetch_row($rs); |
|
| 1875 | + $count_attempts = $row[0]; |
|
| 1876 | 1876 | |
| 1877 | - return $count_attempts; |
|
| 1877 | + return $count_attempts; |
|
| 1878 | 1878 | } |
| 1879 | 1879 | |
| 1880 | 1880 | /** |
@@ -1884,7 +1884,7 @@ discard block |
||
| 1884 | 1884 | * @param int $user_id |
| 1885 | 1885 | * @param int $courseId |
| 1886 | 1886 | * @param int $session_id |
| 1887 | - */ |
|
| 1887 | + */ |
|
| 1888 | 1888 | public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id) |
| 1889 | 1889 | { |
| 1890 | 1890 | $courseId = intval($courseId); |
@@ -3500,8 +3500,8 @@ discard block |
||
| 3500 | 3500 | |
| 3501 | 3501 | $condition_session = ''; |
| 3502 | 3502 | if (isset($session_id)) { |
| 3503 | - $session_id = intval($session_id); |
|
| 3504 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
| 3503 | + $session_id = intval($session_id); |
|
| 3504 | + $condition_session = ' AND f.session_id = '. $session_id; |
|
| 3505 | 3505 | } |
| 3506 | 3506 | |
| 3507 | 3507 | $groupId = intval($groupId); |
@@ -5400,9 +5400,9 @@ discard block |
||
| 5400 | 5400 | } |
| 5401 | 5401 | |
| 5402 | 5402 | /** |
| 5403 | - * @param FormValidator $form |
|
| 5404 | - * @return mixed |
|
| 5405 | - */ |
|
| 5403 | + * @param FormValidator $form |
|
| 5404 | + * @return mixed |
|
| 5405 | + */ |
|
| 5406 | 5406 | public static function setUserSearchForm($form) |
| 5407 | 5407 | { |
| 5408 | 5408 | global $_configuration; |
@@ -5681,26 +5681,26 @@ discard block |
||
| 5681 | 5681 | $session_id = api_get_session_id(); |
| 5682 | 5682 | $course_id = api_get_course_int_id(); |
| 5683 | 5683 | |
| 5684 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
| 5685 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 5684 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
| 5685 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 5686 | 5686 | |
| 5687 | - $sql = "SELECT count(tool) AS total_number_of_items |
|
| 5687 | + $sql = "SELECT count(tool) AS total_number_of_items |
|
| 5688 | 5688 | FROM $table_item_property track_resource, $table_user user |
| 5689 | 5689 | WHERE |
| 5690 | 5690 | track_resource.c_id = $course_id AND |
| 5691 | 5691 | track_resource.insert_user_id = user.user_id AND |
| 5692 | 5692 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
| 5693 | 5693 | |
| 5694 | - if (isset($_GET['keyword'])) { |
|
| 5695 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
| 5696 | - $sql .= " AND ( |
|
| 5694 | + if (isset($_GET['keyword'])) { |
|
| 5695 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
| 5696 | + $sql .= " AND ( |
|
| 5697 | 5697 | user.username LIKE '%".$keyword."%' OR |
| 5698 | 5698 | lastedit_type LIKE '%".$keyword."%' OR |
| 5699 | 5699 | tool LIKE '%".$keyword."%' |
| 5700 | 5700 | )"; |
| 5701 | - } |
|
| 5701 | + } |
|
| 5702 | 5702 | |
| 5703 | - $sql .= " AND tool IN ( |
|
| 5703 | + $sql .= " AND tool IN ( |
|
| 5704 | 5704 | 'document', |
| 5705 | 5705 | 'learnpath', |
| 5706 | 5706 | 'quiz', |
@@ -5712,10 +5712,10 @@ discard block |
||
| 5712 | 5712 | 'thematic_advance', |
| 5713 | 5713 | 'thematic_plan' |
| 5714 | 5714 | )"; |
| 5715 | - $res = Database::query($sql); |
|
| 5716 | - $obj = Database::fetch_object($res); |
|
| 5715 | + $res = Database::query($sql); |
|
| 5716 | + $obj = Database::fetch_object($res); |
|
| 5717 | 5717 | |
| 5718 | - return $obj->total_number_of_items; |
|
| 5718 | + return $obj->total_number_of_items; |
|
| 5719 | 5719 | } |
| 5720 | 5720 | |
| 5721 | 5721 | /** |
@@ -5730,12 +5730,12 @@ discard block |
||
| 5730 | 5730 | $session_id = api_get_session_id(); |
| 5731 | 5731 | $course_id = api_get_course_int_id(); |
| 5732 | 5732 | |
| 5733 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
| 5734 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 5735 | - $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
| 5736 | - $session_id = intval($session_id); |
|
| 5733 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
| 5734 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 5735 | + $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
| 5736 | + $session_id = intval($session_id); |
|
| 5737 | 5737 | |
| 5738 | - $sql = "SELECT |
|
| 5738 | + $sql = "SELECT |
|
| 5739 | 5739 | tool as col0, |
| 5740 | 5740 | lastedit_type as col1, |
| 5741 | 5741 | ref as ref, |
@@ -5749,16 +5749,16 @@ discard block |
||
| 5749 | 5749 | track_resource.insert_user_id = user.user_id AND |
| 5750 | 5750 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
| 5751 | 5751 | |
| 5752 | - if (isset($_GET['keyword'])) { |
|
| 5753 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
| 5754 | - $sql .= " AND ( |
|
| 5752 | + if (isset($_GET['keyword'])) { |
|
| 5753 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
| 5754 | + $sql .= " AND ( |
|
| 5755 | 5755 | user.username LIKE '%".$keyword."%' OR |
| 5756 | 5756 | lastedit_type LIKE '%".$keyword."%' OR |
| 5757 | 5757 | tool LIKE '%".$keyword."%' |
| 5758 | 5758 | ) "; |
| 5759 | - } |
|
| 5759 | + } |
|
| 5760 | 5760 | |
| 5761 | - $sql .= " AND tool IN ( |
|
| 5761 | + $sql .= " AND tool IN ( |
|
| 5762 | 5762 | 'document', |
| 5763 | 5763 | 'learnpath', |
| 5764 | 5764 | 'quiz', |
@@ -5771,41 +5771,41 @@ discard block |
||
| 5771 | 5771 | 'thematic_plan' |
| 5772 | 5772 | )"; |
| 5773 | 5773 | |
| 5774 | - if ($column == 0) { |
|
| 5775 | - $column = '0'; |
|
| 5776 | - } |
|
| 5777 | - if ($column != '' && $direction != '') { |
|
| 5778 | - if ($column != 2 && $column != 4) { |
|
| 5779 | - $sql .= " ORDER BY col$column $direction"; |
|
| 5780 | - } |
|
| 5781 | - } else { |
|
| 5782 | - $sql .= " ORDER BY col5 DESC "; |
|
| 5783 | - } |
|
| 5774 | + if ($column == 0) { |
|
| 5775 | + $column = '0'; |
|
| 5776 | + } |
|
| 5777 | + if ($column != '' && $direction != '') { |
|
| 5778 | + if ($column != 2 && $column != 4) { |
|
| 5779 | + $sql .= " ORDER BY col$column $direction"; |
|
| 5780 | + } |
|
| 5781 | + } else { |
|
| 5782 | + $sql .= " ORDER BY col5 DESC "; |
|
| 5783 | + } |
|
| 5784 | 5784 | |
| 5785 | 5785 | $from = intval($from); |
| 5786 | 5786 | $number_of_items = intval($number_of_items); |
| 5787 | 5787 | |
| 5788 | - $sql .= " LIMIT $from, $number_of_items "; |
|
| 5789 | - |
|
| 5790 | - $res = Database::query($sql); |
|
| 5791 | - $resources = array(); |
|
| 5792 | - $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
| 5793 | - while ($row = Database::fetch_array($res)) { |
|
| 5794 | - $ref = $row['ref']; |
|
| 5795 | - $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
| 5796 | - $table_tool = Database :: get_course_table($table_name['table_name']); |
|
| 5797 | - |
|
| 5798 | - $id = $table_name['id_tool']; |
|
| 5799 | - $recorset = false; |
|
| 5788 | + $sql .= " LIMIT $from, $number_of_items "; |
|
| 5800 | 5789 | |
| 5801 | - if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
| 5802 | - $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
| 5803 | - $sql = "SELECT thematic_id FROM $table_tool |
|
| 5790 | + $res = Database::query($sql); |
|
| 5791 | + $resources = array(); |
|
| 5792 | + $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
| 5793 | + while ($row = Database::fetch_array($res)) { |
|
| 5794 | + $ref = $row['ref']; |
|
| 5795 | + $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
| 5796 | + $table_tool = Database :: get_course_table($table_name['table_name']); |
|
| 5797 | + |
|
| 5798 | + $id = $table_name['id_tool']; |
|
| 5799 | + $recorset = false; |
|
| 5800 | + |
|
| 5801 | + if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
| 5802 | + $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
| 5803 | + $sql = "SELECT thematic_id FROM $table_tool |
|
| 5804 | 5804 | WHERE c_id = $course_id AND id = $ref"; |
| 5805 | - $rs_thematic = Database::query($sql); |
|
| 5806 | - if (Database::num_rows($rs_thematic)) { |
|
| 5807 | - $row_thematic = Database::fetch_array($rs_thematic); |
|
| 5808 | - $thematic_id = $row_thematic['thematic_id']; |
|
| 5805 | + $rs_thematic = Database::query($sql); |
|
| 5806 | + if (Database::num_rows($rs_thematic)) { |
|
| 5807 | + $row_thematic = Database::fetch_array($rs_thematic); |
|
| 5808 | + $thematic_id = $row_thematic['thematic_id']; |
|
| 5809 | 5809 | |
| 5810 | 5810 | $sql = "SELECT session.id, session.name, user.username |
| 5811 | 5811 | FROM $tbl_thematic t, $table_session session, $table_user user |
@@ -5814,9 +5814,9 @@ discard block |
||
| 5814 | 5814 | t.session_id = session.id AND |
| 5815 | 5815 | session.id_coach = user.user_id AND |
| 5816 | 5816 | t.id = $thematic_id"; |
| 5817 | - $recorset = Database::query($sql); |
|
| 5818 | - } |
|
| 5819 | - } else { |
|
| 5817 | + $recorset = Database::query($sql); |
|
| 5818 | + } |
|
| 5819 | + } else { |
|
| 5820 | 5820 | $sql = "SELECT session.id, session.name, user.username |
| 5821 | 5821 | FROM $table_tool tool, $table_session session, $table_user user |
| 5822 | 5822 | WHERE |
@@ -5824,127 +5824,127 @@ discard block |
||
| 5824 | 5824 | tool.session_id = session.id AND |
| 5825 | 5825 | session.id_coach = user.user_id AND |
| 5826 | 5826 | tool.$id = $ref"; |
| 5827 | - $recorset = Database::query($sql); |
|
| 5828 | - } |
|
| 5829 | - |
|
| 5830 | - if (!empty($recorset)) { |
|
| 5831 | - $obj = Database::fetch_object($recorset); |
|
| 5832 | - |
|
| 5833 | - $name_session = ''; |
|
| 5834 | - $coach_name = ''; |
|
| 5835 | - if (!empty($obj)) { |
|
| 5836 | - $name_session = $obj->name; |
|
| 5837 | - $coach_name = $obj->username; |
|
| 5838 | - } |
|
| 5839 | - |
|
| 5840 | - $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
| 5841 | - $row[0] = ''; |
|
| 5842 | - if ($row['col6'] != 2) { |
|
| 5843 | - if (in_array($row['col0'], $thematic_tools)) { |
|
| 5844 | - |
|
| 5845 | - $exp_thematic_tool = explode('_', $row['col0']); |
|
| 5846 | - $thematic_tool_title = ''; |
|
| 5847 | - if (is_array($exp_thematic_tool)) { |
|
| 5848 | - foreach ($exp_thematic_tool as $exp) { |
|
| 5849 | - $thematic_tool_title .= api_ucfirst($exp); |
|
| 5850 | - } |
|
| 5851 | - } else { |
|
| 5852 | - $thematic_tool_title = api_ucfirst($row['col0']); |
|
| 5853 | - } |
|
| 5854 | - |
|
| 5855 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
| 5856 | - } else { |
|
| 5857 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
| 5858 | - } |
|
| 5859 | - } else { |
|
| 5860 | - $row[0] = api_ucfirst($row['col0']); |
|
| 5861 | - } |
|
| 5862 | - $row[1] = get_lang($row[1]); |
|
| 5863 | - $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
| 5864 | - $row[5] = ''; |
|
| 5865 | - //@todo Improve this code please |
|
| 5866 | - switch ($table_name['table_name']) { |
|
| 5867 | - case 'document' : |
|
| 5868 | - $sql = "SELECT tool.title as title FROM $table_tool tool |
|
| 5827 | + $recorset = Database::query($sql); |
|
| 5828 | + } |
|
| 5829 | + |
|
| 5830 | + if (!empty($recorset)) { |
|
| 5831 | + $obj = Database::fetch_object($recorset); |
|
| 5832 | + |
|
| 5833 | + $name_session = ''; |
|
| 5834 | + $coach_name = ''; |
|
| 5835 | + if (!empty($obj)) { |
|
| 5836 | + $name_session = $obj->name; |
|
| 5837 | + $coach_name = $obj->username; |
|
| 5838 | + } |
|
| 5839 | + |
|
| 5840 | + $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
| 5841 | + $row[0] = ''; |
|
| 5842 | + if ($row['col6'] != 2) { |
|
| 5843 | + if (in_array($row['col0'], $thematic_tools)) { |
|
| 5844 | + |
|
| 5845 | + $exp_thematic_tool = explode('_', $row['col0']); |
|
| 5846 | + $thematic_tool_title = ''; |
|
| 5847 | + if (is_array($exp_thematic_tool)) { |
|
| 5848 | + foreach ($exp_thematic_tool as $exp) { |
|
| 5849 | + $thematic_tool_title .= api_ucfirst($exp); |
|
| 5850 | + } |
|
| 5851 | + } else { |
|
| 5852 | + $thematic_tool_title = api_ucfirst($row['col0']); |
|
| 5853 | + } |
|
| 5854 | + |
|
| 5855 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
| 5856 | + } else { |
|
| 5857 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
| 5858 | + } |
|
| 5859 | + } else { |
|
| 5860 | + $row[0] = api_ucfirst($row['col0']); |
|
| 5861 | + } |
|
| 5862 | + $row[1] = get_lang($row[1]); |
|
| 5863 | + $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
| 5864 | + $row[5] = ''; |
|
| 5865 | + //@todo Improve this code please |
|
| 5866 | + switch ($table_name['table_name']) { |
|
| 5867 | + case 'document' : |
|
| 5868 | + $sql = "SELECT tool.title as title FROM $table_tool tool |
|
| 5869 | 5869 | WHERE c_id = $course_id AND id = $ref"; |
| 5870 | - $rs_document = Database::query($sql); |
|
| 5871 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5872 | - $row[5] = $obj_document->title; |
|
| 5870 | + $rs_document = Database::query($sql); |
|
| 5871 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5872 | + $row[5] = $obj_document->title; |
|
| 5873 | 5873 | |
| 5874 | - break; |
|
| 5875 | - case 'announcement': |
|
| 5874 | + break; |
|
| 5875 | + case 'announcement': |
|
| 5876 | 5876 | $sql = "SELECT title FROM $table_tool |
| 5877 | 5877 | WHERE c_id = $course_id AND id = $ref"; |
| 5878 | - $rs_document = Database::query($sql); |
|
| 5879 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5878 | + $rs_document = Database::query($sql); |
|
| 5879 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5880 | 5880 | if ($obj_document) { |
| 5881 | 5881 | $row[5] = $obj_document->title; |
| 5882 | 5882 | } |
| 5883 | - break; |
|
| 5884 | - case 'glossary': |
|
| 5883 | + break; |
|
| 5884 | + case 'glossary': |
|
| 5885 | 5885 | $sql = "SELECT name FROM $table_tool |
| 5886 | 5886 | WHERE c_id = $course_id AND glossary_id = $ref"; |
| 5887 | - $rs_document = Database::query($sql); |
|
| 5888 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5887 | + $rs_document = Database::query($sql); |
|
| 5888 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5889 | 5889 | if ($obj_document) { |
| 5890 | 5890 | $row[5] = $obj_document->name; |
| 5891 | 5891 | } |
| 5892 | - break; |
|
| 5893 | - case 'lp': |
|
| 5892 | + break; |
|
| 5893 | + case 'lp': |
|
| 5894 | 5894 | $sql = "SELECT name |
| 5895 | 5895 | FROM $table_tool WHERE c_id = $course_id AND id = $ref"; |
| 5896 | - $rs_document = Database::query($sql); |
|
| 5897 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5898 | - $row[5] = $obj_document->name; |
|
| 5899 | - break; |
|
| 5900 | - case 'quiz': |
|
| 5896 | + $rs_document = Database::query($sql); |
|
| 5897 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5898 | + $row[5] = $obj_document->name; |
|
| 5899 | + break; |
|
| 5900 | + case 'quiz': |
|
| 5901 | 5901 | $sql = "SELECT title FROM $table_tool |
| 5902 | 5902 | WHERE c_id = $course_id AND id = $ref"; |
| 5903 | - $rs_document = Database::query($sql); |
|
| 5904 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5903 | + $rs_document = Database::query($sql); |
|
| 5904 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5905 | 5905 | if ($obj_document) { |
| 5906 | 5906 | $row[5] = $obj_document->title; |
| 5907 | 5907 | } |
| 5908 | - break; |
|
| 5909 | - case 'course_description': |
|
| 5908 | + break; |
|
| 5909 | + case 'course_description': |
|
| 5910 | 5910 | $sql = "SELECT title FROM $table_tool |
| 5911 | 5911 | WHERE c_id = $course_id AND id = $ref"; |
| 5912 | - $rs_document = Database::query($sql); |
|
| 5913 | - $obj_document = Database::fetch_object($rs_document); |
|
| 5912 | + $rs_document = Database::query($sql); |
|
| 5913 | + $obj_document = Database::fetch_object($rs_document); |
|
| 5914 | 5914 | if ($obj_document) { |
| 5915 | 5915 | $row[5] = $obj_document->title; |
| 5916 | 5916 | } |
| 5917 | - break; |
|
| 5918 | - case 'thematic': |
|
| 5919 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5920 | - if (Database::num_rows($rs) > 0) { |
|
| 5921 | - $obj = Database::fetch_object($rs); |
|
| 5922 | - $row[5] = $obj->title; |
|
| 5923 | - } |
|
| 5924 | - break; |
|
| 5925 | - case 'thematic_advance': |
|
| 5926 | - $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5927 | - if (Database::num_rows($rs) > 0) { |
|
| 5928 | - $obj = Database::fetch_object($rs); |
|
| 5929 | - $row[5] = $obj->content; |
|
| 5930 | - } |
|
| 5931 | - break; |
|
| 5932 | - case 'thematic_plan': |
|
| 5933 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5934 | - if (Database::num_rows($rs) > 0) { |
|
| 5935 | - $obj = Database::fetch_object($rs); |
|
| 5936 | - $row[5] = $obj->title; |
|
| 5937 | - } |
|
| 5938 | - break; |
|
| 5939 | - default: |
|
| 5940 | - break; |
|
| 5941 | - } |
|
| 5942 | - |
|
| 5943 | - $row2 = $name_session; |
|
| 5944 | - if (!empty($coach_name)) { |
|
| 5945 | - $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
| 5946 | - } |
|
| 5947 | - $row[2] = $row2; |
|
| 5917 | + break; |
|
| 5918 | + case 'thematic': |
|
| 5919 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5920 | + if (Database::num_rows($rs) > 0) { |
|
| 5921 | + $obj = Database::fetch_object($rs); |
|
| 5922 | + $row[5] = $obj->title; |
|
| 5923 | + } |
|
| 5924 | + break; |
|
| 5925 | + case 'thematic_advance': |
|
| 5926 | + $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5927 | + if (Database::num_rows($rs) > 0) { |
|
| 5928 | + $obj = Database::fetch_object($rs); |
|
| 5929 | + $row[5] = $obj->content; |
|
| 5930 | + } |
|
| 5931 | + break; |
|
| 5932 | + case 'thematic_plan': |
|
| 5933 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
| 5934 | + if (Database::num_rows($rs) > 0) { |
|
| 5935 | + $obj = Database::fetch_object($rs); |
|
| 5936 | + $row[5] = $obj->title; |
|
| 5937 | + } |
|
| 5938 | + break; |
|
| 5939 | + default: |
|
| 5940 | + break; |
|
| 5941 | + } |
|
| 5942 | + |
|
| 5943 | + $row2 = $name_session; |
|
| 5944 | + if (!empty($coach_name)) { |
|
| 5945 | + $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
| 5946 | + } |
|
| 5947 | + $row[2] = $row2; |
|
| 5948 | 5948 | if (!empty($row['col3'])) { |
| 5949 | 5949 | $userInfo = api_get_user_info($row['user_id']); |
| 5950 | 5950 | |
@@ -5961,11 +5961,11 @@ discard block |
||
| 5961 | 5961 | $row[4] = $ip; |
| 5962 | 5962 | } |
| 5963 | 5963 | |
| 5964 | - $resources[] = $row; |
|
| 5965 | - } |
|
| 5966 | - } |
|
| 5964 | + $resources[] = $row; |
|
| 5965 | + } |
|
| 5966 | + } |
|
| 5967 | 5967 | |
| 5968 | - return $resources; |
|
| 5968 | + return $resources; |
|
| 5969 | 5969 | } |
| 5970 | 5970 | |
| 5971 | 5971 | /** |
@@ -5975,63 +5975,63 @@ discard block |
||
| 5975 | 5975 | */ |
| 5976 | 5976 | public static function get_tool_name_table($tool) |
| 5977 | 5977 | { |
| 5978 | - switch ($tool) { |
|
| 5979 | - case 'document': |
|
| 5980 | - $table_name = TABLE_DOCUMENT; |
|
| 5981 | - $link_tool = 'document/document.php'; |
|
| 5982 | - $id_tool = 'id'; |
|
| 5983 | - break; |
|
| 5984 | - case 'learnpath': |
|
| 5985 | - $table_name = TABLE_LP_MAIN; |
|
| 5986 | - $link_tool = 'newscorm/lp_controller.php'; |
|
| 5987 | - $id_tool = 'id'; |
|
| 5988 | - break; |
|
| 5989 | - case 'quiz': |
|
| 5990 | - $table_name = TABLE_QUIZ_TEST; |
|
| 5991 | - $link_tool = 'exercice/exercice.php'; |
|
| 5992 | - $id_tool = 'id'; |
|
| 5993 | - break; |
|
| 5994 | - case 'glossary': |
|
| 5995 | - $table_name = TABLE_GLOSSARY; |
|
| 5996 | - $link_tool = 'glossary/index.php'; |
|
| 5997 | - $id_tool = 'glossary_id'; |
|
| 5998 | - break; |
|
| 5999 | - case 'link': |
|
| 6000 | - $table_name = TABLE_LINK; |
|
| 6001 | - $link_tool = 'link/link.php'; |
|
| 6002 | - $id_tool = 'id'; |
|
| 6003 | - break; |
|
| 6004 | - case 'course_description': |
|
| 6005 | - $table_name = TABLE_COURSE_DESCRIPTION; |
|
| 6006 | - $link_tool = 'course_description/'; |
|
| 6007 | - $id_tool = 'id'; |
|
| 6008 | - break; |
|
| 6009 | - case 'announcement': |
|
| 6010 | - $table_name = TABLE_ANNOUNCEMENT; |
|
| 6011 | - $link_tool = 'announcements/announcements.php'; |
|
| 6012 | - $id_tool = 'id'; |
|
| 6013 | - break; |
|
| 6014 | - case 'thematic': |
|
| 6015 | - $table_name = TABLE_THEMATIC; |
|
| 6016 | - $link_tool = 'course_progress/index.php'; |
|
| 6017 | - $id_tool = 'id'; |
|
| 6018 | - break; |
|
| 6019 | - case 'thematic_advance': |
|
| 6020 | - $table_name = TABLE_THEMATIC_ADVANCE; |
|
| 6021 | - $link_tool = 'course_progress/index.php'; |
|
| 6022 | - $id_tool = 'id'; |
|
| 6023 | - break; |
|
| 6024 | - case 'thematic_plan': |
|
| 6025 | - $table_name = TABLE_THEMATIC_PLAN; |
|
| 6026 | - $link_tool = 'course_progress/index.php'; |
|
| 6027 | - $id_tool = 'id'; |
|
| 6028 | - break; |
|
| 6029 | - default: |
|
| 6030 | - $table_name = $tool; |
|
| 6031 | - break; |
|
| 6032 | - } |
|
| 6033 | - |
|
| 6034 | - return array( |
|
| 5978 | + switch ($tool) { |
|
| 5979 | + case 'document': |
|
| 5980 | + $table_name = TABLE_DOCUMENT; |
|
| 5981 | + $link_tool = 'document/document.php'; |
|
| 5982 | + $id_tool = 'id'; |
|
| 5983 | + break; |
|
| 5984 | + case 'learnpath': |
|
| 5985 | + $table_name = TABLE_LP_MAIN; |
|
| 5986 | + $link_tool = 'newscorm/lp_controller.php'; |
|
| 5987 | + $id_tool = 'id'; |
|
| 5988 | + break; |
|
| 5989 | + case 'quiz': |
|
| 5990 | + $table_name = TABLE_QUIZ_TEST; |
|
| 5991 | + $link_tool = 'exercice/exercice.php'; |
|
| 5992 | + $id_tool = 'id'; |
|
| 5993 | + break; |
|
| 5994 | + case 'glossary': |
|
| 5995 | + $table_name = TABLE_GLOSSARY; |
|
| 5996 | + $link_tool = 'glossary/index.php'; |
|
| 5997 | + $id_tool = 'glossary_id'; |
|
| 5998 | + break; |
|
| 5999 | + case 'link': |
|
| 6000 | + $table_name = TABLE_LINK; |
|
| 6001 | + $link_tool = 'link/link.php'; |
|
| 6002 | + $id_tool = 'id'; |
|
| 6003 | + break; |
|
| 6004 | + case 'course_description': |
|
| 6005 | + $table_name = TABLE_COURSE_DESCRIPTION; |
|
| 6006 | + $link_tool = 'course_description/'; |
|
| 6007 | + $id_tool = 'id'; |
|
| 6008 | + break; |
|
| 6009 | + case 'announcement': |
|
| 6010 | + $table_name = TABLE_ANNOUNCEMENT; |
|
| 6011 | + $link_tool = 'announcements/announcements.php'; |
|
| 6012 | + $id_tool = 'id'; |
|
| 6013 | + break; |
|
| 6014 | + case 'thematic': |
|
| 6015 | + $table_name = TABLE_THEMATIC; |
|
| 6016 | + $link_tool = 'course_progress/index.php'; |
|
| 6017 | + $id_tool = 'id'; |
|
| 6018 | + break; |
|
| 6019 | + case 'thematic_advance': |
|
| 6020 | + $table_name = TABLE_THEMATIC_ADVANCE; |
|
| 6021 | + $link_tool = 'course_progress/index.php'; |
|
| 6022 | + $id_tool = 'id'; |
|
| 6023 | + break; |
|
| 6024 | + case 'thematic_plan': |
|
| 6025 | + $table_name = TABLE_THEMATIC_PLAN; |
|
| 6026 | + $link_tool = 'course_progress/index.php'; |
|
| 6027 | + $id_tool = 'id'; |
|
| 6028 | + break; |
|
| 6029 | + default: |
|
| 6030 | + $table_name = $tool; |
|
| 6031 | + break; |
|
| 6032 | + } |
|
| 6033 | + |
|
| 6034 | + return array( |
|
| 6035 | 6035 | 'table_name' => $table_name, |
| 6036 | 6036 | 'link_tool' => $link_tool, |
| 6037 | 6037 | 'id_tool' => $id_tool |
@@ -6040,45 +6040,45 @@ discard block |
||
| 6040 | 6040 | |
| 6041 | 6041 | public static function display_additional_profile_fields() |
| 6042 | 6042 | { |
| 6043 | - // getting all the extra profile fields that are defined by the platform administrator |
|
| 6044 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
| 6045 | - |
|
| 6046 | - // creating the form |
|
| 6047 | - $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
| 6048 | - |
|
| 6049 | - // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
| 6050 | - // the information the users have entered or selected. |
|
| 6051 | - $return .= '<select name="additional_profile_field">'; |
|
| 6052 | - $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
| 6053 | - $extra_fields_to_show = 0; |
|
| 6054 | - foreach ($extra_fields as $key=>$field) { |
|
| 6055 | - // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
| 6056 | - if ($field[6]==1 && $field[8] == 1) { |
|
| 6057 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
| 6058 | - $selected = 'selected="selected"'; |
|
| 6059 | - } else { |
|
| 6060 | - $selected = ''; |
|
| 6061 | - } |
|
| 6062 | - $extra_fields_to_show++; |
|
| 6063 | - $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
| 6064 | - } |
|
| 6065 | - } |
|
| 6066 | - $return .= '</select>'; |
|
| 6067 | - |
|
| 6068 | - // the form elements for the $_GET parameters (because the form is passed through GET |
|
| 6069 | - foreach ($_GET as $key=>$value){ |
|
| 6070 | - if ($key <> 'additional_profile_field') { |
|
| 6071 | - $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
| 6072 | - } |
|
| 6073 | - } |
|
| 6074 | - // the submit button |
|
| 6075 | - $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
| 6076 | - $return .= '</form>'; |
|
| 6077 | - if ($extra_fields_to_show > 0) { |
|
| 6078 | - return $return; |
|
| 6079 | - } else { |
|
| 6080 | - return ''; |
|
| 6081 | - } |
|
| 6043 | + // getting all the extra profile fields that are defined by the platform administrator |
|
| 6044 | + $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
| 6045 | + |
|
| 6046 | + // creating the form |
|
| 6047 | + $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
| 6048 | + |
|
| 6049 | + // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
| 6050 | + // the information the users have entered or selected. |
|
| 6051 | + $return .= '<select name="additional_profile_field">'; |
|
| 6052 | + $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
| 6053 | + $extra_fields_to_show = 0; |
|
| 6054 | + foreach ($extra_fields as $key=>$field) { |
|
| 6055 | + // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
| 6056 | + if ($field[6]==1 && $field[8] == 1) { |
|
| 6057 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
| 6058 | + $selected = 'selected="selected"'; |
|
| 6059 | + } else { |
|
| 6060 | + $selected = ''; |
|
| 6061 | + } |
|
| 6062 | + $extra_fields_to_show++; |
|
| 6063 | + $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
| 6064 | + } |
|
| 6065 | + } |
|
| 6066 | + $return .= '</select>'; |
|
| 6067 | + |
|
| 6068 | + // the form elements for the $_GET parameters (because the form is passed through GET |
|
| 6069 | + foreach ($_GET as $key=>$value){ |
|
| 6070 | + if ($key <> 'additional_profile_field') { |
|
| 6071 | + $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
| 6072 | + } |
|
| 6073 | + } |
|
| 6074 | + // the submit button |
|
| 6075 | + $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
| 6076 | + $return .= '</form>'; |
|
| 6077 | + if ($extra_fields_to_show > 0) { |
|
| 6078 | + return $return; |
|
| 6079 | + } else { |
|
| 6080 | + return ''; |
|
| 6081 | + } |
|
| 6082 | 6082 | } |
| 6083 | 6083 | |
| 6084 | 6084 | /** |
@@ -6097,31 +6097,31 @@ discard block |
||
| 6097 | 6097 | */ |
| 6098 | 6098 | public static function get_addtional_profile_information_of_field_by_user($field_id, $users) |
| 6099 | 6099 | { |
| 6100 | - // Database table definition |
|
| 6101 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
| 6102 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
| 6100 | + // Database table definition |
|
| 6101 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
| 6102 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
| 6103 | 6103 | $extraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
| 6104 | - $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
| 6105 | - |
|
| 6106 | - if (!empty($users)) { |
|
| 6107 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
| 6108 | - foreach($users as $user_id) { |
|
| 6109 | - $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
| 6110 | - $tag_list = array(); |
|
| 6111 | - foreach($user_result as $item) { |
|
| 6112 | - $tag_list[] = $item['tag']; |
|
| 6113 | - } |
|
| 6114 | - $return[$user_id][] = implode(', ',$tag_list); |
|
| 6115 | - } |
|
| 6116 | - } else { |
|
| 6117 | - $new_user_array = array(); |
|
| 6118 | - foreach ($users as $user_id) { |
|
| 6119 | - $new_user_array[]= "'".$user_id."'"; |
|
| 6120 | - } |
|
| 6121 | - $users = implode(',',$new_user_array); |
|
| 6104 | + $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
| 6105 | + |
|
| 6106 | + if (!empty($users)) { |
|
| 6107 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
| 6108 | + foreach($users as $user_id) { |
|
| 6109 | + $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
| 6110 | + $tag_list = array(); |
|
| 6111 | + foreach($user_result as $item) { |
|
| 6112 | + $tag_list[] = $item['tag']; |
|
| 6113 | + } |
|
| 6114 | + $return[$user_id][] = implode(', ',$tag_list); |
|
| 6115 | + } |
|
| 6116 | + } else { |
|
| 6117 | + $new_user_array = array(); |
|
| 6118 | + foreach ($users as $user_id) { |
|
| 6119 | + $new_user_array[]= "'".$user_id."'"; |
|
| 6120 | + } |
|
| 6121 | + $users = implode(',',$new_user_array); |
|
| 6122 | 6122 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
| 6123 | - // Selecting only the necessary information NOT ALL the user list |
|
| 6124 | - $sql = "SELECT user.user_id, v.value |
|
| 6123 | + // Selecting only the necessary information NOT ALL the user list |
|
| 6124 | + $sql = "SELECT user.user_id, v.value |
|
| 6125 | 6125 | FROM $table_user user |
| 6126 | 6126 | INNER JOIN $table_user_field_values v |
| 6127 | 6127 | ON (user.user_id = v.item_id) |
@@ -6132,27 +6132,27 @@ discard block |
||
| 6132 | 6132 | v.field_id=".intval($field_id)." AND |
| 6133 | 6133 | user.user_id IN ($users)"; |
| 6134 | 6134 | |
| 6135 | - $result = Database::query($sql); |
|
| 6136 | - while($row = Database::fetch_array($result)) { |
|
| 6137 | - // get option value for field type double select by id |
|
| 6138 | - if (!empty($row['value'])) { |
|
| 6139 | - if ($result_extra_field['field_type'] == |
|
| 6135 | + $result = Database::query($sql); |
|
| 6136 | + while($row = Database::fetch_array($result)) { |
|
| 6137 | + // get option value for field type double select by id |
|
| 6138 | + if (!empty($row['value'])) { |
|
| 6139 | + if ($result_extra_field['field_type'] == |
|
| 6140 | 6140 | ExtraField::FIELD_TYPE_DOUBLE_SELECT |
| 6141 | 6141 | ) { |
| 6142 | - $id_double_select = explode(';', $row['value']); |
|
| 6143 | - if (is_array($id_double_select)) { |
|
| 6144 | - $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
| 6145 | - $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
| 6146 | - $row['value'] = ($value1.';'.$value2); |
|
| 6147 | - } |
|
| 6148 | - } |
|
| 6149 | - } |
|
| 6150 | - // get other value from extra field |
|
| 6151 | - $return[$row['user_id']][] = $row['value']; |
|
| 6152 | - } |
|
| 6153 | - } |
|
| 6154 | - } |
|
| 6155 | - return $return; |
|
| 6142 | + $id_double_select = explode(';', $row['value']); |
|
| 6143 | + if (is_array($id_double_select)) { |
|
| 6144 | + $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
| 6145 | + $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
| 6146 | + $row['value'] = ($value1.';'.$value2); |
|
| 6147 | + } |
|
| 6148 | + } |
|
| 6149 | + } |
|
| 6150 | + // get other value from extra field |
|
| 6151 | + $return[$row['user_id']][] = $row['value']; |
|
| 6152 | + } |
|
| 6153 | + } |
|
| 6154 | + } |
|
| 6155 | + return $return; |
|
| 6156 | 6156 | } |
| 6157 | 6157 | |
| 6158 | 6158 | /** |
@@ -6161,18 +6161,18 @@ discard block |
||
| 6161 | 6161 | */ |
| 6162 | 6162 | public function count_student_in_course() |
| 6163 | 6163 | { |
| 6164 | - global $nbStudents; |
|
| 6165 | - return $nbStudents; |
|
| 6164 | + global $nbStudents; |
|
| 6165 | + return $nbStudents; |
|
| 6166 | 6166 | } |
| 6167 | 6167 | |
| 6168 | 6168 | public function sort_users($a, $b) |
| 6169 | 6169 | { |
| 6170 | - return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
| 6170 | + return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
| 6171 | 6171 | } |
| 6172 | 6172 | |
| 6173 | 6173 | public function sort_users_desc($a, $b) |
| 6174 | 6174 | { |
| 6175 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
| 6175 | + return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
| 6176 | 6176 | } |
| 6177 | 6177 | |
| 6178 | 6178 | /** |
@@ -6181,8 +6181,8 @@ discard block |
||
| 6181 | 6181 | */ |
| 6182 | 6182 | public static function get_number_of_users() |
| 6183 | 6183 | { |
| 6184 | - global $user_ids; |
|
| 6185 | - return count($user_ids); |
|
| 6184 | + global $user_ids; |
|
| 6185 | + return count($user_ids); |
|
| 6186 | 6186 | } |
| 6187 | 6187 | |
| 6188 | 6188 | /** |
@@ -6198,37 +6198,37 @@ discard block |
||
| 6198 | 6198 | { |
| 6199 | 6199 | global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id; |
| 6200 | 6200 | |
| 6201 | - $course_code = Database::escape_string($course_code); |
|
| 6202 | - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
| 6203 | - $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 6201 | + $course_code = Database::escape_string($course_code); |
|
| 6202 | + $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
| 6203 | + $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
| 6204 | 6204 | |
| 6205 | - $access_url_id = api_get_current_access_url_id(); |
|
| 6205 | + $access_url_id = api_get_current_access_url_id(); |
|
| 6206 | 6206 | |
| 6207 | - // get all users data from a course for sortable with limit |
|
| 6208 | - if (is_array($user_ids)) { |
|
| 6209 | - $user_ids = array_map('intval', $user_ids); |
|
| 6210 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
| 6211 | - } else { |
|
| 6212 | - $user_ids = intval($user_ids); |
|
| 6213 | - $condition_user = " WHERE user.user_id = $user_ids "; |
|
| 6214 | - } |
|
| 6207 | + // get all users data from a course for sortable with limit |
|
| 6208 | + if (is_array($user_ids)) { |
|
| 6209 | + $user_ids = array_map('intval', $user_ids); |
|
| 6210 | + $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
| 6211 | + } else { |
|
| 6212 | + $user_ids = intval($user_ids); |
|
| 6213 | + $condition_user = " WHERE user.user_id = $user_ids "; |
|
| 6214 | + } |
|
| 6215 | 6215 | |
| 6216 | - if (!empty($_GET['user_keyword'])) { |
|
| 6217 | - $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
| 6218 | - $condition_user .= " AND ( |
|
| 6216 | + if (!empty($_GET['user_keyword'])) { |
|
| 6217 | + $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
| 6218 | + $condition_user .= " AND ( |
|
| 6219 | 6219 | user.firstname LIKE '%".$keyword."%' OR |
| 6220 | 6220 | user.lastname LIKE '%".$keyword."%' OR |
| 6221 | 6221 | user.username LIKE '%".$keyword."%' OR |
| 6222 | 6222 | user.email LIKE '%".$keyword."%' |
| 6223 | 6223 | ) "; |
| 6224 | - } |
|
| 6224 | + } |
|
| 6225 | 6225 | |
| 6226 | 6226 | $url_table = null; |
| 6227 | 6227 | $url_condition = null; |
| 6228 | - if (api_is_multiple_url_enabled()) { |
|
| 6229 | - $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
| 6230 | - $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
| 6231 | - } |
|
| 6228 | + if (api_is_multiple_url_enabled()) { |
|
| 6229 | + $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
| 6230 | + $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
| 6231 | + } |
|
| 6232 | 6232 | |
| 6233 | 6233 | $invitedUsersCondition = ''; |
| 6234 | 6234 | |
@@ -6236,7 +6236,7 @@ discard block |
||
| 6236 | 6236 | $invitedUsersCondition = " AND user.status != " . INVITEE; |
| 6237 | 6237 | } |
| 6238 | 6238 | |
| 6239 | - $sql = "SELECT user.user_id as user_id, |
|
| 6239 | + $sql = "SELECT user.user_id as user_id, |
|
| 6240 | 6240 | user.official_code as col0, |
| 6241 | 6241 | user.lastname as col1, |
| 6242 | 6242 | user.firstname as col2, |
@@ -6244,17 +6244,17 @@ discard block |
||
| 6244 | 6244 | FROM $tbl_user as user $url_table |
| 6245 | 6245 | $condition_user $url_condition $invitedUsersCondition"; |
| 6246 | 6246 | |
| 6247 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
| 6248 | - $direction = 'ASC'; |
|
| 6249 | - } |
|
| 6247 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
| 6248 | + $direction = 'ASC'; |
|
| 6249 | + } |
|
| 6250 | 6250 | |
| 6251 | - $column = intval($column); |
|
| 6251 | + $column = intval($column); |
|
| 6252 | 6252 | |
| 6253 | - $from = intval($from); |
|
| 6254 | - $number_of_items = intval($number_of_items); |
|
| 6253 | + $from = intval($from); |
|
| 6254 | + $number_of_items = intval($number_of_items); |
|
| 6255 | 6255 | |
| 6256 | - $sql .= " ORDER BY col$column $direction "; |
|
| 6257 | - $sql .= " LIMIT $from,$number_of_items"; |
|
| 6256 | + $sql .= " ORDER BY col$column $direction "; |
|
| 6257 | + $sql .= " LIMIT $from,$number_of_items"; |
|
| 6258 | 6258 | |
| 6259 | 6259 | $res = Database::query($sql); |
| 6260 | 6260 | $users = array(); |
@@ -6288,7 +6288,7 @@ discard block |
||
| 6288 | 6288 | } |
| 6289 | 6289 | } |
| 6290 | 6290 | |
| 6291 | - while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
| 6291 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
| 6292 | 6292 | $courseInfo = api_get_course_info($course_code); |
| 6293 | 6293 | $courseId = $courseInfo['real_id']; |
| 6294 | 6294 | |
@@ -6319,10 +6319,10 @@ discard block |
||
| 6319 | 6319 | $session_id |
| 6320 | 6320 | ); |
| 6321 | 6321 | |
| 6322 | - if (empty($avg_student_progress)) { |
|
| 6322 | + if (empty($avg_student_progress)) { |
|
| 6323 | 6323 | $avg_student_progress = 0; |
| 6324 | - } |
|
| 6325 | - $user['average_progress'] = $avg_student_progress.'%'; |
|
| 6324 | + } |
|
| 6325 | + $user['average_progress'] = $avg_student_progress.'%'; |
|
| 6326 | 6326 | |
| 6327 | 6327 | $total_user_exercise = Tracking::get_exercise_student_progress( |
| 6328 | 6328 | $total_exercises, |
@@ -6342,11 +6342,11 @@ discard block |
||
| 6342 | 6342 | |
| 6343 | 6343 | $user['exercise_average_best_attempt'] = $total_user_exercise; |
| 6344 | 6344 | |
| 6345 | - if (is_numeric($avg_student_score)) { |
|
| 6346 | - $user['student_score'] = $avg_student_score.'%'; |
|
| 6347 | - } else { |
|
| 6348 | - $user['student_score'] = $avg_student_score; |
|
| 6349 | - } |
|
| 6345 | + if (is_numeric($avg_student_score)) { |
|
| 6346 | + $user['student_score'] = $avg_student_score.'%'; |
|
| 6347 | + } else { |
|
| 6348 | + $user['student_score'] = $avg_student_score; |
|
| 6349 | + } |
|
| 6350 | 6350 | |
| 6351 | 6351 | $user['count_assignments'] = Tracking::count_student_assignments( |
| 6352 | 6352 | $user['user_id'], |
@@ -6369,29 +6369,29 @@ discard block |
||
| 6369 | 6369 | $session_id |
| 6370 | 6370 | ); |
| 6371 | 6371 | |
| 6372 | - // we need to display an additional profile field |
|
| 6373 | - $user['additional'] = ''; |
|
| 6372 | + // we need to display an additional profile field |
|
| 6373 | + $user['additional'] = ''; |
|
| 6374 | 6374 | |
| 6375 | - if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
| 6376 | - if (isset($additional_user_profile_info[$user['user_id']]) && |
|
| 6375 | + if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
| 6376 | + if (isset($additional_user_profile_info[$user['user_id']]) && |
|
| 6377 | 6377 | is_array($additional_user_profile_info[$user['user_id']]) |
| 6378 | 6378 | ) { |
| 6379 | - $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
| 6380 | - } |
|
| 6381 | - } |
|
| 6379 | + $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
| 6380 | + } |
|
| 6381 | + } |
|
| 6382 | 6382 | |
| 6383 | 6383 | if (empty($session_id)) { |
| 6384 | 6384 | $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
| 6385 | 6385 | } |
| 6386 | 6386 | |
| 6387 | - $user['link'] = '<center> |
|
| 6387 | + $user['link'] = '<center> |
|
| 6388 | 6388 | <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"> |
| 6389 | 6389 | '.Display::return_icon('2rightarrow.png').' |
| 6390 | 6390 | </a> |
| 6391 | 6391 | </center>'; |
| 6392 | 6392 | |
| 6393 | - // store columns in array $users |
|
| 6394 | - $is_western_name_order = api_is_western_name_order(); |
|
| 6393 | + // store columns in array $users |
|
| 6394 | + $is_western_name_order = api_is_western_name_order(); |
|
| 6395 | 6395 | $user_row = array(); |
| 6396 | 6396 | $user_row[]= $user['official_code']; //0 |
| 6397 | 6397 | if ($is_western_name_order) { |
@@ -6424,21 +6424,21 @@ discard block |
||
| 6424 | 6424 | |
| 6425 | 6425 | $users[] = $user_row; |
| 6426 | 6426 | |
| 6427 | - if ($export_csv) { |
|
| 6428 | - if (empty($session_id)) { |
|
| 6427 | + if ($export_csv) { |
|
| 6428 | + if (empty($session_id)) { |
|
| 6429 | 6429 | $user_row = array_map('strip_tags', $user_row); |
| 6430 | - unset($user_row[14]); |
|
| 6431 | - unset($user_row[15]); |
|
| 6430 | + unset($user_row[14]); |
|
| 6431 | + unset($user_row[15]); |
|
| 6432 | 6432 | } else { |
| 6433 | 6433 | $user_row = array_map('strip_tags', $user_row); |
| 6434 | 6434 | unset($user_row[13]); |
| 6435 | 6435 | unset($user_row[14]); |
| 6436 | 6436 | } |
| 6437 | 6437 | |
| 6438 | - $csv_content[] = $user_row; |
|
| 6439 | - } |
|
| 6440 | - } |
|
| 6441 | - return $users; |
|
| 6438 | + $csv_content[] = $user_row; |
|
| 6439 | + } |
|
| 6440 | + } |
|
| 6441 | + return $users; |
|
| 6442 | 6442 | } |
| 6443 | 6443 | } |
| 6444 | 6444 | |
@@ -6456,18 +6456,18 @@ discard block |
||
| 6456 | 6456 | */ |
| 6457 | 6457 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
| 6458 | 6458 | { |
| 6459 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
| 6460 | - |
|
| 6461 | - // protected data |
|
| 6462 | - $user_id = intval($user_id); |
|
| 6463 | - $session_id = intval($session_id); |
|
| 6464 | - $course_id = Database::escape_string($course_id); |
|
| 6465 | - |
|
| 6466 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 6467 | - $tempView = $view; |
|
| 6468 | - if(substr($view,0,1) == '1') { |
|
| 6469 | - $new_view = substr_replace($view,'0',0,1); |
|
| 6470 | - echo " |
|
| 6459 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
| 6460 | + |
|
| 6461 | + // protected data |
|
| 6462 | + $user_id = intval($user_id); |
|
| 6463 | + $session_id = intval($session_id); |
|
| 6464 | + $course_id = Database::escape_string($course_id); |
|
| 6465 | + |
|
| 6466 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 6467 | + $tempView = $view; |
|
| 6468 | + if(substr($view,0,1) == '1') { |
|
| 6469 | + $new_view = substr_replace($view,'0',0,1); |
|
| 6470 | + echo " |
|
| 6471 | 6471 | <tr> |
| 6472 | 6472 | <td valign='top'> |
| 6473 | 6473 | <font color='#0000FF'>- </font>" . |
@@ -6475,9 +6475,9 @@ discard block |
||
| 6475 | 6475 | </td> |
| 6476 | 6476 | </tr> |
| 6477 | 6477 | "; |
| 6478 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
| 6478 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
| 6479 | 6479 | |
| 6480 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
| 6480 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
| 6481 | 6481 | FROM $track_access_table |
| 6482 | 6482 | WHERE access_user_id = $user_id |
| 6483 | 6483 | AND c_id = $course_id |
@@ -6485,11 +6485,11 @@ discard block |
||
| 6485 | 6485 | GROUP BY YEAR(access_date),MONTH(access_date) |
| 6486 | 6486 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
| 6487 | 6487 | |
| 6488 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6489 | - $results = getManyResults3Col($sql); |
|
| 6488 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6489 | + $results = getManyResults3Col($sql); |
|
| 6490 | 6490 | |
| 6491 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6492 | - echo "<tr> |
|
| 6491 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6492 | + echo "<tr> |
|
| 6493 | 6493 | <td class='secLine'> |
| 6494 | 6494 | ".get_lang('LoginsTitleMonthColumn')." |
| 6495 | 6495 | </td> |
@@ -6497,36 +6497,36 @@ discard block |
||
| 6497 | 6497 | ".get_lang('LoginsTitleCountColumn')." |
| 6498 | 6498 | </td> |
| 6499 | 6499 | </tr>"; |
| 6500 | - $total = 0; |
|
| 6501 | - if (is_array($results)) { |
|
| 6502 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6503 | - echo "<tr>"; |
|
| 6504 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
| 6505 | - echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
| 6506 | - echo"</tr>"; |
|
| 6507 | - $total = $total + $results[$j][1]; |
|
| 6508 | - } |
|
| 6509 | - echo "<tr>"; |
|
| 6510 | - echo "<td>".get_lang('Total')."</td>"; |
|
| 6511 | - echo "<td align='right' class='content'>".$total."</td>"; |
|
| 6512 | - echo"</tr>"; |
|
| 6513 | - } else { |
|
| 6514 | - echo "<tr>"; |
|
| 6515 | - echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
| 6516 | - echo"</tr>"; |
|
| 6517 | - } |
|
| 6518 | - echo "</table>"; |
|
| 6519 | - echo "</td></tr>"; |
|
| 6520 | - } else { |
|
| 6521 | - $new_view = substr_replace($view,'1',0,1); |
|
| 6522 | - echo " |
|
| 6500 | + $total = 0; |
|
| 6501 | + if (is_array($results)) { |
|
| 6502 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6503 | + echo "<tr>"; |
|
| 6504 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
| 6505 | + echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
| 6506 | + echo"</tr>"; |
|
| 6507 | + $total = $total + $results[$j][1]; |
|
| 6508 | + } |
|
| 6509 | + echo "<tr>"; |
|
| 6510 | + echo "<td>".get_lang('Total')."</td>"; |
|
| 6511 | + echo "<td align='right' class='content'>".$total."</td>"; |
|
| 6512 | + echo"</tr>"; |
|
| 6513 | + } else { |
|
| 6514 | + echo "<tr>"; |
|
| 6515 | + echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
| 6516 | + echo"</tr>"; |
|
| 6517 | + } |
|
| 6518 | + echo "</table>"; |
|
| 6519 | + echo "</td></tr>"; |
|
| 6520 | + } else { |
|
| 6521 | + $new_view = substr_replace($view,'1',0,1); |
|
| 6522 | + echo " |
|
| 6523 | 6523 | <tr> |
| 6524 | 6524 | <td valign='top'> |
| 6525 | 6525 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a> |
| 6526 | 6526 | </td> |
| 6527 | 6527 | </tr> |
| 6528 | 6528 | "; |
| 6529 | - } |
|
| 6529 | + } |
|
| 6530 | 6530 | } |
| 6531 | 6531 | |
| 6532 | 6532 | /** |
@@ -6539,38 +6539,38 @@ discard block |
||
| 6539 | 6539 | */ |
| 6540 | 6540 | public function display_exercise_tracking_info($view, $user_id, $courseCode) |
| 6541 | 6541 | { |
| 6542 | - global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
| 6542 | + global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
| 6543 | 6543 | $courseId = api_get_course_int_id($courseCode); |
| 6544 | - if(substr($view,1,1) == '1') { |
|
| 6545 | - $new_view = substr_replace($view,'0',1,1); |
|
| 6546 | - echo "<tr> |
|
| 6544 | + if(substr($view,1,1) == '1') { |
|
| 6545 | + $new_view = substr_replace($view,'0',1,1); |
|
| 6546 | + echo "<tr> |
|
| 6547 | 6547 | <td valign='top'> |
| 6548 | 6548 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
| 6549 | 6549 | </td> |
| 6550 | 6550 | </tr>"; |
| 6551 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
| 6551 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
| 6552 | 6552 | |
| 6553 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6553 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6554 | 6554 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
| 6555 | 6555 | WHERE te.c_id = $courseId |
| 6556 | 6556 | AND te.exe_user_id = ".intval($user_id)." |
| 6557 | 6557 | AND te.exe_exo_id = ce.id |
| 6558 | 6558 | ORDER BY ce.title ASC, te.exe_date ASC"; |
| 6559 | 6559 | |
| 6560 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6560 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6561 | 6561 | FROM $TBL_TRACK_HOTPOTATOES AS te |
| 6562 | 6562 | WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId |
| 6563 | 6563 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
| 6564 | 6564 | |
| 6565 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
| 6565 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
| 6566 | 6566 | |
| 6567 | - $NoTestRes = 0; |
|
| 6568 | - $NoHPTestRes = 0; |
|
| 6567 | + $NoTestRes = 0; |
|
| 6568 | + $NoHPTestRes = 0; |
|
| 6569 | 6569 | |
| 6570 | - echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
| 6571 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6572 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
| 6573 | - echo " |
|
| 6570 | + echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
| 6571 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6572 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
| 6573 | + echo " |
|
| 6574 | 6574 | <tr bgcolor='#E6E6E6'> |
| 6575 | 6575 | <td> |
| 6576 | 6576 | ".get_lang('ExercicesTitleExerciceColumn')." |
@@ -6583,28 +6583,28 @@ discard block |
||
| 6583 | 6583 | </td> |
| 6584 | 6584 | </tr>"; |
| 6585 | 6585 | |
| 6586 | - if (is_array($results)) { |
|
| 6587 | - for($i = 0; $i < sizeof($results); $i++) { |
|
| 6588 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
| 6589 | - echo "<tr>\n"; |
|
| 6590 | - echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
| 6591 | - echo "<td class='content'>".$display_date."</td>\n"; |
|
| 6592 | - echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
| 6593 | - echo "</tr>\n"; |
|
| 6594 | - } |
|
| 6595 | - } else { |
|
| 6596 | - // istvan begin |
|
| 6597 | - $NoTestRes = 1; |
|
| 6598 | - } |
|
| 6599 | - |
|
| 6600 | - // The Result of Tests |
|
| 6601 | - if (is_array($hpresults)) { |
|
| 6602 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6603 | - $title = GetQuizName($hpresults[$i][0],''); |
|
| 6604 | - if ($title == '') |
|
| 6605 | - $title = basename($hpresults[$i][0]); |
|
| 6606 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
| 6607 | - ?> |
|
| 6586 | + if (is_array($results)) { |
|
| 6587 | + for($i = 0; $i < sizeof($results); $i++) { |
|
| 6588 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
| 6589 | + echo "<tr>\n"; |
|
| 6590 | + echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
| 6591 | + echo "<td class='content'>".$display_date."</td>\n"; |
|
| 6592 | + echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
| 6593 | + echo "</tr>\n"; |
|
| 6594 | + } |
|
| 6595 | + } else { |
|
| 6596 | + // istvan begin |
|
| 6597 | + $NoTestRes = 1; |
|
| 6598 | + } |
|
| 6599 | + |
|
| 6600 | + // The Result of Tests |
|
| 6601 | + if (is_array($hpresults)) { |
|
| 6602 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6603 | + $title = GetQuizName($hpresults[$i][0],''); |
|
| 6604 | + if ($title == '') |
|
| 6605 | + $title = basename($hpresults[$i][0]); |
|
| 6606 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
| 6607 | + ?> |
|
| 6608 | 6608 | <tr> |
| 6609 | 6609 | <td class="content"><?php echo $title; ?></td> |
| 6610 | 6610 | <td class="content" align="center"><?php echo $display_date; ?></td> |
@@ -6614,26 +6614,26 @@ discard block |
||
| 6614 | 6614 | |
| 6615 | 6615 | <?php |
| 6616 | 6616 | } |
| 6617 | - } else { |
|
| 6618 | - $NoHPTestRes = 1; |
|
| 6619 | - } |
|
| 6620 | - |
|
| 6621 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
| 6622 | - echo "<tr>\n"; |
|
| 6623 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
| 6624 | - echo "</tr>\n"; |
|
| 6625 | - } |
|
| 6626 | - echo "</table>"; |
|
| 6627 | - echo "</td>\n</tr>\n"; |
|
| 6628 | - } else { |
|
| 6629 | - $new_view = substr_replace($view,'1',1,1); |
|
| 6630 | - echo " |
|
| 6617 | + } else { |
|
| 6618 | + $NoHPTestRes = 1; |
|
| 6619 | + } |
|
| 6620 | + |
|
| 6621 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
| 6622 | + echo "<tr>\n"; |
|
| 6623 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
| 6624 | + echo "</tr>\n"; |
|
| 6625 | + } |
|
| 6626 | + echo "</table>"; |
|
| 6627 | + echo "</td>\n</tr>\n"; |
|
| 6628 | + } else { |
|
| 6629 | + $new_view = substr_replace($view,'1',1,1); |
|
| 6630 | + echo " |
|
| 6631 | 6631 | <tr> |
| 6632 | 6632 | <td valign='top'> |
| 6633 | 6633 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a> |
| 6634 | 6634 | </td> |
| 6635 | 6635 | </tr>"; |
| 6636 | - } |
|
| 6636 | + } |
|
| 6637 | 6637 | } |
| 6638 | 6638 | |
| 6639 | 6639 | /** |
@@ -6642,27 +6642,27 @@ discard block |
||
| 6642 | 6642 | */ |
| 6643 | 6643 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
| 6644 | 6644 | { |
| 6645 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
| 6645 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
| 6646 | 6646 | $_course = api_get_course_info_by_id($course_id); |
| 6647 | 6647 | |
| 6648 | - if (substr($view,2,1) == '1') { |
|
| 6649 | - $new_view = substr_replace($view,'0',2,1); |
|
| 6650 | - echo "<tr> |
|
| 6648 | + if (substr($view,2,1) == '1') { |
|
| 6649 | + $new_view = substr_replace($view,'0',2,1); |
|
| 6650 | + echo "<tr> |
|
| 6651 | 6651 | <td valign='top'> |
| 6652 | 6652 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
| 6653 | 6653 | </td> |
| 6654 | 6654 | </tr>"; |
| 6655 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
| 6656 | - $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
| 6655 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
| 6656 | + $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
| 6657 | 6657 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
| 6658 | 6658 | WHERE u.upload_work_id = w.id |
| 6659 | 6659 | AND u.upload_user_id = '".intval($user_id)."' |
| 6660 | 6660 | AND u.c_id = '".intval($course_id)."' |
| 6661 | 6661 | ORDER BY u.upload_date DESC"; |
| 6662 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6663 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 6664 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6665 | - echo "<tr> |
|
| 6662 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6663 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 6664 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6665 | + echo "<tr> |
|
| 6666 | 6666 | <td class='secLine' width='40%'> |
| 6667 | 6667 | ".get_lang('WorkTitle')." |
| 6668 | 6668 | </td> |
@@ -6673,35 +6673,35 @@ discard block |
||
| 6673 | 6673 | ".get_lang('Date')." |
| 6674 | 6674 | </td> |
| 6675 | 6675 | </tr>"; |
| 6676 | - if (is_array($results)) { |
|
| 6677 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6678 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
| 6679 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
| 6680 | - echo "<tr>"; |
|
| 6681 | - echo "<td class='content'>" |
|
| 6682 | - ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
| 6683 | - ."</td>"; |
|
| 6684 | - echo "<td class='content'>".$results[$j][2]."</td>"; |
|
| 6685 | - echo "<td class='content'>".$beautifulDate."</td>"; |
|
| 6686 | - echo"</tr>"; |
|
| 6687 | - } |
|
| 6688 | - } else { |
|
| 6689 | - echo "<tr>"; |
|
| 6690 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
| 6691 | - echo"</tr>"; |
|
| 6692 | - } |
|
| 6693 | - echo "</table>"; |
|
| 6694 | - echo "</td></tr>"; |
|
| 6695 | - } else { |
|
| 6696 | - $new_view = substr_replace($view,'1',2,1); |
|
| 6697 | - echo " |
|
| 6676 | + if (is_array($results)) { |
|
| 6677 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6678 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
| 6679 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
| 6680 | + echo "<tr>"; |
|
| 6681 | + echo "<td class='content'>" |
|
| 6682 | + ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
| 6683 | + ."</td>"; |
|
| 6684 | + echo "<td class='content'>".$results[$j][2]."</td>"; |
|
| 6685 | + echo "<td class='content'>".$beautifulDate."</td>"; |
|
| 6686 | + echo"</tr>"; |
|
| 6687 | + } |
|
| 6688 | + } else { |
|
| 6689 | + echo "<tr>"; |
|
| 6690 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
| 6691 | + echo"</tr>"; |
|
| 6692 | + } |
|
| 6693 | + echo "</table>"; |
|
| 6694 | + echo "</td></tr>"; |
|
| 6695 | + } else { |
|
| 6696 | + $new_view = substr_replace($view,'1',2,1); |
|
| 6697 | + echo " |
|
| 6698 | 6698 | <tr> |
| 6699 | 6699 | <td valign='top'> |
| 6700 | 6700 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a> |
| 6701 | 6701 | </td> |
| 6702 | 6702 | </tr> |
| 6703 | 6703 | "; |
| 6704 | - } |
|
| 6704 | + } |
|
| 6705 | 6705 | } |
| 6706 | 6706 | |
| 6707 | 6707 | /** |
@@ -6710,55 +6710,55 @@ discard block |
||
| 6710 | 6710 | */ |
| 6711 | 6711 | public function display_links_tracking_info($view, $user_id, $courseCode) |
| 6712 | 6712 | { |
| 6713 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
| 6713 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
| 6714 | 6714 | $courseId = api_get_course_int_id($courseCode); |
| 6715 | - if (substr($view,3,1) == '1') { |
|
| 6716 | - $new_view = substr_replace($view,'0',3,1); |
|
| 6717 | - echo " |
|
| 6715 | + if (substr($view,3,1) == '1') { |
|
| 6716 | + $new_view = substr_replace($view,'0',3,1); |
|
| 6717 | + echo " |
|
| 6718 | 6718 | <tr> |
| 6719 | 6719 | <td valign='top'> |
| 6720 | 6720 | <font color='#0000FF'>- </font><b>".get_lang('LinksAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00010'>".get_lang('ExportAsCSV')."</a>] |
| 6721 | 6721 | </td> |
| 6722 | 6722 | </tr> |
| 6723 | 6723 | "; |
| 6724 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
| 6725 | - $sql = "SELECT cl.title, cl.url |
|
| 6724 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
| 6725 | + $sql = "SELECT cl.title, cl.url |
|
| 6726 | 6726 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
| 6727 | 6727 | WHERE sl.links_link_id = cl.id |
| 6728 | 6728 | AND sl.c_id = $courseId |
| 6729 | 6729 | AND sl.links_user_id = ".intval($user_id)." |
| 6730 | 6730 | GROUP BY cl.title, cl.url"; |
| 6731 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6732 | - $results = StatsUtils::getManyResults2Col($sql); |
|
| 6733 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6734 | - echo "<tr> |
|
| 6731 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6732 | + $results = StatsUtils::getManyResults2Col($sql); |
|
| 6733 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
| 6734 | + echo "<tr> |
|
| 6735 | 6735 | <td class='secLine'> |
| 6736 | 6736 | ".get_lang('LinksTitleLinkColumn')." |
| 6737 | 6737 | </td> |
| 6738 | 6738 | </tr>"; |
| 6739 | - if (is_array($results)) { |
|
| 6740 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6741 | - echo "<tr>"; |
|
| 6742 | - echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
| 6743 | - echo"</tr>"; |
|
| 6744 | - } |
|
| 6745 | - } else { |
|
| 6746 | - echo "<tr>"; |
|
| 6747 | - echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
| 6748 | - echo"</tr>"; |
|
| 6749 | - } |
|
| 6750 | - echo "</table>"; |
|
| 6751 | - echo "</td></tr>"; |
|
| 6752 | - } else { |
|
| 6753 | - $new_view = substr_replace($view,'1',3,1); |
|
| 6754 | - echo " |
|
| 6739 | + if (is_array($results)) { |
|
| 6740 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6741 | + echo "<tr>"; |
|
| 6742 | + echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
| 6743 | + echo"</tr>"; |
|
| 6744 | + } |
|
| 6745 | + } else { |
|
| 6746 | + echo "<tr>"; |
|
| 6747 | + echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
| 6748 | + echo"</tr>"; |
|
| 6749 | + } |
|
| 6750 | + echo "</table>"; |
|
| 6751 | + echo "</td></tr>"; |
|
| 6752 | + } else { |
|
| 6753 | + $new_view = substr_replace($view,'1',3,1); |
|
| 6754 | + echo " |
|
| 6755 | 6755 | <tr> |
| 6756 | 6756 | <td valign='top'> |
| 6757 | 6757 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a> |
| 6758 | 6758 | </td> |
| 6759 | 6759 | </tr> |
| 6760 | 6760 | "; |
| 6761 | - } |
|
| 6761 | + } |
|
| 6762 | 6762 | } |
| 6763 | 6763 | |
| 6764 | 6764 | /** |
@@ -6771,61 +6771,61 @@ discard block |
||
| 6771 | 6771 | */ |
| 6772 | 6772 | public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0) |
| 6773 | 6773 | { |
| 6774 | - // protect data |
|
| 6774 | + // protect data |
|
| 6775 | 6775 | $user_id = intval($user_id); |
| 6776 | 6776 | $courseId = api_get_course_int_id($course_code); |
| 6777 | - $session_id = intval($session_id); |
|
| 6777 | + $session_id = intval($session_id); |
|
| 6778 | 6778 | |
| 6779 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 6780 | - if(substr($view,4,1) == '1') { |
|
| 6781 | - $new_view = substr_replace($view,'0',4,1); |
|
| 6782 | - echo " |
|
| 6779 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 6780 | + if(substr($view,4,1) == '1') { |
|
| 6781 | + $new_view = substr_replace($view,'0',4,1); |
|
| 6782 | + echo " |
|
| 6783 | 6783 | <tr> |
| 6784 | 6784 | <td valign='top'> |
| 6785 | 6785 | <font color='#0000FF'>- </font><b>".get_lang('DocumentsAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>] |
| 6786 | 6786 | </td> |
| 6787 | 6787 | </tr> |
| 6788 | 6788 | "; |
| 6789 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
| 6789 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
| 6790 | 6790 | |
| 6791 | - $sql = "SELECT down_doc_path |
|
| 6791 | + $sql = "SELECT down_doc_path |
|
| 6792 | 6792 | FROM $downloads_table |
| 6793 | 6793 | WHERE c_id = $courseId |
| 6794 | 6794 | AND down_user_id = $user_id |
| 6795 | 6795 | AND down_session_id = $session_id |
| 6796 | 6796 | GROUP BY down_doc_path"; |
| 6797 | 6797 | |
| 6798 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6799 | - $results = StatsUtils::getManyResults1Col($sql); |
|
| 6800 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
| 6801 | - echo "<tr> |
|
| 6798 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
| 6799 | + $results = StatsUtils::getManyResults1Col($sql); |
|
| 6800 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
| 6801 | + echo "<tr> |
|
| 6802 | 6802 | <td class='secLine'> |
| 6803 | 6803 | ".get_lang('DocumentsTitleDocumentColumn')." |
| 6804 | 6804 | </td> |
| 6805 | 6805 | </tr>"; |
| 6806 | - if (is_array($results)) { |
|
| 6807 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6808 | - echo "<tr>"; |
|
| 6809 | - echo "<td class='content'>".$results[$j]."</td>"; |
|
| 6810 | - echo"</tr>"; |
|
| 6811 | - } |
|
| 6812 | - } else { |
|
| 6813 | - echo "<tr>"; |
|
| 6814 | - echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
| 6815 | - echo"</tr>"; |
|
| 6816 | - } |
|
| 6817 | - echo "</table>"; |
|
| 6818 | - echo "</td></tr>"; |
|
| 6819 | - } else { |
|
| 6820 | - $new_view = substr_replace($view,'1',4,1); |
|
| 6821 | - echo " |
|
| 6806 | + if (is_array($results)) { |
|
| 6807 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6808 | + echo "<tr>"; |
|
| 6809 | + echo "<td class='content'>".$results[$j]."</td>"; |
|
| 6810 | + echo"</tr>"; |
|
| 6811 | + } |
|
| 6812 | + } else { |
|
| 6813 | + echo "<tr>"; |
|
| 6814 | + echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
| 6815 | + echo"</tr>"; |
|
| 6816 | + } |
|
| 6817 | + echo "</table>"; |
|
| 6818 | + echo "</td></tr>"; |
|
| 6819 | + } else { |
|
| 6820 | + $new_view = substr_replace($view,'1',4,1); |
|
| 6821 | + echo " |
|
| 6822 | 6822 | <tr> |
| 6823 | 6823 | <td valign='top'> |
| 6824 | 6824 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a> |
| 6825 | 6825 | </td> |
| 6826 | 6826 | </tr> |
| 6827 | 6827 | "; |
| 6828 | - } |
|
| 6828 | + } |
|
| 6829 | 6829 | } |
| 6830 | 6830 | |
| 6831 | 6831 | /** |
@@ -6882,43 +6882,43 @@ discard block |
||
| 6882 | 6882 | */ |
| 6883 | 6883 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
| 6884 | 6884 | { |
| 6885 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
| 6886 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 6887 | - |
|
| 6888 | - // protected data |
|
| 6889 | - $user_id = intval($user_id); |
|
| 6890 | - $session_id = intval($session_id); |
|
| 6891 | - $course_id = intval($course_id); |
|
| 6892 | - |
|
| 6893 | - $tempView = $view; |
|
| 6894 | - if (substr($view,0,1) == '1') { |
|
| 6895 | - $new_view = substr_replace($view,'0',0,1); |
|
| 6896 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
| 6897 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
| 6885 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
| 6886 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
| 6887 | + |
|
| 6888 | + // protected data |
|
| 6889 | + $user_id = intval($user_id); |
|
| 6890 | + $session_id = intval($session_id); |
|
| 6891 | + $course_id = intval($course_id); |
|
| 6892 | + |
|
| 6893 | + $tempView = $view; |
|
| 6894 | + if (substr($view,0,1) == '1') { |
|
| 6895 | + $new_view = substr_replace($view,'0',0,1); |
|
| 6896 | + $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
| 6897 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
| 6898 | 6898 | FROM $track_access_table |
| 6899 | 6899 | WHERE access_user_id = $user_id |
| 6900 | 6900 | AND c_id = $course_id |
| 6901 | 6901 | AND access_session_id = $session_id |
| 6902 | 6902 | GROUP BY YEAR(access_date),MONTH(access_date) |
| 6903 | 6903 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
| 6904 | - //$results = getManyResults2Col($sql); |
|
| 6905 | - $results = getManyResults3Col($sql); |
|
| 6906 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
| 6907 | - $line=''; |
|
| 6908 | - $total = 0; |
|
| 6909 | - if (is_array($results)) { |
|
| 6910 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6911 | - $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
| 6912 | - $total = $total + $results[$j][1]; |
|
| 6913 | - } |
|
| 6914 | - $line .= get_lang('Total').";".$total."\n"; |
|
| 6915 | - } else { |
|
| 6916 | - $line= get_lang('NoResult')."</center></td>"; |
|
| 6917 | - } |
|
| 6918 | - } else { |
|
| 6919 | - $new_view = substr_replace($view,'1',0,1); |
|
| 6920 | - } |
|
| 6921 | - return array($title_line, $line); |
|
| 6904 | + //$results = getManyResults2Col($sql); |
|
| 6905 | + $results = getManyResults3Col($sql); |
|
| 6906 | + $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
| 6907 | + $line=''; |
|
| 6908 | + $total = 0; |
|
| 6909 | + if (is_array($results)) { |
|
| 6910 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 6911 | + $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
| 6912 | + $total = $total + $results[$j][1]; |
|
| 6913 | + } |
|
| 6914 | + $line .= get_lang('Total').";".$total."\n"; |
|
| 6915 | + } else { |
|
| 6916 | + $line= get_lang('NoResult')."</center></td>"; |
|
| 6917 | + } |
|
| 6918 | + } else { |
|
| 6919 | + $new_view = substr_replace($view,'1',0,1); |
|
| 6920 | + } |
|
| 6921 | + return array($title_line, $line); |
|
| 6922 | 6922 | } |
| 6923 | 6923 | |
| 6924 | 6924 | /** |
@@ -6931,67 +6931,67 @@ discard block |
||
| 6931 | 6931 | */ |
| 6932 | 6932 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
| 6933 | 6933 | { |
| 6934 | - global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
| 6934 | + global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
| 6935 | 6935 | $courseId = api_get_course_int_id($courseCode); |
| 6936 | 6936 | $userId = intval($userId); |
| 6937 | - if (substr($view,1,1) == '1') { |
|
| 6938 | - $new_view = substr_replace($view,'0',1,1); |
|
| 6939 | - $title[1] = get_lang('ExercicesDetails'); |
|
| 6940 | - $line = ''; |
|
| 6941 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6937 | + if (substr($view,1,1) == '1') { |
|
| 6938 | + $new_view = substr_replace($view,'0',1,1); |
|
| 6939 | + $title[1] = get_lang('ExercicesDetails'); |
|
| 6940 | + $line = ''; |
|
| 6941 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6942 | 6942 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
| 6943 | 6943 | WHERE te.c_id = $courseId |
| 6944 | 6944 | AND te.exe_user_id = $userId |
| 6945 | 6945 | AND te.exe_exo_id = ce.id |
| 6946 | 6946 | ORDER BY ce.title ASC, te.exe_date ASC"; |
| 6947 | 6947 | |
| 6948 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6948 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
| 6949 | 6949 | FROM $TABLETRACK_HOTPOTATOES AS te |
| 6950 | 6950 | WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId |
| 6951 | 6951 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
| 6952 | 6952 | |
| 6953 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
| 6953 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
| 6954 | 6954 | |
| 6955 | - $NoTestRes = 0; |
|
| 6956 | - $NoHPTestRes = 0; |
|
| 6955 | + $NoTestRes = 0; |
|
| 6956 | + $NoHPTestRes = 0; |
|
| 6957 | 6957 | |
| 6958 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6959 | - $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
| 6958 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
| 6959 | + $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
| 6960 | 6960 | |
| 6961 | - if (is_array($results)) { |
|
| 6962 | - for($i = 0; $i < sizeof($results); $i++) |
|
| 6963 | - { |
|
| 6964 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
| 6965 | - $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
| 6966 | - } |
|
| 6967 | - } else { |
|
| 6961 | + if (is_array($results)) { |
|
| 6962 | + for($i = 0; $i < sizeof($results); $i++) |
|
| 6963 | + { |
|
| 6964 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
| 6965 | + $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
| 6966 | + } |
|
| 6967 | + } else { |
|
| 6968 | 6968 | // istvan begin |
| 6969 | - $NoTestRes = 1; |
|
| 6970 | - } |
|
| 6971 | - |
|
| 6972 | - // The Result of Tests |
|
| 6973 | - if (is_array($hpresults)) { |
|
| 6974 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6975 | - $title = GetQuizName($hpresults[$i][0],''); |
|
| 6976 | - |
|
| 6977 | - if ($title == '') |
|
| 6978 | - $title = basename($hpresults[$i][0]); |
|
| 6979 | - |
|
| 6980 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
| 6981 | - |
|
| 6982 | - $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
| 6983 | - } |
|
| 6984 | - } else { |
|
| 6985 | - $NoHPTestRes = 1; |
|
| 6986 | - } |
|
| 6987 | - |
|
| 6988 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
| 6989 | - $line=get_lang('NoResult'); |
|
| 6990 | - } |
|
| 6991 | - } else { |
|
| 6992 | - $new_view = substr_replace($view,'1',1,1); |
|
| 6993 | - } |
|
| 6994 | - return array($title_line, $line); |
|
| 6969 | + $NoTestRes = 1; |
|
| 6970 | + } |
|
| 6971 | + |
|
| 6972 | + // The Result of Tests |
|
| 6973 | + if (is_array($hpresults)) { |
|
| 6974 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
| 6975 | + $title = GetQuizName($hpresults[$i][0],''); |
|
| 6976 | + |
|
| 6977 | + if ($title == '') |
|
| 6978 | + $title = basename($hpresults[$i][0]); |
|
| 6979 | + |
|
| 6980 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
| 6981 | + |
|
| 6982 | + $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
| 6983 | + } |
|
| 6984 | + } else { |
|
| 6985 | + $NoHPTestRes = 1; |
|
| 6986 | + } |
|
| 6987 | + |
|
| 6988 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
| 6989 | + $line=get_lang('NoResult'); |
|
| 6990 | + } |
|
| 6991 | + } else { |
|
| 6992 | + $new_view = substr_replace($view,'1',1,1); |
|
| 6993 | + } |
|
| 6994 | + return array($title_line, $line); |
|
| 6995 | 6995 | } |
| 6996 | 6996 | |
| 6997 | 6997 | /** |
@@ -7000,37 +7000,37 @@ discard block |
||
| 7000 | 7000 | */ |
| 7001 | 7001 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
| 7002 | 7002 | { |
| 7003 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
| 7003 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
| 7004 | 7004 | $_course = api_get_course_info(); |
| 7005 | 7005 | $user_id = intval($user_id); |
| 7006 | 7006 | $course_id = intval($course_id); |
| 7007 | 7007 | |
| 7008 | - if (substr($view,2,1) == '1') { |
|
| 7009 | - $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
| 7008 | + if (substr($view,2,1) == '1') { |
|
| 7009 | + $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
| 7010 | 7010 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
| 7011 | 7011 | WHERE |
| 7012 | 7012 | u.upload_work_id = w.id AND |
| 7013 | 7013 | u.upload_user_id = '$user_id' AND |
| 7014 | 7014 | u.c_id = '$course_id' |
| 7015 | 7015 | ORDER BY u.upload_date DESC"; |
| 7016 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 7017 | - |
|
| 7018 | - $title[1]=get_lang('WorksDetails'); |
|
| 7019 | - $line=''; |
|
| 7020 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
| 7021 | - |
|
| 7022 | - if (is_array($results)) { |
|
| 7023 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
| 7024 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
| 7025 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
| 7026 | - $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
| 7027 | - } |
|
| 7028 | - |
|
| 7029 | - } else { |
|
| 7030 | - $line= get_lang('NoResult'); |
|
| 7031 | - } |
|
| 7032 | - } |
|
| 7033 | - return array($title_line, $line); |
|
| 7016 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
| 7017 | + |
|
| 7018 | + $title[1]=get_lang('WorksDetails'); |
|
| 7019 | + $line=''; |
|
| 7020 | + $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
| 7021 | + |
|
| 7022 | + if (is_array($results)) { |
|
| 7023 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
| 7024 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
| 7025 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
| 7026 | + $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
| 7027 | + } |
|
| 7028 | + |
|
| 7029 | + } else { |
|
| 7030 | + $line= get_lang('NoResult'); |
|
| 7031 | + } |
|
| 7032 | + } |
|
| 7033 | + return array($title_line, $line); |
|
| 7034 | 7034 | } |
| 7035 | 7035 | |
| 7036 | 7036 | /** |
@@ -7039,32 +7039,32 @@ discard block |
||
| 7039 | 7039 | */ |
| 7040 | 7040 | public function display_links_tracking_info($view, $userId, $courseCode) |
| 7041 | 7041 | { |
| 7042 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
| 7042 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
| 7043 | 7043 | $courseId = api_get_course_int_id($courseCode); |
| 7044 | 7044 | $userId = intval($userId); |
| 7045 | 7045 | $line = null; |
| 7046 | - if (substr($view,3,1) == '1') { |
|
| 7047 | - $new_view = substr_replace($view,'0',3,1); |
|
| 7048 | - $title[1]=get_lang('LinksDetails'); |
|
| 7049 | - $sql = "SELECT cl.title, cl.url |
|
| 7046 | + if (substr($view,3,1) == '1') { |
|
| 7047 | + $new_view = substr_replace($view,'0',3,1); |
|
| 7048 | + $title[1]=get_lang('LinksDetails'); |
|
| 7049 | + $sql = "SELECT cl.title, cl.url |
|
| 7050 | 7050 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
| 7051 | 7051 | WHERE sl.links_link_id = cl.id |
| 7052 | 7052 | AND sl.c_id = $courseId |
| 7053 | 7053 | AND sl.links_user_id = $userId |
| 7054 | 7054 | GROUP BY cl.title, cl.url"; |
| 7055 | - $results = StatsUtils::getManyResults2Col($sql); |
|
| 7056 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
| 7057 | - if (is_array($results)) { |
|
| 7058 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7059 | - $line .= $results[$j][0]."\n"; |
|
| 7060 | - } |
|
| 7061 | - } else { |
|
| 7062 | - $line=get_lang('NoResult'); |
|
| 7063 | - } |
|
| 7064 | - } else { |
|
| 7065 | - $new_view = substr_replace($view,'1',3,1); |
|
| 7066 | - } |
|
| 7067 | - return array($title_line, $line); |
|
| 7055 | + $results = StatsUtils::getManyResults2Col($sql); |
|
| 7056 | + $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
| 7057 | + if (is_array($results)) { |
|
| 7058 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7059 | + $line .= $results[$j][0]."\n"; |
|
| 7060 | + } |
|
| 7061 | + } else { |
|
| 7062 | + $line=get_lang('NoResult'); |
|
| 7063 | + } |
|
| 7064 | + } else { |
|
| 7065 | + $new_view = substr_replace($view,'1',3,1); |
|
| 7066 | + } |
|
| 7067 | + return array($title_line, $line); |
|
| 7068 | 7068 | } |
| 7069 | 7069 | |
| 7070 | 7070 | /** |
@@ -7077,38 +7077,38 @@ discard block |
||
| 7077 | 7077 | */ |
| 7078 | 7078 | public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0) |
| 7079 | 7079 | { |
| 7080 | - // protect data |
|
| 7081 | - $user_id = intval($user_id); |
|
| 7080 | + // protect data |
|
| 7081 | + $user_id = intval($user_id); |
|
| 7082 | 7082 | $courseId = api_get_course_int_id($courseCode); |
| 7083 | - $session_id = intval($session_id); |
|
| 7083 | + $session_id = intval($session_id); |
|
| 7084 | 7084 | |
| 7085 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 7085 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
| 7086 | 7086 | |
| 7087 | - if (substr($view,4,1) == '1') { |
|
| 7088 | - $new_view = substr_replace($view,'0',4,1); |
|
| 7089 | - $title[1]= get_lang('DocumentsDetails'); |
|
| 7087 | + if (substr($view,4,1) == '1') { |
|
| 7088 | + $new_view = substr_replace($view,'0',4,1); |
|
| 7089 | + $title[1]= get_lang('DocumentsDetails'); |
|
| 7090 | 7090 | |
| 7091 | - $sql = "SELECT down_doc_path |
|
| 7091 | + $sql = "SELECT down_doc_path |
|
| 7092 | 7092 | FROM $downloads_table |
| 7093 | 7093 | WHERE c_id = $courseId |
| 7094 | 7094 | AND down_user_id = $user_id |
| 7095 | 7095 | AND down_session_id = $session_id |
| 7096 | 7096 | GROUP BY down_doc_path"; |
| 7097 | 7097 | |
| 7098 | - $results = StatsUtils::getManyResults1Col($sql); |
|
| 7099 | - $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
| 7098 | + $results = StatsUtils::getManyResults1Col($sql); |
|
| 7099 | + $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
| 7100 | 7100 | $line = null; |
| 7101 | - if (is_array($results)) { |
|
| 7102 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7103 | - $line .= $results[$j]."\n"; |
|
| 7104 | - } |
|
| 7105 | - } else { |
|
| 7106 | - $line = get_lang('NoResult'); |
|
| 7107 | - } |
|
| 7108 | - } else { |
|
| 7109 | - $new_view = substr_replace($view,'1',4,1); |
|
| 7110 | - } |
|
| 7111 | - return array($title_line, $line); |
|
| 7101 | + if (is_array($results)) { |
|
| 7102 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
| 7103 | + $line .= $results[$j]."\n"; |
|
| 7104 | + } |
|
| 7105 | + } else { |
|
| 7106 | + $line = get_lang('NoResult'); |
|
| 7107 | + } |
|
| 7108 | + } else { |
|
| 7109 | + $new_view = substr_replace($view,'1',4,1); |
|
| 7110 | + } |
|
| 7111 | + return array($title_line, $line); |
|
| 7112 | 7112 | } |
| 7113 | 7113 | |
| 7114 | 7114 | /** |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | return true; |
| 291 | 291 | } else { |
| 292 | 292 | $tbl_document = Database::get_course_table(TABLE_DOCUMENT); |
| 293 | - $tbl_item_property = $this_course . 'item_property'; |
|
| 293 | + $tbl_item_property = $this_course.'item_property'; |
|
| 294 | 294 | $doc_url = Database::escape_string($doc_url); |
| 295 | 295 | $query = "SELECT 1 FROM $tbl_document AS docs,$tbl_item_property AS props |
| 296 | 296 | WHERE |
@@ -340,18 +340,18 @@ discard block |
||
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | header('Content-type: application/octet-stream'); |
| 343 | - header('Content-length: ' . $len); |
|
| 343 | + header('Content-length: '.$len); |
|
| 344 | 344 | if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
| 345 | - header('Content-Disposition: filename= ' . $filename); |
|
| 345 | + header('Content-Disposition: filename= '.$filename); |
|
| 346 | 346 | } else { |
| 347 | - header('Content-Disposition: attachment; filename= ' . $filename); |
|
| 347 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
| 348 | 348 | } |
| 349 | 349 | if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
| 350 | 350 | header('Pragma: '); |
| 351 | 351 | header('Cache-Control: '); |
| 352 | 352 | header('Cache-Control: public'); // IE cannot download from sessions without a cache |
| 353 | 353 | } |
| 354 | - header('Content-Description: ' . $filename); |
|
| 354 | + header('Content-Description: '.$filename); |
|
| 355 | 355 | header('Content-Transfer-Encoding: binary'); |
| 356 | 356 | |
| 357 | 357 | $res = fopen($full_file_name, 'r'); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | $lpFixedEncoding = api_get_configuration_value('lp_fixed_encoding'); |
| 366 | 366 | |
| 367 | 367 | header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); |
| 368 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 368 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 369 | 369 | // Commented to avoid double caching declaration when playing with IE and HTTPS |
| 370 | 370 | //header('Cache-Control: no-cache, must-revalidate'); |
| 371 | 371 | //header('Pragma: no-cache'); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | } else { |
| 377 | 377 | $encoding = @api_detect_encoding_html(file_get_contents($full_file_name)); |
| 378 | 378 | if (!empty($encoding)) { |
| 379 | - $content_type .= '; charset=' . $encoding; |
|
| 379 | + $content_type .= '; charset='.$encoding; |
|
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | break; |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | } else { |
| 387 | 387 | $encoding = @api_detect_encoding(strip_tags(file_get_contents($full_file_name))); |
| 388 | 388 | if (!empty($encoding)) { |
| 389 | - $content_type .= '; charset=' . $encoding; |
|
| 389 | + $content_type .= '; charset='.$encoding; |
|
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | break; |
@@ -395,13 +395,13 @@ discard block |
||
| 395 | 395 | header('Content-type: application/octet-stream'); |
| 396 | 396 | break; |
| 397 | 397 | } |
| 398 | - header('Content-type: ' . $content_type); |
|
| 399 | - header('Content-Length: ' . $len); |
|
| 398 | + header('Content-type: '.$content_type); |
|
| 399 | + header('Content-Length: '.$len); |
|
| 400 | 400 | $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); |
| 401 | 401 | if (strpos($user_agent, 'msie')) { |
| 402 | - header('Content-Disposition: ; filename= ' . $filename); |
|
| 402 | + header('Content-Disposition: ; filename= '.$filename); |
|
| 403 | 403 | } else { |
| 404 | - header('Content-Disposition: inline; filename= ' . $filename); |
|
| 404 | + header('Content-Disposition: inline; filename= '.$filename); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | if ($fixLinksHttpToHttps) { |
@@ -442,18 +442,18 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | header('Content-type: application/octet-stream'); |
| 444 | 444 | //header('Content-Type: application/force-download'); |
| 445 | - header('Content-length: ' . $len); |
|
| 445 | + header('Content-length: '.$len); |
|
| 446 | 446 | if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
| 447 | - header('Content-Disposition: filename= ' . $filename); |
|
| 447 | + header('Content-Disposition: filename= '.$filename); |
|
| 448 | 448 | } else { |
| 449 | - header('Content-Disposition: attachment; filename= ' . $filename); |
|
| 449 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
| 450 | 450 | } |
| 451 | 451 | if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
| 452 | 452 | header('Pragma: '); |
| 453 | 453 | header('Cache-Control: '); |
| 454 | 454 | header('Cache-Control: public'); // IE cannot download from sessions without a cache |
| 455 | 455 | } |
| 456 | - header('Content-Description: ' . $filename); |
|
| 456 | + header('Content-Description: '.$filename); |
|
| 457 | 457 | header('Content-transfer-encoding: binary'); |
| 458 | 458 | echo $full_string; |
| 459 | 459 | |
@@ -466,30 +466,30 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | $content_type = self::file_get_mime_type($filename); |
| 468 | 468 | header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); |
| 469 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 469 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 470 | 470 | header('Cache-Control: no-cache, must-revalidate'); |
| 471 | 471 | header('Pragma: no-cache'); |
| 472 | 472 | switch ($content_type) { |
| 473 | 473 | case 'text/html': |
| 474 | 474 | $encoding = @api_detect_encoding_html($full_string); |
| 475 | 475 | if (!empty($encoding)) { |
| 476 | - $content_type .= '; charset=' . $encoding; |
|
| 476 | + $content_type .= '; charset='.$encoding; |
|
| 477 | 477 | } |
| 478 | 478 | break; |
| 479 | 479 | case 'text/plain': |
| 480 | 480 | $encoding = @api_detect_encoding(strip_tags($full_string)); |
| 481 | 481 | if (!empty($encoding)) { |
| 482 | - $content_type .= '; charset=' . $encoding; |
|
| 482 | + $content_type .= '; charset='.$encoding; |
|
| 483 | 483 | } |
| 484 | 484 | break; |
| 485 | 485 | } |
| 486 | - header('Content-type: ' . $content_type); |
|
| 487 | - header('Content-Length: ' . $len); |
|
| 486 | + header('Content-type: '.$content_type); |
|
| 487 | + header('Content-Length: '.$len); |
|
| 488 | 488 | $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']); |
| 489 | 489 | if (strpos($user_agent, 'msie')) { |
| 490 | - header('Content-Disposition: ; filename= ' . $filename); |
|
| 490 | + header('Content-Disposition: ; filename= '.$filename); |
|
| 491 | 491 | } else { |
| 492 | - header('Content-Disposition: inline; filename= ' . $filename); |
|
| 492 | + header('Content-Disposition: inline; filename= '.$filename); |
|
| 493 | 493 | } |
| 494 | 494 | echo($full_string); |
| 495 | 495 | //You have to ensure that the calling script then stops processing (exit();) |
@@ -582,9 +582,9 @@ discard block |
||
| 582 | 582 | if (!empty($students)) { |
| 583 | 583 | $conditionList = array(); |
| 584 | 584 | foreach ($students as $studentId => $studentInfo) { |
| 585 | - $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id']; |
|
| 585 | + $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id']; |
|
| 586 | 586 | } |
| 587 | - $sharedCondition .= ' AND docs.path IN ("' . implode('","', $conditionList) . '")'; |
|
| 587 | + $sharedCondition .= ' AND docs.path IN ("'.implode('","', $conditionList).'")'; |
|
| 588 | 588 | } |
| 589 | 589 | } |
| 590 | 590 | |
@@ -610,8 +610,8 @@ discard block |
||
| 610 | 610 | last.c_id = {$_course['real_id']} |
| 611 | 611 | ) |
| 612 | 612 | WHERE |
| 613 | - docs.path LIKE '" . Database::escape_string($path . $added_slash.'%'). "' AND |
|
| 614 | - docs.path NOT LIKE '" . Database::escape_string($path . $added_slash.'%/%')."' AND |
|
| 613 | + docs.path LIKE '".Database::escape_string($path.$added_slash.'%')."' AND |
|
| 614 | + docs.path NOT LIKE '" . Database::escape_string($path.$added_slash.'%/%')."' AND |
|
| 615 | 615 | docs.path NOT LIKE '%_DELETED_%' AND |
| 616 | 616 | $userGroupFilter AND |
| 617 | 617 | last.visibility $visibility_bit |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | $table_template = Database::get_main_table(TABLE_MAIN_TEMPLATES); |
| 653 | 653 | $sql = "SELECT id FROM $table_template |
| 654 | 654 | WHERE |
| 655 | - course_code = '" . $_course['code'] . "' AND |
|
| 655 | + course_code = '".$_course['code']."' AND |
|
| 656 | 656 | user_id = '".api_get_user_id()."' AND |
| 657 | 657 | ref_doc = '".$row['id']."'"; |
| 658 | 658 | $template_result = Database::query($sql); |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | if (!empty($students)) { |
| 763 | 763 | $conditionList = array(); |
| 764 | 764 | foreach ($students as $studentId => $studentInfo) { |
| 765 | - $conditionList[] = '/shared_folder/sf_user_' . $studentInfo['user_id']; |
|
| 765 | + $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id']; |
|
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | INNER JOIN $TABLE_DOCUMENT AS docs |
| 787 | 787 | ON ( |
| 788 | 788 | docs.id = last.ref AND |
| 789 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
| 789 | + last.tool = '".TOOL_DOCUMENT."' AND |
|
| 790 | 790 | last.c_id = {$_course['real_id']} AND |
| 791 | 791 | docs.c_id = {$_course['real_id']} |
| 792 | 792 | ) |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | INNER JOIN $TABLE_DOCUMENT AS docs |
| 804 | 804 | ON ( |
| 805 | 805 | docs.id = last.ref AND |
| 806 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
| 806 | + last.tool = '".TOOL_DOCUMENT."' AND |
|
| 807 | 807 | last.c_id = {$_course['real_id']} AND |
| 808 | 808 | docs.c_id = {$_course['real_id']} |
| 809 | 809 | ) |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | WHERE |
| 851 | 851 | docs.id = last.ref AND |
| 852 | 852 | docs.filetype = 'folder' AND |
| 853 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
| 853 | + last.tool = '".TOOL_DOCUMENT."' AND |
|
| 854 | 854 | $groupCondition AND |
| 855 | 855 | last.visibility = 1 |
| 856 | 856 | $condition_session AND |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | WHERE |
| 872 | 872 | docs.id = last.ref AND |
| 873 | 873 | docs.filetype = 'folder' AND |
| 874 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
| 874 | + last.tool = '".TOOL_DOCUMENT."' AND |
|
| 875 | 875 | $groupCondition AND |
| 876 | 876 | last.visibility = 0 $condition_session AND |
| 877 | 877 | last.c_id = {$_course['real_id']} AND |
@@ -887,9 +887,9 @@ discard block |
||
| 887 | 887 | FROM $TABLE_ITEMPROPERTY AS last, $TABLE_DOCUMENT AS docs |
| 888 | 888 | WHERE |
| 889 | 889 | docs.id = last.ref AND |
| 890 | - docs.path LIKE '" . Database::escape_string($row['path'].'/%') . "' AND |
|
| 890 | + docs.path LIKE '".Database::escape_string($row['path'].'/%')."' AND |
|
| 891 | 891 | docs.filetype = 'folder' AND |
| 892 | - last.tool = '" . TOOL_DOCUMENT . "' AND |
|
| 892 | + last.tool = '" . TOOL_DOCUMENT."' AND |
|
| 893 | 893 | $groupCondition AND |
| 894 | 894 | last.visibility = 1 $condition_session AND |
| 895 | 895 | last.c_id = {$_course['real_id']} AND |
@@ -966,7 +966,7 @@ discard block |
||
| 966 | 966 | tp.c_id = $course_id AND |
| 967 | 967 | td.session_id = $sessionId AND |
| 968 | 968 | tp.ref= td.id AND |
| 969 | - (path='" . $path . "' OR path LIKE BINARY '" . $path . "/%' ) "; |
|
| 969 | + (path='".$path."' OR path LIKE BINARY '".$path."/%' ) "; |
|
| 970 | 970 | // Get all id's of documents that are deleted |
| 971 | 971 | $what_to_check_result = Database::query($sql); |
| 972 | 972 | |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | $res = Database::query($sql); |
| 1309 | 1309 | if (Database::num_rows($res) > 0) { |
| 1310 | 1310 | $row2 = Database::fetch_array($res); |
| 1311 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
| 1311 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
| 1312 | 1312 | $di = new ChamiloIndexer(); |
| 1313 | 1313 | $di->remove_document((int) $row2['search_did']); |
| 1314 | 1314 | } |
@@ -1317,7 +1317,7 @@ discard block |
||
| 1317 | 1317 | Database::query($sql); |
| 1318 | 1318 | |
| 1319 | 1319 | // remove terms from db |
| 1320 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 1320 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 1321 | 1321 | delete_all_values_for_item($course_id, TOOL_DOCUMENT, $document_id); |
| 1322 | 1322 | } |
| 1323 | 1323 | } |
@@ -1406,12 +1406,12 @@ discard block |
||
| 1406 | 1406 | $path = str_replace('%2F', '/', $url_path); |
| 1407 | 1407 | $pathinfo = pathinfo($row['path']); |
| 1408 | 1408 | |
| 1409 | - $row['url'] = api_get_path(WEB_CODE_PATH) . 'document/showinframes.php?cidReq=' . $course_code . '&id=' . $id; |
|
| 1410 | - $row['document_url'] = api_get_path(WEB_CODE_PATH) . 'document/document.php?cidReq=' . $course_code . '&id=' . $id; |
|
| 1411 | - $row['absolute_path'] = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path']; |
|
| 1412 | - $row['absolute_path_from_document'] = '/document' . $row['path']; |
|
| 1413 | - $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'] . '/'; |
|
| 1414 | - $row['direct_url'] = $www . $path; |
|
| 1409 | + $row['url'] = api_get_path(WEB_CODE_PATH).'document/showinframes.php?cidReq='.$course_code.'&id='.$id; |
|
| 1410 | + $row['document_url'] = api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.$course_code.'&id='.$id; |
|
| 1411 | + $row['absolute_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path']; |
|
| 1412 | + $row['absolute_path_from_document'] = '/document'.$row['path']; |
|
| 1413 | + $row['absolute_parent_path'] = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$pathinfo['dirname'].'/'; |
|
| 1414 | + $row['direct_url'] = $www.$path; |
|
| 1415 | 1415 | |
| 1416 | 1416 | if (dirname($row['path']) == '.') { |
| 1417 | 1417 | $row['parent_id'] = '0'; |
@@ -1430,7 +1430,7 @@ discard block |
||
| 1430 | 1430 | $real_dir = ''; |
| 1431 | 1431 | |
| 1432 | 1432 | for ($i = 1; $i < $array_len; $i++) { |
| 1433 | - $real_dir .= '/' . $dir_array[$i]; |
|
| 1433 | + $real_dir .= '/'.$dir_array[$i]; |
|
| 1434 | 1434 | $parent_id = self::get_document_id($course_info, $real_dir); |
| 1435 | 1435 | if ($session_id != 0 && empty($parent_id)) { |
| 1436 | 1436 | $parent_id = self::get_document_id($course_info, $real_dir, 0); |
@@ -1504,21 +1504,21 @@ discard block |
||
| 1504 | 1504 | $user_id = intval($user_id); |
| 1505 | 1505 | $document_id = intval($document_id); |
| 1506 | 1506 | |
| 1507 | - $sql = 'SELECT id FROM ' . $table_template . ' |
|
| 1507 | + $sql = 'SELECT id FROM '.$table_template.' |
|
| 1508 | 1508 | WHERE |
| 1509 | - course_code="' . $course_code . '" AND |
|
| 1510 | - user_id="' . $user_id . '" AND |
|
| 1511 | - ref_doc="' . $document_id . '"'; |
|
| 1509 | + course_code="' . $course_code.'" AND |
|
| 1510 | + user_id="' . $user_id.'" AND |
|
| 1511 | + ref_doc="' . $document_id.'"'; |
|
| 1512 | 1512 | $result = Database::query($sql); |
| 1513 | 1513 | $template_id = Database::result($result, 0, 0); |
| 1514 | 1514 | |
| 1515 | - my_delete(api_get_path(SYS_CODE_PATH) . 'upload/template_thumbnails/' . $template_id . '.jpg'); |
|
| 1515 | + my_delete(api_get_path(SYS_CODE_PATH).'upload/template_thumbnails/'.$template_id.'.jpg'); |
|
| 1516 | 1516 | |
| 1517 | - $sql = 'DELETE FROM ' . $table_template . ' |
|
| 1517 | + $sql = 'DELETE FROM '.$table_template.' |
|
| 1518 | 1518 | WHERE |
| 1519 | - course_code="' . $course_code . '" AND |
|
| 1520 | - user_id="' . $user_id . '" AND |
|
| 1521 | - ref_doc="' . $document_id . '"'; |
|
| 1519 | + course_code="' . $course_code.'" AND |
|
| 1520 | + user_id="' . $user_id.'" AND |
|
| 1521 | + ref_doc="' . $document_id.'"'; |
|
| 1522 | 1522 | |
| 1523 | 1523 | Database::query($sql); |
| 1524 | 1524 | } |
@@ -1578,9 +1578,9 @@ discard block |
||
| 1578 | 1578 | INNER JOIN $propTable ip |
| 1579 | 1579 | ON (d.id = ip.ref AND d.c_id = $course_id AND ip.c_id = $course_id) |
| 1580 | 1580 | WHERE |
| 1581 | - ip.tool = '" . TOOL_DOCUMENT . "' $condition AND |
|
| 1581 | + ip.tool = '".TOOL_DOCUMENT."' $condition AND |
|
| 1582 | 1582 | filetype = '$file_type' AND |
| 1583 | - locate(concat(path,'/'), '" . Database::escape_string($doc_path.'/'). "')=1 |
|
| 1583 | + locate(concat(path,'/'), '".Database::escape_string($doc_path.'/')."')=1 |
|
| 1584 | 1584 | "; |
| 1585 | 1585 | |
| 1586 | 1586 | $result = Database::query($sql); |
@@ -1743,12 +1743,12 @@ discard block |
||
| 1743 | 1743 | if (empty($session_id)) { |
| 1744 | 1744 | $sql_session = 'AND (session_id = 0 OR isnull(session_id)) '; |
| 1745 | 1745 | } elseif ($session_id > 0) { |
| 1746 | - $sql_session = 'AND session_id=' . intval($session_id); |
|
| 1746 | + $sql_session = 'AND session_id='.intval($session_id); |
|
| 1747 | 1747 | } else { |
| 1748 | 1748 | $sql_session = ''; |
| 1749 | 1749 | } |
| 1750 | - $sql = 'UPDATE ' . $tbl_category . ' SET document_id="' . intval($document_id) . '" |
|
| 1751 | - WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session; |
|
| 1750 | + $sql = 'UPDATE '.$tbl_category.' SET document_id="'.intval($document_id).'" |
|
| 1751 | + WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session; |
|
| 1752 | 1752 | Database::query($sql); |
| 1753 | 1753 | } |
| 1754 | 1754 | |
@@ -1770,12 +1770,12 @@ discard block |
||
| 1770 | 1770 | if (empty($session_id)) { |
| 1771 | 1771 | $sql_session = 'AND (session_id = 0 OR isnull(session_id)) '; |
| 1772 | 1772 | } elseif ($session_id > 0) { |
| 1773 | - $sql_session = 'AND session_id=' . intval($session_id); |
|
| 1773 | + $sql_session = 'AND session_id='.intval($session_id); |
|
| 1774 | 1774 | } else { |
| 1775 | 1775 | $sql_session = ''; |
| 1776 | 1776 | } |
| 1777 | - $sql = 'SELECT document_id FROM ' . $tbl_category . ' |
|
| 1778 | - WHERE course_code="' . Database::escape_string($course_id) . '" ' . $sql_session; |
|
| 1777 | + $sql = 'SELECT document_id FROM '.$tbl_category.' |
|
| 1778 | + WHERE course_code="' . Database::escape_string($course_id).'" '.$sql_session; |
|
| 1779 | 1779 | |
| 1780 | 1780 | $rs = Database::query($sql); |
| 1781 | 1781 | $num = Database::num_rows($rs); |
@@ -1816,7 +1816,7 @@ discard block |
||
| 1816 | 1816 | $all_user_info = array(); |
| 1817 | 1817 | if (Database::num_rows($rs)) { |
| 1818 | 1818 | $row = Database::fetch_array($rs); |
| 1819 | - $filepath = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document' . $row['path']; |
|
| 1819 | + $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path']; |
|
| 1820 | 1820 | if (is_file($filepath)) { |
| 1821 | 1821 | $my_content_html = file_get_contents($filepath); |
| 1822 | 1822 | } |
@@ -1899,7 +1899,7 @@ discard block |
||
| 1899 | 1899 | $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY); |
| 1900 | 1900 | } |
| 1901 | 1901 | |
| 1902 | - $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id']; |
|
| 1902 | + $url = api_get_path(WEB_PATH).'certificates/index.php?id='.$info_grade_certificate['id']; |
|
| 1903 | 1903 | |
| 1904 | 1904 | //replace content |
| 1905 | 1905 | $info_to_replace_in_content_html = array( |
@@ -1916,7 +1916,7 @@ discard block |
||
| 1916 | 1916 | $course_info['name'], |
| 1917 | 1917 | $info_grade_certificate['grade'], |
| 1918 | 1918 | $url, |
| 1919 | - '<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>', |
|
| 1919 | + '<a href="'.$url.'" target="_blank">'.get_lang('CertificateOnlineLink').'</a>', |
|
| 1920 | 1920 | '((certificate_barcode))', |
| 1921 | 1921 | ); |
| 1922 | 1922 | |
@@ -1940,7 +1940,7 @@ discard block |
||
| 1940 | 1940 | if (!empty($extraFields)) { |
| 1941 | 1941 | foreach ($extraFields as $extraField) { |
| 1942 | 1942 | $valueExtra = isset($extra_user_info_data[$extraField['variable']]) ? $extra_user_info_data[$extraField['variable']] : ''; |
| 1943 | - $info_to_be_replaced_in_content_html[] = '((' . strtolower($extraField['variable']) . '))'; |
|
| 1943 | + $info_to_be_replaced_in_content_html[] = '(('.strtolower($extraField['variable']).'))'; |
|
| 1944 | 1944 | $info_to_replace_in_content_html[] = $valueExtra; |
| 1945 | 1945 | } |
| 1946 | 1946 | } |
@@ -1968,17 +1968,17 @@ discard block |
||
| 1968 | 1968 | $tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); |
| 1969 | 1969 | $session_id = api_get_session_id(); |
| 1970 | 1970 | if ($session_id == 0 || is_null($session_id)) { |
| 1971 | - $sql_session = 'AND (session_id=' . intval($session_id) . ' OR isnull(session_id)) '; |
|
| 1971 | + $sql_session = 'AND (session_id='.intval($session_id).' OR isnull(session_id)) '; |
|
| 1972 | 1972 | } elseif ($session_id > 0) { |
| 1973 | - $sql_session = 'AND session_id=' . intval($session_id); |
|
| 1973 | + $sql_session = 'AND session_id='.intval($session_id); |
|
| 1974 | 1974 | } else { |
| 1975 | 1975 | $sql_session = ''; |
| 1976 | 1976 | } |
| 1977 | 1977 | |
| 1978 | - $sql = 'UPDATE ' . $tbl_category . ' SET document_id=null |
|
| 1978 | + $sql = 'UPDATE '.$tbl_category.' SET document_id=null |
|
| 1979 | 1979 | WHERE |
| 1980 | - course_code = "' . Database::escape_string($course_id) . '" AND |
|
| 1981 | - document_id="' . $default_certificate_id . '" ' . $sql_session; |
|
| 1980 | + course_code = "' . Database::escape_string($course_id).'" AND |
|
| 1981 | + document_id="' . $default_certificate_id.'" '.$sql_session; |
|
| 1982 | 1982 | Database::query($sql); |
| 1983 | 1983 | } |
| 1984 | 1984 | } |
@@ -1994,10 +1994,10 @@ discard block |
||
| 1994 | 1994 | if (!empty($courseInfo)) { |
| 1995 | 1995 | $to_group_id = 0; |
| 1996 | 1996 | $to_user_id = null; |
| 1997 | - $course_dir = $courseInfo['path'] . "/document/"; |
|
| 1997 | + $course_dir = $courseInfo['path']."/document/"; |
|
| 1998 | 1998 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 1999 | - $base_work_dir = $sys_course_path . $course_dir; |
|
| 2000 | - $base_work_dir_test = $base_work_dir . 'certificates'; |
|
| 1999 | + $base_work_dir = $sys_course_path.$course_dir; |
|
| 2000 | + $base_work_dir_test = $base_work_dir.'certificates'; |
|
| 2001 | 2001 | $dir_name = '/certificates'; |
| 2002 | 2002 | $post_dir_name = get_lang('CertificatesFiles'); |
| 2003 | 2003 | $visibility_command = 'invisible'; |
@@ -2224,9 +2224,9 @@ discard block |
||
| 2224 | 2224 | //$new_abs_path = realpath($dir.'/'.$second_part); |
| 2225 | 2225 | $dir = ''; |
| 2226 | 2226 | if (!empty($abs_path)) { |
| 2227 | - $dir = dirname($abs_path) . '/'; |
|
| 2227 | + $dir = dirname($abs_path).'/'; |
|
| 2228 | 2228 | } |
| 2229 | - $new_abs_path = realpath($dir . $second_part); |
|
| 2229 | + $new_abs_path = realpath($dir.$second_part); |
|
| 2230 | 2230 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
| 2231 | 2231 | if (count($in_files_list) > 0) { |
| 2232 | 2232 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2239,9 +2239,9 @@ discard block |
||
| 2239 | 2239 | $files_list[] = array($second_part, 'local', 'rel'); |
| 2240 | 2240 | $dir = ''; |
| 2241 | 2241 | if (!empty($abs_path)) { |
| 2242 | - $dir = dirname($abs_path) . '/'; |
|
| 2242 | + $dir = dirname($abs_path).'/'; |
|
| 2243 | 2243 | } |
| 2244 | - $new_abs_path = realpath($dir . $second_part); |
|
| 2244 | + $new_abs_path = realpath($dir.$second_part); |
|
| 2245 | 2245 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
| 2246 | 2246 | if (count($in_files_list) > 0) { |
| 2247 | 2247 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2275,9 +2275,9 @@ discard block |
||
| 2275 | 2275 | $files_list[] = array($source, 'local', 'rel'); |
| 2276 | 2276 | $dir = ''; |
| 2277 | 2277 | if (!empty($abs_path)) { |
| 2278 | - $dir = dirname($abs_path) . '/'; |
|
| 2278 | + $dir = dirname($abs_path).'/'; |
|
| 2279 | 2279 | } |
| 2280 | - $new_abs_path = realpath($dir . $source); |
|
| 2280 | + $new_abs_path = realpath($dir.$source); |
|
| 2281 | 2281 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
| 2282 | 2282 | if (count($in_files_list) > 0) { |
| 2283 | 2283 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2290,9 +2290,9 @@ discard block |
||
| 2290 | 2290 | $files_list[] = array($source, 'local', 'rel'); |
| 2291 | 2291 | $dir = ''; |
| 2292 | 2292 | if (!empty($abs_path)) { |
| 2293 | - $dir = dirname($abs_path) . '/'; |
|
| 2293 | + $dir = dirname($abs_path).'/'; |
|
| 2294 | 2294 | } |
| 2295 | - $new_abs_path = realpath($dir . $source); |
|
| 2295 | + $new_abs_path = realpath($dir.$source); |
|
| 2296 | 2296 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
| 2297 | 2297 | if (count($in_files_list) > 0) { |
| 2298 | 2298 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2326,9 +2326,9 @@ discard block |
||
| 2326 | 2326 | $files_list[] = array($source, 'local', 'rel'); |
| 2327 | 2327 | $dir = ''; |
| 2328 | 2328 | if (!empty($abs_path)) { |
| 2329 | - $dir = dirname($abs_path) . '/'; |
|
| 2329 | + $dir = dirname($abs_path).'/'; |
|
| 2330 | 2330 | } |
| 2331 | - $new_abs_path = realpath($dir . $source); |
|
| 2331 | + $new_abs_path = realpath($dir.$source); |
|
| 2332 | 2332 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
| 2333 | 2333 | if (count($in_files_list) > 0) { |
| 2334 | 2334 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2341,9 +2341,9 @@ discard block |
||
| 2341 | 2341 | $files_list[] = array($source, 'local', 'rel'); |
| 2342 | 2342 | $dir = ''; |
| 2343 | 2343 | if (!empty($abs_path)) { |
| 2344 | - $dir = dirname($abs_path) . '/'; |
|
| 2344 | + $dir = dirname($abs_path).'/'; |
|
| 2345 | 2345 | } |
| 2346 | - $new_abs_path = realpath($dir . $source); |
|
| 2346 | + $new_abs_path = realpath($dir.$source); |
|
| 2347 | 2347 | $in_files_list[] = self::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity + 1); |
| 2348 | 2348 | if (count($in_files_list) > 0) { |
| 2349 | 2349 | $files_list = array_merge($files_list, $in_files_list); |
@@ -2401,24 +2401,24 @@ discard block |
||
| 2401 | 2401 | // then possible closing brackets if we were in the opening bracket case |
| 2402 | 2402 | // OR something like @import() |
| 2403 | 2403 | $res = preg_match_all( |
| 2404 | - '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))' . |
|
| 2404 | + '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]*))'. |
|
| 2405 | 2405 | // '/(((([A-Za-z_:])([A-Za-z0-9_:\.-]|[^\x00-\x7F])*)' . -> seems to be taking too much |
| 2406 | 2406 | // '/(((([A-Za-z_:])([^\x00-\x7F])*)' . -> takes only last letter of parameter name |
| 2407 | - '([ \n\t\r]+)?(' . |
|
| 2407 | + '([ \n\t\r]+)?('. |
|
| 2408 | 2408 | // '(=([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+))' . -> doesn't restrict close enough to the url itself |
| 2409 | - '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))' . |
|
| 2410 | - '|' . |
|
| 2409 | + '(=([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+))'. |
|
| 2410 | + '|'. |
|
| 2411 | 2411 | // '(\(([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)\))' . -> doesn't restrict close enough to the url itself |
| 2412 | - '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))' . |
|
| 2413 | - '))' . |
|
| 2414 | - '|' . |
|
| 2412 | + '(\(([ \n\t\r]+)?("[^"\)]+"|\'[^\'\)]+\'|[^ \n\t\r\)]+)\))'. |
|
| 2413 | + '))'. |
|
| 2414 | + '|'. |
|
| 2415 | 2415 | // '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))?/', -> takes a lot (like 100's of thousands of empty possibilities) |
| 2416 | 2416 | '(@import([ \n\t\r]+)?("[^"]+"|\'[^\']+\'|[^ \n\t\r]+)))/', |
| 2417 | 2417 | $attrString, |
| 2418 | 2418 | $regs |
| 2419 | 2419 | ); |
| 2420 | 2420 | } catch (Exception $e) { |
| 2421 | - error_log('Caught exception: ' . $e->getMessage(), 0); |
|
| 2421 | + error_log('Caught exception: '.$e->getMessage(), 0); |
|
| 2422 | 2422 | } |
| 2423 | 2423 | if ($res) { |
| 2424 | 2424 | for ($i = 0; $i < count($regs[1]); $i++) { |
@@ -2496,14 +2496,14 @@ discard block |
||
| 2496 | 2496 | $orig_course_info_path = $origin_course_info_path; |
| 2497 | 2497 | } |
| 2498 | 2498 | } else { |
| 2499 | - $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'] . '/'; |
|
| 2499 | + $orig_course_path = api_get_path(SYS_COURSE_PATH).$orig_course_info['path'].'/'; |
|
| 2500 | 2500 | $orig_course_info_path = $orig_course_info['path']; |
| 2501 | 2501 | } |
| 2502 | 2502 | |
| 2503 | 2503 | $destination_course_code = CourseManager::get_course_id_from_path($destination_course_directory); |
| 2504 | 2504 | $destination_course_info = api_get_course_info($destination_course_code); |
| 2505 | - $dest_course_path = api_get_path(SYS_COURSE_PATH) . $destination_course_directory . '/'; |
|
| 2506 | - $dest_course_path_rel = api_get_path(REL_COURSE_PATH) . $destination_course_directory . '/'; |
|
| 2505 | + $dest_course_path = api_get_path(SYS_COURSE_PATH).$destination_course_directory.'/'; |
|
| 2506 | + $dest_course_path_rel = api_get_path(REL_COURSE_PATH).$destination_course_directory.'/'; |
|
| 2507 | 2507 | |
| 2508 | 2508 | $user_id = api_get_user_id(); |
| 2509 | 2509 | |
@@ -2512,7 +2512,7 @@ discard block |
||
| 2512 | 2512 | |
| 2513 | 2513 | // Get information about source url |
| 2514 | 2514 | $real_orig_url = $source[0]; // url |
| 2515 | - $scope_url = $source[1]; // scope (local, remote) |
|
| 2515 | + $scope_url = $source[1]; // scope (local, remote) |
|
| 2516 | 2516 | $type_url = $source[2]; // type (rel, abs, url) |
| 2517 | 2517 | |
| 2518 | 2518 | // Get path and query from origin url |
@@ -2524,7 +2524,7 @@ discard block |
||
| 2524 | 2524 | $dest_url_query = ''; |
| 2525 | 2525 | |
| 2526 | 2526 | if (!empty($real_orig_query)) { |
| 2527 | - $dest_url_query = '?' . $real_orig_query; |
|
| 2527 | + $dest_url_query = '?'.$real_orig_query; |
|
| 2528 | 2528 | if (strpos($dest_url_query, $origin_course_code) !== false) { |
| 2529 | 2529 | $dest_url_query = str_replace($origin_course_code, $destination_course_code, $dest_url_query); |
| 2530 | 2530 | } |
@@ -2605,7 +2605,7 @@ discard block |
||
| 2605 | 2605 | |
| 2606 | 2606 | //$destination_url = $url_course_path . $destination_course_directory . '/' . $document_file . $dest_url_query; |
| 2607 | 2607 | // See BT#7780 |
| 2608 | - $destination_url = $dest_course_path_rel . $document_file . $dest_url_query; |
|
| 2608 | + $destination_url = $dest_course_path_rel.$document_file.$dest_url_query; |
|
| 2609 | 2609 | |
| 2610 | 2610 | // If the course code doesn't exist in the path? what we do? Nothing! see BT#1985 |
| 2611 | 2611 | if (strpos($real_orig_path, $origin_course_code) === false) { |
@@ -2640,14 +2640,14 @@ discard block |
||
| 2640 | 2640 | function replace_urls_inside_content_html_when_moving_file($file_name, $original_path, $destiny_path) |
| 2641 | 2641 | { |
| 2642 | 2642 | if (substr($original_path, strlen($original_path) - 1, strlen($original_path)) == '/') { |
| 2643 | - $original = $original_path . $file_name; |
|
| 2643 | + $original = $original_path.$file_name; |
|
| 2644 | 2644 | } else { |
| 2645 | - $original = $original_path . '/' . $file_name; |
|
| 2645 | + $original = $original_path.'/'.$file_name; |
|
| 2646 | 2646 | } |
| 2647 | 2647 | if (substr($destiny_path, strlen($destiny_path) - 1, strlen($destiny_path)) == '/') { |
| 2648 | - $destination = $destiny_path . $file_name; |
|
| 2648 | + $destination = $destiny_path.$file_name; |
|
| 2649 | 2649 | } else { |
| 2650 | - $destination = $destiny_path . '/' . $file_name; |
|
| 2650 | + $destination = $destiny_path.'/'.$file_name; |
|
| 2651 | 2651 | } |
| 2652 | 2652 | $original_count = count(explode('/', $original)); |
| 2653 | 2653 | $destination_count = count(explode('/', $destination)); |
@@ -2661,8 +2661,8 @@ discard block |
||
| 2661 | 2661 | $mode = 'inside'; |
| 2662 | 2662 | } |
| 2663 | 2663 | //We do not select the $original_path becayse the file was already moved |
| 2664 | - $content_html = file_get_contents($destiny_path . '/' . $file_name); |
|
| 2665 | - $destination_file = $destiny_path . '/' . $file_name; |
|
| 2664 | + $content_html = file_get_contents($destiny_path.'/'.$file_name); |
|
| 2665 | + $destination_file = $destiny_path.'/'.$file_name; |
|
| 2666 | 2666 | |
| 2667 | 2667 | $pre_original = strstr($original_path, 'document'); |
| 2668 | 2668 | $pre_destin = strstr($destiny_path, 'document'); |
@@ -2684,11 +2684,11 @@ discard block |
||
| 2684 | 2684 | } |
| 2685 | 2685 | |
| 2686 | 2686 | if ($pre_original != '') { |
| 2687 | - $pre_original = '..' . $pre_original . '/'; |
|
| 2687 | + $pre_original = '..'.$pre_original.'/'; |
|
| 2688 | 2688 | } |
| 2689 | 2689 | |
| 2690 | 2690 | if ($pre_destin != '') { |
| 2691 | - $pre_destin = '..' . $pre_destin . '/'; |
|
| 2691 | + $pre_destin = '..'.$pre_destin.'/'; |
|
| 2692 | 2692 | } |
| 2693 | 2693 | |
| 2694 | 2694 | $levels = explode('/', $pre_original); |
@@ -2706,7 +2706,7 @@ discard block |
||
| 2706 | 2706 | //echo '$count_pre_destination_levels '. $count_pre_destination_levels; |
| 2707 | 2707 | $pre_remove = ''; |
| 2708 | 2708 | for ($i = 1; $i <= $count_pre_destination_levels; $i++) { |
| 2709 | - $pre_remove .='..\/'; |
|
| 2709 | + $pre_remove .= '..\/'; |
|
| 2710 | 2710 | } |
| 2711 | 2711 | |
| 2712 | 2712 | $orig_source_html = DocumentManager::get_resources_from_source_html($content_html); |
@@ -2714,9 +2714,9 @@ discard block |
||
| 2714 | 2714 | foreach ($orig_source_html as $source) { |
| 2715 | 2715 | |
| 2716 | 2716 | // get information about source url |
| 2717 | - $real_orig_url = $source[0]; // url |
|
| 2718 | - $scope_url = $source[1]; // scope (local, remote) |
|
| 2719 | - $type_url = $source[2]; // tyle (rel, abs, url) |
|
| 2717 | + $real_orig_url = $source[0]; // url |
|
| 2718 | + $scope_url = $source[1]; // scope (local, remote) |
|
| 2719 | + $type_url = $source[2]; // tyle (rel, abs, url) |
|
| 2720 | 2720 | // Get path and query from origin url |
| 2721 | 2721 | $orig_parse_url = parse_url($real_orig_url); |
| 2722 | 2722 | $real_orig_path = $orig_parse_url['path']; |
@@ -2743,11 +2743,11 @@ discard block |
||
| 2743 | 2743 | $real_orig_url_temp = ''; |
| 2744 | 2744 | if ($mode == 'inside') { |
| 2745 | 2745 | $real_orig_url_temp = str_replace('../', '', $real_orig_url); |
| 2746 | - $destination_url = $link_to_add . $real_orig_url_temp; |
|
| 2746 | + $destination_url = $link_to_add.$real_orig_url_temp; |
|
| 2747 | 2747 | } else { |
| 2748 | 2748 | $real_orig_url_temp = $real_orig_url; |
| 2749 | 2749 | |
| 2750 | - $destination_url = preg_replace("/" . $pre_remove . "/", '', $real_orig_url, 1); |
|
| 2750 | + $destination_url = preg_replace("/".$pre_remove."/", '', $real_orig_url, 1); |
|
| 2751 | 2751 | } |
| 2752 | 2752 | if ($real_orig_url == $destination_url) { |
| 2753 | 2753 | //echo 'continue2'; |
@@ -2773,7 +2773,7 @@ discard block |
||
| 2773 | 2773 | { |
| 2774 | 2774 | $course_data = api_get_course_info($course_code); |
| 2775 | 2775 | $document_data = self::get_document_data_by_id($document_id, $course_code); |
| 2776 | - $file_path = api_get_path(SYS_COURSE_PATH) . $course_data['path'] . '/document' . $document_data['path']; |
|
| 2776 | + $file_path = api_get_path(SYS_COURSE_PATH).$course_data['path'].'/document'.$document_data['path']; |
|
| 2777 | 2777 | $pdf = new PDF('A4-L', 'L'); |
| 2778 | 2778 | $pdf->html_to_pdf($file_path, $document_data['title'], $course_code); |
| 2779 | 2779 | } |
@@ -2804,9 +2804,9 @@ discard block |
||
| 2804 | 2804 | ) { |
| 2805 | 2805 | $course_info = api_get_course_info(); |
| 2806 | 2806 | $sessionId = api_get_session_id(); |
| 2807 | - $course_dir = $course_info['path'] . '/document'; |
|
| 2807 | + $course_dir = $course_info['path'].'/document'; |
|
| 2808 | 2808 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 2809 | - $base_work_dir = $sys_course_path . $course_dir; |
|
| 2809 | + $base_work_dir = $sys_course_path.$course_dir; |
|
| 2810 | 2810 | |
| 2811 | 2811 | if (isset($files[$fileKey])) { |
| 2812 | 2812 | $upload_ok = process_uploaded_file($files[$fileKey], $show_output); |
@@ -2878,7 +2878,7 @@ discard block |
||
| 2878 | 2878 | // Showing message when sending zip files |
| 2879 | 2879 | if ($new_path === true && $unzip == 1 && $show_output) { |
| 2880 | 2880 | Display::display_confirmation_message( |
| 2881 | - get_lang('UplUploadSucceeded') . '<br />', |
|
| 2881 | + get_lang('UplUploadSucceeded').'<br />', |
|
| 2882 | 2882 | false |
| 2883 | 2883 | ); |
| 2884 | 2884 | } |
@@ -2980,7 +2980,7 @@ discard block |
||
| 2980 | 2980 | } |
| 2981 | 2981 | if (isset($output)) { |
| 2982 | 2982 | foreach ($output as & $line) { |
| 2983 | - $content .= $line . "\n"; |
|
| 2983 | + $content .= $line."\n"; |
|
| 2984 | 2984 | } |
| 2985 | 2985 | return $content; |
| 2986 | 2986 | } else { |
@@ -3012,13 +3012,13 @@ discard block |
||
| 3012 | 3012 | $group_condition = null; |
| 3013 | 3013 | if (isset($group_id)) { |
| 3014 | 3014 | $group_id = intval($group_id); |
| 3015 | - $group_condition = " AND props.to_group_id='" . $group_id . "' "; |
|
| 3015 | + $group_condition = " AND props.to_group_id='".$group_id."' "; |
|
| 3016 | 3016 | } |
| 3017 | 3017 | |
| 3018 | 3018 | $session_condition = null; |
| 3019 | 3019 | if (isset($session_id)) { |
| 3020 | 3020 | $session_id = intval($session_id); |
| 3021 | - $session_condition = " AND props.session_id='" . $session_id . "' "; |
|
| 3021 | + $session_condition = " AND props.session_id='".$session_id."' "; |
|
| 3022 | 3022 | } |
| 3023 | 3023 | |
| 3024 | 3024 | $sql = "SELECT SUM(size) |
@@ -3028,7 +3028,7 @@ discard block |
||
| 3028 | 3028 | WHERE |
| 3029 | 3029 | props.c_id = $course_id AND |
| 3030 | 3030 | docs.c_id = $course_id AND |
| 3031 | - props.tool = '" . TOOL_DOCUMENT . "' AND |
|
| 3031 | + props.tool = '".TOOL_DOCUMENT."' AND |
|
| 3032 | 3032 | props.visibility <> 2 |
| 3033 | 3033 | $group_condition |
| 3034 | 3034 | $session_condition |
@@ -3051,8 +3051,8 @@ discard block |
||
| 3051 | 3051 | $course_quota_m = round($course_quota / 1048576); |
| 3052 | 3052 | $already_consumed_space_m = round($already_consumed_space / 1048576); |
| 3053 | 3053 | |
| 3054 | - $message = get_lang('MaximumAllowedQuota') . ' <strong>' . $course_quota_m . ' megabyte</strong>.<br />'; |
|
| 3055 | - $message .= get_lang('CourseCurrentlyUses') . ' <strong>' . $already_consumed_space_m . ' megabyte</strong>.<br />'; |
|
| 3054 | + $message = get_lang('MaximumAllowedQuota').' <strong>'.$course_quota_m.' megabyte</strong>.<br />'; |
|
| 3055 | + $message .= get_lang('CourseCurrentlyUses').' <strong>'.$already_consumed_space_m.' megabyte</strong>.<br />'; |
|
| 3056 | 3056 | |
| 3057 | 3057 | $percentage = round(($already_consumed_space / $course_quota * 100), 1); |
| 3058 | 3058 | |
@@ -3060,33 +3060,33 @@ discard block |
||
| 3060 | 3060 | |
| 3061 | 3061 | // Decide where to place percentage in graph |
| 3062 | 3062 | if ($percentage >= 50) { |
| 3063 | - $text_in_filled = ' ' . $other_percentage . '%'; |
|
| 3063 | + $text_in_filled = ' '.$other_percentage.'%'; |
|
| 3064 | 3064 | $text_in_unfilled = ''; |
| 3065 | 3065 | } else { |
| 3066 | - $text_in_unfilled = ' ' . $other_percentage . '%'; |
|
| 3066 | + $text_in_unfilled = ' '.$other_percentage.'%'; |
|
| 3067 | 3067 | $text_in_filled = ''; |
| 3068 | 3068 | } |
| 3069 | 3069 | |
| 3070 | 3070 | // Decide the background colour of the graph |
| 3071 | 3071 | if ($percentage < 65) { |
| 3072 | - $colour = '#00BB00'; // Safe - green |
|
| 3072 | + $colour = '#00BB00'; // Safe - green |
|
| 3073 | 3073 | } elseif ($percentage < 90) { |
| 3074 | - $colour = '#ffd400'; // Filling up - yelloworange |
|
| 3074 | + $colour = '#ffd400'; // Filling up - yelloworange |
|
| 3075 | 3075 | } else { |
| 3076 | - $colour = '#DD0000'; // Full - red |
|
| 3076 | + $colour = '#DD0000'; // Full - red |
|
| 3077 | 3077 | } |
| 3078 | 3078 | |
| 3079 | 3079 | // This is used for the table width: a table of only 100 pixels looks too small |
| 3080 | 3080 | $visual_percentage = 4 * $percentage; |
| 3081 | 3081 | $visual_other_percentage = 4 * $other_percentage; |
| 3082 | 3082 | |
| 3083 | - $message .= get_lang('PercentageQuotaInUse') . ': <strong>' . $percentage . '%</strong>.<br />' . |
|
| 3084 | - get_lang('PercentageQuotaFree') . ': <strong>' . $other_percentage . '%</strong>.<br />'; |
|
| 3083 | + $message .= get_lang('PercentageQuotaInUse').': <strong>'.$percentage.'%</strong>.<br />'. |
|
| 3084 | + get_lang('PercentageQuotaFree').': <strong>'.$other_percentage.'%</strong>.<br />'; |
|
| 3085 | 3085 | |
| 3086 | - $show_percentage = ' ' . $percentage . '%'; |
|
| 3087 | - $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\'' . api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/bg-header4.png\');" class="document-quota-bar">' . |
|
| 3088 | - '<div style="width:' . $percentage . '%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;"> </div>' . |
|
| 3089 | - '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">' . $show_percentage . '</span></div>'; |
|
| 3086 | + $show_percentage = ' '.$percentage.'%'; |
|
| 3087 | + $message .= '<div style="width: 80%; text-align: center; -moz-border-radius: 5px 5px 5px 5px; border: 1px solid #aaa; background-image: url(\''.api_get_path(WEB_CODE_PATH).'css/'.api_get_visual_theme().'/images/bg-header4.png\');" class="document-quota-bar">'. |
|
| 3088 | + '<div style="width:'.$percentage.'%; background-color: #bbb; border-right:3px groove #bbb; -moz-border-radius:5px;"> </div>'. |
|
| 3089 | + '<span style="margin-top: -15px; margin-left:-15px; position: absolute;font-weight:bold;">'.$show_percentage.'</span></div>'; |
|
| 3090 | 3090 | echo $message; |
| 3091 | 3091 | } |
| 3092 | 3092 | |
@@ -3102,7 +3102,7 @@ discard block |
||
| 3102 | 3102 | $percentage = $already_consumed_space / $course_quota * 100; |
| 3103 | 3103 | $percentage = round($percentage, 1); |
| 3104 | 3104 | $message = get_lang('YouAreCurrentlyUsingXOfYourX'); |
| 3105 | - $message = sprintf($message, $already_consumed_space_m, $percentage . '%', $course_quota_m . ' '); |
|
| 3105 | + $message = sprintf($message, $already_consumed_space_m, $percentage.'%', $course_quota_m.' '); |
|
| 3106 | 3106 | echo Display::div($message, array('id' => 'document_quota')); |
| 3107 | 3107 | } |
| 3108 | 3108 | |
@@ -3133,13 +3133,13 @@ discard block |
||
| 3133 | 3133 | */ |
| 3134 | 3134 | static function generate_jplayer_jquery($params = array()) |
| 3135 | 3135 | { |
| 3136 | - $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/'; |
|
| 3136 | + $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/'; |
|
| 3137 | 3137 | |
| 3138 | 3138 | $js = ' |
| 3139 | - $("#jquery_jplayer_' . $params['count'] . '").jPlayer({ |
|
| 3139 | + $("#jquery_jplayer_' . $params['count'].'").jPlayer({ |
|
| 3140 | 3140 | ready: function() { |
| 3141 | 3141 | $(this).jPlayer("setMedia", { |
| 3142 | - ' . $params['extension'] . ' : "' . $params['url'] . '" |
|
| 3142 | + ' . $params['extension'].' : "'.$params['url'].'" |
|
| 3143 | 3143 | }); |
| 3144 | 3144 | }, |
| 3145 | 3145 | play: function() { // To avoid both jPlayers playing together. |
@@ -3147,12 +3147,12 @@ discard block |
||
| 3147 | 3147 | }, |
| 3148 | 3148 | //errorAlerts: true, |
| 3149 | 3149 | //warningAlerts: true, |
| 3150 | - swfPath: "' . $js_path . 'jquery-jplayer/jplayer/", |
|
| 3150 | + swfPath: "' . $js_path.'jquery-jplayer/jplayer/", |
|
| 3151 | 3151 | //supplied: "m4a, oga, mp3, ogg, wav", |
| 3152 | - supplied: "' . $params['extension'] . '", |
|
| 3152 | + supplied: "' . $params['extension'].'", |
|
| 3153 | 3153 | wmode: "window", |
| 3154 | 3154 | solution: "flash, html", // Do not change this setting |
| 3155 | - cssSelectorAncestor: "#jp_container_' . $params['count'] . '", |
|
| 3155 | + cssSelectorAncestor: "#jp_container_' . $params['count'].'", |
|
| 3156 | 3156 | }); ' . "\n\n"; |
| 3157 | 3157 | |
| 3158 | 3158 | return $js; |
@@ -3182,16 +3182,16 @@ discard block |
||
| 3182 | 3182 | } |
| 3183 | 3183 | |
| 3184 | 3184 | //Shows only the play button |
| 3185 | - $html = '<div id="jquery_jplayer_' . $i . '" class="jp-jplayer"></div> |
|
| 3186 | - <div id="jp_container_' . $i . '" class="jp-audio"> |
|
| 3185 | + $html = '<div id="jquery_jplayer_'.$i.'" class="jp-jplayer"></div> |
|
| 3186 | + <div id="jp_container_' . $i.'" class="jp-audio"> |
|
| 3187 | 3187 | <div class="jp-type-single"> |
| 3188 | 3188 | <div class="jp-gui jp-interface"> |
| 3189 | 3189 | <ul class="jp-controls"> |
| 3190 | 3190 | <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li> |
| 3191 | 3191 | <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li> |
| 3192 | - ' . $extra_controls . ' |
|
| 3192 | + ' . $extra_controls.' |
|
| 3193 | 3193 | </ul> |
| 3194 | - ' . $progress . ' |
|
| 3194 | + ' . $progress.' |
|
| 3195 | 3195 | </div> |
| 3196 | 3196 | </div> |
| 3197 | 3197 | </div>'; |
@@ -3244,8 +3244,8 @@ discard block |
||
| 3244 | 3244 | </div> |
| 3245 | 3245 | </div> |
| 3246 | 3246 | <div class="jp-no-solution"> |
| 3247 | - <span>' . get_lang('UpdateRequire') . '</span> |
|
| 3248 | - ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile") . ' |
|
| 3247 | + <span>' . get_lang('UpdateRequire').'</span> |
|
| 3248 | + ' . get_lang("ToPlayTheMediaYouWillNeedToUpdateYourBrowserToARecentVersionYouCanAlsoDownloadTheFile").' |
|
| 3249 | 3249 | </div> |
| 3250 | 3250 | </div> |
| 3251 | 3251 | </div>'; |
@@ -3326,7 +3326,7 @@ discard block |
||
| 3326 | 3326 | |
| 3327 | 3327 | $add_folder_filter = null; |
| 3328 | 3328 | if (!empty($filter_by_folder)) { |
| 3329 | - $add_folder_filter = " AND docs.path LIKE '" . Database::escape_string($filter_by_folder) . "%'"; |
|
| 3329 | + $add_folder_filter = " AND docs.path LIKE '".Database::escape_string($filter_by_folder)."%'"; |
|
| 3330 | 3330 | } |
| 3331 | 3331 | |
| 3332 | 3332 | // If we are in LP display hidden folder https://support.chamilo.org/issues/6679 |
@@ -3361,7 +3361,7 @@ discard block |
||
| 3361 | 3361 | |
| 3362 | 3362 | $notLikeCondition = null; |
| 3363 | 3363 | for ($i = 1; $i <= $num; $i++) { |
| 3364 | - $repeat = str_repeat('/%', $i+1); |
|
| 3364 | + $repeat = str_repeat('/%', $i + 1); |
|
| 3365 | 3365 | $notLikeCondition .= " AND docs.path NOT LIKE '".Database::escape_string($cleanedPath.$repeat)."' "; |
| 3366 | 3366 | } |
| 3367 | 3367 | |
@@ -3386,7 +3386,7 @@ discard block |
||
| 3386 | 3386 | ON (docs.id = last.ref AND docs.c_id = last.c_id) |
| 3387 | 3387 | WHERE |
| 3388 | 3388 | docs.path NOT LIKE '%_DELETED_%' AND |
| 3389 | - last.tool = '" . TOOL_DOCUMENT . "' $condition_session AND |
|
| 3389 | + last.tool = '".TOOL_DOCUMENT."' $condition_session AND |
|
| 3390 | 3390 | (last.visibility = '1' $lp_visibility_condition) AND |
| 3391 | 3391 | last.visibility <> 2 AND |
| 3392 | 3392 | docs.c_id = {$course_info['real_id']} AND |
@@ -3416,7 +3416,7 @@ discard block |
||
| 3416 | 3416 | Display::url( |
| 3417 | 3417 | Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL), |
| 3418 | 3418 | ' javascript:void(0);', |
| 3419 | - array('id' => 'close_div_' . $course_info['real_id'] . '_' . $session_id, 'class' => 'close_div') |
|
| 3419 | + array('id' => 'close_div_'.$course_info['real_id'].'_'.$session_id, 'class' => 'close_div') |
|
| 3420 | 3420 | ), |
| 3421 | 3421 | array('style' => 'position:absolute;right:10px') |
| 3422 | 3422 | ); |
@@ -3520,7 +3520,7 @@ discard block |
||
| 3520 | 3520 | $('#'+tempId).hide(); |
| 3521 | 3521 | } else { |
| 3522 | 3522 | image.addClass('open'); |
| 3523 | - image.attr('src', '" . Display::returnIconPath('nolines_minus.gif') . "'); |
|
| 3523 | + image.attr('src', '" . Display::returnIconPath('nolines_minus.gif')."'); |
|
| 3524 | 3524 | $('#'+id).hide(); |
| 3525 | 3525 | $('#'+tempId).show(); |
| 3526 | 3526 | |
@@ -3567,7 +3567,7 @@ discard block |
||
| 3567 | 3567 | $target, |
| 3568 | 3568 | $overwrite_url |
| 3569 | 3569 | ) { |
| 3570 | - $img_sys_path = api_get_path(SYS_CODE_PATH) . 'img/'; |
|
| 3570 | + $img_sys_path = api_get_path(SYS_CODE_PATH).'img/'; |
|
| 3571 | 3571 | $web_code_path = api_get_path(WEB_CODE_PATH); |
| 3572 | 3572 | |
| 3573 | 3573 | $documentId = $resource['id']; |
@@ -3582,7 +3582,7 @@ discard block |
||
| 3582 | 3582 | // It's a file. |
| 3583 | 3583 | $icon = choose_image($path); |
| 3584 | 3584 | $position = strrpos($icon, '.'); |
| 3585 | - $icon = substr($icon, 0, $position) . '_small.gif'; |
|
| 3585 | + $icon = substr($icon, 0, $position).'_small.gif'; |
|
| 3586 | 3586 | $my_file_title = $resource['title']; |
| 3587 | 3587 | $visibility = $resource['visibility']; |
| 3588 | 3588 | |
@@ -3594,25 +3594,25 @@ discard block |
||
| 3594 | 3594 | // Show the "image name" not the filename of the image. |
| 3595 | 3595 | if ($lp_id) { |
| 3596 | 3596 | // LP URL |
| 3597 | - $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=add_item&type=' . TOOL_DOCUMENT . '&file=' . $documentId . '&lp_id=' . $lp_id; |
|
| 3597 | + $url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=add_item&type='.TOOL_DOCUMENT.'&file='.$documentId.'&lp_id='.$lp_id; |
|
| 3598 | 3598 | if (!empty($overwrite_url)) { |
| 3599 | - $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId.''; |
|
| 3599 | + $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId.''; |
|
| 3600 | 3600 | } |
| 3601 | 3601 | } else { |
| 3602 | 3602 | // Direct document URL |
| 3603 | - $url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $documentId; |
|
| 3603 | + $url = $web_code_path.'document/document.php?cidReq='.$course_info['code'].'&id_session='.$session_id.'&id='.$documentId; |
|
| 3604 | 3604 | if (!empty($overwrite_url)) { |
| 3605 | - $url = $overwrite_url . '&cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&document_id=' . $documentId; |
|
| 3605 | + $url = $overwrite_url.'&cidReq='.$course_info['code'].'&id_session='.$session_id.'&document_id='.$documentId; |
|
| 3606 | 3606 | } |
| 3607 | 3607 | } |
| 3608 | 3608 | |
| 3609 | 3609 | $img = Display::returnIconPath($icon); |
| 3610 | - if (!file_exists($img_sys_path . $icon)) { |
|
| 3610 | + if (!file_exists($img_sys_path.$icon)) { |
|
| 3611 | 3611 | $img = Display::returnIconPath('default_small.gif'); |
| 3612 | 3612 | } |
| 3613 | 3613 | |
| 3614 | 3614 | $link = Display::url( |
| 3615 | - '<img alt="" src="' . $img . '" title="" /> ' . $my_file_title, $url, |
|
| 3615 | + '<img alt="" src="'.$img.'" title="" /> '.$my_file_title, $url, |
|
| 3616 | 3616 | array('target' => $target) |
| 3617 | 3617 | ); |
| 3618 | 3618 | |
@@ -3623,12 +3623,12 @@ discard block |
||
| 3623 | 3623 | $return = null; |
| 3624 | 3624 | |
| 3625 | 3625 | if ($lp_id == false) { |
| 3626 | - $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >'; |
|
| 3626 | + $return .= '<li class="doc_resource '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >'; |
|
| 3627 | 3627 | } else { |
| 3628 | - $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="' . $documentId . '" data_type="document" title="' . $my_file_title . '" >'; |
|
| 3628 | + $return .= '<li class="doc_resource lp_resource_element '.$visibilityClass.' " data_id="'.$documentId.'" data_type="document" title="'.$my_file_title.'" >'; |
|
| 3629 | 3629 | } |
| 3630 | 3630 | |
| 3631 | - $return .= '<div class="item_data" style="margin-left:' . ($num * 18) . 'px;margin-right:5px;">'; |
|
| 3631 | + $return .= '<div class="item_data" style="margin-left:'.($num * 18).'px;margin-right:5px;">'; |
|
| 3632 | 3632 | |
| 3633 | 3633 | if ($add_move_button) { |
| 3634 | 3634 | $return .= '<a class="moved" href="#">'; |
@@ -3693,7 +3693,7 @@ discard block |
||
| 3693 | 3693 | if (isset($resource['visible']) && $resource['visible'] == 0) { |
| 3694 | 3694 | $folder_class_hidden = "doc_folder_hidden"; // in base.css |
| 3695 | 3695 | } |
| 3696 | - $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"'; |
|
| 3696 | + $onclick = 'onclick="javascript: testResources(\'res_'.$resource['id'].'\',\'img_'.$resource['id'].'\')"'; |
|
| 3697 | 3697 | } |
| 3698 | 3698 | $return = null; |
| 3699 | 3699 | |
@@ -3701,22 +3701,22 @@ discard block |
||
| 3701 | 3701 | $return = '<ul class="lp_resource">'; |
| 3702 | 3702 | } |
| 3703 | 3703 | |
| 3704 | - $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_' . $resource['id'] . '" style="margin-left:' . ($num * 18) . 'px; ">'; |
|
| 3704 | + $return .= '<li class="doc_folder '.$folder_class_hidden.'" id="doc_id_'.$resource['id'].'" style="margin-left:'.($num * 18).'px; ">'; |
|
| 3705 | 3705 | |
| 3706 | 3706 | $image = Display::returnIconPath('nolines_plus.gif'); |
| 3707 | 3707 | if (empty($path)) { |
| 3708 | 3708 | $image = Display::returnIconPath('nolines_minus.gif'); |
| 3709 | 3709 | } |
| 3710 | - $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'] . '" '.$onclick.'>'; |
|
| 3710 | + $return .= '<img style="cursor: pointer;" src="'.$image.'" align="absmiddle" id="img_'.$resource['id'].'" '.$onclick.'>'; |
|
| 3711 | 3711 | $return .= Display::returnIconPath('lp_folder.gif').' '; |
| 3712 | 3712 | $return .= '<span '.$onclick.' style="cursor: pointer;" >'.$title.'</span>'; |
| 3713 | 3713 | $return .= '</li>'; |
| 3714 | 3714 | |
| 3715 | 3715 | if (empty($path)) { |
| 3716 | 3716 | if ($folderId == false) { |
| 3717 | - $return .= '<div id="res_' . $resource['id'] . '" >'; |
|
| 3717 | + $return .= '<div id="res_'.$resource['id'].'" >'; |
|
| 3718 | 3718 | } else { |
| 3719 | - $return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >'; |
|
| 3719 | + $return .= '<div id="res_'.$resource['id'].'" style="display: none;" >'; |
|
| 3720 | 3720 | } |
| 3721 | 3721 | } |
| 3722 | 3722 | |
@@ -3878,9 +3878,9 @@ discard block |
||
| 3878 | 3878 | $session_id = api_get_session_id(); |
| 3879 | 3879 | } |
| 3880 | 3880 | $course_info = api_get_course_info($course_code); |
| 3881 | - $course_dir = $course_info['path'] . '/document'; |
|
| 3881 | + $course_dir = $course_info['path'].'/document'; |
|
| 3882 | 3882 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 3883 | - $base_work_dir = $sys_course_path . $course_dir; |
|
| 3883 | + $base_work_dir = $sys_course_path.$course_dir; |
|
| 3884 | 3884 | |
| 3885 | 3885 | $course_id = $course_info['real_id']; |
| 3886 | 3886 | $table_document = Database::get_course_table(TABLE_DOCUMENT); |
@@ -3889,7 +3889,7 @@ discard block |
||
| 3889 | 3889 | $result = Database::query($qry); |
| 3890 | 3890 | if (Database::num_rows($result) == 1) { |
| 3891 | 3891 | $row = Database::fetch_array($result); |
| 3892 | - $doc_path = api_get_path(SYS_COURSE_PATH) . $course_dir . $row['path']; |
|
| 3892 | + $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path']; |
|
| 3893 | 3893 | //TODO: mime_content_type is deprecated, fileinfo php extension is enabled by default as of PHP 5.3.0 |
| 3894 | 3894 | // now versions of PHP on Debian testing(5.2.6-5) and Ubuntu(5.2.6-2ubuntu) are lower, so wait for a while |
| 3895 | 3895 | $doc_mime = mime_content_type($doc_path); |
@@ -3920,8 +3920,8 @@ discard block |
||
| 3920 | 3920 | $file_content = self::get_text_content($doc_path, $doc_mime); |
| 3921 | 3921 | $course_code = Database::escape_string($course_code); |
| 3922 | 3922 | |
| 3923 | - require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php'; |
|
| 3924 | - require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php'; |
|
| 3923 | + require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; |
|
| 3924 | + require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; |
|
| 3925 | 3925 | |
| 3926 | 3926 | $ic_slide = new IndexableChunk(); |
| 3927 | 3927 | $ic_slide->addValue('title', $file_title); |
@@ -3938,7 +3938,7 @@ discard block |
||
| 3938 | 3938 | $di = new ChamiloIndexer(); |
| 3939 | 3939 | $return = $di->connectDb(null, null, $lang); |
| 3940 | 3940 | |
| 3941 | - require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php'; |
|
| 3941 | + require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; |
|
| 3942 | 3942 | $specific_fields = get_specific_field_list(); |
| 3943 | 3943 | |
| 3944 | 3944 | // process different depending on what to do if file exists |
@@ -3975,7 +3975,7 @@ discard block |
||
| 3975 | 3975 | } else { //if the specific field is not defined, force an empty one |
| 3976 | 3976 | $sterms = ''; |
| 3977 | 3977 | } |
| 3978 | - $all_specific_terms .= ' ' . $sterms; |
|
| 3978 | + $all_specific_terms .= ' '.$sterms; |
|
| 3979 | 3979 | $sterms = explode(',', $sterms); |
| 3980 | 3980 | foreach ($sterms as $sterm) { |
| 3981 | 3981 | $sterm = trim($sterm); |
@@ -3989,7 +3989,7 @@ discard block |
||
| 3989 | 3989 | } |
| 3990 | 3990 | } |
| 3991 | 3991 | // Add terms also to content to make terms findable by probabilistic search |
| 3992 | - $file_content = $all_specific_terms . ' ' . $file_content; |
|
| 3992 | + $file_content = $all_specific_terms.' '.$file_content; |
|
| 3993 | 3993 | |
| 3994 | 3994 | if (!$simulation) { |
| 3995 | 3995 | $ic_slide->addValue('content', $file_content); |
@@ -4015,7 +4015,7 @@ discard block |
||
| 4015 | 4015 | } else { //if the specific field is not defined, force an empty one |
| 4016 | 4016 | $sterms = ''; |
| 4017 | 4017 | } |
| 4018 | - $all_specific_terms .= ' ' . $sterms; |
|
| 4018 | + $all_specific_terms .= ' '.$sterms; |
|
| 4019 | 4019 | if (!empty($sterms)) { |
| 4020 | 4020 | $sterms = explode(',', $sterms); |
| 4021 | 4021 | foreach ($sterms as $sterm) { |
@@ -4027,7 +4027,7 @@ discard block |
||
| 4027 | 4027 | } |
| 4028 | 4028 | } |
| 4029 | 4029 | // Add terms also to content to make terms findable by probabilistic search |
| 4030 | - $file_content = $all_specific_terms . ' ' . $file_content; |
|
| 4030 | + $file_content = $all_specific_terms.' '.$file_content; |
|
| 4031 | 4031 | if (!$simulation) { |
| 4032 | 4032 | $ic_slide->addValue('content', $file_content); |
| 4033 | 4033 | $di->addChunk($ic_slide); |
@@ -4311,7 +4311,7 @@ discard block |
||
| 4311 | 4311 | $defaultVisibility = 'visible'; |
| 4312 | 4312 | |
| 4313 | 4313 | if (isset($settings['documents'])) { |
| 4314 | - $portalDefaultVisibility = 'invisible'; |
|
| 4314 | + $portalDefaultVisibility = 'invisible'; |
|
| 4315 | 4315 | if ($settings['documents'] == 'true') { |
| 4316 | 4316 | $portalDefaultVisibility = 'visible'; |
| 4317 | 4317 | } |
@@ -4549,7 +4549,7 @@ discard block |
||
| 4549 | 4549 | //make htaccess with allow from all, and file index.html into temp/audio |
| 4550 | 4550 | $htaccess = api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess'; |
| 4551 | 4551 | if (!file_exists($htaccess)) { |
| 4552 | - $htaccess_content="order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
| 4552 | + $htaccess_content = "order deny,allow\r\nallow from all\r\nOptions -Indexes"; |
|
| 4553 | 4553 | $fp = @ fopen(api_get_path(SYS_ARCHIVE_PATH).'temp/audio/.htaccess', 'w'); |
| 4554 | 4554 | if ($fp) { |
| 4555 | 4555 | fwrite($fp, $htaccess_content); |
@@ -4558,9 +4558,9 @@ discard block |
||
| 4558 | 4558 | } |
| 4559 | 4559 | |
| 4560 | 4560 | //encript temp name file |
| 4561 | - $name_crip = sha1(uniqid());//encript |
|
| 4562 | - $findext= explode(".", $file); |
|
| 4563 | - $extension = $findext[count($findext)-1]; |
|
| 4561 | + $name_crip = sha1(uniqid()); //encript |
|
| 4562 | + $findext = explode(".", $file); |
|
| 4563 | + $extension = $findext[count($findext) - 1]; |
|
| 4564 | 4564 | $file_crip = $name_crip.'.'.$extension; |
| 4565 | 4565 | |
| 4566 | 4566 | //copy file to temp/audio directory |
@@ -4664,7 +4664,7 @@ discard block |
||
| 4664 | 4664 | $comment = null; |
| 4665 | 4665 | |
| 4666 | 4666 | $fileName = api_replace_dangerous_char($title); |
| 4667 | - $filePath = api_get_path(SYS_COURSE_PATH) . "{$courseData['path']}/document{$dir}"; |
|
| 4667 | + $filePath = api_get_path(SYS_COURSE_PATH)."{$courseData['path']}/document{$dir}"; |
|
| 4668 | 4668 | $fileFullPath = "{$filePath}/{$fileName}.html"; |
| 4669 | 4669 | $fileSize = 0; |
| 4670 | 4670 | $fileType = 'file'; |
@@ -4716,7 +4716,7 @@ discard block |
||
| 4716 | 4716 | $fileSize, |
| 4717 | 4717 | $title, |
| 4718 | 4718 | $comment, |
| 4719 | - 0,//$readonly = 0, |
|
| 4719 | + 0, //$readonly = 0, |
|
| 4720 | 4720 | true, //$save_visibility = true, |
| 4721 | 4721 | null, //$group_id = null, |
| 4722 | 4722 | $sessionId |
@@ -5001,8 +5001,8 @@ discard block |
||
| 5001 | 5001 | $sessionId, |
| 5002 | 5002 | $groupId |
| 5003 | 5003 | )) { |
| 5004 | - $uniqueName = self::addSuffixToFileName($name, '_' . $counter); |
|
| 5005 | - $filePath = $path . $uniqueName; |
|
| 5004 | + $uniqueName = self::addSuffixToFileName($name, '_'.$counter); |
|
| 5005 | + $filePath = $path.$uniqueName; |
|
| 5006 | 5006 | $counter++; |
| 5007 | 5007 | } |
| 5008 | 5008 | |
@@ -5035,7 +5035,7 @@ discard block |
||
| 5035 | 5035 | $folder_sql = implode("','", $escaped_folders); |
| 5036 | 5036 | |
| 5037 | 5037 | $sql = "SELECT * FROM $doc_table |
| 5038 | - WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('" . $folder_sql . "')"; |
|
| 5038 | + WHERE filetype = 'folder' AND c_id = $course_id AND path IN ('".$folder_sql."')"; |
|
| 5039 | 5039 | $res = Database::query($sql); |
| 5040 | 5040 | $folder_titles = array(); |
| 5041 | 5041 | while ($obj = Database::fetch_object($res)) { |
@@ -5043,7 +5043,7 @@ discard block |
||
| 5043 | 5043 | } |
| 5044 | 5044 | } |
| 5045 | 5045 | |
| 5046 | - $form = new FormValidator('selector', 'GET', api_get_self() . '?' . api_get_cidreq()); |
|
| 5046 | + $form = new FormValidator('selector', 'GET', api_get_self().'?'.api_get_cidreq()); |
|
| 5047 | 5047 | $form->addElement('hidden', 'cidReq', api_get_course_id()); |
| 5048 | 5048 | $parent_select = $form->addSelect('id', get_lang('CurrentDirectory'), '', array('onchange' => 'javascript: document.selector.submit();')); |
| 5049 | 5049 | |
@@ -5063,9 +5063,9 @@ discard block |
||
| 5063 | 5063 | $folder_titles[$folder] = cut($folder_titles[$folder], 80); |
| 5064 | 5064 | $counter = count($path_parts) - 2; |
| 5065 | 5065 | if ($counter > 0) { |
| 5066 | - $label = str_repeat(' ', $counter) . ' — ' . $folder_titles[$folder]; |
|
| 5066 | + $label = str_repeat(' ', $counter).' — '.$folder_titles[$folder]; |
|
| 5067 | 5067 | } else { |
| 5068 | - $label = ' — ' . $folder_titles[$folder]; |
|
| 5068 | + $label = ' — '.$folder_titles[$folder]; |
|
| 5069 | 5069 | } |
| 5070 | 5070 | $parent_select->addOption($label, $folder_id); |
| 5071 | 5071 | if ($selected != '') { |
@@ -5083,7 +5083,7 @@ discard block |
||
| 5083 | 5083 | } else { |
| 5084 | 5084 | $path_parts = explode('/', str_replace($group_dir, '', $folder)); |
| 5085 | 5085 | $label = cut($label, 80); |
| 5086 | - $label = str_repeat(' ', count($path_parts) - 2) . ' — ' . $label; |
|
| 5086 | + $label = str_repeat(' ', count($path_parts) - 2).' — '.$label; |
|
| 5087 | 5087 | } |
| 5088 | 5088 | $parent_select->addOption($label, $folder_id); |
| 5089 | 5089 | if ($selected != '') { |
@@ -5115,7 +5115,7 @@ discard block |
||
| 5115 | 5115 | ) { |
| 5116 | 5116 | global $dbl_click_id; |
| 5117 | 5117 | $course_info = api_get_course_info(); |
| 5118 | - $www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document'; |
|
| 5118 | + $www = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document'; |
|
| 5119 | 5119 | $webOdflist = DocumentManager::get_web_odf_extension_list(); |
| 5120 | 5120 | |
| 5121 | 5121 | // Get the title or the basename depending on what we're using |
@@ -5139,11 +5139,11 @@ discard block |
||
| 5139 | 5139 | |
| 5140 | 5140 | if (!$show_as_icon) { |
| 5141 | 5141 | // Build download link (icon) |
| 5142 | - $forcedownload_link = ($filetype == 'folder') ? api_get_self() . '?' . api_get_cidreq() . '&action=downloadfolder&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq() . '&action=download&id=' . $document_data['id']; |
|
| 5142 | + $forcedownload_link = ($filetype == 'folder') ? api_get_self().'?'.api_get_cidreq().'&action=downloadfolder&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq().'&action=download&id='.$document_data['id']; |
|
| 5143 | 5143 | // Folder download or file download? |
| 5144 | 5144 | $forcedownload_icon = ($filetype == 'folder') ? 'save_pack.png' : 'save.png'; |
| 5145 | 5145 | // Prevent multiple clicks on zipped folder download |
| 5146 | - $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_" . ($dbl_click_id++) . "=false;',10000); } else { return false; }\"" : ''; |
|
| 5146 | + $prevent_multiple_click = ($filetype == 'folder') ? " onclick=\"javascript: if(typeof clic_$dbl_click_id == 'undefined' || !clic_$dbl_click_id) { clic_$dbl_click_id=true; window.setTimeout('clic_".($dbl_click_id++)."=false;',10000); } else { return false; }\"" : ''; |
|
| 5147 | 5147 | } |
| 5148 | 5148 | |
| 5149 | 5149 | $target = '_self'; |
@@ -5159,20 +5159,20 @@ discard block |
||
| 5159 | 5159 | |
| 5160 | 5160 | if ($is_browser_viewable_file) { |
| 5161 | 5161 | if ($ext == 'pdf' || in_array($ext, $webOdflist)) { |
| 5162 | - $url = api_get_self() . '?' . api_get_cidreq() . '&action=download&id=' . $document_data['id']; |
|
| 5162 | + $url = api_get_self().'?'.api_get_cidreq().'&action=download&id='.$document_data['id']; |
|
| 5163 | 5163 | } else { |
| 5164 | - $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
| 5164 | + $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; |
|
| 5165 | 5165 | } |
| 5166 | 5166 | } else { |
| 5167 | 5167 | // url-encode for problematic characters (we may not call them dangerous characters...) |
| 5168 | - $path = str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq(); |
|
| 5169 | - $url = $www . $path; |
|
| 5168 | + $path = str_replace('%2F', '/', $url_path).'?'.api_get_cidreq(); |
|
| 5169 | + $url = $www.$path; |
|
| 5170 | 5170 | } |
| 5171 | 5171 | |
| 5172 | 5172 | /*$path = str_replace('%2F', '/', $url_path); //yox view hack otherwise the image can't be well read |
| 5173 | 5173 | $url = $www . $path;*/ |
| 5174 | 5174 | } else { |
| 5175 | - $url = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
| 5175 | + $url = api_get_self().'?'.api_get_cidreq().'&id='.$document_data['id']; |
|
| 5176 | 5176 | } |
| 5177 | 5177 | |
| 5178 | 5178 | // The little download icon |
@@ -5182,10 +5182,10 @@ discard block |
||
| 5182 | 5182 | if ($path == '/shared_folder') { |
| 5183 | 5183 | $tooltip_title_alt = get_lang('UserFolders'); |
| 5184 | 5184 | } elseif (strstr($path, 'shared_folder_session_')) { |
| 5185 | - $tooltip_title_alt = get_lang('UserFolders') . ' (' . api_get_session_name(api_get_session_id()) . ')'; |
|
| 5185 | + $tooltip_title_alt = get_lang('UserFolders').' ('.api_get_session_name(api_get_session_id()).')'; |
|
| 5186 | 5186 | } elseif (strstr($tooltip_title, 'sf_user_')) { |
| 5187 | 5187 | $userinfo = api_get_user_info(substr($tooltip_title, 8)); |
| 5188 | - $tooltip_title_alt = get_lang('UserFolder') . ' ' . $userinfo['complete_name']; |
|
| 5188 | + $tooltip_title_alt = get_lang('UserFolder').' '.$userinfo['complete_name']; |
|
| 5189 | 5189 | } elseif ($path == '/chat_files') { |
| 5190 | 5190 | $tooltip_title_alt = get_lang('ChatFiles'); |
| 5191 | 5191 | } elseif ($path == '/learning_path') { |
@@ -5218,24 +5218,24 @@ discard block |
||
| 5218 | 5218 | ) { |
| 5219 | 5219 | //filter when I am into shared folder, I can show for donwload only my shared folder |
| 5220 | 5220 | if (DocumentManager::is_shared_folder($curdirpath, $current_session_id)) { |
| 5221 | - if (preg_match('/shared_folder\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) || |
|
| 5222 | - preg_match('/shared_folder_session_' . $current_session_id . '\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) || |
|
| 5221 | + if (preg_match('/shared_folder\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) || |
|
| 5222 | + preg_match('/shared_folder_session_'.$current_session_id.'\/sf_user_'.api_get_user_id().'$/', urldecode($forcedownload_link)) || |
|
| 5223 | 5223 | api_is_allowed_to_edit() || api_is_platform_admin() |
| 5224 | 5224 | ) { |
| 5225 | - $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' . |
|
| 5226 | - Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5225 | + $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'. |
|
| 5226 | + Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5227 | 5227 | } |
| 5228 | 5228 | } elseif (!preg_match('/shared_folder/', urldecode($forcedownload_link)) || |
| 5229 | 5229 | api_is_allowed_to_edit() || |
| 5230 | 5230 | api_is_platform_admin() |
| 5231 | 5231 | ) { |
| 5232 | - $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' . |
|
| 5233 | - Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5232 | + $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'. |
|
| 5233 | + Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5234 | 5234 | } |
| 5235 | 5235 | } |
| 5236 | 5236 | } else { |
| 5237 | - $force_download_html = ($size == 0) ? '' : '<a href="' . $forcedownload_link . '" style="float:right"' . $prevent_multiple_click . '>' . |
|
| 5238 | - Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5237 | + $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'. |
|
| 5238 | + Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5239 | 5239 | } |
| 5240 | 5240 | |
| 5241 | 5241 | // Copy files to users myfiles |
@@ -5243,12 +5243,12 @@ discard block |
||
| 5243 | 5243 | api_get_setting('users_copy_files') == 'true' && |
| 5244 | 5244 | !api_is_anonymous() |
| 5245 | 5245 | ) { |
| 5246 | - $copy_myfiles_link = ($filetype == 'file') ? api_get_self() . '?' . api_get_cidreq() . '&action=copytomyfiles&id=' . $document_data['id'] : api_get_self() . '?' . api_get_cidreq(); |
|
| 5246 | + $copy_myfiles_link = ($filetype == 'file') ? api_get_self().'?'.api_get_cidreq().'&action=copytomyfiles&id='.$document_data['id'] : api_get_self().'?'.api_get_cidreq(); |
|
| 5247 | 5247 | |
| 5248 | 5248 | if ($filetype == 'file') { |
| 5249 | 5249 | |
| 5250 | - $copy_to_myfiles = '<a href="' . $copy_myfiles_link . '" style="float:right"' . $prevent_multiple_click . '>' . |
|
| 5251 | - Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL) . ' </a>'; |
|
| 5250 | + $copy_to_myfiles = '<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'. |
|
| 5251 | + Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL).' </a>'; |
|
| 5252 | 5252 | |
| 5253 | 5253 | if (api_get_setting('allow_my_files') === 'false') { |
| 5254 | 5254 | $copy_to_myfiles = ''; |
@@ -5267,13 +5267,13 @@ discard block |
||
| 5267 | 5267 | $filetype == 'file' && |
| 5268 | 5268 | in_array($extension, array('html', 'htm')) |
| 5269 | 5269 | ) { |
| 5270 | - $pdf_icon = ' <a style="float:right".' . $prevent_multiple_click . ' href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $document_data['id'] . '">' . |
|
| 5271 | - Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a> '; |
|
| 5270 | + $pdf_icon = ' <a style="float:right".'.$prevent_multiple_click.' href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$document_data['id'].'">'. |
|
| 5271 | + Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a> '; |
|
| 5272 | 5272 | } |
| 5273 | 5273 | |
| 5274 | 5274 | if ($is_browser_viewable_file) { |
| 5275 | - $open_in_new_window_link = '<a href="' . $www . str_replace('%2F', '/', $url_path) . '?' . api_get_cidreq() . '" style="float:right"' . $prevent_multiple_click . ' target="_blank">' . |
|
| 5276 | - Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL) . ' </a>'; |
|
| 5275 | + $open_in_new_window_link = '<a href="'.$www.str_replace('%2F', '/', $url_path).'?'.api_get_cidreq().'" style="float:right"'.$prevent_multiple_click.' target="_blank">'. |
|
| 5276 | + Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL).' </a>'; |
|
| 5277 | 5277 | } |
| 5278 | 5278 | |
| 5279 | 5279 | if ($filetype == 'file') { |
@@ -5282,9 +5282,9 @@ discard block |
||
| 5282 | 5282 | (preg_match('/wav$/i', urldecode($checkExtension)) && !preg_match('/_chnano_.wav$/i', urldecode($url))) || |
| 5283 | 5283 | preg_match('/ogg$/i', urldecode($checkExtension)) |
| 5284 | 5284 | ) { |
| 5285 | - return '<span style="float:left" ' . $visibility_class . '>' . |
|
| 5286 | - $title . |
|
| 5287 | - '</span>' . $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; |
|
| 5285 | + return '<span style="float:left" '.$visibility_class.'>'. |
|
| 5286 | + $title. |
|
| 5287 | + '</span>'.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; |
|
| 5288 | 5288 | } elseif ( |
| 5289 | 5289 | |
| 5290 | 5290 | // Show preview |
@@ -5302,7 +5302,7 @@ discard block |
||
| 5302 | 5302 | ) |
| 5303 | 5303 | ) { |
| 5304 | 5304 | // Simpler version of showinframesmin.php with no headers |
| 5305 | - $url = 'show_content.php?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
| 5305 | + $url = 'show_content.php?'.api_get_cidreq().'&id='.$document_data['id']; |
|
| 5306 | 5306 | $class = 'ajax'; |
| 5307 | 5307 | if ($visibility == false) { |
| 5308 | 5308 | $class = "ajax invisible"; |
@@ -5317,34 +5317,34 @@ discard block |
||
| 5317 | 5317 | 'style' => 'float: left;' |
| 5318 | 5318 | ] |
| 5319 | 5319 | ) |
| 5320 | - . $force_download_html . $send_to . $copy_to_myfiles |
|
| 5321 | - . $open_in_new_window_link . $pdf_icon; |
|
| 5320 | + . $force_download_html.$send_to.$copy_to_myfiles |
|
| 5321 | + . $open_in_new_window_link.$pdf_icon; |
|
| 5322 | 5322 | } else { |
| 5323 | 5323 | // For PDF Download the file. |
| 5324 | 5324 | $pdfPreview = null; |
| 5325 | 5325 | if ($ext != 'pdf' && !in_array($ext, $webOdflist)) { |
| 5326 | - $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
| 5326 | + $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; |
|
| 5327 | 5327 | } else { |
| 5328 | 5328 | $pdfPreview = Display::url( |
| 5329 | 5329 | Display::return_icon('preview.gif', get_lang('Preview')), |
| 5330 | - api_get_path(WEB_CODE_PATH).'document/showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id'], |
|
| 5330 | + api_get_path(WEB_CODE_PATH).'document/showinframes.php?'.api_get_cidreq().'&id='.$document_data['id'], |
|
| 5331 | 5331 | array('style' => 'float:right') |
| 5332 | 5332 | ); |
| 5333 | 5333 | } |
| 5334 | 5334 | // No plugin just the old and good showinframes.php page |
| 5335 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" style="float:left" ' . $visibility_class . ' >' . $title . '</a>' . |
|
| 5336 | - $pdfPreview.$force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; |
|
| 5335 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" style="float:left" '.$visibility_class.' >'.$title.'</a>'. |
|
| 5336 | + $pdfPreview.$force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; |
|
| 5337 | 5337 | } |
| 5338 | 5338 | } else { |
| 5339 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . $title . '</a>' . |
|
| 5340 | - $force_download_html . $send_to . $copy_to_myfiles . $open_in_new_window_link . $pdf_icon; |
|
| 5339 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.$title.'</a>'. |
|
| 5340 | + $force_download_html.$send_to.$copy_to_myfiles.$open_in_new_window_link.$pdf_icon; |
|
| 5341 | 5341 | } |
| 5342 | 5342 | // end copy files to users myfiles |
| 5343 | 5343 | } else { |
| 5344 | 5344 | // Icon column |
| 5345 | 5345 | if (preg_match('/shared_folder/', urldecode($checkExtension)) && |
| 5346 | 5346 | preg_match('/shared_folder$/', urldecode($checkExtension)) == false && |
| 5347 | - preg_match('/shared_folder_session_' . $current_session_id . '$/', urldecode($url)) == false |
|
| 5347 | + preg_match('/shared_folder_session_'.$current_session_id.'$/', urldecode($url)) == false |
|
| 5348 | 5348 | ) { |
| 5349 | 5349 | if ($filetype == 'file') { |
| 5350 | 5350 | //Sound preview with jplayer |
@@ -5369,19 +5369,19 @@ discard block |
||
| 5369 | 5369 | api_get_setting('enable_nanogong') == 'true' |
| 5370 | 5370 | ) |
| 5371 | 5371 | ) { |
| 5372 | - $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; |
|
| 5373 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . |
|
| 5374 | - DocumentManager::build_document_icon_tag($filetype, $path) . |
|
| 5375 | - Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>'; |
|
| 5372 | + $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; |
|
| 5373 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'. |
|
| 5374 | + DocumentManager::build_document_icon_tag($filetype, $path). |
|
| 5375 | + Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>'; |
|
| 5376 | 5376 | } else { |
| 5377 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . |
|
| 5378 | - DocumentManager::build_document_icon_tag($filetype, $path) . |
|
| 5379 | - Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>'; |
|
| 5377 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'. |
|
| 5378 | + DocumentManager::build_document_icon_tag($filetype, $path). |
|
| 5379 | + Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>'; |
|
| 5380 | 5380 | } |
| 5381 | 5381 | } else { |
| 5382 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' . |
|
| 5383 | - DocumentManager::build_document_icon_tag($filetype, $path) . |
|
| 5384 | - Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>'; |
|
| 5382 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'. |
|
| 5383 | + DocumentManager::build_document_icon_tag($filetype, $path). |
|
| 5384 | + Display::return_icon('shared.png', get_lang('ResourceShared'), array()).'</a>'; |
|
| 5385 | 5385 | } |
| 5386 | 5386 | } else { |
| 5387 | 5387 | if ($filetype == 'file') { |
@@ -5409,16 +5409,16 @@ discard block |
||
| 5409 | 5409 | api_get_setting('enable_nanogong') == 'true' |
| 5410 | 5410 | ) |
| 5411 | 5411 | ) { |
| 5412 | - $url = 'showinframes.php?' . api_get_cidreq() . '&id=' . $document_data['id']; //without preview |
|
| 5413 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . |
|
| 5414 | - DocumentManager::build_document_icon_tag($filetype, $path) . '</a>'; |
|
| 5412 | + $url = 'showinframes.php?'.api_get_cidreq().'&id='.$document_data['id']; //without preview |
|
| 5413 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'. |
|
| 5414 | + DocumentManager::build_document_icon_tag($filetype, $path).'</a>'; |
|
| 5415 | 5415 | } else { |
| 5416 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' . |
|
| 5417 | - DocumentManager::build_document_icon_tag($filetype, $path) . '</a>'; |
|
| 5416 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'. |
|
| 5417 | + DocumentManager::build_document_icon_tag($filetype, $path).'</a>'; |
|
| 5418 | 5418 | } |
| 5419 | 5419 | } else { |
| 5420 | - return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' . |
|
| 5421 | - DocumentManager::build_document_icon_tag($filetype, $path) . '</a>'; |
|
| 5420 | + return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'. |
|
| 5421 | + DocumentManager::build_document_icon_tag($filetype, $path).'</a>'; |
|
| 5422 | 5422 | } |
| 5423 | 5423 | } |
| 5424 | 5424 | } |
@@ -5442,7 +5442,7 @@ discard block |
||
| 5442 | 5442 | |
| 5443 | 5443 | if (preg_match('/_chnano_.wav$/i', $basename)) { |
| 5444 | 5444 | $icon = "jplayer_play.png"; |
| 5445 | - $basename = 'wav' . ' ' . '(Nanogong)'; |
|
| 5445 | + $basename = 'wav'.' '.'(Nanogong)'; |
|
| 5446 | 5446 | } else { |
| 5447 | 5447 | $basename = substr(strrchr($basename, '.'), 1); |
| 5448 | 5448 | } |
@@ -5458,13 +5458,13 @@ discard block |
||
| 5458 | 5458 | $userinfo = api_get_user_info(substr($basename, 8)); |
| 5459 | 5459 | $icon = $userinfo['avatar_small']; |
| 5460 | 5460 | |
| 5461 | - $basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name']; |
|
| 5461 | + $basename = get_lang('UserFolder').' '.$userinfo['complete_name']; |
|
| 5462 | 5462 | $user_image = true; |
| 5463 | 5463 | } elseif (strstr($path, 'shared_folder_session_')) { |
| 5464 | 5464 | if ($is_allowed_to_edit) { |
| 5465 | - $basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder'); |
|
| 5465 | + $basename = '***('.api_get_session_name($current_session_id).')*** '.get_lang('HelpUsersFolder'); |
|
| 5466 | 5466 | } else { |
| 5467 | - $basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')'; |
|
| 5467 | + $basename = get_lang('UserFolders').' ('.api_get_session_name($current_session_id).')'; |
|
| 5468 | 5468 | } |
| 5469 | 5469 | $icon = 'folder_users.gif'; |
| 5470 | 5470 | } else { |
@@ -5558,16 +5558,16 @@ discard block |
||
| 5558 | 5558 | // Build URL-parameters for table-sorting |
| 5559 | 5559 | $sort_params = array(); |
| 5560 | 5560 | if (isset($_GET['column'])) { |
| 5561 | - $sort_params[] = 'column=' . Security::remove_XSS($_GET['column']); |
|
| 5561 | + $sort_params[] = 'column='.Security::remove_XSS($_GET['column']); |
|
| 5562 | 5562 | } |
| 5563 | 5563 | if (isset($_GET['page_nr'])) { |
| 5564 | - $sort_params[] = 'page_nr=' . Security::remove_XSS($_GET['page_nr']); |
|
| 5564 | + $sort_params[] = 'page_nr='.Security::remove_XSS($_GET['page_nr']); |
|
| 5565 | 5565 | } |
| 5566 | 5566 | if (isset($_GET['per_page'])) { |
| 5567 | - $sort_params[] = 'per_page=' . Security::remove_XSS($_GET['per_page']); |
|
| 5567 | + $sort_params[] = 'per_page='.Security::remove_XSS($_GET['per_page']); |
|
| 5568 | 5568 | } |
| 5569 | 5569 | if (isset($_GET['direction'])) { |
| 5570 | - $sort_params[] = 'direction=' . Security::remove_XSS($_GET['direction']); |
|
| 5570 | + $sort_params[] = 'direction='.Security::remove_XSS($_GET['direction']); |
|
| 5571 | 5571 | } |
| 5572 | 5572 | $sort_params = implode('&', $sort_params); |
| 5573 | 5573 | $visibility_icon = ($visibility == 0) ? 'invisible' : 'visible'; |
@@ -5580,89 +5580,89 @@ discard block |
||
| 5580 | 5580 | if ($is_read_only /* or ($session_id!=api_get_session_id()) */) { |
| 5581 | 5581 | if (api_is_course_admin() || api_is_platform_admin()) { |
| 5582 | 5582 | if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { |
| 5583 | - $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5584 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5585 | - } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
| 5586 | - $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5587 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5583 | + $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5584 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5585 | + } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
| 5586 | + $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5587 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5588 | 5588 | } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { |
| 5589 | - $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5590 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5589 | + $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5590 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5591 | 5591 | } else { |
| 5592 | - $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id. '">' . |
|
| 5593 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5592 | + $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5593 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5594 | 5594 | } |
| 5595 | 5595 | } else { |
| 5596 | 5596 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
| 5597 | 5597 | } |
| 5598 | - $modify_icons .= ' ' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL); |
|
| 5598 | + $modify_icons .= ' '.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL); |
|
| 5599 | 5599 | if (api_is_allowed_to_edit() || api_is_platform_admin()) { |
| 5600 | - $modify_icons .= ' ' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL); |
|
| 5600 | + $modify_icons .= ' '.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), '', ICON_SIZE_SMALL); |
|
| 5601 | 5601 | } |
| 5602 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); |
|
| 5602 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); |
|
| 5603 | 5603 | } else { |
| 5604 | 5604 | //Edit button |
| 5605 | 5605 | if (in_array($path, DocumentManager::get_system_folders())) { |
| 5606 | 5606 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
| 5607 | - } elseif ($is_certificate_mode ) { |
|
| 5607 | + } elseif ($is_certificate_mode) { |
|
| 5608 | 5608 | // gradebook category doesn't seem to be taken into account |
| 5609 | - $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . '&curdirpath=/certificates">' . Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5609 | + $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'&curdirpath=/certificates">'.Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5610 | 5610 | } else { |
| 5611 | 5611 | if (api_get_session_id()) { |
| 5612 | 5612 | if ($document_data['session_id'] == api_get_session_id()) { |
| 5613 | 5613 | if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { |
| 5614 | - $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5615 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5616 | - } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
| 5617 | - $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5618 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5614 | + $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5615 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5616 | + } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
| 5617 | + $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5618 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5619 | 5619 | } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { |
| 5620 | - $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5621 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5620 | + $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5621 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5622 | 5622 | } else { |
| 5623 | - $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5624 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5623 | + $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5624 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5625 | 5625 | } |
| 5626 | 5626 | } else { |
| 5627 | - $modify_icons .= ' ' . Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5627 | + $modify_icons .= ' '.Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5628 | 5628 | } |
| 5629 | 5629 | } else { |
| 5630 | 5630 | if ($extension == 'svg' && api_browser_support('svg') && api_get_setting('enabled_support_svg') == 'true') { |
| 5631 | - $modify_icons = '<a href="edit_draw.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5632 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5633 | - } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
| 5634 | - $modify_icons = '<a href="edit_odf.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5635 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5631 | + $modify_icons = '<a href="edit_draw.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5632 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5633 | + } elseif (in_array($extension, $web_odf_extension_list) && api_get_setting('enabled_support_odf') === true) { |
|
| 5634 | + $modify_icons = '<a href="edit_odf.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5635 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5636 | 5636 | } elseif ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'gif' || $extension == 'pxd' && api_get_setting('enabled_support_pixlr') == 'true') { |
| 5637 | - $modify_icons = '<a href="edit_paint.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5638 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5637 | + $modify_icons = '<a href="edit_paint.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5638 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5639 | 5639 | } else { |
| 5640 | - $modify_icons = '<a href="edit_document.php?' . api_get_cidreq() . '&id=' . $document_id . '">' . |
|
| 5641 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5640 | + $modify_icons = '<a href="edit_document.php?'.api_get_cidreq().'&id='.$document_id.'">'. |
|
| 5641 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5642 | 5642 | } |
| 5643 | 5643 | } |
| 5644 | 5644 | } |
| 5645 | 5645 | |
| 5646 | 5646 | // Move button. |
| 5647 | 5647 | if ($is_certificate_mode || in_array($path, DocumentManager::get_system_folders())) { |
| 5648 | - $modify_icons .= ' ' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5648 | + $modify_icons .= ' '.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5649 | 5649 | } else { |
| 5650 | 5650 | if (api_get_session_id()) { |
| 5651 | 5651 | if ($document_data['session_id'] == api_get_session_id()) { |
| 5652 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&id=' . $parent_id . '&move=' . $document_id . '">' . |
|
| 5653 | - Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5652 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'&move='.$document_id.'">'. |
|
| 5653 | + Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5654 | 5654 | } else { |
| 5655 | - $modify_icons .= ' ' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5655 | + $modify_icons .= ' '.Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5656 | 5656 | } |
| 5657 | 5657 | } else { |
| 5658 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&id=' . $parent_id . '&move=' . $document_id . '">' . |
|
| 5659 | - Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5658 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'&move='.$document_id.'">'. |
|
| 5659 | + Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5660 | 5660 | } |
| 5661 | 5661 | } |
| 5662 | 5662 | |
| 5663 | 5663 | //Visibility button |
| 5664 | 5664 | if ($is_certificate_mode) { |
| 5665 | - $modify_icons .= ' ' . Display::return_icon($visibility_icon . '.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5665 | + $modify_icons .= ' '.Display::return_icon($visibility_icon.'.png', get_lang('VisibilityCannotBeChanged'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5666 | 5666 | } else { |
| 5667 | 5667 | if (api_is_allowed_to_edit() || api_is_platform_admin()) { |
| 5668 | 5668 | if ($visibility_icon == 'invisible') { |
@@ -5670,14 +5670,14 @@ discard block |
||
| 5670 | 5670 | } else { |
| 5671 | 5671 | $tip_visibility = get_lang('Hide'); |
| 5672 | 5672 | } |
| 5673 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&id=' . $parent_id . '&' . $visibility_command . '=' . $id . '&' . $sort_params . '">' . |
|
| 5674 | - Display::return_icon($visibility_icon . '.png', $tip_visibility, '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5673 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$parent_id.'&'.$visibility_command.'='.$id.'&'.$sort_params.'">'. |
|
| 5674 | + Display::return_icon($visibility_icon.'.png', $tip_visibility, '', ICON_SIZE_SMALL).'</a>'; |
|
| 5675 | 5675 | } |
| 5676 | 5676 | } |
| 5677 | 5677 | |
| 5678 | 5678 | // Delete button |
| 5679 | 5679 | if (in_array($path, DocumentManager::get_system_folders())) { |
| 5680 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); |
|
| 5680 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); |
|
| 5681 | 5681 | } else { |
| 5682 | 5682 | $titleToShow = addslashes(basename($document_data['title'])); |
| 5683 | 5683 | |
@@ -5685,23 +5685,23 @@ discard block |
||
| 5685 | 5685 | $_GET['curdirpath'] == '/certificates' && |
| 5686 | 5686 | DocumentManager::get_default_certificate_id(api_get_course_id()) == $id |
| 5687 | 5687 | ) { |
| 5688 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&' . $sort_params . 'delete_certificate_id=' . $id . '" onclick="return confirmation(\'' . $titleToShow . '\');">' . |
|
| 5689 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5688 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&'.$sort_params.'delete_certificate_id='.$id.'" onclick="return confirmation(\''.$titleToShow.'\');">'. |
|
| 5689 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5690 | 5690 | } else { |
| 5691 | 5691 | if ($is_certificate_mode) { |
| 5692 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid=' . $document_id . '&' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">' . |
|
| 5693 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5692 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'. |
|
| 5693 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5694 | 5694 | } else { |
| 5695 | 5695 | if (api_get_session_id()) { |
| 5696 | 5696 | if ($document_data['session_id'] == api_get_session_id()) { |
| 5697 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow . '\');">'. |
|
| 5698 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5697 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'. |
|
| 5698 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5699 | 5699 | } else { |
| 5700 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); |
|
| 5700 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL); |
|
| 5701 | 5701 | } |
| 5702 | 5702 | } else { |
| 5703 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id . '&' . $sort_params . '" onclick="return confirmation(\'' . $titleToShow. '\');">' . |
|
| 5704 | - Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5703 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&'.$sort_params.'" onclick="return confirmation(\''.$titleToShow.'\');">'. |
|
| 5704 | + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5705 | 5705 | } |
| 5706 | 5706 | } |
| 5707 | 5707 | } |
@@ -5713,15 +5713,15 @@ discard block |
||
| 5713 | 5713 | // nothing to do |
| 5714 | 5714 | } else { |
| 5715 | 5715 | if ($usePpt2lp && $formatType) { |
| 5716 | - $modify_icons .= ' <a class="convertAction" href="#" ' . |
|
| 5717 | - 'data-documentId = ' . $document_id . |
|
| 5718 | - ' data-formatType = ' . $formatType . '>' . |
|
| 5716 | + $modify_icons .= ' <a class="convertAction" href="#" '. |
|
| 5717 | + 'data-documentId = '.$document_id. |
|
| 5718 | + ' data-formatType = '.$formatType.'>'. |
|
| 5719 | 5719 | Display::return_icon( |
| 5720 | 5720 | 'convert.png', |
| 5721 | 5721 | get_lang('Convert'), |
| 5722 | 5722 | array(), |
| 5723 | 5723 | ICON_SIZE_SMALL |
| 5724 | - ) . '</a>'; |
|
| 5724 | + ).'</a>'; |
|
| 5725 | 5725 | } |
| 5726 | 5726 | } |
| 5727 | 5727 | } |
@@ -5729,8 +5729,8 @@ discard block |
||
| 5729 | 5729 | if ($type == 'file' && ($extension == 'html' || $extension == 'htm')) { |
| 5730 | 5730 | if ($is_template == 0) { |
| 5731 | 5731 | if ((isset($_GET['curdirpath']) && $_GET['curdirpath'] != '/certificates') || !isset($_GET['curdirpath'])) { |
| 5732 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&add_as_template=' . $id . '&' . $sort_params . '">' . |
|
| 5733 | - Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5732 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&add_as_template='.$id.'&'.$sort_params.'">'. |
|
| 5733 | + Display::return_icon('wizard.png', get_lang('AddAsTemplate'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5734 | 5734 | } |
| 5735 | 5735 | if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course |
| 5736 | 5736 | $visibility_icon_certificate = 'nocertificate'; |
@@ -5744,20 +5744,20 @@ discard block |
||
| 5744 | 5744 | $certificate = get_lang('NoDefaultCertificate'); |
| 5745 | 5745 | } |
| 5746 | 5746 | if (isset($_GET['selectcat'])) { |
| 5747 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&selectcat=' . Security::remove_XSS($_GET['selectcat']) . '&set_certificate=' . $id . '&' . $sort_params . '"> |
|
| 5748 | - <img src="../img/' . $visibility_icon_certificate . '.png" border="0" title="' . $certificate . '" alt="" /></a>'; |
|
| 5747 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&selectcat='.Security::remove_XSS($_GET['selectcat']).'&set_certificate='.$id.'&'.$sort_params.'"> |
|
| 5748 | + <img src="../img/' . $visibility_icon_certificate.'.png" border="0" title="'.$certificate.'" alt="" /></a>'; |
|
| 5749 | 5749 | if ($is_preview) { |
| 5750 | - $modify_icons .= ' <a target="_blank" href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&set_preview=' . $id . '&' . $sort_params . '" >' . |
|
| 5751 | - Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5750 | + $modify_icons .= ' <a target="_blank" href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&set_preview='.$id.'&'.$sort_params.'" >'. |
|
| 5751 | + Display::return_icon('preview_view.png', $preview, '', ICON_SIZE_SMALL).'</a>'; |
|
| 5752 | 5752 | } |
| 5753 | 5753 | } |
| 5754 | 5754 | } |
| 5755 | 5755 | } else { |
| 5756 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&curdirpath=' . $curdirpath . '&remove_as_template=' . $id. '&' . $sort_params . '">' . |
|
| 5757 | - Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL) . '</a>'; |
|
| 5756 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.$curdirpath.'&remove_as_template='.$id.'&'.$sort_params.'">'. |
|
| 5757 | + Display::return_icon('wizard_na.png', get_lang('RemoveAsTemplate'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 5758 | 5758 | } |
| 5759 | - $modify_icons .= ' <a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=export_to_pdf&id=' . $id . '">' . |
|
| 5760 | - Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL) . '</a>'; |
|
| 5759 | + $modify_icons .= ' <a href="'.api_get_self().'?'.api_get_cidreq().'&action=export_to_pdf&id='.$id.'">'. |
|
| 5760 | + Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 5761 | 5761 | } |
| 5762 | 5762 | return $modify_icons; |
| 5763 | 5763 | } |
@@ -5826,7 +5826,7 @@ discard block |
||
| 5826 | 5826 | // 3. inside a subfolder of the folder you want to move |
| 5827 | 5827 | if (($curdirpath != $folder) && |
| 5828 | 5828 | ($folder != $move_file) && |
| 5829 | - (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/') |
|
| 5829 | + (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/') |
|
| 5830 | 5830 | ) { |
| 5831 | 5831 | $path_displayed = $folder; |
| 5832 | 5832 | // If document title is used, we have to display titles instead of real paths... |
@@ -5843,7 +5843,7 @@ discard block |
||
| 5843 | 5843 | foreach ($folders as $folder) { |
| 5844 | 5844 | if (($curdirpath != $folder) && |
| 5845 | 5845 | ($folder != $move_file) && |
| 5846 | - (substr($folder, 0, strlen($move_file) + 1) != $move_file . '/') |
|
| 5846 | + (substr($folder, 0, strlen($move_file) + 1) != $move_file.'/') |
|
| 5847 | 5847 | ) { |
| 5848 | 5848 | // Cannot copy dir into his own subdir |
| 5849 | 5849 | $path_displayed = DocumentManager::get_titles_of_path($folder); |
@@ -5885,10 +5885,10 @@ discard block |
||
| 5885 | 5885 | // If this path has soon been stored here we don't need a new query |
| 5886 | 5886 | $path_displayed .= $tmp_folders_titles[$tmp_path]; |
| 5887 | 5887 | } else { |
| 5888 | - $sql = 'SELECT title FROM ' . Database::get_course_table(TABLE_DOCUMENT) . ' |
|
| 5889 | - WHERE c_id = ' . $course_id . ' AND path LIKE BINARY "' . $tmp_path . '"'; |
|
| 5888 | + $sql = 'SELECT title FROM '.Database::get_course_table(TABLE_DOCUMENT).' |
|
| 5889 | + WHERE c_id = ' . $course_id.' AND path LIKE BINARY "'.$tmp_path.'"'; |
|
| 5890 | 5890 | $rs = Database::query($sql); |
| 5891 | - $tmp_title = '/' . Database::result($rs, 0, 0); |
|
| 5891 | + $tmp_title = '/'.Database::result($rs, 0, 0); |
|
| 5892 | 5892 | $path_displayed .= $tmp_title; |
| 5893 | 5893 | $tmp_folders_titles[$tmp_path] = $tmp_title; |
| 5894 | 5894 | } |
@@ -5924,7 +5924,7 @@ discard block |
||
| 5924 | 5924 | $clean_curdirpath = Security::remove_XSS($curdirpath); |
| 5925 | 5925 | if ($clean_curdirpath == '/shared_folder') { |
| 5926 | 5926 | return true; |
| 5927 | - } elseif ($clean_curdirpath == '/shared_folder_session_' . $current_session_id) { |
|
| 5927 | + } elseif ($clean_curdirpath == '/shared_folder_session_'.$current_session_id) { |
|
| 5928 | 5928 | return true; |
| 5929 | 5929 | } else { |
| 5930 | 5930 | return false; |
@@ -5940,7 +5940,7 @@ discard block |
||
| 5940 | 5940 | $clean_path = Security::remove_XSS($path); |
| 5941 | 5941 | if (strpos($clean_path, 'shared_folder/sf_user_')) { |
| 5942 | 5942 | return true; |
| 5943 | - } elseif (strpos($clean_path, 'shared_folder_session_' . $current_session_id . '/sf_user_')) { |
|
| 5943 | + } elseif (strpos($clean_path, 'shared_folder_session_'.$current_session_id.'/sf_user_')) { |
|
| 5944 | 5944 | return true; |
| 5945 | 5945 | } else { |
| 5946 | 5946 | return false; |
@@ -5953,11 +5953,11 @@ discard block |
||
| 5953 | 5953 | */ |
| 5954 | 5954 | public static function is_my_shared_folder($user_id, $path, $current_session_id) |
| 5955 | 5955 | { |
| 5956 | - $clean_path = Security::remove_XSS($path) . '/'; |
|
| 5956 | + $clean_path = Security::remove_XSS($path).'/'; |
|
| 5957 | 5957 | //for security does not remove the last slash |
| 5958 | - $main_user_shared_folder = '/shared_folder\/sf_user_' . $user_id . '\//'; |
|
| 5958 | + $main_user_shared_folder = '/shared_folder\/sf_user_'.$user_id.'\//'; |
|
| 5959 | 5959 | //for security does not remove the last slash |
| 5960 | - $main_user_shared_folder_session = '/shared_folder_session_' . $current_session_id . '\/sf_user_' . $user_id . '\//'; |
|
| 5960 | + $main_user_shared_folder_session = '/shared_folder_session_'.$current_session_id.'\/sf_user_'.$user_id.'\//'; |
|
| 5961 | 5961 | |
| 5962 | 5962 | if (preg_match($main_user_shared_folder, $clean_path)) { |
| 5963 | 5963 | return true; |
@@ -6230,7 +6230,7 @@ discard block |
||
| 6230 | 6230 | ON (i.c_id = d.c_id) |
| 6231 | 6231 | WHERE |
| 6232 | 6232 | d.id = i.ref AND |
| 6233 | - i.tool = '" . TOOL_DOCUMENT . "' |
|
| 6233 | + i.tool = '".TOOL_DOCUMENT."' |
|
| 6234 | 6234 | $conditionSession AND |
| 6235 | 6235 | i.c_id = $courseId AND |
| 6236 | 6236 | d.c_id = $courseId "; |
@@ -6238,9 +6238,9 @@ discard block |
||
| 6238 | 6238 | $result = Database::query($sql); |
| 6239 | 6239 | $documents = Database::store_result($result, 'ASSOC'); |
| 6240 | 6240 | if ($documents) { |
| 6241 | - $course_dir = $courseInfo['directory'] . '/document'; |
|
| 6241 | + $course_dir = $courseInfo['directory'].'/document'; |
|
| 6242 | 6242 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 6243 | - $base_work_dir = $sys_course_path . $course_dir; |
|
| 6243 | + $base_work_dir = $sys_course_path.$course_dir; |
|
| 6244 | 6244 | |
| 6245 | 6245 | foreach ($documents as $document) { |
| 6246 | 6246 | $documentId = $document['id']; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $renderer->setHeaderTemplate('<legend>{header}</legend>'); |
| 100 | 100 | |
| 101 | 101 | //Set required field template |
| 102 | - $this->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>'); |
|
| 102 | + $this->setRequiredNote('<span class="form_required">*</span> <small>'.get_lang('ThisFieldIsRequired').'</small>'); |
|
| 103 | 103 | $noteTemplate = <<<EOT |
| 104 | 104 | <div class="form-group"> |
| 105 | 105 | <div class="col-sm-offset-2 col-sm-10">{requiredNote}</div> |
@@ -851,9 +851,9 @@ discard block |
||
| 851 | 851 | $label = get_lang('PleaseStandBy'); |
| 852 | 852 | } |
| 853 | 853 | $this->with_progress_bar = true; |
| 854 | - $this->updateAttributes("onsubmit=\"javascript: myUpload.start('dynamic_div','".Display::returnIconPath('progress_bar.gif')."','" . $label . "','" . $this->getAttribute('id') . "')\""); |
|
| 855 | - $this->addElement('html', '<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>'); |
|
| 856 | - $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . (abs(intval($delay)) * 1000) . ');</script>'); |
|
| 854 | + $this->updateAttributes("onsubmit=\"javascript: myUpload.start('dynamic_div','".Display::returnIconPath('progress_bar.gif')."','".$label."','".$this->getAttribute('id')."')\""); |
|
| 855 | + $this->addElement('html', '<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>'); |
|
| 856 | + $this->addElement('html', '<script type="text/javascript">var myUpload = new upload('.(abs(intval($delay)) * 1000).');</script>'); |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | /** |
@@ -870,11 +870,11 @@ discard block |
||
| 870 | 870 | return; |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | - $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH) . 'upload.xajax.php'); |
|
| 873 | + $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH).'upload.xajax.php'); |
|
| 874 | 874 | |
| 875 | 875 | $xajax_upload->registerFunction('updateProgress'); |
| 876 | 876 | // IMPORTANT : must be the first element of the form |
| 877 | - $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="' . $upload_id . '" />'), $element_after); |
|
| 877 | + $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="'.$upload_id.'" />'), $element_after); |
|
| 878 | 878 | |
| 879 | 879 | $this->addElement('html', '<br />'); |
| 880 | 880 | |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | $this->addElement( |
| 883 | 883 | 'html', |
| 884 | 884 | '<div id="dynamic_div_container" style="display:none"> |
| 885 | - <div id="dynamic_div_label">' . get_lang('UploadFile') . '</div> |
|
| 885 | + <div id="dynamic_div_label">' . get_lang('UploadFile').'</div> |
|
| 886 | 886 | <div id="dynamic_div_frame" style="width:214px; height:12px; border:1px solid grey; background-image:url(' . Display::returnIconPath('real_upload_frame.gif').');"> |
| 887 | 887 | <div id="dynamic_div_filled" style="width:0%;height:100%;background-image:url(' . Display::returnIconPath('real_upload_step.gif').');background-repeat:repeat-x;background-position:center;"></div> |
| 888 | 888 | </div> |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | $this->addElement('html', ' |
| 894 | 894 | <div id="dynamic_div_waiter_container" style="display:none"> |
| 895 | 895 | <div id="dynamic_div_waiter_label"> |
| 896 | - ' . get_lang('SlideshowConversion') . ' |
|
| 896 | + ' . get_lang('SlideshowConversion').' |
|
| 897 | 897 | </div> |
| 898 | 898 | <div id="dynamic_div_waiter_frame"> |
| 899 | 899 | '.Display::return_icon('real_upload_frame.gif').' |
@@ -903,18 +903,18 @@ discard block |
||
| 903 | 903 | } |
| 904 | 904 | |
| 905 | 905 | // Get the xajax code |
| 906 | - $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH) . 'xajax')); |
|
| 906 | + $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH).'xajax')); |
|
| 907 | 907 | |
| 908 | 908 | // Get the upload code |
| 909 | - $this->addElement('html', '<script language="javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/upload.js" type="text/javascript"></script>'); |
|
| 910 | - $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . (abs(intval($delay)) * 1000) . ');</script>'); |
|
| 909 | + $this->addElement('html', '<script language="javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/upload.js" type="text/javascript"></script>'); |
|
| 910 | + $this->addElement('html', '<script type="text/javascript">var myUpload = new upload('.(abs(intval($delay)) * 1000).');</script>'); |
|
| 911 | 911 | |
| 912 | 912 | if (!$wait_after_upload) { |
| 913 | 913 | $wait_after_upload = 0; |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | // Add the upload event |
| 917 | - $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','" . $upload_id . "','" . $this->getAttribute('id') . "'," . $wait_after_upload . ")\""); |
|
| 917 | + $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','".$upload_id."','".$this->getAttribute('id')."',".$wait_after_upload.")\""); |
|
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param string Optional help file name |
| 56 | 56 | * @param string $page_header |
| 57 | 57 | */ |
| 58 | - public static function display_header($tool_name ='', $help = null, $page_header = null) |
|
| 58 | + public static function display_header($tool_name = '', $help = null, $page_header = null) |
|
| 59 | 59 | { |
| 60 | 60 | $origin = api_get_origin(); |
| 61 | 61 | $showHeader = true; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | $grid_class = array(), |
| 352 | 352 | $elementCount = 0 |
| 353 | 353 | ) { |
| 354 | - $column = 0; |
|
| 354 | + $column = 0; |
|
| 355 | 355 | $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20; |
| 356 | 356 | |
| 357 | 357 | $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name); |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | * @param bool Filter (true) or not (false) |
| 477 | 477 | * @return void |
| 478 | 478 | */ |
| 479 | - public static function display_confirmation_message ($message, $filter = true, $returnValue = false) |
|
| 479 | + public static function display_confirmation_message($message, $filter = true, $returnValue = false) |
|
| 480 | 480 | { |
| 481 | 481 | $message = self::return_message($message, 'confirm', $filter); |
| 482 | 482 | if ($returnValue) { |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @param bool Filter (true) or not (false) |
| 494 | 494 | * @return void |
| 495 | 495 | */ |
| 496 | - public static function display_error_message ($message, $filter = true, $returnValue = false) |
|
| 496 | + public static function display_error_message($message, $filter = true, $returnValue = false) |
|
| 497 | 497 | { |
| 498 | 498 | $message = self::return_message($message, 'error', $filter); |
| 499 | 499 | if ($returnValue) { |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | * @param string $type |
| 509 | 509 | * @param bool $filter |
| 510 | 510 | */ |
| 511 | - public static function return_message_and_translate($message, $type='normal', $filter = true) |
|
| 511 | + public static function return_message_and_translate($message, $type = 'normal', $filter = true) |
|
| 512 | 512 | { |
| 513 | 513 | $message = get_lang($message); |
| 514 | 514 | echo self::return_message($message, $type, $filter); |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | $class = ""; |
| 535 | - switch($type) { |
|
| 535 | + switch ($type) { |
|
| 536 | 536 | case 'warning': |
| 537 | 537 | $class .= 'alert alert-warning'; |
| 538 | 538 | break; |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | * @param string optional, class from stylesheet |
| 561 | 561 | * @return string encrypted mailto hyperlink |
| 562 | 562 | */ |
| 563 | - public static function encrypted_mailto_link ($email, $clickable_text = null, $style_class = '') |
|
| 563 | + public static function encrypted_mailto_link($email, $clickable_text = null, $style_class = '') |
|
| 564 | 564 | { |
| 565 | 565 | if (is_null($clickable_text)) { |
| 566 | 566 | $clickable_text = $email; |
@@ -575,14 +575,14 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | // Encrypt email |
| 577 | 577 | $hmail = ''; |
| 578 | - for ($i = 0; $i < strlen($email); $i ++) { |
|
| 578 | + for ($i = 0; $i < strlen($email); $i++) { |
|
| 579 | 579 | $hmail .= '&#'.ord($email { |
| 580 | 580 | $i }).';'; |
| 581 | 581 | } |
| 582 | 582 | $hclickable_text = null; |
| 583 | 583 | // Encrypt clickable text if @ is present |
| 584 | 584 | if (strpos($clickable_text, '@')) { |
| 585 | - for ($i = 0; $i < strlen($clickable_text); $i ++) { |
|
| 585 | + for ($i = 0; $i < strlen($clickable_text); $i++) { |
|
| 586 | 586 | $hclickable_text .= '&#'.ord($clickable_text { |
| 587 | 587 | $i }).';'; |
| 588 | 588 | } |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | } |
| 615 | 615 | // Encrypt email |
| 616 | 616 | $hmail = ''; |
| 617 | - for ($i = 0; $i < strlen($email); $i ++) { |
|
| 617 | + for ($i = 0; $i < strlen($email); $i++) { |
|
| 618 | 618 | $hmail .= '&#'.ord($email { |
| 619 | 619 | $i }).';'; |
| 620 | 620 | } |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | public static function get_alphabet_options($selected_letter = '') |
| 648 | 648 | { |
| 649 | 649 | $result = ''; |
| 650 | - for ($i = 65; $i <= 90; $i ++) { |
|
| 650 | + for ($i = 65; $i <= 90; $i++) { |
|
| 651 | 651 | $letter = chr($i); |
| 652 | 652 | $result .= '<option value="'.$letter.'"'; |
| 653 | 653 | if ($selected_letter == $letter) { |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | public static function get_numeric_options($min, $max, $selected_num = 0) |
| 669 | 669 | { |
| 670 | 670 | $result = ''; |
| 671 | - for ($i = $min; $i <= $max; $i ++) { |
|
| 671 | + for ($i = $min; $i <= $max; $i++) { |
|
| 672 | 672 | $result .= '<option value="'.$i.'"'; |
| 673 | 673 | if (is_int($selected_num)) |
| 674 | 674 | if ($selected_num == $i) { |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | |
| 741 | 741 | if (isset($size)) { |
| 742 | 742 | $size = intval($size); |
| 743 | - $size_extra = $size . '/'; |
|
| 743 | + $size_extra = $size.'/'; |
|
| 744 | 744 | } else { |
| 745 | 745 | $size = ICON_SIZE_SMALL; |
| 746 | 746 | } |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $theme = 'themes/chamilo/icons/'; |
| 752 | 752 | |
| 753 | 753 | if ($loadThemeIcon) { |
| 754 | - $theme = 'themes/' . api_get_visual_theme() . '/icons/'; |
|
| 754 | + $theme = 'themes/'.api_get_visual_theme().'/icons/'; |
|
| 755 | 755 | // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX |
| 756 | 756 | if (is_file($alternateCssPath.$theme.$size_extra.$image)) { |
| 757 | 757 | $icon = $alternateWebCssPath.$theme.$size_extra.$image; |
@@ -768,11 +768,11 @@ discard block |
||
| 768 | 768 | // ask for the SVG version directly |
| 769 | 769 | $testServer = api_get_setting('server_type'); |
| 770 | 770 | if ($testServer == 'test' && $return_only_path == false) { |
| 771 | - $svgImage = substr($image, 0, -3) . 'svg'; |
|
| 772 | - if (is_file($code_path . $theme . 'svg/' . $svgImage)) { |
|
| 773 | - $icon = $w_code_path . $theme . 'svg/' . $svgImage; |
|
| 774 | - } elseif (is_file($code_path . 'img/icons/svg/' . $svgImage)) { |
|
| 775 | - $icon = $w_code_path . 'img/icons/svg/' . $svgImage; |
|
| 771 | + $svgImage = substr($image, 0, -3).'svg'; |
|
| 772 | + if (is_file($code_path.$theme.'svg/'.$svgImage)) { |
|
| 773 | + $icon = $w_code_path.$theme.'svg/'.$svgImage; |
|
| 774 | + } elseif (is_file($code_path.'img/icons/svg/'.$svgImage)) { |
|
| 775 | + $icon = $w_code_path.'img/icons/svg/'.$svgImage; |
|
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | if (empty($additional_attributes['height'])) { |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | //some tags don't have this </XXX> |
| 855 | - if (in_array($tag, array('img','input','br'))) { |
|
| 855 | + if (in_array($tag, array('img', 'input', 'br'))) { |
|
| 856 | 856 | $return_value = '<'.$tag.' '.$attribute_list.' />'; |
| 857 | 857 | } else { |
| 858 | 858 | $return_value = '<'.$tag.' '.$attribute_list.' > '.$content.'</'.$tag.'>'; |
@@ -905,13 +905,13 @@ discard block |
||
| 905 | 905 | public static function input($type, $name, $value, $attributes = array()) |
| 906 | 906 | { |
| 907 | 907 | if (isset($type)) { |
| 908 | - $attributes['type']= $type; |
|
| 908 | + $attributes['type'] = $type; |
|
| 909 | 909 | } |
| 910 | 910 | if (isset($name)) { |
| 911 | - $attributes['name']= $name; |
|
| 911 | + $attributes['name'] = $name; |
|
| 912 | 912 | } |
| 913 | 913 | if (isset($value)) { |
| 914 | - $attributes['value']= $value; |
|
| 914 | + $attributes['value'] = $value; |
|
| 915 | 915 | } |
| 916 | 916 | return self::tag('input', '', $attributes); |
| 917 | 917 | } |
@@ -944,14 +944,14 @@ discard block |
||
| 944 | 944 | ) { |
| 945 | 945 | $html = ''; |
| 946 | 946 | $extra = ''; |
| 947 | - $default_id = 'id="' . $name . '" '; |
|
| 947 | + $default_id = 'id="'.$name.'" '; |
|
| 948 | 948 | foreach ($extra_attributes as $key => $parameter) { |
| 949 | 949 | if ($key == 'id') { |
| 950 | 950 | $default_id = ''; |
| 951 | 951 | } |
| 952 | - $extra .= $key . '="' . $parameter . '" '; |
|
| 952 | + $extra .= $key.'="'.$parameter.'" '; |
|
| 953 | 953 | } |
| 954 | - $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>'; |
|
| 954 | + $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>'; |
|
| 955 | 955 | |
| 956 | 956 | if ($show_blank_item) { |
| 957 | 957 | if (empty($blank_item_text)) { |
@@ -959,14 +959,14 @@ discard block |
||
| 959 | 959 | } else { |
| 960 | 960 | $blank_item_text = Security::remove_XSS($blank_item_text); |
| 961 | 961 | } |
| 962 | - $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1')); |
|
| 962 | + $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1')); |
|
| 963 | 963 | } |
| 964 | 964 | if ($values) { |
| 965 | 965 | foreach ($values as $key => $value) { |
| 966 | 966 | if (is_array($value) && isset($value['name'])) { |
| 967 | 967 | $value = $value['name']; |
| 968 | 968 | } |
| 969 | - $html .= '<option value="' . $key . '"'; |
|
| 969 | + $html .= '<option value="'.$key.'"'; |
|
| 970 | 970 | |
| 971 | 971 | if (is_array($default)) { |
| 972 | 972 | foreach ($default as $item) { |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | } |
| 982 | 982 | } |
| 983 | 983 | |
| 984 | - $html .= '>' . $value . '</option>'; |
|
| 984 | + $html .= '>'.$value.'</option>'; |
|
| 985 | 985 | } |
| 986 | 986 | } |
| 987 | 987 | $html .= '</select>'; |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | */ |
| 1008 | 1008 | public static function tabs($header_list, $content_list, $id = 'tabs', $attributes = array(), $ul_attributes = array()) |
| 1009 | 1009 | { |
| 1010 | - if (empty($header_list) || count($header_list) == 0 ) { |
|
| 1010 | + if (empty($header_list) || count($header_list) == 0) { |
|
| 1011 | 1011 | return ''; |
| 1012 | 1012 | } |
| 1013 | 1013 | |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes); |
| 1046 | 1046 | |
| 1047 | - return $main_div ; |
|
| 1047 | + return $main_div; |
|
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | /** |
@@ -1092,8 +1092,8 @@ discard block |
||
| 1092 | 1092 | */ |
| 1093 | 1093 | public static function grid_html($div_id) |
| 1094 | 1094 | { |
| 1095 | - $table = self::tag('table','', array('id' => $div_id)); |
|
| 1096 | - $table .= self::tag('div','', array('id' => $div_id.'_pager')); |
|
| 1095 | + $table = self::tag('table', '', array('id' => $div_id)); |
|
| 1096 | + $table .= self::tag('div', '', array('id' => $div_id.'_pager')); |
|
| 1097 | 1097 | return $table; |
| 1098 | 1098 | } |
| 1099 | 1099 | |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | $obj->colNames = $column_names; |
| 1155 | 1155 | $obj->colModel = $column_model; |
| 1156 | 1156 | $obj->pager = '#'.$div_id.'_pager'; |
| 1157 | - $obj->datatype = 'json'; |
|
| 1157 | + $obj->datatype = 'json'; |
|
| 1158 | 1158 | $obj->viewrecords = 'true'; |
| 1159 | 1159 | |
| 1160 | 1160 | $all_value = 10000000; |
@@ -1215,10 +1215,10 @@ discard block |
||
| 1215 | 1215 | // Adding static data. |
| 1216 | 1216 | if (!empty($data)) { |
| 1217 | 1217 | $data_var = $div_id.'_data'; |
| 1218 | - $json.=' var '.$data_var.' = '.json_encode($data).';'; |
|
| 1218 | + $json .= ' var '.$data_var.' = '.json_encode($data).';'; |
|
| 1219 | 1219 | $obj->data = $data_var; |
| 1220 | 1220 | $obj->datatype = 'local'; |
| 1221 | - $json.="\n"; |
|
| 1221 | + $json .= "\n"; |
|
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | 1224 | $obj->end = 'end'; |
@@ -1232,12 +1232,12 @@ discard block |
||
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | // Fixing true/false js values that doesn't need the "" |
| 1235 | - $json_encode = str_replace(':"true"',':true',$json_encode); |
|
| 1235 | + $json_encode = str_replace(':"true"', ':true', $json_encode); |
|
| 1236 | 1236 | // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text |
| 1237 | 1237 | $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode); |
| 1238 | - $json_encode = str_replace(':"false"',':false',$json_encode); |
|
| 1238 | + $json_encode = str_replace(':"false"', ':false', $json_encode); |
|
| 1239 | 1239 | $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode); |
| 1240 | - $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode); |
|
| 1240 | + $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode); |
|
| 1241 | 1241 | |
| 1242 | 1242 | // Creating the jqgrid element. |
| 1243 | 1243 | $json .= '$("#'.$div_id.'").jqGrid({'; |
@@ -1252,22 +1252,22 @@ discard block |
||
| 1252 | 1252 | $groups = ''; |
| 1253 | 1253 | foreach ($extra_params['groupHeaders'] as $group) { |
| 1254 | 1254 | //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" }, |
| 1255 | - $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText'] . '" },'; |
|
| 1255 | + $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },'; |
|
| 1256 | 1256 | |
| 1257 | 1257 | } |
| 1258 | 1258 | $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", { |
| 1259 | 1259 | "useColSpanStyle" : false, |
| 1260 | 1260 | "groupHeaders" : [ |
| 1261 | - ' . $groups . ' |
|
| 1261 | + ' . $groups.' |
|
| 1262 | 1262 | ] |
| 1263 | 1263 | });'; |
| 1264 | 1264 | } |
| 1265 | 1265 | |
| 1266 | 1266 | $all_text = addslashes(get_lang('All')); |
| 1267 | 1267 | $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");'; |
| 1268 | - $json.= "\n"; |
|
| 1268 | + $json .= "\n"; |
|
| 1269 | 1269 | // Adding edit/delete icons. |
| 1270 | - $json.= $formatter; |
|
| 1270 | + $json .= $formatter; |
|
| 1271 | 1271 | |
| 1272 | 1272 | return $json; |
| 1273 | 1273 | } |
@@ -1298,7 +1298,7 @@ discard block |
||
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | if (!empty($rows)) { |
| 1301 | - foreach($rows as $content) { |
|
| 1301 | + foreach ($rows as $content) { |
|
| 1302 | 1302 | $table->setCellContents($row, $column, $content); |
| 1303 | 1303 | $row++; |
| 1304 | 1304 | } |
@@ -1460,7 +1460,7 @@ discard block |
||
| 1460 | 1460 | |
| 1461 | 1461 | // Show all tool icons where there is something new. |
| 1462 | 1462 | $return = ' '; |
| 1463 | - foreach($notifications as $notification) { |
|
| 1463 | + foreach ($notifications as $notification) { |
|
| 1464 | 1464 | $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date'])); |
| 1465 | 1465 | $type = $notification['lastedit_type']; |
| 1466 | 1466 | $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)"; |
@@ -1503,9 +1503,9 @@ discard block |
||
| 1503 | 1503 | $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
| 1504 | 1504 | $active = false; |
| 1505 | 1505 | // Request for the name of the general coach |
| 1506 | - $sql ='SELECT tu.lastname, tu.firstname, ts.* |
|
| 1506 | + $sql = 'SELECT tu.lastname, tu.firstname, ts.* |
|
| 1507 | 1507 | FROM '.$tbl_session.' ts |
| 1508 | - LEFT JOIN '.$main_user_table .' tu |
|
| 1508 | + LEFT JOIN '.$main_user_table.' tu |
|
| 1509 | 1509 | ON ts.id_coach = tu.user_id |
| 1510 | 1510 | WHERE ts.id = '.intval($session_id); |
| 1511 | 1511 | $rs = Database::query($sql); |
@@ -1515,7 +1515,7 @@ discard block |
||
| 1515 | 1515 | $session = array(); |
| 1516 | 1516 | $session['title'] = $session_info['name']; |
| 1517 | 1517 | $session['coach'] = ''; |
| 1518 | - $session['dates'] = ''; |
|
| 1518 | + $session['dates'] = ''; |
|
| 1519 | 1519 | |
| 1520 | 1520 | if ( |
| 1521 | 1521 | ( |
@@ -1597,8 +1597,8 @@ discard block |
||
| 1597 | 1597 | ); |
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | - if ( api_get_setting('show_session_coach') === 'true' ) { |
|
| 1601 | - $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name( |
|
| 1600 | + if (api_get_setting('show_session_coach') === 'true') { |
|
| 1601 | + $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name( |
|
| 1602 | 1602 | $session_info['firstname'], |
| 1603 | 1603 | $session_info['lastname'] |
| 1604 | 1604 | ); |
@@ -1650,9 +1650,9 @@ discard block |
||
| 1650 | 1650 | $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; |
| 1651 | 1651 | |
| 1652 | 1652 | if (!empty($percentage)) { |
| 1653 | - $percentage = $percentage*125/100; |
|
| 1653 | + $percentage = $percentage * 125 / 100; |
|
| 1654 | 1654 | } |
| 1655 | - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
| 1655 | + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; |
|
| 1656 | 1656 | |
| 1657 | 1657 | $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); |
| 1658 | 1658 | |
@@ -1667,19 +1667,19 @@ discard block |
||
| 1667 | 1667 | |
| 1668 | 1668 | $labels = array(); |
| 1669 | 1669 | |
| 1670 | - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
| 1671 | - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
| 1670 | + $labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); |
|
| 1671 | + $labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); |
|
| 1672 | 1672 | if (!empty($number_of_users_who_voted)) { |
| 1673 | - $labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
| 1673 | + $labels[] = get_lang('Average').' '.$point_info['point_average_star'].'/5'; |
|
| 1674 | 1674 | } |
| 1675 | 1675 | |
| 1676 | - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; |
|
| 1676 | + $labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] '; |
|
| 1677 | 1677 | |
| 1678 | 1678 | if (!$add_div_wrapper && api_is_anonymous()) { |
| 1679 | - $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
| 1679 | + $labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error')); |
|
| 1680 | 1680 | } |
| 1681 | 1681 | |
| 1682 | - $html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
|
| 1682 | + $html .= Display::div(implode(' | ', $labels), array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); |
|
| 1683 | 1683 | $html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id)); |
| 1684 | 1684 | |
| 1685 | 1685 | if ($add_div_wrapper) { |
@@ -1757,8 +1757,8 @@ discard block |
||
| 1757 | 1757 | if (!empty($list)) { |
| 1758 | 1758 | $html = '<dl class="dl-horizontal">'; |
| 1759 | 1759 | foreach ($list as $item) { |
| 1760 | - $html .= '<dt>' . $item['title'] . '</dt>'; |
|
| 1761 | - $html .= '<dd>' . $item['content'] . '</dd>'; |
|
| 1760 | + $html .= '<dt>'.$item['title'].'</dt>'; |
|
| 1761 | + $html .= '<dd>'.$item['content'].'</dd>'; |
|
| 1762 | 1762 | } |
| 1763 | 1763 | $html .= '</dl>'; |
| 1764 | 1764 | } |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | * @param string $type |
| 1801 | 1801 | * @return null|string |
| 1802 | 1802 | */ |
| 1803 | - public static function badge($count, $type ="warning") |
|
| 1803 | + public static function badge($count, $type = "warning") |
|
| 1804 | 1804 | { |
| 1805 | 1805 | $class = ''; |
| 1806 | 1806 | |
@@ -1876,7 +1876,7 @@ discard block |
||
| 1876 | 1876 | if (!empty($content)) { |
| 1877 | 1877 | $html = '<span class="label '.$class.'">'; |
| 1878 | 1878 | $html .= $content; |
| 1879 | - $html .='</span>'; |
|
| 1879 | + $html .= '</span>'; |
|
| 1880 | 1880 | } |
| 1881 | 1881 | |
| 1882 | 1882 | return $html; |
@@ -1897,7 +1897,7 @@ discard block |
||
| 1897 | 1897 | $class = 'class ="active"'; |
| 1898 | 1898 | } |
| 1899 | 1899 | |
| 1900 | - if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) { |
|
| 1900 | + if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) { |
|
| 1901 | 1901 | $class = 'class ="active"'; |
| 1902 | 1902 | } |
| 1903 | 1903 | $html .= "<li $class >"; |
@@ -2113,7 +2113,7 @@ discard block |
||
| 2113 | 2113 | */ |
| 2114 | 2114 | public static function getVCardUserLink($userId) |
| 2115 | 2115 | { |
| 2116 | - $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);; |
|
| 2116 | + $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId); ; |
|
| 2117 | 2117 | |
| 2118 | 2118 | return $vCardUrl; |
| 2119 | 2119 | } |
@@ -2131,7 +2131,7 @@ discard block |
||
| 2131 | 2131 | { |
| 2132 | 2132 | $title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3>'.$extra.'</div>' : ''; |
| 2133 | 2133 | $footer = !empty($footer) ? '<div class="panel-footer ">'.$footer.'</div>' : ''; |
| 2134 | - $styles = ['primary','success','info','warning','danger']; |
|
| 2134 | + $styles = ['primary', 'success', 'info', 'warning', 'danger']; |
|
| 2135 | 2135 | $style = !in_array($style, $styles) ? 'default' : $style; |
| 2136 | 2136 | |
| 2137 | 2137 | return ' |
@@ -2176,7 +2176,7 @@ discard block |
||
| 2176 | 2176 | $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass; |
| 2177 | 2177 | |
| 2178 | 2178 | if (!$includeText) { |
| 2179 | - $text = '<span class="sr-only">' . $text . '</span>'; |
|
| 2179 | + $text = '<span class="sr-only">'.$text.'</span>'; |
|
| 2180 | 2180 | } |
| 2181 | 2181 | |
| 2182 | 2182 | return self::url("$icon $text", $url, $attributes); |
@@ -2191,16 +2191,16 @@ discard block |
||
| 2191 | 2191 | */ |
| 2192 | 2192 | public static function toolbarAction($id, $content = array(), $col = 2, $right = true) |
| 2193 | 2193 | { |
| 2194 | - $columns = 12/$col; |
|
| 2194 | + $columns = 12 / $col; |
|
| 2195 | 2195 | $html = ''; |
| 2196 | - $html .= '<div id="' . $id . '" class="actions">'; |
|
| 2196 | + $html .= '<div id="'.$id.'" class="actions">'; |
|
| 2197 | 2197 | $html .= '<div class="row">'; |
| 2198 | 2198 | if ($col > 4) { |
| 2199 | 2199 | $html = '<div class="alert alert-warning" role="alert">Action toolbar design does not work when exceeding four columns - check Display::toolbarAction()</div>'; |
| 2200 | 2200 | } else { |
| 2201 | - for ( $i = 0; $i < $col; $i++ ) { |
|
| 2202 | - $html .= '<div class="col-md-' . $columns . '">'; |
|
| 2203 | - if ( $col == 2 && $i == 1 ) { |
|
| 2201 | + for ($i = 0; $i < $col; $i++) { |
|
| 2202 | + $html .= '<div class="col-md-'.$columns.'">'; |
|
| 2203 | + if ($col == 2 && $i == 1) { |
|
| 2204 | 2204 | if ($right === true) { |
| 2205 | 2205 | $html .= '<div class="pull-right">'; |
| 2206 | 2206 | $html .= (isset($content[$i]) ? $content[$i] : ''); |
@@ -2315,9 +2315,9 @@ discard block |
||
| 2315 | 2315 | $params['class'] = 'panel panel-default'; |
| 2316 | 2316 | $html = null; |
| 2317 | 2317 | if (!empty($title)) { |
| 2318 | - $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL; |
|
| 2318 | + $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL; |
|
| 2319 | 2319 | } |
| 2320 | - $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL; |
|
| 2320 | + $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL; |
|
| 2321 | 2321 | $html = Display::div($html, $params); |
| 2322 | 2322 | } |
| 2323 | 2323 | return $html; |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For licensing terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * @author Patrick Cool [email protected] Ghent University Mai 2004 |
|
| 5 | - * @author Julio Montoya Lots of improvements, cleaning, adding security |
|
| 6 | - * @author Juan Carlos Raña Trabado [email protected] January 2008 |
|
| 7 | - * @package chamilo.document |
|
| 8 | - */ |
|
| 4 | + * @author Patrick Cool [email protected] Ghent University Mai 2004 |
|
| 5 | + * @author Julio Montoya Lots of improvements, cleaning, adding security |
|
| 6 | + * @author Juan Carlos Raña Trabado [email protected] January 2008 |
|
| 7 | + * @package chamilo.document |
|
| 8 | + */ |
|
| 9 | 9 | require_once '../inc/global.inc.php'; |
| 10 | 10 | api_protect_course_script(); |
| 11 | 11 | |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | $slide_id = isset($_GET['slide_id']) ? Security::remove_XSS($_GET['slide_id']) : null; |
| 16 | 16 | |
| 17 | 17 | if (empty($slide_id)) { |
| 18 | - $edit_slide_id = 1; |
|
| 18 | + $edit_slide_id = 1; |
|
| 19 | 19 | } else { |
| 20 | - $edit_slide_id = $slide_id; |
|
| 20 | + $edit_slide_id = $slide_id; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if ($path != '/') { |
| 24 | - $folder = $path.'/'; |
|
| 24 | + $folder = $path.'/'; |
|
| 25 | 25 | } else { |
| 26 | - $folder = '/'; |
|
| 26 | + $folder = '/'; |
|
| 27 | 27 | } |
| 28 | 28 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
| 29 | 29 | |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Loading the slides from the session |
| 43 | 43 | if (isset($_SESSION['image_files_only'])) { |
| 44 | - $image_files_only = $_SESSION['image_files_only']; |
|
| 44 | + $image_files_only = $_SESSION['image_files_only']; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | // Calculating the current slide, next slide, previous slide and the number of slides |
| 48 | 48 | $slide = null; |
| 49 | 49 | if ($slide_id != 'all') { |
| 50 | - $slide = $slide_id ? $slide_id : 0; |
|
| 51 | - $previous_slide = $slide - 1; |
|
| 52 | - $next_slide = $slide + 1; |
|
| 50 | + $slide = $slide_id ? $slide_id : 0; |
|
| 51 | + $previous_slide = $slide - 1; |
|
| 52 | + $next_slide = $slide + 1; |
|
| 53 | 53 | } |
| 54 | 54 | $total_slides = count($image_files_only); |
| 55 | 55 | ?> |
@@ -62,62 +62,62 @@ discard block |
||
| 62 | 62 | <?php |
| 63 | 63 | |
| 64 | 64 | if ($slide_id != 'all') { |
| 65 | - $image = null; |
|
| 66 | - if (isset($image_files_only[$slide])) { |
|
| 67 | - $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
| 68 | - } |
|
| 69 | - if (file_exists($image)) { |
|
| 70 | - echo '<div class="actions-pagination">'; |
|
| 71 | - |
|
| 72 | - // Back forward buttons |
|
| 73 | - if ($slide == 0) { |
|
| 74 | - $imgp = 'action_prev_na.png'; |
|
| 75 | - $first = Display::return_icon('action_first_na.png'); |
|
| 76 | - } else { |
|
| 77 | - $imgp = 'action_prev.png'; |
|
| 78 | - $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'"> |
|
| 65 | + $image = null; |
|
| 66 | + if (isset($image_files_only[$slide])) { |
|
| 67 | + $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
| 68 | + } |
|
| 69 | + if (file_exists($image)) { |
|
| 70 | + echo '<div class="actions-pagination">'; |
|
| 71 | + |
|
| 72 | + // Back forward buttons |
|
| 73 | + if ($slide == 0) { |
|
| 74 | + $imgp = 'action_prev_na.png'; |
|
| 75 | + $first = Display::return_icon('action_first_na.png'); |
|
| 76 | + } else { |
|
| 77 | + $imgp = 'action_prev.png'; |
|
| 78 | + $first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'"> |
|
| 79 | 79 | '.Display::return_icon('action_first.png', get_lang('FirstSlide')).' |
| 80 | 80 | </a>'; |
| 81 | - } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - // First slide |
|
| 84 | - echo $first; |
|
| 83 | + // First slide |
|
| 84 | + echo $first; |
|
| 85 | 85 | |
| 86 | - // Previous slide |
|
| 87 | - if ($slide > 0) { |
|
| 88 | - echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">'; |
|
| 89 | - } |
|
| 86 | + // Previous slide |
|
| 87 | + if ($slide > 0) { |
|
| 88 | + echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">'; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | echo Display::return_icon($imgp, get_lang('Previous')); |
| 92 | - if ($slide > 0) { |
|
| 93 | - echo '</a>'; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - // Divider |
|
| 97 | - echo ' [ '.$next_slide.'/'.$total_slides.' ] '; |
|
| 98 | - |
|
| 99 | - // Next slide |
|
| 100 | - if ($slide < $total_slides - 1) { |
|
| 101 | - echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">'; |
|
| 102 | - } |
|
| 103 | - if ($slide == $total_slides - 1) { |
|
| 104 | - $imgn = 'action_next_na.png'; |
|
| 92 | + if ($slide > 0) { |
|
| 93 | + echo '</a>'; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + // Divider |
|
| 97 | + echo ' [ '.$next_slide.'/'.$total_slides.' ] '; |
|
| 98 | + |
|
| 99 | + // Next slide |
|
| 100 | + if ($slide < $total_slides - 1) { |
|
| 101 | + echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">'; |
|
| 102 | + } |
|
| 103 | + if ($slide == $total_slides - 1) { |
|
| 104 | + $imgn = 'action_next_na.png'; |
|
| 105 | 105 | $last = Display::return_icon('action_last_na.png', get_lang('LastSlide')); |
| 106 | - } else { |
|
| 107 | - $imgn = 'action_next.png'; |
|
| 108 | - $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"> |
|
| 106 | + } else { |
|
| 107 | + $imgn = 'action_next.png'; |
|
| 108 | + $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"> |
|
| 109 | 109 | '.Display::return_icon('action_last.png', get_lang('LastSlide')).' |
| 110 | 110 | </a>'; |
| 111 | - } |
|
| 111 | + } |
|
| 112 | 112 | echo Display::return_icon($imgn, get_lang('Next')); |
| 113 | - if ($slide > 0) { |
|
| 114 | - echo '</a>'; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - // Last slide |
|
| 118 | - echo $last; |
|
| 119 | - echo '</div>'; |
|
| 120 | - } |
|
| 113 | + if ($slide > 0) { |
|
| 114 | + echo '</a>'; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + // Last slide |
|
| 118 | + echo $last; |
|
| 119 | + echo '</div>'; |
|
| 120 | + } |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // Exit the slideshow |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // Show thumbnails |
| 128 | 128 | if ($slide_id != 'all') { |
| 129 | - echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
| 129 | + echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
|
| 130 | 130 | Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>'; |
| 131 | 131 | } else { |
| 132 | - echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM); |
|
| 132 | + echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM); |
|
| 133 | 133 | } |
| 134 | 134 | // Slideshow options |
| 135 | 135 | echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
@@ -142,24 +142,24 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // If we come from slideshowoptions.php we sessionize (new word !!! ;-) the options |
| 144 | 144 | if (isset($_POST['Submit'])) { |
| 145 | - // We come from slideshowoptions.php |
|
| 146 | - //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']); |
|
| 147 | - $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']); |
|
| 148 | - if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') { |
|
| 149 | - //echo "resizing"; |
|
| 150 | - $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']); |
|
| 151 | - $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']); |
|
| 152 | - } else { |
|
| 153 | - //echo "unsetting the session heighte and width"; |
|
| 154 | - $_SESSION["image_resizing_width"] = null; |
|
| 155 | - $_SESSION["image_resizing_height"] = null; |
|
| 156 | - } |
|
| 145 | + // We come from slideshowoptions.php |
|
| 146 | + //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']); |
|
| 147 | + $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']); |
|
| 148 | + if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') { |
|
| 149 | + //echo "resizing"; |
|
| 150 | + $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']); |
|
| 151 | + $_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']); |
|
| 152 | + } else { |
|
| 153 | + //echo "unsetting the session heighte and width"; |
|
| 154 | + $_SESSION["image_resizing_width"] = null; |
|
| 155 | + $_SESSION["image_resizing_height"] = null; |
|
| 156 | + } |
|
| 157 | 157 | } |
| 158 | 158 | $target_width = $target_height = null; |
| 159 | 159 | // The target height and width depends if we choose resizing or no resizing |
| 160 | 160 | if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
| 161 | - $target_width = $_SESSION["image_resizing_width"]; |
|
| 162 | - $target_height = $_SESSION["image_resizing_height"]; |
|
| 161 | + $target_width = $_SESSION["image_resizing_width"]; |
|
| 162 | + $target_height = $_SESSION["image_resizing_height"]; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /* THUMBNAIL VIEW */ |
@@ -169,59 +169,59 @@ discard block |
||
| 169 | 169 | $html = ''; |
| 170 | 170 | if ($slide_id == 'all') { |
| 171 | 171 | |
| 172 | - // Config for make thumbnails |
|
| 172 | + // Config for make thumbnails |
|
| 173 | 173 | $allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png'); |
| 174 | - $max_thumbnail_width = 250; |
|
| 175 | - $max_thumbnail_height = 250; |
|
| 176 | - $png_compression = 0; // 0(none)-9 |
|
| 177 | - $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
| 174 | + $max_thumbnail_width = 250; |
|
| 175 | + $max_thumbnail_height = 250; |
|
| 176 | + $png_compression = 0; // 0(none)-9 |
|
| 177 | + $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
| 178 | 178 | |
| 179 | - $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
|
| 179 | + $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
|
| 180 | 180 | |
| 181 | - //Other parameters only for show tumbnails |
|
| 182 | - $row_items = 4;//only in slideshow.php |
|
| 183 | - $number_image = 7;//num icons cols to show |
|
| 184 | - $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x |
|
| 185 | - $thumbnail_height_frame = $max_thumbnail_height; |
|
| 181 | + //Other parameters only for show tumbnails |
|
| 182 | + $row_items = 4;//only in slideshow.php |
|
| 183 | + $number_image = 7;//num icons cols to show |
|
| 184 | + $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x |
|
| 185 | + $thumbnail_height_frame = $max_thumbnail_height; |
|
| 186 | 186 | |
| 187 | - // Create the template_thumbnails folder (if no exist) |
|
| 187 | + // Create the template_thumbnails folder (if no exist) |
|
| 188 | 188 | |
| 189 | - if (!file_exists($directory_thumbnails)) { |
|
| 190 | - @mkdir($directory_thumbnails, api_get_permissions_for_new_directories()); |
|
| 189 | + if (!file_exists($directory_thumbnails)) { |
|
| 190 | + @mkdir($directory_thumbnails, api_get_permissions_for_new_directories()); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - // check files and thumbnails |
|
| 194 | - if (is_array($image_files_only)) { |
|
| 193 | + // check files and thumbnails |
|
| 194 | + if (is_array($image_files_only)) { |
|
| 195 | 195 | |
| 196 | - foreach ($image_files_only as $one_image_file) { |
|
| 197 | - $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
|
| 198 | - $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
| 196 | + foreach ($image_files_only as $one_image_file) { |
|
| 197 | + $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
|
| 198 | + $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
| 199 | 199 | |
| 200 | - if (file_exists($image)) { |
|
| 201 | - //check thumbnail |
|
| 202 | - $imagetype = explode(".", $image); |
|
| 200 | + if (file_exists($image)) { |
|
| 201 | + //check thumbnail |
|
| 202 | + $imagetype = explode(".", $image); |
|
| 203 | 203 | //or check $imagetype = image_type_to_extension(exif_imagetype($image), false); |
| 204 | - $imagetype = strtolower($imagetype[count($imagetype)-1]); |
|
| 204 | + $imagetype = strtolower($imagetype[count($imagetype)-1]); |
|
| 205 | 205 | |
| 206 | - if (in_array($imagetype,$allowed_thumbnail_types)) { |
|
| 207 | - if (!file_exists($image_thumbnail)){ |
|
| 206 | + if (in_array($imagetype,$allowed_thumbnail_types)) { |
|
| 207 | + if (!file_exists($image_thumbnail)){ |
|
| 208 | 208 | //run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail |
| 209 | - $original_image_size = api_getimagesize($image); |
|
| 210 | - |
|
| 211 | - switch($imagetype) { |
|
| 212 | - case 'gif': |
|
| 213 | - $source_img = imagecreatefromgif($image); |
|
| 214 | - break; |
|
| 215 | - case 'jpg': |
|
| 216 | - $source_img = imagecreatefromjpeg($image); |
|
| 217 | - break; |
|
| 218 | - case 'jpeg': |
|
| 219 | - $source_img = imagecreatefromjpeg($image); |
|
| 220 | - break; |
|
| 221 | - case 'png': |
|
| 222 | - $source_img = imagecreatefrompng($image); |
|
| 223 | - break; |
|
| 224 | - } |
|
| 209 | + $original_image_size = api_getimagesize($image); |
|
| 210 | + |
|
| 211 | + switch($imagetype) { |
|
| 212 | + case 'gif': |
|
| 213 | + $source_img = imagecreatefromgif($image); |
|
| 214 | + break; |
|
| 215 | + case 'jpg': |
|
| 216 | + $source_img = imagecreatefromjpeg($image); |
|
| 217 | + break; |
|
| 218 | + case 'jpeg': |
|
| 219 | + $source_img = imagecreatefromjpeg($image); |
|
| 220 | + break; |
|
| 221 | + case 'png': |
|
| 222 | + $source_img = imagecreatefrompng($image); |
|
| 223 | + break; |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | 226 | $new_thumbnail_size = api_calculate_image_size( |
| 227 | 227 | $original_image_size['width'], |
@@ -229,33 +229,33 @@ discard block |
||
| 229 | 229 | $max_thumbnail_width, |
| 230 | 230 | $max_thumbnail_height |
| 231 | 231 | ); |
| 232 | - if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
| 233 | - $new_thumbnail_size['width']=$original_image_size['width']; |
|
| 234 | - $new_thumbnail_size['height']=$original_image_size['height']; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
| 238 | - |
|
| 239 | - // preserve transparency |
|
| 240 | - if ($imagetype == "png"){ |
|
| 241 | - imagesavealpha($crop, true); |
|
| 242 | - $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
| 243 | - imagefill($crop, 0, 0, $color); |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - if ($imagetype == "gif") { |
|
| 247 | - $transindex = imagecolortransparent($source_img); |
|
| 232 | + if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
| 233 | + $new_thumbnail_size['width']=$original_image_size['width']; |
|
| 234 | + $new_thumbnail_size['height']=$original_image_size['height']; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
|
| 238 | + |
|
| 239 | + // preserve transparency |
|
| 240 | + if ($imagetype == "png"){ |
|
| 241 | + imagesavealpha($crop, true); |
|
| 242 | + $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
| 243 | + imagefill($crop, 0, 0, $color); |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + if ($imagetype == "gif") { |
|
| 247 | + $transindex = imagecolortransparent($source_img); |
|
| 248 | 248 | $palletsize = imagecolorstotal($source_img); |
| 249 | - //GIF89a for transparent and anim (first clip), either GIF87a |
|
| 250 | - if ($transindex >= 0 && $transindex < $palletsize){ |
|
| 251 | - $transcol = imagecolorsforindex($source_img, $transindex); |
|
| 252 | - $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
| 253 | - imagefill($crop, 0, 0, $transindex); |
|
| 254 | - imagecolortransparent($crop, $transindex); |
|
| 255 | - } |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - //resampled image |
|
| 249 | + //GIF89a for transparent and anim (first clip), either GIF87a |
|
| 250 | + if ($transindex >= 0 && $transindex < $palletsize){ |
|
| 251 | + $transcol = imagecolorsforindex($source_img, $transindex); |
|
| 252 | + $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
|
| 253 | + imagefill($crop, 0, 0, $transindex); |
|
| 254 | + imagecolortransparent($crop, $transindex); |
|
| 255 | + } |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + //resampled image |
|
| 259 | 259 | imagecopyresampled( |
| 260 | 260 | $crop, |
| 261 | 261 | $source_img, |
@@ -269,69 +269,69 @@ discard block |
||
| 269 | 269 | $original_image_size['height'] |
| 270 | 270 | ); |
| 271 | 271 | |
| 272 | - switch ($imagetype) { |
|
| 273 | - case 'gif': |
|
| 274 | - imagegif($crop,$image_thumbnail); |
|
| 275 | - break; |
|
| 276 | - case 'jpg': |
|
| 277 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 278 | - break; |
|
| 279 | - case 'jpeg': |
|
| 280 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 281 | - break; |
|
| 282 | - case 'png': |
|
| 283 | - imagepng($crop,$image_thumbnail,$png_compression); |
|
| 284 | - break; |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - //clean memory |
|
| 288 | - imagedestroy($crop); |
|
| 289 | - }//end !exist thumbnail |
|
| 290 | - |
|
| 291 | - //show thumbnail and link |
|
| 292 | - |
|
| 293 | - $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
| 294 | - $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
| 295 | - $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
| 296 | - } else { |
|
| 297 | - //if images aren't support by gd (not gif, jpg, jpeg, png) |
|
| 298 | - if ($imagetype=="bmp") { |
|
| 272 | + switch ($imagetype) { |
|
| 273 | + case 'gif': |
|
| 274 | + imagegif($crop,$image_thumbnail); |
|
| 275 | + break; |
|
| 276 | + case 'jpg': |
|
| 277 | + imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 278 | + break; |
|
| 279 | + case 'jpeg': |
|
| 280 | + imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 281 | + break; |
|
| 282 | + case 'png': |
|
| 283 | + imagepng($crop,$image_thumbnail,$png_compression); |
|
| 284 | + break; |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + //clean memory |
|
| 288 | + imagedestroy($crop); |
|
| 289 | + }//end !exist thumbnail |
|
| 290 | + |
|
| 291 | + //show thumbnail and link |
|
| 292 | + |
|
| 293 | + $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
| 294 | + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
|
| 295 | + $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
|
| 296 | + } else { |
|
| 297 | + //if images aren't support by gd (not gif, jpg, jpeg, png) |
|
| 298 | + if ($imagetype=="bmp") { |
|
| 299 | 299 | // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy |
| 300 | - $original_image_size = getimagesize($image); |
|
| 301 | - if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
| 302 | - $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files |
|
| 303 | - $image_height = $thumbnail_size['height']; |
|
| 304 | - $image_width = $thumbnail_size['width']; |
|
| 305 | - } else { |
|
| 306 | - $image_height=$original_image_size[0]; |
|
| 307 | - $image_width=$original_image_size[1]; |
|
| 308 | - } |
|
| 309 | - } else { |
|
| 310 | - //example for svg files,... |
|
| 311 | - $image_width=$max_thumbnail_width; |
|
| 312 | - $image_height=$max_thumbnail_height; |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
| 316 | - $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; |
|
| 317 | - |
|
| 318 | - }//end allowed image types |
|
| 319 | - }//end if exist file image |
|
| 320 | - }//end foreach |
|
| 321 | - }//end image files only |
|
| 322 | - |
|
| 323 | - // Creating the table |
|
| 324 | - $html_table = ''; |
|
| 325 | - |
|
| 326 | - $i = 0; |
|
| 327 | - $count_image = count($image_tag); |
|
| 328 | - $number_iteration = ceil($count_image/$number_image); |
|
| 329 | - $p = 0; |
|
| 300 | + $original_image_size = getimagesize($image); |
|
| 301 | + if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
| 302 | + $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files |
|
| 303 | + $image_height = $thumbnail_size['height']; |
|
| 304 | + $image_width = $thumbnail_size['width']; |
|
| 305 | + } else { |
|
| 306 | + $image_height=$original_image_size[0]; |
|
| 307 | + $image_width=$original_image_size[1]; |
|
| 308 | + } |
|
| 309 | + } else { |
|
| 310 | + //example for svg files,... |
|
| 311 | + $image_width=$max_thumbnail_width; |
|
| 312 | + $image_height=$max_thumbnail_height; |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
|
| 316 | + $image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">'; |
|
| 317 | + |
|
| 318 | + }//end allowed image types |
|
| 319 | + }//end if exist file image |
|
| 320 | + }//end foreach |
|
| 321 | + }//end image files only |
|
| 322 | + |
|
| 323 | + // Creating the table |
|
| 324 | + $html_table = ''; |
|
| 325 | + |
|
| 326 | + $i = 0; |
|
| 327 | + $count_image = count($image_tag); |
|
| 328 | + $number_iteration = ceil($count_image/$number_image); |
|
| 329 | + $p = 0; |
|
| 330 | 330 | $html = ''; |
| 331 | 331 | $html .= '<div class="gallery">'; |
| 332 | - for ($k = 0; $k < $number_iteration; $k++) { |
|
| 333 | - for ($i = 0; $i < $number_image; $i++) { |
|
| 334 | - if (isset($image_tag[$p])) { |
|
| 332 | + for ($k = 0; $k < $number_iteration; $k++) { |
|
| 333 | + for ($i = 0; $i < $number_image; $i++) { |
|
| 334 | + if (isset($image_tag[$p])) { |
|
| 335 | 335 | $html .= '<div class="col-xs-6 col-sm-3 col-md-2">'; |
| 336 | 336 | $html .= '<div class="canvas-one">'; |
| 337 | 337 | $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">'; |
@@ -343,10 +343,10 @@ discard block |
||
| 343 | 343 | $html .= '</a>'; |
| 344 | 344 | $html .= '</div>'; |
| 345 | 345 | $html .= '</div>'; |
| 346 | - } |
|
| 347 | - $p++; |
|
| 348 | - } |
|
| 349 | - } |
|
| 346 | + } |
|
| 347 | + $p++; |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | 350 | $html .= '</div>'; |
| 351 | 351 | |
| 352 | 352 | }//end slide==all |
@@ -357,45 +357,45 @@ discard block |
||
| 357 | 357 | // This is for viewing all the images in the slideshow one at a time. |
| 358 | 358 | |
| 359 | 359 | if ($slide_id != 'all' && !empty($image_files_only)) { |
| 360 | - if (file_exists($image) && is_file($image)) { |
|
| 361 | - $image_height_width = resize_image($image, $target_width, $target_height); |
|
| 362 | - |
|
| 363 | - $image_height = $image_height_width[0]; |
|
| 364 | - $image_width = $image_height_width[1]; |
|
| 365 | - |
|
| 366 | - $height_width_tags = null; |
|
| 367 | - if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
|
| 368 | - $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - // This is done really quickly and should be cleaned up a little bit using the API functions |
|
| 372 | - $tbl_documents = Database::get_course_table(TABLE_DOCUMENT); |
|
| 373 | - if ($path == '/') { |
|
| 374 | - $pathpart = '/'; |
|
| 375 | - } else { |
|
| 376 | - $pathpart = $path.'/'; |
|
| 377 | - } |
|
| 378 | - $sql = "SELECT * FROM $tbl_documents |
|
| 360 | + if (file_exists($image) && is_file($image)) { |
|
| 361 | + $image_height_width = resize_image($image, $target_width, $target_height); |
|
| 362 | + |
|
| 363 | + $image_height = $image_height_width[0]; |
|
| 364 | + $image_width = $image_height_width[1]; |
|
| 365 | + |
|
| 366 | + $height_width_tags = null; |
|
| 367 | + if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
|
| 368 | + $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + // This is done really quickly and should be cleaned up a little bit using the API functions |
|
| 372 | + $tbl_documents = Database::get_course_table(TABLE_DOCUMENT); |
|
| 373 | + if ($path == '/') { |
|
| 374 | + $pathpart = '/'; |
|
| 375 | + } else { |
|
| 376 | + $pathpart = $path.'/'; |
|
| 377 | + } |
|
| 378 | + $sql = "SELECT * FROM $tbl_documents |
|
| 379 | 379 | WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'"; |
| 380 | - $result = Database::query($sql); |
|
| 381 | - $row = Database::fetch_array($result); |
|
| 382 | - |
|
| 383 | - echo '<table align="center" border="0" cellspacing="10">'; |
|
| 384 | - echo '<tr>'; |
|
| 385 | - echo '<td id="td_image" align="center">'; |
|
| 386 | - if ($slide < $total_slides - 1 && $slide_id != 'all') { |
|
| 387 | - echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>"; |
|
| 388 | - } else { |
|
| 389 | - echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>"; |
|
| 390 | - } |
|
| 380 | + $result = Database::query($sql); |
|
| 381 | + $row = Database::fetch_array($result); |
|
| 382 | + |
|
| 383 | + echo '<table align="center" border="0" cellspacing="10">'; |
|
| 384 | + echo '<tr>'; |
|
| 385 | + echo '<td id="td_image" align="center">'; |
|
| 386 | + if ($slide < $total_slides - 1 && $slide_id != 'all') { |
|
| 387 | + echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>"; |
|
| 388 | + } else { |
|
| 389 | + echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>"; |
|
| 390 | + } |
|
| 391 | 391 | if ($path == '/') { |
| 392 | - $path = ''; |
|
| 392 | + $path = ''; |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - list($width, $height) = getimagesize($image); |
|
| 396 | - // Auto resize |
|
| 397 | - if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
| 398 | - ?> |
|
| 395 | + list($width, $height) = getimagesize($image); |
|
| 396 | + // Auto resize |
|
| 397 | + if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
| 398 | + ?> |
|
| 399 | 399 | |
| 400 | 400 | <script type="text/javascript"> |
| 401 | 401 | var initial_width='<?php echo $width; ?>'; |
@@ -448,30 +448,30 @@ discard block |
||
| 448 | 448 | |
| 449 | 449 | </script> |
| 450 | 450 | <?php |
| 451 | - } else { |
|
| 452 | - echo "<img src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">"; |
|
| 453 | - } |
|
| 454 | - |
|
| 455 | - echo '</a>'; |
|
| 456 | - echo '</td>'; |
|
| 457 | - echo '</tr>'; |
|
| 458 | - echo '<tr>'; |
|
| 459 | - echo '<td>'; |
|
| 460 | - echo $row['comment']; |
|
| 461 | - echo '</td>'; |
|
| 451 | + } else { |
|
| 452 | + echo "<img src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">"; |
|
| 453 | + } |
|
| 454 | + |
|
| 455 | + echo '</a>'; |
|
| 456 | + echo '</td>'; |
|
| 457 | + echo '</tr>'; |
|
| 458 | + echo '<tr>'; |
|
| 459 | + echo '<td>'; |
|
| 460 | + echo $row['comment']; |
|
| 461 | + echo '</td>'; |
|
| 462 | 462 | |
| 463 | 463 | echo '<tr>'; |
| 464 | 464 | echo '<td style="padding:10px;" align="center">'; |
| 465 | 465 | echo Display::tag('h3', $row['title']); |
| 466 | 466 | echo '</td>'; |
| 467 | 467 | echo '</tr>'; |
| 468 | - echo '</tr>'; |
|
| 469 | - echo '</table>'; |
|
| 468 | + echo '</tr>'; |
|
| 469 | + echo '</table>'; |
|
| 470 | 470 | |
| 471 | - echo '<table align="center" border="0">'; |
|
| 472 | - if (api_is_allowed_to_edit(null, true)) { |
|
| 473 | - $aux = explode('.', htmlspecialchars($image_files_only[$slide])); |
|
| 474 | - $ext = $aux[count($aux) - 1]; |
|
| 471 | + echo '<table align="center" border="0">'; |
|
| 472 | + if (api_is_allowed_to_edit(null, true)) { |
|
| 473 | + $aux = explode('.', htmlspecialchars($image_files_only[$slide])); |
|
| 474 | + $ext = $aux[count($aux) - 1]; |
|
| 475 | 475 | |
| 476 | 476 | if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { |
| 477 | 477 | $resize_info = get_lang('Resizing').'<br />'; |
@@ -483,8 +483,8 @@ discard block |
||
| 483 | 483 | $resize_height = get_lang('Auto'); |
| 484 | 484 | } else { |
| 485 | 485 | $resize_info = get_lang('NoResizing').'<br />'; |
| 486 | - $resize_width = ''; |
|
| 487 | - $resize_height = ''; |
|
| 486 | + $resize_width = ''; |
|
| 487 | + $resize_height = ''; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | echo '<tr>'; |
@@ -492,25 +492,25 @@ discard block |
||
| 492 | 492 | echo '<a href="edit_document.php?'.api_get_cidreq().'&id='.$row['id'].'&origin=slideshow&origin_opt='.$edit_slide_id.'&"> |
| 493 | 493 | <img src="../img/edit.gif" border="0" title="'.get_lang('Modify').'" alt="'.get_lang('Modify').'" /></a><br />'; |
| 494 | 494 | |
| 495 | - echo $image_files_only[$slide].' <br />'; |
|
| 496 | - echo $width.' x '.$height.' <br />'; |
|
| 497 | - echo round((filesize($image)/1024), 2).' KB'; |
|
| 498 | - echo ' - '.$ext; |
|
| 499 | - echo '</td>'; |
|
| 500 | - echo '</tr>'; |
|
| 501 | - echo '<tr>'; |
|
| 502 | - echo '<td align="center">'; |
|
| 503 | - echo $resize_info; |
|
| 504 | - echo $resize_width; |
|
| 505 | - echo $resize_height; |
|
| 506 | - echo '</td>'; |
|
| 507 | - echo '</tr>'; |
|
| 508 | - } |
|
| 509 | - echo '</table>'; |
|
| 510 | - |
|
| 511 | - } else { |
|
| 512 | - Display::display_warning_message(get_lang('FileNotFound')); |
|
| 513 | - } |
|
| 495 | + echo $image_files_only[$slide].' <br />'; |
|
| 496 | + echo $width.' x '.$height.' <br />'; |
|
| 497 | + echo round((filesize($image)/1024), 2).' KB'; |
|
| 498 | + echo ' - '.$ext; |
|
| 499 | + echo '</td>'; |
|
| 500 | + echo '</tr>'; |
|
| 501 | + echo '<tr>'; |
|
| 502 | + echo '<td align="center">'; |
|
| 503 | + echo $resize_info; |
|
| 504 | + echo $resize_width; |
|
| 505 | + echo $resize_height; |
|
| 506 | + echo '</td>'; |
|
| 507 | + echo '</tr>'; |
|
| 508 | + } |
|
| 509 | + echo '</table>'; |
|
| 510 | + |
|
| 511 | + } else { |
|
| 512 | + Display::display_warning_message(get_lang('FileNotFound')); |
|
| 513 | + } |
|
| 514 | 514 | } else { |
| 515 | 515 | if ($slide_id != 'all') { |
| 516 | 516 | Display::display_warning_message(get_lang('NoDataAvailable')); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if ($slide_id != 'all') { |
| 65 | 65 | $image = null; |
| 66 | 66 | if (isset($image_files_only[$slide])) { |
| 67 | - $image = $sys_course_path . $_course['path'] . '/document' . $folder . $image_files_only[$slide]; |
|
| 67 | + $image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide]; |
|
| 68 | 68 | } |
| 69 | 69 | if (file_exists($image)) { |
| 70 | 70 | echo '<div class="actions-pagination">'; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $last = Display::return_icon('action_last_na.png', get_lang('LastSlide')); |
| 106 | 106 | } else { |
| 107 | 107 | $imgn = 'action_next.png'; |
| 108 | - $last = '<a href="slideshow.php?slide_id='.($total_slides-1).'&curdirpath='.$pathurl.'"> |
|
| 108 | + $last = '<a href="slideshow.php?slide_id='.($total_slides - 1).'&curdirpath='.$pathurl.'"> |
|
| 109 | 109 | '.Display::return_icon('action_last.png', get_lang('LastSlide')).' |
| 110 | 110 | </a>'; |
| 111 | 111 | } |
@@ -122,18 +122,18 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | // Exit the slideshow |
| 124 | 124 | echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
| 125 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 125 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 126 | 126 | |
| 127 | 127 | // Show thumbnails |
| 128 | 128 | if ($slide_id != 'all') { |
| 129 | 129 | echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
| 130 | - Display::return_icon('thumbnails.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 130 | + Display::return_icon('thumbnails.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 131 | 131 | } else { |
| 132 | - echo Display::return_icon('thumbnails_na.png',get_lang('ShowThumbnails'),'',ICON_SIZE_MEDIUM); |
|
| 132 | + echo Display::return_icon('thumbnails_na.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM); |
|
| 133 | 133 | } |
| 134 | 134 | // Slideshow options |
| 135 | 135 | echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'. |
| 136 | - Display::return_icon('settings.png', get_lang('SetSlideshowOptions'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 136 | + Display::return_icon('settings.png', get_lang('SetSlideshowOptions'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 137 | 137 | |
| 138 | 138 | echo '</div>'; |
| 139 | 139 | echo '<br />'; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | $target_width = $target_height = null; |
| 159 | 159 | // The target height and width depends if we choose resizing or no resizing |
| 160 | -if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
|
| 160 | +if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") { |
|
| 161 | 161 | $target_width = $_SESSION["image_resizing_width"]; |
| 162 | 162 | $target_height = $_SESSION["image_resizing_height"]; |
| 163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | /* THUMBNAIL VIEW */ |
| 166 | 166 | |
| 167 | 167 | // This is for viewing all the images in the slideshow as thumbnails. |
| 168 | -$image_tag = array (); |
|
| 168 | +$image_tag = array(); |
|
| 169 | 169 | $html = ''; |
| 170 | 170 | if ($slide_id == 'all') { |
| 171 | 171 | |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | $max_thumbnail_width = 250; |
| 175 | 175 | $max_thumbnail_height = 250; |
| 176 | 176 | $png_compression = 0; // 0(none)-9 |
| 177 | - $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
| 177 | + $jpg_quality = 75; // from 0 to 100 (default is 75). More quality less compression |
|
| 178 | 178 | |
| 179 | 179 | $directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/'; |
| 180 | 180 | |
| 181 | 181 | //Other parameters only for show tumbnails |
| 182 | - $row_items = 4;//only in slideshow.php |
|
| 183 | - $number_image = 7;//num icons cols to show |
|
| 184 | - $thumbnail_width_frame = $max_thumbnail_width;//optional $max_thumbnail_width+x |
|
| 182 | + $row_items = 4; //only in slideshow.php |
|
| 183 | + $number_image = 7; //num icons cols to show |
|
| 184 | + $thumbnail_width_frame = $max_thumbnail_width; //optional $max_thumbnail_width+x |
|
| 185 | 185 | $thumbnail_height_frame = $max_thumbnail_height; |
| 186 | 186 | |
| 187 | 187 | // Create the template_thumbnails folder (if no exist) |
@@ -195,20 +195,20 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | foreach ($image_files_only as $one_image_file) { |
| 197 | 197 | $image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file; |
| 198 | - $image_thumbnail= $directory_thumbnails.'.'.$one_image_file; |
|
| 198 | + $image_thumbnail = $directory_thumbnails.'.'.$one_image_file; |
|
| 199 | 199 | |
| 200 | 200 | if (file_exists($image)) { |
| 201 | 201 | //check thumbnail |
| 202 | 202 | $imagetype = explode(".", $image); |
| 203 | 203 | //or check $imagetype = image_type_to_extension(exif_imagetype($image), false); |
| 204 | - $imagetype = strtolower($imagetype[count($imagetype)-1]); |
|
| 204 | + $imagetype = strtolower($imagetype[count($imagetype) - 1]); |
|
| 205 | 205 | |
| 206 | - if (in_array($imagetype,$allowed_thumbnail_types)) { |
|
| 207 | - if (!file_exists($image_thumbnail)){ |
|
| 206 | + if (in_array($imagetype, $allowed_thumbnail_types)) { |
|
| 207 | + if (!file_exists($image_thumbnail)) { |
|
| 208 | 208 | //run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail |
| 209 | 209 | $original_image_size = api_getimagesize($image); |
| 210 | 210 | |
| 211 | - switch($imagetype) { |
|
| 211 | + switch ($imagetype) { |
|
| 212 | 212 | case 'gif': |
| 213 | 213 | $source_img = imagecreatefromgif($image); |
| 214 | 214 | break; |
@@ -229,17 +229,17 @@ discard block |
||
| 229 | 229 | $max_thumbnail_width, |
| 230 | 230 | $max_thumbnail_height |
| 231 | 231 | ); |
| 232 | - if ($max_thumbnail_width>$original_image_size['width'] && $max_thumbnail_height>$original_image_size['height']){ |
|
| 233 | - $new_thumbnail_size['width']=$original_image_size['width']; |
|
| 234 | - $new_thumbnail_size['height']=$original_image_size['height']; |
|
| 232 | + if ($max_thumbnail_width > $original_image_size['width'] && $max_thumbnail_height > $original_image_size['height']) { |
|
| 233 | + $new_thumbnail_size['width'] = $original_image_size['width']; |
|
| 234 | + $new_thumbnail_size['height'] = $original_image_size['height']; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']); |
| 238 | 238 | |
| 239 | 239 | // preserve transparency |
| 240 | - if ($imagetype == "png"){ |
|
| 240 | + if ($imagetype == "png") { |
|
| 241 | 241 | imagesavealpha($crop, true); |
| 242 | - $color = imagecolorallocatealpha($crop,0x00,0x00,0x00,127); |
|
| 242 | + $color = imagecolorallocatealpha($crop, 0x00, 0x00, 0x00, 127); |
|
| 243 | 243 | imagefill($crop, 0, 0, $color); |
| 244 | 244 | } |
| 245 | 245 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $transindex = imagecolortransparent($source_img); |
| 248 | 248 | $palletsize = imagecolorstotal($source_img); |
| 249 | 249 | //GIF89a for transparent and anim (first clip), either GIF87a |
| 250 | - if ($transindex >= 0 && $transindex < $palletsize){ |
|
| 250 | + if ($transindex >= 0 && $transindex < $palletsize) { |
|
| 251 | 251 | $transcol = imagecolorsforindex($source_img, $transindex); |
| 252 | 252 | $transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127); |
| 253 | 253 | imagefill($crop, 0, 0, $transindex); |
@@ -271,16 +271,16 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | switch ($imagetype) { |
| 273 | 273 | case 'gif': |
| 274 | - imagegif($crop,$image_thumbnail); |
|
| 274 | + imagegif($crop, $image_thumbnail); |
|
| 275 | 275 | break; |
| 276 | 276 | case 'jpg': |
| 277 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 277 | + imagejpeg($crop, $image_thumbnail, $jpg_quality); |
|
| 278 | 278 | break; |
| 279 | 279 | case 'jpeg': |
| 280 | - imagejpeg($crop,$image_thumbnail,$jpg_quality); |
|
| 280 | + imagejpeg($crop, $image_thumbnail, $jpg_quality); |
|
| 281 | 281 | break; |
| 282 | 282 | case 'png': |
| 283 | - imagepng($crop,$image_thumbnail,$png_compression); |
|
| 283 | + imagepng($crop, $image_thumbnail, $png_compression); |
|
| 284 | 284 | break; |
| 285 | 285 | } |
| 286 | 286 | |
@@ -290,26 +290,26 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | //show thumbnail and link |
| 292 | 292 | |
| 293 | - $one_image_thumbnail_file='.thumbs/.'.$one_image_file;//get path thumbnail |
|
| 293 | + $one_image_thumbnail_file = '.thumbs/.'.$one_image_file; //get path thumbnail |
|
| 294 | 294 | $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file; |
| 295 | 295 | $image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">'; |
| 296 | 296 | } else { |
| 297 | 297 | //if images aren't support by gd (not gif, jpg, jpeg, png) |
| 298 | - if ($imagetype=="bmp") { |
|
| 298 | + if ($imagetype == "bmp") { |
|
| 299 | 299 | // use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy |
| 300 | 300 | $original_image_size = getimagesize($image); |
| 301 | - if ($max_thumbnail_width<$original_image_size[0] || $max_thumbnail_height<$original_image_size[1]){ |
|
| 302 | - $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files |
|
| 301 | + if ($max_thumbnail_width < $original_image_size[0] || $max_thumbnail_height < $original_image_size[1]) { |
|
| 302 | + $thumbnail_size = api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height); //don't use resize_image because doesn't run with bmp files |
|
| 303 | 303 | $image_height = $thumbnail_size['height']; |
| 304 | 304 | $image_width = $thumbnail_size['width']; |
| 305 | 305 | } else { |
| 306 | - $image_height=$original_image_size[0]; |
|
| 307 | - $image_width=$original_image_size[1]; |
|
| 306 | + $image_height = $original_image_size[0]; |
|
| 307 | + $image_width = $original_image_size[1]; |
|
| 308 | 308 | } |
| 309 | 309 | } else { |
| 310 | 310 | //example for svg files,... |
| 311 | - $image_width=$max_thumbnail_width; |
|
| 312 | - $image_height=$max_thumbnail_height; |
|
| 311 | + $image_width = $max_thumbnail_width; |
|
| 312 | + $image_height = $max_thumbnail_height; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | $i = 0; |
| 327 | 327 | $count_image = count($image_tag); |
| 328 | - $number_iteration = ceil($count_image/$number_image); |
|
| 328 | + $number_iteration = ceil($count_image / $number_image); |
|
| 329 | 329 | $p = 0; |
| 330 | 330 | $html = ''; |
| 331 | 331 | $html .= '<div class="gallery">'; |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">'; |
| 338 | 338 | $html .= '<div class="frame">'; |
| 339 | 339 | $html .= '<div class="photo">'; |
| 340 | - $html .= $image_tag[$p]; |
|
| 340 | + $html .= $image_tag[$p]; |
|
| 341 | 341 | $html .= '</div>'; |
| 342 | 342 | $html .= '</div>'; |
| 343 | 343 | $html .= '</a>'; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | list($width, $height) = getimagesize($image); |
| 396 | 396 | // Auto resize |
| 397 | - if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
| 397 | + if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') { |
|
| 398 | 398 | ?> |
| 399 | 399 | |
| 400 | 400 | <script type="text/javascript"> |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | start_height=initial_height; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - document.write('<img id="image" src="<?php echo 'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'" border="0" alt="<?php echo $image_files_only[$slide] ;?>">'); |
|
| 414 | + document.write('<img id="image" src="<?php echo 'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'" border="0" alt="<?php echo $image_files_only[$slide]; ?>">'); |
|
| 415 | 415 | |
| 416 | 416 | function resizeImage() { |
| 417 | 417 | |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $resize_info = get_lang('Resizing').'<br />'; |
| 478 | 478 | $resize_width = $_SESSION["image_resizing_width"].' x '; |
| 479 | 479 | $resize_height = $_SESSION['image_resizing_height']; |
| 480 | - } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing'){ |
|
| 480 | + } elseif (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] != 'noresizing') { |
|
| 481 | 481 | $resize_info = get_lang('Resizing').'<br />'; |
| 482 | 482 | $resize_width = get_lang('Auto').' x '; |
| 483 | 483 | $resize_height = get_lang('Auto'); |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | |
| 495 | 495 | echo $image_files_only[$slide].' <br />'; |
| 496 | 496 | echo $width.' x '.$height.' <br />'; |
| 497 | - echo round((filesize($image)/1024), 2).' KB'; |
|
| 497 | + echo round((filesize($image) / 1024), 2).' KB'; |
|
| 498 | 498 | echo ' - '.$ext; |
| 499 | 499 | echo '</td>'; |
| 500 | 500 | echo '</tr>'; |
@@ -50,26 +50,26 @@ discard block |
||
| 50 | 50 | // Please, do not modify this dirname formatting |
| 51 | 51 | |
| 52 | 52 | if (strstr($dir, '..')) { |
| 53 | - $dir = '/'; |
|
| 53 | + $dir = '/'; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if ($dir[0] == '.') { |
| 57 | - $dir = substr($dir, 1); |
|
| 57 | + $dir = substr($dir, 1); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if ($dir[0] != '/') { |
| 61 | - $dir = '/'.$dir; |
|
| 61 | + $dir = '/'.$dir; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | if ($dir[strlen($dir) - 1] != '/') { |
| 65 | - $dir .= '/'; |
|
| 65 | + $dir .= '/'; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; |
| 69 | 69 | |
| 70 | 70 | if (!is_dir($filepath)) { |
| 71 | - $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 72 | - $dir = '/'; |
|
| 71 | + $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; |
|
| 72 | + $dir = '/'; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $groupId = api_get_group_id(); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] || |
| 100 | - DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id())) |
|
| 100 | + DocumentManager::is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id())) |
|
| 101 | 101 | ) { |
| 102 | 102 | api_not_allowed(true); |
| 103 | 103 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | // Interbreadcrumb for the current directory root path |
| 116 | 116 | if (empty($document_data['parents'])) { |
| 117 | - $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); |
|
| 117 | + $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); |
|
| 118 | 118 | } else { |
| 119 | 119 | foreach ($document_data['parents'] as $document_sub_data) { |
| 120 | 120 | $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']); |
@@ -147,17 +147,17 @@ discard block |
||
| 147 | 147 | $locktitle="false"; |
| 148 | 148 | |
| 149 | 149 | if ($_SERVER['HTTP_HOST']=="localhost") { |
| 150 | - $path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml'; |
|
| 151 | - if (!file_exists($path_and_file)) { |
|
| 152 | - $crossdomain='<?xml version="1.0"?> |
|
| 150 | + $path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml'; |
|
| 151 | + if (!file_exists($path_and_file)) { |
|
| 152 | + $crossdomain='<?xml version="1.0"?> |
|
| 153 | 153 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
| 154 | 154 | <cross-domain-policy> |
| 155 | 155 | <allow-access-from domain="cdn.pixlr.com" /> |
| 156 | 156 | <site-control permitted-cross-domain-policies="master-only"/> |
| 157 | 157 | <allow-http-request-headers-from domain="cnd.pixlr.com" headers="*" secure="true"/> |
| 158 | 158 | </cross-domain-policy>';//more open domain="*" |
| 159 | - @file_put_contents($path_and_file, $crossdomain); |
|
| 160 | - } |
|
| 159 | + @file_put_contents($path_and_file, $crossdomain); |
|
| 160 | + } |
|
| 161 | 161 | $credentials = "true"; |
| 162 | 162 | } else { |
| 163 | 163 | $credentials = "false"; |
@@ -129,27 +129,27 @@ |
||
| 129 | 129 | |
| 130 | 130 | // pixlr |
| 131 | 131 | // max size 1 Mb ?? |
| 132 | -$title = urlencode(utf8_encode(get_lang('NewImage')));//TODO:check |
|
| 132 | +$title = urlencode(utf8_encode(get_lang('NewImage'))); //TODO:check |
|
| 133 | 133 | // |
| 134 | 134 | $image = Display::returnIconPath('canvas1024x768.png'); |
| 135 | 135 | // |
| 136 | 136 | $pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn'); |
| 137 | -$langpixlr = api_get_language_isocode(); |
|
| 137 | +$langpixlr = api_get_language_isocode(); |
|
| 138 | 138 | $langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr; |
| 139 | -$loc=$langpixlr;// deprecated ?? TODO:check pixlr read user browser |
|
| 140 | - |
|
| 141 | -$exit_path=api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php'; |
|
| 142 | -$_SESSION['exit_pixlr']=$document_data['path']; |
|
| 143 | -$referrer="Chamilo"; |
|
| 144 | -$target_path=api_get_path(WEB_CODE_PATH).'document/save_pixlr.php'; |
|
| 145 | -$target=$target_path; |
|
| 146 | -$locktarget="true"; |
|
| 147 | -$locktitle="false"; |
|
| 148 | - |
|
| 149 | -if ($_SERVER['HTTP_HOST']=="localhost") { |
|
| 150 | - $path_and_file= api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml'; |
|
| 139 | +$loc = $langpixlr; // deprecated ?? TODO:check pixlr read user browser |
|
| 140 | + |
|
| 141 | +$exit_path = api_get_path(WEB_CODE_PATH).'document/exit_pixlr.php'; |
|
| 142 | +$_SESSION['exit_pixlr'] = $document_data['path']; |
|
| 143 | +$referrer = "Chamilo"; |
|
| 144 | +$target_path = api_get_path(WEB_CODE_PATH).'document/save_pixlr.php'; |
|
| 145 | +$target = $target_path; |
|
| 146 | +$locktarget = "true"; |
|
| 147 | +$locktitle = "false"; |
|
| 148 | + |
|
| 149 | +if ($_SERVER['HTTP_HOST'] == "localhost") { |
|
| 150 | + $path_and_file = api_get_path(SYS_SERVER_ROOT_PATH).'/crossdomain.xml'; |
|
| 151 | 151 | if (!file_exists($path_and_file)) { |
| 152 | - $crossdomain='<?xml version="1.0"?> |
|
| 152 | + $crossdomain = '<?xml version="1.0"?> |
|
| 153 | 153 | <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> |
| 154 | 154 | <cross-domain-policy> |
| 155 | 155 | <allow-access-from domain="cdn.pixlr.com" /> |