16                "text_block" => 
"div",
 
   17                "text_inline" => 
"span",
 
   22                "media_cont" => 
"table",
 
   23                "media_caption" => 
"div",
 
   31                "flist_cont" => 
"div",
 
   32                "flist_head" => 
"div",
 
   42                "page_frame" => 
"table",
 
   43                "page_cont" => 
"table",
 
   49                "page_lnavlink" => 
"a",
 
   50                "page_rnavlink" => 
"a",
 
   51                "page_lnavimage" => 
"img",
 
   52                "page_rnavimage" => 
"img",
 
   58                        array(
"type" => 
"text_block", 
"class" => 
"Standard"),
 
   59                        array(
"type" => 
"text_block", 
"class" => 
"List"),
 
   60                        array(
"type" => 
"text_block", 
"class" => 
"TableContent"),
 
   61                        array(
"type" => 
"text_block", 
"class" => 
"Headline1"),
 
   62                        array(
"type" => 
"text_block", 
"class" => 
"Headline2"),
 
   63                        array(
"type" => 
"text_block", 
"class" => 
"Headline3"),
 
   64                        array(
"type" => 
"text_inline", 
"class" => 
"Comment"),
 
   65                        array(
"type" => 
"text_inline", 
"class" => 
"Emph"),
 
   66                        array(
"type" => 
"text_inline", 
"class" => 
"Quotation"),
 
   67                        array(
"type" => 
"text_inline", 
"class" => 
"Strong"),
 
   68                        array(
"type" => 
"link", 
"class" => 
"IntLink"),
 
   69                        array(
"type" => 
"link", 
"class" => 
"ExtLink"),
 
   70                        array(
"type" => 
"link", 
"class" => 
"FootnoteLink"),
 
   71                        array(
"type" => 
"media_cont", 
"class" => 
"MediaContainer"),
 
   72                        array(
"type" => 
"table", 
"class" => 
"StandardTable"),
 
   73                        array(
"type" => 
"media_caption", 
"class" => 
"MediaCaption"),
 
   74                        array(
"type" => 
"page_frame", 
"class" => 
"PageFrame"),
 
   75                        array(
"type" => 
"page_cont", 
"class" => 
"PageContainer"),
 
   76                        array(
"type" => 
"page_tnav", 
"class" => 
"TopNavigation"),
 
   77                        array(
"type" => 
"page_bnav", 
"class" => 
"BottomNavigation"),
 
   78                        array(
"type" => 
"page_lnav", 
"class" => 
"LeftNavigation"),
 
   79                        array(
"type" => 
"page_rnav", 
"class" => 
"RightNavigation"),
 
   80                        array(
"type" => 
"page_lnavlink", 
"class" => 
"LeftNavigationLink"),
 
   81                        array(
"type" => 
"page_rnavlink", 
"class" => 
"RightNavigationLink"),
 
   82                        array(
"type" => 
"page_lnavimage", 
"class" => 
"LeftNavigationImage"),
 
   83                        array(
"type" => 
"page_rnavimage", 
"class" => 
"RightNavigationImage"),
 
   84                        array(
"type" => 
"page_fn", 
"class" => 
"Footnote"),
 
   85                        array(
"type" => 
"page_title", 
"class" => 
"PageTitle"),
 
   86                        array(
"type" => 
"sco_title", 
"class" => 
"Title"),
 
   87                        array(
"type" => 
"sco_desc", 
"class" => 
"Description"),
 
   88                        array(
"type" => 
"sco_keyw", 
"class" => 
"Keywords"),
 
   89                        array(
"type" => 
"sco_obj", 
"class" => 
"Objective"),
 
   90                        array(
"type" => 
"list_o", 
"class" => 
"NumberedList"),
 
   91                        array(
"type" => 
"list_u", 
"class" => 
"BulletedList"),
 
   92                        array(
"type" => 
"list_item", 
"class" => 
"StandardListItem"),
 
   93                        array(
"type" => 
"question", 
"class" => 
"Standard"),
 
   94                        array(
"type" => 
"question", 
"class" => 
"SingleChoice"),
 
   95                        array(
"type" => 
"question", 
"class" => 
"MultipleChoice"),
 
   96                        array(
"type" => 
"question", 
"class" => 
"TextQuestion"),
 
   97                        array(
"type" => 
"question", 
"class" => 
"OrderingQuestion"),
 
   98                        array(
"type" => 
"question", 
"class" => 
"MatchingQuestion"),
 
   99                        array(
"type" => 
"question", 
"class" => 
"ImagemapQuestion"),
 
  100                        array(
"type" => 
"question", 
"class" => 
"ClozeTest"),
 
  101                        array(
"type" => 
"qtitle", 
"class" => 
"Title"),
 
  102                        array(
"type" => 
"qanswer", 
"class" => 
"Answer"),
 
  103                        array(
"type" => 
"qinput", 
"class" => 
"Input"),
 
  104                        array(
"type" => 
"qsubmit", 
"class" => 
"Submit"),
 
  105                        array(
"type" => 
"qfeedr", 
"class" => 
"FeedbackRight"),
 
  106                        array(
"type" => 
"qfeedw", 
"class" => 
"FeedbackWrong"),
 
  107                        array(
"type" => 
"flist_cont", 
"class" => 
"FileListContainer"),
 
  108                        array(
"type" => 
"flist_head", 
"class" => 
"FileListHeading"),
 
  109                        array(
"type" => 
"flist", 
"class" => 
"FileList"),
 
  110                        array(
"type" => 
"flist_li", 
"class" => 
"FileListItem")
 
  114        protected static $basic_style_file = 
"./Services/Migration/DBUpdate_1385/basic_style/style.xml";
 
  128                        $add_str = 
" AND style_id = ".$ilDB->quote($a_id, 
"integer");
 
  131                $set = 
$ilDB->query($q = 
"SELECT DISTINCT style_id, tag, class FROM style_parameter WHERE ".
 
  132                        $ilDB->equals(
"type", 
"", 
"text", 
true).
" ".$add_str);
 
  134                while ($rec = 
$ilDB->fetchAssoc($set))
 
  142                                        if (in_array($rec[
"class"], array(
"Headline3", 
"Headline1",
 
  143                                                "Headline2", 
"TableContent", 
"List", 
"Standard", 
"Remark",
 
  144                                                "Additional", 
"Mnemonic", 
"Citation", 
"Example")))
 
  146                                                $types[] = 
"text_block";
 
  148                                        if (in_array($rec[
"class"], array(
"Block", 
"Remark",
 
  149                                                "Additional", 
"Mnemonic", 
"Example", 
"Excursus", 
"Special")))
 
  151                                                $types[] = 
"section";
 
  153                                        if (in_array($rec[
"class"], array(
"Page", 
"Footnote", 
"PageTitle", 
"LMNavigation")))
 
  160                                        $types[] = 
"table_cell";
 
  164                                        if (in_array($rec[
"class"], array(
"ExtLink", 
"IntLink", 
"FootnoteLink")))
 
  171                                        $types[] = 
"text_inline";
 
  184                        foreach ($types as 
$t)
 
  187                                $set4 = 
$ilDB->queryF(
"SELECT * FROM style_char ".
 
  188                                        " WHERE style_id = %s AND type = %s AND characteristic = %s",
 
  189                                        array(
"integer", 
"text", 
"text"),
 
  190                                        array($rec[
"style_id"], 
$t, $rec[
"class"]));
 
  191                                if ($rec4 = 
$ilDB->fetchAssoc($set4))
 
  198                                        $ilDB->manipulateF(
"INSERT INTO style_char ".
 
  199                                                " (style_id, type, characteristic) VALUES ".
 
  201                                                array(
"integer", 
"text", 
"text"),
 
  202                                                array($rec[
"style_id"], 
$t, $rec[
"class"]));
 
  207                        if ($rec[
"type"] == 
"")
 
  209                                if (count($types) > 0)
 
  211                                        $ilDB->manipulateF(
"UPDATE style_parameter SET type = %s ".
 
  212                                                " WHERE style_id = %s AND class = %s AND ".
$ilDB->equals(
"type", 
"", 
"text", 
true),
 
  213                                                array(
"text", 
"integer", 
"text"),
 
  214                                                array($types[0], $rec[
"style_id"], $rec[
"class"]));
 
  217                                        if ($types[0] == 
"link")
 
  219                                                $ilDB->manipulateF(
"UPDATE style_parameter SET type = %s ".
 
  220                                                        " WHERE style_id = %s AND (class = %s OR class = %s) AND ".
$ilDB->equals(
"type", 
"", 
"text", 
true),
 
  221                                                        array(
"text", 
"integer", 
"text", 
"text"),
 
  222                                                        array($types[0], $rec[
"style_id"], $rec[
"class"].
":visited",
 
  223                                                        $rec[
"class"].
":hover"));
 
  229                                if (count($types) == 2)
 
  233                                        $set2 = 
$ilDB->queryF(
"SELECT * FROM style_parameter ".
 
  234                                                " WHERE style_id = %s AND class = %s AND type = %s",
 
  235                                                array(
"integer", 
"text", 
"text"),
 
  236                                                array($rec[
"style_id"], $rec[
"class"], $types[0]));
 
  237                                        while ($rec2 = 
$ilDB->fetchAssoc($set2))
 
  240                                                $set3 = 
$ilDB->queryF(
"SELECT * FROM style_parameter ".
 
  241                                                        " WHERE style_id = %s AND tag = %s AND class = %s AND type = %s AND parameter = %s",
 
  242                                                        array(
"integer", 
"text", 
"text", 
"text", 
"text"),
 
  243                                                        array($rec[
"style_id"], $rec[
"tag"], $rec[
"class"], $types[1], $rec[
"parameter"]));
 
  244                                                if ($rec3 = 
$ilDB->fetchAssoc($set3))
 
  250                                                        $ilDB->manipulateF(
"INSERT INTO style_parameter ".
 
  251                                                                " (style_id, tag, class, parameter, value, type) VALUES ".
 
  252                                                                " (%s,%s,%s,%s,%s,%s) ",
 
  253                                                                array(
"integer", 
"text", 
"text", 
"text", 
"text", 
"text"),
 
  254                                                                array($rec2[
"style_id"], $rec2[
"tag"], $rec2[
"class"],
 
  255                                                                        $rec2[
"parameter"], $rec2[
"value"], $types[1]));
 
  269                foreach (self::$core_styles as $cstyle)
 
  272                                = array(
"type" => $cstyle[
"type"],
 
  274                                        "class" => $cstyle[
"class"]);
 
  281                return self::$assigned_tags[
$a_type];
 
  291                if (!is_object(self::$basic_style_dom))
 
  293                        self::$basic_style_dom = 
new DOMDocument();
 
  294                        self::$basic_style_dom->load(self::$basic_style_file);
 
  308                $sty_data_dir = CLIENT_WEB_DIR.
"/sty";
 
  310                if(!is_writable($sty_data_dir))
 
  312                        $ilErr->raiseError(
"Style data directory (".$sty_data_dir
 
  313                                .
") not writeable.", 
$ilErr->FATAL);
 
  316                $style_dir = $sty_data_dir.
"/sty_".$a_style_id;
 
  318                if(!@is_dir($style_dir))
 
  320                        $ilErr->raiseError(
"Creation of style directory failed (".
 
  321                                $style_dir.
").",
$ilErr->FATAL);
 
  325                $im_dir = $style_dir.
"/images";
 
  327                if(!@is_dir($im_dir))
 
  329                        $ilErr->raiseError(
"Creation of Import Directory failed (".
 
  330                                $im_dir.
").", 
$ilErr->FATAL);
 
  334                $thumb_dir = $style_dir.
"/images/thumbnails";
 
  336                if(!@is_dir($thumb_dir))
 
  338                        $ilErr->raiseError(
"Creation of Import Directory failed (".
 
  339                                $thumb_dir.
").", 
$ilErr->FATAL);
 
  348                return CLIENT_WEB_DIR.
"/sty/sty_".$a_style_id.
 
  363                $core_images = array();
 
  365                if (is_dir($core_dir))
 
  367                        $dir = opendir($core_dir);
 
  368                        while(
$file = readdir($dir))
 
  370                                if (substr(
$file, 0, 1) != 
"." && is_file($core_dir.
"/".
$file))
 
  372                                        $core_images[] = 
$file;
 
  378                $sets = 
$ilDB->query(
"SELECT * FROM object_data WHERE type = 'sty'");
 
  380                while ($recs = 
$ilDB->fetchAssoc($sets))
 
  382                        $id = $recs[
"obj_id"];
 
  387                                $set = 
$ilDB->queryF(
"SELECT * FROM style_char WHERE style_id = %s ".
 
  388                                        "AND type = %s AND characteristic = %s",
 
  389                                        array(
"integer", 
"text", 
"text"),
 
  390                                        array($id, $cs[
"type"], $cs[
"class"]));
 
  393                                if (!($rec = 
$ilDB->fetchAssoc($set)))
 
  395                                        $ilDB->manipulateF(
"INSERT INTO style_char (style_id, type, characteristic) ".
 
  396                                                " VALUES (%s,%s,%s) ",
 
  397                                                array(
"integer", 
"text", 
"text"),
 
  398                                                array($id, $cs[
"type"], $cs[
"class"]));
 
  400                                        $xpath = 
new DOMXPath($bdom);
 
  401                                        $par_nodes = $xpath->query(
"/StyleSheet/Style[@Tag = '".$cs[
"tag"].
"' and @Type='".
 
  402                                                $cs[
"type"].
"' and @Class='".$cs[
"class"].
"']/StyleParameter");
 
  403                                        foreach ($par_nodes as $par_node)
 
  406                                                $set = 
$ilDB->queryF(
"SELECT * FROM style_parameter WHERE style_id = %s ".
 
  407                                                        "AND type = %s AND class = %s AND tag = %s AND parameter = %s",
 
  408                                                        array(
"integer", 
"text", 
"text", 
"text", 
"text"),
 
  409                                                        array($id, $cs[
"type"], $cs[
"class"],
 
  410                                                        $cs[
"tag"], $par_node->getAttribute(
"Name")));
 
  413                                                if (!($rec = 
$ilDB->fetchAssoc($set)))
 
  415                                                        $ilDB->manipulateF(
"INSERT INTO style_parameter (style_id, type, class, tag, parameter, value) ".
 
  416                                                                " VALUES (%s,%s,%s,%s,%s,%s)",
 
  417                                                                array(
"integer", 
"text", 
"text", 
"text", 
"text", 
"text"),
 
  418                                                                array($id, $cs[
"type"], $cs[
"class"], $cs[
"tag"],
 
  419                                                                $par_node->getAttribute(
"Name"), $par_node->getAttribute(
"Value")));
 
  429                        foreach($core_images as $cim)
 
  431                                if (!is_file($imdir.
"/".$cim))
 
  433                                        copy($core_dir.
"/".$cim, $imdir.
"/".$cim);
 
An exception for terminatinating execution or to throw for unit testing.
Style Migration Class (->3.11)
static _getBasicStyleDom()
Get basic style dom.
static _createImagesDirectory($a_style_id)
Create images directory <data_dir>/sty/sty_<id>/images.
static _determineTag($a_type)
static $basic_style_image_dir
static _getCoreStyles()
Get core styles.
static _getImagesDirectory($a_style_id)
Get images directory.
addMissingStyleCharacteristics($a_id="")
Add missing style characteristics to styles.
static _addMissingStyleClassesToAllStyles()
Add missing style classes to all styles.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file