/** * Get user items */ function getItems() { global $lng, $rbacreview, $ilObjDataCache; $this->determineOffsetAndOrder(); include_once "./Services/Registration/classes/class.ilRegistrationCode.php"; $order_map = array("registration_code" => "code", "role" => "role", "registration_generated" => "generated", "registration_used" => "used"); $codes_data = ilRegistrationCode::getCodesData(ilUtil::stripSlashes($order_map[$this->getOrderField()]), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["role"], $this->filter["generated"]); if (count($codes_data["set"]) == 0 && $this->getOffset() > 0) { $this->resetOffset(); $codes_data = ilRegistrationCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["role"], $this->filter["generated"]); } include_once './Services/AccessControl/classes/class.ilObjRole.php'; $options = array(); foreach ($rbacreview->getGlobalRoles() as $role_id) { if (!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID))) { $role_map[$role_id] = $ilObjDataCache->lookupTitle($role_id); } } $result = array(); foreach ($codes_data["set"] as $k => $code) { $result[$k]["registration_generated"] = ilDatePresentation::formatDate(new ilDateTime($code["generated"], IL_CAL_UNIX)); if ($code["used"]) { $result[$k]["registration_used"] = ilDatePresentation::formatDate(new ilDateTime($code["used"], IL_CAL_UNIX)); } else { $result[$k]["registration_used"] = ""; } if ($code["role"]) { $result[$k]["role"] = $this->role_map[$code["role"]]; } $result[$k]["registration_code"] = $code["code"]; $result[$k]["code_id"] = $code["code_id"]; } $this->setMaxCount($codes_data["cnt"]); $this->setData($result); }
/** * Get user items */ function getItems() { global $rbacreview, $ilObjDataCache; $this->determineOffsetAndOrder(); include_once "./Services/Registration/classes/class.ilRegistrationCode.php"; $codes_data = ilRegistrationCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["role"], $this->filter["generated"], $this->filter["alimit"]); if (count($codes_data["set"]) == 0 && $this->getOffset() > 0) { $this->resetOffset(); $codes_data = ilRegistrationCode::getCodesData(ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()), ilUtil::stripSlashes($this->getOffset()), ilUtil::stripSlashes($this->getLimit()), $this->filter["code"], $this->filter["role"], $this->filter["generated"], $this->filter["alimit"]); } include_once './Services/AccessControl/classes/class.ilObjRole.php'; $options = array(); foreach ($rbacreview->getGlobalRoles() as $role_id) { if (!in_array($role_id, array(SYSTEM_ROLE_ID, ANONYMOUS_ROLE_ID))) { $role_map[$role_id] = $ilObjDataCache->lookupTitle($role_id); } } $result = array(); foreach ($codes_data["set"] as $k => $code) { $result[$k]["code"] = $code["code"]; $result[$k]["code_id"] = $code["code_id"]; $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)); } if ($code["role"]) { $result[$k]["role"] = $this->role_map[$code["role"]]; } if ($code["role_local"]) { $local = array(); foreach (explode(";", $code["role_local"]) as $role_id) { $role = ilObject::_lookupTitle($role_id); if ($role) { $local[] = $role; } } if (sizeof($local)) { sort($local); $result[$k]["role_local"] = implode("<br />", $local); } } if ($code["alimit"]) { switch ($code["alimit"]) { case "unlimited": $result[$k]["alimit"] = $this->lng->txt("reg_access_limitation_none"); break; case "absolute": $result[$k]["alimit"] = $this->lng->txt("reg_access_limitation_mode_absolute_target") . ": " . ilDatePresentation::formatDate(new ilDate($code["alimitdt"], IL_CAL_DATE)); break; case "relative": $limit_caption = array(); $limit = unserialize($code["alimitdt"]); if ((int) $limit["d"]) { $limit_caption[] = (int) $limit["d"] . " " . $this->lng->txt("days"); } if ((int) $limit["m"]) { $limit_caption[] = (int) $limit["m"] . " " . $this->lng->txt("months"); } if ((int) $limit["y"]) { $limit_caption[] = (int) $limit["y"] . " " . $this->lng->txt("years"); } if (sizeof($limit_caption)) { $result[$k]["alimit"] = $this->lng->txt("reg_access_limitation_mode_relative_target") . ": " . implode(", ", $limit_caption); } break; } } } $this->setMaxCount($codes_data["cnt"]); $this->setData($result); }