@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For licensing terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * This tool allows platform admins to add users by uploading a CSV or XML file |
|
| 5 | - * @package chamilo.admin |
|
| 6 | - */ |
|
| 4 | + * This tool allows platform admins to add users by uploading a CSV or XML file |
|
| 5 | + * @package chamilo.admin |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Validate the imported data. |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | $user['error'] = get_lang('UserNameNotAvailable'); |
| 61 | 61 | $errors[] = $user; |
| 62 | 62 | } |
| 63 | - } |
|
| 64 | - } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | // 3. Check status. |
| 67 | 67 | if (isset($user['Status']) && !api_status_exists($user['Status'])) { |
@@ -242,10 +242,10 @@ discard block |
||
| 242 | 242 | return $users; |
| 243 | 243 | } |
| 244 | 244 | /** |
| 245 | - * XML-parser: handle start of element |
|
| 246 | - * @param string $parser Deprecated? |
|
| 247 | - * @param string $data The data to be parsed |
|
| 248 | - */ |
|
| 245 | + * XML-parser: handle start of element |
|
| 246 | + * @param string $parser Deprecated? |
|
| 247 | + * @param string $data The data to be parsed |
|
| 248 | + */ |
|
| 249 | 249 | function element_start($parser, $data) |
| 250 | 250 | { |
| 251 | 251 | $data = api_utf8_decode($data); |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | // We are sure that the extra field exists. |
| 216 | 216 | foreach ($extra_fields as $extras) { |
| 217 | 217 | if (isset($user[$extras[1]])) { |
| 218 | - $key = $extras[1]; |
|
| 219 | - $value = $user[$extras[1]]; |
|
| 218 | + $key = $extras[1]; |
|
| 219 | + $value = $user[$extras[1]]; |
|
| 220 | 220 | UserManager::update_extra_field_value($user_id, $key, $value); |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | global $current_tag; |
| 254 | 254 | switch ($data) { |
| 255 | 255 | case 'Contact': |
| 256 | - $user = array (); |
|
| 256 | + $user = array(); |
|
| 257 | 257 | break; |
| 258 | 258 | default: |
| 259 | 259 | $current_tag = $data; |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | if (in_array($ext_import_file, $allowed_file_mimetype)) { |
| 352 | 352 | if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) { |
| 353 | - $users = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
| 353 | + $users = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
| 354 | 354 | $errors = validate_data($users); |
| 355 | 355 | $error_kind_file = false; |
| 356 | 356 | } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) { |
@@ -454,7 +454,10 @@ |
||
| 454 | 454 | <blockquote> |
| 455 | 455 | <pre> |
| 456 | 456 | <b>UserName</b>;LastName;FirstName;Email;NewUserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;Active;Language;Courses;ClassId; |
| 457 | - xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></span>xxx1|xxx2|xxx3;1;<br /> |
|
| 457 | + xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) { |
|
| 458 | + echo implode(';', $list_reponse).';'; |
|
| 459 | +} |
|
| 460 | +?></span>xxx1|xxx2|xxx3;1;<br /> |
|
| 458 | 461 | </pre> |
| 459 | 462 | </blockquote> |
| 460 | 463 | <p><?php |
@@ -241,10 +241,10 @@ |
||
| 241 | 241 | return $users; |
| 242 | 242 | } |
| 243 | 243 | /** |
| 244 | - * XML-parser: handle start of element |
|
| 245 | - * @param string $parser Deprecated? |
|
| 246 | - * @param string $data The data to be parsed |
|
| 247 | - */ |
|
| 244 | + * XML-parser: handle start of element |
|
| 245 | + * @param string $parser Deprecated? |
|
| 246 | + * @param string $data The data to be parsed |
|
| 247 | + */ |
|
| 248 | 248 | function element_start($parser, $data) |
| 249 | 249 | { |
| 250 | 250 | $data = api_utf8_decode($data); |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | // We are sure that the extra field exists. |
| 216 | 216 | foreach ($extra_fields as $extras) { |
| 217 | 217 | if (isset($user[$extras[1]])) { |
| 218 | - $key = $extras[1]; |
|
| 219 | - $value = $user[$extras[1]]; |
|
| 218 | + $key = $extras[1]; |
|
| 219 | + $value = $user[$extras[1]]; |
|
| 220 | 220 | UserManager::update_extra_field_value($user_id, $key, $value); |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | global $current_tag; |
| 253 | 253 | switch ($data) { |
| 254 | 254 | case 'Contact': |
| 255 | - $user = array (); |
|
| 255 | + $user = array(); |
|
| 256 | 256 | break; |
| 257 | 257 | default: |
| 258 | 258 | $current_tag = $data; |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $allowed_file_mimetype = array('csv', 'xml'); |
| 346 | 346 | $error_kind_file = false; |
| 347 | 347 | |
| 348 | - $checkUniqueEmail = isset($_POST['check_unique_email']) ? $_POST['check_unique_email'] :null; |
|
| 348 | + $checkUniqueEmail = isset($_POST['check_unique_email']) ? $_POST['check_unique_email'] : null; |
|
| 349 | 349 | |
| 350 | 350 | $uploadInfo = pathinfo($_FILES['import_file']['name']); |
| 351 | 351 | $ext_import_file = $uploadInfo['extension']; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | if (strcmp($file_type, 'csv') === 0 && |
| 355 | 355 | $ext_import_file == $allowed_file_mimetype[0] |
| 356 | 356 | ) { |
| 357 | - $users = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
| 357 | + $users = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
| 358 | 358 | $errors = validate_data($users, $checkUniqueEmail); |
| 359 | 359 | $error_kind_file = false; |
| 360 | 360 | } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) { |
@@ -288,7 +288,7 @@ |
||
| 288 | 288 | * This function defines globals. |
| 289 | 289 | * @param int $userId |
| 290 | 290 | * |
| 291 | - * @return bool False on failure, redirection on success |
|
| 291 | + * @return false|null False on failure, redirection on success |
|
| 292 | 292 | * @author Evie Embrechts |
| 293 | 293 | * @author Yannick Warnier <[email protected]> |
| 294 | 294 | */ |
@@ -308,13 +308,13 @@ discard block |
||
| 308 | 308 | $firstname = $userInfo['firstname']; |
| 309 | 309 | $lastname = $userInfo['lastname']; |
| 310 | 310 | |
| 311 | - if (api_is_western_name_order()) { |
|
| 312 | - $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); |
|
| 313 | - } else { |
|
| 314 | - $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
| 315 | - } |
|
| 311 | + if (api_is_western_name_order()) { |
|
| 312 | + $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); |
|
| 313 | + } else { |
|
| 314 | + $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | - if ($userId) { |
|
| 317 | + if ($userId) { |
|
| 318 | 318 | |
| 319 | 319 | // Logout the current user |
| 320 | 320 | LoginDelete(api_get_user_id()); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | Display :: display_footer(); |
| 350 | 350 | exit; |
| 351 | 351 | |
| 352 | - } |
|
| 352 | + } |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | }*/ |
| 389 | 389 | |
| 390 | 390 | if (!in_array($direction, array('ASC','DESC'))) { |
| 391 | - $direction = 'ASC'; |
|
| 391 | + $direction = 'ASC'; |
|
| 392 | 392 | } |
| 393 | 393 | $column = intval($column); |
| 394 | 394 | $from = intval($from); |
@@ -399,23 +399,23 @@ discard block |
||
| 399 | 399 | $sql .= " WHERE u.creator_id = ".api_get_user_id(); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - $sql .= " ORDER BY col$column $direction "; |
|
| 403 | - $sql .= " LIMIT $from,$number_of_items"; |
|
| 402 | + $sql .= " ORDER BY col$column $direction "; |
|
| 403 | + $sql .= " LIMIT $from,$number_of_items"; |
|
| 404 | 404 | |
| 405 | - $res = Database::query($sql); |
|
| 405 | + $res = Database::query($sql); |
|
| 406 | 406 | |
| 407 | - $users = array (); |
|
| 407 | + $users = array (); |
|
| 408 | 408 | $t = time(); |
| 409 | - while ($user = Database::fetch_row($res)) { |
|
| 410 | - $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
| 411 | - $photo = '<img src="'.$userPicture.'" width="22" height="22" alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />'; |
|
| 409 | + while ($user = Database::fetch_row($res)) { |
|
| 410 | + $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
| 411 | + $photo = '<img src="'.$userPicture.'" width="22" height="22" alt="'.api_get_person_name($user[2], $user[3]).'" title="'.api_get_person_name($user[2], $user[3]).'" />'; |
|
| 412 | 412 | |
| 413 | 413 | if ($user[7] == 1 && !empty($user[10])) { |
| 414 | 414 | // check expiration date |
| 415 | 415 | $expiration_time = convert_sql_date($user[10]); |
| 416 | 416 | // if expiration date is passed, store a special value for active field |
| 417 | 417 | if ($expiration_time < $t) { |
| 418 | - $user[7] = '-1'; |
|
| 418 | + $user[7] = '-1'; |
|
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
@@ -433,9 +433,9 @@ discard block |
||
| 433 | 433 | api_get_local_time($user[9]), |
| 434 | 434 | $user[0] |
| 435 | 435 | ); |
| 436 | - } |
|
| 436 | + } |
|
| 437 | 437 | |
| 438 | - return $users; |
|
| 438 | + return $users; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | * @return string HTML-code with a mailto-link |
| 445 | 445 | */ |
| 446 | 446 | function email_filter($email) { |
| 447 | - return Display :: encrypted_mailto_link($email, $email); |
|
| 447 | + return Display :: encrypted_mailto_link($email, $email); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | /** |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * @return string HTML-code with a mailto-link |
| 454 | 454 | */ |
| 455 | 455 | function user_filter($name, $params, $row) { |
| 456 | - return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
| 456 | + return '<a href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | /** |
@@ -464,84 +464,84 @@ discard block |
||
| 464 | 464 | * @return string Some HTML-code with modify-buttons |
| 465 | 465 | */ |
| 466 | 466 | function modify_filter($user_id, $url_params, $row) { |
| 467 | - global $charset, $_admins_list; |
|
| 468 | - $is_admin = in_array($user_id,$_admins_list); |
|
| 469 | - $statusname = api_get_status_langvars(); |
|
| 470 | - $user_is_anonymous = false; |
|
| 467 | + global $charset, $_admins_list; |
|
| 468 | + $is_admin = in_array($user_id,$_admins_list); |
|
| 469 | + $statusname = api_get_status_langvars(); |
|
| 470 | + $user_is_anonymous = false; |
|
| 471 | 471 | $current_user_status_label = $row['7']; |
| 472 | 472 | |
| 473 | - if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
| 474 | - $user_is_anonymous =true; |
|
| 475 | - } |
|
| 476 | - $result = ''; |
|
| 477 | - if (!$user_is_anonymous) { |
|
| 478 | - $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')')); |
|
| 479 | - $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
| 473 | + if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
| 474 | + $user_is_anonymous =true; |
|
| 475 | + } |
|
| 476 | + $result = ''; |
|
| 477 | + if (!$user_is_anonymous) { |
|
| 478 | + $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')')); |
|
| 479 | + $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
| 480 | 480 | '.$icon.' |
| 481 | 481 | <div class="blackboard_hide" id="div_'.$user_id.'"> </div> |
| 482 | 482 | </a>'; |
| 483 | 483 | |
| 484 | 484 | $icon = Display::return_icon('session.png', get_lang('Sessions'), array('onmouseout' => 'clear_session_list (\'div_s_'.$user_id.'\')')); |
| 485 | - $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
| 485 | + $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
| 486 | 486 | '.$icon.' |
| 487 | 487 | <div class="blackboard_hide" id="div_s_'.$user_id.'"> </div> |
| 488 | 488 | </a>'; |
| 489 | - } else { |
|
| 490 | - $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
| 491 | - $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
| 492 | - } |
|
| 489 | + } else { |
|
| 490 | + $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
| 491 | + $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
| 492 | + } |
|
| 493 | 493 | |
| 494 | - if (api_is_platform_admin()) { |
|
| 495 | - if (!$user_is_anonymous) { |
|
| 496 | - $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a> '; |
|
| 497 | - } else { |
|
| 498 | - $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).' '; |
|
| 499 | - } |
|
| 500 | - } |
|
| 494 | + if (api_is_platform_admin()) { |
|
| 495 | + if (!$user_is_anonymous) { |
|
| 496 | + $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a> '; |
|
| 497 | + } else { |
|
| 498 | + $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).' '; |
|
| 499 | + } |
|
| 500 | + } |
|
| 501 | 501 | |
| 502 | 502 | //only allow platform admins to login_as, or session admins only for students (not teachers nor other admins) |
| 503 | 503 | if (api_is_platform_admin() || (api_is_session_admin() && $current_user_status_label == $statusname[STUDENT])) { |
| 504 | - if (!$user_is_anonymous) { |
|
| 504 | + if (!$user_is_anonymous) { |
|
| 505 | 505 | if (api_global_admin_can_edit_admin($user_id)) { |
| 506 | 506 | $result .= '<a href="user_list.php?action=login_as&user_id='.$user_id.'&sec_token='.$_SESSION['sec_token'].'">'.Display::return_icon('login_as.png', get_lang('LoginAs')).'</a> '; |
| 507 | 507 | } else { |
| 508 | 508 | $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
| 509 | 509 | } |
| 510 | - } else { |
|
| 511 | - $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 512 | - } |
|
| 510 | + } else { |
|
| 511 | + $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 512 | + } |
|
| 513 | 513 | } else { |
| 514 | - $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 514 | + $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if ($current_user_status_label != $statusname[STUDENT]) { |
|
| 518 | - $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).' '; |
|
| 519 | - } else { |
|
| 520 | - $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a> '; |
|
| 521 | - } |
|
| 517 | + if ($current_user_status_label != $statusname[STUDENT]) { |
|
| 518 | + $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).' '; |
|
| 519 | + } else { |
|
| 520 | + $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a> '; |
|
| 521 | + } |
|
| 522 | 522 | |
| 523 | - if (api_is_platform_admin(true)) { |
|
| 523 | + if (api_is_platform_admin(true)) { |
|
| 524 | 524 | $editProfileUrl = Display::getProfileEditionLink($user_id, true); |
| 525 | 525 | |
| 526 | 526 | if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) { |
| 527 | 527 | $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
| 528 | - } else { |
|
| 528 | + } else { |
|
| 529 | 529 | $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
| 530 | - } |
|
| 531 | - } |
|
| 530 | + } |
|
| 531 | + } |
|
| 532 | 532 | |
| 533 | - if ($is_admin) { |
|
| 534 | - $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 535 | - } else { |
|
| 536 | - $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
| 537 | - } |
|
| 533 | + if ($is_admin) { |
|
| 534 | + $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 535 | + } else { |
|
| 536 | + $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
| 537 | + } |
|
| 538 | 538 | |
| 539 | - // actions for assigning sessions, courses or users |
|
| 540 | - if (api_is_session_admin()) { |
|
| 541 | - /*if ($row[0] == api_get_user_id()) { |
|
| 539 | + // actions for assigning sessions, courses or users |
|
| 540 | + if (api_is_session_admin()) { |
|
| 541 | + /*if ($row[0] == api_get_user_id()) { |
|
| 542 | 542 | $result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a> '; |
| 543 | 543 | }*/ |
| 544 | - } else { |
|
| 544 | + } else { |
|
| 545 | 545 | if ($current_user_status_label == $statusname[SESSIONADMIN]) { |
| 546 | 546 | $result .= Display::url( |
| 547 | 547 | Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')), |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | ); |
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | - } |
|
| 574 | + } |
|
| 575 | 575 | |
| 576 | 576 | if (api_is_platform_admin()) { |
| 577 | 577 | $result .= ' <a href="'.api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?a=get_user_agenda&user_id='.$user_id.'&modal_size=lg" class="agenda_opener ajax">'. |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | - return $result; |
|
| 592 | + return $result; |
|
| 593 | 593 | } |
| 594 | 594 | |
| 595 | 595 | |
@@ -622,10 +622,10 @@ discard block |
||
| 622 | 622 | if ($action == 'edit') { |
| 623 | 623 | $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16); |
| 624 | 624 | } elseif ($row['0']<>$_user['user_id']) { |
| 625 | - // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
|
| 626 | - $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
|
| 627 | - } |
|
| 628 | - return $result; |
|
| 625 | + // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
|
| 626 | + $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
|
| 627 | + } |
|
| 628 | + return $result; |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
@@ -638,8 +638,8 @@ discard block |
||
| 638 | 638 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
| 639 | 639 | */ |
| 640 | 640 | function status_filter($status) { |
| 641 | - $statusname = api_get_status_langvars(); |
|
| 642 | - return $statusname[$status]; |
|
| 641 | + $statusname = api_get_status_langvars(); |
|
| 642 | + return $statusname[$status]; |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) { |
@@ -655,8 +655,8 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | if (!empty($action)) { |
| 657 | 657 | $check = Security::check_token('get'); |
| 658 | - if ($check) { |
|
| 659 | - switch ($action) { |
|
| 658 | + if ($check) { |
|
| 659 | + switch ($action) { |
|
| 660 | 660 | case 'add_user_to_my_url': |
| 661 | 661 | $user_id = $_REQUEST["user_id"]; |
| 662 | 662 | $result = UrlManager::add_user_to_url($user_id, $current_access_url_id); |
@@ -666,45 +666,45 @@ discard block |
||
| 666 | 666 | $message = Display::return_message($message, 'confirmation'); |
| 667 | 667 | } |
| 668 | 668 | break; |
| 669 | - case 'delete_user': |
|
| 670 | - if (api_is_platform_admin()) { |
|
| 669 | + case 'delete_user': |
|
| 670 | + if (api_is_platform_admin()) { |
|
| 671 | 671 | $user_to_delete = $_GET['user_id']; |
| 672 | 672 | $current_user_id = api_get_user_id(); |
| 673 | 673 | |
| 674 | - if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
| 675 | - if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
| 676 | - $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation'); |
|
| 677 | - } else { |
|
| 678 | - $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
| 679 | - } |
|
| 680 | - } else { |
|
| 681 | - $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
| 682 | - } |
|
| 683 | - } |
|
| 684 | - break; |
|
| 674 | + if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
| 675 | + if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
| 676 | + $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation'); |
|
| 677 | + } else { |
|
| 678 | + $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
| 679 | + } |
|
| 680 | + } else { |
|
| 681 | + $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
| 682 | + } |
|
| 683 | + } |
|
| 684 | + break; |
|
| 685 | 685 | case 'delete': |
| 686 | - if (api_is_platform_admin()) { |
|
| 687 | - $number_of_selected_users = count($_POST['id']); |
|
| 688 | - $number_of_deleted_users = 0; |
|
| 689 | - if (is_array($_POST['id'])) { |
|
| 690 | - foreach ($_POST['id'] as $index => $user_id) { |
|
| 691 | - if($user_id != $_user['user_id']) { |
|
| 692 | - if(UserManager :: delete_user($user_id)) { |
|
| 693 | - $number_of_deleted_users++; |
|
| 694 | - } |
|
| 695 | - } |
|
| 696 | - } |
|
| 697 | - } |
|
| 698 | - if ($number_of_selected_users == $number_of_deleted_users) { |
|
| 686 | + if (api_is_platform_admin()) { |
|
| 687 | + $number_of_selected_users = count($_POST['id']); |
|
| 688 | + $number_of_deleted_users = 0; |
|
| 689 | + if (is_array($_POST['id'])) { |
|
| 690 | + foreach ($_POST['id'] as $index => $user_id) { |
|
| 691 | + if($user_id != $_user['user_id']) { |
|
| 692 | + if(UserManager :: delete_user($user_id)) { |
|
| 693 | + $number_of_deleted_users++; |
|
| 694 | + } |
|
| 695 | + } |
|
| 696 | + } |
|
| 697 | + } |
|
| 698 | + if ($number_of_selected_users == $number_of_deleted_users) { |
|
| 699 | 699 | $message = Display :: return_message(get_lang('SelectedUsersDeleted'), 'confirmation'); |
| 700 | - } else { |
|
| 700 | + } else { |
|
| 701 | 701 | $message = Display :: return_message(get_lang('SomeUsersNotDeleted'), 'error'); |
| 702 | - } |
|
| 703 | - } |
|
| 704 | - break; |
|
| 705 | - } |
|
| 706 | - Security::clear_token(); |
|
| 707 | - } |
|
| 702 | + } |
|
| 703 | + } |
|
| 704 | + break; |
|
| 705 | + } |
|
| 706 | + Security::clear_token(); |
|
| 707 | + } |
|
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | // Create a search-box |
@@ -724,24 +724,24 @@ discard block |
||
| 724 | 724 | |
| 725 | 725 | $actions = ''; |
| 726 | 726 | if (api_is_platform_admin()) { |
| 727 | - $actions .= '<div style="float:right;">'. |
|
| 728 | - '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
| 729 | - Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
| 730 | - '</div>'; |
|
| 727 | + $actions .= '<div style="float:right;">'. |
|
| 728 | + '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
| 729 | + Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
| 730 | + '</div>'; |
|
| 731 | 731 | } |
| 732 | 732 | $actions .= $form->return_form(); |
| 733 | 733 | |
| 734 | 734 | if (isset ($_GET['keyword'])) { |
| 735 | - $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 735 | + $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 736 | 736 | } elseif (isset ($_GET['keyword_firstname'])) { |
| 737 | - $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
|
| 738 | - $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
|
| 739 | - $parameters['keyword_username'] = Security::remove_XSS($_GET['keyword_username']); |
|
| 740 | - $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']); |
|
| 741 | - $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
|
| 742 | - $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
|
| 743 | - $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
|
| 744 | - $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 737 | + $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
|
| 738 | + $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
|
| 739 | + $parameters['keyword_username'] = Security::remove_XSS($_GET['keyword_username']); |
|
| 740 | + $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']); |
|
| 741 | + $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
|
| 742 | + $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
|
| 743 | + $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
|
| 744 | + $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 745 | 745 | } |
| 746 | 746 | // Create a sortable table with user-data |
| 747 | 747 | $parameters['sec_token'] = Security::get_token(); |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | $res_admin = Database::query($sql_admin); |
| 753 | 753 | $_admins_list = array(); |
| 754 | 754 | while ($row_admin = Database::fetch_row($res_admin)) { |
| 755 | - $_admins_list[] = $row_admin[0]; |
|
| 755 | + $_admins_list[] = $row_admin[0]; |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | // Display Advanced search form. |
@@ -808,11 +808,11 @@ discard block |
||
| 808 | 808 | $table->set_header(2, get_lang('OfficialCode')); |
| 809 | 809 | |
| 810 | 810 | if (api_is_western_name_order()) { |
| 811 | - $table->set_header(3, get_lang('FirstName')); |
|
| 812 | - $table->set_header(4, get_lang('LastName')); |
|
| 811 | + $table->set_header(3, get_lang('FirstName')); |
|
| 812 | + $table->set_header(4, get_lang('LastName')); |
|
| 813 | 813 | } else { |
| 814 | - $table->set_header(3, get_lang('LastName')); |
|
| 815 | - $table->set_header(4, get_lang('FirstName')); |
|
| 814 | + $table->set_header(3, get_lang('LastName')); |
|
| 815 | + $table->set_header(4, get_lang('FirstName')); |
|
| 816 | 816 | } |
| 817 | 817 | $table->set_header(5, get_lang('LoginName')); |
| 818 | 818 | $table->set_header(6, get_lang('Email')); |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | function display_advanced_search_form () { |
| 108 | 108 | if ($("#advanced_search_form").css("display") == "none") { |
| 109 | 109 | $("#advanced_search_form").css("display","block"); |
| 110 | - $("#img_plus_and_minus").html(\' '.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'\'); |
|
| 110 | + $("#img_plus_and_minus").html(\' '.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'\'); |
|
| 111 | 111 | } else { |
| 112 | 112 | $("#advanced_search_form").css("display","none"); |
| 113 | - $("#img_plus_and_minus").html(\' '.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'\'); |
|
| 113 | + $("#img_plus_and_minus").html(\' '.Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'\'); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // adding the filter to see the user's only of the current access_url |
| 189 | 189 | if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) { |
| 190 | 190 | $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
| 191 | - $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.id=url_rel_user.user_id)"; |
|
| 191 | + $sql .= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.id=url_rel_user.user_id)"; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $keywordList = array( |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | if (isset($keyword_extra_data) && !empty($keyword_extra_data)) { |
| 220 | 220 | $extra_info = UserManager::get_extra_field_information_by_name($keyword_extra_data); |
| 221 | 221 | $field_id = $extra_info['id']; |
| 222 | - $sql.= " INNER JOIN user_field_values ufv ON u.id=ufv.user_id AND ufv.field_id=$field_id "; |
|
| 222 | + $sql .= " INNER JOIN user_field_values ufv ON u.id=ufv.user_id AND ufv.field_id=$field_id "; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | if (isset($_GET['keyword']) && !empty($_GET['keyword'])) { |
| 226 | - $keywordFiltered = Database::escape_string("%". $_GET['keyword'] ."%"); |
|
| 226 | + $keywordFiltered = Database::escape_string("%".$_GET['keyword']."%"); |
|
| 227 | 227 | $sql .= " WHERE ( |
| 228 | 228 | u.firstname LIKE '$keywordFiltered' OR |
| 229 | 229 | u.lastname LIKE '$keywordFiltered' OR |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | $sql .= " $query_admin_table |
| 256 | 256 | WHERE ( |
| 257 | - u.firstname LIKE '". Database::escape_string("%".$keywordListValues['keyword_firstname']."%")."' AND |
|
| 257 | + u.firstname LIKE '".Database::escape_string("%".$keywordListValues['keyword_firstname']."%")."' AND |
|
| 258 | 258 | u.lastname LIKE '". Database::escape_string("%".$keywordListValues['keyword_lastname']."%")."' AND |
| 259 | 259 | u.username LIKE '". Database::escape_string("%".$keywordListValues['keyword_username']."%")."' AND |
| 260 | 260 | u.email LIKE '". Database::escape_string("%".$keywordListValues['keyword_email']."%")."' AND |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $lastname = $userInfo['lastname']; |
| 310 | 310 | |
| 311 | 311 | if (api_is_western_name_order()) { |
| 312 | - $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); |
|
| 312 | + $message = sprintf(get_lang('AttemptingToLoginAs'), $firstname, $lastname, $userId); |
|
| 313 | 313 | } else { |
| 314 | 314 | $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
| 315 | 315 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | Session::write('login_as', true); |
| 344 | 344 | |
| 345 | 345 | $target_url = api_get_path(WEB_PATH)."user_portal.php"; |
| 346 | - $message .= '<br />'.sprintf(get_lang('LoginSuccessfulGoToX'),'<a href="'.$target_url.'">'.$target_url.'</a>'); |
|
| 346 | + $message .= '<br />'.sprintf(get_lang('LoginSuccessfulGoToX'), '<a href="'.$target_url.'">'.$target_url.'</a>'); |
|
| 347 | 347 | Display :: display_header(get_lang('UserList')); |
| 348 | 348 | Display :: display_normal_message($message, false); |
| 349 | 349 | Display :: display_footer(); |
@@ -387,11 +387,11 @@ discard block |
||
| 387 | 387 | $sql .= "AND password LIKE '$easyPassword' "; |
| 388 | 388 | }*/ |
| 389 | 389 | |
| 390 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
| 390 | + if (!in_array($direction, array('ASC', 'DESC'))) { |
|
| 391 | 391 | $direction = 'ASC'; |
| 392 | 392 | } |
| 393 | 393 | $column = intval($column); |
| 394 | - $from = intval($from); |
|
| 394 | + $from = intval($from); |
|
| 395 | 395 | $number_of_items = intval($number_of_items); |
| 396 | 396 | |
| 397 | 397 | $preventSessionAdminsToManageAllUsers = api_get_setting('prevent_session_admins_to_manage_all_users'); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | $res = Database::query($sql); |
| 406 | 406 | |
| 407 | - $users = array (); |
|
| 407 | + $users = array(); |
|
| 408 | 408 | $t = time(); |
| 409 | 409 | while ($user = Database::fetch_row($res)) { |
| 410 | 410 | $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
@@ -465,13 +465,13 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | function modify_filter($user_id, $url_params, $row) { |
| 467 | 467 | global $charset, $_admins_list; |
| 468 | - $is_admin = in_array($user_id,$_admins_list); |
|
| 468 | + $is_admin = in_array($user_id, $_admins_list); |
|
| 469 | 469 | $statusname = api_get_status_langvars(); |
| 470 | 470 | $user_is_anonymous = false; |
| 471 | 471 | $current_user_status_label = $row['7']; |
| 472 | 472 | |
| 473 | 473 | if ($current_user_status_label == $statusname[ANONYMOUS]) { |
| 474 | - $user_is_anonymous =true; |
|
| 474 | + $user_is_anonymous = true; |
|
| 475 | 475 | } |
| 476 | 476 | $result = ''; |
| 477 | 477 | if (!$user_is_anonymous) { |
@@ -487,8 +487,8 @@ discard block |
||
| 487 | 487 | <div class="blackboard_hide" id="div_s_'.$user_id.'"> </div> |
| 488 | 488 | </a>'; |
| 489 | 489 | } else { |
| 490 | - $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
| 491 | - $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
| 490 | + $result .= Display::return_icon('course_na.png', get_lang('Courses')).' '; |
|
| 491 | + $result .= Display::return_icon('course_na.png', get_lang('Sessions')).' '; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | if (api_is_platform_admin()) { |
@@ -524,14 +524,14 @@ discard block |
||
| 524 | 524 | $editProfileUrl = Display::getProfileEditionLink($user_id, true); |
| 525 | 525 | |
| 526 | 526 | if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) { |
| 527 | - $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
|
| 527 | + $result .= '<a href="'.$editProfileUrl.'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
|
| 528 | 528 | } else { |
| 529 | 529 | $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | if ($is_admin) { |
| 534 | - $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 534 | + $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'), array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 535 | 535 | } else { |
| 536 | 536 | $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
| 537 | 537 | } |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | api_global_admin_can_edit_admin($user_id) |
| 584 | 584 | ) { |
| 585 | 585 | // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
| 586 | - $result .= ' <a href="user_list.php?action=delete_user&user_id='.$user_id.'&'.$url_params.'&sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 586 | + $result .= ' <a href="user_list.php?action=delete_user&user_id='.$user_id.'&'.$url_params.'&sec_token='.$_SESSION['sec_token'].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
|
| 587 | 587 | } else { |
| 588 | 588 | $result .= Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL); |
| 589 | 589 | } |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | |
| 622 | 622 | if ($action == 'edit') { |
| 623 | 623 | $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16); |
| 624 | - } elseif ($row['0']<>$_user['user_id']) { |
|
| 624 | + } elseif ($row['0'] <> $_user['user_id']) { |
|
| 625 | 625 | // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. |
| 626 | 626 | $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
| 627 | 627 | } |
@@ -643,11 +643,11 @@ discard block |
||
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) { |
| 646 | - $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
| 647 | - $interbreadcrumb[] = array ("url" => 'user_list.php', "name" => get_lang('UserList')); |
|
| 646 | + $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
| 647 | + $interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList')); |
|
| 648 | 648 | $tool_name = get_lang('SearchUsers'); |
| 649 | 649 | } else { |
| 650 | - $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
| 650 | + $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
| 651 | 651 | $tool_name = get_lang('UserList'); |
| 652 | 652 | } |
| 653 | 653 | |
@@ -660,10 +660,10 @@ discard block |
||
| 660 | 660 | case 'add_user_to_my_url': |
| 661 | 661 | $user_id = $_REQUEST["user_id"]; |
| 662 | 662 | $result = UrlManager::add_user_to_url($user_id, $current_access_url_id); |
| 663 | - if ($result ) { |
|
| 663 | + if ($result) { |
|
| 664 | 664 | $user_info = api_get_user_info($user_id); |
| 665 | 665 | $message = get_lang('UserAdded').' '.$user_info['firstname'].' '.$user_info['lastname'].' ('.$user_info['username'].')'; |
| 666 | - $message = Display::return_message($message, 'confirmation'); |
|
| 666 | + $message = Display::return_message($message, 'confirmation'); |
|
| 667 | 667 | } |
| 668 | 668 | break; |
| 669 | 669 | case 'delete_user': |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
| 679 | 679 | } |
| 680 | 680 | } else { |
| 681 | - $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
| 681 | + $message = Display :: return_message(get_lang('CannotDeleteUser'), 'error'); |
|
| 682 | 682 | } |
| 683 | 683 | } |
| 684 | 684 | break; |
@@ -688,8 +688,8 @@ discard block |
||
| 688 | 688 | $number_of_deleted_users = 0; |
| 689 | 689 | if (is_array($_POST['id'])) { |
| 690 | 690 | foreach ($_POST['id'] as $index => $user_id) { |
| 691 | - if($user_id != $_user['user_id']) { |
|
| 692 | - if(UserManager :: delete_user($user_id)) { |
|
| 691 | + if ($user_id != $_user['user_id']) { |
|
| 692 | + if (UserManager :: delete_user($user_id)) { |
|
| 693 | 693 | $number_of_deleted_users++; |
| 694 | 694 | } |
| 695 | 695 | } |
@@ -722,17 +722,17 @@ discard block |
||
| 722 | 722 | </a>' |
| 723 | 723 | ); |
| 724 | 724 | |
| 725 | -$actions = ''; |
|
| 725 | +$actions = ''; |
|
| 726 | 726 | if (api_is_platform_admin()) { |
| 727 | 727 | $actions .= '<div style="float:right;">'. |
| 728 | 728 | '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
| 729 | - Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
| 729 | + Display::return_icon('new_user.png', get_lang('AddUsers'), '', ICON_SIZE_MEDIUM).'</a>'. |
|
| 730 | 730 | '</div>'; |
| 731 | 731 | } |
| 732 | 732 | $actions .= $form->return_form(); |
| 733 | 733 | |
| 734 | 734 | if (isset ($_GET['keyword'])) { |
| 735 | - $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 735 | + $parameters = array('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 736 | 736 | } elseif (isset ($_GET['keyword_firstname'])) { |
| 737 | 737 | $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
| 738 | 738 | $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
| 742 | 742 | $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
| 743 | 743 | $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
| 744 | - $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 744 | + $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 745 | 745 | } |
| 746 | 746 | // Create a sortable table with user-data |
| 747 | 747 | $parameters['sec_token'] = Security::get_token(); |
@@ -758,15 +758,15 @@ discard block |
||
| 758 | 758 | // Display Advanced search form. |
| 759 | 759 | $form = new FormValidator('advanced_search', 'get', '', '', array(), FormValidator::LAYOUT_HORIZONTAL); |
| 760 | 760 | |
| 761 | -$form->addElement('html','<div id="advanced_search_form" style="display:none;">'); |
|
| 761 | +$form->addElement('html', '<div id="advanced_search_form" style="display:none;">'); |
|
| 762 | 762 | $form->addElement('header', get_lang('AdvancedSearch')); |
| 763 | -$form->addText('keyword_firstname',get_lang('FirstName'),false); |
|
| 764 | -$form->addText('keyword_lastname',get_lang('LastName'),false); |
|
| 763 | +$form->addText('keyword_firstname', get_lang('FirstName'), false); |
|
| 764 | +$form->addText('keyword_lastname', get_lang('LastName'), false); |
|
| 765 | 765 | |
| 766 | -$form->addText('keyword_username',get_lang('LoginName'),false); |
|
| 767 | -$form->addText('keyword_email',get_lang('Email'),false); |
|
| 766 | +$form->addText('keyword_username', get_lang('LoginName'), false); |
|
| 767 | +$form->addText('keyword_email', get_lang('Email'), false); |
|
| 768 | 768 | |
| 769 | -$form->addText('keyword_officialcode',get_lang('OfficialCode'),false); |
|
| 769 | +$form->addText('keyword_officialcode', get_lang('OfficialCode'), false); |
|
| 770 | 770 | |
| 771 | 771 | $status_options = array(); |
| 772 | 772 | $status_options['%'] = get_lang('All'); |
@@ -776,12 +776,12 @@ discard block |
||
| 776 | 776 | $status_options[SESSIONADMIN] = get_lang('SessionsAdmin'); |
| 777 | 777 | $status_options[PLATFORM_ADMIN] = get_lang('Administrator'); |
| 778 | 778 | |
| 779 | -$form->addElement('select','keyword_status',get_lang('Profile'), $status_options ); |
|
| 779 | +$form->addElement('select', 'keyword_status', get_lang('Profile'), $status_options); |
|
| 780 | 780 | |
| 781 | 781 | $active_group = array(); |
| 782 | -$active_group[] = $form->createElement('checkbox','keyword_active','', get_lang('Active')); |
|
| 783 | -$active_group[] = $form->createElement('checkbox','keyword_inactive','', get_lang('Inactive')); |
|
| 784 | -$form->addGroup($active_group,'',get_lang('ActiveAccount'), '<br/>',false); |
|
| 782 | +$active_group[] = $form->createElement('checkbox', 'keyword_active', '', get_lang('Active')); |
|
| 783 | +$active_group[] = $form->createElement('checkbox', 'keyword_inactive', '', get_lang('Inactive')); |
|
| 784 | +$form->addGroup($active_group, '', get_lang('ActiveAccount'), '<br/>', false); |
|
| 785 | 785 | |
| 786 | 786 | $form->addElement('checkbox', 'check_easy_passwords', null, get_lang('CheckEasyPasswords')); |
| 787 | 787 | |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | $defaults['keyword_active'] = 1; |
| 793 | 793 | $defaults['keyword_inactive'] = 1; |
| 794 | 794 | $form->setDefaults($defaults); |
| 795 | -$form->addElement('html','</div>'); |
|
| 795 | +$form->addElement('html', '</div>'); |
|
| 796 | 796 | |
| 797 | 797 | $form = $form->returnForm(); |
| 798 | 798 | |
@@ -874,10 +874,10 @@ discard block |
||
| 874 | 874 | } |
| 875 | 875 | if ($add_user) { |
| 876 | 876 | $row_table = array(); |
| 877 | - $row_table[] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].') '; |
|
| 878 | - $row_table[] = $access_info_to_string; |
|
| 877 | + $row_table[] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].') '; |
|
| 878 | + $row_table[] = $access_info_to_string; |
|
| 879 | 879 | $url = api_get_self().'?action=add_user_to_my_url&user_id='.$user['id'].'&sec_token='.$_SESSION['sec_token']; |
| 880 | - $row_table[] = Display::url(get_lang('AddUserToMyURL'), $url, array('class' => 'btn')); |
|
| 880 | + $row_table[] = Display::url(get_lang('AddUserToMyURL'), $url, array('class' => 'btn')); |
|
| 881 | 881 | |
| 882 | 882 | foreach ($row_table as $cell) { |
| 883 | 883 | $table->setCellContents($row, $column, $cell); |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Available driver list. |
| 87 | - * @return array |
|
| 87 | + * @return string[] |
|
| 88 | 88 | */ |
| 89 | 89 | private function getDefaultDriverList() |
| 90 | 90 | { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct() |
| 23 | 23 | { |
| 24 | - $this->table = Database::get_main_table(TABLE_CAREER); |
|
| 24 | + $this->table = Database::get_main_table(TABLE_CAREER); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $promotion = new Promotion(); |
| 63 | 63 | $promotion_list = $promotion->get_all_promotions_by_career_id($career_id); |
| 64 | 64 | if (!empty($promotion_list)) { |
| 65 | - foreach($promotion_list as $item) { |
|
| 65 | + foreach ($promotion_list as $item) { |
|
| 66 | 66 | $params['id'] = $item['id']; |
| 67 | 67 | $params['status'] = $status; |
| 68 | 68 | $promotion->update($params); |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | public function display() |
| 78 | 78 | { |
| 79 | 79 | echo '<div class="actions" style="margin-bottom:20px">'; |
| 80 | - echo '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
|
| 81 | - echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('new_career.png',get_lang('Add'),'','32').'</a>'; |
|
| 80 | + echo '<a href="career_dashboard.php">'.Display::return_icon('back.png', get_lang('Back'), '', '32').'</a>'; |
|
| 81 | + echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('new_career.png', get_lang('Add'), '', '32').'</a>'; |
|
| 82 | 82 | echo '</div>'; |
| 83 | 83 | echo Display::grid_html('careers'); |
| 84 | 84 | } |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | if ($copy_promotions) { |
| 185 | 185 | //Now also copy each session of the promotion as a new session and register it inside the promotion |
| 186 | 186 | $promotion = new Promotion(); |
| 187 | - $promo_list = $promotion->get_all_promotions_by_career_id($id); |
|
| 187 | + $promo_list = $promotion->get_all_promotions_by_career_id($id); |
|
| 188 | 188 | if (!empty($promo_list)) { |
| 189 | - foreach($promo_list as $item) { |
|
| 189 | + foreach ($promo_list as $item) { |
|
| 190 | 190 | $pid = $promotion->copy($item['id'], $cid, true); |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function get_status($career_id) |
| 203 | 203 | { |
| 204 | - $TBL_CAREER = Database::get_main_table(TABLE_CAREER); |
|
| 204 | + $TBL_CAREER = Database::get_main_table(TABLE_CAREER); |
|
| 205 | 205 | $career_id = intval($career_id); |
| 206 | - $sql = "SELECT status FROM $TBL_CAREER WHERE id = '$career_id'"; |
|
| 206 | + $sql = "SELECT status FROM $TBL_CAREER WHERE id = '$career_id'"; |
|
| 207 | 207 | $result = Database::query($sql); |
| 208 | 208 | if (Database::num_rows($result) > 0) { |
| 209 | 209 | $data = Database::fetch_array($result); |
@@ -83,9 +83,9 @@ |
||
| 83 | 83 | |
| 84 | 84 | //With this function we can add actions to the jgrid (edit, delete, etc) |
| 85 | 85 | $action_links = 'function action_formatter(cellvalue, options, rowObject) { |
| 86 | - return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'. |
|
| 87 | - ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'. |
|
| 88 | - ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. |
|
| 86 | + return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'. |
|
| 87 | + ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png', get_lang('Copy'), '', ICON_SIZE_SMALL).'</a>'. |
|
| 88 | + ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'. |
|
| 89 | 89 | '\'; |
| 90 | 90 | }'; |
| 91 | 91 | ?> |
@@ -85,12 +85,12 @@ |
||
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | if(!empty($url_string)) { |
| 88 | - Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false); |
|
| 88 | + Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // checking the current installation |
| 92 | 92 | if ($current_access_url_id==-1) { |
| 93 | - Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)); |
|
| 93 | + Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)); |
|
| 94 | 94 | } elseif(api_is_platform_admin()) { |
| 95 | 95 | $quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id); |
| 96 | 96 | if ($quant==0) { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | exit; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -$interbreadcrumb[] = array ("url" => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
| 22 | +$interbreadcrumb[] = array("url" => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
| 23 | 23 | $tool_name = get_lang('MultipleAccessURLs'); |
| 24 | 24 | Display :: display_header($tool_name); |
| 25 | 25 | |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | case 'register': |
| 56 | 56 | // we are going to register the admin |
| 57 | 57 | if (api_is_platform_admin()) { |
| 58 | - if ($current_access_url_id!=-1) { |
|
| 58 | + if ($current_access_url_id != -1) { |
|
| 59 | 59 | $url_str = ''; |
| 60 | 60 | foreach ($url_list as $my_url) { |
| 61 | 61 | if (!in_array($my_url['id'], $my_user_url_list)) { |
| 62 | 62 | UrlManager::add_user_to_url(api_get_user_id(), $my_url['id']); |
| 63 | - $url_str.=$my_url['url'].' <br />'; |
|
| 63 | + $url_str .= $my_url['url'].' <br />'; |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | Display:: display_normal_message( |
@@ -84,16 +84,16 @@ discard block |
||
| 84 | 84 | $url_string .= $my_url['url'].' <br />'; |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | -if(!empty($url_string)) { |
|
| 88 | - Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string,false); |
|
| 87 | +if (!empty($url_string)) { |
|
| 88 | + Display :: display_warning_message(get_lang('AdminShouldBeRegisterInSite').'<br />'.$url_string, false); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // checking the current installation |
| 92 | -if ($current_access_url_id==-1) { |
|
| 92 | +if ($current_access_url_id == -1) { |
|
| 93 | 93 | Display::display_warning_message(get_lang('URLNotConfiguredPleaseChangedTo').': '.api_get_path(WEB_PATH)); |
| 94 | -} elseif(api_is_platform_admin()) { |
|
| 95 | - $quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id); |
|
| 96 | - if ($quant==0) { |
|
| 94 | +} elseif (api_is_platform_admin()) { |
|
| 95 | + $quant = UrlManager::relation_url_user_exist(api_get_user_id(), $current_access_url_id); |
|
| 96 | + if ($quant == 0) { |
|
| 97 | 97 | Display:: display_warning_message( |
| 98 | 98 | '<a href="'.api_get_self().'?action=register&sec_token='.$parameters['sec_token'].'">'.get_lang('ClickToRegisterAdmin').'</a>', |
| 99 | 99 | false |
@@ -142,16 +142,16 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | //Status |
| 144 | 144 | $active = $row['active']; |
| 145 | - if ($active=='1') { |
|
| 146 | - $action='lock'; |
|
| 147 | - $image='right'; |
|
| 145 | + if ($active == '1') { |
|
| 146 | + $action = 'lock'; |
|
| 147 | + $image = 'right'; |
|
| 148 | 148 | } |
| 149 | - if ($active=='0') { |
|
| 150 | - $action='unlock'; |
|
| 151 | - $image='wrong'; |
|
| 149 | + if ($active == '0') { |
|
| 150 | + $action = 'unlock'; |
|
| 151 | + $image = 'wrong'; |
|
| 152 | 152 | } |
| 153 | 153 | // you cannot lock the default |
| 154 | - if ($row['id']=='1') { |
|
| 154 | + if ($row['id'] == '1') { |
|
| 155 | 155 | $status = Display::return_icon($image.'.gif', get_lang(ucfirst($action))); |
| 156 | 156 | } else { |
| 157 | 157 | $status = '<a href="access_urls.php?action='.$action.'&url_id='.$row['id'].'">'. |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $url_id = $row['id']; |
| 162 | 162 | $actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id"); |
| 163 | 163 | if ($url_id != '1') { |
| 164 | - $actions .= '<a href="access_urls.php?action=delete_url&url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'. |
|
| 164 | + $actions .= '<a href="access_urls.php?action=delete_url&url_id='.$url_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'. |
|
| 165 | 165 | Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).'</a>'; |
| 166 | 166 | } |
| 167 | 167 | $urls[] = array($url, $description, $status, $actions); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $oskill = new Skill(); |
| 71 | 71 | $skill_id = $oskill->add($skill); |
| 72 | 72 | $parents[$saved_id] = $skill_id; |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | function parse_csv_data($file) |
| 83 | 83 | { |
| 84 | - $skills = Import :: csvToArray($file); |
|
| 85 | - foreach ($skills as $index => $skill) { |
|
| 86 | - $skills[$index] = $skill; |
|
| 87 | - } |
|
| 84 | + $skills = Import :: csvToArray($file); |
|
| 85 | + foreach ($skills as $index => $skill) { |
|
| 86 | + $skills[$index] = $skill; |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - return $skills; |
|
| 89 | + return $skills; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -94,16 +94,16 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | function element_start($parser, $data) |
| 96 | 96 | { |
| 97 | - $data = api_utf8_decode($data); |
|
| 98 | - global $skill; |
|
| 99 | - global $current_tag; |
|
| 100 | - switch ($data) { |
|
| 101 | - case 'Skill' : |
|
| 102 | - $skill = array (); |
|
| 103 | - break; |
|
| 104 | - default : |
|
| 105 | - $current_tag = $data; |
|
| 106 | - } |
|
| 97 | + $data = api_utf8_decode($data); |
|
| 98 | + global $skill; |
|
| 99 | + global $current_tag; |
|
| 100 | + switch ($data) { |
|
| 101 | + case 'Skill' : |
|
| 102 | + $skill = array (); |
|
| 103 | + break; |
|
| 104 | + default : |
|
| 105 | + $current_tag = $data; |
|
| 106 | + } |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -111,18 +111,18 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | function element_end($parser, $data) |
| 113 | 113 | { |
| 114 | - $data = api_utf8_decode($data); |
|
| 115 | - global $skill; |
|
| 116 | - global $skills; |
|
| 117 | - global $current_value; |
|
| 118 | - switch ($data) { |
|
| 119 | - case 'Skill' : |
|
| 120 | - $skills[] = $skill; |
|
| 121 | - break; |
|
| 122 | - default : |
|
| 123 | - $skill[$data] = $current_value; |
|
| 124 | - break; |
|
| 125 | - } |
|
| 114 | + $data = api_utf8_decode($data); |
|
| 115 | + global $skill; |
|
| 116 | + global $skills; |
|
| 117 | + global $current_value; |
|
| 118 | + switch ($data) { |
|
| 119 | + case 'Skill' : |
|
| 120 | + $skills[] = $skill; |
|
| 121 | + break; |
|
| 122 | + default : |
|
| 123 | + $skill[$data] = $current_value; |
|
| 124 | + break; |
|
| 125 | + } |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | function character_data($parser, $data) |
| 132 | 132 | { |
| 133 | - $data = trim(api_utf8_decode($data)); |
|
| 134 | - global $current_value; |
|
| 135 | - $current_value = $data; |
|
| 133 | + $data = trim(api_utf8_decode($data)); |
|
| 134 | + global $current_value; |
|
| 135 | + $current_value = $data; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function parse_xml_data($file) |
| 144 | 144 | { |
| 145 | - global $current_tag; |
|
| 146 | - global $current_value; |
|
| 147 | - global $skill; |
|
| 148 | - global $skills; |
|
| 149 | - $skills = array(); |
|
| 150 | - $parser = xml_parser_create('UTF-8'); |
|
| 151 | - xml_set_element_handler($parser, 'element_start', 'element_end'); |
|
| 152 | - xml_set_character_data_handler($parser, 'character_data'); |
|
| 153 | - xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false); |
|
| 154 | - xml_parse($parser, api_utf8_encode_xml(file_get_contents($file))); |
|
| 155 | - xml_parser_free($parser); |
|
| 145 | + global $current_tag; |
|
| 146 | + global $current_value; |
|
| 147 | + global $skill; |
|
| 148 | + global $skills; |
|
| 149 | + $skills = array(); |
|
| 150 | + $parser = xml_parser_create('UTF-8'); |
|
| 151 | + xml_set_element_handler($parser, 'element_start', 'element_end'); |
|
| 152 | + xml_set_character_data_handler($parser, 'character_data'); |
|
| 153 | + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false); |
|
| 154 | + xml_parse($parser, api_utf8_encode_xml(file_get_contents($file))); |
|
| 155 | + xml_parser_free($parser); |
|
| 156 | 156 | |
| 157 | - return $skills; |
|
| 157 | + return $skills; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $this_section = SECTION_PLATFORM_ADMIN; |
@@ -169,81 +169,81 @@ discard block |
||
| 169 | 169 | $error_message = ''; |
| 170 | 170 | |
| 171 | 171 | if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) { |
| 172 | - $file_type = $_POST['file_type']; |
|
| 173 | - Security::clear_token(); |
|
| 174 | - $tok = Security::get_token(); |
|
| 175 | - $allowed_file_mimetype = array('csv','xml'); |
|
| 176 | - $error_kind_file = false; |
|
| 172 | + $file_type = $_POST['file_type']; |
|
| 173 | + Security::clear_token(); |
|
| 174 | + $tok = Security::get_token(); |
|
| 175 | + $allowed_file_mimetype = array('csv','xml'); |
|
| 176 | + $error_kind_file = false; |
|
| 177 | 177 | $error_message = ''; |
| 178 | 178 | |
| 179 | - $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1)); |
|
| 179 | + $ext_import_file = substr($_FILES['import_file']['name'], (strrpos($_FILES['import_file']['name'],'.')+1)); |
|
| 180 | 180 | |
| 181 | - if (in_array($ext_import_file,$allowed_file_mimetype)) { |
|
| 182 | - if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) { |
|
| 183 | - $skills = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
| 184 | - $errors = validate_data($skills); |
|
| 185 | - $error_kind_file = false; |
|
| 186 | - } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) { |
|
| 187 | - $skills = parse_xml_data($_FILES['import_file']['tmp_name']); |
|
| 188 | - $errors = validate_data($skills); |
|
| 189 | - $error_kind_file = false; |
|
| 190 | - } else { |
|
| 191 | - $error_kind_file = true; |
|
| 192 | - } |
|
| 193 | - } else { |
|
| 194 | - $error_kind_file = true; |
|
| 195 | - } |
|
| 181 | + if (in_array($ext_import_file,$allowed_file_mimetype)) { |
|
| 182 | + if (strcmp($file_type, 'csv') === 0 && $ext_import_file == $allowed_file_mimetype[0]) { |
|
| 183 | + $skills = parse_csv_data($_FILES['import_file']['tmp_name']); |
|
| 184 | + $errors = validate_data($skills); |
|
| 185 | + $error_kind_file = false; |
|
| 186 | + } elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file == $allowed_file_mimetype[1]) { |
|
| 187 | + $skills = parse_xml_data($_FILES['import_file']['tmp_name']); |
|
| 188 | + $errors = validate_data($skills); |
|
| 189 | + $error_kind_file = false; |
|
| 190 | + } else { |
|
| 191 | + $error_kind_file = true; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 194 | + $error_kind_file = true; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - // List skill id with error. |
|
| 198 | - $skills_to_insert = $skill_id_error = array(); |
|
| 199 | - if (is_array($errors)) { |
|
| 200 | - foreach ($errors as $my_errors) { |
|
| 201 | - $skill_id_error[] = $my_errors['SkillName']; |
|
| 202 | - } |
|
| 203 | - } |
|
| 204 | - if (is_array($skills)) { |
|
| 205 | - foreach ($skills as $my_skill) { |
|
| 206 | - if (isset($my_skill['name']) && !in_array($my_skill['name'], $skill_id_error)) { |
|
| 207 | - $skills_to_insert[] = $my_skill; |
|
| 208 | - } |
|
| 209 | - } |
|
| 210 | - } |
|
| 197 | + // List skill id with error. |
|
| 198 | + $skills_to_insert = $skill_id_error = array(); |
|
| 199 | + if (is_array($errors)) { |
|
| 200 | + foreach ($errors as $my_errors) { |
|
| 201 | + $skill_id_error[] = $my_errors['SkillName']; |
|
| 202 | + } |
|
| 203 | + } |
|
| 204 | + if (is_array($skills)) { |
|
| 205 | + foreach ($skills as $my_skill) { |
|
| 206 | + if (isset($my_skill['name']) && !in_array($my_skill['name'], $skill_id_error)) { |
|
| 207 | + $skills_to_insert[] = $my_skill; |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - if (strcmp($file_type, 'csv') === 0) { |
|
| 213 | - save_data($skills_to_insert); |
|
| 214 | - } elseif (strcmp($file_type, 'xml') === 0) { |
|
| 215 | - save_data($skills_to_insert); |
|
| 216 | - } else { |
|
| 217 | - $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); |
|
| 218 | - } |
|
| 212 | + if (strcmp($file_type, 'csv') === 0) { |
|
| 213 | + save_data($skills_to_insert); |
|
| 214 | + } elseif (strcmp($file_type, 'xml') === 0) { |
|
| 215 | + save_data($skills_to_insert); |
|
| 216 | + } else { |
|
| 217 | + $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - if (count($errors) > 0) { |
|
| 221 | - $see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered'); |
|
| 222 | - } else { |
|
| 223 | - $see_message_import = get_lang('FileImported'); |
|
| 224 | - } |
|
| 220 | + if (count($errors) > 0) { |
|
| 221 | + $see_message_import = get_lang('FileImportedJustSkillsThatAreNotRegistered'); |
|
| 222 | + } else { |
|
| 223 | + $see_message_import = get_lang('FileImported'); |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - if (count($errors) != 0) { |
|
| 227 | - $warning_message = '<ul>'; |
|
| 228 | - foreach ($errors as $index => $error_skill) { |
|
| 229 | - $warning_message .= '<li><b>'.$error_skill['error'].'</b>: '; |
|
| 230 | - $warning_message .= '<strong>'.$error_skill['SkillName'].'</strong> ('.$error_skill['SkillName'].')'; |
|
| 231 | - $warning_message .= '</li>'; |
|
| 232 | - } |
|
| 233 | - $warning_message .= '</ul>'; |
|
| 234 | - } |
|
| 226 | + if (count($errors) != 0) { |
|
| 227 | + $warning_message = '<ul>'; |
|
| 228 | + foreach ($errors as $index => $error_skill) { |
|
| 229 | + $warning_message .= '<li><b>'.$error_skill['error'].'</b>: '; |
|
| 230 | + $warning_message .= '<strong>'.$error_skill['SkillName'].'</strong> ('.$error_skill['SkillName'].')'; |
|
| 231 | + $warning_message .= '</li>'; |
|
| 232 | + } |
|
| 233 | + $warning_message .= '</ul>'; |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | if ($error_kind_file) { |
| 237 | - $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); |
|
| 238 | - } |
|
| 237 | + $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); |
|
| 238 | + } |
|
| 239 | 239 | } |
| 240 | 240 | Display :: display_header($tool_name); |
| 241 | 241 | |
| 242 | 242 | if (!empty($error_message)) { |
| 243 | - Display::display_error_message($error_message); |
|
| 243 | + Display::display_error_message($error_message); |
|
| 244 | 244 | } |
| 245 | 245 | if (!empty($see_message_import)) { |
| 246 | - Display::display_normal_message($see_message_import); |
|
| 246 | + Display::display_normal_message($see_message_import); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | $form = new FormValidator('user_import','post','skills_import.php'); |
@@ -266,16 +266,16 @@ discard block |
||
| 266 | 266 | $i = 0; |
| 267 | 267 | $count_fields = count($extra_fields); |
| 268 | 268 | if ($count_fields > 0) { |
| 269 | - foreach ($extra_fields as $extra) { |
|
| 270 | - $list[] = $extra[1]; |
|
| 271 | - $list_reponse[] = 'xxx'; |
|
| 272 | - $spaces = ' '; |
|
| 273 | - $result_xml .= $spaces.'<'.$extra[1].'>xxx</'.$extra[1].'>'; |
|
| 274 | - if ($i != $count_fields - 1) { |
|
| 275 | - $result_xml .= '<br/>'; |
|
| 276 | - } |
|
| 277 | - $i++; |
|
| 278 | - } |
|
| 269 | + foreach ($extra_fields as $extra) { |
|
| 270 | + $list[] = $extra[1]; |
|
| 271 | + $list_reponse[] = 'xxx'; |
|
| 272 | + $spaces = ' '; |
|
| 273 | + $result_xml .= $spaces.'<'.$extra[1].'>xxx</'.$extra[1].'>'; |
|
| 274 | + if ($i != $count_fields - 1) { |
|
| 275 | + $result_xml .= '<br/>'; |
|
| 276 | + } |
|
| 277 | + $i++; |
|
| 278 | + } |
|
| 279 | 279 | } |
| 280 | 280 | ?> |
| 281 | 281 | <p><?php echo get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').')'; ?> :</p> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | // current section |
| 18 | 18 | $this_section = SECTION_COURSES; |
| 19 | 19 | |
| 20 | -$current_course_tool = TOOL_COURSE_PROGRESS; |
|
| 20 | +$current_course_tool = TOOL_COURSE_PROGRESS; |
|
| 21 | 21 | |
| 22 | 22 | // protect a course script |
| 23 | 23 | api_protect_course_script(true); |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | 'thematic_advance_delete' |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | -$action = 'thematic_details'; |
|
| 53 | -if (isset($_GET['action']) && in_array($_GET['action'],$actions)) { |
|
| 52 | +$action = 'thematic_details'; |
|
| 53 | +if (isset($_GET['action']) && in_array($_GET['action'], $actions)) { |
|
| 54 | 54 | $action = $_GET['action']; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -187,21 +187,21 @@ discard block |
||
| 187 | 187 | $thematicControl = Session::read('thematic_control'); |
| 188 | 188 | |
| 189 | 189 | if ($action == 'thematic_list') { |
| 190 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl')); |
|
| 190 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicControl')); |
|
| 191 | 191 | } |
| 192 | 192 | if ($action == 'thematic_add') { |
| 193 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 194 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection')); |
|
| 193 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 194 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewThematicSection')); |
|
| 195 | 195 | } |
| 196 | 196 | if ($action == 'thematic_edit') { |
| 197 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 198 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection')); |
|
| 197 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 198 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditThematicSection')); |
|
| 199 | 199 | } |
| 200 | 200 | if ($action == 'thematic_details') { |
| 201 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl')); |
|
| 201 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicControl')); |
|
| 202 | 202 | } |
| 203 | 203 | if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') { |
| 204 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 204 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 205 | 205 | if (!empty($thematic_data)) { |
| 206 | 206 | $interbreadcrumb[] = array( |
| 207 | 207 | 'url' => '#', |
@@ -210,22 +210,22 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') { |
| 213 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 214 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')'); |
|
| 213 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 214 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')'); |
|
| 215 | 215 | if ($description_type >= ADD_THEMATIC_PLAN) { |
| 216 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc')); |
|
| 216 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewBloc')); |
|
| 217 | 217 | } else { |
| 218 | - $interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]); |
|
| 218 | + $interbreadcrumb[] = array('url' => '#', 'name' => $default_thematic_plan_title[$description_type]); |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | if ($action == 'thematic_advance_list' || $action == 'thematic_advance_delete') { |
| 222 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 223 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); |
|
| 222 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 223 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); |
|
| 224 | 224 | } |
| 225 | 225 | if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { |
| 226 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 227 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); |
|
| 228 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance')); |
|
| 226 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
| 227 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); |
|
| 228 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewThematicAdvance')); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // Distpacher actions to controller |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | case 'thematic_import': |
| 240 | 240 | case 'moveup': |
| 241 | 241 | case 'movedown': |
| 242 | - if (!api_is_allowed_to_edit(null,true)) { |
|
| 242 | + if (!api_is_allowed_to_edit(null, true)) { |
|
| 243 | 243 | api_not_allowed(); |
| 244 | 244 | } |
| 245 | 245 | case 'thematic_list': |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | case 'thematic_plan_add': |
| 252 | 252 | case 'thematic_plan_edit': |
| 253 | 253 | case 'thematic_plan_delete': |
| 254 | - if (!api_is_allowed_to_edit(null,true)) { |
|
| 254 | + if (!api_is_allowed_to_edit(null, true)) { |
|
| 255 | 255 | api_not_allowed(); |
| 256 | 256 | } |
| 257 | 257 | case 'thematic_plan_list': |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | case 'thematic_advance_add': |
| 261 | 261 | case 'thematic_advance_edit': |
| 262 | 262 | case 'thematic_advance_delete': |
| 263 | - if (!api_is_allowed_to_edit(null,true)) { |
|
| 263 | + if (!api_is_allowed_to_edit(null, true)) { |
|
| 264 | 264 | api_not_allowed(); |
| 265 | 265 | } |
| 266 | 266 | case 'thematic_advance_list': |