@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For license terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * Index of the Buy Courses plugin courses list |
|
| 5 | - * @package chamilo.plugin.buycourses |
|
| 6 | - */ |
|
| 4 | + * Index of the Buy Courses plugin courses list |
|
| 5 | + * @package chamilo.plugin.buycourses |
|
| 6 | + */ |
|
| 7 | 7 | /** |
| 8 | - * |
|
| 9 | - */ |
|
| 8 | + * |
|
| 9 | + */ |
|
| 10 | 10 | $plugin = BuyCoursesPlugin::create(); |
| 11 | 11 | $guess_enable = $plugin->get('unregistered_users_enable');
|
| 12 | 12 | |
@@ -1,19 +1,19 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For license terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * Errors management for the Buy Courses plugin - Redirects to course_catalog.php or service_catalog.php |
|
| 5 | - * @package chamilo.plugin.buycourses |
|
| 6 | - */ |
|
| 4 | + * Errors management for the Buy Courses plugin - Redirects to course_catalog.php or service_catalog.php |
|
| 5 | + * @package chamilo.plugin.buycourses |
|
| 6 | + */ |
|
| 7 | 7 | /** |
| 8 | - * Config |
|
| 9 | - */ |
|
| 8 | + * Config |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | if ($_SESSION['bc_service_sale_id']) {
|
| 12 | - unset($_SESSION['bc_service_sale_id']); |
|
| 13 | - header('Location: service_catalog.php');
|
|
| 12 | + unset($_SESSION['bc_service_sale_id']); |
|
| 13 | + header('Location: service_catalog.php');
|
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | if ($_SESSION['bc_sale_id']) {
|
| 17 | - unset($_SESSION['bc_sale_id']); |
|
| 18 | - header('Location: course_catalog.php');
|
|
| 17 | + unset($_SESSION['bc_sale_id']); |
|
| 18 | + header('Location: course_catalog.php');
|
|
| 19 | 19 | } |
| 20 | 20 | \ No newline at end of file |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Script to enable or disable autobilling in recurring payment in a service from a customer paypal account |
|
| 4 | - * @package chamilo.plugin.buycourses |
|
| 5 | - * @author Jose Loguercio Silva <[email protected]> |
|
| 6 | - */ |
|
| 3 | + * Script to enable or disable autobilling in recurring payment in a service from a customer paypal account |
|
| 4 | + * @package chamilo.plugin.buycourses |
|
| 5 | + * @author Jose Loguercio Silva <[email protected]> |
|
| 6 | + */ |
|
| 7 | 7 | /** |
| 8 | - * Initialization |
|
| 9 | - */ |
|
| 8 | + * Initialization |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | require_once '../../../main/inc/global.inc.php'; |
| 12 | 12 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | * phoneNum: the phoneNum entered on the merchant's site |
| 112 | 112 | */ |
| 113 | 113 | function CallMarkExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $returnURL, |
| 114 | - $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, |
|
| 115 | - $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum |
|
| 114 | + $cancelURL, $shipToName, $shipToStreet, $shipToCity, $shipToState, |
|
| 115 | + $shipToCountryCode, $shipToZip, $shipToStreet2, $phoneNum |
|
| 116 | 116 | ) |
| 117 | 117 | {
|
| 118 | 118 | // Construct the parameter string that describes the SetExpressCheckout API call in the shortcut implementation |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | |
| 267 | 267 | function DirectPayment($paymentType, $paymentAmount, $creditCardType, $creditCardNumber, |
| 268 | - $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, |
|
| 269 | - $countryCode, $currencyCode) |
|
| 268 | + $expDate, $cvv2, $firstName, $lastName, $street, $city, $state, $zip, |
|
| 269 | + $countryCode, $currencyCode) |
|
| 270 | 270 | {
|
| 271 | 271 | //Construct the parameter string that describes DoDirectPayment |
| 272 | 272 | $nvpstr = "&AMT=" . $paymentAmount; |
@@ -328,7 +328,6 @@ discard block |
||
| 328 | 328 | * @param CurrencyCode: Currency code (default is USD). |
| 329 | 329 | * @param CustomerPaypalAccount: Email address of customer. |
| 330 | 330 | * @param ExtraParams: Extra Info params. |
| 331 | - |
|
| 332 | 331 | * @return: The NVP Collection object of the CreateRecurringPaymentsProfile Call Response. |
| 333 | 332 | * |
| 334 | 333 | * |
@@ -1229,13 +1229,13 @@ discard block |
||
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | 1231 | /** |
| 1232 | - * Get the users by ID |
|
| 1233 | - * @param array $ids student ids |
|
| 1234 | - * @param string $active |
|
| 1235 | - * @param string $order |
|
| 1236 | - * @param string $limit |
|
| 1237 | - * @return array $result student information |
|
| 1238 | - */ |
|
| 1232 | + * Get the users by ID |
|
| 1233 | + * @param array $ids student ids |
|
| 1234 | + * @param string $active |
|
| 1235 | + * @param string $order |
|
| 1236 | + * @param string $limit |
|
| 1237 | + * @return array $result student information |
|
| 1238 | + */ |
|
| 1239 | 1239 | public static function get_user_list_by_ids($ids = array(), $active = null, $order = null, $limit = null) |
| 1240 | 1240 | { |
| 1241 | 1241 | if (empty($ids)) { |
@@ -3332,12 +3332,12 @@ discard block |
||
| 3332 | 3332 | if ($tag_id == 0) { |
| 3333 | 3333 | //the tag doesn't exist |
| 3334 | 3334 | $sql = "INSERT INTO $table_user_tag (tag, field_id,count) VALUES ('$tag','$field_id', count + 1)"; |
| 3335 | - Database::query($sql); |
|
| 3335 | + Database::query($sql); |
|
| 3336 | 3336 | $last_insert_id = Database::insert_id(); |
| 3337 | 3337 | } else { |
| 3338 | 3338 | //the tag exists we update it |
| 3339 | 3339 | $sql = "UPDATE $table_user_tag SET count = count + 1 WHERE id = $tag_id"; |
| 3340 | - Database::query($sql); |
|
| 3340 | + Database::query($sql); |
|
| 3341 | 3341 | $last_insert_id = $tag_id; |
| 3342 | 3342 | } |
| 3343 | 3343 | |
@@ -3532,9 +3532,9 @@ discard block |
||
| 3532 | 3532 | } |
| 3533 | 3533 | |
| 3534 | 3534 | /** |
| 3535 | - * Get extra filtrable user fields (only type select) |
|
| 3536 | - * @return array |
|
| 3537 | - */ |
|
| 3535 | + * Get extra filtrable user fields (only type select) |
|
| 3536 | + * @return array |
|
| 3537 | + */ |
|
| 3538 | 3538 | public static function get_extra_filtrable_fields() |
| 3539 | 3539 | { |
| 3540 | 3540 | $extraFieldList = UserManager::get_extra_fields(); |
@@ -3559,9 +3559,9 @@ discard block |
||
| 3559 | 3559 | } |
| 3560 | 3560 | |
| 3561 | 3561 | /** |
| 3562 | - * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
| 3563 | - * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
| 3564 | - */ |
|
| 3562 | + * Get extra where clauses for finding users based on extra filtrable user fields (type select) |
|
| 3563 | + * @return string With AND clauses based on user's ID which have the values to search in extra user fields |
|
| 3564 | + */ |
|
| 3565 | 3565 | public static function get_search_form_where_extra_fields() |
| 3566 | 3566 | { |
| 3567 | 3567 | $useExtraFields = false; |
@@ -3869,23 +3869,23 @@ discard block |
||
| 3869 | 3869 | } |
| 3870 | 3870 | |
| 3871 | 3871 | /** |
| 3872 | - * Get users followed by human resource manager |
|
| 3873 | - * @param int $userId |
|
| 3874 | - * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
| 3875 | - * @param bool $getOnlyUserId |
|
| 3876 | - * @param bool $getSql |
|
| 3877 | - * @param bool $getCount |
|
| 3878 | - * @param int $from |
|
| 3879 | - * @param int $numberItems |
|
| 3880 | - * @param int $column |
|
| 3881 | - * @param string $direction |
|
| 3882 | - * @param int $active |
|
| 3883 | - * @param string $lastConnectionDate |
|
| 3884 | - * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
| 3885 | - * @param string $keyword |
|
| 3872 | + * Get users followed by human resource manager |
|
| 3873 | + * @param int $userId |
|
| 3874 | + * @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc) |
|
| 3875 | + * @param bool $getOnlyUserId |
|
| 3876 | + * @param bool $getSql |
|
| 3877 | + * @param bool $getCount |
|
| 3878 | + * @param int $from |
|
| 3879 | + * @param int $numberItems |
|
| 3880 | + * @param int $column |
|
| 3881 | + * @param string $direction |
|
| 3882 | + * @param int $active |
|
| 3883 | + * @param string $lastConnectionDate |
|
| 3884 | + * @param int $status the function is called by who? COURSEMANAGER, DRH? |
|
| 3885 | + * @param string $keyword |
|
| 3886 | 3886 | * |
| 3887 | - * @return array user list |
|
| 3888 | - */ |
|
| 3887 | + * @return array user list |
|
| 3888 | + */ |
|
| 3889 | 3889 | public static function getUsersFollowedByUser( |
| 3890 | 3890 | $userId, |
| 3891 | 3891 | $userStatus = null, |
@@ -5058,31 +5058,31 @@ discard block |
||
| 5058 | 5058 | return $users; |
| 5059 | 5059 | } |
| 5060 | 5060 | |
| 5061 | - /** |
|
| 5062 | - * Search a user by a keyword (like a part of a firstname or lastname or username) |
|
| 5063 | - * |
|
| 5064 | - * @param string $keyword |
|
| 5065 | - * @return array|null |
|
| 5066 | - */ |
|
| 5067 | - function searchUserByKeyword($keyword) |
|
| 5068 | - { |
|
| 5069 | - if (empty($keyword)) { |
|
| 5070 | - return null; |
|
| 5071 | - } |
|
| 5072 | - |
|
| 5073 | - $tableUser = Database::get_main_table(TABLE_MAIN_USER); |
|
| 5074 | - |
|
| 5075 | - $keyword = Database::escape_string($keyword); |
|
| 5076 | - |
|
| 5077 | - $sql = "SELECT * |
|
| 5061 | + /** |
|
| 5062 | + * Search a user by a keyword (like a part of a firstname or lastname or username) |
|
| 5063 | + * |
|
| 5064 | + * @param string $keyword |
|
| 5065 | + * @return array|null |
|
| 5066 | + */ |
|
| 5067 | + function searchUserByKeyword($keyword) |
|
| 5068 | + { |
|
| 5069 | + if (empty($keyword)) { |
|
| 5070 | + return null; |
|
| 5071 | + } |
|
| 5072 | + |
|
| 5073 | + $tableUser = Database::get_main_table(TABLE_MAIN_USER); |
|
| 5074 | + |
|
| 5075 | + $keyword = Database::escape_string($keyword); |
|
| 5076 | + |
|
| 5077 | + $sql = "SELECT * |
|
| 5078 | 5078 | FROM $tableUser |
| 5079 | 5079 | WHERE |
| 5080 | 5080 | ( |
| 5081 | 5081 | username LIKE '%$keyword%' OR firstname LIKE '%$keyword%' OR lastname LIKE '%$keyword%' |
| 5082 | 5082 | )"; |
| 5083 | - $result = Database::query($sql); |
|
| 5084 | - return Database::store_result($result, 'ASSOC'); |
|
| 5085 | - } |
|
| 5083 | + $result = Database::query($sql); |
|
| 5084 | + return Database::store_result($result, 'ASSOC'); |
|
| 5085 | + } |
|
| 5086 | 5086 | |
| 5087 | 5087 | /** |
| 5088 | 5088 | * @param int $optionSelected |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | if (isset($keywordListValues['keyword_status']) && |
| 240 | 240 | $keywordListValues['keyword_status'] == PLATFORM_ADMIN |
| 241 | 241 | ) { |
| 242 | - $query_admin_table = " , $admin_table a "; |
|
| 243 | - $keyword_admin = ' AND a.user_id = u.id '; |
|
| 242 | + $query_admin_table = " , $admin_table a "; |
|
| 243 | + $keyword_admin = ' AND a.user_id = u.id '; |
|
| 244 | 244 | $keywordListValues['keyword_status'] = '%'; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | $firstname = $userInfo['firstname']; |
| 307 | 307 | $lastname = $userInfo['lastname']; |
| 308 | 308 | |
| 309 | - if (api_is_western_name_order()) { |
|
| 310 | - $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname,$lastname, $userId); |
|
| 311 | - } else { |
|
| 312 | - $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
| 313 | - } |
|
| 309 | + if (api_is_western_name_order()) { |
|
| 310 | + $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname,$lastname, $userId); |
|
| 311 | + } else { |
|
| 312 | + $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - if ($userId) { |
|
| 315 | + if ($userId) { |
|
| 316 | 316 | |
| 317 | 317 | // Logout the current user |
| 318 | 318 | LoginDelete(api_get_user_id()); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | Display :: display_footer(); |
| 348 | 348 | exit; |
| 349 | 349 | |
| 350 | - } |
|
| 350 | + } |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | }*/ |
| 386 | 386 | |
| 387 | 387 | if (!in_array($direction, array('ASC','DESC'))) { |
| 388 | - $direction = 'ASC'; |
|
| 388 | + $direction = 'ASC'; |
|
| 389 | 389 | } |
| 390 | 390 | $column = intval($column); |
| 391 | 391 | $from = intval($from); |
@@ -396,23 +396,23 @@ discard block |
||
| 396 | 396 | $sql .= " WHERE u.creator_id = ".api_get_user_id(); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - $sql .= " ORDER BY col$column $direction "; |
|
| 400 | - $sql .= " LIMIT $from,$number_of_items"; |
|
| 399 | + $sql .= " ORDER BY col$column $direction "; |
|
| 400 | + $sql .= " LIMIT $from,$number_of_items"; |
|
| 401 | 401 | |
| 402 | - $res = Database::query($sql); |
|
| 402 | + $res = Database::query($sql); |
|
| 403 | 403 | |
| 404 | - $users = array (); |
|
| 404 | + $users = array (); |
|
| 405 | 405 | $t = time(); |
| 406 | - while ($user = Database::fetch_row($res)) { |
|
| 407 | - $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
| 408 | - $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]).'" />'; |
|
| 406 | + while ($user = Database::fetch_row($res)) { |
|
| 407 | + $userPicture = UserManager::getUserPicture($user[0], USER_IMAGE_SIZE_SMALL); |
|
| 408 | + $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 | 409 | |
| 410 | 410 | if ($user[7] == 1 && !empty($user[10])) { |
| 411 | 411 | // check expiration date |
| 412 | 412 | $expiration_time = convert_sql_date($user[10]); |
| 413 | 413 | // if expiration date is passed, store a special value for active field |
| 414 | 414 | if ($expiration_time < $t) { |
| 415 | - $user[7] = '-1'; |
|
| 415 | + $user[7] = '-1'; |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
@@ -430,9 +430,9 @@ discard block |
||
| 430 | 430 | api_get_local_time($user[9]), |
| 431 | 431 | $user[0] |
| 432 | 432 | ); |
| 433 | - } |
|
| 433 | + } |
|
| 434 | 434 | |
| 435 | - return $users; |
|
| 435 | + return $users; |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | * @return string HTML-code with a mailto-link |
| 442 | 442 | */ |
| 443 | 443 | function email_filter($email) { |
| 444 | - return Display :: encrypted_mailto_link($email, $email); |
|
| 444 | + return Display :: encrypted_mailto_link($email, $email); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | /** |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $class = 'serviceCheckFont'; |
| 461 | 461 | } |
| 462 | 462 | } |
| 463 | - return '<a class="'.$class.'" href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
| 463 | + return '<a class="'.$class.'" href="'.api_get_path(WEB_PATH).'whoisonline.php?origin=user_list&id='.$row[0].'">'.$name.'</a>'; |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | /** |
@@ -471,84 +471,84 @@ discard block |
||
| 471 | 471 | * @return string Some HTML-code with modify-buttons |
| 472 | 472 | */ |
| 473 | 473 | function modify_filter($user_id, $url_params, $row) { |
| 474 | - global $charset, $_admins_list; |
|
| 475 | - $is_admin = in_array($user_id,$_admins_list); |
|
| 476 | - $statusname = api_get_status_langvars(); |
|
| 477 | - $user_is_anonymous = false; |
|
| 474 | + global $charset, $_admins_list; |
|
| 475 | + $is_admin = in_array($user_id,$_admins_list); |
|
| 476 | + $statusname = api_get_status_langvars(); |
|
| 477 | + $user_is_anonymous = false; |
|
| 478 | 478 | $current_user_status_label = $row['7']; |
| 479 | 479 | |
| 480 | - if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
| 481 | - $user_is_anonymous =true; |
|
| 482 | - } |
|
| 483 | - $result = ''; |
|
| 484 | - if (!$user_is_anonymous) { |
|
| 485 | - $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')')); |
|
| 486 | - $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
| 480 | + if ($current_user_status_label == $statusname[ANONYMOUS]) { |
|
| 481 | + $user_is_anonymous =true; |
|
| 482 | + } |
|
| 483 | + $result = ''; |
|
| 484 | + if (!$user_is_anonymous) { |
|
| 485 | + $icon = Display::return_icon('course.png', get_lang('Courses'), array('onmouseout' => 'clear_course_list (\'div_'.$user_id.'\')')); |
|
| 486 | + $result .= '<a href="javascript:void(0)" onclick="load_course_list(\'div_'.$user_id.'\','.$user_id.')" > |
|
| 487 | 487 | '.$icon.' |
| 488 | 488 | <div class="blackboard_hide" id="div_'.$user_id.'"> </div> |
| 489 | 489 | </a>'; |
| 490 | 490 | |
| 491 | 491 | $icon = Display::return_icon('session.png', get_lang('Sessions'), array('onmouseout' => 'clear_session_list (\'div_s_'.$user_id.'\')')); |
| 492 | - $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
| 492 | + $result .= '<a href="javascript:void(0)" onclick="load_session_list(\'div_s_'.$user_id.'\','.$user_id.')" > |
|
| 493 | 493 | '.$icon.' |
| 494 | 494 | <div class="blackboard_hide" id="div_s_'.$user_id.'"> </div> |
| 495 | 495 | </a>'; |
| 496 | - } else { |
|
| 497 | - $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
| 498 | - $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
| 499 | - } |
|
| 496 | + } else { |
|
| 497 | + $result .= Display::return_icon('course_na.png',get_lang('Courses')).' '; |
|
| 498 | + $result .= Display::return_icon('course_na.png',get_lang('Sessions')).' '; |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - if (api_is_platform_admin()) { |
|
| 502 | - if (!$user_is_anonymous) { |
|
| 503 | - $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a> '; |
|
| 504 | - } else { |
|
| 505 | - $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).' '; |
|
| 506 | - } |
|
| 507 | - } |
|
| 501 | + if (api_is_platform_admin()) { |
|
| 502 | + if (!$user_is_anonymous) { |
|
| 503 | + $result .= '<a href="user_information.php?user_id='.$user_id.'">'.Display::return_icon('synthese_view.gif', get_lang('Info')).'</a> '; |
|
| 504 | + } else { |
|
| 505 | + $result .= Display::return_icon('synthese_view_na.gif', get_lang('Info')).' '; |
|
| 506 | + } |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | 509 | //only allow platform admins to login_as, or session admins only for students (not teachers nor other admins) |
| 510 | 510 | if (api_is_platform_admin() || (api_is_session_admin() && $current_user_status_label == $statusname[STUDENT])) { |
| 511 | - if (!$user_is_anonymous) { |
|
| 511 | + if (!$user_is_anonymous) { |
|
| 512 | 512 | if (api_global_admin_can_edit_admin($user_id)) { |
| 513 | 513 | $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> '; |
| 514 | 514 | } else { |
| 515 | 515 | $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
| 516 | 516 | } |
| 517 | - } else { |
|
| 518 | - $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 519 | - } |
|
| 517 | + } else { |
|
| 518 | + $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 519 | + } |
|
| 520 | 520 | } else { |
| 521 | - $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 521 | + $result .= Display::return_icon('login_as_na.png', get_lang('LoginAs')).' '; |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - if ($current_user_status_label != $statusname[STUDENT]) { |
|
| 525 | - $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).' '; |
|
| 526 | - } else { |
|
| 527 | - $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a> '; |
|
| 528 | - } |
|
| 524 | + if ($current_user_status_label != $statusname[STUDENT]) { |
|
| 525 | + $result .= Display::return_icon('statistics_na.gif', get_lang('Reporting')).' '; |
|
| 526 | + } else { |
|
| 527 | + $result .= '<a href="../mySpace/myStudents.php?student='.$user_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a> '; |
|
| 528 | + } |
|
| 529 | 529 | |
| 530 | - if (api_is_platform_admin(true)) { |
|
| 530 | + if (api_is_platform_admin(true)) { |
|
| 531 | 531 | $editProfileUrl = Display::getProfileEditionLink($user_id, true); |
| 532 | 532 | |
| 533 | 533 | if (!$user_is_anonymous && api_global_admin_can_edit_admin($user_id, null, true)) { |
| 534 | 534 | $result .= '<a href="' . $editProfileUrl . '">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
| 535 | - } else { |
|
| 535 | + } else { |
|
| 536 | 536 | $result .= Display::return_icon('edit_na.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a> '; |
| 537 | - } |
|
| 538 | - } |
|
| 537 | + } |
|
| 538 | + } |
|
| 539 | 539 | |
| 540 | - if ($is_admin) { |
|
| 541 | - $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 542 | - } else { |
|
| 543 | - $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
| 544 | - } |
|
| 540 | + if ($is_admin) { |
|
| 541 | + $result .= Display::return_icon('admin_star.png', get_lang('IsAdministrator'),array('width'=> ICON_SIZE_SMALL, 'heigth'=> ICON_SIZE_SMALL)); |
|
| 542 | + } else { |
|
| 543 | + $result .= Display::return_icon('admin_star_na.png', get_lang('IsNotAdministrator')); |
|
| 544 | + } |
|
| 545 | 545 | |
| 546 | - // actions for assigning sessions, courses or users |
|
| 547 | - if (api_is_session_admin()) { |
|
| 548 | - /*if ($row[0] == api_get_user_id()) { |
|
| 546 | + // actions for assigning sessions, courses or users |
|
| 547 | + if (api_is_session_admin()) { |
|
| 548 | + /*if ($row[0] == api_get_user_id()) { |
|
| 549 | 549 | $result .= '<a href="dashboard_add_sessions_to_user.php?user='.$user_id.'">'.Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')).'</a> '; |
| 550 | 550 | }*/ |
| 551 | - } else { |
|
| 551 | + } else { |
|
| 552 | 552 | if ($current_user_status_label == $statusname[SESSIONADMIN]) { |
| 553 | 553 | $result .= Display::url( |
| 554 | 554 | Display::return_icon('view_more_stats.gif', get_lang('AssignSessions')), |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | ); |
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | - } |
|
| 581 | + } |
|
| 582 | 582 | |
| 583 | 583 | if (api_is_platform_admin()) { |
| 584 | 584 | $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">'. |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | - return $result; |
|
| 599 | + return $result; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | |
@@ -629,10 +629,10 @@ discard block |
||
| 629 | 629 | if ($action == 'edit') { |
| 630 | 630 | $result = Display::return_icon($image.'.png', get_lang('AccountExpired'), array(), 16); |
| 631 | 631 | } elseif ($row['0']<>$_user['user_id']) { |
| 632 | - // 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. |
|
| 633 | - $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
|
| 634 | - } |
|
| 635 | - return $result; |
|
| 632 | + // 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. |
|
| 633 | + $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array('onclick'=>'active_user(this);', 'id'=>'img_'.$row['0']), 16).'</a>'; |
|
| 634 | + } |
|
| 635 | + return $result; |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | /** |
@@ -645,8 +645,8 @@ discard block |
||
| 645 | 645 | * @author Patrick Cool <[email protected]>, Ghent University, Belgium |
| 646 | 646 | */ |
| 647 | 647 | function status_filter($status) { |
| 648 | - $statusname = api_get_status_langvars(); |
|
| 649 | - return $statusname[$status]; |
|
| 648 | + $statusname = api_get_status_langvars(); |
|
| 649 | + return $statusname[$status]; |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | if (isset($_GET['keyword']) || isset($_GET['keyword_firstname'])) { |
@@ -662,8 +662,8 @@ discard block |
||
| 662 | 662 | |
| 663 | 663 | if (!empty($action)) { |
| 664 | 664 | $check = Security::check_token('get'); |
| 665 | - if ($check) { |
|
| 666 | - switch ($action) { |
|
| 665 | + if ($check) { |
|
| 666 | + switch ($action) { |
|
| 667 | 667 | case 'add_user_to_my_url': |
| 668 | 668 | $user_id = $_REQUEST["user_id"]; |
| 669 | 669 | $result = UrlManager::add_user_to_url($user_id, $current_access_url_id); |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | $message = Display::return_message($message, 'confirmation'); |
| 674 | 674 | } |
| 675 | 675 | break; |
| 676 | - case 'show_message' : |
|
| 676 | + case 'show_message' : |
|
| 677 | 677 | if (!empty($_GET['warn'])) { |
| 678 | 678 | // to prevent too long messages |
| 679 | 679 | if ($_GET['warn'] == 'session_message') { |
@@ -691,46 +691,46 @@ discard block |
||
| 691 | 691 | $message .= Display::return_message(stripslashes($_GET['message']), 'confirmation'); |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | - break; |
|
| 695 | - case 'delete_user' : |
|
| 696 | - if (api_is_platform_admin()) { |
|
| 694 | + break; |
|
| 695 | + case 'delete_user' : |
|
| 696 | + if (api_is_platform_admin()) { |
|
| 697 | 697 | $user_to_delete = $_GET['user_id']; |
| 698 | 698 | $current_user_id = api_get_user_id(); |
| 699 | 699 | |
| 700 | - if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
| 701 | - if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
| 702 | - $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation'); |
|
| 703 | - } else { |
|
| 704 | - $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
| 705 | - } |
|
| 706 | - } else { |
|
| 707 | - $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
| 708 | - } |
|
| 709 | - } |
|
| 710 | - break; |
|
| 700 | + if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) { |
|
| 701 | + if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) { |
|
| 702 | + $message = Display :: return_message(get_lang('UserDeleted'), 'confirmation'); |
|
| 703 | + } else { |
|
| 704 | + $message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error'); |
|
| 705 | + } |
|
| 706 | + } else { |
|
| 707 | + $message = Display :: return_message(get_lang('CannotDeleteUser'),'error'); |
|
| 708 | + } |
|
| 709 | + } |
|
| 710 | + break; |
|
| 711 | 711 | case 'delete' : |
| 712 | - if (api_is_platform_admin()) { |
|
| 713 | - $number_of_selected_users = count($_POST['id']); |
|
| 714 | - $number_of_deleted_users = 0; |
|
| 715 | - if (is_array($_POST['id'])) { |
|
| 716 | - foreach ($_POST['id'] as $index => $user_id) { |
|
| 717 | - if($user_id != $_user['user_id']) { |
|
| 718 | - if(UserManager :: delete_user($user_id)) { |
|
| 719 | - $number_of_deleted_users++; |
|
| 720 | - } |
|
| 721 | - } |
|
| 722 | - } |
|
| 723 | - } |
|
| 724 | - if ($number_of_selected_users == $number_of_deleted_users) { |
|
| 712 | + if (api_is_platform_admin()) { |
|
| 713 | + $number_of_selected_users = count($_POST['id']); |
|
| 714 | + $number_of_deleted_users = 0; |
|
| 715 | + if (is_array($_POST['id'])) { |
|
| 716 | + foreach ($_POST['id'] as $index => $user_id) { |
|
| 717 | + if($user_id != $_user['user_id']) { |
|
| 718 | + if(UserManager :: delete_user($user_id)) { |
|
| 719 | + $number_of_deleted_users++; |
|
| 720 | + } |
|
| 721 | + } |
|
| 722 | + } |
|
| 723 | + } |
|
| 724 | + if ($number_of_selected_users == $number_of_deleted_users) { |
|
| 725 | 725 | $message = Display :: return_message(get_lang('SelectedUsersDeleted'), 'confirmation'); |
| 726 | - } else { |
|
| 726 | + } else { |
|
| 727 | 727 | $message = Display :: return_message(get_lang('SomeUsersNotDeleted'), 'error'); |
| 728 | - } |
|
| 729 | - } |
|
| 730 | - break; |
|
| 731 | - } |
|
| 732 | - Security::clear_token(); |
|
| 733 | - } |
|
| 728 | + } |
|
| 729 | + } |
|
| 730 | + break; |
|
| 731 | + } |
|
| 732 | + Security::clear_token(); |
|
| 733 | + } |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | // Create a search-box |
@@ -750,24 +750,24 @@ discard block |
||
| 750 | 750 | |
| 751 | 751 | $actions = ''; |
| 752 | 752 | if (api_is_platform_admin()) { |
| 753 | - $actions .= '<div style="float:right;">'. |
|
| 754 | - '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
| 755 | - Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
| 756 | - '</div>'; |
|
| 753 | + $actions .= '<div style="float:right;">'. |
|
| 754 | + '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_add.php">'. |
|
| 755 | + Display::return_icon('new_user.png',get_lang('AddUsers'),'',ICON_SIZE_MEDIUM).'</a>'. |
|
| 756 | + '</div>'; |
|
| 757 | 757 | } |
| 758 | 758 | $actions .= $form->return_form(); |
| 759 | 759 | |
| 760 | 760 | if (isset ($_GET['keyword'])) { |
| 761 | - $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 761 | + $parameters = array ('keyword' => Security::remove_XSS($_GET['keyword'])); |
|
| 762 | 762 | } elseif (isset ($_GET['keyword_firstname'])) { |
| 763 | - $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
|
| 764 | - $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
|
| 765 | - $parameters['keyword_username'] = Security::remove_XSS($_GET['keyword_username']); |
|
| 766 | - $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']); |
|
| 767 | - $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
|
| 768 | - $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
|
| 769 | - $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
|
| 770 | - $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 763 | + $parameters['keyword_firstname'] = Security::remove_XSS($_GET['keyword_firstname']); |
|
| 764 | + $parameters['keyword_lastname'] = Security::remove_XSS($_GET['keyword_lastname']); |
|
| 765 | + $parameters['keyword_username'] = Security::remove_XSS($_GET['keyword_username']); |
|
| 766 | + $parameters['keyword_email'] = Security::remove_XSS($_GET['keyword_email']); |
|
| 767 | + $parameters['keyword_officialcode'] = Security::remove_XSS($_GET['keyword_officialcode']); |
|
| 768 | + $parameters['keyword_status'] = Security::remove_XSS($_GET['keyword_status']); |
|
| 769 | + $parameters['keyword_active'] = Security::remove_XSS($_GET['keyword_active']); |
|
| 770 | + $parameters['keyword_inactive'] = Security::remove_XSS($_GET['keyword_inactive']); |
|
| 771 | 771 | } |
| 772 | 772 | // Create a sortable table with user-data |
| 773 | 773 | $parameters['sec_token'] = Security::get_token(); |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | $res_admin = Database::query($sql_admin); |
| 779 | 779 | $_admins_list = array(); |
| 780 | 780 | while ($row_admin = Database::fetch_row($res_admin)) { |
| 781 | - $_admins_list[] = $row_admin[0]; |
|
| 781 | + $_admins_list[] = $row_admin[0]; |
|
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | // Display Advanced search form. |
@@ -834,11 +834,11 @@ discard block |
||
| 834 | 834 | $table->set_header(2, get_lang('OfficialCode')); |
| 835 | 835 | |
| 836 | 836 | if (api_is_western_name_order()) { |
| 837 | - $table->set_header(3, get_lang('FirstName')); |
|
| 838 | - $table->set_header(4, get_lang('LastName')); |
|
| 837 | + $table->set_header(3, get_lang('FirstName')); |
|
| 838 | + $table->set_header(4, get_lang('LastName')); |
|
| 839 | 839 | } else { |
| 840 | - $table->set_header(3, get_lang('LastName')); |
|
| 841 | - $table->set_header(4, get_lang('FirstName')); |
|
| 840 | + $table->set_header(3, get_lang('LastName')); |
|
| 841 | + $table->set_header(4, get_lang('FirstName')); |
|
| 842 | 842 | } |
| 843 | 843 | $table->set_header(5, get_lang('LoginName')); |
| 844 | 844 | $table->set_header(6, get_lang('Email')); |