ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjStyleSheet Class Reference

Class ilObjStyleSheet. More...

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

Public Member Functions

 __construct ($a_id=0, $a_call_by_reference=false)
 Constructor @access public. More...
 
 setRefId ($a_ref_id)
 Set ref id (show error message, since styles do not use ref ids) More...
 
 getRefId ()
 Get ref id (show error message, since styles do not use ref ids) More...
 
 putInTree ($a_parent_ref)
 Put in tree (show error message, since styles do not use ref ids) More...
 
 createReference ()
 Create a reference (show error message, since styles do not use ref ids) More...
 
 setUpToDate ($a_up_to_date=true)
 Set style up to date (false + update will trigger css generation next time) More...
 
 getUpToDate ()
 Get up to date. More...
 
 setScope ($a_scope)
 Set scope. More...
 
 getScope ()
 Get scope. More...
 
 assignMetaData (&$a_meta_data)
 assign meta data object More...
 
getMetaData ()
 get meta data object More...
 
 create ($a_from_style=0, $a_import_mode=false)
 Create a new style. More...
 
 deleteCharacteristic ($a_type, $a_tag, $a_class)
 Delete Characteristic. More...
 
 characteristicExists ($a_char, $a_style_type)
 Check whether characteristic exists. More...
 
 addCharacteristic ($a_type, $a_char, $a_hidden=false)
 Add characteristic. More...
 
 copyCharacteristic ( $a_from_style_id, $a_from_type, $a_from_char, $a_to_char)
 Copy characteristic. More...
 
 getCharacteristics ($a_type="", $a_no_hidden=false, $a_include_core=true)
 Get characteristics. More...
 
 setCharacteristics ($a_chars)
 Set characteristics. More...
 
 saveHideStatus ($a_type, $a_char, $a_hide)
 Save characteristic hide status. More...
 
 getHideStatus ($a_type, $a_char)
 Get characteristic hide status. More...
 
 ilClone ()
 clone style sheet (note: styles have no ref ids and return an object id) More...
 
 copyImagesToDir ($a_target)
 Copy images to directory. More...
 
 addParameter ($a_tag, $a_par, $a_type, $a_mq_id=0, $a_custom=false)
 write style parameter to db More...
 
 createImagesDirectory ()
 Create images directory <data_dir>/sty/sty_<id>/images. More...
 
 getImagesDirectory ()
 Get images directory. More...
 
 getThumbnailsDirectory ()
 Get thumbnails directory. More...
 
 getImages ()
 Get images of style. More...
 
 uploadImage ($a_file)
 Upload image. More...
 
 deleteImage ($a_file)
 Delete an image. More...
 
 deleteParameter ($a_id)
 delete style parameter More...
 
 deleteStylePar ($a_tag, $a_class, $a_par, $a_type, $a_mq_id=0, $a_custom=false)
 Delete style parameter by tag/class/parameter. More...
 
 deleteCustomStylePars ($a_tag, $a_class, $a_type, $a_mq_id=0)
 Delete style parameter by tag/class/parameter. More...
 
 deleteStyleParOfChar ($a_type, $a_class)
 Delete style parameters of characteristic. More...
 
 delete ()
 delete style object More...
 
 read ()
 read style properties More...
 
 writeCSSFile ($a_target_file="", $a_image_dir="")
 write css file to webspace directory More...
 
 getParametersOfClass ($a_type, $a_class, $a_mq_id=0)
 Get parameters of class. More...
 
 update ()
 update object in db More...
 
 updateStyleParameter ($a_id, $a_value)
 update style parameter per id More...
 
 replaceStylePar ($a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
 Set style parameter per tag/class/parameter. More...
 
 getStyle ()
 todo: bad style! should return array of objects, not multi-dim-arrays More...
 
 setStyle ($a_style)
 set styles More...
 
 handleXmlString ($a_str)
 Handle xml strin. More...
 
 getXML ()
 get xml representation of style object todo: add mq_id More...
 
 createExportDirectory ()
 Create export directory. More...
 
 cleanExportDirectory ()
 Clear export directory. More...
 
 createExportSubDirectory ()
 Create export directory. More...
 
 setExportSubDir ($a_dir)
 Set local directory, that will be included within the zip file. More...
 
 getExportSubDir ()
 The local directory, that will be included within the zip file. More...
 
 export ()
 Create export file. More...
 
 exportXML ($a_dir)
 export style xml file to directory More...
 
 createImportDirectory ()
 Create import directory. More...
 
 import ($a_file)
 Import. More...
 
 createFromXMLFile ($a_file, $a_skip_parent_create=false)
 create style from xml file todo: add mq_id and custom More...
 
 getStyleParameterGroups ()
 Get grouped parameter. More...
 
 determineTemplateStyleClassType ($t, $k)
 
 do_3_10_Migration ()
 Migrates 3.10 style to 3.11 style. More...
 
 do_3_10_CharMigration ($a_id="")
 This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingStyleCharacteristics() More...
 
 do_3_9_Migration ($a_id)
 Migrate old 3.9 styles. More...
 
 getColors ()
 Get colors of style. More...
 
 addColor ($a_name, $a_code)
 Add color. More...
 
 updateColor ($a_name, $a_new_name, $a_code)
 Update color. More...
 
 removeColor ($a_name)
 Remove a color. More...
 
 colorExists ($a_color_name)
 Check whether color exists. More...
 
 getColorCodeForName ($a_name)
 Remove a color. More...
 
 getMediaQueries ()
 Get colors of style. More...
 
 addMediaQuery ($a_mquery, $order_nr=0)
 Add media query. More...
 
 getMaxMQueryOrderNr ()
 Get maximum media query order nr. More...
 
 updateMediaQuery ($a_id, $a_mquery)
 Update media query. More...
 
 getMediaQueryForId ($a_id)
 Get media query for id. More...
 
 deleteMediaQuery ($a_id)
 Delete media query. More...
 
 saveMediaQueryOrder ($a_order_nr=null)
 Save media query order. More...
 
 getTemplates ($a_type)
 Get table templates of style. More...
 
 getTemplateClasses ($a_tid)
 Get template classes. More...
 
 addTemplate ($a_type, $a_name, $a_classes)
 Add table template. More...
 
 updateTemplate ($a_t_id, $a_name, $a_classes)
 Update table template. More...
 
 addTemplateClass ($a_t_id, $a_type, $a_class)
 Update table template. More...
 
 templateExists ($a_template_name)
 Check whether template exists. More...
 
 getTemplate ($a_t_id)
 Get template. More...
 
 lookupTemplateName ($a_t_id)
 Lookup table template name for template ID. More...
 
 getTemplateXML ()
 Get table template xml. More...
 
 writeTemplatePreview ($a_t_id, $a_preview_html)
 Write table template preview. More...
 
 lookupTemplatePreview ($a_t_id)
 Lookup table template preview. More...
 
 removeTemplate ($a_t_id)
 Remove table template. More...
 
 writeStyleSetting ($a_name, $a_value)
 Write Style Setting. More...
 
 lookupStyleSetting ($a_name)
 Lookup style setting. More...
 
- Public Member Functions inherited from ilObject
 __construct ($a_id=0, $a_reference=true)
 Constructor @access public. More...
 
 withReferences ()
 determines wehter objects are referenced or not (got ref ids or not) More...
 
 read ()
 read object data from db into object More...
 
 getId ()
 get object id @access public More...
 
 setId ($a_id)
 set object id @access public More...
 
 setRefId ($a_id)
 set reference id @access public More...
 
 getRefId ()
 get reference id @access public More...
 
 getType ()
 get object type @access public More...
 
 setType ($a_type)
 set object type @access public More...
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 get object title @access public More...
 
 getUntranslatedTitle ()
 get untranslated object title @access public More...
 
 setTitle ($a_title)
 set object title More...
 
 getDescription ()
 get object description More...
 
 setDescription ($a_desc)
 set object description More...
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 get import id More...
 
 setImportId ($a_import_id)
 set import id More...
 
 getOwner ()
 get object owner More...
 
 getOwnerName ()
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 Gets the disk usage of the object in bytes. More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree ($a_parent_ref)
 maybe this method should be in tree object!? More...
 
 setPermissions ($a_parent_ref)
 set permissions of object More...
 
 setParentRolePermissions ($a_parent_ref)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g courses, groups for building permission intersections with non_member templates. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 count references of object More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type If you want to setup default local roles you MUST overwrite this method in derived object classes (see ilObjForum for an example) @access public More...
 
 applyDidacticTemplate ($a_tpl_id)
 Apply template. More...
 
 setRegisterMode ($a_bool)
 
 isUserRegistered ($a_user_id=0)
 
 requireRegistration ()
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo ($a_target_id, $a_copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies ($a_target_id, $a_copy_id)
 Clone object dependencies. More...
 
 cloneMetaData ($target_obj)
 Copy meta data. More...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _writeUpToDate ($a_id, $a_up_to_date)
 Write up to date. More...
 
static _lookupUpToDate ($a_id)
 Looup up to date. More...
 
static _writeStandard ($a_id, $a_std)
 Write standard flag. More...
 
static _writeScope ($a_id, $a_scope)
 Write scope. More...
 
static _lookupStandard ($a_id)
 Lookup standard flag. More...
 
static _writeActive ($a_id, $a_active)
 Write active flag. More...
 
static _lookupActive ($a_id)
 Lookup active flag. More...
 
static _getStandardStyles ( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
 Get standard styles. More...
 
static _getClonableContentStyles ()
 Get all clonable styles (active standard styles and individual learning module styles with write permission). More...
 
static _getBasicStyleDom ()
 Get basic style dom. More...
 
static _createImagesDirectory ($a_style_id)
 Create images directory <data_dir>/sty/sty_<id>/images. More...
 
static _getImagesDirectory ($a_style_id)
 Get images directory. More...
 
static getEffectiveContentStyleId ($a_style_id, $a_type="")
 Get effective Style Id. More...
 
static getContentStylePath ($a_style_id, $add_random=true)
 get content style path More...
 
static getContentPrintStyle ()
 get content print style More...
 
static getSyntaxStylePath ()
 get syntax style path More...
 
static getPlaceHolderStylePath ()
 get placeholder style path (for Page Layouts) More...
 
static _replaceStylePar ($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
 
static _getStyleParameterInputType ($par)
 
static _getStyleParameterSubPar ($par)
 
static _getStyleParameters ($a_tag="")
 
static _getFilteredGroups ()
 
static _getStyleParameterNumericUnits ($a_no_percentage=false)
 
static _getStyleParameterValues ($par)
 
static _getStyleSuperTypes ()
 
static _isExpandable ($a_type)
 
static _isHideable ($a_type)
 
static _getStyleSuperTypeForType ($a_type)
 
static _getCoreStyles ()
 Get core styles. More...
 
static isCoreStyle ($a_type, $a_class)
 Is core style. More...
 
static _getTemplateClassTypes ($a_template_type="")
 Get template class types. More...
 
static _getPseudoClasses ($tag)
 
static _determineTag ($a_type)
 
static getAvailableParameters ()
 Get available parameters. More...
 
static _addMissingStyleClassesToStyle ($a_id)
 Add missing style classes to all styles. More...
 
static _addMissingStyleClassesToAllStyles ($a_styles="")
 Add missing style classes to all styles todo: add mq_id and custom handling. More...
 
static _getColorFlavor ($a_rgb, $a_i)
 Get color flavor. More...
 
static _explodeRGB ($a_rgb, $as_dec=false)
 Explode an RGB string into an array. More...
 
static _RGBToHLS ($a_rgb)
 RGB to HLS (both arrays, 0..255) More...
 
static _HLSToRGB ($a_hls)
 HLS to RGB (both arrays, 0..255) More...
 
static _lookupTemplateName ($a_t_id)
 Lookup table template name for template ID. More...
 
static _lookupTemplateIdByName ($a_style_id, $a_name)
 Lookup table template preview. More...
 
static writeStyleUsage ($a_obj_id, $a_style_id)
 Write style usage. More...
 
static lookupObjectStyle ($a_obj_id)
 Lookup object style. More...
 
static lookupObjectForStyle ($a_style_id)
 Lookup object style. More...
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _lookupImportId ($a_obj_id)
 
static _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _lookupOwner ($a_id)
 lookup object owner More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
static _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
static _lookupObjId ($a_id)
 
static _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. More...
 
static _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
static _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
static _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
static _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
static _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id More...
 
static _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type More...
 
static _exists ($a_id, $a_reference=false, $a_type=null)
 checks if an object exists in object_data@access public More...
 
static _getObjectsByType ($a_obj_type="", $a_owner="")
 Get objects by type. More...
 
static _prepareCloneSelection ($a_ref_ids, $new_type, $show_path=true)
 Prepare copy wizard object selection. More...
 
static _getIcon ( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies ($a_obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $a_obj_ids)
 Get long description data. More...
 
static getAllOwnedRepositoryObjects ($a_user_id)
 Get all ids of objects user owns. More...
 
static fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate ($a_id)
 Lookup creation date. More...
 
static hasAutoRating ($a_type, $a_ref_id)
 Check if auto rating is active for parent group/course. More...
 

Data Fields

 $style
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 max length of object title More...
 
const DESC_LENGTH = 128
 
 $lng
 
 $id
 
 $ref_id
 
 $type
 
 $title
 
 $untranslatedTitle
 
 $desc
 
 $long_desc
 
 $owner
 
 $create_date
 
 $last_update
 
 $import_id
 
 $register = false
 
 $referenced
 
 $objectList
 
 $max_title
 
 $max_desc
 
 $add_dots
 

Static Public Attributes

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

Static Protected Attributes

static $basic_style_file = "./libs/ilias/Style/basic_style/style.xml"
 
static $basic_style_image_dir = "./libs/ilias/Style/basic_style/images"
 
static $basic_style_dom
 

Additional Inherited Members

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

Detailed Description

Class ilObjStyleSheet.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

Parameters
integerreference_id or object_id
booleantreat the id as reference_id (true) or object_id (false)

Reimplemented from ilObject.

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

555 {
556 global $DIC;
557
558 $this->db = $DIC->database();
559 $this->lng = $DIC->language();
560 $this->type = "sty";
561 $this->style = array();
562 if ($a_call_by_reference) {
563 $this->ilias->raiseError("Can't instantiate style object via reference id.", $this->ilias->error_obj->FATAL);
564 }
565
566 parent::__construct($a_id, false);
567 }
redirection script todo: (a better solution should control the processing via a xml file)
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ _addMissingStyleClassesToAllStyles()

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

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

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

2508 {
2509 global $DIC;
2510
2511 $ilDB = $DIC->database();
2512
2513 if ($a_styles == "") {
2515 } else {
2516 $styles = $a_styles;
2517 }
2520
2521 // get all core image files
2522 $core_images = array();
2523 $core_dir = self::$basic_style_image_dir;
2524 if (is_dir($core_dir)) {
2525 $dir = opendir($core_dir);
2526 while ($file = readdir($dir)) {
2527 if (substr($file, 0, 1) != "." && is_file($core_dir . "/" . $file)) {
2528 $core_images[] = $file;
2529 }
2530 }
2531 }
2532
2533 foreach ($styles as $style) {
2534 $id = $style["id"];
2535
2536 foreach ($core_styles as $cs) {
2537 // check, whether core style class exists
2538 $set = $ilDB->queryF(
2539 "SELECT * FROM style_char WHERE style_id = %s " .
2540 "AND type = %s AND characteristic = %s",
2541 array("integer", "text", "text"),
2542 array($id, $cs["type"], $cs["class"])
2543 );
2544
2545 // if not, add core style class
2546 if (!($rec = $ilDB->fetchAssoc($set))) {
2547 $ilDB->manipulateF(
2548 "INSERT INTO style_char (style_id, type, characteristic) " .
2549 " VALUES (%s,%s,%s) ",
2550 array("integer", "text", "text"),
2551 array($id, $cs["type"], $cs["class"])
2552 );
2553
2554 $xpath = new DOMXPath($bdom);
2555 $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '" . $cs["tag"] . "' and @Type='" .
2556 $cs["type"] . "' and @Class='" . $cs["class"] . "']/StyleParameter");
2557 foreach ($par_nodes as $par_node) {
2558 // check whether style parameter exists
2559 $set = $ilDB->queryF(
2560 "SELECT * FROM style_parameter WHERE style_id = %s " .
2561 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2562 array("integer", "text", "text", "text", "text"),
2563 array($id, $cs["type"], $cs["class"],
2564 $cs["tag"], $par_node->getAttribute("Name"))
2565 );
2566
2567 // if not, create style parameter
2568 if (!($rec = $ilDB->fetchAssoc($set))) {
2569 $spid = $ilDB->nextId("style_parameter");
2570 $st = $ilDB->manipulateF(
2571 "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) " .
2572 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2573 array("integer", "integer", "text", "text", "text", "text", "text"),
2574 array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2575 $par_node->getAttribute("Name"), $par_node->getAttribute("Value"))
2576 );
2577 }
2578 }
2579 }
2580 }
2581
2582 // now check, whether some core image files are missing
2585 reset($core_images);
2586 foreach ($core_images as $cim) {
2587 if (!is_file($imdir . "/" . $cim)) {
2588 copy($core_dir . "/" . $cim, $imdir . "/" . $cim);
2589 }
2590 }
2591 }
2592 }
static _createImagesDirectory($a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
static _getImagesDirectory($a_style_id)
Get images directory.
static _getCoreStyles()
Get core styles.
static _getBasicStyleDom()
Get basic style dom.
static _getObjectsDataForType($a_type, $a_omit_trash=false)
get all objects of a certain type
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
global $ilDB

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

Referenced by _addMissingStyleClassesToStyle().

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

◆ _addMissingStyleClassesToStyle()

static ilObjStyleSheet::_addMissingStyleClassesToStyle (   $a_id)
static

Add missing style classes to all styles.

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

2498 {
2499 $styles = array(array("id" => $a_id));
2501 }
static _addMissingStyleClassesToAllStyles($a_styles="")
Add missing style classes to all styles todo: add mq_id and custom handling.

References $styles, and _addMissingStyleClassesToAllStyles().

Referenced by import().

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

◆ _createImagesDirectory()

static ilObjStyleSheet::_createImagesDirectory (   $a_style_id)
static

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

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

1255 {
1256 global $DIC;
1257
1258 $ilErr = $DIC["ilErr"];
1259
1260 $sty_data_dir = ilUtil::getWebspaceDir() . "/sty";
1261 ilUtil::makeDir($sty_data_dir);
1262 if (!is_writable($sty_data_dir)) {
1263 $ilErr->raiseError("Style data directory (" . $sty_data_dir
1264 . ") not writeable.", $ilErr->FATAL);
1265 }
1266
1267 $style_dir = $sty_data_dir . "/sty_" . $a_style_id;
1268 ilUtil::makeDir($style_dir);
1269 if (!@is_dir($style_dir)) {
1270 $ilErr->raiseError("Creation of style directory failed (" .
1271 $style_dir . ").", $ilErr->FATAL);
1272 }
1273
1274 // create images subdirectory
1275 $im_dir = $style_dir . "/images";
1276 ilUtil::makeDir($im_dir);
1277 if (!@is_dir($im_dir)) {
1278 $ilErr->raiseError("Creation of Import Directory failed (" .
1279 $im_dir . ").", $ilErr->FATAL);
1280 }
1281
1282 // create thumbnails directory
1283 $thumb_dir = $style_dir . "/images/thumbnails";
1284 ilUtil::makeDir($thumb_dir);
1285 if (!@is_dir($thumb_dir)) {
1286 $ilErr->raiseError("Creation of Import Directory failed (" .
1287 $thumb_dir . ").", $ilErr->FATAL);
1288 }
1289 }
static getWebspaceDir($mode="filesystem")
get webspace directory
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
global $ilErr
Definition: raiseError.php:16

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

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

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

◆ _determineTag()

static ilObjStyleSheet::_determineTag (   $a_type)
static

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

2476 {
2477 return self::$assigned_tags[$a_type];
2478 }
$a_type
Definition: workflow.php:92

References $a_type.

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

+ Here is the caller graph for this function:

◆ _explodeRGB()

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

Explode an RGB string into an array.

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

3012 {
3013 $r["r"] = substr($a_rgb, 0, 2);
3014 $r["g"] = substr($a_rgb, 2, 2);
3015 $r["b"] = substr($a_rgb, 4, 2);
3016
3017 if ($as_dec) {
3018 $r["r"] = (int) hexdec($r["r"]);
3019 $r["g"] = (int) hexdec($r["g"]);
3020 $r["b"] = (int) hexdec($r["b"]);
3021 }
3022
3023 return $r;
3024 }
$r
Definition: example_031.php:79

References $r.

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

Get basic style dom.

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

849 {
850 if (!is_object(self::$basic_style_dom)) {
851 self::$basic_style_dom = new DOMDocument();
852 self::$basic_style_dom->load(self::$basic_style_file);
853 }
854
856 }

References $basic_style_dom.

Referenced by _addMissingStyleClassesToAllStyles().

+ Here is the caller graph for this function:

◆ _getClonableContentStyles()

static ilObjStyleSheet::_getClonableContentStyles ( )
static

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

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

795 {
796 global $DIC;
797
798 $ilAccess = $DIC->access();
799 $ilDB = $DIC->database();
800
801 $clonable_styles = array();
802
803 $q = "SELECT * FROM style_data";
804 $style_set = $ilDB->query($q);
805 while ($style_rec = $ilDB->fetchAssoc($style_set)) {
806 $clonable = false;
807 if ($style_rec["standard"] == 1) {
808 if ($style_rec["active"] == 1) {
809 $clonable = true;
810 }
811 } else {
812 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
813 $obj_ids = ilObjContentObject::_lookupContObjIdByStyleId($style_rec["id"]);
814 if (count($obj_ids) == 0) {
815 $obj_ids = self::lookupObjectForStyle($style_rec["id"]);
816 }
817 foreach ($obj_ids as $id) {
819 foreach ($ref as $ref_id) {
820 if ($ilAccess->checkAccess("write", "", $ref_id)) {
821 $clonable = true;
822 }
823 }
824 }
825 }
826 if ($clonable) {
827 $clonable_styles[$style_rec["id"]] =
828 ilObject::_lookupTitle($style_rec["id"]);
829 }
830 }
831
832 asort($clonable_styles);
833
834 return $clonable_styles;
835 }
static _lookupContObjIdByStyleId($a_style_id)
lookup style sheet ID
static lookupObjectForStyle($a_style_id)
Lookup object style.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object

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

Referenced by ilObjStyleSheetGUI\createObject().

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

◆ _getColorFlavor()

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

Get color flavor.

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

2988 {
2989 $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
2990 $hls = ilObjStyleSheet::_RGBToHLS($rgb);
2991
2992 if ($a_i > 0) {
2993 $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
2994 }
2995 if ($a_i < 0) {
2996 $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
2997 }
2998
2999 $rgb = ilObjStyleSheet::_HLSToRGB($hls);
3000
3001 foreach ($rgb as $k => $v) {
3002 $rgb[$k] = str_pad(dechex($v), 2, "0", STR_PAD_LEFT);
3003 }
3004
3005 return $rgb["r"] . $rgb["g"] . $rgb["b"];
3006 }
static _HLSToRGB($a_hls)
HLS to RGB (both arrays, 0..255)
static _RGBToHLS($a_rgb)
RGB to HLS (both arrays, 0..255)
static _explodeRGB($a_rgb, $as_dec=false)
Explode an RGB string into an array.

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

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

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

◆ _getCoreStyles()

static ilObjStyleSheet::_getCoreStyles ( )
static

Get core styles.

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

2424 {
2425 $c_styles = array();
2426 foreach (self::$core_styles as $cstyle) {
2427 $c_styles[$cstyle["type"] . "." . ilObjStyleSheet::_determineTag($cstyle["type"]) . "." . $cstyle["class"]]
2428 = array("type" => $cstyle["type"],
2429 "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2430 "class" => $cstyle["class"]);
2431 }
2432 return $c_styles;
2433 }
static _determineTag($a_type)

References _determineTag().

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

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

◆ _getFilteredGroups()

static ilObjStyleSheet::_getFilteredGroups ( )
static

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

2371 {
2373 }

References $filtered_groups.

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

+ Here is the caller graph for this function:

◆ _getImagesDirectory()

static ilObjStyleSheet::_getImagesDirectory (   $a_style_id)
static

Get images directory.

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

1303 {
1304 return ilUtil::getWebspaceDir() . "/sty/sty_" . $a_style_id .
1305 "/images";
1306 }

References ilUtil\getWebspaceDir().

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

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

◆ _getPseudoClasses()

static ilObjStyleSheet::_getPseudoClasses (   $tag)
static

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

2466 {
2467 return self::$pseudo_classes[$tag];
2468 }
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35

References $tag.

◆ _getStandardStyles()

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

Get standard styles.

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

752 {
753 global $DIC;
754
755 $ilDB = $DIC->database();
756 $ilSetting = $DIC->settings();
757 $tree = $DIC->repositoryTree();
758
759 $default_style = $ilSetting->get("default_content_style_id");
760
761 $and_str = "";
762 if (!$a_include_deactivated) {
763 $and_str = " AND active = 1";
764 }
765
766 $q = "SELECT * FROM style_data " .
767 " WHERE standard = 1" . $and_str;
768 $res = $ilDB->query($q);
769 $styles = array();
770 while ($sty = $ilDB->fetchAssoc($res)) {
771 if (!$a_exclude_default_style || $default_style != $sty["id"]) {
772 // check scope
773 if ($a_scope > 0 && $sty["category"] > 0) {
774 if ($tree->isInTree($sty["category"]) &&
775 $tree->isInTree($a_scope)) {
776 $path = $tree->getPathId($a_scope);
777 if (!in_array($sty["category"], $path)) {
778 continue;
779 }
780 }
781 }
782 $styles[$sty["id"]] = ilObject::_lookupTitle($sty["id"]);
783 }
784 }
785
786 return $styles;
787 }
global $ilSetting
Definition: privfeed.php:17
foreach($_POST as $key=> $value) $res

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

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

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

◆ _getStyleParameterInputType()

static ilObjStyleSheet::_getStyleParameterInputType (   $par)
static

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

2343 {
2344 $input = self::$parameter[$par]["input"];
2345 return $input;
2346 }

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

2376 {
2377 if ($a_no_percentage) {
2379 }
2380 return self::$num_unit;
2381 }

References $num_unit, and $num_unit_no_perc.

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

+ Here is the caller graph for this function:

◆ _getStyleParameters()

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

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

2355 {
2356 if ($a_tag == "") {
2357 return self::$parameter;
2358 }
2359 $par = array();
2360 foreach (self::$parameter as $k => $v) {
2361 if (is_array(self::$filtered_groups[$v["group"]]) &&
2362 !in_array($a_tag, self::$filtered_groups[$v["group"]])) {
2363 continue;
2364 }
2365 $par[$k] = $v;
2366 }
2367 return $par;
2368 }

References $parameter.

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

+ Here is the caller graph for this function:

◆ _getStyleParameterSubPar()

static ilObjStyleSheet::_getStyleParameterSubPar (   $par)
static

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

2349 {
2350 $subpar = self::$parameter[$par]["subpar"];
2351 return $subpar;
2352 }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues (   $par)
static

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

2384 {
2385 return self::$parameter[$par]["values"];
2386 }

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

+ Here is the caller graph for this function:

◆ _getStyleSuperTypeForType()

static ilObjStyleSheet::_getStyleSuperTypeForType (   $a_type)
static

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

2409 {
2410 foreach (self::$style_super_types as $s => $t) {
2411 if (in_array($a_type, $t)) {
2412 return $s;
2413 }
2414 if ($a_type == $s) {
2415 return $s;
2416 }
2417 }
2418 }
$s
Definition: pwgen.php:45

References $a_type, $s, and $t.

Referenced by ilObjStyleSheetGUI\__construct().

+ Here is the caller graph for this function:

◆ _getStyleSuperTypes()

static ilObjStyleSheet::_getStyleSuperTypes ( )
static

◆ _getTemplateClassTypes()

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

Get template class types.

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

2456 {
2457 if ($a_template_type == "") {
2458 return self::$templates;
2459 }
2460
2461 return self::$templates[$a_template_type];
2462 }

References $templates.

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

+ Here is the caller graph for this function:

◆ _HLSToRGB()

static ilObjStyleSheet::_HLSToRGB (   $a_hls)
static

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

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

3072 {
3073 $h = $a_hls["h"] / 255;
3074 $l = $a_hls["l"] / 255;
3075 $s = $a_hls["s"] / 255;
3076
3077 $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
3078
3079 // If S=0, define R, G, and B all to L
3080 if ($s == 0) {
3081 $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
3082 } else {
3083 if ($l < 0.5) {
3084 $temp2 = $l * (1.0 + $s);
3085 } else {
3086 $temp2 = $l + $s - $l * $s;
3087 }
3088
3089 $temp1 = 2.0 * $l - $temp2;
3090
3091
3092 # For each of R, G, B, compute another temporary value, temp3, as follows:
3093 foreach ($rgb as $k => $v) {
3094 switch ($k) {
3095 case "r":
3096 $temp3 = $h + 1.0 / 3.0;
3097 break;
3098
3099 case "g":
3100 $temp3 = $h;
3101 break;
3102
3103 case "b":
3104 $temp3 = $h - 1.0/3.0;
3105 break;
3106 }
3107 if ($temp3 < 0) {
3108 $temp3 = $temp3 + 1.0;
3109 }
3110 if ($temp3 > 1) {
3111 $temp3 = $temp3 - 1.0;
3112 }
3113
3114 if (6.0 * $temp3 < 1) {
3115 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3116 } elseif (2.0 * $temp3 < 1) {
3117 $rgb[$k] = $temp2;
3118 } elseif (3.0 * $temp3 < 2) {
3119 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0/3.0) - $temp3) * 6.0;
3120 } else {
3121 $rgb[$k] = $temp1;
3122 }
3123 }
3124 }
3125
3126 $rgb["r"] = round($rgb["r"] * 255);
3127 $rgb["g"] = round($rgb["g"] * 255);
3128 $rgb["b"] = round($rgb["b"] * 255);
3129
3130 return $rgb;
3131 }
global $l
Definition: afr.php:30
$h

References $h, $l, and $s.

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable (   $a_type)
static

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

2399 {
2400 return in_array($a_type, self::$expandable_types);
2401 }

References $a_type.

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

+ Here is the caller graph for this function:

◆ _isHideable()

static ilObjStyleSheet::_isHideable (   $a_type)
static

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

2404 {
2405 return in_array($a_type, self::$hideable_types);
2406 }

References $a_type.

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

+ Here is the caller graph for this function:

◆ _lookupActive()

static ilObjStyleSheet::_lookupActive (   $a_id)
static

Lookup active flag.

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

732 {
733 global $DIC;
734
735 $ilDB = $DIC->database();
736
737 $q = "SELECT * FROM style_data " .
738 " WHERE id = " . $ilDB->quote($a_id, "integer");
739 $res = $ilDB->query($q);
740 $sty = $ilDB->fetchAssoc($res);
741
742 return (boolean) $sty["active"];
743 }

References $DIC, $ilDB, and $res.

Referenced by ilContentStyleSettingsGUI\edit().

+ Here is the caller graph for this function:

◆ _lookupStandard()

static ilObjStyleSheet::_lookupStandard (   $a_id)
static

◆ _lookupTemplateIdByName()

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

Lookup table template preview.

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

3552 {
3553 global $DIC;
3554
3555 $ilDB = $DIC->database();
3556
3557 $set = $ilDB->query("SELECT id FROM style_template " .
3558 " WHERE style_id = " . $ilDB->quote($a_style_id, "integer") .
3559 " AND name = " . $ilDB->quote($a_name, "text"));
3560 if ($rec = $ilDB->fetchAssoc($set)) {
3561 return $rec["id"];
3562 }
3563
3564 return false;
3565 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ _lookupTemplateName()

static ilObjStyleSheet::_lookupTemplateName (   $a_t_id)
static

Lookup table template name for template ID.

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

3451 {
3452 global $DIC;
3453
3454 $ilDB = $DIC->database();
3455
3456 $set = $ilDB->query("SELECT name FROM style_template WHERE " .
3457 " id = " . $ilDB->quote($a_t_id, "integer"));
3458
3459 if ($rec = $ilDB->fetchAssoc($set)) {
3460 return $rec["name"];
3461 }
3462
3463 return false;
3464 }

References $DIC, and $ilDB.

Referenced by lookupTemplateName(), and ilObjStyleSheetGUI\updateTemplateObject().

+ Here is the caller graph for this function:

◆ _lookupUpToDate()

static ilObjStyleSheet::_lookupUpToDate (   $a_id)
static

Looup up to date.

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

653 {
654 global $DIC;
655
656 $ilDB = $DIC->database();
657
658 $q = "SELECT uptodate FROM style_data " .
659 " WHERE id = " . $ilDB->quote($a_id, "integer");
660 $res = $ilDB->query($q);
661 $sty = $ilDB->fetchAssoc($res);
662
663 return (boolean) $sty["uptodate"];
664 }

References $DIC, $ilDB, and $res.

Referenced by getContentStylePath().

+ Here is the caller graph for this function:

◆ _replaceStylePar()

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

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

1892 {
1893 global $DIC;
1894
1895 $ilDB = $DIC->database();
1896
1897 $q = "SELECT * FROM style_parameter WHERE " .
1898 " style_id = " . $ilDB->quote($style_id, "integer") . " AND " .
1899 " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1900 " class = " . $ilDB->quote($a_class, "text") . " AND " .
1901 " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1902 " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1903 " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1904 " parameter = " . $ilDB->quote($a_par, "text");
1905
1906 $set = $ilDB->query($q);
1907
1908 if ($rec = $set->fetchRow()) {
1909 $q = "UPDATE style_parameter SET " .
1910 " value = " . $ilDB->quote($a_val, "text") . " WHERE " .
1911 " style_id = " . $ilDB->quote($style_id, "integer") . " AND " .
1912 " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1913 " class = " . $ilDB->quote($a_class, "text") . " AND " .
1914 " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1915 " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1916 " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1917 " parameter = " . $ilDB->quote($a_par, "text");
1918
1919 $ilDB->manipulate($q);
1920 } else {
1921 $id = $ilDB->nextId("style_parameter");
1922 $q = "INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter, mq_id, custom) VALUES " .
1923 " (" .
1924 $ilDB->quote($id, "integer") . "," .
1925 $ilDB->quote($a_val, "text") . "," .
1926 " " . $ilDB->quote($style_id, "integer") . "," .
1927 " " . $ilDB->quote($a_tag, "text") . "," .
1928 " " . $ilDB->quote($a_class, "text") . "," .
1929 " " . $ilDB->quote($a_type, "text") . "," .
1930 " " . $ilDB->quote($a_par, "text") . "," .
1931 " " . $ilDB->quote($a_mq_id, "integer") . "," .
1932 " " . $ilDB->quote($a_custom, "integer") .
1933 ")";
1934
1935 $ilDB->manipulate($q);
1936 }
1937 }

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

Referenced by replaceStylePar().

+ Here is the caller graph for this function:

◆ _RGBToHLS()

static ilObjStyleSheet::_RGBToHLS (   $a_rgb)
static

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

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

3030 {
3031 $r = $a_rgb["r"] / 255;
3032 $g = $a_rgb["g"] / 255;
3033 $b = $a_rgb["b"] / 255;
3034
3035 // max / min
3036 $max = max($r, $g, $b);
3037 $min = min($r, $g, $b);
3038
3039 //lightness
3040 $l = ($max + $min) / 2;
3041
3042 if ($max == $min) {
3043 $s = 0;
3044 $h = 0;
3045 } else {
3046 if ($l < 0.5) {
3047 $s = ($max - $min) / ($max + $min);
3048 } else {
3049 $s = ($max - $min) / (2.0 - $max - $min);
3050 }
3051
3052 if ($r == $max) {
3053 $h = ($g - $b) / ($max - $min);
3054 } elseif ($g == $max) {
3055 $h = 2.0 + ($b - $r) / ($max - $min);
3056 } elseif ($b == $max) {
3057 $h = 4.0 + ($r - $g) / ($max - $min);
3058 }
3059 }
3060
3061 $hls["h"] = round(($h / 6) * 255);
3062 $hls["l"] = round($l * 255);
3063 $hls["s"] = round($s * 255);
3064
3065 return $hls;
3066 }

References $h, $l, $r, and $s.

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _writeActive()

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

Write active flag.

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

717 {
718 global $DIC;
719
720 $ilDB = $DIC->database();
721
722 $q = "UPDATE style_data SET active = " .
723 $ilDB->quote((int) $a_active, "integer") .
724 " WHERE id = " . $ilDB->quote($a_id, "integer");
725 $ilDB->manipulate($q);
726 }

References $DIC, and $ilDB.

Referenced by ilContentStyleSettingsGUI\saveActiveStyles().

+ Here is the caller graph for this function:

◆ _writeScope()

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

Write scope.

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

685 {
686 global $DIC;
687
688 $ilDB = $DIC->database();
689
690 $q = "UPDATE style_data SET category = " .
691 $ilDB->quote((int) $a_scope, "integer") .
692 " WHERE id = " . $ilDB->quote($a_id, "integer");
693 $ilDB->manipulate($q);
694 }

References $DIC, and $ilDB.

Referenced by ilContentStyleSettingsGUI\saveScope().

+ Here is the caller graph for this function:

◆ _writeStandard()

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

Write standard flag.

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

670 {
671 global $DIC;
672
673 $ilDB = $DIC->database();
674
675 $q = "UPDATE style_data SET standard = " .
676 $ilDB->quote((int) $a_std, "integer") .
677 " WHERE id = " . $ilDB->quote($a_id, "integer");
678 $ilDB->manipulate($q);
679 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ _writeUpToDate()

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

Write up to date.

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

638 {
639 global $DIC;
640
641 $ilDB = $DIC->database();
642
643 $q = "UPDATE style_data SET uptodate = " .
644 $ilDB->quote((int) $a_up_to_date, "integer") .
645 " WHERE id = " . $ilDB->quote($a_id, "integer");
646 $ilDB->manipulate($q);
647 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ addCharacteristic()

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

Add characteristic.

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

1038 {
1039 $ilDB = $this->db;
1040
1041 // delete characteristic record
1042 $ilDB->manipulateF(
1043 "INSERT INTO style_char (style_id, type, characteristic, hide)" .
1044 " VALUES (%s,%s,%s,%s) ",
1045 array("integer", "text", "text", "integer"),
1046 array($this->getId(), $a_type, $a_char, $a_hidden)
1047 );
1048
1049 $this->setUpToDate(false);
1050 $this->_writeUpToDate($this->getId(), false);
1051 }
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
getId()
get object id @access public

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

Referenced by copyCharacteristic().

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

◆ addColor()

ilObjStyleSheet::addColor (   $a_name,
  $a_code 
)

Add color.

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

2869 {
2870 $ilDB = $this->db;
2871
2872 $ilDB->manipulate("INSERT INTO style_color (style_id, color_name, color_code)" .
2873 " VALUES (" .
2874 $ilDB->quote($this->getId(), "integer") . "," .
2875 $ilDB->quote($a_name, "text") . "," .
2876 $ilDB->quote($a_code, "text") .
2877 ")");
2878 }

References ilObject\$db, and $ilDB.

Referenced by copyCharacteristic(), and create().

+ Here is the caller graph for this function:

◆ addMediaQuery()

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

Add media query.

Parameters
string$a_mquerymedia query

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

3165 {
3166 $ilDB = $this->db;
3167
3168 $id = $ilDB->nextId("sty_media_query");
3169 if ($order_nr == 0) {
3170 $order_nr = $this->getMaxMQueryOrderNr() + 10;
3171 }
3172
3173 $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
3174 " VALUES (" .
3175 $ilDB->quote($id, "integer") . "," .
3176 $ilDB->quote($this->getId(), "integer") . "," .
3177 $ilDB->quote($a_mquery, "text") . "," .
3178 $ilDB->quote($order_nr, "integer") .
3179 ")");
3180
3181 return $id;
3182 }
getMaxMQueryOrderNr()
Get maximum media query order nr.

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

Referenced by create().

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

◆ addParameter()

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

write style parameter to db

todo check usages add mq_id

Parameters
string$a_tagtag name (tag.class, e.g. "div.Mnemonic")
string$a_partag parameter (e.g. "margin-left")
string$a_typestyle type (e.g. "section")

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

1217 {
1218 $ilDB = $this->db;
1219
1220 $avail_params = $this->getAvailableParameters();
1221 $tag = explode(".", $a_tag);
1222 $value = $avail_params[$a_par][0];
1223 $id = $ilDB->nextId("style_parameter");
1224 $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1225 "(" .
1226 $ilDB->quote($id, "integer") . "," .
1227 $ilDB->quote($this->getId(), "integer") . "," .
1228 $ilDB->quote($a_type, "text") . "," .
1229 $ilDB->quote($tag[0], "text") . "," .
1230 $ilDB->quote($tag[1], "text") . "," .
1231 $ilDB->quote($a_par, "text") . "," .
1232 $ilDB->quote($value, "text") . "," .
1233 $ilDB->quote($a_mq_id, "integer") . "," .
1234 $ilDB->quote($a_custom, "integer") .
1235 ")";
1236 $ilDB->manipulate($q);
1237 $this->read();
1238 $this->writeCSSFile();
1239 }
read()
read style properties
static getAvailableParameters()
Get available parameters.
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory

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

+ Here is the call graph for this function:

◆ addTemplate()

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

Add table template.

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

3328 {
3329 $ilDB = $this->db;
3330
3331 $tid = $ilDB->nextId("style_template");
3332 $ilDB->manipulate($q = "INSERT INTO style_template " .
3333 "(id, style_id, name, temp_type)" .
3334 " VALUES (" .
3335 $ilDB->quote($tid, "integer") . "," .
3336 $ilDB->quote($this->getId(), "integer") . "," .
3337 $ilDB->quote($a_name, "text") . "," .
3338 $ilDB->quote($a_type, "text") .
3339 ")");
3340
3341 foreach ($a_classes as $t => $c) {
3342 $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3343 "(template_id, class_type, class)" .
3344 " VALUES (" .
3345 $ilDB->quote($tid, "integer") . "," .
3346 $ilDB->quote($t, "text") . "," .
3347 $ilDB->quote($c, "text") .
3348 ")");
3349 }
3350
3351 include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
3352 $this->writeTemplatePreview(
3353 $tid,
3355 );
3356
3357 return $tid;
3358 }
static _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
writeTemplatePreview($a_t_id, $a_preview_html)
Write table template preview.

References $a_type, ilObject\$db, $ilDB, $t, ilObjStyleSheetGUI\_getTemplatePreview(), and writeTemplatePreview().

Referenced by create().

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

◆ addTemplateClass()

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

Update table template.

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

3390 {
3391 $ilDB = $this->db;
3392
3393 $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3394 "(template_id, class_type, class)" .
3395 " VALUES (" .
3396 $ilDB->quote($a_t_id, "integer") . "," .
3397 $ilDB->quote($a_type, "text") . "," .
3398 $ilDB->quote($a_class, "text") .
3399 ")");
3400 }

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

◆ assignMetaData()

ilObjStyleSheet::assignMetaData ( $a_meta_data)

assign meta data object

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

841 {
842 $this->meta_data = $a_meta_data;
843 }

◆ characteristicExists()

ilObjStyleSheet::characteristicExists (   $a_char,
  $a_style_type 
)

Check whether characteristic exists.

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

1020 {
1021 $ilDB = $this->db;
1022
1023 $set = $ilDB->queryF(
1024 "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
1025 array("integer", "text", "text"),
1026 array($this->getId(), $a_char, $a_style_type)
1027 );
1028 if ($rec = $ilDB->fetchAssoc($set)) {
1029 return true;
1030 }
1031 return false;
1032 }

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

Referenced by copyCharacteristic().

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

◆ cleanExportDirectory()

ilObjStyleSheet::cleanExportDirectory ( )

Clear export directory.

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

2056 {
2057 $sty_data_dir = ilUtil::getDataDir() . "/sty";
2058 $style_dir = $sty_data_dir . "/sty_" . $this->getId();
2059 // create export subdirectory
2060 $ex_dir = $style_dir . "/export";
2061
2062 if (is_dir($ex_dir)) {
2063 ilUtil::delDir($ex_dir, true);
2064 }
2065 }
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

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

Referenced by export().

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

◆ colorExists()

ilObjStyleSheet::colorExists (   $a_color_name)

Check whether color exists.

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

2943 {
2944 $ilDB = $this->db;
2945
2946 $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2947 "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2948 "color_name = " . $ilDB->quote($a_color_name, "text"));
2949 if ($rec = $ilDB->fetchAssoc($set)) {
2950 return true;
2951 }
2952 return false;
2953 }

References ilObject\$db, and $ilDB.

Referenced by copyCharacteristic().

+ Here is the caller graph for this function:

◆ copyCharacteristic()

ilObjStyleSheet::copyCharacteristic (   $a_from_style_id,
  $a_from_type,
  $a_from_char,
  $a_to_char 
)

Copy characteristic.

Parameters

return

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

1064 {
1065 $ilDB = $this->db;
1066
1067 if (!$this->characteristicExists($a_to_char, $a_from_type)) {
1068 $this->addCharacteristic($a_from_type, $a_to_char);
1069 }
1070 $this->deleteStyleParOfChar($a_from_type, $a_to_char);
1071
1072 $from_style = new ilObjStyleSheet($a_from_style_id);
1073
1074 // todo fix using mq_id
1075 $pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
1076
1077 $colors = array();
1078 foreach ($pars as $p => $v) {
1079 if (substr($v, 0, 1) == "!") {
1080 $colors[] = substr($v, 1);
1081 }
1082 $this->replaceStylePar(
1083 ilObjStyleSheet::_determineTag($a_from_type),
1084 $a_to_char,
1085 $p,
1086 $v,
1087 $a_from_type
1088 );
1089 }
1090
1091 // copy colors
1092 foreach ($colors as $c) {
1093 if (!$this->colorExists($c)) {
1094 $this->addColor($c, $from_style->getColorCodeForName($c));
1095 }
1096 }
1097 }
Class ilObjStyleSheet.
addColor($a_name, $a_code)
Add color.
characteristicExists($a_char, $a_style_type)
Check whether characteristic exists.
addCharacteristic($a_type, $a_char, $a_hidden=false)
Add characteristic.
replaceStylePar($a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
Set style parameter per tag/class/parameter.
colorExists($a_color_name)
Check whether color exists.
deleteStyleParOfChar($a_type, $a_class)
Delete style parameters of characteristic.

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

+ Here is the call graph for this function:

◆ copyImagesToDir()

ilObjStyleSheet::copyImagesToDir (   $a_target)

Copy images to directory.

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

1203 {
1204 ilUtil::rCopy($this->getImagesDirectory(), $a_target);
1205 }
getImagesDirectory()
Get images directory.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.

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

+ Here is the call graph for this function:

◆ create()

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

Create a new style.

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

870 {
872
873 parent::create();
874
875 if ($a_from_style == 0) {
876 if (!$a_import_mode) {
877 // copy styles from basic style
878 $this->createFromXMLFile(self::$basic_style_file, true);
879
880 // copy images from basic style
881 $this->createImagesDirectory();
883 self::$basic_style_image_dir,
884 $this->getImagesDirectory()
885 );
886 } else {
887 // add style_data record
888 $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
889 "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
890 $ilDB->quote((int) $this->getScope(), "integer") . ")";
891 $ilDB->manipulate($q);
893 }
894 } else {
895 // get style parameter records
896 $def = array();
897 $q = "SELECT * FROM style_parameter WHERE style_id = " .
898 $ilDB->quote($a_from_style, "integer");
899 $par_set = $ilDB->query($q);
900 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
901 $def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
902 "parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
903 "type" => $par_rec["type"], "mq_id" => $par_rec["mq_id"], "custom" => $par_rec["custom"]);
904 }
905
906 // get style characteristics records
907 $chars = array();
908 $q = "SELECT * FROM style_char WHERE style_id = " .
909 $ilDB->quote($a_from_style, "integer");
910 $par_set = $ilDB->query($q);
911 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
912 $chars[] = array("type" => $par_rec["type"], "characteristic" => $par_rec["characteristic"]);
913 }
914
915
916 // copy media queries
917 $from_style = new ilObjStyleSheet($a_from_style);
918 $mqs = $from_style->getMediaQueries();
919 $mq_mapping = array();
920 foreach ($mqs as $mq) {
921 $nid = $this->addMediaQuery($mq["mquery"]);
922 $mq_mapping[$mq["id"]] = $nid;
923 }
924
925 // default style settings
926 foreach ($def as $sty) {
927 $id = $ilDB->nextId("style_parameter");
928 $q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
929 "(" .
930 $ilDB->quote($id, "integer") . "," .
931 $ilDB->quote($this->getId(), "integer") . "," .
932 $ilDB->quote($sty["tag"], "text") . "," .
933 $ilDB->quote($sty["class"], "text") . "," .
934 $ilDB->quote($sty["parameter"], "text") . "," .
935 $ilDB->quote($sty["value"], "text") . "," .
936 $ilDB->quote($sty["type"], "text") . "," .
937 $ilDB->quote((int) $mq_mapping[$sty["mq_id"]], "integer") . "," .
938 $ilDB->quote($sty["custom"], "integer") .
939 ")";
940 $ilDB->manipulate($q);
941 }
942
943 // insert style characteristics
944 foreach ($chars as $char) {
945 $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES " .
946 "(" . $ilDB->quote($this->getId(), "integer") . "," .
947 $ilDB->quote($char["type"], "text") . "," .
948 $ilDB->quote($char["characteristic"], "text") . ")";
949 $ilDB->manipulate($q);
950 }
951
952 // add style_data record
953 $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
954 "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
955 $ilDB->quote((int) $this->getScope(), "integer") . ")";
956 $ilDB->manipulate($q);
957
958 // copy images
959 $this->createImagesDirectory();
961 $from_style->getImagesDirectory(),
962 $this->getImagesDirectory()
963 );
964
965 // copy colors
966 $colors = $from_style->getColors();
967 foreach ($colors as $c) {
968 $this->addColor($c["name"], $c["code"]);
969 }
970
971 // copy templates
973 foreach ($tcts as $tct => $v) {
974 $templates = $from_style->getTemplates($tct);
975 foreach ($templates as $t) {
976 $this->addTemplate($tct, $t["name"], $t["classes"]);
977 }
978 }
979 }
980
981 $this->read();
982 if (!$a_import_mode) {
983 $this->writeCSSFile();
984 }
985 }
addMediaQuery($a_mquery, $order_nr=0)
Add media query.
static _getTemplateClassTypes($a_template_type="")
Get template class types.
createFromXMLFile($a_file, $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
addTemplate($a_type, $a_name, $a_classes)
Add table template.
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
$def
Definition: croninfo.php:21

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

+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjStyleSheet::createExportDirectory ( )

Create export directory.

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

2026 {
2027 $sty_data_dir = ilUtil::getDataDir() . "/sty";
2028 ilUtil::makeDir($sty_data_dir);
2029 if (!is_writable($sty_data_dir)) {
2030 $this->ilias->raiseError("Style data directory (" . $sty_data_dir
2031 . ") not writeable.", $this->ilias->error_obj->FATAL);
2032 }
2033
2034 $style_dir = $sty_data_dir . "/sty_" . $this->getId();
2035 ilUtil::makeDir($style_dir);
2036 if (!@is_dir($style_dir)) {
2037 $this->ilias->raiseError("Creation of style directory failed (" .
2038 $style_dir . ").", $this->ilias->error_obj->FATAL);
2039 }
2040
2041 // create export subdirectory
2042 $ex_dir = $style_dir . "/export";
2043 ilUtil::makeDir($ex_dir);
2044 if (!@is_dir($ex_dir)) {
2045 $this->ilias->raiseError("Creation of Import Directory failed (" .
2046 $ex_dir . ").", $this->ilias->error_obj->FATAL);
2047 }
2048
2049 return $ex_dir;
2050 }

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

Referenced by createExportSubDirectory(), and export().

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

◆ createExportSubDirectory()

ilObjStyleSheet::createExportSubDirectory ( )

Create export directory.

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

2072 {
2073 $ex_dir = $this->createExportDirectory();
2074 $ex_sub_dir = $ex_dir . "/" . $this->getExportSubDir();
2075 ilUtil::makeDir($ex_sub_dir);
2076 if (!is_writable($ex_sub_dir)) {
2077 $this->ilias->raiseError("Style data directory (" . $ex_sub_dir
2078 . ") not writeable.", $this->ilias->error_obj->FATAL);
2079 }
2080 $ex_sub_images_dir = $ex_sub_dir . "/images";
2081 ilUtil::makeDir($ex_sub_images_dir);
2082 if (!is_writable($ex_sub_images_dir)) {
2083 $this->ilias->raiseError("Style data directory (" . $ex_sub_images_dir
2084 . ") not writeable.", $this->ilias->error_obj->FATAL);
2085 }
2086 }
createExportDirectory()
Create export directory.
getExportSubDir()
The local directory, that will be included within the zip file.

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

Referenced by export().

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

◆ createFromXMLFile()

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

create style from xml file todo: add mq_id and custom

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

2247 {
2248 $ilDB = $this->db;
2249
2250 $this->is_3_10_skin = false;
2251
2252 if (!$a_skip_parent_create) {
2253 parent::create();
2254 }
2255 include_once("./Services/Style/Content/classes/class.ilStyleImportParser.php");
2256 $importParser = new ilStyleImportParser($a_file, $this);
2257 $importParser->startParsing();
2258
2259 // store style parameter
2260 foreach ($this->style as $style) {
2261 foreach ($style as $tag) {
2262 $id = $ilDB->nextId("style_parameter");
2263
2264 // migrate old table PageFrame/PageContainer to div
2265 if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
2266 $tag["tag"] == "table") {
2267 $tag["tag"] = "div";
2268 if ($tag["parameter"] == "width" && $tag["value"] == "100%") {
2269 continue;
2270 }
2271 }
2272
2273 $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
2274 "(" .
2275 $ilDB->quote($id, "integer") . "," .
2276 $ilDB->quote($this->getId(), "integer") . "," .
2277 $ilDB->quote($tag["tag"], "text") . "," .
2278 $ilDB->quote($tag["class"], "text") . "," .
2279 $ilDB->quote($tag["parameter"], "text") . "," .
2280 $ilDB->quote($tag["type"], "text") . "," .
2281 $ilDB->quote($tag["value"], "text") . "," .
2282 $ilDB->quote((bool) $tag["custom"], "integer") .
2283 ")";
2284 $ilDB->manipulate($q);
2285 }
2286 }
2287
2288 // store characteristics
2289 $this->is_3_10_skin = true;
2290 if (is_array($this->chars)) {
2291 foreach ($this->chars as $char) {
2292 if ($char["type"] != "") {
2293 $s = substr($char["class"], strlen($char["class"]) - 6);
2294 if ($s != ":hover") {
2295 $ilDB->replace(
2296 "style_char",
2297 array(
2298 "style_id" => array("integer", $this->getId()),
2299 "type" => array("text", $char["type"]),
2300 "characteristic" => array("text", $char["class"])),
2301 array("hide" => array("integer", 0))
2302 );
2303 /*
2304 $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
2305 "(".$ilDB->quote($this->getId(), "integer").",".
2306 $ilDB->quote($char["type"], "text").",".
2307 $ilDB->quote($char["class"], "text").")";
2308 $ilDB->manipulate($q);*/
2309 $this->is_3_10_skin = false;
2310 }
2311 }
2312 }
2313 }
2314
2315 // add style_data record
2316 $q = "INSERT INTO style_data (id, uptodate) VALUES " .
2317 "(" . $ilDB->quote($this->getId(), "integer") . ", 0)";
2318 $ilDB->manipulate($q);
2319
2320 $this->update();
2321 $this->read();
2322
2323 if ($this->is_3_10_skin) {
2324 $this->do_3_10_Migration();
2325 }
2326 //$this->writeCSSFile();
2327 }
update()
update object in db
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.

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

Referenced by create(), and import().

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

1246 {
1248 }

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

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

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

◆ createImportDirectory()

ilObjStyleSheet::createImportDirectory ( )

Create import directory.

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

2162 {
2163 $sty_data_dir = ilUtil::getDataDir() . "/sty";
2164 ilUtil::makeDir($sty_data_dir);
2165 if (!is_writable($sty_data_dir)) {
2166 $this->ilias->raiseError("Style data directory (" . $sty_data_dir
2167 . ") not writeable.", $this->ilias->error_obj->FATAL);
2168 }
2169
2170 $style_dir = $sty_data_dir . "/sty_" . $this->getId();
2171 ilUtil::makeDir($style_dir);
2172 if (!@is_dir($style_dir)) {
2173 $this->ilias->raiseError("Creation of style directory failed (" .
2174 $style_dir . ").", $this->ilias->error_obj->FATAL);
2175 }
2176
2177 // create import subdirectory
2178 $im_dir = $style_dir . "/import";
2179 ilUtil::makeDir($im_dir);
2180 if (!@is_dir($im_dir)) {
2181 $this->ilias->raiseError("Creation of Import Directory failed (" .
2182 $im_dir . ").", $this->ilias->error_obj->FATAL);
2183 }
2184
2185 return $im_dir;
2186 }

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

Referenced by import().

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

◆ createReference()

ilObjStyleSheet::createReference ( )

Create a reference (show error message, since styles do not use ref ids)

Reimplemented from ilObject.

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

598 {
599 $this->ilias->raiseError("Operation ilObjStyleSheet::createReference() not allowed.", $this->ilias->error_obj->FATAL);
600 }

◆ delete()

ilObjStyleSheet::delete ( )

delete style object

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

1459 {
1460 $ilDB = $this->db;
1461
1462 // delete object
1463 parent::delete();
1464
1465 // check whether this style is global default
1466 $def_style = $this->ilias->getSetting("default_content_style_id");
1467 if ($def_style == $this->getId()) {
1468 $this->ilias->deleteSetting("default_content_style_id");
1469 }
1470
1471 // check whether this style is global fixed
1472 $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1473 if ($fixed_style == $this->getId()) {
1474 $this->ilias->deleteSetting("fixed_content_style_id");
1475 }
1476
1477 // delete style parameter
1478 $q = "DELETE FROM style_parameter WHERE style_id = " .
1479 $ilDB->quote($this->getId(), "integer");
1480 $ilDB->manipulate($q);
1481
1482 // delete style file
1483 $css_file_name = ilUtil::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1484 if (is_file($css_file_name)) {
1485 unlink($css_file_name);
1486 }
1487
1488 // delete media queries
1489 $ilDB->manipulate(
1490 "DELETE FROM sty_media_query WHERE " .
1491 " style_id = " . $ilDB->quote($this->getId(), "integer")
1492 );
1493
1494 // delete entries in learning modules
1495 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1497
1498 // delete style data record
1499 $q = "DELETE FROM style_data WHERE id = " .
1500 $ilDB->quote($this->getId(), "integer");
1501 $ilDB->manipulate($q);
1502 }
static _deleteStyleAssignments($a_style_id)
delete all style references to style

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

+ Here is the call graph for this function:

◆ deleteCharacteristic()

ilObjStyleSheet::deleteCharacteristic (   $a_type,
  $a_tag,
  $a_class 
)

Delete Characteristic.

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

991 {
993
994 // check, if characteristic is not a core style
996 if (empty($core_styles[$a_type . "." . $a_tag . "." . $a_class])) {
997 // delete characteristic record
998 $st = $ilDB->manipulateF(
999 "DELETE FROM style_char WHERE style_id = %s AND type = %s AND characteristic = %s",
1000 array("integer", "text", "text"),
1001 array($this->getId(), $a_type, $a_class)
1002 );
1003
1004 // delete parameter records
1005 $st = $ilDB->manipulateF(
1006 "DELETE FROM style_parameter WHERE style_id = %s AND tag = %s AND type = %s AND class = %s",
1007 array("integer", "text", "text", "text"),
1008 array($this->getId(), $a_tag, $a_type, $a_class)
1009 );
1010 }
1011
1012 $this->setUpToDate(false);
1013 $this->_writeUpToDate($this->getId(), false);
1014 }

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

+ Here is the call graph for this function:

◆ deleteCustomStylePars()

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

Delete style parameter by tag/class/parameter.

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

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

1420 {
1421 $ilDB = $this->db;
1422
1423 $q = "DELETE FROM style_parameter WHERE " .
1424 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1425 " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1426 " class = " . $ilDB->quote($a_class, "text") . " AND " .
1427 " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1428 " custom = " . $ilDB->quote(1, "integer") . " AND " .
1429 " " . $ilDB->equals("type", $a_type, "text", true);
1430
1431 $ilDB->manipulate($q);
1432 }

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

+ Here is the call graph for this function:

◆ deleteImage()

ilObjStyleSheet::deleteImage (   $a_file)

Delete an image.

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

1362 {
1363 if (is_file($this->getImagesDirectory() . "/" . $a_file)) {
1364 unlink($this->getImagesDirectory() . "/" . $a_file);
1365 }
1366 if (is_file($this->getThumbnailsDirectory() . "/" . $a_file)) {
1367 unlink($this->getThumbnailsDirectory() . "/" . $a_file);
1368 }
1369 }
getThumbnailsDirectory()
Get thumbnails directory.

References getImagesDirectory(), and getThumbnailsDirectory().

+ Here is the call graph for this function:

◆ deleteMediaQuery()

ilObjStyleSheet::deleteMediaQuery (   $a_id)

Delete media query.

Parameters
int$a_idmedia query id

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

3241 {
3242 $ilDB = $this->db;
3243
3244 $ilDB->manipulate(
3245 "DELETE FROM sty_media_query WHERE " .
3246 " style_id = " . $ilDB->quote($this->getId(), "integer") .
3247 " AND id = " . $ilDB->quote($a_id, "integer")
3248 );
3249 $this->saveMediaQueryOrder();
3250 }
saveMediaQueryOrder($a_order_nr=null)
Save media query order.

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

+ Here is the call graph for this function:

◆ deleteParameter()

ilObjStyleSheet::deleteParameter (   $a_id)

delete style parameter

Parameters
int$a_idstyle parameter id

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

1377 {
1378 $ilDB = $this->db;
1379
1380 $q = "DELETE FROM style_parameter WHERE id = " .
1381 $ilDB->quote($a_id, "integer");
1382 $ilDB->query($q);
1383 }

References ilObject\$db, and $ilDB.

◆ deleteStylePar()

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

Delete style parameter by tag/class/parameter.

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

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

1395 {
1396 $ilDB = $this->db;
1397
1398 $q = "DELETE FROM style_parameter WHERE " .
1399 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1400 " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1401 " class = " . $ilDB->quote($a_class, "text") . " AND " .
1402 " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1403 " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1404 " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1405 " parameter = " . $ilDB->quote($a_par, "text");
1406
1407 $ilDB->manipulate($q);
1408 }

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

+ Here is the call graph for this function:

◆ deleteStyleParOfChar()

ilObjStyleSheet::deleteStyleParOfChar (   $a_type,
  $a_class 
)

Delete style parameters of characteristic.

Parameters
stringtag
stringclass
stringparameter
stringtype

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

1443 {
1444 $ilDB = $this->db;
1445
1446 $q = "DELETE FROM style_parameter WHERE " .
1447 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1448 " class = " . $ilDB->quote($a_class, "text") . " AND " .
1449 " " . $ilDB->equals("type", $a_type, "text", true);
1450
1451 $ilDB->manipulate($q);
1452 }

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

Referenced by copyCharacteristic().

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

◆ determineTemplateStyleClassType()

ilObjStyleSheet::determineTemplateStyleClassType (   $t,
  $k 
)

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

2471 {
2472 return self::$templates[$t][$k];
2473 }

References $t.

◆ do_3_10_CharMigration()

ilObjStyleSheet::do_3_10_CharMigration (   $a_id = "")

This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingStyleCharacteristics()

Any changes here may also be interesting there.

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

2664 {
2665 $ilDB = $this->db;
2666
2667 $add_str = "";
2668 if ($a_id != "") {
2669 $add_str = " AND style_id = " . $ilDB->quote($a_id, "integer");
2670 }
2671
2672 $set = $ilDB->query($q = "SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE " .
2673 $ilDB->equals("type", "", "text", true) . " " . $add_str);
2674
2675 while ($rec = $ilDB->fetchAssoc($set)) {
2676 // derive types from tag
2677 $types = array();
2678 switch ($rec["tag"]) {
2679 case "div":
2680 case "p":
2681 if (in_array($rec["class"], array("Headline3", "Headline1",
2682 "Headline2", "TableContent", "List", "Standard", "Remark",
2683 "Additional", "Mnemonic", "Citation", "Example"))) {
2684 $types[] = "text_block";
2685 }
2686 if (in_array($rec["class"], array("Block", "Remark",
2687 "Additional", "Mnemonic", "Example", "Excursus", "Special"))) {
2688 $types[] = "section";
2689 }
2690 if (in_array($rec["class"], array("Page", "Footnote", "PageTitle", "LMNavigation"))) {
2691 $types[] = "page";
2692 }
2693 break;
2694
2695 case "td":
2696 $types[] = "table_cell";
2697 break;
2698
2699 case "a":
2700 if (in_array($rec["class"], array("ExtLink", "IntLink", "FootnoteLink"))) {
2701 $types[] = "link";
2702 }
2703 break;
2704
2705 case "span":
2706 $types[] = "text_inline";
2707 break;
2708
2709 case "table":
2710 $types[] = "table";
2711 break;
2712 }
2713
2714 // check if style_char set exists
2715 foreach ($types as $t) {
2716 // check if second type already exists
2717 $set4 = $ilDB->queryF(
2718 "SELECT * FROM style_char " .
2719 " WHERE style_id = %s AND type = %s AND characteristic = %s",
2720 array("integer", "text", "text"),
2721 array($rec["style_id"], $t, $rec["class"])
2722 );
2723 if ($rec4 = $ilDB->fetchAssoc($set4)) {
2724 // ok
2725 } else {
2726 //echo "<br>1-".$rec["style_id"]."-".$t."-".$rec["class"]."-";
2727 $ilDB->manipulateF(
2728 "INSERT INTO style_char " .
2729 " (style_id, type, characteristic) VALUES " .
2730 " (%s,%s,%s) ",
2731 array("integer", "text", "text"),
2732 array($rec["style_id"], $t, $rec["class"])
2733 );
2734 }
2735 }
2736
2737 // update types
2738 if ($rec["type"] == "") {
2739 if (count($types) > 0) {
2740 $ilDB->manipulateF(
2741 "UPDATE style_parameter SET type = %s " .
2742 " WHERE style_id = %s AND class = %s AND " . $ilDB->equals("type", "", "text", true),
2743 array("text", "integer", "text"),
2744 array($types[0], $rec["style_id"], $rec["class"])
2745 );
2746 //echo "<br>3-".$types[0]."-".$rec["style_id"]."-".$rec["class"]."-";
2747
2748 // links extra handling
2749 if ($types[0] == "link") {
2750 $ilDB->manipulateF(
2751 "UPDATE style_parameter SET type = %s " .
2752 " WHERE style_id = %s AND (class = %s OR class = %s) AND " . $ilDB->equals("type", "", "text", true),
2753 array("text", "integer", "text", "text"),
2754 array($types[0], $rec["style_id"], $rec["class"] . ":visited",
2755 $rec["class"] . ":hover")
2756 );
2757 }
2758 }
2759
2760 if (count($types) == 2) {
2761 // select all records of first type and add second type
2762 // records if necessary.
2763 $set2 = $ilDB->queryF(
2764 "SELECT * FROM style_parameter " .
2765 " WHERE style_id = %s AND class = %s AND type = %s",
2766 array("integer", "text", "text"),
2767 array($rec["style_id"], $rec["class"], $types[0])
2768 );
2769 while ($rec2 = $ilDB->fetchAssoc($set2)) {
2770 // check if second type already exists
2771 $set3 = $ilDB->queryF(
2772 "SELECT * FROM style_parameter " .
2773 " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2774 array("integer", "text", "text", "text", "text"),
2775 array($rec["style_id"], $rec["tag"], $rec["class"], $types[1], $rec["parameter"])
2776 );
2777 if ($rec3 = $ilDB->fetchAssoc($set3)) {
2778 // ok
2779 } else {
2780 $nid = $ilDB->nextId("style_parameter");
2781 $ilDB->manipulateF(
2782 "INSERT INTO style_parameter " .
2783 " (id, style_id, tag, class, parameter, value, type) VALUES " .
2784 " (%s, %s,%s,%s,%s,%s,%s) ",
2785 array("integer", "integer", "text", "text", "text", "text", "text"),
2786 array($nid, $rec2["style_id"], $rec2["tag"], $rec2["class"],
2787 $rec2["parameter"], $rec2["value"], $types[1])
2788 );
2789 }
2790 }
2791 }
2792 }
2793 }
2794 }

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

Referenced by do_3_10_Migration().

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

2602 {
2603 $ilDB = $this->db;
2604
2605 $this->do_3_9_Migration($this->getId());
2606
2607 //include_once("./Services/Migration/DBUpdate_1385/classes/class.ilStyleMigration.php");
2608 //ilStyleMigration::addMissingStyleCharacteristics($this->getId());
2609
2610 $this->do_3_10_CharMigration($this->getId());
2611
2612 // style_char: type for characteristic
2613 $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?" .
2614 " AND style_id = ? ", array("text", "text", "integer"));
2615 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2616 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2617 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2618 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2619 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2620 $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2621
2622 // style_parameter: type for class
2623 $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?" .
2624 " AND style_id = ? ", array("text", "text", "integer"));
2625 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2626 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2627 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2628 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2629 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2630 $ilDB->execute($st, array("table", "Page", $this->getId()));
2631
2632 $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?" .
2633 " AND style_id = ? ", array("text", "text", "integer"));
2634 $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2635
2636 // style_char: characteristic for characteristic
2637 $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?" .
2638 " AND style_id = ? ", array("text", "text", "integer"));
2639 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2640 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2641
2642 // style_parameter: class for class
2643 $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?" .
2644 " AND style_id = ? ", array("text", "text", "integer"));
2645 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2646 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2647
2648 // force rewriting of container style
2649 $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?" .
2650 " AND style_id = ? ", array("text", "integer"));
2651 $ilDB->execute($st, array("page_cont", $this->getId()));
2652 $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?" .
2653 " AND style_id = ? ", array("text", "integer"));
2654 $ilDB->execute($st, array("page_cont", $this->getId()));
2655 }
do_3_9_Migration($a_id)
Migrate old 3.9 styles.
do_3_10_CharMigration($a_id="")
This is more or less a copy of Services/Migration/DBUpdate_1385/classes ilStyleMigration->addMissingS...

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

Referenced by createFromXMLFile().

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

◆ do_3_9_Migration()

ilObjStyleSheet::do_3_9_Migration (   $a_id)

Migrate old 3.9 styles.

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

2800 {
2801 $ilDB = $this->db;
2802
2803 $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2804 $pars = array("margin-top", "margin-bottom");
2805
2806 foreach ($classes as $curr_class) {
2807 foreach ($pars as $curr_par) {
2808 $res2 = $ilDB->queryF(
2809 "SELECT id FROM style_parameter WHERE style_id = %s" .
2810 " AND tag = %s AND class= %s AND parameter = %s",
2811 array("integer", "text", "text", "text"),
2812 array($a_id, "p", $curr_class, $curr_par)
2813 );
2814 if ($row2 = $ilDB->fetchAssoc($res2)) {
2815 $ilDB->manipulateF(
2816 "UPDATE style_parameter SET value= %s WHERE id = %s",
2817 array("text", "integer"),
2818 array("10px", $row2["id"])
2819 );
2820 } else {
2821 $nid = $ilDB->nextId("style_parameter");
2822 $ilDB->manipulateF(
2823 "INSERT INTO style_parameter " .
2824 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2825 array("integer", "integer", "text", "text", "text", "text"),
2826 array($nid, $a_id, "div", $curr_class, $curr_par, "10px")
2827 );
2828 }
2829 }
2830 }
2831
2832 $ilDB->manipulateF(
2833 "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2834 array("text", "text", "integer"),
2835 array("div", "p", $a_id)
2836 );
2837 }

References ilObject\$db, and $ilDB.

Referenced by do_3_10_Migration().

+ Here is the caller graph for this function:

◆ export()

ilObjStyleSheet::export ( )

Create export file.

Returns
string local file name of export file

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

2114 {
2115 $this->cleanExportDirectory();
2116 $ex_dir = $this->createExportDirectory();
2117 $this->createExportSubDirectory();
2118 $this->exportXML($ex_dir . "/" . $this->getExportSubDir());
2119 //echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
2121 $this->getImagesDirectory(),
2122 $ex_dir . "/" . $this->getExportSubDir() . "/images"
2123 );
2124 if (is_file($ex_dir . "/" . $this->getExportSubDir() . ".zip")) {
2125 unlink($ex_dir . "/" . $this->getExportSubDir() . ".zip");
2126 }
2128 $ex_dir . "/" . $this->getExportSubDir(),
2129 $ex_dir . "/" . $this->getExportSubDir() . ".zip"
2130 );
2131
2132 return $ex_dir . "/" . $this->getExportSubDir() . ".zip";
2133 }
exportXML($a_dir)
export style xml file to directory
cleanExportDirectory()
Clear export directory.
createExportSubDirectory()
Create export directory.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file

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

+ Here is the call graph for this function:

◆ exportXML()

ilObjStyleSheet::exportXML (   $a_dir)

export style xml file to directory

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

2139 {
2140 $file = $a_dir . "/style.xml";
2141
2142 // open file
2143 if (!($fp = @fopen($file, "w"))) {
2144 die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
2145 " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
2146 }
2147
2148 // set file permissions
2149 chmod($file, 0770);
2150
2151 // write xml data into the file
2152 fwrite($fp, $this->getXML());
2153
2154 // close file
2155 fclose($fp);
2156 }
getXML()
get xml representation of style object todo: add mq_id

References $file, and getXML().

Referenced by export().

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

◆ getAvailableParameters()

static ilObjStyleSheet::getAvailableParameters ( )
static

Get available parameters.

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

2484 {
2485 $pars = array();
2486 foreach (self::$parameter as $p => $v) {
2487 $pars[$p] = $v["values"];
2488 }
2489
2490 return $pars;
2491 }

Referenced by addParameter().

+ Here is the caller graph for this function:

◆ getCharacteristics()

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

Get characteristics.

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

1103 {
1104 $chars = array();
1105
1106 if ($a_type == "") {
1107 $chars = $this->chars;
1108 }
1109 if (is_array($this->chars_by_type[$a_type])) {
1110 foreach ($this->chars_by_type[$a_type] as $c) {
1111 if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
1112 $chars[] = $c;
1113 }
1114 }
1115 }
1116
1117 if ($a_no_hidden) {
1118 foreach ($chars as $k => $char) {
1119 if ($a_type == "" && $this->hidden_chars[$char["type"] . ":" . $char["class"]]) {
1120 unset($chars[$k]);
1121 } elseif ($this->hidden_chars[$a_type . ":" . $char]) {
1122 unset($chars[$k]);
1123 }
1124 }
1125 }
1126
1127 return $chars;
1128 }

References $a_type.

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName (   $a_name)

Remove a color.

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

2959 {
2960 $ilDB = $this->db;
2961
2962 $pos = strpos($a_name, "(");
2963 if ($pos > 0) {
2964 $a_i = substr($a_name, $pos + 1);
2965 $a_i = str_replace(")", "", $a_i);
2966 $a_name = substr($a_name, 0, $pos);
2967 }
2968
2969 $set = $ilDB->query("SELECT color_code FROM style_color WHERE " .
2970 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2971 " color_name = " . $ilDB->quote($a_name, "text"));
2972 if ($rec = $ilDB->fetchAssoc($set)) {
2973 if ($a_i == "") {
2974 return "#" . $rec["color_code"];
2975 } else {
2977 $rec["color_code"],
2978 (int) $a_i
2979 );
2980 }
2981 }
2982 }
static _getColorFlavor($a_rgb, $a_i)
Get color flavor.

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

Referenced by writeCSSFile().

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

2847 {
2848 $ilDB = $this->db;
2849
2850 $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2851 "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2852 "ORDER BY color_name");
2853
2854 $colors = array();
2855 while ($rec = $ilDB->fetchAssoc($set)) {
2856 $colors[] = array(
2857 "name" => $rec["color_name"],
2858 "code" => $rec["color_code"]
2859 );
2860 }
2861
2862 return $colors;
2863 }

References ilObject\$db, and $ilDB.

Referenced by getXML().

+ Here is the caller graph for this function:

◆ getContentPrintStyle()

static ilObjStyleSheet::getContentPrintStyle ( )
static

get content print style

static

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

1827 {
1828 return "./Services/COPage/css/print_content.css";
1829 }

Referenced by ilObjPortfolioGUI\printView(), ilGlossaryPresentationGUI\printView(), ilObjWikiGUI\printViewObject(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ getContentStylePath()

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

get content style path

static (to avoid full reading)

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

1781 {
1782 global $DIC;
1783
1784 $ilSetting = $DIC->settings();
1785
1786 $random = new \ilRandom();
1787 $rand = $random->int(1, 999999);
1788
1789
1790 // check global fixed content style
1791 $fixed_style = $ilSetting->get("fixed_content_style_id");
1792 if ($fixed_style > 0) {
1793 $a_style_id = $fixed_style;
1794 }
1795
1796 // check global default style
1797 if ($a_style_id <= 0) {
1798 $a_style_id = $ilSetting->get("default_content_style_id");
1799 }
1800
1801 if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
1802 // check whether file is up to date
1803 if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
1804 $style = new ilObjStyleSheet($a_style_id);
1805 $style->writeCSSFile();
1806 }
1807
1808 $path = ilUtil::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css";
1809 if ($add_random) {
1810 $path .= "?dummy=$rand";
1811 }
1812 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
1814
1815 return $path;
1816 } else { // todo: work this out
1817 return "./Services/COPage/css/content.css";
1818 }
1819 }
static _lookupUpToDate($a_id)
Looup up to date.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static signFile($path_to_file)

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

Referenced by ilBlogPostingGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilImprintGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilPageObjectGUI\displayMedia(), ilPCDataTableGUI\editData(), ilObjCategoryGUI\executeCommand(), ilLOEditorGUI\executeCommand(), ilTermDefinitionEditorGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilObjRootFolderGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilAssQuestionHintsGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilContainerStartObjectsGUI\executeCommand(), ilScormExportUtil\exportContentCSS(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilStartUpGUI\getLoginPageEditorHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilLMPresentationGUI\ilGlossary(), ilLMPresentationGUI\ilMedia(), ilLMPresentationGUI\ilPage(), ilObjStyleSheetGUI\includeCSS(), ilAssQuestionPreviewGUI\initStyleSheets(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\listDefinitions(), ilGlossaryPresentationGUI\listTermByGiven(), ilLMEditorGUI\main_header(), ilGlossaryPresentationGUI\media(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestServiceGUI\outCorrectSolution(), ilObjStyleSheetGUI\outputTagStyleEditScreen(), ilTestPlayerAbstractGUI\populateContentStyleBlock(), ilObjPortfolioGUI\printView(), ilObjStyleSheetGUI\propertiesObject(), ilSCORM2004ScoGUI\sco_preview(), ilSCORM2004NodeGUI\setContentStyle(), ilObjBlogGUI\setContentStyleSheet(), ilObjGlossaryGUI\setContentStyleSheet(), ilObjPortfolioBaseGUI\setContentStyleSheet(), ilObjWikiGUI\setContentStyleSheet(), ilPCParagraphGUI\setStyle(), ilLMPresentationGUI\showDownloadList(), ilAssQuestionFeedbackEditingGUI\showFeedbackFormCmd(), ilObjMediaPoolGUI\showMedia(), ilLMPresentationGUI\showMessageScreen(), ilContainerObjectiveGUI\showObjectives(), ilMediaPoolPageGUI\showPage(), ilObjMediaPoolGUI\showPage(), ilPageObjectGUI\showPage(), ilLMPresentationGUI\showPreconditionsOfPage(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showPrintViewSelection(), ilLMPresentationGUI\showTableOfContents(), and ilContObjectManifestBuilder\writeResources().

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

◆ getEffectiveContentStyleId()

static ilObjStyleSheet::getEffectiveContentStyleId (   $a_style_id,
  $a_type = "" 
)
static

Get effective Style Id.

Parameters
integerstyle id that may be set in object
stringobject type

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

1738 {
1739 global $DIC;
1740
1741 $ilSetting = $DIC->settings();
1742
1743 // check global fixed content style
1744 $fixed_style = $ilSetting->get("fixed_content_style_id");
1745 if ($fixed_style > 0) {
1746 $a_style_id = $fixed_style;
1747 }
1748
1749 // check global default style
1750 if ($a_style_id <= 0) {
1751 $a_style_id = $ilSetting->get("default_content_style_id");
1752 }
1753
1754 if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty") {
1755 return $a_style_id;
1756 }
1757
1758 return 0;
1759 }
static _lookupType($a_id, $a_reference=false)
lookup object type

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

Referenced by ilMediaPoolPageGUI\__construct(), ilLMPresentationGUI\basicPageGuiInit(), ilObjBlogGUI\buildExportFile(), ilPortfolioHTMLExport\buildExportFile(), ilWikiHTMLExport\buildExportFile(), ilObjBlogGUI\executeCommand(), ilLOEditorGUI\executeCommand(), ilTermDefinitionEditorGUI\executeCommand(), ilLMPageObjectGUI\executeCommand(), ilSCORM2004PageNodeGUI\executeCommand(), ilObjSystemFolderGUI\executeCommand(), ilObjWikiGUI\executeCommand(), ilContainerStartObjectsGUI\executeCommand(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilObjPortfolioBaseGUI\handlePageCall(), ilObjSCORM2004LearningModule\prepareHTMLExporter(), ilContainerObjectiveGUI\renderObjective(), ilDclDetailedViewGUI\renderRecord(), ilLMPresentationGUI\showPrintView(), and ilObjWikiGUI\viewPageObject().

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

◆ getExportSubDir()

ilObjStyleSheet::getExportSubDir ( )

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

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

2100 {
2101 if ($this->export_sub_dir == "") {
2102 return "sty_" . $this->getId();
2103 } else {
2104 return $this->export_sub_dir;
2105 }
2106 }

References ilObject\getId().

Referenced by createExportSubDirectory(), and export().

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

◆ getHideStatus()

ilObjStyleSheet::getHideStatus (   $a_type,
  $a_char 
)

Get characteristic hide status.

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

1159 {
1160 $ilDB = $this->db;
1161
1162 $set = $ilDB->query(
1163 "SELECT hide FROM style_char " .
1164 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1165 " type = " . $ilDB->quote($a_type, "text") . " AND " .
1166 " characteristic = " . $ilDB->quote($a_char, "text")
1167 );
1168 $rec = $ilDB->fetchAssoc($set);
1169
1170 return $rec["hide"];
1171 }

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

◆ getImages()

ilObjStyleSheet::getImages ( )

Get images of style.

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

1321 {
1322 $dir = $this->getImagesDirectory();
1323 $images = array();
1324 if (is_dir($dir)) {
1325 $entries = ilUtil::getDir($dir);
1326 foreach ($entries as $entry) {
1327 if (substr($entry["entry"], 0, 1) == ".") {
1328 continue;
1329 }
1330 if ($entry["type"] != "dir") {
1331 $images[] = $entry;
1332 }
1333 }
1334 }
1335
1336 return $images;
1337 }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory

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

+ Here is the call graph for this function:

◆ getImagesDirectory()

ilObjStyleSheet::getImagesDirectory ( )

Get images directory.

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

1295 {
1297 }

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

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

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

3189 {
3190 $ilDB = $this->db;
3191
3192 $set = $ilDB->query(
3193 "SELECT max(order_nr) mnr FROM sty_media_query " .
3194 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer")
3195 );
3196 $rec = $ilDB->fetchAssoc($set);
3197
3198 return (int) $rec["mnr"];
3199 }

References ilObject\$db, and $ilDB.

Referenced by addMediaQuery().

+ Here is the caller graph for this function:

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

Get colors of style.

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

3145 {
3146 $ilDB = $this->db;
3147
3148 $set = $ilDB->query("SELECT * FROM sty_media_query WHERE " .
3149 "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
3150 "ORDER BY order_nr");
3151
3152 $mq = array();
3153 while ($rec = $ilDB->fetchAssoc($set)) {
3154 $mq[] = $rec;
3155 }
3156
3157 return $mq;
3158 }

References ilObject\$db, and $ilDB.

Referenced by saveMediaQueryOrder(), and writeCSSFile().

+ Here is the caller graph for this function:

◆ getMediaQueryForId()

ilObjStyleSheet::getMediaQueryForId (   $a_id)

Get media query for id.

Parameters

return

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

3225 {
3226 $ilDB = $this->db;
3227
3228 $set = $ilDB->query(
3229 "SELECT * FROM sty_media_query " .
3230 " WHERE id = " . $ilDB->quote($a_id, "integer")
3231 );
3232 return $ilDB->fetchAssoc($set);
3233 }

References ilObject\$db, and $ilDB.

◆ getMetaData()

& ilObjStyleSheet::getMetaData ( )

get meta data object

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

862 {
863 return $this->meta_data;
864 }

◆ getParametersOfClass()

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

Get parameters of class.

Parameters

return

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

1768 {
1769 if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1770 return $this->style_class[$a_type][$a_class][$a_mq_id];
1771 }
1772 return array();
1773 }

References $a_type.

◆ getPlaceHolderStylePath()

static ilObjStyleSheet::getPlaceHolderStylePath ( )
static

get placeholder style path (for Page Layouts)

static

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

1847 {
1848 return "./Services/COPage/css/placeholder.css";
1849 }

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

+ Here is the caller graph for this function:

◆ getRefId()

ilObjStyleSheet::getRefId ( )

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

Reimplemented from ilObject.

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

581 {
582 return "";
583 //$this->ilias->raiseError("Operation ilObjStyleSheet::getRefId() not allowed.",$this->ilias->error_obj->FATAL);
584 }

◆ getScope()

ilObjStyleSheet::getScope ( )

Get scope.

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

630 {
631 return $this->scope;
632 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getStyle()

ilObjStyleSheet::getStyle ( )

todo: bad style! should return array of objects, not multi-dim-arrays

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

1944 {
1945 return $this->style;
1946 }

References $style.

Referenced by writeCSSFile().

+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

2333 {
2334 $groups = array();
2335
2336 foreach (self::$parameter as $parameter => $props) {
2337 $groups[$props["group"]][] = $parameter;
2338 }
2339 return $groups;
2340 }

References $parameter.

◆ getSyntaxStylePath()

static ilObjStyleSheet::getSyntaxStylePath ( )
static

get syntax style path

static

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

1837 {
1838 return "./Services/COPage/css/syntaxhighlight.css";
1839 }

Referenced by ilWikiPageGUI\__construct(), ilBlogPostingGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilImprintGUI\__construct(), ilDclDetailedViewGUI\__construct(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilObjGlossaryGUI\confirmDefinitionDeletion(), ilTermDefinitionEditorGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilObjGlossary\exportHTML(), ilObjContentObject\exportHTML(), ilCOPageHTMLExport\exportStyles(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilStartUpGUI\getLoginPageEditorHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilLMPresentationGUI\ilGlossary(), ilLMPresentationGUI\ilPage(), ilAssQuestionPreviewGUI\initStyleSheets(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\listDefinitions(), ilGlossaryPresentationGUI\listTermByGiven(), ilLMEditorGUI\main_header(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestServiceGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\populateSyntaxStyleBlock(), ilObjPortfolioGUI\printView(), ilObjWikiGUI\printViewObject(), ilSCORM2004NodeGUI\setContentStyle(), ilContainerObjectiveGUI\showObjectives(), ilMediaPoolPageGUI\showPage(), ilObjMediaPoolGUI\showPage(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ getTemplate()

ilObjStyleSheet::getTemplate (   $a_t_id)

Get template.

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

3423 {
3424 $ilDB = $this->db;
3425
3426 $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3427 "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
3428 " AND id = " . $ilDB->quote($a_t_id, "integer"));
3429
3430 if ($rec = $ilDB->fetchAssoc($set)) {
3431 $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3432
3433 $template = $rec;
3434 return $template;
3435 }
3436 return array();
3437 }
getTemplateClasses($a_tid)
Get template classes.
$template

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

+ Here is the call graph for this function:

◆ getTemplateClasses()

ilObjStyleSheet::getTemplateClasses (   $a_tid)

Get template classes.

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

3309 {
3310 $ilDB = $this->db;
3311 $set = $ilDB->query("SELECT * FROM style_template_class WHERE " .
3312 "template_id = " . $ilDB->quote($a_tid, "integer"));
3313
3314 $class = array();
3315 while ($rec = $ilDB->fetchAssoc($set)) {
3316 $key = $rec["class_type"];
3317 $class[$key] = $rec["class"];
3318 }
3319
3320 return $class;
3321 }
$key
Definition: croninfo.php:18

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

Referenced by getTemplate(), and getTemplates().

+ Here is the caller graph for this function:

◆ getTemplates()

ilObjStyleSheet::getTemplates (   $a_type)

Get table templates of style.

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

3288 {
3289 $ilDB = $this->db;
3290
3291 $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3292 "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3293 "temp_type = " . $ilDB->quote($a_type, "text") . " " .
3294 "ORDER BY name");
3295
3296 $templates = array();
3297 while ($rec = $ilDB->fetchAssoc($set)) {
3298 $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3299 $templates[] = $rec;
3300 }
3301
3302 return $templates;
3303 }

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

Referenced by getTemplateXML(), and getXML().

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

3470 {
3471 $ilDB = $this->db;
3472
3473 $tag = "<StyleTemplates>";
3474
3475 $ttypes = array("table", "vaccordion", "haccordion", "carousel");
3476
3477 foreach ($ttypes as $ttype) {
3478 $ts = $this->getTemplates($ttype);
3479
3480 foreach ($ts as $t) {
3482 /*$atts = array("table" => "TableClass",
3483 "caption" => "CaptionClass",
3484 "row_head" => "RowHeadClass",
3485 "row_foot" => "RowFootClass",
3486 "col_head" => "ColHeadClass",
3487 "col_foot" => "ColFootClass",
3488 "odd_row" => "OddRowClass",
3489 "even_row" => "EvenRowClass",
3490 "odd_col" => "OddColClass",
3491 "even_col" => "EvenColClass");*/
3492 $c = $t["classes"];
3493
3494 $tag.= '<StyleTemplate Name="' . $t["name"] . '">';
3495
3496 foreach ($atts as $type => $t) {
3497 if ($c[$type] != "") {
3498 $tag.= '<StyleClass Type="' . $type . '" Value="' . $c[$type] . '" />';
3499 }
3500 }
3501
3502 $tag.= "</StyleTemplate>";
3503 }
3504 }
3505
3506 $tag.= "</StyleTemplates>";
3507
3508 //echo htmlentities($tag);
3509 return $tag;
3510 }
getTemplates($a_type)
Get table templates of style.

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

+ Here is the call graph for this function:

◆ getThumbnailsDirectory()

ilObjStyleSheet::getThumbnailsDirectory ( )

Get thumbnails directory.

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

1312 {
1313 return $this->getImagesDirectory() .
1314 "/thumbnails";
1315 }

References getImagesDirectory().

Referenced by deleteImage(), and uploadImage().

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

◆ getUpToDate()

ilObjStyleSheet::getUpToDate ( )

Get up to date.

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

614 {
615 return $this->up_to_date;
616 }

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

1973 {
1974 $xml.= "<StyleSheet>\n";
1975
1976 // title and description
1977 $xml.= "<Title>" . $this->handleXmlString($this->getTitle()) . "</Title>";
1978 $xml.= "<Description>" . $this->handleXmlString($this->getDescription()) . "</Description>\n";
1979
1980 // style classes
1981 foreach ($this->chars as $char) {
1982 $xml.= "<Style Tag=\"" . ilObjStyleSheet::_determineTag($char["type"]) .
1983 "\" Type=\"" . $char["type"] . "\" Class=\"" . $char["class"] . "\">\n";
1984 foreach ($this->style as $style) {
1985 if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"]) {
1986 foreach ($style as $tag) {
1987 $xml.="<StyleParameter Name=\"" . $tag["parameter"] . "\" Value=\"" . $tag["value"] . "\" Custom=\"" . $tag["custom"] . "\" />\n";
1988 }
1989 }
1990 }
1991 $xml.= "</Style>\n";
1992 }
1993
1994 // colors
1995 foreach ($this->getColors() as $color) {
1996 $xml.="<StyleColor Name=\"" . $color["name"] . "\" Code=\"" . $color["code"] . "\"/>\n";
1997 }
1998
1999 // templates
2001 foreach ($tcts as $tct => $v) {
2002 $ts = $this->getTemplates($tct);
2003
2004 foreach ($ts as $t) {
2005 $xml.="<StyleTemplate Type=\"" . $tct . "\" Name=\"" . $t["name"] . "\">\n";
2006 foreach ($t["classes"] as $ct => $c) {
2007 if ($c != "") {
2008 $xml.="<StyleTemplateClass ClassType=\"" . $ct . "\" Class=\"" . $c . "\"/>\n";
2009 }
2010 }
2011 $xml.="</StyleTemplate>\n";
2012 }
2013 }
2014
2015
2016 $xml.= "</StyleSheet>";
2017 //echo "<pre>".htmlentities($xml)."</pre>"; exit;
2018 return $xml;
2019 }
handleXmlString($a_str)
Handle xml strin.
getColors()
Get colors of style.
getDescription()
get object description
getTitle()
get object title @access public
$xml
Definition: metadata.php:240

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

Referenced by exportXML().

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

◆ handleXmlString()

ilObjStyleSheet::handleXmlString (   $a_str)

Handle xml strin.

Parameters

return

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

1964 {
1965 return str_replace("&", "&amp;", $a_str);
1966 }

Referenced by getXML().

+ Here is the caller graph for this function:

◆ ilClone()

ilObjStyleSheet::ilClone ( )

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

@access public

Returns
integer new obj id

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

1180 {
1181 $lng = $this->lng;
1182
1183 $lng->loadLanguageModule("style");
1184
1185 $new_obj = new ilObjStyleSheet();
1186 $new_obj->setTitle($this->getTitle() . " (" . $lng->txt("sty_acopy") . ")");
1187 $new_obj->setType($this->getType());
1188 $new_obj->setDescription($this->getDescription());
1189 $new_obj->create($this->getId());
1190
1191 $new_obj->writeStyleSetting(
1192 "disable_auto_margins",
1193 $this->lookupStyleSetting("disable_auto_margins")
1194 );
1195
1196 return $new_obj->getId();
1197 }
lookupStyleSetting($a_name)
Lookup style setting.
getType()
get object type @access public

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

+ Here is the call graph for this function:

◆ import()

ilObjStyleSheet::import (   $a_file)

Import.

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

2192 {
2193 parent::create();
2194
2195 $im_dir = $this->createImportDirectory();
2196
2197 // handle uploaded files
2198 if (is_array($a_file)) {
2199 ilUtil::moveUploadedFile(
2200 $a_file["tmp_name"],
2201 $a_file["name"],
2202 $im_dir . "/" . $a_file["name"]
2203 );
2204 $file_name = $a_file["name"];
2205 } else { // handle not directly uploaded files
2206 $pi = pathinfo($a_file);
2207 $file_name = $pi["basename"];
2208 copy($a_file, $im_dir . "/" . $file_name);
2209 }
2210 $file = pathinfo($file_name);
2211
2212 // unzip file
2213 if (strtolower($file["extension"] == "zip")) {
2214 ilUtil::unzip($im_dir . "/" . $file_name);
2215 $subdir = basename($file["basename"], "." . $file["extension"]);
2216 if (!is_dir($im_dir . "/" . $subdir)) {
2217 $subdir = "style"; // check style subdir
2218 }
2219 $xml_file = $im_dir . "/" . $subdir . "/style.xml";
2220 } else { // handle xml file directly (old style)
2221 $xml_file = $im_dir . "/" . $file_name;
2222 }
2223
2224 // load information from xml file
2225 //echo "-$xml_file-";
2226 $this->createFromXMLFile($xml_file, true);
2227
2228 // copy images
2229 $this->createImagesDirectory();
2230 if (is_dir($im_dir . "/" . $subdir . "/images")) {
2232 $im_dir . "/" . $subdir . "/images",
2233 $this->getImagesDirectory()
2234 );
2235 }
2236
2238 $this->read();
2239 $this->writeCSSFile();
2240 }
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
createImportDirectory()
Create import directory.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file

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

+ Here is the call graph for this function:

◆ isCoreStyle()

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

Is core style.

Parameters

return

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

2442 {
2443 foreach (self::$core_styles as $s) {
2444 if ($s["type"] == $a_type && $s["class"] == $a_class) {
2445 return true;
2446 }
2447 }
2448 return false;
2449 }

References $a_type, and $s.

◆ lookupObjectForStyle()

static ilObjStyleSheet::lookupObjectForStyle (   $a_style_id)
static

Lookup object style.

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

3666 {
3667 global $DIC;
3668
3669 $ilDB = $DIC->database();
3670
3671 $obj_ids = array();
3672 if (ilObject::_lookupType($a_style_id) == "sty") {
3673 $set = $ilDB->query(
3674 "SELECT DISTINCT obj_id FROM style_usage " .
3675 " WHERE style_id = " . $ilDB->quote($a_style_id, "integer")
3676 );
3677
3678 while ($rec = $ilDB->fetchAssoc($set)) {
3679 $obj_ids[] = $rec["obj_id"];
3680 }
3681 }
3682 return $obj_ids;
3683 }

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

Referenced by _getClonableContentStyles().

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

◆ lookupObjectStyle()

static ilObjStyleSheet::lookupObjectStyle (   $a_obj_id)
static

Lookup object style.

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

3644 {
3645 global $DIC;
3646
3647 $ilDB = $DIC->database();
3648
3649 $set = $ilDB->query(
3650 "SELECT style_id FROM style_usage " .
3651 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
3652 );
3653 $rec = $ilDB->fetchAssoc($set);
3654
3655 if (ilObject::_lookupType($rec["style_id"]) == "sty") {
3656 return (int) $rec["style_id"];
3657 }
3658
3659 return 0;
3660 }

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

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

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

◆ lookupStyleSetting()

ilObjStyleSheet::lookupStyleSetting (   $a_name)

Lookup style setting.

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

3609 {
3610 $ilDB = $this->db;
3611
3612 $set = $ilDB->query(
3613 "SELECT value FROM style_setting " .
3614 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
3615 " AND name = " . $ilDB->quote($a_name, "text")
3616 );
3617 $rec = $ilDB->fetchAssoc($set);
3618
3619 return $rec["value"];
3620 }

References ilObject\$db, and $ilDB.

Referenced by ilClone().

+ Here is the caller graph for this function:

◆ lookupTemplateName()

ilObjStyleSheet::lookupTemplateName (   $a_t_id)

Lookup table template name for template ID.

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

3443 {
3444 return self::_lookupTemplateName($a_t_id);
3445 }
static _lookupTemplateName($a_t_id)
Lookup table template name for template ID.

References _lookupTemplateName().

+ Here is the call graph for this function:

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview (   $a_t_id)

Lookup table template preview.

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

3536 {
3537 $ilDB = $this->db;
3538
3539 $set = $ilDB->query("SELECT preview FROM style_template " .
3540 " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3541 if ($rec = $ilDB->fetchAssoc($set)) {
3542 return $rec["preview"];
3543 }
3544
3545 return "";
3546 }

References ilObject\$db, and $ilDB.

◆ putInTree()

ilObjStyleSheet::putInTree (   $a_parent_ref)

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

Reimplemented from ilObject.

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

590 {
591 $this->ilias->raiseError("Operation ilObjStyleSheet::putInTree() not allowed.", $this->ilias->error_obj->FATAL);
592 }

◆ read()

ilObjStyleSheet::read ( )

read style properties

Reimplemented from ilObject.

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

1509 {
1510 $ilDB = $this->db;
1511
1512 parent::read();
1513
1514 $q = "SELECT * FROM style_parameter WHERE style_id = " .
1515 $ilDB->quote($this->getId(), "integer") . " ORDER BY tag, class, type, mq_id ";
1516 $style_set = $ilDB->query($q);
1517 $ctag = "";
1518 $cclass = "";
1519 $ctype = "";
1520 $cmq_id = 0;
1521 $this->style = array();
1522 // workaround for bug #17586, see also http://stackoverflow.com/questions/3066356/multiple-css-classes-properties-overlapping-based-on-the-order-defined
1523 // e.g. ha_iheada must be written after ha_ihead, since they are acting on the same dom node
1524 // styles that must be added at the end
1525 $this->end_styles = array();
1526 while ($style_rec = $ilDB->fetchAssoc($style_set)) {
1527 if ($style_rec["tag"] != $ctag || $style_rec["class"] != $cclass
1528 || $style_rec["type"] != $ctype || $style_rec["mq_id"] != $cmq_id) {
1529 // add current tag array to style array
1530 if (is_array($tag)) {
1531 if (in_array($ctype, array("ha_iheada", "va_iheada"))) {
1532 $this->end_styles[] = $tag;
1533 } else {
1534 $this->style[] = $tag;
1535 }
1536 }
1537 $tag = array();
1538 }
1539 $ctag = $style_rec["tag"];
1540 $cclass = $style_rec["class"];
1541 $ctype = $style_rec["type"];
1542 $cmq_id = $style_rec["mq_id"];
1543 $tag[] = $style_rec;
1544 // added $cmq_id
1545 $this->style_class[$ctype][$cclass][$cmq_id][$style_rec["parameter"]] = $style_rec["value"];
1546 }
1547 if (is_array($tag)) {
1548 $this->style[] = $tag;
1549 }
1550 foreach ($this->end_styles as $s) {
1551 $this->style[] = $s;
1552 }
1553 //var_dump($this->style_class);
1554 $q = "SELECT * FROM style_data WHERE id = " .
1555 $ilDB->quote($this->getId(), "integer");
1556 $res = $ilDB->query($q);
1557 $sty = $ilDB->fetchAssoc($res);
1558 $this->setUpToDate((boolean) $sty["uptodate"]);
1559 $this->setScope($sty["category"]);
1560
1561 // get style characteristics records
1562 $this->chars = array();
1563 $this->chars_by_type = array();
1564 $q = "SELECT * FROM style_char WHERE style_id = " .
1565 $ilDB->quote($this->getId(), "integer") .
1566 " ORDER BY type ASC, characteristic ASC";
1567 $par_set = $ilDB->query($q);
1568 while ($par_rec = $ilDB->fetchAssoc($par_set)) {
1569 $this->chars[] = array("type" => $par_rec["type"], "class" => $par_rec["characteristic"], "hide" => $par_rec["hide"]);
1570 $this->chars_by_type[$par_rec["type"]][] = $par_rec["characteristic"];
1571 if ($par_rec["hide"]) {
1572 $this->hidden_chars[$par_rec["type"] . ":" . $par_rec["characteristic"]] = true;
1573 }
1574 }
1575 // var_dump($this->style); exit;
1576 }
setScope($a_scope)
Set scope.

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

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

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

◆ removeColor()

ilObjStyleSheet::removeColor (   $a_name)

Remove a color.

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

2931 {
2932 $ilDB = $this->db;
2933
2934 $ilDB->manipulate("DELETE FROM style_color WHERE " .
2935 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2936 " color_name = " . $ilDB->quote($a_name, "text"));
2937 }

References ilObject\$db, and $ilDB.

◆ removeTemplate()

ilObjStyleSheet::removeTemplate (   $a_t_id)

Remove table template.

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

3571 {
3572 $ilDB = $this->db;
3573
3574 $ilDB->manipulate("DELETE FROM style_template WHERE " .
3575 " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3576 " id = " . $ilDB->quote($a_t_id, "integer"));
3577
3578 $ilDB->manipulate(
3579 "DELETE FROM style_template_class WHERE " .
3580 "template_id = " . $ilDB->quote($a_t_id, "integer")
3581 );
3582 }

References ilObject\$db, and $ilDB.

◆ replaceStylePar()

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

Set style parameter per tag/class/parameter.

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

1887 {
1888 ilObjStyleSheet::_replaceStylePar($this->getId(), $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id, $a_custom);
1889 }
static _replaceStylePar($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)

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

Referenced by copyCharacteristic(), and updateColor().

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

◆ saveHideStatus()

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

Save characteristic hide status.

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

1143 {
1144 $ilDB = $this->db;
1145
1146 $ilDB->manipulate(
1147 "UPDATE style_char SET " .
1148 " hide = " . $ilDB->quote((int) $a_hide, "integer") .
1149 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1150 " type = " . $ilDB->quote($a_type, "text") . " AND " .
1151 " characteristic = " . $ilDB->quote($a_char, "text")
1152 );
1153 }

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

◆ saveMediaQueryOrder()

ilObjStyleSheet::saveMediaQueryOrder (   $a_order_nr = null)

Save media query order.

Parameters
int$a_order_nrorder nr

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

3258 {
3259 $ilDB = $this->db;
3260
3261 $mqueries = $this->getMediaQueries();
3262 if (is_array($a_order_nr)) {
3263 foreach ($mqueries as $k => $mq) {
3264 $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
3265 }
3266 $mqueries = ilUtil::sortArray($mqueries, "order_nr", "", true);
3267 }
3268 $cnt = 10;
3269 foreach ($mqueries as $mq) {
3270 $ilDB->manipulate(
3271 "UPDATE sty_media_query SET " .
3272 " order_nr = " . $ilDB->quote($cnt, "integer") .
3273 " WHERE id = " . $ilDB->quote($mq["id"], "integer")
3274 );
3275 $cnt+= 10;
3276 }
3277 }
getMediaQueries()
Get colors of style.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

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

Referenced by deleteMediaQuery().

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

◆ setCharacteristics()

ilObjStyleSheet::setCharacteristics (   $a_chars)

Set characteristics.

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

1134 {
1135 $this->chars = $a_chars;
1136 // $this->chars_by_type[$a_type];
1137 }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir (   $a_dir)

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

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

2092 {
2093 $this->export_sub_dir = $a_dir;
2094 }

◆ setRefId()

ilObjStyleSheet::setRefId (   $a_ref_id)

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

Reimplemented from ilObject.

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

573 {
574 $this->ilias->raiseError("Operation ilObjStyleSheet::setRefId() not allowed.", $this->ilias->error_obj->FATAL);
575 }

◆ setScope()

ilObjStyleSheet::setScope (   $a_scope)

Set scope.

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

622 {
623 $this->scope = $a_scope;
624 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle (   $a_style)

set styles

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

1952 {
1953 $this->style = $a_style;
1954 }

◆ setUpToDate()

ilObjStyleSheet::setUpToDate (   $a_up_to_date = true)

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

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

606 {
607 $this->up_to_date = $a_up_to_date;
608 }

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

+ Here is the caller graph for this function:

◆ templateExists()

ilObjStyleSheet::templateExists (   $a_template_name)

Check whether template exists.

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

3407 {
3408 $ilDB = $this->db;
3409
3410 $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3411 "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3412 "name = " . $ilDB->quote($a_template_name, "text"));
3413 if ($rec = $ilDB->fetchAssoc($set)) {
3414 return true;
3415 }
3416 return false;
3417 }

References ilObject\$db, and $ilDB.

◆ update()

ilObjStyleSheet::update ( )

update object in db

@access public

Returns
boolean true on success

Reimplemented from ilObject.

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

1852 {
1853 $ilDB = $this->db;
1854
1856 $this->read(); // this could be done better
1857 $this->writeCSSFile();
1858
1859 $q = "UPDATE style_data " .
1860 "SET category = " . $ilDB->quote((int) $this->getScope(), "integer") .
1861 " WHERE id = " . $ilDB->quote($this->getId(), "integer");
1862 $ilDB->manipulate($q);
1863 }
update($pash, $contents, Config $config)

References ilObject\$db, $ilDB, ilObject\getId(), getScope(), read(), League\Flysystem\Adapter\Polyfill\update(), and writeCSSFile().

Referenced by createFromXMLFile().

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

◆ updateColor()

ilObjStyleSheet::updateColor (   $a_name,
  $a_new_name,
  $a_code 
)

Update color.

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

2884 {
2885 $ilDB = $this->db;
2886
2887 // todo: update names in parameters as well
2888
2889 $ilDB->manipulate("UPDATE style_color SET " .
2890 "color_name = " . $ilDB->quote($a_new_name, "text") . ", " .
2891 "color_code = " . $ilDB->quote($a_code, "text") .
2892 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
2893 " AND color_name = " . $ilDB->quote($a_name, "text"));
2894 ilObjStyleSheet::_writeUpToDate($this->getId(), false);
2895
2896 // rename also the name in the style parameter values
2897 if ($a_name != $a_new_name) {
2898 $set = $ilDB->query("SELECT * FROM style_parameter " .
2899 " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
2900 " AND (" .
2901 " parameter = " . $ilDB->quote("background-color", "text") . " OR " .
2902 " parameter = " . $ilDB->quote("color", "text") . " OR " .
2903 " parameter = " . $ilDB->quote("border-color", "text") . " OR " .
2904 " parameter = " . $ilDB->quote("border-top-color", "text") . " OR " .
2905 " parameter = " . $ilDB->quote("border-bottom-color", "text") . " OR " .
2906 " parameter = " . $ilDB->quote("border-left-color", "text") . " OR " .
2907 " parameter = " . $ilDB->quote("border-right-color", "text") .
2908 ")");
2909 while ($rec = $ilDB->fetchAssoc($set)) {
2910 if ($rec["value"] == "!" . $a_name ||
2911 is_int(strpos($rec["value"], "!" . $a_name . "("))) {
2912 // parameter is based on color -> rename it
2913 $this->replaceStylePar(
2914 $rec["tag"],
2915 $rec["class"],
2916 $rec["parameter"],
2917 str_replace($a_name, $a_new_name, $rec["value"]),
2918 $rec["type"],
2919 $rec["mq_id"],
2920 $rec["custom"]
2921 );
2922 }
2923 }
2924 }
2925 }

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

+ Here is the call graph for this function:

◆ updateMediaQuery()

ilObjStyleSheet::updateMediaQuery (   $a_id,
  $a_mquery 
)

Update media query.

Parameters
int$a_idid
string$a_mquerymedia query

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

3208 {
3209 $ilDB = $this->db;
3210
3211 $ilDB->manipulate(
3212 "UPDATE sty_media_query SET " .
3213 " mquery = " . $ilDB->quote($a_mquery, "text") .
3214 " WHERE id = " . $ilDB->quote($a_id, "integer")
3215 );
3216 }

References ilObject\$db, and $ilDB.

◆ updateStyleParameter()

ilObjStyleSheet::updateStyleParameter (   $a_id,
  $a_value 
)

update style parameter per id

Parameters
int$a_idstyle parameter id
int$a_idstyle parameter value

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

1872 {
1873 $ilDB = $this->db;
1874
1875 $q = "UPDATE style_parameter SET VALUE = " .
1876 $ilDB->quote($a_value, "text") . " WHERE id = " .
1877 $ilDB->quote($a_id, "integer");
1878 $style_set = $ilDB->manipulate($q);
1879 }

References ilObject\$db, and $ilDB.

◆ updateTemplate()

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

Update table template.

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

3364 {
3365 $ilDB = $this->db;
3366
3367 $ilDB->manipulate("UPDATE style_template SET " .
3368 "name = " . $ilDB->quote($a_name, "text") .
3369 " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3370
3371 $ilDB->manipulate(
3372 "DELETE FROM style_template_class WHERE " .
3373 "template_id = " . $ilDB->quote($a_t_id, "integer")
3374 );
3375 foreach ($a_classes as $t => $c) {
3376 $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3377 "(template_id, class_type, class)" .
3378 " VALUES (" .
3379 $ilDB->quote($a_t_id, "integer") . "," .
3380 $ilDB->quote($t, "text") . "," .
3381 $ilDB->quote($c, "text") .
3382 ")");
3383 }
3384 }

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

◆ uploadImage()

ilObjStyleSheet::uploadImage (   $a_file)

Upload image.

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

1343 {
1344 $this->createImagesDirectory();
1345 @ilUtil::moveUploadedFile(
1346 $a_file["tmp_name"],
1347 $a_file["name"],
1348 $this->getImagesDirectory() . "/" . $a_file["name"]
1349 );
1351 $this->getImagesDirectory() . "/" . $a_file["name"],
1352 $this->getThumbnailsDirectory() . "/" . $a_file["name"],
1353 75,
1354 75
1355 );
1356 }
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image

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

+ Here is the call graph for this function:

◆ writeCSSFile()

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

write css file to webspace directory

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

1582 {
1583 $style = $this->getStyle();
1584
1585 if ($a_target_file == "") {
1586 $css_file_name = ilUtil::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1587 } else {
1588 $css_file_name = $a_target_file;
1589 }
1590 $css_file = fopen($css_file_name, "w");
1591
1592 $page_background = "";
1593
1594 $mqs = array(array("mquery" => "", "id" => 0));
1595 foreach ($this->getMediaQueries() as $mq) {
1596 $mqs[] = $mq;
1597 }
1598
1599 // iterate all media queries
1600 foreach ($mqs as $mq) {
1601 if ($mq["id"] > 0) {
1602 fwrite($css_file, "@media " . $mq["mquery"] . " {\n");
1603 }
1604 reset($style);
1605 foreach ($style as $tag) {
1606 if ($tag[0]["mq_id"] != $mq["id"]) {
1607 continue;
1608 }
1609 fwrite($css_file, $tag[0]["tag"] . ".ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1610 // echo "<br>";
1611 // var_dump($tag[0]["type"]);
1612 if ($tag[0]["tag"] == "td") {
1613 fwrite($css_file, ",th" . ".ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1614 }
1615 if (in_array($tag[0]["tag"], array("h1", "h2", "h3"))) {
1616 fwrite($css_file, ",div.ilc_text_block_" . $tag[0]["class"] . "\n");
1617 fwrite($css_file, ",body.ilc_text_block_" . $tag[0]["class"] . "\n");
1618 }
1619 if ($tag[0]["type"] == "section") { // sections can use a tags, if links are used
1620 fwrite($css_file, ",a.ilc_" . $tag[0]["type"] . "_" . $tag[0]["class"] . "\n");
1621 }
1622 if ($tag[0]["type"] == "text_block") {
1623 fwrite($css_file, ",body.ilc_text_block_" . $tag[0]["class"] . "\n");
1624 }
1625 fwrite($css_file, "{\n");
1626
1627 // collect table border attributes
1628 $t_border = array();
1629
1630 foreach ($tag as $par) {
1631 $cur_par = $par["parameter"];
1632 $cur_val = $par["value"];
1633
1634 // replace named colors
1635 if (is_int(strpos($cur_par, "color")) && substr(trim($cur_val), 0, 1) == "!") {
1636 $cur_val = $this->getColorCodeForName(substr($cur_val, 1));
1637 }
1638
1639 if ($tag[0]["type"] == "table" && is_int(strpos($par["parameter"], "border"))) {
1640 $t_border[$cur_par] = $cur_val;
1641 }
1642
1643 if (in_array($cur_par, array("background-image", "list-style-image"))) {
1644 if (is_int(strpos($cur_val, "/"))) { // external
1645 $cur_val = "url(" . $cur_val . ")";
1646 } else { // internal
1647 if ($a_image_dir == "") {
1648 $cur_val = "url(../sty/sty_" . $this->getId() . "/images/" . $cur_val . ")";
1649 } else {
1650 $cur_val = "url(" . $a_image_dir . "/" . $cur_val . ")";
1651 }
1652 }
1653 }
1654
1655 if ($cur_par == "opacity") {
1656 $cur_val = ((int) $cur_val) / 100;
1657 }
1658
1659 fwrite($css_file, "\t" . $cur_par . ": " . $cur_val . ";\n");
1660
1661 // IE6 fix for minimum height
1662 if ($cur_par == "min-height") {
1663 fwrite($css_file, "\t" . "height" . ": " . "auto !important" . ";\n");
1664 fwrite($css_file, "\t" . "height" . ": " . $cur_val . ";\n");
1665 }
1666
1667 // opacity fix
1668 if ($cur_par == "opacity") {
1669 fwrite($css_file, "\t" . '-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . ($cur_val * 100) . ')"' . ";\n");
1670 fwrite($css_file, "\t" . 'filter: alpha(opacity=' . ($cur_val * 100) . ')' . ";\n");
1671 fwrite($css_file, "\t" . '-moz-opacity: ' . $cur_val . ";\n");
1672 }
1673
1674 // transform fix
1675 if ($cur_par == "transform") {
1676 fwrite($css_file, "\t" . '-webkit-transform: ' . $cur_val . ";\n");
1677 fwrite($css_file, "\t" . '-moz-transform: ' . $cur_val . ";\n");
1678 fwrite($css_file, "\t" . '-ms-transform: ' . $cur_val . ";\n");
1679 }
1680
1681 // transform-origin fix
1682 if ($cur_par == "transform-origin") {
1683 fwrite($css_file, "\t" . '-webkit-transform-origin: ' . $cur_val . ";\n");
1684 fwrite($css_file, "\t" . '-moz-transform-origin: ' . $cur_val . ";\n");
1685 fwrite($css_file, "\t" . '-ms-transform-origin: ' . $cur_val . ";\n");
1686 }
1687
1688 // save page background
1689 if ($tag[0]["tag"] == "div" && $tag[0]["class"] == "Page"
1690 && $cur_par == "background-color") {
1691 $page_background = $cur_val;
1692 }
1693 }
1694 fwrite($css_file, "}\n");
1695 fwrite($css_file, "\n");
1696
1697 // use table border attributes for th td as well
1698 /* if ($tag[0]["type"] == "table")
1699 {
1700 if (count($t_border) > 0)
1701 {
1702 fwrite ($css_file, $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." th,".
1703 $tag[0]["tag"].".ilc_".$tag[0]["type"]."_".$tag[0]["class"]." td\n");
1704 fwrite ($css_file, "{\n");
1705 foreach ($t_border as $p => $v)
1706 {
1707 // fwrite ($css_file, "\t".$p.": ".$v.";\n");
1708 }
1709 fwrite ($css_file, "}\n");
1710 fwrite ($css_file, "\n");
1711 }
1712 }*/
1713 }
1714
1715 if ($page_background != "") {
1716 fwrite($css_file, "td.ilc_Page\n");
1717 fwrite($css_file, "{\n");
1718 fwrite($css_file, "\t" . "background-color: " . $page_background . ";\n");
1719 fwrite($css_file, "}\n");
1720 }
1721 if ($mq["id"] > 0) {
1722 fwrite($css_file, "}\n");
1723 }
1724 }
1725 fclose($css_file);
1726 // exit;
1727 $this->setUpToDate(true);
1728 $this->_writeUpToDate($this->getId(), true);
1729 }
getColorCodeForName($a_name)
Remove a color.
getStyle()
todo: bad style! should return array of objects, not multi-dim-arrays

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

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

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

◆ writeStyleSetting()

ilObjStyleSheet::writeStyleSetting (   $a_name,
  $a_value 
)

Write Style Setting.

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

3588 {
3589 $ilDB = $this->db;
3590
3591 $ilDB->manipulate(
3592 "DELETE FROM style_setting WHERE " .
3593 " style_id = " . $ilDB->quote($this->getId(), "integer") .
3594 " AND name = " . $ilDB->quote($a_name, "text")
3595 );
3596
3597 $ilDB->manipulate("INSERT INTO style_setting " .
3598 "(style_id, name, value) VALUES (" .
3599 $ilDB->quote($this->getId(), "integer") . "," .
3600 $ilDB->quote($a_name, "text") . "," .
3601 $ilDB->quote($a_value, "text") .
3602 ")");
3603 }

References ilObject\$db, and $ilDB.

◆ writeStyleUsage()

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

Write style usage.

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

3626 {
3627 global $DIC;
3628
3629 $ilDB = $DIC->database();
3630
3631 $ilDB->replace(
3632 "style_usage",
3633 array(
3634 "obj_id" => array("integer", (int) $a_obj_id)),
3635 array(
3636 "style_id" => array("integer", (int) $a_style_id))
3637 );
3638 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ writeTemplatePreview()

ilObjStyleSheet::writeTemplatePreview (   $a_t_id,
  $a_preview_html 
)

Write table template preview.

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

3516 {
3517 $ilDB = $this->db;
3518 $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3519 $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3520 $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3521 //echo "1-".strlen($a_preview_html)."-";
3522 //echo htmlentities($a_preview_html);
3523 if (strlen($a_preview_html) > 4000) {
3524 //echo "2";
3525 $a_preview_html = "";
3526 }
3527 $ilDB->manipulate("UPDATE style_template SET " .
3528 "preview = " . $ilDB->quote($a_preview_html, "text") .
3529 " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3530 }

References ilObject\$db, and $ilDB.

Referenced by addTemplate().

+ Here is the caller graph for this function:

Field Documentation

◆ $assigned_tags

ilObjStyleSheet::$assigned_tags
static

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

◆ $basic_style_dom

ilObjStyleSheet::$basic_style_dom
staticprotected

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

Referenced by _getBasicStyleDom().

◆ $basic_style_file

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

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

◆ $basic_style_image_dir

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

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

Referenced by _addMissingStyleClassesToAllStyles().

◆ $core_styles

ilObjStyleSheet::$core_styles
static

◆ $expandable_types

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

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

◆ $filtered_groups

ilObjStyleSheet::$filtered_groups
static
Initial value:
=
array("ol" => array("ol"), "ul" => array("ul"),
"table" => array("table"), "positioning" => array("h1", "h2", "h3", "div", "img", "table", "a", "figure"))

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

Referenced by _getFilteredGroups().

◆ $hideable_types

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

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

◆ $num_unit

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

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

Referenced by _getStyleParameterNumericUnits().

◆ $num_unit_no_perc

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

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

Referenced by _getStyleParameterNumericUnits().

◆ $parameter

ilObjStyleSheet::$parameter
static

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

Referenced by _getStyleParameters(), and getStyleParameterGroups().

◆ $pseudo_classes

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

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

◆ $style

◆ $style_super_types

ilObjStyleSheet::$style_super_types
static
Initial value:
= array(
"text_block" => array("text_block", "heading1", "heading2", "heading3"),
"text_inline" => array("text_inline", "sub", "sup"),
"section" => array("section"),
"link" => array("link"),
"table" => array("table", "table_cell", "table_caption"),
"list" => array("list_o", "list_u", "list_item"),
"flist" => array("flist_cont", "flist_head", "flist", "flist_li", "flist_a"),
"media" => array("media_cont", "media_caption", "iim", "marker"),
"tabs" => array("va_cntr", "va_icntr", "va_ihead", "va_iheada", "va_ihcap", "va_icont",
"ha_cntr", "ha_icntr", "ha_ihead", "ha_iheada", "ha_ihcap", "ha_icont", "ca_cntr", "ca_icntr", "ca_ihead", "ca_icont"),
"question" => array("question", "qtitle", "qanswer", "qinput", "qlinput", "qsubmit", "qfeedr", "qfeedw",
"qimg", "qordul", "qordli", "qimgd", "qetitem", "qetcorr", "qover"),
"page" => array("page_frame", "page_cont", "page_title", "page_fn",
"page_tnav", "page_bnav", "page_lnav", "page_rnav", "page_lnavlink", "page_rnavlink",
"page_lnavimage", "page_rnavimage"),
"glo" => array("glo_overlay", "glo_ovtitle", "glo_ovclink", "glo_ovuglink", "glo_ovuglistlink"),
"sco" => array("sco_title", "sco_keyw", "sco_desc", "sco_desct", "sco_obj", "sco_objt", "sco_fmess"),
"rte" => array("rte_menu", "rte_mlink", "rte_tree", "rte_node", "rte_tlink","rte_status",
"rte_tul", "rte_tli", "rte_texp", "rte_tclink", "rte_drag")
)

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

Referenced by _getStyleSuperTypes().

◆ $templates

ilObjStyleSheet::$templates
static

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

Referenced by _getTemplateClassTypes(), create(), and getTemplates().


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