Version20160610142700.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. namespace Application\Migrations\Schema\V111;
  4. use Application\Migrations\AbstractMigrationChamilo;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\DBAL\Types\Type;
  7. /**
  8. * Class Version20160610142700
  9. * Integrate the Skype plugin and create new settings current to enable it
  10. * @package Application\Migrations\Schema\V111
  11. */
  12. class Version20160610142700 extends AbstractMigrationChamilo
  13. {
  14. /**
  15. * @param Schema $schema
  16. * @throws \Doctrine\DBAL\DBALException
  17. * @throws \Doctrine\DBAL\Schema\SchemaException
  18. */
  19. public function up(Schema $schema)
  20. {
  21. $dataList = $this
  22. ->connection
  23. ->executeQuery("
  24. SELECT id FROM extra_field
  25. WHERE variable = 'skype' AND extra_field_type = 1
  26. ")
  27. ->fetchAll();
  28. if (empty($dataList)) {
  29. $this->addSql("
  30. INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at)
  31. VALUES (1, 1, 'skype', 'Skype', 1, 1, now())
  32. ");
  33. }
  34. $this->addSql("
  35. INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, visible, changeable, created_at)
  36. VALUES (1, 1, 'linkedin_url', 'LinkedInUrl', 1, 1, now())
  37. ");
  38. $this->addSettingCurrent(
  39. 'allow_show_skype_account',
  40. null,
  41. 'radio',
  42. 'Platform',
  43. 'true',
  44. 'AllowShowSkypeAccountTitle',
  45. 'AllowShowSkypeAccountComment',
  46. null,
  47. null,
  48. 1,
  49. true,
  50. false,
  51. [
  52. ['value' => 'false', 'text' => 'No'],
  53. ['value' => 'true', 'text' => 'Yes']
  54. ]
  55. );
  56. $this->addSettingCurrent(
  57. 'allow_show_linkedin_url',
  58. null,
  59. 'radio',
  60. 'Platform',
  61. 'true',
  62. 'AllowShowLinkedInUrlTitle',
  63. 'AllowShowLinkedInUrlComment',
  64. null,
  65. null,
  66. 1,
  67. true,
  68. false,
  69. [
  70. ['value' => 'false', 'text' => 'No'],
  71. ['value' => 'true', 'text' => 'Yes']
  72. ]
  73. );
  74. }
  75. /**
  76. * @param Schema $schema
  77. * @throws \Doctrine\DBAL\DBALException
  78. * @throws \Doctrine\DBAL\Schema\SchemaException
  79. */
  80. public function down(Schema $schema)
  81. {
  82. }
  83. }