ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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, $order_nr=0)
 Add media query. More...
 
 getMaxMQueryOrderNr ()
 Get maximum media query order nr. More...
 
 updateMediaQuery ($a_id, $a_mquery)
 Update media query. More...
 
 getMediaQueryForId ($a_id)
 Get media query for id. More...
 
 deleteMediaQuery ($a_id)
 Delete media query. More...
 
 saveMediaQueryOrder ($a_order_nr=null)
 Save media query order. More...
 
 getTemplates ($a_type)
 Get table templates of style. More...
 
 getTemplateClasses ($a_tid)
 Get template classes. More...
 
 addTemplate ($a_type, $a_name, $a_classes)
 Add table template. More...
 
 updateTemplate ($a_t_id, $a_name, $a_classes)
 Update table template. More...
 
 addTemplateClass ($a_t_id, $a_type, $a_class)
 Update table template. More...
 
 templateExists ($a_template_name)
 Check whether template exists. More...
 
 getTemplate ($a_t_id)
 Get template. More...
 
 lookupTemplateName ($a_t_id)
 Lookup table template name for template ID. More...
 
 getTemplateXML ()
 Get table template xml. More...
 
 writeTemplatePreview ($a_t_id, $a_preview_html)
 Write table template preview. More...
 
 lookupTemplatePreview ($a_t_id)
 Lookup table template preview. More...
 
 removeTemplate ($a_t_id)
 Remove table template. More...
 
 writeStyleSetting ($a_name, $a_value)
 Write Style Setting. More...
 
 lookupStyleSetting ($a_name)
 Lookup style setting. More...
 
- Public Member Functions inherited from ilObject
 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...
 
 getPossibleSubObjects ($a_filter=true)
 get all possible subobjects of this type the object can decide which types of subobjects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static _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 _lookupImportId ($a_obj_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 fixMissingTitles ($a_type, array &$a_obj_title_map)
 Try to fix missing object titles. 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 2557 of file class.ilObjStyleSheet.php.

2558 {
2559 global $ilDB;
2560
2561 if ($a_styles == "")
2562 {
2563 $styles = ilObject::_getObjectsDataForType("sty");
2564 }
2565 else
2566 {
2567 $styles = $a_styles;
2568 }
2571
2572 // get all core image files
2573 $core_images = array();
2574 $core_dir = self::$basic_style_image_dir;
2575 if (is_dir($core_dir))
2576 {
2577 $dir = opendir($core_dir);
2578 while($file = readdir($dir))
2579 {
2580 if (substr($file, 0, 1) != "." && is_file($core_dir."/".$file))
2581 {
2582 $core_images[] = $file;
2583 }
2584 }
2585 }
2586
2587 foreach ($styles as $style)
2588 {
2589 $id = $style["id"];
2590
2591 foreach($core_styles as $cs)
2592 {
2593 // check, whether core style class exists
2594 $set = $ilDB->queryF("SELECT * FROM style_char WHERE style_id = %s ".
2595 "AND type = %s AND characteristic = %s",
2596 array("integer", "text", "text"),
2597 array($id, $cs["type"], $cs["class"]));
2598
2599 // if not, add core style class
2600 if (!($rec = $ilDB->fetchAssoc($set)))
2601 {
2602 $ilDB->manipulateF(
2603 "INSERT INTO style_char (style_id, type, characteristic) ".
2604 " VALUES (%s,%s,%s) ",
2605 array("integer", "text", "text"),
2606 array($id, $cs["type"], $cs["class"]));
2607
2608 $xpath = new DOMXPath($bdom);
2609 $par_nodes = $xpath->query("/StyleSheet/Style[@Tag = '".$cs["tag"]."' and @Type='".
2610 $cs["type"]."' and @Class='".$cs["class"]."']/StyleParameter");
2611 foreach ($par_nodes as $par_node)
2612 {
2613 // check whether style parameter exists
2614 $set = $ilDB->queryF("SELECT * FROM style_parameter WHERE style_id = %s ".
2615 "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
2616 array("integer", "text", "text", "text", "text"),
2617 array($id, $cs["type"], $cs["class"],
2618 $cs["tag"], $par_node->getAttribute("Name")));
2619
2620 // if not, create style parameter
2621 if (!($rec = $ilDB->fetchAssoc($set)))
2622 {
2623 $spid = $ilDB->nextId("style_parameter");
2624 $st = $ilDB->manipulateF("INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value) ".
2625 " VALUES (%s,%s,%s,%s,%s,%s,%s)",
2626 array("integer", "integer", "text", "text", "text", "text", "text"),
2627 array($spid, $id, $cs["type"], $cs["class"], $cs["tag"],
2628 $par_node->getAttribute("Name"), $par_node->getAttribute("Value")));
2629 }
2630 }
2631 }
2632 }
2633
2634 // now check, whether some core image files are missing
2637 reset($core_images);
2638 foreach($core_images as $cim)
2639 {
2640 if (!is_file($imdir."/".$cim))
2641 {
2642 copy($core_dir."/".$cim, $imdir."/".$cim);
2643 }
2644 }
2645 }
2646 }
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 2547 of file class.ilObjStyleSheet.php.

2548 {
2549 $styles = array(array("id" => $a_id));
2551 }
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 1245 of file class.ilObjStyleSheet.php.

1246 {
1247 global $ilErr;
1248
1249 $sty_data_dir = ilUtil::getWebspaceDir()."/sty";
1250 ilUtil::makeDir($sty_data_dir);
1251 if(!is_writable($sty_data_dir))
1252 {
1253 $ilErr->raiseError("Style data directory (".$sty_data_dir
1254 .") not writeable.", $ilErr->FATAL);
1255 }
1256
1257 $style_dir = $sty_data_dir."/sty_".$a_style_id;
1258 ilUtil::makeDir($style_dir);
1259 if(!@is_dir($style_dir))
1260 {
1261 $ilErr->raiseError("Creation of style directory failed (".
1262 $style_dir.").",$ilErr->FATAL);
1263 }
1264
1265 // create images subdirectory
1266 $im_dir = $style_dir."/images";
1267 ilUtil::makeDir($im_dir);
1268 if(!@is_dir($im_dir))
1269 {
1270 $ilErr->raiseError("Creation of Import Directory failed (".
1271 $im_dir.").", $ilErr->FATAL);
1272 }
1273
1274 // create thumbnails directory
1275 $thumb_dir = $style_dir."/images/thumbnails";
1276 ilUtil::makeDir($thumb_dir);
1277 if(!@is_dir($thumb_dir))
1278 {
1279 $ilErr->raiseError("Creation of Import Directory failed (".
1280 $thumb_dir.").", $ilErr->FATAL);
1281 }
1282 }
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(), create(), and createImagesDirectory().

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

◆ _determineTag()

static ilObjStyleSheet::_determineTag (   $a_type)
static

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

2525 {
2526 return self::$assigned_tags[$a_type];
2527 }

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

3074 {
3075 $r["r"] = substr($a_rgb, 0, 2);
3076 $r["g"] = substr($a_rgb, 2, 2);
3077 $r["b"] = substr($a_rgb, 4, 2);
3078
3079 if ($as_dec)
3080 {
3081 $r["r"] = (int) hexdec($r["r"]);
3082 $r["g"] = (int) hexdec($r["g"]);
3083 $r["b"] = (int) hexdec($r["b"]);
3084 }
3085
3086 return $r;
3087 }
$r
Definition: example_031.php:79

References $r.

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

Get basic style dom.

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

833 {
834 global $ilBench;
835
836 if (!is_object(self::$basic_style_dom))
837 {
838 self::$basic_style_dom = new DOMDocument();
839 self::$basic_style_dom->load(self::$basic_style_file);
840 }
841
843 }
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 775 of file class.ilObjStyleSheet.php.

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

3047 {
3048 $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
3049 $hls = ilObjStyleSheet::_RGBToHLS($rgb);
3050
3051 if ($a_i > 0)
3052 {
3053 $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
3054 }
3055 if ($a_i < 0)
3056 {
3057 $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
3058 }
3059
3060 $rgb = ilObjStyleSheet::_HLSToRGB($hls);
3061
3062 foreach ($rgb as $k => $v)
3063 {
3064 $rgb[$k] = str_pad(dechex($v), 2, "0", STR_PAD_LEFT);
3065 }
3066
3067 return $rgb["r"].$rgb["g"].$rgb["b"];
3068 }
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 2487 of file class.ilObjStyleSheet.php.

2488 {
2489 $c_styles = array();
2490 foreach (self::$core_styles as $cstyle)
2491 {
2492 $c_styles[$cstyle["type"].".".ilObjStyleSheet::_determineTag($cstyle["type"]).".".$cstyle["class"]]
2493 = array("type" => $cstyle["type"],
2494 "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2495 "class" => $cstyle["class"]);
2496 }
2497 return $c_styles;
2498 }
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 2430 of file class.ilObjStyleSheet.php.

2431 {
2433 }

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

1296 {
1297 return ilUtil::getWebspaceDir()."/sty/sty_".$a_style_id.
1298 "/images";
1299 }

References ilUtil\getWebspaceDir().

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

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

◆ _getPseudoClasses()

ilObjStyleSheet::_getPseudoClasses (   $tag)

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

2515 {
2516 return self::$pseudo_classes[$tag];
2517 }

◆ _getStandardStyles()

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

Get standard styles.

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

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

2400 {
2401 $input = self::$parameter[$par]["input"];
2402 return $input;
2403 }

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

2436 {
2437 if ($a_no_percentage)
2438 {
2440 }
2441 return self::$num_unit;
2442 }

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

2412 {
2413 if ($a_tag == "")
2414 {
2415 return self::$parameter;
2416 }
2417 $par = array();
2418 foreach (self::$parameter as $k => $v)
2419 {
2420 if (is_array(self::$filtered_groups[$v["group"]]) &&
2421 !in_array($a_tag, self::$filtered_groups[$v["group"]]))
2422 {
2423 continue;
2424 }
2425 $par[$k] = $v;
2426 }
2427 return $par;
2428 }

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

2406 {
2407 $subpar = self::$parameter[$par]["subpar"];
2408 return $subpar;
2409 }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues (   $par)
static

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

2445 {
2446 return self::$parameter[$par]["values"];
2447 }

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

2470 {
2471 foreach (self::$style_super_types as $s => $t)
2472 {
2473 if (in_array($a_type, $t))
2474 {
2475 return $s;
2476 }
2477 if ($a_type == $s)
2478 {
2479 return $s;
2480 }
2481 }
2482 }

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

2504 {
2505 if ($a_template_type == "")
2506 {
2507 return self::$templates;
2508 }
2509
2510 return self::$templates[$a_template_type];
2511 }

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

3146 {
3147 $h = $a_hls["h"] / 255;
3148 $l = $a_hls["l"] / 255;
3149 $s = $a_hls["s"] / 255;
3150
3151 $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
3152
3153 // If S=0, define R, G, and B all to L
3154 if ($s == 0)
3155 {
3156 $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
3157 }
3158 else
3159 {
3160
3161 if ($l < 0.5)
3162 {
3163 $temp2 = $l * (1.0 + $s);
3164 }
3165 else
3166 {
3167 $temp2 = $l + $s - $l * $s;
3168 }
3169
3170 $temp1 = 2.0 * $l - $temp2;
3171
3172
3173 # For each of R, G, B, compute another temporary value, temp3, as follows:
3174 foreach ($rgb as $k => $v)
3175 {
3176 switch ($k)
3177 {
3178 case "r":
3179 $temp3 = $h + 1.0 / 3.0;
3180 break;
3181
3182 case "g":
3183 $temp3 = $h;
3184 break;
3185
3186 case "b":
3187 $temp3 = $h - 1.0/3.0;
3188 break;
3189 }
3190 if ($temp3 < 0)
3191 {
3192 $temp3 = $temp3 + 1.0;
3193 }
3194 if ($temp3 > 1)
3195 {
3196 $temp3 = $temp3 - 1.0;
3197 }
3198
3199 if (6.0 * $temp3 < 1)
3200 {
3201 $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3202 }
3203 else if (2.0 * $temp3 < 1)
3204 {
3205 $rgb[$k] = $temp2;
3206 }
3207 else if (3.0 * $temp3 < 2)
3208 {
3209 $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0/3.0) - $temp3) * 6.0;
3210 }
3211 else
3212 {
3213 $rgb[$k] = $temp1;
3214 }
3215 }
3216 }
3217
3218 $rgb["r"] = round($rgb["r"] * 255);
3219 $rgb["g"] = round($rgb["g"] * 255);
3220 $rgb["b"] = round($rgb["b"] * 255);
3221
3222 return $rgb;
3223 }
global $l
Definition: afr.php:30
$h

References $h, and $l.

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable (   $a_type)
static

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

2460 {
2461 return in_array($a_type, self::$expandable_types);
2462 }

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

2465 {
2466 return in_array($a_type, self::$hideable_types);
2467 }

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

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

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

3645 {
3646 global $ilDB;
3647
3648 $set = $ilDB->query("SELECT id FROM style_template ".
3649 " WHERE style_id = ".$ilDB->quote($a_style_id, "integer").
3650 " AND name = ".$ilDB->quote($a_name, "text"));
3651 if ($rec = $ilDB->fetchAssoc($set))
3652 {
3653 return $rec["id"];
3654 }
3655
3656 return false;
3657 }

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

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

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

1923 {
1924 global $ilDB;
1925
1926 $q = "SELECT * FROM style_parameter WHERE ".
1927 " style_id = ".$ilDB->quote($style_id, "integer")." AND ".
1928 " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1929 " class = ".$ilDB->quote($a_class, "text")." AND ".
1930 " mq_id = ".$ilDB->quote($a_mq_id, "integer")." AND ".
1931 " custom = ".$ilDB->quote($a_custom, "integer")." AND ".
1932 " ".$ilDB->equals("type", $a_type, "text", true)." AND ".
1933 " parameter = ".$ilDB->quote($a_par, "text");
1934
1935 $set = $ilDB->query($q);
1936
1937 if ($rec = $set->fetchRow())
1938 {
1939 $q = "UPDATE style_parameter SET ".
1940 " value = ".$ilDB->quote($a_val, "text")." WHERE ".
1941 " style_id = ".$ilDB->quote($style_id, "integer")." AND ".
1942 " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1943 " class = ".$ilDB->quote($a_class, "text")." AND ".
1944 " mq_id = ".$ilDB->quote($a_mq_id, "integer")." AND ".
1945 " custom = ".$ilDB->quote($a_custom, "integer")." AND ".
1946 " ".$ilDB->equals("type", $a_type, "text", true)." AND ".
1947 " parameter = ".$ilDB->quote($a_par, "text");
1948
1949 $ilDB->manipulate($q);
1950 }
1951 else
1952 {
1953 $id = $ilDB->nextId("style_parameter");
1954 $q = "INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter, mq_id, custom) VALUES ".
1955 " (".
1956 $ilDB->quote($id, "integer").",".
1957 $ilDB->quote($a_val, "text").",".
1958 " ".$ilDB->quote($this->getId(), "integer").",".
1959 " ".$ilDB->quote($a_tag, "text").",".
1960 " ".$ilDB->quote($a_class, "text").",".
1961 " ".$ilDB->quote($a_type, "text").",".
1962 " ".$ilDB->quote($a_par, "text").",".
1963 " ".$ilDB->quote($a_mq_id, "integer").",".
1964 " ".$ilDB->quote($a_custom, "integer").
1965 ")";
1966
1967 $ilDB->manipulate($q);
1968 }
1969 }
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 3092 of file class.ilObjStyleSheet.php.

3093 {
3094 $r = $a_rgb["r"] / 255;
3095 $g = $a_rgb["g"] / 255;
3096 $b = $a_rgb["b"] / 255;
3097
3098 // max / min
3099 $max = max($r,$g,$b);
3100 $min = min($r,$g,$b);
3101
3102 //lightness
3103 $l = ($max + $min) / 2;
3104
3105 if ($max == $min)
3106 {
3107 $s = 0;
3108 $h = 0;
3109 }
3110 else
3111 {
3112 if ($l < 0.5)
3113 {
3114 $s = ($max - $min) / ($max + $min);
3115 }
3116 else
3117 {
3118 $s = ($max - $min) / (2.0 - $max - $min);
3119 }
3120
3121 if ($r == $max)
3122 {
3123 $h = ($g - $b) / ($max - $min);
3124 }
3125 else if ($g == $max)
3126 {
3127 $h = 2.0 + ($b - $r) / ($max - $min);
3128 }
3129 else if ($b == $max)
3130 {
3131 $h = 4.0 + ($r - $g) / ($max - $min);
3132 }
3133 }
3134
3135 $hls["h"] = round(($h / 6) * 255);
3136 $hls["l"] = round($l * 255);
3137 $hls["s"] = round($s * 255);
3138
3139 return $hls;
3140 }

References $h, $l, and $r.

Referenced by _getColorFlavor().

+ Here is the caller graph for this function:

◆ _writeActive()

ilObjStyleSheet::_writeActive (   $a_id,
  $a_active 
)

Write active flag.

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

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

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

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

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

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

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

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

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

1035 {
1036 global $ilDB;
1037
1038 // delete characteristic record
1039 $ilDB->manipulateF("INSERT INTO style_char (style_id, type, characteristic, hide)".
1040 " VALUES (%s,%s,%s,%s) ",
1041 array("integer", "text", "text", "integer"),
1042 array($this->getId(), $a_type, $a_char, $a_hidden));
1043
1044 $this->setUpToDate(false);
1045 $this->_writeUpToDate($this->getId(), false);
1046 }
_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 2927 of file class.ilObjStyleSheet.php.

2928 {
2929 global $ilDB;
2930
2931 $ilDB->manipulate("INSERT INTO style_color (style_id, color_name, color_code)".
2932 " VALUES (".
2933 $ilDB->quote($this->getId(), "integer").",".
2934 $ilDB->quote($a_name, "text").",".
2935 $ilDB->quote($a_code, "text").
2936 ")");
2937 }

References $ilDB.

Referenced by copyCharacteristic(), and create().

+ Here is the caller graph for this function:

◆ addMediaQuery()

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

Add media query.

Parameters
string$a_mquerymedia query

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

3258 {
3259 global $ilDB;
3260
3261 $id = $ilDB->nextId("sty_media_query");
3262 if ($order_nr == 0)
3263 {
3264 $order_nr = $this->getMaxMQueryOrderNr() + 10;
3265 }
3266
3267 $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)".
3268 " VALUES (".
3269 $ilDB->quote($id, "integer").",".
3270 $ilDB->quote($this->getId(), "integer").",".
3271 $ilDB->quote($a_mquery, "text").",".
3272 $ilDB->quote($order_nr, "integer").
3273 ")");
3274
3275 return $id;
3276 }
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 1207 of file class.ilObjStyleSheet.php.

1208 {
1209 global $ilDB;
1210
1211 $avail_params = $this->getAvailableParameters();
1212 $tag = explode(".", $a_tag);
1213 $value = $avail_params[$a_par][0];
1214 $id = $ilDB->nextId("style_parameter");
1215 $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES ".
1216 "(".
1217 $ilDB->quote($id, "integer").",".
1218 $ilDB->quote($this->getId(), "integer").",".
1219 $ilDB->quote($a_type, "text").",".
1220 $ilDB->quote($tag[0], "text").",".
1221 $ilDB->quote($tag[1], "text").",".
1222 $ilDB->quote($a_par, "text").",".
1223 $ilDB->quote($value, "text").",".
1224 $ilDB->quote($a_mq_id, "integer").",".
1225 $ilDB->quote($a_custom, "integer").
1226 ")";
1227 $ilDB->manipulate($q);
1228 $this->read();
1229 $this->writeCSSFile();
1230 }
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 3421 of file class.ilObjStyleSheet.php.

3422 {
3423 global $ilDB;
3424
3425 $tid = $ilDB->nextId("style_template");
3426 $ilDB->manipulate($q = "INSERT INTO style_template ".
3427 "(id, style_id, name, temp_type)".
3428 " VALUES (".
3429 $ilDB->quote($tid, "integer").",".
3430 $ilDB->quote($this->getId(), "integer").",".
3431 $ilDB->quote($a_name, "text").",".
3432 $ilDB->quote($a_type, "text").
3433 ")");
3434
3435 foreach ($a_classes as $t => $c)
3436 {
3437 $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3438 "(template_id, class_type, class)".
3439 " VALUES (".
3440 $ilDB->quote($tid, "integer").",".
3441 $ilDB->quote($t, "text").",".
3442 $ilDB->quote($c, "text").
3443 ")");
3444 }
3445
3446 include_once("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
3447 $this->writeTemplatePreview($tid,
3448 ilObjStyleSheetGUI::_getTemplatePreview($this, $a_type, $tid, true));
3449
3450 return $tid;
3451 }
_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:

◆ addTemplateClass()

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

Update table template.

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

3484 {
3485 global $ilDB;
3486
3487 $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3488 "(template_id, class_type, class)".
3489 " VALUES (".
3490 $ilDB->quote($a_t_id, "integer").",".
3491 $ilDB->quote($a_type, "text").",".
3492 $ilDB->quote($a_class, "text").
3493 ")");
3494 }

References $ilDB.

◆ assignMetaData()

ilObjStyleSheet::assignMetaData ( $a_meta_data)

assign meta data object

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

825 {
826 $this->meta_data =& $a_meta_data;
827 }

◆ characteristicExists()

ilObjStyleSheet::characteristicExists (   $a_char,
  $a_style_type 
)

Check whether characteristic exists.

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

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

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

2100 {
2101 $sty_data_dir = ilUtil::getDataDir()."/sty";
2102 $style_dir = $sty_data_dir."/sty_".$this->getId();
2103 // create export subdirectory
2104 $ex_dir = $style_dir."/export";
2105
2106 if (is_dir($ex_dir))
2107 {
2108 ilUtil::delDir($ex_dir, true);
2109 }
2110 }
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 2997 of file class.ilObjStyleSheet.php.

2998 {
2999 global $ilDB;
3000
3001 $set = $ilDB->query("SELECT * FROM style_color WHERE ".
3002 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3003 "color_name = ".$ilDB->quote($a_color_name, "text"));
3004 if ($rec = $ilDB->fetchAssoc($set))
3005 {
3006 return true;
3007 }
3008 return false;
3009 }

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

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

1194 {
1195 ilUtil::rCopy($this->getImagesDirectory(), $a_target);
1196 }
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 856 of file class.ilObjStyleSheet.php.

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

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

+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjStyleSheet::createExportDirectory ( )

Create export directory.

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

2067 {
2068 $sty_data_dir = ilUtil::getDataDir()."/sty";
2069 ilUtil::makeDir($sty_data_dir);
2070 if(!is_writable($sty_data_dir))
2071 {
2072 $this->ilias->raiseError("Style data directory (".$sty_data_dir
2073 .") not writeable.",$this->ilias->error_obj->FATAL);
2074 }
2075
2076 $style_dir = $sty_data_dir."/sty_".$this->getId();
2077 ilUtil::makeDir($style_dir);
2078 if(!@is_dir($style_dir))
2079 {
2080 $this->ilias->raiseError("Creation of style directory failed (".
2081 $style_dir.").",$this->ilias->error_obj->FATAL);
2082 }
2083
2084 // create export subdirectory
2085 $ex_dir = $style_dir."/export";
2086 ilUtil::makeDir($ex_dir);
2087 if(!@is_dir($ex_dir))
2088 {
2089 $this->ilias->raiseError("Creation of Import Directory failed (".
2090 $ex_dir.").",$this->ilias->error_obj->FATAL);
2091 }
2092
2093 return $ex_dir;
2094 }
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 2116 of file class.ilObjStyleSheet.php.

2117 {
2118 $ex_dir = $this->createExportDirectory();
2119 $ex_sub_dir = $ex_dir."/".$this->getExportSubDir();
2120 ilUtil::makeDir($ex_sub_dir);
2121 if(!is_writable($ex_sub_dir))
2122 {
2123 $this->ilias->raiseError("Style data directory (".$ex_sub_dir
2124 .") not writeable.",$this->ilias->error_obj->FATAL);
2125 }
2126 $ex_sub_images_dir = $ex_sub_dir."/images";
2127 ilUtil::makeDir($ex_sub_images_dir);
2128 if(!is_writable($ex_sub_images_dir))
2129 {
2130 $this->ilias->raiseError("Style data directory (".$ex_sub_images_dir
2131 .") not writeable.",$this->ilias->error_obj->FATAL);
2132 }
2133 }
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 2301 of file class.ilObjStyleSheet.php.

2302 {
2303 global $ilDB;
2304
2305 $this->is_3_10_skin = false;
2306
2307 if (!$a_skip_parent_create)
2308 {
2309 parent::create();
2310 }
2311 include_once("./Services/Style/classes/class.ilStyleImportParser.php");
2312 $importParser = new ilStyleImportParser($a_file, $this);
2313 $importParser->startParsing();
2314
2315 // store style parameter
2316 foreach ($this->style as $style)
2317 {
2318 foreach($style as $tag)
2319 {
2320 $id = $ilDB->nextId("style_parameter");
2321
2322 // migrate old table PageFrame/PageContainer to div
2323 if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
2324 $tag["tag"] == "table")
2325 {
2326 $tag["tag"] = "div";
2327 if ($tag["parameter"] == "width" && $tag["value"] == "100%")
2328 {
2329 continue;
2330 }
2331 }
2332
2333 $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES ".
2334 "(".
2335 $ilDB->quote($id, "integer").",".
2336 $ilDB->quote($this->getId(), "integer").",".
2337 $ilDB->quote($tag["tag"], "text").",".
2338 $ilDB->quote($tag["class"], "text").",".
2339 $ilDB->quote($tag["parameter"], "text").",".
2340 $ilDB->quote($tag["type"], "text").",".
2341 $ilDB->quote($tag["value"], "text").",".
2342 $ilDB->quote((bool) $tag["custom"], "integer").
2343 ")";
2344 $ilDB->manipulate($q);
2345 }
2346 }
2347
2348 // store characteristics
2349 $this->is_3_10_skin = true;
2350 if (is_array($this->chars))
2351 {
2352 foreach ($this->chars as $char)
2353 {
2354 if ($char["type"] != "")
2355 {
2356 $s = substr($char["class"], strlen($char["class"]) - 6);
2357 if ($s != ":hover")
2358 {
2359 $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
2360 "(".$ilDB->quote($this->getId(), "integer").",".
2361 $ilDB->quote($char["type"], "text").",".
2362 $ilDB->quote($char["class"], "text").")";
2363 $ilDB->manipulate($q);
2364 $this->is_3_10_skin = false;
2365 }
2366 }
2367 }
2368 }
2369
2370 // add style_data record
2371 $q = "INSERT INTO style_data (id, uptodate) VALUES ".
2372 "(".$ilDB->quote($this->getId(), "integer").", 0)";
2373 $ilDB->manipulate($q);
2374
2375 $this->update();
2376 $this->read();
2377
2378 if ($this->is_3_10_skin)
2379 {
2380 $this->do_3_10_Migration();
2381 }
2382 //$this->writeCSSFile();
2383 }
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 1236 of file class.ilObjStyleSheet.php.

1237 {
1239 }

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

2211 {
2212 $sty_data_dir = ilUtil::getDataDir()."/sty";
2213 ilUtil::makeDir($sty_data_dir);
2214 if(!is_writable($sty_data_dir))
2215 {
2216 $this->ilias->raiseError("Style data directory (".$sty_data_dir
2217 .") not writeable.",$this->ilias->error_obj->FATAL);
2218 }
2219
2220 $style_dir = $sty_data_dir."/sty_".$this->getId();
2221 ilUtil::makeDir($style_dir);
2222 if(!@is_dir($style_dir))
2223 {
2224 $this->ilias->raiseError("Creation of style directory failed (".
2225 $style_dir.").",$this->ilias->error_obj->FATAL);
2226 }
2227
2228 // create import subdirectory
2229 $im_dir = $style_dir."/import";
2230 ilUtil::makeDir($im_dir);
2231 if(!@is_dir($im_dir))
2232 {
2233 $this->ilias->raiseError("Creation of Import Directory failed (".
2234 $im_dir.").",$this->ilias->error_obj->FATAL);
2235 }
2236
2237 return $im_dir;
2238 }

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

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

◆ delete()

ilObjStyleSheet::delete ( )

delete style object

Reimplemented from ilObject.

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

1451 {
1452 global $ilDB;
1453
1454 // delete object
1455 parent::delete();
1456
1457 // check whether this style is global default
1458 $def_style = $this->ilias->getSetting("default_content_style_id");
1459 if ($def_style == $this->getId())
1460 {
1461 $this->ilias->deleteSetting("default_content_style_id");
1462 }
1463
1464 // check whether this style is global fixed
1465 $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1466 if ($fixed_style == $this->getId())
1467 {
1468 $this->ilias->deleteSetting("fixed_content_style_id");
1469 }
1470
1471 // delete style parameter
1472 $q = "DELETE FROM style_parameter WHERE style_id = ".
1473 $ilDB->quote($this->getId(), "integer");
1474 $ilDB->manipulate($q);
1475
1476 // delete style file
1477 $css_file_name = ilUtil::getWebspaceDir()."/css/style_".$this->getId().".css";
1478 if (is_file($css_file_name))
1479 {
1480 unlink($css_file_name);
1481 }
1482
1483 // delete media queries
1484 $ilDB->manipulate("DELETE FROM sty_media_query WHERE ".
1485 " style_id = ".$ilDB->quote($this->getId(), "integer")
1486 );
1487
1488 // delete entries in learning modules
1489 include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1491
1492 // delete style data record
1493 $q = "DELETE FROM style_data WHERE id = ".
1494 $ilDB->quote($this->getId(), "integer");
1495 $ilDB->manipulate($q);
1496
1497 }
_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 989 of file class.ilObjStyleSheet.php.

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

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

1412 {
1413 global $ilDB;
1414
1415 $q = "DELETE FROM style_parameter WHERE ".
1416 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1417 " tag = ".$ilDB->quote($a_tag, "text")." AND ".
1418 " class = ".$ilDB->quote($a_class, "text")." AND ".
1419 " mq_id = ".$ilDB->quote($a_mq_id, "integer")." AND ".
1420 " custom = ".$ilDB->quote(1, "integer")." AND ".
1421 " ".$ilDB->equals("type", $a_type, "text", true);
1422
1423 $ilDB->manipulate($q);
1424 }

References $ilDB, and ilObject\getId().

+ Here is the call graph for this function:

◆ deleteImage()

ilObjStyleSheet::deleteImage (   $a_file)

Delete an image.

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

1352 {
1353 if (is_file($this->getImagesDirectory()."/".$a_file))
1354 {
1355 unlink($this->getImagesDirectory()."/".$a_file);
1356 }
1357 if (is_file($this->getThumbnailsDirectory()."/".$a_file))
1358 {
1359 unlink($this->getThumbnailsDirectory()."/".$a_file);
1360 }
1361 }
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 3331 of file class.ilObjStyleSheet.php.

3332 {
3333 global $ilDB;
3334
3335 $ilDB->manipulate("DELETE FROM sty_media_query WHERE ".
3336 " style_id = ".$ilDB->quote($this->getId(), "integer").
3337 " AND id = ".$ilDB->quote($a_id, "integer")
3338 );
3339 $this->saveMediaQueryOrder();
3340 }
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 1368 of file class.ilObjStyleSheet.php.

1369 {
1370 global $ilDB;
1371
1372 $q = "DELETE FROM style_parameter WHERE id = ".
1373 $ilDB->quote($a_id, "integer");
1374 $ilDB->query($q);
1375 }

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

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

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

1435 {
1436 global $ilDB;
1437
1438 $q = "DELETE FROM style_parameter WHERE ".
1439 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1440 " class = ".$ilDB->quote($a_class, "text")." AND ".
1441 " ".$ilDB->equals("type", $a_type, "text", true);
1442
1443 $ilDB->manipulate($q);
1444 }

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

2520 {
2521 return self::$templates[$t][$k];
2522 }

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

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

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

2656 {
2657 global $ilDB;
2658
2659 $this->do_3_9_Migration($this->getId());
2660
2661 //include_once("./Services/Migration/DBUpdate_1385/classes/class.ilStyleMigration.php");
2662 //ilStyleMigration::addMissingStyleCharacteristics($this->getId());
2663
2664 $this->do_3_10_CharMigration($this->getId());
2665
2666 // style_char: type for characteristic
2667 $st = $ilDB->prepareManip("UPDATE style_char SET type = ? WHERE characteristic = ?".
2668 " AND style_id = ? ", array("text", "text", "integer"));
2669 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2670 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2671 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2672 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2673 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2674 $ilDB->execute($st, array("page_cont", "Page", $this->getId()));
2675
2676 // style_parameter: type for class
2677 $st = $ilDB->prepareManip("UPDATE style_parameter SET type = ? WHERE class = ?".
2678 " AND style_id = ? ", array("text", "text", "integer"));
2679 $ilDB->execute($st, array("media_cont", "Media", $this->getId()));
2680 $ilDB->execute($st, array("media_caption", "MediaCaption", $this->getId()));
2681 $ilDB->execute($st, array("page_fn", "Footnote", $this->getId()));
2682 $ilDB->execute($st, array("page_nav", "LMNavigation", $this->getId()));
2683 $ilDB->execute($st, array("page_title", "PageTitle", $this->getId()));
2684 $ilDB->execute($st, array("table", "Page", $this->getId()));
2685
2686 $st = $ilDB->prepareManip("UPDATE style_parameter SET tag = ? WHERE class = ?".
2687 " AND style_id = ? ", array("text", "text", "integer"));
2688 $ilDB->execute($st, array("div", "MediaCaption", $this->getId()));
2689
2690 // style_char: characteristic for characteristic
2691 $st = $ilDB->prepareManip("UPDATE style_char SET characteristic = ? WHERE characteristic = ?".
2692 " AND style_id = ? ", array("text", "text", "integer"));
2693 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2694 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2695
2696 // style_parameter: class for class
2697 $st = $ilDB->prepareManip("UPDATE style_parameter SET class = ? WHERE class = ?".
2698 " AND style_id = ? ", array("text", "text", "integer"));
2699 $ilDB->execute($st, array("MediaContainer", "Media", $this->getId()));
2700 $ilDB->execute($st, array("PageContainer", "Page", $this->getId()));
2701
2702 // force rewriting of container style
2703 $st = $ilDB->prepareManip("DELETE FROM style_char WHERE type = ?".
2704 " AND style_id = ? ", array("text", "integer"));
2705 $ilDB->execute($st, array("page_cont", $this->getId()));
2706 $st = $ilDB->prepareManip("DELETE FROM style_parameter WHERE type = ?".
2707 " AND style_id = ? ", array("text", "integer"));
2708 $ilDB->execute($st, array("page_cont", $this->getId()));
2709
2710 }
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 2859 of file class.ilObjStyleSheet.php.

2860 {
2861 global $ilDB;
2862
2863 $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2864 $pars = array("margin-top", "margin-bottom");
2865
2866 foreach ($classes as $curr_class)
2867 {
2868 foreach ($pars as $curr_par)
2869 {
2870 $res2 = $ilDB->queryF("SELECT id FROM style_parameter WHERE style_id = %s".
2871 " AND tag = %s AND class= %s AND parameter = %s",
2872 array("integer", "text", "text", "text"),
2873 array($a_id, "p", $curr_class, $curr_par));
2874 if ($row2 = $ilDB->fetchAssoc($res2))
2875 {
2876 $ilDB->manipulateF("UPDATE style_parameter SET value= %s WHERE id = %s",
2877 array("text", "integer"),
2878 array("10px", $row2["id"]));
2879 }
2880 else
2881 {
2882 $nid = $ilDB->nextId("style_parameter");
2883 $ilDB->manipulateF("INSERT INTO style_parameter ".
2884 "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2885 array("integer", "integer", "text", "text", "text", "text"),
2886 array($nid, $a_id, "div", $curr_class, $curr_par, "10px"));
2887 }
2888 }
2889 }
2890
2891 $ilDB->manipulateF("UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2892 array("text", "text", "integer"),
2893 array("div", "p", $a_id));
2894
2895 }

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

2164 {
2165 $this->cleanExportDirectory();
2166 $ex_dir = $this->createExportDirectory();
2167 $this->createExportSubDirectory();
2168 $this->exportXML($ex_dir."/".$this->getExportSubDir());
2169//echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
2171 $ex_dir."/".$this->getExportSubDir()."/images");
2172 if (is_file($ex_dir."/".$this->getExportSubDir().".zip"))
2173 {
2174 unlink($ex_dir."/".$this->getExportSubDir().".zip");
2175 }
2176 ilUtil::zip($ex_dir."/".$this->getExportSubDir(),
2177 $ex_dir."/".$this->getExportSubDir().".zip");
2178
2179 return $ex_dir."/".$this->getExportSubDir().".zip";
2180 }
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 2185 of file class.ilObjStyleSheet.php.

2186 {
2187 $file = $a_dir."/style.xml";
2188
2189 // open file
2190 if (!($fp = @fopen($file,"w")))
2191 {
2192 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
2193 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
2194 }
2195
2196 // set file permissions
2197 chmod($file, 0770);
2198
2199 // write xml data into the file
2200 fwrite($fp, $this->getXML());
2201
2202 // close file
2203 fclose($fp);
2204
2205 }
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 2532 of file class.ilObjStyleSheet.php.

2533 {
2534 $pars = array();
2535 foreach(self::$parameter as $p => $v)
2536 {
2537 $pars[$p] = $v["values"];
2538 }
2539
2540 return $pars;
2541 }

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

1095 {
1096 $chars = array();
1097
1098 if ($a_type == "")
1099 {
1100 $chars = $this->chars;
1101 }
1102 if (is_array($this->chars_by_type[$a_type]))
1103 {
1104 $chars = $this->chars_by_type[$a_type];
1105 }
1106
1107 if ($a_no_hidden)
1108 {
1109 foreach ($chars as $k => $char)
1110 {
1111 if ($a_type == "" && $this->hidden_chars[$char["type"].":".$char["class"]])
1112 {
1113 unset($chars[$k]);
1114 }
1115 else if ($this->hidden_chars[$a_type.":".$char])
1116 {
1117 unset($chars[$k]);
1118 }
1119 }
1120 }
1121
1122 return $chars;
1123 }

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName (   $a_name)

Remove a color.

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

3015 {
3016 global $ilDB;
3017
3018 $pos = strpos($a_name, "(");
3019 if ($pos > 0)
3020 {
3021 $a_i = substr($a_name, $pos + 1);
3022 $a_i = str_replace(")", "", $a_i);
3023 $a_name = substr($a_name, 0, $pos);
3024 }
3025
3026 $set = $ilDB->query("SELECT color_code FROM style_color WHERE ".
3027 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3028 " color_name = ".$ilDB->quote($a_name, "text"));
3029 if ($rec = $ilDB->fetchAssoc($set))
3030 {
3031 if ($a_i == "")
3032 {
3033 return "#".$rec["color_code"];
3034 }
3035 else
3036 {
3037 return "#".ilObjStyleSheet::_getColorFlavor($rec["color_code"],
3038 (int) $a_i);
3039 }
3040 }
3041 }

References $ilDB.

Referenced by writeCSSFile().

+ Here is the caller graph for this function:

◆ getColors()

ilObjStyleSheet::getColors ( )

Get colors of style.

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

2905 {
2906 global $ilDB;
2907
2908 $set = $ilDB->query("SELECT * FROM style_color WHERE ".
2909 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
2910 "ORDER BY color_name");
2911
2912 $colors = array();
2913 while ($rec = $ilDB->fetchAssoc($set))
2914 {
2915 $colors[] = array(
2916 "name" => $rec["color_name"],
2917 "code" => $rec["color_code"]
2918 );
2919 }
2920
2921 return $colors;
2922 }

References $ilDB.

Referenced by getXML().

+ Here is the caller graph for this function:

◆ getContentPrintStyle()

ilObjStyleSheet::getContentPrintStyle ( )

get content print style

static

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

1858 {
1859 return "./Services/COPage/css/print_content.css";
1860 }

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

1812 {
1813 global $ilias;
1814
1815 $rand = rand(1,999999);
1816
1817
1818 // check global fixed content style
1819 $fixed_style = $ilias->getSetting("fixed_content_style_id");
1820 if ($fixed_style > 0)
1821 {
1822 $a_style_id = $fixed_style;
1823 }
1824
1825 // check global default style
1826 if ($a_style_id <= 0)
1827 {
1828 $a_style_id = $ilias->getSetting("default_content_style_id");
1829 }
1830
1831 if ($a_style_id > 0 && ilObject::_exists($a_style_id))
1832 {
1833 // check whether file is up to date
1834 if (!ilObjStyleSheet::_lookupUpToDate($a_style_id))
1835 {
1836 $style = new ilObjStyleSheet($a_style_id);
1837 $style->writeCSSFile();
1838 }
1839
1840 $path = ilUtil::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css?dummy=$rand";
1841 require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
1843
1844 return $path;
1845 }
1846 else // todo: work this out
1847 {
1848 return "./Services/COPage/css/content.css";
1849 }
1850 }
_lookupUpToDate($a_id)
Looup up to date.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static signFile($path_to_file)

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

Referenced by 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(), ilContainerStartObjectsGUI\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(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestServiceGUI\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(), ilMediaPoolPageGUI\showPage(), ilObjMediaPoolGUI\showPage(), ilPageObjectGUI\showPage(), ilLMPresentationGUI\showPreconditionsOfPage(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showPrintViewSelection(), ilLMPresentationGUI\showTableOfContents(), and ilContObjectManifestBuilder\writeResources().

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

◆ getEffectiveContentStyleId()

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

Get effective Style Id.

Parameters
integerstyle id that may be set in object
stringobject type

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

1767 {
1768 global $ilSetting;
1769
1770 // check global fixed content style
1771 $fixed_style = $ilSetting->get("fixed_content_style_id");
1772 if ($fixed_style > 0)
1773 {
1774 $a_style_id = $fixed_style;
1775 }
1776
1777 // check global default style
1778 if ($a_style_id <= 0)
1779 {
1780 $a_style_id = $ilSetting->get("default_content_style_id");
1781 }
1782
1783 if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty")
1784 {
1785 return $a_style_id;
1786 }
1787
1788 return 0;
1789 }
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 2146 of file class.ilObjStyleSheet.php.

2147 {
2148 if ($this->export_sub_dir == "")
2149 {
2150 return "sty_".$this->getId();
2151 }
2152 else
2153 {
2154 return $this->export_sub_dir;
2155 }
2156 }

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

1153 {
1154 global $ilDB;
1155
1156 $set = $ilDB->query("SELECT hide FROM style_char ".
1157 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1158 " type = ".$ilDB->quote($a_type, "text")." AND ".
1159 " characteristic = ".$ilDB->quote($a_char, "text")
1160 );
1161 $rec = $ilDB->fetchAssoc($set);
1162
1163 return $rec["hide"];
1164 }

References $ilDB.

◆ getImages()

ilObjStyleSheet::getImages ( )

Get images of style.

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

1314 {
1315 $dir = $this->getImagesDirectory();
1316 $images = array();
1317 if (is_dir($dir))
1318 {
1319 $entries = ilUtil::getDir($dir);
1320 foreach($entries as $entry)
1321 {
1322 if (substr($entry["entry"],0,1) == ".")
1323 {
1324 continue;
1325 }
1326 if ($entry["type"] != "dir")
1327 {
1328 $images[] = $entry;
1329 }
1330 }
1331 }
1332
1333 return $images;
1334 }
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 1287 of file class.ilObjStyleSheet.php.

1288 {
1290 }

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

3283 {
3284 global $ilDB;
3285
3286 $set = $ilDB->query("SELECT max(order_nr) mnr FROM sty_media_query ".
3287 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")
3288 );
3289 $rec = $ilDB->fetchAssoc($set);
3290
3291 return (int) $rec["mnr"];
3292 }

References $ilDB.

Referenced by addMediaQuery().

+ Here is the caller graph for this function:

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

Get colors of style.

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

3237 {
3238 global $ilDB;
3239
3240 $set = $ilDB->query("SELECT * FROM sty_media_query WHERE ".
3241 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
3242 "ORDER BY order_nr");
3243
3244 $mq = array();
3245 while ($rec = $ilDB->fetchAssoc($set))
3246 {
3247 $mq[] = $rec;
3248 }
3249
3250 return $mq;
3251 }

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

3317 {
3318 global $ilDB;
3319
3320 $set = $ilDB->query("SELECT * FROM sty_media_query ".
3321 " WHERE id = ".$ilDB->quote($a_id, "integer")
3322 );
3323 return $ilDB->fetchAssoc($set);
3324 }

References $ilDB.

◆ getMetaData()

& ilObjStyleSheet::getMetaData ( )

get meta data object

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

849 {
850 return $this->meta_data;
851 }

◆ getParametersOfClass()

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

Get parameters of class.

Parameters

return

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

1798 {
1799 if (is_array($this->style_class[$a_type][$a_class][$a_mq_id]))
1800 {
1801 return $this->style_class[$a_type][$a_class][$a_mq_id];
1802 }
1803 return array();
1804 }

◆ getPlaceHolderStylePath()

ilObjStyleSheet::getPlaceHolderStylePath ( )

get placeholder style path (for Page Layouts)

static

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

1878 {
1879 return "./Services/COPage/css/placeholder.css";
1880 }

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

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

◆ getScope()

ilObjStyleSheet::getScope ( )

Get scope.

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

625 {
626 return $this->scope;
627 }

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

1976 {
1977 return $this->style;
1978 }

References $style.

Referenced by writeCSSFile().

+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

2389 {
2390 $groups = array();
2391
2392 foreach (self::$parameter as $parameter => $props)
2393 {
2394 $groups[$props["group"]][] = $parameter;
2395 }
2396 return $groups;
2397 }

References $parameter.

◆ getSyntaxStylePath()

ilObjStyleSheet::getSyntaxStylePath ( )

get syntax style path

static

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

1868 {
1869 return "./Services/COPage/css/syntaxhighlight.css";
1870 }

Referenced by 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(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestServiceGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\populateSyntaxStyleBlock(), ilObjWikiGUI\printViewObject(), ilSCORM2004NodeGUI\setContentStyle(), ilObjDlBookGUI\showAbstract(), ilObjDlBookGUI\showCitation(), ilContainerObjectiveGUI\showObjectives(), ilMediaPoolPageGUI\showPage(), ilObjMediaPoolGUI\showPage(), and ilLMPresentationGUI\showPrintView().

+ Here is the caller graph for this function:

◆ getTemplate()

ilObjStyleSheet::getTemplate (   $a_t_id)

Get template.

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

3518 {
3519 global $ilDB;
3520
3521 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3522 "style_id = ".$ilDB->quote($this->getId(), "integer")." ".
3523 " AND id = ".$ilDB->quote($a_t_id, "integer"));
3524
3525 if ($rec = $ilDB->fetchAssoc($set))
3526 {
3527 $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3528
3529 $template = $rec;
3530 return $template;
3531 }
3532 return array();
3533 }
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 3401 of file class.ilObjStyleSheet.php.

3402 {
3403 global $ilDB;
3404 $set = $ilDB->query("SELECT * FROM style_template_class WHERE ".
3405 "template_id = ".$ilDB->quote($a_tid, "integer"));
3406
3407 $class = array();
3408 while ($rec = $ilDB->fetchAssoc($set))
3409 {
3410 $key = $rec["class_type"];
3411 $class[$key] = $rec["class"];
3412 }
3413
3414 return $class;
3415 }

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

3380 {
3381 global $ilDB;
3382
3383 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3384 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3385 "temp_type = ".$ilDB->quote($a_type, "text")." ".
3386 "ORDER BY name");
3387
3388 $templates = array();
3389 while ($rec = $ilDB->fetchAssoc($set))
3390 {
3391 $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3392 $templates[] = $rec;
3393 }
3394
3395 return $templates;
3396 }

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

3557 {
3558 global $ilDB;
3559
3560 $tag = "<StyleTemplates>";
3561
3562 $ttypes = array("table", "vaccordion", "haccordion", "carousel");
3563
3564 foreach ($ttypes as $ttype)
3565 {
3566 $ts = $this->getTemplates($ttype);
3567
3568 foreach($ts as $t)
3569 {
3571 /*$atts = array("table" => "TableClass",
3572 "caption" => "CaptionClass",
3573 "row_head" => "RowHeadClass",
3574 "row_foot" => "RowFootClass",
3575 "col_head" => "ColHeadClass",
3576 "col_foot" => "ColFootClass",
3577 "odd_row" => "OddRowClass",
3578 "even_row" => "EvenRowClass",
3579 "odd_col" => "OddColClass",
3580 "even_col" => "EvenColClass");*/
3581 $c = $t["classes"];
3582
3583 $tag.= '<StyleTemplate Name="'.$t["name"].'">';
3584
3585 foreach ($atts as $type => $t)
3586 {
3587 if ($c[$type] != "")
3588 {
3589 $tag.= '<StyleClass Type="'.$type.'" Value="'.$c[$type].'" />';
3590 }
3591 }
3592
3593 $tag.= "</StyleTemplate>";
3594 }
3595 }
3596
3597 $tag.= "</StyleTemplates>";
3598
3599//echo htmlentities($tag);
3600 return $tag;
3601 }
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 1304 of file class.ilObjStyleSheet.php.

1305 {
1306 return $this->getImagesDirectory().
1307 "/thumbnails";
1308 }

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

609 {
610 return $this->up_to_date;
611 }

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

2005 {
2006 $xml.= "<StyleSheet>\n";
2007
2008 // title and description
2009 $xml.= "<Title>".$this->handleXmlString($this->getTitle())."</Title>";
2010 $xml.= "<Description>".$this->handleXmlString($this->getDescription())."</Description>\n";
2011
2012 // style classes
2013 foreach($this->chars as $char)
2014 {
2015 $xml.= "<Style Tag=\"".ilObjStyleSheet::_determineTag($char["type"]).
2016 "\" Type=\"".$char["type"]."\" Class=\"".$char["class"]."\">\n";
2017 foreach($this->style as $style)
2018 {
2019 if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"])
2020 {
2021 foreach($style as $tag)
2022 {
2023 $xml.="<StyleParameter Name=\"".$tag["parameter"]."\" Value=\"".$tag["value"]."\" Custom=\"".$tag["custom"]."\" />\n";
2024 }
2025 }
2026 }
2027 $xml.= "</Style>\n";
2028 }
2029
2030 // colors
2031 foreach($this->getColors() as $color)
2032 {
2033 $xml.="<StyleColor Name=\"".$color["name"]."\" Code=\"".$color["code"]."\"/>\n";
2034 }
2035
2036 // templates
2038 foreach ($tcts as $tct => $v)
2039 {
2040 $ts = $this->getTemplates($tct);
2041
2042 foreach ($ts as $t)
2043 {
2044 $xml.="<StyleTemplate Type=\"".$tct."\" Name=\"".$t["name"]."\">\n";
2045 foreach ($t["classes"] as $ct => $c)
2046 {
2047 if ($c != "")
2048 {
2049 $xml.="<StyleTemplateClass ClassType=\"".$ct."\" Class=\"".$c."\"/>\n";
2050 }
2051 }
2052 $xml.="</StyleTemplate>\n";
2053 }
2054 }
2055
2056
2057 $xml.= "</StyleSheet>";
2058//echo "<pre>".htmlentities($xml)."</pre>"; exit;
2059 return $xml;
2060 }
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 1995 of file class.ilObjStyleSheet.php.

1996 {
1997 return str_replace("&", "&amp;", $a_str);
1998 }

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

1173 {
1174 global $log, $lng;
1175
1176 $lng->loadLanguageModule("style");
1177
1178 $new_obj = new ilObjStyleSheet();
1179 $new_obj->setTitle($this->getTitle()." (".$lng->txt("sty_acopy").")");
1180 $new_obj->setType($this->getType());
1181 $new_obj->setDescription($this->getDescription());
1182 $new_obj->create($this->getId());
1183
1184 $new_obj->writeStyleSetting("disable_auto_margins",
1185 $this->lookupStyleSetting("disable_auto_margins"));
1186
1187 return $new_obj->getId();
1188 }
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 552 of file class.ilObjStyleSheet.php.

553 {
554 $this->type = "sty";
555 $this->style = array();
556 if($a_call_by_reference)
557 {
558 $this->ilias->raiseError("Can't instantiate style object via reference id.",$this->ilias->error_obj->FATAL);
559 }
560
561 parent::ilObject($a_id, false);
562 }

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

+ Here is the caller graph for this function:

◆ import()

ilObjStyleSheet::import (   $a_file)

Import.

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

2244 {
2245 parent::create();
2246
2247 $im_dir = $this->createImportDirectory();
2248
2249 // handle uploaded files
2250 if (is_array($a_file))
2251 {
2252 ilUtil::moveUploadedFile($a_file["tmp_name"],
2253 $a_file["name"], $im_dir."/".$a_file["name"]);
2254 $file_name = $a_file["name"];
2255 }
2256 else // handle not directly uploaded files
2257 {
2258 $pi = pathinfo($a_file);
2259 $file_name = $pi["basename"];
2260 copy($a_file, $im_dir."/".$file_name);
2261 }
2262 $file = pathinfo($file_name);
2263
2264 // unzip file
2265 if (strtolower($file["extension"] == "zip"))
2266 {
2267 ilUtil::unzip($im_dir."/".$file_name);
2268 $subdir = basename($file["basename"],".".$file["extension"]);
2269 if (!is_dir($im_dir."/".$subdir))
2270 {
2271 $subdir = "style"; // check style subdir
2272 }
2273 $xml_file = $im_dir."/".$subdir."/style.xml";
2274 }
2275 else // handle xml file directly (old style)
2276 {
2277 $xml_file = $im_dir."/".$file_name;
2278 }
2279
2280 // load information from xml file
2281//echo "-$xml_file-";
2282 $this->createFromXMLFile($xml_file, true);
2283
2284 // copy images
2285 $this->createImagesDirectory();
2286 if (is_dir($im_dir."/".$subdir."/images"))
2287 {
2288 ilUtil::rCopy($im_dir."/".$subdir."/images",
2289 $this->getImagesDirectory());
2290 }
2291
2293 $this->read();
2294 $this->writeCSSFile();
2295 }
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 3729 of file class.ilObjStyleSheet.php.

3730 {
3731 global $ilDB;
3732
3733 $set = $ilDB->query("SELECT style_id FROM style_usage ".
3734 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer")
3735 );
3736 $rec = $ilDB->fetchAssoc($set);
3737
3738 if (ilObject::_lookupType($rec["style_id"]) == "sty")
3739 {
3740 return (int) $rec["style_id"];
3741 }
3742
3743 return 0;
3744 }

References $ilDB, and ilObject\_lookupType().

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

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

◆ lookupStyleSetting()

ilObjStyleSheet::lookupStyleSetting (   $a_name)

Lookup style setting.

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

3700 {
3701 global $ilDB;
3702
3703 $set = $ilDB->query("SELECT value FROM style_setting ".
3704 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
3705 " AND name = ".$ilDB->quote($a_name, "text")
3706 );
3707 $rec = $ilDB->fetchAssoc($set);
3708
3709 return $rec["value"];
3710 }

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

3539 {
3540 global $ilDB;
3541
3542 $set = $ilDB->query("SELECT name FROM style_template WHERE ".
3543 " id = ".$ilDB->quote($a_t_id, "integer"));
3544
3545 if ($rec = $ilDB->fetchAssoc($set))
3546 {
3547 return $rec["name"];
3548 }
3549
3550 return false;
3551 }

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

3628 {
3629 global $ilDB;
3630
3631 $set = $ilDB->query("SELECT preview FROM style_template ".
3632 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3633 if ($rec = $ilDB->fetchAssoc($set))
3634 {
3635 return $rec["preview"];
3636 }
3637
3638 return "";
3639 }

References $ilDB.

◆ putInTree()

ilObjStyleSheet::putInTree ( )

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

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

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

◆ read()

ilObjStyleSheet::read ( )

read style properties

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

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

2986 {
2987 global $ilDB;
2988
2989 $ilDB->manipulate("DELETE FROM style_color WHERE ".
2990 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
2991 " color_name = ".$ilDB->quote($a_name, "text"));
2992 }

References $ilDB.

◆ removeTemplate()

ilObjStyleSheet::removeTemplate (   $a_t_id)

Remove table template.

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

3663 {
3664 global $ilDB;
3665
3666 $ilDB->manipulate("DELETE FROM style_template WHERE ".
3667 " style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3668 " id = ".$ilDB->quote($a_t_id, "integer"));
3669
3670 $ilDB->manipulate("DELETE FROM style_template_class WHERE ".
3671 "template_id = ".$ilDB->quote($a_t_id, "integer")
3672 );
3673
3674 }

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

1918 {
1919 ilObjStyleSheet::_replaceStylePar($this->getId(), $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id, $a_custom);
1920 }
_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 1137 of file class.ilObjStyleSheet.php.

1138 {
1139 global $ilDB;
1140
1141 $ilDB->manipulate("UPDATE style_char SET ".
1142 " hide = ".$ilDB->quote((int) $a_hide, "integer").
1143 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
1144 " type = ".$ilDB->quote($a_type, "text")." AND ".
1145 " characteristic = ".$ilDB->quote($a_char, "text")
1146 );
1147 }

References $ilDB.

◆ saveMediaQueryOrder()

ilObjStyleSheet::saveMediaQueryOrder (   $a_order_nr = null)

Save media query order.

Parameters
int$a_order_nrorder nr

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

3348 {
3349 global $ilDB;
3350
3351 $mqueries = $this->getMediaQueries();
3352 if (is_array ($a_order_nr))
3353 {
3354 foreach ($mqueries as $k => $mq)
3355 {
3356 $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
3357 }
3358 $mqueries = ilUtil::sortArray($mqueries, "order_nr", "", true);
3359 }
3360 $cnt = 10;
3361 foreach ($mqueries as $mq)
3362 {
3363 $ilDB->manipulate("UPDATE sty_media_query SET ".
3364 " order_nr = ".$ilDB->quote($cnt, "integer").
3365 " WHERE id = ".$ilDB->quote($mq["id"], "integer")
3366 );
3367 $cnt+= 10;
3368 }
3369 }
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 1128 of file class.ilObjStyleSheet.php.

1129 {
1130 $this->chars = $a_chars;
1131 // $this->chars_by_type[$a_type];
1132 }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir (   $a_dir)

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

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

2139 {
2140 $this->export_sub_dir = $a_dir;
2141 }

◆ setRefId()

ilObjStyleSheet::setRefId ( )

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

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

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

◆ setScope()

ilObjStyleSheet::setScope (   $a_scope)

Set scope.

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

617 {
618 $this->scope = $a_scope;
619 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle (   $a_style)

set styles

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

1984 {
1985 $this->style = $a_style;
1986 }

◆ setUpToDate()

ilObjStyleSheet::setUpToDate (   $a_up_to_date = true)

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

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

601 {
602 $this->up_to_date = $a_up_to_date;
603 }

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

3501 {
3502 global $ilDB;
3503
3504 $set = $ilDB->query("SELECT * FROM style_template WHERE ".
3505 "style_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
3506 "name = ".$ilDB->quote($a_template_name, "text"));
3507 if ($rec = $ilDB->fetchAssoc($set))
3508 {
3509 return true;
3510 }
3511 return false;
3512 }

References $ilDB.

◆ update()

ilObjStyleSheet::update ( )

update object in db

@access public

Returns
boolean true on success

Reimplemented from ilObject.

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

1883 {
1884 global $ilDB;
1885
1886 parent::update();
1887 $this->read(); // this could be done better
1888 $this->writeCSSFile();
1889
1890 $q = "UPDATE style_data ".
1891 "SET category = ".$ilDB->quote((int) $this->getScope(), "integer").
1892 " WHERE id = ".$ilDB->quote($this->getId(), "integer");
1893 $ilDB->manipulate($q);
1894 }

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

2943 {
2944 global $ilDB;
2945
2946 // todo: update names in parameters as well
2947
2948 $ilDB->manipulate("UPDATE style_color SET ".
2949 "color_name = ".$ilDB->quote($a_new_name, "text").", ".
2950 "color_code = ".$ilDB->quote($a_code, "text").
2951 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
2952 " AND color_name = ".$ilDB->quote($a_name, "text"));
2953 ilObjStyleSheet::_writeUpToDate($this->getId(), false);
2954
2955 // rename also the name in the style parameter values
2956 if ($a_name != $a_new_name)
2957 {
2958 $set = $ilDB->query("SELECT * FROM style_parameter ".
2959 " WHERE style_id = ".$ilDB->quote($this->getId(), "integer").
2960 " AND (".
2961 " parameter = ".$ilDB->quote("background-color", "text"). " OR ".
2962 " parameter = ".$ilDB->quote("color", "text"). " OR ".
2963 " parameter = ".$ilDB->quote("border-color", "text"). " OR ".
2964 " parameter = ".$ilDB->quote("border-top-color", "text"). " OR ".
2965 " parameter = ".$ilDB->quote("border-bottom-color", "text"). " OR ".
2966 " parameter = ".$ilDB->quote("border-left-color", "text"). " OR ".
2967 " parameter = ".$ilDB->quote("border-right-color", "text").
2968 ")");
2969 while ($rec = $ilDB->fetchAssoc($set))
2970 {
2971 if ($rec["value"] == "!".$a_name ||
2972 is_int(strpos($rec["value"], "!".$a_name."(")))
2973 {
2974 // parameter is based on color -> rename it
2975 $this->replaceStylePar($rec["tag"], $rec["class"],
2976 $rec["parameter"], str_replace($a_name, $a_new_name, $rec["value"]), $rec["type"], $rec["mq_id"], $rec["custom"]);
2977 }
2978 }
2979 }
2980 }

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

3301 {
3302 global $ilDB;
3303
3304 $ilDB->manipulate("UPDATE sty_media_query SET ".
3305 " mquery = ".$ilDB->quote($a_mquery, "text").
3306 " WHERE id = ".$ilDB->quote($a_id, "integer")
3307 );
3308 }

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

1903 {
1904 global $ilDB;
1905
1906 $q = "UPDATE style_parameter SET VALUE = ".
1907 $ilDB->quote($a_value, "text")." WHERE id = ".
1908 $ilDB->quote($a_id, "integer");
1909 $style_set = $ilDB->manipulate($q);
1910 }

References $ilDB.

◆ updateTemplate()

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

Update table template.

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

3457 {
3458 global $ilDB;
3459
3460 $ilDB->manipulate("UPDATE style_template SET ".
3461 "name = ".$ilDB->quote($a_name, "text").
3462 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3463
3464 $ilDB->manipulate("DELETE FROM style_template_class WHERE ".
3465 "template_id = ".$ilDB->quote($a_t_id, "integer")
3466 );
3467 foreach ($a_classes as $t => $c)
3468 {
3469 $ilDB->manipulate($q = "INSERT INTO style_template_class ".
3470 "(template_id, class_type, class)".
3471 " VALUES (".
3472 $ilDB->quote($a_t_id, "integer").",".
3473 $ilDB->quote($t, "text").",".
3474 $ilDB->quote($c, "text").
3475 ")");
3476 }
3477
3478 }

References $ilDB, and $t.

◆ uploadImage()

ilObjStyleSheet::uploadImage (   $a_file)

Upload image.

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

1340 {
1341 $this->createImagesDirectory();
1342 @ilUtil::moveUploadedFile($a_file["tmp_name"], $a_file["name"],
1343 $this->getImagesDirectory()."/".$a_file["name"]);
1344 @ilUtil::resizeImage($this->getImagesDirectory()."/".$a_file["name"],
1345 $this->getThumbnailsDirectory()."/".$a_file["name"], 75, 75);
1346 }
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 1586 of file class.ilObjStyleSheet.php.

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

3680 {
3681 global $ilDB;
3682
3683 $ilDB->manipulate("DELETE FROM style_setting WHERE ".
3684 " style_id = ".$ilDB->quote($this->getId(), "integer").
3685 " AND name = ".$ilDB->quote($a_name, "text")
3686 );
3687
3688 $ilDB->manipulate("INSERT INTO style_setting ".
3689 "(style_id, name, value) VALUES (".
3690 $ilDB->quote($this->getId(), "integer").",".
3691 $ilDB->quote($a_name, "text").",".
3692 $ilDB->quote($a_value, "text").
3693 ")");
3694 }

References $ilDB.

◆ writeStyleUsage()

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

Write style usage.

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

3716 {
3717 global $ilDB;
3718
3719 $ilDB->replace("style_usage", array(
3720 "obj_id" => array("integer", (int) $a_obj_id)),
3721 array(
3722 "style_id" => array("integer", (int) $a_style_id))
3723 );
3724 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ writeTemplatePreview()

ilObjStyleSheet::writeTemplatePreview (   $a_t_id,
  $a_preview_html 
)

Write table template preview.

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

3607 {
3608 global $ilDB;
3609 $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3610 $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3611 $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3612//echo "1-".strlen($a_preview_html)."-";
3613//echo htmlentities($a_preview_html);
3614 if (strlen($a_preview_html) > 4000)
3615 {
3616//echo "2";
3617 $a_preview_html = "";
3618 }
3619 $ilDB->manipulate("UPDATE style_template SET ".
3620 "preview = ".$ilDB->quote($a_preview_html, "text").
3621 " WHERE id = ".$ilDB->quote($a_t_id, "integer"));
3622 }

References $ilDB.

Referenced by addTemplate().

+ Here is the caller graph for this function:

Field Documentation

◆ $assigned_tags

ilObjStyleSheet::$assigned_tags
static

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

◆ $basic_style_dom

ilObjStyleSheet::$basic_style_dom
staticprotected

Definition at line 544 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 542 of file class.ilObjStyleSheet.php.

◆ $basic_style_image_dir

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

Definition at line 543 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",
"ca_cntr", "ca_icntr", "ca_ihead", "ca_icont"
)

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

◆ $filtered_groups

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

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

Referenced by _getFilteredGroups().

◆ $hideable_types

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

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

◆ $num_unit

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

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

Referenced by _getStyleParameterNumericUnits().

◆ $num_unit_no_perc

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

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

Referenced by _getStyleParameterNumericUnits().

◆ $parameter

ilObjStyleSheet::$parameter
static

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

Referenced by _getStyleParameters(), and getStyleParameterGroups().

◆ $pseudo_classes

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

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

◆ $style

◆ $style_super_types

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

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

Referenced by _getStyleSuperTypes().

◆ $templates

ilObjStyleSheet::$templates
static

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

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


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