コード例 #1
0
ファイル: template.php プロジェクト: sgh1986915/php-crm
 private function _handle_save_template()
 {
     // handle post back for save template template.
     $template_id = (int) $_REQUEST['template_id'];
     // delete.
     if (isset($_REQUEST['butt_del']) && self::can_i('delete', 'Templates')) {
         $template_data = self::get_template($template_id);
         if (module_form::confirm_delete('template_id', _l("Really delete template: %s", $template_data['template_key']), self::link_open($template_id))) {
             $this->delete($template_id);
             // todo: delete company template as well if exists.
             set_message("Template deleted successfully");
             redirect_browser(self::link_open(false));
         }
     }
     $data = $_POST;
     $already_saved = false;
     if ((int) $template_id > 0 && class_exists('module_company', false)) {
         module_company::template_handle_save($template_id, $data);
         // we have to redirect to a company specific version of this template
         // each company template must have a matching parent template id/key. cannot change keys in company unique config.
     }
     // write header/footer html based on uploaded images.
     // pass uploaded images to the file manager plugin.
     $template_id = update_insert('template_id', $template_id, 'template', $data);
     // redirect upon save.
     set_message('Template saved successfully!');
     if (isset($_REQUEST['return']) && $_REQUEST['return']) {
         redirect_browser($_REQUEST['return']);
     }
     redirect_browser($this->link_open($template_id));
     exit;
 }