ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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...
 
 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 ()
 
 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)
 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 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 _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 div => ["hover"
 
static array before
 
static array img
 
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
 
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 = "./libs/ilias/Style/basic_style/style.xml"
 
static string $basic_style_zip = "./libs/ilias/Style/basic_style/style.zip"
 
static string $basic_style_image_dir = "./libs/ilias/Style/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 495 of file class.ilObjStyleSheet.php.

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), and ILIAS\Repository\lng().

498  {
499  global $DIC;
500 
501  $this->db = $DIC->database();
502  $this->lng = $DIC->language();
503  $this->type = "sty";
504  $this->style = array();
505  $this->ilias = $DIC["ilias"];
506  $this->domain = $DIC->contentStyle()->internal()->domain();
507 
508  if ($a_call_by_reference) {
509  $this->ilias->raiseError("Can't instantiate style object via reference id.", $this->ilias->error_obj->FATAL);
510  }
511  parent::__construct($a_id, false);
512  $this->repo = $DIC->contentStyle()->internal()->repo();
513  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
header include for all ilias files.
+ 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 2194 of file class.ilObjStyleSheet.php.

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

Referenced by _addMissingStyleClassesToStyle().

2196  : void {
2197  global $DIC;
2198 
2199  $ilDB = $DIC->database();
2200 
2201  if (is_null($a_styles)) {
2202  $styles = ilObject::_getObjectsDataForType("sty");
2203  } else {
2204  $styles = $a_styles;
2205  }
2208 
2209  // get all core image files
2210  $core_images = array();
2211  $core_dir = self::$basic_style_image_dir;
2212  if (is_dir($core_dir)) {
2213  $dir = opendir($core_dir);
2214  while ($file = readdir($dir)) {
2215  if (substr($file, 0, 1) != "." && is_file($core_dir . "/" . $file)) {
2216  $core_images[] = $file;
2217  }
2218  }
2219  }
2220 
2221  foreach ($styles as $style) {
2222  $id = $style["id"];
2223 
2224  foreach ($core_styles as $cs) {
2225  // check, whether core style class exists
2226  $set = $ilDB->queryF(
2227  "SELECT * FROM style_char WHERE style_id = %s " .
2228  "AND type = %s AND characteristic = %s",
2229  array("integer", "text", "text"),
2230  array($id, $cs["type"], $cs["class"])
2231  );
2232 
2233  // if not, add core style class
2234  if (!($rec = $ilDB->fetchAssoc($set))) {
2235  $ilDB->manipulateF(
2236  "INSERT INTO style_char (style_id, type, characteristic) " .
2237  " VALUES (%s,%s,%s) ",
2238  array("integer", "text", "text"),
2239  array($id, $cs["type"], $cs["class"])
2240  );
2241 
2242  $xpath = new DOMXPath($bdom);
2243  $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '" . $cs["tag"] . "' and @Type='" .
2244  $cs["type"] . "' and @Class='" . $cs["class"] . "']/StyleParameter");
2245  foreach ($par_nodes as $par_node) {
2246  // check whether style parameter exists
2247  $set = $ilDB->queryF(
2248  "SELECT * FROM style_parameter WHERE style_id = %s " .
2249  "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2250  array("integer", "text", "text", "text", "text"),
2251  array($id, $cs["type"], $cs["class"],
2252  $cs["tag"], $par_node->getAttribute("Name"))
2253  );
2254 
2255  // if not, create style parameter
2256  if (!($ilDB->fetchAssoc($set))) {
2257  $spid = $ilDB->nextId("style_parameter");
2258  $st = $ilDB->manipulateF(
2259  "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) " .
2260  " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2261  array("integer", "integer", "text", "text", "text", "text", "text"),
2262  array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2263  $par_node->getAttribute("Name"), $par_node->getAttribute("Value"))
2264  );
2265  }
2266  }
2267  }
2268  }
2269 
2270  // now check, whether some core image files are missing
2273  foreach ($core_images as $cim) {
2274  if (!is_file($imdir . "/" . $cim)) {
2275  copy($core_dir . "/" . $cim, $imdir . "/" . $cim);
2276  }
2277  }
2278  }
2279  }
static _getImagesDirectory(int $a_style_id)
static _getObjectsDataForType(string $type, bool $omit_trash=false)
get all objects of a certain type
global $DIC
Definition: feed.php:28
static _createImagesDirectory(int $a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _addMissingStyleClassesToStyle()

static ilObjStyleSheet::_addMissingStyleClassesToStyle ( int  $a_id)
static

Add missing style classes to all styles.

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

References _addMissingStyleClassesToAllStyles().

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

2185  : void {
2186  $styles = array(array("id" => $a_id));
2188  }
static _addMissingStyleClassesToAllStyles(?array $a_styles=null)
Add missing style classes to all styles todo: add mq_id and custom handling.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _createImagesDirectory()

static ilObjStyleSheet::_createImagesDirectory ( int  $a_style_id)
static

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

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

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

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

1095  : void {
1096  global $DIC;
1097 
1098  $ilErr = $DIC["ilErr"];
1099 
1100  $sty_data_dir = ilFileUtils::getWebspaceDir() . "/sty";
1101  if (!is_dir($sty_data_dir)) {
1102  ilFileUtils::makeDir($sty_data_dir);
1103  }
1104  if (!is_writable($sty_data_dir)) {
1105  $ilErr->raiseError("Style data directory (" . $sty_data_dir
1106  . ") not writeable.", $ilErr->FATAL);
1107  }
1108 
1109  $style_dir = $sty_data_dir . "/sty_" . $a_style_id;
1110  if (!is_dir($style_dir)) {
1111  ilFileUtils::makeDir($style_dir);
1112  }
1113  if (!is_dir($style_dir)) {
1114  $ilErr->raiseError("Creation of style directory failed (" .
1115  $style_dir . ").", $ilErr->FATAL);
1116  }
1117 
1118  // create images subdirectory
1119  $im_dir = $style_dir . "/images";
1120  if (!is_dir($im_dir)) {
1121  ilFileUtils::makeDir($im_dir);
1122  }
1123  if (!is_dir($im_dir)) {
1124  $ilErr->raiseError("Creation of Import Directory failed (" .
1125  $im_dir . ").", $ilErr->FATAL);
1126  }
1127 
1128  // create thumbnails directory
1129  $thumb_dir = $style_dir . "/images/thumbnails";
1130  ilFileUtils::makeDir($thumb_dir);
1131  if (!is_dir($thumb_dir)) {
1132  $ilErr->raiseError("Creation of Import Directory failed (" .
1133  $thumb_dir . ").", $ilErr->FATAL);
1134  }
1135  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$ilErr
Definition: raiseError.php:17
global $DIC
Definition: feed.php:28
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _determineTag()

static ilObjStyleSheet::_determineTag ( string  $a_type)
static

◆ _explodeRGB()

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

Explode an RGB string into an array.

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

References $r.

Referenced by _getColorFlavor().

2619  : array {
2620  $r["r"] = substr($a_rgb, 0, 2);
2621  $r["g"] = substr($a_rgb, 2, 2);
2622  $r["b"] = substr($a_rgb, 4, 2);
2623  if ($as_dec) {
2624  $r["r"] = self::hexdec($r["r"]);
2625  $r["g"] = self::hexdec($r["g"]);
2626  $r["b"] = self::hexdec($r["b"]);
2627  }
2628 
2629  return $r;
2630  }
$r
+ Here is the caller graph for this function:

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

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

Referenced by _addMissingStyleClassesToAllStyles().

750  : DOMDocument
751  {
752  if (!is_object(self::$basic_style_dom)) {
753  self::$basic_style_dom = new DOMDocument();
754  self::$basic_style_dom->load(self::$basic_style_file);
755  }
756 
757  return self::$basic_style_dom;
758  }
+ Here is the caller graph for this function:

◆ _getClonableContentStyles()

static ilObjStyleSheet::_getClonableContentStyles ( )
static

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

Returns
array<int,string>

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

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

Referenced by ilObjStyleSheetGUI\getCloneForm().

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

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

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

2593  : string {
2594  $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
2595  $hls = ilObjStyleSheet::_RGBToHLS($rgb);
2596 
2597  if ($a_i > 0) {
2598  $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
2599  }
2600  if ($a_i < 0) {
2601  $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
2602  }
2603 
2604  $rgb = ilObjStyleSheet::_HLSToRGB($hls);
2605 
2606  foreach ($rgb as $k => $v) {
2607  $rgb[$k] = str_pad(dechex((int) $v), 2, "0", STR_PAD_LEFT);
2608  }
2609 
2610  return $rgb["r"] . $rgb["g"] . $rgb["b"];
2611  }
static _explodeRGB(string $a_rgb, bool $as_dec=false)
Explode an RGB string into an array.
static _RGBToHLS(array $a_rgb)
RGB to HLS (both arrays, 0..255)
static _HLSToRGB(array $a_hls)
HLS to RGB (both arrays, 0..255)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getCoreStyles()

static ilObjStyleSheet::_getCoreStyles ( )
static

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

References _determineTag().

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

2116  : array
2117  {
2118  $c_styles = array();
2119  foreach (self::$core_styles as $cstyle) {
2120  $c_styles[$cstyle["type"] . "." . ilObjStyleSheet::_determineTag($cstyle["type"]) . "." . $cstyle["class"]]
2121  = array("type" => $cstyle["type"],
2122  "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2123  "class" => $cstyle["class"]);
2124  }
2125  return $c_styles;
2126  }
static _determineTag(string $a_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFilteredGroups()

static ilObjStyleSheet::_getFilteredGroups ( )
static

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

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

2067  : array
2068  {
2069  return self::$filtered_groups;
2070  }
+ Here is the caller graph for this function:

◆ _getImagesDirectory()

static ilObjStyleSheet::_getImagesDirectory ( int  $a_style_id)
static

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

References ilFileUtils\getWebspaceDir().

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

1142  : string
1143  {
1144  return ilFileUtils::getWebspaceDir() . "/sty/sty_" . $a_style_id .
1145  "/images";
1146  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getPseudoClasses()

static ilObjStyleSheet::_getPseudoClasses ( string  $tag)
static

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

2152  : array
2153  {
2154  return self::$pseudo_classes[$tag] ?? [];
2155  }

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

References $DIC, $ilDB, $ilSetting, $path, $q, $res, ilObject\$tree, ilObject\_lookupTitle(), ilTree\getPathId(), ILIAS\Repository\int(), and ilTree\isInTree().

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

665  : array {
666  global $DIC;
667 
668  $ilDB = $DIC->database();
669  $ilSetting = $DIC->settings();
670  $tree = $DIC->repositoryTree();
671 
672  $default_style = $ilSetting->get("default_content_style_id");
673 
674  $and_str = "";
675  if (!$a_include_deactivated) {
676  $and_str = " AND active = 1";
677  }
678 
679  $q = "SELECT * FROM style_data " .
680  " WHERE standard = 1" . $and_str;
681  $res = $ilDB->query($q);
682  $styles = array();
683  while ($sty = $ilDB->fetchAssoc($res)) {
684  if (!$a_exclude_default_style || $default_style != $sty["id"]) {
685  // check scope
686  if ($a_scope > 0 && $sty["category"] > 0) {
687  if ($tree->isInTree((int) $sty["category"]) &&
688  $tree->isInTree($a_scope)) {
689  $path = $tree->getPathId($a_scope);
690  if (!in_array((int) $sty["category"], $path)) {
691  continue;
692  }
693  }
694  }
695  $styles[(int) $sty["id"]] = ilObject::_lookupTitle((int) $sty["id"]);
696  }
697  }
698 
699  return $styles;
700  }
$res
Definition: ltiservices.php:69
ilTree $tree
isInTree(?int $a_node_id)
get all information of a node.
$path
Definition: ltiservices.php:32
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
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...
global $ilSetting
Definition: privfeed.php:18
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getStyleParameterInputType()

static ilObjStyleSheet::_getStyleParameterInputType ( string  $par)
static

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

Referenced by ilStyleCharacteristicGUI\initTagStyleForm().

2038  : string
2039  {
2040  $input = self::$parameter[$par]["input"];
2041  return $input;
2042  }
+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

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

2074  : array {
2075  if ($a_no_percentage) {
2076  return self::$num_unit_no_perc;
2077  }
2078  return self::$num_unit;
2079  }
+ Here is the caller graph for this function:

◆ _getStyleParameters()

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

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

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

2052  : array {
2053  if ($a_tag == "") {
2054  return self::$parameter;
2055  }
2056  $par = array();
2057  foreach (self::$parameter as $k => $v) {
2058  if (isset(self::$filtered_groups[$v["group"]]) &&
2059  !in_array($a_tag, self::$filtered_groups[$v["group"]])) {
2060  continue;
2061  }
2062  $par[$k] = $v;
2063  }
2064  return $par;
2065  }
+ Here is the caller graph for this function:

◆ _getStyleParameterSubPar()

static ilObjStyleSheet::_getStyleParameterSubPar ( string  $par)
static

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

2044  : string
2045  {
2046  $subpar = self::$parameter[$par]["subpar"];
2047  return $subpar;
2048  }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues ( string  $par)
static

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

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

2083  : array {
2084  return self::$parameter[$par]["values"];
2085  }
+ Here is the caller graph for this function:

◆ _getStyleSuperTypeForType()

static ilObjStyleSheet::_getStyleSuperTypeForType ( string  $a_type)
static

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

Referenced by ilObjStyleSheetGUI\__construct().

2104  : string {
2105  foreach (self::$style_super_types as $s => $t) {
2106  if (in_array($a_type, $t)) {
2107  return $s;
2108  }
2109  if ($a_type == $s) {
2110  return $s;
2111  }
2112  }
2113  return "";
2114  }
+ 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 2143 of file class.ilObjStyleSheet.php.

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

2145  : array {
2146  if ($a_template_type == "") {
2147  return self::$templates;
2148  }
2149  return self::$templates[$a_template_type];
2150  }
+ 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 2686 of file class.ilObjStyleSheet.php.

Referenced by _getColorFlavor().

2686  : array
2687  {
2688  $h = $a_hls["h"] / 255;
2689  $l = $a_hls["l"] / 255;
2690  $s = $a_hls["s"] / 255;
2691  $temp3 = 0;
2692 
2693  $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
2694 
2695  // If S=0, define R, G, and B all to L
2696  if ($s == 0) {
2697  $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
2698  } else {
2699  if ($l < 0.5) {
2700  $temp2 = $l * (1.0 + $s);
2701  } else {
2702  $temp2 = $l + $s - $l * $s;
2703  }
2704 
2705  $temp1 = 2.0 * $l - $temp2;
2706 
2707 
2708  # For each of R, G, B, compute another temporary value, temp3, as follows:
2709  foreach ($rgb as $k => $v) {
2710  switch ($k) {
2711  case "r":
2712  $temp3 = $h + 1.0 / 3.0;
2713  break;
2714 
2715  case "g":
2716  $temp3 = $h;
2717  break;
2718 
2719  case "b":
2720  $temp3 = $h - 1.0 / 3.0;
2721  break;
2722  }
2723  if ($temp3 < 0) {
2724  $temp3 = $temp3 + 1.0;
2725  }
2726  if ($temp3 > 1) {
2727  $temp3 = $temp3 - 1.0;
2728  }
2729 
2730  if (6.0 * $temp3 < 1) {
2731  $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
2732  } elseif (2.0 * $temp3 < 1) {
2733  $rgb[$k] = $temp2;
2734  } elseif (3.0 * $temp3 < 2) {
2735  $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0 / 3.0) - $temp3) * 6.0;
2736  } else {
2737  $rgb[$k] = $temp1;
2738  }
2739  }
2740  }
2741 
2742  $rgb["r"] = round($rgb["r"] * 255);
2743  $rgb["g"] = round($rgb["g"] * 255);
2744  $rgb["b"] = round($rgb["b"] * 255);
2745 
2746  return $rgb;
2747  }
+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable ( string  $a_type)
static

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

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

2092  : bool
2093  {
2094  return in_array($a_type, self::$expandable_types);
2095  }
+ Here is the caller graph for this function:

◆ _isHideable()

static ilObjStyleSheet::_isHideable ( string  $a_type)
static

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

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

2097  : bool
2098  {
2099  return in_array($a_type, self::$hideable_types);
2100  }
+ Here is the caller graph for this function:

◆ _lookupActive()

static ilObjStyleSheet::_lookupActive ( int  $a_id)
static

Lookup active flag.

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

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

Referenced by ilContentStyleSettingsGUI\edit().

643  : bool
644  {
645  global $DIC;
646 
647  $ilDB = $DIC->database();
648 
649  $q = "SELECT * FROM style_data " .
650  " WHERE id = " . $ilDB->quote($a_id, "integer");
651  $res = $ilDB->query($q);
652  $sty = $ilDB->fetchAssoc($res);
653 
654  return (bool) $sty["active"];
655  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _lookupStandard()

static ilObjStyleSheet::_lookupStandard ( int  $a_id)
static

Lookup standard flag.

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

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

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

614  : bool
615  {
616  global $DIC;
617 
618  $ilDB = $DIC->database();
619 
620  $q = "SELECT * FROM style_data " .
621  " WHERE id = " . $ilDB->quote($a_id, "integer");
622  $res = $ilDB->query($q);
623  $sty = $ilDB->fetchAssoc($res);
624 
625  return (bool) ($sty["standard"] ?? false);
626  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ 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 3167 of file class.ilObjStyleSheet.php.

References $DIC, and $ilDB.

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

3170  : ?int {
3171  global $DIC;
3172 
3173  $ilDB = $DIC->database();
3174 
3175  $set = $ilDB->query("SELECT id FROM style_template " .
3176  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer") .
3177  " AND name = " . $ilDB->quote($a_name, "text"));
3178  if ($rec = $ilDB->fetchAssoc($set)) {
3179  return (int) $rec["id"];
3180  }
3181 
3182  return null;
3183  }
global $DIC
Definition: feed.php:28
+ 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 3064 of file class.ilObjStyleSheet.php.

References $DIC, and $ilDB.

Referenced by ilObjStyleSheetGUI\updateTemplateObject().

3064  : ?string
3065  {
3066  global $DIC;
3067 
3068  $ilDB = $DIC->database();
3069 
3070  $set = $ilDB->query("SELECT name FROM style_template WHERE " .
3071  " id = " . $ilDB->quote($a_t_id, "integer"));
3072 
3073  if ($rec = $ilDB->fetchAssoc($set)) {
3074  return $rec["name"];
3075  }
3076 
3077  return null;
3078  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _lookupUpToDate()

static ilObjStyleSheet::_lookupUpToDate ( int  $a_id)
static

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

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

Referenced by getContentStylePath().

568  : bool
569  {
570  global $DIC;
571 
572  $ilDB = $DIC->database();
573 
574  $q = "SELECT uptodate FROM style_data " .
575  " WHERE id = " . $ilDB->quote($a_id, "integer");
576  $res = $ilDB->query($q);
577  $sty = $ilDB->fetchAssoc($res);
578 
579  return (bool) $sty["uptodate"];
580  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _RGBToHLS()

static ilObjStyleSheet::_RGBToHLS ( array  $a_rgb)
static

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

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

References Vendor\Package\$b, and $r.

Referenced by _getColorFlavor().

2644  : array
2645  {
2646  $r = $a_rgb["r"] / 255;
2647  $g = $a_rgb["g"] / 255;
2648  $b = $a_rgb["b"] / 255;
2649  $h = 0;
2650 
2651  // max / min
2652  $max = max($r, $g, $b);
2653  $min = min($r, $g, $b);
2654 
2655  //lightness
2656  $l = ($max + $min) / 2;
2657 
2658  if ($max == $min) {
2659  $s = 0;
2660  } else {
2661  if ($l < 0.5) {
2662  $s = ($max - $min) / ($max + $min);
2663  } else {
2664  $s = ($max - $min) / (2.0 - $max - $min);
2665  }
2666 
2667  if ($r == $max) {
2668  $h = ($g - $b) / ($max - $min);
2669  } elseif ($g == $max) {
2670  $h = 2.0 + ($b - $r) / ($max - $min);
2671  } elseif ($b == $max) {
2672  $h = 4.0 + ($r - $g) / ($max - $min);
2673  }
2674  }
2675 
2676  $hls["h"] = round(($h / 6) * 255);
2677  $hls["l"] = round($l * 255);
2678  $hls["s"] = round($s * 255);
2679 
2680  return $hls;
2681  }
$r
+ Here is the caller graph for this function:

◆ _writeActive()

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

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

References $DIC, $ilDB, and $q.

Referenced by ilContentStyleSettingsGUI\saveActiveStyles().

628  : void
629  {
630  global $DIC;
631 
632  $ilDB = $DIC->database();
633 
634  $q = "UPDATE style_data SET active = " .
635  $ilDB->quote((int) $a_active, "integer") .
636  " WHERE id = " . $ilDB->quote($a_id, "integer");
637  $ilDB->manipulate($q);
638  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _writeScope()

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

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

References $DIC, $ilDB, and $q.

Referenced by ilContentStyleSettingsGUI\saveScope().

599  : void
600  {
601  global $DIC;
602 
603  $ilDB = $DIC->database();
604 
605  $q = "UPDATE style_data SET category = " .
606  $ilDB->quote($a_scope, "integer") .
607  " WHERE id = " . $ilDB->quote($a_id, "integer");
608  $ilDB->manipulate($q);
609  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ 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 585 of file class.ilObjStyleSheet.php.

References $DIC, $ilDB, and $q.

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

588  : void {
589  global $DIC;
590 
591  $ilDB = $DIC->database();
592 
593  $q = "UPDATE style_data SET standard = " .
594  $ilDB->quote((int) $a_std, "integer") .
595  " WHERE id = " . $ilDB->quote($a_id, "integer");
596  $ilDB->manipulate($q);
597  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _writeUpToDate()

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

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

References $DIC, $ilDB, and $q.

Referenced by ILIAS\Style\Content\CharacteristicManager\addCharacteristic(), addCharacteristic(), ILIAS\Style\Content\CharacteristicManager\deleteCharacteristic(), ilStyleCharacteristicGUI\pasteCharacteristics(), ILIAS\Style\Content\ColorManager\updateColor(), and writeCSSFile().

546  : void {
547  global $DIC;
548 
549  $ilDB = $DIC->database();
550 
551  $q = "UPDATE style_data SET uptodate = " .
552  $ilDB->quote((int) $a_up_to_date, "integer") .
553  " WHERE id = " . $ilDB->quote($a_id, "integer");
554  $ilDB->manipulate($q);
555  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ 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 909 of file class.ilObjStyleSheet.php.

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

915  : void {
916  $ilDB = $this->db;
917 
918  // delete characteristic record
919  $ilDB->insert("style_char", [
920  "style_id" => ["integer", $this->getId()],
921  "type" => ["text", $a_type],
922  "characteristic" => ["text", $a_char],
923  "hide" => ["integer", (int) $a_hidden],
924  "outdated" => ["integer", (int) $outdated],
925  "order_nr" => ["integer", $order_nr]
926  ]);
927 
928  $this->setUpToDate(false);
929  $this->_writeUpToDate($this->getId(), false);
930  }
static _writeUpToDate(int $a_id, bool $a_up_to_date)
ilDBInterface $db
setUpToDate(bool $a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
+ Here is the call graph for this function:

◆ addMediaQuery()

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

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

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

Referenced by create().

2776  : int {
2777  $ilDB = $this->db;
2778 
2779  $id = $ilDB->nextId("sty_media_query");
2780  if ($order_nr == 0) {
2781  $order_nr = $this->getMaxMQueryOrderNr() + 10;
2782  }
2783 
2784  $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
2785  " VALUES (" .
2786  $ilDB->quote($id, "integer") . "," .
2787  $ilDB->quote($this->getId(), "integer") . "," .
2788  $ilDB->quote($a_mquery, "text") . "," .
2789  $ilDB->quote($order_nr, "integer") .
2790  ")");
2791 
2792  return $id;
2793  }
ilDBInterface $db
getMaxMQueryOrderNr()
Get maximum media query order nr.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

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

1056  : void {
1057  $ilDB = $this->db;
1058 
1059  $avail_params = $this->getAvailableParameters();
1060  $tag = explode(".", $a_tag);
1061  $value = $avail_params[$a_par][0];
1062  $id = $ilDB->nextId("style_parameter");
1063  $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1064  "(" .
1065  $ilDB->quote($id, "integer") . "," .
1066  $ilDB->quote($this->getId(), "integer") . "," .
1067  $ilDB->quote($a_type, "text") . "," .
1068  $ilDB->quote($tag[0], "text") . "," .
1069  $ilDB->quote($tag[1], "text") . "," .
1070  $ilDB->quote($a_par, "text") . "," .
1071  $ilDB->quote($value, "text") . "," .
1072  $ilDB->quote($a_mq_id, "integer") . "," .
1073  $ilDB->quote($a_custom, "integer") .
1074  ")";
1075  $ilDB->manipulate($q);
1076  $this->read();
1077  $this->writeCSSFile();
1078  }
read()
read style properties
ilDBInterface $db
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:

◆ addTemplate()

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

Add table template.

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

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

Referenced by create().

2940  : int {
2941  $ilDB = $this->db;
2942 
2943  $tid = $ilDB->nextId("style_template");
2944  $ilDB->manipulate("INSERT INTO style_template " .
2945  "(id, style_id, name, temp_type)" .
2946  " VALUES (" .
2947  $ilDB->quote($tid, "integer") . "," .
2948  $ilDB->quote($this->getId(), "integer") . "," .
2949  $ilDB->quote($a_name, "text") . "," .
2950  $ilDB->quote($a_type, "text") .
2951  ")");
2952 
2953  foreach ($a_classes as $t => $c) {
2954  $ilDB->manipulate("INSERT INTO style_template_class " .
2955  "(template_id, class_type, class)" .
2956  " VALUES (" .
2957  $ilDB->quote($tid, "integer") . "," .
2958  $ilDB->quote($t, "text") . "," .
2959  $ilDB->quote($c, "text") .
2960  ")");
2961  }
2962 
2963  $this->writeTemplatePreview(
2964  $tid,
2965  ilObjStyleSheetGUI::_getTemplatePreview($this, $a_type, $tid, true)
2966  );
2967 
2968  return $tid;
2969  }
static _getTemplatePreview(ilObjStyleSheet $a_style, string $a_type, int $a_t_id, bool $a_small_mode=false)
Get table template preview.
ilDBInterface $db
writeTemplatePreview(int $a_t_id, string $a_preview_html)
Write table template preview.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTemplateClass()

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

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

References ilObject\$db, and $ilDB.

3004  : void {
3005  $ilDB = $this->db;
3006 
3007  $ilDB->manipulate("INSERT INTO style_template_class " .
3008  "(template_id, class_type, class)" .
3009  " VALUES (" .
3010  $ilDB->quote($a_t_id, "integer") . "," .
3011  $ilDB->quote($a_type, "text") . "," .
3012  $ilDB->quote($a_class, "text") .
3013  ")");
3014  }
ilDBInterface $db

◆ characteristicExists()

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

Check whether characteristic exists.

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

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

895  : bool {
896  $ilDB = $this->db;
897 
898  $set = $ilDB->queryF(
899  "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
900  array("integer", "text", "text"),
901  array($this->getId(), $a_char, $a_style_type)
902  );
903  if ($ilDB->fetchAssoc($set)) {
904  return true;
905  }
906  return false;
907  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ cleanExportDirectory()

ilObjStyleSheet::cleanExportDirectory ( )

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

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

Referenced by export().

1755  : void
1756  {
1757  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1758  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1759  // create export subdirectory
1760  $ex_dir = $style_dir . "/export";
1761 
1762  if (is_dir($ex_dir)) {
1763  ilFileUtils::delDir($ex_dir, true);
1764  }
1765  }
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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyImagesToDir()

ilObjStyleSheet::copyImagesToDir ( string  $a_target)

Copy images to directory.

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

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

1036  : void
1037  {
1038  ilFileUtils::rCopy($this->getImagesDirectory(), $a_target);
1039  }
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
+ 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 769 of file class.ilObjStyleSheet.php.

References Vendor\Package\$c, ilObject\$db, $DIC, $id, $ilDB, $q, $service, _createImagesDirectory(), _getTemplateClassTypes(), addMediaQuery(), addTemplate(), createFromXMLFile(), createImagesDirectory(), ilObject\getId(), getImagesDirectory(), getScope(), ilFileUtils\rCopy(), read(), and writeCSSFile().

772  : int {
773  global $DIC;
774 
775  $ilDB = $this->db;
776 
777  $id = parent::create();
778 
779  $service = $DIC->contentStyle()
780  ->internal();
781  $access_manager = $service->domain()->access(
782  0,
783  $DIC->user()->getId()
784  );
785  $access_manager->enableWrite(true);
786  $color_manager = $service->domain()->color($this->getId(), $access_manager);
787 
788  if ($a_from_style == 0) {
789  if (!$a_import_mode) {
790  // copy styles from basic style
791  $this->createFromXMLFile(self::$basic_style_file, true);
792 
793  // copy images from basic style
794  $this->createImagesDirectory();
795 
796  // cross filesystem (lib -> web) rCopy
798  self::$basic_style_image_dir,
799  $this->getImagesDirectory()
800  );
801  } else {
802  // add style_data record
803  $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
804  "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
805  $ilDB->quote($this->getScope(), "integer") . ")";
806  $ilDB->manipulate($q);
808  }
809  } else {
810  // get style parameter records
811  $def = array();
812  $q = "SELECT * FROM style_parameter WHERE style_id = " .
813  $ilDB->quote($a_from_style, "integer");
814  $par_set = $ilDB->query($q);
815  while ($par_rec = $ilDB->fetchAssoc($par_set)) {
816  $def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
817  "parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
818  "type" => $par_rec["type"], "mq_id" => $par_rec["mq_id"], "custom" => $par_rec["custom"]);
819  }
820 
821  $char_repo = $this->repo->characteristic();
822  $char_repo->cloneAllFromStyle($a_from_style, $this->getId());
823 
824 
825  // copy media queries
826  $from_style = new ilObjStyleSheet($a_from_style);
827  $mqs = $from_style->getMediaQueries();
828  $mq_mapping = array();
829  foreach ($mqs as $mq) {
830  $nid = $this->addMediaQuery($mq["mquery"]);
831  $mq_mapping[$mq["id"]] = $nid;
832  }
833 
834  // default style settings
835  foreach ($def as $sty) {
836  $id = $ilDB->nextId("style_parameter");
837  $q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
838  "(" .
839  $ilDB->quote($id, "integer") . "," .
840  $ilDB->quote($this->getId(), "integer") . "," .
841  $ilDB->quote($sty["tag"], "text") . "," .
842  $ilDB->quote($sty["class"], "text") . "," .
843  $ilDB->quote($sty["parameter"], "text") . "," .
844  $ilDB->quote($sty["value"], "text") . "," .
845  $ilDB->quote($sty["type"], "text") . "," .
846  $ilDB->quote((int) ($mq_mapping[$sty["mq_id"]] ?? 0), "integer") . "," .
847  $ilDB->quote($sty["custom"], "integer") .
848  ")";
849  $ilDB->manipulate($q);
850  }
851 
852  // add style_data record
853  $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
854  "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
855  $ilDB->quote($this->getScope(), "integer") . ")";
856  $ilDB->manipulate($q);
857 
858  // copy images
859  $this->createImagesDirectory();
861  $from_style->getImagesDirectory(),
862  $this->getImagesDirectory()
863  );
864 
865  // copy colors
866  $colors = $from_style->getColors();
867  foreach ($colors as $c) {
868  $color_manager->addColor($c["name"], $c["code"]);
869  }
870 
871  // copy templates
873  foreach ($tcts as $tct => $v) {
874  $templates = $from_style->getTemplates($tct);
875  foreach ($templates as $t) {
876  $this->addTemplate($tct, $t["name"], $t["classes"]);
877  }
878  }
879  }
880 
881  $this->read();
882  if (!$a_import_mode) {
883  $this->writeCSSFile();
884  }
885 
886  return $id;
887  }
read()
read style properties
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
addTemplate(string $a_type, string $a_name, array $a_classes)
Add table template.
global $DIC
Definition: feed.php:28
ilDBInterface $db
static _createImagesDirectory(int $a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$q
Definition: shib_logout.php:21
static _getTemplateClassTypes(string $a_template_type="")
Get template class types.
$service
Definition: ltiservices.php:43
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
createFromXMLFile(string $a_file, bool $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
addMediaQuery(string $a_mquery, int $order_nr=0)
+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjStyleSheet::createExportDirectory ( )

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

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

Referenced by createExportSubDirectory(), and export().

1728  : string
1729  {
1730  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1731  ilFileUtils::makeDir($sty_data_dir);
1732  if (!is_writable($sty_data_dir)) {
1733  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
1734  . ") not writeable.", $this->ilias->error_obj->FATAL);
1735  }
1736 
1737  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1738  ilFileUtils::makeDir($style_dir);
1739  if (!is_dir($style_dir)) {
1740  $this->ilias->raiseError("Creation of style directory failed (" .
1741  $style_dir . ").", $this->ilias->error_obj->FATAL);
1742  }
1743 
1744  // create export subdirectory
1745  $ex_dir = $style_dir . "/export";
1746  ilFileUtils::makeDir($ex_dir);
1747  if (!is_dir($ex_dir)) {
1748  $this->ilias->raiseError("Creation of Import Directory failed (" .
1749  $ex_dir . ").", $this->ilias->error_obj->FATAL);
1750  }
1751 
1752  return $ex_dir;
1753  }
header include for all ilias files.
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExportSubDirectory()

ilObjStyleSheet::createExportSubDirectory ( )

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

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

Referenced by export().

1768  {
1769  $ex_dir = $this->createExportDirectory();
1770  $ex_sub_dir = $ex_dir . "/" . $this->getExportSubDir();
1771  ilFileUtils::makeDir($ex_sub_dir);
1772  if (!is_writable($ex_sub_dir)) {
1773  $this->ilias->raiseError("Style data directory (" . $ex_sub_dir
1774  . ") not writeable.", $this->ilias->error_obj->FATAL);
1775  }
1776  $ex_sub_images_dir = $ex_sub_dir . "/images";
1777  ilFileUtils::makeDir($ex_sub_images_dir);
1778  if (!is_writable($ex_sub_images_dir)) {
1779  $this->ilias->raiseError("Style data directory (" . $ex_sub_images_dir
1780  . ") not writeable.", $this->ilias->error_obj->FATAL);
1781  }
1782  }
header include for all ilias files.
getExportSubDir()
The local directory, that will be included within the zip file.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller 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 1945 of file class.ilObjStyleSheet.php.

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

Referenced by create(), and import().

1948  : void {
1949  $ilDB = $this->db;
1950 
1951  $this->is_3_10_skin = false;
1952 
1953  if (!$a_skip_parent_create) {
1954  parent::create();
1955  }
1956  $importParser = new ilStyleImportParser($a_file, $this);
1957  $importParser->startParsing();
1958 
1959  // store style parameter
1960  foreach ($this->style as $style) {
1961  foreach ($style as $tag) {
1962  $id = $ilDB->nextId("style_parameter");
1963 
1964  // migrate old table PageFrame/PageContainer to div
1965  if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
1966  $tag["tag"] == "table") {
1967  $tag["tag"] = "div";
1968  if ($tag["parameter"] == "width" && $tag["value"] == "100%") {
1969  continue;
1970  }
1971  }
1972 
1973  if ($tag["type"] === "text_block" && $tag["tag"] === "div") {
1974  $tag["tag"] = "p";
1975  }
1976 
1977  $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
1978  "(" .
1979  $ilDB->quote($id, "integer") . "," .
1980  $ilDB->quote($this->getId(), "integer") . "," .
1981  $ilDB->quote($tag["tag"], "text") . "," .
1982  $ilDB->quote($tag["class"], "text") . "," .
1983  $ilDB->quote($tag["parameter"], "text") . "," .
1984  $ilDB->quote($tag["type"], "text") . "," .
1985  $ilDB->quote($tag["value"], "text") . "," .
1986  $ilDB->quote((bool) $tag["custom"], "integer") .
1987  ")";
1988  $ilDB->manipulate($q);
1989  }
1990  }
1991 
1992  // store characteristics
1993  $this->is_3_10_skin = true;
1994  foreach ($this->chars as $char) {
1995  if ($char["type"] != "") {
1996  $s = substr($char["class"], strlen($char["class"]) - 6);
1997  if ($s != ":hover") {
1998  $ilDB->replace(
1999  "style_char",
2000  array(
2001  "style_id" => array("integer", $this->getId()),
2002  "type" => array("text", $char["type"]),
2003  "characteristic" => array("text", ilStr::subStr($char["class"], 0, 30))),
2004  array("hide" => array("integer", 0))
2005  );
2006  $this->is_3_10_skin = false;
2007  }
2008  }
2009  }
2010 
2011  // add style_data record
2012  $q = "INSERT INTO style_data (id, uptodate) VALUES " .
2013  "(" . $ilDB->quote($this->getId(), "integer") . ", 0)";
2014  $ilDB->manipulate($q);
2015 
2016  $this->update();
2017  $this->read();
2018 
2019  if ($this->is_3_10_skin) {
2020  $this->do_3_10_Migration();
2021  }
2022  //$this->writeCSSFile();
2023  }
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.
read()
read style properties
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:24
ilDBInterface $db
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createImagesDirectory()

ilObjStyleSheet::createImagesDirectory ( )

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

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

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

Referenced by create(), and import().

1084  : void
1085  {
1087  }
static _createImagesDirectory(int $a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createImportDirectory()

ilObjStyleSheet::createImportDirectory ( )

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

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

Referenced by import().

1855  : string
1856  {
1857  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1858  ilFileUtils::makeDir($sty_data_dir);
1859  if (!is_writable($sty_data_dir)) {
1860  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
1861  . ") not writeable.", $this->ilias->error_obj->FATAL);
1862  }
1863 
1864  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1865  ilFileUtils::makeDir($style_dir);
1866  if (!is_dir($style_dir)) {
1867  $this->ilias->raiseError("Creation of style directory failed (" .
1868  $style_dir . ").", $this->ilias->error_obj->FATAL);
1869  }
1870 
1871  // create import subdirectory
1872  $im_dir = $style_dir . "/import";
1873  ilFileUtils::makeDir($im_dir);
1874  if (!is_dir($im_dir)) {
1875  $this->ilias->raiseError("Creation of Import Directory failed (" .
1876  $im_dir . ").", $this->ilias->error_obj->FATAL);
1877  }
1878 
1879  return $im_dir;
1880  }
header include for all ilias files.
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjStyleSheet::delete ( )

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

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

1211  : bool
1212  {
1213  $ilDB = $this->db;
1214 
1215  // delete object
1216  parent::delete();
1217 
1218  // check whether this style is global default
1219  $def_style = $this->ilias->getSetting("default_content_style_id");
1220  if ($def_style == $this->getId()) {
1221  $this->ilias->deleteSetting("default_content_style_id");
1222  }
1223 
1224  // check whether this style is global fixed
1225  $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1226  if ($fixed_style == $this->getId()) {
1227  $this->ilias->deleteSetting("fixed_content_style_id");
1228  }
1229 
1230  // delete style parameter
1231  $q = "DELETE FROM style_parameter WHERE style_id = " .
1232  $ilDB->quote($this->getId(), "integer");
1233  $ilDB->manipulate($q);
1234 
1235  // delete style file
1236  $css_file_name = ilFileUtils::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1237  if (is_file($css_file_name)) {
1238  unlink($css_file_name);
1239  }
1240 
1241  // delete media queries
1242  $ilDB->manipulate(
1243  "DELETE FROM sty_media_query WHERE " .
1244  " style_id = " . $ilDB->quote($this->getId(), "integer")
1245  );
1246 
1247  // delete entries in learning modules
1249 
1250  // delete style data record
1251  $q = "DELETE FROM style_data WHERE id = " .
1252  $ilDB->quote($this->getId(), "integer");
1253  $ilDB->manipulate($q);
1254 
1255  return true;
1256  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
ilDBInterface $db
header include for all ilias files.
static _deleteStyleAssignments(int $a_style_id)
delete all style references to style
$q
Definition: shib_logout.php:21
+ 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 1174 of file class.ilObjStyleSheet.php.

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

1179  : void {
1180  $ilDB = $this->db;
1181 
1182  $q = "DELETE FROM style_parameter WHERE " .
1183  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1184  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1185  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1186  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1187  " custom = " . $ilDB->quote(1, "integer") . " AND " .
1188  " " . $ilDB->equals("type", $a_type, "text", true);
1189 
1190  $ilDB->manipulate($q);
1191  }
ilDBInterface $db
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:

◆ deleteMediaQuery()

ilObjStyleSheet::deleteMediaQuery ( int  $a_id)

Delete media query.

Parameters
int$a_idmedia query id

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

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

2849  : void {
2850  $ilDB = $this->db;
2851 
2852  $ilDB->manipulate(
2853  "DELETE FROM sty_media_query WHERE " .
2854  " style_id = " . $ilDB->quote($this->getId(), "integer") .
2855  " AND id = " . $ilDB->quote($a_id, "integer")
2856  );
2857  $this->saveMediaQueryOrder();
2858  }
ilDBInterface $db
saveMediaQueryOrder(array $a_order_nr=null)
Save media query order.
+ Here is the call graph for this function:

◆ deleteParameter()

ilObjStyleSheet::deleteParameter ( int  $a_id)

delete style parameter

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

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

1157  : void
1158  {
1159  $ilDB = $this->db;
1160 
1161  $q = "DELETE FROM style_parameter WHERE id = " .
1162  $ilDB->quote($a_id, "integer");
1163  $ilDB->query($q);
1164  }
ilDBInterface $db
$q
Definition: shib_logout.php:21

◆ deleteStyleParOfChar()

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

Delete style parameters of characteristic.

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

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

1199  : void {
1200  $ilDB = $this->db;
1201 
1202  $q = "DELETE FROM style_parameter WHERE " .
1203  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1204  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1205  " " . $ilDB->equals("type", $a_type, "text", true);
1206 
1207  $ilDB->manipulate($q);
1208  }
ilDBInterface $db
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:

◆ determineTemplateStyleClassType()

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

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

2161  : string {
2162  return self::$templates[$t][$k];
2163  }

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

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

Referenced by do_3_10_Migration().

2346  : void
2347  {
2348  $ilDB = $this->db;
2349 
2350  $add_str = "";
2351  if ($a_id > 0) {
2352  $add_str = " AND style_id = " . $ilDB->quote($a_id, "integer");
2353  }
2354 
2355  $set = $ilDB->query($q = "SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE " .
2356  $ilDB->equals("type", "", "text", true) . " " . $add_str);
2357 
2358  while ($rec = $ilDB->fetchAssoc($set)) {
2359  // derive types from tag
2360  $types = array();
2361  switch ($rec["tag"]) {
2362  case "div":
2363  case "p":
2364  if (in_array($rec["class"], array("Headline3", "Headline1",
2365  "Headline2", "TableContent", "List", "Standard", "Remark",
2366  "Additional", "Mnemonic", "Citation", "Example"))) {
2367  $types[] = "text_block";
2368  }
2369  if (in_array($rec["class"], array("Block", "Remark",
2370  "Additional", "Mnemonic", "Example", "Excursus", "Special"))) {
2371  $types[] = "section";
2372  }
2373  if (in_array($rec["class"], array("Page", "Footnote", "PageTitle", "LMNavigation"))) {
2374  $types[] = "page";
2375  }
2376  break;
2377 
2378  case "td":
2379  $types[] = "table_cell";
2380  break;
2381 
2382  case "a":
2383  if (in_array($rec["class"], array("ExtLink", "IntLink", "FootnoteLink"))) {
2384  $types[] = "link";
2385  }
2386  break;
2387 
2388  case "span":
2389  $types[] = "text_inline";
2390  break;
2391 
2392  case "table":
2393  $types[] = "table";
2394  break;
2395  }
2396 
2397  // check if style_char set exists
2398  foreach ($types as $t) {
2399  // check if second type already exists
2400  $set4 = $ilDB->queryF(
2401  "SELECT * FROM style_char " .
2402  " WHERE style_id = %s AND type = %s AND characteristic = %s",
2403  array("integer", "text", "text"),
2404  array($rec["style_id"], $t, $rec["class"])
2405  );
2406  if ($rec4 = $ilDB->fetchAssoc($set4)) {
2407  // ok
2408  } else {
2409  //echo "<br>1-".$rec["style_id"]."-".$t."-".$rec["class"]."-";
2410  $ilDB->manipulateF(
2411  "INSERT INTO style_char " .
2412  " (style_id, type, characteristic) VALUES " .
2413  " (%s,%s,%s) ",
2414  array("integer", "text", "text"),
2415  array($rec["style_id"], $t, $rec["class"])
2416  );
2417  }
2418  }
2419 
2420  // update types
2421  if ($rec["type"] == "") {
2422  if (count($types) > 0) {
2423  $ilDB->manipulateF(
2424  "UPDATE style_parameter SET type = %s " .
2425  " WHERE style_id = %s AND class = %s AND " . $ilDB->equals("type", "", "text", true),
2426  array("text", "integer", "text"),
2427  array($types[0], $rec["style_id"], $rec["class"])
2428  );
2429  //echo "<br>3-".$types[0]."-".$rec["style_id"]."-".$rec["class"]."-";
2430 
2431  // links extra handling
2432  if ($types[0] == "link") {
2433  $ilDB->manipulateF(
2434  "UPDATE style_parameter SET type = %s " .
2435  " WHERE style_id = %s AND (class = %s OR class = %s) AND " . $ilDB->equals("type", "", "text", true),
2436  array("text", "integer", "text", "text"),
2437  array($types[0], $rec["style_id"], $rec["class"] . ":visited",
2438  $rec["class"] . ":hover")
2439  );
2440  }
2441  }
2442 
2443  if (count($types) == 2) {
2444  // select all records of first type and add second type
2445  // records if necessary.
2446  $set2 = $ilDB->queryF(
2447  "SELECT * FROM style_parameter " .
2448  " WHERE style_id = %s AND class = %s AND type = %s",
2449  array("integer", "text", "text"),
2450  array($rec["style_id"], $rec["class"], $types[0])
2451  );
2452  while ($rec2 = $ilDB->fetchAssoc($set2)) {
2453  // check if second type already exists
2454  $set3 = $ilDB->queryF(
2455  "SELECT * FROM style_parameter " .
2456  " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2457  array("integer", "text", "text", "text", "text"),
2458  array($rec["style_id"], $rec["tag"], $rec["class"], $types[1], $rec["parameter"])
2459  );
2460  if ($rec3 = $ilDB->fetchAssoc($set3)) {
2461  // ok
2462  } else {
2463  $nid = $ilDB->nextId("style_parameter");
2464  $ilDB->manipulateF(
2465  "INSERT INTO style_parameter " .
2466  " (id, style_id, tag, class, parameter, value, type) VALUES " .
2467  " (%s, %s,%s,%s,%s,%s,%s) ",
2468  array("integer", "integer", "text", "text", "text", "text", "text"),
2469  array($nid, $rec2["style_id"], $rec2["tag"], $rec2["class"],
2470  $rec2["parameter"], $rec2["value"], $types[1])
2471  );
2472  }
2473  }
2474  }
2475  }
2476  }
2477  }
ilDBInterface $db
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ do_3_10_Migration()

ilObjStyleSheet::do_3_10_Migration ( )

Migrates 3.10 style to 3.11 style.

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

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

Referenced by createFromXMLFile().

2288  : void
2289  {
2290  $ilDB = $this->db;
2291 
2292  $this->do_3_9_Migration($this->getId());
2293 
2294  $this->do_3_10_CharMigration($this->getId());
2295 
2296  // style_char: type for characteristic
2297  $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?" .
2298  " AND style_id = ? ", array("text", "text", "integer"));
2299  $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2300  $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2301  $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2302  $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2303  $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2304  $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2305 
2306  // style_parameter: type for class
2307  $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?" .
2308  " AND style_id = ? ", array("text", "text", "integer"));
2309  $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2310  $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2311  $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2312  $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2313  $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2314  $ilDB->execute($st, array("table", "Page", $this->getId()));
2315 
2316  $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?" .
2317  " AND style_id = ? ", array("text", "text", "integer"));
2318  $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2319 
2320  // style_char: characteristic for characteristic
2321  $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?" .
2322  " AND style_id = ? ", array("text", "text", "integer"));
2323  $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2324  $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2325 
2326  // style_parameter: class for class
2327  $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?" .
2328  " AND style_id = ? ", array("text", "text", "integer"));
2329  $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2330  $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2331 
2332  // force rewriting of container style
2333  $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?" .
2334  " AND style_id = ? ", array("text", "integer"));
2335  $ilDB->execute($st, array("page_cont", $this->getId()));
2336  $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?" .
2337  " AND style_id = ? ", array("text", "integer"));
2338  $ilDB->execute($st, array("page_cont", $this->getId()));
2339  }
ilDBInterface $db
do_3_9_Migration(int $a_id)
Migrate old 3.9 styles.
do_3_10_CharMigration(int $a_id=0)
This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingS...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_3_9_Migration()

ilObjStyleSheet::do_3_9_Migration ( int  $a_id)

Migrate old 3.9 styles.

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

References ilObject\$db, and $ilDB.

Referenced by do_3_10_Migration().

2482  : void
2483  {
2484  $ilDB = $this->db;
2485 
2486  $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2487  $pars = array("margin-top", "margin-bottom");
2488 
2489  foreach ($classes as $curr_class) {
2490  foreach ($pars as $curr_par) {
2491  $res2 = $ilDB->queryF(
2492  "SELECT id FROM style_parameter WHERE style_id = %s" .
2493  " AND tag = %s AND class= %s AND parameter = %s",
2494  array("integer", "text", "text", "text"),
2495  array($a_id, "p", $curr_class, $curr_par)
2496  );
2497  if ($row2 = $ilDB->fetchAssoc($res2)) {
2498  $ilDB->manipulateF(
2499  "UPDATE style_parameter SET value= %s WHERE id = %s",
2500  array("text", "integer"),
2501  array("10px", $row2["id"])
2502  );
2503  } else {
2504  $nid = $ilDB->nextId("style_parameter");
2505  $ilDB->manipulateF(
2506  "INSERT INTO style_parameter " .
2507  "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2508  array("integer", "integer", "text", "text", "text", "text"),
2509  array($nid, $a_id, "div", $curr_class, $curr_par, "10px")
2510  );
2511  }
2512  }
2513  }
2514 
2515  $ilDB->manipulateF(
2516  "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2517  array("text", "text", "integer"),
2518  array("div", "p", $a_id)
2519  );
2520  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ export()

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

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

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

1810  : string
1811  {
1812  $this->cleanExportDirectory();
1813  $ex_dir = $this->createExportDirectory();
1814  $this->createExportSubDirectory();
1815  $this->exportXML($ex_dir . "/" . $this->getExportSubDir());
1816  //echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
1818  $this->getImagesDirectory(),
1819  $ex_dir . "/" . $this->getExportSubDir() . "/images"
1820  );
1821  if (is_file($ex_dir . "/" . $this->getExportSubDir() . ".zip")) {
1822  unlink($ex_dir . "/" . $this->getExportSubDir() . ".zip");
1823  }
1825  $ex_dir . "/" . $this->getExportSubDir(),
1826  $ex_dir . "/" . $this->getExportSubDir() . ".zip"
1827  );
1828 
1829  return $ex_dir . "/" . $this->getExportSubDir() . ".zip";
1830  }
exportXML(string $a_dir)
export style xml file to directory
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getExportSubDir()
The local directory, that will be included within the zip file.
static zip(string $a_dir, string $a_file, bool $compress_content=false)
+ Here is the call graph for this function:

◆ exportXML()

ilObjStyleSheet::exportXML ( string  $a_dir)

export style xml file to directory

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

References getXML().

Referenced by export().

1835  : void
1836  {
1837  $file = $a_dir . "/style.xml";
1838 
1839  // open file
1840  if (!($fp = fopen($file, 'wb'))) {
1841  die("<strong>Error</strong>: Could not open \"" . $file . "\" for writing" .
1842  " in <strong>" . __FILE__ . "</strong> on line <strong>" . __LINE__ . "</strong><br />");
1843  }
1844 
1845  // set file permissions
1846  chmod($file, 0770);
1847 
1848  // write xml data into the file
1849  fwrite($fp, $this->getXML());
1850 
1851  // close file
1852  fclose($fp);
1853  }
getXML()
get xml representation of style object todo: add mq_id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableParameters()

static ilObjStyleSheet::getAvailableParameters ( )
static

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

Referenced by addParameter().

2170  : array
2171  {
2172  $pars = array();
2173  foreach (self::$parameter as $p => $v) {
2174  $pars[$p] = $v["values"];
2175  }
2176 
2177  return $pars;
2178  }
+ Here is the caller graph for this function:

◆ getBaseContentStylePath()

static ilObjStyleSheet::getBaseContentStylePath ( )
static

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

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

1624  : string
1625  {
1626  return "./Services/COPage/css/content_base.css";
1627  }
+ Here is the caller graph for this function:

◆ getBasicImageDir()

static ilObjStyleSheet::getBasicImageDir ( )
static

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

Referenced by ilCOPageHTMLExport\exportStyles().

760  : string
761  {
762  return self::$basic_style_image_dir;
763  }
+ Here is the caller graph for this function:

◆ getBasicZipPath()

static ilObjStyleSheet::getBasicZipPath ( )
static

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

Referenced by ilObjStyleSheetGUI\saveObject().

515  : string
516  {
517  return self::$basic_style_zip;
518  }
+ 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 935 of file class.ilObjStyleSheet.php.

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

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

939  : array {
940  $chars = array();
941 
942  if ($a_type == "") {
944  }
945  if (isset($this->chars_by_type[$a_type])) {
946  foreach ($this->chars_by_type[$a_type] as $c) {
947  if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
948  $chars[] = $c;
949  }
950  }
951  }
952 
953  if ($a_no_hidden) {
954  foreach ($chars as $k => $char) {
955  if ($a_type == "" && $this->hidden_chars[$char["type"] . ":" . $char["class"]]) {
956  unset($chars[$k]);
957  } elseif ($this->hidden_chars[$a_type . ":" . $char] ?? false) {
958  unset($chars[$k]);
959  }
960  }
961  }
962 
963  return $chars;
964  }
+ Here is the caller graph for this function:

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName ( string  $a_name)

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

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

Referenced by writeCSSFile().

2560  : string
2561  {
2562  $ilDB = $this->db;
2563  $a_i = "";
2564  $pos = strpos($a_name, "(");
2565  if ($pos > 0) {
2566  $a_i = substr($a_name, $pos + 1);
2567  $a_i = str_replace(")", "", $a_i);
2568  $a_name = substr($a_name, 0, $pos);
2569  }
2570 
2571  $set = $ilDB->query("SELECT color_code FROM style_color WHERE " .
2572  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2573  " color_name = " . $ilDB->quote($a_name, "text"));
2574  if ($rec = $ilDB->fetchAssoc($set)) {
2575  if ($a_i == "") {
2576  return "#" . $rec["color_code"];
2577  } else {
2578  return "#" . ilObjStyleSheet::_getColorFlavor(
2579  $rec["color_code"],
2580  (int) $a_i
2581  );
2582  }
2583  }
2584  return "";
2585  }
ilDBInterface $db
static _getColorFlavor(string $a_rgb, int $a_i)
Get color flavor.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColors()

ilObjStyleSheet::getColors ( )

Get colors of style.

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

References ilObject\$db, and $ilDB.

Referenced by getXML().

2529  : array
2530  {
2531  $ilDB = $this->db;
2532 
2533  $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2534  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2535  "ORDER BY color_name");
2536 
2537  $colors = array();
2538  while ($rec = $ilDB->fetchAssoc($set)) {
2539  $colors[] = array(
2540  "name" => $rec["color_name"],
2541  "code" => $rec["color_code"]
2542  );
2543  }
2544 
2545  return $colors;
2546  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getContentPrintStyle()

static ilObjStyleSheet::getContentPrintStyle ( )
static

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

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

1614  : string
1615  {
1616  return "./Services/COPage/css/print_content.css";
1617  }
+ 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 1569 of file class.ilObjStyleSheet.php.

References $DIC, $ilSetting, $path, ilObject\_exists(), _lookupUpToDate(), ilFileUtils\getWebspaceDir(), ILIAS\Repository\int(), and ilWACSignedPath\signFile().

Referenced by ilDclDetailedViewDefinitionGUI\__construct(), ilPageLayoutGUI\__construct(), ilImprintGUI\__construct(), ilPortfolioPageGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilBlogPostingGUI\__construct(), ilAssQuestionPreviewGUI\__construct(), ILIAS\Style\Content\GUIService\addCss(), ilPageObjectGUI\displayMedia(), assOrderingQuestionGUI\editNesting(), ilLOEditorGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilAssQuestionHintsGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilCOPageHTMLExport\exportStyles(), ilAssQuestionPageCommandForwarder\forward(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ILIAS\COPage\Page\PageQueryActionHandler\getConfig(), ILIAS\Portfolio\Export\PortfolioHtmlExport\getInitialisedTemplate(), ILIAS\Blog\Export\BlogHtmlExport\getInitialisedTemplate(), ilCOPageHTMLExport\getPreparedMainTemplate(), ilObjQuestionPoolGUI\getQueryParamInt(), ilObjStyleSheetGUI\includeCSS(), ilCOPageHTMLExport\initResourceTemplate(), ILIAS\Glossary\Export\GlossaryHtmlExport\initScreen(), ilAssQuestionPreviewGUI\initStyleSheets(), ilGlossaryPresentationGUI\media(), ilTestServiceGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilStyleCharacteristicGUI\outputTagStyleEditScreen(), ilTestEvaluationGUI\outUserPassDetails(), ilTestPlayerAbstractGUI\populateContentStyleBlock(), ilObjStyleSheetGUI\propertiesObject(), ILIAS\Export\PrintProcessGUI\renderPrintView(), ilTestEvaluationGUI\setCss(), ilPCParagraphGUI\setStyle(), ilStartUpGUI\showLoginPage(), ilObjMediaPoolGUI\showMedia(), ilObjMediaPoolGUI\showPage(), and ilTestCorrectionsGUI\showSolution().

1573  : string {
1574  global $DIC;
1575 
1576  $ilSetting = $DIC->settings();
1577 
1578  $random = new \ilRandom();
1579  $rand = $random->int(1, 999999);
1580 
1581 
1582  // check global fixed content style
1583  $fixed_style = $ilSetting->get("fixed_content_style_id");
1584  if ($fixed_style > 0) {
1585  $a_style_id = (int) $fixed_style;
1586  }
1587 
1588  // check global default style
1589  if ($a_style_id <= 0) {
1590  $a_style_id = (int) $ilSetting->get("default_content_style_id");
1591  }
1592 
1593  if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
1594  // check whether file is up to date
1595  if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
1596  $style = new ilObjStyleSheet($a_style_id);
1597  $style->writeCSSFile();
1598  }
1599 
1600  $path = ilFileUtils::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css";
1601  if ($add_random) {
1602  $path .= "?dummy=$rand";
1603  }
1604  if ($add_token) {
1606  }
1607 
1608  return $path;
1609  } else { // todo: work this out
1610  return "./Services/COPage/css/content.css";
1611  }
1612  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$path
Definition: ltiservices.php:32
global $DIC
Definition: feed.php:28
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupUpToDate(int $a_id)
global $ilSetting
Definition: privfeed.php:18
static signFile(string $path_to_file)
+ Here is the call graph for this function:
+ 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 1529 of file class.ilObjStyleSheet.php.

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

1531  : int {
1532  global $DIC;
1533 
1534  $ilSetting = $DIC->settings();
1535 
1536  // check global fixed content style
1537  $fixed_style = $ilSetting->get("fixed_content_style_id");
1538  if ($fixed_style > 0) {
1539  $a_style_id = (int) $fixed_style;
1540  }
1541 
1542  // check global default style
1543  if ($a_style_id <= 0) {
1544  $a_style_id = (int) $ilSetting->get("default_content_style_id");
1545  }
1546 
1547  if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) === "sty") {
1548  return $a_style_id;
1549  }
1550 
1551  return 0;
1552  }
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:18
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getExportSubDir()

ilObjStyleSheet::getExportSubDir ( )

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

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

References $export_sub_dir, and ilObject\getId().

Referenced by createExportSubDirectory(), and export().

1795  : string
1796  {
1797  if ($this->export_sub_dir == "") {
1798  return "sty_" . $this->getId();
1799  } else {
1800  return $this->export_sub_dir;
1801  }
1802  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHideStatus()

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

Get characteristic hidden status.

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

References ilObject\$db, and $ilDB.

996  : bool {
997  $ilDB = $this->db;
998 
999  $set = $ilDB->query(
1000  "SELECT hide FROM style_char " .
1001  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1002  " type = " . $ilDB->quote($a_type, "text") . " AND " .
1003  " characteristic = " . $ilDB->quote($a_char, "text")
1004  );
1005  $rec = $ilDB->fetchAssoc($set);
1006 
1007  return (bool) ($rec["hide"] ?? false);
1008  }
ilDBInterface $db

◆ getImagesDirectory()

ilObjStyleSheet::getImagesDirectory ( )

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

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

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

1137  : string
1138  {
1140  }
static _getImagesDirectory(int $a_style_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaxMQueryOrderNr()

ilObjStyleSheet::getMaxMQueryOrderNr ( )

Get maximum media query order nr.

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

References ilObject\$db, and $ilDB.

Referenced by addMediaQuery().

2798  : int
2799  {
2800  $ilDB = $this->db;
2801 
2802  $set = $ilDB->query(
2803  "SELECT max(order_nr) mnr FROM sty_media_query " .
2804  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer")
2805  );
2806  $rec = $ilDB->fetchAssoc($set);
2807 
2808  return (int) $rec["mnr"];
2809  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

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

References ilObject\$db, and $ilDB.

Referenced by saveMediaQueryOrder(), and writeCSSFile().

2757  : array
2758  {
2759  $ilDB = $this->db;
2760 
2761  $set = $ilDB->query("SELECT * FROM sty_media_query WHERE " .
2762  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2763  "ORDER BY order_nr");
2764 
2765  $mq = array();
2766  while ($rec = $ilDB->fetchAssoc($set)) {
2767  $mq[] = $rec;
2768  }
2769 
2770  return $mq;
2771  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getMediaQueryForId()

ilObjStyleSheet::getMediaQueryForId ( int  $a_id)

Get media query for id.

Parameters

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

References ilObject\$db, and $ilDB.

2832  : array {
2833  $ilDB = $this->db;
2834 
2835  $set = $ilDB->query(
2836  "SELECT * FROM sty_media_query " .
2837  " WHERE id = " . $ilDB->quote($a_id, "integer")
2838  );
2839  return $ilDB->fetchAssoc($set);
2840  }
ilDBInterface $db

◆ getParametersOfClass()

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

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

1558  : array {
1559  if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1560  return $this->style_class[$a_type][$a_class][$a_mq_id];
1561  }
1562  return array();
1563  }

◆ getScope()

ilObjStyleSheet::getScope ( )

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

References $scope.

Referenced by create(), and update().

538  : int
539  {
540  return $this->scope;
541  }
+ Here is the caller graph for this function:

◆ getStyle()

ilObjStyleSheet::getStyle ( )

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

References $style.

Referenced by writeCSSFile().

1660  : array
1661  {
1662  return $this->style;
1663  }
+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

References $parameter.

2028  : array
2029  {
2030  $groups = array();
2031 
2032  foreach (self::$parameter as $parameter => $props) {
2033  $groups[$props["group"]][] = $parameter;
2034  }
2035  return $groups;
2036  }

◆ getSyntaxStylePath()

static ilObjStyleSheet::getSyntaxStylePath ( )
static

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

Referenced by ilDclDetailedViewDefinitionGUI\__construct(), ilPageLayoutGUI\__construct(), ilImprintGUI\__construct(), ilTermDefinitionEditorGUI\__construct(), ilPortfolioPageGUI\__construct(), ilWikiPageGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilBlogPostingGUI\__construct(), ilAssQuestionPreviewGUI\__construct(), assOrderingQuestionGUI\editNesting(), ilObjTestGUI\executeCommand(), ilCOPageHTMLExport\exportStyles(), ilAssQuestionPageCommandForwarder\forward(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilCOPageHTMLExport\getPreparedMainTemplate(), ilObjQuestionPoolGUI\getQueryParamInt(), ilObjForumGUI\getSafePostCommands(), ilCOPageHTMLExport\initResourceTemplate(), ilAssQuestionPreviewGUI\initStyleSheets(), ilObjContentPageGUI\initStyleSheets(), ilObjForumGUI\initStyleSheets(), ilLMEditorGUI\main_header(), ilTestServiceGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\populateSyntaxStyleBlock(), ilTestEvaluationGUI\prepareContentForPrint(), ilContentPageKioskModeView\renderContentStyle(), ILIAS\Export\PrintProcessGUI\renderPrintView(), ilGlossaryPresentationGUI\setContentStyles(), ilLMPresentationGUI\setContentStyles(), ilObjWikiGUI\setContentStyleSheet(), ilObjContentPageGUI\setTabs(), ilStartUpGUI\showLoginPage(), ilObjMediaPoolGUI\showPage(), and ilTestCorrectionsGUI\showSolution().

1619  : string
1620  {
1621  return "./Services/COPage/css/syntaxhighlight.css";
1622  }
+ Here is the caller graph for this function:

◆ getTemplate()

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

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

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

Referenced by ilObjStyleSheetGUI\_getTemplatePreview().

3036  : array
3037  {
3038  $ilDB = $this->db;
3039 
3040  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3041  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
3042  " AND id = " . $ilDB->quote($a_t_id, "integer"));
3043 
3044  if ($rec = $ilDB->fetchAssoc($set)) {
3045  $rec["classes"] = $this->getTemplateClasses((int) $rec["id"]);
3046 
3047  $template = $rec;
3048  return $template;
3049  }
3050  return array();
3051  }
getTemplateClasses(int $a_tid)
Get template classes.
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplateClasses()

ilObjStyleSheet::getTemplateClasses ( int  $a_tid)

Get template classes.

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

References ilObject\$db, $ilDB, and ILIAS\LTI\ToolProvider\$key.

Referenced by getTemplate(), and getTemplates().

2918  : array {
2919  $ilDB = $this->db;
2920  $set = $ilDB->query("SELECT * FROM style_template_class WHERE " .
2921  "template_id = " . $ilDB->quote($a_tid, "integer"));
2922 
2923  $class = array();
2924  while ($rec = $ilDB->fetchAssoc($set)) {
2925  $key = $rec["class_type"];
2926  $class[$key] = $rec["class"];
2927  }
2928 
2929  return $class;
2930  }
ilDBInterface $db
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the caller graph for this function:

◆ getTemplates()

ilObjStyleSheet::getTemplates ( string  $a_type)

Get table templates of style.

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

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

Referenced by ilPageContentGUI\getTemplateOptions(), getTemplateXML(), and getXML().

2896  : array {
2897  $ilDB = $this->db;
2898 
2899  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
2900  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2901  "temp_type = " . $ilDB->quote($a_type, "text") . " " .
2902  "ORDER BY name");
2903 
2904  $templates = array();
2905  while ($rec = $ilDB->fetchAssoc($set)) {
2906  $rec["classes"] = $this->getTemplateClasses((int) $rec["id"]);
2907  $templates[] = $rec;
2908  }
2909 
2910  return $templates;
2911  }
getTemplateClasses(int $a_tid)
Get template classes.
ilDBInterface $db
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplateXML()

ilObjStyleSheet::getTemplateXML ( )

Get table template xml.

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

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

Referenced by ilObjStyleSheetGUI\_getTemplatePreview(), ilPCTableGUI\getCellContent(), and ilPCTableGUI\getPropertiesFormValues().

3083  : string
3084  {
3085  $ilDB = $this->db;
3086 
3087  $tag = "<StyleTemplates>";
3088 
3089  $ttypes = array("table", "vaccordion", "haccordion", "carousel");
3090 
3091  foreach ($ttypes as $ttype) {
3092  $ts = $this->getTemplates($ttype);
3093 
3094  foreach ($ts as $t) {
3096  /*$atts = array("table" => "TableClass",
3097  "caption" => "CaptionClass",
3098  "row_head" => "RowHeadClass",
3099  "row_foot" => "RowFootClass",
3100  "col_head" => "ColHeadClass",
3101  "col_foot" => "ColFootClass",
3102  "odd_row" => "OddRowClass",
3103  "even_row" => "EvenRowClass",
3104  "odd_col" => "OddColClass",
3105  "even_col" => "EvenColClass");*/
3106  $c = $t["classes"];
3107 
3108  $tag .= '<StyleTemplate Name="' . $t["name"] . '">';
3109 
3110  foreach ($atts as $type => $t2) {
3111  if (($c[$type] ?? "") != "") {
3112  $tag .= '<StyleClass Type="' . $type . '" Value="' . $c[$type] . '" />';
3113  }
3114  }
3115 
3116  $tag .= "</StyleTemplate>";
3117  }
3118  }
3119 
3120  $tag .= "</StyleTemplates>";
3121 
3122  //echo htmlentities($tag);
3123  return $tag;
3124  }
string $type
ilDBInterface $db
getTemplates(string $a_type)
Get table templates of style.
static _getTemplateClassTypes(string $a_template_type="")
Get template class types.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbnailsDirectory()

ilObjStyleSheet::getThumbnailsDirectory ( )

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

References getImagesDirectory().

1148  : string
1149  {
1150  return $this->getImagesDirectory() .
1151  "/thumbnails";
1152  }
+ Here is the call graph for this function:

◆ getUpToDate()

ilObjStyleSheet::getUpToDate ( )

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

References $up_to_date.

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

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

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

Referenced by exportXML().

1679  : string
1680  {
1681  $xml = "<StyleSheet>\n";
1682 
1683  // title and description
1684  $xml .= "<Title>" . $this->handleXmlString($this->getTitle()) . "</Title>";
1685  $xml .= "<Description>" . $this->handleXmlString($this->getDescription()) . "</Description>\n";
1686 
1687  // style classes
1688  foreach ($this->chars as $char) {
1689  $xml .= "<Style Tag=\"" . ilObjStyleSheet::_determineTag($char["type"]) .
1690  "\" Type=\"" . $char["type"] . "\" Class=\"" . $char["class"] . "\">\n";
1691  foreach ($this->style as $style) {
1692  if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"]) {
1693  foreach ($style as $tag) {
1694  $xml .= "<StyleParameter Name=\"" . $tag["parameter"] . "\" Value=\"" . $tag["value"] . "\" Custom=\"" . $tag["custom"] . "\" />\n";
1695  }
1696  }
1697  }
1698  $xml .= "</Style>\n";
1699  }
1700 
1701  // colors
1702  foreach ($this->getColors() as $color) {
1703  $xml .= "<StyleColor Name=\"" . $color["name"] . "\" Code=\"" . $color["code"] . "\"/>\n";
1704  }
1705 
1706  // templates
1708  foreach ($tcts as $tct => $v) {
1709  $ts = $this->getTemplates($tct);
1710 
1711  foreach ($ts as $t) {
1712  $xml .= "<StyleTemplate Type=\"" . $tct . "\" Name=\"" . $t["name"] . "\">\n";
1713  foreach ($t["classes"] as $ct => $c) {
1714  if ($c != "") {
1715  $xml .= "<StyleTemplateClass ClassType=\"" . $ct . "\" Class=\"" . $c . "\"/>\n";
1716  }
1717  }
1718  $xml .= "</StyleTemplate>\n";
1719  }
1720  }
1721 
1722 
1723  $xml .= "</StyleSheet>";
1724  //echo "<pre>".htmlentities($xml)."</pre>"; exit;
1725  return $xml;
1726  }
getColors()
Get colors of style.
handleXmlString(string $a_str)
getTemplates(string $a_type)
Get table templates of style.
static _determineTag(string $a_type)
static _getTemplateClassTypes(string $a_template_type="")
Get template class types.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleXmlString()

ilObjStyleSheet::handleXmlString ( string  $a_str)

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

Referenced by getXML().

1670  : string
1671  {
1672  return str_replace("&", "&amp;", $a_str);
1673  }
+ Here is the caller graph for this function:

◆ hexdec()

static ilObjStyleSheet::hexdec ( string  $hex)
staticprotected

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

2632  : int
2633  {
2634  $hex = preg_replace("/[^a-fA-F0-9]+/", "", $hex);
2635  if ($hex === "") {
2636  $hex = "0";
2637  }
2638  return (int) hexdec($hex);
2639  }
static hexdec(string $hex)

◆ ilClone()

ilObjStyleSheet::ilClone ( )

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

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

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

1013  : int
1014  {
1015  $lng = $this->lng;
1016 
1017  $lng->loadLanguageModule("style");
1018 
1019  $new_obj = new ilObjStyleSheet();
1020  $new_obj->setTitle($this->getTitle() . " (" . $lng->txt("sty_acopy") . ")");
1021  $new_obj->setType($this->getType());
1022  $new_obj->setDescription($this->getDescription());
1023  $new_obj->create($this->getId());
1024 
1025  $new_obj->writeStyleSetting(
1026  "disable_auto_margins",
1027  $this->lookupStyleSetting("disable_auto_margins")
1028  );
1029 
1030  return $new_obj->getId();
1031  }
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...
loadLanguageModule(string $a_module)
Load language module.
lookupStyleSetting(string $a_name)
Lookup style setting.
ilLanguage $lng
+ Here is the call graph for this function:

◆ import()

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

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

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

1889  : void
1890  {
1891  parent::create();
1892 
1893  $subdir = "";
1894  $im_dir = $this->createImportDirectory();
1895 
1896  // handle uploaded files
1897  if (is_array($a_file)) {
1899  $a_file["tmp_name"],
1900  $a_file["name"],
1901  $im_dir . "/" . $a_file["name"]
1902  );
1903  $file_name = $a_file["name"];
1904  } else { // handle not directly uploaded files
1905  $pi = pathinfo($a_file);
1906  $file_name = $pi["basename"];
1907  copy($a_file, $im_dir . "/" . $file_name);
1908  }
1909  $file = pathinfo($file_name);
1910 
1911  // unzip file
1912  if (strtolower($file["extension"]) == "zip") {
1913  $this->domain->resources()->zip()->unzipFile($im_dir . "/" . $file_name);
1914  $subdir = basename($file["basename"], "." . $file["extension"]);
1915  if (!is_dir($im_dir . "/" . $subdir)) {
1916  $subdir = "style"; // check style subdir
1917  }
1918  $xml_file = $im_dir . "/" . $subdir . "/style.xml";
1919  } else { // handle xml file directly (old style)
1920  $xml_file = $im_dir . "/" . $file_name;
1921  }
1922 
1923  // load information from xml file
1924  //echo "-$xml_file-";
1925  $this->createFromXMLFile($xml_file, true);
1926 
1927  // copy images
1928  $this->createImagesDirectory();
1929  if (is_dir($im_dir . "/" . $subdir . "/images")) {
1931  $im_dir . "/" . $subdir . "/images",
1932  $this->getImagesDirectory()
1933  );
1934  }
1935 
1937  $this->read();
1938  $this->writeCSSFile();
1939  }
read()
read style properties
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
static _addMissingStyleClassesToStyle(int $a_id)
Add missing style classes to all styles.
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
createFromXMLFile(string $a_file, bool $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
+ Here is the call graph for this function:

◆ isCoreStyle()

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

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

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

2131  : bool {
2132  foreach (self::$core_styles as $s) {
2133  if ($s["type"] == $a_type && $s["class"] == $a_class) {
2134  return true;
2135  }
2136  }
2137  return false;
2138  }
+ 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 3289 of file class.ilObjStyleSheet.php.

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

3291  : array {
3292  global $DIC;
3293 
3294  $ilDB = $DIC->database();
3295 
3296  $obj_ids = array();
3297  if (ilObject::_lookupType($a_style_id) == "sty") {
3298  $set = $ilDB->query(
3299  "SELECT DISTINCT obj_id FROM style_usage " .
3300  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer")
3301  );
3302 
3303  while ($rec = $ilDB->fetchAssoc($set)) {
3304  $obj_ids[] = (int) $rec["obj_id"];
3305  }
3306  }
3307  return $obj_ids;
3308  }
global $DIC
Definition: feed.php:28
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ lookupObjectStyle()

static ilObjStyleSheet::lookupObjectStyle ( int  $a_obj_id)
static

Lookup object style.

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

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

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

3264  : int {
3265  global $DIC;
3266 
3267  $ilDB = $DIC->database();
3268 
3269  $set = $ilDB->query(
3270  "SELECT style_id FROM style_usage " .
3271  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
3272  );
3273  $rec = $ilDB->fetchAssoc($set);
3274  if (!is_array($rec)) {
3275  return 0;
3276  }
3277 
3278  if (ilObject::_lookupType((int) $rec["style_id"]) == "sty") {
3279  return (int) $rec["style_id"];
3280  }
3281 
3282  return 0;
3283  }
global $DIC
Definition: feed.php:28
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupStyleSetting()

ilObjStyleSheet::lookupStyleSetting ( string  $a_name)

Lookup style setting.

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

References ilObject\$db, and $ilDB.

Referenced by ilClone().

3225  : string
3226  {
3227  $ilDB = $this->db;
3228 
3229  $set = $ilDB->query(
3230  "SELECT value FROM style_setting " .
3231  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
3232  " AND name = " . $ilDB->quote($a_name, "text")
3233  );
3234  $rec = $ilDB->fetchAssoc($set);
3235 
3236  return $rec["value"] ?? '';
3237  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ lookupTemplateName()

ilObjStyleSheet::lookupTemplateName ( int  $a_t_id)

Lookup table template name for template ID.

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

Referenced by ilObjStyleSheetGUI\_getTemplatePreview().

3056  : string
3057  {
3058  return self::_lookupTemplateName($a_t_id);
3059  }
+ Here is the caller graph for this function:

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview ( int  $a_t_id)

Lookup table template preview.

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

References ilObject\$db, and $ilDB.

3151  : string
3152  {
3153  $ilDB = $this->db;
3154 
3155  $set = $ilDB->query("SELECT preview FROM style_template " .
3156  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3157  if ($rec = $ilDB->fetchAssoc($set)) {
3158  return $rec["preview"] ?? "";
3159  }
3160 
3161  return "";
3162  }
ilDBInterface $db

◆ read()

ilObjStyleSheet::read ( )

read style properties

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

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

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

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

◆ removeColor()

ilObjStyleSheet::removeColor ( string  $a_name)

Remove a color.

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

References ilObject\$db, and $ilDB.

2551  : void
2552  {
2553  $ilDB = $this->db;
2554 
2555  $ilDB->manipulate("DELETE FROM style_color WHERE " .
2556  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2557  " color_name = " . $ilDB->quote($a_name, "text"));
2558  }
ilDBInterface $db

◆ removeTemplate()

ilObjStyleSheet::removeTemplate ( int  $a_t_id)

Remove table template.

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

References ilObject\$db, and $ilDB.

3188  : void
3189  {
3190  $ilDB = $this->db;
3191 
3192  $ilDB->manipulate("DELETE FROM style_template WHERE " .
3193  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3194  " id = " . $ilDB->quote($a_t_id, "integer"));
3195 
3196  $ilDB->manipulate(
3197  "DELETE FROM style_template_class WHERE " .
3198  "template_id = " . $ilDB->quote($a_t_id, "integer")
3199  );
3200  }
ilDBInterface $db

◆ saveHideStatus()

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

Save characteristic hidden status.

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

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

978  : void {
979  $ilDB = $this->db;
980 
981  $ilDB->manipulate(
982  "UPDATE style_char SET " .
983  " hide = " . $ilDB->quote((int) $a_hide, "integer") .
984  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
985  " type = " . $ilDB->quote($a_type, "text") . " AND " .
986  " characteristic = " . $ilDB->quote($a_char, "text")
987  );
988  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ saveMediaQueryOrder()

ilObjStyleSheet::saveMediaQueryOrder ( array  $a_order_nr = null)

Save media query order.

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

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

Referenced by deleteMediaQuery().

2865  : void {
2866  $ilDB = $this->db;
2867 
2868  $mqueries = $this->getMediaQueries();
2869  if (is_array($a_order_nr)) {
2870  foreach ($mqueries as $k => $mq) {
2871  $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
2872  }
2873  $mqueries = ilArrayUtil::sortArray($mqueries, "order_nr", "", true);
2874  }
2875  $cnt = 10;
2876  foreach ($mqueries as $mq) {
2877  $ilDB->manipulate(
2878  "UPDATE sty_media_query SET " .
2879  " order_nr = " . $ilDB->quote($cnt, "integer") .
2880  " WHERE id = " . $ilDB->quote($mq["id"], "integer")
2881  );
2882  $cnt += 10;
2883  }
2884  }
ilDBInterface $db
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCharacteristics()

ilObjStyleSheet::setCharacteristics ( array  $a_chars)

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

966  : void
967  {
968  $this->chars = $a_chars;
969  }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir ( string  $a_dir)

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

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

1787  : void
1788  {
1789  $this->export_sub_dir = $a_dir;
1790  }

◆ setScope()

ilObjStyleSheet::setScope ( int  $a_scope)

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

Referenced by read().

533  : void
534  {
535  $this->scope = $a_scope;
536  }
+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle ( array  $a_style)

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

1665  : void
1666  {
1667  $this->style = $a_style;
1668  }

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

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

523  : void
524  {
525  $this->up_to_date = $a_up_to_date;
526  }
+ Here is the caller graph for this function:

◆ templateExists()

ilObjStyleSheet::templateExists ( string  $a_template_name)

Check whether template exists.

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

References ilObject\$db, and $ilDB.

3021  : bool {
3022  $ilDB = $this->db;
3023 
3024  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3025  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3026  "name = " . $ilDB->quote($a_template_name, "text"));
3027  if ($ilDB->fetchAssoc($set)) {
3028  return true;
3029  }
3030  return false;
3031  }
ilDBInterface $db

◆ update()

ilObjStyleSheet::update ( )

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

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

Referenced by createFromXMLFile().

1629  : bool
1630  {
1631  $ilDB = $this->db;
1632 
1633  parent::update();
1634  $this->read(); // this could be done better
1635  $this->writeCSSFile();
1636 
1637  $q = "UPDATE style_data " .
1638  "SET category = " . $ilDB->quote($this->getScope(), "integer") .
1639  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
1640  $ilDB->manipulate($q);
1641 
1642  return true;
1643  }
read()
read style properties
ilDBInterface $db
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateMediaQuery()

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

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

References ilObject\$db, and $ilDB.

2814  : void {
2815  $ilDB = $this->db;
2816 
2817  $ilDB->manipulate(
2818  "UPDATE sty_media_query SET " .
2819  " mquery = " . $ilDB->quote($a_mquery, "text") .
2820  " WHERE id = " . $ilDB->quote($a_id, "integer")
2821  );
2822  }
ilDBInterface $db

◆ updateStyleParameter()

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

update style parameter per id

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

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

1651  : void {
1652  $ilDB = $this->db;
1653 
1654  $q = "UPDATE style_parameter SET VALUE = " .
1655  $ilDB->quote($a_value, "text") . " WHERE id = " .
1656  $ilDB->quote($a_id, "integer");
1657  $style_set = $ilDB->manipulate($q);
1658  }
ilDBInterface $db
$q
Definition: shib_logout.php:21

◆ updateTemplate()

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

Update table template.

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

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

2978  : void {
2979  $ilDB = $this->db;
2980 
2981  $ilDB->manipulate("UPDATE style_template SET " .
2982  "name = " . $ilDB->quote($a_name, "text") .
2983  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
2984 
2985  $ilDB->manipulate(
2986  "DELETE FROM style_template_class WHERE " .
2987  "template_id = " . $ilDB->quote($a_t_id, "integer")
2988  );
2989  foreach ($a_classes as $t => $c) {
2990  $ilDB->manipulate("INSERT INTO style_template_class " .
2991  "(template_id, class_type, class)" .
2992  " VALUES (" .
2993  $ilDB->quote($a_t_id, "integer") . "," .
2994  $ilDB->quote($t, "text") . "," .
2995  $ilDB->quote($c, "text") .
2996  ")");
2997  }
2998  }
ilDBInterface $db

◆ writeCSSFile()

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

write css file to webspace directory

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

References _writeUpToDate(), getColorCodeForName(), ilObject\getId(), getMediaQueries(), getStyle(), ilFileUtils\getWebspaceDir(), ILIAS\Repository\int(), ilFileUtils\makeDirParents(), and setUpToDate().

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

1339  : void {
1340  $style = $this->getStyle();
1341 
1342  if (!is_dir(ilFileUtils::getWebspaceDir() . "/css")) {
1344  }
1345 
1346  if ($a_target_file == "") {
1347  $css_file_name = ilFileUtils::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1348  } else {
1349  $css_file_name = $a_target_file;
1350  }
1351  $css_file = fopen($css_file_name, 'wb');
1352 
1353  $page_background = "";
1354 
1355  $mqs = array(array("mquery" => "", "id" => 0));
1356  foreach ($this->getMediaQueries() as $mq) {
1357  $mqs[] = $mq;
1358  }
1359 
1360  // iterate all media queries
1361  foreach ($mqs as $mq) {
1362  if ($mq["id"] > 0) {
1363  fwrite($css_file, "@media " . $mq["mquery"] . " {\n");
1364  }
1365  reset($style);
1366  foreach ($style as $tag) {
1367  if ($tag[0]["mq_id"] != $mq["id"]) {
1368  continue;
1369  }
1370  if (is_int(strpos($tag[0]["class"], "before")) && !is_int(strpos($tag[0]["class"], "::before"))) {
1371  $tag[0]["class"] = str_replace(":before", "::before", $tag[0]["class"]);
1372  }
1373  fwrite($css_file, $tag[0]["tag"] . ".ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1374  // echo "<br>";
1375  // var_dump($tag[0]["type"]);
1376  if ($tag[0]["tag"] == "td") {
1377  fwrite($css_file, ",th" . ".ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1378  }
1379  if (in_array($tag[0]["tag"], array("h1", "h2", "h3"))) {
1380  fwrite($css_file, ",div.ilc_text_block_" . $tag[0]["class"] . "\n");
1381  fwrite($css_file, ",html.il-no-tiny-bg body#tinymce.ilc_text_block_" . $tag[0]["class"] . " > p \n");
1382  }
1383  if ($tag[0]["type"] == "section") { // sections can use a tags, if links are used
1384  fwrite($css_file, ",div a.ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1385  }
1386  if ($tag[0]["type"] == "strong") {
1387  fwrite($css_file, ",span.ilc_text_inline_" . $tag[0]["class"] . "\n");
1388  }
1389  if ($tag[0]["type"] == "em") {
1390  fwrite($css_file, ",span.ilc_text_inline_" . $tag[0]["class"] . "\n");
1391  }
1392  if ($tag[0]["type"] == "text_block") {
1393  fwrite($css_file, ",html.il-no-tiny-bg body#tinymce.ilc_text_block_" . $tag[0]["class"] . " > p, #copg-editor-slate-content p.ilc_text_block_" . $tag[0]["class"] . "\n");
1394  }
1395  if ($tag[0]["class"] == "VAccordCntr") {
1396  fwrite($css_file, ",div.ilc_va_cntr_AccordCntr\n");
1397  }
1398  if ($tag[0]["class"] == "VAccordICntr") {
1399  fwrite($css_file, ",div.ilc_va_icntr_AccordICntr\n");
1400  }
1401  if ($tag[0]["class"] == "VAccordICont") {
1402  fwrite($css_file, ",div.ilc_va_icont_AccordICont\n");
1403  }
1404  if ($tag[0]["class"] == "VAccordIHead") {
1405  fwrite($css_file, ",div.ilc_va_ihead_AccordIHead\n");
1406  }
1407  if ($tag[0]["class"] == "VAccordIHead:hover") {
1408  fwrite($css_file, ",div.ilc_va_ihead_AccordIHead:hover\n");
1409  }
1410  if ($tag[0]["class"] == "VAccordIHeadActive") {
1411  fwrite($css_file, ",div.ilc_va_iheada_AccordIHeadActive\n");
1412  }
1413  if ($tag[0]["class"] == "VAccordIHeadActive:hover") {
1414  fwrite($css_file, ",div.ilc_va_iheada_AccordIHeadActive:hover\n");
1415  }
1416  fwrite($css_file, "{\n");
1417 
1418  // collect table border attributes
1419  $t_border = array();
1420 
1421  foreach ($tag as $par) {
1422  $cur_par = $par["parameter"] ?? '';
1423  $cur_val = $par["value"] ?? '';
1424 
1425  // replace named colors
1426  if (is_int(strpos($cur_par, "color")) && substr(trim($cur_val), 0, 1) == "!") {
1427  $cur_val = $this->getColorCodeForName(substr($cur_val, 1));
1428  }
1429 
1430  if ($tag[0]["type"] == "table" && is_int(strpos($par["parameter"], "border"))) {
1431  $t_border[$cur_par] = $cur_val;
1432  }
1433 
1434  if (in_array($cur_par, array("background-image", "list-style-image"))) {
1435  if (is_int(strpos($cur_val, "/"))) { // external
1436  $cur_val = "url('" . $cur_val . "')";
1437  } else { // internal
1438  if ($a_image_dir == "") {
1439  $cur_val = "url('../sty/sty_" . $this->getId() . "/images/" . $cur_val . "')";
1440  } else {
1441  $cur_val = "url('" . $a_image_dir . "/" . $cur_val . "')";
1442  }
1443  }
1444  }
1445 
1446  if ($cur_par == "opacity") {
1447  $cur_val = ((int) $cur_val) / 100;
1448  }
1449 
1450  fwrite($css_file, "\t" . $cur_par . ": " . $cur_val . ";\n");
1451 
1452  // IE6 fix for minimum height
1453  /*
1454  if ($cur_par == "min-height") {
1455  fwrite($css_file, "\t" . "height" . ": " . "auto !important" . ";\n");
1456  fwrite($css_file, "\t" . "height" . ": " . $cur_val . ";\n");
1457  }*/
1458 
1459  // opacity fix
1460  if ($cur_par == "opacity") {
1461  fwrite($css_file, "\t" . '-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . ($cur_val * 100) . ')"' . ";\n");
1462  fwrite($css_file, "\t" . 'filter: alpha(opacity=' . ($cur_val * 100) . ')' . ";\n");
1463  fwrite($css_file, "\t" . '-moz-opacity: ' . $cur_val . ";\n");
1464  }
1465 
1466  // transform fix
1467  if ($cur_par == "transform") {
1468  fwrite($css_file, "\t" . '-webkit-transform: ' . $cur_val . ";\n");
1469  fwrite($css_file, "\t" . '-moz-transform: ' . $cur_val . ";\n");
1470  fwrite($css_file, "\t" . '-ms-transform: ' . $cur_val . ";\n");
1471  }
1472 
1473  // transform-origin fix
1474  if ($cur_par == "transform-origin") {
1475  fwrite($css_file, "\t" . '-webkit-transform-origin: ' . $cur_val . ";\n");
1476  fwrite($css_file, "\t" . '-moz-transform-origin: ' . $cur_val . ";\n");
1477  fwrite($css_file, "\t" . '-ms-transform-origin: ' . $cur_val . ";\n");
1478  }
1479 
1480  // save page background
1481  if ($tag[0]["tag"] == "div" && $tag[0]["class"] == "Page"
1482  && $cur_par == "background-color") {
1483  $page_background = $cur_val;
1484  }
1485  }
1486  fwrite($css_file, "}\n");
1487  fwrite($css_file, "\n");
1488 
1489  // use table border attributes for th td as well
1490  /* if ($tag[0]["type"] == "table")
1491  {
1492  if (count($t_border) > 0)
1493  {
1494  fwrite ($css_file, $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." th,".
1495  $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." td\n");
1496  fwrite ($css_file, "{\n");
1497  foreach ($t_border as $p => $v)
1498  {
1499  // fwrite ($css_file, "\t".$p.": ".$v.";\n");
1500  }
1501  fwrite ($css_file, "}\n");
1502  fwrite ($css_file, "\n");
1503  }
1504  }*/
1505  }
1506 
1507  if ($page_background != "") {
1508  fwrite($css_file, "td.ilc_Page\n");
1509  fwrite($css_file, "{\n");
1510  fwrite($css_file, "\t" . "background-color: " . $page_background . ";\n");
1511  fwrite($css_file, "}\n");
1512  }
1513  if ($mq["id"] > 0) {
1514  fwrite($css_file, "}\n");
1515  }
1516  }
1517  fclose($css_file);
1518  // exit;
1519  $this->setUpToDate();
1520  $this->_writeUpToDate($this->getId(), true);
1521  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static _writeUpToDate(int $a_id, bool $a_up_to_date)
getColorCodeForName(string $a_name)
setUpToDate(bool $a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeOwner()

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

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

References $DIC, $ilDB, and $q.

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

558  {
559  global $DIC;
560  $ilDB = $DIC->database();
561 
562  $q = "UPDATE style_data SET owner_obj = " .
563  $ilDB->quote((int) $obj_id, "integer") .
564  " WHERE id = " . $ilDB->quote($style_id, "integer");
565  $ilDB->manipulate($q);
566  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ writeStyleSetting()

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

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

References ilObject\$db, and $ilDB.

3205  : void {
3206  $ilDB = $this->db;
3207 
3208  $ilDB->manipulate(
3209  "DELETE FROM style_setting WHERE " .
3210  " style_id = " . $ilDB->quote($this->getId(), "integer") .
3211  " AND name = " . $ilDB->quote($a_name, "text")
3212  );
3213 
3214  $ilDB->manipulate("INSERT INTO style_setting " .
3215  "(style_id, name, value) VALUES (" .
3216  $ilDB->quote($this->getId(), "integer") . "," .
3217  $ilDB->quote($a_name, "text") . "," .
3218  $ilDB->quote($a_value, "text") .
3219  ")");
3220  }
ilDBInterface $db

◆ writeStyleUsage()

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

Write style usage.

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

References $DIC, and $ilDB.

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

3245  : void {
3246  global $DIC;
3247 
3248  $ilDB = $DIC->database();
3249 
3250  $ilDB->replace(
3251  "style_usage",
3252  array(
3253  "obj_id" => array("integer", $a_obj_id)),
3254  array(
3255  "style_id" => array("integer", $a_style_id))
3256  );
3257  }
global $DIC
Definition: feed.php:28
+ 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 3129 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by addTemplate().

3132  : void {
3133  $ilDB = $this->db;
3134  $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3135  $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3136  $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3137  //echo "1-".strlen($a_preview_html)."-";
3138  //echo htmlentities($a_preview_html);
3139  if (strlen($a_preview_html) > 4000) {
3140  //echo "2";
3141  $a_preview_html = "";
3142  }
3143  $ilDB->manipulate("UPDATE style_template SET " .
3144  "preview = " . $ilDB->quote($a_preview_html, "text") .
3145  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3146  }
ilDBInterface $db
+ Here is the caller graph for this function:

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

◆ $basic_style_file

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

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

◆ $basic_style_image_dir

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

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

◆ $basic_style_zip

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

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

◆ $chars

array ilObjStyleSheet::$chars = []
protected

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

Referenced by getCharacteristics().

◆ $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 380 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.

Referenced by getExportSubDir().

◆ $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.

Referenced by getStyleParameterGroups().

◆ $pseudo_classes

array ilObjStyleSheet::$pseudo_classes
static
Initial value:
=
[
"a" => ["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.

Referenced by getStyle().

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

Referenced by getTemplates().

◆ $up_to_date

bool ilObjStyleSheet::$up_to_date = false
protected

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

Referenced by getUpToDate().

◆ before

array ilObjStyleSheet::before
static

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

◆ div

array ilObjStyleSheet::div => ["hover"
static

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

◆ img

array ilObjStyleSheet::img
static
Initial value:
=> ["hover"],
"li" => ["before"]
]

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


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