ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjStyleSheet Class Reference

Class ilObjStyleSheet. More...

+ Inheritance diagram for ilObjStyleSheet:
+ Collaboration diagram for ilObjStyleSheet:

Public Member Functions

 ilObjStyleSheet ($a_id=0, $a_call_by_reference=false)
 Constructor public.
 setRefId ()
 Set ref id (show error message, since styles do not use ref ids)
 getRefId ()
 Get ref id (show error message, since styles do not use ref ids)
 putInTree ()
 Put in tree (show error message, since styles do not use ref ids)
 createReference ()
 Create a reference (show error message, since styles do not use ref ids)
 setUpToDate ($a_up_to_date=true)
 Set style up to date (false + update will trigger css generation next time)
 getUpToDate ()
 Get up to date.
 setScope ($a_scope)
 Set scope.
 getScope ()
 Get scope.
 _writeUpToDate ($a_id, $a_up_to_date)
 Write up to date.
 _lookupUpToDate ($a_id)
 Looup up to date.
 _writeStandard ($a_id, $a_std)
 Write standard flag.
 _writeScope ($a_id, $a_scope)
 Write scope.
 _lookupStandard ($a_id)
 Lookup standard flag.
 _writeActive ($a_id, $a_active)
 Write active flag.
 _lookupActive ($a_id)
 Lookup active flag.
 _getStandardStyles ($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
 Get standard styles.
 _getClonableContentStyles ()
 Get all clonable styles (active standard styles and individual learning module styles with write permission).
 assignMetaData (&$a_meta_data)
 assign meta data object
getMetaData ()
 get meta data object
 create ($a_from_style=0, $a_import_mode=false)
 Create a new style.
 deleteCharacteristic ($a_type, $a_tag, $a_class)
 Delete Characteristic.
 characteristicExists ($a_char, $a_style_type)
 Check whether characteristic exists.
 addCharacteristic ($a_type, $a_char, $a_hidden=false)
 Add characteristic.
 copyCharacteristic ($a_from_style_id, $a_from_type, $a_from_char, $a_to_char)
 Copy characteristic.
 getCharacteristics ($a_type="", $a_no_hidden=false)
 Get characteristics.
 setCharacteristics ($a_chars)
 Set characteristics.
 saveHideStatus ($a_type, $a_char, $a_hide)
 Save characteristic hide status.
 getHideStatus ($a_type, $a_char)
 Get characteristic hide status.
 ilClone ()
 clone style sheet (note: styles have no ref ids and return an object id)
 copyImagesToDir ($a_target)
 Copy images to directory.
 addParameter ($a_tag, $a_par, $a_type)
 write style parameter to db
 createImagesDirectory ()
 Create images directory <data_dir>/sty/sty_<id>/images.
 getImagesDirectory ()
 Get images directory.
 getThumbnailsDirectory ()
 Get thumbnails directory.
 getImages ()
 Get images of style.
 uploadImage ($a_file)
 Upload image.
 deleteImage ($a_file)
 Delete an image.
 deleteParameter ($a_id)
 delete style parameter
 deleteStylePar ($a_tag, $a_class, $a_par, $a_type)
 Delete style parameter by tag/class/parameter.
 deleteStyleParOfChar ($a_type, $a_class)
 Delete style parameters of characteristic.
 delete ()
 delete style object
 read ()
 read style properties
 writeCSSFile ($a_target_file="", $a_image_dir="")
 write css file to webspace directory
 getParametersOfClass ($a_type, $a_class)
 Get parameters of class.
 getContentStylePath ($a_style_id)
 get content style path
 getContentPrintStyle ()
 get content print style
 getSyntaxStylePath ()
 get syntax style path
 getPlaceHolderStylePath ()
 get placeholder style path (for Page Layouts)
 update ()
 update object in db
 updateStyleParameter ($a_id, $a_value)
 update style parameter per id
 replaceStylePar ($a_tag, $a_class, $a_par, $a_val, $a_type)
 Set style parameter per tag/class/parameter.
 _replaceStylePar ($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type)
 getStyle ()
 todo: bad style! should return array of objects, not multi-dim-arrays
 setStyle ($a_style)
 set styles
 handleXmlString ($a_str)
 Handle xml strin.
 getXML ()
 get xml representation of style object
 createExportDirectory ()
 Create export directory.
 cleanExportDirectory ()
 Clear export directory.
 createExportSubDirectory ()
 Create export directory.
 setExportSubDir ($a_dir)
 Set local directory, that will be included within the zip file.
 getExportSubDir ()
 The local directory, that will be included within the zip file.
 export ()
 Create export file.
 exportXML ($a_dir)
 export style xml file to directory
 createImportDirectory ()
 Create import directory.
 import ($a_file)
 Import.
 createFromXMLFile ($a_file, $a_skip_parent_create=false)
 create style from xml file
 getStyleParameterGroups ()
 Get grouped parameter.
 _getPseudoClasses ($tag)
 determineTemplateStyleClassType ($t, $k)
 do_3_10_Migration ()
 Migrates 3.10 style to 3.11 style.
 do_3_10_CharMigration ($a_id="")
 This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingStyleCharacteristics()
 do_3_9_Migration ($a_id)
 Migrate old 3.9 styles.
 getColors ()
 Get colors of style.
 addColor ($a_name, $a_code)
 Add color.
 updateColor ($a_name, $a_new_name, $a_code)
 Update color.
 removeColor ($a_name)
 Remove a color.
 colorExists ($a_color_name)
 Check whether color exists.
 getColorCodeForName ($a_name)
 Remove a color.
 getTemplates ($a_type)
 Get table templates of style.
 getTemplateClasses ($a_tid)
 Get template classes.
 addTemplate ($a_type, $a_name, $a_classes)
 Add table template.
 updateTemplate ($a_t_id, $a_name, $a_classes)
 Update table template.
 templateExists ($a_template_name)
 Check whether template exists.
 getTemplate ($a_t_id)
 Get template.
 lookupTemplateName ($a_t_id)
 Lookup table template name for template ID.
 getTemplateXML ()
 Get table template xml.
 writeTemplatePreview ($a_t_id, $a_preview_html)
 Write table template preview.
 lookupTemplatePreview ($a_t_id)
 Lookup table template preview.
 removeTemplate ($a_t_id)
 Remove table template.
 writeStyleSetting ($a_name, $a_value)
 Write Style Setting.
 lookupStyleSetting ($a_name)
 Lookup style setting.
- Public Member Functions inherited from ilObject
 ilObject ($a_id=0, $a_reference=true)
 Constructor public.
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not)
 read ($a_force_db=false)
 read object data from db into object
 getId ()
 get object id public
 setId ($a_id)
 set object id public
 setRefId ($a_id)
 set reference id public
 getType ()
 get object type public
 setType ($a_type)
 set object type public
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions
 getTitle ()
 get object title public
 getUntranslatedTitle ()
 get untranslated object title public
 setTitle ($a_title)
 set object title
 getDescription ()
 get object description
 setDescription ($a_desc)
 set object description
 getLongDescription ()
 get object long description (stored in object_description)
 getImportId ()
 get import id
 setImportId ($a_import_id)
 set import id
 getOwner ()
 get object owner
 getOwnerName ()
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id
 setOwner ($a_owner)
 set object owner
 getCreateDate ()
 get create date public
 getLastUpdateDate ()
 get last update date public
 getDiskUsage ()
 Gets the disk usage of the object in bytes.
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class)
 create ()
 create
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 updateOwner ()
 update owner of object in db
 _getIdForImportId ($a_import_id)
 get current object id for import id (static)
 _lookupOwner ($a_id)
 lookup object owner
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects.
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static)
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static)
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static)
 _isInTrash ($a_ref_id)
 checks wether object is in trash
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!?
 setPermissions ($a_parent_ref)
 set permissions of object
 countReferences ()
 count references of object
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) public
 createRoleFolder ()
 creates a local role folder
 applyDidacticTemplate ($a_tpl_id)
 Apply template.
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts.
 setRegisterMode ($a_bool)
 isUserRegistered ($a_user_id=0)
 requireRegistration ()
 getXMLZip ()
 getHTMLDirectory ()
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ...
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container.
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies.
 cloneMetaData ($target_obj)
 Copy meta data.
 _lookupCreationDate ($a_id)
 Lookup creation date.

Static Public Member Functions

static _getBasicStyleDom ()
 Get basic style dom.
static _createImagesDirectory ($a_style_id)
 Create images directory <data_dir>/sty/sty_<id>/images.
static _getImagesDirectory ($a_style_id)
 Get images directory.
static getEffectiveContentStyleId ($a_style_id, $a_type="")
 Get effective Style Id.
static _getStyleParameterInputType ($par)
static _getStyleParameterSubPar ($par)
static _getStyleParameters ($a_tag="")
static _getFilteredGroups ()
static _getStyleParameterNumericUnits ($a_no_percentage=false)
static _getStyleParameterValues ($par)
static _getStyleSuperTypes ()
static _isExpandable ($a_type)
static _isHideable ($a_type)
static _getStyleSuperTypeForType ($a_type)
static _getCoreStyles ()
 Get core styles.
static _getTemplateClassTypes ($a_template_type="")
 Get template class types.
static _determineTag ($a_type)
static getAvailableParameters ()
 Get available parameters.
static _addMissingStyleClassesToStyle ($a_id)
 Add missing style classes to all styles.
static _addMissingStyleClassesToAllStyles ($a_styles="")
 Add missing style classes to all styles.
static _getColorFlavor ($a_rgb, $a_i)
 Get color flavor.
static _explodeRGB ($a_rgb, $as_dec=false)
 Explode an RGB string into an array.
static _RGBToHLS ($a_rgb)
 RGB to HLS (both arrays, 0..255)
static _HLSToRGB ($a_hls)
 HLS to RGB (both arrays, 0..255)
static _lookupTemplateIdByName ($a_style_id, $a_name)
 Lookup table template preview.
static writeStyleUsage ($a_obj_id, $a_style_id)
 Write style usage.
static lookupObjectStyle ($a_obj_id)
 Lookup object style.
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
static _getAllReferences ($a_id)
 get all reference ids of object
static _lookupTitle ($a_id)
 lookup object title
static _getIdsForTitle ($title, $type= '', $partialmatch=false)
static _lookupDescription ($a_id)
 lookup object description
static _lookupObjId ($a_id)
static setDeletedDates ($a_ref_ids)
 Set deleted date type $ilDB.
static _lookupType ($a_id, $a_reference=false)
 lookup object type
static _lookupObjectId ($a_ref_id)
 lookup object id
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type.
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection.
static _getIcon ($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item.
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies.
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies.
static getLongDescriptions (array $a_obj_ids)
 Get long description data.
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns.
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course.

Data Fields

 $style
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title
const DESC_LENGTH = 128
 $ilias
 $lng
 $id
 $ref_id
 $type
 $title
 $untranslatedTitle
 $desc
 $long_desc
 $owner
 $create_date
 $last_update
 $import_id
 $register = false
 $referenced
 $objectList
 $max_title
 $max_desc
 $add_dots
 $obj_data_record
 object_data record

Static Public Attributes

static $num_unit = array("px", "em", "ex", "%", "pt", "pc", "in", "mm", "cm")
static $num_unit_no_perc = array("px", "em", "ex", "pt", "pc", "in", "mm", "cm")
static $parameter
static $filtered_groups
static $style_super_types
static $expandable_types
static $hideable_types
static $assigned_tags
static $pseudo_classes
static $core_styles
static $templates

Static Protected Attributes

static $basic_style_file = "./Services/Style/basic_style/style.xml"
static $basic_style_image_dir = "./Services/Style/basic_style/images"
static $basic_style_dom

Detailed Description

Class ilObjStyleSheet.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Id:
class.ilObjStyleSheet.php 39210 2013-01-12 00:49:35Z akill

Definition at line 15 of file class.ilObjStyleSheet.php.

Member Function Documentation

static ilObjStyleSheet::_addMissingStyleClassesToAllStyles (   $a_styles = "")
static

Add missing style classes to all styles.

Definition at line 2390 of file class.ilObjStyleSheet.php.

References $basic_style_image_dir, $core_styles, $file, ilObject\$id, $style, _createImagesDirectory(), _getBasicStyleDom(), _getCoreStyles(), _getImagesDirectory(), and ilObject\_getObjectsDataForType().

Referenced by _addMissingStyleClassesToStyle().

{
global $ilDB;
if ($a_styles == "")
{
}
else
{
$styles = $a_styles;
}
// get all core image files
$core_images = array();
if (is_dir($core_dir))
{
$dir = opendir($core_dir);
while($file = readdir($dir))
{
if (substr($file, 0, 1) != "." && is_file($core_dir."/".$file))
{
$core_images[] = $file;
}
}
}
foreach ($styles as $style)
{
$id = $style["id"];
foreach($core_styles as $cs)
{
// check, whether core style class exists
$set = $ilDB->queryF("SELECT * FROM style_char WHERE style_id = %s ".
"AND type = %s AND characteristic = %s",
array("integer", "text", "text"),
array($id, $cs["type"], $cs["class"]));
// if not, add core style class
if (!($rec = $ilDB->fetchAssoc($set)))
{
$ilDB->manipulateF(
"INSERT INTO style_char (style_id, type, characteristic) ".
" VALUES (%s,%s,%s) ",
array("integer", "text", "text"),
array($id, $cs["type"], $cs["class"]));
$xpath = new DOMXPath($bdom);
$par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '".$cs["tag"]."' and @Type='".
$cs["type"]."' and @Class='".$cs["class"]."']/StyleParameter");
foreach ($par_nodes as $par_node)
{
// check whether style parameter exists
$set = $ilDB->queryF("SELECT * FROM style_parameter WHERE style_id = %s ".
"AND type = %s AND class = %s AND tag = %s AND parameter = %s",
array("integer", "text", "text", "text", "text"),
array($id, $cs["type"], $cs["class"],
$cs["tag"], $par_node->getAttribute("Name")));
// if not, create style parameter
if (!($rec = $ilDB->fetchAssoc($set)))
{
$spid = $ilDB->nextId("style_parameter");
$st = $ilDB->manipulateF("INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) ".
" VALUES (%s,%s,%s,%s,%s,%s,%s)",
array("integer", "integer", "text", "text", "text", "text", "text"),
array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
$par_node->getAttribute("Name"), $par_node->getAttribute("Value")));
}
}
}
}
// now check, whether some core image files are missing
reset($core_images);
foreach($core_images as $cim)
{
if (!is_file($imdir."/".$cim))
{
copy($core_dir."/".$cim, $imdir."/".$cim);
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::_addMissingStyleClassesToStyle (   $a_id)
static

Add missing style classes to all styles.

Definition at line 2381 of file class.ilObjStyleSheet.php.

References _addMissingStyleClassesToAllStyles().

Referenced by import().

{
$styles = array(array("id" => $a_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::_createImagesDirectory (   $a_style_id)
static

Create images directory <data_dir>/sty/sty_<id>/images.

Definition at line 1183 of file class.ilObjStyleSheet.php.

References $ilErr, ilUtil\getWebspaceDir(), and ilUtil\makeDir().

Referenced by _addMissingStyleClassesToAllStyles(), and createImagesDirectory().

{
global $ilErr;
$sty_data_dir = ilUtil::getWebspaceDir()."/sty";
ilUtil::makeDir($sty_data_dir);
if(!is_writable($sty_data_dir))
{
$ilErr->raiseError("Style data directory (".$sty_data_dir
.") not writeable.", $ilErr->FATAL);
}
$style_dir = $sty_data_dir."/sty_".$a_style_id;
ilUtil::makeDir($style_dir);
if(!@is_dir($style_dir))
{
$ilErr->raiseError("Creation of style directory failed (".
$style_dir.").",$ilErr->FATAL);
}
// create images subdirectory
$im_dir = $style_dir."/images";
ilUtil::makeDir($im_dir);
if(!@is_dir($im_dir))
{
$ilErr->raiseError("Creation of Import Directory failed (".
$im_dir.").", $ilErr->FATAL);
}
// create thumbnails directory
$thumb_dir = $style_dir."/images/thumbnails";
ilUtil::makeDir($thumb_dir);
if(!@is_dir($thumb_dir))
{
$ilErr->raiseError("Creation of Import Directory failed (".
$thumb_dir.").", $ilErr->FATAL);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::_determineTag (   $a_type)
static

Definition at line 2358 of file class.ilObjStyleSheet.php.

Referenced by _getCoreStyles(), copyCharacteristic(), ilObjStyleSheetGUI\deleteTemplateObject(), ilStyleTableGUI\fillRow(), and ilObjStyleSheetGUI\saveCharacteristicObject().

{
return self::$assigned_tags[$a_type];
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_explodeRGB (   $a_rgb,
  $as_dec = false 
)
static

Explode an RGB string into an array.

Definition at line 2903 of file class.ilObjStyleSheet.php.

Referenced by _getColorFlavor().

{
$r["r"] = substr($a_rgb, 0, 2);
$r["g"] = substr($a_rgb, 2, 2);
$r["b"] = substr($a_rgb, 4, 2);
if ($as_dec)
{
$r["r"] = (int) hexdec($r["r"]);
$r["g"] = (int) hexdec($r["g"]);
$r["b"] = (int) hexdec($r["b"]);
}
return $r;
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getBasicStyleDom ( )
static

Get basic style dom.

Definition at line 798 of file class.ilObjStyleSheet.php.

References $basic_style_dom, and $ilBench.

Referenced by _addMissingStyleClassesToAllStyles().

{
global $ilBench;
if (!is_object(self::$basic_style_dom))
{
self::$basic_style_dom = new DOMDocument();
self::$basic_style_dom->load(self::$basic_style_file);
}
}

+ Here is the caller graph for this function:

ilObjStyleSheet::_getClonableContentStyles ( )

Get all clonable styles (active standard styles and individual learning module styles with write permission).

Definition at line 744 of file class.ilObjStyleSheet.php.

References ilObject\$id, ilObject\$ref_id, ilObject\_getAllReferences(), ilObjContentObject\_lookupContObjIdByStyleId(), and ilObject\_lookupTitle().

Referenced by ilObjStyleSheetGUI\createObject().

{
global $ilAccess, $ilDB;
$clonable_styles = array();
$q = "SELECT * FROM style_data";
$style_set = $ilDB->query($q);
while($style_rec = $ilDB->fetchAssoc($style_set))
{
$clonable = false;
if ($style_rec["standard"] == 1)
{
if ($style_rec["active"] == 1)
{
$clonable = true;
}
}
else
{
include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
$obj_ids = ilObjContentObject::_lookupContObjIdByStyleId($style_rec["id"]);
foreach($obj_ids as $id)
{
foreach($ref as $ref_id)
{
if ($ilAccess->checkAccess("write", "", $ref_id))
{
$clonable = true;
}
}
}
}
if ($clonable)
{
$clonable_styles[$style_rec["id"]] =
ilObject::_lookupTitle($style_rec["id"]);
}
}
return $clonable_styles;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getColorFlavor (   $a_rgb,
  $a_i 
)
static

Get color flavor.

Definition at line 2876 of file class.ilObjStyleSheet.php.

References _explodeRGB(), _HLSToRGB(), and _RGBToHLS().

Referenced by ilStyleColorTableGUI\fillRow().

{
$rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
if ($a_i > 0)
{
$hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
}
if ($a_i < 0)
{
$hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
}
foreach ($rgb as $k => $v)
{
$rgb[$k] = str_pad(dechex($v), 2, "0", STR_PAD_LEFT);
}
return $rgb["r"].$rgb["g"].$rgb["b"];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getCoreStyles ( )
static

Get core styles.

Definition at line 2321 of file class.ilObjStyleSheet.php.

References _determineTag().

Referenced by ilStyleTableGUI\__construct(), _addMissingStyleClassesToAllStyles(), deleteCharacteristic(), ilObjStyleSheetGUI\deleteCharacteristicConfirmationObject(), and ilObjStyleSheetGUI\deleteCoreCharMessage().

{
$c_styles = array();
foreach (self::$core_styles as $cstyle)
{
$c_styles[$cstyle["type"].".".ilObjStyleSheet::_determineTag($cstyle["type"]).".".$cstyle["class"]]
= array("type" => $cstyle["type"],
"tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
"class" => $cstyle["class"]);
}
return $c_styles;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getFilteredGroups ( )
static

Definition at line 2264 of file class.ilObjStyleSheet.php.

References $filtered_groups.

Referenced by ilObjStyleSheetGUI\getValues(), and ilObjStyleSheetGUI\initTagStyleForm().

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getImagesDirectory (   $a_style_id)
static

Get images directory.

Definition at line 1233 of file class.ilObjStyleSheet.php.

References ilUtil\getWebspaceDir().

Referenced by _addMissingStyleClassesToAllStyles(), and getImagesDirectory().

{
return ilUtil::getWebspaceDir()."/sty/sty_".$a_style_id.
"/images";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::_getPseudoClasses (   $tag)

Definition at line 2348 of file class.ilObjStyleSheet.php.

{
return self::$pseudo_classes[$tag];
}
ilObjStyleSheet::_getStandardStyles (   $a_exclude_default_style = false,
  $a_include_deactivated = false,
  $a_scope = 0 
)

Get standard styles.

Definition at line 698 of file class.ilObjStyleSheet.php.

References ilObject\$ilias, $path, $res, and ilObject\_lookupTitle().

Referenced by ilPageLayoutGUI\initForm(), ilObjSCORM2004LearningModuleGUI\initPropertiesEditableForm(), ilObjContentObjectGUI\initStylePropertiesForm(), ilObjPortfolioBaseGUI\initStylePropertiesForm(), ilObjSCORM2004LearningModuleGUI\initStylePropertiesForm(), ilObjWikiGUI\initStylePropertiesForm(), ilObjGlossaryGUI\initStylePropertiesForm(), ilObjBlogGUI\initStylePropertiesForm(), ilContainerGUI\initStylePropertiesForm(), and ilObjSCORM2004LearningModuleGUI\properties().

{
global $ilDB, $ilias, $tree;
$default_style = $ilias->getSetting("default_content_style_id");
$and_str = "";
if (!$a_include_deactivated)
{
$and_str = " AND active = 1";
}
$q = "SELECT * FROM style_data ".
" WHERE standard = 1".$and_str;
$res = $ilDB->query($q);
$styles = array();
while($sty = $ilDB->fetchAssoc($res))
{
if (!$a_exclude_default_style || $default_style != $sty["id"])
{
// check scope
if ($a_scope > 0 && $sty["category"] > 0)
{
if ($tree->isInTree($sty["category"]) &&
$tree->isInTree($a_scope))
{
$path = $tree->getPathId($a_scope);
if (!in_array($sty["category"], $path))
{
continue;
}
}
}
$styles[$sty["id"]] = ilObject::_lookupTitle($sty["id"]);
}
}
return $styles;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getStyleParameterInputType (   $par)
static

Definition at line 2233 of file class.ilObjStyleSheet.php.

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

{
$input = self::$parameter[$par]["input"];
return $input;
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getStyleParameterNumericUnits (   $a_no_percentage = false)
static
static ilObjStyleSheet::_getStyleParameters (   $a_tag = "")
static

Definition at line 2245 of file class.ilObjStyleSheet.php.

References $parameter.

Referenced by ilObjStyleSheetGUI\getValues(), and ilObjStyleSheetGUI\saveTagStyle().

{
if ($a_tag == "")
{
}
$par = array();
foreach (self::$parameter as $k => $v)
{
if (is_array(self::$filtered_groups[$v["group"]]) &&
!in_array($a_tag, self::$filtered_groups[$v["group"]]))
{
continue;
}
$par[$k] = $v;
}
return $par;
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getStyleParameterSubPar (   $par)
static

Definition at line 2239 of file class.ilObjStyleSheet.php.

{
$subpar = self::$parameter[$par]["subpar"];
return $subpar;
}
static ilObjStyleSheet::_getStyleParameterValues (   $par)
static

Definition at line 2278 of file class.ilObjStyleSheet.php.

Referenced by ilFontSizeInputGUI\insert(), ilTRBLBorderStyleInputGUI\insert(), ilBackgroundPositionInputGUI\insert(), and ilTRBLBorderWidthInputGUI\insert().

{
return self::$parameter[$par]["values"];
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getStyleSuperTypeForType (   $a_type)
static

Definition at line 2303 of file class.ilObjStyleSheet.php.

References $t.

Referenced by ilObjStyleSheetGUI\ilObjStyleSheetGUI().

{
foreach (self::$style_super_types as $s => $t)
{
if (in_array($a_type, $t))
{
return $s;
}
if ($a_type == $s)
{
return $s;
}
}
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_getStyleSuperTypes ( )
static
static ilObjStyleSheet::_getTemplateClassTypes (   $a_template_type = "")
static

Get template class types.

Definition at line 2337 of file class.ilObjStyleSheet.php.

References $templates.

Referenced by create(), ilObjStyleSheetGUI\getTemplateFormValues(), getTemplateXML(), getXML(), ilObjStyleSheetGUI\initTemplateForm(), ilObjStyleSheetGUI\saveTemplateObject(), ilObjStyleSheetGUI\setTemplatesSubTabs(), and ilObjStyleSheetGUI\updateTemplateObject().

{
if ($a_template_type == "")
{
}
return self::$templates[$a_template_type];
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_HLSToRGB (   $a_hls)
static

HLS to RGB (both arrays, 0..255)

Definition at line 2975 of file class.ilObjStyleSheet.php.

Referenced by _getColorFlavor().

{
$h = $a_hls["h"] / 255;
$l = $a_hls["l"] / 255;
$s = $a_hls["s"] / 255;
$rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
// If S=0, define R, G, and B all to L
if ($s == 0)
{
$rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
}
else
{
if ($l < 0.5)
{
$temp2 = $l * (1.0 + $s);
}
else
{
$temp2 = $l + $s - $l * $s;
}
$temp1 = 2.0 * $l - $temp2;
# For each of R, G, B, compute another temporary value, temp3, as follows:
foreach ($rgb as $k => $v)
{
switch ($k)
{
case "r":
$temp3 = $h + 1.0 / 3.0;
break;
case "g":
$temp3 = $h;
break;
case "b":
$temp3 = $h - 1.0/3.0;
break;
}
if ($temp3 < 0)
{
$temp3 = $temp3 + 1.0;
}
if ($temp3 > 1)
{
$temp3 = $temp3 - 1.0;
}
if (6.0 * $temp3 < 1)
{
$rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
}
else if (2.0 * $temp3 < 1)
{
$rgb[$k] = $temp2;
}
else if (3.0 * $temp3 < 2)
{
$rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0/3.0) - $temp3) * 6.0;
}
else
{
$rgb[$k] = $temp1;
}
}
}
$rgb["r"] = round($rgb["r"] * 255);
$rgb["g"] = round($rgb["g"] * 255);
$rgb["b"] = round($rgb["b"] * 255);
return $rgb;
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_isExpandable (   $a_type)
static

Definition at line 2293 of file class.ilObjStyleSheet.php.

Referenced by ilStyleTableGUI\__construct(), ilObjStyleSheetGUI\editObject(), and ilObjStyleSheetGUI\initCharacteristicForm().

{
return in_array($a_type, self::$expandable_types);
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_isHideable (   $a_type)
static

Definition at line 2298 of file class.ilObjStyleSheet.php.

Referenced by ilStyleTableGUI\__construct(), and ilStyleTableGUI\fillRow().

{
return in_array($a_type, self::$hideable_types);
}

+ Here is the caller graph for this function:

ilObjStyleSheet::_lookupActive (   $a_id)

Lookup active flag.

Definition at line 683 of file class.ilObjStyleSheet.php.

References $res.

Referenced by ilObjStyleSettingsGUI\editContentStylesObject().

{
global $ilDB;
$q = "SELECT * FROM style_data ".
" WHERE id = ".$ilDB->quote($a_id, "integer");
$res = $ilDB->query($q);
$sty = $ilDB->fetchAssoc($res);
return (boolean) $sty["active"];
}

+ Here is the caller graph for this function:

static ilObjStyleSheet::_lookupTemplateIdByName (   $a_style_id,
  $a_name 
)
static

Lookup table template preview.

Definition at line 3310 of file class.ilObjStyleSheet.php.

Referenced by ilPCTabsGUI\getFormValues(), and ilPCTableGUI\getPropertiesFormValues().

{
global $ilDB;
$set = $ilDB->query("SELECT id FROM style_template ".
" WHERE style_id = ".$ilDB->quote($a_style_id, "integer").
" AND name = ".$ilDB->quote($a_name, "text"));
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["id"];
}
return false;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::_lookupUpToDate (   $a_id)

Looup up to date.

Definition at line 614 of file class.ilObjStyleSheet.php.

References $res.

Referenced by getContentStylePath().

{
global $ilDB;
$q = "SELECT uptodate FROM style_data ".
" WHERE id = ".$ilDB->quote($a_id, "integer");
$res = $ilDB->query($q);
$sty = $ilDB->fetchAssoc($res);
return (boolean) $sty["uptodate"];
}

+ Here is the caller graph for this function:

ilObjStyleSheet::_replaceStylePar (   $style_id,
  $a_tag,
  $a_class,
  $a_par,
  $a_val,
  $a_type 
)

Definition at line 1766 of file class.ilObjStyleSheet.php.

References ilObject\$id, and ilObject\getId().

Referenced by replaceStylePar().

{
global $ilDB;
$q = "SELECT * FROM style_parameter WHERE ".
" style_id = ".$ilDB->quote($style_id, "integer")." AND ".
" tag = ".$ilDB->quote($a_tag, "text")." AND ".
" class = ".$ilDB->quote($a_class, "text")." AND ".
" ".$ilDB->equals("type", $a_type, "text", true)." AND ".
" parameter = ".$ilDB->quote($a_par, "text");
$set = $ilDB->query($q);
if ($rec = $set->fetchRow())
{
$q = "UPDATE style_parameter SET ".
" value = ".$ilDB->quote($a_val, "text")." WHERE ".
" style_id = ".$ilDB->quote($style_id, "integer")." AND ".
" tag = ".$ilDB->quote($a_tag, "text")." AND ".
" class = ".$ilDB->quote($a_class, "text")." AND ".
" ".$ilDB->equals("type", $a_type, "text", true)." AND ".
" parameter = ".$ilDB->quote($a_par, "text");
$ilDB->manipulate($q);
}
else
{
$id = $ilDB->nextId("style_parameter");
$q = "INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter) VALUES ".
" (".
$ilDB->quote($id, "integer").",".
$ilDB->quote($a_val, "text").",".
" ".$ilDB->quote($this->getId(), "integer").",".
" ".$ilDB->quote($a_tag, "text").",".
" ".$ilDB->quote($a_class, "text").",".
" ".$ilDB->quote($a_type, "text").",".
" ".$ilDB->quote($a_par, "text").")";
$ilDB->manipulate($q);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::_RGBToHLS (   $a_rgb)
static

RGB to HLS (both arrays, 0..255)

Definition at line 2922 of file class.ilObjStyleSheet.php.

Referenced by _getColorFlavor().

{
$r = $a_rgb["r"] / 255;
$g = $a_rgb["g"] / 255;
$b = $a_rgb["b"] / 255;
// max / min
$max = max($r,$g,$b);
$min = min($r,$g,$b);
//lightness
$l = ($max + $min) / 2;
if ($max == $min)
{
$s = 0;
$h = 0;
}
else
{
if ($l < 0.5)
{
$s = ($max - $min) / ($max + $min);
}
else
{
$s = ($max - $min) / (2.0 - $max - $min);
}
if ($r == $max)
{
$h = ($g - $b) / ($max - $min);
}
else if ($g == $max)
{
$h = 2.0 + ($b - $r) / ($max - $min);
}
else if ($b == $max)
{
$h = 4.0 + ($r - $g) / ($max - $min);
}
}
$hls["h"] = round(($h / 6) * 255);
$hls["l"] = round($l * 255);
$hls["s"] = round($s * 255);
return $hls;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::_writeActive (   $a_id,
  $a_active 
)

Write active flag.

Definition at line 670 of file class.ilObjStyleSheet.php.

Referenced by ilObjStyleSettingsGUI\saveActiveStylesObject().

{
global $ilDB;
$q = "UPDATE style_data SET active = ".
$ilDB->quote((int) $a_active, "integer").
" WHERE id = ".$ilDB->quote($a_id, "integer");
$ilDB->manipulate($q);
}

+ Here is the caller graph for this function:

ilObjStyleSheet::_writeScope (   $a_id,
  $a_scope 
)

Write scope.

Definition at line 642 of file class.ilObjStyleSheet.php.

Referenced by ilObjStyleSettingsGUI\saveScopeObject().

{
global $ilDB;
$q = "UPDATE style_data SET category = ".
$ilDB->quote((int) $a_scope, "integer").
" WHERE id = ".$ilDB->quote($a_id, "integer");
$ilDB->manipulate($q);
}

+ Here is the caller graph for this function:

ilObjStyleSheet::_writeStandard (   $a_id,
  $a_std 
)

Write standard flag.

Definition at line 629 of file class.ilObjStyleSheet.php.

Referenced by ilObjStyleSheetGUI\copyStyleObject(), ilObjStyleSheetGUI\importStyleObject(), and ilObjStyleSheetGUI\saveObject().

{
global $ilDB;
$q = "UPDATE style_data SET standard = ".
$ilDB->quote((int) $a_std, "integer").
" WHERE id = ".$ilDB->quote($a_id, "integer");
$ilDB->manipulate($q);
}

+ Here is the caller graph for this function:

ilObjStyleSheet::_writeUpToDate (   $a_id,
  $a_up_to_date 
)

Write up to date.

Definition at line 601 of file class.ilObjStyleSheet.php.

Referenced by addCharacteristic(), deleteCharacteristic(), ilObjStyleSheetGUI\pasteCharacteristicsObject(), updateColor(), and writeCSSFile().

{
global $ilDB;
$q = "UPDATE style_data SET uptodate = ".
$ilDB->quote((int) $a_up_to_date, "integer").
" WHERE id = ".$ilDB->quote($a_id, "integer");
$ilDB->manipulate($q);
}

+ Here is the caller graph for this function:

ilObjStyleSheet::addCharacteristic (   $a_type,
  $a_char,
  $a_hidden = false 
)

Add characteristic.

Definition at line 978 of file class.ilObjStyleSheet.php.

References _writeUpToDate(), ilObject\getId(), and setUpToDate().

Referenced by copyCharacteristic().

{
global $ilDB;
// delete characteristic record
$ilDB->manipulateF("INSERT INTO style_char (style_id, type, characteristic, hide)".
" VALUES (%s,%s,%s,%s) ",
array("integer", "text", "text", "integer"),
array($this->getId(), $a_type, $a_char, $a_hidden));
$this->setUpToDate(false);
$this->_writeUpToDate($this->getId(), false);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::addColor (   $a_name,
  $a_code 
)

Add color.

Definition at line 2757 of file class.ilObjStyleSheet.php.

Referenced by copyCharacteristic(), and create().

{
global $ilDB;
$ilDB->manipulate("INSERT INTO style_color (style_id, color_name, color_code)".
" VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($a_name, "text").",".
$ilDB->quote($a_code, "text").
")");
}

+ Here is the caller graph for this function:

ilObjStyleSheet::addParameter (   $a_tag,
  $a_par,
  $a_type 
)

write style parameter to db

Parameters
string$a_tagtag name (tag.class, e.g. "div.Mnemonic")
string$a_partag parameter (e.g. "margin-left")
string$a_typestyle type (e.g. "section")

Definition at line 1148 of file class.ilObjStyleSheet.php.

References ilObject\$id, getAvailableParameters(), ilObject\getId(), read(), and writeCSSFile().

{
global $ilDB;
$avail_params = $this->getAvailableParameters();
$tag = explode(".", $a_tag);
$value = $avail_params[$a_par][0];
$id = $ilDB->nextId("style_parameter");
$q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value) VALUES ".
"(".
$ilDB->quote($id, "integer").",".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($a_type, "text").",".
$ilDB->quote($tag[0], "text").",".
$ilDB->quote($tag[1], "text").",".
$ilDB->quote($a_par, "text").",".
$ilDB->quote($value, "text").")";
$ilDB->manipulate($q);
$this->read();
$this->writeCSSFile();
}

+ Here is the call graph for this function:

ilObjStyleSheet::addTemplate (   $a_type,
  $a_name,
  $a_classes 
)

Add table template.

Definition at line 3104 of file class.ilObjStyleSheet.php.

References $t, ilObjStyleSheetGUI\_getTemplatePreview(), ilObject\getId(), and writeTemplatePreview().

Referenced by create().

{
global $ilDB;
$tid = $ilDB->nextId("style_template");
$ilDB->manipulate($q = "INSERT INTO style_template ".
"(id, style_id, name, temp_type)".
" VALUES (".
$ilDB->quote($tid, "integer").",".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($a_name, "text").",".
$ilDB->quote($a_type, "text").
")");
foreach ($a_classes as $t => $c)
{
$ilDB->manipulate($q = "INSERT INTO style_template_class ".
"(template_id, class_type, class)".
" VALUES (".
$ilDB->quote($tid, "integer").",".
$ilDB->quote($t, "text").",".
$ilDB->quote($c, "text").
")");
}
include_once("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
$this->writeTemplatePreview($tid,
ilObjStyleSheetGUI::_getTemplatePreview($this, $a_type, $tid, true));
return $tid;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::assignMetaData ( $a_meta_data)

assign meta data object

Definition at line 790 of file class.ilObjStyleSheet.php.

{
$this->meta_data =& $a_meta_data;
}
ilObjStyleSheet::characteristicExists (   $a_char,
  $a_style_type 
)

Check whether characteristic exists.

Definition at line 960 of file class.ilObjStyleSheet.php.

References ilObject\getId().

Referenced by copyCharacteristic().

{
global $ilDB;
$set = $ilDB->queryF(
"SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
array("integer", "text", "text"),
array($this->getId(), $a_char, $a_style_type));
if ($rec = $ilDB->fetchAssoc($set))
{
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::cleanExportDirectory ( )

Clear export directory.

Definition at line 1935 of file class.ilObjStyleSheet.php.

References ilUtil\delDir(), ilUtil\getDataDir(), and ilObject\getId().

Referenced by export().

{
$sty_data_dir = ilUtil::getDataDir()."/sty";
$style_dir = $sty_data_dir."/sty_".$this->getId();
// create export subdirectory
$ex_dir = $style_dir."/export";
if (is_dir($ex_dir))
{
ilUtil::delDir($ex_dir, true);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::colorExists (   $a_color_name)

Check whether color exists.

Definition at line 2827 of file class.ilObjStyleSheet.php.

Referenced by copyCharacteristic().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM style_color WHERE ".
"style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
"color_name = ".$ilDB->quote($a_color_name, "text"));
if ($rec = $ilDB->fetchAssoc($set))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::copyCharacteristic (   $a_from_style_id,
  $a_from_type,
  $a_from_char,
  $a_to_char 
)

Copy characteristic.

Parameters
@return

Definition at line 998 of file class.ilObjStyleSheet.php.

References _determineTag(), addCharacteristic(), addColor(), characteristicExists(), colorExists(), deleteStyleParOfChar(), ilObjStyleSheet(), and replaceStylePar().

{
global $ilDB;
if (!$this->characteristicExists($a_to_char, $a_from_type))
{
$this->addCharacteristic($a_from_type, $a_to_char);
}
$this->deleteStyleParOfChar($a_from_type, $a_to_char);
$from_style = new ilObjStyleSheet($a_from_style_id);
$pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
$colors = array();
foreach ($pars as $p => $v)
{
if (substr($v, 0, 1) == "!")
{
$colors[] = substr($v, 1);
}
$a_to_char, $p, $v, $a_from_type);
}
// copy colors
foreach ($colors as $c)
{
if (!$this->colorExists($c))
{
$this->addColor($c, $from_style->getColorCodeForName($c));
}
}
}

+ Here is the call graph for this function:

ilObjStyleSheet::copyImagesToDir (   $a_target)

Copy images to directory.

Definition at line 1136 of file class.ilObjStyleSheet.php.

References getImagesDirectory(), and ilUtil\rCopy().

{
ilUtil::rCopy($this->getImagesDirectory(), $a_target);
}

+ Here is the call graph for this function:

ilObjStyleSheet::create (   $a_from_style = 0,
  $a_import_mode = false 
)

Create a new style.

Definition at line 822 of file class.ilObjStyleSheet.php.

References ilObject\$id, $t, $templates, _getTemplateClassTypes(), addColor(), addTemplate(), ilObject\create(), createFromXMLFile(), createImagesDirectory(), ilObject\getId(), getImagesDirectory(), getScope(), ilObjStyleSheet(), ilUtil\rCopy(), read(), and writeCSSFile().

{
global $ilDB;
if ($a_from_style == 0)
{
if (!$a_import_mode)
{
// copy styles from basic style
$this->createFromXMLFile(self::$basic_style_file, true);
// copy images from basic style
ilUtil::rCopy(self::$basic_style_image_dir,
$this->getImagesDirectory());
}
}
else
{
// get style parameter records
$def = array();
$q = "SELECT * FROM style_parameter WHERE style_id = ".
$ilDB->quote($a_from_style, "integer");
$par_set = $ilDB->query($q);
while($par_rec = $ilDB->fetchAssoc($par_set))
{
$def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
"parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
"type" => $par_rec["type"]);
}
// get style characteristics records
$chars = array();
$q = "SELECT * FROM style_char WHERE style_id = ".
$ilDB->quote($a_from_style, "integer");
$par_set = $ilDB->query($q);
while($par_rec = $ilDB->fetchAssoc($par_set))
{
$chars[] = array("type" => $par_rec["type"], "characteristic" => $par_rec["characteristic"]);
}
// default style settings
foreach ($def as $sty)
{
$id = $ilDB->nextId("style_parameter");
$q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type) VALUES ".
"(".
$ilDB->quote($id, "integer").",".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($sty["tag"], "text").",".
$ilDB->quote($sty["class"], "text").",".
$ilDB->quote($sty["parameter"], "text").",".
$ilDB->quote($sty["value"], "text").",".
$ilDB->quote($sty["type"], "text").")";
$ilDB->manipulate($q);
}
// insert style characteristics
foreach ($chars as $char)
{
$q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
"(".$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($char["type"], "text").",".
$ilDB->quote($char["characteristic"], "text").")";
$ilDB->manipulate($q);
}
// add style_data record
$q = "INSERT INTO style_data (id, uptodate, category) VALUES ".
"(".$ilDB->quote($this->getId(), "integer").", 0,".
$ilDB->quote((int) $this->getScope(), "integer").")";
$ilDB->manipulate($q);
// copy images
$from_style = new ilObjStyleSheet($a_from_style);
ilUtil::rCopy($from_style->getImagesDirectory(),
$this->getImagesDirectory());
// copy colors
$colors = $from_style->getColors();
foreach ($colors as $c)
{
$this->addColor($c["name"], $c["code"]);
}
// copy templates
foreach ($tcts as $tct => $v)
{
$templates = $from_style->getTemplates($tct);
foreach ($templates as $t)
{
$this->addTemplate($tct, $t["name"], $t["classes"]);
}
}
}
$this->read();
if (!$a_import_mode)
{
$this->writeCSSFile();
}
}

+ Here is the call graph for this function:

ilObjStyleSheet::createExportDirectory ( )

Create export directory.

Definition at line 1902 of file class.ilObjStyleSheet.php.

References ilUtil\getDataDir(), ilObject\getId(), and ilUtil\makeDir().

Referenced by createExportSubDirectory(), and export().

{
$sty_data_dir = ilUtil::getDataDir()."/sty";
ilUtil::makeDir($sty_data_dir);
if(!is_writable($sty_data_dir))
{
$this->ilias->raiseError("Style data directory (".$sty_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
$style_dir = $sty_data_dir."/sty_".$this->getId();
ilUtil::makeDir($style_dir);
if(!@is_dir($style_dir))
{
$this->ilias->raiseError("Creation of style directory failed (".
$style_dir.").",$this->ilias->error_obj->FATAL);
}
// create export subdirectory
$ex_dir = $style_dir."/export";
ilUtil::makeDir($ex_dir);
if(!@is_dir($ex_dir))
{
$this->ilias->raiseError("Creation of Import Directory failed (".
$ex_dir.").",$this->ilias->error_obj->FATAL);
}
return $ex_dir;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::createExportSubDirectory ( )

Create export directory.

Definition at line 1952 of file class.ilObjStyleSheet.php.

References createExportDirectory(), getExportSubDir(), and ilUtil\makeDir().

Referenced by export().

{
$ex_dir = $this->createExportDirectory();
$ex_sub_dir = $ex_dir."/".$this->getExportSubDir();
ilUtil::makeDir($ex_sub_dir);
if(!is_writable($ex_sub_dir))
{
$this->ilias->raiseError("Style data directory (".$ex_sub_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
$ex_sub_images_dir = $ex_sub_dir."/images";
ilUtil::makeDir($ex_sub_images_dir);
if(!is_writable($ex_sub_images_dir))
{
$this->ilias->raiseError("Style data directory (".$ex_sub_images_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::createFromXMLFile (   $a_file,
  $a_skip_parent_create = false 
)

create style from xml file

Definition at line 2136 of file class.ilObjStyleSheet.php.

References ilObject\$id, $style, ilObject\create(), do_3_10_Migration(), ilObject\getId(), read(), and update().

Referenced by create(), and import().

{
global $ilDB;
$this->is_3_10_skin = false;
if (!$a_skip_parent_create)
{
}
include_once("./Services/Style/classes/class.ilStyleImportParser.php");
$importParser = new ilStyleImportParser($a_file, $this);
$importParser->startParsing();
// store style parameter
foreach ($this->style as $style)
{
foreach($style as $tag)
{
$id = $ilDB->nextId("style_parameter");
// migrate old table PageFrame/PageContainer to div
if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
$tag["tag"] == "table")
{
$tag["tag"] = "div";
if ($tag["parameter"] == "width" && $tag["value"] == "100%")
{
continue;
}
}
$q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value) VALUES ".
"(".
$ilDB->quote($id, "integer").",".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($tag["tag"], "text").",".
$ilDB->quote($tag["class"], "text").",".
$ilDB->quote($tag["parameter"], "text").",".
$ilDB->quote($tag["type"], "text").",".
$ilDB->quote($tag["value"], "text").")";
//echo "<br>-$q";
$ilDB->manipulate($q);
}
}
// store characteristics
$this->is_3_10_skin = true;
if (is_array($this->chars))
{
foreach ($this->chars as $char)
{
if ($char["type"] != "")
{
$s = substr($char["class"], strlen($char["class"]) - 6);
if ($s != ":hover")
{
$q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
"(".$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($char["type"], "text").",".
$ilDB->quote($char["class"], "text").")";
$ilDB->manipulate($q);
$this->is_3_10_skin = false;
}
}
}
}
// add style_data record
$q = "INSERT INTO style_data (id, uptodate) VALUES ".
"(".$ilDB->quote($this->getId(), "integer").", 0)";
$ilDB->manipulate($q);
$this->update();
$this->read();
if ($this->is_3_10_skin)
{
}
//$this->writeCSSFile();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::createImagesDirectory ( )

Create images directory <data_dir>/sty/sty_<id>/images.

Definition at line 1174 of file class.ilObjStyleSheet.php.

References _createImagesDirectory(), and ilObject\getId().

Referenced by create(), import(), and uploadImage().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::createImportDirectory ( )

Create import directory.

Definition at line 2046 of file class.ilObjStyleSheet.php.

References ilUtil\getDataDir(), ilObject\getId(), and ilUtil\makeDir().

Referenced by import().

{
$sty_data_dir = ilUtil::getDataDir()."/sty";
ilUtil::makeDir($sty_data_dir);
if(!is_writable($sty_data_dir))
{
$this->ilias->raiseError("Style data directory (".$sty_data_dir
.") not writeable.",$this->ilias->error_obj->FATAL);
}
$style_dir = $sty_data_dir."/sty_".$this->getId();
ilUtil::makeDir($style_dir);
if(!@is_dir($style_dir))
{
$this->ilias->raiseError("Creation of style directory failed (".
$style_dir.").",$this->ilias->error_obj->FATAL);
}
// create import subdirectory
$im_dir = $style_dir."/import";
ilUtil::makeDir($im_dir);
if(!@is_dir($im_dir))
{
$this->ilias->raiseError("Creation of Import Directory failed (".
$im_dir.").",$this->ilias->error_obj->FATAL);
}
return $im_dir;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::createReference ( )

Create a reference (show error message, since styles do not use ref ids)

Reimplemented from ilObject.

Definition at line 561 of file class.ilObjStyleSheet.php.

{
$this->ilias->raiseError("Operation ilObjStyleSheet::createReference() not allowed.",$this->ilias->error_obj->FATAL);
}
ilObjStyleSheet::delete ( )

delete style object

Reimplemented from ilObject.

Definition at line 1361 of file class.ilObjStyleSheet.php.

References ilObjContentObject\_deleteStyleAssignments(), ilObject\getId(), and ilUtil\getWebspaceDir().

{
global $ilDB;
// delete object
// check whether this style is global default
$def_style = $this->ilias->getSetting("default_content_style_id");
if ($def_style == $this->getId())
{
$this->ilias->deleteSetting("default_content_style_id");
}
// check whether this style is global fixed
$fixed_style = $this->ilias->getSetting("fixed_content_style_id");
if ($fixed_style == $this->getId())
{
$this->ilias->deleteSetting("fixed_content_style_id");
}
// delete style parameter
$q = "DELETE FROM style_parameter WHERE style_id = ".
$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($q);
// delete style file
$css_file_name = ilUtil::getWebspaceDir()."/css/style_".$this->getId().".css";
if (is_file($css_file_name))
{
unlink($css_file_name);
}
// delete entries in learning modules
include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
// delete style data record
$q = "DELETE FROM style_data WHERE id = ".
$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($q);
}

+ Here is the call graph for this function:

ilObjStyleSheet::deleteCharacteristic (   $a_type,
  $a_tag,
  $a_class 
)

Delete Characteristic.

Definition at line 933 of file class.ilObjStyleSheet.php.

References $core_styles, _getCoreStyles(), _writeUpToDate(), ilObject\getId(), and setUpToDate().

{
global $ilDB;
// check, if characteristic is not a core style
if (empty($core_styles[$a_type.".".$a_tag.".".$a_class]))
{
// delete characteristic record
$st = $ilDB->manipulateF(
"DELETE FROM style_char WHERE style_id = %s AND type = %s AND characteristic = %s",
array("integer", "text", "text"),
array($this->getId(), $a_type, $a_class));
// delete parameter records
$st = $ilDB->manipulateF("DELETE FROM style_parameter WHERE style_id = %s AND tag = %s AND type = %s AND class = %s",
array("integer", "text", "text", "text"),
array($this->getId(), $a_tag, $a_type, $a_class));
}
$this->setUpToDate(false);
$this->_writeUpToDate($this->getId(), false);
}

+ Here is the call graph for this function:

ilObjStyleSheet::deleteImage (   $a_file)

Delete an image.

Definition at line 1289 of file class.ilObjStyleSheet.php.

References getImagesDirectory(), and getThumbnailsDirectory().

{
if (is_file($this->getImagesDirectory()."/".$a_file))
{
unlink($this->getImagesDirectory()."/".$a_file);
}
if (is_file($this->getThumbnailsDirectory()."/".$a_file))
{
unlink($this->getThumbnailsDirectory()."/".$a_file);
}
}

+ Here is the call graph for this function:

ilObjStyleSheet::deleteParameter (   $a_id)

delete style parameter

Parameters
int$a_idstyle parameter id

Definition at line 1306 of file class.ilObjStyleSheet.php.

{
global $ilDB;
$q = "DELETE FROM style_parameter WHERE id = ".
$ilDB->quote($a_id, "integer");
$ilDB->query($q);
}
ilObjStyleSheet::deleteStylePar (   $a_tag,
  $a_class,
  $a_par,
  $a_type 
)

Delete style parameter by tag/class/parameter.

Parameters
stringtag
stringclass
stringparameter
stringtype

Definition at line 1323 of file class.ilObjStyleSheet.php.

References ilObject\getId().

{
global $ilDB;
$q = "DELETE FROM style_parameter WHERE ".
" style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
" tag = ".$ilDB->quote($a_tag, "text")." AND ".
" class = ".$ilDB->quote($a_class, "text")." AND ".
" ".$ilDB->equals("type", $a_type, "text", true)." AND ".
" parameter = ".$ilDB->quote($a_par, "text");
$ilDB->manipulate($q);
}

+ Here is the call graph for this function:

ilObjStyleSheet::deleteStyleParOfChar (   $a_type,
  $a_class 
)

Delete style parameters of characteristic.

Parameters
stringtag
stringclass
stringparameter
stringtype

Definition at line 1345 of file class.ilObjStyleSheet.php.

References ilObject\getId().

Referenced by copyCharacteristic().

{
global $ilDB;
$q = "DELETE FROM style_parameter WHERE ".
" style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
" class = ".$ilDB->quote($a_class, "text")." AND ".
" ".$ilDB->equals("type", $a_type, "text", true);
$ilDB->manipulate($q);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::determineTemplateStyleClassType (   $t,
  $k 
)

Definition at line 2353 of file class.ilObjStyleSheet.php.

References $t.

{
return self::$templates[$t][$k];
}
ilObjStyleSheet::do_3_10_CharMigration (   $a_id = "")

This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingStyleCharacteristics()

Any changes here may also be interesting there.

Definition at line 2551 of file class.ilObjStyleSheet.php.

References $t.

Referenced by do_3_10_Migration().

{
global $ilDB;
$add_str = "";
if ($a_id != "")
{
$add_str = " AND style_id = ".$ilDB->quote($a_id, "integer");
}
$set = $ilDB->query($q = "SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE ".
$ilDB->equals("type", "", "text", true)." ".$add_str);
while ($rec = $ilDB->fetchAssoc($set))
{
// derive types from tag
$types = array();
switch ($rec["tag"])
{
case "div":
case "p":
if (in_array($rec["class"], array("Headline3", "Headline1",
"Headline2", "TableContent", "List", "Standard", "Remark",
"Additional", "Mnemonic", "Citation", "Example")))
{
$types[] = "text_block";
}
if (in_array($rec["class"], array("Block", "Remark",
"Additional", "Mnemonic", "Example", "Excursus", "Special")))
{
$types[] = "section";
}
if (in_array($rec["class"], array("Page", "Footnote", "PageTitle", "LMNavigation")))
{
$types[] = "page";
}
break;
case "td":
$types[] = "table_cell";
break;
case "a":
if (in_array($rec["class"], array("ExtLink", "IntLink", "FootnoteLink")))
{
$types[] = "link";
}
break;
case "span":
$types[] = "text_inline";
break;
case "table":
$types[] = "table";
break;
}
// check if style_char set exists
foreach ($types as $t)
{
// check if second type already exists
$set4 = $ilDB->queryF("SELECT * FROM style_char ".
" WHERE style_id = %s AND type = %s AND characteristic = %s",
array("integer", "text", "text"),
array($rec["style_id"], $t, $rec["class"]));
if ($rec4 = $ilDB->fetchAssoc($set4))
{
// ok
}
else
{
//echo "<br>1-".$rec["style_id"]."-".$t."-".$rec["class"]."-";
$ilDB->manipulateF("INSERT INTO style_char ".
" (style_id, type, characteristic) VALUES ".
" (%s,%s,%s) ",
array("integer", "text", "text"),
array($rec["style_id"], $t, $rec["class"]));
}
}
// update types
if ($rec["type"] == "")
{
if (count($types) > 0)
{
$ilDB->manipulateF("UPDATE style_parameter SET type = %s ".
" WHERE style_id = %s AND class = %s AND ".$ilDB->equals("type", "", "text", true),
array("text", "integer", "text"),
array($types[0], $rec["style_id"], $rec["class"]));
//echo "<br>3-".$types[0]."-".$rec["style_id"]."-".$rec["class"]."-";
// links extra handling
if ($types[0] == "link")
{
$ilDB->manipulateF("UPDATE style_parameter SET type = %s ".
" WHERE style_id = %s AND (class = %s OR class = %s) AND ".$ilDB->equals("type", "", "text", true),
array("text", "integer", "text", "text"),
array($types[0], $rec["style_id"], $rec["class"].":visited",
$rec["class"].":hover"));
}
}
if (count($types) == 2)
{
// select all records of first type and add second type
// records if necessary.
$set2 = $ilDB->queryF("SELECT * FROM style_parameter ".
" WHERE style_id = %s AND class = %s AND type = %s",
array("integer", "text", "text"),
array($rec["style_id"], $rec["class"], $types[0]));
while ($rec2 = $ilDB->fetchAssoc($set2))
{
// check if second type already exists
$set3 = $ilDB->queryF("SELECT * FROM style_parameter ".
" WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
array("integer", "text", "text", "text", "text"),
array($rec["style_id"], $rec["tag"], $rec["class"], $types[1], $rec["parameter"]));
if ($rec3 = $ilDB->fetchAssoc($set3))
{
// ok
}
else
{
$nid = $ilDB->nextId("style_parameter");
$ilDB->manipulateF("INSERT INTO style_parameter ".
" (id, style_id, tag, class, parameter, value, type) VALUES ".
" (%s, %s,%s,%s,%s,%s,%s) ",
array("integer", "integer", "text", "text", "text", "text", "text"),
array($nid, $rec2["style_id"], $rec2["tag"], $rec2["class"],
$rec2["parameter"], $rec2["value"], $types[1]));
}
}
}
}
}
}

+ Here is the caller graph for this function:

ilObjStyleSheet::do_3_10_Migration ( )

Migrates 3.10 style to 3.11 style.

Definition at line 2488 of file class.ilObjStyleSheet.php.

References do_3_10_CharMigration(), do_3_9_Migration(), and ilObject\getId().

Referenced by createFromXMLFile().

{
global $ilDB;
$this->do_3_9_Migration($this->getId());
//include_once("./Services/Migration/DBUpdate_1385/classes/class.ilStyleMigration.php");
//ilStyleMigration::addMissingStyleCharacteristics($this->getId());
$this->do_3_10_CharMigration($this->getId());
// style_char: type for characteristic
$st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?".
" AND style_id = ? ", array("text", "text", "integer"));
$ilDB->execute($st, array("media_cont", "Media", $this->getId()));
$ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
$ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
$ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
$ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
$ilDB->execute($st, array("page_cont", "Page", $this->getId()));
// style_parameter: type for class
$st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?".
" AND style_id = ? ", array("text", "text", "integer"));
$ilDB->execute($st, array("media_cont", "Media", $this->getId()));
$ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
$ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
$ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
$ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
$ilDB->execute($st, array("table", "Page", $this->getId()));
$st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?".
" AND style_id = ? ", array("text", "text", "integer"));
$ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
// style_char: characteristic for characteristic
$st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?".
" AND style_id = ? ", array("text", "text", "integer"));
$ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
$ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
// style_parameter: class for class
$st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?".
" AND style_id = ? ", array("text", "text", "integer"));
$ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
$ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
// force rewriting of container style
$st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?".
" AND style_id = ? ", array("text", "integer"));
$ilDB->execute($st, array("page_cont", $this->getId()));
$st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?".
" AND style_id = ? ", array("text", "integer"));
$ilDB->execute($st, array("page_cont", $this->getId()));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::do_3_9_Migration (   $a_id)

Migrate old 3.9 styles.

Definition at line 2692 of file class.ilObjStyleSheet.php.

Referenced by do_3_10_Migration().

{
global $ilDB;
$classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
$pars = array("margin-top", "margin-bottom");
foreach ($classes as $curr_class)
{
foreach ($pars as $curr_par)
{
$res2 = $ilDB->queryF("SELECT id FROM style_parameter WHERE style_id = %s".
" AND tag = %s AND class= %s AND parameter = %s",
array("integer", "text", "text", "text"),
array($a_id, "p", $curr_class, $curr_par));
if ($row2 = $ilDB->fetchAssoc($res2))
{
$ilDB->manipulateF("UPDATE style_parameter SET value= %s WHERE id = %s",
array("text", "integer"),
array("10px", $row2["id"]));
}
else
{
$nid = $ilDB->nextId("style_parameter");
$ilDB->manipulateF("INSERT INTO style_parameter ".
"(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
array("integer", "integer", "text", "text", "text", "text"),
array($nid, $a_id, "div", $curr_class, $curr_par, "10px"));
}
}
}
$ilDB->manipulateF("UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
array("text", "text", "integer"),
array("div", "p", $a_id));
}

+ Here is the caller graph for this function:

ilObjStyleSheet::export ( )

Create export file.

Returns
string local file name of export file

Definition at line 1999 of file class.ilObjStyleSheet.php.

References cleanExportDirectory(), createExportDirectory(), createExportSubDirectory(), exportXML(), getExportSubDir(), getImagesDirectory(), ilUtil\rCopy(), and ilUtil\zip().

{
$ex_dir = $this->createExportDirectory();
$this->exportXML($ex_dir."/".$this->getExportSubDir());
//echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
$ex_dir."/".$this->getExportSubDir()."/images");
if (is_file($ex_dir."/".$this->getExportSubDir().".zip"))
{
unlink($ex_dir."/".$this->getExportSubDir().".zip");
}
ilUtil::zip($ex_dir."/".$this->getExportSubDir(),
$ex_dir."/".$this->getExportSubDir().".zip");
return $ex_dir."/".$this->getExportSubDir().".zip";
}

+ Here is the call graph for this function:

ilObjStyleSheet::exportXML (   $a_dir)

export style xml file to directory

Definition at line 2021 of file class.ilObjStyleSheet.php.

References $file, and getXML().

Referenced by export().

{
$file = $a_dir."/style.xml";
// open file
if (!($fp = @fopen($file,"w")))
{
die ("<b>Error</b>: Could not open \"".$file."\" for writing".
" in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
}
// set file permissions
chmod($file, 0770);
// write xml data into the file
fwrite($fp, $this->getXML());
// close file
fclose($fp);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::getAvailableParameters ( )
static

Get available parameters.

Definition at line 2366 of file class.ilObjStyleSheet.php.

Referenced by addParameter().

{
$pars = array();
foreach(self::$parameter as $p => $v)
{
$pars[$p] = $v["values"];
}
return $pars;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getCharacteristics (   $a_type = "",
  $a_no_hidden = false 
)

Get characteristics.

Definition at line 1037 of file class.ilObjStyleSheet.php.

{
$chars = array();
if ($a_type == "")
{
$chars = $this->chars;
}
if (is_array($this->chars_by_type[$a_type]))
{
$chars = $this->chars_by_type[$a_type];
}
if ($a_no_hidden)
{
foreach ($chars as $k => $char)
{
if ($a_type == "" && $this->hidden_chars[$char["type"].":".$char["class"]])
{
unset($chars[$k]);
}
else if ($this->hidden_chars[$a_type.":".$char])
{
unset($chars[$k]);
}
}
}
return $chars;
}
ilObjStyleSheet::getColorCodeForName (   $a_name)

Remove a color.

Definition at line 2844 of file class.ilObjStyleSheet.php.

Referenced by writeCSSFile().

{
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);
}
}
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getColors ( )

Get colors of style.

Definition at line 2734 of file class.ilObjStyleSheet.php.

Referenced by getXML().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM style_color WHERE ".
"style_id = ".$ilDB->quote($this->getId(), "integer")." ".
"ORDER BY color_name");
$colors = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$colors[] = array(
"name" => $rec["color_name"],
"code" => $rec["color_code"]
);
}
return $colors;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getContentPrintStyle ( )

get content print style

static

Definition at line 1702 of file class.ilObjStyleSheet.php.

Referenced by ilGlossaryPresentationGUI\printView(), ilObjWikiGUI\printViewObject(), and ilLMPresentationGUI\showPrintView().

{
return "./Services/COPage/css/print_content.css";
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getContentStylePath (   $a_style_id)

get content style path

static (to avoid full reading)

Definition at line 1659 of file class.ilObjStyleSheet.php.

References ilObject\$ilias, $style, ilObject\_exists(), _lookupUpToDate(), ilUtil\getWebspaceDir(), and ilObjStyleSheet().

Referenced by ilImprintGUI\__construct(), ilMediaPoolPageGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilDataCollectionRecordViewViewdefinitionGUI\__construct(), ilDataCollectionRecordViewGUI\__construct(), ilBlogPostingGUI\__construct(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilPageObjectGUI\displayMedia(), ilPCDataTableGUI\editData(), ilObjGroupGUI\executeCommand(), ilTermDefinitionEditorGUI\executeCommand(), ilObjCategoryGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjRootFolderGUI\executeCommand(), ilLMPresentationGUI\exportbibinfo(), ilScormExportUtil\exportContentCSS(), ilObjPaymentSettingsGUI\forwardToDocumentsPageObject(), ilTermsConditionsGUI\forwardToPageObject(), ilShopInfoGUI\forwardToPageObject(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilShopGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilObjPaymentSettingsGUI\getDocumentsPageHTML(), ilStartUpGUI\getLoginPageEditorHTML(), ilTermsConditionsGUI\getPageHTML(), ilShopInfoGUI\getPageHTML(), ilShopGUI\getPageHTML(), ilLMPresentationGUI\ilGlossary(), ilLMPresentationGUI\ilMedia(), ilLMPresentationGUI\ilPage(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\listDefinitions(), ilGlossaryPresentationGUI\listTermByGiven(), ilLMEditorGUI\main_header(), ilGlossaryPresentationGUI\media(), ilTestEvaluationGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\populateContentStyleBlock(), ilSCORM2004ScoGUI\sco_preview(), ilSCORM2004NodeGUI\setContentStyle(), ilObjPortfolioBaseGUI\setContentStyleSheet(), ilObjWikiGUI\setContentStyleSheet(), ilObjGlossaryGUI\setContentStyleSheet(), ilObjBlogGUI\setContentStyleSheet(), ilPCParagraphGUI\setStyle(), ilObjDlBookGUI\showAbstract(), ilObjDlBookGUI\showCitation(), ilLMPresentationGUI\showDownloadList(), ilObjMediaPoolGUI\showMedia(), ilLMPresentationGUI\showNoPublicAccess(), ilPageObjectGUI\showPage(), ilLMPresentationGUI\showPreconditionsOfPage(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showPrintViewSelection(), ilLMPresentationGUI\showTableOfContents(), and ilContObjectManifestBuilder\writeResources().

{
global $ilias;
$rand = rand(1,999999);
// check global fixed content style
$fixed_style = $ilias->getSetting("fixed_content_style_id");
if ($fixed_style > 0)
{
$a_style_id = $fixed_style;
}
// check global default style
if ($a_style_id <= 0)
{
$a_style_id = $ilias->getSetting("default_content_style_id");
}
if ($a_style_id > 0 && ilObject::_exists($a_style_id))
{
// check whether file is up to date
{
$style = new ilObjStyleSheet($a_style_id);
$style->writeCSSFile();
}
return ilUtil::getWebspaceDir("output").
"/css/style_".$a_style_id.".css?dummy=$rand";
}
else // todo: work this out
{
return "./Services/COPage/css/content.css";
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjStyleSheet::getEffectiveContentStyleId (   $a_style_id,
  $a_type = "" 
)
static

Get effective Style Id.

Parameters
integerstyle id that may be set in object
stringobject type

Definition at line 1614 of file class.ilObjStyleSheet.php.

References $ilSetting, and ilObject\_lookupType().

Referenced by ilLMPresentationGUI\basicPageGuiInit(), ilObjSystemFolderGUI\executeCommand(), ilObjWikiGUI\executeCommand(), ilSCORM2004PageNodeGUI\executeCommand(), ilLMPageObjectGUI\executeCommand(), ilObjDataCollectionGUI\executeCommand(), ilObjBlogGUI\executeCommand(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilObjPortfolioBaseGUI\handlePageCall(), ilDataCollectionRecordViewGUI\renderRecord(), ilLMPresentationGUI\showPrintView(), and ilObjWikiGUI\viewPageObject().

{
global $ilSetting;
// check global fixed content style
$fixed_style = $ilSetting->get("fixed_content_style_id");
if ($fixed_style > 0)
{
$a_style_id = $fixed_style;
}
// check global default style
if ($a_style_id <= 0)
{
$a_style_id = $ilSetting->get("default_content_style_id");
}
if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty")
{
return $a_style_id;
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::getExportSubDir ( )

The local directory, that will be included within the zip file.

Definition at line 1982 of file class.ilObjStyleSheet.php.

Referenced by createExportSubDirectory(), and export().

{
if ($this->export_sub_dir == "")
{
return "sty_".$this->getId();
}
else
{
return $this->export_sub_dir;
}
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getHideStatus (   $a_type,
  $a_char 
)

Get characteristic hide status.

Definition at line 1095 of file class.ilObjStyleSheet.php.

{
global $ilDB;
$set = $ilDB->query("SELECT hide FROM style_char ".
" WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
" type = ".$ilDB->quote($a_type, "text")." AND ".
" characteristic = ".$ilDB->quote($a_char, "text")
);
$rec = $ilDB->fetchAssoc($set);
return $rec["hide"];
}
ilObjStyleSheet::getImages ( )

Get images of style.

Definition at line 1251 of file class.ilObjStyleSheet.php.

References ilUtil\getDir(), and getImagesDirectory().

{
$dir = $this->getImagesDirectory();
$images = array();
if (is_dir($dir))
{
$entries = ilUtil::getDir($dir);
foreach($entries as $entry)
{
if (substr($entry["entry"],0,1) == ".")
{
continue;
}
if ($entry["type"] != "dir")
{
$images[] = $entry;
}
}
}
return $images;
}

+ Here is the call graph for this function:

ilObjStyleSheet::getImagesDirectory ( )

Get images directory.

Definition at line 1225 of file class.ilObjStyleSheet.php.

References _getImagesDirectory(), and ilObject\getId().

Referenced by copyImagesToDir(), create(), deleteImage(), export(), getImages(), getThumbnailsDirectory(), and uploadImage().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjStyleSheet::getMetaData ( )

get meta data object

Definition at line 814 of file class.ilObjStyleSheet.php.

{
return $this->meta_data;
}
ilObjStyleSheet::getParametersOfClass (   $a_type,
  $a_class 
)

Get parameters of class.

Parameters
@return

Definition at line 1645 of file class.ilObjStyleSheet.php.

{
if (is_array($this->style_class[$a_type][$a_class]))
{
return $this->style_class[$a_type][$a_class];
}
return array();
}
ilObjStyleSheet::getPlaceHolderStylePath ( )

get placeholder style path (for Page Layouts)

static

Definition at line 1722 of file class.ilObjStyleSheet.php.

Referenced by ilPageLayoutGUI\__construct(), ilSCORM2004NodeGUI\setContentStyle(), and ilPortfolioTemplatePageGUI\showPage().

{
return "./Services/COPage/css/placeholder.css";
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getRefId ( )

Get ref id (show error message, since styles do not use ref ids)

Reimplemented from ilObject.

Definition at line 544 of file class.ilObjStyleSheet.php.

{
return "";
//$this->ilias->raiseError("Operation ilObjStyleSheet::getRefId() not allowed.",$this->ilias->error_obj->FATAL);
}
ilObjStyleSheet::getScope ( )

Get scope.

Definition at line 593 of file class.ilObjStyleSheet.php.

Referenced by create(), and update().

{
return $this->scope;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getStyle ( )

todo: bad style! should return array of objects, not multi-dim-arrays

Definition at line 1812 of file class.ilObjStyleSheet.php.

References $style.

Referenced by writeCSSFile().

{
return $this->style;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

Definition at line 2222 of file class.ilObjStyleSheet.php.

References $parameter.

{
$groups = array();
foreach (self::$parameter as $parameter => $props)
{
$groups[$props["group"]][] = $parameter;
}
return $groups;
}
ilObjStyleSheet::getSyntaxStylePath ( )

get syntax style path

static

Definition at line 1712 of file class.ilObjStyleSheet.php.

Referenced by ilImprintGUI\__construct(), ilMediaPoolPageGUI\__construct(), ilWikiPageGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilDataCollectionRecordViewGUI\__construct(), ilDataCollectionRecordViewViewdefinitionGUI\__construct(), ilBlogPostingGUI\__construct(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilObjGlossaryGUI\confirmDefinitionDeletion(), ilTermDefinitionEditorGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilLMPresentationGUI\exportbibinfo(), ilObjGlossary\exportHTML(), ilObjContentObject\exportHTML(), ilCOPageHTMLExport\exportStyles(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilStartUpGUI\getLoginPageEditorHTML(), ilLMPresentationGUI\ilGlossary(), ilLMPresentationGUI\ilPage(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\listDefinitions(), ilGlossaryPresentationGUI\listTermByGiven(), ilLMEditorGUI\main_header(), ilTestEvaluationGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\populateSyntaxStyleBlock(), ilObjWikiGUI\printViewObject(), ilSCORM2004NodeGUI\setContentStyle(), ilObjDlBookGUI\showAbstract(), ilObjDlBookGUI\showCitation(), and ilLMPresentationGUI\showPrintView().

{
return "./Services/COPage/css/syntaxhighlight.css";
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getTemplate (   $a_t_id)

Get template.

Definition at line 3183 of file class.ilObjStyleSheet.php.

References getTemplateClasses().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM style_template WHERE ".
"style_id = ".$ilDB->quote($this->getId(), "integer")." ".
" AND id = ".$ilDB->quote($a_t_id, "integer"));
if ($rec = $ilDB->fetchAssoc($set))
{
$rec["classes"] = $this->getTemplateClasses($rec["id"]);
$template = $rec;
return $template;
}
return array();
}

+ Here is the call graph for this function:

ilObjStyleSheet::getTemplateClasses (   $a_tid)

Get template classes.

Definition at line 3084 of file class.ilObjStyleSheet.php.

Referenced by getTemplate(), and getTemplates().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM style_template_class WHERE ".
"template_id = ".$ilDB->quote($a_tid, "integer"));
$class = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$key = $rec["class_type"];
$class[$key] = $rec["class"];
}
return $class;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::getTemplates (   $a_type)

Get table templates of style.

Definition at line 3062 of file class.ilObjStyleSheet.php.

References $templates, and getTemplateClasses().

Referenced by getTemplateXML(), and getXML().

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM style_template WHERE ".
"style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
"temp_type = ".$ilDB->quote($a_type, "text")." ".
"ORDER BY name");
$templates = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$rec["classes"] = $this->getTemplateClasses($rec["id"]);
$templates[] = $rec;
}
return $templates;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::getTemplateXML ( )

Get table template xml.

Definition at line 3222 of file class.ilObjStyleSheet.php.

References $t, ilObject\$type, _getTemplateClassTypes(), and getTemplates().

{
global $ilDB;
$tag = "<StyleTemplates>";
$ttypes = array("table", "vaccordion", "haccordion");
foreach ($ttypes as $ttype)
{
$ts = $this->getTemplates($ttype);
foreach($ts as $t)
{
/*$atts = array("table" => "TableClass",
"caption" => "CaptionClass",
"row_head" => "RowHeadClass",
"row_foot" => "RowFootClass",
"col_head" => "ColHeadClass",
"col_foot" => "ColFootClass",
"odd_row" => "OddRowClass",
"even_row" => "EvenRowClass",
"odd_col" => "OddColClass",
"even_col" => "EvenColClass");*/
$c = $t["classes"];
$tag.= '<StyleTemplate Name="'.$t["name"].'">';
foreach ($atts as $type => $t)
{
if ($c[$type] != "")
{
$tag.= '<StyleClass Type="'.$type.'" Value="'.$c[$type].'" />';
}
}
$tag.= "</StyleTemplate>";
}
}
$tag.= "</StyleTemplates>";
//echo htmlentities($tag);
return $tag;
}

+ Here is the call graph for this function:

ilObjStyleSheet::getThumbnailsDirectory ( )

Get thumbnails directory.

Definition at line 1242 of file class.ilObjStyleSheet.php.

References getImagesDirectory().

Referenced by deleteImage(), and uploadImage().

{
return $this->getImagesDirectory().
"/thumbnails";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::getUpToDate ( )

Get up to date.

Definition at line 577 of file class.ilObjStyleSheet.php.

{
return $this->up_to_date;
}
ilObjStyleSheet::getXML ( )

get xml representation of style object

Definition at line 1840 of file class.ilObjStyleSheet.php.

References $style, $t, _getTemplateClassTypes(), getColors(), ilObject\getDescription(), getTemplates(), and ilObject\getTitle().

Referenced by exportXML().

{
$xml.= "<StyleSheet>\n";
// title and description
$xml.= "<Title>".$this->handleXmlString($this->getTitle())."</Title>";
$xml.= "<Description>".$this->handleXmlString($this->getDescription())."</Description>\n";
// style classes
foreach($this->chars as $char)
{
$xml.= "<Style Tag=\"".ilObjStyleSheet::_determineTag($char["type"]).
"\" Type=\"".$char["type"]."\" Class=\"".$char["class"]."\">\n";
foreach($this->style as $style)
{
if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"])
{
foreach($style as $tag)
{
$xml.="<StyleParameter Name=\"".$tag["parameter"]."\" Value=\"".$tag["value"]."\"/>\n";
}
}
}
$xml.= "</Style>\n";
}
// colors
foreach($this->getColors() as $color)
{
$xml.="<StyleColor Name=\"".$color["name"]."\" Code=\"".$color["code"]."\"/>\n";
}
// templates
foreach ($tcts as $tct => $v)
{
$ts = $this->getTemplates($tct);
foreach ($ts as $t)
{
$xml.="<StyleTemplate Type=\"".$tct."\" Name=\"".$t["name"]."\">\n";
foreach ($t["classes"] as $ct => $c)
{
if ($c != "")
{
$xml.="<StyleTemplateClass ClassType=\"".$ct."\" Class=\"".$c."\"/>\n";
}
}
$xml.="</StyleTemplate>\n";
}
}
$xml.= "</StyleSheet>";
//echo "<pre>".htmlentities($xml)."</pre>"; exit;
return $xml;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::handleXmlString (   $a_str)

Handle xml strin.

Parameters
@return

Definition at line 1832 of file class.ilObjStyleSheet.php.

{
return str_replace("&", "&amp;", $a_str);
}
ilObjStyleSheet::ilClone ( )

clone style sheet (note: styles have no ref ids and return an object id)

public

Returns
integer new obj id

Definition at line 1115 of file class.ilObjStyleSheet.php.

References ilObject\$lng, $log, ilObject\getDescription(), ilObject\getId(), ilObject\getTitle(), ilObject\getType(), ilObjStyleSheet(), and lookupStyleSetting().

{
global $log, $lng;
$lng->loadLanguageModule("style");
$new_obj = new ilObjStyleSheet();
$new_obj->setTitle($this->getTitle()." (".$lng->txt("sty_acopy").")");
$new_obj->setType($this->getType());
$new_obj->setDescription($this->getDescription());
$new_obj->create($this->getId());
$new_obj->writeStyleSetting("disable_auto_margins",
$this->lookupStyleSetting("disable_auto_margins"));
return $new_obj->getId();
}

+ Here is the call graph for this function:

ilObjStyleSheet::ilObjStyleSheet (   $a_id = 0,
  $a_call_by_reference = false 
)

Constructor public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Definition at line 521 of file class.ilObjStyleSheet.php.

References ilObject\ilObject().

Referenced by copyCharacteristic(), create(), getContentStylePath(), and ilClone().

{
$this->type = "sty";
$this->style = array();
if($a_call_by_reference)
{
$this->ilias->raiseError("Can't instantiate style object via reference id.",$this->ilias->error_obj->FATAL);
}
parent::ilObject($a_id, false);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::import (   $a_file)

Import.

Definition at line 2079 of file class.ilObjStyleSheet.php.

References $file, _addMissingStyleClassesToStyle(), ilObject\create(), createFromXMLFile(), createImagesDirectory(), createImportDirectory(), ilObject\getId(), ilUtil\moveUploadedFile(), ilUtil\rCopy(), read(), ilUtil\unzip(), and writeCSSFile().

{
$im_dir = $this->createImportDirectory();
// handle uploaded files
if (is_array($a_file))
{
ilUtil::moveUploadedFile($a_file["tmp_name"],
$a_file["name"], $im_dir."/".$a_file["name"]);
$file_name = $a_file["name"];
}
else // handle not directly uploaded files
{
$pi = pathinfo($a_file);
$file_name = $pi["basename"];
copy($a_file, $im_dir."/".$file_name);
}
$file = pathinfo($file_name);
// unzip file
if (strtolower($file["extension"] == "zip"))
{
ilUtil::unzip($im_dir."/".$file_name);
$subdir = basename($file["basename"],".".$file["extension"]);
if (!is_dir($im_dir."/".$subdir))
{
$subdir = "style"; // check style subdir
}
$xml_file = $im_dir."/".$subdir."/style.xml";
}
else // handle xml file directly (old style)
{
$xml_file = $im_dir."/".$file_name;
}
// load information from xml file
//echo "-$xml_file-";
$this->createFromXMLFile($xml_file, true);
// copy images
if (is_dir($im_dir."/".$subdir."/images"))
{
ilUtil::rCopy($im_dir."/".$subdir."/images",
$this->getImagesDirectory());
}
$this->read();
$this->writeCSSFile();
}

+ Here is the call graph for this function:

static ilObjStyleSheet::lookupObjectStyle (   $a_obj_id)
static

Lookup object style.

Definition at line 3395 of file class.ilObjStyleSheet.php.

References ilObject\_lookupType().

Referenced by ilObjCategoryGUI\afterSave(), ilObjBlog\doRead(), ilObjPortfolioBase\doRead(), ilObjGlossary\read(), ilObjWiki\read(), and ilContainer\read().

{
global $ilDB;
$set = $ilDB->query("SELECT style_id FROM style_usage ".
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
);
$rec = $ilDB->fetchAssoc($set);
if (ilObject::_lookupType($rec["style_id"]) == "sty")
{
return (int) $rec["style_id"];
}
return 0;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::lookupStyleSetting (   $a_name)

Lookup style setting.

Definition at line 3365 of file class.ilObjStyleSheet.php.

Referenced by ilClone().

{
global $ilDB;
$set = $ilDB->query("SELECT value FROM style_setting ".
" WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
" AND name = ".$ilDB->quote($a_name, "text")
);
$rec = $ilDB->fetchAssoc($set);
return $rec["value"];
}

+ Here is the caller graph for this function:

ilObjStyleSheet::lookupTemplateName (   $a_t_id)

Lookup table template name for template ID.

Definition at line 3204 of file class.ilObjStyleSheet.php.

Referenced by ilObjStyleSheetGUI\updateTemplateObject().

{
global $ilDB;
$set = $ilDB->query("SELECT name FROM style_template WHERE ".
" id = ".$ilDB->quote($a_t_id, "integer"));
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["name"];
}
return false;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::lookupTemplatePreview (   $a_t_id)

Lookup table template preview.

Definition at line 3293 of file class.ilObjStyleSheet.php.

{
global $ilDB;
$set = $ilDB->query("SELECT preview FROM style_template ".
" WHERE id = ".$ilDB->quote($a_t_id, "integer"));
if ($rec = $ilDB->fetchAssoc($set))
{
return $rec["preview"];
}
return "";
}
ilObjStyleSheet::putInTree ( )

Put in tree (show error message, since styles do not use ref ids)

Definition at line 553 of file class.ilObjStyleSheet.php.

{
$this->ilias->raiseError("Operation ilObjStyleSheet::putInTree() not allowed.",$this->ilias->error_obj->FATAL);
}
ilObjStyleSheet::read ( )

read style properties

Definition at line 1409 of file class.ilObjStyleSheet.php.

References $res, ilObject\getId(), setScope(), and setUpToDate().

Referenced by addParameter(), create(), createFromXMLFile(), import(), and update().

{
global $ilDB;
$q = "SELECT * FROM style_parameter WHERE style_id = ".
$ilDB->quote($this->getId(), "integer")." ORDER BY tag, class, type ";
$style_set = $ilDB->query($q);
$ctag = "";
$cclass = "";
$ctype = "";
$this->style = array();
while($style_rec = $ilDB->fetchAssoc($style_set))
{
if ($style_rec["tag"] != $ctag || $style_rec["class"] != $cclass
|| $style_rec["type"] != $ctype)
{
// add current tag array to style array
if(is_array($tag))
{
$this->style[] = $tag;
}
$tag = array();
}
$ctag = $style_rec["tag"];
$cclass = $style_rec["class"];
$ctype = $style_rec["type"];
$tag[] = $style_rec;
$this->style_class[$ctype][$cclass][$style_rec["parameter"]] = $style_rec["value"];
}
if(is_array($tag))
{
$this->style[] = $tag;
}
//var_dump($this->style_class);
$q = "SELECT * FROM style_data WHERE id = ".
$ilDB->quote($this->getId(), "integer");
$res = $ilDB->query($q);
$sty = $ilDB->fetchAssoc($res);
$this->setUpToDate((boolean) $sty["uptodate"]);
$this->setScope($sty["category"]);
// get style characteristics records
$this->chars = array();
$this->chars_by_type = array();
$q = "SELECT * FROM style_char WHERE style_id = ".
$ilDB->quote($this->getId(), "integer").
" ORDER BY type ASC, characteristic ASC";
$par_set = $ilDB->query($q);
while($par_rec = $ilDB->fetchAssoc($par_set))
{
$this->chars[] = array("type" => $par_rec["type"], "class" => $par_rec["characteristic"], "hide" => $par_rec["hide"]);
$this->chars_by_type[$par_rec["type"]][] = $par_rec["characteristic"];
if ($par_rec["hide"])
{
$this->hidden_chars[$par_rec["type"].":".$par_rec["characteristic"]] = true;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::removeColor (   $a_name)

Remove a color.

Definition at line 2815 of file class.ilObjStyleSheet.php.

{
global $ilDB;
$ilDB->manipulate("DELETE FROM style_color WHERE ".
" style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
" color_name = ".$ilDB->quote($a_name, "text"));
}
ilObjStyleSheet::removeTemplate (   $a_t_id)

Remove table template.

Definition at line 3328 of file class.ilObjStyleSheet.php.

{
global $ilDB;
$ilDB->manipulate("DELETE FROM style_template WHERE ".
" style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
" id = ".$ilDB->quote($a_t_id, "integer"));
$ilDB->manipulate("DELETE FROM style_template_class WHERE ".
"template_id = ".$ilDB->quote($a_t_id, "integer")
);
}
ilObjStyleSheet::replaceStylePar (   $a_tag,
  $a_class,
  $a_par,
  $a_val,
  $a_type 
)

Set style parameter per tag/class/parameter.

Definition at line 1761 of file class.ilObjStyleSheet.php.

References _replaceStylePar(), and ilObject\getId().

Referenced by copyCharacteristic(), and updateColor().

{
ilObjStyleSheet::_replaceStylePar($this->getId(), $a_tag, $a_class, $a_par, $a_val, $a_type);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::saveHideStatus (   $a_type,
  $a_char,
  $a_hide 
)

Save characteristic hide status.

Definition at line 1080 of file class.ilObjStyleSheet.php.

References ilObject\getId().

{
global $ilDB;
$ilDB->manipulate("UPDATE style_char SET ".
" hide = ".$ilDB->quote((int) $a_hide, "integer").
" WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
" type = ".$ilDB->quote($a_type, "text")." AND ".
" characteristic = ".$ilDB->quote($a_char, "text")
);
}

+ Here is the call graph for this function:

ilObjStyleSheet::setCharacteristics (   $a_chars)

Set characteristics.

Definition at line 1071 of file class.ilObjStyleSheet.php.

{
$this->chars = $a_chars;
// $this->chars_by_type[$a_type];
}
ilObjStyleSheet::setExportSubDir (   $a_dir)

Set local directory, that will be included within the zip file.

Definition at line 1974 of file class.ilObjStyleSheet.php.

Referenced by ilContObjectExport\buildExportFileXML().

{
$this->export_sub_dir = $a_dir;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::setRefId ( )

Set ref id (show error message, since styles do not use ref ids)

Definition at line 536 of file class.ilObjStyleSheet.php.

{
$this->ilias->raiseError("Operation ilObjStyleSheet::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
}
ilObjStyleSheet::setScope (   $a_scope)

Set scope.

Definition at line 585 of file class.ilObjStyleSheet.php.

Referenced by read().

{
$this->scope = $a_scope;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::setStyle (   $a_style)

set styles

Definition at line 1820 of file class.ilObjStyleSheet.php.

{
$this->style = $a_style;
}
ilObjStyleSheet::setUpToDate (   $a_up_to_date = true)

Set style up to date (false + update will trigger css generation next time)

Definition at line 569 of file class.ilObjStyleSheet.php.

Referenced by addCharacteristic(), deleteCharacteristic(), read(), and writeCSSFile().

{
$this->up_to_date = $a_up_to_date;
}

+ Here is the caller graph for this function:

ilObjStyleSheet::templateExists (   $a_template_name)

Check whether template exists.

Definition at line 3166 of file class.ilObjStyleSheet.php.

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM style_template WHERE ".
"style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
"name = ".$ilDB->quote($a_template_name, "text"));
if ($rec = $ilDB->fetchAssoc($set))
{
return true;
}
return false;
}
ilObjStyleSheet::update ( )

update object in db

public

Returns
boolean true on success

Reimplemented from ilObject.

Definition at line 1727 of file class.ilObjStyleSheet.php.

References ilObject\getId(), getScope(), read(), and writeCSSFile().

Referenced by createFromXMLFile().

{
global $ilDB;
$this->read(); // this could be done better
$this->writeCSSFile();
$q = "UPDATE style_data ".
"SET category = ".$ilDB->quote((int) $this->getScope(), "integer").
" WHERE id = ".$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($q);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::updateColor (   $a_name,
  $a_new_name,
  $a_code 
)

Update color.

Definition at line 2772 of file class.ilObjStyleSheet.php.

References _writeUpToDate(), ilObject\getId(), and replaceStylePar().

{
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"));
// 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"]);
}
}
}
}

+ Here is the call graph for this function:

ilObjStyleSheet::updateStyleParameter (   $a_id,
  $a_value 
)

update style parameter per id

Parameters
int$a_idstyle parameter id
int$a_idstyle parameter value

Definition at line 1747 of file class.ilObjStyleSheet.php.

{
global $ilDB;
$q = "UPDATE style_parameter SET VALUE = ".
$ilDB->quote($a_value, "text")." WHERE id = ".
$ilDB->quote($a_id, "integer");
$style_set = $ilDB->manipulate($q);
}
ilObjStyleSheet::updateTemplate (   $a_t_id,
  $a_name,
  $a_classes 
)

Update table template.

Definition at line 3139 of file class.ilObjStyleSheet.php.

References $t.

{
global $ilDB;
$ilDB->manipulate("UPDATE style_template SET ".
"name = ".$ilDB->quote($a_name, "text").
" WHERE id = ".$ilDB->quote($a_t_id, "integer"));
$ilDB->manipulate("DELETE FROM style_template_class WHERE ".
"template_id = ".$ilDB->quote($a_t_id, "integer")
);
foreach ($a_classes as $t => $c)
{
$ilDB->manipulate($q = "INSERT INTO style_template_class ".
"(template_id, class_type, class)".
" VALUES (".
$ilDB->quote($a_t_id, "integer").",".
$ilDB->quote($t, "text").",".
$ilDB->quote($c, "text").
")");
}
}
ilObjStyleSheet::uploadImage (   $a_file)

Upload image.

Definition at line 1277 of file class.ilObjStyleSheet.php.

References createImagesDirectory(), getImagesDirectory(), getThumbnailsDirectory(), ilUtil\moveUploadedFile(), and ilUtil\resizeImage().

{
@ilUtil::moveUploadedFile($a_file["tmp_name"], $a_file["name"],
$this->getImagesDirectory()."/".$a_file["name"]);
@ilUtil::resizeImage($this->getImagesDirectory()."/".$a_file["name"],
$this->getThumbnailsDirectory()."/".$a_file["name"], 75, 75);
}

+ Here is the call graph for this function:

ilObjStyleSheet::writeCSSFile (   $a_target_file = "",
  $a_image_dir = "" 
)

write css file to webspace directory

Definition at line 1473 of file class.ilObjStyleSheet.php.

References $style, _writeUpToDate(), getColorCodeForName(), ilObject\getId(), getStyle(), ilUtil\getWebspaceDir(), and setUpToDate().

Referenced by addParameter(), create(), import(), and update().

{
$style = $this->getStyle();
if ($a_target_file == "")
{
$css_file_name = ilUtil::getWebspaceDir()."/css/style_".$this->getId().".css";
}
else
{
$css_file_name = $a_target_file;
}
$css_file = fopen($css_file_name, "w");
$page_background = "";
foreach ($style as $tag)
{
fwrite ($css_file, $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]."\n");
if ($tag[0]["tag"] == "td")
{
fwrite ($css_file, ",th".".ilc_".$tag[0]["type"]."_".$tag[0]["class"]."\n");
}
if (in_array($tag[0]["tag"], array("h1", "h2", "h3")))
{
fwrite ($css_file, ",div.ilc_text_block_".$tag[0]["class"]."\n");
fwrite ($css_file, ",body.ilc_text_block_".$tag[0]["class"]."\n");
}
if ($tag[0]["type"] == "text_block")
{
fwrite ($css_file, ",body.ilc_text_block_".$tag[0]["class"]."\n");
}
fwrite ($css_file, "{\n");
// collect table border attributes
$t_border = array();
foreach($tag as $par)
{
$cur_par = $par["parameter"];
$cur_val = $par["value"];
// replace named colors
if (is_int(strpos($cur_par, "color")) && substr(trim($cur_val), 0, 1) == "!")
{
$cur_val = $this->getColorCodeForName(substr($cur_val, 1));
}
if ($tag[0]["type"] == "table" && is_int(strpos($par["parameter"], "border")))
{
$t_border[$cur_par] = $cur_val;
}
if (in_array($cur_par, array("background-image", "list-style-image")))
{
if (is_int(strpos($cur_val, "/"))) // external
{
$cur_val = "url(".$cur_val.")";
}
else // internal
{
if ($a_image_dir == "")
{
$cur_val = "url(../sty/sty_".$this->getId()."/images/".$cur_val.")";
}
else
{
$cur_val = "url(".$a_image_dir."/".$cur_val.")";
}
}
}
if ($cur_par == "opacity")
{
$cur_val = ((int) $cur_val) / 100;
}
fwrite ($css_file, "\t".$cur_par.": ".$cur_val.";\n");
// IE6 fix for minimum height
if ($cur_par == "min-height")
{
fwrite ($css_file, "\t"."height".": "."auto !important".";\n");
fwrite ($css_file, "\t"."height".": ".$cur_val.";\n");
}
// opacity fix
if ($cur_par == "opacity")
{
fwrite ($css_file, "\t".'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity='.($cur_val * 100).')"'.";\n");
fwrite ($css_file, "\t".'filter: alpha(opacity='.($cur_val * 100).')'.";\n");
fwrite ($css_file, "\t".'-moz-opacity: '.$cur_val.";\n");
}
// save page background
if ($tag[0]["tag"] == "div" && $tag[0]["class"] == "Page"
&& $cur_par == "background-color")
{
$page_background = $cur_val;
}
}
fwrite ($css_file, "}\n");
fwrite ($css_file, "\n");
// use table border attributes for th td as well
/* if ($tag[0]["type"] == "table")
{
if (count($t_border) > 0)
{
fwrite ($css_file, $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." th,".
$tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." td\n");
fwrite ($css_file, "{\n");
foreach ($t_border as $p => $v)
{
// fwrite ($css_file, "\t".$p.": ".$v.";\n");
}
fwrite ($css_file, "}\n");
fwrite ($css_file, "\n");
}
}*/
}
if ($page_background != "")
{
fwrite ($css_file, "td.ilc_Page\n");
fwrite ($css_file, "{\n");
fwrite ($css_file, "\t"."background-color: ".$page_background.";\n");
fwrite ($css_file, "}\n");
}
fclose($css_file);
$this->setUpToDate(true);
$this->_writeUpToDate($this->getId(), true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjStyleSheet::writeStyleSetting (   $a_name,
  $a_value 
)

Write Style Setting.

Definition at line 3345 of file class.ilObjStyleSheet.php.

{
global $ilDB;
$ilDB->manipulate("DELETE FROM style_setting WHERE ".
" style_id = ".$ilDB->quote($this->getId(), "integer").
" AND name = ".$ilDB->quote($a_name, "text")
);
$ilDB->manipulate("INSERT INTO style_setting ".
"(style_id, name, value) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($a_name, "text").",".
$ilDB->quote($a_value, "text").
")");
}
static ilObjStyleSheet::writeStyleUsage (   $a_obj_id,
  $a_style_id 
)
static

Write style usage.

Definition at line 3381 of file class.ilObjStyleSheet.php.

Referenced by ilObjCategoryGUI\afterSave(), ilObjGlossary\create(), ilObjWiki\create(), ilContainer\create(), ilObjBlog\doUpdate(), ilObjPortfolioBase\doUpdate(), ilObjGlossary\update(), ilObjWiki\update(), and ilContainer\update().

{
global $ilDB;
$ilDB->replace("style_usage", array(
"obj_id" => array("integer", (int) $a_obj_id)),
array(
"style_id" => array("integer", (int) $a_style_id))
);
}

+ Here is the caller graph for this function:

ilObjStyleSheet::writeTemplatePreview (   $a_t_id,
  $a_preview_html 
)

Write table template preview.

Definition at line 3272 of file class.ilObjStyleSheet.php.

Referenced by addTemplate().

{
global $ilDB;
$a_preview_html = str_replace(' width=""', "", $a_preview_html);
$a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
$a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
//echo "1-".strlen($a_preview_html)."-";
//echo htmlentities($a_preview_html);
if (strlen($a_preview_html) > 4000)
{
//echo "2";
$a_preview_html = "";
}
$ilDB->manipulate("UPDATE style_template SET ".
"preview = ".$ilDB->quote($a_preview_html, "text").
" WHERE id = ".$ilDB->quote($a_t_id, "integer"));
}

+ Here is the caller graph for this function:

Field Documentation

ilObjStyleSheet::$assigned_tags
static

Definition at line 275 of file class.ilObjStyleSheet.php.

ilObjStyleSheet::$basic_style_dom
staticprotected

Definition at line 513 of file class.ilObjStyleSheet.php.

Referenced by _getBasicStyleDom().

ilObjStyleSheet::$basic_style_file = "./Services/Style/basic_style/style.xml"
staticprotected

Definition at line 511 of file class.ilObjStyleSheet.php.

ilObjStyleSheet::$basic_style_image_dir = "./Services/Style/basic_style/images"
staticprotected

Definition at line 512 of file class.ilObjStyleSheet.php.

Referenced by _addMissingStyleClassesToAllStyles().

ilObjStyleSheet::$core_styles
static
ilObjStyleSheet::$expandable_types
static
Initial value:
array (
"text_block", "section", "media_cont", "table", "table_cell", "flist_li", "table_caption",
"list_o", "list_u",
"va_cntr", "va_icntr", "va_ihead", "va_icont",
"ha_cntr", "ha_icntr", "ha_ihead", "ha_icont"
)

Definition at line 262 of file class.ilObjStyleSheet.php.

ilObjStyleSheet::$filtered_groups
static
Initial value:
array("ol" => array("ol"), "ul" => array("ul"),
"table" => array("table"), "positioning" => array("h1", "h2", "h3", "div", "img", "table", "a"))

Definition at line 234 of file class.ilObjStyleSheet.php.

Referenced by _getFilteredGroups().

ilObjStyleSheet::$hideable_types
static
Initial value:
array (
"table", "table_cell"
)

Definition at line 270 of file class.ilObjStyleSheet.php.

ilObjStyleSheet::$num_unit = array("px", "em", "ex", "%", "pt", "pc", "in", "mm", "cm")
static

Definition at line 19 of file class.ilObjStyleSheet.php.

Referenced by _getStyleParameterNumericUnits().

ilObjStyleSheet::$num_unit_no_perc = array("px", "em", "ex", "pt", "pc", "in", "mm", "cm")
static

Definition at line 20 of file class.ilObjStyleSheet.php.

Referenced by _getStyleParameterNumericUnits().

ilObjStyleSheet::$parameter
static

Definition at line 23 of file class.ilObjStyleSheet.php.

Referenced by _getStyleParameters(), and getStyleParameterGroups().

ilObjStyleSheet::$pseudo_classes
static
Initial value:
array ("a" => array("hover"), "div" => array("hover"), "img" => array("hover"))

Definition at line 360 of file class.ilObjStyleSheet.php.

ilObjStyleSheet::$style_super_types
static
Initial value:
array(
"text_block" => array("text_block", "heading1", "heading2", "heading3"),
"text_inline" => array("text_inline"),
"section" => array("section"),
"link" => array("link"),
"table" => array("table", "table_cell", "table_caption"),
"list" => array("list_o", "list_u", "list_item"),
"flist" => array("flist_cont", "flist_head", "flist", "flist_li", "flist_a"),
"media" => array("media_cont", "media_caption", "iim", "marker"),
"tabs" => array("va_cntr", "va_icntr", "va_ihead", "va_icont",
"ha_cntr", "ha_icntr", "ha_ihead", "ha_icont"),
"question" => array("question", "qtitle", "qanswer", "qinput", "qlinput", "qsubmit", "qfeedr", "qfeedw",
"qimg", "qordul", "qordli", "qimgd", "qetitem", "qetcorr", "qover"),
"page" => array("page_frame", "page_cont", "page_title", "page_fn",
"page_tnav", "page_bnav", "page_lnav", "page_rnav", "page_lnavlink", "page_rnavlink",
"page_lnavimage", "page_rnavimage"),
"glo" => array("glo_overlay", "glo_ovtitle", "glo_ovclink", "glo_ovuglink", "glo_ovuglistlink"),
"sco" => array("sco_title", "sco_keyw", "sco_desc", "sco_desct", "sco_obj", "sco_objt", "sco_fmess"),
"rte" => array("rte_menu", "rte_mlink", "rte_tree", "rte_node", "rte_tlink","rte_status",
"rte_tul", "rte_tli", "rte_texp", "rte_tclink", "rte_drag")
)

Definition at line 239 of file class.ilObjStyleSheet.php.

Referenced by _getStyleSuperTypes().

ilObjStyleSheet::$templates
static
Initial value:
array(
"table" => array(
"table" => "table",
"caption" => "table_caption",
"row_head" => "table_cell",
"row_foot" => "table_cell",
"col_head" => "table_cell",
"col_foot" => "table_cell",
"odd_row" => "table_cell",
"even_row" => "table_cell",
"odd_col" => "table_cell",
"even_col" => "table_cell"),
"vaccordion" => array(
"va_cntr" => "va_cntr",
"va_icntr" => "va_icntr",
"va_ihead" => "va_ihead",
"va_icont" => "va_icont"
),
"haccordion" => array(
"ha_cntr" => "ha_cntr",
"ha_icntr" => "ha_icntr",
"ha_ihead" => "ha_ihead",
"ha_icont" => "ha_icont"
)
)

Definition at line 484 of file class.ilObjStyleSheet.php.

Referenced by _getTemplateClassTypes(), create(), and getTemplates().


The documentation for this class was generated from the following file: