예제 #1
0
 /**
  * Get the status of a territory
  * - Warning means the territory should be returned soon
  * - Alert means the territory is late and should be returned now
  *
  * @return string
  */
 public function getStatus()
 {
     $status = '';
     if ($this->publisher) {
         $warningDate = new \DateTime();
         $warningDate->add(\DateInterval::createFromDateString('-' . $this->congregation->getSettings()->get('territory_warning_borrow_time')->getValue()));
         $alertDate = new \DateTime();
         $alertDate->add(\DateInterval::createFromDateString('-' . $this->congregation->getSettings()->get('territory_max_borrow_time')->getValue()));
         if ($this->borrowDate) {
             if ($this->borrowDate < $alertDate) {
                 $status = self::TERRITORY_STATUS_ALERT;
             } elseif ($this->borrowDate < $warningDate) {
                 $status = self::TERRITORY_STATUS_WARNING;
             }
         }
     }
     return $status;
 }
예제 #2
0
 /**
  * Get formatted date
  *
  * @return string
  */
 public function getFormattedEndDate()
 {
     return $this->endDate ? $this->endDate->format($this->congregation->getSettings()->get('date_format_twig')->getValue()) : null;
 }