ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilDataCollectionDBUpdateSteps10 Class Reference
+ Inheritance diagram for ilDataCollectionDBUpdateSteps10:
+ Collaboration diagram for ilDataCollectionDBUpdateSteps10:

Public Member Functions

 prepare (ilDBInterface $db)
 
 step_1 ()
 
 step_2 ()
 
 step_3 ()
 
- Public Member Functions inherited from ilDatabaseUpdateSteps
 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 21 of file class.ilDataCollectionDBUpdateSteps10.php.

Member Function Documentation

◆ prepare()

ilDataCollectionDBUpdateSteps10::prepare ( ilDBInterface  $db)

Definition at line 25 of file class.ilDataCollectionDBUpdateSteps10.php.

25 : void
26 {
27 $this->db = $db;
28 }

References $db.

◆ step_1()

ilDataCollectionDBUpdateSteps10::step_1 ( )

Definition at line 30 of file class.ilDataCollectionDBUpdateSteps10.php.

30 : void
31 {
32 $stmt = $this->db->queryF(
33 'SELECT il_dcl_field.*, area.value As text_area FROM il_dcl_field ' .
34 'LEFT JOIN il_dcl_field_prop AS lenght ON il_dcl_field.id = lenght.field_id AND lenght.name = %s' .
35 'LEFT JOIN il_dcl_field_prop AS area ON il_dcl_field.id = area.field_id AND area.name = %s' .
36 'WHERE il_dcl_field.datatype_id = %s AND lenght.value IS NULL',
37 [ilDBConstants::T_TEXT, ilDbConstants::T_TEXT, ilDbConstants::T_INTEGER],
39 );
40
41 while ($row = $this->db->fetchAssoc($stmt)) {
42 $this->db->insert(
43 'il_dcl_field_prop',
44 [
45 'id' => [ilDBConstants::T_INTEGER, $this->db->nextId('il_dcl_field_prop')],
46 'field_id' => [ilDBConstants::T_INTEGER, $row['id']],
48 'value' => [ilDBConstants::T_TEXT, ($row['text_area'] === '1') ? '4000' : '200'],
49 ]
50 );
51 $this->db->manipulateF(
52 "DELETE FROM il_dcl_field_prop WHERE name = %s AND field_id = %s",
54 ['text_area', $row['id']]
55 );
56 }
57 }
const PROP_LENGTH
General properties.

References ilDclDatatype\INPUTFORMAT_TEXT, ilDclBaseFieldModel\PROP_LENGTH, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

◆ step_2()

ilDataCollectionDBUpdateSteps10::step_2 ( )

Definition at line 59 of file class.ilDataCollectionDBUpdateSteps10.php.

59 : void
60 {
61 $stmt = $this->db->queryF(
62 'SELECT il_dcl_stloc1_value.* FROM il_dcl_stloc1_value ' .
63 'INNER JOIN il_dcl_record_field ON il_dcl_record_field.id = il_dcl_stloc1_value.record_field_id ' .
64 'INNER JOIN il_dcl_field ON il_dcl_field.id = il_dcl_record_field.field_id ' .
65 'WHERE il_dcl_field.datatype_id = %s AND il_dcl_stloc1_value.value LIKE %s',
68 );
69
70 while ($row = $this->db->fetchAssoc($stmt)) {
71 $old = json_decode($row['value'], true);
72 if (isset($old['title']) && isset($old['link'])) {
73 $value = json_encode([
74 'title' => $old['title'],
75 'link' => $old['link'],
76 ]);
77 $this->db->update(
78 'il_dcl_stloc1_value',
79 ['value' => [ilDBConstants::T_TEXT, $value]],
80 ['id' => [ilDBConstants::T_INTEGER, $row['id']]],
81 );
82 }
83 }
84 }

References ilDclDatatype\INPUTFORMAT_TEXT, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

◆ step_3()

ilDataCollectionDBUpdateSteps10::step_3 ( )

Definition at line 86 of file class.ilDataCollectionDBUpdateSteps10.php.

86 : void
87 {
88 $stmt = $this->db->queryF(
89 'SELECT lenght.id as lenght_id, area.id As text_id, area.value As text_area FROM il_dcl_field ' .
90 'LEFT JOIN il_dcl_field_prop AS lenght ON il_dcl_field.id = lenght.field_id AND lenght.name = %s' .
91 'LEFT JOIN il_dcl_field_prop AS area ON il_dcl_field.id = area.field_id AND area.name = %s' .
92 'WHERE il_dcl_field.datatype_id = %s AND lenght.value = ""',
93 [ilDBConstants::T_TEXT, ilDbConstants::T_TEXT, ilDbConstants::T_INTEGER],
95 );
96
97 while ($row = $this->db->fetchAssoc($stmt)) {
98 $this->db->update(
99 'il_dcl_field_prop',
100 ['value' => [ilDBConstants::T_TEXT, ($row['text_area'] === '1') ? '4000' : '200']],
101 ['id' => [ilDBConstants::T_INTEGER, $row['lenght_id']],]
102 );
103 $this->db->manipulateF("DELETE FROM il_dcl_field_prop WHERE id = %s", [ilDBConstants::T_INTEGER], [$row['text_id']]);
104 }
105 }

References ilDclDatatype\INPUTFORMAT_TEXT, ilDclBaseFieldModel\PROP_LENGTH, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Field Documentation

◆ $db

ilDBInterface ilDataCollectionDBUpdateSteps10::$db
protected

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

Referenced by prepare().


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