/** * Fill table row */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilAccess, $rbacsystem; for ($i = -80; $i <= 80; $i += 20) { $this->tpl->setCurrentBlock("flavor"); $this->tpl->setVariable("FLAVOR_NAME", "(" . $i . ")"); $this->tpl->setVariable("FLAVOR_CODE", ilObjStyleSheet::_getColorFlavor($a_set["code"], $i)); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("COLOR_NAME_ENC", ilUtil::prepareFormOutput($a_set["name"])); $this->tpl->setVariable("COLOR_NAME", $a_set["name"]); $this->tpl->setVariable("COLOR_CODE", $a_set["code"]); if ($rbacsystem->checkAccess("write", (int) $_GET["ref_id"])) { $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit")); $ilCtrl->setParameter($this->parent_obj, "c_name", rawurlencode($a_set["name"])); $this->tpl->setVariable("LINK_EDIT_COLOR", $ilCtrl->getLinkTarget($this->parent_obj, "editColor")); } }
/** * Remove a color */ function getColorCodeForName($a_name) { global $ilDB; $pos = strpos($a_name, "("); if ($pos > 0) { $a_i = substr($a_name, $pos + 1); $a_i = str_replace(")", "", $a_i); $a_name = substr($a_name, 0, $pos); } $set = $ilDB->query("SELECT color_code FROM style_color WHERE " . " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " . " color_name = " . $ilDB->quote($a_name, "text")); if ($rec = $ilDB->fetchAssoc($set)) { if ($a_i == "") { return "#" . $rec["color_code"]; } else { return "#" . ilObjStyleSheet::_getColorFlavor($rec["color_code"], (int) $a_i); } } }