1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 
	<?php
class GalleriesController extends ModulesController {
    var $name = 'Galleries';
    var $helpers    = array('Beurl', 'BeTree', 'BeToolbar');
    var $components = array('BeTree', 'BeCustomProperty', 'BeLangText', 'BeSecurity');
    var $uses = array('BEObject', 'Gallery', 'Tree', 'Category') ;
    protected $moduleName = 'galleries';
    protected $categorizableModels = array('Gallery');
    
    public function index($id = null, $order = "", $dir = true, $page = 1, $dim = 20) {
        $conf  = Configure::getInstance() ;
        $filter["object_type_id"] = $conf->objectTypes['gallery']["id"];
        $filter["count_annotation"] = array("Comment","EditorNote");
        $this->paginatedList($id, $filter, $order, $dir, $page, $dim);
        $this->loadCategories($filter["object_type_id"]);
    }
    public function view($id = null) {
        $this->viewObject($this->Gallery, $id);
    }
    
    public function save() {
        $this->checkWriteModulePermission();
        $this->Transaction->begin();
        $this->saveObject($this->Gallery);
        $this->Transaction->commit() ;
        $this->userInfoMessage(__("Gallery saved", true) . "<br />" . $this->data["title"]);
        $this->eventInfo("gallery ". $this->data["title"]." saved");
    }
    public function delete() {
        $this->checkWriteModulePermission();
        $objectsListDeleted = $this->deleteObjects("Gallery");
        $this->userInfoMessage(__("Galleries deleted", true) . " -  " . $objectsListDeleted);
        $this->eventInfo("galleries $objectsListDeleted deleted");
    }
    public function deleteSelected() {
        $this->checkWriteModulePermission();
        $objectsListDeleted = $this->deleteObjects("Gallery");
        $this->userInfoMessage(__("Galleries deleted", true) . " -  " . $objectsListDeleted);
        $this->eventInfo("galleries $objectsListDeleted deleted");
    }
    public function categories() {
        $this->showCategories($this->Gallery);
    }
}