Esempio n. 1
0
 /** Construct */
 public function __construct($module)
 {
     $this->response = new aregistry();
     $this->_in_ajax = loader::in_ajax();
     $this->context = $module;
     $this->request = core::lib('request');
     $this->renderer = core::lib('renderer');
     $this->params = $this->request->get_ident();
     $this->postdata = $this->request->filespost();
     $this->base_url = $this->context->get_editor_base_url();
     // action, colection_model (%module%_%action%_controller)
     // pre-init
     $this->construct_before();
     $this->init_mode();
     if ($this->with_model()) {
         /**
          * Force load deps when edit item
          */
         if ($this->mode == 'form') {
             $this->model_deps = true;
         }
         $this->collection_model = empty($this->collection_model) ? substr(substr(get_class($this), strlen($this->context->get_name()) + 1), 0, -11) : $this->collection_model;
         if (!isset($this->grid_name)) {
             $this->grid_name = 'grid-' . $this->params->m . '-' . $this->params->c;
             /*
             // @todo make grids unique ids
             if ($this->request->postget('grid')) {
              . '-' . functions::url_hash(microtime(1)); //str_replace('_', '-', $this->collection_model);
             }
             */
         }
         if ($this->collection !== false) {
             $this->collection = $this->create_collection();
         } else {
             $this->collection = abs_collection::get_null_collection();
         }
         if ($this->model_deps) {
             $this->collection->with_deps($this->model_deps);
         }
         // apply editor model style
         $this->set_collection_format($this->get_mode());
         $this->get_grid_filters();
         $this->prepare_grid_filters();
     }
     // is item submitted?
     $this->is_submited = (bool) $this->request->post(self::SUBMIT_CONTROL);
     // op=modify old compat
     if ($this->is_submited) {
         $this->params->op = 'modify';
         $this->submit_type = $this->request->post(self::SUBMIT_CONTROL);
     }
     // post-init
     $this->construct_after();
 }