diff --git a/web/api/app/Controller/EventsController.php b/web/api/app/Controller/EventsController.php index 959ccc596..91a2de75c 100644 --- a/web/api/app/Controller/EventsController.php +++ b/web/api/app/Controller/EventsController.php @@ -142,7 +142,7 @@ class EventsController extends AppController { 'event' => $event, '_serialize' => array('event') )); - } + } // end function view /** diff --git a/web/api/app/Model/Event.php b/web/api/app/Model/Event.php index 51e24052e..de83473f1 100644 --- a/web/api/app/Model/Event.php +++ b/web/api/app/Model/Event.php @@ -103,17 +103,17 @@ class Event extends AppModel { ); public function Relative_Path() { - $Event = new ZM\Event($this->data); + $Event = new ZM\Event($this->id); return $Event->Relative_Path(); } // end function Relative_Path() - public function Path() { - $Event = new ZM\Event($this->data); + public function Path() { + $Event = new ZM\Event($this->id); return $Event->Path(); } public function Link_Path() { - $Event = new ZM\Event($this->data); + $Event = new ZM\Event($this->id); return $Event->Link_Path(); } @@ -123,20 +123,19 @@ class Event extends AppModel { $storage = $this->Storage->findById($event['StorageId']); if ( $event['DefaultVideo'] ) { - if ( file_exists($storage['Storage']['Path'].'/'.$this->Relative_Path().'/'.$event['DefaultVideo']) ) { + if ( file_exists($this->Path().'/'.$event['DefaultVideo']) ) { return 1; } else { - ZM\Logger::Debug("FIle does not exist at " . $storage['Storage']['Path'].'/'.$this->Relative_Path().'/'.$event['DefaultVideo'] ); + ZM\Logger::Debug('File does not exist at ' . $this->Path().'/'.$event['DefaultVideo'] ); } } else { - ZM\Logger::Debug("No DefaultVideo in Event" . $this->Event); + ZM\Logger::Debug('No DefaultVideo in Event' . $this->Event); return 0; } } // end function fileExists($event) public function fileSize($event) { - $storage = $this->Storage->findById($event['StorageId']); - return filesize($storage['Storage']['Path'].'/'.$this->Relative_Path($event).'/'.$event['DefaultVideo']); + return filesize($this->Path().'/'.$event['DefaultVideo']); } public function beforeDelete($cascade=true) {