예제 #1
0
 /**
  * отсекает все события, которые закончились на момент фильтра
  * @param AppointmentItem $member
  * @return bool
  */
 public function isMeetFilter(\Application\AppointmentItem $member)
 {
     if (is_null($this->timeFilter)) {
         return true;
     } else {
         $end = $member->getTimeEnd()->getTimestamp();
         $test = $this->timeFilter->getTimestamp();
         return $end > $test;
     }
 }
예제 #2
0
 public function save(\Application\AppointmentItem $app, \Core\Database $db)
 {
     $fields_to_save = $app->toArray();
     unset($fields_to_save['id']);
     unset($fields_to_save['submitted']);
     if (is_null($app->getId()) || $app->getId() == '') {
         $this->makeInsertQuery('appointments', $fields_to_save, $db);
         $lid = $db->getLastInsertId();
         $app->fromArray(array($app->getIdFieldName() => $lid));
     } else {
         $this->makeUpdateQuery('appointments', $fields_to_save, array('id' => $app->getId()), $db);
     }
 }
예제 #3
0
 private function getValuesArray(\Application\AppointmentItem $appointment)
 {
     $values = array();
     $values['start'] = $appointment->getTimeStart()->format('H:i');
     $values['end'] = $appointment->getTimeEnd()->format('H:i');
     $values['notes'] = $appointment->getNotes();
     $values['submitted'] = $appointment->getSubmitted()->format('Y-m-d H:i:s');
     $values['employee'] = $appointment->getEmpId();
     return $values;
 }
예제 #4
0
 /**
  * @depends testArrayFunctions
  * @param \Application\AppointmentItem $app
  */
 public function testSetters(\Application\AppointmentItem $app)
 {
     $app->setTimeStart(new \DateTime('2015-10-15 10:27:00'));
     $this->assertEquals(new \DateTime('2015-10-15 10:27:00'), $app->getTimeStart());
     $app->setTimeEnd(new \DateTime('2015-10-15 10:28:00'));
     $this->assertEquals(new \DateTime('2015-10-15 10:28:00'), $app->getTimeEnd());
     $app->setChain(6);
     $this->assertEquals(6, $app->getChain());
     $app->setNotes('other note');
     $this->assertEquals('other note', $app->getNotes());
     $app->setEmpId(20);
     $this->assertEquals(20, $app->getEmpId());
 }
예제 #5
0
 public static function MakeSuccessAppCreationMessage(\Application\AppointmentItem $leadingApp, $hourMode)
 {
     $message = '<span style="font-weight:normal">The event <strong>' . \Utility\DateHelper::FormatTimeAccordingRule($leadingApp->getTimeStart(), $hourMode) . ' - ' . \Utility\DateHelper::FormatTimeAccordingRule($leadingApp->getTimeEnd(), $hourMode) . '</strong> has been added.<br>' . 'The text for this event is: ' . $leadingApp->getNotes() . '</span>';
     return $message;
 }