Ejemplo n.º 1
0
 public function get_actions_tree_links()
 {
     $tree = new ModuleTreeLinks();
     $manage_fields_link = new AdminModuleLink(LangLoader::get_message('admin.fields.manage', 'common', 'contact'), ContactUrlBuilder::manage_fields());
     $manage_fields_link->add_sub_link(new AdminModuleLink(LangLoader::get_message('admin.fields.manage', 'common', 'contact'), ContactUrlBuilder::manage_fields()));
     $manage_fields_link->add_sub_link(new AdminModuleLink(LangLoader::get_message('fields.action.add_field', 'admin-user-common'), ContactUrlBuilder::add_field()));
     $tree->add_link($manage_fields_link);
     $tree->add_link(new AdminModuleLink(LangLoader::get_message('configuration', 'admin-common'), ContactUrlBuilder::configuration()));
     return $tree;
 }
 public function __construct($view, $title_page)
 {
     parent::__construct($view);
     $lang = LangLoader::get('common', 'contact');
     $this->set_title($lang['module_title']);
     $this->add_link($lang['admin.fields.manage'], ContactUrlBuilder::manage_fields());
     $this->add_link(LangLoader::get_message('fields.action.add_field', 'admin-user-common'), ContactUrlBuilder::add_field());
     $this->add_link(LangLoader::get_message('configuration', 'admin-common'), ContactUrlBuilder::configuration());
     $env = $this->get_graphical_environment();
     $env->set_page_title($title_page, $lang['module_title']);
 }
 public function execute(HTTPRequestCustom $request)
 {
     $this->init($request);
     $this->build_form($request);
     $this->tpl = new FileTemplate('contact/AdminContactFieldFormController.tpl');
     $this->tpl->add_lang($this->lang);
     if ($this->submit_button->has_been_submited() && $this->form->validate()) {
         $this->save();
         if ($this->is_new_field) {
             AppContext::get_response()->redirect(ContactUrlBuilder::manage_fields(), StringVars::replace_vars($this->lang['message.success.add'], array('name' => $this->get_field()->get_name())));
         } else {
             AppContext::get_response()->redirect($this->form->get_value('referrer') ? $this->form->get_value('referrer') : ContactUrlBuilder::manage_fields(), StringVars::replace_vars($this->lang['message.success.edit'], array('name' => $this->get_field()->get_name())));
         }
     }
     $this->tpl->put('FORM', $this->form->display());
     if (!$this->get_field()->is_readonly()) {
         $this->tpl->put('JS_EVENT_SELECT_TYPE', $this->get_events_select_type());
     }
     return new AdminContactDisplayResponse($this->tpl, !empty($this->id) ? $this->lang['admin.fields.title.edit_field.page_title'] : $this->lang['admin.fields.title.add_field.page_title']);
 }