ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilObjStyleSheet Class Reference

Class ilObjStyleSheet. More...

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

Public Member Functions

 __construct (int $a_id=0, bool $a_call_by_reference=false)
 
 setUpToDate (bool $a_up_to_date=true)
 Set style up to date (false + update will trigger css generation next time) More...
 
 getUpToDate ()
 
 setScope (int $a_scope)
 
 getScope ()
 
 create (int $a_from_style=0, bool $a_import_mode=false)
 Create a new style. More...
 
 characteristicExists (string $a_char, string $a_style_type)
 Check whether characteristic exists. More...
 
 addCharacteristic (string $a_type, string $a_char, bool $a_hidden=false, int $order_nr=0, bool $outdated=false)
 
 getCharacteristics (string $a_type="", bool $a_no_hidden=false, bool $a_include_core=true)
 Get characteristics. More...
 
 hasCharacteristic (string $type, string $char)
 
 setCharacteristics (array $a_chars)
 
 saveHideStatus (string $a_type, string $a_char, bool $a_hide)
 Save characteristic hidden status. More...
 
 getHideStatus (string $a_type, string $a_char)
 Get characteristic hidden status. More...
 
 ilClone ()
 clone style sheet (note: styles have no ref ids and return an object id) More...
 
 copyImagesToDir (string $a_target)
 Copy images to directory. More...
 
 addParameter (string $a_tag, string $a_par, string $a_type, int $a_mq_id=0, bool $a_custom=false)
 write style parameter to db More...
 
 createImagesDirectory ()
 Create images directory <data_dir>/sty/sty_<id>/images. More...
 
 getImagesDirectory ()
 
 getThumbnailsDirectory ()
 
 deleteParameter (int $a_id)
 delete style parameter More...
 
 deleteCustomStylePars (string $a_tag, string $a_class, string $a_type, int $a_mq_id=0)
 Delete style parameter by tag/class/parameter. More...
 
 deleteStyleParOfChar (string $a_type, string $a_class)
 Delete style parameters of characteristic. More...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 read ()
 read style properties More...
 
 writeCSSFile (string $a_target_file="", string $a_image_dir="")
 write css file to webspace directory More...
 
 getParametersOfClass (string $a_type, string $a_class, int $a_mq_id=0)
 
 update ()
 
 updateStyleParameter (int $a_id, string $a_value)
 update style parameter per id More...
 
 getStyle ()
 
 setStyle (array $a_style)
 
 handleXmlString (string $a_str)
 
 getXML ()
 get xml representation of style object todo: add mq_id More...
 
 createExportDirectory ()
 
 cleanExportDirectory ()
 
 createExportSubDirectory ()
 
 setExportSubDir (string $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 ()
 
 exportXML (string $a_dir)
 export style xml file to directory More...
 
 createImportDirectory ()
 
 import ($a_file)
 
 createFromXMLFile (string $a_file, bool $a_skip_parent_create=false)
 create style from xml file todo: add mq_id and custom More...
 
 getStyleParameterGroups ()
 Get grouped parameter. More...
 
 determineTemplateStyleClassType (string $t, string $k)
 
 do_3_10_Migration ()
 Migrates 3.10 style to 3.11 style. More...
 
 do_3_10_CharMigration (int $a_id=0)
 This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingStyleCharacteristics() Any changes here may also be interesting there. More...
 
 do_3_9_Migration (int $a_id)
 Migrate old 3.9 styles. More...
 
 getColors ()
 Get colors of style. More...
 
 removeColor (string $a_name)
 Remove a color. More...
 
 getColorCodeForName (string $a_name)
 
 getMediaQueries ()
 
 addMediaQuery (string $a_mquery, int $order_nr=0)
 
 getMaxMQueryOrderNr ()
 Get maximum media query order nr. More...
 
 updateMediaQuery (int $a_id, string $a_mquery)
 
 getMediaQueryForId (int $a_id)
 Get media query for id. More...
 
 deleteMediaQuery (int $a_id)
 Delete media query. More...
 
 saveMediaQueryOrder (?array $a_order_nr=null)
 Save media query order. More...
 
 getTemplates (string $a_type)
 Get table templates of style. More...
 
 getTemplateClasses (int $a_tid)
 Get template classes. More...
 
 addTemplate (string $a_type, string $a_name, array $a_classes)
 Add table template. More...
 
 updateTemplate (int $a_t_id, string $a_name, array $a_classes)
 Update table template. More...
 
 addTemplateClass (int $a_t_id, string $a_type, string $a_class)
 
 templateExists (string $a_template_name)
 Check whether template exists. More...
 
 getTemplate (int $a_t_id)
 
 lookupTemplateName (int $a_t_id)
 Lookup table template name for template ID. More...
 
 getTemplateXML ()
 Get table template xml. More...
 
 writeTemplatePreview (int $a_t_id, string $a_preview_html)
 Write table template preview. More...
 
 lookupTemplatePreview (int $a_t_id)
 Lookup table template preview. More...
 
 removeTemplate (int $a_t_id)
 Remove table template. More...
 
 writeStyleSetting (string $a_name, string $a_value)
 
 lookupStyleSetting (string $a_name)
 Lookup style setting. More...
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id, int $new_obj_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static getBasicZipPath ()
 
static _writeUpToDate (int $a_id, bool $a_up_to_date)
 
static writeOwner ($obj_id, $style_id)
 
static _lookupUpToDate (int $a_id)
 
static _writeStandard (int $a_id, bool $a_std)
 Write standard flag. More...
 
static _writeScope (int $a_id, int $a_scope)
 
static _lookupStandard (int $a_id)
 Lookup standard flag. More...
 
static _writeActive (int $a_id, bool $a_active)
 
static _lookupActive (int $a_id)
 Lookup active flag. More...
 
static _getStandardStyles (bool $a_exclude_default_style=false, bool $a_include_deactivated=false, int $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 ()
 
static getBasicImageDir ()
 
static _createImagesDirectory (int $a_style_id)
 Create images directory <data_dir>/sty/sty_<id>/images. More...
 
static _getImagesDirectory (int $a_style_id)
 
static getEffectiveContentStyleId (int $a_style_id)
 Get effective Style Id. More...
 
static getExportContentStylePath ()
 
static getContentStylePath (int $a_style_id, bool $add_random=true, bool $add_token=true)
 get content style path static (to avoid full reading) More...
 
static getContentPrintStyle ()
 
static getSyntaxStylePath ()
 
static getBaseContentStylePath ()
 
static _getStyleParameterInputType (string $par)
 
static _getStyleParameterSubPar (string $par)
 
static _getStyleParameters (string $a_tag="")
 
static _getFilteredGroups ()
 
static _getStyleParameterNumericUnits (bool $a_no_percentage=false)
 
static _getStyleParameterValues (string $par)
 
static _getStyleSuperTypes ()
 
static _isExpandable (string $a_type)
 
static _isHideable (string $a_type)
 
static _getStyleSuperTypeForType (string $a_type)
 
static _getCoreStyles ()
 
static isCoreStyle (string $a_type, string $a_class)
 
static _getTemplateClassTypes (string $a_template_type="")
 Get template class types. More...
 
static _getPseudoClasses (string $tag)
 
static _determineTag (string $a_type)
 
static getAvailableParameters ()
 
static _addMissingStyleClassesToStyle (int $a_id)
 Add missing style classes to all styles. More...
 
static _addMissingStyleClassesToAllStyles (?array $a_styles=null)
 Add missing style classes to all styles todo: add mq_id and custom handling. More...
 
static _getColorFlavor (string $a_rgb, int $a_i)
 Get color flavor. More...
 
static _explodeRGB (string $a_rgb, bool $as_dec=false)
 Explode an RGB string into an array. More...
 
static _RGBToHLS (array $a_rgb)
 RGB to HLS (both arrays, 0..255) More...
 
static _HLSToRGB (array $a_hls)
 HLS to RGB (both arrays, 0..255) More...
 
static _lookupTemplateName (int $a_t_id)
 Lookup table template name for template ID. More...
 
static _lookupTemplateIdByName (int $a_style_id, string $a_name)
 Lookup table template preview. More...
 
static writeStyleUsage (int $a_obj_id, int $a_style_id)
 Write style usage. More...
 
static lookupObjectStyle (int $a_obj_id)
 Lookup object style. More...
 
static lookupObjectForStyle (int $a_style_id)
 Lookup objects for style. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 

Data Fields

array $style = []
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Static Public Attributes

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

Static Protected Member Functions

static hexdec (string $hex)
 

Protected Attributes

InternalDomainService $domain
 
ILIAS Style Content InternalRepoService $repo
 
bool $is_3_10_skin = false
 
string $export_sub_dir = ""
 
array $chars_by_type = []
 
array $end_styles = []
 
array $chars = []
 
bool $up_to_date = false
 
array $hidden_chars = []
 
array $style_class = []
 
int $scope = 0
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Static Protected Attributes

static string $basic_style_file = "../vendor/ilias/Style/basic_style/style.xml"
 
static string $basic_style_zip = "../vendor/ilias/Style/basic_style/style.zip"
 
static string $basic_style_image_dir = "./components/ILIAS/COPage/basic_style/images"
 
static DOMDocument $basic_style_dom = null
 

Additional Inherited Members

- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjStyleSheet::__construct ( int  $a_id = 0,
bool  $a_call_by_reference = false 
)

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

499 {
500 global $DIC;
501
502 $this->db = $DIC->database();
503 $this->lng = $DIC->language();
504 $this->type = "sty";
505 $this->style = array();
506 $this->ilias = $DIC["ilias"];
507 $this->domain = $DIC->contentStyle()->internal()->domain();
508
509 if ($a_call_by_reference) {
510 $this->ilias->raiseError("Can't instantiate style object via reference id.", $this->ilias->error_obj->FATAL);
511 }
512 parent::__construct($a_id, false);
513 $this->repo = $DIC->contentStyle()->internal()->repo();
514 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ilObjForumAdministration.
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _addMissingStyleClassesToAllStyles()

static ilObjStyleSheet::_addMissingStyleClassesToAllStyles ( ?array  $a_styles = null)
static

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

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

1999 : void {
2000 global $DIC;
2001
2002 $ilDB = $DIC->database();
2003
2004 if (is_null($a_styles)) {
2005 $styles = ilObject::_getObjectsDataForType("sty");
2006 } else {
2007 $styles = $a_styles;
2008 }
2011
2012 // get all core image files
2013 $core_images = array();
2014 $core_dir = self::$basic_style_image_dir;
2015 if (is_dir($core_dir)) {
2016 $dir = opendir($core_dir);
2017 while ($file = readdir($dir)) {
2018 if (substr($file, 0, 1) != "." && is_file($core_dir . "/" . $file)) {
2019 $core_images[] = $file;
2020 }
2021 }
2022 }
2023
2024 foreach ($styles as $style) {
2025 $id = $style["id"];
2026
2027 foreach ($core_styles as $cs) {
2028 // check, whether core style class exists
2029 $set = $ilDB->queryF(
2030 "SELECT * FROM style_char WHERE style_id = %s " .
2031 "AND type = %s AND characteristic = %s",
2032 array("integer", "text", "text"),
2033 array($id, $cs["type"], $cs["class"])
2034 );
2035
2036 // if not, add core style class
2037 if (!($rec = $ilDB->fetchAssoc($set))) {
2038 $ilDB->manipulateF(
2039 "INSERT INTO style_char (style_id, type, characteristic) " .
2040 " VALUES (%s,%s,%s) ",
2041 array("integer", "text", "text"),
2042 array($id, $cs["type"], $cs["class"])
2043 );
2044
2045 $xpath = new DOMXPath($bdom);
2046 $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '" . $cs["tag"] . "' and @Type='" .
2047 $cs["type"] . "' and @Class='" . $cs["class"] . "']/StyleParameter");
2048 foreach ($par_nodes as $par_node) {
2049 // check whether style parameter exists
2050 $set = $ilDB->queryF(
2051 "SELECT * FROM style_parameter WHERE style_id = %s " .
2052 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2053 array("integer", "text", "text", "text", "text"),
2054 array($id, $cs["type"], $cs["class"],
2055 $cs["tag"], $par_node->getAttribute("Name"))
2056 );
2057
2058 // if not, create style parameter
2059 if (!($ilDB->fetchAssoc($set))) {
2060 $spid = $ilDB->nextId("style_parameter");
2061 $st = $ilDB->manipulateF(
2062 "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) " .
2063 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2064 array("integer", "integer", "text", "text", "text", "text", "text"),
2065 array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2066 $par_node->getAttribute("Name"), $par_node->getAttribute("Value"))
2067 );
2068 }
2069 }
2070 }
2071 }
2072
2073 // now check, whether some core image files are missing
2076 foreach ($core_images as $cim) {
2077 if (!is_file($imdir . "/" . $cim)) {
2078 copy($core_dir . "/" . $cim, $imdir . "/" . $cim);
2079 }
2080 }
2081 }
2082 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _createImagesDirectory(int $a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
static _getImagesDirectory(int $a_style_id)
static string $basic_style_image_dir
static _getObjectsDataForType(string $type, bool $omit_trash=false)
get all objects of a certain type

References ilObject\_getObjectsDataForType().

+ Here is the call graph for this function:

◆ _addMissingStyleClassesToStyle()

static ilObjStyleSheet::_addMissingStyleClassesToStyle ( int  $a_id)
static

Add missing style classes to all styles.

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

1988 : void {
1989 $styles = array(array("id" => $a_id));
1991 }
static _addMissingStyleClassesToAllStyles(?array $a_styles=null)
Add missing style classes to all styles todo: add mq_id and custom handling.

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

+ Here is the caller graph for this function:

◆ _createImagesDirectory()

static ilObjStyleSheet::_createImagesDirectory ( int  $a_style_id)
static

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

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

1088 : void {
1089 global $DIC;
1090
1091 $ilErr = $DIC["ilErr"];
1092
1093 $sty_data_dir = ilFileUtils::getWebspaceDir() . "/sty";
1094 if (!is_dir($sty_data_dir)) {
1095 ilFileUtils::makeDir($sty_data_dir);
1096 }
1097 if (!is_writable($sty_data_dir)) {
1098 $ilErr->raiseError("Style data directory (" . $sty_data_dir
1099 . ") not writeable.", $ilErr->FATAL);
1100 }
1101
1102 $style_dir = $sty_data_dir . "/sty_" . $a_style_id;
1103 if (!is_dir($style_dir)) {
1104 ilFileUtils::makeDir($style_dir);
1105 }
1106 if (!is_dir($style_dir)) {
1107 $ilErr->raiseError("Creation of style directory failed (" .
1108 $style_dir . ").", $ilErr->FATAL);
1109 }
1110
1111 // create images subdirectory
1112 $im_dir = $style_dir . "/images";
1113 if (!is_dir($im_dir)) {
1114 ilFileUtils::makeDir($im_dir);
1115 }
1116 if (!is_dir($im_dir)) {
1117 $ilErr->raiseError("Creation of Import Directory failed (" .
1118 $im_dir . ").", $ilErr->FATAL);
1119 }
1120
1121 // create thumbnails directory
1122 $thumb_dir = $style_dir . "/images/thumbnails";
1123 ilFileUtils::makeDir($thumb_dir);
1124 if (!is_dir($thumb_dir)) {
1125 $ilErr->raiseError("Creation of Import Directory failed (" .
1126 $thumb_dir . ").", $ilErr->FATAL);
1127 }
1128 }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
$ilErr
Definition: raiseError.php:33

References ilFileUtils\makeDir().

Referenced by createImagesDirectory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _determineTag()

static ilObjStyleSheet::_determineTag ( string  $a_type)
static

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

1968 : string
1969 {
1970 return self::$assigned_tags[$a_type];
1971 }

Referenced by _getCoreStyles(), ILIAS\Style\Content\CharacteristicTableGUI\fillRow(), getXML(), and ilStyleCharacteristicGUI\saveCharacteristic().

+ Here is the caller graph for this function:

◆ _explodeRGB()

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

Explode an RGB string into an array.

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

2422 : array {
2423 $r["r"] = substr($a_rgb, 0, 2);
2424 $r["g"] = substr($a_rgb, 2, 2);
2425 $r["b"] = substr($a_rgb, 4, 2);
2426 if ($as_dec) {
2427 $r["r"] = self::hexdec($r["r"]);
2428 $r["g"] = self::hexdec($r["g"]);
2429 $r["b"] = self::hexdec($r["b"]);
2430 }
2431
2432 return $r;
2433 }
static hexdec(string $hex)

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

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

751 : DOMDocument
752 {
753 if (!is_object(self::$basic_style_dom)) {
754 self::$basic_style_dom = new DOMDocument();
755 self::$basic_style_dom->load(self::$basic_style_file);
756 }
757
759 }
static DOMDocument $basic_style_dom

◆ _getClonableContentStyles()

static ilObjStyleSheet::_getClonableContentStyles ( )
static

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

Returns
array<int,string>

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

709 : array
710 {
711 global $DIC;
712
713 $ilAccess = $DIC->access();
714 $ilDB = $DIC->database();
715
716 $clonable_styles = array();
717
718 $q = "SELECT * FROM style_data";
719 $style_set = $ilDB->query($q);
720 while ($style_rec = $ilDB->fetchAssoc($style_set)) {
721 $clonable = false;
722 if ($style_rec["standard"] == 1) {
723 if ($style_rec["active"] == 1) {
724 $clonable = true;
725 }
726 } else {
727 $obj_ids = ilObjContentObject::_lookupContObjIdByStyleId((int) $style_rec["id"]);
728 if (count($obj_ids) == 0) {
729 $obj_ids = self::lookupObjectForStyle((int) $style_rec["id"]);
730 }
731 foreach ($obj_ids as $id) {
732 $ref = ilObject::_getAllReferences((int) $id);
733 foreach ($ref as $ref_id) {
734 if ($ilAccess->checkAccess("write", "", $ref_id)) {
735 $clonable = true;
736 }
737 }
738 }
739 }
740 if ($clonable) {
741 $clonable_styles[(int) $style_rec["id"]] =
742 ilObject::_lookupTitle((int) $style_rec["id"]);
743 }
744 }
745
746 asort($clonable_styles);
747
748 return $clonable_styles;
749 }
static _lookupContObjIdByStyleId(int $a_style_id)
static lookupObjectForStyle(int $a_style_id)
Lookup objects for style.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
$q
Definition: shib_logout.php:25

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

Referenced by ilObjStyleSheetGUI\getCloneForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getColorFlavor()

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

Get color flavor.

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

2396 : string {
2397 $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
2398 $hls = ilObjStyleSheet::_RGBToHLS($rgb);
2399
2400 if ($a_i > 0) {
2401 $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
2402 }
2403 if ($a_i < 0) {
2404 $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
2405 }
2406
2407 $rgb = ilObjStyleSheet::_HLSToRGB($hls);
2408
2409 foreach ($rgb as $k => $v) {
2410 $rgb[$k] = str_pad(dechex((int) $v), 2, "0", STR_PAD_LEFT);
2411 }
2412
2413 return $rgb["r"] . $rgb["g"] . $rgb["b"];
2414 }
static _explodeRGB(string $a_rgb, bool $as_dec=false)
Explode an RGB string into an array.
static _HLSToRGB(array $a_hls)
HLS to RGB (both arrays, 0..255)
static _RGBToHLS(array $a_rgb)
RGB to HLS (both arrays, 0..255)

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

+ Here is the caller graph for this function:

◆ _getCoreStyles()

static ilObjStyleSheet::_getCoreStyles ( )
static

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

1919 : array
1920 {
1921 $c_styles = array();
1922 foreach (self::$core_styles as $cstyle) {
1923 $c_styles[$cstyle["type"] . "." . ilObjStyleSheet::_determineTag($cstyle["type"]) . "." . $cstyle["class"]]
1924 = array("type" => $cstyle["type"],
1925 "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
1926 "class" => $cstyle["class"]);
1927 }
1928 return $c_styles;
1929 }
static _determineTag(string $a_type)

References _determineTag().

Referenced by ILIAS\Style\Content\CharacteristicTableGUI\__construct(), ilStyleCharacteristicGUI\deleteCharacteristicConfirmation(), and ilStyleCharacteristicGUI\deleteCoreCharMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFilteredGroups()

static ilObjStyleSheet::_getFilteredGroups ( )
static

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

1870 : array
1871 {
1873 }
static array $filtered_groups

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

+ Here is the caller graph for this function:

◆ _getImagesDirectory()

static ilObjStyleSheet::_getImagesDirectory ( int  $a_style_id)
static

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

1135 : string
1136 {
1137 return ilFileUtils::getWebspaceDir() . "/sty/sty_" . $a_style_id .
1138 "/images";
1139 }

References ilFileUtils\getWebspaceDir().

Referenced by getImagesDirectory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getPseudoClasses()

static ilObjStyleSheet::_getPseudoClasses ( string  $tag)
static

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

1955 : array
1956 {
1957 return self::$pseudo_classes[$tag] ?? [];
1958 }

◆ _getStandardStyles()

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

Get standard styles.

Returns
array<int,string>

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

666 : array {
667 global $DIC;
668
669 $ilDB = $DIC->database();
670 $ilSetting = $DIC->settings();
671 $tree = $DIC->repositoryTree();
672
673 $default_style = $ilSetting->get("default_content_style_id");
674
675 $and_str = "";
676 if (!$a_include_deactivated) {
677 $and_str = " AND active = 1";
678 }
679
680 $q = "SELECT * FROM style_data " .
681 " WHERE standard = 1" . $and_str;
682 $res = $ilDB->query($q);
683 $styles = array();
684 while ($sty = $ilDB->fetchAssoc($res)) {
685 if (!$a_exclude_default_style || $default_style != $sty["id"]) {
686 // check scope
687 if ($a_scope > 0 && $sty["category"] > 0) {
688 if ($tree->isInTree((int) $sty["category"]) &&
689 $tree->isInTree($a_scope)) {
690 $path = $tree->getPathId($a_scope);
691 if (!in_array((int) $sty["category"], $path)) {
692 continue;
693 }
694 }
695 }
696 $styles[(int) $sty["id"]] = ilObject::_lookupTitle((int) $sty["id"]);
697 }
698 }
699
700 return $styles;
701 }
ilTree $tree
isInTree(?int $a_node_id)
get all information of a node.
getPathId(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
$path
Definition: ltiservices.php:30
$res
Definition: ltiservices.php:69
global $ilSetting
Definition: privfeed.php:31

Referenced by ILIAS\Style\Content\Object\ObjectManager\getSelectableStyles().

+ Here is the caller graph for this function:

◆ _getStyleParameterInputType()

static ilObjStyleSheet::_getStyleParameterInputType ( string  $par)
static

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

1841 : string
1842 {
1843 $input = self::$parameter[$par]["input"];
1844 return $input;
1845 }

Referenced by ilStyleCharacteristicGUI\initTagStyleForm().

+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

1877 : array {
1878 if ($a_no_percentage) {
1880 }
1881 return self::$num_unit;
1882 }
static array $num_unit_no_perc

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

+ Here is the caller graph for this function:

◆ _getStyleParameters()

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

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

1855 : array {
1856 if ($a_tag == "") {
1857 return self::$parameter;
1858 }
1859 $par = array();
1860 foreach (self::$parameter as $k => $v) {
1861 if (isset(self::$filtered_groups[$v["group"]]) &&
1862 !in_array($a_tag, self::$filtered_groups[$v["group"]])) {
1863 continue;
1864 }
1865 $par[$k] = $v;
1866 }
1867 return $par;
1868 }

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

+ Here is the caller graph for this function:

◆ _getStyleParameterSubPar()

static ilObjStyleSheet::_getStyleParameterSubPar ( string  $par)
static

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

1847 : string
1848 {
1849 $subpar = self::$parameter[$par]["subpar"];
1850 return $subpar;
1851 }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues ( string  $par)
static

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

1886 : array {
1887 return self::$parameter[$par]["values"];
1888 }

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

+ Here is the caller graph for this function:

◆ _getStyleSuperTypeForType()

static ilObjStyleSheet::_getStyleSuperTypeForType ( string  $a_type)
static

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

1907 : string {
1908 foreach (self::$style_super_types as $s => $t) {
1909 if (in_array($a_type, $t)) {
1910 return $s;
1911 }
1912 if ($a_type == $s) {
1913 return $s;
1914 }
1915 }
1916 return "";
1917 }

Referenced by ilObjStyleSheetGUI\__construct().

+ Here is the caller graph for this function:

◆ _getStyleSuperTypes()

static ilObjStyleSheet::_getStyleSuperTypes ( )
static

◆ _getTemplateClassTypes()

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

Get template class types.

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

1948 : array {
1949 if ($a_template_type == "") {
1950 return self::$templates;
1951 }
1952 return self::$templates[$a_template_type];
1953 }

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

+ Here is the caller graph for this function:

◆ _HLSToRGB()

static ilObjStyleSheet::_HLSToRGB ( array  $a_hls)
static

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

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

2489 : array
2490 {
2491 $h = $a_hls["h"] / 255;
2492 $l = $a_hls["l"] / 255;
2493 $s = $a_hls["s"] / 255;
2494 $temp3 = 0;
2495
2496 $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
2497
2498 // If S=0, define R, G, and B all to L
2499 if ($s == 0) {
2500 $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
2501 } else {
2502 if ($l < 0.5) {
2503 $temp2 = $l * (1.0 + $s);
2504 } else {
2505 $temp2 = $l + $s - $l * $s;
2506 }
2507
2508 $temp1 = 2.0 * $l - $temp2;
2509
2510
2511 # For each of R, G, B, compute another temporary value, temp3, as follows:
2512 foreach ($rgb as $k => $v) {
2513 switch ($k) {
2514 case "r":
2515 $temp3 = $h + 1.0 / 3.0;
2516 break;
2517
2518 case "g":
2519 $temp3 = $h;
2520 break;
2521
2522 case "b":
2523 $temp3 = $h - 1.0 / 3.0;
2524 break;
2525 }
2526 if ($temp3 < 0) {
2527 $temp3 = $temp3 + 1.0;
2528 }
2529 if ($temp3 > 1) {
2530 $temp3 = $temp3 - 1.0;
2531 }
2532
2533 if (6.0 * $temp3 < 1) {
2534 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
2535 } elseif (2.0 * $temp3 < 1) {
2536 $rgb[$k] = $temp2;
2537 } elseif (3.0 * $temp3 < 2) {
2538 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0 / 3.0) - $temp3) * 6.0;
2539 } else {
2540 $rgb[$k] = $temp1;
2541 }
2542 }
2543 }
2544
2545 $rgb["r"] = round($rgb["r"] * 255);
2546 $rgb["g"] = round($rgb["g"] * 255);
2547 $rgb["b"] = round($rgb["b"] * 255);
2548
2549 return $rgb;
2550 }

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable ( string  $a_type)
static

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

1895 : bool
1896 {
1897 return in_array($a_type, self::$expandable_types);
1898 }

Referenced by ILIAS\Style\Content\CharacteristicTableGUI\__construct(), ilStyleCharacteristicGUI\copyCharacteristics(), ilStyleCharacteristicGUI\initCharacteristicForm(), and ilStyleCharacteristicGUI\listCharacteristics().

+ Here is the caller graph for this function:

◆ _isHideable()

static ilObjStyleSheet::_isHideable ( string  $a_type)
static

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

1900 : bool
1901 {
1902 return in_array($a_type, self::$hideable_types);
1903 }

Referenced by ILIAS\Style\Content\CharacteristicTableGUI\__construct(), and ILIAS\Style\Content\CharacteristicTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ _lookupActive()

static ilObjStyleSheet::_lookupActive ( int  $a_id)
static

Lookup active flag.

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

644 : bool
645 {
646 global $DIC;
647
648 $ilDB = $DIC->database();
649
650 $q = "SELECT * FROM style_data " .
651 " WHERE id = " . $ilDB->quote($a_id, "integer");
652 $res = $ilDB->query($q);
653 $sty = $ilDB->fetchAssoc($res);
654
655 return (bool) $sty["active"];
656 }

References $DIC, $ilDB, $q, and $res.

Referenced by ilContentStyleSettingsGUI\edit().

+ Here is the caller graph for this function:

◆ _lookupStandard()

static ilObjStyleSheet::_lookupStandard ( int  $a_id)
static

Lookup standard flag.

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

615 : bool
616 {
617 global $DIC;
618
619 $ilDB = $DIC->database();
620
621 $q = "SELECT * FROM style_data " .
622 " WHERE id = " . $ilDB->quote($a_id, "integer");
623 $res = $ilDB->query($q);
624 $sty = $ilDB->fetchAssoc($res);
625
626 return (bool) ($sty["standard"] ?? false);
627 }

References $DIC, $ilDB, $q, and $res.

Referenced by ILIAS\Style\Content\Object\ObjectManager\cloneTo(), ilObjectCopyGUI\copyParentPage(), and ILIAS\Style\Content\Object\ObjectManager\inheritFromParent().

+ Here is the caller graph for this function:

◆ _lookupTemplateIdByName()

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

Lookup table template preview.

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

2973 : ?int {
2974 global $DIC;
2975
2976 $ilDB = $DIC->database();
2977
2978 $set = $ilDB->query("SELECT id FROM style_template " .
2979 " WHERE style_id = " . $ilDB->quote($a_style_id, "integer") .
2980 " AND name = " . $ilDB->quote($a_name, "text"));
2981 if ($rec = $ilDB->fetchAssoc($set)) {
2982 return (int) $rec["id"];
2983 }
2984
2985 return null;
2986 }

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

+ Here is the caller graph for this function:

◆ _lookupTemplateName()

static ilObjStyleSheet::_lookupTemplateName ( int  $a_t_id)
static

Lookup table template name for template ID.

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

2867 : ?string
2868 {
2869 global $DIC;
2870
2871 $ilDB = $DIC->database();
2872
2873 $set = $ilDB->query("SELECT name FROM style_template WHERE " .
2874 " id = " . $ilDB->quote($a_t_id, "integer"));
2875
2876 if ($rec = $ilDB->fetchAssoc($set)) {
2877 return $rec["name"];
2878 }
2879
2880 return null;
2881 }

References $DIC, and $ilDB.

◆ _lookupUpToDate()

static ilObjStyleSheet::_lookupUpToDate ( int  $a_id)
static

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

569 : bool
570 {
571 global $DIC;
572
573 $ilDB = $DIC->database();
574
575 $q = "SELECT uptodate FROM style_data " .
576 " WHERE id = " . $ilDB->quote($a_id, "integer");
577 $res = $ilDB->query($q);
578 $sty = $ilDB->fetchAssoc($res);
579
580 return (bool) $sty["uptodate"];
581 }

References $DIC, $ilDB, $q, and $res.

◆ _RGBToHLS()

static ilObjStyleSheet::_RGBToHLS ( array  $a_rgb)
static

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

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

2447 : array
2448 {
2449 $r = $a_rgb["r"] / 255;
2450 $g = $a_rgb["g"] / 255;
2451 $b = $a_rgb["b"] / 255;
2452 $h = 0;
2453
2454 // max / min
2455 $max = max($r, $g, $b);
2456 $min = min($r, $g, $b);
2457
2458 //lightness
2459 $l = ($max + $min) / 2;
2460
2461 if ($max == $min) {
2462 $s = 0;
2463 } else {
2464 if ($l < 0.5) {
2465 $s = ($max - $min) / ($max + $min);
2466 } else {
2467 $s = ($max - $min) / (2.0 - $max - $min);
2468 }
2469
2470 if ($r == $max) {
2471 $h = ($g - $b) / ($max - $min);
2472 } elseif ($g == $max) {
2473 $h = 2.0 + ($b - $r) / ($max - $min);
2474 } elseif ($b == $max) {
2475 $h = 4.0 + ($r - $g) / ($max - $min);
2476 }
2477 }
2478
2479 $hls["h"] = round(($h / 6) * 255);
2480 $hls["l"] = round($l * 255);
2481 $hls["s"] = round($s * 255);
2482
2483 return $hls;
2484 }

References Vendor\Package\$b.

◆ _writeActive()

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

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

629 : void
630 {
631 global $DIC;
632
633 $ilDB = $DIC->database();
634
635 $q = "UPDATE style_data SET active = " .
636 $ilDB->quote((int) $a_active, "integer") .
637 " WHERE id = " . $ilDB->quote($a_id, "integer");
638 $ilDB->manipulate($q);
639 }

References $DIC, $ilDB, and $q.

Referenced by ilContentStyleSettingsGUI\saveActiveStyles().

+ Here is the caller graph for this function:

◆ _writeScope()

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

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

600 : void
601 {
602 global $DIC;
603
604 $ilDB = $DIC->database();
605
606 $q = "UPDATE style_data SET category = " .
607 $ilDB->quote($a_scope, "integer") .
608 " WHERE id = " . $ilDB->quote($a_id, "integer");
609 $ilDB->manipulate($q);
610 }

References $DIC, $ilDB, and $q.

Referenced by ilContentStyleSettingsGUI\saveScope().

+ Here is the caller graph for this function:

◆ _writeStandard()

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

Write standard flag.

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

589 : void {
590 global $DIC;
591
592 $ilDB = $DIC->database();
593
594 $q = "UPDATE style_data SET standard = " .
595 $ilDB->quote((int) $a_std, "integer") .
596 " WHERE id = " . $ilDB->quote($a_id, "integer");
597 $ilDB->manipulate($q);
598 }

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

+ Here is the caller graph for this function:

◆ _writeUpToDate()

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

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

547 : void {
548 global $DIC;
549
550 $ilDB = $DIC->database();
551
552 $q = "UPDATE style_data SET uptodate = " .
553 $ilDB->quote((int) $a_up_to_date, "integer") .
554 " WHERE id = " . $ilDB->quote($a_id, "integer");
555 $ilDB->manipulate($q);
556 }

Referenced by ilStyleCharacteristicGUI\pasteCharacteristics().

+ Here is the caller graph for this function:

◆ addCharacteristic()

ilObjStyleSheet::addCharacteristic ( string  $a_type,
string  $a_char,
bool  $a_hidden = false,
int  $order_nr = 0,
bool  $outdated = false 
)

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

902 : void {
904
905 // delete characteristic record
906 $ilDB->insert("style_char", [
907 "style_id" => ["integer", $this->getId()],
908 "type" => ["text", $a_type],
909 "characteristic" => ["text", $a_char],
910 "hide" => ["integer", (int) $a_hidden],
911 "outdated" => ["integer", (int) $outdated],
912 "order_nr" => ["integer", $order_nr]
913 ]);
914
915 $this->setUpToDate(false);
916 $this->_writeUpToDate($this->getId(), false);
917 }
setUpToDate(bool $a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
static _writeUpToDate(int $a_id, bool $a_up_to_date)
ilDBInterface $db

◆ addMediaQuery()

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

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

2579 : int {
2580 $ilDB = $this->db;
2581
2582 $id = $ilDB->nextId("sty_media_query");
2583 if ($order_nr == 0) {
2584 $order_nr = $this->getMaxMQueryOrderNr() + 10;
2585 }
2586
2587 $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
2588 " VALUES (" .
2589 $ilDB->quote($id, "integer") . "," .
2590 $ilDB->quote($this->getId(), "integer") . "," .
2591 $ilDB->quote($a_mquery, "text") . "," .
2592 $ilDB->quote($order_nr, "integer") .
2593 ")");
2594
2595 return $id;
2596 }
getMaxMQueryOrderNr()
Get maximum media query order nr.

◆ addParameter()

ilObjStyleSheet::addParameter ( string  $a_tag,
string  $a_par,
string  $a_type,
int  $a_mq_id = 0,
bool  $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 1043 of file class.ilObjStyleSheet.php.

1049 : void {
1050 $ilDB = $this->db;
1051
1052 $avail_params = $this->getAvailableParameters();
1053 $tag = explode(".", $a_tag);
1054 $value = $avail_params[$a_par][0];
1055 $id = $ilDB->nextId("style_parameter");
1056 $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1057 "(" .
1058 $ilDB->quote($id, "integer") . "," .
1059 $ilDB->quote($this->getId(), "integer") . "," .
1060 $ilDB->quote($a_type, "text") . "," .
1061 $ilDB->quote($tag[0], "text") . "," .
1062 $ilDB->quote($tag[1], "text") . "," .
1063 $ilDB->quote($a_par, "text") . "," .
1064 $ilDB->quote($value, "text") . "," .
1065 $ilDB->quote($a_mq_id, "integer") . "," .
1066 $ilDB->quote($a_custom, "integer") .
1067 ")";
1068 $ilDB->manipulate($q);
1069 $this->read();
1070 $this->writeCSSFile();
1071 }
read()
read style properties
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory

◆ addTemplate()

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

Add table template.

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

2743 : int {
2744 $ilDB = $this->db;
2745
2746 $tid = $ilDB->nextId("style_template");
2747 $ilDB->manipulate("INSERT INTO style_template " .
2748 "(id, style_id, name, temp_type)" .
2749 " VALUES (" .
2750 $ilDB->quote($tid, "integer") . "," .
2751 $ilDB->quote($this->getId(), "integer") . "," .
2752 $ilDB->quote($a_name, "text") . "," .
2753 $ilDB->quote($a_type, "text") .
2754 ")");
2755
2756 foreach ($a_classes as $t => $c) {
2757 $ilDB->manipulate("INSERT INTO style_template_class " .
2758 "(template_id, class_type, class)" .
2759 " VALUES (" .
2760 $ilDB->quote($tid, "integer") . "," .
2761 $ilDB->quote($t, "text") . "," .
2762 $ilDB->quote($c, "text") .
2763 ")");
2764 }
2765
2766 $this->writeTemplatePreview(
2767 $tid,
2768 ilObjStyleSheetGUI::_getTemplatePreview($this, $a_type, $tid, true)
2769 );
2770
2771 return $tid;
2772 }
static _getTemplatePreview(ilObjStyleSheet $a_style, string $a_type, int $a_t_id, bool $a_small_mode=false)
Get table template preview.
writeTemplatePreview(int $a_t_id, string $a_preview_html)
Write table template preview.
$c
Definition: deliver.php:25

References $c, and $ilDB.

◆ addTemplateClass()

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

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

2807 : void {
2808 $ilDB = $this->db;
2809
2810 $ilDB->manipulate("INSERT INTO style_template_class " .
2811 "(template_id, class_type, class)" .
2812 " VALUES (" .
2813 $ilDB->quote($a_t_id, "integer") . "," .
2814 $ilDB->quote($a_type, "text") . "," .
2815 $ilDB->quote($a_class, "text") .
2816 ")");
2817 }

◆ characteristicExists()

ilObjStyleSheet::characteristicExists ( string  $a_char,
string  $a_style_type 
)

Check whether characteristic exists.

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

882 : bool {
884
885 $set = $ilDB->queryF(
886 "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
887 array("integer", "text", "text"),
888 array($this->getId(), $a_char, $a_style_type)
889 );
890 if ($ilDB->fetchAssoc($set)) {
891 return true;
892 }
893 return false;
894 }

◆ cleanExportDirectory()

ilObjStyleSheet::cleanExportDirectory ( )

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

1567 : void
1568 {
1569 $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1570 $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1571 // create export subdirectory
1572 $ex_dir = $style_dir . "/export";
1573
1574 if (is_dir($ex_dir)) {
1575 ilFileUtils::delDir($ex_dir, true);
1576 }
1577 }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDataDir()
get data directory (outside webspace)

References ilFileUtils\delDir(), ilFileUtils\getDataDir(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ copyImagesToDir()

ilObjStyleSheet::copyImagesToDir ( string  $a_target)

Copy images to directory.

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

1029 : void
1030 {
1031 ilFileUtils::rCopy($this->getImagesDirectory(), $a_target);
1032 }
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.

References ilFileUtils\rCopy().

+ Here is the call graph for this function:

◆ create()

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

Create a new style.

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

773 : int {
774 global $DIC;
775
777
778 $id = parent::create();
779
780 $service = $DIC->contentStyle()
781 ->internal();
782 $access_manager = $service->domain()->access(
783 0,
784 $DIC->user()->getId()
785 );
786 $access_manager->enableWrite(true);
787 $color_manager = $service->domain()->color($this->getId(), $access_manager);
788
789 if ($a_from_style == 0) {
790 if (!$a_import_mode) {
791 throw new Exception("Can't create style without a from style in non-import mode.");
792 } else {
793 // add style_data record
794 $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
795 "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
796 $ilDB->quote($this->getScope(), "integer") . ")";
797 $ilDB->manipulate($q);
798 $service->domain()->style($this->getId())->createRid();
799 }
800 } else {
801 // get style parameter records
802 $def = array();
803 $q = "SELECT * FROM style_parameter WHERE style_id = " .
804 $ilDB->quote($a_from_style, "integer");
805 $par_set = $ilDB->query($q);
806 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
807 $def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
808 "parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
809 "type" => $par_rec["type"], "mq_id" => $par_rec["mq_id"], "custom" => $par_rec["custom"]);
810 }
811
812 $char_repo = $this->repo->characteristic();
813 $char_repo->cloneAllFromStyle($a_from_style, $this->getId());
814
815
816 // copy media queries
817 $from_style = new ilObjStyleSheet($a_from_style);
818 $mqs = $from_style->getMediaQueries();
819 $mq_mapping = array();
820 foreach ($mqs as $mq) {
821 $nid = $this->addMediaQuery($mq["mquery"]);
822 $mq_mapping[$mq["id"]] = $nid;
823 }
824
825 // default style settings
826 foreach ($def as $sty) {
827 $id = $ilDB->nextId("style_parameter");
828 $q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
829 "(" .
830 $ilDB->quote($id, "integer") . "," .
831 $ilDB->quote($this->getId(), "integer") . "," .
832 $ilDB->quote($sty["tag"], "text") . "," .
833 $ilDB->quote($sty["class"], "text") . "," .
834 $ilDB->quote($sty["parameter"], "text") . "," .
835 $ilDB->quote($sty["value"], "text") . "," .
836 $ilDB->quote($sty["type"], "text") . "," .
837 $ilDB->quote((int) ($mq_mapping[$sty["mq_id"]] ?? 0), "integer") . "," .
838 $ilDB->quote($sty["custom"], "integer") .
839 ")";
840 $ilDB->manipulate($q);
841 }
842
843 // add style_data record
844 $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
845 "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
846 $ilDB->quote($this->getScope(), "integer") . ")";
847 $ilDB->manipulate($q);
848 $service->domain()->style($this->getId())->createRid();
849
850 // copy images
851 $this->domain->style($this->getId())->cloneResourceContainer($from_style->getId());
852 // copy colors
853 $colors = $from_style->getColors();
854 foreach ($colors as $c) {
855 $color_manager->addColor($c["name"], $c["code"]);
856 }
857
858 // copy templates
860 foreach ($tcts as $tct => $v) {
861 $templates = $from_style->getTemplates($tct);
862 foreach ($templates as $t) {
863 $this->addTemplate($tct, $t["name"], $t["classes"]);
864 }
865 }
866 }
867
868 $this->read();
869 if (!$a_import_mode) {
870 $this->writeCSSFile();
871 }
872
873 return $id;
874 }
Class ilObjStyleSheet.
addTemplate(string $a_type, string $a_name, array $a_classes)
Add table template.
addMediaQuery(string $a_mquery, int $order_nr=0)
static _getTemplateClassTypes(string $a_template_type="")
Get template class types.
$service
Definition: ltiresult.php:36

◆ createExportDirectory()

ilObjStyleSheet::createExportDirectory ( )

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

1540 : string
1541 {
1542 $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1543 ilFileUtils::makeDir($sty_data_dir);
1544 if (!is_writable($sty_data_dir)) {
1545 $this->ilias->raiseError("Style data directory (" . $sty_data_dir
1546 . ") not writeable.", $this->ilias->error_obj->FATAL);
1547 }
1548
1549 $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1550 ilFileUtils::makeDir($style_dir);
1551 if (!is_dir($style_dir)) {
1552 $this->ilias->raiseError("Creation of style directory failed (" .
1553 $style_dir . ").", $this->ilias->error_obj->FATAL);
1554 }
1555
1556 // create export subdirectory
1557 $ex_dir = $style_dir . "/export";
1558 ilFileUtils::makeDir($ex_dir);
1559 if (!is_dir($ex_dir)) {
1560 $this->ilias->raiseError("Creation of Import Directory failed (" .
1561 $ex_dir . ").", $this->ilias->error_obj->FATAL);
1562 }
1563
1564 return $ex_dir;
1565 }

References ilFileUtils\getDataDir(), ILIAS\Survey\Mode\getId(), and ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ createExportSubDirectory()

ilObjStyleSheet::createExportSubDirectory ( )

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

1579 : void
1580 {
1581 $ex_dir = $this->createExportDirectory();
1582 $ex_sub_dir = $ex_dir . "/" . $this->getExportSubDir();
1583 ilFileUtils::makeDir($ex_sub_dir);
1584 if (!is_writable($ex_sub_dir)) {
1585 $this->ilias->raiseError("Style data directory (" . $ex_sub_dir
1586 . ") not writeable.", $this->ilias->error_obj->FATAL);
1587 }
1588 $ex_sub_images_dir = $ex_sub_dir . "/images";
1589 ilFileUtils::makeDir($ex_sub_images_dir);
1590 if (!is_writable($ex_sub_images_dir)) {
1591 $this->ilias->raiseError("Style data directory (" . $ex_sub_images_dir
1592 . ") not writeable.", $this->ilias->error_obj->FATAL);
1593 }
1594 }
getExportSubDir()
The local directory, that will be included within the zip file.

References ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ createFromXMLFile()

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

create style from xml file todo: add mq_id and custom

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

1750 : void {
1751 $ilDB = $this->db;
1752
1753 $this->is_3_10_skin = false;
1754
1755 if (!$a_skip_parent_create) {
1756 parent::create();
1757 }
1758 $importParser = new ilStyleImportParser($a_file, $this);
1759 $importParser->startParsing();
1760
1761 // store style parameter
1762 foreach ($this->style as $style) {
1763 foreach ($style as $tag) {
1764 $id = $ilDB->nextId("style_parameter");
1765
1766 // migrate old table PageFrame/PageContainer to div
1767 if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
1768 $tag["tag"] == "table") {
1769 $tag["tag"] = "div";
1770 if ($tag["parameter"] == "width" && $tag["value"] == "100%") {
1771 continue;
1772 }
1773 }
1774
1775 if ($tag["type"] === "text_block" && $tag["tag"] === "div") {
1776 $tag["tag"] = "p";
1777 }
1778
1779 $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
1780 "(" .
1781 $ilDB->quote($id, "integer") . "," .
1782 $ilDB->quote($this->getId(), "integer") . "," .
1783 $ilDB->quote($tag["tag"], "text") . "," .
1784 $ilDB->quote($tag["class"], "text") . "," .
1785 $ilDB->quote($tag["parameter"], "text") . "," .
1786 $ilDB->quote($tag["type"], "text") . "," .
1787 $ilDB->quote($tag["value"], "text") . "," .
1788 $ilDB->quote((bool) $tag["custom"], "integer") .
1789 ")";
1790 $ilDB->manipulate($q);
1791 }
1792 }
1793
1794 // store characteristics
1795 $this->is_3_10_skin = true;
1796 foreach ($this->chars as $char) {
1797 if ($char["type"] != "") {
1798 $s = substr($char["class"], strlen($char["class"]) - 6);
1799 if ($s != ":hover") {
1800 $ilDB->replace(
1801 "style_char",
1802 array(
1803 "style_id" => array("integer", $this->getId()),
1804 "type" => array("text", $char["type"]),
1805 "characteristic" => array("text", ilStr::subStr($char["class"], 0, 30))),
1806 array("hide" => array("integer", 0))
1807 );
1808 $this->is_3_10_skin = false;
1809 }
1810 }
1811 }
1812
1813 // add style_data record
1814 $q = "INSERT INTO style_data (id, uptodate) VALUES " .
1815 "(" . $ilDB->quote($this->getId(), "integer") . ", 0)";
1816 $ilDB->manipulate($q);
1817 $this->domain->style($this->getId())->createRid();
1818
1819 $this->update();
1820 $this->read();
1821
1822 if ($this->is_3_10_skin) {
1823 $this->do_3_10_Migration();
1824 }
1825 //$this->writeCSSFile();
1826 }
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:21

◆ createImagesDirectory()

ilObjStyleSheet::createImagesDirectory ( )

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

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

1077 : void
1078 {
1080 }

References _createImagesDirectory(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ createImportDirectory()

ilObjStyleSheet::createImportDirectory ( )

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

1667 : string
1668 {
1669 $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1670 ilFileUtils::makeDir($sty_data_dir);
1671 if (!is_writable($sty_data_dir)) {
1672 $this->ilias->raiseError("Style data directory (" . $sty_data_dir
1673 . ") not writeable.", $this->ilias->error_obj->FATAL);
1674 }
1675
1676 $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1677 ilFileUtils::makeDir($style_dir);
1678 if (!is_dir($style_dir)) {
1679 $this->ilias->raiseError("Creation of style directory failed (" .
1680 $style_dir . ").", $this->ilias->error_obj->FATAL);
1681 }
1682
1683 // create import subdirectory
1684 $im_dir = $style_dir . "/import";
1685 ilFileUtils::makeDir($im_dir);
1686 if (!is_dir($im_dir)) {
1687 $this->ilias->raiseError("Creation of Import Directory failed (" .
1688 $im_dir . ").", $this->ilias->error_obj->FATAL);
1689 }
1690
1691 return $im_dir;
1692 }

References ilFileUtils\getDataDir(), ILIAS\Survey\Mode\getId(), and ilFileUtils\makeDir().

+ Here is the call graph for this function:

◆ delete()

ilObjStyleSheet::delete ( )

delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!!

Returns
bool true if object was removed completely; false if only a references was removed

Reimplemented from ilObject.

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

1204 : bool
1205 {
1206 $ilDB = $this->db;
1207
1208 // delete object
1209 parent::delete();
1210
1211 // check whether this style is global default
1212 $def_style = $this->ilias->getSetting("default_content_style_id");
1213 if ($def_style == $this->getId()) {
1214 $this->ilias->deleteSetting("default_content_style_id");
1215 }
1216
1217 // check whether this style is global fixed
1218 $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1219 if ($fixed_style == $this->getId()) {
1220 $this->ilias->deleteSetting("fixed_content_style_id");
1221 }
1222
1223 // delete style parameter
1224 $q = "DELETE FROM style_parameter WHERE style_id = " .
1225 $ilDB->quote($this->getId(), "integer");
1226 $ilDB->manipulate($q);
1227
1228 // delete style file
1229 $css_file_name = ilFileUtils::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1230 if (is_file($css_file_name)) {
1231 unlink($css_file_name);
1232 }
1233
1234 // delete media queries
1235 $ilDB->manipulate(
1236 "DELETE FROM sty_media_query WHERE " .
1237 " style_id = " . $ilDB->quote($this->getId(), "integer")
1238 );
1239
1240 // delete entries in learning modules
1242
1243 // delete style data record
1244 $q = "DELETE FROM style_data WHERE id = " .
1245 $ilDB->quote($this->getId(), "integer");
1246 $ilDB->manipulate($q);
1247
1248 return true;
1249 }
static _deleteStyleAssignments(int $a_style_id)
delete all style references to style

References $ilDB, $q, ilObjContentObject\_deleteStyleAssignments(), ILIAS\Survey\Mode\getId(), and ilFileUtils\getWebspaceDir().

+ Here is the call graph for this function:

◆ deleteCustomStylePars()

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

Delete style parameter by tag/class/parameter.

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

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

1172 : void {
1173 $ilDB = $this->db;
1174
1175 $q = "DELETE FROM style_parameter WHERE " .
1176 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1177 " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1178 " class = " . $ilDB->quote($a_class, "text") . " AND " .
1179 " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1180 " custom = " . $ilDB->quote(1, "integer") . " AND " .
1181 " " . $ilDB->equals("type", $a_type, "text", true);
1182
1183 $ilDB->manipulate($q);
1184 }

◆ deleteMediaQuery()

ilObjStyleSheet::deleteMediaQuery ( int  $a_id)

Delete media query.

Parameters
int$a_idmedia query id

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

2652 : void {
2653 $ilDB = $this->db;
2654
2655 $ilDB->manipulate(
2656 "DELETE FROM sty_media_query WHERE " .
2657 " style_id = " . $ilDB->quote($this->getId(), "integer") .
2658 " AND id = " . $ilDB->quote($a_id, "integer")
2659 );
2660 $this->saveMediaQueryOrder();
2661 }
saveMediaQueryOrder(?array $a_order_nr=null)
Save media query order.

◆ deleteParameter()

ilObjStyleSheet::deleteParameter ( int  $a_id)

delete style parameter

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

1150 : void
1151 {
1152 $ilDB = $this->db;
1153
1154 $q = "DELETE FROM style_parameter WHERE id = " .
1155 $ilDB->quote($a_id, "integer");
1156 $ilDB->query($q);
1157 }

References $ilDB, and $q.

◆ deleteStyleParOfChar()

ilObjStyleSheet::deleteStyleParOfChar ( string  $a_type,
string  $a_class 
)

Delete style parameters of characteristic.

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

1192 : void {
1193 $ilDB = $this->db;
1194
1195 $q = "DELETE FROM style_parameter WHERE " .
1196 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1197 " class = " . $ilDB->quote($a_class, "text") . " AND " .
1198 " " . $ilDB->equals("type", $a_type, "text", true);
1199
1200 $ilDB->manipulate($q);
1201 }

◆ determineTemplateStyleClassType()

ilObjStyleSheet::determineTemplateStyleClassType ( string  $t,
string  $k 
)

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

1964 : string {
1965 return self::$templates[$t][$k];
1966 }

◆ do_3_10_CharMigration()

ilObjStyleSheet::do_3_10_CharMigration ( int  $a_id = 0)

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

2149 : void
2150 {
2151 $ilDB = $this->db;
2152
2153 $add_str = "";
2154 if ($a_id > 0) {
2155 $add_str = " AND style_id = " . $ilDB->quote($a_id, "integer");
2156 }
2157
2158 $set = $ilDB->query($q = "SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE " .
2159 $ilDB->equals("type", "", "text", true) . " " . $add_str);
2160
2161 while ($rec = $ilDB->fetchAssoc($set)) {
2162 // derive types from tag
2163 $types = array();
2164 switch ($rec["tag"]) {
2165 case "div":
2166 case "p":
2167 if (in_array($rec["class"], array("Headline3", "Headline1",
2168 "Headline2", "TableContent", "List", "Standard", "Remark",
2169 "Additional", "Mnemonic", "Citation", "Example"))) {
2170 $types[] = "text_block";
2171 }
2172 if (in_array($rec["class"], array("Block", "Remark",
2173 "Additional", "Mnemonic", "Example", "Excursus", "Special"))) {
2174 $types[] = "section";
2175 }
2176 if (in_array($rec["class"], array("Page", "Footnote", "PageTitle", "LMNavigation"))) {
2177 $types[] = "page";
2178 }
2179 break;
2180
2181 case "td":
2182 $types[] = "table_cell";
2183 break;
2184
2185 case "a":
2186 if (in_array($rec["class"], array("ExtLink", "IntLink", "FootnoteLink"))) {
2187 $types[] = "link";
2188 }
2189 break;
2190
2191 case "span":
2192 $types[] = "text_inline";
2193 break;
2194
2195 case "table":
2196 $types[] = "table";
2197 break;
2198 }
2199
2200 // check if style_char set exists
2201 foreach ($types as $t) {
2202 // check if second type already exists
2203 $set4 = $ilDB->queryF(
2204 "SELECT * FROM style_char " .
2205 " WHERE style_id = %s AND type = %s AND characteristic = %s",
2206 array("integer", "text", "text"),
2207 array($rec["style_id"], $t, $rec["class"])
2208 );
2209 if ($rec4 = $ilDB->fetchAssoc($set4)) {
2210 // ok
2211 } else {
2212 //echo "<br>1-".$rec["style_id"]."-".$t."-".$rec["class"]."-";
2213 $ilDB->manipulateF(
2214 "INSERT INTO style_char " .
2215 " (style_id, type, characteristic) VALUES " .
2216 " (%s,%s,%s) ",
2217 array("integer", "text", "text"),
2218 array($rec["style_id"], $t, $rec["class"])
2219 );
2220 }
2221 }
2222
2223 // update types
2224 if ($rec["type"] == "") {
2225 if (count($types) > 0) {
2226 $ilDB->manipulateF(
2227 "UPDATE style_parameter SET type = %s " .
2228 " WHERE style_id = %s AND class = %s AND " . $ilDB->equals("type", "", "text", true),
2229 array("text", "integer", "text"),
2230 array($types[0], $rec["style_id"], $rec["class"])
2231 );
2232 //echo "<br>3-".$types[0]."-".$rec["style_id"]."-".$rec["class"]."-";
2233
2234 // links extra handling
2235 if ($types[0] == "link") {
2236 $ilDB->manipulateF(
2237 "UPDATE style_parameter SET type = %s " .
2238 " WHERE style_id = %s AND (class = %s OR class = %s) AND " . $ilDB->equals("type", "", "text", true),
2239 array("text", "integer", "text", "text"),
2240 array($types[0], $rec["style_id"], $rec["class"] . ":visited",
2241 $rec["class"] . ":hover")
2242 );
2243 }
2244 }
2245
2246 if (count($types) == 2) {
2247 // select all records of first type and add second type
2248 // records if necessary.
2249 $set2 = $ilDB->queryF(
2250 "SELECT * FROM style_parameter " .
2251 " WHERE style_id = %s AND class = %s AND type = %s",
2252 array("integer", "text", "text"),
2253 array($rec["style_id"], $rec["class"], $types[0])
2254 );
2255 while ($rec2 = $ilDB->fetchAssoc($set2)) {
2256 // check if second type already exists
2257 $set3 = $ilDB->queryF(
2258 "SELECT * FROM style_parameter " .
2259 " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2260 array("integer", "text", "text", "text", "text"),
2261 array($rec["style_id"], $rec["tag"], $rec["class"], $types[1], $rec["parameter"])
2262 );
2263 if ($rec3 = $ilDB->fetchAssoc($set3)) {
2264 // ok
2265 } else {
2266 $nid = $ilDB->nextId("style_parameter");
2267 $ilDB->manipulateF(
2268 "INSERT INTO style_parameter " .
2269 " (id, style_id, tag, class, parameter, value, type) VALUES " .
2270 " (%s, %s,%s,%s,%s,%s,%s) ",
2271 array("integer", "integer", "text", "text", "text", "text", "text"),
2272 array($nid, $rec2["style_id"], $rec2["tag"], $rec2["class"],
2273 $rec2["parameter"], $rec2["value"], $types[1])
2274 );
2275 }
2276 }
2277 }
2278 }
2279 }
2280 }

References $ilDB, and $q.

◆ do_3_10_Migration()

ilObjStyleSheet::do_3_10_Migration ( )

Migrates 3.10 style to 3.11 style.

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

2091 : void
2092 {
2093 $ilDB = $this->db;
2094
2095 $this->do_3_9_Migration($this->getId());
2096
2097 $this->do_3_10_CharMigration($this->getId());
2098
2099 // style_char: type for characteristic
2100 $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?" .
2101 " AND style_id = ? ", array("text", "text", "integer"));
2102 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2103 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2104 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2105 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2106 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2107 $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2108
2109 // style_parameter: type for class
2110 $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?" .
2111 " AND style_id = ? ", array("text", "text", "integer"));
2112 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2113 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2114 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2115 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2116 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2117 $ilDB->execute($st, array("table", "Page", $this->getId()));
2118
2119 $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?" .
2120 " AND style_id = ? ", array("text", "text", "integer"));
2121 $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2122
2123 // style_char: characteristic for characteristic
2124 $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?" .
2125 " AND style_id = ? ", array("text", "text", "integer"));
2126 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2127 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2128
2129 // style_parameter: class for class
2130 $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?" .
2131 " AND style_id = ? ", array("text", "text", "integer"));
2132 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2133 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2134
2135 // force rewriting of container style
2136 $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?" .
2137 " AND style_id = ? ", array("text", "integer"));
2138 $ilDB->execute($st, array("page_cont", $this->getId()));
2139 $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?" .
2140 " AND style_id = ? ", array("text", "integer"));
2141 $ilDB->execute($st, array("page_cont", $this->getId()));
2142 }
do_3_10_CharMigration(int $a_id=0)
This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingS...
do_3_9_Migration(int $a_id)
Migrate old 3.9 styles.

References $ilDB, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ do_3_9_Migration()

ilObjStyleSheet::do_3_9_Migration ( int  $a_id)

Migrate old 3.9 styles.

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

2285 : void
2286 {
2287 $ilDB = $this->db;
2288
2289 $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2290 $pars = array("margin-top", "margin-bottom");
2291
2292 foreach ($classes as $curr_class) {
2293 foreach ($pars as $curr_par) {
2294 $res2 = $ilDB->queryF(
2295 "SELECT id FROM style_parameter WHERE style_id = %s" .
2296 " AND tag = %s AND class= %s AND parameter = %s",
2297 array("integer", "text", "text", "text"),
2298 array($a_id, "p", $curr_class, $curr_par)
2299 );
2300 if ($row2 = $ilDB->fetchAssoc($res2)) {
2301 $ilDB->manipulateF(
2302 "UPDATE style_parameter SET value= %s WHERE id = %s",
2303 array("text", "integer"),
2304 array("10px", $row2["id"])
2305 );
2306 } else {
2307 $nid = $ilDB->nextId("style_parameter");
2308 $ilDB->manipulateF(
2309 "INSERT INTO style_parameter " .
2310 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2311 array("integer", "integer", "text", "text", "text", "text"),
2312 array($nid, $a_id, "div", $curr_class, $curr_par, "10px")
2313 );
2314 }
2315 }
2316 }
2317
2318 $ilDB->manipulateF(
2319 "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2320 array("text", "text", "integer"),
2321 array("div", "p", $a_id)
2322 );
2323 }

References $ilDB.

◆ export()

ilObjStyleSheet::export ( )
Returns
string local file name of export file
Exceptions

ILIAS\Filesystem\Exception\DirectoryNotFoundException

Exceptions

ILIAS\Filesystem\Exception\FileNotFoundException

Exceptions

ILIAS\Filesystem\Exception\IOException

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

1622 : string
1623 {
1624 $this->cleanExportDirectory();
1625 $ex_dir = $this->createExportDirectory();
1626 $this->createExportSubDirectory();
1627 $this->exportXML($ex_dir . "/" . $this->getExportSubDir());
1628 //echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
1630 $this->getImagesDirectory(),
1631 $ex_dir . "/" . $this->getExportSubDir() . "/images"
1632 );
1633 if (is_file($ex_dir . "/" . $this->getExportSubDir() . ".zip")) {
1634 unlink($ex_dir . "/" . $this->getExportSubDir() . ".zip");
1635 }
1637 $ex_dir . "/" . $this->getExportSubDir(),
1638 $ex_dir . "/" . $this->getExportSubDir() . ".zip"
1639 );
1640
1641 return $ex_dir . "/" . $this->getExportSubDir() . ".zip";
1642 }
static zip(string $a_dir, string $a_file, bool $compress_content=false)
exportXML(string $a_dir)
export style xml file to directory

References ilFileUtils\rCopy(), and ilFileUtils\zip().

+ Here is the call graph for this function:

◆ exportXML()

ilObjStyleSheet::exportXML ( string  $a_dir)

export style xml file to directory

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

1647 : void
1648 {
1649 $file = $a_dir . "/style.xml";
1650
1651 // open file
1652 if (!($fp = fopen($file, 'wb'))) {
1653 die("<strong>Error</strong>: Could not open \"" . $file . "\" for writing" .
1654 " in <strong>" . __FILE__ . "</strong> on line <strong>" . __LINE__ . "</strong><br />");
1655 }
1656
1657 // set file permissions
1658 chmod($file, 0770);
1659
1660 // write xml data into the file
1661 fwrite($fp, $this->getXML());
1662
1663 // close file
1664 fclose($fp);
1665 }
getXML()
get xml representation of style object todo: add mq_id

◆ getAvailableParameters()

static ilObjStyleSheet::getAvailableParameters ( )
static

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

1973 : array
1974 {
1975 $pars = array();
1976 foreach (self::$parameter as $p => $v) {
1977 $pars[$p] = $v["values"];
1978 }
1979
1980 return $pars;
1981 }

◆ getBaseContentStylePath()

static ilObjStyleSheet::getBaseContentStylePath ( )
static

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

1436 : string
1437 {
1438 return "./components/ILIAS/COPage/css/content_base.css";
1439 }

Referenced by ilPCSourceCodeGUI\edit(), ilPCTableGUI\editData(), ilPCInteractiveImageGUI\editor(), and ilPageObjectGUI\showPage().

+ Here is the caller graph for this function:

◆ getBasicImageDir()

static ilObjStyleSheet::getBasicImageDir ( )
static

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

761 : string
762 {
764 }

Referenced by ilCOPageHTMLExport\exportStyles().

+ Here is the caller graph for this function:

◆ getBasicZipPath()

static ilObjStyleSheet::getBasicZipPath ( )
static

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

516 : string
517 {
519 }
static string $basic_style_zip

References $basic_style_zip.

Referenced by ilObjStyleSheetGUI\saveObject().

+ Here is the caller graph for this function:

◆ getCharacteristics()

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

Get characteristics.

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

926 : array {
927 $chars = array();
928
929 if ($a_type == "") {
931 }
932 if (isset($this->chars_by_type[$a_type])) {
933 foreach ($this->chars_by_type[$a_type] as $c) {
934 if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
935 $chars[] = $c;
936 }
937 }
938 }
939
940 if ($a_no_hidden) {
941 foreach ($chars as $k => $char) {
942 if ($a_type == "" && $this->hidden_chars[$char["type"] . ":" . $char["class"]]) {
943 unset($chars[$k]);
944 } elseif ($this->hidden_chars[$a_type . ":" . $char] ?? false) {
945 unset($chars[$k]);
946 }
947 }
948 }
949
950 return $chars;
951 }

Referenced by ilPCSectionGUI\_getCharacteristics(), and ilPCListGUI\_getListCharacteristics().

+ Here is the caller graph for this function:

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName ( string  $a_name)

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

2363 : string
2364 {
2365 $ilDB = $this->db;
2366 $a_i = "";
2367 $pos = strpos($a_name, "(");
2368 if ($pos > 0) {
2369 $a_i = substr($a_name, $pos + 1);
2370 $a_i = str_replace(")", "", $a_i);
2371 $a_name = substr($a_name, 0, $pos);
2372 }
2373
2374 $set = $ilDB->query("SELECT color_code FROM style_color WHERE " .
2375 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2376 " color_name = " . $ilDB->quote($a_name, "text"));
2377 if ($rec = $ilDB->fetchAssoc($set)) {
2378 if ($a_i == "") {
2379 return "#" . $rec["color_code"];
2380 } else {
2382 $rec["color_code"],
2383 (int) $a_i
2384 );
2385 }
2386 }
2387 return "";
2388 }
static _getColorFlavor(string $a_rgb, int $a_i)
Get color flavor.

References $ilDB, and _getColorFlavor().

+ Here is the call graph for this function:

◆ getColors()

ilObjStyleSheet::getColors ( )

Get colors of style.

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

2332 : array
2333 {
2334 $ilDB = $this->db;
2335
2336 $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2337 "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2338 "ORDER BY color_name");
2339
2340 $colors = array();
2341 while ($rec = $ilDB->fetchAssoc($set)) {
2342 $colors[] = array(
2343 "name" => $rec["color_name"],
2344 "code" => $rec["color_code"]
2345 );
2346 }
2347
2348 return $colors;
2349 }

References $ilDB.

◆ getContentPrintStyle()

static ilObjStyleSheet::getContentPrintStyle ( )
static

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

1426 : string
1427 {
1428 return "./components/ILIAS/COPage/css/print_content.css";
1429 }

Referenced by ilCOPageHTMLExport\exportStyles(), ILIAS\Export\PrintProcessGUI\renderPrintView(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ getContentStylePath()

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

get content style path static (to avoid full reading)

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

1394 : string {
1395 global $DIC;
1396 $ilSetting = $DIC->settings();
1397
1398 $random = new \Random\Randomizer();
1399 $rand = $random->getInt(1, 999999);
1400
1401 // check global fixed content style
1402 $fixed_style = $ilSetting->get("fixed_content_style_id");
1403 if ($fixed_style > 0) {
1404 $a_style_id = (int) $fixed_style;
1405 }
1406
1407 // check global default style
1408 if ($a_style_id <= 0) {
1409 $a_style_id = (int) $ilSetting->get("default_content_style_id");
1410 }
1411 if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
1412 // check whether file is up to date
1413 if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
1414 $style = new ilObjStyleSheet($a_style_id);
1415 $style->writeCSSFile();
1416 }
1417
1418 $style_manager = $DIC->contentStyle()->internal()->domain()->style($a_style_id);
1419 $path = $style_manager->getPath();
1420 return $path;
1421 } else { // todo: work this out
1422 return "./components/ILIAS/COPage/css/content.css";
1423 }
1424 }
static _lookupUpToDate(int $a_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data

Referenced by ilImprintGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilDclDetailedViewDefinitionGUI\__construct(), ilAssQuestionPreviewGUI\__construct(), ilPageLayoutGUI\__construct(), ILIAS\Style\Content\GUIService\addCss(), ilDashboardPageGUI\afterConstructor(), ilPageObjectGUI\displayMedia(), assOrderingQuestionGUI\editNesting(), ilLOEditorGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilCOPageHTMLExport\exportStyles(), ilAssQuestionPageCommandForwarder\forward(), ILIAS\COPage\Page\PageQueryActionHandler\getConfig(), ilObjStyleSheetGUI\includeCSS(), ILIAS\Glossary\Export\GlossaryHtmlExport\initScreen(), ilAssQuestionPreviewGUI\initStyleSheets(), ilGlossaryPresentationGUI\media(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestServiceGUI\outCorrectSolution(), ilStyleCharacteristicGUI\outputTagStyleEditScreen(), ilTestEvaluationGUI\outUserPassDetails(), ilTestPlayerAbstractGUI\populateContentStyleBlock(), ilObjStyleSheetGUI\propertiesObject(), ilTestEvaluationGUI\setCss(), ilPCParagraphGUI\setStyle(), ilStartUpGUI\showLoginPage(), ilObjMediaPoolGUI\showMedia(), ilContainerObjectiveGUI\showObjectives(), ilDclDetailedViewDefinitionGUI\showPage(), ilObjMediaPoolGUI\showPage(), ilPageObjectGUI\showPageFullscreen(), ilGuidedTourPageGUI\showPageFullscreen(), and ilTestCorrectionsGUI\showSolution().

+ Here is the caller graph for this function:

◆ getEffectiveContentStyleId()

static ilObjStyleSheet::getEffectiveContentStyleId ( int  $a_style_id)
static

Get effective Style Id.

Parameters
intstyle id that may be set in object
stringobject type

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

1347 : int {
1348 global $DIC;
1349
1350 $ilSetting = $DIC->settings();
1351
1352 // check global fixed content style
1353 $fixed_style = $ilSetting->get("fixed_content_style_id");
1354 if ($fixed_style > 0) {
1355 $a_style_id = (int) $fixed_style;
1356 }
1357
1358 // check global default style
1359 if ($a_style_id <= 0) {
1360 $a_style_id = (int) $ilSetting->get("default_content_style_id");
1361 }
1362
1363 if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) === "sty") {
1364 return $a_style_id;
1365 }
1366
1367 return 0;
1368 }
static _lookupType(int $id, bool $reference=false)

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getExportContentStylePath()

static ilObjStyleSheet::getExportContentStylePath ( )
static

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

1381 : string
1382 {
1383 return "assets/content_style/style.css";
1384 }

Referenced by ILIAS\Style\Content\GUIService\addExportCss(), ilCOPageHTMLExport\exportStyles(), and ILIAS\Export\PrintProcessGUI\renderPrintView().

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

1607 : string
1608 {
1609 if ($this->export_sub_dir == "") {
1610 return "sty_" . $this->getId();
1611 } else {
1612 return $this->export_sub_dir;
1613 }
1614 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getHideStatus()

ilObjStyleSheet::getHideStatus ( string  $a_type,
string  $a_char 
)

Get characteristic hidden status.

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

989 : bool {
991
992 $set = $ilDB->query(
993 "SELECT hide FROM style_char " .
994 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
995 " type = " . $ilDB->quote($a_type, "text") . " AND " .
996 " characteristic = " . $ilDB->quote($a_char, "text")
997 );
998 $rec = $ilDB->fetchAssoc($set);
999
1000 return (bool) ($rec["hide"] ?? false);
1001 }

◆ getImagesDirectory()

ilObjStyleSheet::getImagesDirectory ( )

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

1130 : string
1131 {
1133 }

References _getImagesDirectory(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getMaxMQueryOrderNr()

ilObjStyleSheet::getMaxMQueryOrderNr ( )

Get maximum media query order nr.

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

2601 : int
2602 {
2603 $ilDB = $this->db;
2604
2605 $set = $ilDB->query(
2606 "SELECT max(order_nr) mnr FROM sty_media_query " .
2607 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer")
2608 );
2609 $rec = $ilDB->fetchAssoc($set);
2610
2611 return (int) $rec["mnr"];
2612 }

References $ilDB.

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

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

2560 : array
2561 {
2562 $ilDB = $this->db;
2563
2564 $set = $ilDB->query("SELECT * FROM sty_media_query WHERE " .
2565 "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2566 "ORDER BY order_nr");
2567
2568 $mq = array();
2569 while ($rec = $ilDB->fetchAssoc($set)) {
2570 $mq[] = $rec;
2571 }
2572
2573 return $mq;
2574 }

References $ilDB.

◆ getMediaQueryForId()

ilObjStyleSheet::getMediaQueryForId ( int  $a_id)

Get media query for id.

Parameters

return

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

2635 : array {
2636 $ilDB = $this->db;
2637
2638 $set = $ilDB->query(
2639 "SELECT * FROM sty_media_query " .
2640 " WHERE id = " . $ilDB->quote($a_id, "integer")
2641 );
2642 return $ilDB->fetchAssoc($set);
2643 }

◆ getParametersOfClass()

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

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

1374 : array {
1375 if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1376 return $this->style_class[$a_type][$a_class][$a_mq_id];
1377 }
1378 return array();
1379 }

◆ getScope()

ilObjStyleSheet::getScope ( )

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

539 : int
540 {
541 return $this->scope;
542 }

References $scope.

◆ getStyle()

ilObjStyleSheet::getStyle ( )

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

1472 : array
1473 {
1474 return $this->style;
1475 }

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

1831 : array
1832 {
1833 $groups = array();
1834
1835 foreach (self::$parameter as $parameter => $props) {
1836 $groups[$props["group"]][] = $parameter;
1837 }
1838 return $groups;
1839 }

◆ getSyntaxStylePath()

◆ getTemplate()

ilObjStyleSheet::getTemplate ( int  $a_t_id)
Parameters
int$a_t_idtemplate id

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

2839 : array
2840 {
2841 $ilDB = $this->db;
2842
2843 $set = $ilDB->query("SELECT * FROM style_template WHERE " .
2844 "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2845 " AND id = " . $ilDB->quote($a_t_id, "integer"));
2846
2847 if ($rec = $ilDB->fetchAssoc($set)) {
2848 $rec["classes"] = $this->getTemplateClasses((int) $rec["id"]);
2849
2850 $template = $rec;
2851 return $template;
2852 }
2853 return array();
2854 }
getTemplateClasses(int $a_tid)
Get template classes.

References $ilDB.

◆ getTemplateClasses()

ilObjStyleSheet::getTemplateClasses ( int  $a_tid)

Get template classes.

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

2721 : array {
2722 $ilDB = $this->db;
2723 $set = $ilDB->query("SELECT * FROM style_template_class WHERE " .
2724 "template_id = " . $ilDB->quote($a_tid, "integer"));
2725
2726 $class = array();
2727 while ($rec = $ilDB->fetchAssoc($set)) {
2728 $key = $rec["class_type"];
2729 $class[$key] = $rec["class"];
2730 }
2731
2732 return $class;
2733 }

◆ getTemplates()

ilObjStyleSheet::getTemplates ( string  $a_type)

Get table templates of style.

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

2699 : array {
2700 $ilDB = $this->db;
2701
2702 $set = $ilDB->query("SELECT * FROM style_template WHERE " .
2703 "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2704 "temp_type = " . $ilDB->quote($a_type, "text") . " " .
2705 "ORDER BY name");
2706
2707 $templates = array();
2708 while ($rec = $ilDB->fetchAssoc($set)) {
2709 $rec["classes"] = $this->getTemplateClasses((int) $rec["id"]);
2710 $templates[] = $rec;
2711 }
2712
2713 return $templates;
2714 }

Referenced by ilPageContentGUI\getTemplateOptions().

+ Here is the caller graph for this function:

◆ getTemplateXML()

ilObjStyleSheet::getTemplateXML ( )

Get table template xml.

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

2886 : string
2887 {
2888 $ilDB = $this->db;
2889
2890 $tag = "<StyleTemplates>";
2891
2892 $ttypes = array("table", "vaccordion", "haccordion", "carousel");
2893
2894 foreach ($ttypes as $ttype) {
2895 $ts = $this->getTemplates($ttype);
2896
2897 foreach ($ts as $t) {
2899 /*$atts = array("table" => "TableClass",
2900 "caption" => "CaptionClass",
2901 "row_head" => "RowHeadClass",
2902 "row_foot" => "RowFootClass",
2903 "col_head" => "ColHeadClass",
2904 "col_foot" => "ColFootClass",
2905 "odd_row" => "OddRowClass",
2906 "even_row" => "EvenRowClass",
2907 "odd_col" => "OddColClass",
2908 "even_col" => "EvenColClass");*/
2909 $c = $t["classes"];
2910
2911 $tag .= '<StyleTemplate Name="' . $t["name"] . '">';
2912
2913 foreach ($atts as $type => $t2) {
2914 if (($c[$type] ?? "") != "") {
2915 $tag .= '<StyleClass Type="' . $type . '" Value="' . $c[$type] . '" />';
2916 }
2917 }
2918
2919 $tag .= "</StyleTemplate>";
2920 }
2921 }
2922
2923 $tag .= "</StyleTemplates>";
2924
2925 //echo htmlentities($tag);
2926 return $tag;
2927 }
getTemplates(string $a_type)
Get table templates of style.
string $type

References $c, $ilDB, and _getTemplateClassTypes().

+ Here is the call graph for this function:

◆ getThumbnailsDirectory()

ilObjStyleSheet::getThumbnailsDirectory ( )

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

1141 : string
1142 {
1143 return $this->getImagesDirectory() .
1144 "/thumbnails";
1145 }

◆ getUpToDate()

ilObjStyleSheet::getUpToDate ( )

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

529 : bool
530 {
531 return $this->up_to_date;
532 }

References $up_to_date.

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

1491 : string
1492 {
1493 $xml = "<StyleSheet>\n";
1494
1495 // title and description
1496 $xml .= "<Title>" . $this->handleXmlString($this->getTitle()) . "</Title>";
1497 $xml .= "<Description>" . $this->handleXmlString($this->getDescription()) . "</Description>\n";
1498
1499 // style classes
1500 foreach ($this->chars as $char) {
1501 $xml .= "<Style Tag=\"" . ilObjStyleSheet::_determineTag($char["type"]) .
1502 "\" Type=\"" . $char["type"] . "\" Class=\"" . $char["class"] . "\">\n";
1503 foreach ($this->style as $style) {
1504 if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"]) {
1505 foreach ($style as $tag) {
1506 $xml .= "<StyleParameter Name=\"" . $tag["parameter"] . "\" Value=\"" . $tag["value"] . "\" Custom=\"" . $tag["custom"] . "\" />\n";
1507 }
1508 }
1509 }
1510 $xml .= "</Style>\n";
1511 }
1512
1513 // colors
1514 foreach ($this->getColors() as $color) {
1515 $xml .= "<StyleColor Name=\"" . $color["name"] . "\" Code=\"" . $color["code"] . "\"/>\n";
1516 }
1517
1518 // templates
1520 foreach ($tcts as $tct => $v) {
1521 $ts = $this->getTemplates($tct);
1522
1523 foreach ($ts as $t) {
1524 $xml .= "<StyleTemplate Type=\"" . $tct . "\" Name=\"" . $t["name"] . "\">\n";
1525 foreach ($t["classes"] as $ct => $c) {
1526 if ($c != "") {
1527 $xml .= "<StyleTemplateClass ClassType=\"" . $ct . "\" Class=\"" . $c . "\"/>\n";
1528 }
1529 }
1530 $xml .= "</StyleTemplate>\n";
1531 }
1532 }
1533
1534
1535 $xml .= "</StyleSheet>";
1536 //echo "<pre>".htmlentities($xml)."</pre>"; exit;
1537 return $xml;
1538 }
handleXmlString(string $a_str)
getColors()
Get colors of style.

References $c, _determineTag(), _getTemplateClassTypes(), and ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle().

+ Here is the call graph for this function:

◆ handleXmlString()

ilObjStyleSheet::handleXmlString ( string  $a_str)

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

1482 : string
1483 {
1484 return str_replace("&", "&amp;", $a_str);
1485 }

◆ hasCharacteristic()

ilObjStyleSheet::hasCharacteristic ( string  $type,
string  $char 
)

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

953 : bool
954 {
956 return in_array($char, $chars);
957 }
getCharacteristics(string $a_type="", bool $a_no_hidden=false, bool $a_include_core=true)
Get characteristics.

◆ hexdec()

static ilObjStyleSheet::hexdec ( string  $hex)
staticprotected

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

2435 : int
2436 {
2437 $hex = preg_replace("/[^a-fA-F0-9]+/", "", $hex);
2438 if ($hex === "") {
2439 $hex = "0";
2440 }
2441 return (int) hexdec($hex);
2442 }

◆ ilClone()

ilObjStyleSheet::ilClone ( )

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

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

1006 : int
1007 {
1008 $lng = $this->lng;
1009
1010 $lng->loadLanguageModule("style");
1011
1012 $new_obj = new ilObjStyleSheet();
1013 $new_obj->setTitle($this->getTitle() . " (" . $lng->txt("sty_acopy") . ")");
1014 $new_obj->setType($this->getType());
1015 $new_obj->setDescription($this->getDescription());
1016 $new_obj->create($this->getId());
1017
1018 $new_obj->writeStyleSetting(
1019 "disable_auto_margins",
1020 $this->lookupStyleSetting("disable_auto_margins")
1021 );
1022
1023 return $new_obj->getId();
1024 }
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
lookupStyleSetting(string $a_name)
Lookup style setting.
ilLanguage $lng

References $lng, ILIAS\Survey\Mode\getId(), and ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle().

+ Here is the call graph for this function:

◆ import()

ilObjStyleSheet::import (   $a_file)
Parameters
array | string$a_file
Exceptions

ILIAS\Filesystem\Exception\DirectoryNotFoundException

Exceptions

ILIAS\Filesystem\Exception\FileNotFoundException

Exceptions

ILIAS\Filesystem\Exception\IOException

Exceptions
ilException

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

1701 : void
1702 {
1703 parent::create();
1704 $subdir = "";
1705 $im_dir = $this->createImportDirectory();
1706
1707 // handle uploaded files
1708 if (is_array($a_file)) {
1710 $a_file["tmp_name"],
1711 $a_file["name"],
1712 $im_dir . "/" . $a_file["name"]
1713 );
1714 $file_name = $a_file["name"];
1715 } else { // handle not directly uploaded files
1716 $pi = pathinfo($a_file);
1717 $file_name = $pi["basename"];
1718 copy($a_file, $im_dir . "/" . $file_name);
1719 }
1720 $file = pathinfo($file_name);
1721
1722 // unzip file
1723 if (strtolower($file["extension"]) == "zip") {
1724 $this->domain->resources()->zip()->unzipFile($im_dir . "/" . $file_name);
1725 $subdir = basename($file["basename"], "." . $file["extension"]);
1726 if (!is_dir($im_dir . "/" . $subdir)) {
1727 $subdir = "style"; // check style subdir
1728 }
1729 $xml_file = $im_dir . "/" . $subdir . "/style.xml";
1730 } else { // handle xml file directly (old style)
1731 $xml_file = $im_dir . "/" . $file_name;
1732 }
1733
1734 // load information from xml file
1735 //echo "-$xml_file-";
1736 $this->createFromXMLFile($xml_file, true);
1737
1739 $this->read();
1740 $this->writeCSSFile();
1741 }
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
createFromXMLFile(string $a_file, bool $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
static _addMissingStyleClassesToStyle(int $a_id)
Add missing style classes to all styles.

References _addMissingStyleClassesToStyle(), ILIAS\Survey\Mode\getId(), and ilFileUtils\moveUploadedFile().

+ Here is the call graph for this function:

◆ isCoreStyle()

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

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

1934 : bool {
1935 foreach (self::$core_styles as $s) {
1936 if ($s["type"] == $a_type && $s["class"] == $a_class) {
1937 return true;
1938 }
1939 }
1940 return false;
1941 }

Referenced by ILIAS\Style\Content\CharacteristicTableGUI\fillRow(), ilStyleCharacteristicGUI\removeOutdated(), and ilStyleCharacteristicGUI\setOutdated().

+ Here is the caller graph for this function:

◆ lookupObjectForStyle()

static ilObjStyleSheet::lookupObjectForStyle ( int  $a_style_id)
static

Lookup objects for style.

Returns
int[]

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

3094 : array {
3095 global $DIC;
3096
3097 $ilDB = $DIC->database();
3098
3099 $obj_ids = array();
3100 if (ilObject::_lookupType($a_style_id) == "sty") {
3101 $set = $ilDB->query(
3102 "SELECT DISTINCT obj_id FROM style_usage " .
3103 " WHERE style_id = " . $ilDB->quote($a_style_id, "integer")
3104 );
3105
3106 while ($rec = $ilDB->fetchAssoc($set)) {
3107 $obj_ids[] = (int) $rec["obj_id"];
3108 }
3109 }
3110 return $obj_ids;
3111 }

◆ lookupObjectStyle()

static ilObjStyleSheet::lookupObjectStyle ( int  $a_obj_id)
static

Lookup object style.

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

3067 : int {
3068 global $DIC;
3069
3070 $ilDB = $DIC->database();
3071
3072 $set = $ilDB->query(
3073 "SELECT style_id FROM style_usage " .
3074 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
3075 );
3076 $rec = $ilDB->fetchAssoc($set);
3077 if (!is_array($rec)) {
3078 return 0;
3079 }
3080
3081 if (ilObject::_lookupType((int) $rec["style_id"]) == "sty") {
3082 return (int) $rec["style_id"];
3083 }
3084
3085 return 0;
3086 }

Referenced by ilDashboardPageGUI\afterConstructor(), ilObjectCopyGUI\copyParentPage(), ILIAS\Style\Content\Object\ObjectManager\getStyleId(), ILIAS\Style\Content\Object\ObjectManager\inheritFromParent(), and ilContainerXmlWriter\writeSubitems().

+ Here is the caller graph for this function:

◆ lookupStyleSetting()

ilObjStyleSheet::lookupStyleSetting ( string  $a_name)

Lookup style setting.

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

3028 : string
3029 {
3030 $ilDB = $this->db;
3031
3032 $set = $ilDB->query(
3033 "SELECT value FROM style_setting " .
3034 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
3035 " AND name = " . $ilDB->quote($a_name, "text")
3036 );
3037 $rec = $ilDB->fetchAssoc($set);
3038
3039 return $rec["value"] ?? '';
3040 }

References $ilDB.

◆ lookupTemplateName()

ilObjStyleSheet::lookupTemplateName ( int  $a_t_id)

Lookup table template name for template ID.

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

2859 : string
2860 {
2861 return self::_lookupTemplateName($a_t_id);
2862 }
static _lookupTemplateName(int $a_t_id)
Lookup table template name for template ID.

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview ( int  $a_t_id)

Lookup table template preview.

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

2954 : string
2955 {
2956 $ilDB = $this->db;
2957
2958 $set = $ilDB->query("SELECT preview FROM style_template " .
2959 " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
2960 if ($rec = $ilDB->fetchAssoc($set)) {
2961 return $rec["preview"] ?? "";
2962 }
2963
2964 return "";
2965 }

References $ilDB.

◆ read()

ilObjStyleSheet::read ( )

read style properties

Reimplemented from ilObject.

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

1255 : void
1256 {
1257 $ilDB = $this->db;
1258
1259 parent::read();
1260
1261 $q = "SELECT * FROM style_parameter WHERE style_id = " .
1262 $ilDB->quote($this->getId(), "integer") . " ORDER BY tag, class, type, mq_id ";
1263 $style_set = $ilDB->query($q);
1264 $ctag = "";
1265 $cclass = "";
1266 $ctype = "";
1267 $cmq_id = 0;
1268 $this->style = array();
1269 // workaround for bug #17586, see also http://stackoverflow.com/questions/3066356/multiple-css-classes-properties-overlapping-based-on-the-order-defined
1270 // e.g. ha_iheada must be written after ha_ihead, since they are acting on the same dom node
1271 // styles that must be added at the end
1272 $this->end_styles = array();
1273 $tag = null;
1274 while ($style_rec = $ilDB->fetchAssoc($style_set)) {
1275 if ($style_rec["tag"] != $ctag || $style_rec["class"] != $cclass
1276 || $style_rec["type"] != $ctype || $style_rec["mq_id"] != $cmq_id) {
1277 // add current tag array to style array
1278 if (is_array($tag)) {
1279 if (in_array($ctype, array("ha_iheada", "va_iheada"))) {
1280 $this->end_styles[] = $tag;
1281 } else {
1282 $this->style[] = $tag;
1283 }
1284 }
1285 $tag = array();
1286 }
1287 $ctag = $style_rec["tag"];
1288 $cclass = $style_rec["class"];
1289 $ctype = $style_rec["type"];
1290 $cmq_id = $style_rec["mq_id"];
1291 $tag[] = $style_rec;
1292 // added $cmq_id
1293 $this->style_class[$ctype][$cclass][$cmq_id][$style_rec["parameter"]] = $style_rec["value"];
1294 }
1295 if (is_array($tag)) {
1296 $this->style[] = $tag;
1297 }
1298 foreach ($this->end_styles as $s) {
1299 $this->style[] = $s;
1300 }
1301 //var_dump($this->style_class);
1302 $q = "SELECT * FROM style_data WHERE id = " .
1303 $ilDB->quote($this->getId(), "integer");
1304 $res = $ilDB->query($q);
1305 $sty = $ilDB->fetchAssoc($res);
1306 $this->setUpToDate((bool) $sty["uptodate"]);
1307 $this->setScope((int) $sty["category"]);
1308
1309 // get style characteristics records
1310 $this->chars = array();
1311 $this->chars_by_type = array();
1312 $q = "SELECT * FROM style_char WHERE style_id = " .
1313 $ilDB->quote($this->getId(), "integer") .
1314 " ORDER BY type ASC, characteristic ASC";
1315 $par_set = $ilDB->query($q);
1316 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
1317 $this->chars[] = array("type" => $par_rec["type"], "class" => $par_rec["characteristic"], "hide" => $par_rec["hide"]);
1318 $this->chars_by_type[$par_rec["type"]][] = $par_rec["characteristic"];
1319 if ($par_rec["hide"]) {
1320 $this->hidden_chars[$par_rec["type"] . ":" . $par_rec["characteristic"]] = true;
1321 }
1322 }
1323 // var_dump($this->style); exit;
1324 }

References $ilDB, $q, $res, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ removeColor()

ilObjStyleSheet::removeColor ( string  $a_name)

Remove a color.

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

2354 : void
2355 {
2356 $ilDB = $this->db;
2357
2358 $ilDB->manipulate("DELETE FROM style_color WHERE " .
2359 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2360 " color_name = " . $ilDB->quote($a_name, "text"));
2361 }

References $ilDB.

◆ removeTemplate()

ilObjStyleSheet::removeTemplate ( int  $a_t_id)

Remove table template.

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

2991 : void
2992 {
2993 $ilDB = $this->db;
2994
2995 $ilDB->manipulate("DELETE FROM style_template WHERE " .
2996 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2997 " id = " . $ilDB->quote($a_t_id, "integer"));
2998
2999 $ilDB->manipulate(
3000 "DELETE FROM style_template_class WHERE " .
3001 "template_id = " . $ilDB->quote($a_t_id, "integer")
3002 );
3003 }

References $ilDB.

◆ saveHideStatus()

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

Save characteristic hidden status.

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

971 : void {
973
974 $ilDB->manipulate(
975 "UPDATE style_char SET " .
976 " hide = " . $ilDB->quote((int) $a_hide, "integer") .
977 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
978 " type = " . $ilDB->quote($a_type, "text") . " AND " .
979 " characteristic = " . $ilDB->quote($a_char, "text")
980 );
981 }

◆ saveMediaQueryOrder()

ilObjStyleSheet::saveMediaQueryOrder ( ?array  $a_order_nr = null)

Save media query order.

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

2668 : void {
2669 $ilDB = $this->db;
2670
2671 $mqueries = $this->getMediaQueries();
2672 if (is_array($a_order_nr)) {
2673 foreach ($mqueries as $k => $mq) {
2674 $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
2675 }
2676 $mqueries = ilArrayUtil::sortArray($mqueries, "order_nr", "", true);
2677 }
2678 $cnt = 10;
2679 foreach ($mqueries as $mq) {
2680 $ilDB->manipulate(
2681 "UPDATE sty_media_query SET " .
2682 " order_nr = " . $ilDB->quote($cnt, "integer") .
2683 " WHERE id = " . $ilDB->quote($mq["id"], "integer")
2684 );
2685 $cnt += 10;
2686 }
2687 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)

◆ setCharacteristics()

ilObjStyleSheet::setCharacteristics ( array  $a_chars)

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

959 : void
960 {
961 $this->chars = $a_chars;
962 }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir ( string  $a_dir)

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

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

1599 : void
1600 {
1601 $this->export_sub_dir = $a_dir;
1602 }

◆ setScope()

ilObjStyleSheet::setScope ( int  $a_scope)

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

534 : void
535 {
536 $this->scope = $a_scope;
537 }

◆ setStyle()

ilObjStyleSheet::setStyle ( array  $a_style)

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

1477 : void
1478 {
1479 $this->style = $a_style;
1480 }

◆ setUpToDate()

ilObjStyleSheet::setUpToDate ( bool  $a_up_to_date = true)

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

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

524 : void
525 {
526 $this->up_to_date = $a_up_to_date;
527 }

◆ templateExists()

ilObjStyleSheet::templateExists ( string  $a_template_name)

Check whether template exists.

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

2824 : bool {
2825 $ilDB = $this->db;
2826
2827 $set = $ilDB->query("SELECT * FROM style_template WHERE " .
2828 "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2829 "name = " . $ilDB->quote($a_template_name, "text"));
2830 if ($ilDB->fetchAssoc($set)) {
2831 return true;
2832 }
2833 return false;
2834 }

◆ update()

ilObjStyleSheet::update ( )

Reimplemented from ilObject.

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

1441 : bool
1442 {
1443 $ilDB = $this->db;
1444
1445 parent::update();
1446 $this->read(); // this could be done better
1447 $this->writeCSSFile();
1448
1449 $q = "UPDATE style_data " .
1450 "SET category = " . $ilDB->quote($this->getScope(), "integer") .
1451 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
1452 $ilDB->manipulate($q);
1453
1454 return true;
1455 }

References $ilDB, $q, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ updateMediaQuery()

ilObjStyleSheet::updateMediaQuery ( int  $a_id,
string  $a_mquery 
)

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

2617 : void {
2618 $ilDB = $this->db;
2619
2620 $ilDB->manipulate(
2621 "UPDATE sty_media_query SET " .
2622 " mquery = " . $ilDB->quote($a_mquery, "text") .
2623 " WHERE id = " . $ilDB->quote($a_id, "integer")
2624 );
2625 }

◆ updateStyleParameter()

ilObjStyleSheet::updateStyleParameter ( int  $a_id,
string  $a_value 
)

update style parameter per id

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

1463 : void {
1464 $ilDB = $this->db;
1465
1466 $q = "UPDATE style_parameter SET VALUE = " .
1467 $ilDB->quote($a_value, "text") . " WHERE id = " .
1468 $ilDB->quote($a_id, "integer");
1469 $style_set = $ilDB->manipulate($q);
1470 }

◆ updateTemplate()

ilObjStyleSheet::updateTemplate ( int  $a_t_id,
string  $a_name,
array  $a_classes 
)

Update table template.

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

2781 : void {
2782 $ilDB = $this->db;
2783
2784 $ilDB->manipulate("UPDATE style_template SET " .
2785 "name = " . $ilDB->quote($a_name, "text") .
2786 " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
2787
2788 $ilDB->manipulate(
2789 "DELETE FROM style_template_class WHERE " .
2790 "template_id = " . $ilDB->quote($a_t_id, "integer")
2791 );
2792 foreach ($a_classes as $t => $c) {
2793 $ilDB->manipulate("INSERT INTO style_template_class " .
2794 "(template_id, class_type, class)" .
2795 " VALUES (" .
2796 $ilDB->quote($a_t_id, "integer") . "," .
2797 $ilDB->quote($t, "text") . "," .
2798 $ilDB->quote($c, "text") .
2799 ")");
2800 }
2801 }

References $c, and $ilDB.

◆ writeCSSFile()

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

write css file to webspace directory

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

1332 : void {
1333 $style_manager = $this->domain->style($this->getId());
1334 if ($style_manager->writeCss()) {
1335 $this->setUpToDate();
1336 }
1337 }

◆ writeOwner()

static ilObjStyleSheet::writeOwner (   $obj_id,
  $style_id 
)
static

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

558 : void
559 {
560 global $DIC;
561 $ilDB = $DIC->database();
562
563 $q = "UPDATE style_data SET owner_obj = " .
564 $ilDB->quote((int) $obj_id, "integer") .
565 " WHERE id = " . $ilDB->quote($style_id, "integer");
566 $ilDB->manipulate($q);
567 }

References $DIC, $ilDB, and $q.

Referenced by ILIAS\Style\Content\Object\ObjectManager\cloneTo(), ilObjectCopyGUI\copyParentPage(), ilLearningModuleImporter\finalProcessing(), ilStyleDataSet\importRecord(), and ILIAS\Style\Content\Object\ObjectManager\setOwnerOfStyle().

+ Here is the caller graph for this function:

◆ writeStyleSetting()

ilObjStyleSheet::writeStyleSetting ( string  $a_name,
string  $a_value 
)

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

3008 : void {
3009 $ilDB = $this->db;
3010
3011 $ilDB->manipulate(
3012 "DELETE FROM style_setting WHERE " .
3013 " style_id = " . $ilDB->quote($this->getId(), "integer") .
3014 " AND name = " . $ilDB->quote($a_name, "text")
3015 );
3016
3017 $ilDB->manipulate("INSERT INTO style_setting " .
3018 "(style_id, name, value) VALUES (" .
3019 $ilDB->quote($this->getId(), "integer") . "," .
3020 $ilDB->quote($a_name, "text") . "," .
3021 $ilDB->quote($a_value, "text") .
3022 ")");
3023 }

◆ writeStyleUsage()

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

Write style usage.

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

3048 : void {
3049 global $DIC;
3050
3051 $ilDB = $DIC->database();
3052
3053 $ilDB->replace(
3054 "style_usage",
3055 array(
3056 "obj_id" => array("integer", $a_obj_id)),
3057 array(
3058 "style_id" => array("integer", $a_style_id))
3059 );
3060 }

Referenced by ILIAS\Style\Content\Object\ObjectManager\cloneTo(), ilObjectCopyGUI\copyParentPage(), ilContainerImporter\finalProcessing(), ilLearningModuleImporter\finalProcessing(), ilStyleDataSet\importRecord(), ILIAS\Style\Content\Object\ObjectManager\inheritFromParent(), and ILIAS\Style\Content\Object\ObjectManager\updateStyleId().

+ Here is the caller graph for this function:

◆ writeTemplatePreview()

ilObjStyleSheet::writeTemplatePreview ( int  $a_t_id,
string  $a_preview_html 
)

Write table template preview.

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

2935 : void {
2936 $ilDB = $this->db;
2937 $a_preview_html = str_replace(' width=""', "", $a_preview_html);
2938 $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
2939 $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
2940 //echo "1-".strlen($a_preview_html)."-";
2941 //echo htmlentities($a_preview_html);
2942 if (strlen($a_preview_html) > 4000) {
2943 //echo "2";
2944 $a_preview_html = "";
2945 }
2946 $ilDB->manipulate("UPDATE style_template SET " .
2947 "preview = " . $ilDB->quote($a_preview_html, "text") .
2948 " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
2949 }

Field Documentation

◆ $assigned_tags

array ilObjStyleSheet::$assigned_tags
static

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

◆ $basic_style_dom

DOMDocument ilObjStyleSheet::$basic_style_dom = null
staticprotected

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

◆ $basic_style_file

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

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

◆ $basic_style_image_dir

string ilObjStyleSheet::$basic_style_image_dir = "./components/ILIAS/COPage/basic_style/images"
staticprotected

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

◆ $basic_style_zip

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

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

Referenced by getBasicZipPath().

◆ $chars

array ilObjStyleSheet::$chars = []
protected

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

◆ $chars_by_type

array ilObjStyleSheet::$chars_by_type = []
protected

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

◆ $core_styles

array ilObjStyleSheet::$core_styles
static

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

◆ $domain

InternalDomainService ilObjStyleSheet::$domain
protected

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

◆ $end_styles

array ilObjStyleSheet::$end_styles = []
protected

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

◆ $expandable_types

array ilObjStyleSheet::$expandable_types
static
Initial value:
= array(
"text_block",
"text_inline", "section", "media_cont", "media_caption", "table", "table_cell", "flist_li", "table_caption",
"list_o", "list_u", "list_item",
"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 289 of file class.ilObjStyleSheet.php.

◆ $export_sub_dir

string ilObjStyleSheet::$export_sub_dir = ""
protected

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

◆ $filtered_groups

array 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", "li", "p"))

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

◆ $hidden_chars

array ilObjStyleSheet::$hidden_chars = []
protected

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

◆ $hideable_types

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

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

◆ $is_3_10_skin

bool ilObjStyleSheet::$is_3_10_skin = false
protected

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

◆ $num_unit

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

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

◆ $num_unit_no_perc

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

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

◆ $parameter

array ilObjStyleSheet::$parameter
static

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

◆ $pseudo_classes

array ilObjStyleSheet::$pseudo_classes
static
Initial value:
=
[
"a" => ["hover"],
"div" => ["hover", "before"],
"img" => ["hover"],
"li" => ["before"],
"input" => ["hover"],
]

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

◆ $repo

ILIAS Style Content InternalRepoService ilObjStyleSheet::$repo
protected

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

◆ $scope

int ilObjStyleSheet::$scope = 0
protected

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

Referenced by getScope().

◆ $style

array ilObjStyleSheet::$style = []

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

◆ $style_class

array ilObjStyleSheet::$style_class = []
protected

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

◆ $style_super_types

array 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", "strong", "em"),
"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_cont", "page_title", "page_fn")
)

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

◆ $templates

array ilObjStyleSheet::$templates
static

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

◆ $up_to_date

bool ilObjStyleSheet::$up_to_date = false
protected

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

Referenced by getUpToDate().


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