/** * Функция берет даты ТЗ прошлой и будущей * * @return array 0 - Старая дата ТЗ, 1 - Новая дата ТЗ */ public function dateVersionTz() { $ev_code = current(sbr_notification::getEventCode(array('sbr_stages' => array('TZ_MODIFIED')))); $times = sbr_notification::getNotificationsForStage($this->data['sbr_id'], $this->data['id'], $ev_code['id']); // Берем последние две даты (0 - дата ТЗ сейчас, 1 - дата ТЗ до этого) if (count($times) >= 2) { $result = array(strtotime($times[1]['xtime']), strtotime($times[0]['xtime'])); } else { if (count($times) == 1) { // Если 1 изменение до старая дата ТЗ - это дата создания этапа, новая дата - это дата записи события $result = array(strtotime($this->data['created']), strtotime($times[0]['xtime'])); } else { $result = array(strtotime($this->data['created']), strtotime($this->data['created'])); // Даты создания этапа } } $this->data['date_version_tz'] = $result; return $result; }