Exemple #1
0
 public function getPrograms()
 {
     $programs = $this->em->getPrograms($this->sectionId);
     foreach ($programs as $i => $program) {
         $programs[$i]->startTs = $programs[$i]->timeFrom->getTimestamp();
     }
     return $programs;
 }
 public function create()
 {
     $programModel = $this->em->reflection('Program');
     $sectionId = empty($this->sectionId) ? $this->context->getParameters()['sectionId'] : $this->sectionId;
     //$from
     $form = new ProgramEditFormControl($sectionId);
     $form->setDefaultTimeFrom($this->context->getParameters()['programStart']);
     $startPlusOneHour = clone $this->context->getParameters()['programStart'];
     $startPlusOneHour->add(\DateInterval::createFromDateString('1 hour'));
     $form->setDefaultTimeTo($startPlusOneHour);
     $form->setProgramId($this->programId);
     $form->setEm($programModel, $this->em);
     return $form;
 }
Exemple #3
0
 /**
  * @return ProgrammeCondroid[]
  */
 public function fetchForCondroid()
 {
     $programs = $this->model->getProgramsList($this->sectionId, NULL, NULL, NULL, NULL, $orderBy = "content.id");
     $exports = [];
     $helper = new Programme();
     foreach ($programs as $program) {
         $condroidProgramme = new ProgrammeCondroid();
         $condroidProgramme->pid = $program->id;
         $condroidProgramme->author = htmlspecialchars($program->author);
         $condroidProgramme->title = htmlspecialchars($program->contentTitle);
         $condroidProgramme->type = $helper->fromType($program->typeId);
         $condroidProgramme->programLine = htmlspecialchars($program->programGenre);
         $condroidProgramme->location = $program->roomTitle;
         $condroidProgramme->startTime = new \DateTime($program->timeFrom);
         $condroidProgramme->endTime = new \DateTime($program->timeTo);
         $condroidProgramme->annotation = htmlspecialchars(strip_tags($program->text));
         $exports[] = $condroidProgramme;
     }
     return $exports;
 }