Ejemplo n.º 1
0
 /**
  * Update color
  */
 function updateColor($a_name, $a_new_name, $a_code)
 {
     global $ilDB;
     // todo: update names in parameters as well
     $ilDB->manipulate("UPDATE style_color SET " . "color_name = " . $ilDB->quote($a_new_name, "text") . ", " . "color_code = " . $ilDB->quote($a_code, "text") . " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND color_name = " . $ilDB->quote($a_name, "text"));
     ilObjStyleSheet::_writeUpToDate($this->getId(), false);
     // rename also the name in the style parameter values
     if ($a_name != $a_new_name) {
         $set = $ilDB->query("SELECT * FROM style_parameter " . " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND (" . " parameter = " . $ilDB->quote("background-color", "text") . " OR " . " parameter = " . $ilDB->quote("color", "text") . " OR " . " parameter = " . $ilDB->quote("border-color", "text") . " OR " . " parameter = " . $ilDB->quote("border-top-color", "text") . " OR " . " parameter = " . $ilDB->quote("border-bottom-color", "text") . " OR " . " parameter = " . $ilDB->quote("border-left-color", "text") . " OR " . " parameter = " . $ilDB->quote("border-right-color", "text") . ")");
         while ($rec = $ilDB->fetchAssoc($set)) {
             if ($rec["value"] == "!" . $a_name || is_int(strpos($rec["value"], "!" . $a_name . "("))) {
                 // parameter is based on color -> rename it
                 $this->replaceStylePar($rec["tag"], $rec["class"], $rec["parameter"], str_replace($a_name, $a_new_name, $rec["value"]), $rec["type"]);
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Paste characteristics
  *
  * @param
  * @return
  */
 function pasteCharacteristicsObject()
 {
     global $ilCtrl, $lng;
     if (is_array($_POST["title"])) {
         foreach ($_POST["title"] as $from_char => $to_title) {
             $fc = explode(".", $from_char);
             if ($_POST["conflict_action"][$from_char] == "overwrite" || !$this->object->characteristicExists($to_title, $fc[0])) {
                 $this->object->copyCharacteristic($_POST["from_style_id"], $fc[0], $fc[2], $to_title);
             }
         }
         ilObjStyleSheet::_writeUpToDate($this->object->getId(), false);
         unset($_SESSION["sty_copy"]);
         ilUtil::sendSuccess($lng->txt("sty_style_classes_copied"), true);
     }
     $ilCtrl->redirect($this, "edit");
 }