/** * Get a form for displaying a 'start' template. A start template * is read from a file, stored in the database, and is used when creating * a new template of that type. * * @param CMSModule $module The module that this template is for * @param string $id The module instance id. * @param int $returnid The returnid (usually empty) * @param string $prefname The preference (relative to the module supplied) that will hold this start template. * @param string $action The return action (usually defaultadmin) * @param string $active_tab The name of the tab to return to. * @param string $title The title for this form. Usually indicates to the administrator what template he is editing. * @param string $filename The file name (relative to the modules templates directory) where the system default version of the 'start' template is. * @param string $info The info string for the form. * @param bool $simple A flag indicating a simple form. * @return string An HTML form. */ public static function get_start_template_form(&$module, $id, $returnid, $prefname, $action, $active_tab, $title, $filename, $info = '', $simple = false) { static $counter = 0; $cgextensions = cge_utils::get_module(MOD_CGEXTENSIONS); $the_template = $module->GetTemplate($prefname); if (!$the_template) { $the_template = $module->GetPreference($prefname); } $tpl = $cgextensions->CreateSmartyTemplate('editdefaulttemplate.tpl'); $tpl->assign('simple', $simple); $tpl->assign('defaulttemplateform_title', $title); $tpl->assign('info_title', $info); $tpl->assign('startform', $cgextensions->CreateFormStart($id, 'setdefaulttemplate', $returnid, 'post', '', false, '', array('prefname' => $prefname, 'destmodule' => $module->GetName(), 'destaction' => $action, 'cg_activetab' => $active_tab, 'filename' => $filename))); $tpl->assign('prompt_template', $cgextensions->Lang('template')); $tpl->assign('input_template', $cgextensions->CreateTextArea(false, $id, $the_template, 'input_template')); $tpl->assign('submit', $cgextensions->CreateInputSubmit($id, 'submit', $cgextensions->Lang('submit'))); $tpl->assign('reset', $cgextensions->CreateInputSubmit($id, 'resettodefault', $cgextensions->Lang('resettofactory'))); $tpl->assign('endform', $cgextensions->CreateFormEnd()); $tpl->assign('prefname', $prefname); $tpl->assign('dflt_tpl_counter', $counter++); return $tpl->fetch(); }