db_matches_notas.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?php
  2. /**
  3. * This script defines as closely as possible the matches between
  4. * original tables and destination (chamilo) tables and fields.
  5. * See db_matches.dist.php for formatting documentation
  6. */
  7. //intIdTipoEmpleado = 2 = Profesor
  8. // This is an array that matches objects (for Chamilo)
  9. $matches = array(
  10. //Asistencia - put in comment for now
  11. array(
  12. 'orig_table' => 'ProgramaAcademico',
  13. 'query' => 'SELECT %s
  14. FROM ProgramaAcademico as p
  15. INNER JOIN le_AlumnoAsistencia a ON (a.codigoPrograma = p.uidIdPrograma AND p.bitVigencia = 1 )
  16. INNER JOIN Alumno al ON (al.uidIdAlumno = a.codigoAlumno AND al.bitVigencia = 1)
  17. WHERE 1=1 ',
  18. 'dest_func' => 'MigrationCustom::create_attendance',
  19. 'dest_table' => 'session',
  20. 'fields_match' => array(
  21. array(
  22. 'orig' => 'al.uidIdPersona',
  23. 'sql_alter' => 'sql_alter_unhash_50',
  24. 'dest' => 'user_id',
  25. 'func' => 'get_user_id_by_persona_id',
  26. ),
  27. array(
  28. 'orig' => 'p.uidIdPrograma',
  29. 'sql_alter' => 'sql_alter_unhash_50',
  30. 'dest' => 'session_id',
  31. 'func' => 'get_session_id_by_programa_id',
  32. ),
  33. array(
  34. 'orig' => 'a.fecha',
  35. 'sql_alter' => 'clean_date_time',
  36. 'dest' => 'fecha',
  37. 'func' => '',
  38. ),
  39. array(
  40. 'orig' => 'a.estado',
  41. 'sql_alter' => '',
  42. 'dest' => 'status',
  43. 'func' => 'convert_attendance_status',
  44. ),
  45. )
  46. ),
  47. //Course advance
  48. /*
  49. array(
  50. 'orig_table' => 'ProgramaAcademico',
  51. //ORDER BY p.uidIdPrograma, a.Unidad, un.Descripcion
  52. 'query' => 'SELECT DISTINCT %s
  53. FROM ProgramaAcademico as p
  54. INNER JOIN le_AvanceCursoPrograma a ON (a.Programa = p.uidIdPrograma AND p.bitVigencia = 1)
  55. INNER JOIN le_Unidad un ON (un.CodigoUnidad = a.Unidad)
  56. ',
  57. 'dest_func' => 'MigrationCustom::create_thematic',
  58. 'dest_table' => 'session',
  59. 'fields_match' => array(
  60. array(
  61. 'orig' => 'p.uidIdPrograma',
  62. 'sql_alter' => 'sql_alter_unhash_50',
  63. 'dest' => 'session_id',
  64. 'func' => 'get_session_id_by_programa_id',
  65. ),
  66. array(
  67. 'orig' => 'un.Descripcion',
  68. 'sql_alter' => '',
  69. 'dest' => 'thematic_plan',
  70. 'func' => '',
  71. ),
  72. array(
  73. 'orig' => 'a.Unidad',
  74. 'sql_alter' => '',
  75. 'dest' => 'thematic',
  76. 'func' => '',
  77. ),
  78. )
  79. ),
  80. */
  81. //Gradebook - create gradebook evaluations types
  82. array(
  83. 'orig_table' => 'gradebook_evaluation_type',
  84. 'query' => 'SELECT %s '.
  85. ' FROM le_ConceptoCalificatorioTipo '.
  86. ' WHERE 1 = 1 ',
  87. 'dest_func' => 'MigrationCustom::add_evaluation_type',
  88. 'dest_table' => 'session',
  89. 'fields_match' => array(
  90. array(
  91. 'orig' => 'Descripcion',
  92. 'sql_alter' => '',
  93. 'dest' => 'name',
  94. 'func' => '',
  95. ),
  96. array(
  97. 'orig' => 'CodigoTipo',
  98. 'sql_alter' => '',
  99. 'dest' => 'external_id',
  100. 'func' => '',
  101. )
  102. )
  103. ),
  104. //Gradebook - create gradebook evaluations
  105. array(
  106. 'orig_table' => 'ProgramaAcademico',
  107. 'query' => 'SELECT DISTINCT %s
  108. FROM ProgramaAcademico as p
  109. INNER JOIN le_Nota n ON (n.codigoPrograma = p.uidIdPrograma AND p.bitVigencia = 1 )
  110. INNER JOIN le_ConceptoCalificatorio cc ON (cc.CodigoConcepto = n.CodigoConcepto)
  111. WHERE 1 = 1 ',
  112. 'dest_func' => 'MigrationCustom::create_gradebook_evaluation',
  113. 'dest_table' => 'session',
  114. 'fields_match' => array(
  115. array(
  116. 'orig' => 'p.uidIdPrograma',
  117. 'sql_alter' => 'sql_alter_unhash_50',
  118. 'dest' => 'session_id',
  119. 'func' => 'get_session_id_by_programa_id',
  120. ),
  121. array(
  122. 'orig' => 'cc.CodigoTipo',
  123. 'sql_alter' => '',
  124. 'dest' => 'gradebook_evaluation_type_id',
  125. 'func' => 'get_evaluation_type',
  126. ),
  127. array(
  128. 'orig' => 'cc.Descripcion',
  129. 'sql_alter' => '',
  130. 'dest' => 'gradebook_description',
  131. 'func' => '',
  132. ),
  133. )
  134. ),
  135. //Nota <= 2009 (ahora también para > 2009)
  136. array(
  137. 'orig_table' => 'ProgramaAcademico',
  138. 'query' => 'SELECT DISTINCT %s '.
  139. 'FROM ProgramaAcademico as p '.
  140. 'INNER JOIN Nota n ON (n.uidIdPrograma = p.uidIdPrograma AND p.bitVigencia = 1 ) '.
  141. 'INNER JOIN Alumno a ON (a.uidIdAlumno = n.uidIdAlumno) '.
  142. '',
  143. 'dest_func' => 'MigrationCustom::add_gradebook_result_with_evaluation',
  144. 'dest_table' => 'session',
  145. 'fields_match' => array(
  146. array(
  147. 'orig' => 'p.uidIdPrograma',
  148. 'sql_alter' => 'sql_alter_unhash_50',
  149. 'dest' => 'session_id',
  150. 'func' => 'get_session_id_by_programa_id',
  151. ),
  152. array(
  153. 'orig' => 'uidIdPersona',
  154. 'sql_alter' => 'sql_alter_unhash_50',
  155. 'dest' => 'user_id',
  156. 'func' => 'get_user_id_by_persona_id',
  157. ),
  158. array(
  159. 'orig' => 'tinNota',
  160. 'sql_alter' => '',
  161. 'dest' => 'nota',
  162. 'func' => '',
  163. ),
  164. array(
  165. 'orig' => 'n.sdtFechaModificacion',
  166. 'sql_alter' => '',
  167. 'dest' => 'fecha',
  168. 'func' => '',
  169. ),
  170. )
  171. ),
  172. /*
  173. 'web_service_calls' => array(
  174. 'url' => "http://www2.icpna.edu.pe/wsprueba/service.asmx?wsdl",
  175. 'filename' => 'migration.custom.class.php',
  176. 'class' => 'MigrationCustom',
  177. ),
  178. //le_Nota
  179. //>= 2010',
  180. /*
  181. array(
  182. 'orig_table' => 'ProgramaAcademico',
  183. 'query' => 'SELECT DISTINCT %s
  184. FROM ProgramaAcademico as p
  185. INNER JOIN le_Nota n ON (n.codigoPrograma = p.uidIdPrograma AND p.bitVigencia = 1 )
  186. INNER JOIN Alumno a ON (n.CodigoAlumno = a.uidIdAlumno)
  187. WHERE YEAR(UltimaFechaModif) >= 2010',
  188. 'dest_func' => 'MigrationCustom::add_gradebook_result',
  189. 'dest_table' => 'session',
  190. 'fields_match' => array(
  191. array(
  192. 'orig' => 'p.uidIdPrograma',
  193. 'sql_alter' => 'sql_alter_unhash_50',
  194. 'dest' => 'session_id',
  195. 'func' => 'get_session_id_by_programa_id',
  196. ),
  197. array(
  198. 'orig' => 'uidIdPersona',
  199. 'sql_alter' => 'sql_alter_unhash_50',
  200. 'dest' => 'user_id',
  201. 'func' => 'get_user_id_by_persona_id',
  202. ),
  203. array(
  204. 'orig' => 'Nota',
  205. 'sql_alter' => '',
  206. 'dest' => 'nota',
  207. 'func' => '',
  208. ),
  209. array(
  210. 'orig' => 'UltimaFechaModif',
  211. 'sql_alter' => '',
  212. 'dest' => 'fecha',
  213. 'func' => 'clean_date_time',
  214. ),
  215. )
  216. ),
  217. */
  218. );