public function view($slug = '', $id = null) { // $slug is throwaway, it's just used for SEO. $m = ClassRegistry::init('News.AttachmentsItem'); $attachments = $m->findAllByItemId($id); foreach ($attachments as &$a) { $meta = ClassRegistry::init('News.Metadatum'); $a['Metadata'] = $meta->findAllByAttachmentId($a['Attachment']['id']); } $this->set(compact('attachments')); parent::view($id); }
function index($year = null, $month = null) { if ($year && $month) { $this->paginate['conditions'] = array('NewsArticle.date >=' => $year . '-' . $month . '-1', 'NewsArticle.date <=' => $year . '-' . $month . '-31'); } elseif ($year) { $this->paginate['conditions'] = array('NewsArticle.date >=' => $year . '-1-1', 'NewsArticle.date <=' => $year . '-12-31'); } if (Configure::read('News.layout')) { $this->layout = Configure::read('News.layout'); } else { $this->layout = 'default'; } return parent::index(); }
public function beforeFilter() { parent::beforeFilter(); //$this->Auth->allow('display'); }