ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilADNDatabaseObjective Class Reference
+ Inheritance diagram for ilADNDatabaseObjective:
+ Collaboration diagram for ilADNDatabaseObjective:

Public Member Functions

 prepare (ilDBInterface $db)
 
 step_1 ()
 Adds a new table column called 'has_language_limitation' which is used to define whether a notification is only shown for certain languages or if it is shown for all languages. More...
 
- Public Member Functions inherited from ilDatabaseUpdateSteps
 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 

Private Member Functions

 abortIfNotPrepared ()
 Halts the execution of these update steps if no database was provided. More...
 

Private Attributes

ilDBInterface $database = null
 

Detailed Description

Author
Lukas Zehnder lukas.nosp@m.@sr..nosp@m.solut.nosp@m.ions

Definition at line 24 of file class.ilADNDatabaseObjective.php.

Member Function Documentation

◆ abortIfNotPrepared()

ilADNDatabaseObjective::abortIfNotPrepared ( )
private

Halts the execution of these update steps if no database was provided.

Exceptions
LogicExceptionif the database update steps were not yet prepared.

Definition at line 91 of file class.ilADNDatabaseObjective.php.

References null.

Referenced by step_1().

91  : void
92  {
93  if (null === $this->database) {
94  throw new LogicException(self::class . '::prepare() must be called before db-update-steps execution.');
95  }
96  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ prepare()

ilADNDatabaseObjective::prepare ( ilDBInterface  $db)

Definition at line 28 of file class.ilADNDatabaseObjective.php.

28  : void
29  {
30  $this->database = $db;
31  }

◆ step_1()

ilADNDatabaseObjective::step_1 ( )

Adds a new table column called 'has_language_limitation' which is used to define whether a notification is only shown for certain languages or if it is shown for all languages.

Also adds a new table column called 'limited_to_languages' which specifies which languages a notification with

the above limitation is shown for.

NOTE: the initial values will be set to 0 and "" respectively so that existing notifications will not be affected.

Definition at line 42 of file class.ilADNDatabaseObjective.php.

References abortIfNotPrepared().

42  : void
43  {
44  $this->abortIfNotPrepared();
45 
46  if (!$this->database->tableExists('il_adn_notifications') ||
47  $this->database->tableColumnExists('il_adn_notifications', 'has_language_limitation')
48  ) {
49  return;
50  }
51  $this->database->addTableColumn(
52  'il_adn_notifications',
53  'has_language_limitation',
54  [
55  'type' => 'integer',
56  'length' => 1,
57  'notnull' => true,
58  'default' => 0,
59  ]
60  );
61  $this->database->manipulate('
62  UPDATE il_adn_notifications SET has_language_limitation = 0;
63  ');
64 
65  if ($this->database->tableColumnExists('il_adn_notifications', 'limited_to_languages')
66  ) {
67  return;
68  }
69  $this->database->addTableColumn(
70  'il_adn_notifications',
71  'limited_to_languages',
72  [
73  'type' => 'text',
74  'length' => 256,
75  'notnull' => true,
76  'default' => '',
77  ]
78  );
79  $this->database->manipulate('
80  UPDATE il_adn_notifications SET limited_to_languages = "[]";
81  ');
82  }
abortIfNotPrepared()
Halts the execution of these update steps if no database was provided.
+ Here is the call graph for this function:

Field Documentation

◆ $database

ilDBInterface ilADNDatabaseObjective::$database = null
private

Definition at line 26 of file class.ilADNDatabaseObjective.php.


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