PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/PHP/Control Escolar/CalendarioBundle/Entity/OfertaActividad.php

https://gitlab.com/bluedrayco/Portafolio
PHP | 568 lines | 216 code | 76 blank | 276 comment | 3 complexity | f5bc96629b046ec36bb48d9a138a3c80 MD5 | raw file
  1. <?php
  2. namespace ControlEscolar\CalendarioBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints;
  5. use JMS\Serializer\Annotation\ExclusionPolicy;
  6. use JMS\Serializer\Annotation\Expose;
  7. /**
  8. * OfertaActividad
  9. * @ExclusionPolicy("all")
  10. */
  11. class OfertaActividad
  12. {
  13. /*
  14. * Contructor de la clase
  15. */
  16. public function __construct() {
  17. //Inicializa el control acceso con un array vacio
  18. $this->control_acceso = array(
  19. 'obligatorio'=>array(),
  20. 'solo_lectura'=>array()
  21. );
  22. }
  23. /**
  24. * @var integer
  25. * @Expose
  26. */
  27. private $oferta_actividad_id;
  28. /**
  29. * @var \DateTime
  30. * @Expose
  31. */
  32. private $fecha_inicio;
  33. /**
  34. * @var \DateTime
  35. * @Expose
  36. */
  37. private $fecha_fin;
  38. /**
  39. * @var boolean
  40. * @Expose
  41. */
  42. private $obligatoria;
  43. /**
  44. * @var boolean
  45. * @Expose
  46. */
  47. private $sincronizado;
  48. /**
  49. * @var boolean
  50. * @Expose
  51. */
  52. private $puede_publicar;
  53. /**
  54. * @var boolean
  55. * @Expose
  56. */
  57. private $extemporanea;
  58. /**
  59. * @var \DateTime
  60. * @Expose
  61. */
  62. private $fecha_alta;
  63. /**
  64. * @var \DateTime
  65. * @Expose
  66. */
  67. private $fecha_modificacion;
  68. /**
  69. * @var \Core\UserBundle\Entity\Usuario
  70. */
  71. private $Usuario;
  72. /**
  73. * @var \Core\UserBundle\Entity\Usuario
  74. */
  75. private $UsuarioModifica;
  76. /**
  77. * @var \ControlEscolar\CalendarioBundle\Entity\EscenarioOferta
  78. * @Expose
  79. */
  80. private $EscenarioOferta;
  81. /**
  82. * @var \ControlEscolar\PlanAnualBundle\Entity\Actividad
  83. * @Expose
  84. */
  85. private $Actividad;
  86. /**
  87. * @var \Core\CoreBundle\Entity\ActividadAcademica
  88. * @Expose
  89. */
  90. private $ActividadAcademica;
  91. /**
  92. * @var \Core\CoreBundle\Entity\ActividadAcademicaEsquema
  93. * @Expose
  94. */
  95. private $ActividadAcademicaEsquema;
  96. /**
  97. * @var array
  98. * @Expose
  99. */
  100. private $control_acceso;
  101. /**
  102. * Get oferta_actividad_id
  103. *
  104. * @return integer
  105. */
  106. public function getOfertaActividadId()
  107. {
  108. return $this->oferta_actividad_id;
  109. }
  110. /**
  111. * Set fecha_inicio
  112. *
  113. * @param \DateTime $fechaInicio
  114. * @return OfertaActividad
  115. */
  116. public function setFechaInicio($fechaInicio)
  117. {
  118. $this->fecha_inicio = $fechaInicio;
  119. return $this;
  120. }
  121. /**
  122. * Get fecha_inicio
  123. *
  124. * @return \DateTime
  125. */
  126. public function getFechaInicio()
  127. {
  128. return $this->fecha_inicio;
  129. }
  130. /**
  131. * Set fecha_fin
  132. *
  133. * @param \DateTime $fechaFin
  134. * @return OfertaActividad
  135. */
  136. public function setFechaFin($fechaFin)
  137. {
  138. $this->fecha_fin = $fechaFin;
  139. return $this;
  140. }
  141. /**
  142. * Get fecha_fin
  143. *
  144. * @return \DateTime
  145. */
  146. public function getFechaFin()
  147. {
  148. return $this->fecha_fin;
  149. }
  150. /**
  151. * Set obligatoria
  152. *
  153. * @param boolean $obligatoria
  154. * @return OfertaActividad
  155. */
  156. public function setObligatoria($obligatoria)
  157. {
  158. $this->obligatoria = $obligatoria;
  159. return $this;
  160. }
  161. /**
  162. * Get obligatoria
  163. *
  164. * @return boolean
  165. */
  166. public function getObligatoria()
  167. {
  168. return $this->obligatoria;
  169. }
  170. /**
  171. * Set extemporanea
  172. *
  173. * @param boolean $extemporanea
  174. * @return OfertaActividad
  175. */
  176. public function setExtemporanea($extemporanea)
  177. {
  178. $this->extemporanea = $extemporanea;
  179. return $this;
  180. }
  181. /**
  182. * Get extemporanea
  183. *
  184. * @return boolean
  185. */
  186. public function getExtemporanea()
  187. {
  188. return $this->extemporanea;
  189. }
  190. /**
  191. * Set sincronizado
  192. *
  193. * @param boolean $sincronizado
  194. * @return OfertaActividad
  195. */
  196. public function setSincronizado($sincronizado)
  197. {
  198. $this->sincronizado = $sincronizado;
  199. return $this;
  200. }
  201. /**
  202. * Get puede_publicar
  203. *
  204. * @return boolean
  205. */
  206. public function getPuedePublicar()
  207. {
  208. return $this->puede_publicar;
  209. }
  210. /**
  211. * Set puede_publicar
  212. *
  213. * @param boolean $puede_publicar
  214. * @return OfertaActividad
  215. */
  216. public function setPuedePublicar($puede_publicar)
  217. {
  218. $this->puede_publicar = $puede_publicar;
  219. return $this;
  220. }
  221. /**
  222. * Get sincronizado
  223. *
  224. * @return boolean
  225. */
  226. public function getSincronizado()
  227. {
  228. return $this->sincronizado;
  229. }
  230. /**
  231. * Set fecha_alta
  232. *
  233. * @param \DateTime $fechaAlta
  234. * @return OfertaActividad
  235. */
  236. public function setFechaAlta($fechaAlta)
  237. {
  238. $this->fecha_alta = $fechaAlta;
  239. return $this;
  240. }
  241. /**
  242. * Get fecha_alta
  243. *
  244. * @return \DateTime
  245. */
  246. public function getFechaAlta()
  247. {
  248. return $this->fecha_alta;
  249. }
  250. /**
  251. * Set fecha_modificacion
  252. *
  253. * @param \DateTime $fechaModificacion
  254. * @return OfertaActividad
  255. */
  256. public function setFechaModificacion($fechaModificacion)
  257. {
  258. $this->fecha_modificacion = $fechaModificacion;
  259. return $this;
  260. }
  261. /**
  262. * Get fecha_modificacion
  263. *
  264. * @return \DateTime
  265. */
  266. public function getFechaModificacion()
  267. {
  268. return $this->fecha_modificacion;
  269. }
  270. /**
  271. * Set Usuario
  272. *
  273. * @param \Core\UserBundle\Entity\Usuario $usuario
  274. * @return OfertaActividad
  275. */
  276. public function setUsuario(\Core\UserBundle\Entity\Usuario $usuario)
  277. {
  278. $this->Usuario = $usuario;
  279. return $this;
  280. }
  281. /**
  282. * Get Usuario
  283. *
  284. * @return \Core\UserBundle\Entity\Usuario
  285. */
  286. public function getUsuario()
  287. {
  288. return $this->Usuario;
  289. }
  290. /**
  291. * Set UsuarioModifica
  292. *
  293. * @param \Core\UserBundle\Entity\Usuario $usuarioModifica
  294. * @return OfertaActividad
  295. */
  296. public function setUsuarioModifica(\Core\UserBundle\Entity\Usuario $usuarioModifica = null)
  297. {
  298. $this->UsuarioModifica = $usuarioModifica;
  299. return $this;
  300. }
  301. /**
  302. * Get UsuarioModifica
  303. *
  304. * @return \Core\UserBundle\Entity\Usuario
  305. */
  306. public function getUsuarioModifica()
  307. {
  308. return $this->UsuarioModifica;
  309. }
  310. /**
  311. * Set EscenarioOferta
  312. *
  313. * @param \ControlEscolar\CalendarioBundle\Entity\EscenarioOferta $escenarioOferta
  314. * @return OfertaActividad
  315. */
  316. public function setEscenarioOferta(\ControlEscolar\CalendarioBundle\Entity\EscenarioOferta $escenarioOferta = null)
  317. {
  318. $this->EscenarioOferta = $escenarioOferta;
  319. return $this;
  320. }
  321. /**
  322. * Get EscenarioOferta
  323. *
  324. * @return \ControlEscolar\CalendarioBundle\Entity\EscenarioOferta
  325. */
  326. public function getEscenarioOferta()
  327. {
  328. return $this->EscenarioOferta;
  329. }
  330. /**
  331. * Set Actividad
  332. *
  333. * @param \ControlEscolar\CalendarioBundle\Entity\Actividad $actividad
  334. * @return OfertaActividad
  335. */
  336. public function setActividad(\ControlEscolar\PlanAnualBundle\Entity\Actividad $actividad = null)
  337. {
  338. $this->Actividad = $actividad;
  339. return $this;
  340. }
  341. /**
  342. * Get Actividad
  343. *
  344. * @return \ControlEscolar\PlanAnualBundle\Entity\Actividad
  345. */
  346. public function getActividad()
  347. {
  348. return $this->Actividad;
  349. }
  350. /**
  351. * Set ActividadAcademica
  352. *
  353. * @param \Core\CoreBundle\Entity\ActividadAcademica $actividadAcademica
  354. * @return OfertaActividad
  355. */
  356. public function setActividadAcademica(\Core\CoreBundle\Entity\ActividadAcademica $actividadAcademica = null)
  357. {
  358. $this->ActividadAcademica = $actividadAcademica;
  359. return $this;
  360. }
  361. /**
  362. * Get ActividadAcademica
  363. *
  364. * @return \Core\CoreBundle\Entity\ActividadAcademica
  365. */
  366. public function getActividadAcademica()
  367. {
  368. return $this->ActividadAcademica;
  369. }
  370. /**
  371. * Set ActividadAcademicaEsquema
  372. *
  373. * @param \Core\CoreBundle\Entity\ActividadAcademicaEsquema $actividadAcademicaEsquema
  374. * @return OfertaActividad
  375. */
  376. public function setActividadAcademicaEsquema(\Core\CoreBundle\Entity\ActividadAcademicaEsquema $actividadAcademicaEsquema = null)
  377. {
  378. $this->ActividadAcademicaEsquema = $actividadAcademicaEsquema;
  379. return $this;
  380. }
  381. /**
  382. * Get ActividadAcademicaEsquema
  383. *
  384. * @return \Core\CoreBundle\Entity\ActividadAcademicaEsquema
  385. */
  386. public function getActividadAcademicaEsquema()
  387. {
  388. return $this->ActividadAcademicaEsquema;
  389. }
  390. /**
  391. * @var boolean
  392. */
  393. private $activo;
  394. /**
  395. * Set activo
  396. *
  397. * @param boolean $activo
  398. * @return OfertaActividad
  399. */
  400. public function setActivo($activo)
  401. {
  402. $this->activo = $activo;
  403. return $this;
  404. }
  405. /**
  406. * Get activo
  407. *
  408. * @return boolean
  409. */
  410. public function getActivo()
  411. {
  412. return $this->activo;
  413. }
  414. /*
  415. * Función que setea el acceso de tipo obligatorio
  416. */
  417. public function addAccesoObligatorio($acceso)
  418. {
  419. $this->addAcceso($acceso,'obligatorio');
  420. }
  421. /*
  422. * Función que setea el acceso de tipo obligatorio
  423. */
  424. public function removeAccesoObligatorio($acceso)
  425. {
  426. $this->removeAcceso($acceso,'obligatorio');
  427. }
  428. /**
  429. * Función para remover un acceso
  430. *
  431. * @return Object OfertaActividad
  432. */
  433. public function removeAcceso($acceso,$tipo)
  434. {
  435. //Evakya su existe el elemento en el array de control de acceso de
  436. //acuerdo al tipo dado, lo elimina si existe
  437. if (false !== $key = array_search(strtoupper($acceso), $this->control_acceso[$tipo], true)) {
  438. $controlAuxiliar = $this->control_acceso[$tipo];
  439. unset($controlAuxiliar[$key]);
  440. $this->control_acceso[$tipo] = array_values($controlAuxiliar);
  441. }
  442. return $this;
  443. }
  444. /**
  445. * Regresa el acceso
  446. *
  447. * @return array control_acceso
  448. */
  449. public function getControlAcceso()
  450. {
  451. return $this->control_acceso;
  452. }
  453. /**
  454. * Settea un array de acceso completo el acceso
  455. *
  456. * @return Object OfertaActividad
  457. */
  458. public function setControlAcceso($controlAcceso)
  459. {
  460. $this->control_acceso = $controlAcceso;
  461. return $this;
  462. }
  463. /**
  464. * Función para agregar un acceso obligatorio
  465. *
  466. * @return
  467. */
  468. public function addAcceso($acceso,$tipo)
  469. {
  470. $acceso = strtoupper($acceso);
  471. if(in_array($tipo, $this->control_acceso, true)){
  472. $this->control_acceso[$tipo] = array();
  473. }
  474. if (!in_array($acceso, $this->control_acceso[$tipo], true)) {
  475. $this->control_acceso[$tipo][] = $acceso;
  476. }
  477. return $this;
  478. }
  479. /**
  480. * Settea un array de acceso completo el acceso con valores por default
  481. *
  482. * @return Object OfertaActividad
  483. */
  484. public function setDefaultControlAcceso()
  485. {
  486. $this->control_acceso = array(
  487. 'obligatorio'=>array(),
  488. 'solo_lectura'=>array()
  489. );
  490. return $this;
  491. }
  492. }