ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilObjStyleSheet Class Reference

Class ilObjStyleSheet. More...

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

Public Member Functions

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

Static Public Member Functions

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

Data Fields

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

Static Public Attributes

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

Static Protected Attributes

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

Additional Inherited Members

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

Detailed Description

Class ilObjStyleSheet.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor public.

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

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

References $DIC.

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

Member Function Documentation

◆ _addMissingStyleClassesToAllStyles()

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

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

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

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

Referenced by _addMissingStyleClassesToStyle().

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

References _addMissingStyleClassesToAllStyles().

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

2513  {
2514  $styles = array(array("id" => $a_id));
2516  }
static _addMissingStyleClassesToAllStyles($a_styles="")
Add missing style classes to all styles todo: add mq_id and custom handling.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _createImagesDirectory()

static ilObjStyleSheet::_createImagesDirectory (   $a_style_id)
static

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

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

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

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

1270  {
1271  global $DIC;
1272 
1273  $ilErr = $DIC["ilErr"];
1274 
1275  $sty_data_dir = ilUtil::getWebspaceDir() . "/sty";
1276  ilUtil::makeDir($sty_data_dir);
1277  if (!is_writable($sty_data_dir)) {
1278  $ilErr->raiseError("Style data directory (" . $sty_data_dir
1279  . ") not writeable.", $ilErr->FATAL);
1280  }
1281 
1282  $style_dir = $sty_data_dir . "/sty_" . $a_style_id;
1283  ilUtil::makeDir($style_dir);
1284  if (!@is_dir($style_dir)) {
1285  $ilErr->raiseError("Creation of style directory failed (" .
1286  $style_dir . ").", $ilErr->FATAL);
1287  }
1288 
1289  // create images subdirectory
1290  $im_dir = $style_dir . "/images";
1291  ilUtil::makeDir($im_dir);
1292  if (!@is_dir($im_dir)) {
1293  $ilErr->raiseError("Creation of Import Directory failed (" .
1294  $im_dir . ").", $ilErr->FATAL);
1295  }
1296 
1297  // create thumbnails directory
1298  $thumb_dir = $style_dir . "/images/thumbnails";
1299  ilUtil::makeDir($thumb_dir);
1300  if (!@is_dir($thumb_dir)) {
1301  $ilErr->raiseError("Creation of Import Directory failed (" .
1302  $thumb_dir . ").", $ilErr->FATAL);
1303  }
1304  }
global $DIC
Definition: saml.php:7
$ilErr
Definition: raiseError.php:18
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getWebspaceDir($mode="filesystem")
get webspace directory
+ 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 2490 of file class.ilObjStyleSheet.php.

References $a_type.

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

2491  {
2492  return self::$assigned_tags[$a_type];
2493  }
$a_type
Definition: workflow.php:92
+ 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 3026 of file class.ilObjStyleSheet.php.

References $r.

Referenced by _getColorFlavor().

3027  {
3028  $r["r"] = substr($a_rgb, 0, 2);
3029  $r["g"] = substr($a_rgb, 2, 2);
3030  $r["b"] = substr($a_rgb, 4, 2);
3031 
3032  if ($as_dec) {
3033  $r["r"] = (int) hexdec($r["r"]);
3034  $r["g"] = (int) hexdec($r["g"]);
3035  $r["b"] = (int) hexdec($r["b"]);
3036  }
3037 
3038  return $r;
3039  }
$r
Definition: example_031.php:79
+ Here is the caller graph for this function:

◆ _getBasicStyleDom()

static ilObjStyleSheet::_getBasicStyleDom ( )
static

Get basic style dom.

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

Referenced by _addMissingStyleClassesToAllStyles().

864  {
865  if (!is_object(self::$basic_style_dom)) {
866  self::$basic_style_dom = new DOMDocument();
867  self::$basic_style_dom->load(self::$basic_style_file);
868  }
869 
870  return self::$basic_style_dom;
871  }
+ Here is the caller graph for this function:

◆ _getClonableContentStyles()

static ilObjStyleSheet::_getClonableContentStyles ( )
static

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

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

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

Referenced by ilObjStyleSheetGUI\createObject().

810  {
811  global $DIC;
812 
813  $ilAccess = $DIC->access();
814  $ilDB = $DIC->database();
815 
816  $clonable_styles = array();
817 
818  $q = "SELECT * FROM style_data";
819  $style_set = $ilDB->query($q);
820  while ($style_rec = $ilDB->fetchAssoc($style_set)) {
821  $clonable = false;
822  if ($style_rec["standard"] == 1) {
823  if ($style_rec["active"] == 1) {
824  $clonable = true;
825  }
826  } else {
827  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
828  $obj_ids = ilObjContentObject::_lookupContObjIdByStyleId($style_rec["id"]);
829  if (count($obj_ids) == 0) {
830  $obj_ids = self::lookupObjectForStyle($style_rec["id"]);
831  }
832  foreach ($obj_ids as $id) {
833  $ref = ilObject::_getAllReferences($id);
834  foreach ($ref as $ref_id) {
835  if ($ilAccess->checkAccess("write", "", $ref_id)) {
836  $clonable = true;
837  }
838  }
839  }
840  }
841  if ($clonable) {
842  $clonable_styles[$style_rec["id"]] =
843  ilObject::_lookupTitle($style_rec["id"]);
844  }
845  }
846 
847  asort($clonable_styles);
848 
849  return $clonable_styles;
850  }
static _lookupContObjIdByStyleId($a_style_id)
lookup style sheet ID
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
global $ilDB
+ 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 3002 of file class.ilObjStyleSheet.php.

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

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

3003  {
3004  $rgb = ilObjStyleSheet::_explodeRGB($a_rgb, true);
3005  $hls = ilObjStyleSheet::_RGBToHLS($rgb);
3006 
3007  if ($a_i > 0) {
3008  $hls["l"] = $hls["l"] + ((255 - $hls["l"]) * ($a_i / 100));
3009  }
3010  if ($a_i < 0) {
3011  $hls["l"] = $hls["l"] - (($hls["l"]) * (-$a_i / 100));
3012  }
3013 
3014  $rgb = ilObjStyleSheet::_HLSToRGB($hls);
3015 
3016  foreach ($rgb as $k => $v) {
3017  $rgb[$k] = str_pad(dechex($v), 2, "0", STR_PAD_LEFT);
3018  }
3019 
3020  return $rgb["r"] . $rgb["g"] . $rgb["b"];
3021  }
static _explodeRGB($a_rgb, $as_dec=false)
Explode an RGB string into an array.
static _HLSToRGB($a_hls)
HLS to RGB (both arrays, 0..255)
static _RGBToHLS($a_rgb)
RGB to HLS (both arrays, 0..255)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getCoreStyles()

static ilObjStyleSheet::_getCoreStyles ( )
static

Get core styles.

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

References _determineTag().

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

2439  {
2440  $c_styles = array();
2441  foreach (self::$core_styles as $cstyle) {
2442  $c_styles[$cstyle["type"] . "." . ilObjStyleSheet::_determineTag($cstyle["type"]) . "." . $cstyle["class"]]
2443  = array("type" => $cstyle["type"],
2444  "tag" => ilObjStyleSheet::_determineTag($cstyle["type"]),
2445  "class" => $cstyle["class"]);
2446  }
2447  return $c_styles;
2448  }
static _determineTag($a_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getFilteredGroups()

static ilObjStyleSheet::_getFilteredGroups ( )
static

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

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

2386  {
2387  return self::$filtered_groups;
2388  }
+ Here is the caller graph for this function:

◆ _getImagesDirectory()

static ilObjStyleSheet::_getImagesDirectory (   $a_style_id)
static

Get images directory.

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

References ilUtil\getWebspaceDir().

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

1318  {
1319  return ilUtil::getWebspaceDir() . "/sty/sty_" . $a_style_id .
1320  "/images";
1321  }
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getPseudoClasses()

static ilObjStyleSheet::_getPseudoClasses (   $tag)
static

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

References $tag.

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

◆ _getStandardStyles()

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

Get standard styles.

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

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

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

767  {
768  global $DIC;
769 
770  $ilDB = $DIC->database();
771  $ilSetting = $DIC->settings();
772  $tree = $DIC->repositoryTree();
773 
774  $default_style = $ilSetting->get("default_content_style_id");
775 
776  $and_str = "";
777  if (!$a_include_deactivated) {
778  $and_str = " AND active = 1";
779  }
780 
781  $q = "SELECT * FROM style_data " .
782  " WHERE standard = 1" . $and_str;
783  $res = $ilDB->query($q);
784  $styles = array();
785  while ($sty = $ilDB->fetchAssoc($res)) {
786  if (!$a_exclude_default_style || $default_style != $sty["id"]) {
787  // check scope
788  if ($a_scope > 0 && $sty["category"] > 0) {
789  if ($tree->isInTree($sty["category"]) &&
790  $tree->isInTree($a_scope)) {
791  $path = $tree->getPathId($a_scope);
792  if (!in_array($sty["category"], $path)) {
793  continue;
794  }
795  }
796  }
797  $styles[$sty["id"]] = ilObject::_lookupTitle($sty["id"]);
798  }
799  }
800 
801  return $styles;
802  }
$path
Definition: aliased.php:25
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
foreach($_POST as $key=> $value) $res
global $ilSetting
Definition: privfeed.php:17
global $ilDB
+ 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 2357 of file class.ilObjStyleSheet.php.

References $input.

Referenced by ilObjStyleSheetGUI\initTagStyleForm().

2358  {
2359  $input = self::$parameter[$par]["input"];
2360  return $input;
2361  }
+ Here is the caller graph for this function:

◆ _getStyleParameterNumericUnits()

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

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

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

2391  {
2392  if ($a_no_percentage) {
2393  return self::$num_unit_no_perc;
2394  }
2395  return self::$num_unit;
2396  }
+ Here is the caller graph for this function:

◆ _getStyleParameters()

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

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

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

2370  {
2371  if ($a_tag == "") {
2372  return self::$parameter;
2373  }
2374  $par = array();
2375  foreach (self::$parameter as $k => $v) {
2376  if (is_array(self::$filtered_groups[$v["group"]]) &&
2377  !in_array($a_tag, self::$filtered_groups[$v["group"]])) {
2378  continue;
2379  }
2380  $par[$k] = $v;
2381  }
2382  return $par;
2383  }
+ Here is the caller graph for this function:

◆ _getStyleParameterSubPar()

static ilObjStyleSheet::_getStyleParameterSubPar (   $par)
static

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

2364  {
2365  $subpar = self::$parameter[$par]["subpar"];
2366  return $subpar;
2367  }

◆ _getStyleParameterValues()

static ilObjStyleSheet::_getStyleParameterValues (   $par)
static

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

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

2399  {
2400  return self::$parameter[$par]["values"];
2401  }
+ Here is the caller graph for this function:

◆ _getStyleSuperTypeForType()

static ilObjStyleSheet::_getStyleSuperTypeForType (   $a_type)
static

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

References $a_type, $s, and $t.

Referenced by ilObjStyleSheetGUI\__construct().

2424  {
2425  foreach (self::$style_super_types as $s => $t) {
2426  if (in_array($a_type, $t)) {
2427  return $s;
2428  }
2429  if ($a_type == $s) {
2430  return $s;
2431  }
2432  }
2433  }
$s
Definition: pwgen.php:45
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ _getStyleSuperTypes()

static ilObjStyleSheet::_getStyleSuperTypes ( )
static

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

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

2409  {
2410  return self::$style_super_types;
2411  }
+ Here is the caller graph for this function:

◆ _getTemplateClassTypes()

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

Get template class types.

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

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

2471  {
2472  if ($a_template_type == "") {
2473  return self::$templates;
2474  }
2475 
2476  return self::$templates[$a_template_type];
2477  }
+ 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 3086 of file class.ilObjStyleSheet.php.

References $h, $l, and $s.

Referenced by _getColorFlavor().

3087  {
3088  $h = $a_hls["h"] / 255;
3089  $l = $a_hls["l"] / 255;
3090  $s = $a_hls["s"] / 255;
3091 
3092  $rgb["r"] = $rgb["g"] = $rgb["b"] = 0;
3093 
3094  // If S=0, define R, G, and B all to L
3095  if ($s == 0) {
3096  $rgb["r"] = $rgb["g"] = $rgb["b"] = $l;
3097  } else {
3098  if ($l < 0.5) {
3099  $temp2 = $l * (1.0 + $s);
3100  } else {
3101  $temp2 = $l + $s - $l * $s;
3102  }
3103 
3104  $temp1 = 2.0 * $l - $temp2;
3105 
3106 
3107  # For each of R, G, B, compute another temporary value, temp3, as follows:
3108  foreach ($rgb as $k => $v) {
3109  switch ($k) {
3110  case "r":
3111  $temp3 = $h + 1.0 / 3.0;
3112  break;
3113 
3114  case "g":
3115  $temp3 = $h;
3116  break;
3117 
3118  case "b":
3119  $temp3 = $h - 1.0 / 3.0;
3120  break;
3121  }
3122  if ($temp3 < 0) {
3123  $temp3 = $temp3 + 1.0;
3124  }
3125  if ($temp3 > 1) {
3126  $temp3 = $temp3 - 1.0;
3127  }
3128 
3129  if (6.0 * $temp3 < 1) {
3130  $rgb[$k] = $temp1 + ($temp2 - $temp1) * 6.0 * $temp3;
3131  } elseif (2.0 * $temp3 < 1) {
3132  $rgb[$k] = $temp2;
3133  } elseif (3.0 * $temp3 < 2) {
3134  $rgb[$k] = $temp1 + ($temp2 - $temp1) * ((2.0 / 3.0) - $temp3) * 6.0;
3135  } else {
3136  $rgb[$k] = $temp1;
3137  }
3138  }
3139  }
3140 
3141  $rgb["r"] = round($rgb["r"] * 255);
3142  $rgb["g"] = round($rgb["g"] * 255);
3143  $rgb["b"] = round($rgb["b"] * 255);
3144 
3145  return $rgb;
3146  }
$h
$s
Definition: pwgen.php:45
global $l
Definition: afr.php:30
+ Here is the caller graph for this function:

◆ _isExpandable()

static ilObjStyleSheet::_isExpandable (   $a_type)
static

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

References $a_type.

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

2414  {
2415  return in_array($a_type, self::$expandable_types);
2416  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ _isHideable()

static ilObjStyleSheet::_isHideable (   $a_type)
static

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

References $a_type.

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

2419  {
2420  return in_array($a_type, self::$hideable_types);
2421  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ _lookupActive()

static ilObjStyleSheet::_lookupActive (   $a_id)
static

Lookup active flag.

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

References $DIC, $ilDB, and $res.

Referenced by ilContentStyleSettingsGUI\edit().

747  {
748  global $DIC;
749 
750  $ilDB = $DIC->database();
751 
752  $q = "SELECT * FROM style_data " .
753  " WHERE id = " . $ilDB->quote($a_id, "integer");
754  $res = $ilDB->query($q);
755  $sty = $ilDB->fetchAssoc($res);
756 
757  return (boolean) $sty["active"];
758  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupStandard()

static ilObjStyleSheet::_lookupStandard (   $a_id)
static

Lookup standard flag.

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

References $DIC, $ilDB, and $res.

Referenced by ilContainer\_exportContainerSettings(), ilObjCategoryGUI\afterSave(), ilObjContentPageGUI\buildStylePropertiesForm(), ilObjPortfolioBase\cloneBasics(), ilObjWiki\cloneObject(), ilObjGlossary\cloneObject(), ilObjContentObject\cloneObject(), ilObjSCORM2004LearningModule\copyAuthoredContent(), ilObjBlog\doCloneObject(), ilObjSCORM2004LearningModuleGUI\initPropertiesEditableForm(), ilObjContentObjectGUI\initStylePropertiesForm(), ilObjPortfolioBaseGUI\initStylePropertiesForm(), ilObjSCORM2004LearningModuleGUI\initStylePropertiesForm(), ilObjGlossaryGUI\initStylePropertiesForm(), ilObjWikiGUI\initStylePropertiesForm(), ilContainerGUI\initStylePropertiesForm(), ilObjBlogGUI\initStylePropertiesForm(), ilObjSCORM2004LearningModuleGUI\properties(), ilObjSCORM2004LearningModuleGUI\saveProperties(), ilObjContentPageGUI\saveStyleSettings(), ilObjContentObjectGUI\saveStyleSettings(), ilObjPortfolioBaseGUI\saveStyleSettings(), ilObjSCORM2004LearningModuleGUI\saveStyleSettings(), ilObjGlossaryGUI\saveStyleSettings(), ilObjBlogGUI\saveStyleSettings(), ilObjWikiGUI\saveStyleSettingsObject(), ilContainerGUI\saveStyleSettingsObject(), and ilObjContentPage\writeStyleSheetId().

715  {
716  global $DIC;
717 
718  $ilDB = $DIC->database();
719 
720  $q = "SELECT * FROM style_data " .
721  " WHERE id = " . $ilDB->quote($a_id, "integer");
722  $res = $ilDB->query($q);
723  $sty = $ilDB->fetchAssoc($res);
724 
725  return (boolean) $sty["standard"];
726  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupTemplateIdByName()

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

Lookup table template preview.

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

References $DIC, and $ilDB.

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

3567  {
3568  global $DIC;
3569 
3570  $ilDB = $DIC->database();
3571 
3572  $set = $ilDB->query("SELECT id FROM style_template " .
3573  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer") .
3574  " AND name = " . $ilDB->quote($a_name, "text"));
3575  if ($rec = $ilDB->fetchAssoc($set)) {
3576  return $rec["id"];
3577  }
3578 
3579  return false;
3580  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupTemplateName()

static ilObjStyleSheet::_lookupTemplateName (   $a_t_id)
static

Lookup table template name for template ID.

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

References $DIC, and $ilDB.

Referenced by ilObjStyleSheetGUI\updateTemplateObject().

3466  {
3467  global $DIC;
3468 
3469  $ilDB = $DIC->database();
3470 
3471  $set = $ilDB->query("SELECT name FROM style_template WHERE " .
3472  " id = " . $ilDB->quote($a_t_id, "integer"));
3473 
3474  if ($rec = $ilDB->fetchAssoc($set)) {
3475  return $rec["name"];
3476  }
3477 
3478  return false;
3479  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupUpToDate()

static ilObjStyleSheet::_lookupUpToDate (   $a_id)
static

Looup up to date.

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

References $DIC, $ilDB, and $res.

Referenced by getContentStylePath().

668  {
669  global $DIC;
670 
671  $ilDB = $DIC->database();
672 
673  $q = "SELECT uptodate FROM style_data " .
674  " WHERE id = " . $ilDB->quote($a_id, "integer");
675  $res = $ilDB->query($q);
676  $sty = $ilDB->fetchAssoc($res);
677 
678  return (boolean) $sty["uptodate"];
679  }
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB
+ Here is the caller graph for this function:

◆ _replaceStylePar()

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

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

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

Referenced by replaceStylePar().

1907  {
1908  global $DIC;
1909 
1910  $ilDB = $DIC->database();
1911 
1912  $q = "SELECT * FROM style_parameter WHERE " .
1913  " style_id = " . $ilDB->quote($style_id, "integer") . " AND " .
1914  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1915  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1916  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1917  " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1918  " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1919  " parameter = " . $ilDB->quote($a_par, "text");
1920 
1921  $set = $ilDB->query($q);
1922 
1923  if ($rec = $set->fetchRow()) {
1924  $q = "UPDATE style_parameter SET " .
1925  " value = " . $ilDB->quote($a_val, "text") . " WHERE " .
1926  " style_id = " . $ilDB->quote($style_id, "integer") . " AND " .
1927  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1928  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1929  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1930  " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1931  " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1932  " parameter = " . $ilDB->quote($a_par, "text");
1933 
1934  $ilDB->manipulate($q);
1935  } else {
1936  $id = $ilDB->nextId("style_parameter");
1937  $q = "INSERT INTO style_parameter (id, value, style_id, tag, class, type, parameter, mq_id, custom) VALUES " .
1938  " (" .
1939  $ilDB->quote($id, "integer") . "," .
1940  $ilDB->quote($a_val, "text") . "," .
1941  " " . $ilDB->quote($style_id, "integer") . "," .
1942  " " . $ilDB->quote($a_tag, "text") . "," .
1943  " " . $ilDB->quote($a_class, "text") . "," .
1944  " " . $ilDB->quote($a_type, "text") . "," .
1945  " " . $ilDB->quote($a_par, "text") . "," .
1946  " " . $ilDB->quote($a_mq_id, "integer") . "," .
1947  " " . $ilDB->quote($a_custom, "integer") .
1948  ")";
1949 
1950  $ilDB->manipulate($q);
1951  }
1952  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
global $ilDB
+ 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 3044 of file class.ilObjStyleSheet.php.

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

Referenced by _getColorFlavor().

3045  {
3046  $r = $a_rgb["r"] / 255;
3047  $g = $a_rgb["g"] / 255;
3048  $b = $a_rgb["b"] / 255;
3049 
3050  // max / min
3051  $max = max($r, $g, $b);
3052  $min = min($r, $g, $b);
3053 
3054  //lightness
3055  $l = ($max + $min) / 2;
3056 
3057  if ($max == $min) {
3058  $s = 0;
3059  $h = 0;
3060  } else {
3061  if ($l < 0.5) {
3062  $s = ($max - $min) / ($max + $min);
3063  } else {
3064  $s = ($max - $min) / (2.0 - $max - $min);
3065  }
3066 
3067  if ($r == $max) {
3068  $h = ($g - $b) / ($max - $min);
3069  } elseif ($g == $max) {
3070  $h = 2.0 + ($b - $r) / ($max - $min);
3071  } elseif ($b == $max) {
3072  $h = 4.0 + ($r - $g) / ($max - $min);
3073  }
3074  }
3075 
3076  $hls["h"] = round(($h / 6) * 255);
3077  $hls["l"] = round($l * 255);
3078  $hls["s"] = round($s * 255);
3079 
3080  return $hls;
3081  }
$h
$s
Definition: pwgen.php:45
$r
Definition: example_031.php:79
global $l
Definition: afr.php:30
+ Here is the caller graph for this function:

◆ _writeActive()

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

Write active flag.

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

References $DIC, and $ilDB.

Referenced by ilContentStyleSettingsGUI\saveActiveStyles().

732  {
733  global $DIC;
734 
735  $ilDB = $DIC->database();
736 
737  $q = "UPDATE style_data SET active = " .
738  $ilDB->quote((int) $a_active, "integer") .
739  " WHERE id = " . $ilDB->quote($a_id, "integer");
740  $ilDB->manipulate($q);
741  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _writeScope()

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

Write scope.

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

References $DIC, and $ilDB.

Referenced by ilContentStyleSettingsGUI\saveScope().

700  {
701  global $DIC;
702 
703  $ilDB = $DIC->database();
704 
705  $q = "UPDATE style_data SET category = " .
706  $ilDB->quote((int) $a_scope, "integer") .
707  " WHERE id = " . $ilDB->quote($a_id, "integer");
708  $ilDB->manipulate($q);
709  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _writeStandard()

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

Write standard flag.

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

References $DIC, and $ilDB.

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

685  {
686  global $DIC;
687 
688  $ilDB = $DIC->database();
689 
690  $q = "UPDATE style_data SET standard = " .
691  $ilDB->quote((int) $a_std, "integer") .
692  " WHERE id = " . $ilDB->quote($a_id, "integer");
693  $ilDB->manipulate($q);
694  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _writeUpToDate()

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

Write up to date.

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

References $DIC, and $ilDB.

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

653  {
654  global $DIC;
655 
656  $ilDB = $DIC->database();
657 
658  $q = "UPDATE style_data SET uptodate = " .
659  $ilDB->quote((int) $a_up_to_date, "integer") .
660  " WHERE id = " . $ilDB->quote($a_id, "integer");
661  $ilDB->manipulate($q);
662  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ addCharacteristic()

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

Add characteristic.

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

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

Referenced by copyCharacteristic().

1053  {
1054  $ilDB = $this->db;
1055 
1056  // delete characteristic record
1057  $ilDB->manipulateF(
1058  "INSERT INTO style_char (style_id, type, characteristic, hide)" .
1059  " VALUES (%s,%s,%s,%s) ",
1060  array("integer", "text", "text", "integer"),
1061  array($this->getId(), $a_type, $a_char, $a_hidden)
1062  );
1063 
1064  $this->setUpToDate(false);
1065  $this->_writeUpToDate($this->getId(), false);
1066  }
$a_type
Definition: workflow.php:92
getId()
get object id public
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
global $ilDB
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
+ 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 2883 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by copyCharacteristic(), and create().

2884  {
2885  $ilDB = $this->db;
2886 
2887  $ilDB->manipulate("INSERT INTO style_color (style_id, color_name, color_code)" .
2888  " VALUES (" .
2889  $ilDB->quote($this->getId(), "integer") . "," .
2890  $ilDB->quote($a_name, "text") . "," .
2891  $ilDB->quote($a_code, "text") .
2892  ")");
2893  }
global $ilDB
+ 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 3179 of file class.ilObjStyleSheet.php.

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

Referenced by create().

3180  {
3181  $ilDB = $this->db;
3182 
3183  $id = $ilDB->nextId("sty_media_query");
3184  if ($order_nr == 0) {
3185  $order_nr = $this->getMaxMQueryOrderNr() + 10;
3186  }
3187 
3188  $ilDB->manipulate("INSERT INTO sty_media_query (id, style_id, mquery, order_nr)" .
3189  " VALUES (" .
3190  $ilDB->quote($id, "integer") . "," .
3191  $ilDB->quote($this->getId(), "integer") . "," .
3192  $ilDB->quote($a_mquery, "text") . "," .
3193  $ilDB->quote($order_nr, "integer") .
3194  ")");
3195 
3196  return $id;
3197  }
getId()
get object id public
getMaxMQueryOrderNr()
Get maximum media query order nr.
global $ilDB
+ 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 1231 of file class.ilObjStyleSheet.php.

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

1232  {
1233  $ilDB = $this->db;
1234 
1235  $avail_params = $this->getAvailableParameters();
1236  $tag = explode(".", $a_tag);
1237  $value = $avail_params[$a_par][0];
1238  $id = $ilDB->nextId("style_parameter");
1239  $q = "INSERT INTO style_parameter (id,style_id, type, tag, class, parameter, value, mq_id, custom) VALUES " .
1240  "(" .
1241  $ilDB->quote($id, "integer") . "," .
1242  $ilDB->quote($this->getId(), "integer") . "," .
1243  $ilDB->quote($a_type, "text") . "," .
1244  $ilDB->quote($tag[0], "text") . "," .
1245  $ilDB->quote($tag[1], "text") . "," .
1246  $ilDB->quote($a_par, "text") . "," .
1247  $ilDB->quote($value, "text") . "," .
1248  $ilDB->quote($a_mq_id, "integer") . "," .
1249  $ilDB->quote($a_custom, "integer") .
1250  ")";
1251  $ilDB->manipulate($q);
1252  $this->read();
1253  $this->writeCSSFile();
1254  }
read()
read style properties
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
static getAvailableParameters()
Get available parameters.
+ Here is the call graph for this function:

◆ addTemplate()

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

Add table template.

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

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

Referenced by create().

3343  {
3344  $ilDB = $this->db;
3345 
3346  $tid = $ilDB->nextId("style_template");
3347  $ilDB->manipulate($q = "INSERT INTO style_template " .
3348  "(id, style_id, name, temp_type)" .
3349  " VALUES (" .
3350  $ilDB->quote($tid, "integer") . "," .
3351  $ilDB->quote($this->getId(), "integer") . "," .
3352  $ilDB->quote($a_name, "text") . "," .
3353  $ilDB->quote($a_type, "text") .
3354  ")");
3355 
3356  foreach ($a_classes as $t => $c) {
3357  $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3358  "(template_id, class_type, class)" .
3359  " VALUES (" .
3360  $ilDB->quote($tid, "integer") . "," .
3361  $ilDB->quote($t, "text") . "," .
3362  $ilDB->quote($c, "text") .
3363  ")");
3364  }
3365 
3366  include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
3367  $this->writeTemplatePreview(
3368  $tid,
3370  );
3371 
3372  return $tid;
3373  }
static _getTemplatePreview($a_style, $a_type, $a_t_id, $a_small_mode=false)
Get table template preview.
writeTemplatePreview($a_t_id, $a_preview_html)
Write table template preview.
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ 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 3404 of file class.ilObjStyleSheet.php.

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

3405  {
3406  $ilDB = $this->db;
3407 
3408  $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3409  "(template_id, class_type, class)" .
3410  " VALUES (" .
3411  $ilDB->quote($a_t_id, "integer") . "," .
3412  $ilDB->quote($a_type, "text") . "," .
3413  $ilDB->quote($a_class, "text") .
3414  ")");
3415  }
$a_type
Definition: workflow.php:92
global $ilDB

◆ assignMetaData()

ilObjStyleSheet::assignMetaData ( $a_meta_data)

assign meta data object

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

856  {
857  $this->meta_data = $a_meta_data;
858  }

◆ characteristicExists()

ilObjStyleSheet::characteristicExists (   $a_char,
  $a_style_type 
)

Check whether characteristic exists.

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

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

Referenced by copyCharacteristic().

1035  {
1036  $ilDB = $this->db;
1037 
1038  $set = $ilDB->queryF(
1039  "SELECT style_id FROM style_char WHERE style_id = %s AND characteristic = %s AND type = %s",
1040  array("integer", "text", "text"),
1041  array($this->getId(), $a_char, $a_style_type)
1042  );
1043  if ($rec = $ilDB->fetchAssoc($set)) {
1044  return true;
1045  }
1046  return false;
1047  }
getId()
get object id public
global $ilDB
+ 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 2070 of file class.ilObjStyleSheet.php.

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

Referenced by export().

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

References ilObject\$db, and $ilDB.

Referenced by copyCharacteristic().

2958  {
2959  $ilDB = $this->db;
2960 
2961  $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2962  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2963  "color_name = " . $ilDB->quote($a_color_name, "text"));
2964  if ($rec = $ilDB->fetchAssoc($set)) {
2965  return true;
2966  }
2967  return false;
2968  }
global $ilDB
+ 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

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

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

1079  {
1080  $ilDB = $this->db;
1081 
1082  if (!$this->characteristicExists($a_to_char, $a_from_type)) {
1083  $this->addCharacteristic($a_from_type, $a_to_char);
1084  }
1085  $this->deleteStyleParOfChar($a_from_type, $a_to_char);
1086 
1087  $from_style = new ilObjStyleSheet($a_from_style_id);
1088 
1089  // todo fix using mq_id
1090  $pars = $from_style->getParametersOfClass($a_from_type, $a_from_char);
1091 
1092  $colors = array();
1093  foreach ($pars as $p => $v) {
1094  if (substr($v, 0, 1) == "!") {
1095  $colors[] = substr($v, 1);
1096  }
1097  $this->replaceStylePar(
1098  ilObjStyleSheet::_determineTag($a_from_type),
1099  $a_to_char,
1100  $p,
1101  $v,
1102  $a_from_type
1103  );
1104  }
1105 
1106  // copy colors
1107  foreach ($colors as $c) {
1108  if (!$this->colorExists($c)) {
1109  $this->addColor($c, $from_style->getColorCodeForName($c));
1110  }
1111  }
1112  }
characteristicExists($a_char, $a_style_type)
Check whether characteristic exists.
static _determineTag($a_type)
deleteStyleParOfChar($a_type, $a_class)
Delete style parameters of characteristic.
addColor($a_name, $a_code)
Add color.
addCharacteristic($a_type, $a_char, $a_hidden=false)
Add characteristic.
replaceStylePar($a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
Set style parameter per tag/class/parameter.
colorExists($a_color_name)
Check whether color exists.
global $ilDB
Class ilObjStyleSheet.
+ Here is the call graph for this function:

◆ copyImagesToDir()

ilObjStyleSheet::copyImagesToDir (   $a_target)

Copy images to directory.

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

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

1218  {
1219  ilUtil::rCopy($this->getImagesDirectory(), $a_target);
1220  }
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getImagesDirectory()
Get images directory.
+ 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 884 of file class.ilObjStyleSheet.php.

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

885  {
886  $ilDB = $this->db;
887 
888  parent::create();
889 
890  if ($a_from_style == 0) {
891  if (!$a_import_mode) {
892  // copy styles from basic style
893  $this->createFromXMLFile(self::$basic_style_file, true);
894 
895  // copy images from basic style
896  $this->createImagesDirectory();
898  self::$basic_style_image_dir,
899  $this->getImagesDirectory()
900  );
901  } else {
902  // add style_data record
903  $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
904  "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
905  $ilDB->quote((int) $this->getScope(), "integer") . ")";
906  $ilDB->manipulate($q);
908  }
909  } else {
910  // get style parameter records
911  $def = array();
912  $q = "SELECT * FROM style_parameter WHERE style_id = " .
913  $ilDB->quote($a_from_style, "integer");
914  $par_set = $ilDB->query($q);
915  while ($par_rec = $ilDB->fetchAssoc($par_set)) {
916  $def[] = array("tag" => $par_rec["tag"], "class" => $par_rec["class"],
917  "parameter" => $par_rec["parameter"], "value" => $par_rec["value"],
918  "type" => $par_rec["type"], "mq_id" => $par_rec["mq_id"], "custom" => $par_rec["custom"]);
919  }
920 
921  // get style characteristics records
922  $chars = array();
923  $q = "SELECT * FROM style_char WHERE style_id = " .
924  $ilDB->quote($a_from_style, "integer");
925  $par_set = $ilDB->query($q);
926  while ($par_rec = $ilDB->fetchAssoc($par_set)) {
927  $chars[] = array("type" => $par_rec["type"], "characteristic" => $par_rec["characteristic"]);
928  }
929 
930 
931  // copy media queries
932  $from_style = new ilObjStyleSheet($a_from_style);
933  $mqs = $from_style->getMediaQueries();
934  $mq_mapping = array();
935  foreach ($mqs as $mq) {
936  $nid = $this->addMediaQuery($mq["mquery"]);
937  $mq_mapping[$mq["id"]] = $nid;
938  }
939 
940  // default style settings
941  foreach ($def as $sty) {
942  $id = $ilDB->nextId("style_parameter");
943  $q = "INSERT INTO style_parameter (id, style_id, tag, class, parameter, value, type, mq_id, custom) VALUES " .
944  "(" .
945  $ilDB->quote($id, "integer") . "," .
946  $ilDB->quote($this->getId(), "integer") . "," .
947  $ilDB->quote($sty["tag"], "text") . "," .
948  $ilDB->quote($sty["class"], "text") . "," .
949  $ilDB->quote($sty["parameter"], "text") . "," .
950  $ilDB->quote($sty["value"], "text") . "," .
951  $ilDB->quote($sty["type"], "text") . "," .
952  $ilDB->quote((int) $mq_mapping[$sty["mq_id"]], "integer") . "," .
953  $ilDB->quote($sty["custom"], "integer") .
954  ")";
955  $ilDB->manipulate($q);
956  }
957 
958  // insert style characteristics
959  foreach ($chars as $char) {
960  $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES " .
961  "(" . $ilDB->quote($this->getId(), "integer") . "," .
962  $ilDB->quote($char["type"], "text") . "," .
963  $ilDB->quote($char["characteristic"], "text") . ")";
964  $ilDB->manipulate($q);
965  }
966 
967  // add style_data record
968  $q = "INSERT INTO style_data (id, uptodate, category) VALUES " .
969  "(" . $ilDB->quote($this->getId(), "integer") . ", 0," .
970  $ilDB->quote((int) $this->getScope(), "integer") . ")";
971  $ilDB->manipulate($q);
972 
973  // copy images
974  $this->createImagesDirectory();
976  $from_style->getImagesDirectory(),
977  $this->getImagesDirectory()
978  );
979 
980  // copy colors
981  $colors = $from_style->getColors();
982  foreach ($colors as $c) {
983  $this->addColor($c["name"], $c["code"]);
984  }
985 
986  // copy templates
988  foreach ($tcts as $tct => $v) {
989  $templates = $from_style->getTemplates($tct);
990  foreach ($templates as $t) {
991  $this->addTemplate($tct, $t["name"], $t["classes"]);
992  }
993  }
994  }
995 
996  $this->read();
997  if (!$a_import_mode) {
998  $this->writeCSSFile();
999  }
1000  }
static _getTemplateClassTypes($a_template_type="")
Get template class types.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
read()
read style properties
addTemplate($a_type, $a_name, $a_classes)
Add table template.
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
addColor($a_name, $a_code)
Add color.
getImagesDirectory()
Get images directory.
getId()
get object id public
static _createImagesDirectory($a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
global $ilDB
Class ilObjStyleSheet.
$def
Definition: croninfo.php:21
createFromXMLFile($a_file, $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
addMediaQuery($a_mquery, $order_nr=0)
Add media query.
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:

◆ createExportDirectory()

ilObjStyleSheet::createExportDirectory ( )

Create export directory.

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

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

Referenced by createExportSubDirectory(), and export().

2041  {
2042  $sty_data_dir = ilUtil::getDataDir() . "/sty";
2043  ilUtil::makeDir($sty_data_dir);
2044  if (!is_writable($sty_data_dir)) {
2045  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
2046  . ") not writeable.", $this->ilias->error_obj->FATAL);
2047  }
2048 
2049  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
2050  ilUtil::makeDir($style_dir);
2051  if (!@is_dir($style_dir)) {
2052  $this->ilias->raiseError("Creation of style directory failed (" .
2053  $style_dir . ").", $this->ilias->error_obj->FATAL);
2054  }
2055 
2056  // create export subdirectory
2057  $ex_dir = $style_dir . "/export";
2058  ilUtil::makeDir($ex_dir);
2059  if (!@is_dir($ex_dir)) {
2060  $this->ilias->raiseError("Creation of Import Directory failed (" .
2061  $ex_dir . ").", $this->ilias->error_obj->FATAL);
2062  }
2063 
2064  return $ex_dir;
2065  }
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createExportSubDirectory()

ilObjStyleSheet::createExportSubDirectory ( )

Create export directory.

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

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

Referenced by export().

2087  {
2088  $ex_dir = $this->createExportDirectory();
2089  $ex_sub_dir = $ex_dir . "/" . $this->getExportSubDir();
2090  ilUtil::makeDir($ex_sub_dir);
2091  if (!is_writable($ex_sub_dir)) {
2092  $this->ilias->raiseError("Style data directory (" . $ex_sub_dir
2093  . ") not writeable.", $this->ilias->error_obj->FATAL);
2094  }
2095  $ex_sub_images_dir = $ex_sub_dir . "/images";
2096  ilUtil::makeDir($ex_sub_images_dir);
2097  if (!is_writable($ex_sub_images_dir)) {
2098  $this->ilias->raiseError("Style data directory (" . $ex_sub_images_dir
2099  . ") not writeable.", $this->ilias->error_obj->FATAL);
2100  }
2101  }
redirection script todo: (a better solution should control the processing via a xml file) ...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
createExportDirectory()
Create export directory.
getExportSubDir()
The local directory, that will be included within the zip file.
+ 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 2261 of file class.ilObjStyleSheet.php.

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

Referenced by create(), and import().

2262  {
2263  $ilDB = $this->db;
2264 
2265  $this->is_3_10_skin = false;
2266 
2267  if (!$a_skip_parent_create) {
2268  parent::create();
2269  }
2270  include_once("./Services/Style/Content/classes/class.ilStyleImportParser.php");
2271  $importParser = new ilStyleImportParser($a_file, $this);
2272  $importParser->startParsing();
2273 
2274  // store style parameter
2275  foreach ($this->style as $style) {
2276  foreach ($style as $tag) {
2277  $id = $ilDB->nextId("style_parameter");
2278 
2279  // migrate old table PageFrame/PageContainer to div
2280  if (in_array($tag["class"], array("PageFrame", "PageContainer")) &&
2281  $tag["tag"] == "table") {
2282  $tag["tag"] = "div";
2283  if ($tag["parameter"] == "width" && $tag["value"] == "100%") {
2284  continue;
2285  }
2286  }
2287 
2288  $q = "INSERT INTO style_parameter (id,style_id, tag, class, parameter, type, value, custom) VALUES " .
2289  "(" .
2290  $ilDB->quote($id, "integer") . "," .
2291  $ilDB->quote($this->getId(), "integer") . "," .
2292  $ilDB->quote($tag["tag"], "text") . "," .
2293  $ilDB->quote($tag["class"], "text") . "," .
2294  $ilDB->quote($tag["parameter"], "text") . "," .
2295  $ilDB->quote($tag["type"], "text") . "," .
2296  $ilDB->quote($tag["value"], "text") . "," .
2297  $ilDB->quote((bool) $tag["custom"], "integer") .
2298  ")";
2299  $ilDB->manipulate($q);
2300  }
2301  }
2302 
2303  // store characteristics
2304  $this->is_3_10_skin = true;
2305  if (is_array($this->chars)) {
2306  foreach ($this->chars as $char) {
2307  if ($char["type"] != "") {
2308  $s = substr($char["class"], strlen($char["class"]) - 6);
2309  if ($s != ":hover") {
2310  $ilDB->replace(
2311  "style_char",
2312  array(
2313  "style_id" => array("integer", $this->getId()),
2314  "type" => array("text", $char["type"]),
2315  "characteristic" => array("text", $char["class"])),
2316  array("hide" => array("integer", 0))
2317  );
2318  /*
2319  $q = "INSERT INTO style_char (style_id, type, characteristic) VALUES ".
2320  "(".$ilDB->quote($this->getId(), "integer").",".
2321  $ilDB->quote($char["type"], "text").",".
2322  $ilDB->quote($char["class"], "text").")";
2323  $ilDB->manipulate($q);*/
2324  $this->is_3_10_skin = false;
2325  }
2326  }
2327  }
2328  }
2329 
2330  // add style_data record
2331  $q = "INSERT INTO style_data (id, uptodate) VALUES " .
2332  "(" . $ilDB->quote($this->getId(), "integer") . ", 0)";
2333  $ilDB->manipulate($q);
2334 
2335  $this->update();
2336  $this->read();
2337 
2338  if ($this->is_3_10_skin) {
2339  $this->do_3_10_Migration();
2340  }
2341  //$this->writeCSSFile();
2342  }
do_3_10_Migration()
Migrates 3.10 style to 3.11 style.
read()
read style properties
"color:#CC0000 style
Definition: example_001.php:92
$s
Definition: pwgen.php:45
getId()
get object id public
global $ilDB
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
+ 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 1260 of file class.ilObjStyleSheet.php.

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

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

1261  {
1263  }
getId()
get object id public
static _createImagesDirectory($a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createImportDirectory()

ilObjStyleSheet::createImportDirectory ( )

Create import directory.

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

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

Referenced by import().

2177  {
2178  $sty_data_dir = ilUtil::getDataDir() . "/sty";
2179  ilUtil::makeDir($sty_data_dir);
2180  if (!is_writable($sty_data_dir)) {
2181  $this->ilias->raiseError("Style data directory (" . $sty_data_dir
2182  . ") not writeable.", $this->ilias->error_obj->FATAL);
2183  }
2184 
2185  $style_dir = $sty_data_dir . "/sty_" . $this->getId();
2186  ilUtil::makeDir($style_dir);
2187  if (!@is_dir($style_dir)) {
2188  $this->ilias->raiseError("Creation of style directory failed (" .
2189  $style_dir . ").", $this->ilias->error_obj->FATAL);
2190  }
2191 
2192  // create import subdirectory
2193  $im_dir = $style_dir . "/import";
2194  ilUtil::makeDir($im_dir);
2195  if (!@is_dir($im_dir)) {
2196  $this->ilias->raiseError("Creation of Import Directory failed (" .
2197  $im_dir . ").", $this->ilias->error_obj->FATAL);
2198  }
2199 
2200  return $im_dir;
2201  }
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getDataDir()
get data directory (outside webspace)
+ 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)

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

613  {
614  $this->ilias->raiseError("Operation ilObjStyleSheet::createReference() not allowed.", $this->ilias->error_obj->FATAL);
615  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ delete()

ilObjStyleSheet::delete ( )

delete style object

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

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

1474  {
1475  $ilDB = $this->db;
1476 
1477  // delete object
1478  parent::delete();
1479 
1480  // check whether this style is global default
1481  $def_style = $this->ilias->getSetting("default_content_style_id");
1482  if ($def_style == $this->getId()) {
1483  $this->ilias->deleteSetting("default_content_style_id");
1484  }
1485 
1486  // check whether this style is global fixed
1487  $fixed_style = $this->ilias->getSetting("fixed_content_style_id");
1488  if ($fixed_style == $this->getId()) {
1489  $this->ilias->deleteSetting("fixed_content_style_id");
1490  }
1491 
1492  // delete style parameter
1493  $q = "DELETE FROM style_parameter WHERE style_id = " .
1494  $ilDB->quote($this->getId(), "integer");
1495  $ilDB->manipulate($q);
1496 
1497  // delete style file
1498  $css_file_name = ilUtil::getWebspaceDir() . "/css/style_" . $this->getId() . ".css";
1499  if (is_file($css_file_name)) {
1500  unlink($css_file_name);
1501  }
1502 
1503  // delete media queries
1504  $ilDB->manipulate(
1505  "DELETE FROM sty_media_query WHERE " .
1506  " style_id = " . $ilDB->quote($this->getId(), "integer")
1507  );
1508 
1509  // delete entries in learning modules
1510  include_once("./Modules/LearningModule/classes/class.ilObjContentObject.php");
1512 
1513  // delete style data record
1514  $q = "DELETE FROM style_data WHERE id = " .
1515  $ilDB->quote($this->getId(), "integer");
1516  $ilDB->manipulate($q);
1517  }
static _deleteStyleAssignments($a_style_id)
delete all style references to style
getId()
get object id public
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilDB
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:

◆ deleteCharacteristic()

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

Delete Characteristic.

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

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

1006  {
1007  $ilDB = $this->db;
1008 
1009  // check, if characteristic is not a core style
1011  if (empty($core_styles[$a_type . "." . $a_tag . "." . $a_class])) {
1012  // delete characteristic record
1013  $st = $ilDB->manipulateF(
1014  "DELETE FROM style_char WHERE style_id = %s AND type = %s AND characteristic = %s",
1015  array("integer", "text", "text"),
1016  array($this->getId(), $a_type, $a_class)
1017  );
1018 
1019  // delete parameter records
1020  $st = $ilDB->manipulateF(
1021  "DELETE FROM style_parameter WHERE style_id = %s AND tag = %s AND type = %s AND class = %s",
1022  array("integer", "text", "text", "text"),
1023  array($this->getId(), $a_tag, $a_type, $a_class)
1024  );
1025  }
1026 
1027  $this->setUpToDate(false);
1028  $this->_writeUpToDate($this->getId(), false);
1029  }
$a_type
Definition: workflow.php:92
getId()
get object id public
static _getCoreStyles()
Get core styles.
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
global $ilDB
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
+ 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 1434 of file class.ilObjStyleSheet.php.

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

1435  {
1436  $ilDB = $this->db;
1437 
1438  $q = "DELETE FROM style_parameter WHERE " .
1439  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1440  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1441  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1442  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1443  " custom = " . $ilDB->quote(1, "integer") . " AND " .
1444  " " . $ilDB->equals("type", $a_type, "text", true);
1445 
1446  $ilDB->manipulate($q);
1447  }
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ deleteImage()

ilObjStyleSheet::deleteImage (   $a_file)

Delete an image.

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

References getImagesDirectory(), and getThumbnailsDirectory().

1377  {
1378  if (is_file($this->getImagesDirectory() . "/" . $a_file)) {
1379  unlink($this->getImagesDirectory() . "/" . $a_file);
1380  }
1381  if (is_file($this->getThumbnailsDirectory() . "/" . $a_file)) {
1382  unlink($this->getThumbnailsDirectory() . "/" . $a_file);
1383  }
1384  }
getThumbnailsDirectory()
Get thumbnails directory.
getImagesDirectory()
Get images directory.
+ 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 3255 of file class.ilObjStyleSheet.php.

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

3256  {
3257  $ilDB = $this->db;
3258 
3259  $ilDB->manipulate(
3260  "DELETE FROM sty_media_query WHERE " .
3261  " style_id = " . $ilDB->quote($this->getId(), "integer") .
3262  " AND id = " . $ilDB->quote($a_id, "integer")
3263  );
3264  $this->saveMediaQueryOrder();
3265  }
global $ilDB
saveMediaQueryOrder($a_order_nr=null)
Save media query order.
+ 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 1391 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

1392  {
1393  $ilDB = $this->db;
1394 
1395  $q = "DELETE FROM style_parameter WHERE id = " .
1396  $ilDB->quote($a_id, "integer");
1397  $ilDB->query($q);
1398  }
global $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 1409 of file class.ilObjStyleSheet.php.

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

1410  {
1411  $ilDB = $this->db;
1412 
1413  $q = "DELETE FROM style_parameter WHERE " .
1414  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1415  " tag = " . $ilDB->quote($a_tag, "text") . " AND " .
1416  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1417  " mq_id = " . $ilDB->quote($a_mq_id, "integer") . " AND " .
1418  " custom = " . $ilDB->quote($a_custom, "integer") . " AND " .
1419  " " . $ilDB->equals("type", $a_type, "text", true) . " AND " .
1420  " parameter = " . $ilDB->quote($a_par, "text");
1421 
1422  $ilDB->manipulate($q);
1423  }
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ 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 1457 of file class.ilObjStyleSheet.php.

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

Referenced by copyCharacteristic().

1458  {
1459  $ilDB = $this->db;
1460 
1461  $q = "DELETE FROM style_parameter WHERE " .
1462  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1463  " class = " . $ilDB->quote($a_class, "text") . " AND " .
1464  " " . $ilDB->equals("type", $a_type, "text", true);
1465 
1466  $ilDB->manipulate($q);
1467  }
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineTemplateStyleClassType()

ilObjStyleSheet::determineTemplateStyleClassType (   $t,
  $k 
)

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

References $t.

2486  {
2487  return self::$templates[$t][$k];
2488  }

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

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

Referenced by do_3_10_Migration().

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

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

Referenced by createFromXMLFile().

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

References ilObject\$db, and $ilDB.

Referenced by do_3_10_Migration().

2815  {
2816  $ilDB = $this->db;
2817 
2818  $classes = array("Example", "Additional", "Citation", "Mnemonic", "Remark");
2819  $pars = array("margin-top", "margin-bottom");
2820 
2821  foreach ($classes as $curr_class) {
2822  foreach ($pars as $curr_par) {
2823  $res2 = $ilDB->queryF(
2824  "SELECT id FROM style_parameter WHERE style_id = %s" .
2825  " AND tag = %s AND class= %s AND parameter = %s",
2826  array("integer", "text", "text", "text"),
2827  array($a_id, "p", $curr_class, $curr_par)
2828  );
2829  if ($row2 = $ilDB->fetchAssoc($res2)) {
2830  $ilDB->manipulateF(
2831  "UPDATE style_parameter SET value= %s WHERE id = %s",
2832  array("text", "integer"),
2833  array("10px", $row2["id"])
2834  );
2835  } else {
2836  $nid = $ilDB->nextId("style_parameter");
2837  $ilDB->manipulateF(
2838  "INSERT INTO style_parameter " .
2839  "(id, style_id, tag, class, parameter,value) VALUES (%s,%s,%s,%s,%s,%s)",
2840  array("integer", "integer", "text", "text", "text", "text"),
2841  array($nid, $a_id, "div", $curr_class, $curr_par, "10px")
2842  );
2843  }
2844  }
2845  }
2846 
2847  $ilDB->manipulateF(
2848  "UPDATE style_parameter SET tag = %s WHERE tag = %s and style_id = %s",
2849  array("text", "text", "integer"),
2850  array("div", "p", $a_id)
2851  );
2852  }
global $ilDB
+ 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 2128 of file class.ilObjStyleSheet.php.

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

2129  {
2130  $this->cleanExportDirectory();
2131  $ex_dir = $this->createExportDirectory();
2132  $this->createExportSubDirectory();
2133  $this->exportXML($ex_dir . "/" . $this->getExportSubDir());
2134  //echo "-".$this->getImagesDirectory()."-".$ex_dir."/".$this->getExportSubDir()."/images"."-";
2135  ilUtil::rCopy(
2136  $this->getImagesDirectory(),
2137  $ex_dir . "/" . $this->getExportSubDir() . "/images"
2138  );
2139  if (is_file($ex_dir . "/" . $this->getExportSubDir() . ".zip")) {
2140  unlink($ex_dir . "/" . $this->getExportSubDir() . ".zip");
2141  }
2142  ilUtil::zip(
2143  $ex_dir . "/" . $this->getExportSubDir(),
2144  $ex_dir . "/" . $this->getExportSubDir() . ".zip"
2145  );
2146 
2147  return $ex_dir . "/" . $this->getExportSubDir() . ".zip";
2148  }
exportXML($a_dir)
export style xml file to directory
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
createExportSubDirectory()
Create export directory.
getImagesDirectory()
Get images directory.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
createExportDirectory()
Create export directory.
getExportSubDir()
The local directory, that will be included within the zip file.
cleanExportDirectory()
Clear export directory.
+ Here is the call graph for this function:

◆ exportXML()

ilObjStyleSheet::exportXML (   $a_dir)

export style xml file to directory

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

References getXML().

Referenced by export().

2154  {
2155  $file = $a_dir . "/style.xml";
2156 
2157  // open file
2158  if (!($fp = @fopen($file, "w"))) {
2159  die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
2160  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
2161  }
2162 
2163  // set file permissions
2164  chmod($file, 0770);
2165 
2166  // write xml data into the file
2167  fwrite($fp, $this->getXML());
2168 
2169  // close file
2170  fclose($fp);
2171  }
getXML()
get xml representation of style object todo: add mq_id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableParameters()

static ilObjStyleSheet::getAvailableParameters ( )
static

Get available parameters.

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

Referenced by addParameter().

2499  {
2500  $pars = array();
2501  foreach (self::$parameter as $p => $v) {
2502  $pars[$p] = $v["values"];
2503  }
2504 
2505  return $pars;
2506  }
+ Here is the caller graph for this function:

◆ getBasicZipPath()

static ilObjStyleSheet::getBasicZipPath ( )
static

Get basic zip path.

Returns
string

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

Referenced by ilObjStyleSheetGUI\saveObject().

579  : string
580  {
581  return self::$basic_style_zip;
582  }
+ Here is the caller graph for this function:

◆ getCharacteristics()

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

Get characteristics.

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

References $a_type, and $c.

1118  {
1119  $chars = array();
1120 
1121  if ($a_type == "") {
1122  $chars = $this->chars;
1123  }
1124  if (is_array($this->chars_by_type[$a_type])) {
1125  foreach ($this->chars_by_type[$a_type] as $c) {
1126  if ($a_include_core || !self::isCoreStyle($a_type, $c)) {
1127  $chars[] = $c;
1128  }
1129  }
1130  }
1131 
1132  if ($a_no_hidden) {
1133  foreach ($chars as $k => $char) {
1134  if ($a_type == "" && $this->hidden_chars[$char["type"] . ":" . $char["class"]]) {
1135  unset($chars[$k]);
1136  } elseif ($this->hidden_chars[$a_type . ":" . $char]) {
1137  unset($chars[$k]);
1138  }
1139  }
1140  }
1141 
1142  return $chars;
1143  }
$a_type
Definition: workflow.php:92

◆ getColorCodeForName()

ilObjStyleSheet::getColorCodeForName (   $a_name)

Remove a color.

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

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

Referenced by writeCSSFile().

2974  {
2975  $ilDB = $this->db;
2976 
2977  $pos = strpos($a_name, "(");
2978  if ($pos > 0) {
2979  $a_i = substr($a_name, $pos + 1);
2980  $a_i = str_replace(")", "", $a_i);
2981  $a_name = substr($a_name, 0, $pos);
2982  }
2983 
2984  $set = $ilDB->query("SELECT color_code FROM style_color WHERE " .
2985  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2986  " color_name = " . $ilDB->quote($a_name, "text"));
2987  if ($rec = $ilDB->fetchAssoc($set)) {
2988  if ($a_i == "") {
2989  return "#" . $rec["color_code"];
2990  } else {
2991  return "#" . ilObjStyleSheet::_getColorFlavor(
2992  $rec["color_code"],
2993  (int) $a_i
2994  );
2995  }
2996  }
2997  }
static _getColorFlavor($a_rgb, $a_i)
Get color flavor.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColors()

ilObjStyleSheet::getColors ( )

Get colors of style.

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

References ilObject\$db, and $ilDB.

Referenced by getXML().

2862  {
2863  $ilDB = $this->db;
2864 
2865  $set = $ilDB->query("SELECT * FROM style_color WHERE " .
2866  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
2867  "ORDER BY color_name");
2868 
2869  $colors = array();
2870  while ($rec = $ilDB->fetchAssoc($set)) {
2871  $colors[] = array(
2872  "name" => $rec["color_name"],
2873  "code" => $rec["color_code"]
2874  );
2875  }
2876 
2877  return $colors;
2878  }
global $ilDB
+ Here is the caller graph for this function:

◆ getContentPrintStyle()

static ilObjStyleSheet::getContentPrintStyle ( )
static

get content print style

static

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

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

1842  {
1843  return "./Services/COPage/css/print_content.css";
1844  }
+ Here is the caller graph for this function:

◆ getContentStylePath()

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

get content style path

static (to avoid full reading)

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

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

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

1796  {
1797  global $DIC;
1798 
1799  $ilSetting = $DIC->settings();
1800 
1801  $random = new \ilRandom();
1802  $rand = $random->int(1, 999999);
1803 
1804 
1805  // check global fixed content style
1806  $fixed_style = $ilSetting->get("fixed_content_style_id");
1807  if ($fixed_style > 0) {
1808  $a_style_id = $fixed_style;
1809  }
1810 
1811  // check global default style
1812  if ($a_style_id <= 0) {
1813  $a_style_id = $ilSetting->get("default_content_style_id");
1814  }
1815 
1816  if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
1817  // check whether file is up to date
1818  if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
1819  $style = new ilObjStyleSheet($a_style_id);
1820  $style->writeCSSFile();
1821  }
1822 
1823  $path = ilUtil::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css";
1824  if ($add_random) {
1825  $path .= "?dummy=$rand";
1826  }
1827  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
1829 
1830  return $path;
1831  } else { // todo: work this out
1832  return "./Services/COPage/css/content.css";
1833  }
1834  }
$path
Definition: aliased.php:25
global $DIC
Definition: saml.php:7
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static _lookupUpToDate($a_id)
Looup up to date.
static signFile($path_to_file)
global $ilSetting
Definition: privfeed.php:17
Class ilObjStyleSheet.
static getWebspaceDir($mode="filesystem")
get webspace directory
+ 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 1752 of file class.ilObjStyleSheet.php.

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

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

1753  {
1754  global $DIC;
1755 
1756  $ilSetting = $DIC->settings();
1757 
1758  // check global fixed content style
1759  $fixed_style = $ilSetting->get("fixed_content_style_id");
1760  if ($fixed_style > 0) {
1761  $a_style_id = $fixed_style;
1762  }
1763 
1764  // check global default style
1765  if ($a_style_id <= 0) {
1766  $a_style_id = $ilSetting->get("default_content_style_id");
1767  }
1768 
1769  if ($a_style_id > 0 && ilObject::_lookupType($a_style_id) == "sty") {
1770  return $a_style_id;
1771  }
1772 
1773  return 0;
1774  }
global $DIC
Definition: saml.php:7
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilSetting
Definition: privfeed.php:17
+ 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 2114 of file class.ilObjStyleSheet.php.

References ilObject\getId().

Referenced by createExportSubDirectory(), and export().

2115  {
2116  if ($this->export_sub_dir == "") {
2117  return "sty_" . $this->getId();
2118  } else {
2119  return $this->export_sub_dir;
2120  }
2121  }
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHideStatus()

ilObjStyleSheet::getHideStatus (   $a_type,
  $a_char 
)

Get characteristic hide status.

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

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

1174  {
1175  $ilDB = $this->db;
1176 
1177  $set = $ilDB->query(
1178  "SELECT hide FROM style_char " .
1179  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1180  " type = " . $ilDB->quote($a_type, "text") . " AND " .
1181  " characteristic = " . $ilDB->quote($a_char, "text")
1182  );
1183  $rec = $ilDB->fetchAssoc($set);
1184 
1185  return $rec["hide"];
1186  }
$a_type
Definition: workflow.php:92
global $ilDB

◆ getImages()

ilObjStyleSheet::getImages ( )

Get images of style.

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

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

1336  {
1337  $dir = $this->getImagesDirectory();
1338  $images = array();
1339  if (is_dir($dir)) {
1340  $entries = ilUtil::getDir($dir);
1341  foreach ($entries as $entry) {
1342  if (substr($entry["entry"], 0, 1) == ".") {
1343  continue;
1344  }
1345  if ($entry["type"] != "dir") {
1346  $images[] = $entry;
1347  }
1348  }
1349  }
1350 
1351  return $images;
1352  }
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
getImagesDirectory()
Get images directory.
+ Here is the call graph for this function:

◆ getImagesDirectory()

ilObjStyleSheet::getImagesDirectory ( )

Get images directory.

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

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

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

1310  {
1312  }
getId()
get object id public
static _getImagesDirectory($a_style_id)
Get images directory.
+ 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 3203 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by addMediaQuery().

3204  {
3205  $ilDB = $this->db;
3206 
3207  $set = $ilDB->query(
3208  "SELECT max(order_nr) mnr FROM sty_media_query " .
3209  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer")
3210  );
3211  $rec = $ilDB->fetchAssoc($set);
3212 
3213  return (int) $rec["mnr"];
3214  }
global $ilDB
+ Here is the caller graph for this function:

◆ getMediaQueries()

ilObjStyleSheet::getMediaQueries ( )

Get colors of style.

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

References ilObject\$db, and $ilDB.

Referenced by saveMediaQueryOrder(), and writeCSSFile().

3160  {
3161  $ilDB = $this->db;
3162 
3163  $set = $ilDB->query("SELECT * FROM sty_media_query WHERE " .
3164  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
3165  "ORDER BY order_nr");
3166 
3167  $mq = array();
3168  while ($rec = $ilDB->fetchAssoc($set)) {
3169  $mq[] = $rec;
3170  }
3171 
3172  return $mq;
3173  }
global $ilDB
+ Here is the caller graph for this function:

◆ getMediaQueryForId()

ilObjStyleSheet::getMediaQueryForId (   $a_id)

Get media query for id.

Parameters

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

References ilObject\$db, and $ilDB.

3240  {
3241  $ilDB = $this->db;
3242 
3243  $set = $ilDB->query(
3244  "SELECT * FROM sty_media_query " .
3245  " WHERE id = " . $ilDB->quote($a_id, "integer")
3246  );
3247  return $ilDB->fetchAssoc($set);
3248  }
global $ilDB

◆ getMetaData()

& ilObjStyleSheet::getMetaData ( )

get meta data object

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

877  {
878  return $this->meta_data;
879  }

◆ getParametersOfClass()

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

Get parameters of class.

Parameters

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

References $a_type.

1783  {
1784  if (is_array($this->style_class[$a_type][$a_class][$a_mq_id])) {
1785  return $this->style_class[$a_type][$a_class][$a_mq_id];
1786  }
1787  return array();
1788  }
$a_type
Definition: workflow.php:92

◆ getPlaceHolderStylePath()

static ilObjStyleSheet::getPlaceHolderStylePath ( )
static

get placeholder style path (for Page Layouts)

static

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

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

1862  {
1863  return "./Services/COPage/css/placeholder.css";
1864  }
+ Here is the caller graph for this function:

◆ getRefId()

ilObjStyleSheet::getRefId ( )

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

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

596  {
597  return "";
598  //$this->ilias->raiseError("Operation ilObjStyleSheet::getRefId() not allowed.",$this->ilias->error_obj->FATAL);
599  }

◆ getScope()

ilObjStyleSheet::getScope ( )

Get scope.

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

Referenced by create(), and update().

645  {
646  return $this->scope;
647  }
+ 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 1958 of file class.ilObjStyleSheet.php.

References $style.

Referenced by writeCSSFile().

1959  {
1960  return $this->style;
1961  }
+ Here is the caller graph for this function:

◆ getStyleParameterGroups()

ilObjStyleSheet::getStyleParameterGroups ( )

Get grouped parameter.

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

References $parameter.

2348  {
2349  $groups = array();
2350 
2351  foreach (self::$parameter as $parameter => $props) {
2352  $groups[$props["group"]][] = $parameter;
2353  }
2354  return $groups;
2355  }

◆ getSyntaxStylePath()

static ilObjStyleSheet::getSyntaxStylePath ( )
static

get syntax style path

static

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

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

1852  {
1853  return "./Services/COPage/css/syntaxhighlight.css";
1854  }
+ Here is the caller graph for this function:

◆ getTemplate()

ilObjStyleSheet::getTemplate (   $a_t_id)

Get template.

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

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

3438  {
3439  $ilDB = $this->db;
3440 
3441  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3442  "style_id = " . $ilDB->quote($this->getId(), "integer") . " " .
3443  " AND id = " . $ilDB->quote($a_t_id, "integer"));
3444 
3445  if ($rec = $ilDB->fetchAssoc($set)) {
3446  $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3447 
3448  $template = $rec;
3449  return $template;
3450  }
3451  return array();
3452  }
$template
getTemplateClasses($a_tid)
Get template classes.
global $ilDB
+ Here is the call graph for this function:

◆ getTemplateClasses()

ilObjStyleSheet::getTemplateClasses (   $a_tid)

Get template classes.

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

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

Referenced by getTemplate(), and getTemplates().

3324  {
3325  $ilDB = $this->db;
3326  $set = $ilDB->query("SELECT * FROM style_template_class WHERE " .
3327  "template_id = " . $ilDB->quote($a_tid, "integer"));
3328 
3329  $class = array();
3330  while ($rec = $ilDB->fetchAssoc($set)) {
3331  $key = $rec["class_type"];
3332  $class[$key] = $rec["class"];
3333  }
3334 
3335  return $class;
3336  }
global $ilDB
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ getTemplates()

ilObjStyleSheet::getTemplates (   $a_type)

Get table templates of style.

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

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

Referenced by getTemplateXML(), and getXML().

3303  {
3304  $ilDB = $this->db;
3305 
3306  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3307  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3308  "temp_type = " . $ilDB->quote($a_type, "text") . " " .
3309  "ORDER BY name");
3310 
3311  $templates = array();
3312  while ($rec = $ilDB->fetchAssoc($set)) {
3313  $rec["classes"] = $this->getTemplateClasses($rec["id"]);
3314  $templates[] = $rec;
3315  }
3316 
3317  return $templates;
3318  }
$a_type
Definition: workflow.php:92
getTemplateClasses($a_tid)
Get template classes.
global $ilDB
+ 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 3484 of file class.ilObjStyleSheet.php.

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

3485  {
3486  $ilDB = $this->db;
3487 
3488  $tag = "<StyleTemplates>";
3489 
3490  $ttypes = array("table", "vaccordion", "haccordion", "carousel");
3491 
3492  foreach ($ttypes as $ttype) {
3493  $ts = $this->getTemplates($ttype);
3494 
3495  foreach ($ts as $t) {
3497  /*$atts = array("table" => "TableClass",
3498  "caption" => "CaptionClass",
3499  "row_head" => "RowHeadClass",
3500  "row_foot" => "RowFootClass",
3501  "col_head" => "ColHeadClass",
3502  "col_foot" => "ColFootClass",
3503  "odd_row" => "OddRowClass",
3504  "even_row" => "EvenRowClass",
3505  "odd_col" => "OddColClass",
3506  "even_col" => "EvenColClass");*/
3507  $c = $t["classes"];
3508 
3509  $tag .= '<StyleTemplate Name="' . $t["name"] . '">';
3510 
3511  foreach ($atts as $type => $t) {
3512  if ($c[$type] != "") {
3513  $tag .= '<StyleClass Type="' . $type . '" Value="' . $c[$type] . '" />';
3514  }
3515  }
3516 
3517  $tag .= "</StyleTemplate>";
3518  }
3519  }
3520 
3521  $tag .= "</StyleTemplates>";
3522 
3523  //echo htmlentities($tag);
3524  return $tag;
3525  }
static _getTemplateClassTypes($a_template_type="")
Get template class types.
getTemplates($a_type)
Get table templates of style.
global $ilDB
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
+ Here is the call graph for this function:

◆ getThumbnailsDirectory()

ilObjStyleSheet::getThumbnailsDirectory ( )

Get thumbnails directory.

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

References getImagesDirectory().

Referenced by deleteImage(), and uploadImage().

1327  {
1328  return $this->getImagesDirectory() .
1329  "/thumbnails";
1330  }
getImagesDirectory()
Get images directory.
+ 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 628 of file class.ilObjStyleSheet.php.

629  {
630  return $this->up_to_date;
631  }

◆ getXML()

ilObjStyleSheet::getXML ( )

get xml representation of style object todo: add mq_id

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

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

Referenced by exportXML().

1988  {
1989  $xml .= "<StyleSheet>\n";
1990 
1991  // title and description
1992  $xml .= "<Title>" . $this->handleXmlString($this->getTitle()) . "</Title>";
1993  $xml .= "<Description>" . $this->handleXmlString($this->getDescription()) . "</Description>\n";
1994 
1995  // style classes
1996  foreach ($this->chars as $char) {
1997  $xml .= "<Style Tag=\"" . ilObjStyleSheet::_determineTag($char["type"]) .
1998  "\" Type=\"" . $char["type"] . "\" Class=\"" . $char["class"] . "\">\n";
1999  foreach ($this->style as $style) {
2000  if ($style[0]["type"] == $char["type"] && $style[0]["class"] == $char["class"]) {
2001  foreach ($style as $tag) {
2002  $xml .= "<StyleParameter Name=\"" . $tag["parameter"] . "\" Value=\"" . $tag["value"] . "\" Custom=\"" . $tag["custom"] . "\" />\n";
2003  }
2004  }
2005  }
2006  $xml .= "</Style>\n";
2007  }
2008 
2009  // colors
2010  foreach ($this->getColors() as $color) {
2011  $xml .= "<StyleColor Name=\"" . $color["name"] . "\" Code=\"" . $color["code"] . "\"/>\n";
2012  }
2013 
2014  // templates
2016  foreach ($tcts as $tct => $v) {
2017  $ts = $this->getTemplates($tct);
2018 
2019  foreach ($ts as $t) {
2020  $xml .= "<StyleTemplate Type=\"" . $tct . "\" Name=\"" . $t["name"] . "\">\n";
2021  foreach ($t["classes"] as $ct => $c) {
2022  if ($c != "") {
2023  $xml .= "<StyleTemplateClass ClassType=\"" . $ct . "\" Class=\"" . $c . "\"/>\n";
2024  }
2025  }
2026  $xml .= "</StyleTemplate>\n";
2027  }
2028  }
2029 
2030 
2031  $xml .= "</StyleSheet>";
2032  //echo "<pre>".htmlentities($xml)."</pre>"; exit;
2033  return $xml;
2034  }
static _getTemplateClassTypes($a_template_type="")
Get template class types.
getColors()
Get colors of style.
static _determineTag($a_type)
"color:#CC0000 style
Definition: example_001.php:92
handleXmlString($a_str)
Handle xml strin.
getTitle()
get object title public
getDescription()
get object description
getTemplates($a_type)
Get table templates of style.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
+ 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

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

Referenced by getXML().

1979  {
1980  return str_replace("&", "&amp;", $a_str);
1981  }
+ Here is the caller graph for this function:

◆ ilClone()

ilObjStyleSheet::ilClone ( )

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

public

Returns
integer new obj id

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

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

1195  {
1196  $lng = $this->lng;
1197 
1198  $lng->loadLanguageModule("style");
1199 
1200  $new_obj = new ilObjStyleSheet();
1201  $new_obj->setTitle($this->getTitle() . " (" . $lng->txt("sty_acopy") . ")");
1202  $new_obj->setType($this->getType());
1203  $new_obj->setDescription($this->getDescription());
1204  $new_obj->create($this->getId());
1205 
1206  $new_obj->writeStyleSetting(
1207  "disable_auto_margins",
1208  $this->lookupStyleSetting("disable_auto_margins")
1209  );
1210 
1211  return $new_obj->getId();
1212  }
lookupStyleSetting($a_name)
Lookup style setting.
getId()
get object id public
getTitle()
get object title public
getDescription()
get object description
getType()
get object type public
Class ilObjStyleSheet.
+ Here is the call graph for this function:

◆ import()

ilObjStyleSheet::import (   $a_file)

Import.

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

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

2207  {
2208  parent::create();
2209 
2210  $im_dir = $this->createImportDirectory();
2211 
2212  // handle uploaded files
2213  if (is_array($a_file)) {
2214  ilUtil::moveUploadedFile(
2215  $a_file["tmp_name"],
2216  $a_file["name"],
2217  $im_dir . "/" . $a_file["name"]
2218  );
2219  $file_name = $a_file["name"];
2220  } else { // handle not directly uploaded files
2221  $pi = pathinfo($a_file);
2222  $file_name = $pi["basename"];
2223  copy($a_file, $im_dir . "/" . $file_name);
2224  }
2225  $file = pathinfo($file_name);
2226 
2227  // unzip file
2228  if (strtolower($file["extension"] == "zip")) {
2229  ilUtil::unzip($im_dir . "/" . $file_name);
2230  $subdir = basename($file["basename"], "." . $file["extension"]);
2231  if (!is_dir($im_dir . "/" . $subdir)) {
2232  $subdir = "style"; // check style subdir
2233  }
2234  $xml_file = $im_dir . "/" . $subdir . "/style.xml";
2235  } else { // handle xml file directly (old style)
2236  $xml_file = $im_dir . "/" . $file_name;
2237  }
2238 
2239  // load information from xml file
2240  //echo "-$xml_file-";
2241  $this->createFromXMLFile($xml_file, true);
2242 
2243  // copy images
2244  $this->createImagesDirectory();
2245  if (is_dir($im_dir . "/" . $subdir . "/images")) {
2246  ilUtil::rCopy(
2247  $im_dir . "/" . $subdir . "/images",
2248  $this->getImagesDirectory()
2249  );
2250  }
2251 
2253  $this->read();
2254  $this->writeCSSFile();
2255  }
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
read()
read style properties
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
getImagesDirectory()
Get images directory.
getId()
get object id public
static _addMissingStyleClassesToStyle($a_id)
Add missing style classes to all styles.
createImportDirectory()
Create import directory.
createFromXMLFile($a_file, $a_skip_parent_create=false)
create style from xml file todo: add mq_id and custom
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
+ Here is the call graph for this function:

◆ isCoreStyle()

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

Is core style.

Parameters

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

References $a_type, and $s.

2457  {
2458  foreach (self::$core_styles as $s) {
2459  if ($s["type"] == $a_type && $s["class"] == $a_class) {
2460  return true;
2461  }
2462  }
2463  return false;
2464  }
$s
Definition: pwgen.php:45
$a_type
Definition: workflow.php:92

◆ lookupObjectForStyle()

static ilObjStyleSheet::lookupObjectForStyle (   $a_style_id)
static

Lookup object style.

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

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

3681  {
3682  global $DIC;
3683 
3684  $ilDB = $DIC->database();
3685 
3686  $obj_ids = array();
3687  if (ilObject::_lookupType($a_style_id) == "sty") {
3688  $set = $ilDB->query(
3689  "SELECT DISTINCT obj_id FROM style_usage " .
3690  " WHERE style_id = " . $ilDB->quote($a_style_id, "integer")
3691  );
3692 
3693  while ($rec = $ilDB->fetchAssoc($set)) {
3694  $obj_ids[] = $rec["obj_id"];
3695  }
3696  }
3697  return $obj_ids;
3698  }
global $DIC
Definition: saml.php:7
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ Here is the call graph for this function:

◆ lookupObjectStyle()

static ilObjStyleSheet::lookupObjectStyle (   $a_obj_id)
static

Lookup object style.

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

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

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

3659  {
3660  global $DIC;
3661 
3662  $ilDB = $DIC->database();
3663 
3664  $set = $ilDB->query(
3665  "SELECT style_id FROM style_usage " .
3666  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer")
3667  );
3668  $rec = $ilDB->fetchAssoc($set);
3669 
3670  if (ilObject::_lookupType($rec["style_id"]) == "sty") {
3671  return (int) $rec["style_id"];
3672  }
3673 
3674  return 0;
3675  }
global $DIC
Definition: saml.php:7
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ 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 3623 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

Referenced by ilClone().

3624  {
3625  $ilDB = $this->db;
3626 
3627  $set = $ilDB->query(
3628  "SELECT value FROM style_setting " .
3629  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
3630  " AND name = " . $ilDB->quote($a_name, "text")
3631  );
3632  $rec = $ilDB->fetchAssoc($set);
3633 
3634  return $rec["value"];
3635  }
global $ilDB
+ Here is the caller graph for this function:

◆ lookupTemplateName()

ilObjStyleSheet::lookupTemplateName (   $a_t_id)

Lookup table template name for template ID.

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

3458  {
3459  return self::_lookupTemplateName($a_t_id);
3460  }

◆ lookupTemplatePreview()

ilObjStyleSheet::lookupTemplatePreview (   $a_t_id)

Lookup table template preview.

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

References ilObject\$db, and $ilDB.

3551  {
3552  $ilDB = $this->db;
3553 
3554  $set = $ilDB->query("SELECT preview FROM style_template " .
3555  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3556  if ($rec = $ilDB->fetchAssoc($set)) {
3557  return $rec["preview"];
3558  }
3559 
3560  return "";
3561  }
global $ilDB

◆ putInTree()

ilObjStyleSheet::putInTree (   $a_parent_ref)

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

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

605  {
606  $this->ilias->raiseError("Operation ilObjStyleSheet::putInTree() not allowed.", $this->ilias->error_obj->FATAL);
607  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ read()

ilObjStyleSheet::read ( )

read style properties

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

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

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

1524  {
1525  $ilDB = $this->db;
1526 
1527  parent::read();
1528 
1529  $q = "SELECT * FROM style_parameter WHERE style_id = " .
1530  $ilDB->quote($this->getId(), "integer") . " ORDER BY tag, class, type, mq_id ";
1531  $style_set = $ilDB->query($q);
1532  $ctag = "";
1533  $cclass = "";
1534  $ctype = "";
1535  $cmq_id = 0;
1536  $this->style = array();
1537  // workaround for bug #17586, see also http://stackoverflow.com/questions/3066356/multiple-css-classes-properties-overlapping-based-on-the-order-defined
1538  // e.g. ha_iheada must be written after ha_ihead, since they are acting on the same dom node
1539  // styles that must be added at the end
1540  $this->end_styles = array();
1541  while ($style_rec = $ilDB->fetchAssoc($style_set)) {
1542  if ($style_rec["tag"] != $ctag || $style_rec["class"] != $cclass
1543  || $style_rec["type"] != $ctype || $style_rec["mq_id"] != $cmq_id) {
1544  // add current tag array to style array
1545  if (is_array($tag)) {
1546  if (in_array($ctype, array("ha_iheada", "va_iheada"))) {
1547  $this->end_styles[] = $tag;
1548  } else {
1549  $this->style[] = $tag;
1550  }
1551  }
1552  $tag = array();
1553  }
1554  $ctag = $style_rec["tag"];
1555  $cclass = $style_rec["class"];
1556  $ctype = $style_rec["type"];
1557  $cmq_id = $style_rec["mq_id"];
1558  $tag[] = $style_rec;
1559  // added $cmq_id
1560  $this->style_class[$ctype][$cclass][$cmq_id][$style_rec["parameter"]] = $style_rec["value"];
1561  }
1562  if (is_array($tag)) {
1563  $this->style[] = $tag;
1564  }
1565  foreach ($this->end_styles as $s) {
1566  $this->style[] = $s;
1567  }
1568  //var_dump($this->style_class);
1569  $q = "SELECT * FROM style_data WHERE id = " .
1570  $ilDB->quote($this->getId(), "integer");
1571  $res = $ilDB->query($q);
1572  $sty = $ilDB->fetchAssoc($res);
1573  $this->setUpToDate((boolean) $sty["uptodate"]);
1574  $this->setScope($sty["category"]);
1575 
1576  // get style characteristics records
1577  $this->chars = array();
1578  $this->chars_by_type = array();
1579  $q = "SELECT * FROM style_char WHERE style_id = " .
1580  $ilDB->quote($this->getId(), "integer") .
1581  " ORDER BY type ASC, characteristic ASC";
1582  $par_set = $ilDB->query($q);
1583  while ($par_rec = $ilDB->fetchAssoc($par_set)) {
1584  $this->chars[] = array("type" => $par_rec["type"], "class" => $par_rec["characteristic"], "hide" => $par_rec["hide"]);
1585  $this->chars_by_type[$par_rec["type"]][] = $par_rec["characteristic"];
1586  if ($par_rec["hide"]) {
1587  $this->hidden_chars[$par_rec["type"] . ":" . $par_rec["characteristic"]] = true;
1588  }
1589  }
1590  // var_dump($this->style); exit;
1591  }
setScope($a_scope)
Set scope.
"color:#CC0000 style
Definition: example_001.php:92
$s
Definition: pwgen.php:45
foreach($_POST as $key=> $value) $res
getId()
get object id public
setUpToDate($a_up_to_date=true)
Set style up to date (false + update will trigger css generation next time)
global $ilDB
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
+ 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 2945 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

2946  {
2947  $ilDB = $this->db;
2948 
2949  $ilDB->manipulate("DELETE FROM style_color WHERE " .
2950  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
2951  " color_name = " . $ilDB->quote($a_name, "text"));
2952  }
global $ilDB

◆ removeTemplate()

ilObjStyleSheet::removeTemplate (   $a_t_id)

Remove table template.

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

References ilObject\$db, and $ilDB.

3586  {
3587  $ilDB = $this->db;
3588 
3589  $ilDB->manipulate("DELETE FROM style_template WHERE " .
3590  " style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3591  " id = " . $ilDB->quote($a_t_id, "integer"));
3592 
3593  $ilDB->manipulate(
3594  "DELETE FROM style_template_class WHERE " .
3595  "template_id = " . $ilDB->quote($a_t_id, "integer")
3596  );
3597  }
global $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 1901 of file class.ilObjStyleSheet.php.

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

Referenced by copyCharacteristic(), and updateColor().

1902  {
1903  ilObjStyleSheet::_replaceStylePar($this->getId(), $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id, $a_custom);
1904  }
$a_type
Definition: workflow.php:92
getId()
get object id public
static _replaceStylePar($style_id, $a_tag, $a_class, $a_par, $a_val, $a_type, $a_mq_id=0, $a_custom=false)
+ 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 1157 of file class.ilObjStyleSheet.php.

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

1158  {
1159  $ilDB = $this->db;
1160 
1161  $ilDB->manipulate(
1162  "UPDATE style_char SET " .
1163  " hide = " . $ilDB->quote((int) $a_hide, "integer") .
1164  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
1165  " type = " . $ilDB->quote($a_type, "text") . " AND " .
1166  " characteristic = " . $ilDB->quote($a_char, "text")
1167  );
1168  }
$a_type
Definition: workflow.php:92
getId()
get object id public
global $ilDB
+ Here is the call graph for this function:

◆ saveMediaQueryOrder()

ilObjStyleSheet::saveMediaQueryOrder (   $a_order_nr = null)

Save media query order.

Parameters
int$a_order_nrorder nr

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

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

Referenced by deleteMediaQuery().

3273  {
3274  $ilDB = $this->db;
3275 
3276  $mqueries = $this->getMediaQueries();
3277  if (is_array($a_order_nr)) {
3278  foreach ($mqueries as $k => $mq) {
3279  $mqueries[$k]["order_nr"] = $a_order_nr[$mq["id"]];
3280  }
3281  $mqueries = ilUtil::sortArray($mqueries, "order_nr", "", true);
3282  }
3283  $cnt = 10;
3284  foreach ($mqueries as $mq) {
3285  $ilDB->manipulate(
3286  "UPDATE sty_media_query SET " .
3287  " order_nr = " . $ilDB->quote($cnt, "integer") .
3288  " WHERE id = " . $ilDB->quote($mq["id"], "integer")
3289  );
3290  $cnt += 10;
3291  }
3292  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $ilDB
getMediaQueries()
Get colors of style.
+ 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 1148 of file class.ilObjStyleSheet.php.

1149  {
1150  $this->chars = $a_chars;
1151  // $this->chars_by_type[$a_type];
1152  }

◆ setExportSubDir()

ilObjStyleSheet::setExportSubDir (   $a_dir)

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

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

Referenced by ilContObjectExport\buildExportFileXML().

2107  {
2108  $this->export_sub_dir = $a_dir;
2109  }
+ Here is the caller graph for this function:

◆ setRefId()

ilObjStyleSheet::setRefId (   $a_ref_id)

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

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

588  {
589  $this->ilias->raiseError("Operation ilObjStyleSheet::setRefId() not allowed.", $this->ilias->error_obj->FATAL);
590  }
redirection script todo: (a better solution should control the processing via a xml file) ...

◆ setScope()

ilObjStyleSheet::setScope (   $a_scope)

Set scope.

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

Referenced by read().

637  {
638  $this->scope = $a_scope;
639  }
+ Here is the caller graph for this function:

◆ setStyle()

ilObjStyleSheet::setStyle (   $a_style)

set styles

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

1967  {
1968  $this->style = $a_style;
1969  }
"color:#CC0000 style
Definition: example_001.php:92

◆ setUpToDate()

ilObjStyleSheet::setUpToDate (   $a_up_to_date = true)

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

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

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

621  {
622  $this->up_to_date = $a_up_to_date;
623  }
+ Here is the caller graph for this function:

◆ templateExists()

ilObjStyleSheet::templateExists (   $a_template_name)

Check whether template exists.

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

References ilObject\$db, and $ilDB.

3422  {
3423  $ilDB = $this->db;
3424 
3425  $set = $ilDB->query("SELECT * FROM style_template WHERE " .
3426  "style_id = " . $ilDB->quote($this->getId(), "integer") . " AND " .
3427  "name = " . $ilDB->quote($a_template_name, "text"));
3428  if ($rec = $ilDB->fetchAssoc($set)) {
3429  return true;
3430  }
3431  return false;
3432  }
global $ilDB

◆ update()

ilObjStyleSheet::update ( )

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

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

Referenced by createFromXMLFile().

1867  {
1868  $ilDB = $this->db;
1869 
1870  parent::update();
1871  $this->read(); // this could be done better
1872  $this->writeCSSFile();
1873 
1874  $q = "UPDATE style_data " .
1875  "SET category = " . $ilDB->quote((int) $this->getScope(), "integer") .
1876  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
1877  $ilDB->manipulate($q);
1878  }
read()
read style properties
writeCSSFile($a_target_file="", $a_image_dir="")
write css file to webspace directory
getId()
get object id public
update($pash, $contents, Config $config)
global $ilDB
+ 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 2898 of file class.ilObjStyleSheet.php.

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

2899  {
2900  $ilDB = $this->db;
2901 
2902  // todo: update names in parameters as well
2903 
2904  $ilDB->manipulate("UPDATE style_color SET " .
2905  "color_name = " . $ilDB->quote($a_new_name, "text") . ", " .
2906  "color_code = " . $ilDB->quote($a_code, "text") .
2907  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
2908  " AND color_name = " . $ilDB->quote($a_name, "text"));
2909  ilObjStyleSheet::_writeUpToDate($this->getId(), false);
2910 
2911  // rename also the name in the style parameter values
2912  if ($a_name != $a_new_name) {
2913  $set = $ilDB->query("SELECT * FROM style_parameter " .
2914  " WHERE style_id = " . $ilDB->quote($this->getId(), "integer") .
2915  " AND (" .
2916  " parameter = " . $ilDB->quote("background-color", "text") . " OR " .
2917  " parameter = " . $ilDB->quote("color", "text") . " OR " .
2918  " parameter = " . $ilDB->quote("border-color", "text") . " OR " .
2919  " parameter = " . $ilDB->quote("border-top-color", "text") . " OR " .
2920  " parameter = " . $ilDB->quote("border-bottom-color", "text") . " OR " .
2921  " parameter = " . $ilDB->quote("border-left-color", "text") . " OR " .
2922  " parameter = " . $ilDB->quote("border-right-color", "text") .
2923  ")");
2924  while ($rec = $ilDB->fetchAssoc($set)) {
2925  if ($rec["value"] == "!" . $a_name ||
2926  is_int(strpos($rec["value"], "!" . $a_name . "("))) {
2927  // parameter is based on color -> rename it
2928  $this->replaceStylePar(
2929  $rec["tag"],
2930  $rec["class"],
2931  $rec["parameter"],
2932  str_replace($a_name, $a_new_name, $rec["value"]),
2933  $rec["type"],
2934  $rec["mq_id"],
2935  $rec["custom"]
2936  );
2937  }
2938  }
2939  }
2940  }
getId()
get object id 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.
global $ilDB
static _writeUpToDate($a_id, $a_up_to_date)
Write up to date.
+ 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 3222 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

3223  {
3224  $ilDB = $this->db;
3225 
3226  $ilDB->manipulate(
3227  "UPDATE sty_media_query SET " .
3228  " mquery = " . $ilDB->quote($a_mquery, "text") .
3229  " WHERE id = " . $ilDB->quote($a_id, "integer")
3230  );
3231  }
global $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 1886 of file class.ilObjStyleSheet.php.

References ilObject\$db, and $ilDB.

1887  {
1888  $ilDB = $this->db;
1889 
1890  $q = "UPDATE style_parameter SET VALUE = " .
1891  $ilDB->quote($a_value, "text") . " WHERE id = " .
1892  $ilDB->quote($a_id, "integer");
1893  $style_set = $ilDB->manipulate($q);
1894  }
global $ilDB

◆ updateTemplate()

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

Update table template.

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

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

3379  {
3380  $ilDB = $this->db;
3381 
3382  $ilDB->manipulate("UPDATE style_template SET " .
3383  "name = " . $ilDB->quote($a_name, "text") .
3384  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3385 
3386  $ilDB->manipulate(
3387  "DELETE FROM style_template_class WHERE " .
3388  "template_id = " . $ilDB->quote($a_t_id, "integer")
3389  );
3390  foreach ($a_classes as $t => $c) {
3391  $ilDB->manipulate($q = "INSERT INTO style_template_class " .
3392  "(template_id, class_type, class)" .
3393  " VALUES (" .
3394  $ilDB->quote($a_t_id, "integer") . "," .
3395  $ilDB->quote($t, "text") . "," .
3396  $ilDB->quote($c, "text") .
3397  ")");
3398  }
3399  }
global $ilDB

◆ uploadImage()

ilObjStyleSheet::uploadImage (   $a_file)

Upload image.

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

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

1358  {
1359  $this->createImagesDirectory();
1360  @ilUtil::moveUploadedFile(
1361  $a_file["tmp_name"],
1362  $a_file["name"],
1363  $this->getImagesDirectory() . "/" . $a_file["name"]
1364  );
1366  $this->getImagesDirectory() . "/" . $a_file["name"],
1367  $this->getThumbnailsDirectory() . "/" . $a_file["name"],
1368  75,
1369  75
1370  );
1371  }
getThumbnailsDirectory()
Get thumbnails directory.
getImagesDirectory()
Get images directory.
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
createImagesDirectory()
Create images directory <data_dir>/sty/sty_<id>/images.
+ 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 1596 of file class.ilObjStyleSheet.php.

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

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

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

References ilObject\$db, and $ilDB.

3603  {
3604  $ilDB = $this->db;
3605 
3606  $ilDB->manipulate(
3607  "DELETE FROM style_setting WHERE " .
3608  " style_id = " . $ilDB->quote($this->getId(), "integer") .
3609  " AND name = " . $ilDB->quote($a_name, "text")
3610  );
3611 
3612  $ilDB->manipulate("INSERT INTO style_setting " .
3613  "(style_id, name, value) VALUES (" .
3614  $ilDB->quote($this->getId(), "integer") . "," .
3615  $ilDB->quote($a_name, "text") . "," .
3616  $ilDB->quote($a_value, "text") .
3617  ")");
3618  }
global $ilDB

◆ writeStyleUsage()

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

Write style usage.

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

References $DIC, and $ilDB.

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

3641  {
3642  global $DIC;
3643 
3644  $ilDB = $DIC->database();
3645 
3646  $ilDB->replace(
3647  "style_usage",
3648  array(
3649  "obj_id" => array("integer", (int) $a_obj_id)),
3650  array(
3651  "style_id" => array("integer", (int) $a_style_id))
3652  );
3653  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ writeTemplatePreview()

ilObjStyleSheet::writeTemplatePreview (   $a_t_id,
  $a_preview_html 
)

Write table template preview.

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

References ilObject\$db, and $ilDB.

Referenced by addTemplate().

3531  {
3532  $ilDB = $this->db;
3533  $a_preview_html = str_replace(' width=""', "", $a_preview_html);
3534  $a_preview_html = str_replace(' valign="top"', "", $a_preview_html);
3535  $a_preview_html = str_replace('<div class="ilc_text_block_TableContent">', "<div>", $a_preview_html);
3536  //echo "1-".strlen($a_preview_html)."-";
3537  //echo htmlentities($a_preview_html);
3538  if (strlen($a_preview_html) > 4000) {
3539  //echo "2";
3540  $a_preview_html = "";
3541  }
3542  $ilDB->manipulate("UPDATE style_template SET " .
3543  "preview = " . $ilDB->quote($a_preview_html, "text") .
3544  " WHERE id = " . $ilDB->quote($a_t_id, "integer"));
3545  }
global $ilDB
+ 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 551 of file class.ilObjStyleSheet.php.

◆ $basic_style_file

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

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

◆ $basic_style_image_dir

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

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

◆ $basic_style_zip

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

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

◆ $core_styles

ilObjStyleSheet::$core_styles
static

◆ $expandable_types

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

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

◆ $filtered_groups

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

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

◆ $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.

◆ $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.

◆ $parameter

ilObjStyleSheet::$parameter
static

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

Referenced by getStyleParameterGroups().

◆ $pseudo_classes

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

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

◆ $templates

ilObjStyleSheet::$templates
static

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

Referenced by create(), and getTemplates().


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