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

Static Public Member Functions

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

Data Fields

 $style
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
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 More...
 

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$

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

Member Function Documentation

◆ _addMissingStyleClassesToAllStyles()

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

Add missing style classes to all styles.

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

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

Referenced by _addMissingStyleClassesToStyle().

2391  {
2392  global $ilDB;
2393 
2394  if ($a_styles == "")
2395  {
2396  $styles = ilObject::_getObjectsDataForType("sty");
2397  }
2398  else
2399  {
2400  $styles = $a_styles;
2401  }
2404 
2405  // get all core image files
2406  $core_images = array();
2407  $core_dir = self::$basic_style_image_dir;
2408  if (is_dir($core_dir))
2409  {
2410  $dir = opendir($core_dir);
2411  while($file = readdir($dir))
2412  {
2413  if (substr($file, 0, 1) != "." && is_file($core_dir."/".$file))
2414  {
2415  $core_images[] = $file;
2416  }
2417  }
2418  }
2419 
2420  foreach ($styles as $style)
2421  {
2422  $id = $style["id"];
2423 
2424  foreach($core_styles as $cs)
2425  {
2426  // check, whether core style class exists
2427  $set = $ilDB->queryF("SELECT * FROM style_char WHERE style_id = %s ".
2428  "AND type = %s AND characteristic = %s",
2429  array("integer", "text", "text"),
2430  array($id, $cs["type"], $cs["class"]));
2431 
2432  // if not, add core style class
2433  if (!($rec = $ilDB->fetchAssoc($set)))
2434  {
2435  $ilDB->manipulateF(
2436  "INSERT INTO style_char (style_id, type, characteristic) ".
2437  " VALUES (%s,%s,%s) ",
2438  array("integer", "text", "text"),
2439  array($id, $cs["type"], $cs["class"]));
2440 
2441  $xpath = new DOMXPath($bdom);
2442  $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '".$cs["tag"]."' and @Type='".
2443  $cs["type"]."' and @Class='".$cs["class"]."']/StyleParameter");
2444  foreach ($par_nodes as $par_node)
2445  {
2446  // check whether style parameter exists
2447  $set = $ilDB->queryF("SELECT * FROM style_parameter WHERE style_id = %s ".
2448  "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2449  array("integer", "text", "text", "text", "text"),
2450  array($id, $cs["type"], $cs["class"],
2451  $cs["tag"], $par_node->getAttribute("Name")));
2452 
2453  // if not, create style parameter
2454  if (!($rec = $ilDB->fetchAssoc($set)))
2455  {
2456  $spid = $ilDB->nextId("style_parameter");
2457  $st = $ilDB->manipulateF("INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) ".
2458  " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2459  array("integer", "integer", "text", "text", "text", "text", "text"),
2460  array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2461  $par_node->getAttribute("Name"), $par_node->getAttribute("Value")));
2462  }
2463  }
2464  }
2465  }
2466 
2467  // now check, whether some core image files are missing
2470  reset($core_images);
2471  foreach($core_images as $cim)
2472  {
2473  if (!is_file($imdir."/".$cim))
2474  {
2475  copy($core_dir."/".$cim, $imdir."/".$cim);
2476  }
2477  }
2478  }
2479  }
print $file
static _getBasicStyleDom()
Get basic style dom.
static _getCoreStyles()
Get core styles.
static _createImagesDirectory($a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
static _getImagesDirectory($a_style_id)
Get images directory.
_getObjectsDataForType($a_type, $a_omit_trash=false)
get all objects of a certain type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _addMissingStyleClassesToStyle()

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().

2382  {
2383  $styles = array(array("id" => $a_id));
2385  }
static _addMissingStyleClassesToAllStyles($a_styles="")
Add missing style classes to all styles.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _createImagesDirectory()

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().

1184  {
1185  global $ilErr;
1186 
1187  $sty_data_dir = ilUtil::getWebspaceDir()."/sty";
1188  ilUtil::makeDir($sty_data_dir);
1189  if(!is_writable($sty_data_dir))
1190  {
1191  $ilErr->raiseError("Style data directory (".$sty_data_dir
1192  .") not writeable.", $ilErr->FATAL);
1193  }
1194 
1195  $style_dir = $sty_data_dir."/sty_".$a_style_id;
1196  ilUtil::makeDir($style_dir);
1197  if(!@is_dir($style_dir))
1198  {
1199  $ilErr->raiseError("Creation of style directory failed (".
1200  $style_dir.").",$ilErr->FATAL);
1201  }
1202 
1203  // create images subdirectory
1204  $im_dir = $style_dir."/images";
1205  ilUtil::makeDir($im_dir);
1206  if(!@is_dir($im_dir))
1207  {
1208  $ilErr->raiseError("Creation of Import Directory failed (".
1209  $im_dir.").", $ilErr->FATAL);
1210  }
1211 
1212  // create thumbnails directory
1213  $thumb_dir = $style_dir."/images/thumbnails";
1214  ilUtil::makeDir($thumb_dir);
1215  if(!@is_dir($thumb_dir))
1216  {
1217  $ilErr->raiseError("Creation of Import Directory failed (".
1218  $thumb_dir.").", $ilErr->FATAL);
1219  }
1220  }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _determineTag()

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().

2359  {
2360  return self::$assigned_tags[$a_type];
2361  }
+ Here is the caller graph for this function:

◆ _explodeRGB()

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.

References $r.

Referenced by _getColorFlavor().

2904  {
2905  $r["r"] = substr($a_rgb, 0, 2);
2906  $r["g"] = substr($a_rgb, 2, 2);
2907  $r["b"] = substr($a_rgb, 4, 2);
2908 
2909  if ($as_dec)
2910  {
2911  $r["r"] = (int) hexdec($r["r"]);
2912  $r["g"] = (int) hexdec($r["g"]);
2913  $r["b"] = (int) hexdec($r["b"]);
2914  }
2915 
2916  return $r;
2917  }
$r
+ Here is the caller graph for this function:

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

Get basic style dom.

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

References $ilBench.

Referenced by _addMissingStyleClassesToAllStyles().

799  {
800  global $ilBench;
801 
802  if (!is_object(self::$basic_style_dom))
803  {
804  self::$basic_style_dom = new DOMDocument();
805  self::$basic_style_dom->load(self::$basic_style_file);
806  }
807 
808  return self::$basic_style_dom;
809  }
global $ilBench
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ _getClonableContentStyles()

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().

745  {
746  global $ilAccess, $ilDB;
747 
748  $clonable_styles = array();
749 
750  $q = "SELECT * FROM style_data";
751  $style_set = $ilDB->query($q);
752  while($style_rec = $ilDB->fetchAssoc($style_set))
753  {
754  $clonable = false;
755  if ($style_rec["standard"] == 1)
756  {
757  if ($style_rec["active"] == 1)
758  {
759  $clonable = true;
760  }
761  }
762  else
763  {
764  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
765  $obj_ids = ilObjContentObject::_lookupContObjIdByStyleId($style_rec["id"]);
766  foreach($obj_ids as $id)
767  {
768  $ref = ilObject::_getAllReferences($id);
769  foreach($ref as $ref_id)
770  {
771  if ($ilAccess->checkAccess("write", "", $ref_id))
772  {
773  $clonable = true;
774  }
775  }
776  }
777  }
778  if ($clonable)
779  {
780  $clonable_styles[$style_rec["id"]] =
781  ilObject::_lookupTitle($style_rec["id"]);
782  }
783  }
784  return $clonable_styles;
785  }
_lookupContObjIdByStyleId($a_style_id)
lookup style sheet ID
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getColorFlavor()

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().

2877  {
2878  $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
2879  $hls = ilObjStyleSheet::_RGBToHLS($rgb);
2880 
2881  if ($a_i > 0)
2882  {
2883  $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
2884  }
2885  if ($a_i < 0)
2886  {
2887  $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
2888  }
2889 
2890  $rgb = ilObjStyleSheet::_HLSToRGB($hls);
2891 
2892  foreach ($rgb as $k => $v)
2893  {
2894  $rgb[$k] = str_pad(dechex($v), 2, "0", STR_PAD_LEFT);
2895  }
2896 
2897  return $rgb["r"].$rgb["g"].$rgb["b"];
2898  }
static _explodeRGB($a_rgb, $as_dec=false)
Explode an RGB string into an array.
static _HLSToRGB($a_hls)
HLS to RGB (both arrays, 0..255)
static _RGBToHLS($a_rgb)
RGB to HLS (both arrays, 0..255)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getCoreStyles()

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().

2322  {
2323  $c_styles = array();
2324  foreach (self::$core_styles as $cstyle)
2325  {
2326  $c_styles[$cstyle["type"].".".ilObjStyleSheet::_determineTag($cstyle["type"]).".".$cstyle["class"]]
2327  = array("type" => $cstyle["type"],
2328  "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2329  "class" => $cstyle["class"]);
2330  }
2331  return $c_styles;
2332  }
static _determineTag($a_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFilteredGroups()

static ilObjStyleSheet::_getFilteredGroups ( )
static

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

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

2265  {
2266  return self::$filtered_groups;
2267  }
+ Here is the caller graph for this function:

◆ _getImagesDirectory()

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().

1234  {
1235  return ilUtil::getWebspaceDir()."/sty/sty_".$a_style_id.
1236  "/images";
1237  }
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getPseudoClasses()

ilObjStyleSheet::_getPseudoClasses (   $tag)

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

2349  {
2350  return self::$pseudo_classes[$tag];
2351  }

◆ _getStandardStyles()

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().

700  {
701  global $ilDB, $ilias, $tree;
702 
703  $default_style = $ilias->getSetting("default_content_style_id");
704 
705  $and_str = "";
706  if (!$a_include_deactivated)
707  {
708  $and_str = " AND active = 1";
709  }
710 
711  $q = "SELECT * FROM style_data ".
712  " WHERE standard = 1".$and_str;
713  $res = $ilDB->query($q);
714  $styles = array();
715  while($sty = $ilDB->fetchAssoc($res))
716  {
717  if (!$a_exclude_default_style || $default_style != $sty["id"])
718  {
719  // check scope
720  if ($a_scope > 0 && $sty["category"] > 0)
721  {
722  if ($tree->isInTree($sty["category"]) &&
723  $tree->isInTree($a_scope))
724  {
725  $path = $tree->getPathId($a_scope);
726  if (!in_array($sty["category"], $path))
727  {
728  continue;
729  }
730  }
731  }
732  $styles[$sty["id"]] = ilObject::_lookupTitle($sty["id"]);
733  }
734  }
735 
736  return $styles;
737  }
static _lookupTitle($a_id)
lookup object title
$path
Definition: index.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getStyleParameterInputType()

static ilObjStyleSheet::_getStyleParameterInputType (   $par)
static

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

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

2234  {
2235  $input = self::$parameter[$par]["input"];
2236  return $input;
2237  }
+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

static ilObjStyleSheet::_getStyleParameterNumericUnits (   $a_no_percentage = false)
static

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

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

2270  {
2271  if ($a_no_percentage)
2272  {
2273  return self::$num_unit_no_perc;
2274  }
2275  return self::$num_unit;
2276  }
+ Here is the caller graph for this function:

◆ _getStyleParameters()

static ilObjStyleSheet::_getStyleParameters (   $a_tag = "")
static

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

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

2246  {
2247  if ($a_tag == "")
2248  {
2249  return self::$parameter;
2250  }
2251  $par = array();
2252  foreach (self::$parameter as $k => $v)
2253  {
2254  if (is_array(self::$filtered_groups[$v["group"]]) &&
2255  !in_array($a_tag, self::$filtered_groups[$v["group"]]))
2256  {
2257  continue;
2258  }
2259  $par[$k] = $v;
2260  }
2261  return $par;
2262  }
+ Here is the caller graph for this function:

◆ _getStyleParameterSubPar()

static ilObjStyleSheet::_getStyleParameterSubPar (   $par)
static

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

2240  {
2241  $subpar = self::$parameter[$par]["subpar"];
2242  return $subpar;
2243  }

◆ _getStyleParameterValues()

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().

2279  {
2280  return self::$parameter[$par]["values"];
2281  }
+ Here is the caller graph for this function:

◆ _getStyleSuperTypeForType()

static ilObjStyleSheet::_getStyleSuperTypeForType (   $a_type)
static

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

References $t.

Referenced by ilObjStyleSheetGUI\ilObjStyleSheetGUI().

2304  {
2305  foreach (self::$style_super_types as $s => $t)
2306  {
2307  if (in_array($a_type, $t))
2308  {
2309  return $s;
2310  }
2311  if ($a_type == $s)
2312  {
2313  return $s;
2314  }
2315  }
2316  }
+ Here is the caller graph for this function:

◆ _getStyleSuperTypes()

static ilObjStyleSheet::_getStyleSuperTypes ( )
static

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

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

2289  {
2290  return self::$style_super_types;
2291  }
+ Here is the caller graph for this function:

◆ _getTemplateClassTypes()

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

Get template class types.

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

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

2338  {
2339  if ($a_template_type == "")
2340  {
2341  return self::$templates;
2342  }
2343 
2344  return self::$templates[$a_template_type];
2345  }
+ Here is the caller graph for this function:

◆ _HLSToRGB()

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().

2976  {
2977  $h = $a_hls["h"] / 255;
2978  $l = $a_hls["l"] / 255;
2979  $s = $a_hls["s"] / 255;
2980 
2981  $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
2982 
2983  // If S=0, define R, G, and B all to L
2984  if ($s == 0)
2985  {
2986  $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
2987  }
2988  else
2989  {
2990 
2991  if ($l < 0.5)
2992  {
2993  $temp2 = $l * (1.0 + $s);
2994  }
2995  else
2996  {
2997  $temp2 = $l + $s - $l * $s;
2998  }
2999 
3000  $temp1 = 2.0 * $l - $temp2;
3001 
3002 
3003  # For each of R, G, B, compute another temporary value, temp3, as follows:
3004  foreach ($rgb as $k => $v)
3005  {
3006  switch ($k)
3007  {
3008  case "r":
3009  $temp3 = $h + 1.0 / 3.0;
3010  break;
3011 
3012  case "g":
3013  $temp3 = $h;
3014  break;
3015 
3016  case "b":
3017  $temp3 = $h - 1.0/3.0;
3018  break;
3019  }
3020  if ($temp3 < 0)
3021  {
3022  $temp3 = $temp3 + 1.0;
3023  }
3024  if ($temp3 > 1)
3025  {
3026  $temp3 = $temp3 - 1.0;
3027  }
3028 
3029  if (6.0 * $temp3 < 1)
3030  {
3031  $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3032  }
3033  else if (2.0 * $temp3 < 1)
3034  {
3035  $rgb[$k] = $temp2;
3036  }
3037  else if (3.0 * $temp3 < 2)
3038  {
3039  $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0/3.0) - $temp3) * 6.0;
3040  }
3041  else
3042  {
3043  $rgb[$k] = $temp1;
3044  }
3045  }
3046  }
3047 
3048  $rgb["r"] = round($rgb["r"] * 255);
3049  $rgb["g"] = round($rgb["g"] * 255);
3050  $rgb["b"] = round($rgb["b"] * 255);
3051 
3052  return $rgb;
3053  }
+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable (   $a_type)
static

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

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

2294  {
2295  return in_array($a_type, self::$expandable_types);
2296  }
+ Here is the caller graph for this function:

◆ _isHideable()

static ilObjStyleSheet::_isHideable (   $a_type)
static

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

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

2299  {
2300  return in_array($a_type, self::$hideable_types);
2301  }
+ Here is the caller graph for this function:

◆ _lookupActive()

ilObjStyleSheet::_lookupActive (   $a_id)

Lookup active flag.

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

References $res.

Referenced by ilObjStyleSettingsGUI\editContentStylesObject().

684  {
685  global $ilDB;
686 
687  $q = "SELECT * FROM style_data ".
688  " WHERE id = ".$ilDB->quote($a_id, "integer");
689  $res = $ilDB->query($q);
690  $sty = $ilDB->fetchAssoc($res);
691 
692  return (boolean) $sty["active"];
693  }
+ Here is the caller graph for this function:

◆ _lookupStandard()

ilObjStyleSheet::_lookupStandard (   $a_id)

◆ _lookupTemplateIdByName()

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().

3311  {
3312  global $ilDB;
3313 
3314  $set = $ilDB->query("SELECT id FROM style_template ".
3315  " WHERE style_id = ".$ilDB->quote($a_style_id, "integer").
3316  " AND name = ".$ilDB->quote($a_name, "text"));
3317  if ($rec = $ilDB->fetchAssoc($set))
3318  {
3319  return $rec["id"];
3320  }
3321 
3322  return false;
3323  }
+ Here is the caller graph for this function:

◆ _lookupUpToDate()

ilObjStyleSheet::_lookupUpToDate (   $a_id)

Looup up to date.

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

References $res.

Referenced by getContentStylePath().

615  {
616  global $ilDB;
617 
618  $q = "SELECT uptodate FROM style_data ".
619  " WHERE id = ".$ilDB->quote($a_id, "integer");
620  $res = $ilDB->query($q);
621  $sty = $ilDB->fetchAssoc($res);
622 
623  return (boolean) $sty["uptodate"];
624  }
+ Here is the caller graph for this function:

◆ _replaceStylePar()

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().

1767  {
1768  global $ilDB;
1769 
1770  $q = "SELECT * FROM style_parameter WHERE ".
1771  " style_id = ".$ilDB->quote($style_id, "integer")." AND ".
1772  " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1773  " class = ".$ilDB->quote($a_class, "text")." AND ".
1774  " ".$ilDB->equals("type", $a_type, "text", true)." AND ".
1775  " parameter = ".$ilDB->quote($a_par, "text");
1776 
1777  $set = $ilDB->query($q);
1778 
1779  if ($rec = $set->fetchRow())
1780  {
1781  $q = "UPDATE style_parameter SET ".
1782  " value = ".$ilDB->quote($a_val, "text")." WHERE ".
1783  " style_id = ".$ilDB->quote($style_id, "integer")." AND ".
1784  " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1785  " class = ".$ilDB->quote($a_class, "text")." AND ".
1786  " ".$ilDB->equals("type", $a_type, "text", true)." AND ".
1787  " parameter = ".$ilDB->quote($a_par, "text");
1788 
1789  $ilDB->manipulate($q);
1790  }
1791  else
1792  {
1793  $id = $ilDB->nextId("style_parameter");
1794  $q = "INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter) VALUES ".
1795  " (".
1796  $ilDB->quote($id, "integer").",".
1797  $ilDB->quote($a_val, "text").",".
1798  " ".$ilDB->quote($this->getId(), "integer").",".
1799  " ".$ilDB->quote($a_tag, "text").",".
1800  " ".$ilDB->quote($a_class, "text").",".
1801  " ".$ilDB->quote($a_type, "text").",".
1802  " ".$ilDB->quote($a_par, "text").")";
1803 
1804  $ilDB->manipulate($q);
1805  }
1806  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _RGBToHLS()

static ilObjStyleSheet::_RGBToHLS (   $a_rgb)
static

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

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

References $r.

Referenced by _getColorFlavor().

2923  {
2924  $r = $a_rgb["r"] / 255;
2925  $g = $a_rgb["g"] / 255;
2926  $b = $a_rgb["b"] / 255;
2927 
2928  // max / min
2929  $max = max($r,$g,$b);
2930  $min = min($r,$g,$b);
2931 
2932  //lightness
2933  $l = ($max + $min) / 2;
2934 
2935  if ($max == $min)
2936  {
2937  $s = 0;
2938  $h = 0;
2939  }
2940  else
2941  {
2942  if ($l < 0.5)
2943  {
2944  $s = ($max - $min) / ($max + $min);
2945  }
2946  else
2947  {
2948  $s = ($max - $min) / (2.0 - $max - $min);
2949  }
2950 
2951  if ($r == $max)
2952  {
2953  $h = ($g - $b) / ($max - $min);
2954  }
2955  else if ($g == $max)
2956  {
2957  $h = 2.0 + ($b - $r) / ($max - $min);
2958  }
2959  else if ($b == $max)
2960  {
2961  $h = 4.0 + ($r - $g) / ($max - $min);
2962  }
2963  }
2964 
2965  $hls["h"] = round(($h / 6) * 255);
2966  $hls["l"] = round($l * 255);
2967  $hls["s"] = round($s * 255);
2968 
2969  return $hls;
2970  }
$r
+ Here is the caller graph for this function:

◆ _writeActive()

ilObjStyleSheet::_writeActive (   $a_id,
  $a_active 
)

Write active flag.

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

Referenced by ilObjStyleSettingsGUI\saveActiveStylesObject().

671  {
672  global $ilDB;
673 
674  $q = "UPDATE style_data SET active = ".
675  $ilDB->quote((int) $a_active, "integer").
676  " WHERE id = ".$ilDB->quote($a_id, "integer");
677  $ilDB->manipulate($q);
678  }
+ Here is the caller graph for this function:

◆ _writeScope()

ilObjStyleSheet::_writeScope (   $a_id,
  $a_scope 
)

Write scope.

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

Referenced by ilObjStyleSettingsGUI\saveScopeObject().

643  {
644  global $ilDB;
645 
646  $q = "UPDATE style_data SET category = ".
647  $ilDB->quote((int) $a_scope, "integer").
648  " WHERE id = ".$ilDB->quote($a_id, "integer");
649  $ilDB->manipulate($q);
650  }
+ Here is the caller graph for this function:

◆ _writeStandard()

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().

630  {
631  global $ilDB;
632 
633  $q = "UPDATE style_data SET standard = ".
634  $ilDB->quote((int) $a_std, "integer").
635  " WHERE id = ".$ilDB->quote($a_id, "integer");
636  $ilDB->manipulate($q);
637  }
+ Here is the caller graph for this function:

◆ _writeUpToDate()

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().

602  {
603  global $ilDB;
604 
605  $q = "UPDATE style_data SET uptodate = ".
606  $ilDB->quote((int) $a_up_to_date, "integer").
607  " WHERE id = ".$ilDB->quote($a_id, "integer");
608  $ilDB->manipulate($q);
609  }
+ Here is the caller graph for this function:

◆ addCharacteristic()

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().

979  {
980  global $ilDB;
981 
982  // delete characteristic record
983  $ilDB->manipulateF("INSERT INTO style_char (style_id, type, characteristic, hide)".
984  " VALUES (%s,%s,%s,%s) ",
985  array("integer", "text", "text", "integer"),
986  array($this->getId(), $a_type, $a_char, $a_hidden));
987 
988  $this->setUpToDate(false);
989  $this->_writeUpToDate($this->getId(), false);
990  }
getId()
get object id public
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
_writeUpToDate($a_id, $a_up_to_date)
Write up to date.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addColor()

ilObjStyleSheet::addColor (   $a_name,
  $a_code 
)

Add color.

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

Referenced by copyCharacteristic(), and create().

2758  {
2759  global $ilDB;
2760 
2761  $ilDB->manipulate("INSERT INTO style_color (style_id, color_name, color_code)".
2762  " VALUES (".
2763  $ilDB->quote($this->getId(), "integer").",".
2764  $ilDB->quote($a_name, "text").",".
2765  $ilDB->quote($a_code, "text").
2766  ")");
2767  }
+ Here is the caller graph for this function:

◆ addParameter()

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().

1149  {
1150  global $ilDB;
1151 
1152  $avail_params = $this->getAvailableParameters();
1153  $tag = explode(".", $a_tag);
1154  $value = $avail_params[$a_par][0];
1155  $id = $ilDB->nextId("style_parameter");
1156  $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value) VALUES ".
1157  "(".
1158  $ilDB->quote($id, "integer").",".
1159  $ilDB->quote($this->getId(), "integer").",".
1160  $ilDB->quote($a_type, "text").",".
1161  $ilDB->quote($tag[0], "text").",".
1162  $ilDB->quote($tag[1], "text").",".
1163  $ilDB->quote($a_par, "text").",".
1164  $ilDB->quote($value, "text").")";
1165  $ilDB->manipulate($q);
1166  $this->read();
1167  $this->writeCSSFile();
1168  }
read()
read style properties
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
getId()
get object id public
static getAvailableParameters()
Get available parameters.
+ Here is the call graph for this function:

◆ addTemplate()

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().

3105  {
3106  global $ilDB;
3107 
3108  $tid = $ilDB->nextId("style_template");
3109  $ilDB->manipulate($q = "INSERT INTO style_template ".
3110  "(id, style_id, name, temp_type)".
3111  " VALUES (".
3112  $ilDB->quote($tid, "integer").",".
3113  $ilDB->quote($this->getId(), "integer").",".
3114  $ilDB->quote($a_name, "text").",".
3115  $ilDB->quote($a_type, "text").
3116  ")");
3117 
3118  foreach ($a_classes as $t => $c)
3119  {
3120  $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3121  "(template_id, class_type, class)".
3122  " VALUES (".
3123  $ilDB->quote($tid, "integer").",".
3124  $ilDB->quote($t, "text").",".
3125  $ilDB->quote($c, "text").
3126  ")");
3127  }
3128 
3129  include_once("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
3130  $this->writeTemplatePreview($tid,
3131  ilObjStyleSheetGUI::_getTemplatePreview($this, $a_type, $tid, true));
3132 
3133  return $tid;
3134  }
_getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
writeTemplatePreview($a_t_id, $a_preview_html)
Write table template preview.
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignMetaData()

ilObjStyleSheet::assignMetaData ( $a_meta_data)

assign meta data object

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

791  {
792  $this->meta_data =& $a_meta_data;
793  }

◆ characteristicExists()

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().

961  {
962  global $ilDB;
963 
964  $set = $ilDB->queryF(
965  "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
966  array("integer", "text", "text"),
967  array($this->getId(), $a_char, $a_style_type));
968  if ($rec = $ilDB->fetchAssoc($set))
969  {
970  return true;
971  }
972  return false;
973  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanExportDirectory()

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().

1936  {
1937  $sty_data_dir = ilUtil::getDataDir()."/sty";
1938  $style_dir = $sty_data_dir."/sty_".$this->getId();
1939  // create export subdirectory
1940  $ex_dir = $style_dir."/export";
1941 
1942  if (is_dir($ex_dir))
1943  {
1944  ilUtil::delDir($ex_dir, true);
1945  }
1946  }
getId()
get object id public
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ colorExists()

ilObjStyleSheet::colorExists (   $a_color_name)

Check whether color exists.

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

Referenced by copyCharacteristic().

2828  {
2829  global $ilDB;
2830 
2831  $set = $ilDB->query("SELECT * FROM style_color WHERE ".
2832  "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
2833  "color_name = ".$ilDB->quote($a_color_name, "text"));
2834  if ($rec = $ilDB->fetchAssoc($set))
2835  {
2836  return true;
2837  }
2838  return false;
2839  }
+ Here is the caller graph for this function:

◆ copyCharacteristic()

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

Copy characteristic.

Parameters

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

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

1000  {
1001  global $ilDB;
1002 
1003  if (!$this->characteristicExists($a_to_char, $a_from_type))
1004  {
1005  $this->addCharacteristic($a_from_type, $a_to_char);
1006  }
1007  $this->deleteStyleParOfChar($a_from_type, $a_to_char);
1008 
1009  $from_style = new ilObjStyleSheet($a_from_style_id);
1010 
1011  $pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
1012 
1013  $colors = array();
1014  foreach ($pars as $p => $v)
1015  {
1016  if (substr($v, 0, 1) == "!")
1017  {
1018  $colors[] = substr($v, 1);
1019  }
1020  $this->replaceStylePar(ilObjStyleSheet::_determineTag($a_from_type),
1021  $a_to_char, $p, $v, $a_from_type);
1022  }
1023 
1024  // copy colors
1025  foreach ($colors as $c)
1026  {
1027  if (!$this->colorExists($c))
1028  {
1029  $this->addColor($c, $from_style->getColorCodeForName($c));
1030  }
1031  }
1032  }
replaceStylePar($a_tag, $a_class, $a_par, $a_val, $a_type)
Set style parameter per tag/class/parameter.
characteristicExists($a_char, $a_style_type)
Check whether characteristic exists.
static _determineTag($a_type)
deleteStyleParOfChar($a_type, $a_class)
Delete style parameters of characteristic.
addColor($a_name, $a_code)
Add color.
ilObjStyleSheet($a_id=0, $a_call_by_reference=false)
Constructor public.
addCharacteristic($a_type, $a_char, $a_hidden=false)
Add characteristic.
colorExists($a_color_name)
Check whether color exists.
+ Here is the call graph for this function:

◆ copyImagesToDir()

ilObjStyleSheet::copyImagesToDir (   $a_target)

Copy images to directory.

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

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

1137  {
1138  ilUtil::rCopy($this->getImagesDirectory(), $a_target);
1139  }
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getImagesDirectory()
Get images directory.
+ Here is the call graph for this function:

◆ create()

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(), createFromXMLFile(), createImagesDirectory(), ilObject\getId(), getImagesDirectory(), getScope(), ilObjStyleSheet(), ilUtil\rCopy(), read(), and writeCSSFile().

823  {
824  global $ilDB;
825 
826  parent::create();
827 
828  if ($a_from_style == 0)
829  {
830  if (!$a_import_mode)
831  {
832  // copy styles from basic style
833  $this->createFromXMLFile(self::$basic_style_file, true);
834 
835  // copy images from basic style
836  $this->createImagesDirectory();
837  ilUtil::rCopy(self::$basic_style_image_dir,
838  $this->getImagesDirectory());
839  }
840  }
841  else
842  {
843  // get style parameter records
844  $def = array();
845  $q = "SELECT * FROM style_parameter WHERE style_id = ".
846  $ilDB->quote($a_from_style, "integer");
847  $par_set = $ilDB->query($q);
848  while($par_rec = $ilDB->fetchAssoc($par_set))
849  {
850  $def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
851  "parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
852  "type" => $par_rec["type"]);
853  }
854 
855  // get style characteristics records
856  $chars = array();
857  $q = "SELECT * FROM style_char WHERE style_id = ".
858  $ilDB->quote($a_from_style, "integer");
859  $par_set = $ilDB->query($q);
860  while($par_rec = $ilDB->fetchAssoc($par_set))
861  {
862  $chars[] = array("type" => $par_rec["type"], "characteristic" => $par_rec["characteristic"]);
863  }
864 
865  // default style settings
866  foreach ($def as $sty)
867  {
868  $id = $ilDB->nextId("style_parameter");
869  $q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type) VALUES ".
870  "(".
871  $ilDB->quote($id, "integer").",".
872  $ilDB->quote($this->getId(), "integer").",".
873  $ilDB->quote($sty["tag"], "text").",".
874  $ilDB->quote($sty["class"], "text").",".
875  $ilDB->quote($sty["parameter"], "text").",".
876  $ilDB->quote($sty["value"], "text").",".
877  $ilDB->quote($sty["type"], "text").")";
878  $ilDB->manipulate($q);
879  }
880 
881  // insert style characteristics
882  foreach ($chars as $char)
883  {
884  $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
885  "(".$ilDB->quote($this->getId(), "integer").",".
886  $ilDB->quote($char["type"], "text").",".
887  $ilDB->quote($char["characteristic"], "text").")";
888  $ilDB->manipulate($q);
889  }
890 
891  // add style_data record
892  $q = "INSERT INTO style_data (id, uptodate, category) VALUES ".
893  "(".$ilDB->quote($this->getId(), "integer").", 0,".
894  $ilDB->quote((int) $this->getScope(), "integer").")";
895  $ilDB->manipulate($q);
896 
897  // copy images
898  $from_style = new ilObjStyleSheet($a_from_style);
899  $this->createImagesDirectory();
900  ilUtil::rCopy($from_style->getImagesDirectory(),
901  $this->getImagesDirectory());
902 
903  // copy colors
904  $colors = $from_style->getColors();
905  foreach ($colors as $c)
906  {
907  $this->addColor($c["name"], $c["code"]);
908  }
909 
910  // copy templates
912  foreach ($tcts as $tct => $v)
913  {
914  $templates = $from_style->getTemplates($tct);
915  foreach ($templates as $t)
916  {
917  $this->addTemplate($tct, $t["name"], $t["classes"]);
918  }
919  }
920 
921  }
922 
923  $this->read();
924  if (!$a_import_mode)
925  {
926  $this->writeCSSFile();
927  }
928  }
static _getTemplateClassTypes($a_template_type="")
Get template class types.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
read()
read style properties
addTemplate($a_type, $a_name, $a_classes)
Add table template.
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
addColor($a_name, $a_code)
Add color.
getImagesDirectory()
Get images directory.
getId()
get object id public
ilObjStyleSheet($a_id=0, $a_call_by_reference=false)
Constructor public.
createFromXMLFile($a_file, $a_skip_parent_create=false)
create style from xml file
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:

◆ createExportDirectory()

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().

1903  {
1904  $sty_data_dir = ilUtil::getDataDir()."/sty";
1905  ilUtil::makeDir($sty_data_dir);
1906  if(!is_writable($sty_data_dir))
1907  {
1908  $this->ilias->raiseError("Style data directory (".$sty_data_dir
1909  .") not writeable.",$this->ilias->error_obj->FATAL);
1910  }
1911 
1912  $style_dir = $sty_data_dir."/sty_".$this->getId();
1913  ilUtil::makeDir($style_dir);
1914  if(!@is_dir($style_dir))
1915  {
1916  $this->ilias->raiseError("Creation of style directory failed (".
1917  $style_dir.").",$this->ilias->error_obj->FATAL);
1918  }
1919 
1920  // create export subdirectory
1921  $ex_dir = $style_dir."/export";
1922  ilUtil::makeDir($ex_dir);
1923  if(!@is_dir($ex_dir))
1924  {
1925  $this->ilias->raiseError("Creation of Import Directory failed (".
1926  $ex_dir.").",$this->ilias->error_obj->FATAL);
1927  }
1928 
1929  return $ex_dir;
1930  }
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExportSubDirectory()

ilObjStyleSheet::createExportSubDirectory ( )

Create export directory.

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

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

Referenced by export().

1953  {
1954  $ex_dir = $this->createExportDirectory();
1955  $ex_sub_dir = $ex_dir."/".$this->getExportSubDir();
1956  ilUtil::makeDir($ex_sub_dir);
1957  if(!is_writable($ex_sub_dir))
1958  {
1959  $this->ilias->raiseError("Style data directory (".$ex_sub_dir
1960  .") not writeable.",$this->ilias->error_obj->FATAL);
1961  }
1962  $ex_sub_images_dir = $ex_sub_dir."/images";
1963  ilUtil::makeDir($ex_sub_images_dir);
1964  if(!is_writable($ex_sub_images_dir))
1965  {
1966  $this->ilias->raiseError("Style data directory (".$ex_sub_images_dir
1967  .") not writeable.",$this->ilias->error_obj->FATAL);
1968  }
1969  }
redirection script todo: (a better solution should control the processing via a xml file) ...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
createExportDirectory()
Create export directory.
getExportSubDir()
The local directory, that will be included within the zip file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createFromXMLFile()

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, do_3_10_Migration(), ilObject\getId(), read(), and update().

Referenced by create(), and import().

2137  {
2138  global $ilDB;
2139 
2140  $this->is_3_10_skin = false;
2141 
2142  if (!$a_skip_parent_create)
2143  {
2144  parent::create();
2145  }
2146  include_once("./Services/Style/classes/class.ilStyleImportParser.php");
2147  $importParser = new ilStyleImportParser($a_file, $this);
2148  $importParser->startParsing();
2149 
2150  // store style parameter
2151  foreach ($this->style as $style)
2152  {
2153  foreach($style as $tag)
2154  {
2155  $id = $ilDB->nextId("style_parameter");
2156 
2157  // migrate old table PageFrame/PageContainer to div
2158  if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
2159  $tag["tag"] == "table")
2160  {
2161  $tag["tag"] = "div";
2162  if ($tag["parameter"] == "width" && $tag["value"] == "100%")
2163  {
2164  continue;
2165  }
2166  }
2167 
2168  $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value) VALUES ".
2169  "(".
2170  $ilDB->quote($id, "integer").",".
2171  $ilDB->quote($this->getId(), "integer").",".
2172  $ilDB->quote($tag["tag"], "text").",".
2173  $ilDB->quote($tag["class"], "text").",".
2174  $ilDB->quote($tag["parameter"], "text").",".
2175  $ilDB->quote($tag["type"], "text").",".
2176  $ilDB->quote($tag["value"], "text").")";
2177 //echo "<br>-$q";
2178  $ilDB->manipulate($q);
2179  }
2180  }
2181 
2182  // store characteristics
2183  $this->is_3_10_skin = true;
2184  if (is_array($this->chars))
2185  {
2186  foreach ($this->chars as $char)
2187  {
2188  if ($char["type"] != "")
2189  {
2190  $s = substr($char["class"], strlen($char["class"]) - 6);
2191  if ($s != ":hover")
2192  {
2193  $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
2194  "(".$ilDB->quote($this->getId(), "integer").",".
2195  $ilDB->quote($char["type"], "text").",".
2196  $ilDB->quote($char["class"], "text").")";
2197  $ilDB->manipulate($q);
2198  $this->is_3_10_skin = false;
2199  }
2200  }
2201  }
2202  }
2203 
2204  // add style_data record
2205  $q = "INSERT INTO style_data (id, uptodate) VALUES ".
2206  "(".$ilDB->quote($this->getId(), "integer").", 0)";
2207  $ilDB->manipulate($q);
2208 
2209  $this->update();
2210  $this->read();
2211 
2212  if ($this->is_3_10_skin)
2213  {
2214  $this->do_3_10_Migration();
2215  }
2216  //$this->writeCSSFile();
2217  }
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.
read()
read style properties
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createImagesDirectory()

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().

1175  {
1177  }
getId()
get object id public
static _createImagesDirectory($a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createImportDirectory()

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().

2047  {
2048  $sty_data_dir = ilUtil::getDataDir()."/sty";
2049  ilUtil::makeDir($sty_data_dir);
2050  if(!is_writable($sty_data_dir))
2051  {
2052  $this->ilias->raiseError("Style data directory (".$sty_data_dir
2053  .") not writeable.",$this->ilias->error_obj->FATAL);
2054  }
2055 
2056  $style_dir = $sty_data_dir."/sty_".$this->getId();
2057  ilUtil::makeDir($style_dir);
2058  if(!@is_dir($style_dir))
2059  {
2060  $this->ilias->raiseError("Creation of style directory failed (".
2061  $style_dir.").",$this->ilias->error_obj->FATAL);
2062  }
2063 
2064  // create import subdirectory
2065  $im_dir = $style_dir."/import";
2066  ilUtil::makeDir($im_dir);
2067  if(!@is_dir($im_dir))
2068  {
2069  $this->ilias->raiseError("Creation of Import Directory failed (".
2070  $im_dir.").",$this->ilias->error_obj->FATAL);
2071  }
2072 
2073  return $im_dir;
2074  }
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createReference()

ilObjStyleSheet::createReference ( )

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

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

562  {
563  $this->ilias->raiseError("Operation ilObjStyleSheet::createReference() not allowed.",$this->ilias->error_obj->FATAL);
564  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ delete()

ilObjStyleSheet::delete ( )

delete style object

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

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

1362  {
1363  global $ilDB;
1364 
1365  // delete object
1366  parent::delete();
1367 
1368  // check whether this style is global default
1369  $def_style = $this->ilias->getSetting("default_content_style_id");
1370  if ($def_style == $this->getId())
1371  {
1372  $this->ilias->deleteSetting("default_content_style_id");
1373  }
1374 
1375  // check whether this style is global fixed
1376  $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1377  if ($fixed_style == $this->getId())
1378  {
1379  $this->ilias->deleteSetting("fixed_content_style_id");
1380  }
1381 
1382  // delete style parameter
1383  $q = "DELETE FROM style_parameter WHERE style_id = ".
1384  $ilDB->quote($this->getId(), "integer");
1385  $ilDB->manipulate($q);
1386 
1387  // delete style file
1388  $css_file_name = ilUtil::getWebspaceDir()."/css/style_".$this->getId().".css";
1389  if (is_file($css_file_name))
1390  {
1391  unlink($css_file_name);
1392  }
1393 
1394  // delete entries in learning modules
1395  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1397 
1398  // delete style data record
1399  $q = "DELETE FROM style_data WHERE id = ".
1400  $ilDB->quote($this->getId(), "integer");
1401  $ilDB->manipulate($q);
1402 
1403  }
getId()
get object id public
_deleteStyleAssignments($a_style_id)
delete all style references to style
redirection script todo: (a better solution should control the processing via a xml file) ...
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ deleteCharacteristic()

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().

934  {
935  global $ilDB;
936 
937  // check, if characteristic is not a core style
939  if (empty($core_styles[$a_type.".".$a_tag.".".$a_class]))
940  {
941  // delete characteristic record
942  $st = $ilDB->manipulateF(
943  "DELETE FROM style_char WHERE style_id = %s AND type = %s AND characteristic = %s",
944  array("integer", "text", "text"),
945  array($this->getId(), $a_type, $a_class));
946 
947  // delete parameter records
948  $st = $ilDB->manipulateF("DELETE FROM style_parameter WHERE style_id = %s AND tag = %s AND type = %s AND class = %s",
949  array("integer", "text", "text", "text"),
950  array($this->getId(), $a_tag, $a_type, $a_class));
951  }
952 
953  $this->setUpToDate(false);
954  $this->_writeUpToDate($this->getId(), false);
955  }
getId()
get object id public
static _getCoreStyles()
Get core styles.
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
_writeUpToDate($a_id, $a_up_to_date)
Write up to date.
+ Here is the call graph for this function:

◆ deleteImage()

ilObjStyleSheet::deleteImage (   $a_file)

Delete an image.

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

References getImagesDirectory(), and getThumbnailsDirectory().

1290  {
1291  if (is_file($this->getImagesDirectory()."/".$a_file))
1292  {
1293  unlink($this->getImagesDirectory()."/".$a_file);
1294  }
1295  if (is_file($this->getThumbnailsDirectory()."/".$a_file))
1296  {
1297  unlink($this->getThumbnailsDirectory()."/".$a_file);
1298  }
1299  }
getThumbnailsDirectory()
Get thumbnails directory.
getImagesDirectory()
Get images directory.
+ Here is the call graph for this function:

◆ deleteParameter()

ilObjStyleSheet::deleteParameter (   $a_id)

delete style parameter

Parameters
int$a_idstyle parameter id

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

1307  {
1308  global $ilDB;
1309 
1310  $q = "DELETE FROM style_parameter WHERE id = ".
1311  $ilDB->quote($a_id, "integer");
1312  $ilDB->query($q);
1313  }

◆ deleteStylePar()

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().

1324  {
1325  global $ilDB;
1326 
1327  $q = "DELETE FROM style_parameter WHERE ".
1328  " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1329  " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1330  " class = ".$ilDB->quote($a_class, "text")." AND ".
1331  " ".$ilDB->equals("type", $a_type, "text", true)." AND ".
1332  " parameter = ".$ilDB->quote($a_par, "text");
1333 
1334  $ilDB->manipulate($q);
1335  }
getId()
get object id public
+ Here is the call graph for this function:

◆ deleteStyleParOfChar()

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().

1346  {
1347  global $ilDB;
1348 
1349  $q = "DELETE FROM style_parameter WHERE ".
1350  " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1351  " class = ".$ilDB->quote($a_class, "text")." AND ".
1352  " ".$ilDB->equals("type", $a_type, "text", true);
1353 
1354  $ilDB->manipulate($q);
1355  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineTemplateStyleClassType()

ilObjStyleSheet::determineTemplateStyleClassType (   $t,
  $k 
)

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

References $t.

2354  {
2355  return self::$templates[$t][$k];
2356  }

◆ do_3_10_CharMigration()

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().

2552  {
2553  global $ilDB;
2554 
2555  $add_str = "";
2556  if ($a_id != "")
2557  {
2558  $add_str = " AND style_id = ".$ilDB->quote($a_id, "integer");
2559  }
2560 
2561  $set = $ilDB->query($q = "SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE ".
2562  $ilDB->equals("type", "", "text", true)." ".$add_str);
2563 
2564  while ($rec = $ilDB->fetchAssoc($set))
2565  {
2566  // derive types from tag
2567  $types = array();
2568  switch ($rec["tag"])
2569  {
2570  case "div":
2571  case "p":
2572  if (in_array($rec["class"], array("Headline3", "Headline1",
2573  "Headline2", "TableContent", "List", "Standard", "Remark",
2574  "Additional", "Mnemonic", "Citation", "Example")))
2575  {
2576  $types[] = "text_block";
2577  }
2578  if (in_array($rec["class"], array("Block", "Remark",
2579  "Additional", "Mnemonic", "Example", "Excursus", "Special")))
2580  {
2581  $types[] = "section";
2582  }
2583  if (in_array($rec["class"], array("Page", "Footnote", "PageTitle", "LMNavigation")))
2584  {
2585  $types[] = "page";
2586  }
2587  break;
2588 
2589  case "td":
2590  $types[] = "table_cell";
2591  break;
2592 
2593  case "a":
2594  if (in_array($rec["class"], array("ExtLink", "IntLink", "FootnoteLink")))
2595  {
2596  $types[] = "link";
2597  }
2598  break;
2599 
2600  case "span":
2601  $types[] = "text_inline";
2602  break;
2603 
2604  case "table":
2605  $types[] = "table";
2606  break;
2607  }
2608 
2609  // check if style_char set exists
2610  foreach ($types as $t)
2611  {
2612  // check if second type already exists
2613  $set4 = $ilDB->queryF("SELECT * FROM style_char ".
2614  " WHERE style_id = %s AND type = %s AND characteristic = %s",
2615  array("integer", "text", "text"),
2616  array($rec["style_id"], $t, $rec["class"]));
2617  if ($rec4 = $ilDB->fetchAssoc($set4))
2618  {
2619  // ok
2620  }
2621  else
2622  {
2623 //echo "<br>1-".$rec["style_id"]."-".$t."-".$rec["class"]."-";
2624  $ilDB->manipulateF("INSERT INTO style_char ".
2625  " (style_id, type, characteristic) VALUES ".
2626  " (%s,%s,%s) ",
2627  array("integer", "text", "text"),
2628  array($rec["style_id"], $t, $rec["class"]));
2629  }
2630  }
2631 
2632  // update types
2633  if ($rec["type"] == "")
2634  {
2635  if (count($types) > 0)
2636  {
2637  $ilDB->manipulateF("UPDATE style_parameter SET type = %s ".
2638  " WHERE style_id = %s AND class = %s AND ".$ilDB->equals("type", "", "text", true),
2639  array("text", "integer", "text"),
2640  array($types[0], $rec["style_id"], $rec["class"]));
2641 //echo "<br>3-".$types[0]."-".$rec["style_id"]."-".$rec["class"]."-";
2642 
2643  // links extra handling
2644  if ($types[0] == "link")
2645  {
2646  $ilDB->manipulateF("UPDATE style_parameter SET type = %s ".
2647  " WHERE style_id = %s AND (class = %s OR class = %s) AND ".$ilDB->equals("type", "", "text", true),
2648  array("text", "integer", "text", "text"),
2649  array($types[0], $rec["style_id"], $rec["class"].":visited",
2650  $rec["class"].":hover"));
2651  }
2652  }
2653 
2654  if (count($types) == 2)
2655  {
2656  // select all records of first type and add second type
2657  // records if necessary.
2658  $set2 = $ilDB->queryF("SELECT * FROM style_parameter ".
2659  " WHERE style_id = %s AND class = %s AND type = %s",
2660  array("integer", "text", "text"),
2661  array($rec["style_id"], $rec["class"], $types[0]));
2662  while ($rec2 = $ilDB->fetchAssoc($set2))
2663  {
2664  // check if second type already exists
2665  $set3 = $ilDB->queryF("SELECT * FROM style_parameter ".
2666  " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2667  array("integer", "text", "text", "text", "text"),
2668  array($rec["style_id"], $rec["tag"], $rec["class"], $types[1], $rec["parameter"]));
2669  if ($rec3 = $ilDB->fetchAssoc($set3))
2670  {
2671  // ok
2672  }
2673  else
2674  {
2675  $nid = $ilDB->nextId("style_parameter");
2676  $ilDB->manipulateF("INSERT INTO style_parameter ".
2677  " (id, style_id, tag, class, parameter, value, type) VALUES ".
2678  " (%s, %s,%s,%s,%s,%s,%s) ",
2679  array("integer", "integer", "text", "text", "text", "text", "text"),
2680  array($nid, $rec2["style_id"], $rec2["tag"], $rec2["class"],
2681  $rec2["parameter"], $rec2["value"], $types[1]));
2682  }
2683  }
2684  }
2685  }
2686  }
2687  }
+ Here is the caller graph for this function:

◆ do_3_10_Migration()

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().

2489  {
2490  global $ilDB;
2491 
2492  $this->do_3_9_Migration($this->getId());
2493 
2494  //include_once("./Services/Migration/DBUpdate_1385/classes/class.ilStyleMigration.php");
2495  //ilStyleMigration::addMissingStyleCharacteristics($this->getId());
2496 
2497  $this->do_3_10_CharMigration($this->getId());
2498 
2499  // style_char: type for characteristic
2500  $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?".
2501  " AND style_id = ? ", array("text", "text", "integer"));
2502  $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2503  $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2504  $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2505  $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2506  $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2507  $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2508 
2509  // style_parameter: type for class
2510  $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?".
2511  " AND style_id = ? ", array("text", "text", "integer"));
2512  $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2513  $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2514  $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2515  $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2516  $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2517  $ilDB->execute($st, array("table", "Page", $this->getId()));
2518 
2519  $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?".
2520  " AND style_id = ? ", array("text", "text", "integer"));
2521  $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2522 
2523  // style_char: characteristic for characteristic
2524  $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?".
2525  " AND style_id = ? ", array("text", "text", "integer"));
2526  $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2527  $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2528 
2529  // style_parameter: class for class
2530  $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?".
2531  " AND style_id = ? ", array("text", "text", "integer"));
2532  $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2533  $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2534 
2535  // force rewriting of container style
2536  $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?".
2537  " AND style_id = ? ", array("text", "integer"));
2538  $ilDB->execute($st, array("page_cont", $this->getId()));
2539  $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?".
2540  " AND style_id = ? ", array("text", "integer"));
2541  $ilDB->execute($st, array("page_cont", $this->getId()));
2542 
2543  }
do_3_9_Migration($a_id)
Migrate old 3.9 styles.
do_3_10_CharMigration($a_id="")
This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingS...
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_3_9_Migration()

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().

2693  {
2694  global $ilDB;
2695 
2696  $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2697  $pars = array("margin-top", "margin-bottom");
2698 
2699  foreach ($classes as $curr_class)
2700  {
2701  foreach ($pars as $curr_par)
2702  {
2703  $res2 = $ilDB->queryF("SELECT id FROM style_parameter WHERE style_id = %s".
2704  " AND tag = %s AND class= %s AND parameter = %s",
2705  array("integer", "text", "text", "text"),
2706  array($a_id, "p", $curr_class, $curr_par));
2707  if ($row2 = $ilDB->fetchAssoc($res2))
2708  {
2709  $ilDB->manipulateF("UPDATE style_parameter SET value= %s WHERE id = %s",
2710  array("text", "integer"),
2711  array("10px", $row2["id"]));
2712  }
2713  else
2714  {
2715  $nid = $ilDB->nextId("style_parameter");
2716  $ilDB->manipulateF("INSERT INTO style_parameter ".
2717  "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2718  array("integer", "integer", "text", "text", "text", "text"),
2719  array($nid, $a_id, "div", $curr_class, $curr_par, "10px"));
2720  }
2721  }
2722  }
2723 
2724  $ilDB->manipulateF("UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2725  array("text", "text", "integer"),
2726  array("div", "p", $a_id));
2727 
2728  }
+ Here is the caller graph for this function:

◆ export()

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().

2000  {
2001  $this->cleanExportDirectory();
2002  $ex_dir = $this->createExportDirectory();
2003  $this->createExportSubDirectory();
2004  $this->exportXML($ex_dir."/".$this->getExportSubDir());
2005 //echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
2007  $ex_dir."/".$this->getExportSubDir()."/images");
2008  if (is_file($ex_dir."/".$this->getExportSubDir().".zip"))
2009  {
2010  unlink($ex_dir."/".$this->getExportSubDir().".zip");
2011  }
2012  ilUtil::zip($ex_dir."/".$this->getExportSubDir(),
2013  $ex_dir."/".$this->getExportSubDir().".zip");
2014 
2015  return $ex_dir."/".$this->getExportSubDir().".zip";
2016  }
exportXML($a_dir)
export style xml file to directory
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
createExportSubDirectory()
Create export directory.
getImagesDirectory()
Get images directory.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
createExportDirectory()
Create export directory.
getExportSubDir()
The local directory, that will be included within the zip file.
cleanExportDirectory()
Clear export directory.
+ Here is the call graph for this function:

◆ exportXML()

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().

2022  {
2023  $file = $a_dir."/style.xml";
2024 
2025  // open file
2026  if (!($fp = @fopen($file,"w")))
2027  {
2028  die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2029  " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2030  }
2031 
2032  // set file permissions
2033  chmod($file, 0770);
2034 
2035  // write xml data into the file
2036  fwrite($fp, $this->getXML());
2037 
2038  // close file
2039  fclose($fp);
2040 
2041  }
getXML()
get xml representation of style object
print $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableParameters()

static ilObjStyleSheet::getAvailableParameters ( )
static

Get available parameters.

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

Referenced by addParameter().

2367  {
2368  $pars = array();
2369  foreach(self::$parameter as $p => $v)
2370  {
2371  $pars[$p] = $v["values"];
2372  }
2373 
2374  return $pars;
2375  }
+ Here is the caller graph for this function:

◆ getCharacteristics()

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

Get characteristics.

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

1038  {
1039  $chars = array();
1040 
1041  if ($a_type == "")
1042  {
1043  $chars = $this->chars;
1044  }
1045  if (is_array($this->chars_by_type[$a_type]))
1046  {
1047  $chars = $this->chars_by_type[$a_type];
1048  }
1049 
1050  if ($a_no_hidden)
1051  {
1052  foreach ($chars as $k => $char)
1053  {
1054  if ($a_type == "" && $this->hidden_chars[$char["type"].":".$char["class"]])
1055  {
1056  unset($chars[$k]);
1057  }
1058  else if ($this->hidden_chars[$a_type.":".$char])
1059  {
1060  unset($chars[$k]);
1061  }
1062  }
1063  }
1064 
1065  return $chars;
1066  }

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName (   $a_name)

Remove a color.

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

Referenced by writeCSSFile().

2845  {
2846  global $ilDB;
2847 
2848  $pos = strpos($a_name, "(");
2849  if ($pos > 0)
2850  {
2851  $a_i = substr($a_name, $pos + 1);
2852  $a_i = str_replace(")", "", $a_i);
2853  $a_name = substr($a_name, 0, $pos);
2854  }
2855 
2856  $set = $ilDB->query("SELECT color_code FROM style_color WHERE ".
2857  " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
2858  " color_name = ".$ilDB->quote($a_name, "text"));
2859  if ($rec = $ilDB->fetchAssoc($set))
2860  {
2861  if ($a_i == "")
2862  {
2863  return "#".$rec["color_code"];
2864  }
2865  else
2866  {
2867  return "#".ilObjStyleSheet::_getColorFlavor($rec["color_code"],
2868  (int) $a_i);
2869  }
2870  }
2871  }
+ Here is the caller graph for this function:

◆ getColors()

ilObjStyleSheet::getColors ( )

Get colors of style.

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

Referenced by getXML().

2735  {
2736  global $ilDB;
2737 
2738  $set = $ilDB->query("SELECT * FROM style_color WHERE ".
2739  "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
2740  "ORDER BY color_name");
2741 
2742  $colors = array();
2743  while ($rec = $ilDB->fetchAssoc($set))
2744  {
2745  $colors[] = array(
2746  "name" => $rec["color_name"],
2747  "code" => $rec["color_code"]
2748  );
2749  }
2750 
2751  return $colors;
2752  }
+ Here is the caller graph for this function:

◆ getContentPrintStyle()

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().

1703  {
1704  return "./Services/COPage/css/print_content.css";
1705  }
+ Here is the caller graph for this function:

◆ getContentStylePath()

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, ilObject\_exists(), _lookupUpToDate(), ilUtil\getWebspaceDir(), and ilObjStyleSheet().

Referenced by ilImprintGUI\__construct(), ilMediaPoolPageGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilDataCollectionRecordViewViewdefinitionGUI\__construct(), ilDataCollectionRecordViewGUI\__construct(), ilBlogPostingGUI\__construct(), ilObjPaymentSettingsGUI\checkShopActivationObject(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilPageObjectGUI\displayMedia(), ilPCDataTableGUI\editData(), ilObjGroupGUI\executeCommand(), ilTermDefinitionEditorGUI\executeCommand(), ilObjCategoryGUI\executeCommand(), ilPaymentObjectGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjRootFolderGUI\executeCommand(), ilLMPresentationGUI\exportbibinfo(), ilScormExportUtil\exportContentCSS(), ilObjPaymentSettingsGUI\forwardToDocumentsPageObject(), ilShopInfoGUI\forwardToPageObject(), ilTermsConditionsGUI\forwardToPageObject(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilShopGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilObjPaymentSettingsGUI\getDocumentsPageHTML(), ilStartUpGUI\getLoginPageEditorHTML(), ilShopInfoGUI\getPageHTML(), ilTermsConditionsGUI\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().

1660  {
1661  global $ilias;
1662 
1663  $rand = rand(1,999999);
1664 
1665 
1666  // check global fixed content style
1667  $fixed_style = $ilias->getSetting("fixed_content_style_id");
1668  if ($fixed_style > 0)
1669  {
1670  $a_style_id = $fixed_style;
1671  }
1672 
1673  // check global default style
1674  if ($a_style_id <= 0)
1675  {
1676  $a_style_id = $ilias->getSetting("default_content_style_id");
1677  }
1678 
1679  if ($a_style_id > 0 && ilObject::_exists($a_style_id))
1680  {
1681  // check whether file is up to date
1682  if (!ilObjStyleSheet::_lookupUpToDate($a_style_id))
1683  {
1684  $style = new ilObjStyleSheet($a_style_id);
1685  $style->writeCSSFile();
1686  }
1687 
1688  return ilUtil::getWebspaceDir("output").
1689  "/css/style_".$a_style_id.".css?dummy=$rand";
1690  }
1691  else // todo: work this out
1692  {
1693  return "./Services/COPage/css/content.css";
1694  }
1695  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
_lookupUpToDate($a_id)
Looup up to date.
ilObjStyleSheet($a_id=0, $a_call_by_reference=false)
Constructor public.
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEffectiveContentStyleId()

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().

1615  {
1616  global $ilSetting;
1617 
1618  // check global fixed content style
1619  $fixed_style = $ilSetting->get("fixed_content_style_id");
1620  if ($fixed_style > 0)
1621  {
1622  $a_style_id = $fixed_style;
1623  }
1624 
1625  // check global default style
1626  if ($a_style_id <= 0)
1627  {
1628  $a_style_id = $ilSetting->get("default_content_style_id");
1629  }
1630 
1631  if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty")
1632  {
1633  return $a_style_id;
1634  }
1635 
1636  return 0;
1637  }
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilSetting
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExportSubDir()

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().

1983  {
1984  if ($this->export_sub_dir == "")
1985  {
1986  return "sty_".$this->getId();
1987  }
1988  else
1989  {
1990  return $this->export_sub_dir;
1991  }
1992  }
+ Here is the caller graph for this function:

◆ getHideStatus()

ilObjStyleSheet::getHideStatus (   $a_type,
  $a_char 
)

Get characteristic hide status.

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

1096  {
1097  global $ilDB;
1098 
1099  $set = $ilDB->query("SELECT hide FROM style_char ".
1100  " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1101  " type = ".$ilDB->quote($a_type, "text")." AND ".
1102  " characteristic = ".$ilDB->quote($a_char, "text")
1103  );
1104  $rec = $ilDB->fetchAssoc($set);
1105 
1106  return $rec["hide"];
1107  }

◆ getImages()

ilObjStyleSheet::getImages ( )

Get images of style.

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

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

1252  {
1253  $dir = $this->getImagesDirectory();
1254  $images = array();
1255  if (is_dir($dir))
1256  {
1257  $entries = ilUtil::getDir($dir);
1258  foreach($entries as $entry)
1259  {
1260  if (substr($entry["entry"],0,1) == ".")
1261  {
1262  continue;
1263  }
1264  if ($entry["type"] != "dir")
1265  {
1266  $images[] = $entry;
1267  }
1268  }
1269  }
1270 
1271  return $images;
1272  }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
getImagesDirectory()
Get images directory.
+ Here is the call graph for this function:

◆ getImagesDirectory()

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().

1226  {
1228  }
getId()
get object id public
static _getImagesDirectory($a_style_id)
Get images directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMetaData()

& ilObjStyleSheet::getMetaData ( )

get meta data object

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

815  {
816  return $this->meta_data;
817  }

◆ getParametersOfClass()

ilObjStyleSheet::getParametersOfClass (   $a_type,
  $a_class 
)

Get parameters of class.

Parameters

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

1646  {
1647  if (is_array($this->style_class[$a_type][$a_class]))
1648  {
1649  return $this->style_class[$a_type][$a_class];
1650  }
1651  return array();
1652  }

◆ getPlaceHolderStylePath()

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().

1723  {
1724  return "./Services/COPage/css/placeholder.css";
1725  }
+ Here is the caller graph for this function:

◆ getRefId()

ilObjStyleSheet::getRefId ( )

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

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

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

◆ getScope()

ilObjStyleSheet::getScope ( )

Get scope.

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

Referenced by create(), and update().

594  {
595  return $this->scope;
596  }
+ Here is the caller graph for this function:

◆ getStyle()

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().

1813  {
1814  return $this->style;
1815  }
+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

References $parameter.

2223  {
2224  $groups = array();
2225 
2226  foreach (self::$parameter as $parameter => $props)
2227  {
2228  $groups[$props["group"]][] = $parameter;
2229  }
2230  return $groups;
2231  }

◆ getSyntaxStylePath()

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().

1713  {
1714  return "./Services/COPage/css/syntaxhighlight.css";
1715  }
+ Here is the caller graph for this function:

◆ getTemplate()

ilObjStyleSheet::getTemplate (   $a_t_id)

Get template.

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

References getTemplateClasses().

3184  {
3185  global $ilDB;
3186 
3187  $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3188  "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
3189  " AND id = ".$ilDB->quote($a_t_id, "integer"));
3190 
3191  if ($rec = $ilDB->fetchAssoc($set))
3192  {
3193  $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3194 
3195  $template = $rec;
3196  return $template;
3197  }
3198  return array();
3199  }
getTemplateClasses($a_tid)
Get template classes.
+ Here is the call graph for this function:

◆ getTemplateClasses()

ilObjStyleSheet::getTemplateClasses (   $a_tid)

Get template classes.

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

Referenced by getTemplate(), and getTemplates().

3085  {
3086  global $ilDB;
3087  $set = $ilDB->query("SELECT * FROM style_template_class WHERE ".
3088  "template_id = ".$ilDB->quote($a_tid, "integer"));
3089 
3090  $class = array();
3091  while ($rec = $ilDB->fetchAssoc($set))
3092  {
3093  $key = $rec["class_type"];
3094  $class[$key] = $rec["class"];
3095  }
3096 
3097  return $class;
3098  }
+ Here is the caller graph for this function:

◆ getTemplates()

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().

3063  {
3064  global $ilDB;
3065 
3066  $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3067  "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3068  "temp_type = ".$ilDB->quote($a_type, "text")." ".
3069  "ORDER BY name");
3070 
3071  $templates = array();
3072  while ($rec = $ilDB->fetchAssoc($set))
3073  {
3074  $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3075  $templates[] = $rec;
3076  }
3077 
3078  return $templates;
3079  }
getTemplateClasses($a_tid)
Get template classes.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplateXML()

ilObjStyleSheet::getTemplateXML ( )

Get table template xml.

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

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

3223  {
3224  global $ilDB;
3225 
3226  $tag = "<StyleTemplates>";
3227 
3228  $ttypes = array("table", "vaccordion", "haccordion");
3229 
3230  foreach ($ttypes as $ttype)
3231  {
3232  $ts = $this->getTemplates($ttype);
3233 
3234  foreach($ts as $t)
3235  {
3237  /*$atts = array("table" => "TableClass",
3238  "caption" => "CaptionClass",
3239  "row_head" => "RowHeadClass",
3240  "row_foot" => "RowFootClass",
3241  "col_head" => "ColHeadClass",
3242  "col_foot" => "ColFootClass",
3243  "odd_row" => "OddRowClass",
3244  "even_row" => "EvenRowClass",
3245  "odd_col" => "OddColClass",
3246  "even_col" => "EvenColClass");*/
3247  $c = $t["classes"];
3248 
3249  $tag.= '<StyleTemplate Name="'.$t["name"].'">';
3250 
3251  foreach ($atts as $type => $t)
3252  {
3253  if ($c[$type] != "")
3254  {
3255  $tag.= '<StyleClass Type="'.$type.'" Value="'.$c[$type].'" />';
3256  }
3257  }
3258 
3259  $tag.= "</StyleTemplate>";
3260  }
3261  }
3262 
3263  $tag.= "</StyleTemplates>";
3264 
3265 //echo htmlentities($tag);
3266  return $tag;
3267  }
static _getTemplateClassTypes($a_template_type="")
Get template class types.
getTemplates($a_type)
Get table templates of style.
+ Here is the call graph for this function:

◆ getThumbnailsDirectory()

ilObjStyleSheet::getThumbnailsDirectory ( )

Get thumbnails directory.

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

References getImagesDirectory().

Referenced by deleteImage(), and uploadImage().

1243  {
1244  return $this->getImagesDirectory().
1245  "/thumbnails";
1246  }
getImagesDirectory()
Get images directory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUpToDate()

ilObjStyleSheet::getUpToDate ( )

Get up to date.

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

578  {
579  return $this->up_to_date;
580  }

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object

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

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

Referenced by exportXML().

1841  {
1842  $xml.= "<StyleSheet>\n";
1843 
1844  // title and description
1845  $xml.= "<Title>".$this->handleXmlString($this->getTitle())."</Title>";
1846  $xml.= "<Description>".$this->handleXmlString($this->getDescription())."</Description>\n";
1847 
1848  // style classes
1849  foreach($this->chars as $char)
1850  {
1851  $xml.= "<Style Tag=\"".ilObjStyleSheet::_determineTag($char["type"]).
1852  "\" Type=\"".$char["type"]."\" Class=\"".$char["class"]."\">\n";
1853  foreach($this->style as $style)
1854  {
1855  if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"])
1856  {
1857  foreach($style as $tag)
1858  {
1859  $xml.="<StyleParameter Name=\"".$tag["parameter"]."\" Value=\"".$tag["value"]."\"/>\n";
1860  }
1861  }
1862  }
1863  $xml.= "</Style>\n";
1864  }
1865 
1866  // colors
1867  foreach($this->getColors() as $color)
1868  {
1869  $xml.="<StyleColor Name=\"".$color["name"]."\" Code=\"".$color["code"]."\"/>\n";
1870  }
1871 
1872  // templates
1874  foreach ($tcts as $tct => $v)
1875  {
1876  $ts = $this->getTemplates($tct);
1877 
1878  foreach ($ts as $t)
1879  {
1880  $xml.="<StyleTemplate Type=\"".$tct."\" Name=\"".$t["name"]."\">\n";
1881  foreach ($t["classes"] as $ct => $c)
1882  {
1883  if ($c != "")
1884  {
1885  $xml.="<StyleTemplateClass ClassType=\"".$ct."\" Class=\"".$c."\"/>\n";
1886  }
1887  }
1888  $xml.="</StyleTemplate>\n";
1889  }
1890  }
1891 
1892 
1893  $xml.= "</StyleSheet>";
1894 //echo "<pre>".htmlentities($xml)."</pre>"; exit;
1895  return $xml;
1896  }
static _getTemplateClassTypes($a_template_type="")
Get template class types.
getColors()
Get colors of style.
getTitle()
get object title public
getDescription()
get object description
getTemplates($a_type)
Get table templates of style.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleXmlString()

ilObjStyleSheet::handleXmlString (   $a_str)

Handle xml strin.

Parameters

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

1833  {
1834  return str_replace("&", "&amp;", $a_str);
1835  }

◆ ilClone()

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().

1116  {
1117  global $log, $lng;
1118 
1119  $lng->loadLanguageModule("style");
1120 
1121  $new_obj = new ilObjStyleSheet();
1122  $new_obj->setTitle($this->getTitle()." (".$lng->txt("sty_acopy").")");
1123  $new_obj->setType($this->getType());
1124  $new_obj->setDescription($this->getDescription());
1125  $new_obj->create($this->getId());
1126 
1127  $new_obj->writeStyleSetting("disable_auto_margins",
1128  $this->lookupStyleSetting("disable_auto_margins"));
1129 
1130  return $new_obj->getId();
1131  }
lookupStyleSetting($a_name)
Lookup style setting.
getId()
get object id public
ilObjStyleSheet($a_id=0, $a_call_by_reference=false)
Constructor public.
getTitle()
get object title public
getDescription()
get object description
getType()
get object type public
+ Here is the call graph for this function:

◆ ilObjStyleSheet()

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.

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

522  {
523  $this->type = "sty";
524  $this->style = array();
525  if($a_call_by_reference)
526  {
527  $this->ilias->raiseError("Can't instantiate style object via reference id.",$this->ilias->error_obj->FATAL);
528  }
529 
530  parent::ilObject($a_id, false);
531  }
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the caller graph for this function:

◆ import()

ilObjStyleSheet::import (   $a_file)

Import.

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

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

2080  {
2081  parent::create();
2082 
2083  $im_dir = $this->createImportDirectory();
2084 
2085  // handle uploaded files
2086  if (is_array($a_file))
2087  {
2088  ilUtil::moveUploadedFile($a_file["tmp_name"],
2089  $a_file["name"], $im_dir."/".$a_file["name"]);
2090  $file_name = $a_file["name"];
2091  }
2092  else // handle not directly uploaded files
2093  {
2094  $pi = pathinfo($a_file);
2095  $file_name = $pi["basename"];
2096  copy($a_file, $im_dir."/".$file_name);
2097  }
2098  $file = pathinfo($file_name);
2099 
2100  // unzip file
2101  if (strtolower($file["extension"] == "zip"))
2102  {
2103  ilUtil::unzip($im_dir."/".$file_name);
2104  $subdir = basename($file["basename"],".".$file["extension"]);
2105  if (!is_dir($im_dir."/".$subdir))
2106  {
2107  $subdir = "style"; // check style subdir
2108  }
2109  $xml_file = $im_dir."/".$subdir."/style.xml";
2110  }
2111  else // handle xml file directly (old style)
2112  {
2113  $xml_file = $im_dir."/".$file_name;
2114  }
2115 
2116  // load information from xml file
2117 //echo "-$xml_file-";
2118  $this->createFromXMLFile($xml_file, true);
2119 
2120  // copy images
2121  $this->createImagesDirectory();
2122  if (is_dir($im_dir."/".$subdir."/images"))
2123  {
2124  ilUtil::rCopy($im_dir."/".$subdir."/images",
2125  $this->getImagesDirectory());
2126  }
2127 
2129  $this->read();
2130  $this->writeCSSFile();
2131  }
print $file
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
read()
read style properties
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
getId()
get object id public
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
createImportDirectory()
Create import directory.
createFromXMLFile($a_file, $a_skip_parent_create=false)
create style from xml file
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:

◆ lookupObjectStyle()

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().

3396  {
3397  global $ilDB;
3398 
3399  $set = $ilDB->query("SELECT style_id FROM style_usage ".
3400  " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
3401  );
3402  $rec = $ilDB->fetchAssoc($set);
3403 
3404  if (ilObject::_lookupType($rec["style_id"]) == "sty")
3405  {
3406  return (int) $rec["style_id"];
3407  }
3408 
3409  return 0;
3410  }
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupStyleSetting()

ilObjStyleSheet::lookupStyleSetting (   $a_name)

Lookup style setting.

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

Referenced by ilClone().

3366  {
3367  global $ilDB;
3368 
3369  $set = $ilDB->query("SELECT value FROM style_setting ".
3370  " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
3371  " AND name = ".$ilDB->quote($a_name, "text")
3372  );
3373  $rec = $ilDB->fetchAssoc($set);
3374 
3375  return $rec["value"];
3376  }
+ Here is the caller graph for this function:

◆ lookupTemplateName()

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().

3205  {
3206  global $ilDB;
3207 
3208  $set = $ilDB->query("SELECT name FROM style_template WHERE ".
3209  " id = ".$ilDB->quote($a_t_id, "integer"));
3210 
3211  if ($rec = $ilDB->fetchAssoc($set))
3212  {
3213  return $rec["name"];
3214  }
3215 
3216  return false;
3217  }
+ Here is the caller graph for this function:

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview (   $a_t_id)

Lookup table template preview.

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

3294  {
3295  global $ilDB;
3296 
3297  $set = $ilDB->query("SELECT preview FROM style_template ".
3298  " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3299  if ($rec = $ilDB->fetchAssoc($set))
3300  {
3301  return $rec["preview"];
3302  }
3303 
3304  return "";
3305  }

◆ putInTree()

ilObjStyleSheet::putInTree ( )

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

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

554  {
555  $this->ilias->raiseError("Operation ilObjStyleSheet::putInTree() not allowed.",$this->ilias->error_obj->FATAL);
556  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ read()

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().

1410  {
1411  global $ilDB;
1412 
1413  parent::read();
1414 
1415  $q = "SELECT * FROM style_parameter WHERE style_id = ".
1416  $ilDB->quote($this->getId(), "integer")." ORDER BY tag, class, type ";
1417  $style_set = $ilDB->query($q);
1418  $ctag = "";
1419  $cclass = "";
1420  $ctype = "";
1421  $this->style = array();
1422  while($style_rec = $ilDB->fetchAssoc($style_set))
1423  {
1424  if ($style_rec["tag"] != $ctag || $style_rec["class"] != $cclass
1425  || $style_rec["type"] != $ctype)
1426  {
1427  // add current tag array to style array
1428  if(is_array($tag))
1429  {
1430  $this->style[] = $tag;
1431  }
1432  $tag = array();
1433  }
1434  $ctag = $style_rec["tag"];
1435  $cclass = $style_rec["class"];
1436  $ctype = $style_rec["type"];
1437  $tag[] = $style_rec;
1438  $this->style_class[$ctype][$cclass][$style_rec["parameter"]] = $style_rec["value"];
1439  }
1440  if(is_array($tag))
1441  {
1442  $this->style[] = $tag;
1443  }
1444 //var_dump($this->style_class);
1445  $q = "SELECT * FROM style_data WHERE id = ".
1446  $ilDB->quote($this->getId(), "integer");
1447  $res = $ilDB->query($q);
1448  $sty = $ilDB->fetchAssoc($res);
1449  $this->setUpToDate((boolean) $sty["uptodate"]);
1450  $this->setScope($sty["category"]);
1451 
1452  // get style characteristics records
1453  $this->chars = array();
1454  $this->chars_by_type = array();
1455  $q = "SELECT * FROM style_char WHERE style_id = ".
1456  $ilDB->quote($this->getId(), "integer").
1457  " ORDER BY type ASC, characteristic ASC";
1458  $par_set = $ilDB->query($q);
1459  while($par_rec = $ilDB->fetchAssoc($par_set))
1460  {
1461  $this->chars[] = array("type" => $par_rec["type"], "class" => $par_rec["characteristic"], "hide" => $par_rec["hide"]);
1462  $this->chars_by_type[$par_rec["type"]][] = $par_rec["characteristic"];
1463  if ($par_rec["hide"])
1464  {
1465  $this->hidden_chars[$par_rec["type"].":".$par_rec["characteristic"]] = true;
1466  }
1467  }
1468  }
setScope($a_scope)
Set scope.
getId()
get object id public
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeColor()

ilObjStyleSheet::removeColor (   $a_name)

Remove a color.

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

2816  {
2817  global $ilDB;
2818 
2819  $ilDB->manipulate("DELETE FROM style_color WHERE ".
2820  " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
2821  " color_name = ".$ilDB->quote($a_name, "text"));
2822  }

◆ removeTemplate()

ilObjStyleSheet::removeTemplate (   $a_t_id)

Remove table template.

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

3329  {
3330  global $ilDB;
3331 
3332  $ilDB->manipulate("DELETE FROM style_template WHERE ".
3333  " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3334  " id = ".$ilDB->quote($a_t_id, "integer"));
3335 
3336  $ilDB->manipulate("DELETE FROM style_template_class WHERE ".
3337  "template_id = ".$ilDB->quote($a_t_id, "integer")
3338  );
3339 
3340  }

◆ replaceStylePar()

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().

1762  {
1763  ilObjStyleSheet::_replaceStylePar($this->getId(), $a_tag, $a_class, $a_par, $a_val, $a_type);
1764  }
_replaceStylePar($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type)
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveHideStatus()

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

Save characteristic hide status.

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

References ilObject\getId().

1081  {
1082  global $ilDB;
1083 
1084  $ilDB->manipulate("UPDATE style_char SET ".
1085  " hide = ".$ilDB->quote((int) $a_hide, "integer").
1086  " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1087  " type = ".$ilDB->quote($a_type, "text")." AND ".
1088  " characteristic = ".$ilDB->quote($a_char, "text")
1089  );
1090  }
getId()
get object id public
+ Here is the call graph for this function:

◆ setCharacteristics()

ilObjStyleSheet::setCharacteristics (   $a_chars)

Set characteristics.

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

1072  {
1073  $this->chars = $a_chars;
1074  // $this->chars_by_type[$a_type];
1075  }

◆ setExportSubDir()

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().

1975  {
1976  $this->export_sub_dir = $a_dir;
1977  }
+ Here is the caller graph for this function:

◆ setRefId()

ilObjStyleSheet::setRefId ( )

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

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

537  {
538  $this->ilias->raiseError("Operation ilObjStyleSheet::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
539  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ setScope()

ilObjStyleSheet::setScope (   $a_scope)

Set scope.

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

Referenced by read().

586  {
587  $this->scope = $a_scope;
588  }
+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle (   $a_style)

set styles

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

1821  {
1822  $this->style = $a_style;
1823  }

◆ setUpToDate()

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().

570  {
571  $this->up_to_date = $a_up_to_date;
572  }
+ Here is the caller graph for this function:

◆ templateExists()

ilObjStyleSheet::templateExists (   $a_template_name)

Check whether template exists.

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

3167  {
3168  global $ilDB;
3169 
3170  $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3171  "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3172  "name = ".$ilDB->quote($a_template_name, "text"));
3173  if ($rec = $ilDB->fetchAssoc($set))
3174  {
3175  return true;
3176  }
3177  return false;
3178  }

◆ update()

ilObjStyleSheet::update ( )

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

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

Referenced by createFromXMLFile().

1728  {
1729  global $ilDB;
1730 
1731  parent::update();
1732  $this->read(); // this could be done better
1733  $this->writeCSSFile();
1734 
1735  $q = "UPDATE style_data ".
1736  "SET category = ".$ilDB->quote((int) $this->getScope(), "integer").
1737  " WHERE id = ".$ilDB->quote($this->getId(), "integer");
1738  $ilDB->manipulate($q);
1739  }
read()
read style properties
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateColor()

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().

2773  {
2774  global $ilDB;
2775 
2776  // todo: update names in parameters as well
2777 
2778  $ilDB->manipulate("UPDATE style_color SET ".
2779  "color_name = ".$ilDB->quote($a_new_name, "text").", ".
2780  "color_code = ".$ilDB->quote($a_code, "text").
2781  " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
2782  " AND color_name = ".$ilDB->quote($a_name, "text"));
2783  ilObjStyleSheet::_writeUpToDate($this->getId(), false);
2784 
2785  // rename also the name in the style parameter values
2786  if ($a_name != $a_new_name)
2787  {
2788  $set = $ilDB->query("SELECT * FROM style_parameter ".
2789  " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
2790  " AND (".
2791  " parameter = ".$ilDB->quote("background-color", "text"). " OR ".
2792  " parameter = ".$ilDB->quote("color", "text"). " OR ".
2793  " parameter = ".$ilDB->quote("border-color", "text"). " OR ".
2794  " parameter = ".$ilDB->quote("border-top-color", "text"). " OR ".
2795  " parameter = ".$ilDB->quote("border-bottom-color", "text"). " OR ".
2796  " parameter = ".$ilDB->quote("border-left-color", "text"). " OR ".
2797  " parameter = ".$ilDB->quote("border-right-color", "text").
2798  ")");
2799  while ($rec = $ilDB->fetchAssoc($set))
2800  {
2801  if ($rec["value"] == "!".$a_name ||
2802  is_int(strpos($rec["value"], "!".$a_name."(")))
2803  {
2804  // parameter is based on color -> rename it
2805  $this->replaceStylePar($rec["tag"], $rec["class"],
2806  $rec["parameter"], str_replace($a_name, $a_new_name, $rec["value"]), $rec["type"]);
2807  }
2808  }
2809  }
2810  }
replaceStylePar($a_tag, $a_class, $a_par, $a_val, $a_type)
Set style parameter per tag/class/parameter.
getId()
get object id public
_writeUpToDate($a_id, $a_up_to_date)
Write up to date.
+ Here is the call graph for this function:

◆ updateStyleParameter()

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.

1748  {
1749  global $ilDB;
1750 
1751  $q = "UPDATE style_parameter SET VALUE = ".
1752  $ilDB->quote($a_value, "text")." WHERE id = ".
1753  $ilDB->quote($a_id, "integer");
1754  $style_set = $ilDB->manipulate($q);
1755  }

◆ updateTemplate()

ilObjStyleSheet::updateTemplate (   $a_t_id,
  $a_name,
  $a_classes 
)

Update table template.

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

References $t.

3140  {
3141  global $ilDB;
3142 
3143  $ilDB->manipulate("UPDATE style_template SET ".
3144  "name = ".$ilDB->quote($a_name, "text").
3145  " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3146 
3147  $ilDB->manipulate("DELETE FROM style_template_class WHERE ".
3148  "template_id = ".$ilDB->quote($a_t_id, "integer")
3149  );
3150  foreach ($a_classes as $t => $c)
3151  {
3152  $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3153  "(template_id, class_type, class)".
3154  " VALUES (".
3155  $ilDB->quote($a_t_id, "integer").",".
3156  $ilDB->quote($t, "text").",".
3157  $ilDB->quote($c, "text").
3158  ")");
3159  }
3160 
3161  }

◆ uploadImage()

ilObjStyleSheet::uploadImage (   $a_file)

Upload image.

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

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

1278  {
1279  $this->createImagesDirectory();
1280  @ilUtil::moveUploadedFile($a_file["tmp_name"], $a_file["name"],
1281  $this->getImagesDirectory()."/".$a_file["name"]);
1282  @ilUtil::resizeImage($this->getImagesDirectory()."/".$a_file["name"],
1283  $this->getThumbnailsDirectory()."/".$a_file["name"], 75, 75);
1284  }
getThumbnailsDirectory()
Get thumbnails directory.
getImagesDirectory()
Get images directory.
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:

◆ writeCSSFile()

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

write css file to webspace directory

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

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

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

1474  {
1475  $style = $this->getStyle();
1476 
1477  if ($a_target_file == "")
1478  {
1479  $css_file_name = ilUtil::getWebspaceDir()."/css/style_".$this->getId().".css";
1480  }
1481  else
1482  {
1483  $css_file_name = $a_target_file;
1484  }
1485  $css_file = fopen($css_file_name, "w");
1486 
1487  $page_background = "";
1488 
1489  foreach ($style as $tag)
1490  {
1491  fwrite ($css_file, $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]."\n");
1492  if ($tag[0]["tag"] == "td")
1493  {
1494  fwrite ($css_file, ",th".".ilc_".$tag[0]["type"]."_".$tag[0]["class"]."\n");
1495  }
1496  if (in_array($tag[0]["tag"], array("h1", "h2", "h3")))
1497  {
1498  fwrite ($css_file, ",div.ilc_text_block_".$tag[0]["class"]."\n");
1499  fwrite ($css_file, ",body.ilc_text_block_".$tag[0]["class"]."\n");
1500  }
1501  if ($tag[0]["type"] == "text_block")
1502  {
1503  fwrite ($css_file, ",body.ilc_text_block_".$tag[0]["class"]."\n");
1504  }
1505  fwrite ($css_file, "{\n");
1506 
1507  // collect table border attributes
1508  $t_border = array();
1509 
1510  foreach($tag as $par)
1511  {
1512  $cur_par = $par["parameter"];
1513  $cur_val = $par["value"];
1514 
1515  // replace named colors
1516  if (is_int(strpos($cur_par, "color")) && substr(trim($cur_val), 0, 1) == "!")
1517  {
1518  $cur_val = $this->getColorCodeForName(substr($cur_val, 1));
1519  }
1520 
1521  if ($tag[0]["type"] == "table" && is_int(strpos($par["parameter"], "border")))
1522  {
1523  $t_border[$cur_par] = $cur_val;
1524  }
1525 
1526  if (in_array($cur_par, array("background-image", "list-style-image")))
1527  {
1528  if (is_int(strpos($cur_val, "/"))) // external
1529  {
1530  $cur_val = "url(".$cur_val.")";
1531  }
1532  else // internal
1533  {
1534  if ($a_image_dir == "")
1535  {
1536  $cur_val = "url(../sty/sty_".$this->getId()."/images/".$cur_val.")";
1537  }
1538  else
1539  {
1540  $cur_val = "url(".$a_image_dir."/".$cur_val.")";
1541  }
1542  }
1543  }
1544 
1545  if ($cur_par == "opacity")
1546  {
1547  $cur_val = ((int) $cur_val) / 100;
1548  }
1549 
1550  fwrite ($css_file, "\t".$cur_par.": ".$cur_val.";\n");
1551 
1552  // IE6 fix for minimum height
1553  if ($cur_par == "min-height")
1554  {
1555  fwrite ($css_file, "\t"."height".": "."auto !important".";\n");
1556  fwrite ($css_file, "\t"."height".": ".$cur_val.";\n");
1557  }
1558 
1559  // opacity fix
1560  if ($cur_par == "opacity")
1561  {
1562  fwrite ($css_file, "\t".'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity='.($cur_val * 100).')"'.";\n");
1563  fwrite ($css_file, "\t".'filter: alpha(opacity='.($cur_val * 100).')'.";\n");
1564  fwrite ($css_file, "\t".'-moz-opacity: '.$cur_val.";\n");
1565  }
1566 
1567  // save page background
1568  if ($tag[0]["tag"] == "div" && $tag[0]["class"] == "Page"
1569  && $cur_par == "background-color")
1570  {
1571  $page_background = $cur_val;
1572  }
1573  }
1574  fwrite ($css_file, "}\n");
1575  fwrite ($css_file, "\n");
1576 
1577  // use table border attributes for th td as well
1578 /* if ($tag[0]["type"] == "table")
1579  {
1580  if (count($t_border) > 0)
1581  {
1582  fwrite ($css_file, $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." th,".
1583  $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." td\n");
1584  fwrite ($css_file, "{\n");
1585  foreach ($t_border as $p => $v)
1586  {
1587 // fwrite ($css_file, "\t".$p.": ".$v.";\n");
1588  }
1589  fwrite ($css_file, "}\n");
1590  fwrite ($css_file, "\n");
1591  }
1592  }*/
1593  }
1594 
1595  if ($page_background != "")
1596  {
1597  fwrite ($css_file, "td.ilc_Page\n");
1598  fwrite ($css_file, "{\n");
1599  fwrite ($css_file, "\t"."background-color: ".$page_background.";\n");
1600  fwrite ($css_file, "}\n");
1601  }
1602  fclose($css_file);
1603 
1604  $this->setUpToDate(true);
1605  $this->_writeUpToDate($this->getId(), true);
1606  }
getId()
get object id public
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
getStyle()
todo: bad style! should return array of objects, not multi-dim-arrays
_writeUpToDate($a_id, $a_up_to_date)
Write up to date.
getColorCodeForName($a_name)
Remove a color.
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeStyleSetting()

ilObjStyleSheet::writeStyleSetting (   $a_name,
  $a_value 
)

Write Style Setting.

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

3346  {
3347  global $ilDB;
3348 
3349  $ilDB->manipulate("DELETE FROM style_setting WHERE ".
3350  " style_id = ".$ilDB->quote($this->getId(), "integer").
3351  " AND name = ".$ilDB->quote($a_name, "text")
3352  );
3353 
3354  $ilDB->manipulate("INSERT INTO style_setting ".
3355  "(style_id, name, value) VALUES (".
3356  $ilDB->quote($this->getId(), "integer").",".
3357  $ilDB->quote($a_name, "text").",".
3358  $ilDB->quote($a_value, "text").
3359  ")");
3360  }

◆ writeStyleUsage()

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().

3382  {
3383  global $ilDB;
3384 
3385  $ilDB->replace("style_usage", array(
3386  "obj_id" => array("integer", (int) $a_obj_id)),
3387  array(
3388  "style_id" => array("integer", (int) $a_style_id))
3389  );
3390  }
+ Here is the caller graph for this function:

◆ writeTemplatePreview()

ilObjStyleSheet::writeTemplatePreview (   $a_t_id,
  $a_preview_html 
)

Write table template preview.

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

Referenced by addTemplate().

3273  {
3274  global $ilDB;
3275  $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3276  $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3277  $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3278 //echo "1-".strlen($a_preview_html)."-";
3279 //echo htmlentities($a_preview_html);
3280  if (strlen($a_preview_html) > 4000)
3281  {
3282 //echo "2";
3283  $a_preview_html = "";
3284  }
3285  $ilDB->manipulate("UPDATE style_template SET ".
3286  "preview = ".$ilDB->quote($a_preview_html, "text").
3287  " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3288  }
+ Here is the caller graph for this function:

Field Documentation

◆ $assigned_tags

ilObjStyleSheet::$assigned_tags
static

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

◆ $basic_style_dom

ilObjStyleSheet::$basic_style_dom
staticprotected

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

◆ $basic_style_file

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

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

◆ $basic_style_image_dir

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

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

◆ $core_styles

ilObjStyleSheet::$core_styles
static

◆ $expandable_types

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.

◆ $filtered_groups

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.

◆ $hideable_types

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

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

◆ $num_unit

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

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

◆ $num_unit_no_perc

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

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

◆ $parameter

ilObjStyleSheet::$parameter
static

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

Referenced by getStyleParameterGroups().

◆ $pseudo_classes

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.

◆ $style

ilObjStyleSheet::$style

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

Referenced by getStyle().

◆ $style_super_types

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.

◆ $templates

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 create(), and getTemplates().


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