Ejemplo n.º 1
0
 /**
  * beforeFilter callback
  *
  * @return void
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->Category = $this->I18nCategory;
     $this->Auth->allow('view', 'index');
     $this->set('modelName', $this->modelClass);
 }
Ejemplo n.º 2
0
 function admin_delete($id = null)
 {
     if (!$id) {
         $this->Session->setFlash('That Category could not be found', true);
         $this->redirect($this->referer());
     }
     $count = $this->Category->find('count', array('conditions' => array('Category.parent_id' => $id)));
     if ($count > 0) {
         $this->Session->setFlash(__('This Category has sub-categories.', true));
         $this->redirect($this->referer());
     }
     $category = $this->Category->read(null, $id);
     if (!empty($category['Content'])) {
         $this->Session->setFlash(__('There are still content itmes in this category. Remove them and try again.', true));
         $this->redirect($this->referer());
     }
     return parent::admin_delete($id);
 }