Version20150821150000.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. * Class Version20150821150000
  8. *
  9. * @package Application\Migrations\Schema\V11010
  10. */
  11. class Version20150821150000 extends AbstractMigrationChamilo
  12. {
  13. /**
  14. * @param Schema $schema
  15. */
  16. public function up(Schema $schema)
  17. {
  18. $entityManage = $this->getEntityManager();
  19. $deleteOptions = $entityManage->createQueryBuilder();
  20. $deleteSettings = $entityManage->createQueryBuilder();
  21. $deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
  22. ->andWhere(
  23. $deleteOptions->expr()->in(
  24. 'o.variable',
  25. [
  26. 'display_mini_month_calendar'
  27. ]
  28. )
  29. );
  30. $deleteOptions->getQuery()->execute();
  31. $deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
  32. ->andWhere(
  33. $deleteSettings->expr()->in(
  34. 's.variable',
  35. [
  36. 'display_mini_month_calendar'
  37. ]
  38. )
  39. );
  40. $deleteSettings->getQuery()->execute();
  41. $deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
  42. ->andWhere(
  43. $deleteOptions->expr()->in(
  44. 'o.variable',
  45. [
  46. 'display_upcoming_events'
  47. ]
  48. )
  49. );
  50. $deleteOptions->getQuery()->execute();
  51. $deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
  52. ->andWhere(
  53. $deleteSettings->expr()->in(
  54. 's.variable',
  55. [
  56. 'display_upcoming_events'
  57. ]
  58. )
  59. );
  60. $deleteSettings->getQuery()->execute();
  61. $deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
  62. ->andWhere(
  63. $deleteSettings->expr()->in(
  64. 's.variable',
  65. [
  66. 'number_of_upcoming_events'
  67. ]
  68. )
  69. );
  70. $deleteSettings->getQuery()->execute();
  71. $deleteOptions->delete('ChamiloCoreBundle:SettingsOptions', 'o')
  72. ->andWhere(
  73. $deleteOptions->expr()->in(
  74. 'o.variable',
  75. [
  76. 'allow_reservation'
  77. ]
  78. )
  79. );
  80. $deleteOptions->getQuery()->execute();
  81. $deleteSettings->delete('ChamiloCoreBundle:SettingsCurrent', 's')
  82. ->andWhere(
  83. $deleteSettings->expr()->in(
  84. 's.variable',
  85. [
  86. 'allow_reservation'
  87. ]
  88. )
  89. );
  90. $deleteSettings->getQuery()->execute();
  91. }
  92. /**
  93. * @param Schema $schema
  94. */
  95. public function down(Schema $schema)
  96. {
  97. $this->addSettingCurrent(
  98. 'display_mini_month_calendar',
  99. null,
  100. 'radio',
  101. 'Tools',
  102. 'true',
  103. 'DisplayMiniMonthCalendarTitle',
  104. 'DisplayMiniMonthCalendarComment',
  105. null,
  106. null,
  107. 1,
  108. false,
  109. false,
  110. [
  111. 0 => ['value' => 'true', 'text' => 'Yes'],
  112. 1 => ['value' => 'false', 'text' => 'No']
  113. ]
  114. );
  115. $this->addSettingCurrent(
  116. 'display_upcoming_events',
  117. null,
  118. 'radio',
  119. 'Tools',
  120. 'true',
  121. 'DisplayUpcomingEventsTitle',
  122. 'DisplayUpcomingEventsComment',
  123. null,
  124. null,
  125. 1,
  126. false,
  127. false,
  128. [
  129. 0 => ['value' => 'true', 'text' => 'Yes'],
  130. 1 => ['value' => 'false', 'text' => 'No']
  131. ]
  132. );
  133. $this->addSettingCurrent(
  134. 'number_of_upcoming_events',
  135. null,
  136. 'textfield',
  137. 'Tools',
  138. '1',
  139. 'NumberOfUpcomingEventsTitle',
  140. 'NumberOfUpcomingEventsComment',
  141. null,
  142. null,
  143. 1,
  144. false,
  145. false
  146. );
  147. $this->addSettingCurrent(
  148. 'allow_reservation',
  149. null,
  150. 'radio',
  151. 'Tools',
  152. 'false',
  153. 'AllowReservationTitle',
  154. 'AllowReservationComment',
  155. null,
  156. null,
  157. 1,
  158. true,
  159. false,
  160. [
  161. 0 => ['value' => 'true', 'text' => 'Yes'],
  162. 1 => ['value' => 'false', 'text' => 'No']
  163. ]
  164. );
  165. }
  166. }