ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 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...
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type 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 ()
 
 cloneObject ($a_target_id, $a_copy_id=0, $a_omit_tree=false)
 Clone object permissions, put in tree ... More...
 
 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)
 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
 
 $ilias
 
 $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 = "./Services/Style/Content/basic_style/style.xml"
 
static $basic_style_image_dir = "./Services/Style/Content/basic_style/images"
 
static $basic_style_dom
 

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 $this->type = "sty";
557 $this->style = array();
558 if($a_call_by_reference)
559 {
560 $this->ilias->raiseError("Can't instantiate style object via reference id.",$this->ilias->error_obj->FATAL);
561 }
562
563 parent::__construct($a_id, false);
564 }
redirection script todo: (a better solution should control the processing via a xml file)

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

2595 {
2596 global $ilDB;
2597
2598 if ($a_styles == "")
2599 {
2601 }
2602 else
2603 {
2604 $styles = $a_styles;
2605 }
2608
2609 // get all core image files
2610 $core_images = array();
2611 $core_dir = self::$basic_style_image_dir;
2612 if (is_dir($core_dir))
2613 {
2614 $dir = opendir($core_dir);
2615 while($file = readdir($dir))
2616 {
2617 if (substr($file, 0, 1) != "." && is_file($core_dir."/".$file))
2618 {
2619 $core_images[] = $file;
2620 }
2621 }
2622 }
2623
2624 foreach ($styles as $style)
2625 {
2626 $id = $style["id"];
2627
2628 foreach($core_styles as $cs)
2629 {
2630 // check, whether core style class exists
2631 $set = $ilDB->queryF("SELECT * FROM style_char WHERE style_id = %s ".
2632 "AND type = %s AND characteristic = %s",
2633 array("integer", "text", "text"),
2634 array($id, $cs["type"], $cs["class"]));
2635
2636 // if not, add core style class
2637 if (!($rec = $ilDB->fetchAssoc($set)))
2638 {
2639 $ilDB->manipulateF(
2640 "INSERT INTO style_char (style_id, type, characteristic) ".
2641 " VALUES (%s,%s,%s) ",
2642 array("integer", "text", "text"),
2643 array($id, $cs["type"], $cs["class"]));
2644
2645 $xpath = new DOMXPath($bdom);
2646 $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '".$cs["tag"]."' and @Type='".
2647 $cs["type"]."' and @Class='".$cs["class"]."']/StyleParameter");
2648 foreach ($par_nodes as $par_node)
2649 {
2650 // check whether style parameter exists
2651 $set = $ilDB->queryF("SELECT * FROM style_parameter WHERE style_id = %s ".
2652 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2653 array("integer", "text", "text", "text", "text"),
2654 array($id, $cs["type"], $cs["class"],
2655 $cs["tag"], $par_node->getAttribute("Name")));
2656
2657 // if not, create style parameter
2658 if (!($rec = $ilDB->fetchAssoc($set)))
2659 {
2660 $spid = $ilDB->nextId("style_parameter");
2661 $st = $ilDB->manipulateF("INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) ".
2662 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2663 array("integer", "integer", "text", "text", "text", "text", "text"),
2664 array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2665 $par_node->getAttribute("Name"), $par_node->getAttribute("Value")));
2666 }
2667 }
2668 }
2669 }
2670
2671 // now check, whether some core image files are missing
2674 reset($core_images);
2675 foreach($core_images as $cim)
2676 {
2677 if (!is_file($imdir."/".$cim))
2678 {
2679 copy($core_dir."/".$cim, $imdir."/".$cim);
2680 }
2681 }
2682 }
2683 }
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, $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 2584 of file class.ilObjStyleSheet.php.

2585 {
2586 $styles = array(array("id" => $a_id));
2588 }
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 1257 of file class.ilObjStyleSheet.php.

1258 {
1259 global $ilErr;
1260
1261 $sty_data_dir = ilUtil::getWebspaceDir()."/sty";
1262 ilUtil::makeDir($sty_data_dir);
1263 if(!is_writable($sty_data_dir))
1264 {
1265 $ilErr->raiseError("Style data directory (".$sty_data_dir
1266 .") not writeable.", $ilErr->FATAL);
1267 }
1268
1269 $style_dir = $sty_data_dir."/sty_".$a_style_id;
1270 ilUtil::makeDir($style_dir);
1271 if(!@is_dir($style_dir))
1272 {
1273 $ilErr->raiseError("Creation of style directory failed (".
1274 $style_dir.").",$ilErr->FATAL);
1275 }
1276
1277 // create images subdirectory
1278 $im_dir = $style_dir."/images";
1279 ilUtil::makeDir($im_dir);
1280 if(!@is_dir($im_dir))
1281 {
1282 $ilErr->raiseError("Creation of Import Directory failed (".
1283 $im_dir.").", $ilErr->FATAL);
1284 }
1285
1286 // create thumbnails directory
1287 $thumb_dir = $style_dir."/images/thumbnails";
1288 ilUtil::makeDir($thumb_dir);
1289 if(!@is_dir($thumb_dir))
1290 {
1291 $ilErr->raiseError("Creation of Import Directory failed (".
1292 $thumb_dir.").", $ilErr->FATAL);
1293 }
1294 }
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 $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 2561 of file class.ilObjStyleSheet.php.

2562 {
2563 return self::$assigned_tags[$a_type];
2564 }
$a_type
Definition: workflow.php:93

References $a_type.

Referenced by _getCoreStyles(), copyCharacteristic(), ilObjStyleSheetGUI\deleteTemplateObject(), ilStyleTableGUI\fillRow(), 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 3110 of file class.ilObjStyleSheet.php.

3111 {
3112 $r["r"] = substr($a_rgb, 0, 2);
3113 $r["g"] = substr($a_rgb, 2, 2);
3114 $r["b"] = substr($a_rgb, 4, 2);
3115
3116 if ($as_dec)
3117 {
3118 $r["r"] = (int) hexdec($r["r"]);
3119 $r["g"] = (int) hexdec($r["g"]);
3120 $r["b"] = (int) hexdec($r["b"]);
3121 }
3122
3123 return $r;
3124 }
$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 838 of file class.ilObjStyleSheet.php.

839 {
840 global $ilBench;
841
842 if (!is_object(self::$basic_style_dom))
843 {
844 self::$basic_style_dom = new DOMDocument();
845 self::$basic_style_dom->load(self::$basic_style_file);
846 }
847
849 }
global $ilBench
Definition: ilias.php:18

References $basic_style_dom, and $ilBench.

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

778 {
779 global $ilAccess, $ilDB;
780
781 $clonable_styles = array();
782
783 $q = "SELECT * FROM style_data";
784 $style_set = $ilDB->query($q);
785 while($style_rec = $ilDB->fetchAssoc($style_set))
786 {
787 $clonable = false;
788 if ($style_rec["standard"] == 1)
789 {
790 if ($style_rec["active"] == 1)
791 {
792 $clonable = true;
793 }
794 }
795 else
796 {
797 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
798 $obj_ids = ilObjContentObject::_lookupContObjIdByStyleId($style_rec["id"]);
799 if (count($obj_ids) == 0)
800 {
801 $obj_ids = self::lookupObjectForStyle($style_rec["id"]);
802 }
803 foreach($obj_ids as $id)
804 {
806 foreach($ref as $ref_id)
807 {
808 if ($ilAccess->checkAccess("write", "", $ref_id))
809 {
810 $clonable = true;
811 }
812 }
813 }
814 }
815 if ($clonable)
816 {
817 $clonable_styles[$style_rec["id"]] =
818 ilObject::_lookupTitle($style_rec["id"]);
819 }
820 }
821
822 asort($clonable_styles);
823
824 return $clonable_styles;
825 }
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 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 3083 of file class.ilObjStyleSheet.php.

3084 {
3085 $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
3086 $hls = ilObjStyleSheet::_RGBToHLS($rgb);
3087
3088 if ($a_i > 0)
3089 {
3090 $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
3091 }
3092 if ($a_i < 0)
3093 {
3094 $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
3095 }
3096
3097 $rgb = ilObjStyleSheet::_HLSToRGB($hls);
3098
3099 foreach ($rgb as $k => $v)
3100 {
3101 $rgb[$k] = str_pad(dechex($v), 2, "0", STR_PAD_LEFT);
3102 }
3103
3104 return $rgb["r"].$rgb["g"].$rgb["b"];
3105 }
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().

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

2506 {
2507 $c_styles = array();
2508 foreach (self::$core_styles as $cstyle)
2509 {
2510 $c_styles[$cstyle["type"].".".ilObjStyleSheet::_determineTag($cstyle["type"]).".".$cstyle["class"]]
2511 = array("type" => $cstyle["type"],
2512 "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2513 "class" => $cstyle["class"]);
2514 }
2515 return $c_styles;
2516 }
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 2448 of file class.ilObjStyleSheet.php.

2449 {
2451 }

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

1308 {
1309 return ilUtil::getWebspaceDir()."/sty/sty_".$a_style_id.
1310 "/images";
1311 }

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

2552 {
2553 return self::$pseudo_classes[$tag];
2554 }

◆ _getStandardStyles()

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

Get standard styles.

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

733 {
734 global $ilDB, $ilias, $tree;
735
736 $default_style = $ilias->getSetting("default_content_style_id");
737
738 $and_str = "";
739 if (!$a_include_deactivated)
740 {
741 $and_str = " AND active = 1";
742 }
743
744 $q = "SELECT * FROM style_data ".
745 " WHERE standard = 1".$and_str;
746 $res = $ilDB->query($q);
747 $styles = array();
748 while($sty = $ilDB->fetchAssoc($res))
749 {
750 if (!$a_exclude_default_style || $default_style != $sty["id"])
751 {
752 // check scope
753 if ($a_scope > 0 && $sty["category"] > 0)
754 {
755 if ($tree->isInTree($sty["category"]) &&
756 $tree->isInTree($a_scope))
757 {
758 $path = $tree->getPathId($a_scope);
759 if (!in_array($sty["category"], $path))
760 {
761 continue;
762 }
763 }
764 }
765 $styles[$sty["id"]] = ilObject::_lookupTitle($sty["id"]);
766 }
767 }
768
769 return $styles;
770 }
$path
Definition: aliased.php:25

References $ilDB, ilObject\$ilias, $path, $res, $styles, 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 2417 of file class.ilObjStyleSheet.php.

2418 {
2419 $input = self::$parameter[$par]["input"];
2420 return $input;
2421 }

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

2454 {
2455 if ($a_no_percentage)
2456 {
2458 }
2459 return self::$num_unit;
2460 }

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

2430 {
2431 if ($a_tag == "")
2432 {
2433 return self::$parameter;
2434 }
2435 $par = array();
2436 foreach (self::$parameter as $k => $v)
2437 {
2438 if (is_array(self::$filtered_groups[$v["group"]]) &&
2439 !in_array($a_tag, self::$filtered_groups[$v["group"]]))
2440 {
2441 continue;
2442 }
2443 $par[$k] = $v;
2444 }
2445 return $par;
2446 }

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

2424 {
2425 $subpar = self::$parameter[$par]["subpar"];
2426 return $subpar;
2427 }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues (   $par)
static

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

2463 {
2464 return self::$parameter[$par]["values"];
2465 }

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

2488 {
2489 foreach (self::$style_super_types as $s => $t)
2490 {
2491 if (in_array($a_type, $t))
2492 {
2493 return $s;
2494 }
2495 if ($a_type == $s)
2496 {
2497 return $s;
2498 }
2499 }
2500 }

References $a_type, 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 2540 of file class.ilObjStyleSheet.php.

2541 {
2542 if ($a_template_type == "")
2543 {
2544 return self::$templates;
2545 }
2546
2547 return self::$templates[$a_template_type];
2548 }

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

3183 {
3184 $h = $a_hls["h"] / 255;
3185 $l = $a_hls["l"] / 255;
3186 $s = $a_hls["s"] / 255;
3187
3188 $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
3189
3190 // If S=0, define R, G, and B all to L
3191 if ($s == 0)
3192 {
3193 $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
3194 }
3195 else
3196 {
3197
3198 if ($l < 0.5)
3199 {
3200 $temp2 = $l * (1.0 + $s);
3201 }
3202 else
3203 {
3204 $temp2 = $l + $s - $l * $s;
3205 }
3206
3207 $temp1 = 2.0 * $l - $temp2;
3208
3209
3210 # For each of R, G, B, compute another temporary value, temp3, as follows:
3211 foreach ($rgb as $k => $v)
3212 {
3213 switch ($k)
3214 {
3215 case "r":
3216 $temp3 = $h + 1.0 / 3.0;
3217 break;
3218
3219 case "g":
3220 $temp3 = $h;
3221 break;
3222
3223 case "b":
3224 $temp3 = $h - 1.0/3.0;
3225 break;
3226 }
3227 if ($temp3 < 0)
3228 {
3229 $temp3 = $temp3 + 1.0;
3230 }
3231 if ($temp3 > 1)
3232 {
3233 $temp3 = $temp3 - 1.0;
3234 }
3235
3236 if (6.0 * $temp3 < 1)
3237 {
3238 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3239 }
3240 else if (2.0 * $temp3 < 1)
3241 {
3242 $rgb[$k] = $temp2;
3243 }
3244 else if (3.0 * $temp3 < 2)
3245 {
3246 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0/3.0) - $temp3) * 6.0;
3247 }
3248 else
3249 {
3250 $rgb[$k] = $temp1;
3251 }
3252 }
3253 }
3254
3255 $rgb["r"] = round($rgb["r"] * 255);
3256 $rgb["g"] = round($rgb["g"] * 255);
3257 $rgb["b"] = round($rgb["b"] * 255);
3258
3259 return $rgb;
3260 }
global $l
Definition: afr.php:30
$h

References $h, and $l.

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable (   $a_type)
static

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

2478 {
2479 return in_array($a_type, self::$expandable_types);
2480 }

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

2483 {
2484 return in_array($a_type, self::$hideable_types);
2485 }

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

717 {
718 global $ilDB;
719
720 $q = "SELECT * FROM style_data ".
721 " WHERE id = ".$ilDB->quote($a_id, "integer");
722 $res = $ilDB->query($q);
723 $sty = $ilDB->fetchAssoc($res);
724
725 return (boolean) $sty["active"];
726 }

References $ilDB, and $res.

Referenced by ilContentStyleSettingsGUI\edit().

+ Here is the caller graph for this function:

◆ _lookupStandard()

◆ _lookupTemplateIdByName()

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

Lookup table template preview.

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

3690 {
3691 global $ilDB;
3692
3693 $set = $ilDB->query("SELECT id FROM style_template ".
3694 " WHERE style_id = ".$ilDB->quote($a_style_id, "integer").
3695 " AND name = ".$ilDB->quote($a_name, "text"));
3696 if ($rec = $ilDB->fetchAssoc($set))
3697 {
3698 return $rec["id"];
3699 }
3700
3701 return false;
3702 }

References $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 3583 of file class.ilObjStyleSheet.php.

3584 {
3585 global $ilDB;
3586
3587 $set = $ilDB->query("SELECT name FROM style_template WHERE ".
3588 " id = ".$ilDB->quote($a_t_id, "integer"));
3589
3590 if ($rec = $ilDB->fetchAssoc($set))
3591 {
3592 return $rec["name"];
3593 }
3594
3595 return false;
3596 }

References $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 647 of file class.ilObjStyleSheet.php.

648 {
649 global $ilDB;
650
651 $q = "SELECT uptodate FROM style_data ".
652 " WHERE id = ".$ilDB->quote($a_id, "integer");
653 $res = $ilDB->query($q);
654 $sty = $ilDB->fetchAssoc($res);
655
656 return (boolean) $sty["uptodate"];
657 }

References $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 1940 of file class.ilObjStyleSheet.php.

1941 {
1942 global $ilDB;
1943
1944 $q = "SELECT * FROM style_parameter WHERE ".
1945 " style_id = ".$ilDB->quote($style_id, "integer")." AND ".
1946 " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1947 " class = ".$ilDB->quote($a_class, "text")." AND ".
1948 " mq_id = ".$ilDB->quote($a_mq_id, "integer")." AND ".
1949 " custom = ".$ilDB->quote($a_custom, "integer")." AND ".
1950 " ".$ilDB->equals("type", $a_type, "text", true)." AND ".
1951 " parameter = ".$ilDB->quote($a_par, "text");
1952
1953 $set = $ilDB->query($q);
1954
1955 if ($rec = $set->fetchRow())
1956 {
1957 $q = "UPDATE style_parameter SET ".
1958 " value = ".$ilDB->quote($a_val, "text")." WHERE ".
1959 " style_id = ".$ilDB->quote($style_id, "integer")." AND ".
1960 " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1961 " class = ".$ilDB->quote($a_class, "text")." AND ".
1962 " mq_id = ".$ilDB->quote($a_mq_id, "integer")." AND ".
1963 " custom = ".$ilDB->quote($a_custom, "integer")." AND ".
1964 " ".$ilDB->equals("type", $a_type, "text", true)." AND ".
1965 " parameter = ".$ilDB->quote($a_par, "text");
1966
1967 $ilDB->manipulate($q);
1968 }
1969 else
1970 {
1971 $id = $ilDB->nextId("style_parameter");
1972 $q = "INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter, mq_id, custom) VALUES ".
1973 " (".
1974 $ilDB->quote($id, "integer").",".
1975 $ilDB->quote($a_val, "text").",".
1976 " ".$ilDB->quote($style_id, "integer").",".
1977 " ".$ilDB->quote($a_tag, "text").",".
1978 " ".$ilDB->quote($a_class, "text").",".
1979 " ".$ilDB->quote($a_type, "text").",".
1980 " ".$ilDB->quote($a_par, "text").",".
1981 " ".$ilDB->quote($a_mq_id, "integer").",".
1982 " ".$ilDB->quote($a_custom, "integer").
1983 ")";
1984
1985 $ilDB->manipulate($q);
1986 }
1987 }

References $a_type, 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 3129 of file class.ilObjStyleSheet.php.

3130 {
3131 $r = $a_rgb["r"] / 255;
3132 $g = $a_rgb["g"] / 255;
3133 $b = $a_rgb["b"] / 255;
3134
3135 // max / min
3136 $max = max($r,$g,$b);
3137 $min = min($r,$g,$b);
3138
3139 //lightness
3140 $l = ($max + $min) / 2;
3141
3142 if ($max == $min)
3143 {
3144 $s = 0;
3145 $h = 0;
3146 }
3147 else
3148 {
3149 if ($l < 0.5)
3150 {
3151 $s = ($max - $min) / ($max + $min);
3152 }
3153 else
3154 {
3155 $s = ($max - $min) / (2.0 - $max - $min);
3156 }
3157
3158 if ($r == $max)
3159 {
3160 $h = ($g - $b) / ($max - $min);
3161 }
3162 else if ($g == $max)
3163 {
3164 $h = 2.0 + ($b - $r) / ($max - $min);
3165 }
3166 else if ($b == $max)
3167 {
3168 $h = 4.0 + ($r - $g) / ($max - $min);
3169 }
3170 }
3171
3172 $hls["h"] = round(($h / 6) * 255);
3173 $hls["l"] = round($l * 255);
3174 $hls["s"] = round($s * 255);
3175
3176 return $hls;
3177 }

References $h, $l, and $r.

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

704 {
705 global $ilDB;
706
707 $q = "UPDATE style_data SET active = ".
708 $ilDB->quote((int) $a_active, "integer").
709 " WHERE id = ".$ilDB->quote($a_id, "integer");
710 $ilDB->manipulate($q);
711 }

References $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 675 of file class.ilObjStyleSheet.php.

676 {
677 global $ilDB;
678
679 $q = "UPDATE style_data SET category = ".
680 $ilDB->quote((int) $a_scope, "integer").
681 " WHERE id = ".$ilDB->quote($a_id, "integer");
682 $ilDB->manipulate($q);
683 }

References $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 662 of file class.ilObjStyleSheet.php.

663 {
664 global $ilDB;
665
666 $q = "UPDATE style_data SET standard = ".
667 $ilDB->quote((int) $a_std, "integer").
668 " WHERE id = ".$ilDB->quote($a_id, "integer");
669 $ilDB->manipulate($q);
670 }

References $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 634 of file class.ilObjStyleSheet.php.

635 {
636 global $ilDB;
637
638 $q = "UPDATE style_data SET uptodate = ".
639 $ilDB->quote((int) $a_up_to_date, "integer").
640 " WHERE id = ".$ilDB->quote($a_id, "integer");
641 $ilDB->manipulate($q);
642 }

References $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 1040 of file class.ilObjStyleSheet.php.

1041 {
1042 global $ilDB;
1043
1044 // delete characteristic record
1045 $ilDB->manipulateF("INSERT INTO style_char (style_id, type, characteristic, hide)".
1046 " VALUES (%s,%s,%s,%s) ",
1047 array("integer", "text", "text", "integer"),
1048 array($this->getId(), $a_type, $a_char, $a_hidden));
1049
1050 $this->setUpToDate(false);
1051 $this->_writeUpToDate($this->getId(), false);
1052 }
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, $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 2964 of file class.ilObjStyleSheet.php.

2965 {
2966 global $ilDB;
2967
2968 $ilDB->manipulate("INSERT INTO style_color (style_id, color_name, color_code)".
2969 " VALUES (".
2970 $ilDB->quote($this->getId(), "integer").",".
2971 $ilDB->quote($a_name, "text").",".
2972 $ilDB->quote($a_code, "text").
2973 ")");
2974 }

References $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 3294 of file class.ilObjStyleSheet.php.

3295 {
3296 global $ilDB;
3297
3298 $id = $ilDB->nextId("sty_media_query");
3299 if ($order_nr == 0)
3300 {
3301 $order_nr = $this->getMaxMQueryOrderNr() + 10;
3302 }
3303
3304 $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)".
3305 " VALUES (".
3306 $ilDB->quote($id, "integer").",".
3307 $ilDB->quote($this->getId(), "integer").",".
3308 $ilDB->quote($a_mquery, "text").",".
3309 $ilDB->quote($order_nr, "integer").
3310 ")");
3311
3312 return $id;
3313 }
getMaxMQueryOrderNr()
Get maximum media query order nr.

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

1220 {
1221 global $ilDB;
1222
1223 $avail_params = $this->getAvailableParameters();
1224 $tag = explode(".", $a_tag);
1225 $value = $avail_params[$a_par][0];
1226 $id = $ilDB->nextId("style_parameter");
1227 $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES ".
1228 "(".
1229 $ilDB->quote($id, "integer").",".
1230 $ilDB->quote($this->getId(), "integer").",".
1231 $ilDB->quote($a_type, "text").",".
1232 $ilDB->quote($tag[0], "text").",".
1233 $ilDB->quote($tag[1], "text").",".
1234 $ilDB->quote($a_par, "text").",".
1235 $ilDB->quote($value, "text").",".
1236 $ilDB->quote($a_mq_id, "integer").",".
1237 $ilDB->quote($a_custom, "integer").
1238 ")";
1239 $ilDB->manipulate($q);
1240 $this->read();
1241 $this->writeCSSFile();
1242 }
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\$id, $ilDB, 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 3458 of file class.ilObjStyleSheet.php.

3459 {
3460 global $ilDB;
3461
3462 $tid = $ilDB->nextId("style_template");
3463 $ilDB->manipulate($q = "INSERT INTO style_template ".
3464 "(id, style_id, name, temp_type)".
3465 " VALUES (".
3466 $ilDB->quote($tid, "integer").",".
3467 $ilDB->quote($this->getId(), "integer").",".
3468 $ilDB->quote($a_name, "text").",".
3469 $ilDB->quote($a_type, "text").
3470 ")");
3471
3472 foreach ($a_classes as $t => $c)
3473 {
3474 $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3475 "(template_id, class_type, class)".
3476 " VALUES (".
3477 $ilDB->quote($tid, "integer").",".
3478 $ilDB->quote($t, "text").",".
3479 $ilDB->quote($c, "text").
3480 ")");
3481 }
3482
3483 include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
3484 $this->writeTemplatePreview($tid,
3486
3487 return $tid;
3488 }
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, $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 3520 of file class.ilObjStyleSheet.php.

3521 {
3522 global $ilDB;
3523
3524 $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3525 "(template_id, class_type, class)".
3526 " VALUES (".
3527 $ilDB->quote($a_t_id, "integer").",".
3528 $ilDB->quote($a_type, "text").",".
3529 $ilDB->quote($a_class, "text").
3530 ")");
3531 }

References $a_type, and $ilDB.

◆ assignMetaData()

ilObjStyleSheet::assignMetaData ( $a_meta_data)

assign meta data object

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

831 {
832 $this->meta_data = $a_meta_data;
833 }

◆ characteristicExists()

ilObjStyleSheet::characteristicExists (   $a_char,
  $a_style_type 
)

Check whether characteristic exists.

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

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

References $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 2117 of file class.ilObjStyleSheet.php.

2118 {
2119 $sty_data_dir = ilUtil::getDataDir()."/sty";
2120 $style_dir = $sty_data_dir."/sty_".$this->getId();
2121 // create export subdirectory
2122 $ex_dir = $style_dir."/export";
2123
2124 if (is_dir($ex_dir))
2125 {
2126 ilUtil::delDir($ex_dir, true);
2127 }
2128 }
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 3034 of file class.ilObjStyleSheet.php.

3035 {
3036 global $ilDB;
3037
3038 $set = $ilDB->query("SELECT * FROM style_color WHERE ".
3039 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3040 "color_name = ".$ilDB->quote($a_color_name, "text"));
3041 if ($rec = $ilDB->fetchAssoc($set))
3042 {
3043 return true;
3044 }
3045 return false;
3046 }

References $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 1060 of file class.ilObjStyleSheet.php.

1062 {
1063 global $ilDB;
1064
1065 if (!$this->characteristicExists($a_to_char, $a_from_type))
1066 {
1067 $this->addCharacteristic($a_from_type, $a_to_char);
1068 }
1069 $this->deleteStyleParOfChar($a_from_type, $a_to_char);
1070
1071 $from_style = new ilObjStyleSheet($a_from_style_id);
1072
1073 // todo fix using mq_id
1074 $pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
1075
1076 $colors = array();
1077 foreach ($pars as $p => $v)
1078 {
1079 if (substr($v, 0, 1) == "!")
1080 {
1081 $colors[] = substr($v, 1);
1082 }
1084 $a_to_char, $p, $v, $a_from_type);
1085 }
1086
1087 // copy colors
1088 foreach ($colors as $c)
1089 {
1090 if (!$this->colorExists($c))
1091 {
1092 $this->addColor($c, $from_style->getColorCodeForName($c));
1093 }
1094 }
1095 }
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 $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 1205 of file class.ilObjStyleSheet.php.

1206 {
1207 ilUtil::rCopy($this->getImagesDirectory(), $a_target);
1208 }
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 862 of file class.ilObjStyleSheet.php.

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

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

2085 {
2086 $sty_data_dir = ilUtil::getDataDir()."/sty";
2087 ilUtil::makeDir($sty_data_dir);
2088 if(!is_writable($sty_data_dir))
2089 {
2090 $this->ilias->raiseError("Style data directory (".$sty_data_dir
2091 .") not writeable.",$this->ilias->error_obj->FATAL);
2092 }
2093
2094 $style_dir = $sty_data_dir."/sty_".$this->getId();
2095 ilUtil::makeDir($style_dir);
2096 if(!@is_dir($style_dir))
2097 {
2098 $this->ilias->raiseError("Creation of style directory failed (".
2099 $style_dir.").",$this->ilias->error_obj->FATAL);
2100 }
2101
2102 // create export subdirectory
2103 $ex_dir = $style_dir."/export";
2104 ilUtil::makeDir($ex_dir);
2105 if(!@is_dir($ex_dir))
2106 {
2107 $this->ilias->raiseError("Creation of Import Directory failed (".
2108 $ex_dir.").",$this->ilias->error_obj->FATAL);
2109 }
2110
2111 return $ex_dir;
2112 }

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

2135 {
2136 $ex_dir = $this->createExportDirectory();
2137 $ex_sub_dir = $ex_dir."/".$this->getExportSubDir();
2138 ilUtil::makeDir($ex_sub_dir);
2139 if(!is_writable($ex_sub_dir))
2140 {
2141 $this->ilias->raiseError("Style data directory (".$ex_sub_dir
2142 .") not writeable.",$this->ilias->error_obj->FATAL);
2143 }
2144 $ex_sub_images_dir = $ex_sub_dir."/images";
2145 ilUtil::makeDir($ex_sub_images_dir);
2146 if(!is_writable($ex_sub_images_dir))
2147 {
2148 $this->ilias->raiseError("Style data directory (".$ex_sub_images_dir
2149 .") not writeable.",$this->ilias->error_obj->FATAL);
2150 }
2151 }
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 2319 of file class.ilObjStyleSheet.php.

2320 {
2321 global $ilDB;
2322
2323 $this->is_3_10_skin = false;
2324
2325 if (!$a_skip_parent_create)
2326 {
2327 parent::create();
2328 }
2329 include_once("./Services/Style/Content/classes/class.ilStyleImportParser.php");
2330 $importParser = new ilStyleImportParser($a_file, $this);
2331 $importParser->startParsing();
2332
2333 // store style parameter
2334 foreach ($this->style as $style)
2335 {
2336 foreach($style as $tag)
2337 {
2338 $id = $ilDB->nextId("style_parameter");
2339
2340 // migrate old table PageFrame/PageContainer to div
2341 if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
2342 $tag["tag"] == "table")
2343 {
2344 $tag["tag"] = "div";
2345 if ($tag["parameter"] == "width" && $tag["value"] == "100%")
2346 {
2347 continue;
2348 }
2349 }
2350
2351 $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES ".
2352 "(".
2353 $ilDB->quote($id, "integer").",".
2354 $ilDB->quote($this->getId(), "integer").",".
2355 $ilDB->quote($tag["tag"], "text").",".
2356 $ilDB->quote($tag["class"], "text").",".
2357 $ilDB->quote($tag["parameter"], "text").",".
2358 $ilDB->quote($tag["type"], "text").",".
2359 $ilDB->quote($tag["value"], "text").",".
2360 $ilDB->quote((bool) $tag["custom"], "integer").
2361 ")";
2362 $ilDB->manipulate($q);
2363 }
2364 }
2365
2366 // store characteristics
2367 $this->is_3_10_skin = true;
2368 if (is_array($this->chars))
2369 {
2370 foreach ($this->chars as $char)
2371 {
2372 if ($char["type"] != "")
2373 {
2374 $s = substr($char["class"], strlen($char["class"]) - 6);
2375 if ($s != ":hover")
2376 {
2377 $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
2378 "(".$ilDB->quote($this->getId(), "integer").",".
2379 $ilDB->quote($char["type"], "text").",".
2380 $ilDB->quote($char["class"], "text").")";
2381 $ilDB->manipulate($q);
2382 $this->is_3_10_skin = false;
2383 }
2384 }
2385 }
2386 }
2387
2388 // add style_data record
2389 $q = "INSERT INTO style_data (id, uptodate) VALUES ".
2390 "(".$ilDB->quote($this->getId(), "integer").", 0)";
2391 $ilDB->manipulate($q);
2392
2393 $this->update();
2394 $this->read();
2395
2396 if ($this->is_3_10_skin)
2397 {
2398 $this->do_3_10_Migration();
2399 }
2400 //$this->writeCSSFile();
2401 }
update()
update object in db
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.

References ilObject\$id, $ilDB, $style, 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 1248 of file class.ilObjStyleSheet.php.

1249 {
1251 }

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

2229 {
2230 $sty_data_dir = ilUtil::getDataDir()."/sty";
2231 ilUtil::makeDir($sty_data_dir);
2232 if(!is_writable($sty_data_dir))
2233 {
2234 $this->ilias->raiseError("Style data directory (".$sty_data_dir
2235 .") not writeable.",$this->ilias->error_obj->FATAL);
2236 }
2237
2238 $style_dir = $sty_data_dir."/sty_".$this->getId();
2239 ilUtil::makeDir($style_dir);
2240 if(!@is_dir($style_dir))
2241 {
2242 $this->ilias->raiseError("Creation of style directory failed (".
2243 $style_dir.").",$this->ilias->error_obj->FATAL);
2244 }
2245
2246 // create import subdirectory
2247 $im_dir = $style_dir."/import";
2248 ilUtil::makeDir($im_dir);
2249 if(!@is_dir($im_dir))
2250 {
2251 $this->ilias->raiseError("Creation of Import Directory failed (".
2252 $im_dir.").",$this->ilias->error_obj->FATAL);
2253 }
2254
2255 return $im_dir;
2256 }

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

595 {
596 $this->ilias->raiseError("Operation ilObjStyleSheet::createReference() not allowed.",$this->ilias->error_obj->FATAL);
597 }

◆ delete()

ilObjStyleSheet::delete ( )

delete style object

Reimplemented from ilObject.

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

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

References $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 995 of file class.ilObjStyleSheet.php.

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

References $a_type, $core_styles, $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 1423 of file class.ilObjStyleSheet.php.

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

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

+ Here is the call graph for this function:

◆ deleteImage()

ilObjStyleSheet::deleteImage (   $a_file)

Delete an image.

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

1364 {
1365 if (is_file($this->getImagesDirectory()."/".$a_file))
1366 {
1367 unlink($this->getImagesDirectory()."/".$a_file);
1368 }
1369 if (is_file($this->getThumbnailsDirectory()."/".$a_file))
1370 {
1371 unlink($this->getThumbnailsDirectory()."/".$a_file);
1372 }
1373 }
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 3368 of file class.ilObjStyleSheet.php.

3369 {
3370 global $ilDB;
3371
3372 $ilDB->manipulate("DELETE FROM sty_media_query WHERE ".
3373 " style_id = ".$ilDB->quote($this->getId(), "integer").
3374 " AND id = ".$ilDB->quote($a_id, "integer")
3375 );
3376 $this->saveMediaQueryOrder();
3377 }
saveMediaQueryOrder($a_order_nr=null)
Save media query order.

References $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 1380 of file class.ilObjStyleSheet.php.

1381 {
1382 global $ilDB;
1383
1384 $q = "DELETE FROM style_parameter WHERE id = ".
1385 $ilDB->quote($a_id, "integer");
1386 $ilDB->query($q);
1387 }

References $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 1398 of file class.ilObjStyleSheet.php.

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

References $a_type, $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 1446 of file class.ilObjStyleSheet.php.

1447 {
1448 global $ilDB;
1449
1450 $q = "DELETE FROM style_parameter WHERE ".
1451 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1452 " class = ".$ilDB->quote($a_class, "text")." AND ".
1453 " ".$ilDB->equals("type", $a_type, "text", true);
1454
1455 $ilDB->manipulate($q);
1456 }

References $a_type, $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 2556 of file class.ilObjStyleSheet.php.

2557 {
2558 return self::$templates[$t][$k];
2559 }

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

2756 {
2757 global $ilDB;
2758
2759 $add_str = "";
2760 if ($a_id != "")
2761 {
2762 $add_str = " AND style_id = ".$ilDB->quote($a_id, "integer");
2763 }
2764
2765 $set = $ilDB->query($q = "SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE ".
2766 $ilDB->equals("type", "", "text", true)." ".$add_str);
2767
2768 while ($rec = $ilDB->fetchAssoc($set))
2769 {
2770 // derive types from tag
2771 $types = array();
2772 switch ($rec["tag"])
2773 {
2774 case "div":
2775 case "p":
2776 if (in_array($rec["class"], array("Headline3", "Headline1",
2777 "Headline2", "TableContent", "List", "Standard", "Remark",
2778 "Additional", "Mnemonic", "Citation", "Example")))
2779 {
2780 $types[] = "text_block";
2781 }
2782 if (in_array($rec["class"], array("Block", "Remark",
2783 "Additional", "Mnemonic", "Example", "Excursus", "Special")))
2784 {
2785 $types[] = "section";
2786 }
2787 if (in_array($rec["class"], array("Page", "Footnote", "PageTitle", "LMNavigation")))
2788 {
2789 $types[] = "page";
2790 }
2791 break;
2792
2793 case "td":
2794 $types[] = "table_cell";
2795 break;
2796
2797 case "a":
2798 if (in_array($rec["class"], array("ExtLink", "IntLink", "FootnoteLink")))
2799 {
2800 $types[] = "link";
2801 }
2802 break;
2803
2804 case "span":
2805 $types[] = "text_inline";
2806 break;
2807
2808 case "table":
2809 $types[] = "table";
2810 break;
2811 }
2812
2813 // check if style_char set exists
2814 foreach ($types as $t)
2815 {
2816 // check if second type already exists
2817 $set4 = $ilDB->queryF("SELECT * FROM style_char ".
2818 " WHERE style_id = %s AND type = %s AND characteristic = %s",
2819 array("integer", "text", "text"),
2820 array($rec["style_id"], $t, $rec["class"]));
2821 if ($rec4 = $ilDB->fetchAssoc($set4))
2822 {
2823 // ok
2824 }
2825 else
2826 {
2827//echo "<br>1-".$rec["style_id"]."-".$t."-".$rec["class"]."-";
2828 $ilDB->manipulateF("INSERT INTO style_char ".
2829 " (style_id, type, characteristic) VALUES ".
2830 " (%s,%s,%s) ",
2831 array("integer", "text", "text"),
2832 array($rec["style_id"], $t, $rec["class"]));
2833 }
2834 }
2835
2836 // update types
2837 if ($rec["type"] == "")
2838 {
2839 if (count($types) > 0)
2840 {
2841 $ilDB->manipulateF("UPDATE style_parameter SET type = %s ".
2842 " WHERE style_id = %s AND class = %s AND ".$ilDB->equals("type", "", "text", true),
2843 array("text", "integer", "text"),
2844 array($types[0], $rec["style_id"], $rec["class"]));
2845//echo "<br>3-".$types[0]."-".$rec["style_id"]."-".$rec["class"]."-";
2846
2847 // links extra handling
2848 if ($types[0] == "link")
2849 {
2850 $ilDB->manipulateF("UPDATE style_parameter SET type = %s ".
2851 " WHERE style_id = %s AND (class = %s OR class = %s) AND ".$ilDB->equals("type", "", "text", true),
2852 array("text", "integer", "text", "text"),
2853 array($types[0], $rec["style_id"], $rec["class"].":visited",
2854 $rec["class"].":hover"));
2855 }
2856 }
2857
2858 if (count($types) == 2)
2859 {
2860 // select all records of first type and add second type
2861 // records if necessary.
2862 $set2 = $ilDB->queryF("SELECT * FROM style_parameter ".
2863 " WHERE style_id = %s AND class = %s AND type = %s",
2864 array("integer", "text", "text"),
2865 array($rec["style_id"], $rec["class"], $types[0]));
2866 while ($rec2 = $ilDB->fetchAssoc($set2))
2867 {
2868 // check if second type already exists
2869 $set3 = $ilDB->queryF("SELECT * FROM style_parameter ".
2870 " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
2871 array("integer", "text", "text", "text", "text"),
2872 array($rec["style_id"], $rec["tag"], $rec["class"], $types[1], $rec["parameter"]));
2873 if ($rec3 = $ilDB->fetchAssoc($set3))
2874 {
2875 // ok
2876 }
2877 else
2878 {
2879 $nid = $ilDB->nextId("style_parameter");
2880 $ilDB->manipulateF("INSERT INTO style_parameter ".
2881 " (id, style_id, tag, class, parameter, value, type) VALUES ".
2882 " (%s, %s,%s,%s,%s,%s,%s) ",
2883 array("integer", "integer", "text", "text", "text", "text", "text"),
2884 array($nid, $rec2["style_id"], $rec2["tag"], $rec2["class"],
2885 $rec2["parameter"], $rec2["value"], $types[1]));
2886 }
2887 }
2888 }
2889 }
2890 }
2891 }

References $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 2692 of file class.ilObjStyleSheet.php.

2693 {
2694 global $ilDB;
2695
2696 $this->do_3_9_Migration($this->getId());
2697
2698 //include_once("./Services/Migration/DBUpdate_1385/classes/class.ilStyleMigration.php");
2699 //ilStyleMigration::addMissingStyleCharacteristics($this->getId());
2700
2701 $this->do_3_10_CharMigration($this->getId());
2702
2703 // style_char: type for characteristic
2704 $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?".
2705 " AND style_id = ? ", array("text", "text", "integer"));
2706 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2707 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2708 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2709 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2710 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2711 $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2712
2713 // style_parameter: type for class
2714 $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?".
2715 " AND style_id = ? ", array("text", "text", "integer"));
2716 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2717 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2718 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2719 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2720 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2721 $ilDB->execute($st, array("table", "Page", $this->getId()));
2722
2723 $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?".
2724 " AND style_id = ? ", array("text", "text", "integer"));
2725 $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2726
2727 // style_char: characteristic for characteristic
2728 $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?".
2729 " AND style_id = ? ", array("text", "text", "integer"));
2730 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2731 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2732
2733 // style_parameter: class for class
2734 $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?".
2735 " AND style_id = ? ", array("text", "text", "integer"));
2736 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2737 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2738
2739 // force rewriting of container style
2740 $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?".
2741 " AND style_id = ? ", array("text", "integer"));
2742 $ilDB->execute($st, array("page_cont", $this->getId()));
2743 $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?".
2744 " AND style_id = ? ", array("text", "integer"));
2745 $ilDB->execute($st, array("page_cont", $this->getId()));
2746
2747 }
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 $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 2896 of file class.ilObjStyleSheet.php.

2897 {
2898 global $ilDB;
2899
2900 $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2901 $pars = array("margin-top", "margin-bottom");
2902
2903 foreach ($classes as $curr_class)
2904 {
2905 foreach ($pars as $curr_par)
2906 {
2907 $res2 = $ilDB->queryF("SELECT id FROM style_parameter WHERE style_id = %s".
2908 " AND tag = %s AND class= %s AND parameter = %s",
2909 array("integer", "text", "text", "text"),
2910 array($a_id, "p", $curr_class, $curr_par));
2911 if ($row2 = $ilDB->fetchAssoc($res2))
2912 {
2913 $ilDB->manipulateF("UPDATE style_parameter SET value= %s WHERE id = %s",
2914 array("text", "integer"),
2915 array("10px", $row2["id"]));
2916 }
2917 else
2918 {
2919 $nid = $ilDB->nextId("style_parameter");
2920 $ilDB->manipulateF("INSERT INTO style_parameter ".
2921 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2922 array("integer", "integer", "text", "text", "text", "text"),
2923 array($nid, $a_id, "div", $curr_class, $curr_par, "10px"));
2924 }
2925 }
2926 }
2927
2928 $ilDB->manipulateF("UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2929 array("text", "text", "integer"),
2930 array("div", "p", $a_id));
2931
2932 }

References $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 2181 of file class.ilObjStyleSheet.php.

2182 {
2183 $this->cleanExportDirectory();
2184 $ex_dir = $this->createExportDirectory();
2185 $this->createExportSubDirectory();
2186 $this->exportXML($ex_dir."/".$this->getExportSubDir());
2187//echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
2189 $ex_dir."/".$this->getExportSubDir()."/images");
2190 if (is_file($ex_dir."/".$this->getExportSubDir().".zip"))
2191 {
2192 unlink($ex_dir."/".$this->getExportSubDir().".zip");
2193 }
2194 ilUtil::zip($ex_dir."/".$this->getExportSubDir(),
2195 $ex_dir."/".$this->getExportSubDir().".zip");
2196
2197 return $ex_dir."/".$this->getExportSubDir().".zip";
2198 }
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)

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

2204 {
2205 $file = $a_dir."/style.xml";
2206
2207 // open file
2208 if (!($fp = @fopen($file,"w")))
2209 {
2210 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2211 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2212 }
2213
2214 // set file permissions
2215 chmod($file, 0770);
2216
2217 // write xml data into the file
2218 fwrite($fp, $this->getXML());
2219
2220 // close file
2221 fclose($fp);
2222
2223 }
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 2569 of file class.ilObjStyleSheet.php.

2570 {
2571 $pars = array();
2572 foreach(self::$parameter as $p => $v)
2573 {
2574 $pars[$p] = $v["values"];
2575 }
2576
2577 return $pars;
2578 }

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

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

References $a_type.

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName (   $a_name)

Remove a color.

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

3052 {
3053 global $ilDB;
3054
3055 $pos = strpos($a_name, "(");
3056 if ($pos > 0)
3057 {
3058 $a_i = substr($a_name, $pos + 1);
3059 $a_i = str_replace(")", "", $a_i);
3060 $a_name = substr($a_name, 0, $pos);
3061 }
3062
3063 $set = $ilDB->query("SELECT color_code FROM style_color WHERE ".
3064 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3065 " color_name = ".$ilDB->quote($a_name, "text"));
3066 if ($rec = $ilDB->fetchAssoc($set))
3067 {
3068 if ($a_i == "")
3069 {
3070 return "#".$rec["color_code"];
3071 }
3072 else
3073 {
3074 return "#".ilObjStyleSheet::_getColorFlavor($rec["color_code"],
3075 (int) $a_i);
3076 }
3077 }
3078 }

References $ilDB.

Referenced by writeCSSFile().

+ Here is the caller graph for this function:

◆ getColors()

ilObjStyleSheet::getColors ( )

Get colors of style.

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

2942 {
2943 global $ilDB;
2944
2945 $set = $ilDB->query("SELECT * FROM style_color WHERE ".
2946 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
2947 "ORDER BY color_name");
2948
2949 $colors = array();
2950 while ($rec = $ilDB->fetchAssoc($set))
2951 {
2952 $colors[] = array(
2953 "name" => $rec["color_name"],
2954 "code" => $rec["color_code"]
2955 );
2956 }
2957
2958 return $colors;
2959 }

References $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 1875 of file class.ilObjStyleSheet.php.

1876 {
1877 return "./Services/COPage/css/print_content.css";
1878 }

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

+ Here is the caller graph for this function:

◆ getContentStylePath()

static ilObjStyleSheet::getContentStylePath (   $a_style_id)
static

get content style path

static (to avoid full reading)

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

1830 {
1831 global $ilias;
1832
1833 $rand = rand(1,999999);
1834
1835
1836 // check global fixed content style
1837 $fixed_style = $ilias->getSetting("fixed_content_style_id");
1838 if ($fixed_style > 0)
1839 {
1840 $a_style_id = $fixed_style;
1841 }
1842
1843 // check global default style
1844 if ($a_style_id <= 0)
1845 {
1846 $a_style_id = $ilias->getSetting("default_content_style_id");
1847 }
1848
1849 if ($a_style_id > 0 && ilObject::_exists($a_style_id))
1850 {
1851 // check whether file is up to date
1852 if (!ilObjStyleSheet::_lookupUpToDate($a_style_id))
1853 {
1854 $style = new ilObjStyleSheet($a_style_id);
1855 $style->writeCSSFile();
1856 }
1857
1858 $path = ilUtil::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css?dummy=$rand";
1859 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
1861
1862 return $path;
1863 }
1864 else // todo: work this out
1865 {
1866 return "./Services/COPage/css/content.css";
1867 }
1868 }
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 ilObject\$ilias, $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(), 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 1784 of file class.ilObjStyleSheet.php.

1785 {
1786 global $ilSetting;
1787
1788 // check global fixed content style
1789 $fixed_style = $ilSetting->get("fixed_content_style_id");
1790 if ($fixed_style > 0)
1791 {
1792 $a_style_id = $fixed_style;
1793 }
1794
1795 // check global default style
1796 if ($a_style_id <= 0)
1797 {
1798 $a_style_id = $ilSetting->get("default_content_style_id");
1799 }
1800
1801 if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty")
1802 {
1803 return $a_style_id;
1804 }
1805
1806 return 0;
1807 }
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilSetting
Definition: privfeed.php:17

References $ilSetting, and ilObject\_lookupType().

Referenced by ilMediaPoolPageGUI\__construct(), ilLMPresentationGUI\basicPageGuiInit(), 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 2164 of file class.ilObjStyleSheet.php.

2165 {
2166 if ($this->export_sub_dir == "")
2167 {
2168 return "sty_".$this->getId();
2169 }
2170 else
2171 {
2172 return $this->export_sub_dir;
2173 }
2174 }

Referenced by createExportSubDirectory(), and export().

+ Here is the caller graph for this function:

◆ getHideStatus()

ilObjStyleSheet::getHideStatus (   $a_type,
  $a_char 
)

Get characteristic hide status.

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

1165 {
1166 global $ilDB;
1167
1168 $set = $ilDB->query("SELECT hide FROM style_char ".
1169 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1170 " type = ".$ilDB->quote($a_type, "text")." AND ".
1171 " characteristic = ".$ilDB->quote($a_char, "text")
1172 );
1173 $rec = $ilDB->fetchAssoc($set);
1174
1175 return $rec["hide"];
1176 }

References $a_type, and $ilDB.

◆ getImages()

ilObjStyleSheet::getImages ( )

Get images of style.

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

1326 {
1327 $dir = $this->getImagesDirectory();
1328 $images = array();
1329 if (is_dir($dir))
1330 {
1331 $entries = ilUtil::getDir($dir);
1332 foreach($entries as $entry)
1333 {
1334 if (substr($entry["entry"],0,1) == ".")
1335 {
1336 continue;
1337 }
1338 if ($entry["type"] != "dir")
1339 {
1340 $images[] = $entry;
1341 }
1342 }
1343 }
1344
1345 return $images;
1346 }
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 1299 of file class.ilObjStyleSheet.php.

1300 {
1302 }

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

Referenced by copyImagesToDir(), create(), deleteImage(), export(), getImages(), getThumbnailsDirectory(), 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 3319 of file class.ilObjStyleSheet.php.

3320 {
3321 global $ilDB;
3322
3323 $set = $ilDB->query("SELECT max(order_nr) mnr FROM sty_media_query ".
3324 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")
3325 );
3326 $rec = $ilDB->fetchAssoc($set);
3327
3328 return (int) $rec["mnr"];
3329 }

References $ilDB.

Referenced by addMediaQuery().

+ Here is the caller graph for this function:

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

Get colors of style.

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

3274 {
3275 global $ilDB;
3276
3277 $set = $ilDB->query("SELECT * FROM sty_media_query WHERE ".
3278 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
3279 "ORDER BY order_nr");
3280
3281 $mq = array();
3282 while ($rec = $ilDB->fetchAssoc($set))
3283 {
3284 $mq[] = $rec;
3285 }
3286
3287 return $mq;
3288 }

References $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 3353 of file class.ilObjStyleSheet.php.

3354 {
3355 global $ilDB;
3356
3357 $set = $ilDB->query("SELECT * FROM sty_media_query ".
3358 " WHERE id = ".$ilDB->quote($a_id, "integer")
3359 );
3360 return $ilDB->fetchAssoc($set);
3361 }

References $ilDB.

◆ getMetaData()

& ilObjStyleSheet::getMetaData ( )

get meta data object

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

855 {
856 return $this->meta_data;
857 }

◆ getParametersOfClass()

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

Get parameters of class.

Parameters

return

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

1816 {
1817 if (is_array($this->style_class[$a_type][$a_class][$a_mq_id]))
1818 {
1819 return $this->style_class[$a_type][$a_class][$a_mq_id];
1820 }
1821 return array();
1822 }

References $a_type.

◆ getPlaceHolderStylePath()

static ilObjStyleSheet::getPlaceHolderStylePath ( )
static

get placeholder style path (for Page Layouts)

static

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

1896 {
1897 return "./Services/COPage/css/placeholder.css";
1898 }

Referenced by ilPageLayoutGUI\__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 577 of file class.ilObjStyleSheet.php.

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

◆ getScope()

ilObjStyleSheet::getScope ( )

Get scope.

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

627 {
628 return $this->scope;
629 }

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

1994 {
1995 return $this->style;
1996 }

References $style.

Referenced by writeCSSFile().

+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

2407 {
2408 $groups = array();
2409
2410 foreach (self::$parameter as $parameter => $props)
2411 {
2412 $groups[$props["group"]][] = $parameter;
2413 }
2414 return $groups;
2415 }

References $parameter.

◆ getSyntaxStylePath()

static ilObjStyleSheet::getSyntaxStylePath ( )
static

get syntax style path

static

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

1886 {
1887 return "./Services/COPage/css/syntaxhighlight.css";
1888 }

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(), 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 3554 of file class.ilObjStyleSheet.php.

3555 {
3556 global $ilDB;
3557
3558 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3559 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
3560 " AND id = ".$ilDB->quote($a_t_id, "integer"));
3561
3562 if ($rec = $ilDB->fetchAssoc($set))
3563 {
3564 $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3565
3566 $template = $rec;
3567 return $template;
3568 }
3569 return array();
3570 }
getTemplateClasses($a_tid)
Get template classes.

References $ilDB, and getTemplateClasses().

+ Here is the call graph for this function:

◆ getTemplateClasses()

ilObjStyleSheet::getTemplateClasses (   $a_tid)

Get template classes.

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

3439 {
3440 global $ilDB;
3441 $set = $ilDB->query("SELECT * FROM style_template_class WHERE ".
3442 "template_id = ".$ilDB->quote($a_tid, "integer"));
3443
3444 $class = array();
3445 while ($rec = $ilDB->fetchAssoc($set))
3446 {
3447 $key = $rec["class_type"];
3448 $class[$key] = $rec["class"];
3449 }
3450
3451 return $class;
3452 }

References $ilDB.

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

3417 {
3418 global $ilDB;
3419
3420 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3421 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3422 "temp_type = ".$ilDB->quote($a_type, "text")." ".
3423 "ORDER BY name");
3424
3425 $templates = array();
3426 while ($rec = $ilDB->fetchAssoc($set))
3427 {
3428 $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3429 $templates[] = $rec;
3430 }
3431
3432 return $templates;
3433 }

References $a_type, $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 3601 of file class.ilObjStyleSheet.php.

3602 {
3603 global $ilDB;
3604
3605 $tag = "<StyleTemplates>";
3606
3607 $ttypes = array("table", "vaccordion", "haccordion", "carousel");
3608
3609 foreach ($ttypes as $ttype)
3610 {
3611 $ts = $this->getTemplates($ttype);
3612
3613 foreach($ts as $t)
3614 {
3616 /*$atts = array("table" => "TableClass",
3617 "caption" => "CaptionClass",
3618 "row_head" => "RowHeadClass",
3619 "row_foot" => "RowFootClass",
3620 "col_head" => "ColHeadClass",
3621 "col_foot" => "ColFootClass",
3622 "odd_row" => "OddRowClass",
3623 "even_row" => "EvenRowClass",
3624 "odd_col" => "OddColClass",
3625 "even_col" => "EvenColClass");*/
3626 $c = $t["classes"];
3627
3628 $tag.= '<StyleTemplate Name="'.$t["name"].'">';
3629
3630 foreach ($atts as $type => $t)
3631 {
3632 if ($c[$type] != "")
3633 {
3634 $tag.= '<StyleClass Type="'.$type.'" Value="'.$c[$type].'" />';
3635 }
3636 }
3637
3638 $tag.= "</StyleTemplate>";
3639 }
3640 }
3641
3642 $tag.= "</StyleTemplates>";
3643
3644//echo htmlentities($tag);
3645 return $tag;
3646 }
getTemplates($a_type)
Get table templates of style.

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

+ Here is the call graph for this function:

◆ getThumbnailsDirectory()

ilObjStyleSheet::getThumbnailsDirectory ( )

Get thumbnails directory.

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

1317 {
1318 return $this->getImagesDirectory().
1319 "/thumbnails";
1320 }

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

611 {
612 return $this->up_to_date;
613 }

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

2023 {
2024 $xml.= "<StyleSheet>\n";
2025
2026 // title and description
2027 $xml.= "<Title>".$this->handleXmlString($this->getTitle())."</Title>";
2028 $xml.= "<Description>".$this->handleXmlString($this->getDescription())."</Description>\n";
2029
2030 // style classes
2031 foreach($this->chars as $char)
2032 {
2033 $xml.= "<Style Tag=\"".ilObjStyleSheet::_determineTag($char["type"]).
2034 "\" Type=\"".$char["type"]."\" Class=\"".$char["class"]."\">\n";
2035 foreach($this->style as $style)
2036 {
2037 if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"])
2038 {
2039 foreach($style as $tag)
2040 {
2041 $xml.="<StyleParameter Name=\"".$tag["parameter"]."\" Value=\"".$tag["value"]."\" Custom=\"".$tag["custom"]."\" />\n";
2042 }
2043 }
2044 }
2045 $xml.= "</Style>\n";
2046 }
2047
2048 // colors
2049 foreach($this->getColors() as $color)
2050 {
2051 $xml.="<StyleColor Name=\"".$color["name"]."\" Code=\"".$color["code"]."\"/>\n";
2052 }
2053
2054 // templates
2056 foreach ($tcts as $tct => $v)
2057 {
2058 $ts = $this->getTemplates($tct);
2059
2060 foreach ($ts as $t)
2061 {
2062 $xml.="<StyleTemplate Type=\"".$tct."\" Name=\"".$t["name"]."\">\n";
2063 foreach ($t["classes"] as $ct => $c)
2064 {
2065 if ($c != "")
2066 {
2067 $xml.="<StyleTemplateClass ClassType=\"".$ct."\" Class=\"".$c."\"/>\n";
2068 }
2069 }
2070 $xml.="</StyleTemplate>\n";
2071 }
2072 }
2073
2074
2075 $xml.= "</StyleSheet>";
2076//echo "<pre>".htmlentities($xml)."</pre>"; exit;
2077 return $xml;
2078 }
getColors()
Get colors of style.
getDescription()
get object description
getTitle()
get object title @access public

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

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

2014 {
2015 return str_replace("&", "&amp;", $a_str);
2016 }

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

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

References ilObject\$lng, $log, 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 2261 of file class.ilObjStyleSheet.php.

2262 {
2263 parent::create();
2264
2265 $im_dir = $this->createImportDirectory();
2266
2267 // handle uploaded files
2268 if (is_array($a_file))
2269 {
2270 ilUtil::moveUploadedFile($a_file["tmp_name"],
2271 $a_file["name"], $im_dir."/".$a_file["name"]);
2272 $file_name = $a_file["name"];
2273 }
2274 else // handle not directly uploaded files
2275 {
2276 $pi = pathinfo($a_file);
2277 $file_name = $pi["basename"];
2278 copy($a_file, $im_dir."/".$file_name);
2279 }
2280 $file = pathinfo($file_name);
2281
2282 // unzip file
2283 if (strtolower($file["extension"] == "zip"))
2284 {
2285 ilUtil::unzip($im_dir."/".$file_name);
2286 $subdir = basename($file["basename"],".".$file["extension"]);
2287 if (!is_dir($im_dir."/".$subdir))
2288 {
2289 $subdir = "style"; // check style subdir
2290 }
2291 $xml_file = $im_dir."/".$subdir."/style.xml";
2292 }
2293 else // handle xml file directly (old style)
2294 {
2295 $xml_file = $im_dir."/".$file_name;
2296 }
2297
2298 // load information from xml file
2299//echo "-$xml_file-";
2300 $this->createFromXMLFile($xml_file, true);
2301
2302 // copy images
2303 $this->createImagesDirectory();
2304 if (is_dir($im_dir."/".$subdir."/images"))
2305 {
2306 ilUtil::rCopy($im_dir."/".$subdir."/images",
2307 $this->getImagesDirectory());
2308 }
2309
2311 $this->read();
2312 $this->writeCSSFile();
2313 }
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
createImportDirectory()
Create import directory.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file

References $file, _addMissingStyleClassesToStyle(), createFromXMLFile(), createImagesDirectory(), createImportDirectory(), ilObject\getId(), ilUtil\moveUploadedFile(), 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 2524 of file class.ilObjStyleSheet.php.

2525 {
2526 foreach (self::$core_styles as $s)
2527 {
2528 if ($s["type"] == $a_type && $s["class"] == $a_class)
2529 {
2530 return true;
2531 }
2532 }
2533 return false;
2534 }

References $a_type.

◆ lookupObjectForStyle()

static ilObjStyleSheet::lookupObjectForStyle (   $a_style_id)
static

Lookup object style.

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

3795 {
3796 global $ilDB;
3797
3798 $obj_ids = array();
3799 if (ilObject::_lookupType($a_style_id) == "sty")
3800 {
3801 $set = $ilDB->query("SELECT DISTINCT obj_id FROM style_usage " .
3802 " WHERE style_id = " . $ilDB->quote($a_style_id, "integer")
3803 );
3804
3805 while ($rec = $ilDB->fetchAssoc($set))
3806 {
3807 $obj_ids[] = $rec["obj_id"];
3808 }
3809 }
3810 return $obj_ids;
3811 }

References $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 3774 of file class.ilObjStyleSheet.php.

3775 {
3776 global $ilDB;
3777
3778 $set = $ilDB->query("SELECT style_id FROM style_usage ".
3779 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
3780 );
3781 $rec = $ilDB->fetchAssoc($set);
3782
3783 if (ilObject::_lookupType($rec["style_id"]) == "sty")
3784 {
3785 return (int) $rec["style_id"];
3786 }
3787
3788 return 0;
3789 }

References $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 3744 of file class.ilObjStyleSheet.php.

3745 {
3746 global $ilDB;
3747
3748 $set = $ilDB->query("SELECT value FROM style_setting ".
3749 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
3750 " AND name = ".$ilDB->quote($a_name, "text")
3751 );
3752 $rec = $ilDB->fetchAssoc($set);
3753
3754 return $rec["value"];
3755 }

References $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 3575 of file class.ilObjStyleSheet.php.

3576 {
3577 return self::_lookupTemplateName($a_t_id);
3578 }
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 3672 of file class.ilObjStyleSheet.php.

3673 {
3674 global $ilDB;
3675
3676 $set = $ilDB->query("SELECT preview FROM style_template ".
3677 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3678 if ($rec = $ilDB->fetchAssoc($set))
3679 {
3680 return $rec["preview"];
3681 }
3682
3683 return "";
3684 }

References $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 586 of file class.ilObjStyleSheet.php.

587 {
588 $this->ilias->raiseError("Operation ilObjStyleSheet::putInTree() not allowed.",$this->ilias->error_obj->FATAL);
589 }

◆ read()

ilObjStyleSheet::read ( )

read style properties

Reimplemented from ilObject.

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

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

References $ilDB, $res, 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 3022 of file class.ilObjStyleSheet.php.

3023 {
3024 global $ilDB;
3025
3026 $ilDB->manipulate("DELETE FROM style_color WHERE ".
3027 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3028 " color_name = ".$ilDB->quote($a_name, "text"));
3029 }

References $ilDB.

◆ removeTemplate()

ilObjStyleSheet::removeTemplate (   $a_t_id)

Remove table template.

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

3708 {
3709 global $ilDB;
3710
3711 $ilDB->manipulate("DELETE FROM style_template WHERE ".
3712 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3713 " id = ".$ilDB->quote($a_t_id, "integer"));
3714
3715 $ilDB->manipulate("DELETE FROM style_template_class WHERE ".
3716 "template_id = ".$ilDB->quote($a_t_id, "integer")
3717 );
3718
3719 }

References $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 1935 of file class.ilObjStyleSheet.php.

1936 {
1937 ilObjStyleSheet::_replaceStylePar($this->getId(), $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id, $a_custom);
1938 }
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 1149 of file class.ilObjStyleSheet.php.

1150 {
1151 global $ilDB;
1152
1153 $ilDB->manipulate("UPDATE style_char SET ".
1154 " hide = ".$ilDB->quote((int) $a_hide, "integer").
1155 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1156 " type = ".$ilDB->quote($a_type, "text")." AND ".
1157 " characteristic = ".$ilDB->quote($a_char, "text")
1158 );
1159 }

References $a_type, and $ilDB.

◆ saveMediaQueryOrder()

ilObjStyleSheet::saveMediaQueryOrder (   $a_order_nr = null)

Save media query order.

Parameters
int$a_order_nrorder nr

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

3385 {
3386 global $ilDB;
3387
3388 $mqueries = $this->getMediaQueries();
3389 if (is_array ($a_order_nr))
3390 {
3391 foreach ($mqueries as $k => $mq)
3392 {
3393 $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
3394 }
3395 $mqueries = ilUtil::sortArray($mqueries, "order_nr", "", true);
3396 }
3397 $cnt = 10;
3398 foreach ($mqueries as $mq)
3399 {
3400 $ilDB->manipulate("UPDATE sty_media_query SET ".
3401 " order_nr = ".$ilDB->quote($cnt, "integer").
3402 " WHERE id = ".$ilDB->quote($mq["id"], "integer")
3403 );
3404 $cnt+= 10;
3405 }
3406 }
getMediaQueries()
Get colors of style.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

References $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 1140 of file class.ilObjStyleSheet.php.

1141 {
1142 $this->chars = $a_chars;
1143 // $this->chars_by_type[$a_type];
1144 }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir (   $a_dir)

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

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

2157 {
2158 $this->export_sub_dir = $a_dir;
2159 }

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

570 {
571 $this->ilias->raiseError("Operation ilObjStyleSheet::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
572 }

◆ setScope()

ilObjStyleSheet::setScope (   $a_scope)

Set scope.

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

619 {
620 $this->scope = $a_scope;
621 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle (   $a_style)

set styles

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

2002 {
2003 $this->style = $a_style;
2004 }

◆ setUpToDate()

ilObjStyleSheet::setUpToDate (   $a_up_to_date = true)

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

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

603 {
604 $this->up_to_date = $a_up_to_date;
605 }

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

3538 {
3539 global $ilDB;
3540
3541 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3542 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3543 "name = ".$ilDB->quote($a_template_name, "text"));
3544 if ($rec = $ilDB->fetchAssoc($set))
3545 {
3546 return true;
3547 }
3548 return false;
3549 }

References $ilDB.

◆ update()

ilObjStyleSheet::update ( )

update object in db

@access public

Returns
boolean true on success

Reimplemented from ilObject.

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

1901 {
1902 global $ilDB;
1903
1904 parent::update();
1905 $this->read(); // this could be done better
1906 $this->writeCSSFile();
1907
1908 $q = "UPDATE style_data ".
1909 "SET category = ".$ilDB->quote((int) $this->getScope(), "integer").
1910 " WHERE id = ".$ilDB->quote($this->getId(), "integer");
1911 $ilDB->manipulate($q);
1912 }

References $ilDB, ilObject\getId(), getScope(), read(), 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 2979 of file class.ilObjStyleSheet.php.

2980 {
2981 global $ilDB;
2982
2983 // todo: update names in parameters as well
2984
2985 $ilDB->manipulate("UPDATE style_color SET ".
2986 "color_name = ".$ilDB->quote($a_new_name, "text").", ".
2987 "color_code = ".$ilDB->quote($a_code, "text").
2988 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
2989 " AND color_name = ".$ilDB->quote($a_name, "text"));
2990 ilObjStyleSheet::_writeUpToDate($this->getId(), false);
2991
2992 // rename also the name in the style parameter values
2993 if ($a_name != $a_new_name)
2994 {
2995 $set = $ilDB->query("SELECT * FROM style_parameter ".
2996 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
2997 " AND (".
2998 " parameter = ".$ilDB->quote("background-color", "text"). " OR ".
2999 " parameter = ".$ilDB->quote("color", "text"). " OR ".
3000 " parameter = ".$ilDB->quote("border-color", "text"). " OR ".
3001 " parameter = ".$ilDB->quote("border-top-color", "text"). " OR ".
3002 " parameter = ".$ilDB->quote("border-bottom-color", "text"). " OR ".
3003 " parameter = ".$ilDB->quote("border-left-color", "text"). " OR ".
3004 " parameter = ".$ilDB->quote("border-right-color", "text").
3005 ")");
3006 while ($rec = $ilDB->fetchAssoc($set))
3007 {
3008 if ($rec["value"] == "!".$a_name ||
3009 is_int(strpos($rec["value"], "!".$a_name."(")))
3010 {
3011 // parameter is based on color -> rename it
3012 $this->replaceStylePar($rec["tag"], $rec["class"],
3013 $rec["parameter"], str_replace($a_name, $a_new_name, $rec["value"]), $rec["type"], $rec["mq_id"], $rec["custom"]);
3014 }
3015 }
3016 }
3017 }

References $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 3337 of file class.ilObjStyleSheet.php.

3338 {
3339 global $ilDB;
3340
3341 $ilDB->manipulate("UPDATE sty_media_query SET ".
3342 " mquery = ".$ilDB->quote($a_mquery, "text").
3343 " WHERE id = ".$ilDB->quote($a_id, "integer")
3344 );
3345 }

References $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 1920 of file class.ilObjStyleSheet.php.

1921 {
1922 global $ilDB;
1923
1924 $q = "UPDATE style_parameter SET VALUE = ".
1925 $ilDB->quote($a_value, "text")." WHERE id = ".
1926 $ilDB->quote($a_id, "integer");
1927 $style_set = $ilDB->manipulate($q);
1928 }

References $ilDB.

◆ updateTemplate()

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

Update table template.

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

3494 {
3495 global $ilDB;
3496
3497 $ilDB->manipulate("UPDATE style_template SET ".
3498 "name = ".$ilDB->quote($a_name, "text").
3499 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3500
3501 $ilDB->manipulate("DELETE FROM style_template_class WHERE ".
3502 "template_id = ".$ilDB->quote($a_t_id, "integer")
3503 );
3504 foreach ($a_classes as $t => $c)
3505 {
3506 $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3507 "(template_id, class_type, class)".
3508 " VALUES (".
3509 $ilDB->quote($a_t_id, "integer").",".
3510 $ilDB->quote($t, "text").",".
3511 $ilDB->quote($c, "text").
3512 ")");
3513 }
3514
3515 }

References $ilDB, and $t.

◆ uploadImage()

ilObjStyleSheet::uploadImage (   $a_file)

Upload image.

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

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

References createImagesDirectory(), getImagesDirectory(), getThumbnailsDirectory(), ilUtil\moveUploadedFile(), 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 1598 of file class.ilObjStyleSheet.php.

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

References $style, _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 3724 of file class.ilObjStyleSheet.php.

3725 {
3726 global $ilDB;
3727
3728 $ilDB->manipulate("DELETE FROM style_setting WHERE ".
3729 " style_id = ".$ilDB->quote($this->getId(), "integer").
3730 " AND name = ".$ilDB->quote($a_name, "text")
3731 );
3732
3733 $ilDB->manipulate("INSERT INTO style_setting ".
3734 "(style_id, name, value) VALUES (".
3735 $ilDB->quote($this->getId(), "integer").",".
3736 $ilDB->quote($a_name, "text").",".
3737 $ilDB->quote($a_value, "text").
3738 ")");
3739 }

References $ilDB.

◆ writeStyleUsage()

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

Write style usage.

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

3761 {
3762 global $ilDB;
3763
3764 $ilDB->replace("style_usage", array(
3765 "obj_id" => array("integer", (int) $a_obj_id)),
3766 array(
3767 "style_id" => array("integer", (int) $a_style_id))
3768 );
3769 }

References $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 3651 of file class.ilObjStyleSheet.php.

3652 {
3653 global $ilDB;
3654 $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3655 $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3656 $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3657//echo "1-".strlen($a_preview_html)."-";
3658//echo htmlentities($a_preview_html);
3659 if (strlen($a_preview_html) > 4000)
3660 {
3661//echo "2";
3662 $a_preview_html = "";
3663 }
3664 $ilDB->manipulate("UPDATE style_template SET ".
3665 "preview = ".$ilDB->quote($a_preview_html, "text").
3666 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3667 }

References $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 = "./Services/Style/Content/basic_style/style.xml"
staticprotected

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

◆ $basic_style_image_dir

ilObjStyleSheet::$basic_style_image_dir = "./Services/Style/Content/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"))

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: