@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | // Access restriction |
29 | 29 | if (!api_is_allowed_to_edit()) { |
30 | - api_not_allowed(true); |
|
30 | + api_not_allowed(true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | $tool_name = get_lang("SubscribeUserToCourse"); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $courseInfo = api_get_course_info(); |
38 | 38 | |
39 | 39 | if ($type == COURSEMANAGER) { |
40 | - $tool_name = get_lang("SubscribeUserToCourseAsTeacher"); |
|
40 | + $tool_name = get_lang("SubscribeUserToCourseAsTeacher"); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | //extra entries in breadcrumb |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | "url" => "subscribe_user.php?type=".$type.'&'.api_get_cidreq(), |
51 | 51 | "name" => $tool_name |
52 | 52 | ); |
53 | - $tool_name = get_lang('SearchResults'); |
|
53 | + $tool_name = get_lang('SearchResults'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $sessionId = api_get_session_id(); |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | |
131 | 131 | // Build table |
132 | 132 | $table = new SortableTable( |
133 | - 'subscribe_users', |
|
134 | - 'get_number_of_users', |
|
135 | - 'get_user_data', |
|
136 | - ($is_western_name_order xor $sort_by_first_name) ? 3 : 2 |
|
133 | + 'subscribe_users', |
|
134 | + 'get_number_of_users', |
|
135 | + 'get_user_data', |
|
136 | + ($is_western_name_order xor $sort_by_first_name) ? 3 : 2 |
|
137 | 137 | ); |
138 | 138 | $parameters['keyword'] = $keyword; |
139 | 139 | $parameters['type'] = $type; |
@@ -220,18 +220,18 @@ discard block |
||
220 | 220 | */ |
221 | 221 | function get_number_of_users() |
222 | 222 | { |
223 | - // Database table definition |
|
224 | - $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
225 | - $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
|
226 | - $tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
227 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
223 | + // Database table definition |
|
224 | + $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
225 | + $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
|
226 | + $tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
227 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
228 | 228 | |
229 | 229 | $courseCode = api_get_course_id(); |
230 | 230 | $sessionId = api_get_session_id(); |
231 | 231 | |
232 | - if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'teacher') { |
|
233 | - if (api_get_session_id() != 0) { |
|
234 | - $sql = "SELECT COUNT(u.id) |
|
232 | + if (isset($_REQUEST['type']) && $_REQUEST['type'] === 'teacher') { |
|
233 | + if (api_get_session_id() != 0) { |
|
234 | + $sql = "SELECT COUNT(u.id) |
|
235 | 235 | FROM $user_table u |
236 | 236 | LEFT JOIN $tbl_session_rel_course_user cu |
237 | 237 | ON |
@@ -399,11 +399,11 @@ discard block |
||
399 | 399 | $count_user = 0; |
400 | 400 | |
401 | 401 | if ($res) { |
402 | - $row = Database::fetch_row($res); |
|
403 | - $count_user = $row[0]; |
|
402 | + $row = Database::fetch_row($res); |
|
403 | + $count_user = $row[0]; |
|
404 | 404 | } |
405 | 405 | |
406 | - return $count_user; |
|
406 | + return $count_user; |
|
407 | 407 | } |
408 | 408 | /** |
409 | 409 | * Get the users to display on the current page. |
@@ -413,17 +413,17 @@ discard block |
||
413 | 413 | $url_access_id = api_get_current_access_url_id(); |
414 | 414 | $course_code = api_get_course_id(); |
415 | 415 | $sessionId = api_get_session_id(); |
416 | - $courseId = api_get_course_int_id(); |
|
416 | + $courseId = api_get_course_int_id(); |
|
417 | 417 | |
418 | - // Database table definitions |
|
419 | - $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
420 | - $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
|
421 | - $tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
422 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
418 | + // Database table definitions |
|
419 | + $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
420 | + $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
|
421 | + $tbl_session_rel_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
422 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
423 | 423 | $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
424 | 424 | |
425 | 425 | // adding teachers |
426 | - $is_western_name_order = api_is_western_name_order(); |
|
426 | + $is_western_name_order = api_is_western_name_order(); |
|
427 | 427 | |
428 | 428 | if (api_get_setting('show_email_addresses') === 'true') { |
429 | 429 | $select_fields = "u.id AS col0, |
@@ -447,10 +447,10 @@ discard block |
||
447 | 447 | u.active AS col4, |
448 | 448 | u.user_id AS col5"; |
449 | 449 | } |
450 | - if (isset($_REQUEST['type']) && $_REQUEST['type'] == COURSEMANAGER) { |
|
451 | - // adding a teacher through a session |
|
452 | - if (!empty($sessionId)) { |
|
453 | - $sql = "SELECT $select_fields |
|
450 | + if (isset($_REQUEST['type']) && $_REQUEST['type'] == COURSEMANAGER) { |
|
451 | + // adding a teacher through a session |
|
452 | + if (!empty($sessionId)) { |
|
453 | + $sql = "SELECT $select_fields |
|
454 | 454 | FROM $user_table u |
455 | 455 | LEFT JOIN $tbl_session_rel_course_user cu |
456 | 456 | ON |
@@ -460,13 +460,13 @@ discard block |
||
460 | 460 | INNER JOIN $tbl_url_rel_user as url_rel_user |
461 | 461 | ON (url_rel_user.user_id = u.user_id) "; |
462 | 462 | |
463 | - // applying the filter of the additional user profile fields |
|
464 | - if (isset($_GET['subscribe_user_filter_value']) && |
|
465 | - !empty($_GET['subscribe_user_filter_value']) && |
|
466 | - api_get_setting('ProfilingFilterAddingUsers') == 'true' |
|
467 | - ) { |
|
468 | - $field_identification = explode('*',$_GET['subscribe_user_filter_value']); |
|
469 | - $sql .= " |
|
463 | + // applying the filter of the additional user profile fields |
|
464 | + if (isset($_GET['subscribe_user_filter_value']) && |
|
465 | + !empty($_GET['subscribe_user_filter_value']) && |
|
466 | + api_get_setting('ProfilingFilterAddingUsers') == 'true' |
|
467 | + ) { |
|
468 | + $field_identification = explode('*',$_GET['subscribe_user_filter_value']); |
|
469 | + $sql .= " |
|
470 | 470 | LEFT JOIN $table_user_field_values field_values |
471 | 471 | ON field_values.item_id = u.user_id |
472 | 472 | WHERE |
@@ -480,47 +480,47 @@ discard block |
||
480 | 480 | } |
481 | 481 | |
482 | 482 | $sql .= " AND access_url_id = $url_access_id"; |
483 | - } else { |
|
484 | - // adding a teacher NOT through a session |
|
485 | - $sql = "SELECT $select_fields |
|
483 | + } else { |
|
484 | + // adding a teacher NOT through a session |
|
485 | + $sql = "SELECT $select_fields |
|
486 | 486 | FROM $user_table u |
487 | 487 | LEFT JOIN $course_user_table cu |
488 | 488 | ON u.user_id = cu.user_id AND c_id = '".$courseId."'"; |
489 | 489 | |
490 | - // applying the filter of the additional user profile fields |
|
491 | - if (isset($_GET['subscribe_user_filter_value']) && |
|
492 | - !empty($_GET['subscribe_user_filter_value']) && |
|
493 | - api_get_setting('ProfilingFilterAddingUsers') == 'true' |
|
494 | - ) { |
|
495 | - $field_identification = explode('*',$_GET['subscribe_user_filter_value']); |
|
496 | - $sql .= " |
|
490 | + // applying the filter of the additional user profile fields |
|
491 | + if (isset($_GET['subscribe_user_filter_value']) && |
|
492 | + !empty($_GET['subscribe_user_filter_value']) && |
|
493 | + api_get_setting('ProfilingFilterAddingUsers') == 'true' |
|
494 | + ) { |
|
495 | + $field_identification = explode('*',$_GET['subscribe_user_filter_value']); |
|
496 | + $sql .= " |
|
497 | 497 | LEFT JOIN $table_user_field_values field_values |
498 | 498 | ON field_values.item_id = u.user_id |
499 | 499 | WHERE |
500 | 500 | cu.user_id IS NULL AND u.status<>".DRH." AND |
501 | 501 | field_values.field_id = '".intval($field_identification[0])."' AND |
502 | 502 | field_values.value = '".Database::escape_string($field_identification[1])."'"; |
503 | - } else { |
|
504 | - $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." "; |
|
505 | - } |
|
506 | - |
|
507 | - // adding a teacher NOT trough a session on a portal with multiple URLs |
|
508 | - if (api_is_multiple_url_enabled()) { |
|
509 | - if ($url_access_id !=-1) { |
|
510 | - $sql = "SELECT $select_fields |
|
503 | + } else { |
|
504 | + $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." "; |
|
505 | + } |
|
506 | + |
|
507 | + // adding a teacher NOT trough a session on a portal with multiple URLs |
|
508 | + if (api_is_multiple_url_enabled()) { |
|
509 | + if ($url_access_id !=-1) { |
|
510 | + $sql = "SELECT $select_fields |
|
511 | 511 | FROM $user_table u |
512 | 512 | LEFT JOIN $course_user_table cu |
513 | 513 | ON u.user_id = cu.user_id and c_id='".$courseId."' |
514 | 514 | INNER JOIN $tbl_url_rel_user as url_rel_user |
515 | 515 | ON (url_rel_user.user_id = u.user_id) "; |
516 | 516 | |
517 | - // applying the filter of the additional user profile fields |
|
518 | - if (isset($_GET['subscribe_user_filter_value']) && |
|
519 | - !empty($_GET['subscribe_user_filter_value']) && |
|
520 | - api_get_setting('ProfilingFilterAddingUsers') == 'true' |
|
521 | - ){ |
|
522 | - $field_identification = explode('*', $_GET['subscribe_user_filter_value']); |
|
523 | - $sql .= " |
|
517 | + // applying the filter of the additional user profile fields |
|
518 | + if (isset($_GET['subscribe_user_filter_value']) && |
|
519 | + !empty($_GET['subscribe_user_filter_value']) && |
|
520 | + api_get_setting('ProfilingFilterAddingUsers') == 'true' |
|
521 | + ){ |
|
522 | + $field_identification = explode('*', $_GET['subscribe_user_filter_value']); |
|
523 | + $sql .= " |
|
524 | 524 | LEFT JOIN $table_user_field_values field_values |
525 | 525 | ON field_values.item_id = u.user_id |
526 | 526 | WHERE |
@@ -528,16 +528,16 @@ discard block |
||
528 | 528 | u.status<>".DRH." AND |
529 | 529 | field_values.field_id = '".intval($field_identification[0])."' AND |
530 | 530 | field_values.value = '".Database::escape_string($field_identification[1])."'"; |
531 | - } else { |
|
532 | - $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id "; |
|
533 | - } |
|
534 | - } |
|
535 | - } |
|
536 | - } |
|
537 | - } else { |
|
538 | - // adding a student |
|
539 | - if (!empty($sessionId)) { |
|
540 | - $sql = "SELECT $select_fields |
|
531 | + } else { |
|
532 | + $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id "; |
|
533 | + } |
|
534 | + } |
|
535 | + } |
|
536 | + } |
|
537 | + } else { |
|
538 | + // adding a student |
|
539 | + if (!empty($sessionId)) { |
|
540 | + $sql = "SELECT $select_fields |
|
541 | 541 | FROM $user_table u |
542 | 542 | LEFT JOIN $tbl_session_rel_course_user cu |
543 | 543 | ON |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $sql .= "AND access_url_id = $url_access_id"; |
573 | 573 | } |
574 | 574 | |
575 | - } else { |
|
575 | + } else { |
|
576 | 576 | $sql = "SELECT $select_fields |
577 | 577 | FROM $user_table u |
578 | 578 | LEFT JOIN $course_user_table cu |
@@ -580,10 +580,10 @@ discard block |
||
580 | 580 | u.user_id = cu.user_id AND |
581 | 581 | c_id ='".$courseId."'"; |
582 | 582 | |
583 | - // applying the filter of the additional user profile fields |
|
584 | - if (isset($_GET['subscribe_user_filter_value']) && !empty($_GET['subscribe_user_filter_value'])) { |
|
585 | - $field_identification = explode('*',$_GET['subscribe_user_filter_value']); |
|
586 | - $sql .= " |
|
583 | + // applying the filter of the additional user profile fields |
|
584 | + if (isset($_GET['subscribe_user_filter_value']) && !empty($_GET['subscribe_user_filter_value'])) { |
|
585 | + $field_identification = explode('*',$_GET['subscribe_user_filter_value']); |
|
586 | + $sql .= " |
|
587 | 587 | LEFT JOIN $table_user_field_values field_values |
588 | 588 | ON field_values.item_id = u.user_id |
589 | 589 | WHERE |
@@ -591,28 +591,28 @@ discard block |
||
591 | 591 | u.status<>".DRH." AND |
592 | 592 | field_values.field_id = '".intval($field_identification[0])."' AND |
593 | 593 | field_values.value = '".Database::escape_string($field_identification[1])."'"; |
594 | - } else { |
|
595 | - $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." "; |
|
596 | - } |
|
594 | + } else { |
|
595 | + $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." "; |
|
596 | + } |
|
597 | 597 | |
598 | - //showing only the courses of the current Chamilo access_url_id |
|
598 | + //showing only the courses of the current Chamilo access_url_id |
|
599 | 599 | |
600 | - if (api_is_multiple_url_enabled()) { |
|
601 | - if ($url_access_id !=-1) { |
|
602 | - $sql = "SELECT $select_fields |
|
600 | + if (api_is_multiple_url_enabled()) { |
|
601 | + if ($url_access_id !=-1) { |
|
602 | + $sql = "SELECT $select_fields |
|
603 | 603 | FROM $user_table u |
604 | 604 | LEFT JOIN $course_user_table cu |
605 | 605 | ON u.user_id = cu.user_id AND c_id='".$courseId."' |
606 | 606 | INNER JOIN $tbl_url_rel_user as url_rel_user |
607 | 607 | ON (url_rel_user.user_id = u.user_id) "; |
608 | 608 | |
609 | - // applying the filter of the additional user profile fields |
|
610 | - if (isset($_GET['subscribe_user_filter_value']) && |
|
611 | - !empty($_GET['subscribe_user_filter_value']) && |
|
612 | - api_get_setting('ProfilingFilterAddingUsers') == 'true' |
|
613 | - ){ |
|
614 | - $field_identification = explode('*', $_GET['subscribe_user_filter_value']); |
|
615 | - $sql .= " |
|
609 | + // applying the filter of the additional user profile fields |
|
610 | + if (isset($_GET['subscribe_user_filter_value']) && |
|
611 | + !empty($_GET['subscribe_user_filter_value']) && |
|
612 | + api_get_setting('ProfilingFilterAddingUsers') == 'true' |
|
613 | + ){ |
|
614 | + $field_identification = explode('*', $_GET['subscribe_user_filter_value']); |
|
615 | + $sql .= " |
|
616 | 616 | LEFT JOIN $table_user_field_values field_values |
617 | 617 | ON field_values.item_id = u.user_id |
618 | 618 | WHERE |
@@ -622,18 +622,18 @@ discard block |
||
622 | 622 | field_values.value = '".Database::escape_string($field_identification[1])."' AND |
623 | 623 | access_url_id = $url_access_id |
624 | 624 | "; |
625 | - } else { |
|
626 | - $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id "; |
|
627 | - } |
|
628 | - } |
|
629 | - } |
|
630 | - } |
|
631 | - } |
|
632 | - |
|
633 | - // adding additional WHERE statements to the SQL for the search functionality |
|
634 | - if (isset($_REQUEST['keyword'])) { |
|
635 | - $keyword = Database::escape_string(trim($_REQUEST['keyword'])); |
|
636 | - $sql .= " AND ( |
|
625 | + } else { |
|
626 | + $sql .= "WHERE cu.user_id IS NULL AND u.status<>".DRH." AND access_url_id= $url_access_id "; |
|
627 | + } |
|
628 | + } |
|
629 | + } |
|
630 | + } |
|
631 | + } |
|
632 | + |
|
633 | + // adding additional WHERE statements to the SQL for the search functionality |
|
634 | + if (isset($_REQUEST['keyword'])) { |
|
635 | + $keyword = Database::escape_string(trim($_REQUEST['keyword'])); |
|
636 | + $sql .= " AND ( |
|
637 | 637 | firstname LIKE '%".$keyword."%' OR |
638 | 638 | lastname LIKE '%".$keyword."%' OR |
639 | 639 | email LIKE '%".$keyword."%' OR |
@@ -642,39 +642,39 @@ discard block |
||
642 | 642 | ) |
643 | 643 | "; |
644 | 644 | |
645 | - if (api_get_setting('ProfilingFilterAddingUsers') === 'true') { |
|
646 | - // we also want to search for users who have something in |
|
647 | - // their profile fields that matches the keyword |
|
648 | - $additional_users = search_additional_profile_fields($keyword); |
|
649 | - } |
|
650 | - |
|
651 | - // getting all the users of the course (to make sure that we do not |
|
652 | - // display users that are already in the course) |
|
653 | - if (!empty($sessionId)) { |
|
654 | - $a_course_users = CourseManager :: get_user_list_from_course_code($course_code, $sessionId); |
|
655 | - } else { |
|
656 | - $a_course_users = CourseManager :: get_user_list_from_course_code($course_code, 0); |
|
657 | - } |
|
658 | - foreach ($a_course_users as $user_id=>$course_user) { |
|
659 | - $users_of_course[] = $course_user['user_id']; |
|
660 | - } |
|
661 | - } |
|
662 | - |
|
663 | - $sql .=" AND u.status != ".ANONYMOUS." "; |
|
664 | - |
|
665 | - // Sorting and pagination (used by the sortable table) |
|
666 | - $sql .= " ORDER BY col$column $direction "; |
|
645 | + if (api_get_setting('ProfilingFilterAddingUsers') === 'true') { |
|
646 | + // we also want to search for users who have something in |
|
647 | + // their profile fields that matches the keyword |
|
648 | + $additional_users = search_additional_profile_fields($keyword); |
|
649 | + } |
|
650 | + |
|
651 | + // getting all the users of the course (to make sure that we do not |
|
652 | + // display users that are already in the course) |
|
653 | + if (!empty($sessionId)) { |
|
654 | + $a_course_users = CourseManager :: get_user_list_from_course_code($course_code, $sessionId); |
|
655 | + } else { |
|
656 | + $a_course_users = CourseManager :: get_user_list_from_course_code($course_code, 0); |
|
657 | + } |
|
658 | + foreach ($a_course_users as $user_id=>$course_user) { |
|
659 | + $users_of_course[] = $course_user['user_id']; |
|
660 | + } |
|
661 | + } |
|
662 | + |
|
663 | + $sql .=" AND u.status != ".ANONYMOUS." "; |
|
664 | + |
|
665 | + // Sorting and pagination (used by the sortable table) |
|
666 | + $sql .= " ORDER BY col$column $direction "; |
|
667 | 667 | $from = (int) $from; |
668 | 668 | $number_of_items = (int) $number_of_items; |
669 | - $sql .= " LIMIT $from, $number_of_items"; |
|
669 | + $sql .= " LIMIT $from, $number_of_items"; |
|
670 | 670 | |
671 | - $res = Database::query($sql); |
|
672 | - $users = array (); |
|
673 | - while ($user = Database::fetch_row($res)) { |
|
674 | - $users[] = $user; |
|
675 | - } |
|
671 | + $res = Database::query($sql); |
|
672 | + $users = array (); |
|
673 | + while ($user = Database::fetch_row($res)) { |
|
674 | + $users[] = $user; |
|
675 | + } |
|
676 | 676 | |
677 | - return $users; |
|
677 | + return $users; |
|
678 | 678 | } |
679 | 679 | /** |
680 | 680 | * Returns a mailto-link |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | */ |
684 | 684 | function email_filter($email) |
685 | 685 | { |
686 | - return Display :: encrypted_mailto_link($email, $email); |
|
686 | + return Display :: encrypted_mailto_link($email, $email); |
|
687 | 687 | } |
688 | 688 | /** |
689 | 689 | * Build the reg-column of the table |
@@ -699,10 +699,10 @@ discard block |
||
699 | 699 | } |
700 | 700 | $user_id = (int) $user_id; |
701 | 701 | |
702 | - $result = '<a class="btn btn-small btn-primary" href="'.api_get_self().'?'.api_get_cidreq().'®ister=yes&type='.$type.'&user_id='.$user_id.'">'. |
|
702 | + $result = '<a class="btn btn-small btn-primary" href="'.api_get_self().'?'.api_get_cidreq().'®ister=yes&type='.$type.'&user_id='.$user_id.'">'. |
|
703 | 703 | get_lang("reg").'</a>'; |
704 | 704 | |
705 | - return $result; |
|
705 | + return $result; |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | /** |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | function active_filter($active, $url_params, $row) |
718 | 718 | { |
719 | - $_user = api_get_user_info(); |
|
719 | + $_user = api_get_user_info(); |
|
720 | 720 | if ($active == '1') { |
721 | 721 | $action = 'AccountActive'; |
722 | 722 | $image = 'accept'; |
@@ -725,15 +725,15 @@ discard block |
||
725 | 725 | if ($active == '0') { |
726 | 726 | $action = 'AccountInactive'; |
727 | 727 | $image = 'error'; |
728 | - } |
|
728 | + } |
|
729 | 729 | $result = ''; |
730 | 730 | if ($row['0'] <> $_user['user_id']) { |
731 | - // you cannot lock yourself out otherwise you could disable all the accounts |
|
732 | - // including your own => everybody is locked out and nobody can change it anymore. |
|
733 | - $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array() , ICON_SIZE_TINY); |
|
734 | - } |
|
731 | + // you cannot lock yourself out otherwise you could disable all the accounts |
|
732 | + // including your own => everybody is locked out and nobody can change it anymore. |
|
733 | + $result = Display::return_icon($image.'.png', get_lang(ucfirst($action)), array() , ICON_SIZE_TINY); |
|
734 | + } |
|
735 | 735 | |
736 | - return $result; |
|
736 | + return $result; |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | /** |
@@ -751,30 +751,30 @@ discard block |
||
751 | 751 | */ |
752 | 752 | function search_additional_profile_fields($keyword) |
753 | 753 | { |
754 | - // database table definitions |
|
755 | - $table_user_field_options = Database :: get_main_table(TABLE_EXTRA_FIELD_OPTIONS); |
|
756 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
754 | + // database table definitions |
|
755 | + $table_user_field_options = Database :: get_main_table(TABLE_EXTRA_FIELD_OPTIONS); |
|
756 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
757 | 757 | $tableExtraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
758 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
758 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
759 | 759 | |
760 | 760 | $keyword = Database::escape_string($keyword); |
761 | - // getting the field option text that match this keyword (for radio buttons and checkboxes) |
|
762 | - $sql = "SELECT * FROM $table_user_field_options |
|
761 | + // getting the field option text that match this keyword (for radio buttons and checkboxes) |
|
762 | + $sql = "SELECT * FROM $table_user_field_options |
|
763 | 763 | WHERE display_text LIKE '%".$keyword."%'"; |
764 | - $result_profiling = Database::query($sql); |
|
765 | - while ($profiling_field_options = Database::fetch_array($result_profiling)) { |
|
766 | - $profiling_field_options_exact_values[] = $profiling_field_options; |
|
767 | - } |
|
764 | + $result_profiling = Database::query($sql); |
|
765 | + while ($profiling_field_options = Database::fetch_array($result_profiling)) { |
|
766 | + $profiling_field_options_exact_values[] = $profiling_field_options; |
|
767 | + } |
|
768 | 768 | $profiling_field_options_exact_values_sql = ''; |
769 | - foreach ($profiling_field_options_exact_values as $profilingkey => $profilingvalue) { |
|
770 | - $profiling_field_options_exact_values_sql .= " OR (field_id = '".$profilingvalue['field_id']."' AND value='".$profilingvalue['option_value']."') "; |
|
771 | - } |
|
769 | + foreach ($profiling_field_options_exact_values as $profilingkey => $profilingvalue) { |
|
770 | + $profiling_field_options_exact_values_sql .= " OR (field_id = '".$profilingvalue['field_id']."' AND value='".$profilingvalue['option_value']."') "; |
|
771 | + } |
|
772 | 772 | |
773 | 773 | $extraFieldType = ExtraField::USER_FIELD_TYPE; |
774 | 774 | |
775 | - // getting all the user ids of the users who have chosen on of the predefined fields that contain the keyword |
|
776 | - // or all the users who have entered the keyword in a free-form field |
|
777 | - $sql = "SELECT |
|
775 | + // getting all the user ids of the users who have chosen on of the predefined fields that contain the keyword |
|
776 | + // or all the users who have entered the keyword in a free-form field |
|
777 | + $sql = "SELECT |
|
778 | 778 | user.user_id as col0, |
779 | 779 | user.official_code as col1, |
780 | 780 | user.lastname as col2, |
@@ -788,13 +788,13 @@ discard block |
||
788 | 788 | user_values.field_id = e.id AND |
789 | 789 | e.extra_field_type = $extraFieldType AND |
790 | 790 | (value LIKE '%".$keyword."%'".$profiling_field_options_exact_values_sql.")"; |
791 | - $result = Database::query($sql); |
|
791 | + $result = Database::query($sql); |
|
792 | 792 | $additional_users = array(); |
793 | - while ($profiled_users = Database::fetch_array($result)) { |
|
794 | - $additional_users[$profiled_users['col0']] = $profiled_users; |
|
795 | - } |
|
793 | + while ($profiled_users = Database::fetch_array($result)) { |
|
794 | + $additional_users[$profiled_users['col0']] = $profiled_users; |
|
795 | + } |
|
796 | 796 | |
797 | - return $additional_users; |
|
797 | + return $additional_users; |
|
798 | 798 | } |
799 | 799 | |
800 | 800 | /** |
@@ -806,44 +806,44 @@ discard block |
||
806 | 806 | */ |
807 | 807 | function display_extra_profile_fields_filter() |
808 | 808 | { |
809 | - // getting all the additional user profile fields |
|
809 | + // getting all the additional user profile fields |
|
810 | 810 | $extra = UserManager::get_extra_fields(0, 50, 5, 'ASC'); |
811 | - $return = '<option value="">'.get_lang('SelectFilter').'</option>'; |
|
812 | - |
|
813 | - // looping through the additional user profile fields |
|
814 | - foreach ($extra as $id => $field_details) { |
|
815 | - // $field_details[2] contains the type of the additional user profile field |
|
816 | - switch ($field_details[2]) { |
|
817 | - // text fields cannot be used as a filter |
|
818 | - case ExtraFieldModel::FIELD_TYPE_TEXT: |
|
819 | - break; |
|
820 | - // text area fields cannot be used as a filter |
|
821 | - case ExtraFieldModel::FIELD_TYPE_TEXTAREA: |
|
822 | - break; |
|
823 | - case ExtraFieldModel::FIELD_TYPE_RADIO: |
|
824 | - case ExtraFieldModel::FIELD_TYPE_SELECT: |
|
825 | - case ExtraFieldModel::FIELD_TYPE_SELECT_MULTIPLE: |
|
826 | - $return .= '<optgroup label="'.$field_details[3].'">'; |
|
827 | - foreach ($field_details[9] as $option_id => $option_details) { |
|
828 | - if (isset($_GET['subscribe_user_filter_value']) && |
|
811 | + $return = '<option value="">'.get_lang('SelectFilter').'</option>'; |
|
812 | + |
|
813 | + // looping through the additional user profile fields |
|
814 | + foreach ($extra as $id => $field_details) { |
|
815 | + // $field_details[2] contains the type of the additional user profile field |
|
816 | + switch ($field_details[2]) { |
|
817 | + // text fields cannot be used as a filter |
|
818 | + case ExtraFieldModel::FIELD_TYPE_TEXT: |
|
819 | + break; |
|
820 | + // text area fields cannot be used as a filter |
|
821 | + case ExtraFieldModel::FIELD_TYPE_TEXTAREA: |
|
822 | + break; |
|
823 | + case ExtraFieldModel::FIELD_TYPE_RADIO: |
|
824 | + case ExtraFieldModel::FIELD_TYPE_SELECT: |
|
825 | + case ExtraFieldModel::FIELD_TYPE_SELECT_MULTIPLE: |
|
826 | + $return .= '<optgroup label="'.$field_details[3].'">'; |
|
827 | + foreach ($field_details[9] as $option_id => $option_details) { |
|
828 | + if (isset($_GET['subscribe_user_filter_value']) && |
|
829 | 829 | $_GET['subscribe_user_filter_value'] == $field_details[0].'*'.$option_details[1] |
830 | 830 | ) { |
831 | - $selected = 'selected="selected"'; |
|
832 | - } else { |
|
833 | - $selected = false; |
|
834 | - } |
|
835 | - $return .= '<option value="'.$field_details[0].'*'.$option_details[1].'" '.$selected.'>'.$option_details[2].'</option>'; |
|
836 | - } |
|
837 | - $return .= '</optgroup>'; |
|
838 | - break; |
|
839 | - } |
|
840 | - } |
|
841 | - |
|
842 | - $html = '<form class="form-inline" id="subscribe_user_filter" name="subscribe_user_filter" method="get" action="'.api_get_self().'?'.api_get_cidreq().'">'; |
|
843 | - $html .= '<input type="hidden" name="type" id="type" value="'.Security::remove_XSS($_REQUEST['type']).'" />'; |
|
844 | - $html .= '<select name="subscribe_user_filter_value" id="subscribe_user_filter_value">'.$return.'</select>'; |
|
845 | - $html .= '<button type="submit" name="submit_filter" id="submit_filter" value="" class="search">'.get_lang('Filter').'</button>'; |
|
846 | - $html .= '</form>'; |
|
831 | + $selected = 'selected="selected"'; |
|
832 | + } else { |
|
833 | + $selected = false; |
|
834 | + } |
|
835 | + $return .= '<option value="'.$field_details[0].'*'.$option_details[1].'" '.$selected.'>'.$option_details[2].'</option>'; |
|
836 | + } |
|
837 | + $return .= '</optgroup>'; |
|
838 | + break; |
|
839 | + } |
|
840 | + } |
|
841 | + |
|
842 | + $html = '<form class="form-inline" id="subscribe_user_filter" name="subscribe_user_filter" method="get" action="'.api_get_self().'?'.api_get_cidreq().'">'; |
|
843 | + $html .= '<input type="hidden" name="type" id="type" value="'.Security::remove_XSS($_REQUEST['type']).'" />'; |
|
844 | + $html .= '<select name="subscribe_user_filter_value" id="subscribe_user_filter_value">'.$return.'</select>'; |
|
845 | + $html .= '<button type="submit" name="submit_filter" id="submit_filter" value="" class="search">'.get_lang('Filter').'</button>'; |
|
846 | + $html .= '</form>'; |
|
847 | 847 | |
848 | 848 | return $html; |
849 | 849 | } |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | } |
566 | 566 | |
567 | 567 | return $items;*/ |
568 | - $listChoises = api_preg_split("/\|/", $correctAnswer); |
|
568 | + $listChoises = api_preg_split("/\|/", $correctAnswer); |
|
569 | 569 | if ($displayForStudent) { |
570 | 570 | shuffle($listChoises); |
571 | 571 | } |
@@ -789,29 +789,29 @@ discard block |
||
789 | 789 | } |
790 | 790 | |
791 | 791 | /** |
792 | - * Return an array of student state answers for fill the blank questions |
|
793 | - * for each students that answered the question |
|
794 | - * -2 : didn't answer |
|
795 | - * -1 : student answer is wrong |
|
796 | - * 0 : student answer is correct |
|
797 | - * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
798 | - * |
|
799 | - * @param integer $testId |
|
800 | - * @param integer $questionId |
|
801 | - * @param $studentsIdList |
|
802 | - * @param string $startDate |
|
803 | - * @param string $endDate |
|
804 | - * @param bool $useLastAnswerredAttempt |
|
805 | - * @return array |
|
806 | - * ( |
|
807 | - * [student_id] => Array |
|
808 | - * ( |
|
809 | - * [first fill the blank for question] => -1 |
|
810 | - * [second fill the blank for question] => 2 |
|
811 | - * [third fill the blank for question] => -1 |
|
812 | - * ) |
|
813 | - * ) |
|
814 | - */ |
|
792 | + * Return an array of student state answers for fill the blank questions |
|
793 | + * for each students that answered the question |
|
794 | + * -2 : didn't answer |
|
795 | + * -1 : student answer is wrong |
|
796 | + * 0 : student answer is correct |
|
797 | + * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
798 | + * |
|
799 | + * @param integer $testId |
|
800 | + * @param integer $questionId |
|
801 | + * @param $studentsIdList |
|
802 | + * @param string $startDate |
|
803 | + * @param string $endDate |
|
804 | + * @param bool $useLastAnswerredAttempt |
|
805 | + * @return array |
|
806 | + * ( |
|
807 | + * [student_id] => Array |
|
808 | + * ( |
|
809 | + * [first fill the blank for question] => -1 |
|
810 | + * [second fill the blank for question] => 2 |
|
811 | + * [third fill the blank for question] => -1 |
|
812 | + * ) |
|
813 | + * ) |
|
814 | + */ |
|
815 | 815 | public static function getFillTheBlankTabResult( |
816 | 816 | $testId, |
817 | 817 | $questionId, |
@@ -11,88 +11,88 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Response_Headers extends Requests_Utility_CaseInsensitiveDictionary { |
14 | - /** |
|
15 | - * Get the given header |
|
16 | - * |
|
17 | - * Unlike {@see self::getValues()}, this returns a string. If there are |
|
18 | - * multiple values, it concatenates them with a comma as per RFC2616. |
|
19 | - * |
|
20 | - * Avoid using this where commas may be used unquoted in values, such as |
|
21 | - * Set-Cookie headers. |
|
22 | - * |
|
23 | - * @param string $key |
|
24 | - * @return string Header value |
|
25 | - */ |
|
26 | - public function offsetGet($key) { |
|
27 | - $key = strtolower($key); |
|
28 | - if (!isset($this->data[$key])) { |
|
29 | - return null; |
|
30 | - } |
|
14 | + /** |
|
15 | + * Get the given header |
|
16 | + * |
|
17 | + * Unlike {@see self::getValues()}, this returns a string. If there are |
|
18 | + * multiple values, it concatenates them with a comma as per RFC2616. |
|
19 | + * |
|
20 | + * Avoid using this where commas may be used unquoted in values, such as |
|
21 | + * Set-Cookie headers. |
|
22 | + * |
|
23 | + * @param string $key |
|
24 | + * @return string Header value |
|
25 | + */ |
|
26 | + public function offsetGet($key) { |
|
27 | + $key = strtolower($key); |
|
28 | + if (!isset($this->data[$key])) { |
|
29 | + return null; |
|
30 | + } |
|
31 | 31 | |
32 | - return $this->flatten($this->data[$key]); |
|
33 | - } |
|
32 | + return $this->flatten($this->data[$key]); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Set the given item |
|
37 | - * |
|
38 | - * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`) |
|
39 | - * |
|
40 | - * @param string $key Item name |
|
41 | - * @param string $value Item value |
|
42 | - */ |
|
43 | - public function offsetSet($key, $value) { |
|
44 | - if ($key === null) { |
|
45 | - throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset'); |
|
46 | - } |
|
35 | + /** |
|
36 | + * Set the given item |
|
37 | + * |
|
38 | + * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`) |
|
39 | + * |
|
40 | + * @param string $key Item name |
|
41 | + * @param string $value Item value |
|
42 | + */ |
|
43 | + public function offsetSet($key, $value) { |
|
44 | + if ($key === null) { |
|
45 | + throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset'); |
|
46 | + } |
|
47 | 47 | |
48 | - $key = strtolower($key); |
|
48 | + $key = strtolower($key); |
|
49 | 49 | |
50 | - if (!isset($this->data[$key])) { |
|
51 | - $this->data[$key] = array(); |
|
52 | - } |
|
50 | + if (!isset($this->data[$key])) { |
|
51 | + $this->data[$key] = array(); |
|
52 | + } |
|
53 | 53 | |
54 | - $this->data[$key][] = $value; |
|
55 | - } |
|
54 | + $this->data[$key][] = $value; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Get all values for a given header |
|
59 | - * |
|
60 | - * @param string $key |
|
61 | - * @return array Header values |
|
62 | - */ |
|
63 | - public function getValues($key) { |
|
64 | - $key = strtolower($key); |
|
65 | - if (!isset($this->data[$key])) { |
|
66 | - return null; |
|
67 | - } |
|
57 | + /** |
|
58 | + * Get all values for a given header |
|
59 | + * |
|
60 | + * @param string $key |
|
61 | + * @return array Header values |
|
62 | + */ |
|
63 | + public function getValues($key) { |
|
64 | + $key = strtolower($key); |
|
65 | + if (!isset($this->data[$key])) { |
|
66 | + return null; |
|
67 | + } |
|
68 | 68 | |
69 | - return $this->data[$key]; |
|
70 | - } |
|
69 | + return $this->data[$key]; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Flattens a value into a string |
|
74 | - * |
|
75 | - * Converts an array into a string by imploding values with a comma, as per |
|
76 | - * RFC2616's rules for folding headers. |
|
77 | - * |
|
78 | - * @param string|array $value Value to flatten |
|
79 | - * @return string Flattened value |
|
80 | - */ |
|
81 | - public function flatten($value) { |
|
82 | - if (is_array($value)) { |
|
83 | - $value = implode(',', $value); |
|
84 | - } |
|
72 | + /** |
|
73 | + * Flattens a value into a string |
|
74 | + * |
|
75 | + * Converts an array into a string by imploding values with a comma, as per |
|
76 | + * RFC2616's rules for folding headers. |
|
77 | + * |
|
78 | + * @param string|array $value Value to flatten |
|
79 | + * @return string Flattened value |
|
80 | + */ |
|
81 | + public function flatten($value) { |
|
82 | + if (is_array($value)) { |
|
83 | + $value = implode(',', $value); |
|
84 | + } |
|
85 | 85 | |
86 | - return $value; |
|
87 | - } |
|
86 | + return $value; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Get an iterator for the data |
|
91 | - * |
|
92 | - * Converts the internal |
|
93 | - * @return ArrayIterator |
|
94 | - */ |
|
95 | - public function getIterator() { |
|
96 | - return new Requests_Utility_FilteredIterator($this->data, array($this, 'flatten')); |
|
97 | - } |
|
89 | + /** |
|
90 | + * Get an iterator for the data |
|
91 | + * |
|
92 | + * Converts the internal |
|
93 | + * @return ArrayIterator |
|
94 | + */ |
|
95 | + public function getIterator() { |
|
96 | + return new Requests_Utility_FilteredIterator($this->data, array($this, 'flatten')); |
|
97 | + } |
|
98 | 98 | } |
@@ -13,33 +13,33 @@ |
||
13 | 13 | * @subpackage Utilities |
14 | 14 | */ |
15 | 15 | class Requests_Utility_FilteredIterator extends ArrayIterator { |
16 | - /** |
|
17 | - * Callback to run as a filter |
|
18 | - * |
|
19 | - * @var callable |
|
20 | - */ |
|
21 | - protected $callback; |
|
16 | + /** |
|
17 | + * Callback to run as a filter |
|
18 | + * |
|
19 | + * @var callable |
|
20 | + */ |
|
21 | + protected $callback; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Create a new iterator |
|
25 | - * |
|
26 | - * @param array $data |
|
27 | - * @param callable $callback Callback to be called on each value |
|
28 | - */ |
|
29 | - public function __construct($data, $callback) { |
|
30 | - parent::__construct($data); |
|
23 | + /** |
|
24 | + * Create a new iterator |
|
25 | + * |
|
26 | + * @param array $data |
|
27 | + * @param callable $callback Callback to be called on each value |
|
28 | + */ |
|
29 | + public function __construct($data, $callback) { |
|
30 | + parent::__construct($data); |
|
31 | 31 | |
32 | - $this->callback = $callback; |
|
33 | - } |
|
32 | + $this->callback = $callback; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Get the current item's value after filtering |
|
37 | - * |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public function current() { |
|
41 | - $value = parent::current(); |
|
42 | - $value = call_user_func($this->callback, $value); |
|
43 | - return $value; |
|
44 | - } |
|
35 | + /** |
|
36 | + * Get the current item's value after filtering |
|
37 | + * |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public function current() { |
|
41 | + $value = parent::current(); |
|
42 | + $value = call_user_func($this->callback, $value); |
|
43 | + return $value; |
|
44 | + } |
|
45 | 45 | } |
@@ -13,91 +13,91 @@ |
||
13 | 13 | * @subpackage Utilities |
14 | 14 | */ |
15 | 15 | class Requests_Utility_CaseInsensitiveDictionary implements ArrayAccess, IteratorAggregate { |
16 | - /** |
|
17 | - * Actual item data |
|
18 | - * |
|
19 | - * @var array |
|
20 | - */ |
|
21 | - protected $data = array(); |
|
16 | + /** |
|
17 | + * Actual item data |
|
18 | + * |
|
19 | + * @var array |
|
20 | + */ |
|
21 | + protected $data = array(); |
|
22 | 22 | |
23 | - /** |
|
24 | - * Creates a case insensitive dictionary. |
|
25 | - * |
|
26 | - * @param array $data Dictionary/map to convert to case-insensitive |
|
27 | - */ |
|
28 | - public function __construct(array $data = array()) { |
|
29 | - foreach ($data as $key => $value) { |
|
30 | - $this->offsetSet($key, $value); |
|
31 | - } |
|
32 | - } |
|
23 | + /** |
|
24 | + * Creates a case insensitive dictionary. |
|
25 | + * |
|
26 | + * @param array $data Dictionary/map to convert to case-insensitive |
|
27 | + */ |
|
28 | + public function __construct(array $data = array()) { |
|
29 | + foreach ($data as $key => $value) { |
|
30 | + $this->offsetSet($key, $value); |
|
31 | + } |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Check if the given item exists |
|
36 | - * |
|
37 | - * @param string $key Item key |
|
38 | - * @return boolean Does the item exist? |
|
39 | - */ |
|
40 | - public function offsetExists($key) { |
|
41 | - $key = strtolower($key); |
|
42 | - return isset($this->data[$key]); |
|
43 | - } |
|
34 | + /** |
|
35 | + * Check if the given item exists |
|
36 | + * |
|
37 | + * @param string $key Item key |
|
38 | + * @return boolean Does the item exist? |
|
39 | + */ |
|
40 | + public function offsetExists($key) { |
|
41 | + $key = strtolower($key); |
|
42 | + return isset($this->data[$key]); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Get the value for the item |
|
47 | - * |
|
48 | - * @param string $key Item key |
|
49 | - * @return string Item value |
|
50 | - */ |
|
51 | - public function offsetGet($key) { |
|
52 | - $key = strtolower($key); |
|
53 | - if (!isset($this->data[$key])) { |
|
54 | - return null; |
|
55 | - } |
|
45 | + /** |
|
46 | + * Get the value for the item |
|
47 | + * |
|
48 | + * @param string $key Item key |
|
49 | + * @return string Item value |
|
50 | + */ |
|
51 | + public function offsetGet($key) { |
|
52 | + $key = strtolower($key); |
|
53 | + if (!isset($this->data[$key])) { |
|
54 | + return null; |
|
55 | + } |
|
56 | 56 | |
57 | - return $this->data[$key]; |
|
58 | - } |
|
57 | + return $this->data[$key]; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Set the given item |
|
62 | - * |
|
63 | - * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`) |
|
64 | - * |
|
65 | - * @param string $key Item name |
|
66 | - * @param string $value Item value |
|
67 | - */ |
|
68 | - public function offsetSet($key, $value) { |
|
69 | - if ($key === null) { |
|
70 | - throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset'); |
|
71 | - } |
|
60 | + /** |
|
61 | + * Set the given item |
|
62 | + * |
|
63 | + * @throws Requests_Exception On attempting to use dictionary as list (`invalidset`) |
|
64 | + * |
|
65 | + * @param string $key Item name |
|
66 | + * @param string $value Item value |
|
67 | + */ |
|
68 | + public function offsetSet($key, $value) { |
|
69 | + if ($key === null) { |
|
70 | + throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset'); |
|
71 | + } |
|
72 | 72 | |
73 | - $key = strtolower($key); |
|
74 | - $this->data[$key] = $value; |
|
75 | - } |
|
73 | + $key = strtolower($key); |
|
74 | + $this->data[$key] = $value; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Unset the given header |
|
79 | - * |
|
80 | - * @param string $key |
|
81 | - */ |
|
82 | - public function offsetUnset($key) { |
|
83 | - unset($this->data[strtolower($key)]); |
|
84 | - } |
|
77 | + /** |
|
78 | + * Unset the given header |
|
79 | + * |
|
80 | + * @param string $key |
|
81 | + */ |
|
82 | + public function offsetUnset($key) { |
|
83 | + unset($this->data[strtolower($key)]); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Get an iterator for the data |
|
88 | - * |
|
89 | - * @return ArrayIterator |
|
90 | - */ |
|
91 | - public function getIterator() { |
|
92 | - return new ArrayIterator($this->data); |
|
93 | - } |
|
86 | + /** |
|
87 | + * Get an iterator for the data |
|
88 | + * |
|
89 | + * @return ArrayIterator |
|
90 | + */ |
|
91 | + public function getIterator() { |
|
92 | + return new ArrayIterator($this->data); |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Get the headers as an array |
|
97 | - * |
|
98 | - * @return array Header data |
|
99 | - */ |
|
100 | - public function getAll() { |
|
101 | - return $this->data; |
|
102 | - } |
|
95 | + /** |
|
96 | + * Get the headers as an array |
|
97 | + * |
|
98 | + * @return array Header data |
|
99 | + */ |
|
100 | + public function getAll() { |
|
101 | + return $this->data; |
|
102 | + } |
|
103 | 103 | } |
@@ -13,21 +13,21 @@ |
||
13 | 13 | * @subpackage Utilities |
14 | 14 | */ |
15 | 15 | interface Requests_Hooker { |
16 | - /** |
|
17 | - * Register a callback for a hook |
|
18 | - * |
|
19 | - * @param string $hook Hook name |
|
20 | - * @param callback $callback Function/method to call on event |
|
21 | - * @param int $priority Priority number. <0 is executed earlier, >0 is executed later |
|
22 | - */ |
|
23 | - public function register($hook, $callback, $priority = 0); |
|
16 | + /** |
|
17 | + * Register a callback for a hook |
|
18 | + * |
|
19 | + * @param string $hook Hook name |
|
20 | + * @param callback $callback Function/method to call on event |
|
21 | + * @param int $priority Priority number. <0 is executed earlier, >0 is executed later |
|
22 | + */ |
|
23 | + public function register($hook, $callback, $priority = 0); |
|
24 | 24 | |
25 | - /** |
|
26 | - * Dispatch a message |
|
27 | - * |
|
28 | - * @param string $hook Hook name |
|
29 | - * @param array $parameters Parameters to pass to callbacks |
|
30 | - * @return boolean Successfulness |
|
31 | - */ |
|
32 | - public function dispatch($hook, $parameters = array()); |
|
25 | + /** |
|
26 | + * Dispatch a message |
|
27 | + * |
|
28 | + * @param string $hook Hook name |
|
29 | + * @param array $parameters Parameters to pass to callbacks |
|
30 | + * @return boolean Successfulness |
|
31 | + */ |
|
32 | + public function dispatch($hook, $parameters = array()); |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -13,17 +13,17 @@ |
||
13 | 13 | * @package Requests |
14 | 14 | */ |
15 | 15 | class Requests_Exception_HTTP_431 extends Requests_Exception_HTTP { |
16 | - /** |
|
17 | - * HTTP status code |
|
18 | - * |
|
19 | - * @var integer |
|
20 | - */ |
|
21 | - protected $code = 431; |
|
16 | + /** |
|
17 | + * HTTP status code |
|
18 | + * |
|
19 | + * @var integer |
|
20 | + */ |
|
21 | + protected $code = 431; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Reason phrase |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - protected $reason = 'Request Header Fields Too Large'; |
|
23 | + /** |
|
24 | + * Reason phrase |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + protected $reason = 'Request Header Fields Too Large'; |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -11,17 +11,17 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Exception_HTTP_415 extends Requests_Exception_HTTP { |
14 | - /** |
|
15 | - * HTTP status code |
|
16 | - * |
|
17 | - * @var integer |
|
18 | - */ |
|
19 | - protected $code = 415; |
|
14 | + /** |
|
15 | + * HTTP status code |
|
16 | + * |
|
17 | + * @var integer |
|
18 | + */ |
|
19 | + protected $code = 415; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Reason phrase |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $reason = 'Unsupported Media Type'; |
|
21 | + /** |
|
22 | + * Reason phrase |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $reason = 'Unsupported Media Type'; |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -11,17 +11,17 @@ |
||
11 | 11 | * @package Requests |
12 | 12 | */ |
13 | 13 | class Requests_Exception_HTTP_403 extends Requests_Exception_HTTP { |
14 | - /** |
|
15 | - * HTTP status code |
|
16 | - * |
|
17 | - * @var integer |
|
18 | - */ |
|
19 | - protected $code = 403; |
|
14 | + /** |
|
15 | + * HTTP status code |
|
16 | + * |
|
17 | + * @var integer |
|
18 | + */ |
|
19 | + protected $code = 403; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Reason phrase |
|
23 | - * |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $reason = 'Forbidden'; |
|
21 | + /** |
|
22 | + * Reason phrase |
|
23 | + * |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $reason = 'Forbidden'; |
|
27 | 27 | } |
28 | 28 | \ No newline at end of file |