ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilObjStyleSheet Class Reference

Class ilObjStyleSheet. More...

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

Public Member Functions

 ilObjStyleSheet ($a_id=0, $a_call_by_reference=false)
 Constructor @access public. More...
 
 setRefId ()
 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 ()
 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...
 
 _writeUpToDate ($a_id, $a_up_to_date)
 Write up to date. More...
 
 _lookupUpToDate ($a_id)
 Looup up to date. More...
 
 _writeStandard ($a_id, $a_std)
 Write standard flag. More...
 
 _writeScope ($a_id, $a_scope)
 Write scope. More...
 
 _lookupStandard ($a_id)
 Lookup standard flag. More...
 
 _writeActive ($a_id, $a_active)
 Write active flag. More...
 
 _lookupActive ($a_id)
 Lookup active flag. More...
 
 _getStandardStyles ($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
 Get standard styles. More...
 
 _getClonableContentStyles ()
 Get all clonable styles (active standard styles and individual learning module styles with write permission). 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)
 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...
 
 getContentStylePath ($a_style_id)
 get content style path More...
 
 getContentPrintStyle ()
 get content print style More...
 
 getSyntaxStylePath ()
 get syntax style path More...
 
 getPlaceHolderStylePath ()
 get placeholder style path (for Page Layouts) 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...
 
 _replaceStylePar ($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
 
 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...
 
 _getPseudoClasses ($tag)
 
 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)
 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...
 
 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
 ilObject ($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 ($a_force_db=false)
 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 ()
 
 _lookupOwnerName ($a_owner_id)
 lookup owner name for owner id More...
 
 setOwner ($a_owner)
 set object owner More...
 
 getCreateDate ()
 get create date @access public More...
 
 getLastUpdateDate ()
 get last update date @access public More...
 
 getDiskUsage ()
 
 setObjDataRecord ($a_record)
 set object_data record (note: this method should only be called from the ilObjectFactory class) More...
 
 create ()
 create More...
 
 update ()
 update object in db More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 updateOwner ()
 update owner of object in db More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _lookupOwner ($a_id)
 lookup object owner More...
 
 _lookupLastUpdate ($a_id, $a_as_string=false)
 lookup last update More...
 
 _getLastUpdateOfObjects ($a_objs)
 Get last update for a set of media objects. More...
 
 _setDeletedDate ($a_ref_id)
 only called in ilTree::saveSubTree More...
 
 _resetDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _lookupDeletedDate ($a_ref_id)
 only called in ilObjectGUI::insertSavedNodes More...
 
 _writeTitle ($a_obj_id, $a_title)
 write title to db (static) More...
 
 _writeDescription ($a_obj_id, $a_desc)
 write description to db (static) More...
 
 _writeImportId ($a_obj_id, $a_import_id)
 write import id to db (static) More...
 
 _isInTrash ($a_ref_id)
 checks wether object is in trash More...
 
 _hasUntrashedReference ($a_obj_id)
 checks wether an object has at least one reference that is not in trash More...
 
 _getObjectsDataForType ($a_type, $a_omit_trash=false)
 get all objects of a certain type 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...
 
 notify ($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
 notifys an object about an event occured Based on the event passed, each object may decide how it reacts. 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...
 
 _lookupCreationDate ($a_id)
 Lookup creation date. More...
 

Static Public Member Functions

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 _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 _getTemplateClassTypes ($a_template_type="")
 Get template class types. More...
 
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 _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 Public Member Functions inherited from ilObject
static _lookupObjIdByImportId ($a_import_id)
 
static _getAllReferences ($a_id)
 get all reference ids of object More...
 
static _lookupTitle ($a_id)
 lookup object title More...
 
static _getIdsForTitle ($title, $type='', $partialmatch=false)
 
static _lookupDescription ($a_id)
 lookup object description More...
 
static _lookupObjId ($a_id)
 
static setDeletedDates ($a_ref_ids)
 Set deleted date @global type $ilDB. More...
 
static _lookupType ($a_id, $a_reference=false)
 lookup object type More...
 
static _lookupObjectId ($a_ref_id)
 lookup object id 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 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
 
 $obj_data_record
 object_data record More...
 

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/basic_style/style.xml"
 
static $basic_style_image_dir = "./Services/Style/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.

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

2528 {
2529 global $ilDB;
2530
2531 if ($a_styles == "")
2532 {
2533 $styles = ilObject::_getObjectsDataForType("sty");
2534 }
2535 else
2536 {
2537 $styles = $a_styles;
2538 }
2541
2542 // get all core image files
2543 $core_images = array();
2544 $core_dir = self::$basic_style_image_dir;
2545 if (is_dir($core_dir))
2546 {
2547 $dir = opendir($core_dir);
2548 while($file = readdir($dir))
2549 {
2550 if (substr($file, 0, 1) != "." && is_file($core_dir."/".$file))
2551 {
2552 $core_images[] = $file;
2553 }
2554 }
2555 }
2556
2557 foreach ($styles as $style)
2558 {
2559 $id = $style["id"];
2560
2561 foreach($core_styles as $cs)
2562 {
2563 // check, whether core style class exists
2564 $set = $ilDB->queryF("SELECT * FROM style_char WHERE style_id = %s ".
2565 "AND type = %s AND characteristic = %s",
2566 array("integer", "text", "text"),
2567 array($id, $cs["type"], $cs["class"]));
2568
2569 // if not, add core style class
2570 if (!($rec = $ilDB->fetchAssoc($set)))
2571 {
2572 $ilDB->manipulateF(
2573 "INSERT INTO style_char (style_id, type, characteristic) ".
2574 " VALUES (%s,%s,%s) ",
2575 array("integer", "text", "text"),
2576 array($id, $cs["type"], $cs["class"]));
2577
2578 $xpath = new DOMXPath($bdom);
2579 $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '".$cs["tag"]."' and @Type='".
2580 $cs["type"]."' and @Class='".$cs["class"]."']/StyleParameter");
2581 foreach ($par_nodes as $par_node)
2582 {
2583 // check whether style parameter exists
2584 $set = $ilDB->queryF("SELECT * FROM style_parameter WHERE style_id = %s ".
2585 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2586 array("integer", "text", "text", "text", "text"),
2587 array($id, $cs["type"], $cs["class"],
2588 $cs["tag"], $par_node->getAttribute("Name")));
2589
2590 // if not, create style parameter
2591 if (!($rec = $ilDB->fetchAssoc($set)))
2592 {
2593 $spid = $ilDB->nextId("style_parameter");
2594 $st = $ilDB->manipulateF("INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) ".
2595 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2596 array("integer", "integer", "text", "text", "text", "text", "text"),
2597 array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2598 $par_node->getAttribute("Name"), $par_node->getAttribute("Value")));
2599 }
2600 }
2601 }
2602 }
2603
2604 // now check, whether some core image files are missing
2607 reset($core_images);
2608 foreach($core_images as $cim)
2609 {
2610 if (!is_file($imdir."/".$cim))
2611 {
2612 copy($core_dir."/".$cim, $imdir."/".$cim);
2613 }
2614 }
2615 }
2616 }
print $file
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.
_getObjectsDataForType($a_type, $a_omit_trash=false)
get all objects of a certain type
global $ilDB

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

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

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

1219 {
1220 global $ilErr;
1221
1222 $sty_data_dir = ilUtil::getWebspaceDir()."/sty";
1223 ilUtil::makeDir($sty_data_dir);
1224 if(!is_writable($sty_data_dir))
1225 {
1226 $ilErr->raiseError("Style data directory (".$sty_data_dir
1227 .") not writeable.", $ilErr->FATAL);
1228 }
1229
1230 $style_dir = $sty_data_dir."/sty_".$a_style_id;
1231 ilUtil::makeDir($style_dir);
1232 if(!@is_dir($style_dir))
1233 {
1234 $ilErr->raiseError("Creation of style directory failed (".
1235 $style_dir.").",$ilErr->FATAL);
1236 }
1237
1238 // create images subdirectory
1239 $im_dir = $style_dir."/images";
1240 ilUtil::makeDir($im_dir);
1241 if(!@is_dir($im_dir))
1242 {
1243 $ilErr->raiseError("Creation of Import Directory failed (".
1244 $im_dir.").", $ilErr->FATAL);
1245 }
1246
1247 // create thumbnails directory
1248 $thumb_dir = $style_dir."/images/thumbnails";
1249 ilUtil::makeDir($thumb_dir);
1250 if(!@is_dir($thumb_dir))
1251 {
1252 $ilErr->raiseError("Creation of Import Directory failed (".
1253 $thumb_dir.").", $ilErr->FATAL);
1254 }
1255 }
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 ...

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

Referenced by _addMissingStyleClassesToAllStyles(), 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 2494 of file class.ilObjStyleSheet.php.

2495 {
2496 return self::$assigned_tags[$a_type];
2497 }

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

3044 {
3045 $r["r"] = substr($a_rgb, 0, 2);
3046 $r["g"] = substr($a_rgb, 2, 2);
3047 $r["b"] = substr($a_rgb, 4, 2);
3048
3049 if ($as_dec)
3050 {
3051 $r["r"] = (int) hexdec($r["r"]);
3052 $r["g"] = (int) hexdec($r["g"]);
3053 $r["b"] = (int) hexdec($r["b"]);
3054 }
3055
3056 return $r;
3057 }

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

Get basic style dom.

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

815 {
816 global $ilBench;
817
818 if (!is_object(self::$basic_style_dom))
819 {
820 self::$basic_style_dom = new DOMDocument();
821 self::$basic_style_dom->load(self::$basic_style_file);
822 }
823
825 }
global $ilBench
Definition: ilias.php:18

References $basic_style_dom, and $ilBench.

Referenced by _addMissingStyleClassesToAllStyles().

+ Here is the caller graph for this function:

◆ _getClonableContentStyles()

ilObjStyleSheet::_getClonableContentStyles ( )

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

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

761 {
762 global $ilAccess, $ilDB;
763
764 $clonable_styles = array();
765
766 $q = "SELECT * FROM style_data";
767 $style_set = $ilDB->query($q);
768 while($style_rec = $ilDB->fetchAssoc($style_set))
769 {
770 $clonable = false;
771 if ($style_rec["standard"] == 1)
772 {
773 if ($style_rec["active"] == 1)
774 {
775 $clonable = true;
776 }
777 }
778 else
779 {
780 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
781 $obj_ids = ilObjContentObject::_lookupContObjIdByStyleId($style_rec["id"]);
782 foreach($obj_ids as $id)
783 {
785 foreach($ref as $ref_id)
786 {
787 if ($ilAccess->checkAccess("write", "", $ref_id))
788 {
789 $clonable = true;
790 }
791 }
792 }
793 }
794 if ($clonable)
795 {
796 $clonable_styles[$style_rec["id"]] =
797 ilObject::_lookupTitle($style_rec["id"]);
798 }
799 }
800 return $clonable_styles;
801 }
_lookupContObjIdByStyleId($a_style_id)
lookup style sheet ID
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(), and ilObject\_lookupTitle().

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

3017 {
3018 $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
3019 $hls = ilObjStyleSheet::_RGBToHLS($rgb);
3020
3021 if ($a_i > 0)
3022 {
3023 $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
3024 }
3025 if ($a_i < 0)
3026 {
3027 $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
3028 }
3029
3030 $rgb = ilObjStyleSheet::_HLSToRGB($hls);
3031
3032 foreach ($rgb as $k => $v)
3033 {
3034 $rgb[$k] = str_pad(dechex($v), 2, "0", STR_PAD_LEFT);
3035 }
3036
3037 return $rgb["r"].$rgb["g"].$rgb["b"];
3038 }
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 2457 of file class.ilObjStyleSheet.php.

2458 {
2459 $c_styles = array();
2460 foreach (self::$core_styles as $cstyle)
2461 {
2462 $c_styles[$cstyle["type"].".".ilObjStyleSheet::_determineTag($cstyle["type"]).".".$cstyle["class"]]
2463 = array("type" => $cstyle["type"],
2464 "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2465 "class" => $cstyle["class"]);
2466 }
2467 return $c_styles;
2468 }
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 2400 of file class.ilObjStyleSheet.php.

2401 {
2403 }

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

1269 {
1270 return ilUtil::getWebspaceDir()."/sty/sty_".$a_style_id.
1271 "/images";
1272 }

References ilUtil\getWebspaceDir().

Referenced by _addMissingStyleClassesToAllStyles(), and getImagesDirectory().

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

◆ _getPseudoClasses()

ilObjStyleSheet::_getPseudoClasses (   $tag)

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

2485 {
2486 return self::$pseudo_classes[$tag];
2487 }

◆ _getStandardStyles()

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

Get standard styles.

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

716 {
717 global $ilDB, $ilias, $tree;
718
719 $default_style = $ilias->getSetting("default_content_style_id");
720
721 $and_str = "";
722 if (!$a_include_deactivated)
723 {
724 $and_str = " AND active = 1";
725 }
726
727 $q = "SELECT * FROM style_data ".
728 " WHERE standard = 1".$and_str;
729 $res = $ilDB->query($q);
730 $styles = array();
731 while($sty = $ilDB->fetchAssoc($res))
732 {
733 if (!$a_exclude_default_style || $default_style != $sty["id"])
734 {
735 // check scope
736 if ($a_scope > 0 && $sty["category"] > 0)
737 {
738 if ($tree->isInTree($sty["category"]) &&
739 $tree->isInTree($a_scope))
740 {
741 $path = $tree->getPathId($a_scope);
742 if (!in_array($sty["category"], $path))
743 {
744 continue;
745 }
746 }
747 }
748 $styles[$sty["id"]] = ilObject::_lookupTitle($sty["id"]);
749 }
750 }
751
752 return $styles;
753 }
$path
Definition: index.php:22

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

2370 {
2371 $input = self::$parameter[$par]["input"];
2372 return $input;
2373 }

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

2406 {
2407 if ($a_no_percentage)
2408 {
2410 }
2411 return self::$num_unit;
2412 }

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

2382 {
2383 if ($a_tag == "")
2384 {
2385 return self::$parameter;
2386 }
2387 $par = array();
2388 foreach (self::$parameter as $k => $v)
2389 {
2390 if (is_array(self::$filtered_groups[$v["group"]]) &&
2391 !in_array($a_tag, self::$filtered_groups[$v["group"]]))
2392 {
2393 continue;
2394 }
2395 $par[$k] = $v;
2396 }
2397 return $par;
2398 }

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

2376 {
2377 $subpar = self::$parameter[$par]["subpar"];
2378 return $subpar;
2379 }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues (   $par)
static

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

2415 {
2416 return self::$parameter[$par]["values"];
2417 }

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

2440 {
2441 foreach (self::$style_super_types as $s => $t)
2442 {
2443 if (in_array($a_type, $t))
2444 {
2445 return $s;
2446 }
2447 if ($a_type == $s)
2448 {
2449 return $s;
2450 }
2451 }
2452 }

References $t.

Referenced by ilObjStyleSheetGUI\ilObjStyleSheetGUI().

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

2474 {
2475 if ($a_template_type == "")
2476 {
2477 return self::$templates;
2478 }
2479
2480 return self::$templates[$a_template_type];
2481 }

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

3116 {
3117 $h = $a_hls["h"] / 255;
3118 $l = $a_hls["l"] / 255;
3119 $s = $a_hls["s"] / 255;
3120
3121 $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
3122
3123 // If S=0, define R, G, and B all to L
3124 if ($s == 0)
3125 {
3126 $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
3127 }
3128 else
3129 {
3130
3131 if ($l < 0.5)
3132 {
3133 $temp2 = $l * (1.0 + $s);
3134 }
3135 else
3136 {
3137 $temp2 = $l + $s - $l * $s;
3138 }
3139
3140 $temp1 = 2.0 * $l - $temp2;
3141
3142
3143 # For each of R, G, B, compute another temporary value, temp3, as follows:
3144 foreach ($rgb as $k => $v)
3145 {
3146 switch ($k)
3147 {
3148 case "r":
3149 $temp3 = $h + 1.0 / 3.0;
3150 break;
3151
3152 case "g":
3153 $temp3 = $h;
3154 break;
3155
3156 case "b":
3157 $temp3 = $h - 1.0/3.0;
3158 break;
3159 }
3160 if ($temp3 < 0)
3161 {
3162 $temp3 = $temp3 + 1.0;
3163 }
3164 if ($temp3 > 1)
3165 {
3166 $temp3 = $temp3 - 1.0;
3167 }
3168
3169 if (6.0 * $temp3 < 1)
3170 {
3171 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3172 }
3173 else if (2.0 * $temp3 < 1)
3174 {
3175 $rgb[$k] = $temp2;
3176 }
3177 else if (3.0 * $temp3 < 2)
3178 {
3179 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0/3.0) - $temp3) * 6.0;
3180 }
3181 else
3182 {
3183 $rgb[$k] = $temp1;
3184 }
3185 }
3186 }
3187
3188 $rgb["r"] = round($rgb["r"] * 255);
3189 $rgb["g"] = round($rgb["g"] * 255);
3190 $rgb["b"] = round($rgb["b"] * 255);
3191
3192 return $rgb;
3193 }

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable (   $a_type)
static

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

2430 {
2431 return in_array($a_type, self::$expandable_types);
2432 }

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

2435 {
2436 return in_array($a_type, self::$hideable_types);
2437 }

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

+ Here is the caller graph for this function:

◆ _lookupActive()

ilObjStyleSheet::_lookupActive (   $a_id)

Lookup active flag.

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

700 {
701 global $ilDB;
702
703 $q = "SELECT * FROM style_data ".
704 " WHERE id = ".$ilDB->quote($a_id, "integer");
705 $res = $ilDB->query($q);
706 $sty = $ilDB->fetchAssoc($res);
707
708 return (boolean) $sty["active"];
709 }

References $ilDB, and $res.

Referenced by ilObjStyleSettingsGUI\editContentStylesObject().

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

3595 {
3596 global $ilDB;
3597
3598 $set = $ilDB->query("SELECT id FROM style_template ".
3599 " WHERE style_id = ".$ilDB->quote($a_style_id, "integer").
3600 " AND name = ".$ilDB->quote($a_name, "text"));
3601 if ($rec = $ilDB->fetchAssoc($set))
3602 {
3603 return $rec["id"];
3604 }
3605
3606 return false;
3607 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ _lookupUpToDate()

ilObjStyleSheet::_lookupUpToDate (   $a_id)

Looup up to date.

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

631 {
632 global $ilDB;
633
634 $q = "SELECT uptodate FROM style_data ".
635 " WHERE id = ".$ilDB->quote($a_id, "integer");
636 $res = $ilDB->query($q);
637 $sty = $ilDB->fetchAssoc($res);
638
639 return (boolean) $sty["uptodate"];
640 }

References $ilDB, and $res.

Referenced by getContentStylePath().

+ Here is the caller graph for this function:

◆ _replaceStylePar()

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

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

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

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

Referenced by replaceStylePar().

+ Here is the call graph for this function:
+ 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 3062 of file class.ilObjStyleSheet.php.

3063 {
3064 $r = $a_rgb["r"] / 255;
3065 $g = $a_rgb["g"] / 255;
3066 $b = $a_rgb["b"] / 255;
3067
3068 // max / min
3069 $max = max($r,$g,$b);
3070 $min = min($r,$g,$b);
3071
3072 //lightness
3073 $l = ($max + $min) / 2;
3074
3075 if ($max == $min)
3076 {
3077 $s = 0;
3078 $h = 0;
3079 }
3080 else
3081 {
3082 if ($l < 0.5)
3083 {
3084 $s = ($max - $min) / ($max + $min);
3085 }
3086 else
3087 {
3088 $s = ($max - $min) / (2.0 - $max - $min);
3089 }
3090
3091 if ($r == $max)
3092 {
3093 $h = ($g - $b) / ($max - $min);
3094 }
3095 else if ($g == $max)
3096 {
3097 $h = 2.0 + ($b - $r) / ($max - $min);
3098 }
3099 else if ($b == $max)
3100 {
3101 $h = 4.0 + ($r - $g) / ($max - $min);
3102 }
3103 }
3104
3105 $hls["h"] = round(($h / 6) * 255);
3106 $hls["l"] = round($l * 255);
3107 $hls["s"] = round($s * 255);
3108
3109 return $hls;
3110 }

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _writeActive()

ilObjStyleSheet::_writeActive (   $a_id,
  $a_active 
)

Write active flag.

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

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

References $ilDB.

Referenced by ilObjStyleSettingsGUI\saveActiveStylesObject().

+ Here is the caller graph for this function:

◆ _writeScope()

ilObjStyleSheet::_writeScope (   $a_id,
  $a_scope 
)

Write scope.

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

659 {
660 global $ilDB;
661
662 $q = "UPDATE style_data SET category = ".
663 $ilDB->quote((int) $a_scope, "integer").
664 " WHERE id = ".$ilDB->quote($a_id, "integer");
665 $ilDB->manipulate($q);
666 }

References $ilDB.

Referenced by ilObjStyleSettingsGUI\saveScopeObject().

+ Here is the caller graph for this function:

◆ _writeStandard()

ilObjStyleSheet::_writeStandard (   $a_id,
  $a_std 
)

Write standard flag.

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

646 {
647 global $ilDB;
648
649 $q = "UPDATE style_data SET standard = ".
650 $ilDB->quote((int) $a_std, "integer").
651 " WHERE id = ".$ilDB->quote($a_id, "integer");
652 $ilDB->manipulate($q);
653 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ _writeUpToDate()

ilObjStyleSheet::_writeUpToDate (   $a_id,
  $a_up_to_date 
)

Write up to date.

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

618 {
619 global $ilDB;
620
621 $q = "UPDATE style_data SET uptodate = ".
622 $ilDB->quote((int) $a_up_to_date, "integer").
623 " WHERE id = ".$ilDB->quote($a_id, "integer");
624 $ilDB->manipulate($q);
625 }

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

1008 {
1009 global $ilDB;
1010
1011 // delete characteristic record
1012 $ilDB->manipulateF("INSERT INTO style_char (style_id, type, characteristic, hide)".
1013 " VALUES (%s,%s,%s,%s) ",
1014 array("integer", "text", "text", "integer"),
1015 array($this->getId(), $a_type, $a_char, $a_hidden));
1016
1017 $this->setUpToDate(false);
1018 $this->_writeUpToDate($this->getId(), false);
1019 }
_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)

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

2898 {
2899 global $ilDB;
2900
2901 $ilDB->manipulate("INSERT INTO style_color (style_id, color_name, color_code)".
2902 " VALUES (".
2903 $ilDB->quote($this->getId(), "integer").",".
2904 $ilDB->quote($a_name, "text").",".
2905 $ilDB->quote($a_code, "text").
2906 ")");
2907 }

References $ilDB.

Referenced by copyCharacteristic(), and create().

+ Here is the caller graph for this function:

◆ addMediaQuery()

ilObjStyleSheet::addMediaQuery (   $a_mquery)

Add media query.

Parameters
string$a_mquerymedia query

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

3228 {
3229 global $ilDB;
3230
3231 $id = $ilDB->nextId("sty_media_query");
3232 $order_nr = $this->getMaxMQueryOrderNr() + 10;
3233
3234 $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)".
3235 " VALUES (".
3236 $ilDB->quote($id, "integer").",".
3237 $ilDB->quote($this->getId(), "integer").",".
3238 $ilDB->quote($a_mquery, "text").",".
3239 $ilDB->quote($order_nr, "integer").
3240 ")");
3241
3242 return $id;
3243 }
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 1180 of file class.ilObjStyleSheet.php.

1181 {
1182 global $ilDB;
1183
1184 $avail_params = $this->getAvailableParameters();
1185 $tag = explode(".", $a_tag);
1186 $value = $avail_params[$a_par][0];
1187 $id = $ilDB->nextId("style_parameter");
1188 $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES ".
1189 "(".
1190 $ilDB->quote($id, "integer").",".
1191 $ilDB->quote($this->getId(), "integer").",".
1192 $ilDB->quote($a_type, "text").",".
1193 $ilDB->quote($tag[0], "text").",".
1194 $ilDB->quote($tag[1], "text").",".
1195 $ilDB->quote($a_par, "text").",".
1196 $ilDB->quote($value, "text").",".
1197 $ilDB->quote($a_mq_id, "integer").",".
1198 $ilDB->quote($a_custom, "integer").
1199 ")";
1200 $ilDB->manipulate($q);
1201 $this->read();
1202 $this->writeCSSFile();
1203 }
read()
read style properties
static getAvailableParameters()
Get available parameters.
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory

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

3389 {
3390 global $ilDB;
3391
3392 $tid = $ilDB->nextId("style_template");
3393 $ilDB->manipulate($q = "INSERT INTO style_template ".
3394 "(id, style_id, name, temp_type)".
3395 " VALUES (".
3396 $ilDB->quote($tid, "integer").",".
3397 $ilDB->quote($this->getId(), "integer").",".
3398 $ilDB->quote($a_name, "text").",".
3399 $ilDB->quote($a_type, "text").
3400 ")");
3401
3402 foreach ($a_classes as $t => $c)
3403 {
3404 $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3405 "(template_id, class_type, class)".
3406 " VALUES (".
3407 $ilDB->quote($tid, "integer").",".
3408 $ilDB->quote($t, "text").",".
3409 $ilDB->quote($c, "text").
3410 ")");
3411 }
3412
3413 include_once("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
3414 $this->writeTemplatePreview($tid,
3415 ilObjStyleSheetGUI::_getTemplatePreview($this, $a_type, $tid, true));
3416
3417 return $tid;
3418 }
_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 $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:

◆ assignMetaData()

ilObjStyleSheet::assignMetaData ( $a_meta_data)

assign meta data object

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

807 {
808 $this->meta_data =& $a_meta_data;
809 }

◆ characteristicExists()

ilObjStyleSheet::characteristicExists (   $a_char,
  $a_style_type 
)

Check whether characteristic exists.

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

990 {
991 global $ilDB;
992
993 $set = $ilDB->queryF(
994 "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
995 array("integer", "text", "text"),
996 array($this->getId(), $a_char, $a_style_type));
997 if ($rec = $ilDB->fetchAssoc($set))
998 {
999 return true;
1000 }
1001 return false;
1002 }

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

2070 {
2071 $sty_data_dir = ilUtil::getDataDir()."/sty";
2072 $style_dir = $sty_data_dir."/sty_".$this->getId();
2073 // create export subdirectory
2074 $ex_dir = $style_dir."/export";
2075
2076 if (is_dir($ex_dir))
2077 {
2078 ilUtil::delDir($ex_dir, true);
2079 }
2080 }
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 2967 of file class.ilObjStyleSheet.php.

2968 {
2969 global $ilDB;
2970
2971 $set = $ilDB->query("SELECT * FROM style_color WHERE ".
2972 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
2973 "color_name = ".$ilDB->quote($a_color_name, "text"));
2974 if ($rec = $ilDB->fetchAssoc($set))
2975 {
2976 return true;
2977 }
2978 return false;
2979 }

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

1029 {
1030 global $ilDB;
1031
1032 if (!$this->characteristicExists($a_to_char, $a_from_type))
1033 {
1034 $this->addCharacteristic($a_from_type, $a_to_char);
1035 }
1036 $this->deleteStyleParOfChar($a_from_type, $a_to_char);
1037
1038 $from_style = new ilObjStyleSheet($a_from_style_id);
1039
1040 // todo fix using mq_id
1041 $pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
1042
1043 $colors = array();
1044 foreach ($pars as $p => $v)
1045 {
1046 if (substr($v, 0, 1) == "!")
1047 {
1048 $colors[] = substr($v, 1);
1049 }
1051 $a_to_char, $p, $v, $a_from_type);
1052 }
1053
1054 // copy colors
1055 foreach ($colors as $c)
1056 {
1057 if (!$this->colorExists($c))
1058 {
1059 $this->addColor($c, $from_style->getColorCodeForName($c));
1060 }
1061 }
1062 }
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.
ilObjStyleSheet($a_id=0, $a_call_by_reference=false)
Constructor @access public.
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(), ilObjStyleSheet(), and replaceStylePar().

+ Here is the call graph for this function:

◆ copyImagesToDir()

ilObjStyleSheet::copyImagesToDir (   $a_target)

Copy images to directory.

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

1167 {
1168 ilUtil::rCopy($this->getImagesDirectory(), $a_target);
1169 }
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 838 of file class.ilObjStyleSheet.php.

839 {
840 global $ilDB;
841
842 parent::create();
843
844 if ($a_from_style == 0)
845 {
846 if (!$a_import_mode)
847 {
848 // copy styles from basic style
849 $this->createFromXMLFile(self::$basic_style_file, true);
850
851 // copy images from basic style
852 $this->createImagesDirectory();
853 ilUtil::rCopy(self::$basic_style_image_dir,
854 $this->getImagesDirectory());
855 }
856 }
857 else
858 {
859 // get style parameter records
860 $def = array();
861 $q = "SELECT * FROM style_parameter WHERE style_id = ".
862 $ilDB->quote($a_from_style, "integer");
863 $par_set = $ilDB->query($q);
864 while($par_rec = $ilDB->fetchAssoc($par_set))
865 {
866 $def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
867 "parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
868 "type" => $par_rec["type"], "mq_id" => $par_rec["mq_id"], "custom" => $par_rec["custom"]);
869 }
870
871 // get style characteristics records
872 $chars = array();
873 $q = "SELECT * FROM style_char WHERE style_id = ".
874 $ilDB->quote($a_from_style, "integer");
875 $par_set = $ilDB->query($q);
876 while($par_rec = $ilDB->fetchAssoc($par_set))
877 {
878 $chars[] = array("type" => $par_rec["type"], "characteristic" => $par_rec["characteristic"]);
879 }
880
881
882 // copy media queries
883 $from_style = new ilObjStyleSheet($a_from_style);
884 $mqs = $from_style->getMediaQueries();
885 $mq_mapping = array();
886 foreach ($mqs as $mq)
887 {
888 $nid = $this->addMediaQuery($mq["mquery"]);
889 $mq_mapping[$mq["id"]] = $nid;
890 }
891
892 // default style settings
893 foreach ($def as $sty)
894 {
895 $id = $ilDB->nextId("style_parameter");
896 $q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES ".
897 "(".
898 $ilDB->quote($id, "integer").",".
899 $ilDB->quote($this->getId(), "integer").",".
900 $ilDB->quote($sty["tag"], "text").",".
901 $ilDB->quote($sty["class"], "text").",".
902 $ilDB->quote($sty["parameter"], "text").",".
903 $ilDB->quote($sty["value"], "text").",".
904 $ilDB->quote($sty["type"], "text").",".
905 $ilDB->quote((int) $mq_mapping[$sty["mq_id"]], "integer").",".
906 $ilDB->quote($sty["custom"], "integer").
907 ")";
908 $ilDB->manipulate($q);
909 }
910
911 // insert style characteristics
912 foreach ($chars as $char)
913 {
914 $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
915 "(".$ilDB->quote($this->getId(), "integer").",".
916 $ilDB->quote($char["type"], "text").",".
917 $ilDB->quote($char["characteristic"], "text").")";
918 $ilDB->manipulate($q);
919 }
920
921 // add style_data record
922 $q = "INSERT INTO style_data (id, uptodate, category) VALUES ".
923 "(".$ilDB->quote($this->getId(), "integer").", 0,".
924 $ilDB->quote((int) $this->getScope(), "integer").")";
925 $ilDB->manipulate($q);
926
927 // copy images
928 $this->createImagesDirectory();
929 ilUtil::rCopy($from_style->getImagesDirectory(),
930 $this->getImagesDirectory());
931
932 // copy colors
933 $colors = $from_style->getColors();
934 foreach ($colors as $c)
935 {
936 $this->addColor($c["name"], $c["code"]);
937 }
938
939 // copy templates
941 foreach ($tcts as $tct => $v)
942 {
943 $templates = $from_style->getTemplates($tct);
944 foreach ($templates as $t)
945 {
946 $this->addTemplate($tct, $t["name"], $t["classes"]);
947 }
948 }
949
950 }
951
952 $this->read();
953 if (!$a_import_mode)
954 {
955 $this->writeCSSFile();
956 }
957 }
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.
addMediaQuery($a_mquery)
Add media query.
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.

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

+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjStyleSheet::createExportDirectory ( )

Create export directory.

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

2037 {
2038 $sty_data_dir = ilUtil::getDataDir()."/sty";
2039 ilUtil::makeDir($sty_data_dir);
2040 if(!is_writable($sty_data_dir))
2041 {
2042 $this->ilias->raiseError("Style data directory (".$sty_data_dir
2043 .") not writeable.",$this->ilias->error_obj->FATAL);
2044 }
2045
2046 $style_dir = $sty_data_dir."/sty_".$this->getId();
2047 ilUtil::makeDir($style_dir);
2048 if(!@is_dir($style_dir))
2049 {
2050 $this->ilias->raiseError("Creation of style directory failed (".
2051 $style_dir.").",$this->ilias->error_obj->FATAL);
2052 }
2053
2054 // create export subdirectory
2055 $ex_dir = $style_dir."/export";
2056 ilUtil::makeDir($ex_dir);
2057 if(!@is_dir($ex_dir))
2058 {
2059 $this->ilias->raiseError("Creation of Import Directory failed (".
2060 $ex_dir.").",$this->ilias->error_obj->FATAL);
2061 }
2062
2063 return $ex_dir;
2064 }
redirection script todo: (a better solution should control the processing via a xml file)

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

2087 {
2088 $ex_dir = $this->createExportDirectory();
2089 $ex_sub_dir = $ex_dir."/".$this->getExportSubDir();
2090 ilUtil::makeDir($ex_sub_dir);
2091 if(!is_writable($ex_sub_dir))
2092 {
2093 $this->ilias->raiseError("Style data directory (".$ex_sub_dir
2094 .") not writeable.",$this->ilias->error_obj->FATAL);
2095 }
2096 $ex_sub_images_dir = $ex_sub_dir."/images";
2097 ilUtil::makeDir($ex_sub_images_dir);
2098 if(!is_writable($ex_sub_images_dir))
2099 {
2100 $this->ilias->raiseError("Style data directory (".$ex_sub_images_dir
2101 .") not writeable.",$this->ilias->error_obj->FATAL);
2102 }
2103 }
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 2271 of file class.ilObjStyleSheet.php.

2272 {
2273 global $ilDB;
2274
2275 $this->is_3_10_skin = false;
2276
2277 if (!$a_skip_parent_create)
2278 {
2279 parent::create();
2280 }
2281 include_once("./Services/Style/classes/class.ilStyleImportParser.php");
2282 $importParser = new ilStyleImportParser($a_file, $this);
2283 $importParser->startParsing();
2284
2285 // store style parameter
2286 foreach ($this->style as $style)
2287 {
2288 foreach($style as $tag)
2289 {
2290 $id = $ilDB->nextId("style_parameter");
2291
2292 // migrate old table PageFrame/PageContainer to div
2293 if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
2294 $tag["tag"] == "table")
2295 {
2296 $tag["tag"] = "div";
2297 if ($tag["parameter"] == "width" && $tag["value"] == "100%")
2298 {
2299 continue;
2300 }
2301 }
2302
2303 $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES ".
2304 "(".
2305 $ilDB->quote($id, "integer").",".
2306 $ilDB->quote($this->getId(), "integer").",".
2307 $ilDB->quote($tag["tag"], "text").",".
2308 $ilDB->quote($tag["class"], "text").",".
2309 $ilDB->quote($tag["parameter"], "text").",".
2310 $ilDB->quote($tag["type"], "text").",".
2311 $ilDB->quote($tag["value"], "text").",".
2312 $ilDB->quote((bool) $tag["custom"], "integer").
2313 ")";
2314 $ilDB->manipulate($q);
2315 }
2316 }
2317
2318 // store characteristics
2319 $this->is_3_10_skin = true;
2320 if (is_array($this->chars))
2321 {
2322 foreach ($this->chars as $char)
2323 {
2324 if ($char["type"] != "")
2325 {
2326 $s = substr($char["class"], strlen($char["class"]) - 6);
2327 if ($s != ":hover")
2328 {
2329 $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
2330 "(".$ilDB->quote($this->getId(), "integer").",".
2331 $ilDB->quote($char["type"], "text").",".
2332 $ilDB->quote($char["class"], "text").")";
2333 $ilDB->manipulate($q);
2334 $this->is_3_10_skin = false;
2335 }
2336 }
2337 }
2338 }
2339
2340 // add style_data record
2341 $q = "INSERT INTO style_data (id, uptodate) VALUES ".
2342 "(".$ilDB->quote($this->getId(), "integer").", 0)";
2343 $ilDB->manipulate($q);
2344
2345 $this->update();
2346 $this->read();
2347
2348 if ($this->is_3_10_skin)
2349 {
2350 $this->do_3_10_Migration();
2351 }
2352 //$this->writeCSSFile();
2353 }
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 1209 of file class.ilObjStyleSheet.php.

1210 {
1212 }

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

2181 {
2182 $sty_data_dir = ilUtil::getDataDir()."/sty";
2183 ilUtil::makeDir($sty_data_dir);
2184 if(!is_writable($sty_data_dir))
2185 {
2186 $this->ilias->raiseError("Style data directory (".$sty_data_dir
2187 .") not writeable.",$this->ilias->error_obj->FATAL);
2188 }
2189
2190 $style_dir = $sty_data_dir."/sty_".$this->getId();
2191 ilUtil::makeDir($style_dir);
2192 if(!@is_dir($style_dir))
2193 {
2194 $this->ilias->raiseError("Creation of style directory failed (".
2195 $style_dir.").",$this->ilias->error_obj->FATAL);
2196 }
2197
2198 // create import subdirectory
2199 $im_dir = $style_dir."/import";
2200 ilUtil::makeDir($im_dir);
2201 if(!@is_dir($im_dir))
2202 {
2203 $this->ilias->raiseError("Creation of Import Directory failed (".
2204 $im_dir.").",$this->ilias->error_obj->FATAL);
2205 }
2206
2207 return $im_dir;
2208 }

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

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

◆ delete()

ilObjStyleSheet::delete ( )

delete style object

Reimplemented from ilObject.

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

1424 {
1425 global $ilDB;
1426
1427 // delete object
1428 parent::delete();
1429
1430 // check whether this style is global default
1431 $def_style = $this->ilias->getSetting("default_content_style_id");
1432 if ($def_style == $this->getId())
1433 {
1434 $this->ilias->deleteSetting("default_content_style_id");
1435 }
1436
1437 // check whether this style is global fixed
1438 $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1439 if ($fixed_style == $this->getId())
1440 {
1441 $this->ilias->deleteSetting("fixed_content_style_id");
1442 }
1443
1444 // delete style parameter
1445 $q = "DELETE FROM style_parameter WHERE style_id = ".
1446 $ilDB->quote($this->getId(), "integer");
1447 $ilDB->manipulate($q);
1448
1449 // delete style file
1450 $css_file_name = ilUtil::getWebspaceDir()."/css/style_".$this->getId().".css";
1451 if (is_file($css_file_name))
1452 {
1453 unlink($css_file_name);
1454 }
1455
1456 // delete media queries
1457 $ilDB->manipulate("DELETE FROM sty_media_query WHERE ".
1458 " style_id = ".$ilDB->quote($this->getId(), "integer")
1459 );
1460
1461 // delete entries in learning modules
1462 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1464
1465 // delete style data record
1466 $q = "DELETE FROM style_data WHERE id = ".
1467 $ilDB->quote($this->getId(), "integer");
1468 $ilDB->manipulate($q);
1469
1470 }
_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 962 of file class.ilObjStyleSheet.php.

963 {
964 global $ilDB;
965
966 // check, if characteristic is not a core style
968 if (empty($core_styles[$a_type.".".$a_tag.".".$a_class]))
969 {
970 // delete characteristic record
971 $st = $ilDB->manipulateF(
972 "DELETE FROM style_char WHERE style_id = %s AND type = %s AND characteristic = %s",
973 array("integer", "text", "text"),
974 array($this->getId(), $a_type, $a_class));
975
976 // delete parameter records
977 $st = $ilDB->manipulateF("DELETE FROM style_parameter WHERE style_id = %s AND tag = %s AND type = %s AND class = %s",
978 array("integer", "text", "text", "text"),
979 array($this->getId(), $a_tag, $a_type, $a_class));
980 }
981
982 $this->setUpToDate(false);
983 $this->_writeUpToDate($this->getId(), false);
984 }

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

1385 {
1386 global $ilDB;
1387
1388 $q = "DELETE FROM style_parameter WHERE ".
1389 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1390 " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1391 " class = ".$ilDB->quote($a_class, "text")." AND ".
1392 " mq_id = ".$ilDB->quote($a_mq_id, "integer")." AND ".
1393 " custom = ".$ilDB->quote(1, "integer")." AND ".
1394 " ".$ilDB->equals("type", $a_type, "text", true);
1395
1396 $ilDB->manipulate($q);
1397 }

References $ilDB, and ilObject\getId().

+ Here is the call graph for this function:

◆ deleteImage()

ilObjStyleSheet::deleteImage (   $a_file)

Delete an image.

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

1325 {
1326 if (is_file($this->getImagesDirectory()."/".$a_file))
1327 {
1328 unlink($this->getImagesDirectory()."/".$a_file);
1329 }
1330 if (is_file($this->getThumbnailsDirectory()."/".$a_file))
1331 {
1332 unlink($this->getThumbnailsDirectory()."/".$a_file);
1333 }
1334 }
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 3298 of file class.ilObjStyleSheet.php.

3299 {
3300 global $ilDB;
3301
3302 $ilDB->manipulate("DELETE FROM sty_media_query WHERE ".
3303 " style_id = ".$ilDB->quote($this->getId(), "integer").
3304 " AND id = ".$ilDB->quote($a_id, "integer")
3305 );
3306 $this->saveMediaQueryOrder();
3307 }
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 1341 of file class.ilObjStyleSheet.php.

1342 {
1343 global $ilDB;
1344
1345 $q = "DELETE FROM style_parameter WHERE id = ".
1346 $ilDB->quote($a_id, "integer");
1347 $ilDB->query($q);
1348 }

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

1360 {
1361 global $ilDB;
1362
1363 $q = "DELETE FROM style_parameter WHERE ".
1364 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1365 " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1366 " class = ".$ilDB->quote($a_class, "text")." AND ".
1367 " mq_id = ".$ilDB->quote($a_mq_id, "integer")." AND ".
1368 " custom = ".$ilDB->quote($a_custom, "integer")." AND ".
1369 " ".$ilDB->equals("type", $a_type, "text", true)." AND ".
1370 " parameter = ".$ilDB->quote($a_par, "text");
1371
1372 $ilDB->manipulate($q);
1373 }

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

1408 {
1409 global $ilDB;
1410
1411 $q = "DELETE FROM style_parameter WHERE ".
1412 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1413 " class = ".$ilDB->quote($a_class, "text")." AND ".
1414 " ".$ilDB->equals("type", $a_type, "text", true);
1415
1416 $ilDB->manipulate($q);
1417 }

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

2490 {
2491 return self::$templates[$t][$k];
2492 }

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

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

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

2626 {
2627 global $ilDB;
2628
2629 $this->do_3_9_Migration($this->getId());
2630
2631 //include_once("./Services/Migration/DBUpdate_1385/classes/class.ilStyleMigration.php");
2632 //ilStyleMigration::addMissingStyleCharacteristics($this->getId());
2633
2634 $this->do_3_10_CharMigration($this->getId());
2635
2636 // style_char: type for characteristic
2637 $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?".
2638 " AND style_id = ? ", array("text", "text", "integer"));
2639 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2640 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2641 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2642 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2643 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2644 $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2645
2646 // style_parameter: type for class
2647 $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?".
2648 " AND style_id = ? ", array("text", "text", "integer"));
2649 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2650 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2651 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2652 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2653 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2654 $ilDB->execute($st, array("table", "Page", $this->getId()));
2655
2656 $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?".
2657 " AND style_id = ? ", array("text", "text", "integer"));
2658 $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2659
2660 // style_char: characteristic for characteristic
2661 $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?".
2662 " AND style_id = ? ", array("text", "text", "integer"));
2663 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2664 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2665
2666 // style_parameter: class for class
2667 $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?".
2668 " AND style_id = ? ", array("text", "text", "integer"));
2669 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2670 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2671
2672 // force rewriting of container style
2673 $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?".
2674 " AND style_id = ? ", array("text", "integer"));
2675 $ilDB->execute($st, array("page_cont", $this->getId()));
2676 $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?".
2677 " AND style_id = ? ", array("text", "integer"));
2678 $ilDB->execute($st, array("page_cont", $this->getId()));
2679
2680 }
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 2829 of file class.ilObjStyleSheet.php.

2830 {
2831 global $ilDB;
2832
2833 $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2834 $pars = array("margin-top", "margin-bottom");
2835
2836 foreach ($classes as $curr_class)
2837 {
2838 foreach ($pars as $curr_par)
2839 {
2840 $res2 = $ilDB->queryF("SELECT id FROM style_parameter WHERE style_id = %s".
2841 " AND tag = %s AND class= %s AND parameter = %s",
2842 array("integer", "text", "text", "text"),
2843 array($a_id, "p", $curr_class, $curr_par));
2844 if ($row2 = $ilDB->fetchAssoc($res2))
2845 {
2846 $ilDB->manipulateF("UPDATE style_parameter SET value= %s WHERE id = %s",
2847 array("text", "integer"),
2848 array("10px", $row2["id"]));
2849 }
2850 else
2851 {
2852 $nid = $ilDB->nextId("style_parameter");
2853 $ilDB->manipulateF("INSERT INTO style_parameter ".
2854 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2855 array("integer", "integer", "text", "text", "text", "text"),
2856 array($nid, $a_id, "div", $curr_class, $curr_par, "10px"));
2857 }
2858 }
2859 }
2860
2861 $ilDB->manipulateF("UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2862 array("text", "text", "integer"),
2863 array("div", "p", $a_id));
2864
2865 }

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

2134 {
2135 $this->cleanExportDirectory();
2136 $ex_dir = $this->createExportDirectory();
2137 $this->createExportSubDirectory();
2138 $this->exportXML($ex_dir."/".$this->getExportSubDir());
2139//echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
2141 $ex_dir."/".$this->getExportSubDir()."/images");
2142 if (is_file($ex_dir."/".$this->getExportSubDir().".zip"))
2143 {
2144 unlink($ex_dir."/".$this->getExportSubDir().".zip");
2145 }
2146 ilUtil::zip($ex_dir."/".$this->getExportSubDir(),
2147 $ex_dir."/".$this->getExportSubDir().".zip");
2148
2149 return $ex_dir."/".$this->getExportSubDir().".zip";
2150 }
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 2155 of file class.ilObjStyleSheet.php.

2156 {
2157 $file = $a_dir."/style.xml";
2158
2159 // open file
2160 if (!($fp = @fopen($file,"w")))
2161 {
2162 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2163 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2164 }
2165
2166 // set file permissions
2167 chmod($file, 0770);
2168
2169 // write xml data into the file
2170 fwrite($fp, $this->getXML());
2171
2172 // close file
2173 fclose($fp);
2174
2175 }
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 2502 of file class.ilObjStyleSheet.php.

2503 {
2504 $pars = array();
2505 foreach(self::$parameter as $p => $v)
2506 {
2507 $pars[$p] = $v["values"];
2508 }
2509
2510 return $pars;
2511 }

Referenced by addParameter().

+ Here is the caller graph for this function:

◆ getCharacteristics()

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

Get characteristics.

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

1068 {
1069 $chars = array();
1070
1071 if ($a_type == "")
1072 {
1073 $chars = $this->chars;
1074 }
1075 if (is_array($this->chars_by_type[$a_type]))
1076 {
1077 $chars = $this->chars_by_type[$a_type];
1078 }
1079
1080 if ($a_no_hidden)
1081 {
1082 foreach ($chars as $k => $char)
1083 {
1084 if ($a_type == "" && $this->hidden_chars[$char["type"].":".$char["class"]])
1085 {
1086 unset($chars[$k]);
1087 }
1088 else if ($this->hidden_chars[$a_type.":".$char])
1089 {
1090 unset($chars[$k]);
1091 }
1092 }
1093 }
1094
1095 return $chars;
1096 }

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName (   $a_name)

Remove a color.

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

2985 {
2986 global $ilDB;
2987
2988 $pos = strpos($a_name, "(");
2989 if ($pos > 0)
2990 {
2991 $a_i = substr($a_name, $pos + 1);
2992 $a_i = str_replace(")", "", $a_i);
2993 $a_name = substr($a_name, 0, $pos);
2994 }
2995
2996 $set = $ilDB->query("SELECT color_code FROM style_color WHERE ".
2997 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
2998 " color_name = ".$ilDB->quote($a_name, "text"));
2999 if ($rec = $ilDB->fetchAssoc($set))
3000 {
3001 if ($a_i == "")
3002 {
3003 return "#".$rec["color_code"];
3004 }
3005 else
3006 {
3007 return "#".ilObjStyleSheet::_getColorFlavor($rec["color_code"],
3008 (int) $a_i);
3009 }
3010 }
3011 }

References $ilDB.

Referenced by writeCSSFile().

+ Here is the caller graph for this function:

◆ getColors()

ilObjStyleSheet::getColors ( )

Get colors of style.

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

2875 {
2876 global $ilDB;
2877
2878 $set = $ilDB->query("SELECT * FROM style_color WHERE ".
2879 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
2880 "ORDER BY color_name");
2881
2882 $colors = array();
2883 while ($rec = $ilDB->fetchAssoc($set))
2884 {
2885 $colors[] = array(
2886 "name" => $rec["color_name"],
2887 "code" => $rec["color_code"]
2888 );
2889 }
2890
2891 return $colors;
2892 }

References $ilDB.

Referenced by getXML().

+ Here is the caller graph for this function:

◆ getContentPrintStyle()

ilObjStyleSheet::getContentPrintStyle ( )

get content print style

static

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

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

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

+ Here is the caller graph for this function:

◆ getContentStylePath()

ilObjStyleSheet::getContentStylePath (   $a_style_id)

get content style path

static (to avoid full reading)

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

1785 {
1786 global $ilias;
1787
1788 $rand = rand(1,999999);
1789
1790
1791 // check global fixed content style
1792 $fixed_style = $ilias->getSetting("fixed_content_style_id");
1793 if ($fixed_style > 0)
1794 {
1795 $a_style_id = $fixed_style;
1796 }
1797
1798 // check global default style
1799 if ($a_style_id <= 0)
1800 {
1801 $a_style_id = $ilias->getSetting("default_content_style_id");
1802 }
1803
1804 if ($a_style_id > 0 && ilObject::_exists($a_style_id))
1805 {
1806 // check whether file is up to date
1807 if (!ilObjStyleSheet::_lookupUpToDate($a_style_id))
1808 {
1809 $style = new ilObjStyleSheet($a_style_id);
1810 $style->writeCSSFile();
1811 }
1812
1813 return ilUtil::getWebspaceDir("output").
1814 "/css/style_".$a_style_id.".css?dummy=$rand";
1815 }
1816 else // todo: work this out
1817 {
1818 return "./Services/COPage/css/content.css";
1819 }
1820 }
_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

References ilObject\$ilias, $style, ilObject\_exists(), _lookupUpToDate(), ilUtil\getWebspaceDir(), and ilObjStyleSheet().

Referenced by ilMediaPoolPageGUI\__construct(), ilBlogPostingGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilImprintGUI\__construct(), ilDataCollectionRecordViewGUI\__construct(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilPageObjectGUI\displayMedia(), ilPCDataTableGUI\editData(), ilObjCategoryGUI\executeCommand(), ilLOEditorGUI\executeCommand(), ilTermDefinitionEditorGUI\executeCommand(), ilObjGroupGUI\executeCommand(), ilObjRootFolderGUI\executeCommand(), ilObjTestGUI\executeCommand(), ilObjQuestionPoolGUI\executeCommand(), ilScormExportUtil\exportContentCSS(), ilObjPaymentSettingsGUI\forwardToDocumentsPageObject(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilShopGUI\forwardToPageObject(), ilShopInfoGUI\forwardToPageObject(), ilTermsConditionsGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilObjPaymentSettingsGUI\getDocumentsPageHTML(), ilStartUpGUI\getLoginPageEditorHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilShopGUI\getPageHTML(), ilShopInfoGUI\getPageHTML(), ilTermsConditionsGUI\getPageHTML(), ilLMPresentationGUI\ilGlossary(), ilLMPresentationGUI\ilMedia(), ilLMPresentationGUI\ilPage(), ilAssQuestionPreviewGUI\initStyleSheets(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\listDefinitions(), ilGlossaryPresentationGUI\listTermByGiven(), ilLMEditorGUI\main_header(), ilGlossaryPresentationGUI\media(), ilTestEvaluationGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\populateContentStyleBlock(), ilSCORM2004ScoGUI\sco_preview(), ilSCORM2004NodeGUI\setContentStyle(), ilObjBlogGUI\setContentStyleSheet(), ilObjGlossaryGUI\setContentStyleSheet(), ilObjPortfolioBaseGUI\setContentStyleSheet(), ilObjWikiGUI\setContentStyleSheet(), ilPCParagraphGUI\setStyle(), ilObjDlBookGUI\showAbstract(), ilObjDlBookGUI\showCitation(), ilLMPresentationGUI\showDownloadList(), ilObjMediaPoolGUI\showMedia(), ilLMPresentationGUI\showMessageScreen(), ilContainerObjectiveGUI\showObjectives(), 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 1739 of file class.ilObjStyleSheet.php.

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

References $ilSetting, and ilObject\_lookupType().

Referenced by ilMediaPoolPageGUI\__construct(), ilLMPresentationGUI\basicPageGuiInit(), ilObjBlogGUI\executeCommand(), ilLOEditorGUI\executeCommand(), ilLMPageObjectGUI\executeCommand(), ilSCORM2004PageNodeGUI\executeCommand(), ilObjSystemFolderGUI\executeCommand(), ilObjWikiGUI\executeCommand(), ilContainerStartObjectsGUI\executeCommand(), ilContainerGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), ilContainerStartObjectsContentGUI\getPageHTML(), ilObjPortfolioBaseGUI\handlePageCall(), ilObjSCORM2004LearningModule\prepareHTMLExporter(), ilContainerObjectiveGUI\renderObjective(), ilDataCollectionRecordViewGUI\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 2116 of file class.ilObjStyleSheet.php.

2117 {
2118 if ($this->export_sub_dir == "")
2119 {
2120 return "sty_".$this->getId();
2121 }
2122 else
2123 {
2124 return $this->export_sub_dir;
2125 }
2126 }

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

1126 {
1127 global $ilDB;
1128
1129 $set = $ilDB->query("SELECT hide FROM style_char ".
1130 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1131 " type = ".$ilDB->quote($a_type, "text")." AND ".
1132 " characteristic = ".$ilDB->quote($a_char, "text")
1133 );
1134 $rec = $ilDB->fetchAssoc($set);
1135
1136 return $rec["hide"];
1137 }

References $ilDB.

◆ getImages()

ilObjStyleSheet::getImages ( )

Get images of style.

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

1287 {
1288 $dir = $this->getImagesDirectory();
1289 $images = array();
1290 if (is_dir($dir))
1291 {
1292 $entries = ilUtil::getDir($dir);
1293 foreach($entries as $entry)
1294 {
1295 if (substr($entry["entry"],0,1) == ".")
1296 {
1297 continue;
1298 }
1299 if ($entry["type"] != "dir")
1300 {
1301 $images[] = $entry;
1302 }
1303 }
1304 }
1305
1306 return $images;
1307 }
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 1260 of file class.ilObjStyleSheet.php.

1261 {
1263 }

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

3250 {
3251 global $ilDB;
3252
3253 $set = $ilDB->query("SELECT max(order_nr) mnr FROM sty_media_query ".
3254 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")
3255 );
3256 $rec = $ilDB->fetchAssoc($set);
3257
3258 return (int) $rec["mnr"];
3259 }

References $ilDB.

Referenced by addMediaQuery().

+ Here is the caller graph for this function:

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

Get colors of style.

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

3207 {
3208 global $ilDB;
3209
3210 $set = $ilDB->query("SELECT * FROM sty_media_query WHERE ".
3211 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
3212 "ORDER BY order_nr");
3213
3214 $mq = array();
3215 while ($rec = $ilDB->fetchAssoc($set))
3216 {
3217 $mq[] = $rec;
3218 }
3219
3220 return $mq;
3221 }

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

3284 {
3285 global $ilDB;
3286
3287 $set = $ilDB->query("SELECT * FROM sty_media_query ".
3288 " WHERE id = ".$ilDB->quote($a_id, "integer")
3289 );
3290 return $ilDB->fetchAssoc($set);
3291 }

References $ilDB.

◆ getMetaData()

& ilObjStyleSheet::getMetaData ( )

get meta data object

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

831 {
832 return $this->meta_data;
833 }

◆ getParametersOfClass()

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

Get parameters of class.

Parameters

return

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

1771 {
1772 if (is_array($this->style_class[$a_type][$a_class][$a_mq_id]))
1773 {
1774 return $this->style_class[$a_type][$a_class][$a_mq_id];
1775 }
1776 return array();
1777 }

◆ getPlaceHolderStylePath()

ilObjStyleSheet::getPlaceHolderStylePath ( )

get placeholder style path (for Page Layouts)

static

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

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

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

561 {
562 return "";
563 //$this->ilias->raiseError("Operation ilObjStyleSheet::getRefId() not allowed.",$this->ilias->error_obj->FATAL);
564 }

◆ getScope()

ilObjStyleSheet::getScope ( )

Get scope.

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

610 {
611 return $this->scope;
612 }

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

1946 {
1947 return $this->style;
1948 }

References $style.

Referenced by writeCSSFile().

+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

2359 {
2360 $groups = array();
2361
2362 foreach (self::$parameter as $parameter => $props)
2363 {
2364 $groups[$props["group"]][] = $parameter;
2365 }
2366 return $groups;
2367 }

References $parameter.

◆ getSyntaxStylePath()

ilObjStyleSheet::getSyntaxStylePath ( )

get syntax style path

static

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

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

Referenced by ilMediaPoolPageGUI\__construct(), ilWikiPageGUI\__construct(), ilBlogPostingGUI\__construct(), ilPageLayoutGUI\__construct(), ilPortfolioPageGUI\__construct(), ilImprintGUI\__construct(), ilDataCollectionRecordViewGUI\__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(), ilTestEvaluationGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\populateSyntaxStyleBlock(), ilObjWikiGUI\printViewObject(), ilSCORM2004NodeGUI\setContentStyle(), ilObjDlBookGUI\showAbstract(), ilObjDlBookGUI\showCitation(), ilContainerObjectiveGUI\showObjectives(), ilObjMediaPoolGUI\showPage(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ getTemplate()

ilObjStyleSheet::getTemplate (   $a_t_id)

Get template.

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

3468 {
3469 global $ilDB;
3470
3471 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3472 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
3473 " AND id = ".$ilDB->quote($a_t_id, "integer"));
3474
3475 if ($rec = $ilDB->fetchAssoc($set))
3476 {
3477 $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3478
3479 $template = $rec;
3480 return $template;
3481 }
3482 return array();
3483 }
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 3368 of file class.ilObjStyleSheet.php.

3369 {
3370 global $ilDB;
3371 $set = $ilDB->query("SELECT * FROM style_template_class WHERE ".
3372 "template_id = ".$ilDB->quote($a_tid, "integer"));
3373
3374 $class = array();
3375 while ($rec = $ilDB->fetchAssoc($set))
3376 {
3377 $key = $rec["class_type"];
3378 $class[$key] = $rec["class"];
3379 }
3380
3381 return $class;
3382 }

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

3347 {
3348 global $ilDB;
3349
3350 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3351 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3352 "temp_type = ".$ilDB->quote($a_type, "text")." ".
3353 "ORDER BY name");
3354
3355 $templates = array();
3356 while ($rec = $ilDB->fetchAssoc($set))
3357 {
3358 $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3359 $templates[] = $rec;
3360 }
3361
3362 return $templates;
3363 }

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

3507 {
3508 global $ilDB;
3509
3510 $tag = "<StyleTemplates>";
3511
3512 $ttypes = array("table", "vaccordion", "haccordion");
3513
3514 foreach ($ttypes as $ttype)
3515 {
3516 $ts = $this->getTemplates($ttype);
3517
3518 foreach($ts as $t)
3519 {
3521 /*$atts = array("table" => "TableClass",
3522 "caption" => "CaptionClass",
3523 "row_head" => "RowHeadClass",
3524 "row_foot" => "RowFootClass",
3525 "col_head" => "ColHeadClass",
3526 "col_foot" => "ColFootClass",
3527 "odd_row" => "OddRowClass",
3528 "even_row" => "EvenRowClass",
3529 "odd_col" => "OddColClass",
3530 "even_col" => "EvenColClass");*/
3531 $c = $t["classes"];
3532
3533 $tag.= '<StyleTemplate Name="'.$t["name"].'">';
3534
3535 foreach ($atts as $type => $t)
3536 {
3537 if ($c[$type] != "")
3538 {
3539 $tag.= '<StyleClass Type="'.$type.'" Value="'.$c[$type].'" />';
3540 }
3541 }
3542
3543 $tag.= "</StyleTemplate>";
3544 }
3545 }
3546
3547 $tag.= "</StyleTemplates>";
3548
3549//echo htmlentities($tag);
3550 return $tag;
3551 }
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 1277 of file class.ilObjStyleSheet.php.

1278 {
1279 return $this->getImagesDirectory().
1280 "/thumbnails";
1281 }

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

594 {
595 return $this->up_to_date;
596 }

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

1975 {
1976 $xml.= "<StyleSheet>\n";
1977
1978 // title and description
1979 $xml.= "<Title>".$this->handleXmlString($this->getTitle())."</Title>";
1980 $xml.= "<Description>".$this->handleXmlString($this->getDescription())."</Description>\n";
1981
1982 // style classes
1983 foreach($this->chars as $char)
1984 {
1985 $xml.= "<Style Tag=\"".ilObjStyleSheet::_determineTag($char["type"]).
1986 "\" Type=\"".$char["type"]."\" Class=\"".$char["class"]."\">\n";
1987 foreach($this->style as $style)
1988 {
1989 if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"])
1990 {
1991 foreach($style as $tag)
1992 {
1993 $xml.="<StyleParameter Name=\"".$tag["parameter"]."\" Value=\"".$tag["value"]."\" Custom=\"".$tag["custom"]."\" />\n";
1994 }
1995 }
1996 }
1997 $xml.= "</Style>\n";
1998 }
1999
2000 // colors
2001 foreach($this->getColors() as $color)
2002 {
2003 $xml.="<StyleColor Name=\"".$color["name"]."\" Code=\"".$color["code"]."\"/>\n";
2004 }
2005
2006 // templates
2008 foreach ($tcts as $tct => $v)
2009 {
2010 $ts = $this->getTemplates($tct);
2011
2012 foreach ($ts as $t)
2013 {
2014 $xml.="<StyleTemplate Type=\"".$tct."\" Name=\"".$t["name"]."\">\n";
2015 foreach ($t["classes"] as $ct => $c)
2016 {
2017 if ($c != "")
2018 {
2019 $xml.="<StyleTemplateClass ClassType=\"".$ct."\" Class=\"".$c."\"/>\n";
2020 }
2021 }
2022 $xml.="</StyleTemplate>\n";
2023 }
2024 }
2025
2026
2027 $xml.= "</StyleSheet>";
2028//echo "<pre>".htmlentities($xml)."</pre>"; exit;
2029 return $xml;
2030 }
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 1965 of file class.ilObjStyleSheet.php.

1966 {
1967 return str_replace("&", "&amp;", $a_str);
1968 }

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

1146 {
1147 global $log, $lng;
1148
1149 $lng->loadLanguageModule("style");
1150
1151 $new_obj = new ilObjStyleSheet();
1152 $new_obj->setTitle($this->getTitle()." (".$lng->txt("sty_acopy").")");
1153 $new_obj->setType($this->getType());
1154 $new_obj->setDescription($this->getDescription());
1155 $new_obj->create($this->getId());
1156
1157 $new_obj->writeStyleSetting("disable_auto_margins",
1158 $this->lookupStyleSetting("disable_auto_margins"));
1159
1160 return $new_obj->getId();
1161 }
lookupStyleSetting($a_name)
Lookup style setting.
getType()
get object type @access public

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

+ Here is the call graph for this function:

◆ ilObjStyleSheet()

ilObjStyleSheet::ilObjStyleSheet (   $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)

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

538 {
539 $this->type = "sty";
540 $this->style = array();
541 if($a_call_by_reference)
542 {
543 $this->ilias->raiseError("Can't instantiate style object via reference id.",$this->ilias->error_obj->FATAL);
544 }
545
546 parent::ilObject($a_id, false);
547 }

Referenced by copyCharacteristic(), create(), getContentStylePath(), and ilClone().

+ Here is the caller graph for this function:

◆ import()

ilObjStyleSheet::import (   $a_file)

Import.

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

2214 {
2215 parent::create();
2216
2217 $im_dir = $this->createImportDirectory();
2218
2219 // handle uploaded files
2220 if (is_array($a_file))
2221 {
2222 ilUtil::moveUploadedFile($a_file["tmp_name"],
2223 $a_file["name"], $im_dir."/".$a_file["name"]);
2224 $file_name = $a_file["name"];
2225 }
2226 else // handle not directly uploaded files
2227 {
2228 $pi = pathinfo($a_file);
2229 $file_name = $pi["basename"];
2230 copy($a_file, $im_dir."/".$file_name);
2231 }
2232 $file = pathinfo($file_name);
2233
2234 // unzip file
2235 if (strtolower($file["extension"] == "zip"))
2236 {
2237 ilUtil::unzip($im_dir."/".$file_name);
2238 $subdir = basename($file["basename"],".".$file["extension"]);
2239 if (!is_dir($im_dir."/".$subdir))
2240 {
2241 $subdir = "style"; // check style subdir
2242 }
2243 $xml_file = $im_dir."/".$subdir."/style.xml";
2244 }
2245 else // handle xml file directly (old style)
2246 {
2247 $xml_file = $im_dir."/".$file_name;
2248 }
2249
2250 // load information from xml file
2251//echo "-$xml_file-";
2252 $this->createFromXMLFile($xml_file, true);
2253
2254 // copy images
2255 $this->createImagesDirectory();
2256 if (is_dir($im_dir."/".$subdir."/images"))
2257 {
2258 ilUtil::rCopy($im_dir."/".$subdir."/images",
2259 $this->getImagesDirectory());
2260 }
2261
2263 $this->read();
2264 $this->writeCSSFile();
2265 }
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:

◆ lookupObjectStyle()

static ilObjStyleSheet::lookupObjectStyle (   $a_obj_id)
static

Lookup object style.

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

3680 {
3681 global $ilDB;
3682
3683 $set = $ilDB->query("SELECT style_id FROM style_usage ".
3684 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
3685 );
3686 $rec = $ilDB->fetchAssoc($set);
3687
3688 if (ilObject::_lookupType($rec["style_id"]) == "sty")
3689 {
3690 return (int) $rec["style_id"];
3691 }
3692
3693 return 0;
3694 }

References $ilDB, and ilObject\_lookupType().

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

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

3650 {
3651 global $ilDB;
3652
3653 $set = $ilDB->query("SELECT value FROM style_setting ".
3654 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
3655 " AND name = ".$ilDB->quote($a_name, "text")
3656 );
3657 $rec = $ilDB->fetchAssoc($set);
3658
3659 return $rec["value"];
3660 }

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

3489 {
3490 global $ilDB;
3491
3492 $set = $ilDB->query("SELECT name FROM style_template WHERE ".
3493 " id = ".$ilDB->quote($a_t_id, "integer"));
3494
3495 if ($rec = $ilDB->fetchAssoc($set))
3496 {
3497 return $rec["name"];
3498 }
3499
3500 return false;
3501 }

References $ilDB.

Referenced by ilObjStyleSheetGUI\updateTemplateObject().

+ Here is the caller graph for this function:

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview (   $a_t_id)

Lookup table template preview.

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

3578 {
3579 global $ilDB;
3580
3581 $set = $ilDB->query("SELECT preview FROM style_template ".
3582 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3583 if ($rec = $ilDB->fetchAssoc($set))
3584 {
3585 return $rec["preview"];
3586 }
3587
3588 return "";
3589 }

References $ilDB.

◆ putInTree()

ilObjStyleSheet::putInTree ( )

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

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

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

◆ read()

ilObjStyleSheet::read ( )

read style properties

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

1477 {
1478 global $ilDB;
1479
1480 parent::read();
1481
1482 $q = "SELECT * FROM style_parameter WHERE style_id = ".
1483 $ilDB->quote($this->getId(), "integer")." ORDER BY tag, class, type, mq_id ";
1484 $style_set = $ilDB->query($q);
1485 $ctag = "";
1486 $cclass = "";
1487 $ctype = "";
1488 $cmq_id = 0;
1489 $this->style = array();
1490 // workaround for bug #17586, see also http://stackoverflow.com/questions/3066356/multiple-css-classes-properties-overlapping-based-on-the-order-defined
1491 // e.g. ha_iheada must be written after ha_ihead, since they are acting on the same dom node
1492 // styles that must be added at the end
1493 $this->end_styles = array();
1494 while($style_rec = $ilDB->fetchAssoc($style_set))
1495 {
1496 if ($style_rec["tag"] != $ctag || $style_rec["class"] != $cclass
1497 || $style_rec["type"] != $ctype || $style_rec["mq_id"] != $cmq_id)
1498 {
1499 // add current tag array to style array
1500 if(is_array($tag))
1501 {
1502 if (in_array($ctype, array("ha_iheada", "va_iheada")))
1503 {
1504 $this->end_styles[] = $tag;
1505 }
1506 else
1507 {
1508 $this->style[] = $tag;
1509 }
1510 }
1511 $tag = array();
1512 }
1513 $ctag = $style_rec["tag"];
1514 $cclass = $style_rec["class"];
1515 $ctype = $style_rec["type"];
1516 $cmq_id = $style_rec["mq_id"];
1517 $tag[] = $style_rec;
1518 // added $cmq_id
1519 $this->style_class[$ctype][$cclass][$cmq_id][$style_rec["parameter"]] = $style_rec["value"];
1520 }
1521 if(is_array($tag))
1522 {
1523 $this->style[] = $tag;
1524 }
1525 foreach ($this->end_styles as $s)
1526 {
1527 $this->style[] = $s;
1528 }
1529//var_dump($this->style_class);
1530 $q = "SELECT * FROM style_data WHERE id = ".
1531 $ilDB->quote($this->getId(), "integer");
1532 $res = $ilDB->query($q);
1533 $sty = $ilDB->fetchAssoc($res);
1534 $this->setUpToDate((boolean) $sty["uptodate"]);
1535 $this->setScope($sty["category"]);
1536
1537 // get style characteristics records
1538 $this->chars = array();
1539 $this->chars_by_type = array();
1540 $q = "SELECT * FROM style_char WHERE style_id = ".
1541 $ilDB->quote($this->getId(), "integer").
1542 " ORDER BY type ASC, characteristic ASC";
1543 $par_set = $ilDB->query($q);
1544 while($par_rec = $ilDB->fetchAssoc($par_set))
1545 {
1546 $this->chars[] = array("type" => $par_rec["type"], "class" => $par_rec["characteristic"], "hide" => $par_rec["hide"]);
1547 $this->chars_by_type[$par_rec["type"]][] = $par_rec["characteristic"];
1548 if ($par_rec["hide"])
1549 {
1550 $this->hidden_chars[$par_rec["type"].":".$par_rec["characteristic"]] = true;
1551 }
1552 }
1553// var_dump($this->style); exit;
1554 }
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 2955 of file class.ilObjStyleSheet.php.

2956 {
2957 global $ilDB;
2958
2959 $ilDB->manipulate("DELETE FROM style_color WHERE ".
2960 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
2961 " color_name = ".$ilDB->quote($a_name, "text"));
2962 }

References $ilDB.

◆ removeTemplate()

ilObjStyleSheet::removeTemplate (   $a_t_id)

Remove table template.

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

3613 {
3614 global $ilDB;
3615
3616 $ilDB->manipulate("DELETE FROM style_template WHERE ".
3617 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3618 " id = ".$ilDB->quote($a_t_id, "integer"));
3619
3620 $ilDB->manipulate("DELETE FROM style_template_class WHERE ".
3621 "template_id = ".$ilDB->quote($a_t_id, "integer")
3622 );
3623
3624 }

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

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

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

1111 {
1112 global $ilDB;
1113
1114 $ilDB->manipulate("UPDATE style_char SET ".
1115 " hide = ".$ilDB->quote((int) $a_hide, "integer").
1116 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1117 " type = ".$ilDB->quote($a_type, "text")." AND ".
1118 " characteristic = ".$ilDB->quote($a_char, "text")
1119 );
1120 }

References $ilDB.

◆ saveMediaQueryOrder()

ilObjStyleSheet::saveMediaQueryOrder (   $a_order_nr = null)

Save media query order.

Parameters
int$a_order_nrorder nr

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

3315 {
3316 global $ilDB;
3317
3318 $mqueries = $this->getMediaQueries();
3319 if (is_array ($a_order_nr))
3320 {
3321 foreach ($mqueries as $k => $mq)
3322 {
3323 $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
3324 }
3325 $mqueries = ilUtil::sortArray($mqueries, "order_nr", "", true);
3326 }
3327 $cnt = 10;
3328 foreach ($mqueries as $mq)
3329 {
3330 $ilDB->manipulate("UPDATE sty_media_query SET ".
3331 " order_nr = ".$ilDB->quote($cnt, "integer").
3332 " WHERE id = ".$ilDB->quote($mq["id"], "integer")
3333 );
3334 $cnt+= 10;
3335 }
3336 }
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 1101 of file class.ilObjStyleSheet.php.

1102 {
1103 $this->chars = $a_chars;
1104 // $this->chars_by_type[$a_type];
1105 }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir (   $a_dir)

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

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

2109 {
2110 $this->export_sub_dir = $a_dir;
2111 }

◆ setRefId()

ilObjStyleSheet::setRefId ( )

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

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

553 {
554 $this->ilias->raiseError("Operation ilObjStyleSheet::setRefId() not allowed.",$this->ilias->error_obj->FATAL);
555 }

◆ setScope()

ilObjStyleSheet::setScope (   $a_scope)

Set scope.

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

602 {
603 $this->scope = $a_scope;
604 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle (   $a_style)

set styles

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

1954 {
1955 $this->style = $a_style;
1956 }

◆ setUpToDate()

ilObjStyleSheet::setUpToDate (   $a_up_to_date = true)

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

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

586 {
587 $this->up_to_date = $a_up_to_date;
588 }

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

3451 {
3452 global $ilDB;
3453
3454 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3455 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3456 "name = ".$ilDB->quote($a_template_name, "text"));
3457 if ($rec = $ilDB->fetchAssoc($set))
3458 {
3459 return true;
3460 }
3461 return false;
3462 }

References $ilDB.

◆ update()

ilObjStyleSheet::update ( )

update object in db

@access public

Returns
boolean true on success

Reimplemented from ilObject.

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

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

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

2913 {
2914 global $ilDB;
2915
2916 // todo: update names in parameters as well
2917
2918 $ilDB->manipulate("UPDATE style_color SET ".
2919 "color_name = ".$ilDB->quote($a_new_name, "text").", ".
2920 "color_code = ".$ilDB->quote($a_code, "text").
2921 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
2922 " AND color_name = ".$ilDB->quote($a_name, "text"));
2923 ilObjStyleSheet::_writeUpToDate($this->getId(), false);
2924
2925 // rename also the name in the style parameter values
2926 if ($a_name != $a_new_name)
2927 {
2928 $set = $ilDB->query("SELECT * FROM style_parameter ".
2929 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
2930 " AND (".
2931 " parameter = ".$ilDB->quote("background-color", "text"). " OR ".
2932 " parameter = ".$ilDB->quote("color", "text"). " OR ".
2933 " parameter = ".$ilDB->quote("border-color", "text"). " OR ".
2934 " parameter = ".$ilDB->quote("border-top-color", "text"). " OR ".
2935 " parameter = ".$ilDB->quote("border-bottom-color", "text"). " OR ".
2936 " parameter = ".$ilDB->quote("border-left-color", "text"). " OR ".
2937 " parameter = ".$ilDB->quote("border-right-color", "text").
2938 ")");
2939 while ($rec = $ilDB->fetchAssoc($set))
2940 {
2941 if ($rec["value"] == "!".$a_name ||
2942 is_int(strpos($rec["value"], "!".$a_name."(")))
2943 {
2944 // parameter is based on color -> rename it
2945 $this->replaceStylePar($rec["tag"], $rec["class"],
2946 $rec["parameter"], str_replace($a_name, $a_new_name, $rec["value"]), $rec["type"], $rec["mq_id"], $rec["custom"]);
2947 }
2948 }
2949 }
2950 }

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

3268 {
3269 global $ilDB;
3270
3271 $ilDB->manipulate("UPDATE sty_media_query SET ".
3272 " mquery = ".$ilDB->quote($a_mquery, "text").
3273 " WHERE id = ".$ilDB->quote($a_id, "integer")
3274 );
3275 }

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

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

References $ilDB.

◆ updateTemplate()

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

Update table template.

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

3424 {
3425 global $ilDB;
3426
3427 $ilDB->manipulate("UPDATE style_template SET ".
3428 "name = ".$ilDB->quote($a_name, "text").
3429 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3430
3431 $ilDB->manipulate("DELETE FROM style_template_class WHERE ".
3432 "template_id = ".$ilDB->quote($a_t_id, "integer")
3433 );
3434 foreach ($a_classes as $t => $c)
3435 {
3436 $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3437 "(template_id, class_type, class)".
3438 " VALUES (".
3439 $ilDB->quote($a_t_id, "integer").",".
3440 $ilDB->quote($t, "text").",".
3441 $ilDB->quote($c, "text").
3442 ")");
3443 }
3444
3445 }

References $ilDB, and $t.

◆ uploadImage()

ilObjStyleSheet::uploadImage (   $a_file)

Upload image.

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

1313 {
1314 $this->createImagesDirectory();
1315 @ilUtil::moveUploadedFile($a_file["tmp_name"], $a_file["name"],
1316 $this->getImagesDirectory()."/".$a_file["name"]);
1317 @ilUtil::resizeImage($this->getImagesDirectory()."/".$a_file["name"],
1318 $this->getThumbnailsDirectory()."/".$a_file["name"], 75, 75);
1319 }
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 1559 of file class.ilObjStyleSheet.php.

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

3630 {
3631 global $ilDB;
3632
3633 $ilDB->manipulate("DELETE FROM style_setting WHERE ".
3634 " style_id = ".$ilDB->quote($this->getId(), "integer").
3635 " AND name = ".$ilDB->quote($a_name, "text")
3636 );
3637
3638 $ilDB->manipulate("INSERT INTO style_setting ".
3639 "(style_id, name, value) VALUES (".
3640 $ilDB->quote($this->getId(), "integer").",".
3641 $ilDB->quote($a_name, "text").",".
3642 $ilDB->quote($a_value, "text").
3643 ")");
3644 }

References $ilDB.

◆ writeStyleUsage()

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

Write style usage.

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

3666 {
3667 global $ilDB;
3668
3669 $ilDB->replace("style_usage", array(
3670 "obj_id" => array("integer", (int) $a_obj_id)),
3671 array(
3672 "style_id" => array("integer", (int) $a_style_id))
3673 );
3674 }

References $ilDB.

Referenced by ilObjCategoryGUI\afterSave(), ilObjWiki\create(), ilObjGlossary\create(), ilContainer\create(), ilObjBlog\doUpdate(), ilObjPortfolioBase\doUpdate(), ilBlogImporter\finalProcessing(), 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 3556 of file class.ilObjStyleSheet.php.

3557 {
3558 global $ilDB;
3559 $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3560 $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3561 $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3562//echo "1-".strlen($a_preview_html)."-";
3563//echo htmlentities($a_preview_html);
3564 if (strlen($a_preview_html) > 4000)
3565 {
3566//echo "2";
3567 $a_preview_html = "";
3568 }
3569 $ilDB->manipulate("UPDATE style_template SET ".
3570 "preview = ".$ilDB->quote($a_preview_html, "text").
3571 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3572 }

References $ilDB.

Referenced by addTemplate().

+ Here is the caller graph for this function:

Field Documentation

◆ $assigned_tags

ilObjStyleSheet::$assigned_tags
static

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

◆ $basic_style_dom

ilObjStyleSheet::$basic_style_dom
staticprotected

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

Referenced by _getBasicStyleDom().

◆ $basic_style_file

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

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

◆ $basic_style_image_dir

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

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

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 278 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 372 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"),
"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"),
"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
Initial value:
= array(
"table" => array(
"table" => "table",
"caption" => "table_caption",
"row_head" => "table_cell",
"row_foot" => "table_cell",
"col_head" => "table_cell",
"col_foot" => "table_cell",
"odd_row" => "table_cell",
"even_row" => "table_cell",
"odd_col" => "table_cell",
"even_col" => "table_cell"),
"vaccordion" => array(
"va_cntr" => "va_cntr",
"va_icntr" => "va_icntr",
"va_ihead" => "va_ihead",
"va_iheada" => "va_iheada",
"va_ihcap" => "va_ihcap",
"va_icont" => "va_icont"
),
"haccordion" => array(
"ha_cntr" => "ha_cntr",
"ha_icntr" => "ha_icntr",
"ha_ihead" => "ha_ihead",
"ha_iheada" => "ha_iheada",
"ha_ihcap" => "ha_ihcap",
"ha_icont" => "ha_icont"
)
)

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

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


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