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 81
<?php
class NewsController extends ModulesController {
var $helpers = array('BeTree', 'BeToolbar');
var $components = array('BeTree', 'BeCustomProperty', 'BeLangText', 'BeSecurity');
var $uses = array('BEObject','ShortNews','Category','Area') ;
protected $moduleName = 'news';
protected $categorizableModels = array('ShortNews');
public function index($id = null, $order = "", $dir = true, $page = 1, $dim = 20) {
$conf = Configure::getInstance() ;
$filter["object_type_id"] = $conf->objectTypes['short_news']["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->ShortNews, $id);
}
public function save() {
$this->checkWriteModulePermission();
$this->Transaction->begin();
$this->saveObject($this->ShortNews);
$this->Transaction->commit();
$this->userInfoMessage(__("News saved", true)." - ".$this->data["title"]);
$this->eventInfo("news [". $this->data["title"]."] saved");
}
public function delete() {
$this->checkWriteModulePermission();
$objectsListDeleted = $this->deleteObjects("ShortNews");
$this->userInfoMessage(__("News deleted", true) . " - " . $objectsListDeleted);
$this->eventInfo("News $objectsListDeleted deleted");
}
public function deleteSelected() {
$this->checkWriteModulePermission();
$objectsListDeleted = $this->deleteObjects("ShortNews");
$this->userInfoMessage(__("News deleted", true) . " - " . $objectsListDeleted);
$this->eventInfo("News $objectsListDeleted deleted");
}
public function categories() {
$this->showCategories($this->ShortNews);
}
}