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

Data Fields

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

Static Public Attributes

static array $num_unit = array("px", "em", "rem", "ex", "%", "pt", "pc", "in", "mm", "cm")
 
static array $num_unit_no_perc = array("px", "em", "rem", "ex", "pt", "pc", "in", "mm", "cm")
 
static array $parameter
 
static array $filtered_groups
 
static array $style_super_types
 
static array $expandable_types
 
static array $hideable_types
 
static array $assigned_tags
 
static array $pseudo_classes
 
static array 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
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Static Protected Attributes

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

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, ILIAS\GlobalScreen\Provider\__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: shib_login.php:22
Class ilObjForumAdministration.
__construct(Container $dic, ilPlugin $plugin)
+ 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 2176 of file class.ilObjStyleSheet.php.

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

Referenced by _addMissingStyleClassesToStyle().

2178  : void {
2179  global $DIC;
2180 
2181  $ilDB = $DIC->database();
2182 
2183  if (is_null($a_styles)) {
2184  $styles = ilObject::_getObjectsDataForType("sty");
2185  } else {
2186  $styles = $a_styles;
2187  }
2190 
2191  // get all core image files
2192  $core_images = array();
2193  $core_dir = self::$basic_style_image_dir;
2194  if (is_dir($core_dir)) {
2195  $dir = opendir($core_dir);
2196  while ($file = readdir($dir)) {
2197  if (substr($file, 0, 1) != "." && is_file($core_dir . "/" . $file)) {
2198  $core_images[] = $file;
2199  }
2200  }
2201  }
2202 
2203  foreach ($styles as $style) {
2204  $id = $style["id"];
2205 
2206  foreach ($core_styles as $cs) {
2207  // check, whether core style class exists
2208  $set = $ilDB->queryF(
2209  "SELECT * FROM style_char WHERE style_id = %s " .
2210  "AND type = %s AND characteristic = %s",
2211  array("integer", "text", "text"),
2212  array($id, $cs["type"], $cs["class"])
2213  );
2214 
2215  // if not, add core style class
2216  if (!($rec = $ilDB->fetchAssoc($set))) {
2217  $ilDB->manipulateF(
2218  "INSERT INTO style_char (style_id, type, characteristic) " .
2219  " VALUES (%s,%s,%s) ",
2220  array("integer", "text", "text"),
2221  array($id, $cs["type"], $cs["class"])
2222  );
2223 
2224  $xpath = new DOMXPath($bdom);
2225  $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '" . $cs["tag"] . "' and @Type='" .
2226  $cs["type"] . "' and @Class='" . $cs["class"] . "']/StyleParameter");
2227  foreach ($par_nodes as $par_node) {
2228  // check whether style parameter exists
2229  $set = $ilDB->queryF(
2230  "SELECT * FROM style_parameter WHERE style_id = %s " .
2231  "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2232  array("integer", "text", "text", "text", "text"),
2233  array($id, $cs["type"], $cs["class"],
2234  $cs["tag"], $par_node->getAttribute("Name"))
2235  );
2236 
2237  // if not, create style parameter
2238  if (!($ilDB->fetchAssoc($set))) {
2239  $spid = $ilDB->nextId("style_parameter");
2240  $st = $ilDB->manipulateF(
2241  "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) " .
2242  " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2243  array("integer", "integer", "text", "text", "text", "text", "text"),
2244  array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2245  $par_node->getAttribute("Name"), $par_node->getAttribute("Value"))
2246  );
2247  }
2248  }
2249  }
2250  }
2251 
2252  // now check, whether some core image files are missing
2255  foreach ($core_images as $cim) {
2256  if (!is_file($imdir . "/" . $cim)) {
2257  copy($core_dir . "/" . $cim, $imdir . "/" . $cim);
2258  }
2259  }
2260  }
2261  }
static _getImagesDirectory(int $a_style_id)
static _getObjectsDataForType(string $type, bool $omit_trash=false)
get all objects of a certain type
static _createImagesDirectory(int $a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
global $DIC
Definition: shib_login.php:22
$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 2165 of file class.ilObjStyleSheet.php.

References _addMissingStyleClassesToAllStyles().

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

2167  : void {
2168  $styles = array(array("id" => $a_id));
2170  }
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 1077 of file class.ilObjStyleSheet.php.

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

Referenced by _addMissingStyleClassesToAllStyles(), and createImagesDirectory().

1079  : void {
1080  global $DIC;
1081 
1082  $ilErr = $DIC["ilErr"];
1083 
1084  $sty_data_dir = ilFileUtils::getWebspaceDir() . "/sty";
1085  if (!is_dir($sty_data_dir)) {
1086  ilFileUtils::makeDir($sty_data_dir);
1087  }
1088  if (!is_writable($sty_data_dir)) {
1089  $ilErr->raiseError("Style data directory (" . $sty_data_dir
1090  . ") not writeable.", $ilErr->FATAL);
1091  }
1092 
1093  $style_dir = $sty_data_dir . "/sty_" . $a_style_id;
1094  if (!is_dir($style_dir)) {
1095  ilFileUtils::makeDir($style_dir);
1096  }
1097  if (!is_dir($style_dir)) {
1098  $ilErr->raiseError("Creation of style directory failed (" .
1099  $style_dir . ").", $ilErr->FATAL);
1100  }
1101 
1102  // create images subdirectory
1103  $im_dir = $style_dir . "/images";
1104  if (!is_dir($im_dir)) {
1105  ilFileUtils::makeDir($im_dir);
1106  }
1107  if (!is_dir($im_dir)) {
1108  $ilErr->raiseError("Creation of Import Directory failed (" .
1109  $im_dir . ").", $ilErr->FATAL);
1110  }
1111 
1112  // create thumbnails directory
1113  $thumb_dir = $style_dir . "/images/thumbnails";
1114  ilFileUtils::makeDir($thumb_dir);
1115  if (!is_dir($thumb_dir)) {
1116  $ilErr->raiseError("Creation of Import Directory failed (" .
1117  $thumb_dir . ").", $ilErr->FATAL);
1118  }
1119  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$ilErr
Definition: raiseError.php:33
global $DIC
Definition: shib_login.php:22
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 2598 of file class.ilObjStyleSheet.php.

References $r.

Referenced by _getColorFlavor().

2601  : array {
2602  $r["r"] = substr($a_rgb, 0, 2);
2603  $r["g"] = substr($a_rgb, 2, 2);
2604  $r["b"] = substr($a_rgb, 4, 2);
2605  if ($as_dec) {
2606  $r["r"] = self::hexdec($r["r"]);
2607  $r["g"] = self::hexdec($r["g"]);
2608  $r["b"] = self::hexdec($r["b"]);
2609  }
2610 
2611  return $r;
2612  }
$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)
static _lookupTitle(int $obj_id)
global $DIC
Definition: shib_login.php:22
$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 2572 of file class.ilObjStyleSheet.php.

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

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

2575  : string {
2576  $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
2577  $hls = ilObjStyleSheet::_RGBToHLS($rgb);
2578 
2579  if ($a_i > 0) {
2580  $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
2581  }
2582  if ($a_i < 0) {
2583  $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
2584  }
2585 
2586  $rgb = ilObjStyleSheet::_HLSToRGB($hls);
2587 
2588  foreach ($rgb as $k => $v) {
2589  $rgb[$k] = str_pad(dechex((int) $v), 2, "0", STR_PAD_LEFT);
2590  }
2591 
2592  return $rgb["r"] . $rgb["g"] . $rgb["b"];
2593  }
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 2098 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().

2098  : array
2099  {
2100  $c_styles = array();
2101  foreach (self::$core_styles as $cstyle) {
2102  $c_styles[$cstyle["type"] . "." . ilObjStyleSheet::_determineTag($cstyle["type"]) . "." . $cstyle["class"]]
2103  = array("type" => $cstyle["type"],
2104  "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2105  "class" => $cstyle["class"]);
2106  }
2107  return $c_styles;
2108  }
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 2049 of file class.ilObjStyleSheet.php.

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

2049  : array
2050  {
2051  return self::$filtered_groups;
2052  }
+ Here is the caller graph for this function:

◆ _getImagesDirectory()

static ilObjStyleSheet::_getImagesDirectory ( int  $a_style_id)
static

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

References ilFileUtils\getWebspaceDir().

Referenced by _addMissingStyleClassesToAllStyles(), and getImagesDirectory().

1126  : string
1127  {
1128  return ilFileUtils::getWebspaceDir() . "/sty/sty_" . $a_style_id .
1129  "/images";
1130  }
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 2134 of file class.ilObjStyleSheet.php.

2134  : array
2135  {
2136  return self::$pseudo_classes[$tag] ?? [];
2137  }

◆ _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:66
ilTree $tree
isInTree(?int $a_node_id)
get all information of a node.
$path
Definition: ltiservices.php:29
static _lookupTitle(int $obj_id)
global $DIC
Definition: shib_login.php:22
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:31
$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 2020 of file class.ilObjStyleSheet.php.

Referenced by ilStyleCharacteristicGUI\initTagStyleForm().

2020  : string
2021  {
2022  $input = self::$parameter[$par]["input"];
2023  return $input;
2024  }
+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

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

2056  : array {
2057  if ($a_no_percentage) {
2058  return self::$num_unit_no_perc;
2059  }
2060  return self::$num_unit;
2061  }
+ Here is the caller graph for this function:

◆ _getStyleParameters()

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

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

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

2034  : array {
2035  if ($a_tag == "") {
2036  return self::$parameter;
2037  }
2038  $par = array();
2039  foreach (self::$parameter as $k => $v) {
2040  if (isset(self::$filtered_groups[$v["group"]]) &&
2041  !in_array($a_tag, self::$filtered_groups[$v["group"]])) {
2042  continue;
2043  }
2044  $par[$k] = $v;
2045  }
2046  return $par;
2047  }
+ Here is the caller graph for this function:

◆ _getStyleParameterSubPar()

static ilObjStyleSheet::_getStyleParameterSubPar ( string  $par)
static

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

2026  : string
2027  {
2028  $subpar = self::$parameter[$par]["subpar"];
2029  return $subpar;
2030  }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues ( string  $par)
static

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

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

2065  : array {
2066  return self::$parameter[$par]["values"];
2067  }
+ Here is the caller graph for this function:

◆ _getStyleSuperTypeForType()

static ilObjStyleSheet::_getStyleSuperTypeForType ( string  $a_type)
static

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

Referenced by ilObjStyleSheetGUI\__construct().

2086  : string {
2087  foreach (self::$style_super_types as $s => $t) {
2088  if (in_array($a_type, $t)) {
2089  return $s;
2090  }
2091  if ($a_type == $s) {
2092  return $s;
2093  }
2094  }
2095  return "";
2096  }
+ 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 2125 of file class.ilObjStyleSheet.php.

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

2127  : array {
2128  if ($a_template_type == "") {
2129  return self::$templates;
2130  }
2131  return self::$templates[$a_template_type];
2132  }
+ 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 2668 of file class.ilObjStyleSheet.php.

Referenced by _getColorFlavor().

2668  : array
2669  {
2670  $h = $a_hls["h"] / 255;
2671  $l = $a_hls["l"] / 255;
2672  $s = $a_hls["s"] / 255;
2673  $temp3 = 0;
2674 
2675  $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
2676 
2677  // If S=0, define R, G, and B all to L
2678  if ($s == 0) {
2679  $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
2680  } else {
2681  if ($l < 0.5) {
2682  $temp2 = $l * (1.0 + $s);
2683  } else {
2684  $temp2 = $l + $s - $l * $s;
2685  }
2686 
2687  $temp1 = 2.0 * $l - $temp2;
2688 
2689 
2690  # For each of R, G, B, compute another temporary value, temp3, as follows:
2691  foreach ($rgb as $k => $v) {
2692  switch ($k) {
2693  case "r":
2694  $temp3 = $h + 1.0 / 3.0;
2695  break;
2696 
2697  case "g":
2698  $temp3 = $h;
2699  break;
2700 
2701  case "b":
2702  $temp3 = $h - 1.0 / 3.0;
2703  break;
2704  }
2705  if ($temp3 < 0) {
2706  $temp3 = $temp3 + 1.0;
2707  }
2708  if ($temp3 > 1) {
2709  $temp3 = $temp3 - 1.0;
2710  }
2711 
2712  if (6.0 * $temp3 < 1) {
2713  $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
2714  } elseif (2.0 * $temp3 < 1) {
2715  $rgb[$k] = $temp2;
2716  } elseif (3.0 * $temp3 < 2) {
2717  $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0 / 3.0) - $temp3) * 6.0;
2718  } else {
2719  $rgb[$k] = $temp1;
2720  }
2721  }
2722  }
2723 
2724  $rgb["r"] = round($rgb["r"] * 255);
2725  $rgb["g"] = round($rgb["g"] * 255);
2726  $rgb["b"] = round($rgb["b"] * 255);
2727 
2728  return $rgb;
2729  }
+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable ( string  $a_type)
static

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

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

2074  : bool
2075  {
2076  return in_array($a_type, self::$expandable_types);
2077  }
+ Here is the caller graph for this function:

◆ _isHideable()

static ilObjStyleSheet::_isHideable ( string  $a_type)
static

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

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

2079  : bool
2080  {
2081  return in_array($a_type, self::$hideable_types);
2082  }
+ 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:66
global $DIC
Definition: shib_login.php:22
$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:66
global $DIC
Definition: shib_login.php:22
$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 3149 of file class.ilObjStyleSheet.php.

References $DIC, $ilDB, and null.

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

3152  : ?int {
3153  global $DIC;
3154 
3155  $ilDB = $DIC->database();
3156 
3157  $set = $ilDB->query("SELECT id FROM style_template " .
3158  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer") .
3159  " AND name = " . $ilDB->quote($a_name, "text"));
3160  if ($rec = $ilDB->fetchAssoc($set)) {
3161  return (int) $rec["id"];
3162  }
3163 
3164  return null;
3165  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ 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 3046 of file class.ilObjStyleSheet.php.

References $DIC, $ilDB, and null.

Referenced by ilObjStyleSheetGUI\updateTemplateObject().

3046  : ?string
3047  {
3048  global $DIC;
3049 
3050  $ilDB = $DIC->database();
3051 
3052  $set = $ilDB->query("SELECT name FROM style_template WHERE " .
3053  " id = " . $ilDB->quote($a_t_id, "integer"));
3054 
3055  if ($rec = $ilDB->fetchAssoc($set)) {
3056  return $rec["name"];
3057  }
3058 
3059  return null;
3060  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ 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:66
global $DIC
Definition: shib_login.php:22
$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 2626 of file class.ilObjStyleSheet.php.

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

Referenced by _getColorFlavor().

2626  : array
2627  {
2628  $r = $a_rgb["r"] / 255;
2629  $g = $a_rgb["g"] / 255;
2630  $b = $a_rgb["b"] / 255;
2631  $h = 0;
2632 
2633  // max / min
2634  $max = max($r, $g, $b);
2635  $min = min($r, $g, $b);
2636 
2637  //lightness
2638  $l = ($max + $min) / 2;
2639 
2640  if ($max == $min) {
2641  $s = 0;
2642  } else {
2643  if ($l < 0.5) {
2644  $s = ($max - $min) / ($max + $min);
2645  } else {
2646  $s = ($max - $min) / (2.0 - $max - $min);
2647  }
2648 
2649  if ($r == $max) {
2650  $h = ($g - $b) / ($max - $min);
2651  } elseif ($g == $max) {
2652  $h = 2.0 + ($b - $r) / ($max - $min);
2653  } elseif ($b == $max) {
2654  $h = 4.0 + ($r - $g) / ($max - $min);
2655  }
2656  }
2657 
2658  $hls["h"] = round(($h / 6) * 255);
2659  $hls["l"] = round($l * 255);
2660  $hls["s"] = round($s * 255);
2661 
2662  return $hls;
2663  }
$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: shib_login.php:22
$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: shib_login.php:22
$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(), ilContentStyleSettingsGUI\import(), 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: shib_login.php:22
$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: shib_login.php:22
$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 893 of file class.ilObjStyleSheet.php.

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

899  : void {
900  $ilDB = $this->db;
901 
902  // delete characteristic record
903  $ilDB->insert("style_char", [
904  "style_id" => ["integer", $this->getId()],
905  "type" => ["text", $a_type],
906  "characteristic" => ["text", $a_char],
907  "hide" => ["integer", (int) $a_hidden],
908  "outdated" => ["integer", (int) $outdated],
909  "order_nr" => ["integer", $order_nr]
910  ]);
911 
912  $this->setUpToDate(false);
913  $this->_writeUpToDate($this->getId(), false);
914  }
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 2755 of file class.ilObjStyleSheet.php.

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

Referenced by create().

2758  : int {
2759  $ilDB = $this->db;
2760 
2761  $id = $ilDB->nextId("sty_media_query");
2762  if ($order_nr == 0) {
2763  $order_nr = $this->getMaxMQueryOrderNr() + 10;
2764  }
2765 
2766  $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
2767  " VALUES (" .
2768  $ilDB->quote($id, "integer") . "," .
2769  $ilDB->quote($this->getId(), "integer") . "," .
2770  $ilDB->quote($a_mquery, "text") . "," .
2771  $ilDB->quote($order_nr, "integer") .
2772  ")");
2773 
2774  return $id;
2775  }
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 1034 of file class.ilObjStyleSheet.php.

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

1040  : void {
1041  $ilDB = $this->db;
1042 
1043  $avail_params = $this->getAvailableParameters();
1044  $tag = explode(".", $a_tag);
1045  $value = $avail_params[$a_par][0];
1046  $id = $ilDB->nextId("style_parameter");
1047  $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1048  "(" .
1049  $ilDB->quote($id, "integer") . "," .
1050  $ilDB->quote($this->getId(), "integer") . "," .
1051  $ilDB->quote($a_type, "text") . "," .
1052  $ilDB->quote($tag[0], "text") . "," .
1053  $ilDB->quote($tag[1], "text") . "," .
1054  $ilDB->quote($a_par, "text") . "," .
1055  $ilDB->quote($value, "text") . "," .
1056  $ilDB->quote($a_mq_id, "integer") . "," .
1057  $ilDB->quote($a_custom, "integer") .
1058  ")";
1059  $ilDB->manipulate($q);
1060  $this->read();
1061  $this->writeCSSFile();
1062  }
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 2918 of file class.ilObjStyleSheet.php.

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

Referenced by create().

2922  : int {
2923  $ilDB = $this->db;
2924 
2925  $tid = $ilDB->nextId("style_template");
2926  $ilDB->manipulate("INSERT INTO style_template " .
2927  "(id, style_id, name, temp_type)" .
2928  " VALUES (" .
2929  $ilDB->quote($tid, "integer") . "," .
2930  $ilDB->quote($this->getId(), "integer") . "," .
2931  $ilDB->quote($a_name, "text") . "," .
2932  $ilDB->quote($a_type, "text") .
2933  ")");
2934 
2935  foreach ($a_classes as $t => $c) {
2936  $ilDB->manipulate("INSERT INTO style_template_class " .
2937  "(template_id, class_type, class)" .
2938  " VALUES (" .
2939  $ilDB->quote($tid, "integer") . "," .
2940  $ilDB->quote($t, "text") . "," .
2941  $ilDB->quote($c, "text") .
2942  ")");
2943  }
2944 
2945  $this->writeTemplatePreview(
2946  $tid,
2947  ilObjStyleSheetGUI::_getTemplatePreview($this, $a_type, $tid, true)
2948  );
2949 
2950  return $tid;
2951  }
static _getTemplatePreview(ilObjStyleSheet $a_style, string $a_type, int $a_t_id, bool $a_small_mode=false)
Get table template preview.
$c
Definition: deliver.php:25
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 2982 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

2986  : void {
2987  $ilDB = $this->db;
2988 
2989  $ilDB->manipulate("INSERT INTO style_template_class " .
2990  "(template_id, class_type, class)" .
2991  " VALUES (" .
2992  $ilDB->quote($a_t_id, "integer") . "," .
2993  $ilDB->quote($a_type, "text") . "," .
2994  $ilDB->quote($a_class, "text") .
2995  ")");
2996  }
ilDBInterface $db

◆ characteristicExists()

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

Check whether characteristic exists.

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

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

879  : bool {
880  $ilDB = $this->db;
881 
882  $set = $ilDB->queryF(
883  "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
884  array("integer", "text", "text"),
885  array($this->getId(), $a_char, $a_style_type)
886  );
887  if ($ilDB->fetchAssoc($set)) {
888  return true;
889  }
890  return false;
891  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ cleanExportDirectory()

ilObjStyleSheet::cleanExportDirectory ( )

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

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

Referenced by export().

1747  : void
1748  {
1749  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1750  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1751  // create export subdirectory
1752  $ex_dir = $style_dir . "/export";
1753 
1754  if (is_dir($ex_dir)) {
1755  ilFileUtils::delDir($ex_dir, true);
1756  }
1757  }
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 1020 of file class.ilObjStyleSheet.php.

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

1020  : void
1021  {
1022  ilFileUtils::rCopy($this->getImagesDirectory(), $a_target);
1023  }
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 $c, ilObject\$db, $DIC, $id, $ilDB, $q, $service, _getTemplateClassTypes(), addMediaQuery(), addTemplate(), ilObject\getId(), getScope(), 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  throw new Exception("Can't create style without a from style in non-import mode.");
791  } else {
792  // add style_data record
793  $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
794  "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
795  $ilDB->quote($this->getScope(), "integer") . ")";
796  $ilDB->manipulate($q);
797  }
798  } else {
799  // get style parameter records
800  $def = array();
801  $q = "SELECT * FROM style_parameter WHERE style_id = " .
802  $ilDB->quote($a_from_style, "integer");
803  $par_set = $ilDB->query($q);
804  while ($par_rec = $ilDB->fetchAssoc($par_set)) {
805  $def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
806  "parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
807  "type" => $par_rec["type"], "mq_id" => $par_rec["mq_id"], "custom" => $par_rec["custom"]);
808  }
809 
810  $char_repo = $this->repo->characteristic();
811  $char_repo->cloneAllFromStyle($a_from_style, $this->getId());
812 
813 
814  // copy media queries
815  $from_style = new ilObjStyleSheet($a_from_style);
816  $mqs = $from_style->getMediaQueries();
817  $mq_mapping = array();
818  foreach ($mqs as $mq) {
819  $nid = $this->addMediaQuery($mq["mquery"]);
820  $mq_mapping[$mq["id"]] = $nid;
821  }
822 
823  // default style settings
824  foreach ($def as $sty) {
825  $id = $ilDB->nextId("style_parameter");
826  $q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
827  "(" .
828  $ilDB->quote($id, "integer") . "," .
829  $ilDB->quote($this->getId(), "integer") . "," .
830  $ilDB->quote($sty["tag"], "text") . "," .
831  $ilDB->quote($sty["class"], "text") . "," .
832  $ilDB->quote($sty["parameter"], "text") . "," .
833  $ilDB->quote($sty["value"], "text") . "," .
834  $ilDB->quote($sty["type"], "text") . "," .
835  $ilDB->quote((int) ($mq_mapping[$sty["mq_id"]] ?? 0), "integer") . "," .
836  $ilDB->quote($sty["custom"], "integer") .
837  ")";
838  $ilDB->manipulate($q);
839  }
840 
841  // add style_data record
842  $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
843  "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
844  $ilDB->quote($this->getScope(), "integer") . ")";
845  $ilDB->manipulate($q);
846 
847  // copy images
848  $this->domain->style($this->getId())->cloneResourceContainer($from_style->getId());
849  // copy colors
850  $colors = $from_style->getColors();
851  foreach ($colors as $c) {
852  $color_manager->addColor($c["name"], $c["code"]);
853  }
854 
855  // copy templates
857  foreach ($tcts as $tct => $v) {
858  $templates = $from_style->getTemplates($tct);
859  foreach ($templates as $t) {
860  $this->addTemplate($tct, $t["name"], $t["classes"]);
861  }
862  }
863  }
864 
865  $this->read();
866  if (!$a_import_mode) {
867  $this->writeCSSFile();
868  }
869 
870  return $id;
871  }
read()
read style properties
$c
Definition: deliver.php:25
addTemplate(string $a_type, string $a_name, array $a_classes)
Add table template.
ilDBInterface $db
global $DIC
Definition: shib_login.php:22
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:40
addMediaQuery(string $a_mquery, int $order_nr=0)
+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjStyleSheet::createExportDirectory ( )

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

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

Referenced by createExportSubDirectory(), and export().

1720  : string
1721  {
1722  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1723  ilFileUtils::makeDir($sty_data_dir);
1724  if (!is_writable($sty_data_dir)) {
1725  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
1726  . ") not writeable.", $this->ilias->error_obj->FATAL);
1727  }
1728 
1729  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1730  ilFileUtils::makeDir($style_dir);
1731  if (!is_dir($style_dir)) {
1732  $this->ilias->raiseError("Creation of style directory failed (" .
1733  $style_dir . ").", $this->ilias->error_obj->FATAL);
1734  }
1735 
1736  // create export subdirectory
1737  $ex_dir = $style_dir . "/export";
1738  ilFileUtils::makeDir($ex_dir);
1739  if (!is_dir($ex_dir)) {
1740  $this->ilias->raiseError("Creation of Import Directory failed (" .
1741  $ex_dir . ").", $this->ilias->error_obj->FATAL);
1742  }
1743 
1744  return $ex_dir;
1745  }
Class ilObjForumAdministration.
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 1759 of file class.ilObjStyleSheet.php.

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

Referenced by export().

1760  {
1761  $ex_dir = $this->createExportDirectory();
1762  $ex_sub_dir = $ex_dir . "/" . $this->getExportSubDir();
1763  ilFileUtils::makeDir($ex_sub_dir);
1764  if (!is_writable($ex_sub_dir)) {
1765  $this->ilias->raiseError("Style data directory (" . $ex_sub_dir
1766  . ") not writeable.", $this->ilias->error_obj->FATAL);
1767  }
1768  $ex_sub_images_dir = $ex_sub_dir . "/images";
1769  ilFileUtils::makeDir($ex_sub_images_dir);
1770  if (!is_writable($ex_sub_images_dir)) {
1771  $this->ilias->raiseError("Style data directory (" . $ex_sub_images_dir
1772  . ") not writeable.", $this->ilias->error_obj->FATAL);
1773  }
1774  }
Class ilObjForumAdministration.
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 1927 of file class.ilObjStyleSheet.php.

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

Referenced by import().

1930  : void {
1931  $ilDB = $this->db;
1932 
1933  $this->is_3_10_skin = false;
1934 
1935  if (!$a_skip_parent_create) {
1936  parent::create();
1937  }
1938  $importParser = new ilStyleImportParser($a_file, $this);
1939  $importParser->startParsing();
1940 
1941  // store style parameter
1942  foreach ($this->style as $style) {
1943  foreach ($style as $tag) {
1944  $id = $ilDB->nextId("style_parameter");
1945 
1946  // migrate old table PageFrame/PageContainer to div
1947  if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
1948  $tag["tag"] == "table") {
1949  $tag["tag"] = "div";
1950  if ($tag["parameter"] == "width" && $tag["value"] == "100%") {
1951  continue;
1952  }
1953  }
1954 
1955  if ($tag["type"] === "text_block" && $tag["tag"] === "div") {
1956  $tag["tag"] = "p";
1957  }
1958 
1959  $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
1960  "(" .
1961  $ilDB->quote($id, "integer") . "," .
1962  $ilDB->quote($this->getId(), "integer") . "," .
1963  $ilDB->quote($tag["tag"], "text") . "," .
1964  $ilDB->quote($tag["class"], "text") . "," .
1965  $ilDB->quote($tag["parameter"], "text") . "," .
1966  $ilDB->quote($tag["type"], "text") . "," .
1967  $ilDB->quote($tag["value"], "text") . "," .
1968  $ilDB->quote((bool) $tag["custom"], "integer") .
1969  ")";
1970  $ilDB->manipulate($q);
1971  }
1972  }
1973 
1974  // store characteristics
1975  $this->is_3_10_skin = true;
1976  foreach ($this->chars as $char) {
1977  if ($char["type"] != "") {
1978  $s = substr($char["class"], strlen($char["class"]) - 6);
1979  if ($s != ":hover") {
1980  $ilDB->replace(
1981  "style_char",
1982  array(
1983  "style_id" => array("integer", $this->getId()),
1984  "type" => array("text", $char["type"]),
1985  "characteristic" => array("text", ilStr::subStr($char["class"], 0, 30))),
1986  array("hide" => array("integer", 0))
1987  );
1988  $this->is_3_10_skin = false;
1989  }
1990  }
1991  }
1992 
1993  // add style_data record
1994  $q = "INSERT INTO style_data (id, uptodate) VALUES " .
1995  "(" . $ilDB->quote($this->getId(), "integer") . ", 0)";
1996  $ilDB->manipulate($q);
1997 
1998  $this->update();
1999  $this->read();
2000 
2001  if ($this->is_3_10_skin) {
2002  $this->do_3_10_Migration();
2003  }
2004  //$this->writeCSSFile();
2005  }
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 1068 of file class.ilObjStyleSheet.php.

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

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

◆ createImportDirectory()

ilObjStyleSheet::createImportDirectory ( )

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

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

Referenced by import().

1847  : string
1848  {
1849  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1850  ilFileUtils::makeDir($sty_data_dir);
1851  if (!is_writable($sty_data_dir)) {
1852  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
1853  . ") not writeable.", $this->ilias->error_obj->FATAL);
1854  }
1855 
1856  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1857  ilFileUtils::makeDir($style_dir);
1858  if (!is_dir($style_dir)) {
1859  $this->ilias->raiseError("Creation of style directory failed (" .
1860  $style_dir . ").", $this->ilias->error_obj->FATAL);
1861  }
1862 
1863  // create import subdirectory
1864  $im_dir = $style_dir . "/import";
1865  ilFileUtils::makeDir($im_dir);
1866  if (!is_dir($im_dir)) {
1867  $this->ilias->raiseError("Creation of Import Directory failed (" .
1868  $im_dir . ").", $this->ilias->error_obj->FATAL);
1869  }
1870 
1871  return $im_dir;
1872  }
Class ilObjForumAdministration.
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 1195 of file class.ilObjStyleSheet.php.

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

1195  : bool
1196  {
1197  $ilDB = $this->db;
1198 
1199  // delete object
1200  parent::delete();
1201 
1202  // check whether this style is global default
1203  $def_style = $this->ilias->getSetting("default_content_style_id");
1204  if ($def_style == $this->getId()) {
1205  $this->ilias->deleteSetting("default_content_style_id");
1206  }
1207 
1208  // check whether this style is global fixed
1209  $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1210  if ($fixed_style == $this->getId()) {
1211  $this->ilias->deleteSetting("fixed_content_style_id");
1212  }
1213 
1214  // delete style parameter
1215  $q = "DELETE FROM style_parameter WHERE style_id = " .
1216  $ilDB->quote($this->getId(), "integer");
1217  $ilDB->manipulate($q);
1218 
1219  // delete style file
1220  $css_file_name = ilFileUtils::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1221  if (is_file($css_file_name)) {
1222  unlink($css_file_name);
1223  }
1224 
1225  // delete media queries
1226  $ilDB->manipulate(
1227  "DELETE FROM sty_media_query WHERE " .
1228  " style_id = " . $ilDB->quote($this->getId(), "integer")
1229  );
1230 
1231  // delete entries in learning modules
1233 
1234  // delete style data record
1235  $q = "DELETE FROM style_data WHERE id = " .
1236  $ilDB->quote($this->getId(), "integer");
1237  $ilDB->manipulate($q);
1238 
1239  return true;
1240  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
ilDBInterface $db
Class ilObjForumAdministration.
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 1158 of file class.ilObjStyleSheet.php.

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

1163  : void {
1164  $ilDB = $this->db;
1165 
1166  $q = "DELETE FROM style_parameter WHERE " .
1167  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1168  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1169  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1170  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1171  " custom = " . $ilDB->quote(1, "integer") . " AND " .
1172  " " . $ilDB->equals("type", $a_type, "text", true);
1173 
1174  $ilDB->manipulate($q);
1175  }
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 2829 of file class.ilObjStyleSheet.php.

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

2831  : void {
2832  $ilDB = $this->db;
2833 
2834  $ilDB->manipulate(
2835  "DELETE FROM sty_media_query WHERE " .
2836  " style_id = " . $ilDB->quote($this->getId(), "integer") .
2837  " AND id = " . $ilDB->quote($a_id, "integer")
2838  );
2839  $this->saveMediaQueryOrder();
2840  }
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 1141 of file class.ilObjStyleSheet.php.

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

1141  : void
1142  {
1143  $ilDB = $this->db;
1144 
1145  $q = "DELETE FROM style_parameter WHERE id = " .
1146  $ilDB->quote($a_id, "integer");
1147  $ilDB->query($q);
1148  }
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 1180 of file class.ilObjStyleSheet.php.

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

1183  : void {
1184  $ilDB = $this->db;
1185 
1186  $q = "DELETE FROM style_parameter WHERE " .
1187  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1188  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1189  " " . $ilDB->equals("type", $a_type, "text", true);
1190 
1191  $ilDB->manipulate($q);
1192  }
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 2140 of file class.ilObjStyleSheet.php.

2143  : string {
2144  return self::$templates[$t][$k];
2145  }

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

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

Referenced by do_3_10_Migration().

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

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

Referenced by createFromXMLFile().

2270  : void
2271  {
2272  $ilDB = $this->db;
2273 
2274  $this->do_3_9_Migration($this->getId());
2275 
2276  $this->do_3_10_CharMigration($this->getId());
2277 
2278  // style_char: type for characteristic
2279  $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?" .
2280  " AND style_id = ? ", array("text", "text", "integer"));
2281  $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2282  $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2283  $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2284  $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2285  $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2286  $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2287 
2288  // style_parameter: type for class
2289  $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?" .
2290  " AND style_id = ? ", array("text", "text", "integer"));
2291  $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2292  $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2293  $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2294  $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2295  $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2296  $ilDB->execute($st, array("table", "Page", $this->getId()));
2297 
2298  $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?" .
2299  " AND style_id = ? ", array("text", "text", "integer"));
2300  $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2301 
2302  // style_char: characteristic for characteristic
2303  $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?" .
2304  " AND style_id = ? ", array("text", "text", "integer"));
2305  $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2306  $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2307 
2308  // style_parameter: class for class
2309  $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?" .
2310  " AND style_id = ? ", array("text", "text", "integer"));
2311  $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2312  $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2313 
2314  // force rewriting of container style
2315  $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?" .
2316  " AND style_id = ? ", array("text", "integer"));
2317  $ilDB->execute($st, array("page_cont", $this->getId()));
2318  $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?" .
2319  " AND style_id = ? ", array("text", "integer"));
2320  $ilDB->execute($st, array("page_cont", $this->getId()));
2321  }
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 2464 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by do_3_10_Migration().

2464  : void
2465  {
2466  $ilDB = $this->db;
2467 
2468  $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2469  $pars = array("margin-top", "margin-bottom");
2470 
2471  foreach ($classes as $curr_class) {
2472  foreach ($pars as $curr_par) {
2473  $res2 = $ilDB->queryF(
2474  "SELECT id FROM style_parameter WHERE style_id = %s" .
2475  " AND tag = %s AND class= %s AND parameter = %s",
2476  array("integer", "text", "text", "text"),
2477  array($a_id, "p", $curr_class, $curr_par)
2478  );
2479  if ($row2 = $ilDB->fetchAssoc($res2)) {
2480  $ilDB->manipulateF(
2481  "UPDATE style_parameter SET value= %s WHERE id = %s",
2482  array("text", "integer"),
2483  array("10px", $row2["id"])
2484  );
2485  } else {
2486  $nid = $ilDB->nextId("style_parameter");
2487  $ilDB->manipulateF(
2488  "INSERT INTO style_parameter " .
2489  "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2490  array("integer", "integer", "text", "text", "text", "text"),
2491  array($nid, $a_id, "div", $curr_class, $curr_par, "10px")
2492  );
2493  }
2494  }
2495  }
2496 
2497  $ilDB->manipulateF(
2498  "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2499  array("text", "text", "integer"),
2500  array("div", "p", $a_id)
2501  );
2502  }
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 1802 of file class.ilObjStyleSheet.php.

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

1802  : string
1803  {
1804  $this->cleanExportDirectory();
1805  $ex_dir = $this->createExportDirectory();
1806  $this->createExportSubDirectory();
1807  $this->exportXML($ex_dir . "/" . $this->getExportSubDir());
1808  //echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
1810  $this->getImagesDirectory(),
1811  $ex_dir . "/" . $this->getExportSubDir() . "/images"
1812  );
1813  if (is_file($ex_dir . "/" . $this->getExportSubDir() . ".zip")) {
1814  unlink($ex_dir . "/" . $this->getExportSubDir() . ".zip");
1815  }
1817  $ex_dir . "/" . $this->getExportSubDir(),
1818  $ex_dir . "/" . $this->getExportSubDir() . ".zip"
1819  );
1820 
1821  return $ex_dir . "/" . $this->getExportSubDir() . ".zip";
1822  }
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 1827 of file class.ilObjStyleSheet.php.

References getXML().

Referenced by export().

1827  : void
1828  {
1829  $file = $a_dir . "/style.xml";
1830 
1831  // open file
1832  if (!($fp = fopen($file, 'wb'))) {
1833  die("<strong>Error</strong>: Could not open \"" . $file . "\" for writing" .
1834  " in <strong>" . __FILE__ . "</strong> on line <strong>" . __LINE__ . "</strong><br />");
1835  }
1836 
1837  // set file permissions
1838  chmod($file, 0770);
1839 
1840  // write xml data into the file
1841  fwrite($fp, $this->getXML());
1842 
1843  // close file
1844  fclose($fp);
1845  }
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 2152 of file class.ilObjStyleSheet.php.

Referenced by addParameter().

2152  : array
2153  {
2154  $pars = array();
2155  foreach (self::$parameter as $p => $v) {
2156  $pars[$p] = $v["values"];
2157  }
2158 
2159  return $pars;
2160  }
+ Here is the caller graph for this function:

◆ getBaseContentStylePath()

static ilObjStyleSheet::getBaseContentStylePath ( )
static

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

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

1616  : string
1617  {
1618  return "./components/ILIAS/COPage/css/content_base.css";
1619  }
+ 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 919 of file class.ilObjStyleSheet.php.

References $c, and $chars.

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

923  : array {
924  $chars = array();
925 
926  if ($a_type == "") {
928  }
929  if (isset($this->chars_by_type[$a_type])) {
930  foreach ($this->chars_by_type[$a_type] as $c) {
931  if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
932  $chars[] = $c;
933  }
934  }
935  }
936 
937  if ($a_no_hidden) {
938  foreach ($chars as $k => $char) {
939  if ($a_type == "" && $this->hidden_chars[$char["type"] . ":" . $char["class"]]) {
940  unset($chars[$k]);
941  } elseif ($this->hidden_chars[$a_type . ":" . $char] ?? false) {
942  unset($chars[$k]);
943  }
944  }
945  }
946 
947  return $chars;
948  }
$c
Definition: deliver.php:25
+ Here is the caller graph for this function:

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName ( string  $a_name)

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

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

Referenced by writeCSSFile().

2542  : string
2543  {
2544  $ilDB = $this->db;
2545  $a_i = "";
2546  $pos = strpos($a_name, "(");
2547  if ($pos > 0) {
2548  $a_i = substr($a_name, $pos + 1);
2549  $a_i = str_replace(")", "", $a_i);
2550  $a_name = substr($a_name, 0, $pos);
2551  }
2552 
2553  $set = $ilDB->query("SELECT color_code FROM style_color WHERE " .
2554  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2555  " color_name = " . $ilDB->quote($a_name, "text"));
2556  if ($rec = $ilDB->fetchAssoc($set)) {
2557  if ($a_i == "") {
2558  return "#" . $rec["color_code"];
2559  } else {
2560  return "#" . ilObjStyleSheet::_getColorFlavor(
2561  $rec["color_code"],
2562  (int) $a_i
2563  );
2564  }
2565  }
2566  return "";
2567  }
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 2511 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by getXML().

2511  : array
2512  {
2513  $ilDB = $this->db;
2514 
2515  $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2516  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2517  "ORDER BY color_name");
2518 
2519  $colors = array();
2520  while ($rec = $ilDB->fetchAssoc($set)) {
2521  $colors[] = array(
2522  "name" => $rec["color_name"],
2523  "code" => $rec["color_code"]
2524  );
2525  }
2526 
2527  return $colors;
2528  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getContentPrintStyle()

static ilObjStyleSheet::getContentPrintStyle ( )
static

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

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

1606  : string
1607  {
1608  return "./components/ILIAS/COPage/css/print_content.css";
1609  }
+ 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(), and ILIAS\Repository\int().

Referenced by ilDclDetailedViewDefinitionGUI\__construct(), ilPageLayoutGUI\__construct(), ilImprintGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilPortfolioPageGUI\__construct(), ilAssQuestionPreviewGUI\__construct(), ILIAS\Style\Content\GUIService\addCss(), ilDashboardPageGUI\afterConstructor(), ilPageObjectGUI\displayMedia(), assOrderingQuestionGUI\editNesting(), ilLOEditorGUI\executeCommand(), ilAssQuestionHintsGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilCOPageHTMLExport\exportStyles(), ilAssQuestionPageCommandForwarder\forward(), ilAuthPageEditorGUI\forwardToPageObject(), ILIAS\UI\Implementation\Component\Layout\Page\PageQueryActionHandler\getConfig(), 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(), ilDclDetailedViewDefinitionGUI\showPage(), ilObjMediaPoolGUI\showPage(), and ilTestCorrectionsGUI\showSolution().

1573  : string {
1574  global $DIC;
1575  $ilSetting = $DIC->settings();
1576 
1577  $random = new \Random\Randomizer();
1578  $rand = $random->getInt(1, 999999);
1579 
1580  // check global fixed content style
1581  $fixed_style = $ilSetting->get("fixed_content_style_id");
1582  if ($fixed_style > 0) {
1583  $a_style_id = (int) $fixed_style;
1584  }
1585 
1586  // check global default style
1587  if ($a_style_id <= 0) {
1588  $a_style_id = (int) $ilSetting->get("default_content_style_id");
1589  }
1590 
1591  if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
1592  // check whether file is up to date
1593  if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
1594  $style = new ilObjStyleSheet($a_style_id);
1595  $style->writeCSSFile();
1596  }
1597 
1598  $style_manager = $DIC->contentStyle()->internal()->domain()->style($a_style_id);
1599  $path = $style_manager->getPath();
1600  return $path;
1601  } else { // todo: work this out
1602  return "./components/ILIAS/COPage/css/content.css";
1603  }
1604  }
$path
Definition: ltiservices.php:29
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupUpToDate(int $a_id)
global $DIC
Definition: shib_login.php:22
global $ilSetting
Definition: privfeed.php:31
+ 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 1524 of file class.ilObjStyleSheet.php.

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

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

◆ getExportContentStylePath()

static ilObjStyleSheet::getExportContentStylePath ( )
static

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

Referenced by ilCOPageHTMLExport\exportStyles(), ILIAS\Portfolio\Export\PortfolioHtmlExport\getInitialisedTemplate(), ILIAS\Wiki\Export\BlogHtmlExport\getInitialisedTemplate(), and ilCOPageHTMLExport\getPreparedMainTemplate().

1560  : string
1561  {
1562  return "content_style/style.css";
1563  }
+ Here is the caller graph for this function:

◆ getExportSubDir()

ilObjStyleSheet::getExportSubDir ( )

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

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

References $export_sub_dir, and ilObject\getId().

Referenced by createExportSubDirectory(), and export().

1787  : string
1788  {
1789  if ($this->export_sub_dir == "") {
1790  return "sty_" . $this->getId();
1791  } else {
1792  return $this->export_sub_dir;
1793  }
1794  }
+ 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 977 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

980  : bool {
981  $ilDB = $this->db;
982 
983  $set = $ilDB->query(
984  "SELECT hide FROM style_char " .
985  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
986  " type = " . $ilDB->quote($a_type, "text") . " AND " .
987  " characteristic = " . $ilDB->quote($a_char, "text")
988  );
989  $rec = $ilDB->fetchAssoc($set);
990 
991  return (bool) ($rec["hide"] ?? false);
992  }
ilDBInterface $db

◆ getImagesDirectory()

ilObjStyleSheet::getImagesDirectory ( )

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

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

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

1121  : string
1122  {
1124  }
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 2780 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by addMediaQuery().

2780  : int
2781  {
2782  $ilDB = $this->db;
2783 
2784  $set = $ilDB->query(
2785  "SELECT max(order_nr) mnr FROM sty_media_query " .
2786  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer")
2787  );
2788  $rec = $ilDB->fetchAssoc($set);
2789 
2790  return (int) $rec["mnr"];
2791  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

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

References ilObject\$db, and $ilDB.

Referenced by saveMediaQueryOrder(), and writeCSSFile().

2739  : array
2740  {
2741  $ilDB = $this->db;
2742 
2743  $set = $ilDB->query("SELECT * FROM sty_media_query WHERE " .
2744  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2745  "ORDER BY order_nr");
2746 
2747  $mq = array();
2748  while ($rec = $ilDB->fetchAssoc($set)) {
2749  $mq[] = $rec;
2750  }
2751 
2752  return $mq;
2753  }
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 2812 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

2814  : array {
2815  $ilDB = $this->db;
2816 
2817  $set = $ilDB->query(
2818  "SELECT * FROM sty_media_query " .
2819  " WHERE id = " . $ilDB->quote($a_id, "integer")
2820  );
2821  return $ilDB->fetchAssoc($set);
2822  }
ilDBInterface $db

◆ getParametersOfClass()

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

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

1553  : array {
1554  if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1555  return $this->style_class[$a_type][$a_class][$a_mq_id];
1556  }
1557  return array();
1558  }

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

References $style.

Referenced by writeCSSFile().

1652  : array
1653  {
1654  return $this->style;
1655  }
+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

References $parameter.

2010  : array
2011  {
2012  $groups = array();
2013 
2014  foreach (self::$parameter as $parameter => $props) {
2015  $groups[$props["group"]][] = $parameter;
2016  }
2017  return $groups;
2018  }

◆ getSyntaxStylePath()

static ilObjStyleSheet::getSyntaxStylePath ( )
static

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

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

1611  : string
1612  {
1613  return "./components/ILIAS/COPage/css/syntaxhighlight.css";
1614  }
+ Here is the caller graph for this function:

◆ getTemplate()

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

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

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

Referenced by ilObjStyleSheetGUI\_getTemplatePreview().

3018  : array
3019  {
3020  $ilDB = $this->db;
3021 
3022  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3023  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
3024  " AND id = " . $ilDB->quote($a_t_id, "integer"));
3025 
3026  if ($rec = $ilDB->fetchAssoc($set)) {
3027  $rec["classes"] = $this->getTemplateClasses((int) $rec["id"]);
3028 
3029  $template = $rec;
3030  return $template;
3031  }
3032  return array();
3033  }
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 2898 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by getTemplate(), and getTemplates().

2900  : array {
2901  $ilDB = $this->db;
2902  $set = $ilDB->query("SELECT * FROM style_template_class WHERE " .
2903  "template_id = " . $ilDB->quote($a_tid, "integer"));
2904 
2905  $class = array();
2906  while ($rec = $ilDB->fetchAssoc($set)) {
2907  $key = $rec["class_type"];
2908  $class[$key] = $rec["class"];
2909  }
2910 
2911  return $class;
2912  }
ilDBInterface $db
+ Here is the caller graph for this function:

◆ getTemplates()

ilObjStyleSheet::getTemplates ( string  $a_type)

Get table templates of style.

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

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

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

2878  : array {
2879  $ilDB = $this->db;
2880 
2881  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
2882  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2883  "temp_type = " . $ilDB->quote($a_type, "text") . " " .
2884  "ORDER BY name");
2885 
2886  $templates = array();
2887  while ($rec = $ilDB->fetchAssoc($set)) {
2888  $rec["classes"] = $this->getTemplateClasses((int) $rec["id"]);
2889  $templates[] = $rec;
2890  }
2891 
2892  return $templates;
2893  }
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 3065 of file class.ilObjStyleSheet.php.

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

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

3065  : string
3066  {
3067  $ilDB = $this->db;
3068 
3069  $tag = "<StyleTemplates>";
3070 
3071  $ttypes = array("table", "vaccordion", "haccordion", "carousel");
3072 
3073  foreach ($ttypes as $ttype) {
3074  $ts = $this->getTemplates($ttype);
3075 
3076  foreach ($ts as $t) {
3078  /*$atts = array("table" => "TableClass",
3079  "caption" => "CaptionClass",
3080  "row_head" => "RowHeadClass",
3081  "row_foot" => "RowFootClass",
3082  "col_head" => "ColHeadClass",
3083  "col_foot" => "ColFootClass",
3084  "odd_row" => "OddRowClass",
3085  "even_row" => "EvenRowClass",
3086  "odd_col" => "OddColClass",
3087  "even_col" => "EvenColClass");*/
3088  $c = $t["classes"];
3089 
3090  $tag .= '<StyleTemplate Name="' . $t["name"] . '">';
3091 
3092  foreach ($atts as $type => $t2) {
3093  if (($c[$type] ?? "") != "") {
3094  $tag .= '<StyleClass Type="' . $type . '" Value="' . $c[$type] . '" />';
3095  }
3096  }
3097 
3098  $tag .= "</StyleTemplate>";
3099  }
3100  }
3101 
3102  $tag .= "</StyleTemplates>";
3103 
3104  //echo htmlentities($tag);
3105  return $tag;
3106  }
string $type
$c
Definition: deliver.php:25
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 1132 of file class.ilObjStyleSheet.php.

References getImagesDirectory().

1132  : string
1133  {
1134  return $this->getImagesDirectory() .
1135  "/thumbnails";
1136  }
+ 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 1671 of file class.ilObjStyleSheet.php.

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

Referenced by exportXML().

1671  : string
1672  {
1673  $xml = "<StyleSheet>\n";
1674 
1675  // title and description
1676  $xml .= "<Title>" . $this->handleXmlString($this->getTitle()) . "</Title>";
1677  $xml .= "<Description>" . $this->handleXmlString($this->getDescription()) . "</Description>\n";
1678 
1679  // style classes
1680  foreach ($this->chars as $char) {
1681  $xml .= "<Style Tag=\"" . ilObjStyleSheet::_determineTag($char["type"]) .
1682  "\" Type=\"" . $char["type"] . "\" Class=\"" . $char["class"] . "\">\n";
1683  foreach ($this->style as $style) {
1684  if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"]) {
1685  foreach ($style as $tag) {
1686  $xml .= "<StyleParameter Name=\"" . $tag["parameter"] . "\" Value=\"" . $tag["value"] . "\" Custom=\"" . $tag["custom"] . "\" />\n";
1687  }
1688  }
1689  }
1690  $xml .= "</Style>\n";
1691  }
1692 
1693  // colors
1694  foreach ($this->getColors() as $color) {
1695  $xml .= "<StyleColor Name=\"" . $color["name"] . "\" Code=\"" . $color["code"] . "\"/>\n";
1696  }
1697 
1698  // templates
1700  foreach ($tcts as $tct => $v) {
1701  $ts = $this->getTemplates($tct);
1702 
1703  foreach ($ts as $t) {
1704  $xml .= "<StyleTemplate Type=\"" . $tct . "\" Name=\"" . $t["name"] . "\">\n";
1705  foreach ($t["classes"] as $ct => $c) {
1706  if ($c != "") {
1707  $xml .= "<StyleTemplateClass ClassType=\"" . $ct . "\" Class=\"" . $c . "\"/>\n";
1708  }
1709  }
1710  $xml .= "</StyleTemplate>\n";
1711  }
1712  }
1713 
1714 
1715  $xml .= "</StyleSheet>";
1716  //echo "<pre>".htmlentities($xml)."</pre>"; exit;
1717  return $xml;
1718  }
getColors()
Get colors of style.
handleXmlString(string $a_str)
$c
Definition: deliver.php:25
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 1662 of file class.ilObjStyleSheet.php.

Referenced by getXML().

1662  : string
1663  {
1664  return str_replace("&", "&amp;", $a_str);
1665  }
+ Here is the caller graph for this function:

◆ hexdec()

static ilObjStyleSheet::hexdec ( string  $hex)
staticprotected

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

2614  : int
2615  {
2616  $hex = preg_replace("/[^a-fA-F0-9]+/", "", $hex);
2617  if ($hex === "") {
2618  $hex = "0";
2619  }
2620  return (int) hexdec($hex);
2621  }
static hexdec(string $hex)

◆ ilClone()

ilObjStyleSheet::ilClone ( )

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

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

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

997  : int
998  {
999  $lng = $this->lng;
1000 
1001  $lng->loadLanguageModule("style");
1002 
1003  $new_obj = new ilObjStyleSheet();
1004  $new_obj->setTitle($this->getTitle() . " (" . $lng->txt("sty_acopy") . ")");
1005  $new_obj->setType($this->getType());
1006  $new_obj->setDescription($this->getDescription());
1007  $new_obj->create($this->getId());
1008 
1009  $new_obj->writeStyleSetting(
1010  "disable_auto_margins",
1011  $this->lookupStyleSetting("disable_auto_margins")
1012  );
1013 
1014  return $new_obj->getId();
1015  }
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 1881 of file class.ilObjStyleSheet.php.

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

1881  : void
1882  {
1883  parent::create();
1884  $subdir = "";
1885  $im_dir = $this->createImportDirectory();
1886 
1887  // handle uploaded files
1888  if (is_array($a_file)) {
1890  $a_file["tmp_name"],
1891  $a_file["name"],
1892  $im_dir . "/" . $a_file["name"]
1893  );
1894  $file_name = $a_file["name"];
1895  } else { // handle not directly uploaded files
1896  $pi = pathinfo($a_file);
1897  $file_name = $pi["basename"];
1898  copy($a_file, $im_dir . "/" . $file_name);
1899  }
1900  $file = pathinfo($file_name);
1901 
1902  // unzip file
1903  if (strtolower($file["extension"]) == "zip") {
1904  $this->domain->resources()->zip()->unzipFile($im_dir . "/" . $file_name);
1905  $subdir = basename($file["basename"], "." . $file["extension"]);
1906  if (!is_dir($im_dir . "/" . $subdir)) {
1907  $subdir = "style"; // check style subdir
1908  }
1909  $xml_file = $im_dir . "/" . $subdir . "/style.xml";
1910  } else { // handle xml file directly (old style)
1911  $xml_file = $im_dir . "/" . $file_name;
1912  }
1913 
1914  // load information from xml file
1915  //echo "-$xml_file-";
1916  $this->createFromXMLFile($xml_file, true);
1917 
1919  $this->read();
1920  $this->writeCSSFile();
1921  }
read()
read style properties
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.
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 2110 of file class.ilObjStyleSheet.php.

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

2113  : bool {
2114  foreach (self::$core_styles as $s) {
2115  if ($s["type"] == $a_type && $s["class"] == $a_class) {
2116  return true;
2117  }
2118  }
2119  return false;
2120  }
+ 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 3271 of file class.ilObjStyleSheet.php.

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

3273  : array {
3274  global $DIC;
3275 
3276  $ilDB = $DIC->database();
3277 
3278  $obj_ids = array();
3279  if (ilObject::_lookupType($a_style_id) == "sty") {
3280  $set = $ilDB->query(
3281  "SELECT DISTINCT obj_id FROM style_usage " .
3282  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer")
3283  );
3284 
3285  while ($rec = $ilDB->fetchAssoc($set)) {
3286  $obj_ids[] = (int) $rec["obj_id"];
3287  }
3288  }
3289  return $obj_ids;
3290  }
global $DIC
Definition: shib_login.php:22
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 3244 of file class.ilObjStyleSheet.php.

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

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

3246  : int {
3247  global $DIC;
3248 
3249  $ilDB = $DIC->database();
3250 
3251  $set = $ilDB->query(
3252  "SELECT style_id FROM style_usage " .
3253  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
3254  );
3255  $rec = $ilDB->fetchAssoc($set);
3256  if (!is_array($rec)) {
3257  return 0;
3258  }
3259 
3260  if (ilObject::_lookupType((int) $rec["style_id"]) == "sty") {
3261  return (int) $rec["style_id"];
3262  }
3263 
3264  return 0;
3265  }
global $DIC
Definition: shib_login.php:22
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 3207 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by ilClone().

3207  : string
3208  {
3209  $ilDB = $this->db;
3210 
3211  $set = $ilDB->query(
3212  "SELECT value FROM style_setting " .
3213  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
3214  " AND name = " . $ilDB->quote($a_name, "text")
3215  );
3216  $rec = $ilDB->fetchAssoc($set);
3217 
3218  return $rec["value"] ?? '';
3219  }
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 3038 of file class.ilObjStyleSheet.php.

Referenced by ilObjStyleSheetGUI\_getTemplatePreview().

3038  : string
3039  {
3040  return self::_lookupTemplateName($a_t_id);
3041  }
+ Here is the caller graph for this function:

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview ( int  $a_t_id)

Lookup table template preview.

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

References ilObject\$db, and $ilDB.

3133  : string
3134  {
3135  $ilDB = $this->db;
3136 
3137  $set = $ilDB->query("SELECT preview FROM style_template " .
3138  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3139  if ($rec = $ilDB->fetchAssoc($set)) {
3140  return $rec["preview"] ?? "";
3141  }
3142 
3143  return "";
3144  }
ilDBInterface $db

◆ read()

ilObjStyleSheet::read ( )

read style properties

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

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

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

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

References ilObject\$db, and $ilDB.

2533  : void
2534  {
2535  $ilDB = $this->db;
2536 
2537  $ilDB->manipulate("DELETE FROM style_color WHERE " .
2538  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2539  " color_name = " . $ilDB->quote($a_name, "text"));
2540  }
ilDBInterface $db

◆ removeTemplate()

ilObjStyleSheet::removeTemplate ( int  $a_t_id)

Remove table template.

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

References ilObject\$db, and $ilDB.

3170  : void
3171  {
3172  $ilDB = $this->db;
3173 
3174  $ilDB->manipulate("DELETE FROM style_template WHERE " .
3175  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3176  " id = " . $ilDB->quote($a_t_id, "integer"));
3177 
3178  $ilDB->manipulate(
3179  "DELETE FROM style_template_class WHERE " .
3180  "template_id = " . $ilDB->quote($a_t_id, "integer")
3181  );
3182  }
ilDBInterface $db

◆ saveHideStatus()

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

Save characteristic hidden status.

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

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

962  : void {
963  $ilDB = $this->db;
964 
965  $ilDB->manipulate(
966  "UPDATE style_char SET " .
967  " hide = " . $ilDB->quote((int) $a_hide, "integer") .
968  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
969  " type = " . $ilDB->quote($a_type, "text") . " AND " .
970  " characteristic = " . $ilDB->quote($a_char, "text")
971  );
972  }
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 2845 of file class.ilObjStyleSheet.php.

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

Referenced by deleteMediaQuery().

2847  : void {
2848  $ilDB = $this->db;
2849 
2850  $mqueries = $this->getMediaQueries();
2851  if (is_array($a_order_nr)) {
2852  foreach ($mqueries as $k => $mq) {
2853  $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
2854  }
2855  $mqueries = ilArrayUtil::sortArray($mqueries, "order_nr", "", true);
2856  }
2857  $cnt = 10;
2858  foreach ($mqueries as $mq) {
2859  $ilDB->manipulate(
2860  "UPDATE sty_media_query SET " .
2861  " order_nr = " . $ilDB->quote($cnt, "integer") .
2862  " WHERE id = " . $ilDB->quote($mq["id"], "integer")
2863  );
2864  $cnt += 10;
2865  }
2866  }
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 950 of file class.ilObjStyleSheet.php.

950  : void
951  {
952  $this->chars = $a_chars;
953  }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir ( string  $a_dir)

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

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

1779  : void
1780  {
1781  $this->export_sub_dir = $a_dir;
1782  }

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

1657  : void
1658  {
1659  $this->style = $a_style;
1660  }

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

References ilObject\$db, and $ilDB.

3003  : bool {
3004  $ilDB = $this->db;
3005 
3006  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3007  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3008  "name = " . $ilDB->quote($a_template_name, "text"));
3009  if ($ilDB->fetchAssoc($set)) {
3010  return true;
3011  }
3012  return false;
3013  }
ilDBInterface $db

◆ update()

ilObjStyleSheet::update ( )

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

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

Referenced by createFromXMLFile().

1621  : bool
1622  {
1623  $ilDB = $this->db;
1624 
1625  parent::update();
1626  $this->read(); // this could be done better
1627  $this->writeCSSFile();
1628 
1629  $q = "UPDATE style_data " .
1630  "SET category = " . $ilDB->quote($this->getScope(), "integer") .
1631  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
1632  $ilDB->manipulate($q);
1633 
1634  return true;
1635  }
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 2793 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

2796  : void {
2797  $ilDB = $this->db;
2798 
2799  $ilDB->manipulate(
2800  "UPDATE sty_media_query SET " .
2801  " mquery = " . $ilDB->quote($a_mquery, "text") .
2802  " WHERE id = " . $ilDB->quote($a_id, "integer")
2803  );
2804  }
ilDBInterface $db

◆ updateStyleParameter()

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

update style parameter per id

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

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

1643  : void {
1644  $ilDB = $this->db;
1645 
1646  $q = "UPDATE style_parameter SET VALUE = " .
1647  $ilDB->quote($a_value, "text") . " WHERE id = " .
1648  $ilDB->quote($a_id, "integer");
1649  $style_set = $ilDB->manipulate($q);
1650  }
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 2956 of file class.ilObjStyleSheet.php.

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

2960  : void {
2961  $ilDB = $this->db;
2962 
2963  $ilDB->manipulate("UPDATE style_template SET " .
2964  "name = " . $ilDB->quote($a_name, "text") .
2965  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
2966 
2967  $ilDB->manipulate(
2968  "DELETE FROM style_template_class WHERE " .
2969  "template_id = " . $ilDB->quote($a_t_id, "integer")
2970  );
2971  foreach ($a_classes as $t => $c) {
2972  $ilDB->manipulate("INSERT INTO style_template_class " .
2973  "(template_id, class_type, class)" .
2974  " VALUES (" .
2975  $ilDB->quote($a_t_id, "integer") . "," .
2976  $ilDB->quote($t, "text") . "," .
2977  $ilDB->quote($c, "text") .
2978  ")");
2979  }
2980  }
$c
Definition: deliver.php:25
ilDBInterface $db

◆ writeCSSFile()

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

write css file to webspace directory

Definition at line 1320 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().

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

References ilObject\$db, and $ilDB.

3187  : void {
3188  $ilDB = $this->db;
3189 
3190  $ilDB->manipulate(
3191  "DELETE FROM style_setting WHERE " .
3192  " style_id = " . $ilDB->quote($this->getId(), "integer") .
3193  " AND name = " . $ilDB->quote($a_name, "text")
3194  );
3195 
3196  $ilDB->manipulate("INSERT INTO style_setting " .
3197  "(style_id, name, value) VALUES (" .
3198  $ilDB->quote($this->getId(), "integer") . "," .
3199  $ilDB->quote($a_name, "text") . "," .
3200  $ilDB->quote($a_value, "text") .
3201  ")");
3202  }
ilDBInterface $db

◆ writeStyleUsage()

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

Write style usage.

Definition at line 3224 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().

3227  : void {
3228  global $DIC;
3229 
3230  $ilDB = $DIC->database();
3231 
3232  $ilDB->replace(
3233  "style_usage",
3234  array(
3235  "obj_id" => array("integer", $a_obj_id)),
3236  array(
3237  "style_id" => array("integer", $a_style_id))
3238  );
3239  }
global $DIC
Definition: shib_login.php:22
+ 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 3111 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by addTemplate().

3114  : void {
3115  $ilDB = $this->db;
3116  $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3117  $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3118  $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3119  //echo "1-".strlen($a_preview_html)."-";
3120  //echo htmlentities($a_preview_html);
3121  if (strlen($a_preview_html) > 4000) {
3122  //echo "2";
3123  $a_preview_html = "";
3124  }
3125  $ilDB->manipulate("UPDATE style_template SET " .
3126  "preview = " . $ilDB->quote($a_preview_html, "text") .
3127  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3128  }
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 = "../vendor/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 = "./components/ILIAS/COPage/basic_style/images"
staticprotected

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

◆ $basic_style_zip

string ilObjStyleSheet::$basic_style_zip = "../vendor/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: