/** * Get user items */ function getItems() { global $lng, $rbacreview, $ilObjDataCache; $this->determineOffsetAndOrder(); include_once "./Services/User/classes/class.ilAccountCode.php"; $codes_data = ilAccountCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["valid_until"], $this->filter["generated"]); if (count($codes_data["set"]) == 0 && $this->getOffset() > 0) { $this->resetOffset(); $codes_data = ilAccountCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["valid_until"], $this->filter["generated"]); } $result = array(); foreach ($codes_data["set"] as $k => $code) { $result[$k]["generated"] = ilDatePresentation::formatDate(new ilDateTime($code["generated"], IL_CAL_UNIX)); if ($code["used"]) { $result[$k]["used"] = ilDatePresentation::formatDate(new ilDateTime($code["used"], IL_CAL_UNIX)); } else { $result[$k]["used"] = ""; } if ($code["valid_until"] === "0") { $valid = $lng->txt("user_account_code_valid_until_unlimited"); } else { if (is_numeric($code["valid_until"])) { $valid = $code["valid_until"] . " " . ($code["valid_until"] == 1 ? $lng->txt("day") : $lng->txt("days")); } else { $valid = ilDatePresentation::formatDate(new ilDate($code["valid_until"], IL_CAL_DATE)); } } $result[$k]["valid_until"] = $valid; $result[$k]["code"] = $code["code"]; $result[$k]["code_id"] = $code["code_id"]; } $this->setMaxCount($codes_data["cnt"]); $this->setData($result); }