Jeff PHP framework  0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
menu.controller.php
Go to the documentation of this file.
00001 <?php
00023 require_once('menu.php');
00024 
00034 class menuController extends controller {
00035         
00039         private $_class_privilege;
00040 
00044         private $_admin_privilege;
00045 
00051         function __construct() {
00052 
00053                 parent::__construct();
00054 
00055                 $this->_cpath = dirname(__FILE__);
00056 
00057                 $this->_mdl_name = "menu";
00058 
00059                 // privileges
00060                 $this->_class_privilege = $this->_mdl_name;
00061                 $this->_admin_privilege = 1;
00062         }
00063 
00069         public function adminMenu() {
00070                 
00071                 access::check('admin_view');
00072 
00073                 $menu = new menu('admin');
00074                 $this->_view->setTpl('menu_admin', array('css'=>'menu_admin'));
00075                 $this->_registry->addJs(relativePath($this->_cpath).'/js/menu.js');
00076                 
00077                 $this->_view->assign('voices', $menu->voices);
00078 
00079                 return $this->_view->render();
00080 
00081         }
00082         
00088         public function mainMenu() {
00089                 
00090                 $menu = new menu('main');
00091 
00092                 $this->_view->setTpl('menu_public', array('css'=>'menu'));
00093                 $this->_registry->addJs(relativePath($this->_cpath).'/js/menu.js');
00094 
00095                 $this->_view->assign('voices', $menu->voices);
00096                 $this->_view->assign('selected_url', $_SERVER['REQUEST_URI']);
00097 
00098                 return $this->_view->render();
00099 
00100         }
00101 
00107         public function index() {
00108                 return null;
00109         }
00110 
00117         public function manage() {
00118                 
00119                 require_once('menuAdminTable.php');
00120                 
00121                 access::check($this->_class_privilege, $this->_admin_privilege, array("exitOnFailure"=>true));
00122                 
00123 
00124                 $f_keys = array(
00125                         "parent"=>array(
00126                                 "table"=>TBL_MENU,
00127                                 "field"=>"label",
00128                                 "where"=>null,
00129                                 "order"=>"label"
00130                         )
00131                 );
00132 
00133                 $target_data = array("_self"=>__("sameWindow"), "_blank"=>__("newWindow"));
00134                 $s_fields = array(
00135                         "groups"=>array(
00136                                 "type"=>"multicheck",
00137                                 "value_type"=>"int",
00138                                 "table"=>TBL_SYS_GROUPS,
00139                                 "field"=>"label",
00140                                 "where"=>"",
00141                                 "order"=>'id'
00142                         ),
00143                         "target"=>array(
00144                                 'type' => 'enum',
00145                                 'key_type' => 'string',
00146                                 'data' => $target_data
00147                                 
00148                         )
00149                 );
00150 
00151                 $at = new menuAdminTable(TBL_MENU, array("insertion"=>true));
00152                 $at->setForeignKeys($f_keys);
00153                 $at->setSpecialFields($s_fields);
00154 
00155                 $table = $at->manage();
00156 
00157                 $this->_view->setTpl('manage_table');
00158                 $this->_view->assign('title', __("ManageTable")." ".__("Menu"));
00159                 $this->_view->assign('table', $table);
00160 
00161                 return $this->_view->render();
00162 
00163         }
00164 }
00165 
00166 ?>