ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjStyleSheet Class Reference

Class ilObjStyleSheet. More...

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

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=false)
 Constructor public. More...
 
 setRefId ($a_ref_id)
 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 ($a_parent_ref)
 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...
 
 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, $a_include_core=true)
 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, $a_mq_id=0, $a_custom=false)
 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, $a_mq_id=0, $a_custom=false)
 Delete style parameter by tag/class/parameter. More...
 
 deleteCustomStylePars ($a_tag, $a_class, $a_type, $a_mq_id=0)
 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, $a_mq_id=0)
 Get parameters of class. More...
 
 update ()
 
 updateStyleParameter ($a_id, $a_value)
 update style parameter per id More...
 
 replaceStylePar ($a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
 Set style parameter per tag/class/parameter. More...
 
 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 todo: add mq_id 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 todo: add mq_id and custom More...
 
 getStyleParameterGroups ()
 Get grouped parameter. More...
 
 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...
 
 getMediaQueries ()
 Get colors of style. More...
 
 addMediaQuery ($a_mquery, $order_nr=0)
 Add media query. More...
 
 getMaxMQueryOrderNr ()
 Get maximum media query order nr. More...
 
 updateMediaQuery ($a_id, $a_mquery)
 Update media query. More...
 
 getMediaQueryForId ($a_id)
 Get media query for id. More...
 
 deleteMediaQuery ($a_id)
 Delete media query. More...
 
 saveMediaQueryOrder ($a_order_nr=null)
 Save media query order. 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...
 
 addTemplateClass ($a_t_id, $a_type, $a_class)
 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
 __construct ($a_id=0, $a_reference=true)
 Constructor public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 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...
 
 setOfflineStatus ($a_status)
 Set offline status. More...
 
 getOfflineStatus ()
 Get offline status. More...
 
 supportsOfflineHandling ()
 Check whether object supports offline handling. More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 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...
 
 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...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object 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...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 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...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getBasicZipPath ()
 Get basic zip path. More...
 
static _writeUpToDate ($a_id, $a_up_to_date)
 Write up to date. More...
 
static _lookupUpToDate ($a_id)
 Looup up to date. More...
 
static _writeStandard ($a_id, $a_std)
 Write standard flag. More...
 
static _writeScope ($a_id, $a_scope)
 Write scope. More...
 
static _lookupStandard ($a_id)
 Lookup standard flag. More...
 
static _writeActive ($a_id, $a_active)
 Write active flag. More...
 
static _lookupActive ($a_id)
 Lookup active flag. More...
 
static _getStandardStyles ( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
 Get standard styles. More...
 
static _getClonableContentStyles ()
 Get all clonable styles (active standard styles and individual learning module styles with write permission). More...
 
static _getBasicStyleDom ()
 Get basic style dom. More...
 
static getBasicImageDir ()
 Get basic image dir. 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 getContentStylePath ($a_style_id, $add_random=true, $add_token=true)
 get content style path More...
 
static getContentPrintStyle ()
 get content print style More...
 
static getSyntaxStylePath ()
 get syntax style path More...
 
static getPlaceHolderStylePath ()
 get placeholder style path (for Page Layouts) More...
 
static _replaceStylePar ($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
 
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 isCoreStyle ($a_type, $a_class)
 Is core style. More...
 
static _getTemplateClassTypes ($a_template_type="")
 Get template class types. More...
 
static _getPseudoClasses ($tag)
 
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 todo: add mq_id and custom handling. 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 _lookupTemplateName ($a_t_id)
 Lookup table template name for template ID. 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 lookupObjectForStyle ($a_style_id)
 Lookup object style. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static lookupOfflineStatus ($a_obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id, $a_deleted_by)
 
static setDeletedDates ($a_ref_ids, $a_user_id)
 Set deleted date. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type 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 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 fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. 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
 
 $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
 

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 = "./libs/ilias/Style/basic_style/style.xml"
 
static $basic_style_zip = "./libs/ilias/Style/basic_style/style.zip"
 
static $basic_style_image_dir = "./libs/ilias/Style/basic_style/images"
 
static $basic_style_dom
 

Additional Inherited Members

- Protected Attributes inherited from ilObject
 $objDefinition
 
 $db
 
 $log
 
 $error
 
 $tree
 
 $app_event_handler
 
 $rbacadmin
 
 $rbacreview
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilObjStyleSheet::__construct (   $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 559 of file class.ilObjStyleSheet.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

560  {
561  global $DIC;
562 
563  $this->db = $DIC->database();
564  $this->lng = $DIC->language();
565  $this->type = "sty";
566  $this->style = array();
567  if ($a_call_by_reference) {
568  $this->ilias->raiseError("Can't instantiate style object via reference id.", $this->ilias->error_obj->FATAL);
569  }
570 
571  parent::__construct($a_id, false);
572  }
redirection script todo: (a better solution should control the processing via a xml file) ...
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ _addMissingStyleClassesToAllStyles()

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

Add missing style classes to all styles todo: add mq_id and custom handling.

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

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

Referenced by _addMissingStyleClassesToStyle().

2539  {
2540  global $DIC;
2541 
2542  $ilDB = $DIC->database();
2543 
2544  if ($a_styles == "") {
2545  $styles = ilObject::_getObjectsDataForType("sty");
2546  } else {
2547  $styles = $a_styles;
2548  }
2551 
2552  // get all core image files
2553  $core_images = array();
2554  $core_dir = self::$basic_style_image_dir;
2555  if (is_dir($core_dir)) {
2556  $dir = opendir($core_dir);
2557  while ($file = readdir($dir)) {
2558  if (substr($file, 0, 1) != "." && is_file($core_dir . "/" . $file)) {
2559  $core_images[] = $file;
2560  }
2561  }
2562  }
2563 
2564  foreach ($styles as $style) {
2565  $id = $style["id"];
2566 
2567  foreach ($core_styles as $cs) {
2568  // check, whether core style class exists
2569  $set = $ilDB->queryF(
2570  "SELECT * FROM style_char WHERE style_id = %s " .
2571  "AND type = %s AND characteristic = %s",
2572  array("integer", "text", "text"),
2573  array($id, $cs["type"], $cs["class"])
2574  );
2575 
2576  // if not, add core style class
2577  if (!($rec = $ilDB->fetchAssoc($set))) {
2578  $ilDB->manipulateF(
2579  "INSERT INTO style_char (style_id, type, characteristic) " .
2580  " VALUES (%s,%s,%s) ",
2581  array("integer", "text", "text"),
2582  array($id, $cs["type"], $cs["class"])
2583  );
2584 
2585  $xpath = new DOMXPath($bdom);
2586  $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '" . $cs["tag"] . "' and @Type='" .
2587  $cs["type"] . "' and @Class='" . $cs["class"] . "']/StyleParameter");
2588  foreach ($par_nodes as $par_node) {
2589  // check whether style parameter exists
2590  $set = $ilDB->queryF(
2591  "SELECT * FROM style_parameter WHERE style_id = %s " .
2592  "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2593  array("integer", "text", "text", "text", "text"),
2594  array($id, $cs["type"], $cs["class"],
2595  $cs["tag"], $par_node->getAttribute("Name"))
2596  );
2597 
2598  // if not, create style parameter
2599  if (!($rec = $ilDB->fetchAssoc($set))) {
2600  $spid = $ilDB->nextId("style_parameter");
2601  $st = $ilDB->manipulateF(
2602  "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) " .
2603  " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2604  array("integer", "integer", "text", "text", "text", "text", "text"),
2605  array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2606  $par_node->getAttribute("Name"), $par_node->getAttribute("Value"))
2607  );
2608  }
2609  }
2610  }
2611  }
2612 
2613  // now check, whether some core image files are missing
2616  reset($core_images);
2617  foreach ($core_images as $cim) {
2618  if (!is_file($imdir . "/" . $cim)) {
2619  copy($core_dir . "/" . $cim, $imdir . "/" . $cim);
2620  }
2621  }
2622  }
2623  }
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.
global $ilDB
$DIC
Definition: xapitoken.php:46
static _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 2528 of file class.ilObjStyleSheet.php.

References _addMissingStyleClassesToAllStyles().

Referenced by import(), and ilObjStyleSheetGUI\saveObject().

2529  {
2530  $styles = array(array("id" => $a_id));
2532  }
static _addMissingStyleClassesToAllStyles($a_styles="")
Add missing style classes to all styles todo: add mq_id and custom handling.
+ 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 1279 of file class.ilObjStyleSheet.php.

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

Referenced by _addMissingStyleClassesToAllStyles(), create(), and createImagesDirectory().

1280  {
1281  global $DIC;
1282 
1283  $ilErr = $DIC["ilErr"];
1284 
1285  $sty_data_dir = ilUtil::getWebspaceDir() . "/sty";
1286  ilUtil::makeDir($sty_data_dir);
1287  if (!is_writable($sty_data_dir)) {
1288  $ilErr->raiseError("Style data directory (" . $sty_data_dir
1289  . ") not writeable.", $ilErr->FATAL);
1290  }
1291 
1292  $style_dir = $sty_data_dir . "/sty_" . $a_style_id;
1293  ilUtil::makeDir($style_dir);
1294  if (!@is_dir($style_dir)) {
1295  $ilErr->raiseError("Creation of style directory failed (" .
1296  $style_dir . ").", $ilErr->FATAL);
1297  }
1298 
1299  // create images subdirectory
1300  $im_dir = $style_dir . "/images";
1301  ilUtil::makeDir($im_dir);
1302  if (!@is_dir($im_dir)) {
1303  $ilErr->raiseError("Creation of Import Directory failed (" .
1304  $im_dir . ").", $ilErr->FATAL);
1305  }
1306 
1307  // create thumbnails directory
1308  $thumb_dir = $style_dir . "/images/thumbnails";
1309  ilUtil::makeDir($thumb_dir);
1310  if (!@is_dir($thumb_dir)) {
1311  $ilErr->raiseError("Creation of Import Directory failed (" .
1312  $thumb_dir . ").", $ilErr->FATAL);
1313  }
1314  }
$ilErr
Definition: raiseError.php:18
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
$DIC
Definition: xapitoken.php:46
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 2506 of file class.ilObjStyleSheet.php.

References $a_type.

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

2507  {
2508  return self::$assigned_tags[$a_type];
2509  }
$a_type
Definition: workflow.php:92
+ 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 3042 of file class.ilObjStyleSheet.php.

Referenced by _getColorFlavor().

3043  {
3044  $r["r"] = substr($a_rgb, 0, 2);
3045  $r["g"] = substr($a_rgb, 2, 2);
3046  $r["b"] = substr($a_rgb, 4, 2);
3047 
3048  if ($as_dec) {
3049  $r["r"] = (int) hexdec($r["r"]);
3050  $r["g"] = (int) hexdec($r["g"]);
3051  $r["b"] = (int) hexdec($r["b"]);
3052  }
3053 
3054  return $r;
3055  }
+ Here is the caller graph for this function:

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

Get basic style dom.

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

Referenced by _addMissingStyleClassesToAllStyles().

864  {
865  if (!is_object(self::$basic_style_dom)) {
866  self::$basic_style_dom = new DOMDocument();
867  self::$basic_style_dom->load(self::$basic_style_file);
868  }
869 
870  return self::$basic_style_dom;
871  }
+ Here is the caller graph for this function:

◆ _getClonableContentStyles()

static ilObjStyleSheet::_getClonableContentStyles ( )
static

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

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

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

Referenced by ilObjStyleSheetGUI\createObject().

810  {
811  global $DIC;
812 
813  $ilAccess = $DIC->access();
814  $ilDB = $DIC->database();
815 
816  $clonable_styles = array();
817 
818  $q = "SELECT * FROM style_data";
819  $style_set = $ilDB->query($q);
820  while ($style_rec = $ilDB->fetchAssoc($style_set)) {
821  $clonable = false;
822  if ($style_rec["standard"] == 1) {
823  if ($style_rec["active"] == 1) {
824  $clonable = true;
825  }
826  } else {
827  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
828  $obj_ids = ilObjContentObject::_lookupContObjIdByStyleId($style_rec["id"]);
829  if (count($obj_ids) == 0) {
830  $obj_ids = self::lookupObjectForStyle($style_rec["id"]);
831  }
832  foreach ($obj_ids as $id) {
833  $ref = ilObject::_getAllReferences($id);
834  foreach ($ref as $ref_id) {
835  if ($ilAccess->checkAccess("write", "", $ref_id)) {
836  $clonable = true;
837  }
838  }
839  }
840  }
841  if ($clonable) {
842  $clonable_styles[$style_rec["id"]] =
843  ilObject::_lookupTitle($style_rec["id"]);
844  }
845  }
846 
847  asort($clonable_styles);
848 
849  return $clonable_styles;
850  }
static _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
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 3018 of file class.ilObjStyleSheet.php.

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

Referenced by ilStyleColorTableGUI\fillRow(), and getColorCodeForName().

3019  {
3020  $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
3021  $hls = ilObjStyleSheet::_RGBToHLS($rgb);
3022 
3023  if ($a_i > 0) {
3024  $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
3025  }
3026  if ($a_i < 0) {
3027  $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
3028  }
3029 
3030  $rgb = ilObjStyleSheet::_HLSToRGB($hls);
3031 
3032  foreach ($rgb as $k => $v) {
3033  $rgb[$k] = str_pad(dechex($v), 2, "0", STR_PAD_LEFT);
3034  }
3035 
3036  return $rgb["r"] . $rgb["g"] . $rgb["b"];
3037  }
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 2454 of file class.ilObjStyleSheet.php.

References _determineTag().

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

2455  {
2456  $c_styles = array();
2457  foreach (self::$core_styles as $cstyle) {
2458  $c_styles[$cstyle["type"] . "." . ilObjStyleSheet::_determineTag($cstyle["type"]) . "." . $cstyle["class"]]
2459  = array("type" => $cstyle["type"],
2460  "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2461  "class" => $cstyle["class"]);
2462  }
2463  return $c_styles;
2464  }
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 2401 of file class.ilObjStyleSheet.php.

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

2402  {
2403  return self::$filtered_groups;
2404  }
+ Here is the caller graph for this function:

◆ _getImagesDirectory()

static ilObjStyleSheet::_getImagesDirectory (   $a_style_id)
static

Get images directory.

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

References ilUtil\getWebspaceDir().

Referenced by _addMissingStyleClassesToAllStyles(), getImagesDirectory(), ilStyleDataSet\getXmlRecord(), and ilStyleDataSet\importRecord().

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

◆ _getPseudoClasses()

static ilObjStyleSheet::_getPseudoClasses (   $tag)
static

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

2497  {
2498  return self::$pseudo_classes[$tag];
2499  }

◆ _getStandardStyles()

static ilObjStyleSheet::_getStandardStyles (   $a_exclude_default_style = false,
  $a_include_deactivated = false,
  $a_scope = 0 
)
static

Get standard styles.

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

References $DIC, $ilDB, $ilSetting, $res, ilObject\$tree, and ilObject\_lookupTitle().

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

767  {
768  global $DIC;
769 
770  $ilDB = $DIC->database();
771  $ilSetting = $DIC->settings();
772  $tree = $DIC->repositoryTree();
773 
774  $default_style = $ilSetting->get("default_content_style_id");
775 
776  $and_str = "";
777  if (!$a_include_deactivated) {
778  $and_str = " AND active = 1";
779  }
780 
781  $q = "SELECT * FROM style_data " .
782  " WHERE standard = 1" . $and_str;
783  $res = $ilDB->query($q);
784  $styles = array();
785  while ($sty = $ilDB->fetchAssoc($res)) {
786  if (!$a_exclude_default_style || $default_style != $sty["id"]) {
787  // check scope
788  if ($a_scope > 0 && $sty["category"] > 0) {
789  if ($tree->isInTree($sty["category"]) &&
790  $tree->isInTree($a_scope)) {
791  $path = $tree->getPathId($a_scope);
792  if (!in_array($sty["category"], $path)) {
793  continue;
794  }
795  }
796  }
797  $styles[$sty["id"]] = ilObject::_lookupTitle($sty["id"]);
798  }
799  }
800 
801  return $styles;
802  }
static _lookupTitle($a_id)
lookup object title
foreach($_POST as $key=> $value) $res
global $ilSetting
Definition: privfeed.php:17
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 2373 of file class.ilObjStyleSheet.php.

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

2374  {
2375  $input = self::$parameter[$par]["input"];
2376  return $input;
2377  }
+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

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

2407  {
2408  if ($a_no_percentage) {
2409  return self::$num_unit_no_perc;
2410  }
2411  return self::$num_unit;
2412  }
+ Here is the caller graph for this function:

◆ _getStyleParameters()

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

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

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

2386  {
2387  if ($a_tag == "") {
2388  return self::$parameter;
2389  }
2390  $par = array();
2391  foreach (self::$parameter as $k => $v) {
2392  if (is_array(self::$filtered_groups[$v["group"]]) &&
2393  !in_array($a_tag, self::$filtered_groups[$v["group"]])) {
2394  continue;
2395  }
2396  $par[$k] = $v;
2397  }
2398  return $par;
2399  }
+ Here is the caller graph for this function:

◆ _getStyleParameterSubPar()

static ilObjStyleSheet::_getStyleParameterSubPar (   $par)
static

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

2380  {
2381  $subpar = self::$parameter[$par]["subpar"];
2382  return $subpar;
2383  }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues (   $par)
static

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

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

2415  {
2416  return self::$parameter[$par]["values"];
2417  }
+ Here is the caller graph for this function:

◆ _getStyleSuperTypeForType()

static ilObjStyleSheet::_getStyleSuperTypeForType (   $a_type)
static

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

References $a_type.

Referenced by ilObjStyleSheetGUI\__construct().

2440  {
2441  foreach (self::$style_super_types as $s => $t) {
2442  if (in_array($a_type, $t)) {
2443  return $s;
2444  }
2445  if ($a_type == $s) {
2446  return $s;
2447  }
2448  }
2449  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ _getStyleSuperTypes()

static ilObjStyleSheet::_getStyleSuperTypes ( )
static

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

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

2425  {
2426  return self::$style_super_types;
2427  }
+ Here is the caller graph for this function:

◆ _getTemplateClassTypes()

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

Get template class types.

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

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

2487  {
2488  if ($a_template_type == "") {
2489  return self::$templates;
2490  }
2491 
2492  return self::$templates[$a_template_type];
2493  }
+ 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 3102 of file class.ilObjStyleSheet.php.

Referenced by _getColorFlavor().

3103  {
3104  $h = $a_hls["h"] / 255;
3105  $l = $a_hls["l"] / 255;
3106  $s = $a_hls["s"] / 255;
3107 
3108  $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
3109 
3110  // If S=0, define R, G, and B all to L
3111  if ($s == 0) {
3112  $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
3113  } else {
3114  if ($l < 0.5) {
3115  $temp2 = $l * (1.0 + $s);
3116  } else {
3117  $temp2 = $l + $s - $l * $s;
3118  }
3119 
3120  $temp1 = 2.0 * $l - $temp2;
3121 
3122 
3123  # For each of R, G, B, compute another temporary value, temp3, as follows:
3124  foreach ($rgb as $k => $v) {
3125  switch ($k) {
3126  case "r":
3127  $temp3 = $h + 1.0 / 3.0;
3128  break;
3129 
3130  case "g":
3131  $temp3 = $h;
3132  break;
3133 
3134  case "b":
3135  $temp3 = $h - 1.0 / 3.0;
3136  break;
3137  }
3138  if ($temp3 < 0) {
3139  $temp3 = $temp3 + 1.0;
3140  }
3141  if ($temp3 > 1) {
3142  $temp3 = $temp3 - 1.0;
3143  }
3144 
3145  if (6.0 * $temp3 < 1) {
3146  $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3147  } elseif (2.0 * $temp3 < 1) {
3148  $rgb[$k] = $temp2;
3149  } elseif (3.0 * $temp3 < 2) {
3150  $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0 / 3.0) - $temp3) * 6.0;
3151  } else {
3152  $rgb[$k] = $temp1;
3153  }
3154  }
3155  }
3156 
3157  $rgb["r"] = round($rgb["r"] * 255);
3158  $rgb["g"] = round($rgb["g"] * 255);
3159  $rgb["b"] = round($rgb["b"] * 255);
3160 
3161  return $rgb;
3162  }
+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable (   $a_type)
static

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

References $a_type.

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

2430  {
2431  return in_array($a_type, self::$expandable_types);
2432  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ _isHideable()

static ilObjStyleSheet::_isHideable (   $a_type)
static

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

References $a_type.

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

2435  {
2436  return in_array($a_type, self::$hideable_types);
2437  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ _lookupActive()

static ilObjStyleSheet::_lookupActive (   $a_id)
static

Lookup active flag.

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

References $DIC, $ilDB, and $res.

Referenced by ilContentStyleSettingsGUI\edit().

747  {
748  global $DIC;
749 
750  $ilDB = $DIC->database();
751 
752  $q = "SELECT * FROM style_data " .
753  " WHERE id = " . $ilDB->quote($a_id, "integer");
754  $res = $ilDB->query($q);
755  $sty = $ilDB->fetchAssoc($res);
756 
757  return (boolean) $sty["active"];
758  }
foreach($_POST as $key=> $value) $res
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _lookupStandard()

static ilObjStyleSheet::_lookupStandard (   $a_id)
static

Lookup standard flag.

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

References $DIC, $ilDB, and $res.

Referenced by ilContainer\_exportContainerSettings(), ilObjCategoryGUI\afterSave(), ilObjContentPageGUI\buildStylePropertiesForm(), ilObjPortfolioBase\cloneBasics(), ilObjWiki\cloneObject(), ilObjGlossary\cloneObject(), ilObjContentObject\cloneObject(), ilObjSCORM2004LearningModule\copyAuthoredContent(), ilObjBlog\doCloneObject(), ilObjSCORM2004LearningModuleGUI\initPropertiesEditableForm(), ilObjContentObjectGUI\initStylePropertiesForm(), ilObjPortfolioBaseGUI\initStylePropertiesForm(), ilObjSCORM2004LearningModuleGUI\initStylePropertiesForm(), ilObjGlossaryGUI\initStylePropertiesForm(), ilObjWikiGUI\initStylePropertiesForm(), ilContainerGUI\initStylePropertiesForm(), ilObjBlogGUI\initStylePropertiesForm(), ilObjSCORM2004LearningModuleGUI\properties(), ilObjSCORM2004LearningModuleGUI\saveProperties(), ilObjContentPageGUI\saveStyleSettings(), ilObjContentObjectGUI\saveStyleSettings(), ilObjPortfolioBaseGUI\saveStyleSettings(), ilObjSCORM2004LearningModuleGUI\saveStyleSettings(), ilObjGlossaryGUI\saveStyleSettings(), ilObjBlogGUI\saveStyleSettings(), ilObjWikiGUI\saveStyleSettingsObject(), ilContainerGUI\saveStyleSettingsObject(), and ilObjContentPage\writeStyleSheetId().

715  {
716  global $DIC;
717 
718  $ilDB = $DIC->database();
719 
720  $q = "SELECT * FROM style_data " .
721  " WHERE id = " . $ilDB->quote($a_id, "integer");
722  $res = $ilDB->query($q);
723  $sty = $ilDB->fetchAssoc($res);
724 
725  return (boolean) $sty["standard"];
726  }
foreach($_POST as $key=> $value) $res
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _lookupTemplateIdByName()

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

Lookup table template preview.

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

References $DIC, and $ilDB.

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

3583  {
3584  global $DIC;
3585 
3586  $ilDB = $DIC->database();
3587 
3588  $set = $ilDB->query("SELECT id FROM style_template " .
3589  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer") .
3590  " AND name = " . $ilDB->quote($a_name, "text"));
3591  if ($rec = $ilDB->fetchAssoc($set)) {
3592  return $rec["id"];
3593  }
3594 
3595  return false;
3596  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _lookupTemplateName()

static ilObjStyleSheet::_lookupTemplateName (   $a_t_id)
static

Lookup table template name for template ID.

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

References $DIC, and $ilDB.

Referenced by ilObjStyleSheetGUI\updateTemplateObject().

3482  {
3483  global $DIC;
3484 
3485  $ilDB = $DIC->database();
3486 
3487  $set = $ilDB->query("SELECT name FROM style_template WHERE " .
3488  " id = " . $ilDB->quote($a_t_id, "integer"));
3489 
3490  if ($rec = $ilDB->fetchAssoc($set)) {
3491  return $rec["name"];
3492  }
3493 
3494  return false;
3495  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _lookupUpToDate()

static ilObjStyleSheet::_lookupUpToDate (   $a_id)
static

Looup up to date.

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

References $DIC, $ilDB, and $res.

Referenced by getContentStylePath().

668  {
669  global $DIC;
670 
671  $ilDB = $DIC->database();
672 
673  $q = "SELECT uptodate FROM style_data " .
674  " WHERE id = " . $ilDB->quote($a_id, "integer");
675  $res = $ilDB->query($q);
676  $sty = $ilDB->fetchAssoc($res);
677 
678  return (boolean) $sty["uptodate"];
679  }
foreach($_POST as $key=> $value) $res
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _replaceStylePar()

static ilObjStyleSheet::_replaceStylePar (   $style_id,
  $a_tag,
  $a_class,
  $a_par,
  $a_val,
  $a_type,
  $a_mq_id = 0,
  $a_custom = false 
)
static

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

References $a_type, $DIC, ilObject\$id, and $ilDB.

Referenced by replaceStylePar().

1923  {
1924  global $DIC;
1925 
1926  $ilDB = $DIC->database();
1927 
1928  $q = "SELECT * FROM style_parameter WHERE " .
1929  " style_id = " . $ilDB->quote($style_id, "integer") . " AND " .
1930  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1931  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1932  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1933  " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1934  " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1935  " parameter = " . $ilDB->quote($a_par, "text");
1936 
1937  $set = $ilDB->query($q);
1938 
1939  if ($rec = $set->fetchRow()) {
1940  $q = "UPDATE style_parameter SET " .
1941  " value = " . $ilDB->quote($a_val, "text") . " WHERE " .
1942  " style_id = " . $ilDB->quote($style_id, "integer") . " AND " .
1943  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1944  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1945  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1946  " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1947  " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1948  " parameter = " . $ilDB->quote($a_par, "text");
1949 
1950  $ilDB->manipulate($q);
1951  } else {
1952  $id = $ilDB->nextId("style_parameter");
1953  $q = "INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter, mq_id, custom) VALUES " .
1954  " (" .
1955  $ilDB->quote($id, "integer") . "," .
1956  $ilDB->quote($a_val, "text") . "," .
1957  " " . $ilDB->quote($style_id, "integer") . "," .
1958  " " . $ilDB->quote($a_tag, "text") . "," .
1959  " " . $ilDB->quote($a_class, "text") . "," .
1960  " " . $ilDB->quote($a_type, "text") . "," .
1961  " " . $ilDB->quote($a_par, "text") . "," .
1962  " " . $ilDB->quote($a_mq_id, "integer") . "," .
1963  " " . $ilDB->quote($a_custom, "integer") .
1964  ")";
1965 
1966  $ilDB->manipulate($q);
1967  }
1968  }
$a_type
Definition: workflow.php:92
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 3060 of file class.ilObjStyleSheet.php.

References Vendor\Package\$b.

Referenced by _getColorFlavor().

3061  {
3062  $r = $a_rgb["r"] / 255;
3063  $g = $a_rgb["g"] / 255;
3064  $b = $a_rgb["b"] / 255;
3065 
3066  // max / min
3067  $max = max($r, $g, $b);
3068  $min = min($r, $g, $b);
3069 
3070  //lightness
3071  $l = ($max + $min) / 2;
3072 
3073  if ($max == $min) {
3074  $s = 0;
3075  $h = 0;
3076  } else {
3077  if ($l < 0.5) {
3078  $s = ($max - $min) / ($max + $min);
3079  } else {
3080  $s = ($max - $min) / (2.0 - $max - $min);
3081  }
3082 
3083  if ($r == $max) {
3084  $h = ($g - $b) / ($max - $min);
3085  } elseif ($g == $max) {
3086  $h = 2.0 + ($b - $r) / ($max - $min);
3087  } elseif ($b == $max) {
3088  $h = 4.0 + ($r - $g) / ($max - $min);
3089  }
3090  }
3091 
3092  $hls["h"] = round(($h / 6) * 255);
3093  $hls["l"] = round($l * 255);
3094  $hls["s"] = round($s * 255);
3095 
3096  return $hls;
3097  }
+ Here is the caller graph for this function:

◆ _writeActive()

static ilObjStyleSheet::_writeActive (   $a_id,
  $a_active 
)
static

Write active flag.

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

References $DIC, and $ilDB.

Referenced by ilContentStyleSettingsGUI\saveActiveStyles().

732  {
733  global $DIC;
734 
735  $ilDB = $DIC->database();
736 
737  $q = "UPDATE style_data SET active = " .
738  $ilDB->quote((int) $a_active, "integer") .
739  " WHERE id = " . $ilDB->quote($a_id, "integer");
740  $ilDB->manipulate($q);
741  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _writeScope()

static ilObjStyleSheet::_writeScope (   $a_id,
  $a_scope 
)
static

Write scope.

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

References $DIC, and $ilDB.

Referenced by ilContentStyleSettingsGUI\saveScope().

700  {
701  global $DIC;
702 
703  $ilDB = $DIC->database();
704 
705  $q = "UPDATE style_data SET category = " .
706  $ilDB->quote((int) $a_scope, "integer") .
707  " WHERE id = " . $ilDB->quote($a_id, "integer");
708  $ilDB->manipulate($q);
709  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _writeStandard()

static ilObjStyleSheet::_writeStandard (   $a_id,
  $a_std 
)
static

Write standard flag.

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

References $DIC, and $ilDB.

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

685  {
686  global $DIC;
687 
688  $ilDB = $DIC->database();
689 
690  $q = "UPDATE style_data SET standard = " .
691  $ilDB->quote((int) $a_std, "integer") .
692  " WHERE id = " . $ilDB->quote($a_id, "integer");
693  $ilDB->manipulate($q);
694  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ _writeUpToDate()

static ilObjStyleSheet::_writeUpToDate (   $a_id,
  $a_up_to_date 
)
static

Write up to date.

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

References $DIC, and $ilDB.

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

653  {
654  global $DIC;
655 
656  $ilDB = $DIC->database();
657 
658  $q = "UPDATE style_data SET uptodate = " .
659  $ilDB->quote((int) $a_up_to_date, "integer") .
660  " WHERE id = " . $ilDB->quote($a_id, "integer");
661  $ilDB->manipulate($q);
662  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ addCharacteristic()

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

Add characteristic.

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

References $a_type, ilObject\$db, $ilDB, _writeUpToDate(), ilObject\getId(), and setUpToDate().

Referenced by copyCharacteristic().

1063  {
1064  $ilDB = $this->db;
1065 
1066  // delete characteristic record
1067  $ilDB->manipulateF(
1068  "INSERT INTO style_char (style_id, type, characteristic, hide)" .
1069  " VALUES (%s,%s,%s,%s) ",
1070  array("integer", "text", "text", "integer"),
1071  array($this->getId(), $a_type, $a_char, $a_hidden)
1072  );
1073 
1074  $this->setUpToDate(false);
1075  $this->_writeUpToDate($this->getId(), false);
1076  }
$a_type
Definition: workflow.php:92
getId()
get object id public
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
global $ilDB
static _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 2899 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by copyCharacteristic(), and create().

2900  {
2901  $ilDB = $this->db;
2902 
2903  $ilDB->manipulate("INSERT INTO style_color (style_id, color_name, color_code)" .
2904  " VALUES (" .
2905  $ilDB->quote($this->getId(), "integer") . "," .
2906  $ilDB->quote($a_name, "text") . "," .
2907  $ilDB->quote($a_code, "text") .
2908  ")");
2909  }
global $ilDB
+ Here is the caller graph for this function:

◆ addMediaQuery()

ilObjStyleSheet::addMediaQuery (   $a_mquery,
  $order_nr = 0 
)

Add media query.

Parameters
string$a_mquerymedia query

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

References ilObject\$db, ilObject\$id, $ilDB, ilObject\getId(), and getMaxMQueryOrderNr().

Referenced by create().

3196  {
3197  $ilDB = $this->db;
3198 
3199  $id = $ilDB->nextId("sty_media_query");
3200  if ($order_nr == 0) {
3201  $order_nr = $this->getMaxMQueryOrderNr() + 10;
3202  }
3203 
3204  $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
3205  " VALUES (" .
3206  $ilDB->quote($id, "integer") . "," .
3207  $ilDB->quote($this->getId(), "integer") . "," .
3208  $ilDB->quote($a_mquery, "text") . "," .
3209  $ilDB->quote($order_nr, "integer") .
3210  ")");
3211 
3212  return $id;
3213  }
getId()
get object id public
getMaxMQueryOrderNr()
Get maximum media query order nr.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addParameter()

ilObjStyleSheet::addParameter (   $a_tag,
  $a_par,
  $a_type,
  $a_mq_id = 0,
  $a_custom = false 
)

write style parameter to db

todo check usages add mq_id

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 1241 of file class.ilObjStyleSheet.php.

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

1242  {
1243  $ilDB = $this->db;
1244 
1245  $avail_params = $this->getAvailableParameters();
1246  $tag = explode(".", $a_tag);
1247  $value = $avail_params[$a_par][0];
1248  $id = $ilDB->nextId("style_parameter");
1249  $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1250  "(" .
1251  $ilDB->quote($id, "integer") . "," .
1252  $ilDB->quote($this->getId(), "integer") . "," .
1253  $ilDB->quote($a_type, "text") . "," .
1254  $ilDB->quote($tag[0], "text") . "," .
1255  $ilDB->quote($tag[1], "text") . "," .
1256  $ilDB->quote($a_par, "text") . "," .
1257  $ilDB->quote($value, "text") . "," .
1258  $ilDB->quote($a_mq_id, "integer") . "," .
1259  $ilDB->quote($a_custom, "integer") .
1260  ")";
1261  $ilDB->manipulate($q);
1262  $this->read();
1263  $this->writeCSSFile();
1264  }
read()
read style properties
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
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 3358 of file class.ilObjStyleSheet.php.

References $a_type, Vendor\Package\$c, ilObject\$db, $ilDB, ilObjStyleSheetGUI\_getTemplatePreview(), ilObject\getId(), and writeTemplatePreview().

Referenced by create().

3359  {
3360  $ilDB = $this->db;
3361 
3362  $tid = $ilDB->nextId("style_template");
3363  $ilDB->manipulate($q = "INSERT INTO style_template " .
3364  "(id, style_id, name, temp_type)" .
3365  " VALUES (" .
3366  $ilDB->quote($tid, "integer") . "," .
3367  $ilDB->quote($this->getId(), "integer") . "," .
3368  $ilDB->quote($a_name, "text") . "," .
3369  $ilDB->quote($a_type, "text") .
3370  ")");
3371 
3372  foreach ($a_classes as $t => $c) {
3373  $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3374  "(template_id, class_type, class)" .
3375  " VALUES (" .
3376  $ilDB->quote($tid, "integer") . "," .
3377  $ilDB->quote($t, "text") . "," .
3378  $ilDB->quote($c, "text") .
3379  ")");
3380  }
3381 
3382  include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
3383  $this->writeTemplatePreview(
3384  $tid,
3386  );
3387 
3388  return $tid;
3389  }
static _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.
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTemplateClass()

ilObjStyleSheet::addTemplateClass (   $a_t_id,
  $a_type,
  $a_class 
)

Update table template.

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

References $a_type, ilObject\$db, and $ilDB.

3421  {
3422  $ilDB = $this->db;
3423 
3424  $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3425  "(template_id, class_type, class)" .
3426  " VALUES (" .
3427  $ilDB->quote($a_t_id, "integer") . "," .
3428  $ilDB->quote($a_type, "text") . "," .
3429  $ilDB->quote($a_class, "text") .
3430  ")");
3431  }
$a_type
Definition: workflow.php:92
global $ilDB

◆ assignMetaData()

ilObjStyleSheet::assignMetaData ( $a_meta_data)

assign meta data object

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

856  {
857  $this->meta_data = $a_meta_data;
858  }

◆ characteristicExists()

ilObjStyleSheet::characteristicExists (   $a_char,
  $a_style_type 
)

Check whether characteristic exists.

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

References ilObject\$db, $ilDB, and ilObject\getId().

Referenced by copyCharacteristic().

1045  {
1046  $ilDB = $this->db;
1047 
1048  $set = $ilDB->queryF(
1049  "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
1050  array("integer", "text", "text"),
1051  array($this->getId(), $a_char, $a_style_type)
1052  );
1053  if ($rec = $ilDB->fetchAssoc($set)) {
1054  return true;
1055  }
1056  return false;
1057  }
getId()
get object id public
global $ilDB
+ 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 2086 of file class.ilObjStyleSheet.php.

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

Referenced by export().

2087  {
2088  $sty_data_dir = ilUtil::getDataDir() . "/sty";
2089  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
2090  // create export subdirectory
2091  $ex_dir = $style_dir . "/export";
2092 
2093  if (is_dir($ex_dir)) {
2094  ilUtil::delDir($ex_dir, true);
2095  }
2096  }
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 2973 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by copyCharacteristic().

2974  {
2975  $ilDB = $this->db;
2976 
2977  $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2978  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2979  "color_name = " . $ilDB->quote($a_color_name, "text"));
2980  if ($rec = $ilDB->fetchAssoc($set)) {
2981  return true;
2982  }
2983  return false;
2984  }
global $ilDB
+ 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 1084 of file class.ilObjStyleSheet.php.

References Vendor\Package\$c, ilObject\$db, $ilDB, _determineTag(), addCharacteristic(), addColor(), characteristicExists(), colorExists(), deleteStyleParOfChar(), and replaceStylePar().

1089  {
1090  $ilDB = $this->db;
1091 
1092  if (!$this->characteristicExists($a_to_char, $a_from_type)) {
1093  $this->addCharacteristic($a_from_type, $a_to_char);
1094  }
1095  $this->deleteStyleParOfChar($a_from_type, $a_to_char);
1096 
1097  $from_style = new ilObjStyleSheet($a_from_style_id);
1098 
1099  // todo fix using mq_id
1100  $pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
1101 
1102  $colors = array();
1103  foreach ($pars as $p => $v) {
1104  if (substr($v, 0, 1) == "!") {
1105  $colors[] = substr($v, 1);
1106  }
1107  $this->replaceStylePar(
1108  ilObjStyleSheet::_determineTag($a_from_type),
1109  $a_to_char,
1110  $p,
1111  $v,
1112  $a_from_type
1113  );
1114  }
1115 
1116  // copy colors
1117  foreach ($colors as $c) {
1118  if (!$this->colorExists($c)) {
1119  $this->addColor($c, $from_style->getColorCodeForName($c));
1120  }
1121  }
1122  }
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.
addCharacteristic($a_type, $a_char, $a_hidden=false)
Add characteristic.
replaceStylePar($a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
Set style parameter per tag/class/parameter.
colorExists($a_color_name)
Check whether color exists.
global $ilDB
Class ilObjStyleSheet.
+ Here is the call graph for this function:

◆ copyImagesToDir()

ilObjStyleSheet::copyImagesToDir (   $a_target)

Copy images to directory.

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

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

1228  {
1229  ilUtil::rCopy($this->getImagesDirectory(), $a_target);
1230  }
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 894 of file class.ilObjStyleSheet.php.

References Vendor\Package\$c, ilObject\$db, ilObject\$id, $ilDB, $templates, _createImagesDirectory(), _getTemplateClassTypes(), addColor(), addMediaQuery(), addTemplate(), createFromXMLFile(), createImagesDirectory(), ilObject\getId(), getImagesDirectory(), getScope(), ilUtil\rCopy(), read(), and writeCSSFile().

895  {
896  $ilDB = $this->db;
897 
898  parent::create();
899 
900  if ($a_from_style == 0) {
901  if (!$a_import_mode) {
902  // copy styles from basic style
903  $this->createFromXMLFile(self::$basic_style_file, true);
904 
905  // copy images from basic style
906  $this->createImagesDirectory();
908  self::$basic_style_image_dir,
909  $this->getImagesDirectory()
910  );
911  } else {
912  // add style_data record
913  $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
914  "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
915  $ilDB->quote((int) $this->getScope(), "integer") . ")";
916  $ilDB->manipulate($q);
918  }
919  } else {
920  // get style parameter records
921  $def = array();
922  $q = "SELECT * FROM style_parameter WHERE style_id = " .
923  $ilDB->quote($a_from_style, "integer");
924  $par_set = $ilDB->query($q);
925  while ($par_rec = $ilDB->fetchAssoc($par_set)) {
926  $def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
927  "parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
928  "type" => $par_rec["type"], "mq_id" => $par_rec["mq_id"], "custom" => $par_rec["custom"]);
929  }
930 
931  // get style characteristics records
932  $chars = array();
933  $q = "SELECT * FROM style_char WHERE style_id = " .
934  $ilDB->quote($a_from_style, "integer");
935  $par_set = $ilDB->query($q);
936  while ($par_rec = $ilDB->fetchAssoc($par_set)) {
937  $chars[] = array("type" => $par_rec["type"], "characteristic" => $par_rec["characteristic"]);
938  }
939 
940 
941  // copy media queries
942  $from_style = new ilObjStyleSheet($a_from_style);
943  $mqs = $from_style->getMediaQueries();
944  $mq_mapping = array();
945  foreach ($mqs as $mq) {
946  $nid = $this->addMediaQuery($mq["mquery"]);
947  $mq_mapping[$mq["id"]] = $nid;
948  }
949 
950  // default style settings
951  foreach ($def as $sty) {
952  $id = $ilDB->nextId("style_parameter");
953  $q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
954  "(" .
955  $ilDB->quote($id, "integer") . "," .
956  $ilDB->quote($this->getId(), "integer") . "," .
957  $ilDB->quote($sty["tag"], "text") . "," .
958  $ilDB->quote($sty["class"], "text") . "," .
959  $ilDB->quote($sty["parameter"], "text") . "," .
960  $ilDB->quote($sty["value"], "text") . "," .
961  $ilDB->quote($sty["type"], "text") . "," .
962  $ilDB->quote((int) $mq_mapping[$sty["mq_id"]], "integer") . "," .
963  $ilDB->quote($sty["custom"], "integer") .
964  ")";
965  $ilDB->manipulate($q);
966  }
967 
968  // insert style characteristics
969  foreach ($chars as $char) {
970  $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES " .
971  "(" . $ilDB->quote($this->getId(), "integer") . "," .
972  $ilDB->quote($char["type"], "text") . "," .
973  $ilDB->quote($char["characteristic"], "text") . ")";
974  $ilDB->manipulate($q);
975  }
976 
977  // add style_data record
978  $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
979  "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
980  $ilDB->quote((int) $this->getScope(), "integer") . ")";
981  $ilDB->manipulate($q);
982 
983  // copy images
984  $this->createImagesDirectory();
986  $from_style->getImagesDirectory(),
987  $this->getImagesDirectory()
988  );
989 
990  // copy colors
991  $colors = $from_style->getColors();
992  foreach ($colors as $c) {
993  $this->addColor($c["name"], $c["code"]);
994  }
995 
996  // copy templates
998  foreach ($tcts as $tct => $v) {
999  $templates = $from_style->getTemplates($tct);
1000  foreach ($templates as $t) {
1001  $this->addTemplate($tct, $t["name"], $t["classes"]);
1002  }
1003  }
1004  }
1005 
1006  $this->read();
1007  if (!$a_import_mode) {
1008  $this->writeCSSFile();
1009  }
1010  }
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
static _createImagesDirectory($a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
global $ilDB
Class ilObjStyleSheet.
createFromXMLFile($a_file, $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
addMediaQuery($a_mquery, $order_nr=0)
Add media query.
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 2056 of file class.ilObjStyleSheet.php.

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

Referenced by createExportSubDirectory(), and export().

2057  {
2058  $sty_data_dir = ilUtil::getDataDir() . "/sty";
2059  ilUtil::makeDir($sty_data_dir);
2060  if (!is_writable($sty_data_dir)) {
2061  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
2062  . ") not writeable.", $this->ilias->error_obj->FATAL);
2063  }
2064 
2065  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
2066  ilUtil::makeDir($style_dir);
2067  if (!@is_dir($style_dir)) {
2068  $this->ilias->raiseError("Creation of style directory failed (" .
2069  $style_dir . ").", $this->ilias->error_obj->FATAL);
2070  }
2071 
2072  // create export subdirectory
2073  $ex_dir = $style_dir . "/export";
2074  ilUtil::makeDir($ex_dir);
2075  if (!@is_dir($ex_dir)) {
2076  $this->ilias->raiseError("Creation of Import Directory failed (" .
2077  $ex_dir . ").", $this->ilias->error_obj->FATAL);
2078  }
2079 
2080  return $ex_dir;
2081  }
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 2102 of file class.ilObjStyleSheet.php.

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

Referenced by export().

2103  {
2104  $ex_dir = $this->createExportDirectory();
2105  $ex_sub_dir = $ex_dir . "/" . $this->getExportSubDir();
2106  ilUtil::makeDir($ex_sub_dir);
2107  if (!is_writable($ex_sub_dir)) {
2108  $this->ilias->raiseError("Style data directory (" . $ex_sub_dir
2109  . ") not writeable.", $this->ilias->error_obj->FATAL);
2110  }
2111  $ex_sub_images_dir = $ex_sub_dir . "/images";
2112  ilUtil::makeDir($ex_sub_images_dir);
2113  if (!is_writable($ex_sub_images_dir)) {
2114  $this->ilias->raiseError("Style data directory (" . $ex_sub_images_dir
2115  . ") not writeable.", $this->ilias->error_obj->FATAL);
2116  }
2117  }
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 todo: add mq_id and custom

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

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

Referenced by create(), and import().

2278  {
2279  $ilDB = $this->db;
2280 
2281  $this->is_3_10_skin = false;
2282 
2283  if (!$a_skip_parent_create) {
2284  parent::create();
2285  }
2286  include_once("./Services/Style/Content/classes/class.ilStyleImportParser.php");
2287  $importParser = new ilStyleImportParser($a_file, $this);
2288  $importParser->startParsing();
2289 
2290  // store style parameter
2291  foreach ($this->style as $style) {
2292  foreach ($style as $tag) {
2293  $id = $ilDB->nextId("style_parameter");
2294 
2295  // migrate old table PageFrame/PageContainer to div
2296  if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
2297  $tag["tag"] == "table") {
2298  $tag["tag"] = "div";
2299  if ($tag["parameter"] == "width" && $tag["value"] == "100%") {
2300  continue;
2301  }
2302  }
2303 
2304  $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
2305  "(" .
2306  $ilDB->quote($id, "integer") . "," .
2307  $ilDB->quote($this->getId(), "integer") . "," .
2308  $ilDB->quote($tag["tag"], "text") . "," .
2309  $ilDB->quote($tag["class"], "text") . "," .
2310  $ilDB->quote($tag["parameter"], "text") . "," .
2311  $ilDB->quote($tag["type"], "text") . "," .
2312  $ilDB->quote($tag["value"], "text") . "," .
2313  $ilDB->quote((bool) $tag["custom"], "integer") .
2314  ")";
2315  $ilDB->manipulate($q);
2316  }
2317  }
2318 
2319  // store characteristics
2320  $this->is_3_10_skin = true;
2321  if (is_array($this->chars)) {
2322  foreach ($this->chars as $char) {
2323  if ($char["type"] != "") {
2324  $s = substr($char["class"], strlen($char["class"]) - 6);
2325  if ($s != ":hover") {
2326  $ilDB->replace(
2327  "style_char",
2328  array(
2329  "style_id" => array("integer", $this->getId()),
2330  "type" => array("text", $char["type"]),
2331  "characteristic" => array("text", $char["class"])),
2332  array("hide" => array("integer", 0))
2333  );
2334  /*
2335  $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
2336  "(".$ilDB->quote($this->getId(), "integer").",".
2337  $ilDB->quote($char["type"], "text").",".
2338  $ilDB->quote($char["class"], "text").")";
2339  $ilDB->manipulate($q);*/
2340  $this->is_3_10_skin = false;
2341  }
2342  }
2343  }
2344  }
2345 
2346  // add style_data record
2347  $q = "INSERT INTO style_data (id, uptodate) VALUES " .
2348  "(" . $ilDB->quote($this->getId(), "integer") . ", 0)";
2349  $ilDB->manipulate($q);
2350 
2351  $this->update();
2352  $this->read();
2353 
2354  if ($this->is_3_10_skin) {
2355  $this->do_3_10_Migration();
2356  }
2357  //$this->writeCSSFile();
2358  }
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.
read()
read style properties
getId()
get object id public
global $ilDB
+ 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 1270 of file class.ilObjStyleSheet.php.

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

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

1271  {
1273  }
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 2192 of file class.ilObjStyleSheet.php.

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

Referenced by import().

2193  {
2194  $sty_data_dir = ilUtil::getDataDir() . "/sty";
2195  ilUtil::makeDir($sty_data_dir);
2196  if (!is_writable($sty_data_dir)) {
2197  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
2198  . ") not writeable.", $this->ilias->error_obj->FATAL);
2199  }
2200 
2201  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
2202  ilUtil::makeDir($style_dir);
2203  if (!@is_dir($style_dir)) {
2204  $this->ilias->raiseError("Creation of style directory failed (" .
2205  $style_dir . ").", $this->ilias->error_obj->FATAL);
2206  }
2207 
2208  // create import subdirectory
2209  $im_dir = $style_dir . "/import";
2210  ilUtil::makeDir($im_dir);
2211  if (!@is_dir($im_dir)) {
2212  $this->ilias->raiseError("Creation of Import Directory failed (" .
2213  $im_dir . ").", $this->ilias->error_obj->FATAL);
2214  }
2215 
2216  return $im_dir;
2217  }
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 612 of file class.ilObjStyleSheet.php.

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

◆ delete()

ilObjStyleSheet::delete ( )

delete style object

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

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

1484  {
1485  $ilDB = $this->db;
1486 
1487  // delete object
1488  parent::delete();
1489 
1490  // check whether this style is global default
1491  $def_style = $this->ilias->getSetting("default_content_style_id");
1492  if ($def_style == $this->getId()) {
1493  $this->ilias->deleteSetting("default_content_style_id");
1494  }
1495 
1496  // check whether this style is global fixed
1497  $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1498  if ($fixed_style == $this->getId()) {
1499  $this->ilias->deleteSetting("fixed_content_style_id");
1500  }
1501 
1502  // delete style parameter
1503  $q = "DELETE FROM style_parameter WHERE style_id = " .
1504  $ilDB->quote($this->getId(), "integer");
1505  $ilDB->manipulate($q);
1506 
1507  // delete style file
1508  $css_file_name = ilUtil::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1509  if (is_file($css_file_name)) {
1510  unlink($css_file_name);
1511  }
1512 
1513  // delete media queries
1514  $ilDB->manipulate(
1515  "DELETE FROM sty_media_query WHERE " .
1516  " style_id = " . $ilDB->quote($this->getId(), "integer")
1517  );
1518 
1519  // delete entries in learning modules
1520  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1522 
1523  // delete style data record
1524  $q = "DELETE FROM style_data WHERE id = " .
1525  $ilDB->quote($this->getId(), "integer");
1526  $ilDB->manipulate($q);
1527  }
static _deleteStyleAssignments($a_style_id)
delete all style references to style
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilDB
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 1015 of file class.ilObjStyleSheet.php.

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

1016  {
1017  $ilDB = $this->db;
1018 
1019  // check, if characteristic is not a core style
1021  if (empty($core_styles[$a_type . "." . $a_tag . "." . $a_class])) {
1022  // delete characteristic record
1023  $st = $ilDB->manipulateF(
1024  "DELETE FROM style_char WHERE style_id = %s AND type = %s AND characteristic = %s",
1025  array("integer", "text", "text"),
1026  array($this->getId(), $a_type, $a_class)
1027  );
1028 
1029  // delete parameter records
1030  $st = $ilDB->manipulateF(
1031  "DELETE FROM style_parameter WHERE style_id = %s AND tag = %s AND type = %s AND class = %s",
1032  array("integer", "text", "text", "text"),
1033  array($this->getId(), $a_tag, $a_type, $a_class)
1034  );
1035  }
1036 
1037  $this->setUpToDate(false);
1038  $this->_writeUpToDate($this->getId(), false);
1039  }
$a_type
Definition: workflow.php:92
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)
global $ilDB
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
+ Here is the call graph for this function:

◆ deleteCustomStylePars()

ilObjStyleSheet::deleteCustomStylePars (   $a_tag,
  $a_class,
  $a_type,
  $a_mq_id = 0 
)

Delete style parameter by tag/class/parameter.

Parameters
string$a_tagtag
string$a_classclass
string$a_parparameter
string$a_typetype
string$a_mq_idmedia query id

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

References $a_type, ilObject\$db, $ilDB, and ilObject\getId().

1445  {
1446  $ilDB = $this->db;
1447 
1448  $q = "DELETE FROM style_parameter WHERE " .
1449  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1450  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1451  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1452  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1453  " custom = " . $ilDB->quote(1, "integer") . " AND " .
1454  " " . $ilDB->equals("type", $a_type, "text", true);
1455 
1456  $ilDB->manipulate($q);
1457  }
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ deleteImage()

ilObjStyleSheet::deleteImage (   $a_file)

Delete an image.

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

References getImagesDirectory(), and getThumbnailsDirectory().

1387  {
1388  if (is_file($this->getImagesDirectory() . "/" . $a_file)) {
1389  unlink($this->getImagesDirectory() . "/" . $a_file);
1390  }
1391  if (is_file($this->getThumbnailsDirectory() . "/" . $a_file)) {
1392  unlink($this->getThumbnailsDirectory() . "/" . $a_file);
1393  }
1394  }
getThumbnailsDirectory()
Get thumbnails directory.
getImagesDirectory()
Get images directory.
+ Here is the call graph for this function:

◆ deleteMediaQuery()

ilObjStyleSheet::deleteMediaQuery (   $a_id)

Delete media query.

Parameters
int$a_idmedia query id

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

References ilObject\$db, $ilDB, and saveMediaQueryOrder().

3272  {
3273  $ilDB = $this->db;
3274 
3275  $ilDB->manipulate(
3276  "DELETE FROM sty_media_query WHERE " .
3277  " style_id = " . $ilDB->quote($this->getId(), "integer") .
3278  " AND id = " . $ilDB->quote($a_id, "integer")
3279  );
3280  $this->saveMediaQueryOrder();
3281  }
global $ilDB
saveMediaQueryOrder($a_order_nr=null)
Save media query order.
+ 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 1401 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

1402  {
1403  $ilDB = $this->db;
1404 
1405  $q = "DELETE FROM style_parameter WHERE id = " .
1406  $ilDB->quote($a_id, "integer");
1407  $ilDB->query($q);
1408  }
global $ilDB

◆ deleteStylePar()

ilObjStyleSheet::deleteStylePar (   $a_tag,
  $a_class,
  $a_par,
  $a_type,
  $a_mq_id = 0,
  $a_custom = false 
)

Delete style parameter by tag/class/parameter.

Parameters
string$a_tagtag
string$a_classclass
string$a_parparameter
string$a_typetype
string$a_mq_idmedia query id

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

References $a_type, ilObject\$db, $ilDB, and ilObject\getId().

1420  {
1421  $ilDB = $this->db;
1422 
1423  $q = "DELETE FROM style_parameter WHERE " .
1424  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1425  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1426  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1427  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1428  " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1429  " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1430  " parameter = " . $ilDB->quote($a_par, "text");
1431 
1432  $ilDB->manipulate($q);
1433  }
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ 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 1467 of file class.ilObjStyleSheet.php.

References $a_type, ilObject\$db, $ilDB, and ilObject\getId().

Referenced by copyCharacteristic().

1468  {
1469  $ilDB = $this->db;
1470 
1471  $q = "DELETE FROM style_parameter WHERE " .
1472  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1473  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1474  " " . $ilDB->equals("type", $a_type, "text", true);
1475 
1476  $ilDB->manipulate($q);
1477  }
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineTemplateStyleClassType()

ilObjStyleSheet::determineTemplateStyleClassType (   $t,
  $k 
)

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

2502  {
2503  return self::$templates[$t][$k];
2504  }

◆ 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 2694 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by do_3_10_Migration().

2695  {
2696  $ilDB = $this->db;
2697 
2698  $add_str = "";
2699  if ($a_id != "") {
2700  $add_str = " AND style_id = " . $ilDB->quote($a_id, "integer");
2701  }
2702 
2703  $set = $ilDB->query($q = "SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE " .
2704  $ilDB->equals("type", "", "text", true) . " " . $add_str);
2705 
2706  while ($rec = $ilDB->fetchAssoc($set)) {
2707  // derive types from tag
2708  $types = array();
2709  switch ($rec["tag"]) {
2710  case "div":
2711  case "p":
2712  if (in_array($rec["class"], array("Headline3", "Headline1",
2713  "Headline2", "TableContent", "List", "Standard", "Remark",
2714  "Additional", "Mnemonic", "Citation", "Example"))) {
2715  $types[] = "text_block";
2716  }
2717  if (in_array($rec["class"], array("Block", "Remark",
2718  "Additional", "Mnemonic", "Example", "Excursus", "Special"))) {
2719  $types[] = "section";
2720  }
2721  if (in_array($rec["class"], array("Page", "Footnote", "PageTitle", "LMNavigation"))) {
2722  $types[] = "page";
2723  }
2724  break;
2725 
2726  case "td":
2727  $types[] = "table_cell";
2728  break;
2729 
2730  case "a":
2731  if (in_array($rec["class"], array("ExtLink", "IntLink", "FootnoteLink"))) {
2732  $types[] = "link";
2733  }
2734  break;
2735 
2736  case "span":
2737  $types[] = "text_inline";
2738  break;
2739 
2740  case "table":
2741  $types[] = "table";
2742  break;
2743  }
2744 
2745  // check if style_char set exists
2746  foreach ($types as $t) {
2747  // check if second type already exists
2748  $set4 = $ilDB->queryF(
2749  "SELECT * FROM style_char " .
2750  " WHERE style_id = %s AND type = %s AND characteristic = %s",
2751  array("integer", "text", "text"),
2752  array($rec["style_id"], $t, $rec["class"])
2753  );
2754  if ($rec4 = $ilDB->fetchAssoc($set4)) {
2755  // ok
2756  } else {
2757  //echo "<br>1-".$rec["style_id"]."-".$t."-".$rec["class"]."-";
2758  $ilDB->manipulateF(
2759  "INSERT INTO style_char " .
2760  " (style_id, type, characteristic) VALUES " .
2761  " (%s,%s,%s) ",
2762  array("integer", "text", "text"),
2763  array($rec["style_id"], $t, $rec["class"])
2764  );
2765  }
2766  }
2767 
2768  // update types
2769  if ($rec["type"] == "") {
2770  if (count($types) > 0) {
2771  $ilDB->manipulateF(
2772  "UPDATE style_parameter SET type = %s " .
2773  " WHERE style_id = %s AND class = %s AND " . $ilDB->equals("type", "", "text", true),
2774  array("text", "integer", "text"),
2775  array($types[0], $rec["style_id"], $rec["class"])
2776  );
2777  //echo "<br>3-".$types[0]."-".$rec["style_id"]."-".$rec["class"]."-";
2778 
2779  // links extra handling
2780  if ($types[0] == "link") {
2781  $ilDB->manipulateF(
2782  "UPDATE style_parameter SET type = %s " .
2783  " WHERE style_id = %s AND (class = %s OR class = %s) AND " . $ilDB->equals("type", "", "text", true),
2784  array("text", "integer", "text", "text"),
2785  array($types[0], $rec["style_id"], $rec["class"] . ":visited",
2786  $rec["class"] . ":hover")
2787  );
2788  }
2789  }
2790 
2791  if (count($types) == 2) {
2792  // select all records of first type and add second type
2793  // records if necessary.
2794  $set2 = $ilDB->queryF(
2795  "SELECT * FROM style_parameter " .
2796  " WHERE style_id = %s AND class = %s AND type = %s",
2797  array("integer", "text", "text"),
2798  array($rec["style_id"], $rec["class"], $types[0])
2799  );
2800  while ($rec2 = $ilDB->fetchAssoc($set2)) {
2801  // check if second type already exists
2802  $set3 = $ilDB->queryF(
2803  "SELECT * FROM style_parameter " .
2804  " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2805  array("integer", "text", "text", "text", "text"),
2806  array($rec["style_id"], $rec["tag"], $rec["class"], $types[1], $rec["parameter"])
2807  );
2808  if ($rec3 = $ilDB->fetchAssoc($set3)) {
2809  // ok
2810  } else {
2811  $nid = $ilDB->nextId("style_parameter");
2812  $ilDB->manipulateF(
2813  "INSERT INTO style_parameter " .
2814  " (id, style_id, tag, class, parameter, value, type) VALUES " .
2815  " (%s, %s,%s,%s,%s,%s,%s) ",
2816  array("integer", "integer", "text", "text", "text", "text", "text"),
2817  array($nid, $rec2["style_id"], $rec2["tag"], $rec2["class"],
2818  $rec2["parameter"], $rec2["value"], $types[1])
2819  );
2820  }
2821  }
2822  }
2823  }
2824  }
2825  }
global $ilDB
+ 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 2632 of file class.ilObjStyleSheet.php.

References ilObject\$db, $ilDB, do_3_10_CharMigration(), do_3_9_Migration(), and ilObject\getId().

Referenced by createFromXMLFile().

2633  {
2634  $ilDB = $this->db;
2635 
2636  $this->do_3_9_Migration($this->getId());
2637 
2638  //include_once("./Services/Migration/DBUpdate_1385/classes/class.ilStyleMigration.php");
2639  //ilStyleMigration::addMissingStyleCharacteristics($this->getId());
2640 
2641  $this->do_3_10_CharMigration($this->getId());
2642 
2643  // style_char: type for characteristic
2644  $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?" .
2645  " AND style_id = ? ", array("text", "text", "integer"));
2646  $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2647  $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2648  $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2649  $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2650  $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2651  $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2652 
2653  // style_parameter: type for class
2654  $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?" .
2655  " AND style_id = ? ", array("text", "text", "integer"));
2656  $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2657  $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2658  $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2659  $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2660  $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2661  $ilDB->execute($st, array("table", "Page", $this->getId()));
2662 
2663  $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?" .
2664  " AND style_id = ? ", array("text", "text", "integer"));
2665  $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2666 
2667  // style_char: characteristic for characteristic
2668  $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?" .
2669  " AND style_id = ? ", array("text", "text", "integer"));
2670  $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2671  $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2672 
2673  // style_parameter: class for class
2674  $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?" .
2675  " AND style_id = ? ", array("text", "text", "integer"));
2676  $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2677  $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2678 
2679  // force rewriting of container style
2680  $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?" .
2681  " AND style_id = ? ", array("text", "integer"));
2682  $ilDB->execute($st, array("page_cont", $this->getId()));
2683  $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?" .
2684  " AND style_id = ? ", array("text", "integer"));
2685  $ilDB->execute($st, array("page_cont", $this->getId()));
2686  }
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
global $ilDB
+ 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 2830 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by do_3_10_Migration().

2831  {
2832  $ilDB = $this->db;
2833 
2834  $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2835  $pars = array("margin-top", "margin-bottom");
2836 
2837  foreach ($classes as $curr_class) {
2838  foreach ($pars as $curr_par) {
2839  $res2 = $ilDB->queryF(
2840  "SELECT id FROM style_parameter WHERE style_id = %s" .
2841  " AND tag = %s AND class= %s AND parameter = %s",
2842  array("integer", "text", "text", "text"),
2843  array($a_id, "p", $curr_class, $curr_par)
2844  );
2845  if ($row2 = $ilDB->fetchAssoc($res2)) {
2846  $ilDB->manipulateF(
2847  "UPDATE style_parameter SET value= %s WHERE id = %s",
2848  array("text", "integer"),
2849  array("10px", $row2["id"])
2850  );
2851  } else {
2852  $nid = $ilDB->nextId("style_parameter");
2853  $ilDB->manipulateF(
2854  "INSERT INTO style_parameter " .
2855  "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2856  array("integer", "integer", "text", "text", "text", "text"),
2857  array($nid, $a_id, "div", $curr_class, $curr_par, "10px")
2858  );
2859  }
2860  }
2861  }
2862 
2863  $ilDB->manipulateF(
2864  "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2865  array("text", "text", "integer"),
2866  array("div", "p", $a_id)
2867  );
2868  }
global $ilDB
+ 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 2144 of file class.ilObjStyleSheet.php.

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

2145  {
2146  $this->cleanExportDirectory();
2147  $ex_dir = $this->createExportDirectory();
2148  $this->createExportSubDirectory();
2149  $this->exportXML($ex_dir . "/" . $this->getExportSubDir());
2150  //echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
2151  ilUtil::rCopy(
2152  $this->getImagesDirectory(),
2153  $ex_dir . "/" . $this->getExportSubDir() . "/images"
2154  );
2155  if (is_file($ex_dir . "/" . $this->getExportSubDir() . ".zip")) {
2156  unlink($ex_dir . "/" . $this->getExportSubDir() . ".zip");
2157  }
2158  ilUtil::zip(
2159  $ex_dir . "/" . $this->getExportSubDir(),
2160  $ex_dir . "/" . $this->getExportSubDir() . ".zip"
2161  );
2162 
2163  return $ex_dir . "/" . $this->getExportSubDir() . ".zip";
2164  }
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 2169 of file class.ilObjStyleSheet.php.

References getXML().

Referenced by export().

2170  {
2171  $file = $a_dir . "/style.xml";
2172 
2173  // open file
2174  if (!($fp = @fopen($file, "w"))) {
2175  die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
2176  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
2177  }
2178 
2179  // set file permissions
2180  chmod($file, 0770);
2181 
2182  // write xml data into the file
2183  fwrite($fp, $this->getXML());
2184 
2185  // close file
2186  fclose($fp);
2187  }
getXML()
get xml representation of style object todo: add mq_id
+ 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 2514 of file class.ilObjStyleSheet.php.

Referenced by addParameter().

2515  {
2516  $pars = array();
2517  foreach (self::$parameter as $p => $v) {
2518  $pars[$p] = $v["values"];
2519  }
2520 
2521  return $pars;
2522  }
+ Here is the caller graph for this function:

◆ getBasicImageDir()

static ilObjStyleSheet::getBasicImageDir ( )
static

Get basic image dir.

Returns
string

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

Referenced by ilCOPageHTMLExport\exportStyles().

886  {
887  return self::$basic_style_image_dir;
888  }
+ Here is the caller graph for this function:

◆ getBasicZipPath()

static ilObjStyleSheet::getBasicZipPath ( )
static

Get basic zip path.

Returns
string

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

Referenced by ilObjStyleSheetGUI\saveObject().

579  : string
580  {
581  return self::$basic_style_zip;
582  }
+ Here is the caller graph for this function:

◆ getCharacteristics()

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

Get characteristics.

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

References $a_type, and Vendor\Package\$c.

1128  {
1129  $chars = array();
1130 
1131  if ($a_type == "") {
1132  $chars = $this->chars;
1133  }
1134  if (is_array($this->chars_by_type[$a_type])) {
1135  foreach ($this->chars_by_type[$a_type] as $c) {
1136  if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
1137  $chars[] = $c;
1138  }
1139  }
1140  }
1141 
1142  if ($a_no_hidden) {
1143  foreach ($chars as $k => $char) {
1144  if ($a_type == "" && $this->hidden_chars[$char["type"] . ":" . $char["class"]]) {
1145  unset($chars[$k]);
1146  } elseif ($this->hidden_chars[$a_type . ":" . $char]) {
1147  unset($chars[$k]);
1148  }
1149  }
1150  }
1151 
1152  return $chars;
1153  }
$a_type
Definition: workflow.php:92

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName (   $a_name)

Remove a color.

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

References ilObject\$db, $ilDB, and _getColorFlavor().

Referenced by writeCSSFile().

2990  {
2991  $ilDB = $this->db;
2992 
2993  $pos = strpos($a_name, "(");
2994  if ($pos > 0) {
2995  $a_i = substr($a_name, $pos + 1);
2996  $a_i = str_replace(")", "", $a_i);
2997  $a_name = substr($a_name, 0, $pos);
2998  }
2999 
3000  $set = $ilDB->query("SELECT color_code FROM style_color WHERE " .
3001  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3002  " color_name = " . $ilDB->quote($a_name, "text"));
3003  if ($rec = $ilDB->fetchAssoc($set)) {
3004  if ($a_i == "") {
3005  return "#" . $rec["color_code"];
3006  } else {
3007  return "#" . ilObjStyleSheet::_getColorFlavor(
3008  $rec["color_code"],
3009  (int) $a_i
3010  );
3011  }
3012  }
3013  }
static _getColorFlavor($a_rgb, $a_i)
Get color flavor.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColors()

ilObjStyleSheet::getColors ( )

Get colors of style.

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

References ilObject\$db, and $ilDB.

Referenced by getXML().

2878  {
2879  $ilDB = $this->db;
2880 
2881  $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2882  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2883  "ORDER BY color_name");
2884 
2885  $colors = array();
2886  while ($rec = $ilDB->fetchAssoc($set)) {
2887  $colors[] = array(
2888  "name" => $rec["color_name"],
2889  "code" => $rec["color_code"]
2890  );
2891  }
2892 
2893  return $colors;
2894  }
global $ilDB
+ Here is the caller graph for this function:

◆ getContentPrintStyle()

static ilObjStyleSheet::getContentPrintStyle ( )
static

get content print style

static

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

Referenced by ilObjPortfolioGUI\printView().

1858  {
1859  return "./Services/COPage/css/print_content.css";
1860  }
+ Here is the caller graph for this function:

◆ getContentStylePath()

static ilObjStyleSheet::getContentStylePath (   $a_style_id,
  $add_random = true,
  $add_token = true 
)
static

get content style path

static (to avoid full reading)

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

References $DIC, $ilSetting, $style, ilObject\_exists(), _lookupUpToDate(), ilUtil\getWebspaceDir(), and ilWACSignedPath\signFile().

Referenced by ilImprintGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilBlogPostingGUI\__construct(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilPageObjectGUI\displayMedia(), ilPCDataTableGUI\editData(), ilObjGroupGUI\executeCommand(), ilTermDefinitionEditorGUI\executeCommand(), ilLOEditorGUI\executeCommand(), ilContainerStartObjectsGUI\executeCommand(), ilObjCategoryGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilAssQuestionHintsGUI\executeCommand(), ilObjRootFolderGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjContentPageGUI\executeCommand(), ilScormExportUtil\exportContentCSS(), ilCOPageHTMLExport\exportStyles(), ilAssQuestionPageCommandForwarder\forward(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ILIAS\Portfolio\Export\PortfolioHtmlExport\getInitialisedTemplate(), ILIAS\Blog\Export\BlogHtmlExport\getInitialisedTemplate(), ilContainerStartObjectsContentGUI\getPageHTML(), ilCOPageHTMLExport\getPreparedMainTemplate(), ilObjStyleSheetGUI\includeCSS(), ilCOPageHTMLExport\initResourceTemplate(), ILIAS\Glossary\Export\GlossaryHtmlExport\initScreen(), ilAssQuestionPreviewGUI\initStyleSheets(), ilObjContentPageGUI\initStyleSheets(), ilGlossaryTermGUI\listDefinitions(), ilLMEditorGUI\main_header(), ilGlossaryPresentationGUI\media(), ilTestServiceGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilObjStyleSheetGUI\outputTagStyleEditScreen(), ilTestPlayerAbstractGUI\populateContentStyleBlock(), ilObjPortfolioGUI\printView(), ilObjStyleSheetGUI\propertiesObject(), ilContentPageKioskModeView\renderContentStyle(), ilSCORM2004ScoGUI\sco_preview(), ilSCORM2004NodeGUI\setContentStyle(), ilGlossaryPresentationGUI\setContentStyles(), ilLMPresentationGUI\setContentStyles(), ilObjPortfolioBaseGUI\setContentStyleSheet(), ilObjGlossaryGUI\setContentStyleSheet(), ilObjWikiGUI\setContentStyleSheet(), ilObjBlogGUI\setContentStyleSheet(), ilPCParagraphGUI\setStyle(), ilAssQuestionFeedbackEditingGUI\showFeedbackFormCmd(), ilStartUpGUI\showLoginPage(), ilObjMediaPoolGUI\showMedia(), ilContainerObjectiveGUI\showObjectives(), ilMediaPoolPageGUI\showPage(), ilObjMediaPoolGUI\showPage(), ilPageObjectGUI\showPage(), ilTestCorrectionsGUI\showSolution(), and ilContObjectManifestBuilder\writeResources().

1810  {
1811  global $DIC;
1812 
1813  $ilSetting = $DIC->settings();
1814 
1815  $random = new \ilRandom();
1816  $rand = $random->int(1, 999999);
1817 
1818 
1819  // check global fixed content style
1820  $fixed_style = $ilSetting->get("fixed_content_style_id");
1821  if ($fixed_style > 0) {
1822  $a_style_id = $fixed_style;
1823  }
1824 
1825  // check global default style
1826  if ($a_style_id <= 0) {
1827  $a_style_id = $ilSetting->get("default_content_style_id");
1828  }
1829 
1830  if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
1831  // check whether file is up to date
1832  if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
1833  $style = new ilObjStyleSheet($a_style_id);
1834  $style->writeCSSFile();
1835  }
1836 
1837  $path = ilUtil::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css";
1838  if ($add_random) {
1839  $path .= "?dummy=$rand";
1840  }
1841  if ($add_token) {
1842  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
1843  $path = ilWACSignedPath::signFile($path);
1844  }
1845 
1846  return $path;
1847  } else { // todo: work this out
1848  return "./Services/COPage/css/content.css";
1849  }
1850  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static _lookupUpToDate($a_id)
Looup up to date.
static signFile($path_to_file)
global $ilSetting
Definition: privfeed.php:17
Class ilObjStyleSheet.
$DIC
Definition: xapitoken.php:46
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 1766 of file class.ilObjStyleSheet.php.

References $DIC, $ilSetting, and ilObject\_lookupType().

Referenced by ilMediaPoolPageGUI\__construct(), ILIAS\LearningModule\Export\LMHtmlExport\__construct(), ilGlossaryPresentationGUI\basicPageGuiInit(), ilLMPresentationGUI\basicPageGuiInit(), ilContentPagePageCommandForwarder\buildEmbeddedPresentationPageObjectGUI(), ILIAS\Wiki\Export\WikiHtmlExport\buildExportFile(), ilContentPagePageCommandForwarder\buildPresentationPageObjectGUI(), ilSCORM2004PageNodeGUI\executeCommand(), ilTermDefinitionEditorGUI\executeCommand(), ilLMPageObjectGUI\executeCommand(), ilLOEditorGUI\executeCommand(), ilContainerStartObjectsGUI\executeCommand(), ilObjWikiGUI\executeCommand(), ilObjSystemFolderGUI\executeCommand(), ilObjBlogGUI\executeCommand(), ILIAS\Services\Export\HTML\Util\exportCOPageFiles(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilContentPagePageCommandForwarder\getPageObjectGUI(), ilContainerExporter\getXmlExportTailDependencies(), ilObjPortfolioBaseGUI\handlePageCall(), ilObjSCORM2004LearningModule\prepareHTMLExporter(), ilContainerObjectiveGUI\renderObjective(), ilDclDetailedViewGUI\renderRecord(), ilGlossaryPresentationGUI\setContentStyles(), ilObjWikiGUI\setContentStyleSheet(), ilLMPresentationGUI\showPrintView(), and ilObjWikiGUI\viewPageObject().

1767  {
1768  global $DIC;
1769 
1770  $ilSetting = $DIC->settings();
1771 
1772  // check global fixed content style
1773  $fixed_style = $ilSetting->get("fixed_content_style_id");
1774  if ($fixed_style > 0) {
1775  $a_style_id = $fixed_style;
1776  }
1777 
1778  // check global default style
1779  if ($a_style_id <= 0) {
1780  $a_style_id = $ilSetting->get("default_content_style_id");
1781  }
1782 
1783  if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty") {
1784  return $a_style_id;
1785  }
1786 
1787  return 0;
1788  }
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilSetting
Definition: privfeed.php:17
$DIC
Definition: xapitoken.php:46
+ 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 2130 of file class.ilObjStyleSheet.php.

References ilObject\getId().

Referenced by createExportSubDirectory(), and export().

2131  {
2132  if ($this->export_sub_dir == "") {
2133  return "sty_" . $this->getId();
2134  } else {
2135  return $this->export_sub_dir;
2136  }
2137  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHideStatus()

ilObjStyleSheet::getHideStatus (   $a_type,
  $a_char 
)

Get characteristic hide status.

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

References $a_type, ilObject\$db, and $ilDB.

1184  {
1185  $ilDB = $this->db;
1186 
1187  $set = $ilDB->query(
1188  "SELECT hide FROM style_char " .
1189  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1190  " type = " . $ilDB->quote($a_type, "text") . " AND " .
1191  " characteristic = " . $ilDB->quote($a_char, "text")
1192  );
1193  $rec = $ilDB->fetchAssoc($set);
1194 
1195  return $rec["hide"];
1196  }
$a_type
Definition: workflow.php:92
global $ilDB

◆ getImages()

ilObjStyleSheet::getImages ( )

Get images of style.

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

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

1346  {
1347  $dir = $this->getImagesDirectory();
1348  $images = array();
1349  if (is_dir($dir)) {
1350  $entries = ilUtil::getDir($dir);
1351  foreach ($entries as $entry) {
1352  if (substr($entry["entry"], 0, 1) == ".") {
1353  continue;
1354  }
1355  if ($entry["type"] != "dir") {
1356  $images[] = $entry;
1357  }
1358  }
1359  }
1360 
1361  return $images;
1362  }
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 1319 of file class.ilObjStyleSheet.php.

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

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

1320  {
1322  }
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:

◆ getMaxMQueryOrderNr()

ilObjStyleSheet::getMaxMQueryOrderNr ( )

Get maximum media query order nr.

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

References ilObject\$db, and $ilDB.

Referenced by addMediaQuery().

3220  {
3221  $ilDB = $this->db;
3222 
3223  $set = $ilDB->query(
3224  "SELECT max(order_nr) mnr FROM sty_media_query " .
3225  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer")
3226  );
3227  $rec = $ilDB->fetchAssoc($set);
3228 
3229  return (int) $rec["mnr"];
3230  }
global $ilDB
+ Here is the caller graph for this function:

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

Get colors of style.

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

References ilObject\$db, and $ilDB.

Referenced by saveMediaQueryOrder(), and writeCSSFile().

3176  {
3177  $ilDB = $this->db;
3178 
3179  $set = $ilDB->query("SELECT * FROM sty_media_query WHERE " .
3180  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
3181  "ORDER BY order_nr");
3182 
3183  $mq = array();
3184  while ($rec = $ilDB->fetchAssoc($set)) {
3185  $mq[] = $rec;
3186  }
3187 
3188  return $mq;
3189  }
global $ilDB
+ Here is the caller graph for this function:

◆ getMediaQueryForId()

ilObjStyleSheet::getMediaQueryForId (   $a_id)

Get media query for id.

Parameters

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

References ilObject\$db, and $ilDB.

3256  {
3257  $ilDB = $this->db;
3258 
3259  $set = $ilDB->query(
3260  "SELECT * FROM sty_media_query " .
3261  " WHERE id = " . $ilDB->quote($a_id, "integer")
3262  );
3263  return $ilDB->fetchAssoc($set);
3264  }
global $ilDB

◆ getMetaData()

& ilObjStyleSheet::getMetaData ( )

get meta data object

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

877  {
878  return $this->meta_data;
879  }

◆ getParametersOfClass()

ilObjStyleSheet::getParametersOfClass (   $a_type,
  $a_class,
  $a_mq_id = 0 
)

Get parameters of class.

Parameters

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

References $a_type.

1797  {
1798  if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1799  return $this->style_class[$a_type][$a_class][$a_mq_id];
1800  }
1801  return array();
1802  }
$a_type
Definition: workflow.php:92

◆ getPlaceHolderStylePath()

static ilObjStyleSheet::getPlaceHolderStylePath ( )
static

get placeholder style path (for Page Layouts)

static

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

Referenced by ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilPCPlaceHolder\getCssFiles(), ilSCORM2004NodeGUI\setContentStyle(), ilPortfolioTemplatePageGUI\showPage(), and ilPageObjectGUI\showPage().

1878  {
1879  return "./Services/COPage/css/placeholder.css";
1880  }
+ 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 595 of file class.ilObjStyleSheet.php.

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

◆ getScope()

ilObjStyleSheet::getScope ( )

Get scope.

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

Referenced by create(), and update().

645  {
646  return $this->scope;
647  }
+ 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 1974 of file class.ilObjStyleSheet.php.

References $style.

Referenced by writeCSSFile().

1975  {
1976  return $this->style;
1977  }
+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

References $parameter.

2364  {
2365  $groups = array();
2366 
2367  foreach (self::$parameter as $parameter => $props) {
2368  $groups[$props["group"]][] = $parameter;
2369  }
2370  return $groups;
2371  }

◆ getSyntaxStylePath()

static ilObjStyleSheet::getSyntaxStylePath ( )
static

get syntax style path

static

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

Referenced by ilImprintGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilWikiPageGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilBlogPostingGUI\__construct(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilObjGlossaryGUI\confirmDefinitionDeletion(), ilTermDefinitionEditorGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjContentPageGUI\executeCommand(), ilCOPageHTMLExport\exportStyles(), ilAssQuestionPageCommandForwarder\forward(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilCOPageHTMLExport\getPreparedMainTemplate(), ilCOPageHTMLExport\initResourceTemplate(), ilAssQuestionPreviewGUI\initStyleSheets(), ilObjContentPageGUI\initStyleSheets(), ilGlossaryTermGUI\listDefinitions(), ilLMEditorGUI\main_header(), ilTestServiceGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\populateSyntaxStyleBlock(), ilObjPortfolioGUI\printView(), ilContentPageKioskModeView\renderContentStyle(), ilSCORM2004NodeGUI\setContentStyle(), ilGlossaryPresentationGUI\setContentStyles(), ilLMPresentationGUI\setContentStyles(), ilObjWikiGUI\setContentStyleSheet(), ilStartUpGUI\showLoginPage(), ilContainerObjectiveGUI\showObjectives(), ilObjMediaPoolGUI\showPage(), and ilTestCorrectionsGUI\showSolution().

1868  {
1869  return "./Services/COPage/css/syntaxhighlight.css";
1870  }
+ Here is the caller graph for this function:

◆ getTemplate()

ilObjStyleSheet::getTemplate (   $a_t_id)

Get template.

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

References ilObject\$db, $ilDB, and getTemplateClasses().

3454  {
3455  $ilDB = $this->db;
3456 
3457  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3458  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
3459  " AND id = " . $ilDB->quote($a_t_id, "integer"));
3460 
3461  if ($rec = $ilDB->fetchAssoc($set)) {
3462  $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3463 
3464  $template = $rec;
3465  return $template;
3466  }
3467  return array();
3468  }
getTemplateClasses($a_tid)
Get template classes.
global $ilDB
+ Here is the call graph for this function:

◆ getTemplateClasses()

ilObjStyleSheet::getTemplateClasses (   $a_tid)

Get template classes.

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

References ilObject\$db, and $ilDB.

Referenced by getTemplate(), and getTemplates().

3340  {
3341  $ilDB = $this->db;
3342  $set = $ilDB->query("SELECT * FROM style_template_class WHERE " .
3343  "template_id = " . $ilDB->quote($a_tid, "integer"));
3344 
3345  $class = array();
3346  while ($rec = $ilDB->fetchAssoc($set)) {
3347  $key = $rec["class_type"];
3348  $class[$key] = $rec["class"];
3349  }
3350 
3351  return $class;
3352  }
global $ilDB
+ Here is the caller graph for this function:

◆ getTemplates()

ilObjStyleSheet::getTemplates (   $a_type)

Get table templates of style.

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

References $a_type, ilObject\$db, $ilDB, $templates, and getTemplateClasses().

Referenced by getTemplateXML(), and getXML().

3319  {
3320  $ilDB = $this->db;
3321 
3322  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3323  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3324  "temp_type = " . $ilDB->quote($a_type, "text") . " " .
3325  "ORDER BY name");
3326 
3327  $templates = array();
3328  while ($rec = $ilDB->fetchAssoc($set)) {
3329  $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3330  $templates[] = $rec;
3331  }
3332 
3333  return $templates;
3334  }
$a_type
Definition: workflow.php:92
getTemplateClasses($a_tid)
Get template classes.
global $ilDB
+ 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 3500 of file class.ilObjStyleSheet.php.

References Vendor\Package\$c, ilObject\$db, $ilDB, ilObject\$type, _getTemplateClassTypes(), and getTemplates().

3501  {
3502  $ilDB = $this->db;
3503 
3504  $tag = "<StyleTemplates>";
3505 
3506  $ttypes = array("table", "vaccordion", "haccordion", "carousel");
3507 
3508  foreach ($ttypes as $ttype) {
3509  $ts = $this->getTemplates($ttype);
3510 
3511  foreach ($ts as $t) {
3513  /*$atts = array("table" => "TableClass",
3514  "caption" => "CaptionClass",
3515  "row_head" => "RowHeadClass",
3516  "row_foot" => "RowFootClass",
3517  "col_head" => "ColHeadClass",
3518  "col_foot" => "ColFootClass",
3519  "odd_row" => "OddRowClass",
3520  "even_row" => "EvenRowClass",
3521  "odd_col" => "OddColClass",
3522  "even_col" => "EvenColClass");*/
3523  $c = $t["classes"];
3524 
3525  $tag .= '<StyleTemplate Name="' . $t["name"] . '">';
3526 
3527  foreach ($atts as $type => $t) {
3528  if ($c[$type] != "") {
3529  $tag .= '<StyleClass Type="' . $type . '" Value="' . $c[$type] . '" />';
3530  }
3531  }
3532 
3533  $tag .= "</StyleTemplate>";
3534  }
3535  }
3536 
3537  $tag .= "</StyleTemplates>";
3538 
3539  //echo htmlentities($tag);
3540  return $tag;
3541  }
static _getTemplateClassTypes($a_template_type="")
Get template class types.
getTemplates($a_type)
Get table templates of style.
global $ilDB
+ Here is the call graph for this function:

◆ getThumbnailsDirectory()

ilObjStyleSheet::getThumbnailsDirectory ( )

Get thumbnails directory.

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

References getImagesDirectory().

Referenced by deleteImage(), and uploadImage().

1337  {
1338  return $this->getImagesDirectory() .
1339  "/thumbnails";
1340  }
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 628 of file class.ilObjStyleSheet.php.

629  {
630  return $this->up_to_date;
631  }

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

References Vendor\Package\$c, $style, $xml, _determineTag(), _getTemplateClassTypes(), getColors(), ilObject\getDescription(), getTemplates(), ilObject\getTitle(), and handleXmlString().

Referenced by exportXML().

2004  {
2005  $xml .= "<StyleSheet>\n";
2006 
2007  // title and description
2008  $xml .= "<Title>" . $this->handleXmlString($this->getTitle()) . "</Title>";
2009  $xml .= "<Description>" . $this->handleXmlString($this->getDescription()) . "</Description>\n";
2010 
2011  // style classes
2012  foreach ($this->chars as $char) {
2013  $xml .= "<Style Tag=\"" . ilObjStyleSheet::_determineTag($char["type"]) .
2014  "\" Type=\"" . $char["type"] . "\" Class=\"" . $char["class"] . "\">\n";
2015  foreach ($this->style as $style) {
2016  if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"]) {
2017  foreach ($style as $tag) {
2018  $xml .= "<StyleParameter Name=\"" . $tag["parameter"] . "\" Value=\"" . $tag["value"] . "\" Custom=\"" . $tag["custom"] . "\" />\n";
2019  }
2020  }
2021  }
2022  $xml .= "</Style>\n";
2023  }
2024 
2025  // colors
2026  foreach ($this->getColors() as $color) {
2027  $xml .= "<StyleColor Name=\"" . $color["name"] . "\" Code=\"" . $color["code"] . "\"/>\n";
2028  }
2029 
2030  // templates
2032  foreach ($tcts as $tct => $v) {
2033  $ts = $this->getTemplates($tct);
2034 
2035  foreach ($ts as $t) {
2036  $xml .= "<StyleTemplate Type=\"" . $tct . "\" Name=\"" . $t["name"] . "\">\n";
2037  foreach ($t["classes"] as $ct => $c) {
2038  if ($c != "") {
2039  $xml .= "<StyleTemplateClass ClassType=\"" . $ct . "\" Class=\"" . $c . "\"/>\n";
2040  }
2041  }
2042  $xml .= "</StyleTemplate>\n";
2043  }
2044  }
2045 
2046 
2047  $xml .= "</StyleSheet>";
2048  //echo "<pre>".htmlentities($xml)."</pre>"; exit;
2049  return $xml;
2050  }
static _getTemplateClassTypes($a_template_type="")
Get template class types.
getColors()
Get colors of style.
static _determineTag($a_type)
handleXmlString($a_str)
Handle xml strin.
getTitle()
get object title public
getDescription()
get object description
$xml
Definition: metadata.php:332
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 1994 of file class.ilObjStyleSheet.php.

Referenced by getXML().

1995  {
1996  return str_replace("&", "&amp;", $a_str);
1997  }
+ Here is the caller graph for this function:

◆ 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 1204 of file class.ilObjStyleSheet.php.

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

1205  {
1206  $lng = $this->lng;
1207 
1208  $lng->loadLanguageModule("style");
1209 
1210  $new_obj = new ilObjStyleSheet();
1211  $new_obj->setTitle($this->getTitle() . " (" . $lng->txt("sty_acopy") . ")");
1212  $new_obj->setType($this->getType());
1213  $new_obj->setDescription($this->getDescription());
1214  $new_obj->create($this->getId());
1215 
1216  $new_obj->writeStyleSetting(
1217  "disable_auto_margins",
1218  $this->lookupStyleSetting("disable_auto_margins")
1219  );
1220 
1221  return $new_obj->getId();
1222  }
lookupStyleSetting($a_name)
Lookup style setting.
getId()
get object id public
getTitle()
get object title public
getDescription()
get object description
getType()
get object type public
Class ilObjStyleSheet.
+ Here is the call graph for this function:

◆ import()

ilObjStyleSheet::import (   $a_file)

Import.

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

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

2223  {
2224  parent::create();
2225 
2226  $im_dir = $this->createImportDirectory();
2227 
2228  // handle uploaded files
2229  if (is_array($a_file)) {
2231  $a_file["tmp_name"],
2232  $a_file["name"],
2233  $im_dir . "/" . $a_file["name"]
2234  );
2235  $file_name = $a_file["name"];
2236  } else { // handle not directly uploaded files
2237  $pi = pathinfo($a_file);
2238  $file_name = $pi["basename"];
2239  copy($a_file, $im_dir . "/" . $file_name);
2240  }
2241  $file = pathinfo($file_name);
2242 
2243  // unzip file
2244  if (strtolower($file["extension"] == "zip")) {
2245  ilUtil::unzip($im_dir . "/" . $file_name);
2246  $subdir = basename($file["basename"], "." . $file["extension"]);
2247  if (!is_dir($im_dir . "/" . $subdir)) {
2248  $subdir = "style"; // check style subdir
2249  }
2250  $xml_file = $im_dir . "/" . $subdir . "/style.xml";
2251  } else { // handle xml file directly (old style)
2252  $xml_file = $im_dir . "/" . $file_name;
2253  }
2254 
2255  // load information from xml file
2256  //echo "-$xml_file-";
2257  $this->createFromXMLFile($xml_file, true);
2258 
2259  // copy images
2260  $this->createImagesDirectory();
2261  if (is_dir($im_dir . "/" . $subdir . "/images")) {
2262  ilUtil::rCopy(
2263  $im_dir . "/" . $subdir . "/images",
2264  $this->getImagesDirectory()
2265  );
2266  }
2267 
2269  $this->read();
2270  $this->writeCSSFile();
2271  }
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
getImagesDirectory()
Get images 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 todo: add mq_id and custom
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:

◆ isCoreStyle()

static ilObjStyleSheet::isCoreStyle (   $a_type,
  $a_class 
)
static

Is core style.

Parameters

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

References $a_type.

2473  {
2474  foreach (self::$core_styles as $s) {
2475  if ($s["type"] == $a_type && $s["class"] == $a_class) {
2476  return true;
2477  }
2478  }
2479  return false;
2480  }
$a_type
Definition: workflow.php:92

◆ lookupObjectForStyle()

static ilObjStyleSheet::lookupObjectForStyle (   $a_style_id)
static

Lookup object style.

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

References $DIC, $ilDB, and ilObject\_lookupType().

3697  {
3698  global $DIC;
3699 
3700  $ilDB = $DIC->database();
3701 
3702  $obj_ids = array();
3703  if (ilObject::_lookupType($a_style_id) == "sty") {
3704  $set = $ilDB->query(
3705  "SELECT DISTINCT obj_id FROM style_usage " .
3706  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer")
3707  );
3708 
3709  while ($rec = $ilDB->fetchAssoc($set)) {
3710  $obj_ids[] = $rec["obj_id"];
3711  }
3712  }
3713  return $obj_ids;
3714  }
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ lookupObjectStyle()

static ilObjStyleSheet::lookupObjectStyle (   $a_obj_id)
static

Lookup object style.

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

References $DIC, $ilDB, and ilObject\_lookupType().

Referenced by ilObjCategoryGUI\afterSave(), ilObjBlog\doRead(), ilObjPortfolioBase\doRead(), ilStyleDataSet\getDependencies(), ilBlogExporter\getXmlExportTailDependencies(), ilContainerExporter\getXmlExportTailDependencies(), ilBlogDataSet\getXmlRecord(), ilObjGlossary\read(), ilObjWiki\read(), ilContainer\read(), and ilContainerXmlWriter\writeSubitems().

3675  {
3676  global $DIC;
3677 
3678  $ilDB = $DIC->database();
3679 
3680  $set = $ilDB->query(
3681  "SELECT style_id FROM style_usage " .
3682  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
3683  );
3684  $rec = $ilDB->fetchAssoc($set);
3685 
3686  if (ilObject::_lookupType($rec["style_id"]) == "sty") {
3687  return (int) $rec["style_id"];
3688  }
3689 
3690  return 0;
3691  }
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 3639 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by ilClone().

3640  {
3641  $ilDB = $this->db;
3642 
3643  $set = $ilDB->query(
3644  "SELECT value FROM style_setting " .
3645  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
3646  " AND name = " . $ilDB->quote($a_name, "text")
3647  );
3648  $rec = $ilDB->fetchAssoc($set);
3649 
3650  return $rec["value"];
3651  }
global $ilDB
+ Here is the caller graph for this function:

◆ lookupTemplateName()

ilObjStyleSheet::lookupTemplateName (   $a_t_id)

Lookup table template name for template ID.

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

3474  {
3475  return self::_lookupTemplateName($a_t_id);
3476  }

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview (   $a_t_id)

Lookup table template preview.

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

References ilObject\$db, and $ilDB.

3567  {
3568  $ilDB = $this->db;
3569 
3570  $set = $ilDB->query("SELECT preview FROM style_template " .
3571  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3572  if ($rec = $ilDB->fetchAssoc($set)) {
3573  return $rec["preview"];
3574  }
3575 
3576  return "";
3577  }
global $ilDB

◆ putInTree()

ilObjStyleSheet::putInTree (   $a_parent_ref)

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

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

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

◆ read()

ilObjStyleSheet::read ( )

read style properties

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

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

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

1534  {
1535  $ilDB = $this->db;
1536 
1537  parent::read();
1538 
1539  $q = "SELECT * FROM style_parameter WHERE style_id = " .
1540  $ilDB->quote($this->getId(), "integer") . " ORDER BY tag, class, type, mq_id ";
1541  $style_set = $ilDB->query($q);
1542  $ctag = "";
1543  $cclass = "";
1544  $ctype = "";
1545  $cmq_id = 0;
1546  $this->style = array();
1547  // workaround for bug #17586, see also http://stackoverflow.com/questions/3066356/multiple-css-classes-properties-overlapping-based-on-the-order-defined
1548  // e.g. ha_iheada must be written after ha_ihead, since they are acting on the same dom node
1549  // styles that must be added at the end
1550  $this->end_styles = array();
1551  while ($style_rec = $ilDB->fetchAssoc($style_set)) {
1552  if ($style_rec["tag"] != $ctag || $style_rec["class"] != $cclass
1553  || $style_rec["type"] != $ctype || $style_rec["mq_id"] != $cmq_id) {
1554  // add current tag array to style array
1555  if (is_array($tag)) {
1556  if (in_array($ctype, array("ha_iheada", "va_iheada"))) {
1557  $this->end_styles[] = $tag;
1558  } else {
1559  $this->style[] = $tag;
1560  }
1561  }
1562  $tag = array();
1563  }
1564  $ctag = $style_rec["tag"];
1565  $cclass = $style_rec["class"];
1566  $ctype = $style_rec["type"];
1567  $cmq_id = $style_rec["mq_id"];
1568  $tag[] = $style_rec;
1569  // added $cmq_id
1570  $this->style_class[$ctype][$cclass][$cmq_id][$style_rec["parameter"]] = $style_rec["value"];
1571  }
1572  if (is_array($tag)) {
1573  $this->style[] = $tag;
1574  }
1575  foreach ($this->end_styles as $s) {
1576  $this->style[] = $s;
1577  }
1578  //var_dump($this->style_class);
1579  $q = "SELECT * FROM style_data WHERE id = " .
1580  $ilDB->quote($this->getId(), "integer");
1581  $res = $ilDB->query($q);
1582  $sty = $ilDB->fetchAssoc($res);
1583  $this->setUpToDate((boolean) $sty["uptodate"]);
1584  $this->setScope($sty["category"]);
1585 
1586  // get style characteristics records
1587  $this->chars = array();
1588  $this->chars_by_type = array();
1589  $q = "SELECT * FROM style_char WHERE style_id = " .
1590  $ilDB->quote($this->getId(), "integer") .
1591  " ORDER BY type ASC, characteristic ASC";
1592  $par_set = $ilDB->query($q);
1593  while ($par_rec = $ilDB->fetchAssoc($par_set)) {
1594  $this->chars[] = array("type" => $par_rec["type"], "class" => $par_rec["characteristic"], "hide" => $par_rec["hide"]);
1595  $this->chars_by_type[$par_rec["type"]][] = $par_rec["characteristic"];
1596  if ($par_rec["hide"]) {
1597  $this->hidden_chars[$par_rec["type"] . ":" . $par_rec["characteristic"]] = true;
1598  }
1599  }
1600  // var_dump($this->style); exit;
1601  }
setScope($a_scope)
Set scope.
foreach($_POST as $key=> $value) $res
getId()
get object id public
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
global $ilDB
+ 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 2961 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

2962  {
2963  $ilDB = $this->db;
2964 
2965  $ilDB->manipulate("DELETE FROM style_color WHERE " .
2966  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2967  " color_name = " . $ilDB->quote($a_name, "text"));
2968  }
global $ilDB

◆ removeTemplate()

ilObjStyleSheet::removeTemplate (   $a_t_id)

Remove table template.

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

References ilObject\$db, and $ilDB.

3602  {
3603  $ilDB = $this->db;
3604 
3605  $ilDB->manipulate("DELETE FROM style_template WHERE " .
3606  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3607  " id = " . $ilDB->quote($a_t_id, "integer"));
3608 
3609  $ilDB->manipulate(
3610  "DELETE FROM style_template_class WHERE " .
3611  "template_id = " . $ilDB->quote($a_t_id, "integer")
3612  );
3613  }
global $ilDB

◆ replaceStylePar()

ilObjStyleSheet::replaceStylePar (   $a_tag,
  $a_class,
  $a_par,
  $a_val,
  $a_type,
  $a_mq_id = 0,
  $a_custom = false 
)

Set style parameter per tag/class/parameter.

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

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

Referenced by copyCharacteristic(), and updateColor().

1918  {
1919  ilObjStyleSheet::_replaceStylePar($this->getId(), $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id, $a_custom);
1920  }
$a_type
Definition: workflow.php:92
getId()
get object id public
static _replaceStylePar($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
+ 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 1167 of file class.ilObjStyleSheet.php.

References $a_type, ilObject\$db, $ilDB, and ilObject\getId().

1168  {
1169  $ilDB = $this->db;
1170 
1171  $ilDB->manipulate(
1172  "UPDATE style_char SET " .
1173  " hide = " . $ilDB->quote((int) $a_hide, "integer") .
1174  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1175  " type = " . $ilDB->quote($a_type, "text") . " AND " .
1176  " characteristic = " . $ilDB->quote($a_char, "text")
1177  );
1178  }
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ saveMediaQueryOrder()

ilObjStyleSheet::saveMediaQueryOrder (   $a_order_nr = null)

Save media query order.

Parameters
int$a_order_nrorder nr

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

References ilObject\$db, $ilDB, getMediaQueries(), and ilUtil\sortArray().

Referenced by deleteMediaQuery().

3289  {
3290  $ilDB = $this->db;
3291 
3292  $mqueries = $this->getMediaQueries();
3293  if (is_array($a_order_nr)) {
3294  foreach ($mqueries as $k => $mq) {
3295  $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
3296  }
3297  $mqueries = ilUtil::sortArray($mqueries, "order_nr", "", true);
3298  }
3299  $cnt = 10;
3300  foreach ($mqueries as $mq) {
3301  $ilDB->manipulate(
3302  "UPDATE sty_media_query SET " .
3303  " order_nr = " . $ilDB->quote($cnt, "integer") .
3304  " WHERE id = " . $ilDB->quote($mq["id"], "integer")
3305  );
3306  $cnt += 10;
3307  }
3308  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $ilDB
getMediaQueries()
Get colors of style.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCharacteristics()

ilObjStyleSheet::setCharacteristics (   $a_chars)

Set characteristics.

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

1159  {
1160  $this->chars = $a_chars;
1161  // $this->chars_by_type[$a_type];
1162  }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir (   $a_dir)

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

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

Referenced by ilContObjectExport\buildExportFileXML().

2123  {
2124  $this->export_sub_dir = $a_dir;
2125  }
+ Here is the caller graph for this function:

◆ setRefId()

ilObjStyleSheet::setRefId (   $a_ref_id)

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

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

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

◆ setScope()

ilObjStyleSheet::setScope (   $a_scope)

Set scope.

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

Referenced by read().

637  {
638  $this->scope = $a_scope;
639  }
+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle (   $a_style)

set styles

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

1983  {
1984  $this->style = $a_style;
1985  }

◆ setUpToDate()

ilObjStyleSheet::setUpToDate (   $a_up_to_date = true)

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

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

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

621  {
622  $this->up_to_date = $a_up_to_date;
623  }
+ Here is the caller graph for this function:

◆ templateExists()

ilObjStyleSheet::templateExists (   $a_template_name)

Check whether template exists.

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

References ilObject\$db, and $ilDB.

3438  {
3439  $ilDB = $this->db;
3440 
3441  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3442  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3443  "name = " . $ilDB->quote($a_template_name, "text"));
3444  if ($rec = $ilDB->fetchAssoc($set)) {
3445  return true;
3446  }
3447  return false;
3448  }
global $ilDB

◆ update()

ilObjStyleSheet::update ( )

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

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

Referenced by createFromXMLFile().

1883  {
1884  $ilDB = $this->db;
1885 
1886  parent::update();
1887  $this->read(); // this could be done better
1888  $this->writeCSSFile();
1889 
1890  $q = "UPDATE style_data " .
1891  "SET category = " . $ilDB->quote((int) $this->getScope(), "integer") .
1892  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
1893  $ilDB->manipulate($q);
1894  }
read()
read style properties
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
getId()
get object id public
global $ilDB
+ 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 2914 of file class.ilObjStyleSheet.php.

References ilObject\$db, $ilDB, _writeUpToDate(), ilObject\getId(), and replaceStylePar().

2915  {
2916  $ilDB = $this->db;
2917 
2918  // todo: update names in parameters as well
2919 
2920  $ilDB->manipulate("UPDATE style_color SET " .
2921  "color_name = " . $ilDB->quote($a_new_name, "text") . ", " .
2922  "color_code = " . $ilDB->quote($a_code, "text") .
2923  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
2924  " AND color_name = " . $ilDB->quote($a_name, "text"));
2925  ilObjStyleSheet::_writeUpToDate($this->getId(), false);
2926 
2927  // rename also the name in the style parameter values
2928  if ($a_name != $a_new_name) {
2929  $set = $ilDB->query("SELECT * FROM style_parameter " .
2930  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
2931  " AND (" .
2932  " parameter = " . $ilDB->quote("background-color", "text") . " OR " .
2933  " parameter = " . $ilDB->quote("color", "text") . " OR " .
2934  " parameter = " . $ilDB->quote("border-color", "text") . " OR " .
2935  " parameter = " . $ilDB->quote("border-top-color", "text") . " OR " .
2936  " parameter = " . $ilDB->quote("border-bottom-color", "text") . " OR " .
2937  " parameter = " . $ilDB->quote("border-left-color", "text") . " OR " .
2938  " parameter = " . $ilDB->quote("border-right-color", "text") .
2939  ")");
2940  while ($rec = $ilDB->fetchAssoc($set)) {
2941  if ($rec["value"] == "!" . $a_name ||
2942  is_int(strpos($rec["value"], "!" . $a_name . "("))) {
2943  // parameter is based on color -> rename it
2944  $this->replaceStylePar(
2945  $rec["tag"],
2946  $rec["class"],
2947  $rec["parameter"],
2948  str_replace($a_name, $a_new_name, $rec["value"]),
2949  $rec["type"],
2950  $rec["mq_id"],
2951  $rec["custom"]
2952  );
2953  }
2954  }
2955  }
2956  }
getId()
get object id public
replaceStylePar($a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
Set style parameter per tag/class/parameter.
global $ilDB
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
+ Here is the call graph for this function:

◆ updateMediaQuery()

ilObjStyleSheet::updateMediaQuery (   $a_id,
  $a_mquery 
)

Update media query.

Parameters
int$a_idid
string$a_mquerymedia query

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

References ilObject\$db, and $ilDB.

3239  {
3240  $ilDB = $this->db;
3241 
3242  $ilDB->manipulate(
3243  "UPDATE sty_media_query SET " .
3244  " mquery = " . $ilDB->quote($a_mquery, "text") .
3245  " WHERE id = " . $ilDB->quote($a_id, "integer")
3246  );
3247  }
global $ilDB

◆ 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 1902 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

1903  {
1904  $ilDB = $this->db;
1905 
1906  $q = "UPDATE style_parameter SET VALUE = " .
1907  $ilDB->quote($a_value, "text") . " WHERE id = " .
1908  $ilDB->quote($a_id, "integer");
1909  $style_set = $ilDB->manipulate($q);
1910  }
global $ilDB

◆ updateTemplate()

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

Update table template.

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

References Vendor\Package\$c, ilObject\$db, and $ilDB.

3395  {
3396  $ilDB = $this->db;
3397 
3398  $ilDB->manipulate("UPDATE style_template SET " .
3399  "name = " . $ilDB->quote($a_name, "text") .
3400  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3401 
3402  $ilDB->manipulate(
3403  "DELETE FROM style_template_class WHERE " .
3404  "template_id = " . $ilDB->quote($a_t_id, "integer")
3405  );
3406  foreach ($a_classes as $t => $c) {
3407  $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3408  "(template_id, class_type, class)" .
3409  " VALUES (" .
3410  $ilDB->quote($a_t_id, "integer") . "," .
3411  $ilDB->quote($t, "text") . "," .
3412  $ilDB->quote($c, "text") .
3413  ")");
3414  }
3415  }
global $ilDB

◆ uploadImage()

ilObjStyleSheet::uploadImage (   $a_file)

Upload image.

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

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

1368  {
1369  $this->createImagesDirectory();
1371  $a_file["tmp_name"],
1372  $a_file["name"],
1373  $this->getImagesDirectory() . "/" . $a_file["name"]
1374  );
1376  $this->getImagesDirectory() . "/" . $a_file["name"],
1377  $this->getThumbnailsDirectory() . "/" . $a_file["name"],
1378  75,
1379  75
1380  );
1381  }
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 1606 of file class.ilObjStyleSheet.php.

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

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

1607  {
1608  $style = $this->getStyle();
1609 
1610  if (!is_dir(ilUtil::getWebspaceDir() . "/css")) {
1612  }
1613 
1614  if ($a_target_file == "") {
1615  $css_file_name = ilUtil::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1616  } else {
1617  $css_file_name = $a_target_file;
1618  }
1619  $css_file = fopen($css_file_name, "w");
1620 
1621  $page_background = "";
1622 
1623  $mqs = array(array("mquery" => "", "id" => 0));
1624  foreach ($this->getMediaQueries() as $mq) {
1625  $mqs[] = $mq;
1626  }
1627 
1628  // iterate all media queries
1629  foreach ($mqs as $mq) {
1630  if ($mq["id"] > 0) {
1631  fwrite($css_file, "@media " . $mq["mquery"] . " {\n");
1632  }
1633  reset($style);
1634  foreach ($style as $tag) {
1635  if ($tag[0]["mq_id"] != $mq["id"]) {
1636  continue;
1637  }
1638  fwrite($css_file, $tag[0]["tag"] . ".ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1639  // echo "<br>";
1640  // var_dump($tag[0]["type"]);
1641  if ($tag[0]["tag"] == "td") {
1642  fwrite($css_file, ",th" . ".ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1643  }
1644  if (in_array($tag[0]["tag"], array("h1", "h2", "h3"))) {
1645  fwrite($css_file, ",div.ilc_text_block_" . $tag[0]["class"] . "\n");
1646  fwrite($css_file, ",body.ilc_text_block_" . $tag[0]["class"] . "\n");
1647  }
1648  if ($tag[0]["type"] == "section") { // sections can use a tags, if links are used
1649  fwrite($css_file, ",a.ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1650  }
1651  if ($tag[0]["type"] == "text_block") {
1652  fwrite($css_file, ",body.ilc_text_block_" . $tag[0]["class"] . "\n");
1653  }
1654  fwrite($css_file, "{\n");
1655 
1656  // collect table border attributes
1657  $t_border = array();
1658 
1659  foreach ($tag as $par) {
1660  $cur_par = $par["parameter"];
1661  $cur_val = $par["value"];
1662 
1663  // replace named colors
1664  if (is_int(strpos($cur_par, "color")) && substr(trim($cur_val), 0, 1) == "!") {
1665  $cur_val = $this->getColorCodeForName(substr($cur_val, 1));
1666  }
1667 
1668  if ($tag[0]["type"] == "table" && is_int(strpos($par["parameter"], "border"))) {
1669  $t_border[$cur_par] = $cur_val;
1670  }
1671 
1672  if (in_array($cur_par, array("background-image", "list-style-image"))) {
1673  if (is_int(strpos($cur_val, "/"))) { // external
1674  $cur_val = "url(" . $cur_val . ")";
1675  } else { // internal
1676  if ($a_image_dir == "") {
1677  $cur_val = "url(../sty/sty_" . $this->getId() . "/images/" . $cur_val . ")";
1678  } else {
1679  $cur_val = "url(" . $a_image_dir . "/" . $cur_val . ")";
1680  }
1681  }
1682  }
1683 
1684  if ($cur_par == "opacity") {
1685  $cur_val = ((int) $cur_val) / 100;
1686  }
1687 
1688  fwrite($css_file, "\t" . $cur_par . ": " . $cur_val . ";\n");
1689 
1690  // IE6 fix for minimum height
1691  if ($cur_par == "min-height") {
1692  fwrite($css_file, "\t" . "height" . ": " . "auto !important" . ";\n");
1693  fwrite($css_file, "\t" . "height" . ": " . $cur_val . ";\n");
1694  }
1695 
1696  // opacity fix
1697  if ($cur_par == "opacity") {
1698  fwrite($css_file, "\t" . '-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . ($cur_val * 100) . ')"' . ";\n");
1699  fwrite($css_file, "\t" . 'filter: alpha(opacity=' . ($cur_val * 100) . ')' . ";\n");
1700  fwrite($css_file, "\t" . '-moz-opacity: ' . $cur_val . ";\n");
1701  }
1702 
1703  // transform fix
1704  if ($cur_par == "transform") {
1705  fwrite($css_file, "\t" . '-webkit-transform: ' . $cur_val . ";\n");
1706  fwrite($css_file, "\t" . '-moz-transform: ' . $cur_val . ";\n");
1707  fwrite($css_file, "\t" . '-ms-transform: ' . $cur_val . ";\n");
1708  }
1709 
1710  // transform-origin fix
1711  if ($cur_par == "transform-origin") {
1712  fwrite($css_file, "\t" . '-webkit-transform-origin: ' . $cur_val . ";\n");
1713  fwrite($css_file, "\t" . '-moz-transform-origin: ' . $cur_val . ";\n");
1714  fwrite($css_file, "\t" . '-ms-transform-origin: ' . $cur_val . ";\n");
1715  }
1716 
1717  // save page background
1718  if ($tag[0]["tag"] == "div" && $tag[0]["class"] == "Page"
1719  && $cur_par == "background-color") {
1720  $page_background = $cur_val;
1721  }
1722  }
1723  fwrite($css_file, "}\n");
1724  fwrite($css_file, "\n");
1725 
1726  // use table border attributes for th td as well
1727  /* if ($tag[0]["type"] == "table")
1728  {
1729  if (count($t_border) > 0)
1730  {
1731  fwrite ($css_file, $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." th,".
1732  $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." td\n");
1733  fwrite ($css_file, "{\n");
1734  foreach ($t_border as $p => $v)
1735  {
1736  // fwrite ($css_file, "\t".$p.": ".$v.";\n");
1737  }
1738  fwrite ($css_file, "}\n");
1739  fwrite ($css_file, "\n");
1740  }
1741  }*/
1742  }
1743 
1744  if ($page_background != "") {
1745  fwrite($css_file, "td.ilc_Page\n");
1746  fwrite($css_file, "{\n");
1747  fwrite($css_file, "\t" . "background-color: " . $page_background . ";\n");
1748  fwrite($css_file, "}\n");
1749  }
1750  if ($mq["id"] > 0) {
1751  fwrite($css_file, "}\n");
1752  }
1753  }
1754  fclose($css_file);
1755  // exit;
1756  $this->setUpToDate(true);
1757  $this->_writeUpToDate($this->getId(), true);
1758  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
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
getColorCodeForName($a_name)
Remove a color.
static getWebspaceDir($mode="filesystem")
get webspace directory
getMediaQueries()
Get colors of style.
static _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:

◆ writeStyleSetting()

ilObjStyleSheet::writeStyleSetting (   $a_name,
  $a_value 
)

Write Style Setting.

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

References ilObject\$db, and $ilDB.

3619  {
3620  $ilDB = $this->db;
3621 
3622  $ilDB->manipulate(
3623  "DELETE FROM style_setting WHERE " .
3624  " style_id = " . $ilDB->quote($this->getId(), "integer") .
3625  " AND name = " . $ilDB->quote($a_name, "text")
3626  );
3627 
3628  $ilDB->manipulate("INSERT INTO style_setting " .
3629  "(style_id, name, value) VALUES (" .
3630  $ilDB->quote($this->getId(), "integer") . "," .
3631  $ilDB->quote($a_name, "text") . "," .
3632  $ilDB->quote($a_value, "text") .
3633  ")");
3634  }
global $ilDB

◆ writeStyleUsage()

static ilObjStyleSheet::writeStyleUsage (   $a_obj_id,
  $a_style_id 
)
static

Write style usage.

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

References $DIC, and $ilDB.

Referenced by ilObjCategoryGUI\afterSave(), ilObjGlossary\create(), ilObjWiki\create(), ilContainer\create(), ilObjBlog\doUpdate(), ilObjPortfolioBase\doUpdate(), ilBlogImporter\finalProcessing(), ilContainerImporter\finalProcessing(), ilStyleDataSet\importRecord(), ilObjWiki\update(), ilObjGlossary\update(), and ilContainer\update().

3657  {
3658  global $DIC;
3659 
3660  $ilDB = $DIC->database();
3661 
3662  $ilDB->replace(
3663  "style_usage",
3664  array(
3665  "obj_id" => array("integer", (int) $a_obj_id)),
3666  array(
3667  "style_id" => array("integer", (int) $a_style_id))
3668  );
3669  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ writeTemplatePreview()

ilObjStyleSheet::writeTemplatePreview (   $a_t_id,
  $a_preview_html 
)

Write table template preview.

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

References ilObject\$db, and $ilDB.

Referenced by addTemplate().

3547  {
3548  $ilDB = $this->db;
3549  $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3550  $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3551  $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3552  //echo "1-".strlen($a_preview_html)."-";
3553  //echo htmlentities($a_preview_html);
3554  if (strlen($a_preview_html) > 4000) {
3555  //echo "2";
3556  $a_preview_html = "";
3557  }
3558  $ilDB->manipulate("UPDATE style_template SET " .
3559  "preview = " . $ilDB->quote($a_preview_html, "text") .
3560  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3561  }
global $ilDB
+ Here is the caller graph for this function:

Field Documentation

◆ $assigned_tags

ilObjStyleSheet::$assigned_tags
static

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

◆ $basic_style_dom

ilObjStyleSheet::$basic_style_dom
staticprotected

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

◆ $basic_style_file

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

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

◆ $basic_style_image_dir

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

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

◆ $basic_style_zip

ilObjStyleSheet::$basic_style_zip = "./libs/ilias/Style/basic_style/style.zip"
staticprotected

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

◆ $core_styles

ilObjStyleSheet::$core_styles
static

◆ $expandable_types

ilObjStyleSheet::$expandable_types
static
Initial value:
= array(
"text_block", "text_inline", "section", "media_cont", "table", "table_cell", "flist_li", "table_caption",
"list_o", "list_u",
"va_cntr", "va_icntr", "va_ihead", "va_iheada", "va_ihcap", "va_icont",
"ha_cntr", "ha_icntr", "ha_ihead", "ha_iheada", "ha_ihcap", "ha_icont",
"ca_cntr", "ca_icntr", "ca_ihead", "ca_icont"
)

Definition at line 270 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", "figure"))

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

◆ $hideable_types

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

Definition at line 279 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 381 of file class.ilObjStyleSheet.php.

◆ $style

◆ $style_super_types

ilObjStyleSheet::$style_super_types
static
Initial value:
= array(
"text_block" => array("text_block", "heading1", "heading2", "heading3", "code_block"),
"text_inline" => array("text_inline", "sub", "sup", "code_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_iheada", "va_ihcap", "va_icont",
"ha_cntr", "ha_icntr", "ha_ihead", "ha_iheada", "ha_ihcap", "ha_icont", "ca_cntr", "ca_icntr", "ca_ihead", "ca_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 247 of file class.ilObjStyleSheet.php.

◆ $templates

ilObjStyleSheet::$templates
static

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

Referenced by create(), and getTemplates().


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