function getcomments($id) { Configure::write('debug', '0'); //turn debugging off; debugging breaks ajax $this->layout = 'ajax'; $comments = Set::extract($this->Comment->getComments($this->Event, $id), '{n}.Comment'); $event = $this->Event->findById($id); $params = array(); $params['summary'] = $event['Event']['summary']; $params['start_time'] = $event['Event']['start_time']; $params['end_time'] = $event['Event']['end_time']; App::import("Model", 'Template'); $template = new Template(); $res = $template->findByName('timelineevent-details'); $tpl = $res['Template']['temp']; App::import('Vendor', 'h2o/h2o'); App::import('Vendor', 'filters'); $details = h2o($tpl, array('autoescape' => false))->render($params); $this->set('json', array('success' => TRUE, 'comments' => $comments, 'details' => $details, 'created' => $event['Event']['created'])); }
function getcomments($id) { Configure::write('debug', '0'); //turn debugging off; debugging breaks ajax $this->layout = 'ajax'; $comments = Set::extract($this->Comment->getComments($this->Photo, $id), '{n}.Comment'); $photo = $this->Photo->findById($id); $params = array(); $params['id'] = $photo['Photo']['id']; $params['name'] = $photo['Photo']['name']; $params['filename'] = substr_replace($photo['Photo']['filename'], '.jpg', strrpos($photo['Photo']['filename'], '.')); $params['img_path'] = $this->Conf->get('Images.people_web_path'); App::import("Model", 'Template'); $template = new Template(); $res = $template->findByName('photo-details'); $tpl = $res['Template']['temp']; App::import('Vendor', 'h2o/h2o'); App::import('Vendor', 'filters'); $details = h2o($tpl, array('autoescape' => false))->render($params); $this->set('json', array('success' => TRUE, 'comments' => $comments, 'details' => $details, 'created' => $photo['Photo']['created'])); }