1 | <?php |
||
12 | class Version20150813143000 extends AbstractMigrationChamilo |
||
13 | { |
||
14 | /** |
||
15 | * @param Schema $schema |
||
16 | */ |
||
17 | public function up(Schema $schema) |
||
18 | { |
||
19 | $this->addSettingCurrent( |
||
20 | 'prevent_multiple_simultaneous_login', |
||
21 | null, |
||
22 | 'radio', |
||
23 | 'Security', |
||
24 | 'false', |
||
25 | 'PreventMultipleSimultaneousLoginTitle', |
||
26 | 'PreventMultipleSimultaneousLoginComment', |
||
27 | null, |
||
28 | null, |
||
29 | 1, |
||
30 | false, |
||
31 | true, |
||
32 | [ |
||
33 | 0 => ['value' => 'true', 'text' => 'Yes'], |
||
34 | 1 => ['value' => 'false', 'text' => 'No'] |
||
35 | ] |
||
36 | ); |
||
37 | $this->addSettingCurrent( |
||
38 | 'gradebook_detailed_admin_view', |
||
39 | null, |
||
40 | 'radio', |
||
41 | 'Gradebook', |
||
42 | 'false', |
||
43 | 'ShowAdditionalColumnsInStudentResultsPageTitle', |
||
44 | 'ShowAdditionalColumnsInStudentResultsPageComment', |
||
45 | null, |
||
46 | null, |
||
47 | 1, |
||
48 | true, |
||
49 | false, |
||
50 | [ |
||
51 | 0 => ['value' => 'true', 'text' => 'Yes'], |
||
52 | 1 => ['value' => 'false', 'text' => 'No'] |
||
53 | ] |
||
54 | ); |
||
55 | $this->addSettingCurrent( |
||
56 | 'course_catalog_published', |
||
57 | null, |
||
58 | 'radio', |
||
59 | 'Course', |
||
60 | 'false', |
||
61 | 'CourseCatalogIsPublicTitle', |
||
62 | 'CourseCatalogIsPublicComment', |
||
63 | null, |
||
64 | null, |
||
65 | 1, |
||
66 | false, |
||
67 | true, |
||
68 | [ |
||
69 | 0 => ['value' => 'true', 'text' => 'Yes'], |
||
70 | 1 => ['value' => 'false', 'text' => 'No'] |
||
71 | ] |
||
72 | ); |
||
73 | $this->addSettingCurrent( |
||
74 | 'user_reset_password', |
||
75 | null, |
||
76 | 'radio', |
||
77 | 'Security', |
||
78 | 'false', |
||
79 | 'ResetPasswordTokenTitle', |
||
80 | 'ResetPasswordTokenComment', |
||
81 | null, |
||
82 | null, |
||
83 | 1, |
||
84 | false, |
||
85 | true, |
||
86 | [ |
||
87 | 0 => ['value' => 'true', 'text' => 'Yes'], |
||
88 | 1 => ['value' => 'false', 'text' => 'No'] |
||
89 | ] |
||
90 | ); |
||
91 | $this->addSettingCurrent( |
||
92 | 'user_reset_password_token_limit', |
||
93 | null, |
||
94 | 'textfield', |
||
95 | 'Security', |
||
96 | '3600', |
||
97 | 'ResetPasswordTokenLimitTitle', |
||
98 | 'ResetPasswordTokenLimitComment', |
||
99 | null, |
||
100 | null, |
||
101 | 1, |
||
102 | false, |
||
103 | true |
||
104 | ); |
||
105 | $this->addSettingCurrent( |
||
106 | 'my_courses_view_by_session', |
||
107 | null, |
||
108 | 'radio', |
||
109 | 'Session', |
||
110 | 'false', |
||
111 | 'ViewMyCoursesListBySessionTitle', |
||
112 | 'ViewMyCoursesListBySessionComment', |
||
113 | null, |
||
114 | null, |
||
115 | 1, |
||
116 | true, |
||
117 | false, |
||
118 | [ |
||
119 | 0 => ['value' => 'true', 'text' => 'Yes'], |
||
120 | 1 => ['value' => 'false', 'text' => 'No'] |
||
121 | ] |
||
122 | ); |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * @param Schema $schema |
||
127 | */ |
||
128 | public function down(Schema $schema) |
||
129 | { |
||
130 | $entityManage = $this->getEntityManager(); |
||
131 | |||
132 | $deleteOptions = $entityManage->createQueryBuilder(); |
||
133 | $deleteSettings = $entityManage->createQueryBuilder(); |
||
134 | |||
135 | $deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o') |
||
136 | ->andWhere( |
||
137 | $deleteOptions->expr()->in( |
||
138 | 'o.variable', |
||
139 | [ |
||
140 | 'prevent_multiple_simultaneous_login', |
||
141 | 'gradebook_detailed_admin_view', |
||
142 | 'course_catalog_published', |
||
143 | 'user_reset_password', |
||
144 | 'user_reset_password_token_limit', |
||
145 | 'my_courses_view_by_session' |
||
146 | ] |
||
147 | ) |
||
148 | ); |
||
149 | $deleteOptions->getQuery()->execute(); |
||
150 | |||
151 | $deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's') |
||
152 | ->andWhere( |
||
153 | $deleteSettings->expr()->in( |
||
154 | 's.variable', |
||
155 | [ |
||
156 | 'prevent_multiple_simultaneous_login', |
||
157 | 'gradebook_detailed_admin_view', |
||
158 | 'course_catalog_published', |
||
159 | 'user_reset_password', |
||
160 | 'my_courses_view_by_session' |
||
161 | ] |
||
162 | ) |
||
163 | ); |
||
164 | $deleteSettings->getQuery()->execute(); |
||
165 | } |
||
166 | } |
||
167 |