API: Return Filesystem path to event within json payload
This commit is contained in:
parent
c486cd0741
commit
7565edfc69
|
@ -62,12 +62,23 @@ class EventsController extends AppController {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function view($id = null) {
|
public function view($id = null) {
|
||||||
$this->Event->recursive = -1;
|
$this->loadModel('Config');
|
||||||
|
$configs = $this->Config->find('list', array(
|
||||||
|
'fields' => array('Name', 'Value'),
|
||||||
|
'conditions' => array('Name' => array('ZM_DIR_EVENTS'))
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->Event->recursive = 1;
|
||||||
if (!$this->Event->exists($id)) {
|
if (!$this->Event->exists($id)) {
|
||||||
throw new NotFoundException(__('Invalid event'));
|
throw new NotFoundException(__('Invalid event'));
|
||||||
}
|
}
|
||||||
$options = array('conditions' => array('Event.' . $this->Event->primaryKey => $id));
|
$options = array('conditions' => array('Event.' . $this->Event->primaryKey => $id));
|
||||||
$event = $this->Event->find('first', $options);
|
$event = $this->Event->find('first', $options);
|
||||||
|
|
||||||
|
$path = $configs['ZM_DIR_EVENTS'].'/'.$this->Image->getEventPath($event).'/';
|
||||||
|
|
||||||
|
$event['Event']['BasePath'] = $path;
|
||||||
|
|
||||||
$this->set(array(
|
$this->set(array(
|
||||||
'event' => $event,
|
'event' => $event,
|
||||||
'_serialize' => array('event')
|
'_serialize' => array('event')
|
||||||
|
|
Loading…
Reference in New Issue