• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilObjStyleSheet.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 
00025 require_once "classes/class.ilObject.php";
00026 
00036 class ilObjStyleSheet extends ilObject
00037 {
00038         var $style;
00039 
00040 
00047         function ilObjStyleSheet($a_id = 0, $a_call_by_reference = false)
00048         {
00049                 $this->type = "sty";
00050                 $this->style = array();
00051                 if($a_call_by_reference)
00052                 {
00053                         $this->ilias->raiseError("Can't instantiate style object via reference id.",$this->ilias->error_obj->FATAL);
00054                 }
00055 
00056                 parent::ilObject($a_id, false);
00057         }
00058 
00059         function setRefId()
00060         {
00061                 $this->ilias->raiseError("Operation ilObjStyleSheet::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
00062         }
00063 
00064         function getRefId()
00065         {
00066                 return "";
00067                 //$this->ilias->raiseError("Operation ilObjStyleSheet::getRefId() not allowed.",$this->ilias->error_obj->FATAL);
00068         }
00069 
00070         function putInTree()
00071         {
00072                 $this->ilias->raiseError("Operation ilObjStyleSheet::putInTree() not allowed.",$this->ilias->error_obj->FATAL);
00073         }
00074 
00075         function createReference()
00076         {
00077                 $this->ilias->raiseError("Operation ilObjStyleSheet::createReference() not allowed.",$this->ilias->error_obj->FATAL);
00078         }
00079 
00080         function setUpToDate($a_up_to_date = true)
00081         {
00082                 $this->up_to_date = $a_up_to_date;
00083         }
00084         
00085         function getUpToDate()
00086         {
00087                 return $this->up_to_date;
00088         }
00089         
00090         function _writeUpToDate($a_id, $a_up_to_date)
00091         {
00092                 global $ilDB;
00093 
00094                 $q = "UPDATE style_data SET uptodate = ".$ilDB->quote((int) $a_up_to_date).
00095                         " WHERE id = ".$ilDB->quote($a_id);
00096                 $ilDB->query($q);
00097         }
00098         
00099         function _lookupUpToDate($a_id)
00100         {
00101                 global $ilDB;
00102                 
00103                 $q = "SELECT * FROM style_data ".
00104                         " WHERE id = ".$ilDB->quote($a_id);
00105                 $res = $ilDB->query($q);
00106                 $sty = $res->fetchRow(DB_FETCHMODE_ASSOC);
00107                 
00108                 return (boolean) $sty["uptodate"];
00109         }
00110 
00111         
00115         function assignMetaData(&$a_meta_data)
00116         {
00117                 $this->meta_data =& $a_meta_data;
00118         }
00119 
00123         function &getMetaData()
00124         {
00125                 return $this->meta_data;
00126         }
00127 
00128         function create()
00129         {
00130                 global $ilDB;
00131                 
00132                 parent::create();
00133 
00134                 $def = array(
00135                         array("tag" => "div", "class" => "PageTitle", "parameter" => "margin-top" ,"value" => "5px"),
00136                         array("tag" => "div", "class" => "PageTitle", "parameter" => "margin-bottom" ,"value" => "20px"),
00137                         array("tag" => "div", "class" => "PageTitle", "parameter" => "font-size" ,"value" => "140%"),
00138                         array("tag" => "div", "class" => "PageTitle", "parameter" => "padding-bottom" ,"value" => "3px"),
00139                         array("tag" => "div", "class" => "PageTitle", "parameter" => "border-bottom-width" ,"value" => "1px"),
00140                         array("tag" => "div", "class" => "PageTitle", "parameter" => "border-bottom-style" ,"value" => "solid"),
00141                         array("tag" => "div", "class" => "PageTitle", "parameter" => "border-color" ,"value" => "#000000"),
00142 
00143                         array("tag" => "span", "class" => "Strong", "parameter" => "font-weight" ,"value" => "bold"),
00144                         array("tag" => "span", "class" => "Emph", "parameter" => "font-style" ,"value" => "italic"),
00145                         array("tag" => "span", "class" => "Comment", "parameter" => "color" ,"value" => "green"),
00146                         array("tag" => "span", "class" => "Quotation", "parameter" => "color" ,"value" => "brown"),
00147                         array("tag" => "span", "class" => "Quotation", "parameter" => "font-style" ,"value" => "italic"),
00148 
00149                         array("tag" => "a", "class" => "FootnoteLink", "parameter" => "color" ,"value" => "blue"),
00150                         array("tag" => "a", "class" => "FootnoteLink", "parameter" => "font-weight" ,"value" => "normal"),
00151                         array("tag" => "a", "class" => "FootnoteLink:hover", "parameter" => "color" ,"value" => "#000000"),
00152                         array("tag" => "div", "class" => "Footnote", "parameter" => "margin-top" ,"value" => "5px"),
00153                         array("tag" => "div", "class" => "Footnote", "parameter" => "margin-bottom" ,"value" => "5px"),
00154                         array("tag" => "div", "class" => "Footnote", "parameter" => "font-style" ,"value" => "italic"),
00155 
00156                         array("tag" => "a", "class" => "IntLink", "parameter" => "color" ,"value" => "blue"),
00157                         array("tag" => "a", "class" => "IntLink:visited", "parameter" => "color" ,"value" => "blue"),
00158                         array("tag" => "a", "class" => "IntLink", "parameter" => "font-weight" ,"value" => "normal"),
00159                         array("tag" => "a", "class" => "IntLink", "parameter" => "text-decoration" ,"value" => "underline"),
00160                         array("tag" => "a", "class" => "IntLink:hover", "parameter" => "color" ,"value" => "#000000"),
00161 
00162                         array("tag" => "a", "class" => "ExtLink", "parameter" => "color" ,"value" => "blue"),
00163                         array("tag" => "a", "class" => "ExtLink:visited", "parameter" => "color" ,"value" => "blue"),
00164                         array("tag" => "a", "class" => "ExtLink", "parameter" => "font-weight" ,"value" => "normal"),
00165                         array("tag" => "a", "class" => "ExtLink", "parameter" => "text-decoration" ,"value" => "underline"),
00166                         array("tag" => "a", "class" => "ExtLink:hover", "parameter" => "color" ,"value" => "#000000"),
00167 
00168                         array("tag" => "div", "class" => "LMNavigation", "parameter" => "background-color" ,"value" => "#EEEEEE"),
00169                         array("tag" => "div", "class" => "LMNavigation", "parameter" => "border-style" ,"value" => "outset"),
00170                         array("tag" => "div", "class" => "LMNavigation", "parameter" => "border-color" ,"value" => "#EEEEEE"),
00171                         array("tag" => "div", "class" => "LMNavigation", "parameter" => "border-width" ,"value" => "1px"),
00172                         array("tag" => "div", "class" => "Page", "parameter" => "background-color" ,"value" => "#FFFFFF"),
00173                         array("tag" => "div", "class" => "Page", "parameter" => "padding" ,"value" => "0px"),
00174                         array("tag" => "div", "class" => "Page", "parameter" => "margin" ,"value" => "0px"),
00175                         array("tag" => "td", "class" => "Cell1", "parameter" => "background-color" ,"value" => "#FFCCCC"),
00176                         array("tag" => "td", "class" => "Cell2", "parameter" => "background-color" ,"value" => "#CCCCFF"),
00177                         array("tag" => "td", "class" => "Cell3", "parameter" => "background-color" ,"value" => "#CCFFCC"),
00178                         array("tag" => "td", "class" => "Cell4", "parameter" => "background-color" ,"value" => "#FFFFCC"),
00179 
00180                         array("tag" => "p", "class" => "Standard", "parameter" => "margin-top" ,"value" => "10px"),
00181                         array("tag" => "p", "class" => "Standard", "parameter" => "margin-bottom" ,"value" => "10px"),
00182 
00183                         array("tag" => "p", "class" => "List", "parameter" => "margin-top" ,"value" => "3px"),
00184                         array("tag" => "p", "class" => "List", "parameter" => "margin-bottom" ,"value" => "3px"),
00185 
00186                         array("tag" => "p", "class" => "Headline1", "parameter" => "margin-top" ,"value" => "20px"),
00187                         array("tag" => "p", "class" => "Headline1", "parameter" => "margin-bottom" ,"value" => "10px"),
00188                         array("tag" => "p", "class" => "Headline1", "parameter" => "font-size" ,"value" => "140%"),
00189 
00190                         array("tag" => "p", "class" => "Headline2", "parameter" => "margin-top" ,"value" => "20px"),
00191                         array("tag" => "p", "class" => "Headline2", "parameter" => "margin-bottom" ,"value" => "10px"),
00192                         array("tag" => "p", "class" => "Headline2", "parameter" => "font-size" ,"value" => "130%"),
00193 
00194                         array("tag" => "p", "class" => "Headline3", "parameter" => "margin-top" ,"value" => "20px"),
00195                         array("tag" => "p", "class" => "Headline3", "parameter" => "margin-bottom" ,"value" => "10px"),
00196                         array("tag" => "p", "class" => "Headline3", "parameter" => "font-size" ,"value" => "120%"),
00197 
00198                         array("tag" => "p", "class" => "Example", "parameter" => "padding-left" ,"value" => "20px"),
00199                         array("tag" => "p", "class" => "Example", "parameter" => "border-left" ,"value" => "3px"),
00200                         array("tag" => "p", "class" => "Example", "parameter" => "border-left-style" ,"value" => "solid"),
00201                         array("tag" => "p", "class" => "Example", "parameter" => "border-left-color" ,"value" => "blue"),
00202 
00203                         array("tag" => "p", "class" => "Citation", "parameter" => "color" ,"value" => "brown"),
00204                         array("tag" => "p", "class" => "Citation", "parameter" => "font-style" ,"value" => "italic"),
00205 
00206                         array("tag" => "p", "class" => "Mnemonic", "parameter" => "margin-left" ,"value" => "20px"),
00207                         array("tag" => "p", "class" => "Mnemonic", "parameter" => "margin-right" ,"value" => "20px"),
00208                         array("tag" => "p", "class" => "Mnemonic", "parameter" => "color" ,"value" => "red"),
00209                         array("tag" => "p", "class" => "Mnemonic", "parameter" => "padding" ,"value" => "10px"),
00210                         array("tag" => "p", "class" => "Mnemonic", "parameter" => "border" ,"value" => "1px"),
00211                         array("tag" => "p", "class" => "Mnemonic", "parameter" => "border-style" ,"value" => "solid"),
00212                         array("tag" => "p", "class" => "Mnemonic", "parameter" => "border-color" ,"value" => "red"),
00213 
00214                         array("tag" => "p", "class" => "Additional", "parameter" => "padding" ,"value" => "10px"),
00215                         array("tag" => "p", "class" => "Additional", "parameter" => "border" ,"value" => "1px"),
00216                         array("tag" => "p", "class" => "Additional", "parameter" => "border-style" ,"value" => "solid"),
00217                         array("tag" => "p", "class" => "Additional", "parameter" => "border-color" ,"value" => "blue"),
00218 
00219                         array("tag" => "p", "class" => "Remark", "parameter" => "padding" ,"value" => "10px"),
00220                         array("tag" => "p", "class" => "Remark", "parameter" => "border" ,"value" => "1px"),
00221                         array("tag" => "p", "class" => "Remark", "parameter" => "border-style" ,"value" => "solid"),
00222                         array("tag" => "p", "class" => "Remark", "parameter" => "border-color" ,"value" => "#909090"),
00223                         array("tag" => "p", "class" => "Remark", "parameter" => "background-color" ,"value" => "#D0D0D0"),
00224                         array("tag" => "p", "class" => "Remark", "parameter" => "text-align" ,"value" => "right"),
00225 
00226                         array("tag" => "p", "class" => "TableContent", "parameter" => "margin-left" ,"value" => "0px"),
00227                         array("tag" => "p", "class" => "TableContent", "parameter" => "margin-right" ,"value" => "0px"),
00228                         array("tag" => "p", "class" => "TableContent", "parameter" => "margin-top" ,"value" => "0px"),
00229                         array("tag" => "p", "class" => "TableContent", "parameter" => "margin-bottom" ,"value" => "0px"),
00230                         array("tag" => "p", "class" => "TableContent", "parameter" => "padding-left" ,"value" => "0px"),
00231                         array("tag" => "p", "class" => "TableContent", "parameter" => "padding-right" ,"value" => "0px"),
00232                         array("tag" => "p", "class" => "TableContent", "parameter" => "padding-top" ,"value" => "0px"),
00233                         array("tag" => "p", "class" => "TableContent", "parameter" => "padding-bottom" ,"value" => "0px"),
00234 
00235                         array("tag" => "table", "class" => "Media", "parameter" => "background-color" ,"value" => "#F5F5F5"),
00236                         array("tag" => "table", "class" => "Media", "parameter" => "padding" ,"value" => "0px"),
00237                         array("tag" => "table", "class" => "Media", "parameter" => "margin" ,"value" => "10px"),
00238 
00239                         array("tag" => "td", "class" => "MediaCaption", "parameter" => "padding" ,"value" => "5px")
00240                 );
00241 
00242 
00243                 // default style settings
00244                 foreach ($def as $sty)
00245                 {
00246                         $q = "INSERT INTO style_parameter (style_id, tag, class, parameter, value) VALUES ".
00247                                 "('".$this->getId()."','".$sty["tag"]."','".$sty["class"].
00248                                 "','".$sty["parameter"]."','".$sty["value"]."')";
00249                         $ilDB->query($q);
00250                 }
00251                 
00252                 // add style_data record
00253                 $q = "INSERT INTO style_data (id, uptodate) VALUES ".
00254                         "(".$ilDB->quote($this->getId()).", 0)";
00255                 $ilDB->query($q);
00256 
00257                 $this->read();
00258                 $this->writeCSSFile();
00259         }
00260 
00267         function addParameter($a_tag, $a_par)
00268         {
00269                 $avail_params = $this->getAvailableParameters();
00270                 $tag = explode(".", $a_tag);
00271                 $value = $avail_params[$a_par][0];
00272                 $q = "INSERT INTO style_parameter (style_id, tag, class, parameter, value) VALUES ".
00273                         "('".$this->getId()."','".$tag[0]."','".$tag[1].
00274                         "','".$a_par."','".$value."')";
00275                 $this->ilias->db->query($q);
00276                 $this->read();
00277                 $this->writeCSSFile();
00278         }
00279 
00285         function deleteParameter($a_id)
00286         {
00287                 $q = "DELETE FROM style_parameter WHERE id = '".$a_id."'";
00288                 $this->ilias->db->query($q);
00289         }
00290 
00291 
00295         function delete()
00296         {
00297                 global $ilDB;
00298                 
00299                 // delete object
00300                 parent::delete();
00301                 
00302                 // check whether this style is global default
00303                 $def_style = $this->ilias->getSetting("default_content_style_id");              
00304                 if ($def_style == $this->getId())
00305                 {
00306                         $this->ilias->deleteSetting("default_content_style_id");
00307                 }
00308 
00309                 // check whether this style is global fixed
00310                 $fixed_style = $this->ilias->getSetting("fixed_content_style_id");              
00311                 if ($fixed_style == $this->getId())
00312                 {
00313                         $this->ilias->deleteSetting("fixed_content_style_id");
00314                 }
00315 
00316                 // delete style parameter
00317                 $q = "DELETE FROM style_parameter WHERE style_id = ".$ilDB->quote($this->getId());
00318                 $ilDB->query($q);
00319                 
00320                 // delete style file
00321                 $css_file_name = ilUtil::getWebspaceDir()."/css/style_".$this->getId().".css";
00322                 if (is_file($css_file_name))
00323                 {
00324                         unlink($css_file_name);
00325                 }
00326                 
00327                 // delete entries in learning modules
00328                 include_once("content/classes/class.ilObjContentObject.php");
00329                 ilObjContentObject::_deleteStyleAssignments($this->getId());
00330                 
00331                 // delete style data record
00332                 $q = "DELETE FROM style_data WHERE id = ".$ilDB->quote($this->getId());
00333                 $ilDB->query($q);
00334 
00335         }
00336 
00337 
00341         function read()
00342         {
00343                 global $ilDB;
00344                 
00345                 parent::read();
00346 
00347                 $q = "SELECT * FROM style_parameter WHERE style_id = '".$this->getId()."' ORDER BY tag, class ";
00348                 $style_set = $this->ilias->db->query($q);
00349                 $ctag = "";
00350                 $cclass = "";
00351                 $this->style = array();
00352                 while($style_rec = $style_set->fetchRow(DB_FETCHMODE_ASSOC))
00353                 {
00354                         if ($style_rec["tag"] != $ctag || $style_rec["class"] != $cclass)
00355                         {
00356                                 // add current tag array to style array
00357                                 if(is_array($tag))
00358                                 {
00359                                         $this->style[] = $tag;
00360                                 }
00361                                 $tag = array();
00362                         }
00363                         $ctag = $style_rec["tag"];
00364                         $cclass = $style_rec["class"];
00365                         $tag[] = $style_rec;
00366                 }
00367                 if(is_array($tag))
00368                 {
00369                         $this->style[] = $tag;
00370                 }
00371                 
00372                 $q = "SELECT * FROM style_data WHERE id = ".$ilDB->quote($this->getId());
00373                 $res = $ilDB->query($q);
00374                 $sty = $res->fetchRow(DB_FETCHMODE_ASSOC);
00375                 $this->setUpToDate((boolean) $sty["uptodate"]);
00376                 
00377         }
00378 
00382         function writeCSSFile($a_target_file = "")
00383         {
00384                 $style = $this->getStyle();
00385 
00386                 if ($a_target_file == "")
00387                 {
00388                         $css_file_name = ilUtil::getWebspaceDir()."/css/style_".$this->getId().".css";
00389                 }
00390                 else
00391                 {
00392                         $css_file_name = $a_target_file;
00393                 }
00394                 $css_file = fopen($css_file_name, "w");
00395                 
00396                 $page_background = "";
00397 
00398                 foreach ($style as $tag)
00399                 {
00400                         fwrite ($css_file, $tag[0]["tag"].".ilc_".$tag[0]["class"]."\n");
00401                         fwrite ($css_file, "{\n");
00402 
00403                         foreach($tag as $par)
00404                         {
00405                                 fwrite ($css_file, "\t".$par["parameter"].": ".$par["value"].";\n");
00406                                 
00407                                 // save page background
00408                                 if ($tag[0]["tag"] == "div" && $tag[0]["class"] == "Page"
00409                                         && $par["parameter"] == "background-color")
00410                                 {
00411                                         $page_background = $par["value"];
00412                                 }
00413                         }
00414                         fwrite ($css_file, "}\n");
00415                         fwrite ($css_file, "\n");
00416                 }
00417                 
00418                 if ($page_background != "")
00419                 {
00420                         fwrite ($css_file, "td.ilc_Page\n");
00421                         fwrite ($css_file, "{\n");
00422                         fwrite ($css_file, "\t"."background-color: ".$page_background.";\n");
00423                         fwrite ($css_file, "}\n");
00424                 }
00425                 fclose($css_file);
00426                 
00427                 $this->setUpToDate(true);
00428                 $this->_writeUpToDate($this->getId(), true);
00429         }
00430 
00431 
00437         function getContentStylePath($a_style_id)
00438         {
00439                 global $ilias;
00440                 
00441                 $rand = rand(1,999999);
00442                 
00443                 
00444                 // check global fixed content style
00445                 $fixed_style = $ilias->getSetting("fixed_content_style_id");
00446                 if ($fixed_style > 0)
00447                 {
00448                         $a_style_id = $fixed_style;
00449                 }
00450 
00451                 // check global default style
00452                 if ($a_style_id <= 0)
00453                 {
00454                         $a_style_id = $ilias->getSetting("default_content_style_id");
00455                 }
00456 
00457                 if ($a_style_id > 0 && ilObject::_exists($a_style_id))
00458                 {
00459                         // check whether file is up to date
00460                         if (!ilObjStyleSheet::_lookupUpToDate($a_style_id))
00461                         {
00462                                 $style = new ilObjStyleSheet($a_style_id);
00463                                 $style->writeCSSFile();
00464                         }
00465                         
00466                         return ilUtil::getWebspaceDir("output").
00467                                 "/css/style_".$a_style_id.".css?dummy=$rand";
00468                 }
00469                 else            // todo: work this out
00470                 {
00471                         if (defined("ILIAS_MODULE"))
00472                         {
00473                                 return "../content/content.css";
00474                         }
00475                         else
00476                         {
00477                                 return "./content/content.css";
00478                         }
00479                 }
00480         }
00481 
00487         function getContentPrintStyle()
00488         {
00489                 if (defined("ILIAS_MODULE"))
00490                 {
00491                         return "../content/print_content.css";
00492                 }
00493                 else
00494                 {
00495                         return "./content/print_content.css";
00496                 }
00497         }
00498 
00504         function getSyntaxStylePath()
00505         {
00506                 if (defined("ILIAS_MODULE"))
00507                 {
00508                         return "../content/syntaxhighlight.css";
00509                 }
00510                 else
00511                 {
00512                         return "./content/syntaxhighlight.css";
00513                 }
00514         }
00515 
00516         function update()
00517         {
00518                 parent::update();
00519                 $this->read();                          // this could be done better
00520                 $this->writeCSSFile();
00521         }
00522 
00523         function updateStyleParameter($a_id, $a_value)
00524         {
00525                 $q = "UPDATE style_parameter SET VALUE='".$a_value."' WHERE id = '".$a_id."'";
00526                 $style_set = $this->ilias->db->query($q);
00527         }
00528 
00532         function getStyle()
00533         {
00534                 return $this->style;
00535         }
00536         
00540         function setStyle($a_style)
00541         {
00542                 $this->style = $a_style;
00543         }
00544         
00545         
00549         function getXML()
00550         {
00551                 $xml.= "<StyleSheet>";
00552                 $xml.= "<Title>".$this->getTitle()."</Title>";
00553                 $xml.= "<Description>".$this->getDescription()."</Description>";
00554                 foreach($this->style as $style)
00555                 {
00556                         $xml.= "<Style Tag=\"".$style[0]["tag"]."\" Class=\"".$style[0]["class"]."\">";
00557                         foreach($style as $tag)
00558                         {
00559                                 $xml.="<StyleParameter Name=\"".$tag["parameter"]."\" Value=\"".$tag["value"]."\"/>";
00560                         }
00561                         $xml.= "</Style>";
00562                 }
00563                 $xml.= "</StyleSheet>";
00564                 
00565                 return $xml;
00566         }
00567         
00568         
00572         function exportXML($a_dir)
00573         {
00574                 $file = $a_dir."/style.xml";
00575                 
00576                 // open file
00577                 if (!($fp = @fopen($file,"w")))
00578                 {
00579                         die ("<b>Error</b>: Could not open \"".$file."\" for writing".
00580                                         " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
00581                 }
00582                 
00583                 // set file permissions
00584                 chmod($file, 0770);
00585                 
00586                 // write xml data into the file
00587                 fwrite($fp, $this->getXML());
00588                 
00589                 // close file
00590                 fclose($fp);
00591 
00592         }
00593 
00597         function createFromXMLFile($a_file)
00598         {
00599                 global $ilDB;
00600                 
00601                 parent::create();               
00602                 include_once("classes/class.ilStyleImportParser.php");
00603                 $importParser = new ilStyleImportParser($a_file, $this);
00604                 $importParser->startParsing();
00605                 
00606                 // store style parameter
00607                 foreach ($this->style as $style)
00608                 {
00609                         foreach($style as $tag)
00610                         {
00611                                 $q = "INSERT INTO style_parameter (style_id, tag, class, parameter, value) VALUES ".
00612                                         "('".$this->getId()."','".$tag["tag"]."','".$tag["class"].
00613                                         "','".$tag["parameter"]."','".$tag["value"]."')";
00614                                 $this->ilias->db->query($q);
00615                         }
00616                 }
00617                 
00618                 // add style_data record
00619                 $q = "INSERT INTO style_data (id, uptodate) VALUES ".
00620                         "(".$ilDB->quote($this->getId()).", 0)";
00621                 $ilDB->query($q);
00622                 
00623                 $this->update();
00624                 $this->read();
00625                 $this->writeCSSFile();
00626         }
00627         
00631         function getAvailableTags()
00632         {
00633                 $tags = array("a.FootnoteLink", "a.FootnoteLink:hover", "a.IntLink", "a.IntLink:hover",
00634                         "a.IntLink:visited", "a.IntLink:active",
00635                         "a.ExtLink", "a.ExtLink:hover", "a.ExtLink:visited", "a.ExtLink:active",
00636                         "div.Footnote", "div.LMNavigation", "div.Page", "div.PageTitle", "span.Comment",
00637                         "span.Emph", "span.Quotation", "span.Strong",
00638                         "td.Cell1", "td.Cell2", "td.Cell3", "td.Cell4",
00639                         "p.Standard", "p.List", "p.Headline1", "p.Headline2", "p.Headline3",
00640                         "p.Example", "p.Citation", "p.Mnemonic", "p.Additional", "p.Remark",
00641                         "p.TableContent",
00642                         "table.Media", "td.MediaCaption");
00643 
00644                 return $tags;
00645         }
00646 
00647         function getAvailableParameters()
00648         {
00649                 $pars = array(
00650                         "font-family" => array(),
00651                         "font-style" => array("italic", "oblique", "normal"),
00652                         "font-variant" => array("small-caps", "normal"),
00653                         "font-weight" => array("bold", "normal", "bolder", "lighter"),
00654                         "font-stretch" => array("wider", "narrower", "condensed", "semi-condensed",
00655                                         "extra-condensed", "ultra-condensed", "expanded", "semi-expanded",
00656                                         "extra-expanded", "ultra-expanded", "normal"),
00657                         "font-size" => array(),
00658                         "word-spacing" => array(),
00659                         "letter-spacing" => array(),
00660                         "text-decoration" => array("underline", "overline", "line-through", "blink", "none"),
00661                         "text-transform" => array("capitalize", "uppercase", "lowercase", "none"),
00662                         "color" => array(),
00663 
00664                         "text-indent" => array(),
00665                         "line-height" => array(),
00666                         "vertical-align" => array("top", "middle", "bottom", "baseline", "sub", "super",
00667                                 "text-top", "text-bottom"),
00668                         "text-align" => array("left", "center", "right", "justify"),
00669                         "white-space" => array("normal", "pre", "nowrap"),
00670 
00671                         "margin" => array(),
00672                         "margin-top" => array(),
00673                         "margin-bottom" => array(),
00674                         "margin-left" => array(),
00675                         "margin-right" => array(),
00676 
00677                         "padding" => array(),
00678                         "padding-top" => array(),
00679                         "padding-bottom" => array(),
00680                         "padding-left" => array(),
00681                         "padding-right" => array(),
00682 
00683                         "border-width" => array(),
00684                         "border-width-top" => array(),
00685                         "border-width-bottom" => array(),
00686                         "border-width-left" => array(),
00687                         "border-width-right" => array(),
00688 
00689                         "border-color" => array(),
00690                         "border-top-color" => array(),
00691                         "border-bottom-color" => array(),
00692                         "border-left-color" => array(),
00693                         "border-right-color" => array(),
00694 
00695                         "border-style" => array("none", "hidden", "dotted", "dashed", "solid", "double",
00696                                 "groove", "ridge", "inset", "outset"),
00697                         "border-top-style" => array("none", "hidden", "dotted", "dashed", "solid", "double",
00698                                 "groove", "ridge", "inset", "outset"),
00699                         "border-bottom-style" => array("none", "hidden", "dotted", "dashed", "solid", "double",
00700                                 "groove", "ridge", "inset", "outset"),
00701                         "border-left-style" => array("none", "hidden", "dotted", "dashed", "solid", "double",
00702                                 "groove", "ridge", "inset", "outset"),
00703                         "border-right-style" => array("none", "hidden", "dotted", "dashed", "solid", "double",
00704                                 "groove", "ridge", "inset", "outset"),
00705 
00706                         "background-color" => array(),
00707                         "background-image" => array(),
00708                         "background-repeat" => array("repeat", "repeat-x", "repeat-y", "no-repeat"),
00709                         "background-attachment" => array("fixed", "scroll"),
00710                         "background-position" => array("top", "center", "middle", "bottom", "left", "right"),
00711 
00712                         "cursor" => array("auto", "default", "crosshair", "pointer", "move",
00713                                 "n-resize", "ne-resize", "e-resize", "se-resize", "s-resize", "sw-resize",
00714                                 "w-resize", "nw-resize", "text", "wait", "help"),
00715                         "clear" => array ("non","left","right","both")
00716                 );
00717 
00718                 return $pars;
00719         }
00720 
00721 } // END class.ilObjStyleSheet
00722 ?>

Generated on Fri Dec 13 2013 11:57:55 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1