database.php 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876
  1. <?php
  2. /* For license terms, see /license.txt */
  3. /**
  4. * Plugin database installation script. Can only be executed if included
  5. * inside another script loading global.inc.php
  6. * @package chamilo.plugin.sepe
  7. */
  8. /**
  9. * Check if script can be called
  10. */
  11. if (!function_exists('api_get_path')) {
  12. die('This script must be loaded through the Chamilo plugin installer sequence');
  13. }
  14. $entityManager = Database::getManager();
  15. $pluginSchema = new \Doctrine\DBAL\Schema\Schema();
  16. $connection = $entityManager->getConnection();
  17. $platform = $connection->getDatabasePlatform();
  18. //Create tables
  19. /* ========== PLUGIN_SEPE_CENTER ========== */
  20. $sepeCenterTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_CENTER);
  21. $sepeCenterTable->addColumn(
  22. 'id',
  23. \Doctrine\DBAL\Types\Type::INTEGER,
  24. array('autoincrement' => true, 'unsigned' => true)
  25. );
  26. $sepeCenterTable->addColumn('center_origin', \Doctrine\DBAL\Types\Type::STRING);
  27. $sepeCenterTable->addColumn('center_code', \Doctrine\DBAL\Types\Type::STRING);
  28. $sepeCenterTable->addColumn('center_name', \Doctrine\DBAL\Types\Type::STRING);
  29. $sepeCenterTable->addColumn('url', \Doctrine\DBAL\Types\Type::STRING);
  30. $sepeCenterTable->addColumn('tracking_url', \Doctrine\DBAL\Types\Type::STRING);
  31. $sepeCenterTable->addColumn('phone', \Doctrine\DBAL\Types\Type::STRING);
  32. $sepeCenterTable->addColumn('mail', \Doctrine\DBAL\Types\Type::STRING);
  33. $sepeCenterTable->setPrimaryKey(array('d'));
  34. /* ========== PLUGIN_SEPE_ACTIONS ========== */
  35. $sepeActionsTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_ACTIONS);
  36. $sepeActionsTable->addColumn(
  37. 'id',
  38. \Doctrine\DBAL\Types\Type::INTEGER,
  39. array('autoincrement' => true, 'unsigned' => true)
  40. );
  41. $sepeActionsTable->addColumn(
  42. 'action_origin',
  43. \Doctrine\DBAL\Types\Type::STRING,
  44. array('length' => 2)
  45. );
  46. $sepeActionsTable->addColumn(
  47. 'action_code',
  48. \Doctrine\DBAL\Types\Type::STRING,
  49. array('length' => 30)
  50. );
  51. $sepeActionsTable->addColumn(
  52. 'situation',
  53. \Doctrine\DBAL\Types\Type::STRING,
  54. array('length' => 2)
  55. );
  56. $sepeActionsTable->addColumn(
  57. 'specialty_origin',
  58. \Doctrine\DBAL\Types\Type::STRING,
  59. array('length' => 2)
  60. );
  61. $sepeActionsTable->addColumn(
  62. 'professional_area',
  63. \Doctrine\DBAL\Types\Type::STRING,
  64. array('length' => 4)
  65. );
  66. $sepeActionsTable->addColumn(
  67. 'specialty_code',
  68. \Doctrine\DBAL\Types\Type::STRING,
  69. array('length' => 14)
  70. );
  71. $sepeActionsTable->addColumn(
  72. 'duration',
  73. \Doctrine\DBAL\Types\Type::INTEGER,
  74. array('unsigned' => true)
  75. );
  76. $sepeActionsTable->addColumn('start_date', \Doctrine\DBAL\Types\Type::DATE);
  77. $sepeActionsTable->addColumn('end_date', \Doctrine\DBAL\Types\Type::DATE);
  78. $sepeActionsTable->addColumn(
  79. 'full_itinerary_indicator',
  80. \Doctrine\DBAL\Types\Type::STRING,
  81. array('length' => 2)
  82. );
  83. $sepeActionsTable->addColumn(
  84. 'financing_type',
  85. \Doctrine\DBAL\Types\Type::STRING,
  86. array('length' => 2)
  87. );
  88. $sepeActionsTable->addColumn(
  89. 'attendees_count',
  90. \Doctrine\DBAL\Types\Type::INTEGER,
  91. array('unsigned' => true)
  92. );
  93. $sepeActionsTable->addColumn(
  94. 'action_name',
  95. \Doctrine\DBAL\Types\Type::STRING,
  96. array('length' => 250)
  97. );
  98. $sepeActionsTable->addColumn('global_info', \Doctrine\DBAL\Types\Type::TEXT);
  99. $sepeActionsTable->addColumn('schedule', \Doctrine\DBAL\Types\Type::TEXT);
  100. $sepeActionsTable->addColumn('requirements', \Doctrine\DBAL\Types\Type::TEXT);
  101. $sepeActionsTable->addColumn('contact_action', \Doctrine\DBAL\Types\Type::TEXT);
  102. $sepeActionsTable->setPrimaryKey(array('id'));
  103. /* ==========PLUGIN_SEPE_SPECIALTY========== */
  104. $sepeSpecialtyTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_SPECIALTY);
  105. $sepeSpecialtyTable->addColumn(
  106. 'id',
  107. \Doctrine\DBAL\Types\Type::INTEGER,
  108. array('autoincrement' => true, 'unsigned' => true)
  109. );
  110. $sepeSpecialtyTable->addColumn(
  111. 'action_id',
  112. \Doctrine\DBAL\Types\Type::INTEGER,
  113. array('unsigned' => true)
  114. );
  115. $sepeSpecialtyTable->addColumn(
  116. 'specialty_origin',
  117. \Doctrine\DBAL\Types\Type::STRING,
  118. array('length' => 2)
  119. );
  120. $sepeSpecialtyTable->addColumn(
  121. 'professional_area',
  122. \Doctrine\DBAL\Types\Type::STRING,
  123. array('length' => 4)
  124. );
  125. $sepeSpecialtyTable->addColumn(
  126. 'specialty_code',
  127. \Doctrine\DBAL\Types\Type::STRING,
  128. array('length' => 14)
  129. );
  130. $sepeSpecialtyTable->addColumn(
  131. 'center_origin',
  132. \Doctrine\DBAL\Types\Type::STRING,
  133. array('length' => 2)
  134. );
  135. $sepeSpecialtyTable->addColumn(
  136. 'center_code',
  137. \Doctrine\DBAL\Types\Type::STRING,
  138. array('length' => 16)
  139. );
  140. $sepeSpecialtyTable->addColumn('start_date', \Doctrine\DBAL\Types\Type::DATE);
  141. $sepeSpecialtyTable->addColumn('end_date', \Doctrine\DBAL\Types\Type::DATE);
  142. $sepeSpecialtyTable->addColumn(
  143. 'modality_impartition',
  144. \Doctrine\DBAL\Types\Type::STRING,
  145. array('length' => 2)
  146. );
  147. $sepeSpecialtyTable->addColumn(
  148. 'classroom_hours',
  149. \Doctrine\DBAL\Types\Type::INTEGER,
  150. array('unsigned' => true)
  151. );
  152. $sepeSpecialtyTable->addColumn(
  153. 'distance_hours',
  154. \Doctrine\DBAL\Types\Type::INTEGER,
  155. array('unsigned' => true)
  156. );
  157. $sepeSpecialtyTable->addColumn(
  158. 'mornings_participants_number',
  159. \Doctrine\DBAL\Types\Type::INTEGER,
  160. array('unsigned' => true, 'notnull' => false)
  161. );
  162. $sepeSpecialtyTable->addColumn(
  163. 'mornings_access_number',
  164. \Doctrine\DBAL\Types\Type::INTEGER,
  165. array('unsigned' => true, 'notnull' => false)
  166. );
  167. $sepeSpecialtyTable->addColumn(
  168. 'morning_total_duration',
  169. \Doctrine\DBAL\Types\Type::INTEGER,
  170. array('unsigned' => true, 'notnull' => false)
  171. );
  172. $sepeSpecialtyTable->addColumn(
  173. 'afternoon_participants_number',
  174. \Doctrine\DBAL\Types\Type::INTEGER,
  175. array('unsigned' => true, 'notnull' => false)
  176. );
  177. $sepeSpecialtyTable->addColumn(
  178. 'afternoon_access_number',
  179. \Doctrine\DBAL\Types\Type::INTEGER,
  180. array('unsigned' => true, 'notnull' => false)
  181. );
  182. $sepeSpecialtyTable->addColumn(
  183. 'afternoon_total_duration',
  184. \Doctrine\DBAL\Types\Type::INTEGER,
  185. array('unsigned' => true, 'notnull' => false)
  186. );
  187. $sepeSpecialtyTable->addColumn(
  188. 'night_participants_number',
  189. \Doctrine\DBAL\Types\Type::INTEGER,
  190. array('unsigned' => true, 'notnull' => false)
  191. );
  192. $sepeSpecialtyTable->addColumn(
  193. 'night_access_number',
  194. \Doctrine\DBAL\Types\Type::INTEGER,
  195. array('unsigned' => true, 'notnull' => false)
  196. );
  197. $sepeSpecialtyTable->addColumn(
  198. 'night_total_duration',
  199. \Doctrine\DBAL\Types\Type::INTEGER,
  200. array('unsigned' => true, 'notnull' => false)
  201. );
  202. $sepeSpecialtyTable->addColumn(
  203. 'attendees_count',
  204. \Doctrine\DBAL\Types\Type::INTEGER,
  205. array('unsigned' => true, 'notnull' => false)
  206. );
  207. $sepeSpecialtyTable->addColumn(
  208. 'learning_activity_count',
  209. \Doctrine\DBAL\Types\Type::INTEGER,
  210. array('unsigned' => true, 'notnull' => false)
  211. );
  212. $sepeSpecialtyTable->addColumn(
  213. 'attempt_count',
  214. \Doctrine\DBAL\Types\Type::INTEGER,
  215. array('unsigned' => true, 'notnull' => false)
  216. );
  217. $sepeSpecialtyTable->addColumn(
  218. 'evaluation_activity_count',
  219. \Doctrine\DBAL\Types\Type::INTEGER,
  220. array('unsigned' => true, 'notnull' => false)
  221. );
  222. $sepeSpecialtyTable->setPrimaryKey(array('id'));
  223. $sepeSpecialtyTable->addForeignKeyConstraint(
  224. $sepeActionsTable,
  225. array('action_id'),
  226. array('id'),
  227. array('onDelete' => 'CASCADE')
  228. );
  229. /* ========== PLUGIN_SEPE_CENTROS ========== */
  230. $sepeCentrosTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_CENTERS);
  231. $sepeCentrosTable->addColumn(
  232. 'id',
  233. \Doctrine\DBAL\Types\Type::INTEGER,
  234. array('autoincrement' => true, 'unsigned' => true)
  235. );
  236. $sepeCentrosTable->addColumn(
  237. 'center_origin',
  238. \Doctrine\DBAL\Types\Type::STRING,
  239. array('length' => 2)
  240. );
  241. $sepeCentrosTable->addColumn(
  242. 'center_code',
  243. \Doctrine\DBAL\Types\Type::STRING,
  244. array('length' => 16)
  245. );
  246. $sepeCentrosTable->setPrimaryKey(array('cod'));
  247. /* ========== PLUGIN_SEPE_SPECIALTY_CLASSROOM ========== */
  248. $sepeSpecialtyClassroomTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_SPECIALTY_CLASSROOM);
  249. $sepeSpecialtyClassroomTable->addColumn(
  250. 'id',
  251. \Doctrine\DBAL\Types\Type::INTEGER,
  252. array('autoincrement' => true, 'unsigned' => true)
  253. );
  254. $sepeSpecialtyClassroomTable->addColumn(
  255. 'specialty_id',
  256. \Doctrine\DBAL\Types\Type::INTEGER,
  257. array('unsigned' => true)
  258. );
  259. $sepeSpecialtyClassroomTable->addColumn(
  260. 'center_id',
  261. \Doctrine\DBAL\Types\Type::INTEGER,
  262. array('unsigned' => true)
  263. );
  264. $sepeSpecialtyClassroomTable->setPrimaryKey(array('cod'));
  265. $sepeSpecialtyClassroomTable->addForeignKeyConstraint(
  266. $sepeSpecialtyTable,
  267. array('specialty_id'),
  268. array('id'),
  269. array('onDelete' => 'CASCADE')
  270. );
  271. /* ========== PLUGIN_SEPE_TUTORS ========== */
  272. $sepeTutorsTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_TUTORS);
  273. $sepeTutorsTable->addColumn(
  274. 'id',
  275. \Doctrine\DBAL\Types\Type::INTEGER,
  276. array('autoincrement' => true, 'unsigned' => true)
  277. );
  278. $sepeTutorsTable->addColumn(
  279. 'platform_user_id',
  280. \Doctrine\DBAL\Types\Type::INTEGER,
  281. array('unsigned' => true)
  282. );
  283. $sepeTutorsTable->addColumn(
  284. 'document_type',
  285. \Doctrine\DBAL\Types\Type::STRING,
  286. array('length' => 1)
  287. ); //enum('D','E','U','W','G','H')
  288. $sepeTutorsTable->addColumn(
  289. 'document_number',
  290. \Doctrine\DBAL\Types\Type::STRING,
  291. array('length' => 10)
  292. );
  293. $sepeTutorsTable->addColumn(
  294. 'document_letter',
  295. \Doctrine\DBAL\Types\Type::STRING,
  296. array('length' => 1)
  297. );
  298. $sepeTutorsTable->addColumn(
  299. 'tutor_accreditation',
  300. \Doctrine\DBAL\Types\Type::STRING,
  301. array('length' => 200)
  302. );
  303. $sepeTutorsTable->addColumn(
  304. 'professional_experience',
  305. \Doctrine\DBAL\Types\Type::INTEGER,
  306. array('unsigned' => true)
  307. );
  308. $sepeTutorsTable->addColumn(
  309. 'teaching_competence',
  310. \Doctrine\DBAL\Types\Type::STRING,
  311. array('length' => 2)
  312. );
  313. $sepeTutorsTable->addColumn(
  314. 'experience_teleforming',
  315. \Doctrine\DBAL\Types\Type::INTEGER,
  316. array('unsigned' => true)
  317. );
  318. $sepeTutorsTable->addColumn(
  319. 'training_teleforming',
  320. \Doctrine\DBAL\Types\Type::STRING,
  321. array('length' => 2)
  322. );
  323. $sepeTutorsTable->setPrimaryKey(array('id'));
  324. /* ========== PLUGIN_SEPE_SPECIALTY_TUTORS ========== */
  325. $sepeSpecialtyTutorsTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_SPECIALTY_TUTORS);
  326. $sepeSpecialtyTutorsTable->addColumn(
  327. 'id',
  328. \Doctrine\DBAL\Types\Type::INTEGER,
  329. array('autoincrement' => true, 'unsigned' => true)
  330. );
  331. $sepeSpecialtyTutorsTable->addColumn(
  332. 'specialty_id',
  333. \Doctrine\DBAL\Types\Type::INTEGER,
  334. array('unsigned' => true)
  335. );
  336. $sepeSpecialtyTutorsTable->addColumn(
  337. 'tutor_id',
  338. \Doctrine\DBAL\Types\Type::INTEGER,
  339. array('unsigned' => true)
  340. );
  341. $sepeSpecialtyTutorsTable->addColumn(
  342. 'tutor_accreditation',
  343. \Doctrine\DBAL\Types\Type::STRING,
  344. array('length' => 200)
  345. );
  346. $sepeSpecialtyTutorsTable->addColumn(
  347. 'professional_experience',
  348. \Doctrine\DBAL\Types\Type::INTEGER,
  349. array('unsigned' => true)
  350. );
  351. $sepeSpecialtyTutorsTable->addColumn(
  352. 'teaching_competence',
  353. \Doctrine\DBAL\Types\Type::STRING,
  354. array('length' => 2)
  355. );
  356. $sepeSpecialtyTutorsTable->addColumn(
  357. 'experience_teleforming',
  358. \Doctrine\DBAL\Types\Type::INTEGER,
  359. array('unsigned' => true)
  360. );
  361. $sepeSpecialtyTutorsTable->addColumn(
  362. 'training_teleforming',
  363. \Doctrine\DBAL\Types\Type::STRING,
  364. array('length' => 2)
  365. );
  366. $sepeSpecialtyTutorsTable->setPrimaryKey(array('id'));
  367. $sepeSpecialtyTutorsTable->addForeignKeyConstraint(
  368. $sepeSpecialtyTable,
  369. array('specialty_id'),
  370. array('id'),
  371. array('onDelete' => 'CASCADE')
  372. );
  373. /* ========== PLUGIN_SEPE_TUTORS_EMPRESA ========== */
  374. $sepeTutorsCompanyTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_TUTORS_COMPANY);
  375. $sepeTutorsCompanyTable->addColumn(
  376. 'id',
  377. \Doctrine\DBAL\Types\Type::INTEGER,
  378. array('autoincrement' => true, 'unsigned' => true)
  379. );
  380. $sepeTutorsCompanyTable->addColumn(
  381. 'alias',
  382. \Doctrine\DBAL\Types\Type::STRING,
  383. array('length' => 255)
  384. );
  385. $sepeTutorsCompanyTable->addColumn(
  386. 'document_type',
  387. \Doctrine\DBAL\Types\Type::STRING,
  388. array('length' => 1, 'notnull' => false)
  389. ); //enum('D','E','U','W','G','H')
  390. $sepeTutorsCompanyTable->addColumn(
  391. 'document_number',
  392. \Doctrine\DBAL\Types\Type::STRING,
  393. array('length' => 10, 'notnull' => false)
  394. );
  395. $sepeTutorsCompanyTable->addColumn(
  396. 'document_letter',
  397. \Doctrine\DBAL\Types\Type::STRING,
  398. array('length' => 1, 'notnull' => false)
  399. );
  400. $sepeTutorsCompanyTable->addColumn(
  401. 'company',
  402. \Doctrine\DBAL\Types\Type::STRING,
  403. array('length' => 2)
  404. );
  405. $sepeTutorsCompanyTable->addColumn(
  406. 'training',
  407. \Doctrine\DBAL\Types\Type::STRING,
  408. array('length' => 2)
  409. );
  410. $sepeTutorsCompanyTable->setPrimaryKey(array('cod'));
  411. /* ========== PLUGIN_SEPE_PARTICIPANTS ========== */
  412. $sepeParticipantsTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_PARTICIPANTS);
  413. $sepeParticipantsTable->addColumn(
  414. 'id',
  415. \Doctrine\DBAL\Types\Type::INTEGER,
  416. array('autoincrement' => true, 'unsigned' => true)
  417. );
  418. $sepeParticipantsTable->addColumn(
  419. 'action_id',
  420. \Doctrine\DBAL\Types\Type::INTEGER,
  421. array('unsigned' => true)
  422. );
  423. $sepeParticipantsTable->addColumn(
  424. 'platform_user_id',
  425. \Doctrine\DBAL\Types\Type::INTEGER,
  426. array('unsigned' => true)
  427. );
  428. $sepeParticipantsTable->addColumn(
  429. 'document_type',
  430. \Doctrine\DBAL\Types\Type::STRING,
  431. array('length' => 1)
  432. ); //enum('D','E','U','W','G','H')
  433. $sepeParticipantsTable->addColumn(
  434. 'document_number',
  435. \Doctrine\DBAL\Types\Type::STRING,
  436. array('length' => 10)
  437. );
  438. $sepeParticipantsTable->addColumn(
  439. 'document_letter',
  440. \Doctrine\DBAL\Types\Type::STRING,
  441. array('length' => 1)
  442. );
  443. $sepeParticipantsTable->addColumn(
  444. 'key_competence',
  445. \Doctrine\DBAL\Types\Type::STRING,
  446. array('length' => 2)
  447. );
  448. $sepeParticipantsTable->addColumn(
  449. 'contract_id',
  450. \Doctrine\DBAL\Types\Type::STRING,
  451. array('length' => 14, 'notnull' => false)
  452. );
  453. $sepeParticipantsTable->addColumn(
  454. 'company_fiscal_number',
  455. \Doctrine\DBAL\Types\Type::STRING,
  456. array('length' => 9, 'notnull' => false)
  457. );
  458. $sepeParticipantsTable->addColumn(
  459. 'company_tutor_id',
  460. \Doctrine\DBAL\Types\Type::INTEGER,
  461. array('unsigned' => true)
  462. );
  463. $sepeParticipantsTable->addColumn(
  464. 'training_tutor_id',
  465. \Doctrine\DBAL\Types\Type::INTEGER,
  466. array('unsigned' => true)
  467. );
  468. $sepeParticipantsTable->setPrimaryKey(array('id'));
  469. $sepeParticipantsTable->addForeignKeyConstraint(
  470. $sepeActionsTable,
  471. array('action_id'),
  472. array('id'),
  473. array('onDelete' => 'CASCADE')
  474. );
  475. $sepeParticipantsTable->addForeignKeyConstraint(
  476. $sepeTutorsCompanyTable,
  477. array('company_tutor_id'),
  478. array('id'),
  479. array('onDelete' => 'CASCADE')
  480. );
  481. $sepeParticipantsTable->addForeignKeyConstraint(
  482. $sepeTutorsCompanyTable,
  483. array('training_tutor_id'),
  484. array('id'),
  485. array('onDelete' => 'CASCADE')
  486. );
  487. /* ========== PLUGIN_SEPE_PARTICIPANTS_SPECIALTY ========== */
  488. $sepeParticipantsSpecialtyTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_PARTICIPANTS_SPECIALTY);
  489. $sepeParticipantsSpecialtyTable->addColumn(
  490. 'id',
  491. \Doctrine\DBAL\Types\Type::INTEGER,
  492. array('autoincrement' => true, 'unsigned' => true)
  493. );
  494. $sepeParticipantsSpecialtyTable->addColumn(
  495. 'participant_id',
  496. \Doctrine\DBAL\Types\Type::INTEGER,
  497. array('unsigned' => true)
  498. );
  499. $sepeParticipantsSpecialtyTable->addColumn(
  500. 'specialty_origin',
  501. \Doctrine\DBAL\Types\Type::STRING,
  502. array('length' => 2, 'notnull' => false)
  503. );
  504. $sepeParticipantsSpecialtyTable->addColumn(
  505. 'professional_area',
  506. \Doctrine\DBAL\Types\Type::STRING,
  507. array('length' => 4, 'notnull' => false)
  508. );
  509. $sepeParticipantsSpecialtyTable->addColumn(
  510. 'specialty_code',
  511. \Doctrine\DBAL\Types\Type::STRING,
  512. array('length' => 14, 'notnull' => false)
  513. );
  514. $sepeParticipantsSpecialtyTable->addColumn(
  515. 'registration_date',
  516. \Doctrine\DBAL\Types\Type::DATE,
  517. array('notnull' => false)
  518. );
  519. $sepeParticipantsSpecialtyTable->addColumn(
  520. 'leaving_date',
  521. \Doctrine\DBAL\Types\Type::DATE,
  522. array('notnull' => false)
  523. );
  524. $sepeParticipantsSpecialtyTable->addColumn(
  525. 'center_origin',
  526. \Doctrine\DBAL\Types\Type::STRING,
  527. array('length' => 2, 'notnull' => false)
  528. );
  529. $sepeParticipantsSpecialtyTable->addColumn(
  530. 'center_code',
  531. \Doctrine\DBAL\Types\Type::STRING,
  532. array('length' => 16, 'notnull' => false)
  533. );
  534. $sepeParticipantsSpecialtyTable->addColumn(
  535. 'start_date',
  536. \Doctrine\DBAL\Types\Type::DATE,
  537. array('notnull' => false)
  538. );
  539. $sepeParticipantsSpecialtyTable->addColumn(
  540. 'end_date',
  541. \Doctrine\DBAL\Types\Type::DATE,
  542. array('notnull' => false)
  543. );
  544. $sepeParticipantsSpecialtyTable->addColumn(
  545. 'final_result',
  546. \Doctrine\DBAL\Types\Type::STRING,
  547. array('length' => 1, 'notnull' => false)
  548. );
  549. $sepeParticipantsSpecialtyTable->addColumn(
  550. 'final_qualification',
  551. \Doctrine\DBAL\Types\Type::STRING,
  552. array('length' => 4, 'notnull' => false)
  553. );
  554. $sepeParticipantsSpecialtyTable->addColumn(
  555. 'final_score',
  556. \Doctrine\DBAL\Types\Type::STRING,
  557. array('length' => 4, 'notnull' => false)
  558. );
  559. $sepeParticipantsSpecialtyTable->setPrimaryKey(array('cod'));
  560. $sepeParticipantsSpecialtyTable->addForeignKeyConstraint(
  561. $sepeParticipantsTable,
  562. array('participant_id'),
  563. array('id'),
  564. array('onDelete' => 'CASCADE')
  565. );
  566. /* ========== PLUGIN_SEPE_PARTICIPANTS_SPECIALTY_TUTORIALS ========== */
  567. $sepeParticipantsSpecialtyTutorialsTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_PARTICIPANTS_SPECIALTY_TUTORIALS);
  568. $sepeParticipantsSpecialtyTutorialsTable->addColumn(
  569. 'id',
  570. \Doctrine\DBAL\Types\Type::INTEGER,
  571. array('autoincrement' => true, 'unsigned' => true)
  572. );
  573. $sepeParticipantsSpecialtyTutorialsTable->addColumn(
  574. 'participant_specialty_id',
  575. \Doctrine\DBAL\Types\Type::INTEGER,
  576. array('unsigned' => true)
  577. );
  578. $sepeParticipantsSpecialtyTutorialsTable->addColumn(
  579. 'center_origin',
  580. \Doctrine\DBAL\Types\Type::STRING,
  581. array('length' => 2)
  582. );
  583. $sepeParticipantsSpecialtyTutorialsTable->addColumn(
  584. 'center_code',
  585. \Doctrine\DBAL\Types\Type::STRING,
  586. array('length' => 16)
  587. );
  588. $sepeParticipantsSpecialtyTutorialsTable->addColumn('start_date', \Doctrine\DBAL\Types\Type::DATE);
  589. $sepeParticipantsSpecialtyTutorialsTable->addColumn('end_date', \Doctrine\DBAL\Types\Type::DATE);
  590. $sepeParticipantsSpecialtyTutorialsTable->setPrimaryKey(array('id'));
  591. $sepeParticipantsSpecialtyTutorialsTable->addForeignKeyConstraint(
  592. $sepeParticipantsSpecialtyTable,
  593. array('participant_specialty_id'),
  594. array('id'),
  595. array('onDelete' => 'CASCADE')
  596. );
  597. /* ========== PLUGIN_SEPE_COURSE_ACTIONS ========== */
  598. $sepeCourseActionsTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_COURSE_ACTIONS);
  599. $sepeCourseActionsTable->addColumn(
  600. 'id',
  601. \Doctrine\DBAL\Types\Type::INTEGER,
  602. array('autoincrement' => true, 'unsigned' => true)
  603. );
  604. $sepeCourseActionsTable->addColumn(
  605. 'course_id',
  606. \Doctrine\DBAL\Types\Type::INTEGER,
  607. array('unsigned' => true)
  608. );
  609. $sepeCourseActionsTable->addColumn(
  610. 'action_id',
  611. \Doctrine\DBAL\Types\Type::INTEGER,
  612. array('unsigned' => true)
  613. );
  614. $sepeCourseActionsTable->setPrimaryKey(array('cod'));
  615. $sepeCourseActionsTable->addForeignKeyConstraint(
  616. $sepeActionsTable,
  617. array('action_id'),
  618. array('id'),
  619. array('onDelete' => 'CASCADE')
  620. );
  621. /* ========== PLUGIN_SEPE_TEACHING_COMPETENCE ========== */
  622. $sepeTeachingCompetenceTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_TEACHING_COMPETENCE);
  623. $sepeTeachingCompetenceTable->addColumn(
  624. 'id',
  625. \Doctrine\DBAL\Types\Type::INTEGER,
  626. array('autoincrement' => true, 'unsigned' => true)
  627. );
  628. $sepeTeachingCompetenceTable->addColumn(
  629. 'code',
  630. \Doctrine\DBAL\Types\Type::STRING,
  631. array('length' => 2)
  632. );
  633. $sepeTeachingCompetenceTable->addColumn('value', \Doctrine\DBAL\Types\Type::TEXT);
  634. $sepeTeachingCompetenceTable->setPrimaryKey(array('id'));
  635. /* ========== PLUGIN_SEPE_LOG_PARTICIPANT ========== */
  636. $sepeLogParticipantTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_LOG_PARTICIPANT);
  637. $sepeLogParticipantTable->addColumn(
  638. 'id',
  639. \Doctrine\DBAL\Types\Type::INTEGER,
  640. array('autoincrement' => true, 'unsigned' => true)
  641. );
  642. $sepeLogParticipantTable->addColumn(
  643. 'platform_user_id',
  644. \Doctrine\DBAL\Types\Type::INTEGER,
  645. array('unsigned' => true)
  646. );
  647. $sepeLogParticipantTable->addColumn(
  648. 'action_id',
  649. \Doctrine\DBAL\Types\Type::INTEGER,
  650. array('unsigned' => true)
  651. );
  652. $sepeLogParticipantTable->addColumn('registration_date', \Doctrine\DBAL\Types\Type::DATETIME);
  653. $sepeLogParticipantTable->addColumn('leaving_date', \Doctrine\DBAL\Types\Type::DATETIME);
  654. $sepeLogParticipantTable->setPrimaryKey(array('id'));
  655. /* ========== PLUGIN_SEPE_LOG_MOD_PARTICIPANT ========== */
  656. $sepeLogModParticipantTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_LOG_MOD_PARTICIPANT);
  657. $sepeLogModParticipantTable->addColumn(
  658. 'id',
  659. \Doctrine\DBAL\Types\Type::INTEGER,
  660. array('autoincrement' => true, 'unsigned' => true)
  661. );
  662. $sepeLogModParticipantTable->addColumn(
  663. 'platform_user_id',
  664. \Doctrine\DBAL\Types\Type::INTEGER,
  665. array('unsigned' => true)
  666. );
  667. $sepeLogModParticipantTable->addColumn(
  668. 'action_id',
  669. \Doctrine\DBAL\Types\Type::INTEGER,
  670. array('unsigned' => true)
  671. );
  672. $sepeLogModParticipantTable->addColumn('change_date', \Doctrine\DBAL\Types\Type::DATETIME);
  673. $sepeLogModParticipantTable->setPrimaryKey(array('id'));
  674. /* ==========PLUGIN_SEPE_LOG ========== */
  675. $sepeLogTable = $pluginSchema->createTable(SepePlugin::TABLE_SEPE_LOG);
  676. $sepeLogTable->addColumn(
  677. 'id',
  678. \Doctrine\DBAL\Types\Type::INTEGER,
  679. array('autoincrement' => true, 'unsigned' => true)
  680. );
  681. $sepeLogTable->addColumn(
  682. 'ip',
  683. \Doctrine\DBAL\Types\Type::STRING,
  684. array('length' => 200)
  685. );
  686. $sepeLogTable->addColumn(
  687. 'action',
  688. \Doctrine\DBAL\Types\Type::STRING,
  689. array('length' => 255)
  690. );
  691. $sepeLogTable->addColumn('date', \Doctrine\DBAL\Types\Type::DATETIME);
  692. $sepeLogTable->setPrimaryKey(array('id'));
  693. $queries = $pluginSchema->toSql($platform);
  694. foreach ($queries as $query) {
  695. Database::query($query);
  696. }
  697. //Insert data
  698. $sepeTeachingCompetenceTable = Database::get_main_table(SepePlugin::TABLE_SEPE_TEACHING_COMPETENCE);
  699. $competences = array(
  700. array(1, '01', 'Certificado de profesionalidad de docencia de la formación profesional para el empleo regulado por Real Decreto 1697/2011, de 18 de noviembre.'),
  701. array(2, '02', 'Certificado de profesionalidad de formador ocupacional.'),
  702. array(3, '03', 'Certificado de Aptitud Pedagógica o título profesional de Especialización Didáctica o Certificado de Cualificación Pedagógica.'),
  703. array(4, '04', 'Máster Universitario habilitante para el ejercicio de las Profesiones reguladas de Profesor de Educación Secundaria Obligatoria y Bachillerato, Formación Profesional y Escuelas Oficiales de Idiomas.'),
  704. array(5, '05', 'Curso de formación equivalente a la formación pedagógica y didáctica exigida para aquellas personas que, estando en posesion de una titulación declarada equivalente a efectos de docencia, no pueden realizar los estudios de máster, establecida en la disposición adicional primera del Real Decreto 1834/2008, de 8 de noviembre.'),
  705. array(6, '06', 'Experiencia docente contrastada de al menos 600 horas de impartición de acciones formativas de formación profesional para el empleo o del sistema educativo en modalidad presencial, en los últimos diez años.')
  706. );
  707. foreach ($competences as $competence) {
  708. Database::insert(
  709. $sepeTeachingCompetenceTable,
  710. array(
  711. 'cod' => $competence[0],
  712. 'code' => $competence[1],
  713. 'value' => $competence[2]
  714. )
  715. );
  716. }
  717. $sepeTutorsCompanyTable = Database::get_main_table(SepePlugin::TABLE_SEPE_TUTORS_COMPANY);
  718. Database::insert(
  719. $sepeTutorsCompanyTable,
  720. array(
  721. 'cod' => 1,
  722. 'alias' => 'Sin tutor',
  723. 'company' => 'SI',
  724. 'training' => 'SI'
  725. )
  726. );
  727. /* Create extra fields for platform users */
  728. $fieldlabel = 'sexo';
  729. $fieldtype = '3';
  730. $fieldtitle = 'Género';
  731. $fielddefault = '';
  732. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  733. $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', 'Hombre', 'Hombre',1);";
  734. Database::query($sql);
  735. $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', 'Mujer', 'Mujer',2);";
  736. Database::query($sql);
  737. $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', 'Otros', 'Otros',3);";
  738. Database::query($sql);
  739. $fieldlabel = 'edad';
  740. $fieldtype = '6';
  741. $fieldtitle = 'Fecha de nacimiento';
  742. $fielddefault = '';
  743. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  744. $fieldlabel = 'nivel_formativo';
  745. $fieldtype = '1';
  746. $fieldtitle = 'Nivel formativo';
  747. $fielddefault = '';
  748. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  749. $fieldlabel = 'situacion_laboral';
  750. $fieldtype = '1';
  751. $fieldtitle = 'Situación Laboral';
  752. $fielddefault = '';
  753. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  754. $fieldlabel = 'provincia_residencia';
  755. $fieldtype = '4';
  756. $fieldtitle = 'Provincia Residencia';
  757. $fielddefault = '';
  758. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  759. $provinces = 'Albacete;Alicante/Alacant;Almería;Araba/Álava;Asturias;Ávila;Badajoz;Balears, Illes;Barcelona;Bizkaia;Burgos;Cáceres;Cádiz;Cantabria;Castellón/Castelló;Ciudad Real;Córdoba;Coruña, A;Cuenca;Gipuzkoa;Girona;Granada;Guadalajara;Huelva;Huesca;Jaén;León;Lleida;Lugo;Madrid;Málaga;Murcia;Navarra;Ourense;Palencia;Palmas, Las;Pontevedr;Rioja, La;Salamanca;Santa Cruz de Tenerife;Segovia;Sevilla;Soria;Tarragona;Teruel;Toledo;Valencia/Valéncia;Valladolid;Zamora;Zaragoza;Ceuta;Melilla';
  760. $list_provinces = explode(';',$provinces);
  761. $i = 1;
  762. foreach ($list_provinces as $value) {
  763. $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', '".$i."', '".$value."','".$i."');";
  764. Database::query($sql);
  765. $i++;
  766. }
  767. $fieldlabel = 'comunidad_residencia';
  768. $fieldtype = '4';
  769. $fieldtitle = 'Comunidad autonoma de residencia';
  770. $fielddefault = '';
  771. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  772. $ccaa = ';Andalucía;Aragón;Asturias, Principado de;Balears, Illes;Canarias;Cantabria;Castilla y León;Castilla - La Mancha;Cataluña;Comunitat Valenciana;Extremadura;Galicia;Madrid, Comunidad de;Murcia, Región de;Navarra, Comunidad Foral de;País Vasco;Rioja, La;Ceuta;Melilla';
  773. $list_ccaa = explode(';',$ccaa);
  774. $i = 1;
  775. foreach ($list_ccaa as $value) {
  776. $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', '".$i."', '".$value."','".$i."');";
  777. Database::query($sql);
  778. $i++;
  779. }
  780. $fieldlabel = 'provincia_trabajo';
  781. $fieldtype = '4';
  782. $fieldtitle = 'Provincia Trabajo';
  783. $fielddefault = '';
  784. //$fieldoptions = ';Albacete;Alicante/Alacant;Almería;Araba/Álava;Asturias;Ávila;Badajoz;Balears, Illes;Barcelona;Bizkaia;Burgos;Cáceres;Cádiz;Cantabria;Castellón/Castelló;Ciudad Real;Córdoba;Coruña, A;Cuenca;Gipuzkoa;Girona;Granada;Guadalajara;Huelva;Huesca;Jaén;León;Lleida;Lugo;Madrid;Málaga;Murcia;Navarra;Ourense;Palencia;Palmas, Las;Pontevedr;Rioja, La;Salamanca;Santa Cruz de Tenerife;Segovia;Sevilla;Soria;Tarragona;Teruel;Toledo;Valencia/Valéncia;Valladolid;Zamora;Zaragoza;Ceuta;Melilla';
  785. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  786. $i = 1;
  787. foreach ($list_provincias as $value) {
  788. $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', '".$i."', '".$value."','".$i."');";
  789. Database::query($sql);
  790. $i++;
  791. }
  792. $fieldlabel = 'comunidad_trabajo';
  793. $fieldtype = '4';
  794. $fieldtitle = 'Comunidad autonoma Trabajo';
  795. $fielddefault = '';
  796. //$fieldoptions = ';Andalucía;Aragón;Asturias, Principado de;Balears, Illes;Canarias;Cantabria;Castilla y León;Castilla - La Mancha;Cataluña;Comunitat Valenciana;Extremadura;Galicia;Madrid, Comunidad de;Murcia, Región de;Navarra, Comunidad Foral de;País Vasco;Rioja, La;Ceuta;Melilla';
  797. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  798. $i = 1;
  799. foreach ($list_ccaa as $value) {
  800. $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', '".$i."', '".$value."','".$i."');";
  801. Database::query($sql);
  802. $i++;
  803. }
  804. $fieldlabel = 'medio_conocimiento';
  805. $fieldtype = '2';
  806. $fieldtitle = 'Medio de conocimiento Acción formativa';
  807. $fielddefault = '';
  808. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  809. $fieldlabel = 'experiencia_anterior';
  810. $fieldtype = '2';
  811. $fieldtitle = 'Experiencia anterior en la realización de cursos on-line';
  812. $fielddefault = '';
  813. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  814. $fieldlabel = 'razones_teleformacion';
  815. $fieldtype = '2';
  816. $fieldtitle = 'Razones por la modalidad teleformación';
  817. $fielddefault = '';
  818. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  819. $fieldlabel = 'valoracion_modalidad';
  820. $fieldtype = '2';
  821. $fieldtitle = 'Valoración general sobre la modalidad';
  822. $fielddefault = '';
  823. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  824. $fieldlabel = 'categoria_profesional';
  825. $fieldtype = '1';
  826. $fieldtitle = 'Categoría profesional';
  827. $fielddefault = '';
  828. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  829. $fieldlabel = 'tamano_empresa';
  830. $fieldtype = '1';
  831. $fieldtitle = 'Tamaño de la empresa';
  832. $fielddefault = '';
  833. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);
  834. $fieldlabel = 'horario_accion_formativa';
  835. $fieldtype = '1';
  836. $fieldtitle = 'Horario de la acción formativa';
  837. $fielddefault = '';
  838. $field_id = UserManager::create_extra_field($fieldlabel,$fieldtype,$fieldtitle,$fielddefault);