Version20150813143000.php 4.6 KB

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