protected function listCalendar($st, $et, $uid) { $curUid = Ibos::app()->user->uid; $list["calendar"] = Calendars::model()->listCalendarByRange($st, $et, $uid); $allowEdit = CalendarUtil::getIsAllowEdit(); $tmpret["events"] = array(); foreach ($list["calendar"]["events"] as $key => $row) { $spanday = date("Y-m-d", $row["starttime"]) < date("Y-m-d", $row["endtime"]) ? 1 : 0; if ($row["lock"]) { $editAble = 0; } else { if ($row["uid"] == $curUid || $allowEdit || $curUid == $row["upuid"]) { $editAble = 1; } else { $editAble = 0; } } $tmpret["events"][] = array("id" => $row["calendarid"], "title" => $row["subject"], "start" => CalendarUtil::php2JsTime($row["starttime"]), "end" => CalendarUtil::php2JsTime($row["endtime"]), "allDay" => $row["isalldayevent"], "acrossDay" => $spanday, "type" => $row["instancetype"], "category" => $row["category"], "editable" => $editAble, "location" => $row["location"], "attends" => "", "status" => $row["status"], "loopId" => $row["masterid"]); } foreach ($tmpret["events"] as $key => $row) { $beginarr[$key] = $row["start"]; } if (!empty($beginarr)) { array_multisort($beginarr, SORT_ASC, $tmpret["events"]); } $ret = $list["calendar"]; $ret["events"] = $tmpret["events"]; return $ret; }