Ejemplo n.º 1
0
 /**
  * 
  * @return App_Config_Controller
  */
 public static function getInstance()
 {
     if (null == self::$_instance) {
         self::$_instance = new App_Config_Controller();
     }
     return self::$_instance;
 }
 function saveConfigAction()
 {
     $con = $this->_request->getParam("con");
     $mdl = $this->_request->getParam("mdl");
     $act = $this->_request->getParam("act");
     $params = $this->_request->getParams();
     $options = array();
     foreach ($params as $key => $value) {
         list($prefix, $configKey) = explode("-", $key);
         if ($prefix == "opt") {
             $key = str_replace("opt-", "", $key);
             $keys = explode("-", $key);
             $tmp = array();
             foreach ($keys as $k) {
                 $tmp[] = "['{$k}']";
             }
             $tmp = join("", $tmp);
             $code = "\$options{$tmp} = '{$value}' ;";
             eval($code);
             //$options[] = $x;
         }
         //echo "$configKey => $value <br/>";
     }
     //die();
     App_Config_Controller::getInstance()->save($mdl, $con, $act, $options);
     $this->_helper->redirector("index", null, null, array("con" => $con, "mdl" => $mdl, "act" => $act));
 }
Ejemplo n.º 3
0
 function preDispatch()
 {
     ob_start();
     //		and $this->getInnerLayout() ==self::LAYOUT_DEFAULT  /
     if ($this->_helper->layout()->isEnabled()) {
         $layout = $this->_request->getParam('layout', '');
         if ('fullsize-nonavi' == $layout) {
             $this->setLayout('fullsize-nonavi');
             App_Env::setSession("sys_layout_detach", 'no-detach');
         } elseif ('nodetach' == $layout) {
             App_Env::setSession("sys_layout_detach", 'no-detach');
         } elseif ('detach' == $layout) {
             App_Env::setSession("sys_layout_detach", 'detach');
             $this->setLayout('detach');
         } elseif ('popup' == $layout) {
             $this->setLayout('popup');
         } elseif ('detach' == App_Env::getSession("sys_layout_detach", '')) {
             $this->setLayout('detach');
         } else {
             App_Env::setSession("sys_layout_detach", 'no-detach');
         }
         $this->view->headTitle($this->view->printPageName());
         // echo $this->_request->getParam('id');
         if (method_exists($this, "getDefaultModel")) {
             if (App_Config_Controller::getInstance()->getConfig()->isListMenuEnabled() and $this->_disableListMenu == false) {
                 if (!in_array($this->_request->getActionName(), array('index', 'new')) and $this->_request->getParam('id') != '') {
                     $id = $this->getRequestId();
                     $model = $this->getDefaultModel($id);
                     if (is_object($model)) {
                         //echo die(  "ss". get_class($model)  );
                         $this->view->hideLeftMenu = $isLeftMenuHide = !$this->_isMenuLeftPaneStateShow();
                         $this->view->content()->captureStart('navPane');
                         $filter = new App_Grid_Filter($model);
                         if ($filter instanceof App_Grid_Filter) {
                             $filter->setRecordsPerPage($this->_recordsPerPage);
                             if ($this->_request->getParam('filter', '') != 'reset') {
                                 if (count($this->_conditions) > 0) {
                                     foreach ($this->_conditions as $condition) {
                                         $field = trim($condition[0]);
                                         $field = $this->_modelProperties[$field];
                                         $filter->addCondition($field, trim($condition[1]), trim($condition[2]));
                                     }
                                 }
                             }
                             $filter->setRequest($this->_request);
                             $filter->setup('default');
                         }
                         echo $this->view->listMenu($model, $id, $filter, $isLeftMenuHide);
                         $this->view->content()->captureEnd();
                         $this->view->enabledListMenu = true;
                     }
                 }
             }
         }
         $moduleName = $this->_request->getModuleName();
         $controllerName = $this->_request->getControllerName();
         $actionName = $this->_request->getActionName();
         $config = App_Config_Controller::getInstance()->getConfig($moduleName, $controllerName, $actionName);
         if (true != $config->isEmpty) {
             //$this->view->buttons = array();
             $winlayout = $this->_request->getParam('layout', '');
             foreach ($config->actionbuttons as $button) {
                 switch ($button) {
                     case 'print':
                         $this->addPrintButton();
                         break;
                         //case 'export' : $this->addExportButton();
                         //	break;
                     //case 'export' : $this->addExportButton();
                     //	break;
                     case 'new':
                         $this->addNewButton();
                         break;
                     case 'edit':
                         $this->addEditButton();
                         break;
                     case 'reset':
                         $this->addResteFormButton();
                         break;
                     case 'save':
                         $this->addSaveButton();
                         break;
                     case 'Back':
                         if ($winlayout != 'popup') {
                             $this->addCloseToIndexButton();
                         }
                         break;
                     case 'close':
                         $this->addCloseButton();
                         break;
                     case 'delete':
                         $this->addDeleteButton();
                         break;
                 }
             }
         }
     }
     $this->MyPostDispatch();
     ob_end_clean();
 }