• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

sql/dbupdate.php

Go to the documentation of this file.
00001 <#1>
00002 CREATE TABLE glossary_term
00003 (
00004         id                      INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
00005         glo_id          INT NOT NULL,
00006         term            VARCHAR(200),
00007         language        CHAR(2),
00008         INDEX glo_id (glo_id)
00009 );
00010 
00011 <#2>
00012 CREATE TABLE glossary_definition
00013 (
00014         id                      INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
00015         term_id         INT NOT NULL,
00016         page_id         INT NOT NULL
00017 );
00018 
00019 <#3>
00020 CREATE TABLE desktop_item
00021 (
00022         user_id         INT NOT NULL,
00023         item_id         INT NOT NULL,
00024         type            CHAR(4) NOT NULL,
00025         INDEX user_id (user_id)
00026 );
00027 
00028 <#4>
00029 UPDATE object_data SET title = 'ILIAS' WHERE title = 'ILIAS open source';
00030 
00031 <#5>
00032 REPLACE INTO lm_data (obj_id, title, type, lm_id) VALUES (1, 'dummy', 'du', 0);
00033 
00034 <#6>
00035 UPDATE role_data SET allow_register = 1 WHERE role_id = 5;
00036 
00037 <#7>
00038 REPLACE INTO settings (keyword, value) VALUES ('enable_registration', 1);
00039 
00040 <#8>
00041 REPLACE INTO settings (keyword, value) VALUES ('system_role_id', '2');
00042 
00043 <#9>
00044 DELETE FROM rbac_pa WHERE rol_id = 2;
00045 DELETE FROM rbac_templates WHERE rol_id = 2;
00046 DELETE FROM rbac_fa WHERE rol_id = 2 AND parent != 8;
00047 
00048 <#10>
00049 RENAME TABLE lm_page_object TO page_object;
00050 ALTER TABLE page_object DROP PRIMARY KEY;
00051 ALTER TABLE page_object MODIFY parent_type VARCHAR(4) NOT NULL DEFAULT 'lm';
00052 ALTER TABLE page_object ADD PRIMARY KEY (page_id, parent_type);
00053 
00054 <#11>
00055 ALTER TABLE glossary_definition DROP COLUMN page_id;
00056 ALTER TABLE glossary_definition ADD COLUMN short_text VARCHAR(200) NOT NULL DEFAULT '';
00057 
00058 <#12>
00059 UPDATE settings SET value = '3.0.0_alpha5' WHERE keyword = 'ilias_version' LIMIT 1;
00060 
00061 <#13>
00062 DROP TABLE IF EXISTS object_translation;
00063 CREATE TABLE object_translation (
00064  obj_id int(11) NOT NULL default '0',
00065  title char(70) NOT NULL default '',
00066  description char(128) default NULL,
00067  lang_code char(2) NOT NULL default '',
00068  lang_default tinyint(1) NOT NULL default '0',
00069  PRIMARY KEY  (obj_id,lang_code)
00070 ) TYPE=MyISAM;
00071 
00072 <#14>
00073 CREATE TABLE cal_appointment (
00074   appointmentId int(11) NOT NULL auto_increment,
00075   appointmentUnionId int(11) NOT NULL default '0',
00076   categoryId int(11) NOT NULL default '0',
00077   priorityId int(11) NOT NULL default '0',
00078   access varchar(15) NOT NULL default '',
00079   description text,
00080   duration int(11) NOT NULL default '0',
00081   startTimestamp bigint(14) NOT NULL default '0',
00082   term varchar(128) NOT NULL default '',
00083   location varchar(80) default NULL,
00084   serial tinyint(1) unsigned NOT NULL default '0',
00085   ownerId int(11) unsigned NOT NULL default '0',
00086   userId int(11) unsigned NOT NULL default '0',
00087   PRIMARY KEY  (appointmentId)
00088 ) TYPE=MyISAM;
00089 
00090 <#15>
00091 CREATE TABLE cal_appointmentrepeats (
00092   appointmentRepeatsId int(11) NOT NULL auto_increment,
00093   appointmentId int(11) NOT NULL default '0',
00094   endTimestamp int(14) default NULL,
00095   type varchar(15) NOT NULL default '',
00096   weekdays varchar(7) NOT NULL default 'nnnnnnn',
00097   PRIMARY KEY  (appointmentRepeatsId)
00098 ) TYPE=MyISAM;
00099 
00100 
00101 <#16>
00102 CREATE TABLE cal_appointmentrepeatsnot (
00103   appointmentRepeatsNotId int(11) NOT NULL auto_increment,
00104   appointmentRepeatsId int(11) NOT NULL default '0',
00105   leaveOutTimestamp int(14) default NULL,
00106   PRIMARY KEY  (appointmentRepeatsNotId)
00107 ) TYPE=MyISAM;
00108 
00109 <#17>
00110 CREATE TABLE cal_category (
00111   categoryId int(11) NOT NULL auto_increment,
00112   description text,
00113   term varchar(20) NOT NULL default '',
00114   PRIMARY KEY  (categoryId)
00115 ) TYPE=MyISAM;
00116 
00117 
00118 <#18>
00119 CREATE TABLE cal_priority (
00120   priorityId int(11) NOT NULL auto_increment,
00121   description text,
00122   term varchar(20) NOT NULL default '',
00123   PRIMARY KEY  (priorityId)
00124 ) TYPE=MyISAM;
00125 
00126 
00127 <#19>
00128 CREATE TABLE cal_user_group (
00129   groupId int(11) NOT NULL default '0',
00130   userId int(11) NOT NULL default '0',
00131   description text,
00132   PRIMARY KEY  (groupId,userId)
00133 ) TYPE=MyISAM;
00134 
00135 <#20>
00136 CREATE TABLE dummy_groups (
00137   groupId int(11) NOT NULL auto_increment,
00138   description text,
00139   owner varchar(20) NOT NULL default '',
00140   term varchar(20) NOT NULL default '',
00141   PRIMARY KEY  (groupId)
00142 ) TYPE=MyISAM;
00143 
00144 <#21>
00145 DELETE FROM glossary_definition;
00146 DELETE FROM meta_data WHERE obj_type='gdf';
00147 DELETE FROM page_object WHERE parent_type='gdf';
00148 ALTER TABLE glossary_definition ADD COLUMN nr INT NOT NULL;
00149 
00150 <#22>
00151 CREATE TABLE usr_search (
00152 usr_id INT NOT NULL ,
00153 search_result TEXT,
00154 PRIMARY KEY ( usr_id )
00155 );
00156 
00157 <#23>
00158 ALTER TABLE lm_data ADD COLUMN import_id CHAR(50) NOT NULL DEFAULT '';
00159 
00160 <#24>
00161 ALTER TABLE object_data ADD COLUMN import_id CHAR(50) NOT NULL DEFAULT '';
00162 
00163 <#25>
00164 ALTER TABLE glossary_term ADD COLUMN import_id CHAR(50) NOT NULL DEFAULT '';
00165 
00166 <#26>
00167 ALTER TABLE desktop_item ADD COLUMN parameters VARCHAR(200);
00168 
00169 <#27>
00170 CREATE TABLE personal_clipboard
00171 (
00172         user_id         INT NOT NULL,
00173         item_id         INT NOT NULL,
00174         type            CHAR(4) NOT NULL,
00175         title           CHAR(70) NOT NULL DEFAULT '',
00176         PRIMARY KEY (user_id, item_id, type)
00177 );
00178 
00179 <#28>
00180 INSERT INTO cal_priority (priorityId, description, term) VALUES ('1','high','high');
00181 INSERT INTO cal_priority (priorityId, description, term) VALUES ('2','middle','middle');
00182 INSERT INTO cal_priority (priorityId, description, term) VALUES ('3','low','low');
00183 INSERT INTO cal_category (categoryId, description, term) VALUES ('1','test','test');
00184 
00185 <#29>
00186 ALTER TABLE page_object CHANGE content content TEXT NOT NULL;
00187 ALTER TABLE page_object ADD FULLTEXT ( content );
00188 
00189 <#30>
00190 CREATE TABLE dbk_translations
00191 (
00192         id                      int(11) NOT NULL,
00193         tr_id           int(11) NOT NULL,
00194         PRIMARY KEY (id,tr_id)
00195 );
00196 
00197 <#31>
00198 <?php
00199 // 1. replace all '-1' values in ref_id
00200 $q = "SELECT * FROM grp_tree WHERE ref_id = '-1'";
00201 $res = $this->db->query($q);
00202 
00203 $grp_data = array();
00204 
00205 while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
00206 {
00207         $grp_data[] = $row;
00208 }
00209 
00210 if (count($grp_data) > 0)
00211 {
00212         foreach ($grp_data as $entry)
00213         {
00214                 $q = "INSERT INTO object_reference ".
00215                          "(ref_id,obj_id) VALUES (0,'".$entry["child"]."')";
00216                 $this->db->query($q);
00217 
00218                 $q = "SELECT LAST_INSERT_ID()";
00219                 $res = $this->db->query($q);
00220                 $row = $res->fetchRow();
00221                 $entry["ref_id"] = $row[0];
00222         
00223                 $q = "UPDATE grp_data SET ref_id='".$entry["ref_id"]."' WHERE child='".$entry["child"]."'";
00224                 $this->db->query($q);
00225         }
00226 }
00227 
00228 unset($grp_data);
00229 $grp_data = array();
00230 
00231 // 2. replace child and parent (both are obj_ids) with ref_ids
00232 $q = "SELECT * FROM grp_tree";
00233 $res = $this->db->query($q);
00234 
00235 while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
00236 {
00237         $grp_data[] = $row;
00238 }
00239 
00240 $q = "DELETE FROM grp_tree";
00241 $this->db->query($q);
00242 
00243 if (count($grp_data) > 0)
00244 {
00245         foreach ($grp_data as $key => $entry)
00246         {
00247                 $q = "SELECT ref_id FROM object_reference WHERE obj_id='".$entry["parent"]."'";
00248                 $res = $this->db->query($q);
00249                 $row = $res->fetchRow(DB_FETCHMODE_ASSOC); 
00250                 $entry["parent"] = $row["ref_id"];
00251 
00252                 $q = "INSERT INTO grp_tree (tree,child,parent,lft,rgt,depth,perm,ref_id) VALUES ".
00253                          "('".$entry["tree"]."',".
00254                          "'".$entry["ref_id"]."',".
00255                          "'".$entry["parent"]."',".
00256                          "'".$entry["lft"]."',".
00257                          "'".$entry["rgt"]."',".
00258                          "'".$entry["depth"]."',".
00259                          "'".$entry["perm"]."',".
00260                          "'".$entry["child"]."')";
00261                 $this->db->query($q);
00262         }
00263 }
00264 
00265 unset($grp_data);
00266 ?>
00267 
00268 <#32>
00269 ALTER TABLE grp_tree CHANGE ref_id obj_id INT(11);
00270 
00271 <#33>
00272 CREATE TABLE file_data
00273 (
00274         file_id INT NOT NULL,
00275         file_type CHAR(64) NOT NULL,
00276         PRIMARY KEY (file_id)
00277 );
00278 
00279 <#34>
00280 CREATE TABLE lo_access
00281 (
00282         timestamp DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
00283         usr_id INT(11) DEFAULT '0' NOT NULL,
00284         lm_id  INT(11) DEFAULT '0' NOT NULL,
00285         obj_id INT(11) DEFAULT '0' NOT NULL,
00286         lm_title VARCHAR(200) DEFAULT '' NOT NULL
00287 );
00288 
00289 <#35>
00290 ALTER TABLE file_data ADD file_name CHAR(128) NOT NULL AFTER file_id;
00291 
00292 <#36>
00293 DELETE FROM rbac_templates WHERE rol_id='83' AND type='grp' AND ops_id=3 AND parent=8;
00294 
00295 <#37>
00296 ALTER TABLE media_item ADD COLUMN param TEXT;
00297 
00298 <#38>
00299 INSERT INTO object_data (type, title, description, owner, create_date, last_update)
00300 VALUES ('typ', 'exc', 'Exercise object', -1, now(), now());
00301 
00302 <#39>
00303 CREATE TABLE exc_data
00304 (
00305         obj_id INT NOT NULL,
00306         instruction TEXT,
00307         time_stamp INT(10),
00308         PRIMARY KEY (obj_id)
00309         );
00310 CREATE TABLE exc_members
00311 (
00312         obj_id INT(11) NOT NULL,
00313         usr_id INT(11) NOT NULL,
00314         solved TINYINT(1) NULL,
00315         sent TINYINT(1) NULL,
00316         PRIMARY KEY(obj_id,usr_id)
00317         );
00318 
00319 <#40>
00320 INSERT INTO rbac_templates VALUES(81,"frm",4,8);
00321 INSERT INTO rbac_templates VALUES(80,"frm",9,8);
00322 INSERT INTO rbac_templates VALUES(80,"frm",10,8);
00323 
00324 <#41>
00325 ALTER TABLE learning_module RENAME content_object;
00326 
00327 <#42>
00328 ALTER TABLE content_object ADD COLUMN online ENUM('y','n') DEFAULT 'n';
00329 
00330 <#43>
00331 DELETE FROM rbac_templates where rol_id=82;
00332 
00333 CREATE TABLE grp_registration (
00334 `grp_id` INT NOT NULL ,
00335 `user_id` INT NOT NULL ,
00336 `subject` VARCHAR( 255 ) NOT NULL ,
00337 `application_date` DATETIME NOT NULL
00338 );
00339 
00340 <#44>
00341 DELETE FROM settings WHERE keyword='crs_enable';
00342 DELETE FROM settings WHERE keyword='group_file_sharing';
00343 DELETE FROM settings WHERE keyword='babylon_path';
00344 DELETE FROM settings WHERE keyword='news';
00345 DELETE FROM settings WHERE keyword='payment_system';
00346 
00347 <#45>
00348 ALTER TABLE grp_data CHANGE status register INTEGER DEFAULT '1';
00349 
00350 <#46>
00351 <?php
00352 // adding new object type LDAP
00353 
00354 // INSERT LDAP TYPE DEFINITION in object_data
00355 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
00356                  "VALUES ('typ', 'ldap', 'LDAP settings object', -1, now(), now())";
00357 $this->db->query($query);
00358 
00359 // fetch type id
00360 $query = "SELECT LAST_INSERT_ID()";
00361 $res = $this->db->query($query);
00362 $row = $res->fetchRow();
00363 $typ_id = $row[0];
00364 
00365 // ADD OPERATION assignment to ldap object definition
00366 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
00367 $this->db->query($query);
00368 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
00369 $this->db->query($query);
00370 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
00371 $this->db->query($query);
00372 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
00373 $this->db->query($query);
00374 
00375 // INSERT LDAP OBJECT in object_data
00376 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
00377                  "VALUES ('ldap','LDAP settings','Folder contains all LDAP settings','-1',now(),now())";
00378 $this->db->query($query);
00379 
00380 // fetch obj id
00381 $query = "SELECT LAST_INSERT_ID()";
00382 $res = $this->db->query($query);
00383 $row = $res->fetchRow();
00384 $obj_id = $row[0];
00385 
00386 // CREATE OBJECT REFERENCE ENTRY for ldap object
00387 $query = "INSERT INTO object_reference (obj_id) VALUES ('".$obj_id."')";
00388 $this->db->query($query);
00389 
00390 // fetch ref id
00391 $query = "SELECT LAST_INSERT_ID()";
00392 $res = $this->db->query($query);
00393 $row = $res->fetchRow();
00394 $ref_id = $row[0];
00395 
00396 // INSERT LDAP OBJECT IN TREE (UNDER SYSTEMSETTINGS FOLDER)
00397 $query = "SELECT * FROM tree".
00398      "WHERE child = '9' ".
00399      "AND tree = '1'";
00400 $res = $this->db->getRow($query);
00401 
00402 $left = $res->lft;
00403 $lft = $left + 1;
00404 $rgt = $left + 2;
00405 
00406 // SPREAD TREE
00407 $query = "UPDATE tree SET ".
00408      "lft = CASE ".
00409          "WHEN lft > ".$left." ".
00410          "THEN lft + 2 ".
00411          "ELSE lft ".
00412          "END, ".
00413          "rgt = CASE ".
00414          "WHEN rgt > ".$left." ".
00415          "THEN rgt + 2 ".
00416          "ELSE rgt ".
00417          "END ".
00418          "WHERE tree = '1'";
00419 $this->db->query($query);
00420 
00421 // INSERT NODE
00422 $query = "INSERT INTO tree (tree,child,parent,lft,rgt,depth) ".
00423      "VALUES ".
00424          "('1','".$ref_id."','9','".$lft."','".$rgt."','2')";
00425 $this->db->query($query);
00426 ?>
00427 
00428 <#47>
00429 INSERT INTO settings (keyword, value) VALUES ('anonymous_role_id','14');
00430 
00431 <#48>
00432 ALTER TABLE grp_data ADD COLUMN password VARCHAR(255) DEFAULT NULL;
00433 ALTER TABLE grp_data ADD COLUMN expiration DATETIME DEFAULT '0000-00-00 00:00:00';
00434 
00435 <#49>
00436 ALTER TABLE usr_data ADD COLUMN department VARCHAR(80) NOT NULL DEFAULT '';
00437 ALTER TABLE usr_data CHANGE phone phone_office VARCHAR(40) NOT NULL DEFAULT '';
00438 ALTER TABLE usr_data ADD COLUMN phone_home VARCHAR(40) NOT NULL DEFAULT '';
00439 ALTER TABLE usr_data ADD COLUMN phone_mobile VARCHAR(40) NOT NULL DEFAULT '';
00440 ALTER TABLE usr_data ADD COLUMN fax VARCHAR(40) NOT NULL DEFAULT '';
00441 
00442 <#50>
00443 <?php
00444 // correct tree entry for LDAP object
00445 
00446 // fetch ref_id of ldap object entry
00447 $query = "SELECT ref_id FROM object_reference ".
00448                  "LEFT JOIN object_data ON object_reference.obj_id=object_data.obj_id ".
00449                  "WHERE object_data.type='ldap'";
00450 $res = $this->db->query($query);
00451 
00452 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00453 {
00454         $ref_id = $row->ref_id;
00455 }
00456 
00457 // remove false tree entry
00458 $query = "DELETE FROM tree WHERE child = '".$ref_id."'";
00459 $this->db->query($query);
00460 
00461 // INSERT LDAP OBJECT IN TREE (UNDER SYSTEMSETTINGS FOLDER)
00462 $query = "SELECT * FROM tree ".
00463      "WHERE child = '9' ".
00464      "AND tree = '1'";
00465 $res = $this->db->query($query);
00466 
00467 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00468 {
00469         $left = $row->lft;
00470         $lft = $left + 1;
00471         $rgt = $left + 2;
00472 }
00473 
00474 // SPREAD TREE
00475 $query = "UPDATE tree SET ".
00476      "lft = CASE ".
00477          "WHEN lft > ".$left." ".
00478          "THEN lft + 2 ".
00479          "ELSE lft ".
00480          "END, ".
00481          "rgt = CASE ".
00482          "WHEN rgt > ".$left." ".
00483          "THEN rgt + 2 ".
00484          "ELSE rgt ".
00485          "END ".
00486          "WHERE tree = '1'";
00487 $this->db->query($query);
00488 
00489 // INSERT NODE
00490 $query = "INSERT INTO tree (tree,child,parent,lft,rgt,depth) ".
00491      "VALUES ".
00492          "('1','".$ref_id."','9','".$lft."','".$rgt."','2')";
00493 $this->db->query($query);
00494 ?>
00495 
00496 <#51>
00497 ALTER TABLE rbac_ua DROP COLUMN default_role;
00498 
00499 <#52>
00500 <?php
00501 // change author role to template
00502 // first move all assigned users from author to guest role
00503 $query = "SELECT usr_id FROM rbac_ua WHERE rol_id='3'";
00504 $res = $this->db->query($query);
00505 
00506 $users = array();
00507 
00508 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00509 {
00510         $users[] = $row->usr_id;
00511 }
00512 
00513 foreach ($users as $key => $id)
00514 {
00515         $query = "SELECT * FROM rbac_ua WHERE usr_id='".$id."' AND rol_id='5'";
00516         $res = $this->db->query($query);
00517 
00518         if (!$res->numRows())
00519         {
00520                 $query = "INSERT INTO rbac_ua (usr_id,rol_id) ".
00521                          "VALUES ".
00522                                  "('".$id."','5')";
00523                 $this->db->query($query);
00524         }
00525 }
00526 
00527 // change object type of author from role to rolt
00528 $query = "UPDATE object_data SET type='rolt', description='Role template for authors with write & create permissions.' WHERE obj_id='3'";
00529 $this->db->query($query);
00530 
00531 // change assign status
00532 $query = "UPDATE rbac_fa SET assign='n' WHERE rol_id='3' AND parent='8'";
00533 $this->db->query($query);
00534 
00535 // remove invalid datas
00536 $query = "DELETE FROM rbac_fa WHERE rol_id='3' AND parent!='8'";
00537 $this->db->query($query);
00538 
00539 $query = "DELETE FROM rbac_templates WHERE rol_id='3' AND parent!='8'";
00540 $this->db->query($query);
00541 
00542 $query = "DELETE FROM rbac_ua WHERE rol_id='3'";
00543 $this->db->query($query);
00544 ?>
00545 
00546 <#53>
00547 UPDATE object_data SET title='User', description='Standard role for registered users. Grants read access to most objects.' WHERE obj_id='4';
00548 
00549 <#54>
00550 CREATE TABLE mob_usage
00551 (
00552         id INT NOT NULL,
00553         usage_type CHAR(4) NOT NULL,
00554         usage_id INT NOT NULL,
00555         PRIMARY KEY (id, usage_type, usage_id)
00556 );
00557 
00558 <#55>
00559 INSERT INTO settings (keyword,value) VALUES ('system_user_id','6');
00560 
00561 <#56>
00562 ALTER TABLE `exc_members` ADD `notice` TEXT AFTER `usr_id` ,
00563 ADD `returned` TINYINT( 1 ) AFTER `notice` ;
00564 
00565 <#57>
00566 <?php
00567 
00568   // GET DEFAULT OPERATIONS FOR EXC-OBJECT
00569 $query = "SELECT DISTINCT(ops_id) AS id FROM rbac_operations ".
00570         "WHERE operation IN('visible','read','write','create','delete','edit permission')";
00571 
00572 $res = $this->db->query($query);
00573 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00574 {
00575         $ops_ids[] = $row->id;
00576 }
00577 // GET type_id of exc object
00578 $query = "SELECT obj_id FROM object_data ".
00579         "WHERE type = 'typ' ".
00580         "AND title = 'exc'";
00581 
00582 $res = $this->db->query($query);
00583 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00584 {
00585         $type_id = $row->obj_id;
00586 }
00587 // INSERT OPERATIONS
00588 foreach($ops_ids as $id)
00589 {
00590         $query = "INSERT INTO rbac_ta ".
00591                 "SET typ_id = '".$type_id."', ".
00592                 "ops_id = '".$id."'";
00593         $this->db->query($query);
00594 }
00595 ?>
00596 
00597 <#58>
00598 <?php
00599 
00600 //GET ID OF THE IL_GRP_MEMBER TEMPLATE
00601 $query1 = "SELECT obj_id FROM object_data WHERE title = 'il_grp_member' ";
00602 $res = $this->db->query($query1);
00603 $tpl = $res->fetchRow(DB_FETCHMODE_ASSOC);
00604 
00605 //GET PROPER PARENT_ID
00606 $query2 = "SELECT parent FROM rbac_templates WHERE rol_id = ".$tpl["obj_id"];
00607 $res = $this->db->query($query2);
00608 $rol_fold = $res->fetchRow(DB_FETCHMODE_ASSOC);
00609 
00610 
00611 //DELETE RIGHTS FOR COURSE OBJECT FROM THE TEMPLATE
00612 $query3 = "DELETE FROM rbac_templates WHERE rol_id = '".$tpl["obj_id"]."' AND type = 'crs'";
00613 $this->db->query($query3);
00614 
00615 //CHANGE RIGHTS OF THE FORUM OBJECT IN THE TEMPLATE
00616 $query4 = "DELETE FROM rbac_templates WHERE rol_id = '".$tpl["obj_id"]."' AND type = 'frm' AND ops_id = 5 ";
00617 $this->db->query($query4);
00618 $query5 = "DELETE FROM rbac_templates WHERE rol_id = '".$tpl["obj_id"]."' AND type = 'frm' AND ops_id = 6 ";
00619 $this->db->query($query5);
00620 $query6 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','frm','9','".$rol_fold["parent"]."')";
00621 $this->db->query($query6);
00622 
00623 //CHANGE RIGHTS OF THE FORUM OBJECT IN THE TEMPLATE
00624 $query7 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','glo','2','".$rol_fold["parent"]."')";
00625 $this->db->query($query7);
00626 $query8 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','glo','3','".$rol_fold["parent"]."')";
00627 $this->db->query($query8);
00628 
00629 //CHANGE RIGHTS OF THE GROUP OBJECT IN THE TEMPLATE
00630 $query9 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','grp','5','".$rol_fold["parent"]."')";
00631 $this->db->query($query9);
00632 $query10 = "DELETE FROM rbac_templates WHERE rol_id = '".$tpl["obj_id"]."' AND type = 'grp' AND ops_id = 4 ";
00633 $this->db->query($query10);
00634 
00635 //CHANGE RIGHTS OF THE LEARNING MODUL OBJECT IN THE TEMPLATE
00636 $query11 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','lm','2','".$rol_fold["parent"]."')";
00637 $this->db->query($query11);
00638 $query12 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','lm','3','".$rol_fold["parent"]."')";
00639 $this->db->query($query12);
00640 
00641 //CHANGE RIGHTS OF THE SCORM LEARNING MODUL OBJECT IN THE TEMPLATE
00642 $query13 = "DELETE FROM rbac_templates WHERE rol_id = '".$tpl["obj_id"]."' AND type = 'slm' AND ops_id = 5 ";
00643 $this->db->query($query13);
00644 $query14 = "DELETE FROM rbac_templates WHERE rol_id = '".$tpl["obj_id"]."' AND type = 'slm' AND ops_id = 6 ";
00645 $this->db->query($query14);
00646 ?>
00647 
00648 <#59>
00649 <?php
00650 
00651 //GET ID OF THE IL_GRP_ADMIN TEMPLATE
00652 $query1 = "SELECT obj_id FROM object_data WHERE title = 'il_grp_admin' ";
00653 $res = $this->db->query($query1);
00654 $tpl = $res->fetchRow(DB_FETCHMODE_ASSOC);
00655 
00656 //GET PROPER PARENT_ID
00657 $query2 = "SELECT parent FROM rbac_templates WHERE rol_id = ".$tpl["obj_id"];
00658 $res = $this->db->query($query2);
00659 $rol_fold = $res->fetchRow(DB_FETCHMODE_ASSOC);
00660 
00661 //CHANGE RIGHTS OF THE GROUP OBJECT IN THE TEMPLATE
00662 $query3 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','grp','5','".$rol_fold["parent"]."')";
00663 $this->db->query($query3);
00664 
00665 //DELETE RIGHTS FOR COURSE OBJECT FROM THE TEMPLATE
00666 $query4 = "DELETE FROM rbac_templates WHERE rol_id = '".$tpl["obj_id"]."' AND type = 'crs'";
00667 $this->db->query($query4);
00668 
00669 //CHANGE RIGHTS OF THE FORUM OBJECT IN THE TEMPLATE
00670 $query5 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','frm','1','".$rol_fold["parent"]."')";
00671 $this->db->query($query5);
00672 $query6 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','frm','4','".$rol_fold["parent"]."')";
00673 $this->db->query($query6);
00674 
00675 //CHANGE RIGHTS OF THE GLOSSARY OBJECT IN THE TEMPLATE
00676 $query7 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','glo','1','".$rol_fold["parent"]."')";
00677 $this->db->query($query7);
00678 $query8 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','glo','4','".$rol_fold["parent"]."')";
00679 $this->db->query($query8);
00680 $query9 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','glo','7','".$rol_fold["parent"]."')";
00681 $this->db->query($query9);
00682 $query10 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','glo','8','".$rol_fold["parent"]."')";
00683 $this->db->query($query10);
00684 
00685 //CHANGE RIGHTS OF THE GLOSSARY OBJECT IN THE TEMPLATE
00686 $query11 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','rolf','1','".$rol_fold["parent"]."')";
00687 $this->db->query($query11);
00688 $query12 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','rolf','5','".$rol_fold["parent"]."')";
00689 $this->db->query($query12);
00690 $query13 = "INSERT INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','rolf','6','".$rol_fold["parent"]."')";
00691 $this->db->query($query13);
00692 ?>
00693 
00694 <#60>
00695 <?php
00696 $query1 = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
00697                  "VALUES ('typ', 'fold', 'Folder object', -1, now(), now())";
00698 $this->db->query($query1);
00699 $query2 = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
00700                  "VALUES ('typ', 'file', 'File object', -1, now(), now())";
00701 $this->db->query($query2);
00702 ?>
00703 <#61>
00704 <?php
00705 // check if setup migration is required
00706 $ini = new ilIniFile(ILIAS_ABSOLUTE_PATH."/ilias.ini.php");
00707 $res = $ini->read();
00708 
00709 $migrate = true;
00710 
00711 if ($res)
00712 {
00713         if ($ini->readVariable("clients","path") !== false)
00714         {
00715                 $migrate = false;
00716         }
00717 }
00718 
00719 unset($ini);
00720 
00721 if ($migrate)
00722 {
00723         $query = "SELECT * FROM settings";
00724         $res = $this->db->query($query);
00725 
00726         while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00727         {
00728                 $settings[$row->keyword] = $row->value;
00729         }
00730 
00731         $client_id = "default";
00732 
00733         rename(ILIAS_ABSOLUTE_PATH."/ilias.ini.php",ILIAS_ABSOLUTE_PATH."/ilias.ini_copied.php");
00734 
00735         $ini_old = new ilIniFile(ILIAS_ABSOLUTE_PATH."/ilias.ini_copied.php");
00736         $res = $ini_old->read();
00737 
00738         $datadir = $ini_old->readVariable("server","data_dir");
00739         $datadir_client = $datadir."/".$client_id;
00740         $webdir = $ini_old->readVariable("server","absolute_path")."/data";
00741         $webdir_client = $webdir."/".$client_id;
00742 
00743         ilUtil::makeDir($datadir_client);
00744         ilUtil::makeDir($datadir_client."/forum");
00745         ilUtil::makeDir($datadir_client."/files");
00746         ilUtil::makeDir($datadir_client."/lm_data");
00747         ilUtil::makeDir($datadir_client."/mail");
00748 
00749         ilUtil::makeDir($webdir_client);
00750         ilUtil::makeDir($webdir_client."/css");
00751         ilUtil::makeDir($webdir_client."/mobs");
00752         ilUtil::makeDir($webdir_client."/lm_data");
00753         ilUtil::makeDir($webdir_client."/usr_images");
00754 
00755         //copy data dir
00756         ilUtil::rcopy($datadir."/forum",$datadir_client."/forum");
00757         ilUtil::rcopy($datadir."/files",$datadir_client."/files");
00758         ilUtil::rcopy($datadir."/lm_data",$datadir_client."/lm_data");
00759         ilUtil::rcopy($datadir."/mail",$datadir_client."/mail");
00760         // copy web dir
00761         ilUtil::rcopy($webdir."/css",$webdir_client."/css");
00762         ilUtil::rcopy($webdir."/mobs",$webdir_client."/mobs");
00763         ilUtil::rcopy($webdir."/lm_data",$webdir_client."/lm_data");
00764         ilUtil::rcopy($webdir."/usr_images",$webdir_client."/usr_images");
00765 
00766         $client_master = ILIAS_ABSOLUTE_PATH."/setup/client.master.ini.php";
00767         $ini_new = new ilIniFile($webdir_client."/client.ini.php");
00768         $ini_new->GROUPS = parse_ini_file($client_master,true);
00769 
00770         $ini_new->setVariable("client","name",$settings["inst_name"]);
00771         $ini_new->setVariable("client","description",$settings["inst_info"]);
00772         $ini_new->setVariable("client","access",1);
00773         $ini_new->setVariable("db","host",$ini_old->readVariable("db","host"));
00774         $ini_new->setVariable("db","user",$ini_old->readVariable("db","user"));
00775         $ini_new->setVariable("db","pass",$ini_old->readVariable("db","pass"));
00776         $ini_new->setVariable("db","name",$ini_old->readVariable("db","name"));
00777         $ini_new->setVariable("language","default",$ini_old->readVariable("language","default"));
00778         $ini_new->setVariable("layout","skin",$ini_old->readVariable("layout","skin"));
00779         $ini_new->setVariable("layout","style",$ini_old->readVariable("layout","style"));
00780 
00781         $ilias_master = ILIAS_ABSOLUTE_PATH."/setup/ilias.master.ini.php";
00782         $ini_il = new ilIniFile($ini_old->readVariable("server","absolute_path")."/ilias.ini.php");
00783         $ini_il->GROUPS = parse_ini_file($ilias_master,true);
00784 
00785         $ini_il->setVariable("server","http_path",$ini_old->readVariable("server","http_path"));
00786         $ini_il->setVariable("server","absolute_path",$ini_old->readVariable("server","absolute_path"));
00787         $ini_il->setVariable("clients","datadir",$ini_old->readVariable("server","data_dir"));
00788         $ini_il->setVariable("tools", "convert", $settings["convert_path"]);
00789         $ini_il->setVariable("tools", "zip", $settings["zip_path"]);
00790         $ini_il->setVariable("tools", "unzip", $settings["unzip_path"]);
00791         $ini_il->setVariable("tools", "java", $settings["java_path"]);
00792         $ini_il->setVariable("tools", "htmldoc", $settings["htmldoc"]);
00793 
00794         $setup_pass = ($settings["setup_passwd"]) ? $settings["setup_passwd"] : md5("homer");
00795         $ini_il->setVariable("setup", "pass", $setup_pass);
00796         $ini_il->setVariable("clients","default",$client_id);
00797 
00798         $ini_new->write();
00799         $ini_il->write();
00800 
00801         if (!$settings["setup_ok"])
00802         {
00803                 $query = "INSERT INTO settings VALUES ('setup_ok','1')";
00804                 $this->db->query($query);
00805         }
00806 
00807         if (!isset($settings["nic_enabled"]))
00808         {
00809                 $query = "INSERT INTO settings VALUES ('nic_enabled','0')";
00810                 $this->db->query($query);
00811         }
00812 }
00813 ?>
00814 
00815 <#62>
00816 
00817 CREATE TABLE int_link
00818 (
00819         source_type CHAR(4) NOT NULL DEFAULT '',
00820         source_id INT NOT NULL,
00821         target_type CHAR(4) NOT NULL DEFAULT '',
00822         target_id INT NOT NULL,
00823         target_inst INT NOT NULL DEFAULT '0',
00824         PRIMARY KEY (source_type, source_id, target_type, target_id, target_inst)
00825 );
00826 
00827 <#63>
00828 <?php
00829 // CODE IS BROKEN! DON'T USE IT
00830 // remove LDAP node temporary
00831 // get LDAP node data
00832 //$query = "SELECT * FROM tree WHERE child=13 AND tree=1";
00833 //$res = $this->db->query($query);
00834 //$row = $res->fetchRow(DB_FETCHMODE_OBJECT);
00835 
00836 // take out node in main tree
00837 //$query = "update tree SET tree='-13' WHERE child=13";
00838 //$this->db->query($query);
00839 
00840 // close gaps
00841 //$diff = $row->rgt - $row->lft + 1;
00842 
00843 //$query = "UPDATE tree SET ".
00844 //               "lft = CASE ".
00845 //               "WHEN lft > '".$row->lft." '".
00846 //               "THEN lft - '".$diff." '".
00847 //               "ELSE lft ".
00848 //               "END, ".
00849 //               "rgt = CASE ".
00850 //               "WHEN rgt > '".$row->lft." '".
00851 //               "THEN rgt - '".$diff." '".
00852 //               "ELSE rgt ".
00853 //               "END ".
00854 //               "WHERE tree = 1";
00855 //$this->db->query($query);
00856 ?>
00857 
00858 <#64>
00859 ALTER TABLE page_object MODIFY content MEDIUMTEXT;
00860 
00861 <#65>
00862 ALTER TABLE mob_usage MODIFY usage_type VARCHAR(10) NOT NULL;
00863 
00864 
00865 <#66>
00866 UPDATE settings SET value = '3.0.0_beta1' WHERE keyword = 'ilias_version' LIMIT 1;
00867 
00868 <#67>
00869 ALTER TABLE int_link MODIFY source_type VARCHAR(10) NOT NULL;
00870 
00871 <#68>
00872 #
00873 # Tabellenstruktur für Tabelle `search_data`
00874 #
00875 
00876 CREATE TABLE search_data (
00877   obj_id int(11) NOT NULL auto_increment,
00878   user_id int(11) NOT NULL default '0',
00879   title varchar(200) NOT NULL default '',
00880   target text NOT NULL default '',
00881   type varchar(4) NOT NULL default '',
00882   PRIMARY KEY  (obj_id,user_id)
00883 ) TYPE=MyISAM;
00884 
00885 #
00886 # Tabellenstruktur für Tabelle `search_tree`
00887 #
00888 
00889 CREATE TABLE search_tree (
00890   tree int(11) NOT NULL default '0',
00891   child int(11) unsigned NOT NULL default '0',
00892   parent int(11) unsigned default NULL,
00893   lft int(11) unsigned NOT NULL default '0',
00894   rgt int(11) unsigned NOT NULL default '0',
00895   depth smallint(5) unsigned NOT NULL default '0',
00896   KEY child (child),
00897   KEY parent (parent)
00898 ) TYPE=MyISAM;
00899 
00900   DELETE FROM usr_search;
00901 
00902 <#69>
00903   DELETE FROM usr_search;
00904   DELETE FROM search_data;
00905   DELETE FROM search_tree;
00906 
00907 <#70>
00908 UPDATE settings SET value = '3.0.0_beta2' WHERE keyword = 'ilias_version' LIMIT 1;
00909 
00910 <#71>
00911 #
00912 # Tabellenstruktur für Tabelle `dp_changed_dates`
00913 #
00914 
00915 CREATE TABLE dp_changed_dates (
00916   ID int(15) NOT NULL auto_increment,
00917   user_ID int(15) NOT NULL default '0',
00918   date_ID int(15) NOT NULL default '0',
00919   status int(15) NOT NULL default '0',
00920   timestamp int(10) NOT NULL default '0',
00921   PRIMARY KEY  (ID)
00922 ) TYPE=MyISAM COMMENT='Tabelle f�r Anzeige von Geänderten Termindaten';
00923 # --------------------------------------------------------
00924 
00925 <#72>
00926 #
00927 # Tabellenstruktur für Tabelle `dp_dates`
00928 #
00929 
00930 CREATE TABLE dp_dates (
00931   ID int(15) NOT NULL auto_increment,
00932   begin int(10) NOT NULL default '0',
00933   end int(10) NOT NULL default '0',
00934   group_ID int(15) NOT NULL default '0',
00935   user_ID int(15) NOT NULL default '0',
00936   created int(10) NOT NULL default '0',
00937   changed int(10) NOT NULL default '0',
00938   rotation int(15) NOT NULL default '0',
00939   shorttext varchar(50) NOT NULL default '',
00940   text text,
00941   end_rotation int(10) NOT NULL default '0',
00942   PRIMARY KEY  (ID)
00943 ) TYPE=MyISAM COMMENT='Termin Tabelle';
00944 # --------------------------------------------------------
00945 
00946 <#73>
00947 #
00948 # Tabellenstruktur für Tabelle `dp_keyword`
00949 #
00950 
00951 CREATE TABLE dp_keyword (
00952   ID int(15) NOT NULL auto_increment,
00953   user_ID int(15) NOT NULL default '0',
00954   keyword varchar(20) NOT NULL default '',
00955   PRIMARY KEY  (ID)
00956 ) TYPE=MyISAM COMMENT='Tabelle für Schlagwörter';
00957 # --------------------------------------------------------
00958 
00959 <#74>
00960 #
00961 # Tabellenstruktur für Tabelle `dp_keywords`
00962 #
00963 
00964 CREATE TABLE dp_keywords (
00965   ID int(15) NOT NULL auto_increment,
00966   date_ID int(15) NOT NULL default '0',
00967   keyword_ID int(15) NOT NULL default '0',
00968   PRIMARY KEY  (ID)
00969 ) TYPE=MyISAM COMMENT='Tabelle für die Zuordnung der Schlagwörter';
00970 # --------------------------------------------------------
00971 
00972 <#75>
00973 #
00974 # Tabellenstruktur für Tabelle `dp_neg_dates`
00975 #
00976 
00977 CREATE TABLE dp_neg_dates (
00978   ID int(15) NOT NULL auto_increment,
00979   date_ID int(15) NOT NULL default '0',
00980   user_ID int(15) NOT NULL default '0',
00981   timestamp int(14) default NULL,
00982   PRIMARY KEY  (ID)
00983 ) TYPE=MyISAM COMMENT='Tabelle für die negativen Termine';
00984 # --------------------------------------------------------
00985 
00986 <#76>
00987 #
00988 # Tabellenstruktur für Tabelle `dp_properties`
00989 #
00990 
00991 CREATE TABLE dp_properties (
00992   ID int(15) NOT NULL auto_increment,
00993   user_ID int(15) NOT NULL default '0',
00994   dv_starttime time NOT NULL default '00:00:00',
00995   dv_endtime time NOT NULL default '00:00:00',
00996   PRIMARY KEY  (ID)
00997 ) TYPE=MyISAM COMMENT='Tabelle für UserEinstellungen';
00998 
00999 <#77>
01000 ALTER TABLE xmlvalue ADD FULLTEXT ( tag_value );
01001 
01002 <#78>
01003 UPDATE usr_pref SET value='default' WHERE keyword='skin';
01004 UPDATE usr_pref SET value='blueshadow' WHERE keyword='style';
01005 
01006 <#79>
01007 <?php
01008 //
01009 $q = "SELECT * FROM page_object WHERE content LIKE '%flit%'";
01010 $page_set = $this->db->query($q);
01011 
01012 while ($page_rec = $page_set->fetchRow(DB_FETCHMODE_ASSOC))
01013 {
01014         $content = $page_rec["content"];
01015 
01016         while (ereg("flit\_([0-9]*)", $content, $found))
01017         {
01018                 $new = "il__file_".$found[1];
01019                 $content = ereg_replace($found[0], $new, $content);
01020 //echo "replace ".$found[0]." with $new<br>";
01021         }
01022         $q = "UPDATE page_object SET content = '".addslashes($content)."'".
01023                 " WHERE page_id = '".$page_rec["page_id"]."'".
01024                 " AND parent_type='".$page_rec["parent_type"]."'";
01025         $this->db->query($q);
01026 }
01027 
01028 ?>
01029 
01030 <#80>
01031 ALTER TABLE glossary_term ADD COLUMN
01032   create_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
01033 
01034 ALTER TABLE glossary_term ADD COLUMN
01035   last_update DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
01036 
01037 <#81>
01038 ALTER TABLE lm_data ADD COLUMN
01039   create_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
01040 
01041 ALTER TABLE lm_data ADD COLUMN
01042   last_update DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
01043 
01044 <#82>
01045 UPDATE rbac_operations SET operation='edit_permission' WHERE ops_id='1';
01046 UPDATE rbac_operations SET operation='edit_post' WHERE ops_id='9';
01047 UPDATE rbac_operations SET operation='delete_post' WHERE ops_id='10';
01048 UPDATE rbac_operations SET operation='smtp_mail' WHERE ops_id='11';
01049 UPDATE rbac_operations SET operation='system_message' WHERE ops_id='12';
01050 
01051 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('13', 'create_user', 'create new user account');
01052 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('22', '13');
01053 DELETE FROM rbac_ta WHERE typ_id='25' AND ops_id='5';
01054 
01055 # remove useless write-operation for lngf-object
01056 DELETE FROM rbac_ta WHERE typ_id='28' AND ops_id='4';
01057 
01058 # remove mob-object completely from RBAC system
01059 DELETE FROM rbac_ta WHERE typ_id='18';
01060 
01061 # remove useless create-operation for adm-object
01062 DELETE FROM rbac_ta WHERE typ_id='21' AND ops_id='5';
01063 
01064 # add operations 'create_role' and 'create_rolt'
01065 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('14', 'create_role', 'create new role definition');
01066 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('15', 'create_rolt', 'create new role definition template');
01067 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('23', '14');
01068 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('23', '15');
01069 DELETE FROM rbac_ta WHERE typ_id='27';
01070 DELETE FROM rbac_ta WHERE typ_id='30';
01071 DELETE FROM rbac_ta WHERE typ_id='23' AND ops_id='5';
01072 
01073 <#83>
01074 # add create operations for most object types
01075 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('16', 'create_cat', 'create new category');
01076 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('17', 'create_grp', 'create new group');
01077 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('18', 'create_frm', 'create new forum');
01078 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('19', 'create_crs', 'create new course');
01079 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('20', 'create_lm', 'create new learning module');
01080 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('21', 'create_slm', 'create new SCORM learning module');
01081 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('22', 'create_glo', 'create new glossary');
01082 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('23', 'create_dbk', 'create new digibook');
01083 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('24', 'create_exc', 'create new exercise');
01084 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('25', 'create_file', 'upload new file');
01085 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('26', 'create_fold', 'create new folder');
01086 
01087 # assign create-operations to different object types according to defined rules in objects.xml
01088 # create_cat
01089 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('33', '16');
01090 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '16');
01091 # create grp
01092 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '17');
01093 # create_frm
01094 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '18');
01095 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('15', '18');
01096 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('17', '18');
01097 # create_crs
01098 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '19');
01099 # create_lm
01100 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '20');
01101 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('17', '20');
01102 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('15', '20');
01103 # create_slm
01104 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '21');
01105 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('17', '21');
01106 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('15', '21');
01107 # create_glo
01108 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '22');
01109 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('17', '22');
01110 # create_dbk
01111 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '23');
01112 # create_exc
01113 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('16', '24');
01114 # create_file
01115 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('15', '25');
01116 # create_fold
01117 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('15', '26');
01118 
01119 <#84>
01120 CREATE TABLE map_area (
01121         item_id int(11) NOT NULL default '0',
01122         nr int(11) NOT NULL default '0',
01123         shape VARCHAR(20),
01124         coords VARCHAR(200),
01125         link_type CHAR(3),
01126         title VARCHAR(200),
01127         href VARCHAR(200),
01128         target VARCHAR(50),
01129         type VARCHAR(20),
01130         target_frame VARCHAR(50),
01131         PRIMARY KEY (item_id, nr)
01132 ) TYPE=MyISAM;
01133 
01134 <#85>
01135 DROP TABLE IF EXISTS lo_attribute_idx;
01136 DROP TABLE IF EXISTS lo_attribute_name;
01137 DROP TABLE IF EXISTS lo_attribute_namespace;
01138 DROP TABLE IF EXISTS lo_attribute_value;
01139 DROP TABLE IF EXISTS lo_cdata;
01140 DROP TABLE IF EXISTS lo_comment;
01141 DROP TABLE IF EXISTS lo_element_idx;
01142 DROP TABLE IF EXISTS lo_element_namespace;
01143 DROP TABLE IF EXISTS lo_element_name;
01144 DROP TABLE IF EXISTS lo_entity_reference;
01145 DROP TABLE IF EXISTS lo_node_type;
01146 DROP TABLE IF EXISTS lo_pi_data;
01147 DROP TABLE IF EXISTS lo_pi_target;
01148 DROP TABLE IF EXISTS lo_text;
01149 DROP TABLE IF EXISTS lo_tree;
01150 
01151 <#86>
01152 <?php
01153 // remove LDAP node temporary
01154 
01155 // get LDAP node data
01156 $query = "SELECT ref_id FROM object_reference ".
01157                  "LEFT JOIN object_data ON object_reference.obj_id=object_data.obj_id ".
01158                  "WHERE object_data.type = 'ldap'";
01159 $res = $this->db->query($query);
01160 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
01161 
01162 // check if ldap node was found
01163 if ($row->ref_id > 0)
01164 {
01165         // init tree
01166         $tree = new ilTree(ROOT_FOLDER_ID);
01167 
01168         $ldap_node = $tree->getNodeData($row->ref_id);
01169         
01170         // check if ldap is already deactivated
01171         if ($ldap_node["tree"] > 0)
01172         {
01173                 // remove ldap node from tree
01174                 $tree->deleteTree($ldap_node);
01175         }
01176 }
01177 ?>
01178 
01179 <#87>
01180 <?php
01181 // remove create operation for file object
01182 $query = "SELECT obj_id FROM object_data ".
01183                  "WHERE type='typ' AND title='file'";
01184 $res = $this->db->query($query);
01185 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
01186 
01187 $query = "DELETE FROM rbac_ta WHERE typ_id='".$row->obj_id."'";
01188 $this->db->query($query);
01189 
01190 // init rbac
01191 $rbacadmin = new ilRbacAdmin();
01192 $rbacreview = new ilRbacReview();
01193 // init tree
01194 $tree = new ilTree(ROOT_FOLDER_ID);
01195 // init object definition
01196 $ilObjDef = new ilObjectDefinition();
01197 $ilObjDef->startParsing();
01198 
01199 // migration of rbac_pa
01200 
01201 // first clean up rbac_pa. remove empty entries
01202 $query = "DELETE FROM rbac_pa WHERE ops_id='a:0:{}'";
01203 $this->db->query($query);
01204 
01205 // set new object create permissions
01206 $query = "SELECT rbac_pa.ops_id, rbac_pa.rol_id, rbac_pa.obj_id as ref_id, object_data.type FROM rbac_pa ".
01207                  "LEFT JOIN object_reference ON rbac_pa.obj_id=object_reference.ref_id ".
01208                  "LEFT JOIN object_data ON object_reference.obj_id=object_data.obj_id";
01209 $res = $this->db->query($query);
01210 
01211 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01212 {
01213         $arr_pa_entries[] = array(
01214                                                                 "ref_id"        =>      $row->ref_id,
01215                                                                 "rol_id"        =>      $row->rol_id,
01216                                                                 "type"          =>      $row->type,
01217                                                                 "operations"=>  unserialize($row->ops_id)
01218                                                         );
01219 }
01220 
01221 foreach ($arr_pa_entries as $key => $pa_entry)
01222 {
01223         // detect create permission
01224         $pa_entry["create"] = array_search("5",$pa_entry["operations"]);
01225 
01226         // remove create permission and remember pa_entries with create permission
01227         if ($pa_entry["create"] !== false)
01228         {
01229                 unset($pa_entry["operations"][$pa_entry["create"]]);
01230         }
01231 
01232         switch ($pa_entry)
01233         {
01234                 case "usrf":
01235                         if (in_array("4",$pa_entry["operations"]))
01236                         {
01237                                 $pa_entry["operations"][] = "13";
01238                         }
01239                         break;
01240 
01241                 case "grp":
01242                         if ($pa_entry["create"] !== false)
01243                         {
01244                                 $pa_entry["operations"][] = "18";
01245                                 $pa_entry["operations"][] = "20";
01246                                 $pa_entry["operations"][] = "21";
01247                         }
01248 
01249                         if (in_array("2",$pa_entry["operations"]) and in_array("3",$pa_entry["operations"]))
01250                         {
01251                                 $pa_entry["operations"][] = "25";
01252                                 $pa_entry["operations"][] = "26";
01253                         }
01254                         break;
01255 
01256                 case "cat":
01257                         if ($pa_entry["create"] !== false)
01258                         {
01259                                 $pa_entry["operations"][] = "16";
01260                                 $pa_entry["operations"][] = "17";
01261                                 $pa_entry["operations"][] = "18";
01262                                 $pa_entry["operations"][] = "19";
01263                                 $pa_entry["operations"][] = "20";
01264                                 $pa_entry["operations"][] = "21";
01265                                 $pa_entry["operations"][] = "22";
01266                                 $pa_entry["operations"][] = "23";
01267                                 $pa_entry["operations"][] = "24";
01268                         }
01269                         break;
01270 
01271                 case "crs":
01272                         if ($pa_entry["create"] !== false)
01273                         {
01274                                 $pa_entry["operations"][] = "18";
01275                                 $pa_entry["operations"][] = "20";
01276                                 $pa_entry["operations"][] = "21";
01277                                 $pa_entry["operations"][] = "22";
01278                         }
01279                         break;
01280         }
01281 
01282         // remove multiple values
01283         $pa_entry["operations"] = array_unique($pa_entry["operations"]);
01284 
01285         $rbacadmin->revokePermission($pa_entry["ref_id"],$pa_entry["rol_id"]);
01286         $rbacadmin->grantPermission($pa_entry["rol_id"],$pa_entry["operations"],$pa_entry["ref_id"]);
01287 }
01288 
01289 // migration of rbac_templates and rbac_ta
01290 
01291 // build array with all rbac object types
01292 $query = "SELECT ta.typ_id,obj.title,ops.ops_id,ops.operation FROM rbac_ta AS ta ".
01293                  "LEFT JOIN object_data AS obj ON obj.obj_id=ta.typ_id ".
01294                  "LEFT JOIN rbac_operations AS ops ON ops.ops_id=ta.ops_id";
01295 $res = $this->db->query($query);
01296 
01297 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01298 {
01299         $rbac_objects[$row->typ_id] = array("obj_id"    => $row->typ_id,
01300                                                                             "type"              => $row->title
01301                                                                                 );
01302 
01303         $rbac_operations[$row->typ_id][$row->ops_id] = $row->ops_id;
01304 }
01305 
01306 foreach ($rbac_objects as $key => $obj_data)
01307 {
01308         $rbac_objects[$key]["ops"] = $rbac_operations[$key];
01309 }
01310 
01311 // get all roles
01312 $query = "SELECT * FROM rbac_fa";
01313 $res = $this->db->query($query);
01314 
01315 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01316 {
01317         $arr_roles[] = array(
01318                                                 "rol_id"        =>      $row->rol_id,
01319                                                 "rolf_id"       =>      $row->parent,
01320                                                 "assign"        =>      $row->assign
01321                                                 );
01322 }
01323 
01324 foreach ($arr_roles as $role)
01325 {
01326         // work on a copy of rbac_objects
01327         $rbac_objects_temp = $rbac_objects;
01328 
01329         // for local roles display only the permissions settings for allowed subobjects
01330         if ($role["rolf_id"] != ROLE_FOLDER_ID)
01331         {
01332                 // first get object in question (parent of role folder object)
01333                 $parent_data = $tree->getParentNodeData($role["rolf_id"]);
01334                 // get allowed subobject of object
01335                 $subobj_data = $ilObjDef->getSubObjects($parent_data["type"]);
01336 
01337                 // remove not allowed object types from array but keep the type definition of object itself
01338                 foreach ($rbac_objects_temp as $key => $obj_data)
01339                 {
01340                         if (!$subobj_data[$obj_data["type"]] and $parent_data["type"] != $obj_data["type"])
01341                         {
01342                                 unset($rbac_objects_temp[$key]);
01343                         }
01344                 }
01345         } // end if local roles
01346         
01347         foreach ($rbac_objects_temp as $key => $obj_data)
01348         {
01349                 $arr_selected = $rbacreview->getOperationsOfRole($role["rol_id"], $obj_data["type"], $role["rolf_id"]);
01350 
01351                 // detect create permission
01352                 $obj_data["create"] = array_search("5",$arr_selected);
01353 
01354                 // remove create permission and remember pa_entries with create permission
01355                 if ($obj_data["create"] !== false)
01356                 {
01357                         unset($arr_selected[$obj_data["create"]]);
01358                 }
01359 
01360                 if ($obj_data["create"] !== false)
01361                 {
01362                         switch ($obj_data["type"])
01363                         {
01364                                 case "usrf":
01365                                         $arr_selected[] = "13";
01366                                         break;
01367 
01368                                 case "grp":
01369                                         $arr_selected[] = "18";
01370                                         $arr_selected[] = "20";
01371                                         $arr_selected[] = "21";
01372                                         $arr_selected[] = "25";
01373                                         $arr_selected[] = "26";
01374 
01375                                         break;
01376                 
01377                                 case "cat":
01378                                         $arr_selected[] = "16";
01379                                         $arr_selected[] = "17";
01380                                         $arr_selected[] = "18";
01381                                         $arr_selected[] = "19";
01382                                         $arr_selected[] = "20";
01383                                         $arr_selected[] = "21";
01384                                         $arr_selected[] = "22";
01385                                         $arr_selected[] = "23";
01386                                         $arr_selected[] = "24";
01387                                         break;
01388 
01389                                 case "crs":
01390                                         $arr_selected[] = "18";
01391                                         $arr_selected[] = "20";
01392                                         $arr_selected[] = "21";
01393                                         $arr_selected[] = "22";
01394                                         break;
01395                         }
01396                 }
01397 
01398                 // remove multiple values
01399                 $arr_selected = array_unique($arr_selected);
01400 
01401                 // sets new template permissions
01402                 if (!empty($arr_selected))
01403                 {
01404                         // delete all template entries for each role
01405                         $rbacadmin->deleteRolePermission($role["rol_id"], $role["rolf_id"],$obj_data["type"]);
01406                         $rbacadmin->setRolePermission($role["rol_id"], $obj_data["type"], $arr_selected, $role["rolf_id"]);
01407                 }
01408         }
01409 }
01410 
01411 // remove old create operation
01412 $query = "DELETE FROM rbac_ta WHERE ops_id=5";
01413 $this->db->query($query);
01414 $query = "DELETE FROM rbac_operations WHERE ops_id=5";
01415 $this->db->query($query);
01416 // clean up tree
01417 $query = "DELETE FROM tree WHERE parent=0 AND tree <> 1";
01418 $this->db->query($query);
01419 ?>
01420 
01421 <#88>
01422 DELETE FROM usr_session;
01423 
01424 <#89>
01425 ALTER TABLE rbac_pa CHANGE obj_id ref_id INT(11) DEFAULT '0' NOT NULL;
01426 DELETE FROM usr_session;
01427 
01428 <#90>
01429 UPDATE settings SET value = '3.0.0_beta3' WHERE keyword = 'ilias_version' LIMIT 1;
01430 
01431 <#91>
01432 DROP TABLE IF EXISTS cal_appointment;
01433 DROP TABLE IF EXISTS cal_appointmentrepeats;
01434 DROP TABLE IF EXISTS cal_appointmentrepeatsnot;
01435 DROP TABLE IF EXISTS cal_category;
01436 DROP TABLE IF EXISTS cal_priority;
01437 DROP TABLE IF EXISTS cal_user_group;
01438 DROP TABLE IF EXISTS dummy_groups;
01439 
01440 <#92>
01441 # add operations 'assign_user' and 'assign_role'
01442 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('40', 'edit_userassignment', 'change userassignment of roles');
01443 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('41', 'edit_roleassignment', 'change roleassignments of user accounts');
01444 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('23', '40');
01445 INSERT INTO rbac_ta (typ_id,ops_id) VALUES ('22', '41');
01446 
01447 <#93>
01448 ALTER TABLE mail_options ADD incoming_type TINYINT( 3 );
01449 
01450 <#94>
01451 # add operations 'create_tst' and 'create_qpl' for test objects and question pools
01452 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('27', 'create_tst', 'create new test');
01453 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('28', 'create_qpl', 'create new question pool');
01454 
01455 <#95>
01456 <?php
01457 
01458 // insert test definition in object_data
01459 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
01460                  "VALUES ('typ', 'tst', 'Test object', -1, now(), now())";
01461 $this->db->query($query);
01462 
01463 // fetch type id
01464 $query = "SELECT LAST_INSERT_ID()";
01465 $res = $this->db->query($query);
01466 $row = $res->fetchRow();
01467 $typ_id = $row[0];
01468 
01469 // add operation assignment to test object definition
01470 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
01471 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
01472 $this->db->query($query);
01473 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
01474 $this->db->query($query);
01475 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
01476 $this->db->query($query);
01477 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
01478 $this->db->query($query);
01479 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
01480 $this->db->query($query);
01481 ?>
01482 
01483 <#96>
01484 <?php
01485 
01486 // insert question pool definition in object_data
01487 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
01488                  "VALUES ('typ', 'qpl', 'Question pool object', -1, now(), now())";
01489 $this->db->query($query);
01490 
01491 // fetch type id
01492 $query = "SELECT LAST_INSERT_ID()";
01493 $res = $this->db->query($query);
01494 $row = $res->fetchRow();
01495 $typ_id = $row[0];
01496 
01497 // add operation assignment to question pool object definition
01498 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
01499 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
01500 $this->db->query($query);
01501 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
01502 $this->db->query($query);
01503 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
01504 $this->db->query($query);
01505 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
01506 $this->db->query($query);
01507 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
01508 $this->db->query($query);
01509 ?>
01510 
01511 <#97>
01512 <?php
01513 
01514 // get category type id
01515 $query = "SELECT obj_id FROM object_data WHERE type='typ' and title='cat'";
01516 $res = $this->db->query($query);
01517 $row = $res->fetchRow();
01518 $typ_id = $row[0];
01519 
01520 // add create_tst and create_qpl operations to category type
01521 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','27')";
01522 $this->db->query($query);
01523 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','28')";
01524 $this->db->query($query);
01525 ?>
01526 
01527 <#98>
01528 
01529 #
01530 # Table structure for table 'qpl_answers'
01531 #
01532 
01533 DROP TABLE IF EXISTS `qpl_answers`;
01534 CREATE TABLE `qpl_answers` (
01535   `answer_id` int(10) unsigned NOT NULL auto_increment,
01536   `question_fi` int(10) unsigned NOT NULL default '0',
01537   `answertext` char(100) NOT NULL default '',
01538   `points` double NOT NULL default '0',
01539   `order` int(10) unsigned NOT NULL default '0',
01540   `correctness` enum('0','1') NOT NULL default '0',
01541   `solution_order` int(10) unsigned NOT NULL default '0',
01542   `matchingtext` char(100) default NULL,
01543   `matching_order` int(10) unsigned default NULL,
01544   `gap_id` int(10) unsigned NOT NULL default '0',
01545   `TIMESTAMP` timestamp(14) NOT NULL,
01546   PRIMARY KEY  (`answer_id`),
01547   UNIQUE KEY `answer_id` (`answer_id`),
01548   KEY `answer_id_2` (`answer_id`)
01549 ) TYPE=MyISAM;
01550 
01551 <#99>
01552 
01553 #
01554 # Table structure for table 'qpl_question_type'
01555 #
01556 
01557 DROP TABLE IF EXISTS `qpl_question_type`;
01558 CREATE TABLE `qpl_question_type` (
01559   `question_type_id` int(3) unsigned NOT NULL auto_increment,
01560   `type_tag` char(25) NOT NULL default '',
01561   PRIMARY KEY  (`question_type_id`),
01562   UNIQUE KEY `question_type_id` (`question_type_id`),
01563   KEY `question_type_id_2` (`question_type_id`)
01564 ) TYPE=MyISAM;
01565 
01566 INSERT INTO `qpl_question_type` (`question_type_id`, `type_tag`) VALUES("1", "qt_multiple_choice_sr");
01567 INSERT INTO `qpl_question_type` (`question_type_id`, `type_tag`) VALUES("2", "qt_multiple_choice_mr");
01568 INSERT INTO `qpl_question_type` (`question_type_id`, `type_tag`) VALUES("3", "qt_cloze");
01569 INSERT INTO `qpl_question_type` (`question_type_id`, `type_tag`) VALUES("4", "qt_matching");
01570 INSERT INTO `qpl_question_type` (`question_type_id`, `type_tag`) VALUES("5", "qt_ordering");
01571 
01572 <#100>
01573 
01574 #
01575 # Table structure for table 'qpl_questions'
01576 #
01577 
01578 DROP TABLE IF EXISTS `qpl_questions`;
01579 CREATE TABLE `qpl_questions` (
01580   `question_id` int(11) NOT NULL default '0',
01581   `question_type_fi` int(10) unsigned NOT NULL default '0',
01582   `ref_fi` int(10) unsigned NOT NULL default '0',
01583   `title` varchar(100) NOT NULL default '',
01584   `comment` text,
01585   `author` varchar(50) NOT NULL default '',
01586   `owner` int(11) NOT NULL default '0',
01587   `question_text` text NOT NULL,
01588   `points` double default NULL,
01589   `start_tag` varchar(5) default NULL,
01590   `end_tag` varchar(5) default NULL,
01591   `cloze_type` enum('0','1') default NULL,
01592   `choice_response` enum('0','1') default NULL,
01593   `materials` text,
01594   `created` varchar(14) NOT NULL default '',
01595   `TIMESTAMP` timestamp(14) NOT NULL,
01596   PRIMARY KEY  (`question_id`)
01597 ) TYPE=MyISAM;
01598 
01599 <#101>
01600 <?php
01601 
01602 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
01603                 "VALUES ('typ', 'chat', 'Chat object', -1, now(), now())";
01604 $this->db->query($query);
01605 
01606 $query = "SELECT LAST_INSERT_ID() as id";
01607 $res = $this->db->query($query);
01608 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
01609 
01610 // INSERT NEW OPERATIONS
01611 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','1')";
01612 $this->db->query($query);
01613 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','2')";
01614 $this->db->query($query);
01615 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','3')";
01616 $this->db->query($query);
01617 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','4')";
01618 $this->db->query($query);
01619 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','6')";
01620 $this->db->query($query);
01621 
01622 
01623 // ADD NEW OPERATION create_chat
01624 $query = "INSERT INTO rbac_operations VALUES('29','create_chat','create chat object')";
01625 $this->db->query($query);
01626 
01627 // ADD CREATE PERMISSION FOR TYPE 'cat','grp'
01628 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND ( title = 'cat' OR title = 'grp') ";
01629 $res = $this->db->query($query);
01630 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01631 {
01632         $query = "INSERT INTO rbac_ta VALUES('".$row->obj_id."','29')";
01633         $this->db->query($query);
01634 }
01635 ?>
01636 <#102>
01637 <?php
01638 
01639 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
01640                 "VALUES ('typ', 'chac', 'Chat server config object', -1, now(), now())";
01641 $this->db->query($query);
01642 
01643 $query = "SELECT LAST_INSERT_ID() as id";
01644 $res = $this->db->query($query);
01645 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
01646 
01647 // INSERT NEW OPERATIONS
01648 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','1')";
01649 $this->db->query($query);
01650 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','2')";
01651 $this->db->query($query);
01652 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','3')";
01653 $this->db->query($query);
01654 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','4')";
01655 $this->db->query($query);
01656 
01657 // ADD NODE IN SYSTEM SETTINGS FOLDER
01658 // create object data entry
01659 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
01660                 "VALUES ('chac', 'Chat server settings', 'Configure chat server settings here', -1, now(), now())";
01661 $this->db->query($query);
01662 
01663 $query = "SELECT LAST_INSERT_ID() as id";
01664 $res = $this->db->query($query);
01665 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
01666 
01667 // create object reference entry
01668 $query = "INSERT INTO object_reference (obj_id) VALUES('".$row->id."')";
01669 $res = $this->db->query($query);
01670 
01671 $query = "SELECT LAST_INSERT_ID() as id";
01672 $res = $this->db->query($query);
01673 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
01674 
01675 // put in tree
01676 $tree = new ilTree(ROOT_FOLDER_ID);
01677 $tree->insertNode($row->id,SYSTEM_FOLDER_ID);
01678 ?>
01679 
01680 <#103>
01681 CREATE TABLE chat_rooms (
01682 room_id INT( 11 ) NOT NULL AUTO_INCREMENT ,
01683 chat_id INT( 11 ) NOT NULL ,
01684 title VARCHAR( 64 ) ,
01685 owner INT( 11 ) NOT NULL ,
01686 PRIMARY KEY ( room_id )
01687 );
01688 CREATE TABLE chat_invitations (
01689 room_id INT( 11 ) NOT NULL ,
01690 guest_id INT( 11 ) NOT NULL ,
01691 PRIMARY KEY ( room_id , guest_id )
01692 );
01693 CREATE TABLE chat_user (
01694 usr_id INT( 11 ) NOT NULL ,
01695 room_id INT( 11 ) NOT NULL ,
01696 last_conn_timestamp TIMESTAMP NOT NULL ,
01697 PRIMARY KEY ( usr_id , room_id )
01698 );
01699 <#104>
01700 ALTER TABLE frm_posts ADD notify TINYINT( 1 ) NOT NULL ;
01701 <#105>
01702 UPDATE settings SET value = '3.0.0_beta4 2004-02-18' WHERE keyword = 'ilias_version' LIMIT 1;
01703 <#106>
01704 CREATE TABLE `tst_mark` (
01705   `mark_id` int(10) unsigned NOT NULL auto_increment,
01706   `test_fi` int(10) unsigned NOT NULL default '0',
01707   `short_name` varchar(15) NOT NULL default '',
01708   `official_name` varchar(50) NOT NULL default '',
01709   `minimum_level` double NOT NULL default '0',
01710   `TIMESTAMP` timestamp(14) NOT NULL,
01711   PRIMARY KEY  (`mark_id`),
01712   UNIQUE KEY `mark_id` (`mark_id`),
01713   KEY `mark_id_2` (`mark_id`)
01714 ) TYPE=MyISAM COMMENT='Mark steps of mark schemas';
01715 <#107>
01716 CREATE TABLE `tst_test_question` (
01717   `test_question_id` int(11) NOT NULL auto_increment,
01718   `test_fi` int(11) NOT NULL default '0',
01719   `question_fi` int(11) NOT NULL default '0',
01720   `sequence` int(10) unsigned NOT NULL default '0',
01721   `TIMESTAMP` timestamp(14) NOT NULL,
01722   PRIMARY KEY  (`test_question_id`)
01723 ) TYPE=MyISAM COMMENT='Relation table for questions in tests';
01724 <#108>
01725 CREATE TABLE `tst_test_type` (
01726   `test_type_id` int(10) unsigned NOT NULL auto_increment,
01727   `type_tag` varchar(50) NOT NULL default '',
01728   PRIMARY KEY  (`test_type_id`),
01729   UNIQUE KEY `test_type_id` (`test_type_id`),
01730   KEY `test_type_id_2` (`test_type_id`)
01731 ) TYPE=MyISAM COMMENT='ILIAS 3 Assessment Test types';
01732 
01733 INSERT INTO `tst_test_type` (`test_type_id`, `type_tag`) VALUES (1, 'tt_assessment');
01734 INSERT INTO `tst_test_type` (`test_type_id`, `type_tag`) VALUES (2, 'tt_self_assessment');
01735 INSERT INTO `tst_test_type` (`test_type_id`, `type_tag`) VALUES (3, 'tt_navigation_controlling');
01736 <#109>
01737 CREATE TABLE `tst_tests` (
01738   `test_id` int(10) unsigned NOT NULL auto_increment,
01739   `ref_fi` int(11) NOT NULL default '0',
01740   `author` varchar(50) NOT NULL default '',
01741   `test_type_fi` int(10) unsigned NOT NULL default '0',
01742   `introduction` text,
01743   `sequence_settings` tinyint(3) unsigned NOT NULL default '0',
01744   `score_reporting` tinyint(3) unsigned NOT NULL default '0',
01745   `nr_of_tries` tinyint(3) unsigned NOT NULL default '0',
01746   `processing_time` int(10) unsigned NOT NULL default '0',
01747   `starting_time` varchar(14) default NULL,
01748   `created` varchar(14) default NULL,
01749   `TIMESTAMP` timestamp(14) NOT NULL,
01750   PRIMARY KEY  (`test_id`),
01751   UNIQUE KEY `test_id` (`test_id`),
01752   KEY `test_id_2` (`test_id`)
01753 ) TYPE=MyISAM COMMENT='Tests in ILIAS Assessment';
01754 
01755 <#110>
01756 ALTER  TABLE  `tst_mark`  ADD  `passed` ENUM(  '0',  '1'  ) DEFAULT  '0' NOT  NULL  AFTER  `minimum_level` ;
01757 
01758 <#111>
01759 ALTER  TABLE  `qpl_questions`  ADD  `matching_type` ENUM(  '0',  '1'  )  AFTER  `end_tag` ;
01760 
01761 <#112>
01762 INSERT INTO `qpl_question_type` (`question_type_id`, `type_tag`) VALUES("6", "qt_imagemap");
01763 
01764 <#113>
01765 ALTER  TABLE  `qpl_questions`  ADD  `imagemap_file` VARCHAR( 100  )  AFTER  `materials` , ADD  `image_file` VARCHAR( 100  )  AFTER  `imagemap_file` ;
01766 
01767 <#114>
01768 
01769 <#115>
01770 #
01771 # Table structure for table 'qpl_answers'
01772 #
01773 
01774 DROP TABLE IF EXISTS `qpl_answers`;
01775 CREATE TABLE `qpl_answers` (
01776   `answer_id` int(10) unsigned NOT NULL auto_increment,
01777   `question_fi` int(10) unsigned NOT NULL default '0',
01778   `answertext` char(100) NOT NULL default '',
01779   `points` double NOT NULL default '0',
01780   `aorder` int(10) unsigned NOT NULL default '0',
01781   `correctness` enum('0','1') NOT NULL default '0',
01782   `solution_order` int(10) unsigned NOT NULL default '0',
01783   `matchingtext` char(100) default NULL,
01784   `matching_order` int(10) unsigned default NULL,
01785   `gap_id` int(10) unsigned NOT NULL default '0',
01786   `TIMESTAMP` timestamp(14) NOT NULL,
01787   PRIMARY KEY  (`answer_id`),
01788   UNIQUE KEY `answer_id` (`answer_id`),
01789   KEY `answer_id_2` (`answer_id`)
01790 ) TYPE=MyISAM;
01791 
01792 <#116>
01793 ALTER  TABLE  `qpl_answers`  ADD  `coords` TEXT AFTER  `gap_id` , ADD  `area` VARCHAR( 20  )  AFTER  `coords` ;
01794 
01795 <#117>
01796 CREATE TABLE `chat_room_messages` (
01797 `entry_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
01798 `chat_id` INT( 11 ) NOT NULL ,
01799 `room_id` INT( 11 ) NOT NULL ,
01800 `message` TEXT,
01801 `commit_timestamp` TIMESTAMP NOT NULL ,
01802 PRIMARY KEY ( `entry_id` )
01803 );
01804 <#118>
01805 ALTER TABLE chat_user ADD chat_id INT( 11 ) NOT NULL AFTER usr_id ;
01806 
01807 <#119>
01808 ALTER TABLE usr_data ADD i2passwd VARCHAR(32) NOT NULL DEFAULT '';
01809 
01810 <#120>
01811 CREATE TABLE `xml_attribute_idx` (
01812   `node_id` int(10) unsigned NOT NULL default '0',
01813   `attribute_id` smallint(5) unsigned NOT NULL default '0',
01814   `value_id` smallint(5) unsigned NOT NULL default '0',
01815   KEY `node_id` (`node_id`)
01816 ) TYPE=MyISAM;
01817 
01818 # --------------------------------------------------------
01819 
01820 CREATE TABLE `xml_attribute_name` (
01821   `attribute_id` smallint(5) unsigned NOT NULL auto_increment,
01822   `attribute` char(32) NOT NULL default '',
01823   PRIMARY KEY  (`attribute_id`),
01824   UNIQUE KEY `attribute` (`attribute`)
01825 ) TYPE=MyISAM ;
01826 
01827 # --------------------------------------------------------
01828 
01829 CREATE TABLE `xml_attribute_namespace` (
01830   `attribute_id` smallint(5) unsigned NOT NULL auto_increment,
01831   `node_id` int(10) unsigned NOT NULL default '0',
01832   `namespace` char(64) NOT NULL default '',
01833   PRIMARY KEY  (`attribute_id`)
01834 ) TYPE=MyISAM;
01835 
01836 # --------------------------------------------------------
01837 
01838 CREATE TABLE `xml_attribute_value` (
01839   `value_id` smallint(5) unsigned NOT NULL auto_increment,
01840   `value` char(32) NOT NULL default '0',
01841   PRIMARY KEY  (`value_id`)
01842 ) TYPE=MyISAM ;
01843 
01844 # --------------------------------------------------------
01845 
01846 CREATE TABLE `xml_cdata` (
01847   `node_id` int(10) unsigned NOT NULL auto_increment,
01848   `cdata` text NOT NULL,
01849   PRIMARY KEY  (`node_id`)
01850 ) TYPE=MyISAM ;
01851 
01852 # --------------------------------------------------------
01853 
01854 CREATE TABLE `xml_comment` (
01855   `node_id` int(10) unsigned NOT NULL auto_increment,
01856   `comment` text NOT NULL,
01857   PRIMARY KEY  (`node_id`)
01858 ) TYPE=MyISAM ;
01859 
01860 # --------------------------------------------------------
01861 
01862 CREATE TABLE `xml_element_idx` (
01863   `node_id` int(10) unsigned NOT NULL default '0',
01864   `element_id` smallint(5) unsigned NOT NULL default '0',
01865   PRIMARY KEY  (`node_id`)
01866 ) TYPE=MyISAM;
01867 
01868 # --------------------------------------------------------
01869 
01870 CREATE TABLE `xml_element_name` (
01871   `element_id` smallint(5) unsigned NOT NULL auto_increment,
01872   `element` char(32) NOT NULL default '',
01873   PRIMARY KEY  (`element_id`),
01874   UNIQUE KEY `element` (`element`)
01875 ) TYPE=MyISAM ;
01876 
01877 # --------------------------------------------------------
01878 
01879 CREATE TABLE `xml_element_namespace` (
01880   `element_id` smallint(5) unsigned NOT NULL auto_increment,
01881   `node_id` int(10) unsigned NOT NULL default '0',
01882   `namespace` char(64) NOT NULL default '',
01883   PRIMARY KEY  (`element_id`)
01884 ) TYPE=MyISAM ;
01885 
01886 # --------------------------------------------------------
01887 
01888 CREATE TABLE `xml_entity_reference` (
01889   `element_id` smallint(5) unsigned NOT NULL auto_increment,
01890   `node_id` int(10) unsigned NOT NULL default '0',
01891   `entity_reference` char(128) NOT NULL default '',
01892   PRIMARY KEY  (`element_id`)
01893 ) TYPE=MyISAM;
01894 
01895 # --------------------------------------------------------
01896 
01897 CREATE TABLE `xml_node_type` (
01898   `node_type_id` int(11) NOT NULL auto_increment,
01899   `description` varchar(50) default NULL,
01900   `lft_delimiter` varchar(10) default NULL,
01901   `rgt_delimiter` varchar(10) default NULL,
01902   PRIMARY KEY  (`node_type_id`)
01903 ) TYPE=MyISAM;
01904 
01905 INSERT INTO `xml_node_type` (`node_type_id`, `description`, `lft_delimiter`, `rgt_delimiter`) VALUES (1, 'ELEMENT_NODE', '<', '>'),
01906 (2, 'ATTRIBUTE_NODE(not used)', '"', '"'),
01907 (3, 'TEXT_NODE', NULL, NULL),
01908 (5, 'ENTITY_REF_NODE', '&', ';'),
01909 (4, 'CDATA_SECTION_NODE', '<![CDATA[', ']]>'),
01910 (8, 'COMMENT_NODE', '<!--', '-->'),
01911 (9, 'DOCUMENT_NODE', NULL, NULL),
01912 (10, 'DOCUMENT_TYPE_NODE', NULL, NULL),
01913 (6, 'ENTITY_NODE', '&', ';');
01914 
01915 # --------------------------------------------------------
01916 
01917 CREATE TABLE `xml_object` (
01918   `ID` int(11) NOT NULL auto_increment,
01919   `version` varchar(5) NOT NULL default '',
01920   `encoding` varchar(40) default NULL,
01921   `charset` varchar(40) default NULL,
01922   `TIMESTAMP` timestamp(14) NOT NULL,
01923   PRIMARY KEY  (`ID`)
01924 ) TYPE=MyISAM COMMENT='Master Table for XML objects';
01925 
01926 # --------------------------------------------------------
01927 
01928 CREATE TABLE `xml_pi_data` (
01929   `leaf_id` int(10) unsigned NOT NULL auto_increment,
01930   `node_id` int(10) unsigned NOT NULL default '0',
01931   `leaf_text` text NOT NULL,
01932   PRIMARY KEY  (`leaf_id`)
01933 ) TYPE=MyISAM ;
01934 
01935 # --------------------------------------------------------
01936 
01937 CREATE TABLE `xml_pi_target` (
01938   `leaf_id` int(10) unsigned NOT NULL auto_increment,
01939   `node_id` int(10) unsigned NOT NULL default '0',
01940   `leaf_text` text NOT NULL,
01941   PRIMARY KEY  (`leaf_id`)
01942 ) TYPE=MyISAM;
01943 
01944 # --------------------------------------------------------
01945 
01946 CREATE TABLE `xml_text` (
01947   `node_id` int(10) unsigned NOT NULL default '0',
01948   `textnode` text NOT NULL,
01949   PRIMARY KEY  (`node_id`),
01950   FULLTEXT KEY `textnode` (`textnode`)
01951 ) TYPE=MyISAM;
01952 
01953 # --------------------------------------------------------
01954 
01955 CREATE TABLE `xml_tree` (
01956   `node_id` int(10) unsigned NOT NULL auto_increment,
01957   `xml_id` mediumint(8) unsigned NOT NULL default '0',
01958   `parent_node_id` int(10) unsigned NOT NULL default '0',
01959   `lft` smallint(5) unsigned NOT NULL default '0',
01960   `rgt` smallint(5) unsigned NOT NULL default '0',
01961   `node_type_id` tinyint(3) unsigned NOT NULL default '0',
01962   `depth` smallint(5) unsigned NOT NULL default '0',
01963   `prev_sibling_node_id` int(10) unsigned NOT NULL default '0',
01964   `next_sibling_node_id` int(10) unsigned NOT NULL default '0',
01965   `first_child_node_id` int(10) unsigned NOT NULL default '0',
01966   `struct` tinyint(3) unsigned NOT NULL default '0',
01967   PRIMARY KEY  (`node_id`),
01968   KEY `xml_id` (`xml_id`)
01969 ) TYPE=MyISAM;
01970 
01971 <#121>
01972 ALTER TABLE chat_user DROP PRIMARY KEY;
01973 ALTER TABLE chat_user ADD PRIMARY KEY(usr_id,chat_id,room_id);
01974 
01975 <#122>
01976 <?php
01977 // register new object type 'recf' for RecoveryFolder
01978 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
01979                 "VALUES ('typ', 'recf', 'RecoveryFolder object', -1, now(), now())";
01980 $this->db->query($query);
01981 
01982 // ADD NODE IN SYSTEM SETTINGS FOLDER
01983 // create object data entry
01984 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
01985                 "VALUES ('recf', '__Restored Objects', 'Contains objects restored by recovery tool', -1, now(), now())";
01986 $this->db->query($query);
01987 
01988 $query = "SELECT LAST_INSERT_ID() as id";
01989 $res = $this->db->query($query);
01990 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
01991 
01992 // create object reference entry
01993 $query = "INSERT INTO object_reference (obj_id) VALUES('".$row->id."')";
01994 $res = $this->db->query($query);
01995 
01996 $query = "SELECT LAST_INSERT_ID() as id";
01997 $res = $this->db->query($query);
01998 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
01999 
02000 // put in tree
02001 $tree = new ilTree(ROOT_FOLDER_ID);
02002 $tree->insertNode($row->id,SYSTEM_FOLDER_ID);
02003 
02004 // register RECOVERY_FOLDER_ID in table settings
02005 $query = "INSERT INTO settings (keyword,value) VALUES('recovery_folder_id','".$row->id."')";
02006 $res = $this->db->query($query);
02007 ?>
02008 
02009 <#123>
02010 CREATE TABLE `tst_solutions` (
02011   `solution_id` int(10) unsigned NOT NULL auto_increment,
02012   `user_fi` int(10) unsigned NOT NULL default '0',
02013   `test_fi` int(10) unsigned NOT NULL default '0',
02014   `question_fi` int(10) unsigned NOT NULL default '0',
02015   `value1` varchar(50) default NULL,
02016   `value2` varchar(50) default NULL,
02017   `TIMESTAMP` timestamp(14) NOT NULL,
02018   PRIMARY KEY  (`solution_id`),
02019   UNIQUE KEY `solution_id` (`solution_id`),
02020   KEY `solution_id_2` (`solution_id`)
02021 ) TYPE=MyISAM COMMENT='Test and Assessment solutions';
02022 
02023 <#124>
02024 ALTER  TABLE  `tst_solutions`  ADD  `postponed` ENUM(  '0',  '1'  ) DEFAULT  '0' NOT  NULL  AFTER  `value2` ;
02025 
02026 <#125>
02027 CREATE TABLE `tst_active` (
02028   `active_id` int(10) unsigned NOT NULL auto_increment,
02029   `user_fi` int(10) unsigned NOT NULL default '0',
02030   `test_fi` int(10) unsigned NOT NULL default '0',
02031   `sequence` text NOT NULL,
02032   `lastindex` tinyint(4) NOT NULL default '1',
02033   `tries` int(11) NOT NULL default '0',
02034   `TIMESTAMP` timestamp(14) NOT NULL,
02035   PRIMARY KEY  (`active_id`),
02036   UNIQUE KEY `active_id` (`active_id`),
02037   KEY `active_id_2` (`active_id`)
02038 ) TYPE=MyISAM ;
02039 
02040 <#126>
02041 ALTER  TABLE  `tst_solutions`  DROP  `postponed` ;
02042 
02043 <#127>
02044 ALTER  TABLE  `tst_active`  ADD  `postponed` text AFTER  `sequence` ;
02045 
02046 <#128>
02047 UPDATE settings SET value = '3.0.0_beta5 2004-03-09' WHERE keyword = 'ilias_version' LIMIT 1;
02048 
02049 <#129>
02050 CREATE TABLE `qpl_question_material` (
02051   `material_id` int(11) NOT NULL auto_increment,
02052   `question_id` int(11) NOT NULL default '0',
02053   `materials` text,
02054   UNIQUE KEY `material_id` (`material_id`)
02055 ) TYPE=MyISAM;
02056 
02057 <#130>
02058 CREATE  TABLE  `tst_times` (
02059 `times_id` INT NOT  NULL  AUTO_INCREMENT ,
02060 `active_fi` INT NOT  NULL ,
02061 `started` DATETIME NOT  NULL ,
02062 `finished` DATETIME NOT  NULL ,
02063 `TIMESTAMP` TIMESTAMP NOT  NULL ,
02064 PRIMARY  KEY (  `times_id`  )
02065 ) COMMENT  =  'Editing times of an assessment test';
02066 
02067 <#131>
02068 CREATE TABLE benchmark
02069 (
02070         cdate                   DATETIME,
02071         module                  VARCHAR(200),
02072         benchmark               VARCHAR(200),
02073         duration                DOUBLE(14,5),
02074         INDEX (module, benchmark)
02075 );
02076 
02077 <#132>
02078 REPLACE INTO settings (keyword, value) VALUES ('bench_max_records', 10000);
02079 REPLACE INTO settings (keyword, value) VALUES ('enable_bench', 0);
02080 <#133>
02081 ALTER  TABLE  `tst_tests`  ADD  `reporting_date` VARCHAR( 14  )  AFTER  `processing_time` ;
02082 <#134>
02083 ALTER  TABLE  `qpl_questions`  ADD  `complete` ENUM(  '0',  '1'  ) DEFAULT  '1' NOT  NULL  AFTER  `image_file` ;
02084 <#135>
02085 ALTER  TABLE  `tst_tests`  ADD  `complete` ENUM(  '0',  '1'  ) DEFAULT  '1' NOT  NULL  AFTER  `starting_time` ;
02086 
02087 <#136>
02088 <?php
02089 // ADD NEW OPERATION create_chat
02090 $query = "INSERT INTO rbac_operations VALUES('30','mail_visible','users can use mail system')";
02091 $this->db->query($query);
02092 
02093 // ENABLE OPERATION FOR MAIL OBJECT
02094 $query = "INSERT INTO rbac_ta VALUES('19','30')";
02095 $this->db->query($query);
02096 
02097 ?>
02098 <#137>
02099 <?php
02100 // MAIL REF_ID
02101 $query = "SELECT * FROM object_data NATURAL JOIN object_reference ".
02102                 "WHERE type = 'mail'";
02103 
02104 $res = $this->db->query($query);
02105 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02106 {
02107         $ref_id = $row->ref_id;
02108 }
02109 // GET ALL ROLE_IDS
02110 $query = "SELECT DISTINCT(rol_id) FROM rbac_pa";
02111 $res = $this->db->query($query);
02112 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02113 {
02114         $role_ids[] = $row->rol_id;
02115 }
02116 
02117 $rbacsystem =& new ilRbacSystem();
02118 $rbacadmin =& new ilRbacAdmin();
02119 $rbacreview =& new ilRbacReview();
02120 
02121 foreach($role_ids as $id)
02122 {
02123         if($rbacsystem->checkPermission($ref_id,$id,"visible") and $rbacsystem->checkPermission($ref_id,$id,"read"))
02124         {
02125                 $ops = $rbacreview->getRoleOperationsOnObject($id,$ref_id);
02126                 $ops[] = 30;
02127                 $rbacadmin->revokePermission($ref_id,$id);
02128                 $rbacadmin->grantPermission($id,$ops,$ref_id);
02129         }
02130 }
02131 ?>
02132 <#138>
02133 CREATE TABLE `tst_eval_settings` (
02134   `eval_settings_id` int(11) NOT NULL auto_increment,
02135   `user_fi` int(11) NOT NULL default '0',
02136   `qworkedthrough` enum('0','1') NOT NULL default '1',
02137   `pworkedthrough` enum('0','1') NOT NULL default '1',
02138   `timeofwork` enum('0','1') NOT NULL default '1',
02139   `atimeofwork` enum('0','1') NOT NULL default '1',
02140   `firstvisit` enum('0','1') NOT NULL default '1',
02141   `lastvisit` enum('0','1') NOT NULL default '1',
02142   `resultspoints` enum('0','1') NOT NULL default '1',
02143   `resultsmarks` enum('0','1') NOT NULL default '1',
02144   `distancemean` enum('0','1') NOT NULL default '1',
02145   `distancequintile` enum('0','1') NOT NULL default '1',
02146   `TIMESTAMP` timestamp(14) NOT NULL,
02147   PRIMARY KEY  (`eval_settings_id`)
02148 ) TYPE=MyISAM COMMENT='User settings for statistical evaluation tool';
02149 
02150 <#139>
02151 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('31', 'create_mep', 'create new media pool');
02152 
02153 <#140>
02154 <?php
02155 
02156 // insert media pool definition in object_data
02157 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
02158                  "VALUES ('typ', 'mep', 'Media pool object', -1, now(), now())";
02159 $this->db->query($query);
02160 
02161 // fetch type id
02162 $query = "SELECT LAST_INSERT_ID()";
02163 $res = $this->db->query($query);
02164 $row = $res->fetchRow();
02165 $typ_id = $row[0];
02166 
02167 // add operations to media pool
02168 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
02169 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
02170 $this->db->query($query);
02171 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
02172 $this->db->query($query);
02173 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
02174 $this->db->query($query);
02175 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
02176 $this->db->query($query);
02177 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
02178 $this->db->query($query);
02179 ?>
02180 
02181 <#141>
02182 <?php
02183 
02184 // add create media pool operation to categories
02185 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='cat'";
02186 $res = $this->db->query($query);
02187 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
02188 $typ_id = $row["obj_id"];
02189 
02190 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','31')";
02191 $this->db->query($query);
02192 ?>
02193 
02194 <#142>
02195 
02196 CREATE TABLE mep_tree
02197 (
02198         mep_id INT NOT NULL,
02199         child INT NOT NULL,
02200         parent INT NOT NULL,
02201         lft INT NOT NULL,
02202         rgt INT NOT NULL,
02203         depth SMALLINT NOT NULL
02204 );
02205 
02206 <#143>
02207 ALTER  TABLE  `qpl_questions`  ADD  `ordering_type` enum('0','1') default NULL  AFTER  `matching_type` ;
02208 
02209 <#144>
02210 UPDATE content_object SET default_layout = '1window' WHERE default_layout='no_menu';
02211 
02212 <#145>
02213 ALTER TABLE mail DROP COLUMN timest;
02214 
02215 <#146>
02216 ALTER TABLE mail CHANGE m_type m_type VARCHAR( 255 ) DEFAULT NULL;
02217 
02218 <#147>
02219 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('32', 'create_htlm', 'create new html learning module');
02220 
02221 <#148>
02222 <?php
02223 
02224 // insert media pool definition in object_data
02225 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
02226                  "VALUES ('typ', 'htlm', 'HTML LM object', -1, now(), now())";
02227 $this->db->query($query);
02228 
02229 // fetch type id
02230 $query = "SELECT LAST_INSERT_ID()";
02231 $res = $this->db->query($query);
02232 $row = $res->fetchRow();
02233 $typ_id = $row[0];
02234 
02235 // add operations to html lm
02236 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
02237 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
02238 $this->db->query($query);
02239 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
02240 $this->db->query($query);
02241 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
02242 $this->db->query($query);
02243 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
02244 $this->db->query($query);
02245 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
02246 $this->db->query($query);
02247 ?>
02248 
02249 <#149>
02250 <?php
02251 
02252 // add create html lm operation to categories
02253 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='cat'";
02254 $res = $this->db->query($query);
02255 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
02256 $typ_id = $row["obj_id"];
02257 
02258 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','32')";
02259 $this->db->query($query);
02260 ?>
02261 <#150>
02262 ALTER  TABLE  `qpl_questions`  ADD  `working_time` TIME DEFAULT  '00:00:00' NOT  NULL  AFTER  `question_text` ;
02263 <#151>
02264 ALTER  TABLE  `qpl_questions`  ADD  `shuffle` ENUM(  '0',  '1'  ) DEFAULT  '1' NOT  NULL  AFTER  `working_time` ;
02265 <#152>
02266 ALTER TABLE `frm_posts` ADD `pos_subject` TEXT NOT NULL AFTER `pos_message` ;
02267 <#153>
02268 ALTER TABLE content_object ADD COLUMN toc_active ENUM('y','n') DEFAULT 'y';
02269 ALTER TABLE content_object ADD COLUMN lm_menu_active ENUM('y','n') DEFAULT 'y';
02270 
02271 <#154>
02272 CREATE TABLE file_based_lm
02273 (
02274         id INT NOT NULL PRIMARY KEY,
02275         online ENUM('y','n') DEFAULT 'n',
02276         startfile VARCHAR(200)
02277 );
02278 
02279 <#155>
02280 <?php
02281 
02282 // build file_based_lm entries for each html learning module
02283 $query = "SELECT * FROM object_data WHERE type='htlm'";
02284 $res = $this->db->query($query);
02285 while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
02286 {
02287         $obj_id = $row["obj_id"];
02288         $query = "INSERT INTO file_based_lm (id, online) VALUES ('".
02289                 $row["obj_id"]."', 'n')";
02290         $this->db->query($query);
02291 }
02292 ?>
02293 <#156>
02294 ALTER  TABLE  `qpl_answers`  ADD  `cloze_type` ENUM(  '0',  '1'  )  AFTER  `gap_id` ;
02295 
02296 <#157>
02297 <?php
02298 // save the cloze type from the qpl_questions table into the qpl_answers table
02299 $query = "SELECT * FROM qpl_questions WHERE cloze_type >= 0";
02300 $res = $this->db->query($query);
02301 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02302 {
02303         $update_query = sprintf("UPDATE qpl_answers SET cloze_type = %s WHERE question_fi = %s",
02304                 $this->db->quote("$row->cloze_type"),
02305                 $this->db->quote("$row->question_id")
02306         );
02307         $update_res = $this->db->query($update_query);
02308 }
02309 ?>
02310 <#158>
02311 <?php
02312 // insert files into tree
02313 $query = "SELECT * FROM object_data AS obj ".
02314                  "LEFT JOIN object_reference AS ref ON obj.obj_id = ref.obj_id ".
02315                  "LEFT JOIN grp_tree AS grp ON grp.child = ref.ref_id ".
02316                  "WHERE obj.type = 'file'";
02317 $res = $this->db->query($query);
02318 
02319 $tree = new ilTree(ROOT_FOLDER_ID);
02320 
02321 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02322 {
02323         if ($row->tree > 0)
02324         {
02325                 $query = "SELECT * FROM tree WHERE child='".$row->tree."' AND tree='1'";
02326                 $res2 = $this->db->query($query);
02327 
02328                 if ($res2->numRows() > 0)
02329                 {
02330                         $tree->insertNode($row->child,$row->tree);
02331                 }
02332         }
02333 }
02334 
02335 // remove table grp_tree
02336 $query = "DROP TABLE IF EXISTS grp_tree";
02337 $this->db->query($query);
02338 ?>
02339 <#159>
02340 <?php
02341 $query = "SELECT * FROM `qpl_questions` WHERE  NOT isnull(start_tag)";
02342 $res = $this->db->query($query);
02343 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02344 {
02345         $new_text = preg_replace("/" . preg_quote($row->start_tag) . "(.*?)" . preg_quote($row->end_tag) . "/", "<gap>$1</gap>", $row->question_text);
02346         $update_query = sprintf("UPDATE qpl_questions SET question_text = %s WHERE question_id = %s",
02347                 $this->db->quote($new_text),
02348                 $this->db->quote("$row->question_id")
02349         );
02350         $update_res = $this->db->query($update_query);
02351 }
02352 ?>
02353 <#160>
02354 <?php
02355 // fetch type id of file object definition
02356 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='file'";
02357 $res = $this->db->query($query);
02358 $row = $res->fetchRow();
02359 $typ_id = $row[0];
02360 // add operation assignment to file object definition
02361 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
02362 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
02363 $this->db->query($query);
02364 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
02365 $this->db->query($query);
02366 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
02367 $this->db->query($query);
02368 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
02369 $this->db->query($query);
02370 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
02371 $this->db->query($query);
02372 
02373 // fetch type id of folder object definition
02374 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='fold'";
02375 $res = $this->db->query($query);
02376 $row = $res->fetchRow();
02377 $typ_id = $row[0];
02378 
02379 // add operation assignment to file object definition
02380 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
02381 // 18: create_frm, 20: create_lm, 21: create_slm, 22: create_glo, 25: create_file, 26: create_fold
02382 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
02383 $this->db->query($query);
02384 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
02385 $this->db->query($query);
02386 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
02387 $this->db->query($query);
02388 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
02389 $this->db->query($query);
02390 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
02391 $this->db->query($query);
02392 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','18')";
02393 $this->db->query($query);
02394 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','20')";
02395 $this->db->query($query);
02396 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','21')";
02397 $this->db->query($query);
02398 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','22')";
02399 $this->db->query($query);
02400 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','25')";
02401 $this->db->query($query);
02402 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','26')";
02403 $this->db->query($query);
02404 
02405 // fetch type id of group object definition
02406 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='grp'";
02407 $res = $this->db->query($query);
02408 $row = $res->fetchRow();
02409 $typ_id = $row[0];
02410 
02411 // add create_glo operation assignment to grp object definition
02412 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','22')";
02413 $this->db->query($query);
02414 
02415 // init rbac
02416 $rbacadmin = new ilRbacAdmin();
02417 $rbacreview = new ilRbacReview();
02418 
02419 // init tree
02420 $tree = new ilTree(ROOT_FOLDER_ID);
02421 
02422 // fetch obj id of group member role template
02423 $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_member'";
02424 $res = $this->db->query($query);
02425 $row = $res->fetchRow();
02426 $mem_role_id = $row[0];
02427 
02428 // update group role templates
02429 // member role
02430 $ops_data["chat"] = array(2,3);
02431 $ops_data["file"] = array(2,3);
02432 $ops_data["frm"] = array(2,3,4,9);
02433 $ops_data["glo"] = array(2,3,7,8);
02434 $ops_data["grp"] = array(2,3,7,8,18,25,26);
02435 $ops_data["lm"] = array(2,3,7,8);
02436 $ops_data["slm"] = array(2,3,7,8);
02437 $ops_data["fold"] = array(2,3,18,25,26);
02438 
02439 // sets new template permissions
02440 foreach ($ops_data as $type => $ops)
02441 {
02442         // delete all template entries for each role
02443         $rbacadmin->deleteRolePermission($mem_role_id, ROLE_FOLDER_ID,$type);
02444         $rbacadmin->setRolePermission($mem_role_id, $type, $ops, ROLE_FOLDER_ID);
02445 }
02446 
02447 // copy member template settings to all group member roles
02448 $query = "SELECT obj_id FROM object_data WHERE type='role' AND title LIKE 'il_grp_member%'";
02449 $res = $this->db->query($query);
02450 
02451 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02452 {
02453         $dest_role_id = $row->obj_id;
02454         $rolf_arr = $rbacreview->getFoldersAssignedToRole($dest_role_id,true);
02455         $dest_rolf_id = $rolf_arr[0];
02456         $rbacadmin->deleteRolePermission($dest_role_id,$dest_rolf_id,false);
02457         $rbacadmin->copyRolePermission($mem_role_id,ROLE_FOLDER_ID,$dest_rolf_id,$dest_role_id);
02458 
02459         // change existing objects
02460         $node_id = $tree->getParentId($dest_rolf_id);
02461 
02462         if (empty($node_id))
02463         {
02464                 continue;
02465         }
02466 
02467         // GET ALL SUBNODES
02468         $node_data = $tree->getNodeData($node_id);
02469         $subtree_nodes = $tree->getSubTree($node_data);
02470 
02471         // GET ALL OBJECTS THAT CONTAIN A ROLE FOLDER
02472         $all_parent_obj_of_rolf = $rbacreview->getObjectsWithStopedInheritance($dest_role_id);
02473 
02474         // DELETE ACTUAL ROLE FOLDER FROM ARRAY
02475         $key = array_keys($all_parent_obj_of_rolf,$node_id);
02476         
02477         unset($all_parent_obj_of_rolf[$key[0]]);
02478         
02479         $check = false;
02480         
02481         foreach ($subtree_nodes as $node)
02482         {
02483                 if (!$check)
02484                 {
02485                         if (in_array($node["child"],$all_parent_obj_of_rolf))
02486                         {
02487                                 $lft = $node["lft"];
02488                                 $rgt = $node["rgt"];
02489                                 $check = true;
02490                                 continue;
02491                         }
02492 
02493                         $valid_nodes[] = $node;
02494                 }
02495                 else
02496                 {
02497                         if (($node["lft"] > $lft) && ($node["rgt"] < $rgt))
02498                         {
02499                                 continue;
02500                         }
02501                         else
02502                         {
02503                                 $check = false;
02504                                 $valid_nodes[] = $node;
02505                         }
02506                 }
02507         }
02508         
02509         // prepare arrays for permission settings below
02510         foreach ($valid_nodes as $key => $node)
02511         {
02512                 $node_ids[] = $node["child"];
02513                 $valid_nodes[$key]["perms"] = $rbacreview->getOperationsOfRole($mem_role_id,$node["type"],ROLE_FOLDER_ID);
02514         }
02515 
02516         // FIRST REVOKE PERMISSIONS FROM ALL VALID OBJECTS
02517         $rbacadmin->revokePermissionList($node_ids,$dest_role_id);
02518 
02519         // NOW SET ALL PERMISSIONS
02520         foreach ($valid_nodes as $node)
02521         {
02522                 if (is_array($node["perms"]))
02523                 {
02524                         $rbacadmin->grantPermission($dest_role_id,$node["perms"],$node["child"]);
02525                 }
02526         }
02527 } // end while
02528 
02529 // now for grp_admin roles
02530 // fetch obj id of group member role template
02531 $query = "SELECT obj_id FROM object_data WHERE type='rolt' AND title='il_grp_admin'";
02532 $res = $this->db->query($query);
02533 $row = $res->fetchRow();
02534 $adm_role_id = $row[0];
02535 
02536 // update group role templates
02537 // admin role
02538 unset($ops_data);
02539 unset($rolf_arr);
02540 unset($node_data);
02541 unset($node_ids);
02542 unset($valid_nodes);
02543 
02544 $ops_data["chat"] = array(1,2,3,4,6);
02545 $ops_data["file"] = array(1,2,3,4,6);
02546 $ops_data["frm"] = array(1,2,3,4,6,9,10);
02547 $ops_data["glo"] = array(1,2,3,4,6,7,8);
02548 $ops_data["grp"] = array(1,2,3,4,6,7,8,18,20,21,22,25,26,29);
02549 $ops_data["lm"] = array(1,2,3,4,6,7,8);
02550 $ops_data["slm"] = array(1,2,3,4,6,7,8);
02551 $ops_data["fold"] = array(1,2,3,4,6,18,20,21,22,25,26);
02552 
02553 // sets new template permissions
02554 foreach ($ops_data as $type => $ops)
02555 {
02556         // delete all template entries for each role
02557         $rbacadmin->deleteRolePermission($adm_role_id, ROLE_FOLDER_ID,$type);
02558         $rbacadmin->setRolePermission($adm_role_id, $type, $ops, ROLE_FOLDER_ID);
02559 }
02560 
02561 // copy member template settings to all group member roles
02562 $query = "SELECT obj_id FROM object_data WHERE type='role' AND title LIKE 'il_grp_admin%'";
02563 $res = $this->db->query($query);
02564 
02565 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02566 {
02567         $dest_role_id = $row->obj_id;
02568         $rolf_arr = $rbacreview->getFoldersAssignedToRole($dest_role_id,true);
02569         $dest_rolf_id = $rolf_arr[0];
02570         $rbacadmin->deleteRolePermission($dest_role_id,$dest_rolf_id,false);
02571         $rbacadmin->copyRolePermission($adm_role_id,ROLE_FOLDER_ID,$dest_rolf_id,$dest_role_id);
02572 
02573         // change existing objects
02574         $node_id = $tree->getParentId($dest_rolf_id);
02575 
02576         if (empty($node_id))
02577         {
02578                 continue;
02579         }
02580 
02581         // GET ALL SUBNODES
02582         $node_data = $tree->getNodeData($node_id);
02583         $subtree_nodes = $tree->getSubTree($node_data);
02584 
02585         // GET ALL OBJECTS THAT CONTAIN A ROLE FOLDER
02586         $all_parent_obj_of_rolf = $rbacreview->getObjectsWithStopedInheritance($dest_role_id);
02587 
02588         // DELETE ACTUAL ROLE FOLDER FROM ARRAY
02589         $key = array_keys($all_parent_obj_of_rolf,$node_id);
02590         
02591         unset($all_parent_obj_of_rolf[$key[0]]);
02592 
02593         $check = false;
02594         
02595         foreach ($subtree_nodes as $node)
02596         {
02597                 if (!$check)
02598                 {
02599                         if (in_array($node["child"],$all_parent_obj_of_rolf))
02600                         {
02601                                 $lft = $node["lft"];
02602                                 $rgt = $node["rgt"];
02603                                 $check = true;
02604                                 continue;
02605                         }
02606         
02607                         $valid_nodes[] = $node;
02608                 }
02609                 else
02610                 {
02611                         if (($node["lft"] > $lft) && ($node["rgt"] < $rgt))
02612                         {
02613                                 continue;
02614                         }
02615                         else
02616                         {
02617                                 $check = false;
02618                                 $valid_nodes[] = $node;
02619                         }
02620                 }
02621         }
02622 
02623         // prepare arrays for permission settings below
02624         foreach ($valid_nodes as $key => $node)
02625         {
02626                 $node_ids[] = $node["child"];
02627                 $valid_nodes[$key]["perms"] = $rbacreview->getOperationsOfRole($adm_role_id,$node["type"],ROLE_FOLDER_ID);
02628         }
02629 
02630         // FIRST REVOKE PERMISSIONS FROM ALL VALID OBJECTS
02631         $rbacadmin->revokePermissionList($node_ids,$dest_role_id);
02632         
02633         // NOW SET ALL PERMISSIONS
02634         foreach ($valid_nodes as $node)
02635         {
02636                 if (is_array($node["perms"]))
02637                 {
02638                         $rbacadmin->grantPermission($dest_role_id,$node["perms"],$node["child"]);
02639                 }
02640         }
02641 } // end while
02642 ?>
02643 <#161>
02644 ALTER  TABLE  `qpl_answers`  ADD  `name` VARCHAR( 50  )  NOT  NULL  AFTER  `question_fi` ;
02645 <#162>
02646 ALTER  TABLE  `qpl_answers`  ADD  `shuffle` ENUM('0','1')  NOT  NULL DEFAULT '1' AFTER  `name` ;
02647 
02648 <#163>
02649 UPDATE settings SET value = '3.0.0RC1 2004-04-18' WHERE keyword = 'ilias_version' LIMIT 1;
02650 
02651 <#164>
02652 ALTER TABLE `scorm_tracking` ADD `student_name` VARCHAR( 255 ) NOT NULL ;
02653 
02654 <#165>
02655 CREATE TABLE scorm_lm
02656 (
02657         id INT NOT NULL PRIMARY KEY,
02658         online ENUM('y','n') DEFAULT 'n',
02659         api_adapter VARCHAR(80) DEFAULT 'API'
02660 );
02661 
02662 <#166>
02663 ALTER TABLE scorm_lm ADD COLUMN  api_func_prefix VARCHAR(20) DEFAULT 'LMS';
02664 
02665 <#167>
02666 DELETE FROM style_parameter WHERE tag='div' AND class='Page' and parameter='border-spacing';
02667 DELETE FROM style_parameter WHERE tag='div' AND class='Page' and parameter='border-style';
02668 DELETE FROM style_parameter WHERE tag='div' AND class='Page' and parameter='border-color';
02669 DELETE FROM style_parameter WHERE tag='div' AND class='Page' and parameter='border-width';
02670 UPDATE style_parameter SET value='0px' WHERE tag='div' AND class='Page' and parameter='padding';
02671 DELETE FROM style_parameter WHERE tag='div' AND class='LMNavigation' and parameter='padding';
02672 DELETE FROM style_parameter WHERE tag='div' AND class='LMNavigation' and parameter='border-spacing';
02673 
02674 <#168>
02675 UPDATE usr_pref SET value='blueshadow' WHERE value='blueshadow_ie' AND keyword='style';
02676 
02677 <#169>
02678 ALTER TABLE frm_posts ADD import_name TEXT;
02679 ALTER TABLE frm_threads ADD import_name TEXT;
02680 
02681 <#170>
02682 ALTER TABLE content_object ADD COLUMN toc_mode ENUM('chapters','pages') DEFAULT 'chapters';
02683 
02684 <#171>
02685 <?php
02686 
02687 // add create media pool operation to categories
02688 $query = "SELECT obj_id FROM object_data WHERE type='adm'";
02689 $res = $this->db->query($query);
02690 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
02691 $adm_id = $row["obj_id"];
02692 
02693 $query = "INSERT INTO object_translation (obj_id, title, description, ".
02694         "lang_code, lang_default) VALUES ('".$adm_id."','Open Source eLearning'".
02695         ",'','en','1')";
02696 $this->db->query($query);
02697 ?>
02698 
02699 <#172>
02700 ALTER TABLE mail ADD import_name TEXT;
02701 
02702 <#173>
02703 # add operations 'create_svy' and 'create_spl' for survey objects and survey question pools
02704 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('42', 'create_svy', 'create new survey');
02705 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('43', 'create_spl', 'create new question pool (Survey)');
02706 
02707 <#174>
02708 <?php
02709 
02710 // insert survey definition in object_data
02711 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
02712                  "VALUES ('typ', 'svy', 'Survey object', -1, now(), now())";
02713 $this->db->query($query);
02714 
02715 // fetch type id
02716 $query = "SELECT LAST_INSERT_ID()";
02717 $res = $this->db->query($query);
02718 $row = $res->fetchRow();
02719 $typ_id = $row[0];
02720 
02721 // add operation assignment to survey object definition
02722 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
02723 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
02724 $this->db->query($query);
02725 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
02726 $this->db->query($query);
02727 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
02728 $this->db->query($query);
02729 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
02730 $this->db->query($query);
02731 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
02732 $this->db->query($query);
02733 ?>
02734 
02735 <#175>
02736 <?php
02737 
02738 // insert survey question pool definition in object_data
02739 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
02740                  "VALUES ('typ', 'spl', 'Question pool object (Survey)', -1, now(), now())";
02741 $this->db->query($query);
02742 
02743 // fetch type id
02744 $query = "SELECT LAST_INSERT_ID()";
02745 $res = $this->db->query($query);
02746 $row = $res->fetchRow();
02747 $typ_id = $row[0];
02748 
02749 // add operation assignment to survey question pool object definition
02750 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
02751 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
02752 $this->db->query($query);
02753 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
02754 $this->db->query($query);
02755 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
02756 $this->db->query($query);
02757 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
02758 $this->db->query($query);
02759 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
02760 $this->db->query($query);
02761 ?>
02762 
02763 <#176>
02764 <?php
02765 
02766 // get category type id
02767 $query = "SELECT obj_id FROM object_data WHERE type='typ' and title='cat'";
02768 $res = $this->db->query($query);
02769 $row = $res->fetchRow();
02770 $typ_id = $row[0];
02771 
02772 // add create_tst and create_qpl operations to category type
02773 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','42')";
02774 $this->db->query($query);
02775 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','43')";
02776 $this->db->query($query);
02777 ?>
02778 <#177>
02779 ALTER TABLE `usr_data` CHANGE `login` `login` VARCHAR (80) NOT NULL;
02780 ALTER TABLE `usr_data` CHANGE `email` `email` VARCHAR (80) NOT NULL;
02781 
02782 <#178>
02783 CREATE TABLE file_usage
02784 (
02785         id INT NOT NULL,
02786         usage_type VARCHAR(10) NOT NULL,
02787         usage_id INT NOT NULL,
02788         PRIMARY KEY (id, usage_type, usage_id)
02789 );
02790 
02791 <#179>
02792 <?php
02793 
02794 // prepare file access to work with safe mode
02795 umask(0117);
02796 
02797 // get settings from ini file
02798 $ini = new ilIniFile(CLIENT_WEB_DIR."/client.ini.php");
02799 $ini->read();
02800 $ini->setVariable("layout", "skin", "default");
02801 $ini->setVariable("layout", "style", "blueshadow");
02802 $ini->write();
02803 
02804 ?>
02805 
02806 <#180>
02807 UPDATE usr_pref SET value='blueshadow' WHERE value='blueshadow_ie' AND keyword='style';
02808 
02809 <#181>
02810 ALTER  TABLE  `tst_tests`  CHANGE  `processing_time`  `processing_time` TIME;
02811 ALTER  TABLE  `tst_tests`  ADD  `enable_processing_time` ENUM(  '0',  '1'  ) DEFAULT  '0' NOT  NULL  AFTER  `processing_time` ;
02812 
02813 <#182>
02814 CREATE TABLE glossary
02815 (
02816         id INT NOT NULL PRIMARY KEY,
02817         online ENUM('y','n') DEFAULT 'n'
02818 );
02819 
02820 <#183>
02821 <?php
02822 $query = "SELECT obj_id FROM object_data WHERE type='glo'";
02823 $gl_set = $this->db->query($query);
02824 
02825 while ($gl_rec = $gl_set->fetchRow(DB_FETCHMODE_ASSOC))
02826 {
02827         $query = "INSERT INTO glossary (id, online) VALUES ('".$gl_rec["obj_id"]."','y')";
02828         $this->db->query($query);
02829 }
02830 ?>
02831 
02832 <#184>
02833 CREATE TABLE scorm_tracking2
02834 (
02835         user_id INT NOT NULL,
02836         sco_id INT NOT NULL,
02837         lvalue VARCHAR(64),
02838         rvalue TEXT,
02839         PRIMARY KEY(user_id, sco_id)
02840 );
02841 
02842 <#185>
02843 <?php
02844 
02845 // add create media pool, exercise, htlm and digilib operation to groups
02846 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='grp'";
02847 $res = $this->db->query($query);
02848 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
02849 $typ_id = $row["obj_id"];
02850 
02851 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','32')";
02852 $this->db->query($query);
02853 ?>
02854 
02855 <#186>
02856 <?php
02857 
02858 // add create media pool, exercise, htlm and digilib operation to groups
02859 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='grp'";
02860 $res = $this->db->query($query);
02861 $row = $res->fetchRow(DB_FETCHMODE_ASSOC);
02862 $typ_id = $row["obj_id"];
02863 
02864 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','23')";
02865 $this->db->query($query);
02866 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','24')";
02867 $this->db->query($query);
02868 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','31')";
02869 $this->db->query($query);
02870 ?>
02871 
02872 <#187>
02873 <?php
02874 
02875 //GET ID OF THE IL_GRP_ADMIN TEMPLATE
02876 $query1 = "SELECT obj_id FROM object_data WHERE title = 'il_grp_admin' ";
02877 $res = $this->db->query($query1);
02878 $tpl = $res->fetchRow(DB_FETCHMODE_ASSOC);
02879 
02880 //GET PROPER PARENT_ID
02881 $query2 = "SELECT parent FROM rbac_templates WHERE rol_id = ".$tpl["obj_id"];
02882 $res = $this->db->query($query2);
02883 $rol_fold = $res->fetchRow(DB_FETCHMODE_ASSOC);
02884 
02885 $perms = array(         array("type" => "dbk", "ops_id" => 1),
02886                                         array("type" => "dbk", "ops_id" => 2),
02887                                         array("type" => "dbk", "ops_id" => 3),
02888                                         array("type" => "dbk", "ops_id" => 4),
02889                                         array("type" => "dbk", "ops_id" => 6));
02890 
02891 foreach($perms as $perm)
02892 {
02893         $q = "REPLACE INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','".$perm["type"]."','".$perm["ops_id"]."','".$rol_fold["parent"]."')";
02894         $this->db->query($q);
02895 }
02896 
02897 ?>
02898 
02899 <#188>
02900 <?php
02901 
02902 //GET ID OF THE IL_GRP_ADMIN TEMPLATE
02903 $query1 = "SELECT obj_id FROM object_data WHERE title = 'il_grp_admin' ";
02904 $res = $this->db->query($query1);
02905 $tpl = $res->fetchRow(DB_FETCHMODE_ASSOC);
02906 
02907 //GET PROPER PARENT_ID
02908 $query2 = "SELECT parent FROM rbac_templates WHERE rol_id = ".$tpl["obj_id"];
02909 $res = $this->db->query($query2);
02910 $rol_fold = $res->fetchRow(DB_FETCHMODE_ASSOC);
02911 
02912 $perms = array(         array("type" => "exc", "ops_id" => 1),
02913                                         array("type" => "exc", "ops_id" => 2),
02914                                         array("type" => "exc", "ops_id" => 3),
02915                                         array("type" => "exc", "ops_id" => 4),
02916                                         array("type" => "exc", "ops_id" => 6),
02917 
02918                                         array("type" => "grp", "ops_id" => 23),
02919                                         array("type" => "grp", "ops_id" => 24),
02920                                         array("type" => "grp", "ops_id" => 31),
02921                                         array("type" => "grp", "ops_id" => 32),
02922 
02923                                         array("type" => "htlm", "ops_id" => 1),
02924                                         array("type" => "htlm", "ops_id" => 2),
02925                                         array("type" => "htlm", "ops_id" => 3),
02926                                         array("type" => "htlm", "ops_id" => 4),
02927                                         array("type" => "htlm", "ops_id" => 6),
02928 
02929                                         array("type" => "mep", "ops_id" => 1),
02930                                         array("type" => "mep", "ops_id" => 2),
02931                                         array("type" => "mep", "ops_id" => 3),
02932                                         array("type" => "mep", "ops_id" => 4),
02933                                         array("type" => "mep", "ops_id" => 6),
02934 
02935                                         );
02936 
02937 foreach($perms as $perm)
02938 {
02939         $q = "REPLACE INTO rbac_templates (rol_id,type,ops_id,parent) VALUES ('".$tpl["obj_id"]."','".$perm["type"]."','".$perm["ops_id"]."','".$rol_fold["parent"]."')";
02940         $this->db->query($q);
02941 }
02942 
02943 ?>
02944 
02945 <#189>
02946 UPDATE settings SET value = '3.0.0 2004-05-15' WHERE keyword = 'ilias_version' LIMIT 1;
02947 <#190>
02948 INSERT  INTO  `qpl_question_type` (  `question_type_id` ,  `type_tag`  ) VALUES ('7',  'qt_javaapplet');
02949 <#191>
02950 ALTER  TABLE  `tst_solutions`  ADD  `points` DOUBLE AFTER  `value2` ;
02951 <#192>
02952 ALTER  TABLE  `qpl_questions`  ADD  `params` TEXT AFTER  `image_file` ;
02953 <#193>
02954 <?php
02955 
02956 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
02957                 "VALUES ('typ', 'tax', 'Taxonomy object', -1, now(), now())";
02958 $this->db->query($query);
02959 
02960 $query = "SELECT LAST_INSERT_ID() as id";
02961 $res = $this->db->query($query);
02962 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
02963 
02964 // INSERT NEW OPERATIONS
02965 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','1')";
02966 $this->db->query($query);
02967 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','2')";
02968 $this->db->query($query);
02969 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','3')";
02970 $this->db->query($query);
02971 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','4')";
02972 $this->db->query($query);
02973 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','6')";
02974 $this->db->query($query);
02975 
02976 
02977 // ADD NEW OPERATION create_chat
02978 $query = "INSERT INTO rbac_operations VALUES('44','create_tax','create taxonomy object')";
02979 $this->db->query($query);
02980 
02981 // ADD CREATE PERMISSION FOR TYPE 'adm'
02982 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'adm' ";
02983 $res = $this->db->query($query);
02984 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02985 {
02986         $query = "INSERT INTO rbac_ta VALUES('".$row->obj_id."','44')";
02987         $this->db->query($query);
02988 }
02989 
02990 
02991 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
02992                 "VALUES ('typ', 'taxf', 'Taxonomy folder object', -1, now(), now())";
02993 $this->db->query($query);
02994 
02995 $query = "SELECT LAST_INSERT_ID() as id";
02996 $res = $this->db->query($query);
02997 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
02998 
02999 // INSERT NEW OPERATIONS
03000 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','1')";
03001 $this->db->query($query);
03002 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','2')";
03003 $this->db->query($query);
03004 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','3')";
03005 $this->db->query($query);
03006 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','4')";
03007 $this->db->query($query);
03008 
03009 // ADD NODE IN SYSTEM SETTINGS FOLDER
03010 // create object data entry
03011 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
03012                 "VALUES ('taxf', 'Taxonomy folder', 'Configure taxonomy settings here', -1, now(), now())";
03013 $this->db->query($query);
03014 
03015 $query = "SELECT LAST_INSERT_ID() as id";
03016 $res = $this->db->query($query);
03017 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
03018 
03019 // create object reference entry
03020 $query = "INSERT INTO object_reference (obj_id) VALUES('".$row->id."')";
03021 $res = $this->db->query($query);
03022 
03023 $query = "SELECT LAST_INSERT_ID() as id";
03024 $res = $this->db->query($query);
03025 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
03026 
03027 // put in tree
03028 $tree = new ilTree(ROOT_FOLDER_ID);
03029 $tree->insertNode($row->id,SYSTEM_FOLDER_ID);
03030 ?>
03031 
03032 <#194>
03033 DROP TABLE IF EXISTS aicc_lm;
03034 CREATE TABLE aicc_lm (
03035   `id` int(11) NOT NULL default '0',
03036   `online` enum('y','n') default 'n',
03037   `api_adapter` varchar(80) default 'API',
03038   `api_func_prefix` varchar(20) default 'LMS',
03039   PRIMARY KEY  (`id`)
03040 ) TYPE=MyISAM;
03041 
03042 
03043 <#195>
03044 ALTER TABLE scorm_tracking2 DROP PRIMARY KEY;
03045 ALTER TABLE scorm_tracking2 MODIFY lvalue VARCHAR(64) NOT NULL;
03046 ALTER TABLE scorm_tracking2 ADD PRIMARY KEY (user_id, sco_id, lvalue);
03047 
03048 <#196>
03049 # add operations 'invite' and 'participate' for survey objects
03050 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('45', 'invite', 'invite');
03051 INSERT INTO rbac_operations (ops_id,operation,description) VALUES ('46', 'participate', 'participate');
03052 
03053 <#197>
03054 <?php
03055 
03056 // retrieve survey object data
03057 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='svy'";
03058 $result = $this->db->query($query);
03059 $row = $result->fetchRow(DB_FETCHMODE_OBJECT);
03060 $typ_id = $row->obj_id;
03061 
03062 // append operation assignment to survey object definition
03063 // 45: invite, 46: participate
03064 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','45')";
03065 $this->db->query($query);
03066 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','46')";
03067 $this->db->query($query);
03068 ?>
03069 
03070 <#198>
03071 DROP TABLE IF EXISTS aicc_lm;
03072 CREATE TABLE aicc_lm (
03073   `id` int(11) NOT NULL default '0',
03074   `online` enum('y','n') default 'n',
03075   `api_adapter` varchar(80) default 'API',
03076   `api_func_prefix` varchar(20) default 'LMS',
03077   PRIMARY KEY  (`id`)
03078 ) TYPE=MyISAM;
03079 
03080 
03081 <#199>
03082 ALTER TABLE scorm_tracking2 DROP PRIMARY KEY;
03083 ALTER TABLE scorm_tracking2 MODIFY lvalue VARCHAR(64) NOT NULL;
03084 ALTER TABLE scorm_tracking2 ADD PRIMARY KEY (user_id, sco_id, lvalue);
03085 
03086 <#200>
03087 CREATE TABLE `ut_access` (
03088         `obj_id` int(10) NOT NULL auto_increment,
03089         `user_id` int(10) unsigned NOT NULL default '0',
03090         `action_type` char(10) default NULL,
03091         `php_script` char(10) default NULL,
03092         `client_ip` char(15) default NULL,
03093         `acc_obj_type` char(10) NOT NULL default '',
03094         `acc_obj_id` int(10) NOT NULL default '0',
03095         `sub_type` char(10) NOT NULL default '',
03096         `sub_id` int(10) NOT NULL default '0',
03097         `language` char(15) default NULL,
03098         `browser` char(10) default NULL,
03099         `session_id` char(40) default NULL,
03100         `acctime` datetime default NULL,
03101         PRIMARY KEY (`obj_id`)
03102 ) TYPE=MyISAM AUTO_INCREMENT=1;
03103 
03104 <#201>
03105 ALTER TABLE ut_access CHANGE obj_id id int(10) NOT NULL auto_increment;
03106 ALTER TABLE ut_access CHANGE acctime acc_time datetime default NULL;
03107 ALTER TABLE ut_access CHANGE sub_type acc_sub_type char(10) NOT NULL default '';
03108 ALTER TABLE ut_access CHANGE sub_id acc_sub_id int(10) NOT NULL default '0';
03109 
03110 <#202>
03111 ALTER TABLE ut_access CHANGE browser browser char(60) NOT NULL default '';
03112 
03113 <#203>
03114 ALTER TABLE ut_access CHANGE php_script php_script char(100) NOT NULL default '';
03115 
03116 <#204>
03117 # Create all tables for survey tool
03118 
03119 DROP TABLE IF EXISTS `survey_answer`;
03120 CREATE TABLE `survey_answer` (
03121   `answer_id` int(11) NOT NULL auto_increment,
03122   `survey_fi` int(11) NOT NULL default '0',
03123   `question_fi` int(11) NOT NULL default '0',
03124   `user_fi` int(11) NOT NULL default '0',
03125   `value` double default NULL,
03126   `textanswer` text,
03127   `TIMESTAMP` timestamp(14) NOT NULL,
03128   PRIMARY KEY  (`answer_id`)
03129 ) TYPE=MyISAM ;
03130 
03131 DROP TABLE IF EXISTS `survey_category`;
03132 CREATE TABLE `survey_category` (
03133   `category_id` int(11) NOT NULL auto_increment,
03134   `title` varchar(100) NOT NULL default '',
03135   `defaultvalue` enum('0','1') NOT NULL default '0',
03136   `owner_fi` int(11) NOT NULL default '0',
03137   `TIMESTAMP` timestamp(14) NOT NULL,
03138   PRIMARY KEY  (`category_id`)
03139 ) TYPE=MyISAM AUTO_INCREMENT=36 ;
03140 
03141 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (1, 'dc_desired', '1', 0, 20040522134301);
03142 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (2, 'dc_undesired', '1', 0, 20040522134301);
03143 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (3, 'dc_agree', '1', 0, 20040522134301);
03144 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (4, 'dc_disagree', '1', 0, 20040522134301);
03145 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (5, 'dc_good', '1', 0, 20040522134301);
03146 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (6, 'dc_notacceptable', '1', 0, 20040522134301);
03147 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (7, 'dc_should', '1', 0, 20040522134301);
03148 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (8, 'dc_shouldnot', '1', 0, 20040522134301);
03149 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (9, 'dc_true', '1', 0, 20040522134301);
03150 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (10, 'dc_false', '1', 0, 20040522134301);
03151 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (11, 'dc_always', '1', 0, 20040522134301);
03152 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (12, 'dc_never', '1', 0, 20040522134301);
03153 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (13, 'dc_yes', '1', 0, 20040522134301);
03154 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (14, 'dc_no', '1', 0, 20040522134301);
03155 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (15, 'dc_neutral', '1', 0, 20040522134301);
03156 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (16, 'dc_undecided', '1', 0, 20040522134301);
03157 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (17, 'dc_fair', '1', 0, 20040522134301);
03158 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (18, 'dc_sometimes', '1', 0, 20040522134301);
03159 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (19, 'dc_stronglydesired', '1', 0, 20040522134301);
03160 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (20, 'dc_stronglyundesired', '1', 0, 20040522134301);
03161 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (21, 'dc_stronglyagree', '1', 0, 20040522134301);
03162 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (22, 'dc_stronglydisagree', '1', 0, 20040522134301);
03163 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (23, 'dc_verygood', '1', 0, 20040522134301);
03164 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (24, 'dc_poor', '1', 0, 20040522134301);
03165 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (25, 'dc_must', '1', 0, 20040522134301);
03166 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (26, 'dc_mustnot', '1', 0, 20040522134301);
03167 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (27, 'dc_definitelytrue', '1', 0, 20040522134301);
03168 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (28, 'dc_definitelyfalse', '1', 0, 20040522134301);
03169 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (29, 'dc_manytimes', '1', 0, 20040522134301);
03170 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (30, 'dc_varying', '1', 0, 20040522134301);
03171 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (31, 'dc_rarely', '1', 0, 20040522134301);
03172 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (32, 'dc_mostcertainly', '1', 0, 20040522134301);
03173 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (33, 'dc_morepositive', '1', 0, 20040522134301);
03174 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (34, 'dc_morenegative', '1', 0, 20040522134301);
03175 INSERT INTO `survey_category` (`category_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (35, 'dc_mostcertainlynot', '1', 0, 20040522134301);
03176 
03177 DROP TABLE IF EXISTS `survey_constraint`;
03178 CREATE TABLE `survey_constraint` (
03179   `constraint_id` int(11) NOT NULL auto_increment,
03180   `question_fi` int(11) NOT NULL default '0',
03181   `relation_fi` int(11) NOT NULL default '0',
03182   `value` double NOT NULL default '0',
03183   PRIMARY KEY  (`constraint_id`)
03184 ) TYPE=MyISAM ;
03185 
03186 DROP TABLE IF EXISTS `survey_finished`;
03187 CREATE TABLE `survey_finished` (
03188   `finished_id` int(11) NOT NULL auto_increment,
03189   `survey_fi` int(11) NOT NULL default '0',
03190   `user_fi` int(11) NOT NULL default '0',
03191   `state` enum('0','1') NOT NULL default '0',
03192   `TIMESTAMP` timestamp(14) NOT NULL,
03193   PRIMARY KEY  (`finished_id`)
03194 ) TYPE=MyISAM ;
03195 
03196 DROP TABLE IF EXISTS `survey_invited_group`;
03197 CREATE TABLE `survey_invited_group` (
03198   `invited_group_id` int(11) NOT NULL auto_increment,
03199   `survey_fi` int(11) NOT NULL default '0',
03200   `group_fi` int(11) NOT NULL default '0',
03201   `TIMESTAMP` timestamp(14) NOT NULL,
03202   PRIMARY KEY  (`invited_group_id`)
03203 ) TYPE=MyISAM ;
03204 
03205 DROP TABLE IF EXISTS `survey_invited_user`;
03206 CREATE TABLE `survey_invited_user` (
03207   `invited_user_id` int(11) NOT NULL auto_increment,
03208   `survey_fi` int(11) NOT NULL default '0',
03209   `user_fi` int(11) NOT NULL default '0',
03210   `TIMESTAMP` timestamp(14) NOT NULL,
03211   PRIMARY KEY  (`invited_user_id`)
03212 ) TYPE=MyISAM ;
03213 
03214 DROP TABLE IF EXISTS `survey_phrase`;
03215 CREATE TABLE `survey_phrase` (
03216   `phrase_id` int(11) NOT NULL auto_increment,
03217   `title` varchar(100) NOT NULL default '',
03218   `defaultvalue` enum('0','1','2') NOT NULL default '0',
03219   `owner_fi` int(11) NOT NULL default '0',
03220   `TIMESTAMP` timestamp(14) NOT NULL,
03221   PRIMARY KEY  (`phrase_id`)
03222 ) TYPE=MyISAM AUTO_INCREMENT=22 ;
03223 
03224 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (1, 'dp_standard_attitude_desired_undesired', '1', 0, 20040522135431);
03225 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (2, 'dp_standard_attitude_agree_disagree', '1', 0, 20040522135458);
03226 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (3, 'dp_standard_attitude_good_notacceptable', '1', 0, 20040522135518);
03227 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (4, 'dp_standard_attitude_shold_shouldnot', '1', 0, 20040522135546);
03228 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (5, 'dp_standard_beliefs_true_false', '1', 0, 20040522135613);
03229 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (6, 'dp_standard_beliefs_always_never', '1', 0, 20040522140547);
03230 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (7, 'dp_standard_behaviour_yes_no', '1', 0, 20040522140547);
03231 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (8, 'dp_standard_attitude_desired_neutral_undesired', '1', 0, 20040522140547);
03232 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (9, 'dp_standard_attitude_agree_undecided_disagree', '1', 0, 20040522140547);
03233 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (10, 'dp_standard_attitude_good_fair_notacceptable', '1', 0, 20040522140547);
03234 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (11, 'dp_standard_attitude_should_undecided_shouldnot', '1', 0, 20040522140547);
03235 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (12, 'dp_standard_beliefs_true_undecided_false', '1', 0, 20040522140547);
03236 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (13, 'dp_standard_beliefs_always_sometimes_never', '1', 0, 20040522140547);
03237 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (14, 'dp_standard_behaviour_yes_undecided_no', '1', 0, 20040522140547);
03238 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (15, 'dp_standard_attitude_desired5', '1', 0, 20040522150702);
03239 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (16, 'dp_standard_attitude_agree5', '1', 0, 20040522150717);
03240 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (17, 'dp_standard_attitude_good5', '1', 0, 20040522150729);
03241 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (18, 'dp_standard_attitude_must5', '1', 0, 20040522150744);
03242 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (19, 'dp_standard_beliefs_true5', '1', 0, 20040522150754);
03243 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (20, 'dp_standard_beliefs_always5', '1', 0, 20040522150812);
03244 INSERT INTO `survey_phrase` (`phrase_id`, `title`, `defaultvalue`, `owner_fi`, `TIMESTAMP`) VALUES (21, 'dp_standard_behaviour_certainly5', '1', 0, 20040522150828);
03245 
03246 DROP TABLE IF EXISTS `survey_phrase_category`;
03247 CREATE TABLE `survey_phrase_category` (
03248   `phrase_category_id` int(11) NOT NULL auto_increment,
03249   `phrase_fi` int(11) NOT NULL default '0',
03250   `category_fi` int(11) NOT NULL default '0',
03251   `sequence` int(11) NOT NULL default '0',
03252   PRIMARY KEY  (`phrase_category_id`)
03253 ) TYPE=MyISAM ;
03254 
03255 DROP TABLE IF EXISTS `survey_question`;
03256 CREATE TABLE `survey_question` (
03257   `question_id` int(11) NOT NULL auto_increment,
03258   `subtype` enum('0','1','2','3','4','5') NOT NULL default '0',
03259   `questiontype_fi` int(11) NOT NULL default '0',
03260   `ref_fi` int(11) NOT NULL default '0',
03261   `owner_fi` int(11) NOT NULL default '0',
03262   `title` varchar(100) NOT NULL default '',
03263   `description` varchar(200) NOT NULL default '',
03264   `author` varchar(100) NOT NULL default '',
03265   `questiontext` text NOT NULL,
03266   `obligatory` enum('0','1') NOT NULL default '1',
03267   `complete` enum('0','1') NOT NULL default '0',
03268   `created` varchar(14) NOT NULL default '',
03269   `TIMESTAMP` timestamp(14) NOT NULL,
03270   PRIMARY KEY  (`question_id`)
03271 ) TYPE=MyISAM ;
03272 
03273 DROP TABLE IF EXISTS `survey_question_constraint`;
03274 CREATE TABLE `survey_question_constraint` (
03275   `question_constraint_id` int(11) NOT NULL auto_increment,
03276   `survey_fi` int(11) NOT NULL default '0',
03277   `question_fi` int(11) NOT NULL default '0',
03278   `constraint_fi` int(11) NOT NULL default '0',
03279   PRIMARY KEY  (`question_constraint_id`)
03280 ) TYPE=MyISAM ;
03281 
03282 DROP TABLE IF EXISTS `survey_question_material`;
03283 CREATE TABLE `survey_question_material` (
03284   `material_id` int(11) NOT NULL auto_increment,
03285   `question_fi` int(11) NOT NULL default '0',
03286   `materials` text,
03287   `materials_file` varchar(200) NOT NULL default '',
03288   UNIQUE KEY `material_id` (`material_id`)
03289 ) TYPE=MyISAM ;
03290 
03291 DROP TABLE IF EXISTS `survey_questionblock`;
03292 CREATE TABLE `survey_questionblock` (
03293   `questionblock_id` int(11) NOT NULL auto_increment,
03294   `title` varchar(100) default NULL,
03295   `obligatory` enum('0','1') NOT NULL default '0',
03296   `owner_fi` int(11) NOT NULL default '0',
03297   `TIMESTAMP` timestamp(14) NOT NULL,
03298   PRIMARY KEY  (`questionblock_id`)
03299 ) TYPE=MyISAM ;
03300 
03301 DROP TABLE IF EXISTS `survey_questionblock_question`;
03302 CREATE TABLE `survey_questionblock_question` (
03303   `questionblock_question_id` int(11) NOT NULL auto_increment,
03304   `questionblock_fi` int(11) NOT NULL default '0',
03305   `question_fi` int(11) NOT NULL default '0',
03306   PRIMARY KEY  (`questionblock_question_id`)
03307 ) TYPE=MyISAM ;
03308 
03309 DROP TABLE IF EXISTS `survey_questiontype`;
03310 CREATE TABLE `survey_questiontype` (
03311   `questiontype_id` int(11) NOT NULL auto_increment,
03312   `type_tag` varchar(30) NOT NULL default '',
03313   `TIMESTAMP` timestamp(14) NOT NULL,
03314   PRIMARY KEY  (`questiontype_id`)
03315 ) TYPE=MyISAM AUTO_INCREMENT=5 ;
03316 
03317 INSERT INTO `survey_questiontype` (`questiontype_id`, `type_tag`, `TIMESTAMP`) VALUES (1, 'qt_nominal', 20040518222841);
03318 INSERT INTO `survey_questiontype` (`questiontype_id`, `type_tag`, `TIMESTAMP`) VALUES (2, 'qt_ordinal', 20040518222848);
03319 INSERT INTO `survey_questiontype` (`questiontype_id`, `type_tag`, `TIMESTAMP`) VALUES (3, 'qt_metric', 20040518222859);
03320 INSERT INTO `survey_questiontype` (`questiontype_id`, `type_tag`, `TIMESTAMP`) VALUES (4, 'qt_text', 20040518222904);
03321 
03322 DROP TABLE IF EXISTS `survey_relation`;
03323 CREATE TABLE `survey_relation` (
03324   `relation_id` int(11) NOT NULL auto_increment,
03325   `long` varchar(20) NOT NULL default '',
03326   `short` char(2) NOT NULL default '',
03327   `TIMESTAMP` timestamp(14) NOT NULL,
03328   PRIMARY KEY  (`relation_id`)
03329 ) TYPE=MyISAM AUTO_INCREMENT=7 ;
03330 
03331 INSERT INTO `survey_relation` (`relation_id`, `long`, `short`, `TIMESTAMP`) VALUES (1, 'less', '<', 20040518195753);
03332 INSERT INTO `survey_relation` (`relation_id`, `long`, `short`, `TIMESTAMP`) VALUES (2, 'less or equal', '<=', 20040518195808);
03333 INSERT INTO `survey_relation` (`relation_id`, `long`, `short`, `TIMESTAMP`) VALUES (3, 'equal', '=', 20040518195816);
03334 INSERT INTO `survey_relation` (`relation_id`, `long`, `short`, `TIMESTAMP`) VALUES (4, 'not equal', '<>', 20040518195839);
03335 INSERT INTO `survey_relation` (`relation_id`, `long`, `short`, `TIMESTAMP`) VALUES (5, 'more or equal', '>=', 20040518195852);
03336 INSERT INTO `survey_relation` (`relation_id`, `long`, `short`, `TIMESTAMP`) VALUES (6, 'more', '>', 20040518195903);
03337 
03338 DROP TABLE IF EXISTS `survey_survey`;
03339 CREATE TABLE `survey_survey` (
03340   `survey_id` int(11) NOT NULL auto_increment,
03341   `ref_fi` int(11) NOT NULL default '0',
03342   `author` varchar(50) NOT NULL default '',
03343   `introduction` text,
03344   `status` enum('0','1') NOT NULL default '1',
03345   `startdate` date default NULL,
03346   `enddate` date default NULL,
03347   `evaluation_access` enum('0','1') NOT NULL default '0',
03348   `invitation` enum('0','1') NOT NULL default '0',
03349   `invitation_mode` enum('0','1') NOT NULL default '1',
03350   `complete` enum('0','1') NOT NULL default '0',
03351   `created` varchar(14) NOT NULL default '',
03352   `TIMESTAMP` timestamp(14) NOT NULL,
03353   PRIMARY KEY  (`survey_id`)
03354 ) TYPE=MyISAM ;
03355 
03356 DROP TABLE IF EXISTS `survey_survey_question`;
03357 CREATE TABLE `survey_survey_question` (
03358   `survey_question_id` int(11) NOT NULL auto_increment,
03359   `survey_fi` int(11) NOT NULL default '0',
03360   `question_fi` int(11) NOT NULL default '0',
03361   `sequence` int(11) NOT NULL default '0',
03362   `TIMESTAMP` timestamp(14) NOT NULL,
03363   PRIMARY KEY  (`survey_question_id`)
03364 ) TYPE=MyISAM ;
03365 
03366 DROP TABLE IF EXISTS `survey_variable`;
03367 CREATE TABLE `survey_variable` (
03368   `variable_id` int(11) NOT NULL auto_increment,
03369   `category_fi` int(11) NOT NULL default '0',
03370   `question_fi` int(11) NOT NULL default '0',
03371   `value1` double default NULL,
03372   `value2` double default NULL,
03373   `sequence` int(11) NOT NULL default '0',
03374   `TIMESTAMP` timestamp(14) NOT NULL,
03375   PRIMARY KEY  (`variable_id`)
03376 ) TYPE=MyISAM ;
03377 
03378 <#205>
03379 
03380 ALTER TABLE `survey_questionblock_question` ADD `survey_fi` INT NOT NULL AFTER `questionblock_question_id` ;
03381 
03382 <#206>
03383 DROP TABLE IF EXISTS `aicc_course`;
03384 CREATE TABLE `aicc_course` (
03385   `obj_id` int(11) NOT NULL default '0',
03386   `course_creator` varchar(255) default NULL,
03387   `course_id` varchar(50) default NULL,
03388   `course_system` varchar(50) default NULL,
03389   `course_title` varchar(255) default NULL,
03390   `level` varchar(5) default NULL,
03391   `max_fields_cst` smallint(6) default NULL,
03392   `max_fields_ort` smallint(6) default NULL,
03393   `total_aus` smallint(6) default NULL,
03394   `total_blocks` smallint(6) default NULL,
03395   `total_complex_obj` smallint(6) default NULL,
03396   `total_objectives` smallint(6) default NULL,
03397   `version` varchar(10) default NULL,
03398   `max_normal` tinyint(4) default NULL,
03399   `description` text,
03400   PRIMARY KEY  (`obj_id`)
03401 ) TYPE=MyISAM;
03402 
03403 DROP TABLE IF EXISTS `aicc_object`;
03404 CREATE TABLE `aicc_object` (
03405   `obj_id` int(11) NOT NULL auto_increment,
03406   `alm_id` int(11) NOT NULL default '0',
03407   `system_id` varchar(50) NOT NULL default '',
03408   `title` text NOT NULL,
03409   `description` text,
03410   `developer_id` varchar(50) default NULL,
03411   `type` char(3) NOT NULL default '',
03412   PRIMARY KEY  (`obj_id`),
03413   KEY `alm_id` (`alm_id`)
03414 ) TYPE=MyISAM;
03415 
03416 DROP TABLE IF EXISTS `aicc_tree`;
03417 CREATE TABLE `aicc_tree` (
03418   `alm_id` int(11) NOT NULL default '0',
03419   `child` int(11) unsigned NOT NULL default '0',
03420   `parent` int(11) unsigned default NULL,
03421   `lft` int(11) unsigned NOT NULL default '0',
03422   `rgt` int(11) unsigned NOT NULL default '0',
03423   `depth` smallint(5) unsigned NOT NULL default '0',
03424   KEY `child` (`child`),
03425   KEY `parent` (`parent`)
03426 ) TYPE=MyISAM;
03427 
03428 DROP TABLE IF EXISTS `aicc_units`;
03429 CREATE TABLE `aicc_units` (
03430   `obj_id` int(11) NOT NULL auto_increment,
03431   `type` varchar(50) default NULL,
03432   `command_line` varchar(255) default NULL,
03433   `max_time_allowed` time default NULL,
03434   `time_limit_action` varchar(50) default NULL,
03435   `max_score` decimal(10,0) default NULL,
03436   `core_vendor` text,
03437   `system_vendor` text,
03438   `file_name` varchar(255) default NULL,
03439   `mastery_score` smallint(6) default NULL,
03440   `web_launch` varchar(255) default NULL,
03441   `au_password` varchar(50) default NULL,
03442   PRIMARY KEY  (`obj_id`)
03443 ) TYPE=MyISAM;
03444 
03445 <#207>
03446 INSERT  INTO  `survey_phrase` (`phrase_id` ,  `title` ,  `defaultvalue` ,  `owner_fi` ,  `TIMESTAMP`) VALUES (NULL,  'dp_standard_numbers',  '1',  '0', NOW());
03447 
03448 <#208>
03449 ALTER TABLE scorm_tracking2 ADD COLUMN ref_id INT NOT NULL DEFAULT '0';
03450 <#209>
03451 ALTER  TABLE  `survey_question`  ADD  `original_id` INT DEFAULT  '0' NOT  NULL  AFTER  `created` ;
03452 <#210>
03453 
03454 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'1','1','1');
03455 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'1','2','2');
03456 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'2','3','1');
03457 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'2','4','2');
03458 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'3','5','1');
03459 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'3','6','2');
03460 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'4','7','1');
03461 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'4','8','2');
03462 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'5','9','1');
03463 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'5','10','2');
03464 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'6','11','1');
03465 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'6','12','2');
03466 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'7','13','1');
03467 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'7','14','2');
03468 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'8','1','1');
03469 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'8','15','2');
03470 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'8','2','3');
03471 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'9','3','1');
03472 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'9','16','2');
03473 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'9','4','3');
03474 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'10','5','1');
03475 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'10','17','2');
03476 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'10','6','3');
03477 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'11','7','1');
03478 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'11','16','2');
03479 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'11','8','3');
03480 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'12','9','1');
03481 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'12','16','2');
03482 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'12','10','3');
03483 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'13','11','1');
03484 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'13','18','2');
03485 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'13','12','3');
03486 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'14','13','1');
03487 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'14','16','2');
03488 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'14','14','3');
03489 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'15','19','1');
03490 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'15','1','2');
03491 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'15','15','3');
03492 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'15','2','4');
03493 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'15','20','5');
03494 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'16','21','1');
03495 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'16','3','2');
03496 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'16','16','3');
03497 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'16','4','4');
03498 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'16','22','5');
03499 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'17','23','1');
03500 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'17','5','2');
03501 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'17','17','3');
03502 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'17','24','4');
03503 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'17','6','5');
03504 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'18','25','1');
03505 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'18','7','2');
03506 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'18','16','3');
03507 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'18','8','4');
03508 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'18','26','5');
03509 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'19','27','1');
03510 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'19','9','2');
03511 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'19','16','3');
03512 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'19','10','4');
03513 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'19','28','5');
03514 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'20','11','1');
03515 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'20','29','2');
03516 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'20','30','3');
03517 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'20','31','4');
03518 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'20','12','5');
03519 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'21','32','1');
03520 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'21','33','2');
03521 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'21','16','3');
03522 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'21','34','4');
03523 INSERT INTO `survey_phrase_category` (`phrase_category_id`,`phrase_fi`,`category_fi`,`sequence`) VALUES (NULL,'21','35','5');
03524 <#211>
03525 ALTER  TABLE  `qpl_questions`  CHANGE  `question_id`  `question_id` INT( 11  ) DEFAULT  '0' NOT  NULL  AUTO_INCREMENT;
03526 
03527 <#212>
03528 DROP TABLE IF EXISTS scorm_tracking;
03529 RENAME TABLE scorm_tracking2 TO scorm_tracking;
03530 
03531 <#213>
03532 ALTER TABLE scorm_lm ADD COLUMN credit ENUM('credit','no_credit') NOT NULL DEFAULT 'credit';
03533 
03534 <#214>
03535 ALTER TABLE scorm_lm ADD COLUMN default_lesson_mode ENUM('normal','browse') NOT NULL DEFAULT 'normal';
03536 ALTER TABLE scorm_lm ADD COLUMN auto_review ENUM('y','n') NOT NULL DEFAULT 'n';
03537 
03538 <#215>
03539 ALTER TABLE content_object ADD COLUMN clean_frames ENUM('y','n') NOT NULL DEFAULT 'n';
03540 
03541 <#216>
03542 <?php
03543 // get all users
03544 $q = "SELECT usr_id FROM usr_data";
03545 $user_set = $this->db->query($q);
03546 
03547 while ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
03548 {
03549         $q = "REPLACE INTO usr_pref (usr_id, keyword, value) VALUES ".
03550                 " ('".$user_rec["usr_id"]."','show_users_online','y')";
03551         $this->db->query($q);
03552 }
03553 ?>
03554 
03555 <#217>
03556 ALTER  TABLE  `qpl_question_material`  ADD  `materials_file` TEXT;
03557 ALTER  TABLE  `qpl_question_material`  ADD  `TIMESTAMP` TIMESTAMP NOT  NULL ;
03558 
03559 <#218>
03560 ALTER  TABLE  `qpl_questions`  DROP  `imagemap_file`;
03561 
03562 <#219>
03563 ALTER  TABLE  `qpl_questions`  ADD  `original_id` INT AFTER  `created` ;
03564 
03565 <#220>
03566 <?php
03567 // duplicate all test questions. work with duplicates instead of references
03568 $query = "SELECT test_question_id, question_fi, test_fi FROM tst_test_question";
03569 $search_result = $this->db->query($query);
03570 while ($result_row = $search_result->fetchRow(DB_FETCHMODE_OBJECT))
03571 {
03572         $question_id = $result_row->question_fi;
03573         $query = sprintf("SELECT * FROM qpl_questions WHERE question_id = %s",
03574                 $this->db->quote($question_id)
03575         );
03576         $result = $this->db->query($query);
03577   if (strcmp(get_class($result), db_result) == 0) {
03578                 if ($result->numRows() == 1)
03579                 {
03580                         $row = $result->fetchRow(DB_FETCHMODE_OBJECT);
03581                         $query = sprintf("INSERT INTO qpl_questions (question_id, question_type_fi, ref_fi, title, comment, author, owner, question_text, working_time, shuffle, points, start_tag, end_tag, matching_type, ordering_type, cloze_type, choice_response, materials, image_file, params, complete, created, original_id, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NULL)",
03582                                 $this->db->quote("$row->question_type_fi"),
03583                                 $this->db->quote("$row->ref_fi"),
03584                                 $this->db->quote("$row->title"),
03585                                 $this->db->quote("$row->comment"),
03586                                 $this->db->quote("$row->author"),
03587                                 $this->db->quote("$row->owner"),
03588                                 $this->db->quote("$row->question_text"),
03589                                 $this->db->quote("$row->working_time"),
03590                                 $this->db->quote("$row->shuffle"),
03591                                 $this->db->quote("$row->points"),
03592                                 $this->db->quote("$row->start_tag"),
03593                                 $this->db->quote("$row->end_tag"),
03594                                 $this->db->quote("$row->matching_type"),
03595                                 $this->db->quote("$row->ordering_type"),
03596                                 $this->db->quote("$row->cloze_type"),
03597                                 $this->db->quote("$row->choice_response"),
03598                                 $this->db->quote("$row->materials"),
03599                                 $this->db->quote("$row->image_file"),
03600                                 $this->db->quote("$row->params"),
03601                                 $this->db->quote("$row->complete"),
03602                                 $this->db->quote("$row->created"),
03603                                 $this->db->quote("$row->question_id")
03604                         );
03605                         $result = $this->db->query($query);
03606                         $duplicate_id = $this->db->getLastInsertId();
03607                         $query = sprintf("SELECT * FROM qpl_answers WHERE question_fi = %s",
03608                                 $this->db->quote($question_id)
03609                         );
03610                         $result = $this->db->query($query);
03611                         while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
03612                         {
03613                                 $insertquery = sprintf("INSERT INTO qpl_answers (answer_id, question_fi, name, shuffle, answertext, points, aorder, correctness, solution_order, matchingtext, matching_order, gap_id, cloze_type, coords, area, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NULL)",
03614                                         $this->db->quote("$duplicate_id"),
03615                                         $this->db->quote("$row->name"),
03616                                         $this->db->quote("$row->shuffle"),
03617                                         $this->db->quote("$row->answertext"),
03618                                         $this->db->quote("$row->points"),
03619                                         $this->db->quote("$row->aorder"),
03620                                         $this->db->quote("$row->correctness"),
03621                                         $this->db->quote("$row->solution_order"),
03622                                         $this->db->quote("$row->matchingtext"),
03623                                         $this->db->quote("$row->matching_order"),
03624                                         $this->db->quote("$row->gap_id"),
03625                                         $this->db->quote("$row->cloze_type"),
03626                                         $this->db->quote("$row->coords"),
03627                                         $this->db->quote("$row->area")
03628                                 );
03629                                 $insertresult = $this->db->query($insertquery);
03630                         }
03631 
03632                         // copy question materials
03633                         $query = sprintf("SELECT * FROM qpl_question_material WHERE question_id = %s",
03634                                 $this->db->quote($question_id)
03635                         );
03636                         $result = $this->db->query($query);
03637                         while ($row = $result->fetchRow(DB_FETCHMODE_OBJECT))
03638                         {
03639                                 $insertquery = sprintf("INSERT INTO qpl_question_material (material_id, question_id, materials, materials_file, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
03640                                         $this->db->quote("$duplicate_id"),
03641                                         $this->db->quote("$row->materials"),
03642                                         $this->db->quote("$row->materials_file")
03643                                 );
03644                                 $insertresult = $this->db->query($insertquery);
03645                         }
03646 
03647                         $query = sprintf("UPDATE tst_test_question SET question_fi = %s WHERE test_question_id = %s",
03648                                 $this->db->quote($duplicate_id),
03649                                 $this->db->quote($result_row->test_question_id)
03650                         );
03651                         $result = $this->db->query($query);
03652 
03653                         $query = sprintf("UPDATE tst_solutions SET question_fi = %s WHERE test_fi = %s AND question_fi = %s",
03654                                 $this->db->quote($duplicate_id),
03655                                 $this->db->quote($result_row->test_fi),
03656                                 $this->db->quote($result_row->question_fi)
03657                         );
03658                         $result = $this->db->query($query);
03659                 }
03660         }
03661 }
03662 ?>
03663 
03664 <#221>
03665 UPDATE settings SET value = '3.0.1 2004-06-21' WHERE keyword = 'ilias_version' LIMIT 1;
03666 
03667 <#222>
03668 ALTER  TABLE  `tst_tests`  ADD  `ending_time` varchar(14) default NULL AFTER  `starting_time` ;
03669 <#223>
03670 
03671 ALTER  TABLE  `survey_question`  CHANGE  `original_id`  `original_id` INT( 11  ) ;
03672 UPDATE `survey_question` SET `original_id` = NULL WHERE `original_id` = 0;
03673 
03674 <#224>
03675 
03676 CREATE TABLE ctrl_classfile
03677 (
03678         class           VARCHAR(100) NOT NULL PRIMARY KEY,
03679         file            VARCHAR(250)
03680 );
03681 
03682 CREATE TABLE ctrl_calls
03683 (
03684         parent          VARCHAR(100) NOT NULL,
03685         child           VARCHAR(100)
03686 );
03687 
03688 <#225>
03689 DROP TABLE IF EXISTS `aicc_lm`;
03690 DROP TABLE IF EXISTS `aicc_tree`;
03691 
03692 <#226>
03693 DROP TABLE IF EXISTS `ut_access`;
03694 CREATE TABLE `ut_access` (
03695   `id` int(10) NOT NULL auto_increment,
03696   `user_id` int(10) unsigned NOT NULL default '0',
03697   `action_type` char(10) default NULL,
03698   `php_script` char(100) NOT NULL default '',
03699   `client_ip` char(15) default NULL,
03700   `acc_obj_type` char(10) NOT NULL default '',
03701   `acc_obj_id` int(10) NOT NULL default '0',
03702   `acc_sub_type` char(10) NOT NULL default '',
03703   `acc_sub_id` int(10) NOT NULL default '0',
03704   `language` char(15) default NULL,
03705   `browser` char(60) NOT NULL default '',
03706   `session_id` char(40) default NULL,
03707   `acc_time` datetime default NULL,
03708   PRIMARY KEY  (`id`)
03709 ) TYPE=MyISAM;
03710 
03711 <#227>
03712 <?php
03713 
03714 // get visible id
03715 $query = "SELECT * FROM rbac_operations WHERE operation='visible'";
03716 $result = $this->db->query($query);
03717 $visible_id = "";
03718 if ($result->numRows() == 1)
03719 {
03720         $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
03721         $visible_id = $row["ops_id"];
03722 }
03723 
03724 // get participate id
03725 $query = "SELECT * FROM rbac_operations WHERE operation='participate'";
03726 $result = $this->db->query($query);
03727 $participate_id = "";
03728 if ($result->numRows() == 1)
03729 {
03730         $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
03731         $participate_id = $row["ops_id"];
03732 }
03733 
03734 // check if User role still exists
03735 $query = "SELECT * FROM object_data WHERE type='role' AND title='User'";
03736 $result = $this->db->query($query);
03737 $user_id = "";
03738 if ($result->numRows() == 1)
03739 {
03740         $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
03741         $user_id = $row["obj_id"];
03742 }
03743 
03744 // check if Guest role still exists
03745 $query = "SELECT * FROM object_data WHERE type='role' AND title='Guest'";
03746 $result = $this->db->query($query);
03747 $guest_id = "";
03748 if ($result->numRows() == 1)
03749 {
03750         $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
03751         $guest_id = $row["obj_id"];
03752 }
03753 
03754 // create default roles for assessment tests
03755 
03756 if ($user_id and $visible_id)
03757 {
03758         // tests visible for users
03759         $query = sprintf("INSERT INTO rbac_templates (rol_id, type, ops_id, parent) VALUES (%s, %s, %s, %s)",
03760                 $this->db->quote($user_id),
03761                 $this->db->quote("tst"),
03762                 $this->db->quote($visible_id),
03763                 ROLE_FOLDER_ID
03764         );
03765         $result = $this->db->query($query);
03766 }
03767 
03768 if ($guest_id and $visible_id)
03769 {
03770         // tests visible for guests
03771         $query = sprintf("INSERT INTO rbac_templates (rol_id, type, ops_id, parent) VALUES (%s, %s, %s, %s)",
03772                 $this->db->quote($guest_id),
03773                 $this->db->quote("tst"),
03774                 $this->db->quote($visible_id),
03775                 ROLE_FOLDER_ID
03776         );
03777         $result = $this->db->query($query);
03778 }
03779 
03780 // create default roles for surveys
03781 
03782 if ($user_id and $visible_id)
03783 {
03784         // surveys visible for users
03785         $query = sprintf("INSERT INTO rbac_templates (rol_id, type, ops_id, parent) VALUES (%s, %s, %s, %s)",
03786                 $this->db->quote($user_id),
03787                 $this->db->quote("svy"),
03788                 $this->db->quote($visible_id),
03789                 ROLE_FOLDER_ID
03790         );
03791         $result = $this->db->query($query);
03792 }
03793 
03794 if ($guest_id and $visible_id)
03795 {
03796         // surveys visible for guests
03797         $query = sprintf("INSERT INTO rbac_templates (rol_id, type, ops_id, parent) VALUES (%s, %s, %s, %s)",
03798                 $this->db->quote($guest_id),
03799                 $this->db->quote("svy"),
03800                 $this->db->quote($visible_id),
03801                 ROLE_FOLDER_ID
03802         );
03803         $result = $this->db->query($query);
03804 }
03805 
03806 if ($user_id and $participate_id)
03807 {
03808         // users can participate surveys
03809         $query = sprintf("INSERT INTO rbac_templates (rol_id, type, ops_id, parent) VALUES (%s, %s, %s, %s)",
03810                 $this->db->quote($user_id),
03811                 $this->db->quote("svy"),
03812                 $this->db->quote($participate_id),
03813                 ROLE_FOLDER_ID
03814         );
03815         $result = $this->db->query($query);
03816 }
03817 
03818 if ($guest_id and $participate_id)
03819 {
03820         // guests can participate surveys
03821         $query = sprintf("INSERT INTO rbac_templates (rol_id, type, ops_id, parent) VALUES (%s, %s, %s, %s)",
03822                 $this->db->quote($guest_id),
03823                 $this->db->quote("svy"),
03824                 $this->db->quote($participate_id),
03825                 ROLE_FOLDER_ID
03826         );
03827         $result = $this->db->query($query);
03828 }
03829 
03830 ?>
03831 
03832 <#228>
03833 <?php
03834 
03835 // register new object type 'trac' for Tracking Item
03836 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
03837                 "VALUES ('typ', 'trac', 'UserTracking object', -1, now(), now())";
03838 $this->db->query($query);
03839 
03840 // ADD NODE IN SYSTEM SETTINGS FOLDER
03841 // create object data entry
03842 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
03843                 "VALUES ('trac', '__User Tracking', 'System user tracking', -1, now(), now())";
03844 $this->db->query($query);
03845 
03846 $query = "SELECT LAST_INSERT_ID() as id";
03847 $res = $this->db->query($query);
03848 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
03849 
03850 // create object reference entry
03851 $query = "INSERT INTO object_reference (obj_id) VALUES('".$row->id."')";
03852 $res = $this->db->query($query);
03853 
03854 $query = "SELECT LAST_INSERT_ID() as id";
03855 $res = $this->db->query($query);
03856 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
03857 
03858 // put in tree
03859 $tree = new ilTree(ROOT_FOLDER_ID);
03860 $tree->insertNode($row->id,SYSTEM_FOLDER_ID);
03861 
03862 // register RECOVERY_FOLDER_ID in table settings
03863 $query = "INSERT INTO settings (keyword,value) VALUES('sys_user_tracking_id','".$row->id."')";
03864 $res = $this->db->query($query);
03865 ?>
03866 
03867 <#229>
03868 ALTER TABLE `survey_questionblock` CHANGE `title` `title` TEXT DEFAULT NULL;
03869 
03870 <#230>
03871 REPLACE INTO settings (keyword, value) VALUES ('enable_tracking', 0);
03872 REPLACE INTO settings (keyword, value) VALUES ('save_user_related_data', 0);
03873 
03874 <#231>
03875 <?php
03876 
03877 $ilCtrlStructureReader->getStructure();
03878 
03879 ?>
03880 
03881 <#232>
03882 <?php
03883 
03884 $ilCtrlStructureReader->getStructure();
03885 
03886 ?>
03887 
03888 <#233>
03889 <?php
03890 
03891 // insert media pool definition in object_data
03892 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' ".
03893         " AND title = 'trac'";
03894 $res = $this->db->query($query);
03895 $row = $res->fetchRow();
03896 $typ_id = $row[0];
03897 
03898 // add operations to media pool
03899 // 1: edit_permissions, 2: visible, 3: read, 6:delete
03900 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
03901 $this->db->query($query);
03902 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
03903 $this->db->query($query);
03904 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
03905 $this->db->query($query);
03906 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
03907 $this->db->query($query);
03908 
03909 ?>
03910 
03911 <#234>
03912 UPDATE settings SET value = '3.1.0_beta1 2004-07-11' WHERE keyword = 'ilias_version' LIMIT 1;
03913 
03914 <#235>
03915 <?php
03916 
03917 $ilCtrlStructureReader->getStructure();
03918 
03919 ?>
03920 
03921 <#236>
03922 ALTER TABLE `aicc_object` CHANGE `alm_id` `slm_id` INT( 11 ) DEFAULT '0' NOT NULL;
03923 
03924 <#237>
03925 <?php
03926 // ADMIN TEMPLATE
03927 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
03928                  "VALUES ('rolt', 'il_crs_admin', 'Administrator template for course admins', -1, now(), now())";
03929 
03930 $this->db->query($query);
03931 
03932 // Get id of admin_template
03933 $query = "SELECT obj_id FROM object_data WHERE type = 'rolt' AND title = 'il_crs_admin'";
03934 $res = $this->db->query($query);
03935 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
03936 {
03937         $admin_id = $row->obj_id;
03938 }
03939 
03940 $admin["lm"] = array(1,2,3,4,6,7,8);
03941 $admin["slm"] = array(1,2,3,4,6,7,8);
03942 $admin["dbk"] = array(1,2,3,4,6);
03943 $admin["glo"] = array(1,2,3,4,6,7,8);
03944 $admin["frm"] = array(1,2,3,4,6,9,10);
03945 $admin["chat"] = array(1,2,3,4,6);
03946 $admin["file"] = array(1,2,3,4,6);
03947 $admin["tst"] = array(1,2,3,4,6);
03948 $admin["grp"] = array(1,2,3,4,6,7,8,18,20,21,22,23,24,25,26,27,29,31);
03949 $admin["exc"] = array(1,2,3,4,6);
03950 $admin["fold"] = array(1,2,3,4,6,18,20,21,22,25,26,29);
03951 $admin["crs"] = array(1,2,3,4,6,7,8,17,18,20,21,22,23,24,25,26,27,29,31,32);
03952 
03953 $rbacadmin =& new ilRbacAdmin();
03954 
03955 foreach($admin as $type => $ops)
03956 {
03957         $rbacadmin->setRolePermission($admin_id,$type,$ops,ROLE_FOLDER_ID);
03958 }
03959 $rbacadmin->assignRoleToFolder($admin_id,ROLE_FOLDER_ID,"n");
03960 
03961 // TUTOR TEMPLATE
03962 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
03963                  "VALUES ('rolt', 'il_crs_tutor', 'Tutor template for course tutors', -1, now(), now())";
03964 
03965 $this->db->query($query);
03966 
03967 // Get id of admin_template
03968 $query = "SELECT obj_id FROM object_data WHERE type = 'rolt' AND title = 'il_crs_tutor'";
03969 $res = $this->db->query($query);
03970 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
03971 {
03972         $tutor_id = $row->obj_id;
03973 }
03974 $admin["lm"] = array(2,3,4);
03975 $admin["slm"] = array(2,3,4,7,8);
03976 $admin["dbk"] = array(2,3,4);
03977 $admin["glo"] = array(2,3,4,7,8);
03978 $admin["frm"] = array(2,3,4,9);
03979 $admin["chat"] = array(2,3,4);
03980 $admin["file"] = array(2,3,4);
03981 $admin["tst"] = array(2,3,4);
03982 $admin["grp"] = array(2,3,4,7,8);
03983 $admin["exc"] = array(2,3,4);
03984 $admin["fold"] = array(2,3,4);
03985 $admin["crs"] = array(2,3,4,7,8);
03986 
03987 $rbacadmin =& new ilRbacAdmin();
03988 
03989 foreach($admin as $type => $ops)
03990 {
03991         $rbacadmin->setRolePermission($tutor_id,$type,$ops,ROLE_FOLDER_ID);
03992 }
03993 $rbacadmin->assignRoleToFolder($tutor_id,ROLE_FOLDER_ID,"n");
03994 
03995 // MEMBER TEMPLATE
03996 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
03997                  "VALUES ('rolt', 'il_crs_member', 'Member template for course members', -1, now(), now())";
03998 
03999 $this->db->query($query);
04000 
04001 // Get id of admin_template
04002 $query = "SELECT obj_id FROM object_data WHERE type = 'rolt' AND title = 'il_crs_member'";
04003 $res = $this->db->query($query);
04004 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04005 {
04006         $member_id = $row->obj_id;
04007 }
04008 $admin["lm"] = array(2,3);
04009 $admin["slm"] = array(2,3,7,8);
04010 $admin["dbk"] = array(2,3);
04011 $admin["glo"] = array(2,3,7,8);
04012 $admin["frm"] = array(2,3);
04013 $admin["chat"] = array(2,3);
04014 $admin["file"] = array(2,3);
04015 $admin["tst"] = array(2,3);
04016 $admin["grp"] = array(2,3,7,8);
04017 $admin["exc"] = array(2,3);
04018 $admin["fold"] = array(2,3);
04019 $admin["crs"] = array(2,3,7,8);
04020 
04021 $rbacadmin =& new ilRbacAdmin();
04022 
04023 foreach($admin as $type => $ops)
04024 {
04025         $rbacadmin->setRolePermission($member_id,$type,$ops,ROLE_FOLDER_ID);
04026 }
04027 
04028 $rbacadmin->assignRoleToFolder($member_id,ROLE_FOLDER_ID,"n");
04029 ?>
04030 <#238>
04031 <?php
04032 
04033 $ilCtrlStructureReader->getStructure();
04034 
04035 ?>
04036 
04037 <#239>
04038 CREATE TABLE `crs_items` (
04039   `parent_id` int(11) NOT NULL default '0',
04040   `obj_id` int(11) NOT NULL default '0',
04041   `activation_unlimited` tinyint(2) default NULL,
04042   `activation_start` int(8) default NULL,
04043   `activation_end` int(8) default NULL,
04044   `position` int(11) default NULL,
04045   PRIMARY KEY  (`parent_id`,`obj_id`)
04046 ) TYPE=MyISAM;
04047 CREATE TABLE `crs_members` (
04048   `obj_id` int(11) NOT NULL default '0',
04049   `usr_id` int(11) NOT NULL default '0',
04050   `status` tinyint(2) NOT NULL default '0',
04051   `role` tinyint(2) NOT NULL default '0',
04052   PRIMARY KEY  (`obj_id`,`usr_id`)
04053 ) TYPE=MyISAM;
04054 CREATE TABLE `crs_settings` (
04055   `obj_id` int(11) NOT NULL default '0',
04056   `syllabus` text,
04057   `contact_name` varchar(255) default NULL,
04058   `contact_responsibility` varchar(255) default NULL,
04059   `contact_phone` varchar(255) default NULL,
04060   `contact_email` varchar(255) default NULL,
04061   `contact_consultation` text,
04062   `activation_unlimited` tinyint(2) default NULL,
04063   `activation_start` int(11) default NULL,
04064   `activation_end` int(11) default NULL,
04065   `activation_offline` int(1) default NULL,
04066   `subscription_unlimited` tinyint(2) default NULL,
04067   `subscription_start` int(11) default NULL,
04068   `subscription_end` int(11) default NULL,
04069   `subscription_type` int(2) default NULL,
04070   `subscription_password` varchar(32) default NULL,
04071   `subscription_max_members` int(4) default NULL,
04072   `subscription_notify` int(2) default NULL,
04073   `sortorder` int(2) default NULL,
04074   `archive_start` int(11) default NULL,
04075   `archive_end` int(11) default NULL,
04076   `archive_type` int(2) default NULL,
04077   PRIMARY KEY  (`obj_id`)
04078 ) TYPE=MyISAM;
04079 CREATE TABLE `crs_subscribers` (
04080   `usr_id` int(11) NOT NULL default '0',
04081   `obj_id` int(11) NOT NULL default '0',
04082   `sub_time` int(11) NOT NULL default '0',
04083   PRIMARY KEY  (`usr_id`,`obj_id`)
04084 ) TYPE=MyISAM;
04085 
04086 <#240>
04087 CREATE TABLE `crs_archives` (
04088   `archive_id` int(11) NOT NULL auto_increment,
04089   `course_id` int(11) NOT NULL default '0',
04090   `archive_name` varchar(255) NOT NULL default '',
04091   `archive_type` tinyint(2) NOT NULL default '0',
04092   `archive_date` int(11) default NULL,
04093   `archive_size` int(11) default NULL,
04094   PRIMARY KEY  (`archive_id`)
04095 ) TYPE=MyISAM;
04096 
04097 <#241>
04098 ALTER TABLE `crs_archives` ADD `archive_lang` VARCHAR( 16 ) ;
04099 
04100 <#242>
04101 ALTER  TABLE  `tst_tests`  CHANGE  `ref_fi`  `obj_fi` INT( 11  ) DEFAULT  '0' NOT  NULL;
04102 ALTER  TABLE  `qpl_questions`  CHANGE  `ref_fi`  `obj_fi` INT( 10  ) UNSIGNED DEFAULT  '0' NOT  NULL;
04103 <#243>
04104 <?php
04105 
04106 // convert tst_tests reference id's to object id's
04107 $query = "SELECT object_reference.obj_id, tst_tests.obj_fi, tst_tests.test_id FROM object_reference, tst_tests WHERE tst_tests.obj_fi = object_reference.ref_id";
04108 $result = $this->db->query($query);
04109 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
04110 {
04111         $query = sprintf("UPDATE `tst_tests` SET `obj_fi` = %s WHERE `test_id` = %s",
04112                 $this->db->quote($row["obj_id"]),
04113                 $this->db->quote($row["test_id"])
04114         );
04115         $insert_result = $this->db->query($query);
04116 }
04117 
04118 // convert qpl_questions reference id's to object id's
04119 $query = "SELECT object_reference.obj_id, qpl_questions.obj_fi, qpl_questions.question_id FROM object_reference, qpl_questions WHERE qpl_questions.obj_fi = object_reference.ref_id";
04120 $result = $this->db->query($query);
04121 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
04122 {
04123         $query = sprintf("UPDATE `qpl_questions` SET `obj_fi` = %s WHERE `question_id` = %s",
04124                 $this->db->quote($row["obj_id"]),
04125                 $this->db->quote($row["question_id"])
04126         );
04127         $insert_result = $this->db->query($query);
04128 }
04129 
04130 ?>
04131 
04132 <#244>
04133 <?php
04134 ilUtil::makeDir(CLIENT_WEB_DIR."/assessment/");
04135 // convert material path names in web directory from CLIENT_WEB_DIR . "/assessment/ref_id/" to CLIENT_WEB_DIR . "/assessment/obj_id/";
04136 $d = opendir(CLIENT_WEB_DIR . "/assessment/") or die($php_errormsg);
04137 while (false !== ($f = readdir($d))) {
04138         if (preg_match("/\d+/", $f))
04139         {
04140                 $query = sprintf("SELECT obj_id FROM object_reference WHERE ref_id = %s",
04141                         $this->db->quote($f)
04142                 );
04143                 $result = $this->db->query($query);
04144                 if ($result->numRows())
04145                 {
04146                         $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
04147         rename(CLIENT_WEB_DIR . "/assessment/$f", CLIENT_WEB_DIR . "/assessment/" . $row["obj_id"]);
04148                 }
04149         }
04150 }
04151 closedir($d);
04152 ?>
04153 
04154 <#245>
04155 <?php
04156 // add auth object by using deprecated ldap object in database
04157 $query = "SELECT obj_id FROM object_data WHERE type = 'ldap' LIMIT 1";
04158 $res = $this->db->query($query);
04159 $row = $res->fetchRow();
04160 $obj_id = $row[0];
04161 
04162 // create object reference entry
04163 $query = "INSERT INTO object_reference (obj_id) VALUES('".$obj_id."')";
04164 $res = $this->db->query($query);
04165 
04166 $query = "SELECT LAST_INSERT_ID()";
04167 $res = $this->db->query($query);
04168 $row = $res->fetchRow();
04169 $ref_id = $row[0];
04170 
04171 // put in tree
04172 $tree = new ilTree(ROOT_FOLDER_ID);
04173 $tree->insertNode($ref_id,SYSTEM_FOLDER_ID);
04174 ?>
04175 
04176 <#246>
04177 UPDATE object_data SET type = 'auth', title = 'Authentication settings', description = 'Select and configure authentication mode for all user accounts' WHERE type = 'ldap' LIMIT 1;
04178 UPDATE object_data SET title = 'auth', description = 'Authentication settings' WHERE type = 'typ' AND title = 'ldap' AND owner = '-1' LIMIT 1;
04179 INSERT INTO settings (keyword,value) VALUES ('auth_mode',1);
04180 
04181 <#247>
04182 <?php
04183 
04184 $ilCtrlStructureReader->getStructure();
04185 
04186 ?>
04187 <#248>
04188 CREATE TABLE `conditions` (
04189 `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
04190 `target_ref_id` INT( 11 ) NOT NULL ,
04191 `target_obj_id` INT( 11 ) NOT NULL ,
04192 `target_type` VARCHAR( 8 ) NOT NULL ,
04193 `trigger_ref_id` INT( 11 ) NOT NULL ,
04194 `trigger_obj_id` INT( 11 ) NOT NULL ,
04195 `trigger_type` VARCHAR( 8 ) NOT NULL ,
04196 `operation` VARCHAR( 64 ) ,
04197 `value` VARCHAR( 64 ) ,
04198 PRIMARY KEY ( `id` )
04199 );
04200 <#249>
04201 ALTER TABLE `crs_members` ADD `passed` TINYINT( 1 ) ;
04202 <#250>
04203 ALTER TABLE `conditions` CHANGE `operation` `operator` VARCHAR( 64 ) DEFAULT NULL;
04204 <#251>
04205 ALTER TABLE usr_data ADD COLUMN `time_limit_owner` int(10) default '0';
04206 ALTER TABLE usr_data ADD COLUMN `time_limit_unlimited` int(2) default '0';
04207 ALTER TABLE usr_data ADD COLUMN `time_limit_from` int(10) default '0';
04208 ALTER TABLE usr_data ADD COLUMN `time_limit_until` int(10) default '0';
04209 
04210 <#252>
04211 UPDATE usr_data SET time_limit_unlimited = '1';
04212 
04213 <#253>
04214 <?php
04215 
04216 $ilCtrlStructureReader->getStructure();
04217 
04218 ?>
04219 <#254>
04220 ALTER TABLE `chat_user` CHANGE `last_conn_timestamp` `last_conn_timestamp` INT( 14 ) DEFAULT NULL;
04221 <#255>
04222 DELETE FROM chat_user;
04223 <#256>
04224 <?php
04225 // add operation create_file to categories
04226 $query = "SELECT ops_id FROM rbac_operations WHERE operation = 'create_file'";
04227 $res = $this->db->query($query);
04228 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04229 {
04230         $ops_id = $row->ops_id;
04231 }
04232 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'cat'";
04233 $res = $this->db->query($query);
04234 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04235 {
04236         $obj_id = $row->obj_id;
04237 }
04238 if($obj_id and $ops_id)
04239 {
04240         $query = "INSERT INTO rbac_ta VALUES('".$obj_id."','".$ops_id."')";
04241         $res = $this->db->query($query);
04242 }
04243 // assign operation to global author template
04244 $query = "SELECT obj_id FROM object_data ".
04245         "WHERE type = 'rolt' AND title = 'Author'";
04246 $res = $this->db->query($query);
04247 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04248 {
04249         $role_id = $row->obj_id;
04250 }
04251 if($role_id and $ops_id)
04252 {
04253         $query = "INSERT INTO rbac_templates ".
04254                 "VALUES('".$role_id."','cat','".$ops_id."','".ROLE_FOLDER_ID."')";
04255 
04256         $res = $this->db->query($query);
04257 }
04258 ?>
04259 
04260 <#257>
04261 # INSERT INTO `object_data` VALUES (38, 'typ', 'alm', 'AICC Learning Module', -1, '2003-08-15 10:07:28', '2003-08-15 12:23:10', '');
04262 # INSERT INTO `object_data` VALUES (39, 'typ', 'hlm', 'HACP Learning Module', -1, '2003-08-15 10:07:28', '2003-08-15 12:23:10', '');
04263 
04264 <?php
04265 $query = "SELECT ops_id FROM rbac_ta WHERE typ_id = '20'";
04266 $res = $this->db->query($query);
04267 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04268 {
04269         $ops_id = $row->ops_id;
04270 }
04271 $query = "insert into rbac_ta VALUES('38', '".$ops_id."')";
04272 //$this->db->query($query);
04273 
04274 $query = "insert into rbac_ta VALUES('39', '".$ops_id."')";
04275 //$this->db->query($query);
04276 ?>
04277 <#258>
04278 <?php
04279 // fix: remove duplicate auth entry in tree or references table
04280 $query = "SELECT ref_id FROM object_reference LEFT JOIN object_data ON object_data.obj_id = object_reference.obj_id WHERE object_data.type = 'auth'";
04281 $res = $this->db->query($query);
04282 
04283 if ($res->numRows() > 1)
04284 {
04285         $tree = new ilTree(ROOT_FOLDER_ID);
04286 
04287         while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04288         {
04289                 $query = "SELECT * FROM tree WHERE child='".$row->ref_id."' AND parent='9'";
04290                 $res2 = $this->db->query($query);
04291 
04292                 if ($res2->numRows() == 1)
04293                 {
04294                         continue;
04295                 }
04296                 else
04297                 {
04298                         $query = "DELETE FROM tree WHERE child='".$row->ref_id."'";
04299                         $this->db->query($query);
04300                         $query = "DELETE FROM object_reference WHERE ref_id='".$row->ref_id."'";
04301                         $this->db->query($query);
04302                 }
04303         }
04304 
04305         $tree->renumber();
04306  }
04307 ?>
04308 <#259>
04309 ALTER TABLE usr_data ADD COLUMN `time_limit_message` int(2) default '0';
04310 
04311 <#260>
04312 # <-257
04313 # DELETE FROM rbac_ta WHERE (typ_id=38 or typ_id=39);
04314 
04315 <?php
04316 $query = "SELECT ops_id FROM rbac_ta WHERE typ_id = '20'";
04317 $res = $this->db->query($query);
04318 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04319 {
04320         $ops_id = $row->ops_id;
04321 
04322         $query = "insert into rbac_ta VALUES('38', '".$ops_id."')";
04323         //$this->db->query($query);
04324 
04325         $query = "insert into rbac_ta VALUES('39', '".$ops_id."')";
04326         //$this->db->query($query);
04327 
04328 }
04329 ?>
04330 
04331 <#261>
04332 #
04333 # Remove materials table for assessment questions
04334 # The materials are no longer needed because of the
04335 # filelists in the PageObjects now uses in question text
04336 #
04337 
04338 DROP  TABLE `qpl_question_material`;
04339 
04340 <#262>
04341 <?php
04342 
04343   // INSERT TYPE ENTRY
04344 $query = "INSERT object_data VALUES('','typ','pays','Payment settings',-1,NOW(),NOW(),'')";
04345 $this->db->query($query);
04346 
04347 $query = "SELECT LAST_INSERT_ID()";
04348 $res = $this->db->query($query);
04349 $row = $res->fetchRow();
04350 $type_id = $row[0];
04351 
04352 $query = "INSERT INTO object_data VALUES('','pays','Payment settings','Payment settings',-1,NOW(),NOW(),'')";
04353 $this->db->query($query);
04354 
04355 $query = "SELECT LAST_INSERT_ID()";
04356 $res = $this->db->query($query);
04357 $row = $res->fetchRow();
04358 $obj_id = $row[0];
04359 
04360 // create object reference entry
04361 $query = "INSERT INTO object_reference (obj_id) VALUES('".$obj_id."')";
04362 $this->db->query($query);
04363 
04364 $query = "SELECT LAST_INSERT_ID()";
04365 $res = $this->db->query($query);
04366 $row = $res->fetchRow();
04367 $ref_id = $row[0];
04368 
04369 // put in tree
04370 $tree = new ilTree(ROOT_FOLDER_ID);
04371 $tree->insertNode($ref_id,SYSTEM_FOLDER_ID);
04372 ?>
04373 <#263>
04374 <?php
04375 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'pays'";
04376 $res = $this->db->query($query);
04377 $row = $res->fetchRow();
04378 $typ_id = $row[0];
04379 
04380 // added fix for too small typ_id field
04381 $query = "ALTER TABLE rbac_ta CHANGE typ_id typ_id INT( 11 ) DEFAULT '0' NOT NULL ";
04382 $this->db->query($query);
04383 
04384 $query = "INSERT INTO rbac_ta VALUES('".$typ_id."','1')";
04385 $this->db->query($query);
04386 
04387 $query = "INSERT INTO rbac_ta VALUES('".$typ_id."','2')";
04388 $this->db->query($query);
04389 
04390 $query = "INSERT INTO rbac_ta VALUES('".$typ_id."','3')";
04391 $this->db->query($query);
04392 
04393 $query = "INSERT INTO rbac_ta VALUES('".$typ_id."','4')";
04394 $this->db->query($query);
04395 ?>
04396 <#264>
04397 ALTER  TABLE `tst_eval_settings`   CHANGE `distancemean`  `distancemedian`  ENUM( '0' , '1'   ) DEFAULT '1'  NOT  NULL;
04398 <#265>
04399 ALTER TABLE `tst_eval_settings` DROP `distancequintile`;
04400 <#266>
04401 CREATE TABLE `payment_vendors` (
04402 `vendor_id` INT( 11 ) NOT NULL ,
04403 `cost_center` VARCHAR( 16 ) NOT NULL ,
04404 PRIMARY KEY ( `vendor_id` )
04405 );
04406 
04407 <#267>
04408 <?php
04409 // remove rbac operations of aicc object type
04410 $query = "SELECT obj_id FROM object_data ".
04411                  "WHERE type='typ' AND title='alm'";
04412 $res = $this->db->query($query);
04413 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
04414 if ($row->obj_id > 0)
04415 {
04416         $query = "DELETE FROM rbac_ta WHERE typ_id='".$row->obj_id."'";
04417         $this->db->query($query);
04418 }
04419 $query = "DELETE FROM object_data WHERE type='typ' and title='alm'";
04420 $this->db->query($query);
04421 
04422 // remove rbac operations of hacp object type
04423 $query = "SELECT obj_id FROM object_data ".
04424                  "WHERE type='typ' AND title='hlm'";
04425 $res = $this->db->query($query);
04426 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
04427 
04428 if ($row->obj_id > 0)
04429 {
04430         $query = "DELETE FROM rbac_ta WHERE typ_id='".$row->obj_id."'";
04431         $this->db->query($query);
04432 }
04433 $query = "DELETE FROM object_data WHERE type='typ' and title='hlm'";
04434 $this->db->query($query);
04435 
04436 ?>
04437 
04438 <#268>
04439 ALTER  TABLE  `survey_survey`  CHANGE  `ref_fi`  `obj_fi` INT( 11  ) DEFAULT  '0' NOT  NULL;
04440 ALTER  TABLE  `survey_question`  CHANGE  `ref_fi`  `obj_fi` INT( 11  ) UNSIGNED DEFAULT  '0' NOT  NULL;
04441 <#269>
04442 <?php
04443 
04444 // convert tst_tests reference id's to object id's
04445 $query = "SELECT object_reference.obj_id, survey_survey.obj_fi, survey_survey.survey_id FROM object_reference, survey_survey WHERE survey_survey.obj_fi = object_reference.ref_id";
04446 $result = $this->db->query($query);
04447 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
04448 {
04449         $query = sprintf("UPDATE `survey_survey` SET `obj_fi` = %s WHERE `survey_id` = %s",
04450                 $this->db->quote($row["obj_id"]),
04451                 $this->db->quote($row["survey_id"])
04452         );
04453         $insert_result = $this->db->query($query);
04454 }
04455 
04456 // convert qpl_questions reference id's to object id's
04457 $query = "SELECT object_reference.obj_id, survey_question.obj_fi, survey_question.question_id FROM object_reference, survey_question WHERE survey_question.obj_fi = object_reference.ref_id";
04458 $result = $this->db->query($query);
04459 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
04460 {
04461         $query = sprintf("UPDATE `survey_question` SET `obj_fi` = %s WHERE `question_id` = %s",
04462                 $this->db->quote($row["obj_id"]),
04463                 $this->db->quote($row["question_id"])
04464         );
04465         $insert_result = $this->db->query($query);
04466 }
04467 
04468 ?>
04469 
04470 <#270>
04471 ALTER  TABLE `qpl_answers`   CHANGE `answertext`  `answertext`  TEXT NOT  NULL;
04472 ALTER  TABLE `qpl_answers`   CHANGE `matchingtext`  `matchingtext`  TEXT NULL;
04473 
04474 <#271>
04475 DELETE FROM settings WHERE keyword='ldap_enable';
04476 <#272>
04477 UPDATE settings SET value = '3.2.0_beta1 2004-09-02' WHERE keyword = 'ilias_version' LIMIT 1;
04478 <#273>
04479 ALTER TABLE content_object ADD COLUMN print_view_active ENUM('y','n') DEFAULT 'y';
04480 <#274>
04481 CREATE TABLE `payment_trustees` (
04482 `vendor_id` INT( 11 ) NOT NULL ,
04483 `trustee_id` INT( 11 ) NOT NULL ,
04484 `perm_stat` INT( 1 ) ,
04485 `perm_obj` INT( 1 ) NOT NULL ,
04486 PRIMARY KEY ( `vendor_id` , `trustee_id` )
04487 );
04488 
04489 <#275>
04490 ALTER TABLE content_object ADD COLUMN numbering ENUM('y','n') DEFAULT 'n';
04491 
04492 <#276>
04493 CREATE TABLE `payment_objects` (
04494 `pobject_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
04495 `ref_id` INT( 11 ) NOT NULL ,
04496 `status` INT( 2 ) NOT NULL ,
04497 `pay_method` INT( 2 ) NOT NULL ,
04498 `vendor_id` INT( 11 ) NOT NULL ,
04499 PRIMARY KEY ( `pobject_id` )
04500 );
04501 
04502 <#277>
04503 <?php
04504 $ilCtrlStructureReader->getStructure();
04505 ?>
04506 
04507 <#278>
04508 <?php
04509 $ilCtrlStructureReader->getStructure();
04510 ?>
04511 
04512 <#279>
04513 ALTER TABLE `role_data` ADD `assign_users` VARCHAR( 2 ) DEFAULT '0';
04514 
04515 <#280>
04516 RENAME TABLE scorm_lm TO sahs_lm;
04517 ALTER TABLE sahs_lm ADD COLUMN type ENUM('scorm','aicc','hacp') DEFAULT 'scorm';
04518 
04519 <#281>
04520 <?php
04521 
04522 $query = "SELECT * FROM object_data where type = 'slm' or type = 'alm' or type = 'hlm'";
04523 $result = $this->db->query($query);
04524 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
04525 {
04526         switch($row["type"])
04527         {
04528                 case "slm":
04529                         $type = "scorm";
04530                         break;
04531 
04532                 case "alm":
04533                         $type = "aicc";
04534                         break;
04535 
04536                 case "hlm":
04537                         $type = "hacp";
04538                         break;
04539         }
04540         $query = "UPDATE sahs_lm SET type='$type' WHERE id ='".$row["obj_id"]."'";
04541         $this->db->query($query);
04542         $query = "UPDATE object_data SET type='sahs' WHERE obj_id ='".$row["obj_id"]."'";
04543         $this->db->query($query);
04544 }
04545 ?>
04546 
04547 <#282>
04548 UPDATE object_data SET title='sahs', description='SCORM/AICC Learning Module' WHERE title='slm' AND type='typ';
04549 
04550 <#283>
04551 UPDATE rbac_operations SET operation='create_sahs', description='create new SCORM/AICC learning module' WHERE operation = 'create_slm';
04552 
04553 <#284>
04554 UPDATE rbac_templates SET type='sahs' WHERE type='slm';
04555 
04556 <#285>
04557 <?php
04558 $query = "INSERT INTO rbac_operations ".
04559         "VALUES('','cat_administrate_users','Administrate local user')";
04560 $this->db->query($query);
04561 
04562 $query = "SELECT LAST_INSERT_ID() AS ops_id";
04563 $res = $this->db->query($query);
04564 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04565 {
04566         $admin_ops = $row->ops_id;
04567 }
04568 
04569 $query = "INSERT INTO rbac_operations ".
04570         "VALUES('','read_users','read local users')";
04571 $this->db->query($query);
04572 
04573 $query = "SELECT LAST_INSERT_ID() AS ops_id";
04574 $res = $this->db->query($query);
04575 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04576 {
04577         $read_ops = $row->ops_id;
04578 }
04579 
04580 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'cat'";
04581 $res = $this->db->query($query);
04582 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04583 {
04584         $cat_id = $row->obj_id;
04585 }
04586 
04587 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'usrf'";
04588 $res = $this->db->query($query);
04589 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
04590 {
04591         $usrf_id = $row->obj_id;
04592 }
04593 
04594 $query = "INSERT INTO rbac_ta VALUES('".$cat_id."','".$read_ops."')";
04595 $this->db->query($query);
04596 
04597 $query = "INSERT INTO rbac_ta VALUES('".$cat_id."','".$admin_ops."')";
04598 $this->db->query($query);
04599 
04600 $query = "INSERT INTO rbac_ta VALUES('".$usrf_id."','".$read_ops."')";
04601 $this->db->query($query);
04602 ?>
04603 
04604 <#286>
04605 <?php
04606 $ilCtrlStructureReader->getStructure();
04607 ?>
04608 <#287>
04609 <?php
04610 $query = "UPDATE usr_data SET time_limit_owner = '7'";
04611 $this->db->query($query);
04612 ?>
04613 
04614 <#288>
04615 ALTER TABLE `usr_data` ADD COLUMN `referral_comment` varchar(250) DEFAULT '';
04616 ALTER TABLE `usr_data` ADD COLUMN `active` int(4) unsigned NOT NULL DEFAULT '0';
04617 ALTER TABLE `usr_data` ADD COLUMN `approve_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
04618 
04619 REPLACE INTO settings (keyword, value) VALUES ('auto_registration', '1');
04620 REPLACE INTO settings (keyword, value) VALUES ('approve_recipient', '');
04621 REPLACE INTO settings (keyword, value) VALUES ('require_login', '1');
04622 REPLACE INTO settings (keyword, value) VALUES ('require_passwd', '1');
04623 REPLACE INTO settings (keyword, value) VALUES ('require_passwd2', '1');
04624 REPLACE INTO settings (keyword, value) VALUES ('require_firstname', '1');
04625 REPLACE INTO settings (keyword, value) VALUES ('require_gender', '1');
04626 REPLACE INTO settings (keyword, value) VALUES ('require_lastname', '1');
04627 REPLACE INTO settings (keyword, value) VALUES ('require_institution', '');
04628 REPLACE INTO settings (keyword, value) VALUES ('require_department', '');
04629 REPLACE INTO settings (keyword, value) VALUES ('require_street', '');
04630 REPLACE INTO settings (keyword, value) VALUES ('require_city', '');
04631 REPLACE INTO settings (keyword, value) VALUES ('require_zipcode', '');
04632 REPLACE INTO settings (keyword, value) VALUES ('require_country', '');
04633 REPLACE INTO settings (keyword, value) VALUES ('require_phone_office', '');
04634 REPLACE INTO settings (keyword, value) VALUES ('require_phone_home', '');
04635 REPLACE INTO settings (keyword, value) VALUES ('require_phone_mobile', '');
04636 REPLACE INTO settings (keyword, value) VALUES ('require_fax', '');
04637 REPLACE INTO settings (keyword, value) VALUES ('require_email', '1');
04638 REPLACE INTO settings (keyword, value) VALUES ('require_hobby', '');
04639 REPLACE INTO settings (keyword, value) VALUES ('require_default_role', '1');
04640 REPLACE INTO settings (keyword, value) VALUES ('require_referral_comment', '');
04641 <#289>
04642 <?php
04643 $ilCtrlStructureReader->getStructure();
04644 ?>
04645 <#290>
04646 CREATE TABLE `payment_prices` (
04647 `price_id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
04648 `pobject_id` INT( 11 ) NOT NULL ,
04649 `duration` INT( 4 ) NOT NULL ,
04650 `currency` INT( 4 ) NOT NULL ,
04651 `unit_value` INT( 6 ) DEFAULT '0',
04652 `sub_unit_value` INT( 3 ) DEFAULT '0',
04653 PRIMARY KEY ( `price_id` )
04654 );
04655 <#291>
04656 CREATE TABLE `payment_currencies` (
04657   `currency_id` int(3) NOT NULL default '0',
04658   `unit` char(32) NOT NULL default '',
04659   `subunit` char(32) NOT NULL default '',
04660   PRIMARY KEY  (`currency_id`)
04661 ) TYPE=MyISAM;
04662 <#292>
04663 INSERT INTO `payment_currencies` VALUES (1, 'euro', 'cent');
04664 <#293>
04665 UPDATE `usr_data` SET `active`='1';
04666 <#294>
04667 ALTER  TABLE  `tst_tests`  ADD  `ects_output` ENUM(  '0',  '1'  ) DEFAULT  '0' NOT  NULL  AFTER  `ending_time` ;
04668 ALTER  TABLE  `tst_tests`  ADD  `ects_fx` VARCHAR(2) DEFAULT  NULL AFTER  `ects_output` ;
04669 <#295>
04670 ALTER TABLE `tst_tests` CHANGE `ects_fx` `ects_fx` FLOAT DEFAULT NULL;
04671 <#296>
04672 <?php
04673 $ilCtrlStructureReader->getStructure();
04674 ?>
04675 <#297>
04676 ALTER  TABLE  `tst_tests`  ADD `ects_a` DOUBLE DEFAULT  '90' NOT  NULL;
04677 ALTER  TABLE  `tst_tests`  ADD `ects_b` DOUBLE DEFAULT  '65' NOT  NULL;
04678 ALTER  TABLE  `tst_tests`  ADD `ects_c` DOUBLE DEFAULT  '35' NOT  NULL;
04679 ALTER  TABLE  `tst_tests`  ADD `ects_d` DOUBLE DEFAULT  '10' NOT  NULL;
04680 ALTER  TABLE  `tst_tests`  ADD `ects_e` DOUBLE DEFAULT  '0' NOT  NULL;
04681 <#298>
04682 DROP TABLE `payment_prices`;
04683 <#299>
04684 CREATE TABLE `payment_prices` (
04685   `price_id` int(11) NOT NULL auto_increment,
04686   `pobject_id` int(11) NOT NULL default '0',
04687   `duration` int(4) NOT NULL default '0',
04688   `currency` int(4) NOT NULL default '0',
04689   `unit_value` char(6) default '0',
04690   `sub_unit_value` char(3) default '00',
04691   PRIMARY KEY  (`price_id`)
04692 ) TYPE=MyISAM;
04693 <#300>
04694 CREATE TABLE `payment_bill_vendor` (
04695   `pobject_id` int(11) NOT NULL default '0',
04696   `gender` tinyint(2) default NULL,
04697   `firstname` char(64) default NULL,
04698   `lastname` char(64) default NULL,
04699   `title` char(64) default NULL,
04700   `institution` char(64) default NULL,
04701   `department` char(64) default NULL,
04702   `street` char(64) default NULL,
04703   `zipcode` char(16) default NULL,
04704   `city` char(64) default NULL,
04705   `country` char(64) default NULL,
04706   `phone` char(32) default NULL,
04707   `fax` char(32) default NULL,
04708   `email` char(64) default NULL,
04709   `account_number` char(32) default NULL,
04710   `bankcode` char(32) default NULL,
04711   `iban` char(64) default NULL,
04712   `bic` char(64) default NULL,
04713   `bankname` char(64) default NULL,
04714   PRIMARY KEY  (`pobject_id`)
04715 ) TYPE=MyISAM;
04716 <#301>
04717 <?php
04718 $ilCtrlStructureReader->getStructure();
04719 ?>
04720 <#302>
04721 DROP TABLE IF EXISTS `payment_statistic`;
04722 CREATE TABLE `payment_statistic` (
04723   `booking_id` int(11) NOT NULL auto_increment,
04724   `transaction` char(64) default NULL,
04725   `pobject_id` int(11) NOT NULL default '0',
04726   `customer_id` int(11) NOT NULL default '0',
04727   `b_vendor_id` int(11) default NULL,
04728   `b_pay_method` int(2) default NULL,
04729   `order_date` int(9) default NULL,
04730   `duration` char(16) default NULL,
04731   `price` char(16) NOT NULL default '',
04732   `payed` int(2) NOT NULL default '0',
04733   `access` int(2) NOT NULL default '0',
04734   PRIMARY KEY  (`booking_id`)
04735 ) TYPE=MyISAM ;
04736 <#303>
04737 DROP TABLE IF EXISTS `payment_shopping_cart`;
04738 CREATE TABLE `payment_shopping_cart` (
04739   `psc_id` int(11) NOT NULL auto_increment,
04740   `customer_id` int(11) NOT NULL default '0',
04741   `pobject_id` int(11) NOT NULL default '0',
04742   `price_id` int(11) NOT NULL default '0',
04743   PRIMARY KEY  (`psc_id`)
04744 ) TYPE=MyISAM AUTO_INCREMENT=1 ;
04745 <#304>
04746 <?php
04747 $ilCtrlStructureReader->getStructure();
04748 ?>
04749 <#305>
04750 <?php
04751 $ilCtrlStructureReader->getStructure();
04752 ?>
04753 <#306>
04754 ALTER TABLE `survey_survey` ADD `anonymize` ENUM( '0', '1' ) DEFAULT '0' NOT NULL AFTER `created` ;
04755 <#307>
04756 ALTER TABLE `survey_finished` ADD `anonymous_id` VARCHAR( 32 ) NOT NULL AFTER `user_fi` ;
04757 ALTER TABLE `survey_answer` ADD `anonymous_id` VARCHAR( 32 ) NOT NULL AFTER `user_fi` ;
04758 <#308>
04759 ALTER TABLE `survey_finished` DROP `anonymous_id`;
04760 <#309>
04761 ALTER TABLE `qpl_questions` CHANGE `materials` `solution_hint` TEXT DEFAULT NULL;
04762 <#310>
04763 <?php
04764 $ilCtrlStructureReader->getStructure();
04765 ?>
04766 <#311>
04767 ALTER TABLE `tst_active` ADD INDEX `user_fi` (`user_fi`);
04768 ALTER TABLE `tst_active` ADD INDEX `test_fi` (`test_fi`);
04769 <#312>
04770 <?php
04771 $ilCtrlStructureReader->getStructure();
04772 ?>
04773 <#313>
04774 CREATE TABLE `exc_returned` (
04775 `returned_id` INT NOT NULL AUTO_INCREMENT ,
04776 `obj_id` INT NOT NULL ,
04777 `user_id` INT NOT NULL ,
04778 `filename` MEDIUMTEXT NOT NULL ,
04779 `filetitle` MEDIUMTEXT NOT NULL ,
04780 `mimetype` VARCHAR( 40 ) NOT NULL ,
04781 `TIMESTAMP` TIMESTAMP NOT NULL ,
04782 PRIMARY KEY ( `returned_id` ) ,
04783 INDEX ( `obj_id` ),
04784 INDEX ( `user_id` )
04785 );
04786 <#314>
04787 ALTER TABLE `usr_data` ADD `matriculation` VARCHAR( 40 ) AFTER `referral_comment` ;
04788 <#315>
04789 DROP TABLE IF EXISTS `survey_relation`;
04790 
04791 CREATE TABLE `survey_relation` (
04792   `relation_id` int(11) NOT NULL auto_increment,
04793   `longname` varchar(20) NOT NULL default '',
04794   `shortname` char(2) NOT NULL default '',
04795   `TIMESTAMP` timestamp(14) NOT NULL,
04796   PRIMARY KEY  (`relation_id`)
04797 ) TYPE=MyISAM AUTO_INCREMENT=7 ;
04798 
04799 INSERT INTO `survey_relation` VALUES (1, 'less', '<', 20040518195753);
04800 INSERT INTO `survey_relation` VALUES (2, 'less_or_equal', '<=', 20040518195808);
04801 INSERT INTO `survey_relation` VALUES (3, 'equal', '=', 20040518195816);
04802 INSERT INTO `survey_relation` VALUES (4, 'not_equal', '<>', 20040518195839);
04803 INSERT INTO `survey_relation` VALUES (5, 'more_or_equal', '>=', 20040518195852);
04804 INSERT INTO `survey_relation` VALUES (6, 'more', '>', 20040518195903);
04805 <#316>
04806 DROP TABLE IF EXISTS `exc_returned`;
04807 CREATE TABLE `exc_returned` (
04808 `returned_id` INT NOT NULL AUTO_INCREMENT ,
04809 `obj_id` INT NOT NULL ,
04810 `user_id` INT NOT NULL ,
04811 `filename` MEDIUMTEXT NOT NULL ,
04812 `filetitle` MEDIUMTEXT NOT NULL ,
04813 `mimetype` VARCHAR( 40 ) NOT NULL ,
04814 `TIMESTAMP` TIMESTAMP NOT NULL ,
04815 PRIMARY KEY ( `returned_id` ) ,
04816 INDEX ( `obj_id` ),
04817 INDEX ( `user_id` )
04818 );
04819 <#317>
04820 ALTER TABLE `object_reference` ADD INDEX ( `obj_id` );
04821 ALTER TABLE `xmlnestedset` DROP INDEX `ns_l`;
04822 ALTER TABLE `xmlnestedset` DROP INDEX `ns_r`;
04823 <#318>
04824 CREATE TABLE `qpl_answer_enhanced` (
04825 `answer_enhanced_id` INT NOT NULL AUTO_INCREMENT ,
04826 `answerblock_fi` INT NOT NULL ,
04827 `answer_fi` INT NOT NULL ,
04828 `answer_boolean_prefix` ENUM( '0', '1' ) DEFAULT '0' NOT NULL ,
04829 `answer_boolean_connection` ENUM( '0', '1' ) DEFAULT '1' NOT NULL ,
04830 `enhanced_order` TINYINT DEFAULT '0' NOT NULL ,
04831 `TIMESTAMP` TIMESTAMP NOT NULL ,
04832 PRIMARY KEY ( `answer_enhanced_id` ) ,
04833 INDEX ( `answerblock_fi` , `answer_fi` )
04834 ) COMMENT = 'saves combinations of test question answers which are combined in an answer block';
04835 
04836 CREATE TABLE `qpl_answerblock` (
04837 `answerblock_id` INT NOT NULL AUTO_INCREMENT ,
04838 `answerblock_index` TINYINT DEFAULT '0' NOT NULL ,
04839 `question_fi` INT NOT NULL ,
04840 `subquestion_index` TINYINT DEFAULT '0' NOT NULL ,
04841 `points` DOUBLE DEFAULT '0' NOT NULL ,
04842 `feedback` VARCHAR( 30 ) ,
04843 `TIMESTAMP` TIMESTAMP NOT NULL ,
04844 PRIMARY KEY ( `answerblock_id` ) ,
04845 INDEX ( `question_fi` )
04846 ) COMMENT = 'defines an answerblock, a combination of given answers of a test question';
04847 
04848 <#319>
04849 <?php>
04850 // fetch type id of folder object definition
04851 $query = "SELECT obj_id FROM object_data WHERE type='typ' AND title='fold'";
04852 $res = $this->db->query($query);
04853 $row = $res->fetchRow();
04854 $typ_id = $row[0];
04855 
04856 // add operation assignment to folder object definition
04857 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','23')";
04858 $this->db->query($query);
04859 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','24')";
04860 $this->db->query($query);
04861 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','27')";
04862 $this->db->query($query);
04863 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','28')";
04864 $this->db->query($query);
04865 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','29')";
04866 $this->db->query($query);
04867 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','31')";
04868 $this->db->query($query);
04869 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','32')";
04870 $this->db->query($query);
04871 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','42')";
04872 $this->db->query($query);
04873 $query = "REPLACE INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','43')";
04874 $this->db->query($query);
04875 ?>
04876 
04877 <#320>
04878 # add group & course operation assignments
04879 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,17);
04880 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,23);
04881 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,24);
04882 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,25);
04883 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,26);
04884 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,27);
04885 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,28);
04886 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,29);
04887 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,31);
04888 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,32);
04889 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,42);
04890 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (17,43);
04891 
04892 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (15,27);
04893 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (15,28);
04894 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (15,42);
04895 REPLACE INTO rbac_ta (typ_id,ops_id) VALUES (15,43);
04896 
04897 <#321>
04898 UPDATE settings SET value = '3.2.0 2004-10-20' WHERE keyword = 'ilias_version' LIMIT 1;
04899 <#322>
04900 ALTER TABLE `qpl_answer_enhanced` CHANGE `answer_fi` `answer_fi` VARCHAR( 20 ) DEFAULT '0' NOT NULL;
04901 <#323>
04902 ALTER TABLE `qpl_answer_enhanced` CHANGE `answer_fi` `value1` INT DEFAULT '0' NOT NULL;
04903 ALTER TABLE `qpl_answer_enhanced` ADD `value2` INT DEFAULT '0' NOT NULL AFTER `value1`;
04904 ALTER TABLE `qpl_answer_enhanced` DROP `answer_boolean_connection`;
04905 <#324>
04906 CREATE TABLE IF NOT EXISTS `qpl_suggested_solutions` (
04907   `suggested_solution_id` int(11) NOT NULL auto_increment,
04908   `question_fi` int(11) NOT NULL default '0',
04909   `internal_link` varchar(50) default '',
04910   `import_id` varchar(50) default '',
04911   `subquestion_index` int(11) NOT NULL default '0',
04912   `TIMESTAMP` timestamp(14) NOT NULL,
04913   PRIMARY KEY  (`suggested_solution_id`),
04914   KEY `question_fi` (`question_fi`)
04915 );
04916 <#325>
04917 <?php>
04918 // convert suggested solutions from prior format to new suggested solutions table
04919 $query = "SELECT * FROM qpl_questions WHERE solution_hint > 0";
04920 $res = $this->db->query($query);
04921 if ($res->numRows())
04922 {
04923         while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
04924         {
04925                 $qinsert = sprintf("INSERT INTO qpl_suggested_solutions (suggested_solution_id, question_fi, internal_link, import_id, subquestion_index, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, NULL)",
04926                         $this->db->quote($row["question_id"] . ""),
04927                         $this->db->quote("il__lm_" . $row["solution_hint"]),
04928                         $this->db->quote(""),
04929                         $this->db->quote("0")
04930                 );
04931                 $result = $this->db->query($qinsert);
04932         }
04933 }
04934 ?>
04935 <#326>
04936 ALTER TABLE `qpl_questions` DROP `solution_hint`;
04937 <#327>
04938 <?php
04939 $ilCtrlStructureReader->getStructure();
04940 ?>
04941 <#328>
04942 ALTER  TABLE  `survey_survey`  ADD  `show_question_titles` ENUM(  '0',  '1'  ) DEFAULT  '1' NOT  NULL  AFTER  `anonymize` ;
04943 <#329>
04944 CREATE TABLE `survey_question_obligatory` (
04945 `question_obligatory_id` INT NOT NULL AUTO_INCREMENT ,
04946 `survey_fi` INT NOT NULL ,
04947 `question_fi` INT NOT NULL ,
04948 `obligatory` ENUM( '0', '1' ) DEFAULT '1' NOT NULL ,
04949 `TIMESTAMP` TIMESTAMP NOT NULL ,
04950 PRIMARY KEY ( `question_obligatory_id` ) ,
04951 INDEX ( `survey_fi` , `question_fi` )
04952 ) COMMENT = 'Contains the obligatory state of questions in a survey';
04953 <#330>
04954 <?php
04955 // convert former questionblock obligatory states into the question obligatory table
04956 $query = "SELECT * FROM survey_questionblock, survey_questionblock_question WHERE survey_questionblock_question.questionblock_fi = survey_questionblock.questionblock_id";
04957 $res = $this->db->query($query);
04958 if ($res->numRows())
04959 {
04960         while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
04961         {
04962                 $qinsert = sprintf("INSERT INTO survey_question_obligatory (question_obligatory_id, survey_fi, question_fi, obligatory, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL)",
04963                         $this->db->quote($row["survey_fi"] . ""),
04964                         $this->db->quote($row["question_fi"] . ""),
04965                         $this->db->quote($row["obligatory"] . "")
04966                 );
04967                 $result = $this->db->query($qinsert);
04968         }
04969 }
04970 ?>
04971 <#331>
04972 ALTER TABLE `survey_questionblock` DROP COLUMN `obligatory`;
04973 <#332>
04974 ALTER  TABLE  `usr_data`  ADD  `agree_date` DATETIME DEFAULT  '0000-00-00 00:00' NOT NULL;
04975 <#333>
04976 UPDATE settings SET value = '3.2.1 2004-11-03' WHERE keyword = 'ilias_version' LIMIT 1;
04977 <#334>
04978 ALTER TABLE `survey_survey_question`  ADD `heading` VARCHAR(255) AFTER `sequence`;
04979 <#335>
04980 CREATE TABLE IF NOT EXISTS usr_pwassist (
04981   pwassist_id varchar(32) NOT NULL default '',
04982   expires int(11) NOT NULL default '0',
04983   ctime int(11) NOT NULL default '0',
04984   user_id int(10) unsigned NOT NULL default '0',
04985   PRIMARY KEY  (pwassist_id),
04986   UNIQUE KEY user_id (user_id)
04987 ) TYPE=MyISAM;
04988 
04989 <#336>
04990 ALTER TABLE `survey_question`  ADD `orientation` ENUM('0','1') default '0' AFTER `obligatory`;
04991 <#337>
04992 ALTER TABLE `qpl_questions` ADD INDEX `question_type_fi` ( `question_type_fi` );
04993 ALTER TABLE `qpl_answers` ADD INDEX `question_fi` ( `question_fi` );
04994 ALTER TABLE `tst_solutions` ADD INDEX `user_fi` ( `user_fi` );
04995 ALTER TABLE `tst_solutions` ADD INDEX `test_fi` ( `test_fi` );
04996 <#338>
04997 UPDATE settings SET value = '3.2.2 2004-11-19' WHERE keyword = 'ilias_version' LIMIT 1;
04998 <#339>
04999 UPDATE settings SET value = '3.2.3 2004-11-22' WHERE keyword = 'ilias_version' LIMIT 1;
05000 
05001 <#340>
05002 <?php
05003 
05004 $tree = new ilTree(ROOT_FOLDER_ID);
05005 $tree->renumber();
05006 ?>
05007 <#341>
05008 REPLACE INTO settings (keyword, value) VALUES ('enable_js_edit', 1);
05009 <#342>
05010 <?php
05011 $ilCtrlStructureReader->getStructure();
05012 ?>
05013 <#343>
05014 CREATE TABLE `payment_settings` (
05015   `settings_id` bigint(20) NOT NULL auto_increment,
05016   `currency_unit` varchar(255) NOT NULL default '',
05017   `currency_subunit` varchar(255) NOT NULL default '',
05018   `address` text NOT NULL,
05019   `bank_data` text NOT NULL,
05020   `add_info` text NOT NULL,
05021   `vat_rate` varchar(255) NOT NULL default '',
05022   `pdf_path` varchar(255) NOT NULL default '',
05023   PRIMARY KEY  (`settings_id`)
05024 ) TYPE=MyISAM;
05025 <#344>
05026 DROP TABLE IF EXISTS `payment_statistic`;
05027 CREATE TABLE `payment_statistic` (
05028   `booking_id` int(11) NOT NULL auto_increment,
05029   `transaction` char(64) default NULL,
05030   `pobject_id` int(11) NOT NULL default '0',
05031   `customer_id` int(11) NOT NULL default '0',
05032   `b_vendor_id` int(11) default NULL,
05033   `b_pay_method` int(2) default NULL,
05034   `order_date` int(9) default NULL,
05035   `duration` char(16) default NULL,
05036   `price` char(16) NOT NULL default '',
05037   `payed` int(2) NOT NULL default '0',
05038   `access` int(2) NOT NULL default '0',
05039   `voucher` char(64) default NULL,
05040   `transaction_extern` char(64) default NULL,
05041   PRIMARY KEY  (`booking_id`)
05042 ) TYPE=MyISAM;
05043 
05044 <#345>
05045 DROP TABLE IF EXISTS `history`;
05046 CREATE TABLE `history` (
05047   `obj_id` int(11) NOT NULL,
05048   `action` char(20) NOT NULL DEFAULT '',
05049   `hdate` DATETIME,
05050   `usr_id` int(11) NOT NULL,
05051   INDEX object_id (`obj_id`)
05052 ) TYPE=MyISAM;
05053 
05054 <#346>
05055 ALTER TABLE file_data ADD version INT;
05056 
05057 <#347>
05058 ALTER TABLE history ADD info_params TEXT;
05059 
05060 <#348>
05061 UPDATE file_data SET version = 1;
05062 <#349>
05063 CREATE TABLE `frm_settings` (
05064   `obj_id` int(11) NOT NULL default '0',
05065   `default_view` int(2) NOT NULL default '0',
05066   PRIMARY KEY  (`obj_id`)
05067 ) TYPE=MyISAM;
05068 
05069 <#350>
05070 DROP TABLE IF EXISTS `frm_user_read`;
05071 CREATE TABLE `frm_user_read` (
05072   `usr_id` int(11) NOT NULL default '0',
05073   `obj_id` int(11) NOT NULL default '0',
05074   `thread_id` int(11) NOT NULL default '0',
05075   `post_id` int(11) NOT NULL default '0',
05076   PRIMARY KEY  (`usr_id`,`obj_id`,`thread_id`,`post_id`)
05077 ) TYPE=MyISAM;
05078 
05079 <#351>
05080 <?php
05081 
05082 $query = "SELECT pos_pk,pos_usr_id,pos_thr_fk,pos_top_fk FROM frm_posts";
05083 $res = $this->db->query($query);
05084 while($row1 = $res->fetchRow(DB_FETCHMODE_OBJECT))
05085 {
05086         $query = "SELECT top_frm_fk FROM frm_data ".
05087                 "WHERE top_pk = '".$row1->pos_top_fk."'";
05088 
05089         $res2 = $this->db->query($query);
05090         while($row2 = $res2->fetchRow(DB_FETCHMODE_OBJECT))
05091         {
05092                 $query = "INSERT INTO frm_user_read ".
05093                         "SET usr_id = '".$row1->pos_usr_id."', ".
05094                         "obj_id = '".$row2->top_frm_fk."', ".
05095                         "thread_id = '".$row1->pos_thr_fk."', ".
05096                         "post_id = '".$row1->pos_pk."'";
05097 
05098                 $this->db->query($query);
05099         }
05100 }
05101 ?>
05102 <#352>
05103 DROP TABLE IF EXISTS `frm_thread_access`;
05104 CREATE TABLE `frm_thread_access` (
05105   `usr_id` int(11) NOT NULL default '0',
05106   `obj_id` int(11) NOT NULL default '0',
05107   `thread_id` int(11) NOT NULL default '0',
05108   `access_old` int(11) NOT NULL default '0',
05109   `access_last` int(11) NOT NULL default '0',
05110   PRIMARY KEY  (`usr_id`,`obj_id`,`thread_id`)
05111 ) TYPE=MyISAM;
05112 
05113 <#353>
05114 DROP TABLE IF EXISTS `history`;
05115 CREATE TABLE `history` (
05116   `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
05117   `obj_id` int(11) NOT NULL,
05118   `obj_type` CHAR(8) NOT NULL DEFAULT '',
05119   `action` char(20) NOT NULL DEFAULT '',
05120   `hdate` DATETIME,
05121   `usr_id` int(11) NOT NULL,
05122   `info_params` TEXT NOT NULL DEFAULT '',
05123   `user_comment` TEXT NOT NULL DEFAULT '',
05124   INDEX id_type (obj_id, obj_type)
05125 ) TYPE=MyISAM;
05126 <#354>
05127 ALTER TABLE content_object ADD COLUMN hist_user_comments ENUM('y','n') DEFAULT 'n';
05128 <#355>
05129 ALTER TABLE `tst_tests` ADD `random_test` ENUM(  '0',  '1'  ) DEFAULT  '0' NOT  NULL  AFTER  `ects_e` ;
05130 <#356>
05131 CREATE TABLE `tst_test_random_question` (
05132   `test_random_question_id` int(11) NOT NULL auto_increment,
05133   `test_fi` int(11) NOT NULL default '0',
05134   `user_fi` int(11) NOT NULL default '0',
05135   `question_fi` int(11) NOT NULL default '0',
05136   `sequence` int(10) unsigned NOT NULL default '0',
05137   `TIMESTAMP` timestamp(14) NOT NULL,
05138   PRIMARY KEY  (`test_random_question_id`)
05139 ) TYPE=MyISAM COMMENT='Relation table for random questions in tests';
05140 
05141 ALTER TABLE `tst_tests` ADD `random_question_count` int(11) AFTER  `random_test` ;
05142 <#357>
05143 CREATE TABLE `tst_test_random` (
05144   `test_random_id` int(11) NOT NULL auto_increment,
05145   `test_fi` int(11) NOT NULL default '0',
05146   `questionpool_fi` int(11) NOT NULL default '0',
05147   `num_of_q` int(10) unsigned NOT NULL default '0',
05148   `TIMESTAMP` timestamp(14) NOT NULL,
05149   PRIMARY KEY  (`test_random_id`)
05150 ) TYPE=MyISAM COMMENT='Questionpools taken for a random test';
05151 <#358>
05152 ALTER TABLE `survey_finished` ADD `anonymous_id` VARCHAR(32) AFTER  `user_fi` ;
05153 <#359>
05154 CREATE TABLE `link_check` (
05155   `page_id` int(11) NOT NULL default '0',
05156   `url` varchar(255) NOT NULL default '',
05157   `parent_type` varchar(8) NOT NULL default ''
05158 ) TYPE=MyISAM;
05159 <#360>
05160 <?php
05161 // convert all single response mc questions and remove the 'when not set' option 
05162 $query = "SELECT qpl_answers.answer_id FROM qpl_answers, qpl_questions WHERE qpl_answers.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = 1";
05163 $res = $this->db->query($query);
05164 while($row1 = $res->fetchRow(DB_FETCHMODE_OBJECT))
05165 {
05166         $query = sprintf("UPDATE qpl_answers SET correctness = '1', points = 0 WHERE answer_id = %s AND correctness = '0'",
05167                 $this->db->quote($row1->answer_id . "")
05168         );
05169         $res2 = $this->db->query($query);
05170 }
05171 
05172 // convert all imagemap questions and remove the 'when not set' option 
05173 $query = "SELECT qpl_answers.answer_id FROM qpl_answers, qpl_questions WHERE qpl_answers.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = 6";
05174 $res = $this->db->query($query);
05175 while($row1 = $res->fetchRow(DB_FETCHMODE_OBJECT))
05176 {
05177         $query = sprintf("UPDATE qpl_answers SET correctness = '1', points = 0 WHERE answer_id = %s AND correctness = '0'",
05178                 $this->db->quote($row1->answer_id . "")
05179         );
05180         $res2 = $this->db->query($query);
05181 }
05182 
05183 // convert all close questions and remove the 'when not set' option 
05184 $query = "SELECT qpl_answers.answer_id FROM qpl_answers, qpl_questions WHERE qpl_answers.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = 6 AND qpl_answers.cloze_type = '1'";
05185 $res = $this->db->query($query);
05186 while($row1 = $res->fetchRow(DB_FETCHMODE_OBJECT))
05187 {
05188         $query = sprintf("UPDATE qpl_answers SET correctness = '1', points = 0 WHERE answer_id = %s AND correctness = '0'",
05189                 $this->db->quote($row1->answer_id . "")
05190         );
05191         $res2 = $this->db->query($query);
05192 }
05193 ?>
05194 <#361>
05195 DROP TABLE IF EXISTS `link_check_report`;
05196 CREATE TABLE `link_check_report` (
05197   `obj_id` int(11) NOT NULL default '0',
05198   `usr_id` int(11) NOT NULL default '0',
05199   PRIMARY KEY  (`obj_id`,`usr_id`)
05200 ) TYPE=MyISAM;
05201 <#362>
05202 DROP TABLE IF EXISTS `link_check`;
05203 CREATE TABLE `link_check` (
05204   `obj_id` int(11) NOT NULL default '0',
05205   `page_id` int(11) NOT NULL default '0',
05206   `url` varchar(255) NOT NULL default '',
05207   `parent_type` varchar(8) NOT NULL default ''
05208 ) TYPE=MyISAM;
05209 <#363>
05210 CREATE TABLE `tst_eval_users` (
05211 `eval_users_id` INT NOT NULL AUTO_INCREMENT ,
05212 `test_fi` INT NOT NULL ,
05213 `evaluator_fi` INT NOT NULL ,
05214 `user_fi` INT NOT NULL ,
05215 `TIMESTAMP` TIMESTAMP NOT NULL ,
05216 PRIMARY KEY ( `eval_users_id` ) ,
05217 INDEX ( `test_fi` , `evaluator_fi` , `user_fi` )
05218 ) COMMENT = 'Contains the users someone has chosen for a statistical evaluation';
05219 
05220 CREATE TABLE `tst_eval_groups` (
05221 `eval_users_id` INT NOT NULL AUTO_INCREMENT ,
05222 `test_fi` INT NOT NULL ,
05223 `evaluator_fi` INT NOT NULL ,
05224 `group_fi` INT NOT NULL ,
05225 `TIMESTAMP` TIMESTAMP NOT NULL ,
05226 PRIMARY KEY ( `eval_users_id` ) ,
05227 INDEX ( `test_fi` , `evaluator_fi` , `group_fi` )
05228 ) COMMENT = 'Contains the groups someone has chosen for a statistical evaluation';
05229 <#364>
05230 ALTER TABLE `tst_eval_groups` CHANGE `eval_users_id` `eval_groups_id` int(11) NOT NULL DEFAULT NULL auto_increment;
05231 
05232 <#365>
05233 DROP TABLE IF EXISTS `link_check`;
05234 CREATE TABLE `link_check` (
05235   `obj_id` int(11) NOT NULL default '0',
05236   `page_id` int(11) NOT NULL default '0',
05237   `url` varchar(255) NOT NULL default '',
05238   `parent_type` varchar(8) NOT NULL default '',
05239   `http_status_code` int(4) NOT NULL default '0',
05240   `last_check` int(11) NOT NULL default '0'
05241 ) TYPE=MyISAM;
05242 <#366>
05243 CREATE TABLE `survey_anonymous` (
05244 `anonymous_id` INT NOT NULL AUTO_INCREMENT ,
05245 `survey_key` VARCHAR( 32 ) NOT NULL ,
05246 `survey_fi` INT NOT NULL ,
05247 `TIMESTAMP` TIMESTAMP NOT NULL ,
05248 PRIMARY KEY ( `anonymous_id` ) ,
05249 INDEX ( `survey_key` , `survey_fi` )
05250 );
05251 <#367>
05252 ALTER TABLE `content_object` ADD `public_access_mode` ENUM( 'complete', 'selected' ) DEFAULT 'complete' NOT NULL;
05253 ALTER TABLE `lm_data` ADD `public_access` ENUM( 'y', 'n' ) DEFAULT 'n' NOT NULL AFTER `import_id`;
05254 ALTER TABLE `lm_data` ADD INDEX (`lm_id`);
05255 ALTER TABLE `lm_data` ADD INDEX (`type`);
05256 <#368>
05257 ALTER TABLE `survey_question` CHANGE `orientation` `orientation` ENUM( '0', '1', '2' ) DEFAULT '0';
05258 <#369>
05259 ALTER TABLE `survey_question` ADD `maxchars` INT DEFAULT '0' NOT NULL AFTER `orientation` ;
05260 <#370>
05261 ALTER TABLE content_object ADD public_html_file VARCHAR(50) DEFAULT '' NOT NULL;
05262 ALTER TABLE content_object ADD public_xml_file VARCHAR(50) DEFAULT '' NOT NULL;
05263 <#371>
05264 CREATE TABLE `survey_material` (
05265 `material_id` INT NOT NULL AUTO_INCREMENT ,
05266 `question_fi` INT NOT NULL ,
05267 `internal_link` VARCHAR( 50 ) ,
05268 `import_id` VARCHAR( 50 ) ,
05269 `TIMESTAMP` TIMESTAMP NOT NULL ,
05270 PRIMARY KEY ( `material_id` ) ,
05271 INDEX ( `question_fi` )
05272 );
05273 <#372>
05274 ALTER TABLE `survey_material` ADD `material_title` VARCHAR( 255 ) AFTER `import_id` ;
05275 <#373>
05276 ALTER TABLE content_object ADD COLUMN downloads_active ENUM('y','n') DEFAULT 'n';
05277 <#374>
05278 UPDATE object_data SET import_id='' WHERE import_id='Array';
05279 UPDATE lm_data SET import_id='' WHERE import_id='Array';
05280 <#375>
05281 CREATE TABLE `lm_menu` (
05282 `id` INT NOT NULL AUTO_INCREMENT ,
05283 `lm_id` INT NOT NULL ,
05284 `link_type` ENUM( 'extern', 'intern' ) ,
05285 `title` VARCHAR( 200 ) ,
05286 `target` VARCHAR( 200 ) ,
05287 `link_ref_id` INT,
05288 `active` ENUM( 'y', 'n' ) DEFAULT 'n' NOT NULL ,
05289 PRIMARY KEY ( `id` ) ,
05290 INDEX ( `link_type` ) ,
05291 INDEX ( `lm_id` ) ,
05292 INDEX ( `active` )
05293 );
05294 <#376>
05295 <?php
05296 
05297 // added fix for too small typ_id field
05298 $query = "ALTER TABLE rbac_ta CHANGE typ_id typ_id INT( 11 ) DEFAULT '0' NOT NULL ";
05299 $this->db->query($query);
05300 
05301 // register new object type 'assf' for Test&Assessment Administration
05302 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
05303                 "VALUES ('typ', 'assf', 'AssessmentFolder object', -1, now(), now())";
05304 $this->db->query($query);
05305 
05306 // ADD NODE IN SYSTEM SETTINGS FOLDER
05307 // create object data entry
05308 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
05309                 "VALUES ('assf', '__Test&Assessment', 'Test&Assessment Administration', -1, now(), now())";
05310 $this->db->query($query);
05311 
05312 $query = "SELECT LAST_INSERT_ID() as id";
05313 $res = $this->db->query($query);
05314 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
05315 
05316 // create object reference entry
05317 $query = "INSERT INTO object_reference (obj_id) VALUES('".$row->id."')";
05318 $res = $this->db->query($query);
05319 
05320 $query = "SELECT LAST_INSERT_ID() as id";
05321 $res = $this->db->query($query);
05322 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
05323 
05324 // put in tree
05325 $tree = new ilTree(ROOT_FOLDER_ID);
05326 $tree->insertNode($row->id,SYSTEM_FOLDER_ID);
05327 
05328 // register RECOVERY_FOLDER_ID in table settings
05329 $query = "INSERT INTO settings (keyword,value) VALUES('sys_assessment_folder_id','".$row->id."')";
05330 $res = $this->db->query($query);
05331 
05332 // retrieve assessment folder definition from object_data
05333 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' ".
05334         " AND title = 'assf'";
05335 $res = $this->db->query($query);
05336 $row = $res->fetchRow();
05337 $typ_id = $row[0];
05338 
05339 // add rbac operations to assessment folder
05340 // 1: edit_permissions, 2: visible, 3: read, 4:write
05341 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
05342 $this->db->query($query);
05343 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
05344 $this->db->query($query);
05345 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
05346 $this->db->query($query);
05347 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
05348 $this->db->query($query);
05349 ?>
05350 <#377>
05351 CREATE TABLE `ass_log` (
05352 `ass_log_id` INT NOT NULL AUTO_INCREMENT ,
05353 `user_fi` INT NOT NULL ,
05354 `obj_fi` INT NOT NULL ,
05355 `logtext` TEXT NOT NULL ,
05356 `question_fi` INT,
05357 `TIMESTAMP` TIMESTAMP NOT NULL ,
05358 PRIMARY KEY ( `ass_log_id` ) ,
05359 INDEX ( `user_fi` , `obj_fi` )
05360 ) COMMENT = 'Logging of Test&Assessment object changes';
05361 <#378>
05362 ALTER TABLE `ass_log` ADD `original_fi` INT AFTER `question_fi` ;
05363 <#379>
05364 INSERT INTO `qpl_question_type` ( `question_type_id` , `type_tag` ) VALUES ('8', 'qt_text') ;
05365 ALTER TABLE `qpl_questions` ADD `maxNrOfChars` INT DEFAULT '0' NOT NULL AFTER `params` ;
05366 ALTER TABLE `tst_solutions` CHANGE `value1` `value1` TEXT DEFAULT NULL ;
05367 <#380>
05368 <?php
05369 $ilCtrlStructureReader->getStructure();
05370 ?>
05371 <#381>
05372 ALTER TABLE `qpl_questions` CHANGE `maxNrOfChars` `maxNumOfChars` INT( 11 ) DEFAULT '0' NOT NULL;
05373 
05374 <#382>
05375 <?php
05376 
05377 // added fix for too small typ_id field
05378 $query = "ALTER TABLE rbac_ta CHANGE typ_id typ_id INT( 11 ) DEFAULT '0' NOT NULL ";
05379 $this->db->query($query);
05380 ?>
05381 <#383>
05382 ALTER TABLE `survey_question` CHANGE `maxchars` `maxchars` INT( 11 );
05383 <#384>
05384 <?php
05385 // fix misassigned pages (cut in lm x - pasted in lm y)
05386 $q = "SELECT * FROM lm_tree WHERE child > 1";
05387 $tree_set = $this->db->query($q);
05388 while($tree_rec = $tree_set->fetchRow(DB_FETCHMODE_ASSOC))
05389 {
05390         $q2 = "UPDATE page_object SET parent_id='".$tree_rec["lm_id"]."' WHERE page_id='".$tree_rec["child"]."' AND parent_type='lm'";
05391         $this->db->query($q2);
05392         $q3 = "UPDATE lm_data SET lm_id='".$tree_rec["lm_id"]."' WHERE obj_id='".$tree_rec["child"]."' AND type='pg'";
05393         $this->db->query($q3);
05394 }
05395 
05396 ?>
05397 <#385>
05398 <?php
05399 $ilCtrlStructureReader->getStructure();
05400 ?>
05401 <#386>
05402 DROP TABLE IF EXISTS `crs_objectives`;
05403 CREATE TABLE `crs_objectives` (
05404   `crs_id` int(11) NOT NULL default '0',
05405   `objective_id` int(11) NOT NULL auto_increment,
05406   `title` varchar(70) NOT NULL default '',
05407   `description` varchar(128) NOT NULL default '',
05408   `position` int(3) NOT NULL default '0',
05409   `created` int(11) NOT NULL default '0',
05410   PRIMARY KEY  (`objective_id`),
05411   KEY `crs_id` (`crs_id`)
05412 ) TYPE=MyISAM;
05413 
05414 DROP TABLE IF EXISTS `crs_objective_lm`;
05415 CREATE TABLE `crs_objective_lm` (
05416   `lm_ass_id` int(11) NOT NULL auto_increment,
05417   `objective_id` int(11) NOT NULL default '0',
05418   `ref_id` int(11) NOT NULL default '0',
05419   `obj_id` int(11) NOT NULL default '0',
05420   `type` char(6) NOT NULL default '',
05421   PRIMARY KEY  (`lm_ass_id`)
05422 ) TYPE=MyISAM AUTO_INCREMENT=14 ;
05423 
05424 <#387>
05425 DROP TABLE IF EXISTS `style_folder_styles`;
05426 CREATE TABLE `style_folder_styles` (
05427   `folder_id` int(11) NOT NULL default '0',
05428   `style_id` int(11) NOT NULL default '0',
05429   INDEX f_id (`folder_id`)
05430 ) TYPE=MyISAM;
05431 
05432 <#388>
05433 <?php
05434 
05435 // insert style folder type to object data
05436 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
05437                 "VALUES ('typ', 'styf', 'Style Folder', -1, now(), now())";
05438 $this->db->query($query);
05439 
05440 $query = "SELECT LAST_INSERT_ID() as id";
05441 $res = $this->db->query($query);
05442 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
05443 
05444 // insert operations for style folder type
05445 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','1')";
05446 $this->db->query($query);
05447 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','2')";
05448 $this->db->query($query);
05449 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','3')";
05450 $this->db->query($query);
05451 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','4')";
05452 $this->db->query($query);
05453 
05454 // CREATE SYSTEM STYLE FOLDER
05455 // create object data entry
05456 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
05457                 "VALUES ('styf', 'System Style Folder', 'System Style Templates', -1, now(), now())";
05458 $this->db->query($query);
05459 
05460 // get style folder number
05461 $query = "SELECT LAST_INSERT_ID() as id";
05462 $res = $this->db->query($query);
05463 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
05464 $sty_folder_id = $row->id;
05465 
05466 // create object reference entry
05467 $query = "INSERT INTO object_reference (obj_id) VALUES('".$row->id."')";
05468 $res = $this->db->query($query);
05469 
05470 $query = "SELECT LAST_INSERT_ID() as id";
05471 $res = $this->db->query($query);
05472 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
05473 
05474 // put in tree
05475 $tree = new ilTree(ROOT_FOLDER_ID);
05476 $tree->insertNode($row->id,SYSTEM_FOLDER_ID);
05477 
05478 ?>
05479 <#389>
05480 DROP TABLE IF EXISTS `crs_objective_qst`;
05481 CREATE TABLE `crs_objective_qst` (
05482   `qst_ass_id` int(11) NOT NULL auto_increment,
05483   `objective_id` int(11) NOT NULL default '0',
05484   `ref_id` int(11) NOT NULL default '0',
05485   `obj_id` int(11) NOT NULL default '0',
05486   `question_id` int(11) NOT NULL default '0',
05487   PRIMARY KEY  (`qst_ass_id`)
05488 ) TYPE=MyISAM;
05489 
05490 <#390>
05491 
05492 CREATE TABLE IF NOT EXISTS `crs_objective_tst` (
05493   `test_objective_id` int(11) NOT NULL auto_increment,
05494   `objective_id` int(11) NOT NULL default '0',
05495   `ref_id` int(11) NOT NULL default '0',
05496   `obj_id` int(11) NOT NULL default '0',
05497   `tst_status` tinyint(2) default NULL,
05498   `tst_limit` tinyint(3) default NULL,
05499   PRIMARY KEY  (`test_objective_id`)
05500 ) TYPE=MyISAM;
05501 <#391>
05502 ALTER TABLE `crs_settings` ADD `abo` TINYINT( 2 ) DEFAULT '1';
05503 <#392>
05504 <?php
05505 $ilCtrlStructureReader->getStructure();
05506 ?>
05507 <#393>
05508 ALTER TABLE `crs_settings` ADD `objective_view` TINYINT( 2 ) DEFAULT '0';
05509 <#394>
05510 <?php
05511 // insert iLinc course definition in object_data
05512 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
05513                  "VALUES ('typ', 'icrs', 'iLinc course object', -1, now(), now())";
05514 $this->db->query($query);
05515 
05516 // fetch type id
05517 $query = "SELECT LAST_INSERT_ID()";
05518 $res = $this->db->query($query);
05519 $row = $res->fetchRow();
05520 $typ_id = $row[0];
05521 
05522 // add operation assignment to iLinc course object definition
05523 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
05524 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
05525 $this->db->query($query);
05526 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
05527 $this->db->query($query);
05528 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
05529 $this->db->query($query);
05530 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
05531 $this->db->query($query);
05532 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
05533 $this->db->query($query);
05534 
05535 // insert iLinc classroom definition in object_data
05536 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
05537                  "VALUES ('typ', 'icla', 'iLinc class room object', -1, now(), now())";
05538 $this->db->query($query);
05539 
05540 // fetch type id
05541 $query = "SELECT LAST_INSERT_ID()";
05542 $res = $this->db->query($query);
05543 $row = $res->fetchRow();
05544 $typ_id = $row[0];
05545 
05546 // add operation assignment to iLinc course object definition
05547 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
05548 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
05549 $this->db->query($query);
05550 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
05551 $this->db->query($query);
05552 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
05553 $this->db->query($query);
05554 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
05555 $this->db->query($query);
05556 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
05557 $this->db->query($query);
05558 ?>
05559 
05560 CREATE TABLE IF NOT EXISTS `ilinc_data` (
05561   `obj_id` INT(11) UNSIGNED NOT NULL,
05562   `type` CHAR(5) NOT NULL,
05563   `course_id` INT(11) UNSIGNED NOT NULL,
05564   `class_id` INT(11) UNSIGNED,
05565   `user_id` INT(11) UNSIGNED,
05566   INDEX (`obj_id`)
05567 ) TYPE=MyISAM;
05568 
05569 ALTER TABLE `usr_data` ADD `ilinc_id` INT UNSIGNED;
05570 
05571 <#395>
05572 <?php
05573 $ilCtrlStructureReader->getStructure();
05574 ?>
05575 <#396>
05576 CREATE TABLE IF NOT EXISTS `crs_objective_results` (
05577   `res_id` int(11) NOT NULL auto_increment,
05578   `usr_id` int(11) NOT NULL default '0',
05579   `question_id` int(11) NOT NULL default '0',
05580   `points` int(11) NOT NULL default '0',
05581   PRIMARY KEY  (`res_id`)
05582 ) TYPE=MyISAM;
05583 <#397>
05584 CREATE TABLE IF NOT EXISTS `crs_lm_history` (
05585   `usr_id` int(11) NOT NULL default '0',
05586   `crs_ref_id` int(11) NOT NULL default '0',
05587   `lm_ref_id` int(11) NOT NULL default '0',
05588   `lm_page_id` int(11) NOT NULL default '0',
05589   `last_access` int(11) NOT NULL default '0',
05590   PRIMARY KEY  (`usr_id`,`crs_ref_id`,`lm_ref_id`)
05591 ) TYPE=MyISAM;
05592 <#398>
05593 <#399>
05594 <?php
05595 // insert course grouping object in object_data
05596 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
05597                  "VALUES ('typ', 'crsg', 'Course grouping object', -1, now(), now())";
05598 $this->db->query($query);
05599 
05600 // fetch type id
05601 $query = "SELECT LAST_INSERT_ID()";
05602 $res = $this->db->query($query);
05603 $row = $res->fetchRow();
05604 $typ_id = $row[0];
05605 
05606 // add operation assignment to iLinc course object definition
05607 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
05608 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
05609 $this->db->query($query);
05610 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
05611 $this->db->query($query);
05612 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
05613 $this->db->query($query);
05614 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
05615 $this->db->query($query);
05616 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
05617 $this->db->query($query);
05618 ?>
05619 <#400>
05620 <?php
05621 $ilCtrlStructureReader->getStructure();
05622 ?>
05623 <#401>
05624 ALTER TABLE `tst_eval_groups` ADD INDEX ( `test_fi` );
05625 ALTER TABLE `tst_eval_groups` ADD INDEX ( `evaluator_fi` );
05626 ALTER TABLE `tst_eval_groups` ADD INDEX ( `group_fi` );
05627 ALTER TABLE `tst_eval_settings` ADD INDEX ( `user_fi` );
05628 ALTER TABLE `tst_eval_users` ADD INDEX ( `evaluator_fi` );
05629 ALTER TABLE `tst_eval_users` ADD INDEX ( `user_fi` );
05630 ALTER TABLE `tst_eval_users` ADD INDEX ( `test_fi` );
05631 ALTER TABLE `tst_mark` ADD INDEX ( `test_fi` );
05632 ALTER TABLE `tst_solutions` ADD INDEX ( `question_fi` );
05633 ALTER TABLE `tst_test_question` ADD INDEX ( `test_fi` );
05634 ALTER TABLE `tst_test_question` ADD INDEX ( `question_fi` );
05635 ALTER TABLE `tst_test_random` ADD INDEX ( `test_fi` );
05636 ALTER TABLE `tst_test_random` ADD INDEX ( `questionpool_fi` );
05637 ALTER TABLE `tst_test_random_question` ADD INDEX ( `test_fi` );
05638 ALTER TABLE `tst_test_random_question` ADD INDEX ( `user_fi` );
05639 ALTER TABLE `tst_test_random_question` ADD INDEX ( `question_fi` );
05640 ALTER TABLE `tst_tests` ADD INDEX ( `obj_fi` );
05641 ALTER TABLE `tst_tests` ADD INDEX ( `test_type_fi` );
05642 ALTER TABLE `tst_times` ADD INDEX ( `active_fi` );
05643 ALTER TABLE `survey_anonymous` ADD INDEX ( `survey_fi` );
05644 ALTER TABLE `survey_answer` ADD INDEX ( `survey_fi` );
05645 ALTER TABLE `survey_answer` ADD INDEX ( `question_fi` );
05646 ALTER TABLE `survey_answer` ADD INDEX ( `user_fi` );
05647 ALTER TABLE `survey_answer` ADD INDEX ( `anonymous_id` );
05648 ALTER TABLE `survey_category` ADD INDEX ( `owner_fi` );
05649 ALTER TABLE `survey_constraint` ADD INDEX ( `question_fi` );
05650 ALTER TABLE `survey_constraint` ADD INDEX ( `relation_fi` );
05651 ALTER TABLE `survey_finished` ADD INDEX ( `survey_fi` );
05652 ALTER TABLE `survey_finished` ADD INDEX ( `user_fi` );
05653 ALTER TABLE `survey_finished` ADD INDEX ( `anonymous_id` );
05654 ALTER TABLE `survey_invited_group` ADD INDEX ( `survey_fi` );
05655 ALTER TABLE `survey_invited_group` ADD INDEX ( `group_fi` );
05656 ALTER TABLE `survey_invited_user` ADD INDEX ( `survey_fi` );
05657 ALTER TABLE `survey_invited_user` ADD INDEX ( `user_fi` );
05658 ALTER TABLE `survey_phrase` ADD INDEX ( `owner_fi` );
05659 ALTER TABLE `survey_phrase_category` ADD INDEX ( `phrase_fi` );
05660 ALTER TABLE `survey_phrase_category` ADD INDEX ( `category_fi` );
05661 ALTER TABLE `survey_question` ADD INDEX ( `obj_fi` );
05662 ALTER TABLE `survey_question` ADD INDEX ( `owner_fi` );
05663 ALTER TABLE `survey_question_constraint` ADD INDEX ( `survey_fi` );
05664 ALTER TABLE `survey_question_constraint` ADD INDEX ( `question_fi` );
05665 ALTER TABLE `survey_question_constraint` ADD INDEX ( `constraint_fi` );
05666 ALTER TABLE `survey_questionblock` ADD INDEX ( `owner_fi` );
05667 ALTER TABLE `survey_questionblock_question` ADD INDEX ( `survey_fi` );
05668 ALTER TABLE `survey_questionblock_question` ADD INDEX ( `questionblock_fi` );
05669 ALTER TABLE `survey_questionblock_question` ADD INDEX ( `question_fi` );
05670 ALTER TABLE `survey_survey` ADD INDEX ( `obj_fi` );
05671 ALTER TABLE `survey_survey_question` ADD INDEX ( `survey_fi` );
05672 ALTER TABLE `survey_survey_question` ADD INDEX ( `question_fi` );
05673 ALTER TABLE `survey_variable` ADD INDEX ( `category_fi` );
05674 ALTER TABLE `survey_variable` ADD INDEX ( `question_fi` );
05675 <#402>
05676 CREATE TABLE IF NOT EXISTS `crs_groupings` (
05677   `crs_grp_id` int(11) NOT NULL default '0',
05678   `crs_id` int(11) NOT NULL default '0',
05679   `unique_field` char(32) NOT NULL default '',
05680   PRIMARY KEY  (`crs_grp_id`),
05681   KEY `crs_id` (`crs_id`)
05682 ) TYPE=MyISAM;
05683 <#403>
05684 <?php
05685 $ilCtrlStructureReader->getStructure();
05686 ?>
05687 <#404>
05688 <?php
05689 $ilCtrlStructureReader->getStructure();
05690 ?>
05691 <#405>
05692 CREATE TABLE IF NOT EXISTS `crs_start` (
05693   `crs_start_id` int(11) NOT NULL auto_increment,
05694   `crs_id` int(11) NOT NULL default '0',
05695   `item_ref_id` int(11) NOT NULL default '0',
05696   PRIMARY KEY  (`crs_start_id`),
05697   KEY `crs_id` (`crs_id`)
05698 ) TYPE=MyISAM AUTO_INCREMENT=1;
05699 <#406>
05700 <?php
05701 // change style folder to style settings
05702 $query = "UPDATE object_data SET title='stys', description='Style Settings'".
05703                 " WHERE title='styf' AND type='typ'";
05704 $this->db->query($query);
05705 
05706 // change style folder to style settings
05707 $query = "UPDATE object_data SET type='stys', title = 'System Style Settings',".
05708                 " description = 'Manage system skin and style settings here' ".
05709                 " WHERE type='styf' ";
05710 $this->db->query($query);
05711 ?>
05712 <#407>
05713 DROP TABLE IF EXISTS `settings_deactivated_styles`;
05714 CREATE TABLE `settings_deactivated_styles` (
05715         `skin` VARCHAR(100) NOT NULL,
05716         `style` VARCHAR(100) NOT NULL,
05717         PRIMARY KEY (`skin`,`style`)
05718 ) TYPE=MyISAM;
05719 <#408>
05720 <?php
05721 // change style folder to style settings
05722 $query = "INSERT INTO settings (keyword, value) VALUES ('default_repository_view','flat')";
05723 $this->db->query($query);
05724 ?>
05725 <#409>
05726 <?php
05727 // ADD new permission push desktop items
05728 $query = "SELECT * FROM object_data WHERE type = 'typ' AND title = 'usrf'";
05729 $res = $this->db->query($query);
05730 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
05731 {
05732         $type_id = $row->obj_id;
05733 }
05734 
05735 // INSERT new operation push_sesktop_items
05736 $query = "INSERT INTO rbac_operations ".
05737         "SET operation = 'push_desktop_items', description = 'Allow pushing desktop items'";
05738 
05739 $this->db->query($query);
05740 // GET new ops_id
05741 $query = "SELECT LAST_INSERT_ID() as ops_id FROM rbac_operations ";
05742 $res = $this->db->getRow($query);
05743 $ops_id = $res->ops_id;
05744 
05745 // INSERT in rbac_ta
05746 $query = "INSERT INTO rbac_ta SET typ_id = '".$type_id."', ops_id = '".$ops_id."'";
05747 $this->db->query($query);
05748 ?>
05749 <#410>
05750 <?php
05751 $query = "SELECT * FROM object_data ".
05752         "WHERE type = 'typ' AND title = 'crsg'";
05753 
05754 $res = $this->db->getRow($query);
05755 $ops_id = $res->obj_id;
05756 
05757 $query = "DELETE FROM rbac_ta WHERE typ_id = '".$ops_id."'";
05758 $this->db->query($query);
05759 ?>
05760 <#411>
05761 <?php
05762 $ilCtrlStructureReader->getStructure();
05763 ?>
05764 <#412>
05765 CREATE TABLE IF NOT EXISTS `role_desktop_items` (
05766   `role_item_id` int(11) NOT NULL auto_increment,
05767   `role_id` int(11) NOT NULL default '0',
05768   `item_id` int(11) NOT NULL default '0',
05769   `item_type` char(16) NOT NULL default '',
05770   KEY `role_item_id` (`role_item_id`,`role_id`)
05771 ) TYPE=MyISAM AUTO_INCREMENT=1 ;
05772 
05773 <#413>
05774 <?php
05775 $ilDB->query("DELETE FROM conditions WHERE operator = 'not_member'");
05776 $ilDB->query('DELETE FROM crs_groupings');
05777 ?>
05778 
05779 <#414>
05780 ALTER TABLE `crs_groupings` ADD `crs_ref_id` INT( 11 ) NOT NULL AFTER `crs_grp_id` ;
05781 
05782 
05783 <#415>
05784 ALTER TABLE media_item ADD COLUMN tried_thumb ENUM('y','n') DEFAULT 'n';
05785 
05786 <#416>
05787 <?php
05788 // insert link definition in object_data
05789 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
05790                  "VALUES ('typ', 'webr', 'Link resource object', -1, now(), now())";
05791 $this->db->query($query);
05792 
05793 // fetch type id
05794 $query = "SELECT LAST_INSERT_ID()";
05795 $res = $this->db->query($query);
05796 $row = $res->fetchRow();
05797 $typ_id = $row[0];
05798 
05799 
05800 // add operation assignment to link object definition
05801 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete, 7: subscribe, 8:unsubscribe
05802 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
05803 $this->db->query($query);
05804 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
05805 $this->db->query($query);
05806 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
05807 $this->db->query($query);
05808 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
05809 $this->db->query($query);
05810 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','6')";
05811 $this->db->query($query);
05812 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','7')";
05813 $this->db->query($query);
05814 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','8')";
05815 $this->db->query($query);
05816 
05817 // add create operation
05818 $query = "INSERT INTO rbac_operations ".
05819         "SET operation = 'create_webr', description = 'create web resource'";
05820 $this->db->query($query);
05821 
05822 // get new ops_id
05823 $query = "SELECT LAST_INSERT_ID()";
05824 $res = $this->db->query($query);
05825 $row = $res->fetchRow();
05826 $ops_id = $row[0];
05827 
05828 // add create for crs,cat,fold and grp
05829 // get category type id
05830 $query = "SELECT obj_id FROM object_data WHERE type='typ' and title='cat'";
05831 $res = $this->db->query($query);
05832 $row = $res->fetchRow();
05833 $typ_id = $row[0];
05834 
05835 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','".$ops_id."')";
05836 $this->db->query($query);
05837 
05838 $query = "SELECT obj_id FROM object_data WHERE type='typ' and title='crs'";
05839 $res = $this->db->query($query);
05840 $row = $res->fetchRow();
05841 $typ_id = $row[0];
05842 
05843 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','".$ops_id."')";
05844 $this->db->query($query);
05845 
05846 $query = "SELECT obj_id FROM object_data WHERE type='typ' and title='grp'";
05847 $res = $this->db->query($query);
05848 $row = $res->fetchRow();
05849 $typ_id = $row[0];
05850 
05851 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','".$ops_id."')";
05852 $this->db->query($query);
05853 
05854 $query = "SELECT obj_id FROM object_data WHERE type='typ' and title='fold'";
05855 $res = $this->db->query($query);
05856 $row = $res->fetchRow();
05857 $typ_id = $row[0];
05858 
05859 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','".$ops_id."')";
05860 $this->db->query($query);
05861 ?>
05862 <#417>
05863 CREATE TABLE `webr_items` (
05864   `link_id` int(11) NOT NULL auto_increment,
05865   `webr_id` int(11) NOT NULL default '0',
05866   `title` varchar(127) default NULL,
05867   `target` text,
05868   `active` tinyint(1) default NULL,
05869   `disable_check` tinyint(1) default NULL,
05870   `create_date` int(11) NOT NULL default '0',
05871   `last_update` int(11) NOT NULL default '0',
05872   `last_check` int(11) default NULL,
05873   `valid` tinyint(1) NOT NULL default '0',
05874   KEY `link_id` (`link_id`,`webr_id`)
05875 ) TYPE=MyISAM AUTO_INCREMENT=1 ;
05876 
05877 <#418>
05878 ALTER TABLE benchmark MODIFY module VARCHAR(150);
05879 ALTER TABLE benchmark MODIFY benchmark VARCHAR(150);
05880 
05881 <#419>
05882 ALTER TABLE usr_data ADD COLUMN `client_ip` VARCHAR(15) AFTER `ilinc_id`;
05883 
05884 <#420>
05885 <?php
05886 $ilCtrlStructureReader->getStructure();
05887 ?>
05888 <#421>
05889 DROP TABLE IF EXISTS il_meta_annotation;
05890 CREATE TABLE il_meta_annotation (
05891   meta_annotation_id int(11) NOT NULL AUTO_INCREMENT,
05892   rbac_id int(11) NULL,
05893   obj_id int(11) NULL,
05894   obj_type CHAR(6) NULL,
05895   entity TEXT NULL,
05896   date TEXT NULL,
05897   description TEXT NULL,
05898   description_language CHAR(2) NULL,
05899   PRIMARY KEY(meta_annotation_id)
05900 );
05901 DROP TABLE IF EXISTS il_meta_classification;
05902 CREATE TABLE il_meta_classification (
05903   meta_classification_id int(11) NOT NULL AUTO_INCREMENT,
05904   rbac_id int(11) NULL,
05905   obj_id int(11) NULL,
05906   obj_type CHAR NULL,
05907   purpose CHAR(32) NULL,
05908   description TEXT NULL,
05909   description_language CHAR(2) NULL,
05910   PRIMARY KEY(meta_classification_id)
05911 );
05912 DROP TABLE IF EXISTS il_meta_contribute;
05913 CREATE TABLE il_meta_contribute (
05914   meta_contribute_id int(11) NOT NULL AUTO_INCREMENT,
05915   rbac_id int(11) NULL,
05916   obj_id int(11) NULL,
05917   obj_type CHAR(6) NULL,
05918   parent_type CHAR(16) NULL,
05919   parent_id int(11) NULL,
05920   role CHAR(32) NULL,
05921   date TEXT NULL,
05922   PRIMARY KEY(meta_contribute_id)
05923 );
05924 
05925 DROP TABLE IF EXISTS il_meta_description;
05926 CREATE TABLE il_meta_description (
05927   meta_description_id int(11) NOT NULL AUTO_INCREMENT,
05928   rbac_id int(11) NULL,
05929   obj_id int(11) NULL,
05930   obj_type CHAR(6) NULL,
05931   parent_type CHAR(16) NULL,
05932   parent_id int(11) NULL,
05933   description TEXT NULL,
05934   description_language CHAR(2) NULL,
05935   PRIMARY KEY(meta_description_id)
05936 );
05937 
05938 DROP TABLE IF EXISTS il_meta_educational;
05939 CREATE TABLE il_meta_educational (
05940   meta_educational_id int(11) NOT NULL AUTO_INCREMENT,
05941   rbac_id int(11) NULL,
05942   obj_id int(11) NULL,
05943   obj_type CHAR(6) NULL,
05944   interactivity_type CHAR(16) NULL,
05945   learning_resource_type CHAR(32) NULL,
05946   interactivity_level CHAR(16) NULL,
05947   semantic_density CHAR(16) NULL,
05948   intended_end_user_row CHAR(16) NULL,
05949   context CHAR(16) NULL,
05950   difficulty CHAR(16) NULL,
05951   typical_learning_time TEXT NULL,
05952   PRIMARY KEY(meta_educational_id)
05953 );
05954 
05955 DROP TABLE IF EXISTS il_meta_entity;
05956 CREATE TABLE il_meta_entity (
05957   meta_entity_id int(11) NOT NULL AUTO_INCREMENT,
05958   rbac_id int(11) NULL,
05959   obj_id int(11) NULL,
05960   obj_type CHAR(6) NULL,
05961   parent_type CHAR(16) NULL,
05962   parent_id int(11) NULL,
05963   entity TEXT NULL,
05964   PRIMARY KEY(meta_entity_id)
05965 );
05966 
05967 DROP TABLE IF EXISTS il_meta_format;
05968 CREATE TABLE il_meta_format (
05969   meta_format_id int(11) NOT NULL AUTO_INCREMENT,
05970   rbac_id int(11) NULL,
05971   obj_id int(11) NULL,
05972   obj_type CHAR(6) NULL,
05973   parent_type CHAR(16) NULL,
05974   parent_id int(11) NULL,
05975   format TEXT NULL,
05976   PRIMARY KEY(meta_format_id)
05977 );
05978 
05979 DROP TABLE IF EXISTS il_meta_general;
05980 CREATE TABLE il_meta_general (
05981   meta_general_id int(11) NOT NULL AUTO_INCREMENT,
05982   rbac_id int(11) NULL,
05983   obj_id int(11) NULL,
05984   obj_type CHAR(6) NULL,
05985   general_structure CHAR(16) NULL,
05986   title TEXT NOT NULL,
05987   title_language CHAR(2) NULL,
05988   coverage TEXT NULL,
05989   coverage_language CHAR(2) NULL,
05990   PRIMARY KEY(meta_general_id)
05991 );
05992 
05993 DROP TABLE IF EXISTS il_meta_identifier;
05994 CREATE TABLE il_meta_identifier (
05995   meta_identifier_id int(11) NOT NULL AUTO_INCREMENT,
05996   rbac_id int(11) NULL,
05997   obj_id int(11) NULL,
05998   obj_type CHAR(6) NULL,
05999   parent_type CHAR(16) NULL,
06000   parent_id int(11) NULL,
06001   catalog TEXT NULL,
06002   entry_id TEXT NULL,
06003   PRIMARY KEY(meta_identifier_id)
06004 );
06005 
06006 DROP TABLE IF EXISTS il_meta_identifier_;
06007 CREATE TABLE il_meta_identifier_ (
06008   meta_identifier__id int(11) NOT NULL AUTO_INCREMENT,
06009   rbac_id int(11) NULL,
06010   obj_id int(11) NULL,
06011   obj_type CHAR(6) NULL,
06012   parent_type CHAR(16) NULL,
06013   parent_id int(11) NULL,
06014   catalog TEXT NULL,
06015   entry TEXT NULL,
06016   PRIMARY KEY(meta_identifier__id)
06017 );
06018 
06019 DROP TABLE IF EXISTS il_meta_keyword;
06020 CREATE TABLE il_meta_keyword (
06021   meta_keyword_id int(11) NOT NULL AUTO_INCREMENT,
06022   rbac_id int(11) NULL,
06023   obj_id int(11) NULL,
06024   obj_type CHAR(6) NULL,
06025   parent_type CHAR(16) NULL,
06026   parent_id CHAR NULL,
06027   keyword TEXT NULL,
06028   keyword_language CHAR(2) NULL,
06029   PRIMARY KEY(meta_keyword_id)
06030 );
06031 
06032 DROP TABLE IF EXISTS il_meta_language;
06033 CREATE TABLE il_meta_language (
06034   meta_language_id int(11) NOT NULL AUTO_INCREMENT,
06035   rbac_id int(11) NULL,
06036   obj_id int(11) NULL,
06037   obj_type CHAR(6) NULL,
06038   parent_type CHAR(16) NULL,
06039   parent_id int(11) NULL,
06040   language CHAR(2) NULL,
06041   PRIMARY KEY(meta_language_id)
06042 );
06043 
06044 DROP TABLE IF EXISTS il_meta_lifecycle;
06045 CREATE TABLE il_meta_lifecycle (
06046   meta_lifecycle_id int(11) NOT NULL AUTO_INCREMENT,
06047   rbac_id int(11) NULL,
06048   obj_id int(11) NULL,
06049   obj_type CHAR(6) NULL,
06050   lifecycle_status CHAR(16) NULL,
06051   meta_version TEXT NULL,
06052   version_language CHAR(2) BINARY NULL,
06053   PRIMARY KEY(meta_lifecycle_id)
06054 );
06055 
06056 DROP TABLE IF EXISTS il_meta_location;
06057 CREATE TABLE il_meta_location (
06058   meta_location_id int(11) NOT NULL AUTO_INCREMENT,
06059   rbac_id int(11) NULL,
06060   obj_id int(11) NULL,
06061   obj_type CHAR(6) NULL,
06062   parent_type CHAR(16) NOT NULL,
06063   parent_id int(11) NULL,
06064   location TEXT NULL,
06065   location_type CHAR(16) NULL,
06066   PRIMARY KEY(meta_location_id)
06067 );
06068 
06069 DROP TABLE IF EXISTS il_meta_meta_data;
06070 CREATE TABLE il_meta_meta_data (
06071   meta_meta_data_id int(11) NOT NULL AUTO_INCREMENT,
06072   rbac_id int(11) NULL,
06073   obj_id int(11) NULL,
06074   obj_type CHAR(6) NULL,
06075   meta_data_scheme CHAR(16) NULL,
06076   language CHAR(2) NULL,
06077   PRIMARY KEY(meta_meta_data_id)
06078 );
06079 
06080 DROP TABLE IF EXISTS il_meta_relation;
06081 CREATE TABLE il_meta_relation (
06082   meta_relation_id int(11) NOT NULL AUTO_INCREMENT,
06083   rbac_id int(11) NULL,
06084   obj_id int(11) NULL,
06085   obj_type CHAR(6) NULL,
06086   kind CHAR(16) NULL,
06087   PRIMARY KEY(meta_relation_id)
06088 );
06089 
06090 DROP TABLE IF EXISTS il_meta_requirement;
06091 CREATE TABLE il_meta_requirement (
06092   meta_requirement_id int(11) NOT NULL AUTO_INCREMENT,
06093   rbac_id int(11) NULL,
06094   obj_id int(11) NULL,
06095   obj_type CHAR(6) NULL,
06096   parent_type CHAR(16) NULL,
06097   parent_id int(11) NULL,
06098   operating_system_name CHAR(16) NULL,
06099   operating_system_minimum_version TEXT NULL,
06100   operating_system_maximum_version TEXT NULL,
06101   browser_name CHAR(32) NULL,
06102   browser_minimum_version TEXT NULL,
06103   browser_maximum_version TEXT NULL,
06104   PRIMARY KEY(meta_requirement_id)
06105 );
06106 
06107 DROP TABLE IF EXISTS il_meta_rights;
06108 CREATE TABLE il_meta_rights (
06109   meta_rights_id int(11) NOT NULL AUTO_INCREMENT,
06110   rbac_id int(11) NULL,
06111   obj_id int(11) NULL,
06112   obj_type CHAR(6) NULL,
06113   costs CHAR(3) NULL,
06114   copyright_and_other_restrictions CHAR(3) NULL,
06115   description TEXT NULL,
06116   description_language CHAR(2) NULL,
06117   PRIMARY KEY(meta_rights_id)
06118 );
06119 
06120 DROP TABLE IF EXISTS il_meta_taxon;
06121 CREATE TABLE il_meta_taxon (
06122   meta_taxon_id int(11) NOT NULL AUTO_INCREMENT,
06123   rbac_id int(11) NULL,
06124   obj_id int(11) NULL,
06125   obj_type CHAR(6) NULL,
06126   parent_type CHAR NULL,
06127   parent_id int(11) NULL,
06128   taxon TEXT NULL,
06129   taxon_language CHAR(2) NULL,
06130   taxon_id TEXT NULL,
06131   PRIMARY KEY(meta_taxon_id)
06132 );
06133 
06134 DROP TABLE IF EXISTS il_meta_taxon_path;
06135 CREATE TABLE il_meta_taxon_path (
06136   meta_taxon_path_id int(11) NOT NULL AUTO_INCREMENT,
06137   rbac_id int(11) NULL,
06138   obj_id int(11) NULL,
06139   obj_type CHAR(6) NULL,
06140   parent_type CHAR(16) NULL,
06141   parent_id int(11) NULL,
06142   source TEXT NULL,
06143   source_language CHAR(2) NULL,
06144   PRIMARY KEY(meta_taxon_path_id)
06145 );
06146 
06147 DROP TABLE IF EXISTS il_meta_technical;
06148 CREATE TABLE il_meta_technical (
06149   meta_technical_id int(11) NOT NULL AUTO_INCREMENT,
06150   rbac_id int(11) NULL,
06151   obj_id int(11) NULL,
06152   obj_type CHAR(6) NULL,
06153   size TEXT NULL,
06154   installation_remarks TEXT NULL,
06155   installation_remarks_language CHAR(2) NULL,
06156   other_platform_requirements TEXT NULL,
06157   other_platform_requirements_language CHAR(2) NULL,
06158   duration TEXT NULL,
06159   PRIMARY KEY(meta_technical_id)
06160 );
06161 
06162 DROP TABLE IF EXISTS il_meta_typical_age_range;
06163 CREATE TABLE il_meta_typical_age_range (
06164   meta_typical_age_range_id int(11) NOT NULL AUTO_INCREMENT,
06165   rbac_id int(11) NULL,
06166   obj_id int(11) NULL,
06167   obj_type CHAR(6) NULL,
06168   parent_type CHAR(16) NULL,
06169   parent_id int(11) NULL,
06170   typical_age_range TEXT NULL,
06171   typical_age_range_language CHAR(2) NULL,
06172   PRIMARY KEY(meta_typical_age_range_id)
06173 );
06174 
06175 <#422>
06176 
06177 ALTER TABLE tst_active 
06178 ADD COLUMN `submitted` TINYINT UNSIGNED DEFAULT 0 AFTER `TIMESTAMP`,
06179 ADD COLUMN `submittimestamp` DATETIME AFTER `submitted`;
06180 
06181 CREATE TABLE `tst_active_qst_sol_settings` (
06182   `test_fi` int(10) unsigned NOT NULL default '0',
06183   `user_fi` int(10) unsigned NOT NULL default '0',
06184   `question_fi` int(10) unsigned NOT NULL default '0',
06185   `solved` tinyint(3) unsigned NOT NULL default '0',
06186   PRIMARY KEY  (`test_fi`,`user_fi`,`question_fi`)
06187 ) TYPE=MyISAM;
06188 
06189 CREATE TABLE `tst_invited_user` (
06190   `test_fi` int(11) NOT NULL default '0',
06191   `user_fi` int(11) NOT NULL default '0',
06192   `TIMESTAMP` timestamp(14) NOT NULL,
06193   `clientip` varchar(15) default NULL,
06194   PRIMARY KEY  (`test_fi`,`user_fi`)
06195 ) TYPE=MyISAM;
06196 
06197 INSERT INTO tst_test_type SET test_type_id=4, type_tag='tt_online_exam';
06198 
06199 
06200 <#423>
06201 ALTER TABLE `il_meta_classification` CHANGE `obj_type` `obj_type` VARCHAR( 6 ) NULL DEFAULT NULL;
06202 ALTER TABLE `il_meta_contribute` CHANGE `parent_type` `parent_type` VARCHAR( 32 ) NULL DEFAULT NULL;
06203 ALTER TABLE `il_meta_educational` CHANGE `intended_end_user_row` `intended_end_user_role` VARCHAR( 16 ) NULL DEFAULT NULL;
06204 ALTER TABLE `il_meta_identifier` CHANGE `entry_id` `entry` TEXT NULL DEFAULT NULL;
06205 ALTER TABLE `il_meta_keyword` CHANGE `parent_id` `parent_id` INT( 11 ) NULL DEFAULT NULL;
06206 ALTER TABLE `il_meta_taxon` CHANGE `parent_type` `parent_type` CHAR( 32 ) NULL DEFAULT NULL;
06207 ALTER TABLE `il_meta_taxon_path` CHANGE `parent_type` `parent_type` VARCHAR( 32 ) NULL DEFAULT NULL ;
06208 
06209 <#424>
06210 ALTER TABLE `il_meta_requirement` ADD `or_composite_id` INT( 11 ) NOT NULL ;
06211 
06212 <#425>
06213 ALTER TABLE `il_meta_keyword` CHANGE `parent_type` `parent_type` VARCHAR( 32 ) NULL DEFAULT NULL;
06214 
06215 <#426>
06216 <?php
06217 $ilCtrlStructureReader->getStructure();
06218 ?>
06219 <?php
06220 $wd = getcwd();
06221 chdir('..');
06222 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDCreator.php';
06223 
06224 
06225 $webr_ids = array();
06226 $query = "SELECT * FROM object_data WHERE type = 'webr'";
06227 $res = $ilDB->query($query);
06228 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
06229 {
06230         $webr_ids[$row->obj_id]['title'] = $row->title;
06231         $webr_ids[$row->obj_id]['desc'] = $row->description;
06232 
06233 }
06234 
06235 foreach($webr_ids as $id => $data)
06236 {
06237         $query = "SELECT ref_id FROM object_reference WHERE obj_id = '".$id."'";
06238 
06239         $res = $ilDB->query($query);
06240         while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
06241         {
06242                 $md_creator = new ilMDCreator($row->ref_id,$id,'webr');
06243                 $md_creator->setTitle($data['title']);
06244                 $md_creator->setTitleLanguage('en');
06245                 $md_creator->setDescription($data['desc']);
06246                 $md_creator->setDescriptionLanguage('en');
06247                 $md_creator->setKeywordLanguage('en');
06248                 $md_creator->setLanguage('en');
06249 
06250                 $md_creator->create();
06251         }
06252 }
06253 chdir($wd);
06254 ?>
06255 <#427>
06256 ALTER  TABLE  `tst_tests`  ADD  `count_system` ENUM(  '0',  '1'  ) DEFAULT  '0' NOT  NULL  AFTER  `random_question_count` ;
06257 
06258 <#428>
06259 ALTER TABLE `glossary` ADD `virtual` ENUM('none','fixed','level','subtree') DEFAULT 'none' NOT NULL;
06260 
06261 <#429>
06262 <?php
06263 
06264 // insert style folder type to object data
06265 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
06266                 "VALUES ('typ', 'seas', 'Search settings', -1, now(), now())";
06267 $this->db->query($query);
06268 
06269 $query = "SELECT LAST_INSERT_ID() as id";
06270 $res = $this->db->query($query);
06271 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
06272 
06273 // insert operations for style folder type
06274 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','1')";
06275 $this->db->query($query);
06276 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','2')";
06277 $this->db->query($query);
06278 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','3')";
06279 $this->db->query($query);
06280 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$row->id."','4')";
06281 $this->db->query($query);
06282 
06283 // CREATE SEarch settings object
06284 // create object data entry
06285 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
06286                 "VALUES ('seas', 'Search settings', 'Search settings', -1, now(), now())";
06287 $this->db->query($query);
06288 
06289 // get style folder number
06290 $query = "SELECT LAST_INSERT_ID() as id";
06291 $res = $this->db->query($query);
06292 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
06293 $sty_folder_id = $row->id;
06294 
06295 // create object reference entry
06296 $query = "INSERT INTO object_reference (obj_id) VALUES('".$row->id."')";
06297 $res = $this->db->query($query);
06298 
06299 $query = "SELECT LAST_INSERT_ID() as id";
06300 $res = $this->db->query($query);
06301 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
06302 
06303 // put in tree
06304 $tree = new ilTree(ROOT_FOLDER_ID);
06305 $tree->insertNode($row->id,SYSTEM_FOLDER_ID);
06306 ?>
06307 <#430>
06308 <?php
06309 
06310 $query = "INSERT INTO rbac_operations SET operation = 'search', description = 'Allow using search'";
06311 $res = $this->db->query($query);
06312 
06313 $query = "SELECT LAST_INSERT_ID() as ops_id";
06314 $res = $this->db->query($query);
06315 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
06316 
06317 $ops_id = $row->ops_id;
06318 
06319   // Add permission tu use search
06320 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'seas'";
06321 $res = $this->db->query($query);
06322 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
06323 
06324 $obj_id = $row->obj_id;
06325 
06326 
06327 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$obj_id."','".$ops_id."')";
06328 $this->db->query($query);
06329 ?>
06330 <#431>
06331 <?php
06332 $ilCtrlStructureReader->getStructure();
06333 ?>
06334 
06335 <#432>
06336 <?php
06337 $ilCtrlStructureReader->getStructure();
06338 ?>
06339 <#433>
06340 <?php
06341 $ilCtrlStructureReader->getStructure();
06342 ?>
06343 <#434>
06344 <?php
06345 $this->db->query('DELETE FROM usr_search');
06346 ?>
06347 <#435>
06348 <?php
06349 $ilCtrlStructureReader->getStructure();
06350 ?>
06351 <#436>
06352 CREATE TABLE `tst_test_result` (
06353   `test_result_id` int(10) unsigned NOT NULL auto_increment,
06354   `user_fi` int(10) unsigned NOT NULL default '0',
06355   `test_fi` int(10) unsigned NOT NULL default '0',
06356   `question_fi` int(10) unsigned NOT NULL default '0',
06357   `points` double NOT NULL default '0',
06358   `TIMESTAMP` timestamp,
06359   PRIMARY KEY  (`test_result_id`),
06360   UNIQUE KEY `test_result_id` (`test_result_id`),
06361   KEY `test_result_id_2` (`test_result_id`),
06362   KEY `user_fi` (`user_fi`),
06363   KEY `test_fi` (`test_fi`),
06364   KEY `question_fi` (`question_fi`)
06365 ) COMMENT='Test and Assessment user results for test questions';
06366 <#437>
06367 ALTER TABLE  `tst_test_result` DROP INDEX  `test_result_id`;
06368 ALTER TABLE  `tst_test_result` DROP INDEX  `test_result_id_2`;
06369 ALTER TABLE  `tst_test_result` DROP INDEX  `user_fi`;
06370 ALTER TABLE  `tst_test_result` ADD UNIQUE (`user_fi` ,`test_fi` ,`question_fi`);
06371 <#438>
06372 UPDATE ut_access SET language='uk' WHERE language='ua';
06373 UPDATE usr_pref SET value='uk' WHERE value='ua' and keyword='language';
06374 UPDATE settings SET value='uk' WHERE value='ua' and keyword='language';
06375 UPDATE object_translation SET lang_code='uk' WHERE lang_code='ua';
06376 UPDATE lng_data SET lang_key='uk' WHERE lang_key='ua';
06377 UPDATE glossary_term SET language='uk' WHERE language='ua';
06378 <#439>
06379 <?php
06380 $wd = getcwd();
06381 chdir('..');
06382 
06383 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDCreator.php';
06384 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMD.php';
06385 
06386 ilMD::_deleteAllByType('webr');
06387 
06388 $webr_ids = array();
06389 $query = "SELECT * FROM object_data WHERE type = 'webr'";
06390 $res = $ilDB->query($query);
06391 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
06392 {
06393         $webr_ids[$row->obj_id]['title'] = $row->title;
06394         $webr_ids[$row->obj_id]['desc'] = $row->description;
06395 
06396 }
06397 
06398 foreach($webr_ids as $id => $data)
06399 {
06400         $md_creator = new ilMDCreator($id,$id,'webr');
06401         $md_creator->setTitle($data['title']);
06402         $md_creator->setTitleLanguage('en');
06403         $md_creator->setDescription($data['desc']);
06404         $md_creator->setDescriptionLanguage('en');
06405         $md_creator->setKeywordLanguage('en');
06406         $md_creator->setLanguage('en');
06407 
06408         $md_creator->create();
06409 }
06410 chdir($wd);
06411 ?>
06412 <#440>
06413 <?php
06414         global $log;
06415         $log->write("test&assessment (update step 440): starting with conversion. creating database entries with maximum available points for every question");
06416         $idx = 1;
06417         $query = "SELECT * FROM qpl_questions";
06418         $result = $ilDB->query($query);
06419         $maxidx = $result->numRows() + 1;
06420         while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
06421         {
06422                 $maxidx--;
06423                 $log->write("processing question $maxidx");
06424                 $query_answer = sprintf("SELECT * FROM qpl_answers WHERE question_fi = %s",
06425                         $ilDB->quote($row["question_id"] . "")
06426                 );
06427                 $result_answer = $ilDB->query($query_answer);
06428                 $answers = array();
06429                 while ($row_answer = $result_answer->fetchRow(DB_FETCHMODE_ASSOC))
06430                 {
06431                         array_push($answers, $row_answer);
06432                 }
06433                 $maxpoints = 0;
06434                 switch ($row["question_type_fi"])
06435                 {
06436                         case 1: // multiple choice single response
06437                                 $points = array("set" => 0, "unset" => 0);
06438                                 foreach ($answers as $key => $value) 
06439                                 {
06440                                         if ($value["points"] > $points["set"])
06441                                         {
06442                                                 $points["set"] = $value["points"];
06443                                         }
06444                                 }
06445                                 $maxpoints = $points["set"];
06446                                 break;
06447                         case 2: // multiple choice multiple response
06448                                 $points = array("set" => 0, "unset" => 0);
06449                                 $allpoints = 0;
06450                                 foreach ($answers as $key => $value) 
06451                                 {
06452                                         $allpoints += $value["points"];
06453                                 }
06454                                 $maxpoints = $allpoints;
06455                                 break;
06456                         case 3: // close question
06457                                 $gaps = array();
06458                                 foreach ($answers as $key => $value)
06459                                 {
06460                                         if (!array_key_exists($value["gap_id"], $gaps))
06461                                         {
06462                                                 $gaps[$value["gap_id"]] = array();
06463                                         }
06464                                         array_push($gaps[$value["gap_id"]], $value);
06465                                 }
06466                                 $points = 0;
06467                                 foreach ($gaps as $key => $value) {
06468                                         if ($value[0]["cloze_type"] == 0) {
06469                                                 $points += $value[0]["points"];
06470                                         } else {
06471                                                 $points_arr = array("set" => 0, "unset" => 0);
06472                                                 foreach ($value as $key2 => $value2) {
06473                                                         if ($value2["points"] > $points_arr["set"])
06474                                                         {
06475                                                                 $points_arr["set"] = $value2["points"];
06476                                                         }
06477                                                 }
06478                                                 $points += $points_arr["set"];
06479                                         }
06480                                 }
06481                                 $maxpoints = $points;
06482                                 break;
06483                         case 4: // matching question
06484                                 $points = 0;
06485                                 foreach ($answers as $key => $value)
06486                                 {
06487                                         if ($value["points"] > 0)
06488                                         {
06489                                                 $points += $value["points"];
06490                                         }
06491                                 }
06492                                 $maxpoints = $points;
06493                                 break;
06494                         case 5: // ordering question
06495                                 $points = 0;
06496                                 foreach ($answers as $key => $value)
06497                                 {
06498                                         $points += $value["points"];
06499                                 }
06500                                 $maxpoints = $points;
06501                                 break;
06502                         case 6: // imagemap question
06503                                 $points = array("set" => 0, "unset" => 0);
06504                                 foreach ($answers as $key => $value) {
06505                                         if ($value["points"] > $points["set"])
06506                                         {
06507                                                 $points["set"] = $value["points"];
06508                                         }
06509                                 }
06510                                 $maxpoints = $points["set"];
06511                                 break;
06512                         case 7: // java applet question
06513                         case 8: // text question
06514                                 break;
06515                 }
06516                 if ($row["question_type_fi"] < 7)
06517                 {
06518                         $updatequery = sprintf("UPDATE qpl_questions SET points = %s WHERE question_id = %s",
06519                                 $ilDB->quote($maxpoints . ""),
06520                                 $ilDB->quote($row["question_id"] . "")
06521                         );
06522                         $resultupdate = $ilDB->query($updatequery);
06523                         $log->write("  $idx. creating maximum question points: $updatequery");
06524                         $idx++;
06525                 }
06526         }
06527         $log->write("test&assessment: conversion completed. maximum available points for every question");
06528 
06529         
06530         $log->write("test&assessment: starting with conversion. creating database entry for reached points of every user for every processed question");
06531         // update code
06532         $idx = 1;
06533         $query = "SELECT question_id, question_type_fi FROM qpl_questions";
06534         $result = $ilDB->query($query);
06535         while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
06536         {
06537                 $queryanswers = sprintf("SELECT * FROM qpl_answers WHERE question_fi = %s ORDER BY gap_id, aorder ASC",
06538                         $ilDB->quote($row["question_id"] . "")
06539                 );
06540                 $resultanswers = $ilDB->query($queryanswers);
06541                 $answers = array();
06542                 while ($rowanswer = $resultanswers->fetchRow(DB_FETCHMODE_ASSOC))
06543                 {
06544                         array_push($answers, $rowanswer);
06545                 }
06546                 $querytests = sprintf("SELECT DISTINCT test_fi FROM tst_solutions WHERE question_fi = %s",
06547                         $ilDB->quote($row["question_id"] . "")
06548                 );
06549                 $resulttests = $ilDB->query($querytests);
06550                 $tests = array();
06551                 while ($rowtest = $resulttests->fetchRow(DB_FETCHMODE_ASSOC))
06552                 {
06553                         array_push($tests, $rowtest["test_fi"]);
06554                 }
06555                 foreach ($tests as $test_id)
06556                 {
06557                         $queryusers = sprintf("SELECT DISTINCT user_fi FROM tst_solutions WHERE test_fi = %s AND question_fi = %s",
06558                                 $ilDB->quote($test_id . ""),
06559                                 $ilDB->quote($row["question_id"])
06560                         );
06561                         $resultusers = $ilDB->query($queryusers);
06562                         $users = array();
06563                         while ($rowuser = $resultusers->fetchRow(DB_FETCHMODE_ASSOC))
06564                         {
06565                                 array_push($users, $rowuser["user_fi"]);
06566                         }
06567                         // now begin the conversion
06568                         foreach ($users as $user_id)
06569                         {
06570                                 $querysolutions = sprintf("SELECT * FROM tst_solutions WHERE test_fi = %s AND user_fi = %s AND question_fi = %s",
06571                                         $ilDB->quote($test_id . ""),
06572                                         $ilDB->quote($user_id . ""),
06573                                         $ilDB->quote($row["question_id"] . "")
06574                                 );
06575                                 $resultsolutions = $ilDB->query($querysolutions);
06576                                 switch ($row["question_type_fi"])
06577                                 {
06578                                         case 1:
06579                                         case 2:
06580                                                 // multiple choice questions
06581                                                 $found_values = array();
06582                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
06583                                                 {
06584                                                         if (strcmp($data["value1"], "") != 0)
06585                                                         {
06586                                                                 array_push($found_values, $data["value1"]);
06587                                                         }
06588                                                 }
06589                                                 $points = 0;
06590                                                 if (count($found_values) > 0)
06591                                                 {
06592                                                         foreach ($answers as $key => $answer)
06593                                                         {
06594                                                                 if ($answer["correctness"])
06595                                                                 {
06596                                                                         if (in_array($key, $found_values))
06597                                                                         {
06598                                                                                 $points += $answer["points"];
06599                                                                         }
06600                                                                 }
06601                                                                 else
06602                                                                 {
06603                                                                         if (!in_array($key, $found_values))
06604                                                                         {
06605                                                                                 $points += $answer["points"];
06606                                                                         }
06607                                                                 }
06608                                                         }
06609                                                 }
06610                                                 // save $points
06611                                                 break;
06612                                         case 3:
06613                                                 // close questions
06614                                                 $found_value1 = array();
06615                                                 $found_value2 = array();
06616                                                 $user_result = array();
06617                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
06618                                                 {
06619                                                         if (strcmp($data["value2"], "") != 0)
06620                                                         {
06621                                                                 $user_result[$data["value1"]] = array(
06622                                                                         "gap_id" => $data["value1"],
06623                                                                         "value" => $data["value2"]
06624                                                                 );
06625                                                         }
06626                                                 }
06627                                                 $points = 0;
06628                                                 $counter = 0;
06629                                                 $gaps = array();
06630                                                 foreach ($answers as $key => $value)
06631                                                 {
06632                                                         if (!array_key_exists($value["gap_id"], $gaps))
06633                                                         {
06634                                                                 $gaps[$value["gap_id"]] = array();
06635                                                         }
06636                                                         array_push($gaps[$value["gap_id"]], $value);
06637                                                 }
06638                                                 foreach ($user_result as $gap_id => $value) 
06639                                                 {
06640                                                         if ($gaps[$gap_id][0]["cloze_type"] == 0) 
06641                                                         {
06642                                                                 $foundsolution = 0;
06643                                                                 foreach ($gaps[$gap_id] as $k => $v) 
06644                                                                 {
06645                                                                         if ((strcmp(strtolower($v["answertext"]), strtolower($value["value"])) == 0) && (!$foundsolution)) 
06646                                                                         {
06647                                                                                 $points += $v["points"];
06648                                                                                 $foundsolution = 1;
06649                                                                         }
06650                                                                 }
06651                                                         } 
06652                                                         else 
06653                                                         {
06654                                                                 if ($value["value"] >= 0)
06655                                                                 {
06656                                                                         foreach ($gaps[$gap_id] as $answerkey => $answer)
06657                                                                         {
06658                                                                                 if ($value["value"] == $answerkey)
06659                                                                                 {
06660                                                                                         $points += $answer["points"];
06661                                                                                 }
06662                                                                         }
06663                                                                 }
06664                                                         }
06665                                                 }
06666                                                 // save $points;
06667                                                 break;
06668                                         case 4:
06669                                                 // matching questions
06670                                                 $found_value1 = array();
06671                                                 $found_value2 = array();
06672                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
06673                                                 {
06674                                                         if (strcmp($data["value1"], "") != 0)
06675                                                         {
06676                                                                 array_push($found_value1, $data["value1"]);
06677                                                                 array_push($found_value2, $data["value2"]);
06678                                                         }
06679                                                 }
06680                                                 $points = 0;
06681                                                 foreach ($found_value2 as $key => $value)
06682                                                 {
06683                                                         foreach ($answers as $answer_value)
06684                                                         {
06685                                                                 if (($answer_value["matching_order"] == $value) and ($answer_value["aorder"] == $found_value1[$key]))
06686                                                                 {
06687                                                                         $points += $answer_value["points"];
06688                                                                 }
06689                                                         }
06690                                                 }
06691                                                 // save $points;
06692                                                 break;
06693                                         case 5:
06694                                                 // ordering questions
06695                                                 $found_value1 = array();
06696                                                 $found_value2 = array();
06697                                                 $user_order = array();
06698                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
06699                                                 {
06700                                                         if ((strcmp($data["value1"], "") != 0) && (strcmp($data["value2"], "") != 0))
06701                                                         {
06702                                                                 $user_order[$data["value2"]] = $data["value1"];
06703                                                         }
06704                                                 }
06705                                                 ksort($user_order);
06706                                                 $user_order = array_values($user_order);
06707                                                 $answer_order = array();
06708                                                 foreach ($answers as $key => $answer)
06709                                                 {
06710                                                         $answer_order[$answer["solution_order"]] = $key;
06711                                                 }
06712                                                 ksort($answer_order);
06713                                                 $answer_order = array_values($answer_order);
06714                                                 $points = 0;
06715                                                 foreach ($answer_order as $index => $answer_id)
06716                                                 {
06717                                                         if (strcmp($user_order[$index], "") != 0)
06718                                                         {
06719                                                                 if ($answer_id == $user_order[$index])
06720                                                                 {
06721                                                                         $points += $answers[$answer_id]["points"];
06722                                                                 }
06723                                                         }
06724                                                 }
06725                                                 // save $points;
06726                                                 break;
06727                                         case 6:
06728                                                 // imagemap questions
06729                                                 $found_values = array();
06730                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
06731                                                 {
06732                                                         if (strcmp($data["value1"], "") != 0)
06733                                                         {
06734                                                                 array_push($found_values, $data["value1"]);
06735                                                         }
06736                                                 }
06737                                                 $points = 0;
06738                                                 if (count($found_values) > 0)
06739                                                 {
06740                                                         foreach ($answers as $key => $answer)
06741                                                         {
06742                                                                 if ($answer["correctness"])
06743                                                                 {
06744                                                                         if (in_array($key, $found_values))
06745                                                                         {
06746                                                                                 $points += $answer["points"];
06747                                                                         }
06748                                                                 }
06749                                                         }
06750                                                 }
06751                                                 // save $points;
06752                                                 break;
06753                                         case 7:
06754                                                 // java applet questions
06755                                                 $found_values = array();
06756                                                 $points = 0;
06757                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
06758                                                 {
06759                                                         $points += $data["points"];
06760                                                 }
06761                                                 // save $points;
06762                                                 break;
06763                                         case 8:
06764                                                 // text questions
06765                                                 $points = 0;
06766                                                 if ($resultsolutions->numRows() == 1)
06767                                                 {
06768                                                         $data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC);
06769                                                         if ($data["points"])
06770                                                         {
06771                                                                 $points = $data["points"];
06772                                                         }
06773                                                 }
06774                                                 // save $points;
06775                                                 break;
06776                                 }
06777                                 $insertquery = sprintf("REPLACE tst_test_result (user_fi, test_fi, question_fi, points) VALUES (%s, %s, %s, %s)",
06778                                         $ilDB->quote($user_id . ""),
06779                                         $ilDB->quote($test_id . ""),
06780                                         $ilDB->quote($row["question_id"] . ""),
06781                                         $ilDB->quote($points . "")
06782                                 );
06783                                 $ilDB->query($insertquery);
06784                                 $log->write("  $idx. creating user result: $insertquery");
06785                                 $idx++;
06786                         }
06787                 }
06788         }
06789         $log->write("test&assessment: conversion finished. creating database entry for reached points of every user for every processed question");
06790 ?>
06791 <#441>
06792 DROP TABLE IF EXISTS tmp_migration;
06793 CREATE TABLE `tmp_migration` (
06794   `obj_id` int(11) NOT NULL default '0',
06795   `passed` tinyint(4) NOT NULL default '0');
06796 
06797 <#442>
06798 <?php
06799 $tables = array('il_meta_annotation',
06800                                 'il_meta_classification',
06801                                 'il_meta_contribute',
06802                                 'il_meta_description',
06803                                 'il_meta_educational',
06804                                 'il_meta_entity',
06805                                 'il_meta_format',
06806                                 'il_meta_general',
06807                                 'il_meta_identifier',
06808                                 'il_meta_identifier_',
06809                                 'il_meta_keyword',
06810                                 'il_meta_language',
06811                                 'il_meta_lifecycle',
06812                                 'il_meta_location',
06813                                 'il_meta_meta_data',
06814                                 'il_meta_relation',
06815                                 'il_meta_requirement',
06816                                 'il_meta_rights',
06817                                 'il_meta_taxon',
06818                                 'il_meta_taxon_path',
06819                                 'il_meta_technical',
06820                                 'il_meta_typical_age_range');
06821 
06822 foreach($tables as $table)
06823 {
06824         $ilDB->query("ALTER TABLE ".$table." ADD INDEX ('obj_id','rbac_id','obj_type')");
06825 }
06826 
06827 <#443>
06828 <?php
06829 $wd = getcwd();
06830 chdir('..');
06831 
06832 include_once 'Services/Migration/DBUpdate_439/classes/class.ilNestedSetXML.php';
06833 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDCreator.php';
06834 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDXMLParser.php';
06835 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMD.php';
06836 
06837 global $log;
06838 
06839 $log->write("MetaData (Migration type 'mob'): Start");
06840 
06841 $nested = new ilNestedSetXML();
06842 
06843 // Get last processes mob object
06844 $res = $ilDB->query("SELECT MAX(obj_id) as max_id FROM tmp_migration ");
06845 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
06846 {
06847         $max_id = $row->max_id;
06848 }
06849 $max_id = $max_id ? $max_id : 0;
06850 
06851 // MetaData migration of mobs
06852 $res = $ilDB->query("SELECT * FROM object_data WHERE type = 'mob' AND obj_id >= '".$max_id."' ORDER BY obj_id");
06853 
06854 $log->write("MetaData (Migration type 'mob'): Number of objects: ".$res->numRows());
06855 
06856 $counter = 0;
06857 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
06858 {
06859         if(!(++$counter%100))
06860         {
06861                 $log->write("MetaData (Migration type 'mob'): Processing obj number: ".$row->obj_id);
06862         }
06863 
06864         // Check if already processed
06865         $done_res = $ilDB->query("SELECT * FROM tmp_migration WHERE obj_id = '".$row->obj_id."' AND passed = '1'");
06866         if($done_res->numRows())
06867         {
06868                 continue;
06869         }
06870         // Delete old entries
06871         $md = new ilMD($row->obj_id,$row->obj_id,'mob');
06872         $md->deleteAll();
06873 
06874         // Get xml data
06875         if($xml = $nested->export($row->obj_id,'mob'))
06876         {
06877                 $parser = new ilMDXMLParser($xml,$row->obj_id,$row->obj_id,'mob');
06878                 $parser->startParsing();
06879         }
06880         else
06881         {
06882                 // Create new entry
06883                 $md_creator = new ilMDCreator($row->obj_id,$row->obj_id,'mob');
06884                 $md_creator->setTitle($row->title);
06885                 $md_creator->setTitleLanguage('en');
06886                 $md_creator->setDescription($row->desc);
06887                 $md_creator->setDescriptionLanguage('en');
06888                 $md_creator->setKeywordLanguage('en');
06889                 $md_creator->setLanguage('en');
06890 
06891                 $md_creator->create();
06892         }
06893         // Set passed
06894         $ilDB->query("INSERT INTO tmp_migration SET obj_id = '".$row->obj_id."', passed = 1");
06895 }
06896 $log->write("MetaData (Migration type 'mob'): Finished migration");
06897 
06898 chdir($wd);
06899 ?>
06900 
06901 <#444>
06902 <?php
06903 $ilCtrlStructureReader->getStructure();
06904 ?>
06905 
06906 <#445>
06907 <?php
06908 $ilCtrlStructureReader->getStructure();
06909 ?>
06910 <#446>
06911 DROP TABLE IF EXISTS tmp_migration;
06912 CREATE TABLE `tmp_migration` (
06913   `obj_id` int(11) NOT NULL default '0',
06914   `passed` tinyint(4) NOT NULL default '0');
06915 
06916 <#447>
06917 <?php
06918 $tables = array('il_meta_annotation',
06919                                 'il_meta_classification',
06920                                 'il_meta_contribute',
06921                                 'il_meta_description',
06922                                 'il_meta_educational',
06923                                 'il_meta_entity',
06924                                 'il_meta_format',
06925                                 'il_meta_general',
06926                                 'il_meta_identifier',
06927                                 'il_meta_identifier_',
06928                                 'il_meta_keyword',
06929                                 'il_meta_language',
06930                                 'il_meta_lifecycle',
06931                                 'il_meta_location',
06932                                 'il_meta_meta_data',
06933                                 'il_meta_relation',
06934                                 'il_meta_requirement',
06935                                 'il_meta_rights',
06936                                 'il_meta_taxon',
06937                                 'il_meta_taxon_path',
06938                                 'il_meta_technical',
06939                                 'il_meta_typical_age_range');
06940 
06941 foreach($tables as $table)
06942 {
06943         $ilDB->query("ALTER TABLE ".$table." ADD INDEX rbac_obj(rbac_id,obj_id)");
06944 }
06945 $ilDB->query("ALTER TABLE tmp_migration ADD INDEX (obj_id)");
06946 ?>
06947 
06948 <#448>
06949 <?php
06950 $wd = getcwd();
06951 chdir('..');
06952 
06953 include_once 'Services/Migration/DBUpdate_439/classes/class.ilNestedSetXML.php';
06954 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDCreator.php';
06955 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDXMLParser.php';
06956 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMD.php';
06957 
06958 global $log;
06959 
06960 $log->write("MetaData (Migration type 'lm'): Start");
06961 
06962 $nested = new ilNestedSetXML();
06963 
06964 // Get last processed lm object
06965 $res = $ilDB->query("SELECT MAX(obj_id) as max_id FROM tmp_migration ");
06966 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
06967 {
06968         $max_id = $row->max_id;
06969 }
06970 $max_id = $max_id ? $max_id : 0;
06971 
06972 // MetaData migration of lm's
06973 $res = $ilDB->query("SELECT * FROM object_data WHERE type = 'lm' AND obj_id >= '".$max_id."' ORDER BY obj_id");
06974 
06975 $log->write("MetaData (Migration type 'lm,st,pg'): Number of lm's: ".$res->numRows());
06976 
06977 $counter = 0;
06978 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
06979 {
06980         $log->write("MetaData (Migration type 'lm'): Processing obj number: ".$row->obj_id);
06981 
06982         // Check if already processed
06983         $done_res = $ilDB->query("SELECT * FROM tmp_migration WHERE obj_id = '".$row->obj_id."' AND passed = '1'");
06984         if($done_res->numRows())
06985         {
06986                 continue;
06987         }
06988         // Delete old entries
06989         $md = new ilMD($row->obj_id,$row->obj_id,'lm');
06990         $md->deleteAll();
06991         unset($md);
06992 
06993         // Get xml data
06994         $xml = $nested->export($row->obj_id,'lm');
06995         if($xml)
06996         {
06997                 $parser = new ilMDXMLParser($xml,$row->obj_id,$row->obj_id,'lm');
06998                 $parser->startParsing();
06999         }
07000         else
07001         {
07002                 // Create new entry
07003                 $md_creator = new ilMDCreator($row->obj_id,$row->obj_id,'lm');
07004                 $md_creator->setTitle($row->title);
07005                 $md_creator->setTitleLanguage('en');
07006                 $md_creator->setDescription($row->description);
07007                 $md_creator->setDescriptionLanguage('en');
07008                 $md_creator->setKeywordLanguage('en');
07009                 $md_creator->setLanguage('en');
07010 
07011                 $md_creator->create();
07012         }
07013 
07014         // Now migrate all pages and chapters
07015         $res_pg = $ilDB->query("SELECT * FROM lm_data WHERE lm_id = '".$row->obj_id."' AND (type = 'pg' OR type = 'st')");
07016         while($row_pg = $res_pg->fetchRow(DB_FETCHMODE_OBJECT))
07017         {
07018                 if(function_exists('memory_get_usage'))
07019                 {
07020                         $memory_usage = " Memory usage: ".memory_get_usage();
07021                 }
07022 
07023                 $log->write("-- MetaData (Migration type '".$row_pg->type."'): Processing obj number: ".$row_pg->obj_id.$memory_usage);
07024 
07025                 // Delete old entries
07026                 $md = new ilMD($row_pg->lm_id,$row_pg->obj_id,$row_pg->type);
07027                 $md->deleteAll();
07028                 unset($md);
07029                            
07030                 // Get xml data
07031                 if($xml = $nested->export($row_pg->obj_id,$row_pg->type))
07032                 {
07033                         $parser = new ilMDXMLParser($xml,$row_pg->lm_id,$row_pg->obj_id,$row_pg->type);
07034                         $parser->startParsing();
07035                 }
07036                 else
07037                 {
07038                         if(function_exists('memory_get_usage'))
07039                         {
07040                                 $memory_usage = " Memory usage: ".memory_get_usage();
07041                         }
07042                         $log->write("-- --  MetaData (Migration type '".$row_pg->type."'): (Creating new entry!) Processing obj number: ".
07043                                                 $row_pg->obj_id.$memory_usage);
07044 
07045                         // Create new entry
07046                         $md_creator = new ilMDCreator($row_pg->lm_id,$row_pg->obj_id,$row_pg->type);
07047                         $md_creator->setTitle($row_pg->title);
07048                         $md_creator->setTitleLanguage('en');
07049                         $md_creator->setDescription('');
07050                         $md_creator->setDescriptionLanguage('en');
07051                         $md_creator->setKeywordLanguage('en');
07052                         $md_creator->setLanguage('en');
07053 
07054                         $md_creator->create();
07055                 }
07056         }
07057         // Finally set lm passed
07058         $ilDB->query("INSERT INTO tmp_migration SET obj_id = '".$row->obj_id."', passed = 1");
07059 }
07060 $log->write("MetaData (Migration type 'lm'): Finished migration");
07061 
07062 chdir($wd);
07063 ?>
07064 <#449>
07065 DROP TABLE IF EXISTS tmp_migration;
07066 CREATE TABLE `tmp_migration` (
07067   `obj_id` int(11) NOT NULL default '0',
07068   `passed` tinyint(4) NOT NULL default '0');
07069 
07070 <#450>
07071 <?php
07072 // Migration of glossaries
07073 $wd = getcwd();
07074 chdir('..');
07075 
07076 include_once 'Services/Migration/DBUpdate_439/classes/class.ilNestedSetXML.php';
07077 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDCreator.php';
07078 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDXMLParser.php';
07079 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMD.php';
07080 
07081 global $log;
07082 
07083 $log->write("MetaData (Migration type 'glo'): Start");
07084 
07085 $nested = new ilNestedSetXML();
07086 
07087 // Get last processed lm object
07088 $res = $ilDB->query("SELECT MAX(obj_id) as max_id FROM tmp_migration ");
07089 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07090 {
07091         $max_id = $row->max_id;
07092 }
07093 $max_id = $max_id ? $max_id : 0;
07094 
07095 // MetaData migration of glossaries
07096 $res = $ilDB->query("SELECT * FROM object_data WHERE type = 'glo' AND obj_id >= '".$max_id."' ORDER BY obj_id");
07097 
07098 $log->write("MetaData (Migration type 'glo'): Number of glossaries: ".$res->numRows());
07099 
07100 $counter = 0;
07101 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07102 {
07103         $log->write("MetaData (Migration type 'glo'): Processing obj number: ".$row->obj_id);
07104 
07105         // Check if already processed
07106         $done_res = $ilDB->query("SELECT * FROM tmp_migration WHERE obj_id = '".$row->obj_id."' AND passed = '1'");
07107         if($done_res->numRows())
07108         {
07109                 continue;
07110         }
07111         // Delete old entries
07112         $md = new ilMD($row->obj_id,$row->obj_id,'glo');
07113         $md->deleteAll();
07114         unset($md);
07115 
07116         // Get xml data
07117         $xml = $nested->export($row->obj_id,'glo');
07118         if($xml)
07119         {
07120                 $parser = new ilMDXMLParser($xml,$row->obj_id,$row->obj_id,'glo');
07121                 $parser->startParsing();
07122         }
07123         else
07124         {
07125                 // Create new entry
07126                 $md_creator = new ilMDCreator($row->obj_id,$row->obj_id,'glo');
07127                 $md_creator->setTitle($row->title);
07128                 $md_creator->setTitleLanguage('en');
07129                 $md_creator->setDescription($row->description);
07130                 $md_creator->setDescriptionLanguage('en');
07131                 $md_creator->setKeywordLanguage('en');
07132                 $md_creator->setLanguage('en');
07133 
07134                 $md_creator->create();
07135         }
07136 
07137         // Now migrate all glossary definitions
07138         $res_gdf = $ilDB->query("select gd.id as gdid,term from glossary_definition as gd, glossary_term as gt where gd.term_id = gt.id".
07139                                                         " and glo_id = '".$row->obj_id."'");
07140         while($row_gdf = $res_gdf->fetchRow(DB_FETCHMODE_OBJECT))
07141         {
07142                 if(function_exists('memory_get_usage'))
07143                 {
07144                         $memory_usage = " Memory usage: ".memory_get_usage();
07145                 }
07146 
07147                 $log->write("-- MetaData (Migration type 'gdf'): Processing definition nr.: ".$row_gdf->gdid.$memory_usage);
07148 
07149                 // Delete old entries
07150                 $md = new ilMD($row->obj_id,$row_gdf->gdid,'gdf');
07151                 $md->deleteAll();
07152                 unset($md);
07153                            
07154                 // Get xml data
07155                 if($xml = $nested->export($row_gdf->gdid,'gdf'))
07156                 {
07157                         $log->write('xml: '.$xml);
07158                         $parser = new ilMDXMLParser($xml,$row->obj_id,$row_gdf->gdid,'gdf');
07159                         $parser->startParsing();
07160                 }
07161                 else
07162                 {
07163                         if(function_exists('memory_get_usage'))
07164                         {
07165                                 $memory_usage = " Memory usage: ".memory_get_usage();
07166                         }
07167                         $log->write("-- --  MetaData (Migration type 'gdf'): (Creating new entry!) Processing glossary definition number: ".
07168                                                 $row_gdf->gdid.$memory_usage);
07169 
07170                         // Create new entry
07171                         $md_creator = new ilMDCreator($row->obj_id,$row_gdf->gdid,'gdf');
07172                         $md_creator->setTitle($row_gdf->term);
07173                         $md_creator->setTitleLanguage('en');
07174                         $md_creator->setDescription('');
07175                         $md_creator->setDescriptionLanguage('en');
07176                         $md_creator->setKeywordLanguage('en');
07177                         $md_creator->setLanguage('en');
07178 
07179                         $md_creator->create();
07180                 }
07181         }
07182         // Finally set gdf passed
07183         $ilDB->query("INSERT INTO tmp_migration SET obj_id = '".$row->obj_id."', passed = 1");
07184 }
07185 $log->write("MetaData (Migration type 'glo'): Finished migration");
07186 
07187 chdir($wd);
07188 ?>
07189 <#451>
07190 DROP TABLE IF EXISTS tmp_migration;
07191 CREATE TABLE `tmp_migration` (
07192   `obj_id` int(11) NOT NULL default '0',
07193   `passed` tinyint(4) NOT NULL default '0');
07194 
07195 <#452>
07196 <?php
07197   // Migration of type tst,svy,crs,sahs,icla,icrs
07198 $wd = getcwd();
07199 chdir('..');
07200 
07201 include_once 'Services/Migration/DBUpdate_439/classes/class.ilNestedSetXML.php';
07202 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDCreator.php';
07203 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDXMLParser.php';
07204 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMD.php';
07205 
07206 global $log;
07207 
07208 $log->write("MetaData (Migration type tst,svy,crs,sahs,icla,icrs): Start");
07209 
07210 $nested = new ilNestedSetXML();
07211 
07212 // Get last processed object
07213 $res = $ilDB->query("SELECT MAX(obj_id) as max_id FROM tmp_migration ");
07214 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07215 {
07216         $max_id = $row->max_id;
07217 }
07218 $max_id = $max_id ? $max_id : 0;
07219 
07220 // MetaData migration of glossaries
07221 $res = $ilDB->query("SELECT * FROM object_data WHERE type IN ('tst','svy','qpl','spl','crs','icla','icrs','sahs','htlm') AND obj_id >= '".
07222                                         $max_id."' ORDER BY obj_id");
07223 
07224 $log->write("MetaData (Migration): Number of objects: ".$res->numRows());
07225 
07226 $counter = 0;
07227 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07228 {
07229         $log->write("MetaData (Migration type '".$row->type."'): Processing obj number: ".$row->obj_id);
07230 
07231         // Check if already processed
07232         $done_res = $ilDB->query("SELECT * FROM tmp_migration WHERE obj_id = '".$row->obj_id."' AND passed = '1'");
07233         if($done_res->numRows())
07234         {
07235                 continue;
07236         }
07237         // Delete old entries
07238         $md = new ilMD($row->obj_id,$row->obj_id,$row->type);
07239         $md->deleteAll();
07240         unset($md);
07241 
07242         // Get xml data
07243         $xml = $nested->export($row->obj_id,$row->type);
07244         if($xml)
07245         {
07246                 $parser = new ilMDXMLParser($xml,$row->obj_id,$row->obj_id,$row->type);
07247                 $parser->startParsing();
07248         }
07249         else
07250         {
07251                 // Create new entry
07252                 $md_creator = new ilMDCreator($row->obj_id,$row->obj_id,$row->type);
07253                 $md_creator->setTitle($row->title);
07254                 $md_creator->setTitleLanguage('en');
07255                 $md_creator->setDescription($row->description);
07256                 $md_creator->setDescriptionLanguage('en');
07257                 $md_creator->setKeywordLanguage('en');
07258                 $md_creator->setLanguage('en');
07259 
07260                 $md_creator->create();
07261         }
07262 }
07263 $log->write("MetaData (Migration): Finished migration");
07264 
07265 chdir($wd);
07266 ?>
07267 <#453>
07268 DROP TABLE IF EXISTS tmp_migration;
07269 <#454>
07270 ALTER TABLE `object_data` ADD FULLTEXT (
07271         `title`);
07272 ALTER TABLE `object_data` ADD FULLTEXT (
07273         `description`);
07274 <#455>
07275 ALTER TABLE `object_data` DROP INDEX `title`;
07276 ALTER TABLE `object_data` DROP INDEX `description`;
07277 
07278 ALTER TABLE `object_data` ADD FULLTEXT `title_desc` (`title` ,`description`     );
07279 <#456>
07280 ALTER TABLE `il_meta_keyword` ADD FULLTEXT `keyword` (`keyword`);
07281 ALTER TABLE `il_meta_entity` ADD FULLTEXT `entity` (`entity`);
07282 
07283 <#457>
07284 ALTER TABLE `il_meta_general` ADD FULLTEXT `title_coverage` (`title`,`coverage`);
07285 <#458>
07286 ALTER TABLE `il_meta_description` ADD FULLTEXT `description` (`description`);
07287 <#459>
07288 ALTER TABLE `frm_posts` ADD FULLTEXT `message_subject` (`pos_message`,`pos_subject`);
07289 <#460>
07290 ALTER TABLE `frm_threads` ADD FULLTEXT `thr_subject` (`thr_subject`);
07291 <#461>
07292 ALTER TABLE `glossary_term` ADD FULLTEXT `term` (`term`);
07293 <#462>
07294 ALTER TABLE `exc_data` ADD FULLTEXT `instruction` (`instruction`);
07295 <#463>
07296 ALTER TABLE `survey_question` ADD FULLTEXT `title_desc` (`title` ,`description`);
07297 <#464>
07298 ALTER TABLE `qpl_questions` ADD FULLTEXT `title_desc` (`title` ,`comment`);
07299 <#465>
07300 ALTER TABLE `tst_tests` ADD FULLTEXT `introduction` (`introduction`);
07301 <#466>
07302 ALTER TABLE `survey_survey` ADD FULLTEXT `introduction` (`introduction`);
07303 <#467>
07304 ALTER  TABLE  `tst_tests`  ADD  `mc_scoring` ENUM(  '0',  '1'  ) DEFAULT  '0' NOT  NULL  AFTER  `count_system` ;
07305 <#468>
07306 <?php
07307 $ilCtrlStructureReader->getStructure();
07308 ?>
07309 
07310 <#469>
07311 CREATE TABLE `module` (
07312         `name` VARCHAR(100) NOT NULL PRIMARY KEY,
07313         `dir` VARCHAR(200) NOT NULL
07314 ) COMMENT = 'ILIAS Modules';
07315 
07316 CREATE TABLE `module_class` (
07317         `class` VARCHAR(100) NOT NULL PRIMARY KEY,
07318         `module` VARCHAR(100) NOT NULL,
07319         `dir` VARCHAR(200) NOT NULL
07320 ) COMMENT = 'Class information of ILIAS Modules';
07321 
07322 <#470>
07323 <?php
07324 
07325 $ilCtrlStructureReader->getStructure();
07326 
07327 ?>
07328 
07329 <#471>
07330 <?php
07331 
07332 $ilModuleReader->getModules();
07333 
07334 ?>
07335 <#472>
07336 ALTER TABLE `usr_search` ADD `search_type` TINYINT( 2 ) DEFAULT '0' NOT NULL ;
07337 <#473>
07338 <?php
07339         // update reached question points for new test scoring options
07340         global $log;
07341         $log->write("test&assessment: starting with conversion. updating database entries for reached points of every user for every processed question");
07342         // update code
07343         $idx = 1;
07344         $query = "SELECT question_id, question_type_fi FROM qpl_questions";
07345         $result = $ilDB->query($query);
07346         while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
07347         {
07348                 $queryanswers = sprintf("SELECT * FROM qpl_answers WHERE question_fi = %s ORDER BY gap_id, aorder ASC",
07349                         $ilDB->quote($row["question_id"] . "")
07350                 );
07351                 $resultanswers = $ilDB->query($queryanswers);
07352                 $answers = array();
07353                 while ($rowanswer = $resultanswers->fetchRow(DB_FETCHMODE_ASSOC))
07354                 {
07355                         array_push($answers, $rowanswer);
07356                 }
07357                 $querytests = sprintf("SELECT DISTINCT test_fi FROM tst_solutions WHERE question_fi = %s",
07358                         $ilDB->quote($row["question_id"] . "")
07359                 );
07360                 $resulttests = $ilDB->query($querytests);
07361                 $tests = array();
07362                 while ($rowtest = $resulttests->fetchRow(DB_FETCHMODE_ASSOC))
07363                 {
07364                         array_push($tests, $rowtest["test_fi"]);
07365                 }
07366                 foreach ($tests as $test_id)
07367                 {
07368                         $queryusers = sprintf("SELECT DISTINCT user_fi FROM tst_solutions WHERE test_fi = %s AND question_fi = %s",
07369                                 $ilDB->quote($test_id . ""),
07370                                 $ilDB->quote($row["question_id"])
07371                         );
07372                         $resultusers = $ilDB->query($queryusers);
07373                         $users = array();
07374                         while ($rowuser = $resultusers->fetchRow(DB_FETCHMODE_ASSOC))
07375                         {
07376                                 array_push($users, $rowuser["user_fi"]);
07377                         }
07378                         // now begin the conversion
07379                         foreach ($users as $user_id)
07380                         {
07381                                 $querysolutions = sprintf("SELECT * FROM tst_solutions WHERE test_fi = %s AND user_fi = %s AND question_fi = %s",
07382                                         $ilDB->quote($test_id . ""),
07383                                         $ilDB->quote($user_id . ""),
07384                                         $ilDB->quote($row["question_id"] . "")
07385                                 );
07386                                 $resultsolutions = $ilDB->query($querysolutions);
07387                                 switch ($row["question_type_fi"])
07388                                 {
07389                                         case 1:
07390                                         case 2:
07391                                                 // multiple choice questions
07392                                                 $found_values = array();
07393                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
07394                                                 {
07395                                                         if (strcmp($data["value1"], "") != 0)
07396                                                         {
07397                                                                 array_push($found_values, $data["value1"]);
07398                                                         }
07399                                                 }
07400                                                 $points = 0;
07401                                                 if ((count($found_values) > 0) || ($row["question_type_fi"] == 2))
07402                                                 {
07403                                                         foreach ($answers as $key => $answer)
07404                                                         {
07405                                                                 if ($answer["correctness"])
07406                                                                 {
07407                                                                         if (in_array($key, $found_values))
07408                                                                         {
07409                                                                                 $points += $answer["points"];
07410                                                                         }
07411                                                                 }
07412                                                                 else
07413                                                                 {
07414                                                                         if (!in_array($key, $found_values))
07415                                                                         {
07416                                                                                 $points += $answer["points"];
07417                                                                         }
07418                                                                 }
07419                                                         }
07420                                                 }
07421                                                 // save $points
07422                                                 break;
07423                                         case 3:
07424                                                 // close questions
07425                                                 $found_value1 = array();
07426                                                 $found_value2 = array();
07427                                                 $user_result = array();
07428                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
07429                                                 {
07430                                                         if (strcmp($data["value2"], "") != 0)
07431                                                         {
07432                                                                 $user_result[$data["value1"]] = array(
07433                                                                         "gap_id" => $data["value1"],
07434                                                                         "value" => $data["value2"]
07435                                                                 );
07436                                                         }
07437                                                 }
07438                                                 $points = 0;
07439                                                 $counter = 0;
07440                                                 $gaps = array();
07441                                                 foreach ($answers as $key => $value)
07442                                                 {
07443                                                         if (!array_key_exists($value["gap_id"], $gaps))
07444                                                         {
07445                                                                 $gaps[$value["gap_id"]] = array();
07446                                                         }
07447                                                         array_push($gaps[$value["gap_id"]], $value);
07448                                                 }
07449                                                 foreach ($user_result as $gap_id => $value) 
07450                                                 {
07451                                                         if ($gaps[$gap_id][0]["cloze_type"] == 0) 
07452                                                         {
07453                                                                 $foundsolution = 0;
07454                                                                 foreach ($gaps[$gap_id] as $k => $v) 
07455                                                                 {
07456                                                                         if ((strcmp(strtolower($v["answertext"]), strtolower($value["value"])) == 0) && (!$foundsolution)) 
07457                                                                         {
07458                                                                                 $points += $v["points"];
07459                                                                                 $foundsolution = 1;
07460                                                                         }
07461                                                                 }
07462                                                         } 
07463                                                         else 
07464                                                         {
07465                                                                 if ($value["value"] >= 0)
07466                                                                 {
07467                                                                         foreach ($gaps[$gap_id] as $answerkey => $answer)
07468                                                                         {
07469                                                                                 if ($value["value"] == $answerkey)
07470                                                                                 {
07471                                                                                         $points += $answer["points"];
07472                                                                                 }
07473                                                                         }
07474                                                                 }
07475                                                         }
07476                                                 }
07477                                                 // save $points;
07478                                                 break;
07479                                         case 4:
07480                                                 // matching questions
07481                                                 $found_value1 = array();
07482                                                 $found_value2 = array();
07483                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
07484                                                 {
07485                                                         if (strcmp($data["value1"], "") != 0)
07486                                                         {
07487                                                                 array_push($found_value1, $data["value1"]);
07488                                                                 array_push($found_value2, $data["value2"]);
07489                                                         }
07490                                                 }
07491                                                 $points = 0;
07492                                                 foreach ($found_value2 as $key => $value)
07493                                                 {
07494                                                         foreach ($answers as $answer_value)
07495                                                         {
07496                                                                 if (($answer_value["matching_order"] == $value) and ($answer_value["aorder"] == $found_value1[$key]))
07497                                                                 {
07498                                                                         $points += $answer_value["points"];
07499                                                                 }
07500                                                         }
07501                                                 }
07502                                                 // save $points;
07503                                                 break;
07504                                         case 5:
07505                                                 // ordering questions
07506                                                 $found_value1 = array();
07507                                                 $found_value2 = array();
07508                                                 $user_order = array();
07509                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
07510                                                 {
07511                                                         if ((strcmp($data["value1"], "") != 0) && (strcmp($data["value2"], "") != 0))
07512                                                         {
07513                                                                 $user_order[$data["value2"]] = $data["value1"];
07514                                                         }
07515                                                 }
07516                                                 ksort($user_order);
07517                                                 $user_order = array_values($user_order);
07518                                                 $answer_order = array();
07519                                                 foreach ($answers as $key => $answer)
07520                                                 {
07521                                                         $answer_order[$answer["solution_order"]] = $key;
07522                                                 }
07523                                                 ksort($answer_order);
07524                                                 $answer_order = array_values($answer_order);
07525                                                 $points = 0;
07526                                                 foreach ($answer_order as $index => $answer_id)
07527                                                 {
07528                                                         if (strcmp($user_order[$index], "") != 0)
07529                                                         {
07530                                                                 if ($answer_id == $user_order[$index])
07531                                                                 {
07532                                                                         $points += $answers[$answer_id]["points"];
07533                                                                 }
07534                                                         }
07535                                                 }
07536                                                 // save $points;
07537                                                 break;
07538                                         case 6:
07539                                                 // imagemap questions
07540                                                 $found_values = array();
07541                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
07542                                                 {
07543                                                         if (strcmp($data["value1"], "") != 0)
07544                                                         {
07545                                                                 array_push($found_values, $data["value1"]);
07546                                                         }
07547                                                 }
07548                                                 $points = 0;
07549                                                 if (count($found_values) > 0)
07550                                                 {
07551                                                         foreach ($answers as $key => $answer)
07552                                                         {
07553                                                                 if ($answer["correctness"])
07554                                                                 {
07555                                                                         if (in_array($key, $found_values))
07556                                                                         {
07557                                                                                 $points += $answer["points"];
07558                                                                         }
07559                                                                 }
07560                                                         }
07561                                                 }
07562                                                 // save $points;
07563                                                 break;
07564                                         case 7:
07565                                                 // java applet questions
07566                                                 $found_values = array();
07567                                                 $points = 0;
07568                                                 while ($data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC))
07569                                                 {
07570                                                         $points += $data["points"];
07571                                                 }
07572                                                 // save $points;
07573                                                 break;
07574                                         case 8:
07575                                                 // text questions
07576                                                 $points = 0;
07577                                                 if ($resultsolutions->numRows() == 1)
07578                                                 {
07579                                                         $data = $resultsolutions->fetchRow(DB_FETCHMODE_ASSOC);
07580                                                         if ($data["points"])
07581                                                         {
07582                                                                 $points = $data["points"];
07583                                                         }
07584                                                 }
07585                                                 // save $points;
07586                                                 break;
07587                                 }
07588                                 // check for special scoring options in test
07589                                 $query = sprintf("SELECT * FROM tst_tests WHERE test_id = %s",
07590                                         $ilDB->quote($test_id)
07591                                 );
07592                                 $resulttest = $ilDB->query($query);
07593                                 if ($resulttest->numRows() == 1)
07594                                 {
07595                                         $rowtest = $resulttest->fetchRow(DB_FETCHMODE_ASSOC);
07596                                         if ($rowtest["count_system"] == 1)
07597                                         {
07598                                                 $maxpoints = 0;
07599                                                 $query = sprintf("SELECT points FROM qpl_questions WHERE question_id = %s",
07600                                                         $ilDB->quote($row["question_id"] . "")
07601                                                 );
07602                                                 $resultmaxpoints = $ilDB->query($query);
07603                                                 if ($resultmaxpoints->numRows() == 1)
07604                                                 {
07605                                                         $rowmaxpoints = $resultmaxpoints->fetchRow(DB_FETCHMODE_ASSOC);
07606                                                         $maxpoints = $rowmaxpoints["points"];
07607                                                 }
07608                                                 if ($points != $maxpoints)
07609                                                 {
07610                                                         $points = 0;
07611                                                 }
07612                                         }
07613                                 }
07614                                 else
07615                                 {
07616                                         $points = 0;
07617                                 }
07618                                 $insertquery = sprintf("REPLACE tst_test_result (user_fi, test_fi, question_fi, points) VALUES (%s, %s, %s, %s)",
07619                                         $ilDB->quote($user_id . ""),
07620                                         $ilDB->quote($test_id . ""),
07621                                         $ilDB->quote($row["question_id"] . ""),
07622                                         $ilDB->quote($points . "")
07623                                 );
07624                                 $ilDB->query($insertquery);
07625                                 $log->write("  $idx. creating user result: $insertquery");
07626                                 $idx++;
07627                         }
07628                 }
07629         }
07630         $log->write("test&assessment: conversion finished. creating database entry for reached points of every user for every processed question");
07631 ?>
07632 <#474>
07633 ALTER TABLE `il_meta_typical_age_range` ADD `typical_age_range_min` TINYINT( 3 ) DEFAULT '-1' NOT NULL ,
07634 ADD `typical_age_range_max` TINYINT( 3 ) DEFAULT '-1' NOT NULL ;
07635 <#475>
07636 <?php
07637 $query = "SELECT * FROM il_meta_typical_age_range ";
07638 $res =& $ilDB->query($query);
07639 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07640 {
07641         if(preg_match("/\s*(\d*)\s*(-?)\s*(\d*)/",$row->typical_age_range,$matches))
07642         {
07643                 if(!$matches[2] and !$matches[3])
07644                 {
07645                         $min = $max = $matches[1];
07646                 }
07647                 elseif($matches[2] and !$matches[3])
07648                 {
07649                         $min = $matches[1];
07650                         $max = 99;
07651                 }
07652                 else
07653                 {
07654                         $min = $matches[1];
07655                         $max = $matches[3];
07656                 }
07657 
07658                 $query = "UPDATE il_meta_typical_age_range ".
07659                         "SET typical_age_range_min = '".(int) $min."', ".
07660                         "typical_age_range_max = '".(int) $max."' ".
07661                         "WHERE meta_typical_age_range_id = '".$row->meta_typical_age_range_id."'";
07662 
07663                 $ilDB->query($query);
07664         }
07665 }
07666 ?>
07667 <#476>
07668 ALTER TABLE `usr_search` DROP PRIMARY KEY ,
07669 ADD PRIMARY KEY ( `usr_id` , `search_type` );
07670 
07671 <#477>
07672 REPLACE INTO settings (keyword, value) VALUES ('enable_calendar', '1');
07673 
07674 <#478>
07675 <?php
07676 $tables = array('il_meta_annotation',
07677                                 'il_meta_classification',
07678                                 'il_meta_contribute',
07679                                 'il_meta_description',
07680                                 'il_meta_educational',
07681                                 'il_meta_entity',
07682                                 'il_meta_format',
07683                                 'il_meta_general',
07684                                 'il_meta_identifier',
07685                                 'il_meta_identifier_',
07686                                 'il_meta_keyword',
07687                                 'il_meta_language',
07688                                 'il_meta_lifecycle',
07689                                 'il_meta_location',
07690                                 'il_meta_meta_data',
07691                                 'il_meta_relation',
07692                                 'il_meta_requirement',
07693                                 'il_meta_rights',
07694                                 'il_meta_taxon',
07695                                 'il_meta_taxon_path',
07696                                 'il_meta_technical',
07697                                 'il_meta_typical_age_range');
07698 
07699 foreach($tables as $table)
07700 {
07701         $ilDB->query("UPDATE ".$table." SET rbac_id = 0 WHERE obj_type = 'mob'");
07702 }
07703 ?>
07704 <#479>
07705 <?php
07706 
07707 $query = "INSERT INTO rbac_operations SET operation = 'moderate', description = 'Moderate objects'";
07708 $res = $this->db->query($query);
07709 
07710 $query = "SELECT LAST_INSERT_ID() as ops_id";
07711 $res = $this->db->query($query);
07712 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
07713 
07714 $ops_id = $row->ops_id;
07715 
07716   // Add permission tu use search
07717 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'chat'";
07718 $res = $this->db->query($query);
07719 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
07720 
07721 $obj_id = $row->obj_id;
07722 
07723 
07724 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$obj_id."','".$ops_id."')";
07725 $this->db->query($query);
07726 ?>
07727 <#480>
07728 <?php
07729  // Get all global roles
07730 $query = "SELECT rol_id FROM rbac_fa ".
07731         "WHERE parent = '".ROLE_FOLDER_ID."'";
07732 
07733 $res = $this->db->query($query);
07734 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07735 {
07736         $rol_ids[] = $row->rol_id;
07737 }
07738 // Get searchSettings ref_id
07739 $query = "SELECT ref_id from object_data od ,object_reference as orf where od.obj_id = orf.obj_id and type = 'seas'";
07740 $res = $this->db->query($query);
07741 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07742 {
07743         $ref_id = $row->ref_id;
07744 }
07745 // Get serach operation id
07746 $query = "SELECT * FROM rbac_operations where operation = 'search'";
07747 $res = $this->db->query($query);
07748 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07749 {
07750         $search_ops = $row->ops_id;
07751 }
07752 
07753 foreach($rol_ids as $role_id)
07754 {
07755         $query = "SELECT ops_id FROM rbac_pa where rol_id = '".$role_id."' and ref_id = '".$ref_id."'";
07756         $res = $this->db->query($query);
07757         $ops = array();
07758         while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07759         {
07760                 $ops = unserialize(stripslashes($row->ops_id));
07761         }
07762         if(!in_array($search_ops,$ops))
07763         {
07764                 $query = "DELETE FROM rbac_pa WHERE rol_id = '".$role_id."' and ref_id = '".$ref_id."'";
07765                 $this->db->query($query);
07766                 
07767                 $ops[] = $search_ops;
07768                 $query = "INSERT INTO rbac_pa SET rol_id = '".$role_id."', ".
07769                         "ops_id = '".addslashes(serialize($ops))."', ".
07770                         "ref_id = '".$ref_id."'";
07771                 $this->db->query($query);
07772         }
07773 }
07774 ?>
07775 <#481>
07776 <?php
07777 $query = "UPDATE il_meta_format SET parent_type = 'meta_technical'";
07778 $this->db->query($query);
07779 ?>
07780 <#482>
07781 CREATE TABLE `crs_wating_list` (
07782 `obj_id` INT( 11 ) NOT NULL ,
07783 `usr_id` INT( 11 ) NOT NULL ,
07784 `sub_time` INT( 11 ) NOT NULL ,
07785 PRIMARY KEY ( `obj_id` , `usr_id` )
07786 ) TYPE = MYISAM ;
07787 
07788 <#483>
07789 ALTER TABLE `usr_data` ADD `auth_mode` ENUM( 'default','local', 'ldap', 'radius', 'shibboleth','script' ) DEFAULT 'default' NOT NULL;
07790 ALTER TABLE `role_data` ADD `auth_mode` ENUM( 'default', 'local', 'ldap', 'radius', 'shibboleth', 'script' ) DEFAULT 'default' NOT NULL;
07791 
07792 
07793 <#484>
07794 UPDATE `usr_data` SET `auth_mode` = 'local' WHERE `usr_id` =13 LIMIT 1;
07795 
07796 <#485>
07797 ALTER TABLE `crs_wating_list` RENAME `crs_waiting_list`;
07798 
07799 <#486>
07800 DROP TABLE IF EXISTS `chat_record_data`;
07801 CREATE TABLE `chat_record_data` (
07802   `record_data_id` int(11) NOT NULL auto_increment,
07803   `record_id` int(11) NOT NULL default '0',
07804   `message` mediumtext NOT NULL,
07805   `msg_time` int(11) NOT NULL default '0',
07806   PRIMARY KEY  (`record_data_id`)
07807         ) TYPE = MyISAM;
07808 
07809 
07810 DROP TABLE IF EXISTS `chat_records`;
07811 CREATE TABLE `chat_records` (
07812   `record_id` int(11) NOT NULL auto_increment,
07813   `moderator_id` int(11) NOT NULL default '0',
07814   `chat_id` int(11) NOT NULL default '0',
07815   `room_id` int(11) NOT NULL default '0',
07816   `start_time` int(11) NOT NULL default '0',
07817   `end_time` int(11) NOT NULL default '0',
07818   PRIMARY KEY  (`record_id`)
07819         ) TYPE=MyISAM;
07820 
07821 <#487>
07822 ALTER TABLE `chat_records` ADD `title` VARCHAR( 255 ) NOT NULL AFTER `room_id`,
07823 ADD `description` TEXT NOT NULL AFTER `title` ;
07824 
07825 <#488>
07826 ALTER TABLE glossary ADD public_html_file VARCHAR(50) DEFAULT '' NOT NULL;
07827 ALTER TABLE glossary ADD public_xml_file VARCHAR(50) DEFAULT '' NOT NULL;
07828 
07829 <#489>
07830 ALTER TABLE glossary ADD COLUMN glo_menu_active ENUM('y','n') DEFAULT 'y';
07831 ALTER TABLE glossary ADD COLUMN downloads_active ENUM('y','n') DEFAULT 'n';
07832 <#490>
07833 DROP TABLE IF EXISTS `tmp_migration`;
07834 CREATE TABLE `tmp_migration` (
07835   `page_id` int(11) NOT NULL default '0',
07836   `parent_id` int(11) default '0',
07837   `passed` tinyint(4) NOT NULL default '0');
07838 <#491>
07839 <?php
07840 $wd = getcwd();
07841 chdir('..');
07842 
07843 global $log;
07844 
07845 // php5 downward complaince to php 4 dom xml
07846 if (version_compare(PHP_VERSION,'5','>='))
07847 {
07848         include_once 'Services/Migration/DBUpdate_491/inc.xml5compliance.php';
07849 }
07850 
07851 
07852 //  migration of page content
07853 $res = $ilDB->query("SELECT page_id,parent_id FROM page_object ORDER BY page_id,parent_id");
07854 
07855 $log->write("Page object migration: Number of objects: ".$res->numRows());
07856 
07857 $counter = 0;
07858 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07859 {
07860         $log->write("Page object migration: Processing page_id, parent_id: ".$row->page_id.", ".$row->parent_id);
07861 
07862         // Check if already processed
07863         $done_res = $ilDB->query("SELECT * FROM tmp_migration WHERE page_id = '".$row->page_id."' AND parent_id = '".$row->parent_id."' ".
07864                                                          "AND passed = '1'");
07865         if($done_res->numRows())
07866         {
07867                 continue;
07868         }
07869 
07870         // get content
07871         $query = "SELECT content FROM page_object WHERE page_id = '".$row->page_id."' ".
07872                 "AND parent_id = '".$row->parent_id."'";
07873 
07874         $res2 = $ilDB->query($query);
07875 
07876         // Must be splitted since DBupdate.php cannot handle expressions like 'question mark greater than'.
07877         $prefix = "<";
07878         $prefix .= "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
07879         $prefix .= ">";
07880 
07881         while($row2 = $res2->fetchRow(DB_FETCHMODE_OBJECT))
07882         {
07883                 $content = $row2->content;
07884         }
07885         $content = $prefix.$content;
07886 
07887         $error = '';
07888         $dom_obj = @domxml_open_mem($content, DOMXML_LOAD_PARSING, $error);
07889 
07890         if($error)
07891         {
07892                 // Cannot handle this error. => set passed and continue
07893                 $log->write("Error building dom from node: page_id, parent_id: ".$row->page_id.", ".$row->parent_id);
07894                 $ilDB->query("INSERT INTO tmp_migration SET page_id = '".$row->page_id."', parent_id = '".$row->parent_id."', passed = 1");
07895                 continue;
07896         }
07897 
07898         $new_content = $dom_obj->dump_mem(0,"UTF-8");
07899 
07900         //$log->write("FROM DOM: ".$new_content ."ENDE");
07901 
07902         $new_content = eregi_replace("<\?xml[^>]*>","",$new_content);
07903         $new_content = eregi_replace("<!DOCTYPE[^>]*>","",$new_content);
07904 
07905         // Update content
07906         $query = "UPDATE page_object SET content = '".addslashes($new_content)."' ".
07907                 "WHERE page_id = '".$row->page_id ."' AND parent_id = '".$row->parent_id."'";
07908         $ilDB->query($query);
07909 
07910 
07911         // Set passed
07912         $ilDB->query("INSERT INTO tmp_migration SET page_id = '".$row->page_id."', parent_id = '".$row->parent_id."', passed = 1");
07913 }
07914 $log->write("Page object: Finished migration");
07915 chdir($wd);
07916 ?>
07917 <#492>
07918 DROP TABLE IF EXISTS `tmp_migration`;
07919 
07920 <#493>
07921 DELETE FROM desktop_item WHERE type = 'grou';
07922 
07923 <#494>
07924 <?php   
07925 // insert third party tools definition (extt)
07926 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
07927                  "VALUES ('typ', 'extt', 'external tools settings', -1, now(), now())";
07928 $this->db->query($query);
07929 
07930 // fetch type id
07931 $query = "SELECT LAST_INSERT_ID()";
07932 $res = $this->db->query($query);
07933 $row = $res->fetchRow();
07934 $typ_id = $row[0];
07935 
07936 // add operation assignment for extt object
07937 // 1: edit_permissions, 2: visible, 3: read, 4: write, 6:delete
07938 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','1')";
07939 $this->db->query($query);
07940 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','2')";
07941 $this->db->query($query);
07942 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','3')";
07943 $this->db->query($query);
07944 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$typ_id."','4')";
07945 $this->db->query($query);
07946 
07947 // add extt object in administration panel
07948 $query = "INSERT INTO object_data VALUES('','extt','External tools settings','Configuring external tools',-1,NOW(),NOW(),'')";
07949 $this->db->query($query);
07950 
07951 $query = "SELECT LAST_INSERT_ID()";
07952 $res = $this->db->query($query);
07953 $row = $res->fetchRow();
07954 $obj_id = $row[0];
07955 
07956 // create object reference entry
07957 $query = "INSERT INTO object_reference (obj_id) VALUES('".$obj_id."')";
07958 $this->db->query($query);
07959 
07960 $query = "SELECT LAST_INSERT_ID()";
07961 $res = $this->db->query($query);
07962 $row = $res->fetchRow();
07963 $ref_id = $row[0];
07964 
07965 // put in tree
07966 $tree = new ilTree(ROOT_FOLDER_ID);
07967 $tree->insertNode($ref_id,SYSTEM_FOLDER_ID);
07968 ?>
07969 
07970 <#495>
07971 ALTER TABLE `usr_data` ADD `ilinc_login` VARCHAR( 40 ) AFTER `ilinc_id` ,
07972 ADD `ilinc_passwd` VARCHAR( 40 ) AFTER `ilinc_login` ;
07973 
07974 <#496>
07975 <?php
07976 $query = "INSERT INTO rbac_operations SET operation = 'create_icrs', description = 'create LearnLink Seminar'";
07977 $res = $this->db->query($query);
07978 
07979 $query = "SELECT LAST_INSERT_ID() as ops_id";
07980 $res = $this->db->query($query);
07981 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
07982 
07983 $ops_id = $row->ops_id;
07984 
07985 // Add operation to cat,grp,fold,crs 
07986 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title IN ('cat','grp','fold','crs')";
07987 $res = $this->db->query($query);
07988 
07989 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
07990 {
07991         $obj_ids[] = $row->obj_id;
07992 }
07993 
07994 foreach ($obj_ids as $obj_id)
07995 {
07996         $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$obj_id."','".$ops_id."')";
07997         $this->db->query($query);
07998 }
07999 ?>
08000 
08001 <#497>
08002 <?php
08003 // Add new operation create_icla
08004 $query = "INSERT INTO rbac_operations SET operation = 'create_icla', description = 'create LearnLink Seminar room'";
08005 $res = $this->db->query($query);
08006 
08007 $query = "SELECT LAST_INSERT_ID() as ops_id";
08008 $res = $this->db->query($query);
08009 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
08010 $icla_ops_id = $row->ops_id;
08011 
08012 // Add operation to icrs 
08013 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title IN ('icrs')";
08014 $res = $this->db->query($query);
08015 
08016 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
08017 {
08018         $obj_ids[] = $row->obj_id;
08019 }
08020 
08021 foreach ($obj_ids as $obj_id)
08022 {
08023         $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$obj_id."','".$icla_ops_id."')";
08024         $this->db->query($query);
08025 }
08026 
08027 
08028 // Add join/leave operations to icrs 
08029 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'icrs'";
08030 $res = $this->db->query($query);
08031 
08032 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
08033 $obj_id = $row->obj_id;
08034 
08035 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$obj_id."','7')";
08036 $this->db->query($query);
08037 
08038 $query = "INSERT INTO rbac_ta (typ_id, ops_id) VALUES ('".$obj_id."','8')";
08039 $this->db->query($query);
08040 
08041 // ADMIN TEMPLATE for LearnLink Seminars
08042 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
08043                  "VALUES ('rolt', 'il_icrs_admin', 'Administrator template for LearnLink Seminars', -1, now(), now())";
08044 $this->db->query($query);
08045 
08046 $query = "SELECT LAST_INSERT_ID() as obj_id";
08047 $res = $this->db->query($query);
08048 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
08049 $obj_id = $row->obj_id;
08050 
08051 $admin = array();
08052 $admin["icrs"] = array(1,2,3,4,6,7,8,$icla_ops_id);
08053 $admin["rolf"] = array(1,2,3,4,6,14);
08054 
08055 $rbacadmin =& new ilRbacAdmin();
08056 
08057 foreach($admin as $type => $ops)
08058 {
08059         $rbacadmin->setRolePermission($obj_id,$type,$ops,ROLE_FOLDER_ID);
08060 }
08061 
08062 $rbacadmin->assignRoleToFolder($obj_id,ROLE_FOLDER_ID,"n");
08063 
08064 // MEMBER TEMPLATE for LearnLink Seminars
08065 $query = "INSERT INTO object_data (type, title, description, owner, create_date, last_update) ".
08066                  "VALUES ('rolt', 'il_icrs_member', 'Member template for LearnLink Seminars', -1, now(), now())";
08067 $this->db->query($query);
08068 
08069 $query = "SELECT LAST_INSERT_ID() as obj_id";
08070 $res = $this->db->query($query);
08071 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
08072 $obj_id = $row->obj_id;
08073 
08074 $admin = array();
08075 $admin["icrs"] = array(2,3,7,8);
08076 
08077 
08078 foreach($admin as $type => $ops)
08079 {
08080         $rbacadmin->setRolePermission($obj_id,$type,$ops,ROLE_FOLDER_ID);
08081 }
08082 $rbacadmin->assignRoleToFolder($obj_id,ROLE_FOLDER_ID,"n");
08083 ?>
08084 
08085 <#498>
08086 <?php
08087 // the following code removes all existing icrs and icla objects in system
08088 // normally most of the code won't be triggered because iLinc-support was not available to public
08089 
08090 // init tree and rbacadmin
08091 $tree =& new ilTree(ROOT_FOLDER_ID);
08092 $rbacadmin =& new ilRbacAdmin();
08093 $rbacreview =& new ilRbacReview();
08094 
08095 $ilca_nodes = $tree->getNodeDataByType('icla');
08096 
08097 if (count($icla_nodes) != 0)
08098 {
08099         foreach ($icla_nodes as $node)
08100         {
08101                 // first look up for rolefolders
08102                 $rolf = $rbacreview->getRoleFolderOfObject($node["ref_id"]);
08103                 
08104                 if ($rolf)
08105                 {
08106                         // remove local roles
08107                         $roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"],false);
08108                         foreach ($roles as $role_id)
08109                         {
08110                                 $rbacadmin->deleteRole($role_id,$rolf["ref_id"]);
08111                         }
08112                         
08113                         // remove linked local roles
08114                         $roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]);
08115                         foreach ($roles as $role_id)
08116                         {
08117                                 $rbacadmin->deleteLocalRole($role_id,$rolf["ref_id"]);
08118                         }
08119 
08120                         // delete rbac_fa entry
08121                         $query = "DELETE FROM rbac_fa WHERE parent = '".$rolf["ref_id"]."'";
08122                         $this->db->query($query);
08123                         
08124                         // delete entry in object_data
08125                         $query = "DELETE FROM object_data WHERE obj_id = '".$rolf["obj_id"]."'";
08126                         $this->db->query($query);
08127                         
08128                         // delete entry in object_reference
08129                         $query = "DELETE FROM object_reference WHERE ref_id = '".$rolf["ref_id"]."'";
08130                         $this->db->query($query);
08131 
08132                         // remove tree entry
08133                         $tree->deleteTree($rolf);       
08134                 }
08135                 
08136                 // delete entry in object_data
08137                 $query = "DELETE FROM object_data WHERE obj_id = '".$node["obj_id"]."'";
08138                 $this->db->query($query);
08139                 
08140                 // delete entry in object_reference
08141                 $query = "DELETE FROM object_reference WHERE ref_id = '".$node["ref_id"]."'";
08142                 $this->db->query($query);
08143                 
08144                 // remove permission settings
08145                 $rbacadmin->revokePermission($node["ref_id"]);
08146                 
08147                 // remove tree entry
08148                 $tree->deleteTree($node);       
08149         }
08150 } // if count icla_nodes
08151 
08152 $ilcrs_nodes = $tree->getNodeDataByType('icrs');
08153 
08154 if (count($icrs_nodes) != 0)
08155 {
08156         foreach ($icrs_nodes as $node)
08157         {
08158                 // first look up for rolefolders
08159                 $rolf = $rbacreview->getRoleFolderOfObject($node["ref_id"]);
08160                 
08161                 if ($rolf)
08162                 {
08163                         // remove local roles
08164                         $roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"],false);
08165                         foreach ($roles as $role_id)
08166                         {
08167                                 $rbacadmin->deleteRole($role_id,$rolf["ref_id"]);
08168                         }
08169                         
08170                         // remove linked local roles
08171                         $roles = $rbacreview->getRolesOfRoleFolder($rolf["ref_id"]);
08172                         foreach ($roles as $role_id)
08173                         {
08174                                 $rbacadmin->deleteLocalRole($role_id,$rolf["ref_id"]);
08175                         }
08176                         
08177                         // delete rbac_fa entry
08178                         $query = "DELETE FROM rbac_fa WHERE parent = '".$rolf["ref_id"]."'";
08179                         $this->db->query($query);
08180                         
08181                         // delete entry in object_data
08182                         $query = "DELETE FROM object_data WHERE obj_id = '".$rolf["obj_id"]."'";
08183                         $this->db->query($query);
08184                         
08185                         // delete entry in object_reference
08186                         $query = "DELETE FROM object_reference WHERE ref_id = '".$rolf["ref_id"]."'";
08187                         $this->db->query($query);
08188 
08189                         // remove tree entry
08190                         $tree->deleteTree($rolf);
08191                 }
08192 
08193                 // delete entry in object_data
08194                 $query = "DELETE FROM object_data WHERE obj_id = '".$node["obj_id"]."'";
08195                 $this->db->query($query);
08196                 
08197                 // delete entry in object_reference
08198                 $query = "DELETE FROM object_reference WHERE ref_id = '".$node["ref_id"]."'";
08199                 $this->db->query($query);
08200                 
08201                 // remove permission settings
08202                 $rbacadmin->revokePermission($node["ref_id"]);
08203                 
08204                 // remove tree entry
08205                 $tree->deleteTree($node);       
08206         }
08207 } // if count icrs_nodes
08208 ?>
08209 
08210 <#499>
08211 <?php
08212 // remove icla object from rbac system
08213 $query = "SELECT obj_id FROM object_data WHERE type = 'typ' AND title = 'icla'";
08214 $res = $this->db->query($query);
08215 
08216 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
08217 $obj_id = $row->obj_id;
08218 
08219 $query = "DELETE FROM rbac_ta WHERE typ_id = '".$obj_id."'";
08220 $this->db->query($query);
08221 
08222 $query = "DELETE FROM rbac_templates WHERE type = 'icla'";
08223 $this->db->query($query);
08224 
08225 $query = "DELETE FROM object_data WHERE type = 'icla'";
08226 $this->db->query($query);
08227 
08228 $query = "DELETE FROM object_data WHERE type = 'icrs'";
08229 $this->db->query($query);
08230 
08231 // reset iLinc related datas
08232 $query = "TRUNCATE ilinc_data";
08233 $this->db->query($query);
08234 
08235 $query = "UPDATE usr_data SET ilinc_id = NULL";
08236 $this->db->query($query);
08237 ?>
08238 <#500>
08239 CREATE INDEX jmp_parent ON ctrl_calls(parent);
08240 <#501>
08241 CREATE INDEX jmp_uid ON mail_obj_data(user_id);
08242 <#502>
08243 CREATE INDEX jmp_uid ON mail(user_id);
08244 <#503>
08245 CREATE INDEX jmp_parent ON rbac_fa(parent);
08246 <#504>
08247 CREATE INDEX jmp_tree ON mail_tree(tree);
08248 <#505>
08249 CREATE INDEX jmp_tree ON tree(tree);
08250 <#506>
08251 CREATE INDEX jmp_lm ON lm_tree(lm_id);
08252 <#507>
08253 CREATE TABLE `chat_blocked` (
08254 `chat_id` INT( 11 ) NOT NULL ,
08255 `usr_id` INT( 11 ) NOT NULL
08256 ) TYPE = MYISAM;
08257 <#508>
08258 <?php
08259 
08260 // get all glossary definition pages
08261 $res = $ilDB->query("SELECT content, page_id, parent_type FROM page_object ".
08262         "WHERE content LIKE '%MediaAlias OriginId%' AND parent_type='gdf'");
08263 
08264 while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
08265 {
08266         $content = $row["content"];
08267 
08268         // get all media aliases
08269         while (eregi("MediaAlias OriginId=\"(il__mob_([0-9]*))\"", $content, $found))
08270         {
08271                 // insert mob usage record
08272                 $q = "REPLACE INTO mob_usage (id, usage_type, usage_id) VALUES".
08273                         " ('".$found[2]."', 'gdf:pg', '".$row["page_id"]."')";
08274                 $ilDB->query($q);
08275 
08276                 // remove id from content string to prevent endless while loop
08277                 $content = eregi_replace($found[1], "", $content);
08278         }
08279 }
08280 
08281 ?>
08282 <#509>
08283 ALTER TABLE `chat_user` ADD `kicked` TINYINT DEFAULT '0' AFTER `last_conn_timestamp`;
08284 <#510>
08285 ALTER TABLE `webr_items` ADD FULLTEXT (
08286 `title`
08287         );
08288 <#511>
08289 <?php
08290 
08291 // get all question pages
08292 $res = $ilDB->query("SELECT content, page_id, parent_type FROM page_object ".
08293         "WHERE content LIKE '%MediaAlias OriginId%' AND parent_type='qpl'");
08294 
08295 while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
08296 {
08297         $content = $row["content"];
08298 
08299         // get all media aliases
08300         while (eregi("MediaAlias OriginId=\"(il__mob_([0-9]*))\"", $content, $found))
08301         {
08302                 // insert mob usage record
08303                 $q = "REPLACE INTO mob_usage (id, usage_type, usage_id) VALUES".
08304                         " ('".$found[2]."', 'qpl:pg', '".$row["page_id"]."')";
08305                 $ilDB->query($q);
08306 
08307                 // remove id from content string to prevent endless while loop
08308                 $content = eregi_replace($found[1], "", $content);
08309         }
08310 }
08311 
08312 ?>
08313 <#512>
08314 <?php
08315         // convert referral_comment and hobby textareas in usr_data:
08316         // change html entities &lt; &gt; &amp; to normal characters because
08317         // the form was changed
08318         $res = $ilDB->query("SELECT usr_id, referral_comment, hobby FROM usr_data");
08319         while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
08320         {
08321                 $newhobby = str_replace("&amp;", "&", str_replace("&gt;", ">", str_replace("&lt;", "<", $row["hobby"])));
08322                 $newcomment = str_replace("&amp;", "&", str_replace("&gt;", ">", str_replace("&lt;", "<", $row["referral_comment"])));
08323                 if ((strcmp($row["hobby"], $newhobby) != 0) || (strcmp($row["referral_comment"], $newcomment) != 0))
08324                 {
08325                         $q = sprintf("UPDATE usr_data SET hobby = %s, referral_comment = %s WHERE usr_id = %s",
08326                                 $ilDB->quote($newhobby . ""),
08327                                 $ilDB->quote($newcomment . ""),
08328                                 $ilDB->quote($row["usr_id"] . "")
08329                         );
08330                         $ilDB->query($q);
08331                 }
08332         }
08333 ?>
08334 <#513>
08335 CREATE TABLE `object_description` (
08336   `obj_id` int(11) NOT NULL default '0',
08337   `description` text  NOT NULL,
08338   PRIMARY KEY  (`obj_id`)
08339 ) TYPE=MyISAM;
08340 <#514>
08341 ALTER TABLE `object_translation` CHANGE `description` `description` TEXT  NULL DEFAULT NULL;
08342 <#515>
08343 <?php
08344         // reconstruct original id's which were set wrong due to test duplication
08345         $res = $ilDB->query("SELECT question_id, original_id FROM qpl_questions WHERE original_id > 0");
08346         while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
08347         {
08348                 $original_id = $row["original_id"];
08349                 $question_id = $row["question_id"];
08350                 $last_original_id = $row["original_id"];
08351                 $last_question_id = $row["question_id"];
08352                 // DBUPDATE-BUGFIX
08353                 // add a fix for a previously update step run which was not successful and
08354                 // ended in an endless loop
08355                 if ($original_id == $question_id)
08356                 {
08357                         $update_query = sprintf("UPDATE qpl_questions SET original_id = NULL WHERE question_id = %s",
08358                                 $ilDB->quote($question_id . "")
08359                         );
08360                         $result_update = $ilDB->query($update_query);
08361                 }
08362                 else
08363                 {
08364                         while ($last_original_id > 0)
08365                         {
08366                                 $search_query = sprintf("SELECT question_id, original_id FROM qpl_questions WHERE question_id = %s",
08367                                         $ilDB->quote($last_original_id . "")
08368                                 );
08369                                 $result_search = $ilDB->query($search_query);
08370                                 if ($result_search->numRows() == 0)
08371                                 {
08372                                         // no original found
08373                                         $last_original_id = 0;
08374                                 }
08375                                 else
08376                                 {
08377                                         $search_row = $result_search->fetchRow(DB_FETCHMODE_ASSOC);
08378                                         $last_original_id = $search_row["original_id"];
08379                                         $last_question_id = $search_row["question_id"];
08380                                 }
08381                         }
08382                 }
08383                 if ($last_question_id != $original_id)
08384                 {
08385                         // DBUPDATE-BUGFIX
08386                         // added && ($last_question_id != $question_id) to prevent setting the
08387                         // original_id equal to the question_id which could happen when the original
08388                         // question no longer exists
08389                         if ((($last_question_id > 0) && ($question_id > 0)) && ($last_question_id != $question_id))
08390                         {
08391                                 $update_query = sprintf("UPDATE qpl_questions SET original_id = %s WHERE question_id = %s",
08392                                         $ilDB->quote($last_question_id . ""),
08393                                         $ilDB->quote($question_id . "")
08394                                 );
08395                                 $result_update = $ilDB->query($update_query);
08396                         }
08397                 }
08398         }
08399 ?>
08400 <#516>
08401 ALTER TABLE `webr_items` ADD `description` TEXT NOT NULL AFTER `title`;
08402 
08403 <#517>
08404 ALTER TABLE `ilinc_data` DROP `class_id`;
08405 ALTER TABLE `ilinc_data` DROP `user_id`;
08406 
08407 ALTER TABLE `ilinc_data` ADD `contact_name` VARCHAR( 255 ) ,
08408 ADD `contact_responsibility` VARCHAR( 255 ) ,
08409 ADD `contact_phone` VARCHAR( 255 ) ,
08410 ADD `contact_email` VARCHAR( 255 ) ,
08411 ADD `activation_unlimited` TINYINT( 2 ) ,
08412 ADD `activation_start` INT( 11 ) ,
08413 ADD `activation_end` INT( 11 ) ,
08414 ADD `activation_offline` ENUM( 'y', 'n' ) ,
08415 ADD `subscription_unlimited` TINYINT( 2 ) ,
08416 ADD `subscription_start` INT( 11 ) ,
08417 ADD `subscription_end` INT( 11 ) ,
08418 ADD `subscription_type` TINYINT( 2 ) ,
08419 ADD `subscription_password` VARCHAR( 32 ) ;
08420 
08421 CREATE TABLE `ilinc_registration` (
08422 `obj_id` INT UNSIGNED NOT NULL ,
08423 `usr_id` INT UNSIGNED NOT NULL ,
08424 `usr_text` VARCHAR( 255 ) ,
08425 `application_date` DATETIME,
08426 PRIMARY KEY ( `obj_id` ) ,
08427 INDEX ( `usr_id` )
08428 );
08429 <#518>
08430 DELETE FROM object_description;
08431 <#519>
08432 <?php
08433 $wd = getcwd();
08434 chdir('..');
08435 
08436 $tree =& new ilTree(ROOT_FOLDER_ID);
08437 $GLOBALS['tree'] = $tree;
08438 $rbacadmin =& new ilRbacAdmin();
08439 $rbacreview =& new ilRbacReview();
08440 
08441 $query = "SELECT obd.obj_id as objid,obr.ref_id as refid FROM object_data as obd,object_reference as obr ".
08442         "WHERE obd.obj_id = obr.obj_id ".
08443         "AND type = 'chat'";
08444 
08445 $res = $ilDB->query($query);
08446 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
08447 {
08448         if($tree->isInTree($row->refid) and !count($tree->getChilds($row->refid)))
08449         {
08450                 // 1. Insert in object_data
08451                 $query = "INSERT INTO object_data ".
08452                         "(type,title,description,owner,create_date,last_update,import_id) ".
08453                         "VALUES ".
08454                         "('rolf','".$row->objid."','(ref_id ".$row->refid.")',".
08455                         "'6',now(),now(),'')";
08456 
08457                 $ilDB->query($query);
08458                 
08459                 // 2. Get id of new role folder
08460                 $rolf_id = $ilDB->getLastInsertId();
08461 
08462                 // 3. Create reference
08463                 $query = "INSERT INTO object_reference ".
08464                         "(obj_id) VALUES ('".$rolf_id."')";
08465                 $ilDB->query($query);
08466 
08467                 $rolf_ref_id = $ilDB->getLastInsertId();
08468 
08469                 // 4. Insert in tree
08470                 $tree->insertNode($rolf_ref_id,$row->refid);
08471 
08472                 // Set permissions
08473                 foreach ($rbacreview->getParentRoleIds($row->refid) as $parRol)
08474                 {
08475                         $ops = $rbacreview->getOperationsOfRole($parRol["obj_id"],'rolf', $parRol["parent"]);
08476                         $rbacadmin->grantPermission($parRol["obj_id"], $ops,$rolf_ref_id);
08477                 }
08478 
08479                 // Add new lokal moderator role
08480                 $query = "INSERT INTO object_data ".
08481                         "(type,title,description,owner,create_date,last_update,import_id) ".
08482                          "VALUES ".
08483                         "('role','il_chat_moderator_".$row->refid."','"."Moderator of chat obj_no.".$row->objid."',".
08484                         "'6',now(),now(),'')";
08485 
08486                 $ilDB->query($query);
08487                         
08488                 $role_id = $ilDB->getLastInsertId();
08489 
08490                 // Insert role_data entry
08491                 $query = "INSERT INTO role_data ".
08492                         "(role_id,allow_register,assign_users) ".
08493                         "VALUES ".
08494                         "('".$role_id."','0','1')";
08495                 $ilDB->query($query);
08496 
08497                 // Assign this role to role folder
08498                 $rbacadmin->assignRoleToFolder($role_id,$rolf_ref_id);
08499 
08500                 // Grant permissions: visible,read,write,chat_moderate
08501                 $permissions = ilRbacReview::_getOperationIdsByName(array('visible','read','moderate'));
08502                 $rbacadmin->grantPermission($role_id,
08503                                                                         $permissions,
08504                                                                         $row->refid);
08505 
08506         }
08507 
08508 
08509 }
08510 chdir($wd);
08511 ?>
08512 
08513 <#520>
08514 <?php
08515 $ilCtrlStructureReader->getStructure();
08516 ?>
08517 

Generated on Fri Dec 13 2013 10:18:33 for ILIAS Release_3_5_x_branch .rev 46805 by  doxygen 1.7.1