public function edit()
 {
     $this->view->set('field_name', $this->_data['field_name']);
     $modulecomponent = new ModuleComponent();
     $modulecomponent->load($this->_data['module_components_id']);
     $model = new $modulecomponent->name();
     $field = $model->getField($this->_data['field_name']);
     $this->view->set('field', $field);
     if (isset($model->belongsToField[$field->name])) {
         $x = $model->belongsTo[$model->belongsToField[$field->name]]["model"];
         $cc = new ConstraintChain();
         if ($model->belongsTo[$model->belongsToField[$field->name]]["cc"] instanceof ConstraintChain) {
             $cc->add($model->belongsTo[$model->belongsToField[$field->name]]["cc"]);
         }
         $x = new $x();
         $this->view->set('options', $x->getAll($cc));
         $field->type = 'select';
     }
     if ($model->isEnum($field->name)) {
         $this->view->set('options', $model->getEnumOptions($field->name));
         $field->type = 'select';
     }
     if (empty($this->_data['id'])) {
         //			sendTo($this->name,'new',$this->_modules);
         unset($this->_data['id']);
         $this->view->set('module_components_id', $this->_data['module_components_id']);
         parent::_new();
         $this->_templateName = $this->getTemplateName('new');
     } else {
         parent::edit();
     }
 }
Esempio n. 2
0
 public function get_action_list($controller_id = '')
 {
     if (is_ajax() && is_direct_request()) {
         $controller_id = $this->_data['controller_id'];
     }
     $html = '';
     // attempt to load the controller based on the controller id
     $module_components = new ModuleComponent();
     $module_components->load($controller_id);
     // if the component hs loaded it must mean we were dealing with an id
     // set the controller_id to the controller name
     if ($module_components->loaded) {
         $controller_id = $module_components->name;
     }
     // set actions as an array with a null first value
     $actions = array('' => '');
     // fetch the methods for the controller
     $actions['Local Methods'] = get_final_class_methods($controller_id);
     // fetch the inherited methods
     $inherited_methods = get_class_methods($controller_id);
     $inherited_methods = array_combine($inherited_methods, $inherited_methods);
     $actions['Inherited Methods'] = array_diff($inherited_methods, $actions['Local Methods']);
     if (is_ajax() && is_direct_request()) {
         $output['action'] = array('data' => $actions, 'is_array' => is_array($actions));
         $this->view->set('data', $output);
         $this->setTemplateName('ajax_multiple');
     } else {
         return $actions;
     }
 }