Пример #1
0
 public static function getCommonTimeScope()
 {
     static $timeScope = array();
     if (empty($timeScope)) {
         $time = EnvUtil::getRequest("time");
         $start = EnvUtil::getRequest("start");
         $end = EnvUtil::getRequest("end");
         if (!empty($time)) {
             if (!in_array($time, array("thisweek", "lastweek", "thismonth", "lastmonth"))) {
                 $time = "thisweek";
             }
         } else {
             if (!empty($start) && !empty($end)) {
                 $start = strtotime($start);
                 $end = strtotime($end);
                 if ($start && $end) {
                     $timeScope = array("timestr" => "custom", "start" => $start, "end" => $end);
                 }
             } else {
                 $time = "thisweek";
             }
         }
         if (empty($timeScope)) {
             $timeScope = DateTimeUtil::getStrTimeScope($time);
             $timeScope["timestr"] = $time;
         }
     }
     return $timeScope;
 }
Пример #2
0
 protected function getListFilterParam()
 {
     static $params = array();
     if (empty($params)) {
         $type = EnvUtil::getRequest("type");
         if (!in_array($type, array("all", "perform", "end"))) {
             $type = "all";
         }
         $scope = EnvUtil::getRequest("scope");
         if (!in_array($scope, array("none", "start", "handle", "manage", "focus", "custom"))) {
             $scope = "none";
         }
         $params["beginuser"] = null;
         if ($scope == "custom") {
             $beginUser = EnvUtil::getRequest("beginuser");
             if (!empty($beginUser)) {
                 $params["beginuser"] = $beginUser;
             } else {
                 $scope = "none";
             }
         }
         $time = EnvUtil::getRequest("time");
         $timeScope = array("none", "today", "yesterday", "thisweek", "lastweek", "thismonth", "lastmonth", "custom");
         if (!in_array($time, $timeScope)) {
             $time = "none";
         }
         if ($time == "custom") {
             $start = EnvUtil::getRequest("start") . "";
             $end = EnvUtil::getRequest("end") . "";
             $params["start"] = strtotime($start) !== false ? strtotime($start) : null;
             $params["end"] = strtotime($end) !== false ? strtotime($end) : null;
         } elseif ($time !== "none") {
             $times = DateTimeUtil::getStrTimeScope($time);
             $params["start"] = $times["start"];
             $params["end"] = $times["end"];
         } else {
             $params["start"] = $params["end"] = null;
         }
         $params["flowid"] = intval(EnvUtil::getRequest("flowid"));
         $params["type"] = $type;
         $params["scope"] = $scope;
         $params["time"] = $time;
     }
     return $params;
 }