diff --git a/web/api/app/Model/Event.php b/web/api/app/Model/Event.php index 14dbd377e..4e0ec96b9 100644 --- a/web/api/app/Model/Event.php +++ b/web/api/app/Model/Event.php @@ -1,4 +1,6 @@ data); + return $Event->Relative_Path(); } // end function Relative_Path() + public function Path() { + $Event = new ZM\Event($this->data); + return $Event->Path(); + } + + public function Link_Path() { + $Event = new ZM\Event($this->data); + return $Event->Link_Path(); + } public function fileExists($event) { //$data = $this->findById($id); @@ -121,10 +123,10 @@ class Event extends AppModel { $storage = $this->Storage->findById($event['StorageId']); if ( $event['DefaultVideo'] ) { - if ( file_exists($storage['Storage']['Path'].'/'.$this->Relative_Path($event).'/'.$event['DefaultVideo']) ) { + if ( file_exists($storage['Storage']['Path'].'/'.$this->Relative_Path().'/'.$event['DefaultVideo']) ) { return 1; } else { - Logger::Debug("FIle does not exist at " . $storage['Storage']['Path'].'/'.$this->Relative_Path($event).'/'.$event['DefaultVideo'] ); + Logger::Debug("FIle does not exist at " . $storage['Storage']['Path'].'/'.$this->Relative_Path().'/'.$event['DefaultVideo'] ); } } else { Logger::Debug("No DefaultVideo in Event" . $this->Event); @@ -136,4 +138,8 @@ Logger::Debug("No DefaultVideo in Event" . $this->Event); $storage = $this->Storage->findById($event['StorageId']); return filesize($storage['Storage']['Path'].'/'.$this->Relative_Path($event).'/'.$event['DefaultVideo']); } + public function beforeDelete($cascade=true) { + $Event = new ZM\Event($this->data); + return $Event->delete(); + } // end function afterDelete } diff --git a/web/includes/Event.php b/web/includes/Event.php index 51995ac19..227dc6842 100644 --- a/web/includes/Event.php +++ b/web/includes/Event.php @@ -1,5 +1,7 @@