ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjStyleSheet Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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
 __construct (int $id=0, bool $reference=true)
 
 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 $desc)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

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

Data Fields

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

Static Public Attributes

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

Static Protected Member Functions

static hexdec (string $hex)
 

Protected Attributes

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
 
int $id
 
bool $referenced
 
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 = ""
 
bool $offline = false
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

Static Protected Attributes

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

Additional Inherited Members

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

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjStyleSheet

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

508  {
509  global $DIC;
510 
511  $this->db = $DIC->database();
512  $this->lng = $DIC->language();
513  $this->type = "sty";
514  $this->style = array();
515  $this->ilias = $DIC["ilias"];
516 
517  if ($a_call_by_reference) {
518  $this->ilias->raiseError("Can't instantiate style object via reference id.", $this->ilias->error_obj->FATAL);
519  }
520  parent::__construct($a_id, false);
521  $this->repo = $DIC->contentStyle()->internal()->repo();
522  }
global $DIC
Definition: feed.php:28
header include for all ilias files.
__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 2170 of file class.ilObjStyleSheet.php.

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

Referenced by _addMissingStyleClassesToStyle().

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

References _addMissingStyleClassesToAllStyles().

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

2161  : void {
2162  $styles = array(array("id" => $a_id));
2164  }
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 1102 of file class.ilObjStyleSheet.php.

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

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

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

◆ _determineTag()

static ilObjStyleSheet::_determineTag ( string  $a_type)
static

◆ _explodeRGB()

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

Explode an RGB string into an array.

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

Referenced by _getColorFlavor().

2595  : array {
2596  $r["r"] = (string) substr($a_rgb, 0, 2);
2597  $r["g"] = (string) substr($a_rgb, 2, 2);
2598  $r["b"] = (string) substr($a_rgb, 4, 2);
2599  if ($as_dec) {
2600  $r["r"] = self::hexdec($r["r"]);
2601  $r["g"] = self::hexdec($r["g"]);
2602  $r["b"] = self::hexdec($r["b"]);
2603  }
2604 
2605  return $r;
2606  }
+ Here is the caller graph for this function:

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

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

Referenced by _addMissingStyleClassesToAllStyles().

759  : DOMDocument
760  {
761  if (!is_object(self::$basic_style_dom)) {
762  self::$basic_style_dom = new DOMDocument();
763  self::$basic_style_dom->load(self::$basic_style_file);
764  }
765 
766  return self::$basic_style_dom;
767  }
+ 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 717 of file class.ilObjStyleSheet.php.

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

Referenced by ilObjStyleSheetGUI\getCloneForm().

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

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

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

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

2091  : array
2092  {
2093  $c_styles = array();
2094  foreach (self::$core_styles as $cstyle) {
2095  $c_styles[$cstyle["type"] . "." . ilObjStyleSheet::_determineTag($cstyle["type"]) . "." . $cstyle["class"]]
2096  = array("type" => $cstyle["type"],
2097  "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2098  "class" => $cstyle["class"]);
2099  }
2100  return $c_styles;
2101  }
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 2042 of file class.ilObjStyleSheet.php.

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

2042  : array
2043  {
2044  return self::$filtered_groups;
2045  }
+ Here is the caller graph for this function:

◆ _getImagesDirectory()

static ilObjStyleSheet::_getImagesDirectory ( int  $a_style_id)
static

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

References ilFileUtils\getWebspaceDir().

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

1151  : string
1152  {
1153  return ilFileUtils::getWebspaceDir() . "/sty/sty_" . $a_style_id .
1154  "/images";
1155  }
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 2128 of file class.ilObjStyleSheet.php.

2128  : array
2129  {
2130  return self::$pseudo_classes[$tag] ?? [];
2131  }

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

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

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

674  : array {
675  global $DIC;
676 
677  $ilDB = $DIC->database();
678  $ilSetting = $DIC->settings();
679  $tree = $DIC->repositoryTree();
680 
681  $default_style = $ilSetting->get("default_content_style_id");
682 
683  $and_str = "";
684  if (!$a_include_deactivated) {
685  $and_str = " AND active = 1";
686  }
687 
688  $q = "SELECT * FROM style_data " .
689  " WHERE standard = 1" . $and_str;
690  $res = $ilDB->query($q);
691  $styles = array();
692  while ($sty = $ilDB->fetchAssoc($res)) {
693  if (!$a_exclude_default_style || $default_style != $sty["id"]) {
694  // check scope
695  if ($a_scope > 0 && $sty["category"] > 0) {
696  if ($tree->isInTree((int) $sty["category"]) &&
697  $tree->isInTree($a_scope)) {
698  $path = $tree->getPathId($a_scope);
699  if (!in_array((int) $sty["category"], $path)) {
700  continue;
701  }
702  }
703  }
704  $styles[(int) $sty["id"]] = ilObject::_lookupTitle((int) $sty["id"]);
705  }
706  }
707 
708  return $styles;
709  }
$res
Definition: ltiservices.php:69
ilTree $tree
isInTree(?int $a_node_id)
get all information of a node.
$path
Definition: ltiservices.php:32
global $DIC
Definition: feed.php:28
static _lookupTitle(int $obj_id)
getPathId(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
global $ilSetting
Definition: privfeed.php:17
+ 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 2013 of file class.ilObjStyleSheet.php.

Referenced by ilStyleCharacteristicGUI\initTagStyleForm().

2013  : string
2014  {
2015  $input = self::$parameter[$par]["input"];
2016  return $input;
2017  }
+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

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

2049  : array {
2050  if ($a_no_percentage) {
2051  return self::$num_unit_no_perc;
2052  }
2053  return self::$num_unit;
2054  }
+ Here is the caller graph for this function:

◆ _getStyleParameters()

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

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

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

2027  : array {
2028  if ($a_tag == "") {
2029  return self::$parameter;
2030  }
2031  $par = array();
2032  foreach (self::$parameter as $k => $v) {
2033  if (isset(self::$filtered_groups[$v["group"]]) &&
2034  !in_array($a_tag, self::$filtered_groups[$v["group"]])) {
2035  continue;
2036  }
2037  $par[$k] = $v;
2038  }
2039  return $par;
2040  }
+ Here is the caller graph for this function:

◆ _getStyleParameterSubPar()

static ilObjStyleSheet::_getStyleParameterSubPar ( string  $par)
static

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

2019  : string
2020  {
2021  $subpar = self::$parameter[$par]["subpar"];
2022  return $subpar;
2023  }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues ( string  $par)
static

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

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

2058  : array {
2059  return self::$parameter[$par]["values"];
2060  }
+ Here is the caller graph for this function:

◆ _getStyleSuperTypeForType()

static ilObjStyleSheet::_getStyleSuperTypeForType ( string  $a_type)
static

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

Referenced by ilObjStyleSheetGUI\__construct().

2079  : string {
2080  foreach (self::$style_super_types as $s => $t) {
2081  if (in_array($a_type, $t)) {
2082  return $s;
2083  }
2084  if ($a_type == $s) {
2085  return $s;
2086  }
2087  }
2088  return "";
2089  }
+ 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 2118 of file class.ilObjStyleSheet.php.

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

2120  : array {
2121  if ($a_template_type == "") {
2122  return self::$templates;
2123  }
2124 
2125  return self::$templates[$a_template_type];
2126  }
+ 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 2662 of file class.ilObjStyleSheet.php.

Referenced by _getColorFlavor().

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

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable ( string  $a_type)
static

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

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

2067  : bool
2068  {
2069  return in_array($a_type, self::$expandable_types);
2070  }
+ Here is the caller graph for this function:

◆ _isHideable()

static ilObjStyleSheet::_isHideable ( string  $a_type)
static

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

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

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

◆ _lookupActive()

static ilObjStyleSheet::_lookupActive ( int  $a_id)
static

Lookup active flag.

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

References $DIC, $ilDB, and $res.

Referenced by ilContentStyleSettingsGUI\edit().

652  : bool
653  {
654  global $DIC;
655 
656  $ilDB = $DIC->database();
657 
658  $q = "SELECT * FROM style_data " .
659  " WHERE id = " . $ilDB->quote($a_id, "integer");
660  $res = $ilDB->query($q);
661  $sty = $ilDB->fetchAssoc($res);
662 
663  return (bool) $sty["active"];
664  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _lookupStandard()

static ilObjStyleSheet::_lookupStandard ( int  $a_id)
static

Lookup standard flag.

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

References $DIC, $ilDB, and $res.

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

623  : bool
624  {
625  global $DIC;
626 
627  $ilDB = $DIC->database();
628 
629  $q = "SELECT * FROM style_data " .
630  " WHERE id = " . $ilDB->quote($a_id, "integer");
631  $res = $ilDB->query($q);
632  $sty = $ilDB->fetchAssoc($res);
633 
634  return (bool) ($sty["standard"] ?? false);
635  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ 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 3143 of file class.ilObjStyleSheet.php.

References $DIC, and $ilDB.

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

3146  : ?int {
3147  global $DIC;
3148 
3149  $ilDB = $DIC->database();
3150 
3151  $set = $ilDB->query("SELECT id FROM style_template " .
3152  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer") .
3153  " AND name = " . $ilDB->quote($a_name, "text"));
3154  if ($rec = $ilDB->fetchAssoc($set)) {
3155  return (int) $rec["id"];
3156  }
3157 
3158  return null;
3159  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _lookupTemplateName()

static ilObjStyleSheet::_lookupTemplateName ( int  $a_t_id)
static

Lookup table template name for template ID.

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

References $DIC, and $ilDB.

Referenced by ilObjStyleSheetGUI\updateTemplateObject().

3040  : ?string
3041  {
3042  global $DIC;
3043 
3044  $ilDB = $DIC->database();
3045 
3046  $set = $ilDB->query("SELECT name FROM style_template WHERE " .
3047  " id = " . $ilDB->quote($a_t_id, "integer"));
3048 
3049  if ($rec = $ilDB->fetchAssoc($set)) {
3050  return $rec["name"];
3051  }
3052 
3053  return null;
3054  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _lookupUpToDate()

static ilObjStyleSheet::_lookupUpToDate ( int  $a_id)
static

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

References $DIC, $ilDB, and $res.

Referenced by getContentStylePath().

577  : bool
578  {
579  global $DIC;
580 
581  $ilDB = $DIC->database();
582 
583  $q = "SELECT uptodate FROM style_data " .
584  " WHERE id = " . $ilDB->quote($a_id, "integer");
585  $res = $ilDB->query($q);
586  $sty = $ilDB->fetchAssoc($res);
587 
588  return (bool) $sty["uptodate"];
589  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ 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 2620 of file class.ilObjStyleSheet.php.

References Vendor\Package\$b.

Referenced by _getColorFlavor().

2620  : array
2621  {
2622  $r = $a_rgb["r"] / 255;
2623  $g = $a_rgb["g"] / 255;
2624  $b = $a_rgb["b"] / 255;
2625  $h = 0;
2626 
2627  // max / min
2628  $max = max($r, $g, $b);
2629  $min = min($r, $g, $b);
2630 
2631  //lightness
2632  $l = ($max + $min) / 2;
2633 
2634  if ($max == $min) {
2635  $s = 0;
2636  } else {
2637  if ($l < 0.5) {
2638  $s = ($max - $min) / ($max + $min);
2639  } else {
2640  $s = ($max - $min) / (2.0 - $max - $min);
2641  }
2642 
2643  if ($r == $max) {
2644  $h = ($g - $b) / ($max - $min);
2645  } elseif ($g == $max) {
2646  $h = 2.0 + ($b - $r) / ($max - $min);
2647  } elseif ($b == $max) {
2648  $h = 4.0 + ($r - $g) / ($max - $min);
2649  }
2650  }
2651 
2652  $hls["h"] = round(($h / 6) * 255);
2653  $hls["l"] = round($l * 255);
2654  $hls["s"] = round($s * 255);
2655 
2656  return $hls;
2657  }
+ Here is the caller graph for this function:

◆ _writeActive()

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

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

References $DIC, and $ilDB.

Referenced by ilContentStyleSettingsGUI\saveActiveStyles().

637  : void
638  {
639  global $DIC;
640 
641  $ilDB = $DIC->database();
642 
643  $q = "UPDATE style_data SET active = " .
644  $ilDB->quote((int) $a_active, "integer") .
645  " WHERE id = " . $ilDB->quote($a_id, "integer");
646  $ilDB->manipulate($q);
647  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _writeScope()

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

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

References $DIC, and $ilDB.

Referenced by ilContentStyleSettingsGUI\saveScope().

608  : void
609  {
610  global $DIC;
611 
612  $ilDB = $DIC->database();
613 
614  $q = "UPDATE style_data SET category = " .
615  $ilDB->quote($a_scope, "integer") .
616  " WHERE id = " . $ilDB->quote($a_id, "integer");
617  $ilDB->manipulate($q);
618  }
global $DIC
Definition: feed.php:28
+ 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 594 of file class.ilObjStyleSheet.php.

References $DIC, and $ilDB.

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

597  : void {
598  global $DIC;
599 
600  $ilDB = $DIC->database();
601 
602  $q = "UPDATE style_data SET standard = " .
603  $ilDB->quote((int) $a_std, "integer") .
604  " WHERE id = " . $ilDB->quote($a_id, "integer");
605  $ilDB->manipulate($q);
606  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _writeUpToDate()

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

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

References $DIC, and $ilDB.

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

555  : void {
556  global $DIC;
557 
558  $ilDB = $DIC->database();
559 
560  $q = "UPDATE style_data SET uptodate = " .
561  $ilDB->quote((int) $a_up_to_date, "integer") .
562  " WHERE id = " . $ilDB->quote($a_id, "integer");
563  $ilDB->manipulate($q);
564  }
global $DIC
Definition: feed.php:28
+ 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 918 of file class.ilObjStyleSheet.php.

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

924  : void {
925  $ilDB = $this->db;
926 
927  // delete characteristic record
928  $ilDB->insert("style_char", [
929  "style_id" => ["integer", $this->getId()],
930  "type" => ["text", $a_type],
931  "characteristic" => ["text", $a_char],
932  "hide" => ["integer", (int) $a_hidden],
933  "outdated" => ["integer", (int) $outdated],
934  "order_nr" => ["integer", $order_nr]
935  ]);
936 
937  $this->setUpToDate(false);
938  $this->_writeUpToDate($this->getId(), false);
939  }
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 2749 of file class.ilObjStyleSheet.php.

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

Referenced by create().

2752  : int {
2753  $ilDB = $this->db;
2754 
2755  $id = $ilDB->nextId("sty_media_query");
2756  if ($order_nr == 0) {
2757  $order_nr = $this->getMaxMQueryOrderNr() + 10;
2758  }
2759 
2760  $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
2761  " VALUES (" .
2762  $ilDB->quote($id, "integer") . "," .
2763  $ilDB->quote($this->getId(), "integer") . "," .
2764  $ilDB->quote($a_mquery, "text") . "," .
2765  $ilDB->quote($order_nr, "integer") .
2766  ")");
2767 
2768  return $id;
2769  }
ilDBInterface $db
getMaxMQueryOrderNr()
Get maximum media query order nr.
+ 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 1059 of file class.ilObjStyleSheet.php.

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

1065  : void {
1066  $ilDB = $this->db;
1067 
1068  $avail_params = $this->getAvailableParameters();
1069  $tag = explode(".", $a_tag);
1070  $value = $avail_params[$a_par][0];
1071  $id = $ilDB->nextId("style_parameter");
1072  $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1073  "(" .
1074  $ilDB->quote($id, "integer") . "," .
1075  $ilDB->quote($this->getId(), "integer") . "," .
1076  $ilDB->quote($a_type, "text") . "," .
1077  $ilDB->quote($tag[0], "text") . "," .
1078  $ilDB->quote($tag[1], "text") . "," .
1079  $ilDB->quote($a_par, "text") . "," .
1080  $ilDB->quote($value, "text") . "," .
1081  $ilDB->quote($a_mq_id, "integer") . "," .
1082  $ilDB->quote($a_custom, "integer") .
1083  ")";
1084  $ilDB->manipulate($q);
1085  $this->read();
1086  $this->writeCSSFile();
1087  }
read()
read style properties
ilDBInterface $db
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
+ 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 2912 of file class.ilObjStyleSheet.php.

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

Referenced by create().

2916  : int {
2917  $ilDB = $this->db;
2918 
2919  $tid = $ilDB->nextId("style_template");
2920  $ilDB->manipulate("INSERT INTO style_template " .
2921  "(id, style_id, name, temp_type)" .
2922  " VALUES (" .
2923  $ilDB->quote($tid, "integer") . "," .
2924  $ilDB->quote($this->getId(), "integer") . "," .
2925  $ilDB->quote($a_name, "text") . "," .
2926  $ilDB->quote($a_type, "text") .
2927  ")");
2928 
2929  foreach ($a_classes as $t => $c) {
2930  $ilDB->manipulate("INSERT INTO style_template_class " .
2931  "(template_id, class_type, class)" .
2932  " VALUES (" .
2933  $ilDB->quote($tid, "integer") . "," .
2934  $ilDB->quote($t, "text") . "," .
2935  $ilDB->quote($c, "text") .
2936  ")");
2937  }
2938 
2939  $this->writeTemplatePreview(
2940  $tid,
2941  ilObjStyleSheetGUI::_getTemplatePreview($this, $a_type, $tid, true)
2942  );
2943 
2944  return $tid;
2945  }
$c
Definition: cli.php:38
static _getTemplatePreview(ilObjStyleSheet $a_style, string $a_type, int $a_t_id, bool $a_small_mode=false)
Get table template preview.
ilDBInterface $db
writeTemplatePreview(int $a_t_id, string $a_preview_html)
Write table template preview.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addTemplateClass()

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

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

References ilObject\$db, and $ilDB.

2980  : void {
2981  $ilDB = $this->db;
2982 
2983  $ilDB->manipulate("INSERT INTO style_template_class " .
2984  "(template_id, class_type, class)" .
2985  " VALUES (" .
2986  $ilDB->quote($a_t_id, "integer") . "," .
2987  $ilDB->quote($a_type, "text") . "," .
2988  $ilDB->quote($a_class, "text") .
2989  ")");
2990  }
ilDBInterface $db

◆ characteristicExists()

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

Check whether characteristic exists.

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

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

904  : bool {
905  $ilDB = $this->db;
906 
907  $set = $ilDB->queryF(
908  "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
909  array("integer", "text", "text"),
910  array($this->getId(), $a_char, $a_style_type)
911  );
912  if ($ilDB->fetchAssoc($set)) {
913  return true;
914  }
915  return false;
916  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ cleanExportDirectory()

ilObjStyleSheet::cleanExportDirectory ( )

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

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

Referenced by export().

1734  : void
1735  {
1736  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1737  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1738  // create export subdirectory
1739  $ex_dir = $style_dir . "/export";
1740 
1741  if (is_dir($ex_dir)) {
1742  ilFileUtils::delDir($ex_dir, true);
1743  }
1744  }
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 1045 of file class.ilObjStyleSheet.php.

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

1045  : void
1046  {
1047  ilFileUtils::rCopy($this->getImagesDirectory(), $a_target);
1048  }
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 778 of file class.ilObjStyleSheet.php.

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

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

◆ createExportDirectory()

ilObjStyleSheet::createExportDirectory ( )

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

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

Referenced by createExportSubDirectory(), and export().

1707  : string
1708  {
1709  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1710  ilFileUtils::makeDir($sty_data_dir);
1711  if (!is_writable($sty_data_dir)) {
1712  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
1713  . ") not writeable.", $this->ilias->error_obj->FATAL);
1714  }
1715 
1716  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1717  ilFileUtils::makeDir($style_dir);
1718  if (!is_dir($style_dir)) {
1719  $this->ilias->raiseError("Creation of style directory failed (" .
1720  $style_dir . ").", $this->ilias->error_obj->FATAL);
1721  }
1722 
1723  // create export subdirectory
1724  $ex_dir = $style_dir . "/export";
1725  ilFileUtils::makeDir($ex_dir);
1726  if (!is_dir($ex_dir)) {
1727  $this->ilias->raiseError("Creation of Import Directory failed (" .
1728  $ex_dir . ").", $this->ilias->error_obj->FATAL);
1729  }
1730 
1731  return $ex_dir;
1732  }
header include for all ilias files.
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExportSubDirectory()

ilObjStyleSheet::createExportSubDirectory ( )

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

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

Referenced by export().

1747  {
1748  $ex_dir = $this->createExportDirectory();
1749  $ex_sub_dir = $ex_dir . "/" . $this->getExportSubDir();
1750  ilFileUtils::makeDir($ex_sub_dir);
1751  if (!is_writable($ex_sub_dir)) {
1752  $this->ilias->raiseError("Style data directory (" . $ex_sub_dir
1753  . ") not writeable.", $this->ilias->error_obj->FATAL);
1754  }
1755  $ex_sub_images_dir = $ex_sub_dir . "/images";
1756  ilFileUtils::makeDir($ex_sub_images_dir);
1757  if (!is_writable($ex_sub_images_dir)) {
1758  $this->ilias->raiseError("Style data directory (" . $ex_sub_images_dir
1759  . ") not writeable.", $this->ilias->error_obj->FATAL);
1760  }
1761  }
header include for all ilias files.
getExportSubDir()
The local directory, that will be included within the zip file.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createFromXMLFile()

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

create style from xml file todo: add mq_id and custom

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

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

Referenced by create(), and import().

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

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

Referenced by create(), and import().

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

◆ createImportDirectory()

ilObjStyleSheet::createImportDirectory ( )

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

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

Referenced by import().

1834  : string
1835  {
1836  $sty_data_dir = ilFileUtils::getDataDir() . "/sty";
1837  ilFileUtils::makeDir($sty_data_dir);
1838  if (!is_writable($sty_data_dir)) {
1839  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
1840  . ") not writeable.", $this->ilias->error_obj->FATAL);
1841  }
1842 
1843  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
1844  ilFileUtils::makeDir($style_dir);
1845  if (!is_dir($style_dir)) {
1846  $this->ilias->raiseError("Creation of style directory failed (" .
1847  $style_dir . ").", $this->ilias->error_obj->FATAL);
1848  }
1849 
1850  // create import subdirectory
1851  $im_dir = $style_dir . "/import";
1852  ilFileUtils::makeDir($im_dir);
1853  if (!is_dir($im_dir)) {
1854  $this->ilias->raiseError("Creation of Import Directory failed (" .
1855  $im_dir . ").", $this->ilias->error_obj->FATAL);
1856  }
1857 
1858  return $im_dir;
1859  }
header include for all ilias files.
static getDataDir()
get data directory (outside webspace)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilObjStyleSheet::delete ( )

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

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

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

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

1188  : void {
1189  $ilDB = $this->db;
1190 
1191  $q = "DELETE FROM style_parameter WHERE " .
1192  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1193  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1194  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1195  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1196  " custom = " . $ilDB->quote(1, "integer") . " AND " .
1197  " " . $ilDB->equals("type", $a_type, "text", true);
1198 
1199  $ilDB->manipulate($q);
1200  }
ilDBInterface $db
+ 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 2823 of file class.ilObjStyleSheet.php.

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

2825  : void {
2826  $ilDB = $this->db;
2827 
2828  $ilDB->manipulate(
2829  "DELETE FROM sty_media_query WHERE " .
2830  " style_id = " . $ilDB->quote($this->getId(), "integer") .
2831  " AND id = " . $ilDB->quote($a_id, "integer")
2832  );
2833  $this->saveMediaQueryOrder();
2834  }
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 1166 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

1166  : void
1167  {
1168  $ilDB = $this->db;
1169 
1170  $q = "DELETE FROM style_parameter WHERE id = " .
1171  $ilDB->quote($a_id, "integer");
1172  $ilDB->query($q);
1173  }
ilDBInterface $db

◆ deleteStyleParOfChar()

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

Delete style parameters of characteristic.

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

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

1208  : void {
1209  $ilDB = $this->db;
1210 
1211  $q = "DELETE FROM style_parameter WHERE " .
1212  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1213  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1214  " " . $ilDB->equals("type", $a_type, "text", true);
1215 
1216  $ilDB->manipulate($q);
1217  }
ilDBInterface $db
+ Here is the call graph for this function:

◆ determineTemplateStyleClassType()

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

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

2137  : string {
2138  return self::$templates[$t][$k];
2139  }

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

References ilObject\$db, and $ilDB.

Referenced by do_3_10_Migration().

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

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

Referenced by createFromXMLFile().

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

References ilObject\$db, and $ilDB.

Referenced by do_3_10_Migration().

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

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

1789  : string
1790  {
1791  $this->cleanExportDirectory();
1792  $ex_dir = $this->createExportDirectory();
1793  $this->createExportSubDirectory();
1794  $this->exportXML($ex_dir . "/" . $this->getExportSubDir());
1795  //echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
1797  $this->getImagesDirectory(),
1798  $ex_dir . "/" . $this->getExportSubDir() . "/images"
1799  );
1800  if (is_file($ex_dir . "/" . $this->getExportSubDir() . ".zip")) {
1801  unlink($ex_dir . "/" . $this->getExportSubDir() . ".zip");
1802  }
1804  $ex_dir . "/" . $this->getExportSubDir(),
1805  $ex_dir . "/" . $this->getExportSubDir() . ".zip"
1806  );
1807 
1808  return $ex_dir . "/" . $this->getExportSubDir() . ".zip";
1809  }
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)
zips given directory/file into given zip.file
+ Here is the call graph for this function:

◆ exportXML()

ilObjStyleSheet::exportXML ( string  $a_dir)

export style xml file to directory

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

References getXML().

Referenced by export().

1814  : void
1815  {
1816  $file = $a_dir . "/style.xml";
1817 
1818  // open file
1819  if (!($fp = fopen($file, 'wb'))) {
1820  die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
1821  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
1822  }
1823 
1824  // set file permissions
1825  chmod($file, 0770);
1826 
1827  // write xml data into the file
1828  fwrite($fp, $this->getXML());
1829 
1830  // close file
1831  fclose($fp);
1832  }
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 2146 of file class.ilObjStyleSheet.php.

Referenced by addParameter().

2146  : array
2147  {
2148  $pars = array();
2149  foreach (self::$parameter as $p => $v) {
2150  $pars[$p] = $v["values"];
2151  }
2152 
2153  return $pars;
2154  }
+ Here is the caller graph for this function:

◆ getBasicImageDir()

static ilObjStyleSheet::getBasicImageDir ( )
static

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

Referenced by ilCOPageHTMLExport\exportStyles().

769  : string
770  {
771  return self::$basic_style_image_dir;
772  }
+ Here is the caller graph for this function:

◆ getBasicZipPath()

static ilObjStyleSheet::getBasicZipPath ( )
static

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

Referenced by ilObjStyleSheetGUI\saveObject().

524  : string
525  {
526  return self::$basic_style_zip;
527  }
+ 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 944 of file class.ilObjStyleSheet.php.

References $c, and $chars.

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

948  : array {
949  $chars = array();
950 
951  if ($a_type == "") {
953  }
954  if (isset($this->chars_by_type[$a_type])) {
955  foreach ($this->chars_by_type[$a_type] as $c) {
956  if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
957  $chars[] = $c;
958  }
959  }
960  }
961 
962  if ($a_no_hidden) {
963  foreach ($chars as $k => $char) {
964  if ($a_type == "" && $this->hidden_chars[$char["type"] . ":" . $char["class"]]) {
965  unset($chars[$k]);
966  } elseif ($this->hidden_chars[$a_type . ":" . $char] ?? false) {
967  unset($chars[$k]);
968  }
969  }
970  }
971 
972  return $chars;
973  }
$c
Definition: cli.php:38
+ Here is the caller graph for this function:

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName ( string  $a_name)

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

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

Referenced by writeCSSFile().

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

References ilObject\$db, and $ilDB.

Referenced by getXML().

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

◆ getContentPrintStyle()

static ilObjStyleSheet::getContentPrintStyle ( )
static

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

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

1593  : string
1594  {
1595  return "./Services/COPage/css/print_content.css";
1596  }
+ 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 1548 of file class.ilObjStyleSheet.php.

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

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

1552  : string {
1553  global $DIC;
1554 
1555  $ilSetting = $DIC->settings();
1556 
1557  $random = new \ilRandom();
1558  $rand = $random->int(1, 999999);
1559 
1560 
1561  // check global fixed content style
1562  $fixed_style = $ilSetting->get("fixed_content_style_id");
1563  if ($fixed_style > 0) {
1564  $a_style_id = (int) $fixed_style;
1565  }
1566 
1567  // check global default style
1568  if ($a_style_id <= 0) {
1569  $a_style_id = (int) $ilSetting->get("default_content_style_id");
1570  }
1571 
1572  if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
1573  // check whether file is up to date
1574  if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
1575  $style = new ilObjStyleSheet($a_style_id);
1576  $style->writeCSSFile();
1577  }
1578 
1579  $path = ilFileUtils::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css";
1580  if ($add_random) {
1581  $path .= "?dummy=$rand";
1582  }
1583  if ($add_token) {
1585  }
1586 
1587  return $path;
1588  } else { // todo: work this out
1589  return "./Services/COPage/css/content.css";
1590  }
1591  }
static getWebspaceDir(string $mode="filesystem")
get webspace directory
$path
Definition: ltiservices.php:32
global $DIC
Definition: feed.php:28
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupUpToDate(int $a_id)
global $ilSetting
Definition: privfeed.php:17
static signFile(string $path_to_file)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEffectiveContentStyleId()

static ilObjStyleSheet::getEffectiveContentStyleId ( int  $a_style_id)
static

Get effective Style Id.

Parameters
intstyle id that may be set in object
stringobject type

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

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

1510  : int {
1511  global $DIC;
1512 
1513  $ilSetting = $DIC->settings();
1514 
1515  // check global fixed content style
1516  $fixed_style = $ilSetting->get("fixed_content_style_id");
1517  if ($fixed_style > 0) {
1518  $a_style_id = (int) $fixed_style;
1519  }
1520 
1521  // check global default style
1522  if ($a_style_id <= 0) {
1523  $a_style_id = (int) $ilSetting->get("default_content_style_id");
1524  }
1525 
1526  if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) === "sty") {
1527  return $a_style_id;
1528  }
1529 
1530  return 0;
1531  }
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:17
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ getExportSubDir()

ilObjStyleSheet::getExportSubDir ( )

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

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

References $export_sub_dir, and ilObject\getId().

Referenced by createExportSubDirectory(), and export().

1774  : string
1775  {
1776  if ($this->export_sub_dir == "") {
1777  return "sty_" . $this->getId();
1778  } else {
1779  return $this->export_sub_dir;
1780  }
1781  }
+ 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 1002 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

1005  : bool {
1006  $ilDB = $this->db;
1007 
1008  $set = $ilDB->query(
1009  "SELECT hide FROM style_char " .
1010  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1011  " type = " . $ilDB->quote($a_type, "text") . " AND " .
1012  " characteristic = " . $ilDB->quote($a_char, "text")
1013  );
1014  $rec = $ilDB->fetchAssoc($set);
1015 
1016  return (bool) ($rec["hide"] ?? false);
1017  }
ilDBInterface $db

◆ getImagesDirectory()

ilObjStyleSheet::getImagesDirectory ( )

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

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

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

1146  : string
1147  {
1149  }
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 2774 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by addMediaQuery().

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

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

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

References ilObject\$db, and $ilDB.

Referenced by saveMediaQueryOrder(), and writeCSSFile().

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

References ilObject\$db, and $ilDB.

2808  : array {
2809  $ilDB = $this->db;
2810 
2811  $set = $ilDB->query(
2812  "SELECT * FROM sty_media_query " .
2813  " WHERE id = " . $ilDB->quote($a_id, "integer")
2814  );
2815  return $ilDB->fetchAssoc($set);
2816  }
ilDBInterface $db

◆ getParametersOfClass()

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

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

1537  : array {
1538  if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1539  return $this->style_class[$a_type][$a_class][$a_mq_id];
1540  }
1541  return array();
1542  }

◆ getPlaceHolderStylePath()

static ilObjStyleSheet::getPlaceHolderStylePath ( )
static

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

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

1603  : string
1604  {
1605  return "./Services/COPage/css/placeholder.css";
1606  }
+ Here is the caller graph for this function:

◆ getScope()

ilObjStyleSheet::getScope ( )

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

References $scope.

Referenced by create(), and update().

547  : int
548  {
549  return $this->scope;
550  }
+ Here is the caller graph for this function:

◆ getStyle()

ilObjStyleSheet::getStyle ( )

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

References $style.

Referenced by writeCSSFile().

1639  : array
1640  {
1641  return $this->style;
1642  }
+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

References $parameter.

2003  : array
2004  {
2005  $groups = array();
2006 
2007  foreach (self::$parameter as $parameter => $props) {
2008  $groups[$props["group"]][] = $parameter;
2009  }
2010  return $groups;
2011  }

◆ getSyntaxStylePath()

static ilObjStyleSheet::getSyntaxStylePath ( )
static

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

Referenced by ilDclDetailedViewDefinitionGUI\__construct(), ilImprintGUI\__construct(), ilPageLayoutGUI\__construct(), ilWikiPageGUI\__construct(), ilPortfolioPageGUI\__construct(), ilBlogPostingGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilAssQuestionPreviewGUI\__construct(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilObjGlossaryGUI\confirmDefinitionDeletion(), assOrderingQuestionGUI\editNesting(), ilTermDefinitionEditorGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilCOPageHTMLExport\exportStyles(), ilAssQuestionPageCommandForwarder\forward(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilCOPageHTMLExport\getPreparedMainTemplate(), ilObjQuestionPoolGUI\getQueryParamInt(), ilObjForumGUI\getSafePostCommands(), ilCOPageHTMLExport\initResourceTemplate(), ilAssQuestionPreviewGUI\initStyleSheets(), ilObjContentPageGUI\initStyleSheets(), ilObjForumGUI\initStyleSheets(), ilGlossaryTermGUI\listDefinitions(), 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().

1598  : string
1599  {
1600  return "./Services/COPage/css/syntaxhighlight.css";
1601  }
+ Here is the caller graph for this function:

◆ getTemplate()

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

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

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

Referenced by ilObjStyleSheetGUI\_getTemplatePreview().

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

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

Referenced by getTemplate(), and getTemplates().

2894  : array {
2895  $ilDB = $this->db;
2896  $set = $ilDB->query("SELECT * FROM style_template_class WHERE " .
2897  "template_id = " . $ilDB->quote($a_tid, "integer"));
2898 
2899  $class = array();
2900  while ($rec = $ilDB->fetchAssoc($set)) {
2901  $key = $rec["class_type"];
2902  $class[$key] = $rec["class"];
2903  }
2904 
2905  return $class;
2906  }
ilDBInterface $db
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the caller graph for this function:

◆ getTemplates()

ilObjStyleSheet::getTemplates ( string  $a_type)

Get table templates of style.

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

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

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

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

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

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

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

References getImagesDirectory().

1157  : string
1158  {
1159  return $this->getImagesDirectory() .
1160  "/thumbnails";
1161  }
+ Here is the call graph for this function:

◆ getUpToDate()

ilObjStyleSheet::getUpToDate ( )

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

References $up_to_date.

537  : bool
538  {
539  return $this->up_to_date;
540  }

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

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

Referenced by exportXML().

1658  : string
1659  {
1660  $xml = "<StyleSheet>\n";
1661 
1662  // title and description
1663  $xml .= "<Title>" . $this->handleXmlString($this->getTitle()) . "</Title>";
1664  $xml .= "<Description>" . $this->handleXmlString($this->getDescription()) . "</Description>\n";
1665 
1666  // style classes
1667  foreach ($this->chars as $char) {
1668  $xml .= "<Style Tag=\"" . ilObjStyleSheet::_determineTag($char["type"]) .
1669  "\" Type=\"" . $char["type"] . "\" Class=\"" . $char["class"] . "\">\n";
1670  foreach ($this->style as $style) {
1671  if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"]) {
1672  foreach ($style as $tag) {
1673  $xml .= "<StyleParameter Name=\"" . $tag["parameter"] . "\" Value=\"" . $tag["value"] . "\" Custom=\"" . $tag["custom"] . "\" />\n";
1674  }
1675  }
1676  }
1677  $xml .= "</Style>\n";
1678  }
1679 
1680  // colors
1681  foreach ($this->getColors() as $color) {
1682  $xml .= "<StyleColor Name=\"" . $color["name"] . "\" Code=\"" . $color["code"] . "\"/>\n";
1683  }
1684 
1685  // templates
1687  foreach ($tcts as $tct => $v) {
1688  $ts = $this->getTemplates($tct);
1689 
1690  foreach ($ts as $t) {
1691  $xml .= "<StyleTemplate Type=\"" . $tct . "\" Name=\"" . $t["name"] . "\">\n";
1692  foreach ($t["classes"] as $ct => $c) {
1693  if ($c != "") {
1694  $xml .= "<StyleTemplateClass ClassType=\"" . $ct . "\" Class=\"" . $c . "\"/>\n";
1695  }
1696  }
1697  $xml .= "</StyleTemplate>\n";
1698  }
1699  }
1700 
1701 
1702  $xml .= "</StyleSheet>";
1703  //echo "<pre>".htmlentities($xml)."</pre>"; exit;
1704  return $xml;
1705  }
$c
Definition: cli.php:38
getColors()
Get colors of style.
handleXmlString(string $a_str)
getTemplates(string $a_type)
Get table templates of style.
$xml
Definition: metadata.php:351
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 1649 of file class.ilObjStyleSheet.php.

Referenced by getXML().

1649  : string
1650  {
1651  return str_replace("&", "&amp;", $a_str);
1652  }
+ Here is the caller graph for this function:

◆ hexdec()

static ilObjStyleSheet::hexdec ( string  $hex)
staticprotected

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

2608  : int
2609  {
2610  $hex = preg_replace("/[^a-fA-F0-9]+/", "", $hex);
2611  if ($hex === "") {
2612  $hex = "0";
2613  }
2614  return (int) hexdec($hex);
2615  }
static hexdec(string $hex)

◆ ilClone()

ilObjStyleSheet::ilClone ( )

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

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

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

1022  : int
1023  {
1024  $lng = $this->lng;
1025 
1026  $lng->loadLanguageModule("style");
1027 
1028  $new_obj = new ilObjStyleSheet();
1029  $new_obj->setTitle($this->getTitle() . " (" . $lng->txt("sty_acopy") . ")");
1030  $new_obj->setType($this->getType());
1031  $new_obj->setDescription($this->getDescription());
1032  $new_obj->create($this->getId());
1033 
1034  $new_obj->writeStyleSetting(
1035  "disable_auto_margins",
1036  $this->lookupStyleSetting("disable_auto_margins")
1037  );
1038 
1039  return $new_obj->getId();
1040  }
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 1868 of file class.ilObjStyleSheet.php.

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

1868  : void
1869  {
1870  parent::create();
1871 
1872  $subdir = "";
1873  $im_dir = $this->createImportDirectory();
1874 
1875  // handle uploaded files
1876  if (is_array($a_file)) {
1878  $a_file["tmp_name"],
1879  $a_file["name"],
1880  $im_dir . "/" . $a_file["name"]
1881  );
1882  $file_name = $a_file["name"];
1883  } else { // handle not directly uploaded files
1884  $pi = pathinfo($a_file);
1885  $file_name = $pi["basename"];
1886  copy($a_file, $im_dir . "/" . $file_name);
1887  }
1888  $file = pathinfo($file_name);
1889 
1890  // unzip file
1891  if (strtolower($file["extension"]) == "zip") {
1892  ilFileUtils::unzip($im_dir . "/" . $file_name);
1893  $subdir = basename($file["basename"], "." . $file["extension"]);
1894  if (!is_dir($im_dir . "/" . $subdir)) {
1895  $subdir = "style"; // check style subdir
1896  }
1897  $xml_file = $im_dir . "/" . $subdir . "/style.xml";
1898  } else { // handle xml file directly (old style)
1899  $xml_file = $im_dir . "/" . $file_name;
1900  }
1901 
1902  // load information from xml file
1903  //echo "-$xml_file-";
1904  $this->createFromXMLFile($xml_file, true);
1905 
1906  // copy images
1907  $this->createImagesDirectory();
1908  if (is_dir($im_dir . "/" . $subdir . "/images")) {
1910  $im_dir . "/" . $subdir . "/images",
1911  $this->getImagesDirectory()
1912  );
1913  }
1914 
1916  $this->read();
1917  $this->writeCSSFile();
1918  }
read()
read style properties
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
static _addMissingStyleClassesToStyle(int $a_id)
Add missing style classes to all styles.
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
createFromXMLFile(string $a_file, bool $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
+ Here is the call graph for this function:

◆ isCoreStyle()

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

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

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

2106  : bool {
2107  foreach (self::$core_styles as $s) {
2108  if ($s["type"] == $a_type && $s["class"] == $a_class) {
2109  return true;
2110  }
2111  }
2112  return false;
2113  }
+ 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 3265 of file class.ilObjStyleSheet.php.

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

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

◆ lookupObjectStyle()

static ilObjStyleSheet::lookupObjectStyle ( int  $a_obj_id)
static

Lookup object style.

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

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

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

3240  : int {
3241  global $DIC;
3242 
3243  $ilDB = $DIC->database();
3244 
3245  $set = $ilDB->query(
3246  "SELECT style_id FROM style_usage " .
3247  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
3248  );
3249  $rec = $ilDB->fetchAssoc($set);
3250  if (!is_array($rec)) {
3251  return 0;
3252  }
3253 
3254  if (ilObject::_lookupType((int) $rec["style_id"]) == "sty") {
3255  return (int) $rec["style_id"];
3256  }
3257 
3258  return 0;
3259  }
global $DIC
Definition: feed.php:28
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupStyleSetting()

ilObjStyleSheet::lookupStyleSetting ( string  $a_name)

Lookup style setting.

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

References ilObject\$db, and $ilDB.

Referenced by ilClone().

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

Referenced by ilObjStyleSheetGUI\_getTemplatePreview().

3032  : string
3033  {
3034  return self::_lookupTemplateName($a_t_id);
3035  }
+ Here is the caller graph for this function:

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview ( int  $a_t_id)

Lookup table template preview.

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

References ilObject\$db, and $ilDB.

3127  : string
3128  {
3129  $ilDB = $this->db;
3130 
3131  $set = $ilDB->query("SELECT preview FROM style_template " .
3132  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3133  if ($rec = $ilDB->fetchAssoc($set)) {
3134  return $rec["preview"] ?? "";
3135  }
3136 
3137  return "";
3138  }
ilDBInterface $db

◆ read()

ilObjStyleSheet::read ( )

read style properties

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

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

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

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

◆ removeColor()

ilObjStyleSheet::removeColor ( string  $a_name)

Remove a color.

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

References ilObject\$db, and $ilDB.

2527  : void
2528  {
2529  $ilDB = $this->db;
2530 
2531  $ilDB->manipulate("DELETE FROM style_color WHERE " .
2532  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2533  " color_name = " . $ilDB->quote($a_name, "text"));
2534  }
ilDBInterface $db

◆ removeTemplate()

ilObjStyleSheet::removeTemplate ( int  $a_t_id)

Remove table template.

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

References ilObject\$db, and $ilDB.

3164  : void
3165  {
3166  $ilDB = $this->db;
3167 
3168  $ilDB->manipulate("DELETE FROM style_template WHERE " .
3169  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3170  " id = " . $ilDB->quote($a_t_id, "integer"));
3171 
3172  $ilDB->manipulate(
3173  "DELETE FROM style_template_class WHERE " .
3174  "template_id = " . $ilDB->quote($a_t_id, "integer")
3175  );
3176  }
ilDBInterface $db

◆ saveHideStatus()

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

Save characteristic hidden status.

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

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

987  : void {
988  $ilDB = $this->db;
989 
990  $ilDB->manipulate(
991  "UPDATE style_char SET " .
992  " hide = " . $ilDB->quote((int) $a_hide, "integer") .
993  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
994  " type = " . $ilDB->quote($a_type, "text") . " AND " .
995  " characteristic = " . $ilDB->quote($a_char, "text")
996  );
997  }
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 2839 of file class.ilObjStyleSheet.php.

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

Referenced by deleteMediaQuery().

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

975  : void
976  {
977  $this->chars = $a_chars;
978  }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir ( string  $a_dir)

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

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

1766  : void
1767  {
1768  $this->export_sub_dir = $a_dir;
1769  }

◆ setScope()

ilObjStyleSheet::setScope ( int  $a_scope)

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

Referenced by read().

542  : void
543  {
544  $this->scope = $a_scope;
545  }
+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle ( array  $a_style)

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

1644  : void
1645  {
1646  $this->style = $a_style;
1647  }

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

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

532  : void
533  {
534  $this->up_to_date = $a_up_to_date;
535  }
+ Here is the caller graph for this function:

◆ templateExists()

ilObjStyleSheet::templateExists ( string  $a_template_name)

Check whether template exists.

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

References ilObject\$db, and $ilDB.

2997  : bool {
2998  $ilDB = $this->db;
2999 
3000  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3001  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3002  "name = " . $ilDB->quote($a_template_name, "text"));
3003  if ($ilDB->fetchAssoc($set)) {
3004  return true;
3005  }
3006  return false;
3007  }
ilDBInterface $db

◆ update()

ilObjStyleSheet::update ( )

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

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

Referenced by createFromXMLFile().

1608  : bool
1609  {
1610  $ilDB = $this->db;
1611 
1612  parent::update();
1613  $this->read(); // this could be done better
1614  $this->writeCSSFile();
1615 
1616  $q = "UPDATE style_data " .
1617  "SET category = " . $ilDB->quote($this->getScope(), "integer") .
1618  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
1619  $ilDB->manipulate($q);
1620 
1621  return true;
1622  }
read()
read style properties
ilDBInterface $db
writeCSSFile(string $a_target_file="", string $a_image_dir="")
write css file to webspace directory
+ 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 2787 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

2790  : void {
2791  $ilDB = $this->db;
2792 
2793  $ilDB->manipulate(
2794  "UPDATE sty_media_query SET " .
2795  " mquery = " . $ilDB->quote($a_mquery, "text") .
2796  " WHERE id = " . $ilDB->quote($a_id, "integer")
2797  );
2798  }
ilDBInterface $db

◆ updateStyleParameter()

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

update style parameter per id

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

References ilObject\$db, and $ilDB.

1630  : void {
1631  $ilDB = $this->db;
1632 
1633  $q = "UPDATE style_parameter SET VALUE = " .
1634  $ilDB->quote($a_value, "text") . " WHERE id = " .
1635  $ilDB->quote($a_id, "integer");
1636  $style_set = $ilDB->manipulate($q);
1637  }
ilDBInterface $db

◆ updateTemplate()

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

Update table template.

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

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

2954  : void {
2955  $ilDB = $this->db;
2956 
2957  $ilDB->manipulate("UPDATE style_template SET " .
2958  "name = " . $ilDB->quote($a_name, "text") .
2959  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
2960 
2961  $ilDB->manipulate(
2962  "DELETE FROM style_template_class WHERE " .
2963  "template_id = " . $ilDB->quote($a_t_id, "integer")
2964  );
2965  foreach ($a_classes as $t => $c) {
2966  $ilDB->manipulate("INSERT INTO style_template_class " .
2967  "(template_id, class_type, class)" .
2968  " VALUES (" .
2969  $ilDB->quote($a_t_id, "integer") . "," .
2970  $ilDB->quote($t, "text") . "," .
2971  $ilDB->quote($c, "text") .
2972  ")");
2973  }
2974  }
$c
Definition: cli.php:38
ilDBInterface $db

◆ writeCSSFile()

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

write css file to webspace directory

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

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

References $DIC, and $ilDB.

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

567  {
568  global $DIC;
569  $ilDB = $DIC->database();
570 
571  $q = "UPDATE style_data SET owner_obj = " .
572  $ilDB->quote((int) $obj_id, "integer") .
573  " WHERE id = " . $ilDB->quote($style_id, "integer");
574  $ilDB->manipulate($q);
575  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ writeStyleSetting()

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

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

References ilObject\$db, and $ilDB.

3181  : void {
3182  $ilDB = $this->db;
3183 
3184  $ilDB->manipulate(
3185  "DELETE FROM style_setting WHERE " .
3186  " style_id = " . $ilDB->quote($this->getId(), "integer") .
3187  " AND name = " . $ilDB->quote($a_name, "text")
3188  );
3189 
3190  $ilDB->manipulate("INSERT INTO style_setting " .
3191  "(style_id, name, value) VALUES (" .
3192  $ilDB->quote($this->getId(), "integer") . "," .
3193  $ilDB->quote($a_name, "text") . "," .
3194  $ilDB->quote($a_value, "text") .
3195  ")");
3196  }
ilDBInterface $db

◆ writeStyleUsage()

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

Write style usage.

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

References $DIC, and $ilDB.

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

3221  : void {
3222  global $DIC;
3223 
3224  $ilDB = $DIC->database();
3225 
3226  $ilDB->replace(
3227  "style_usage",
3228  array(
3229  "obj_id" => array("integer", $a_obj_id)),
3230  array(
3231  "style_id" => array("integer", $a_style_id))
3232  );
3233  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ writeTemplatePreview()

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

Write table template preview.

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

References ilObject\$db, and $ilDB.

Referenced by addTemplate().

3108  : void {
3109  $ilDB = $this->db;
3110  $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3111  $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3112  $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3113  //echo "1-".strlen($a_preview_html)."-";
3114  //echo htmlentities($a_preview_html);
3115  if (strlen($a_preview_html) > 4000) {
3116  //echo "2";
3117  $a_preview_html = "";
3118  }
3119  $ilDB->manipulate("UPDATE style_template SET " .
3120  "preview = " . $ilDB->quote($a_preview_html, "text") .
3121  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3122  }
ilDBInterface $db
+ Here is the caller graph for this function:

Field Documentation

◆ $assigned_tags

array ilObjStyleSheet::$assigned_tags
static

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

◆ $basic_style_dom

DOMDocument ilObjStyleSheet::$basic_style_dom = null
staticprotected

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

◆ $basic_style_file

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

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

◆ $basic_style_image_dir

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

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

◆ $basic_style_zip

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

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

◆ $chars

array ilObjStyleSheet::$chars = []
protected

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

Referenced by getCharacteristics().

◆ $chars_by_type

array ilObjStyleSheet::$chars_by_type = []
protected

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

◆ $core_styles

array ilObjStyleSheet::$core_styles
static

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

◆ $end_styles

array ilObjStyleSheet::$end_styles = []
protected

Definition at line 32 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",
"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 288 of file class.ilObjStyleSheet.php.

◆ $export_sub_dir

string ilObjStyleSheet::$export_sub_dir = ""
protected

Definition at line 30 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"))

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

◆ $hidden_chars

array ilObjStyleSheet::$hidden_chars = []
protected

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

◆ $hideable_types

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

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

◆ $is_3_10_skin

bool ilObjStyleSheet::$is_3_10_skin = false
protected

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

◆ $num_unit

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

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

◆ $num_unit_no_perc

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

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

◆ $parameter

array ilObjStyleSheet::$parameter
static

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

Referenced by getStyleParameterGroups().

◆ $pseudo_classes

array ilObjStyleSheet::$pseudo_classes
static
Initial value:
=
array("a" => array("hover"), "div" => array("hover"), "img" => array("hover"))

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

◆ $repo

ILIAS Style Content InternalRepoService ilObjStyleSheet::$repo
protected

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

◆ $scope

int ilObjStyleSheet::$scope = 0
protected

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

Referenced by getScope().

◆ $style

array ilObjStyleSheet::$style = []

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

Referenced by getStyle().

◆ $style_class

array ilObjStyleSheet::$style_class = []
protected

Definition at line 37 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"),
"section" => array("section"),
"link" => array("link"),
"table" => array("table", "table_cell", "table_caption"),
"list" => array("list_o", "list_u", "list_item"),
"flist" => array("flist_cont", "flist_head", "flist", "flist_li", "flist_a"),
"media" => array("media_cont", "media_caption", "iim", "marker"),
"tabs" => array("va_cntr", "va_icntr", "va_ihead", "va_iheada", "va_ihcap", "va_icont",
"ha_cntr", "ha_icntr", "ha_ihead", "ha_iheada", "ha_ihcap", "ha_icont", "ca_cntr", "ca_icntr", "ca_ihead", "ca_icont"),
"question" => array("question", "qtitle", "qanswer", "qinput", "qlinput", "qsubmit", "qfeedr", "qfeedw",
"qimg", "qordul", "qordli", "qimgd", "qetitem", "qetcorr", "qover"),
"page" => array("page_frame", "page_cont", "page_title", "page_fn",
"page_tnav", "page_bnav", "page_lnav", "page_rnav", "page_lnavlink", "page_rnavlink",
"page_lnavimage", "page_rnavimage")
)

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

◆ $templates

array ilObjStyleSheet::$templates
static

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

Referenced by getTemplates().

◆ $up_to_date

bool ilObjStyleSheet::$up_to_date = false
protected

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

Referenced by getUpToDate().


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