users.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. $users = User::query($nvp);
  24. $pagination_object = Util::getPaginationObject($users);
  25. Core::$page = $pagination_object->page;
  26. Core::$page_count = $pagination_object->pageCount;
  27. $users = array_slice($users, $pagination_object->offset, $pagination_object->pageSize);
  28. View::includeOnce("header", compact("page_title"));
  29. View::include("users", compact("users", "pagination_object", "filter_count", "first_name", "last_name", "email", "level", "customer_id", "location_id"));
  30. View::includeOnce("footer");
  31. ?>