users.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. if(Core::$user->level == User::LEVEL_SUPERADMIN) {
  3. $page_title = "Users";
  4. }
  5. else {
  6. $page_title = "Testers";
  7. }
  8. Core::addBreadcrumb("/account", "Account");
  9. Core::addBreadcrumb("/account/users", $page_title);
  10. $first_name = http::value("first_name", "trim");
  11. $last_name = http::value("last_name", "trim");
  12. $email = http::value("email", "trim");
  13. $level = http::value("level", "int");
  14. $customer_id = http::value("customer_id", "int");
  15. $location_id = http::value("location_id", "int");
  16. $nvp = [];
  17. if($first_name !== false) $nvp["first_name"] = ((new Constraint("CONTAINS"))->setValues($first_name));
  18. if($last_name !== false) $nvp["last_name"] = ((new Constraint("CONTAINS"))->setValues($last_name));
  19. if(strlen($email) > 0) $nvp["email"] = $email;
  20. if($level !== false) $nvp["level"] = $level;
  21. $filter_count = "";
  22. if($nvp) $filter_count = count(array_keys($nvp));
  23. if(empty($nvp)) {
  24. $nvp["level"] = (new Constraint("NOT_EQUALS"))->setValues(User::LEVEL_REGISTERED);
  25. }
  26. $users = User::query($nvp);
  27. $pagination_object = Util::getPaginationObject($users);
  28. Core::$page = $pagination_object->page;
  29. Core::$page_count = $pagination_object->pageCount;
  30. $users = array_slice($users, $pagination_object->offset, $pagination_object->pageSize);
  31. View::includeOnce("header", compact("page_title"));
  32. View::include("users", compact("users", "pagination_object", "filter_count", "first_name", "last_name", "email", "level", "customer_id", "location_id"));
  33. View::includeOnce("modal_page_jump");
  34. View::includeOnce("footer");
  35. ?>