/** * Returns a form to edit a menuentry * @access private * @param integer Menu_entry_id The id of the menuentry to edit * @return string HTML code of the form */ function _EditMenuEntry($Menu_entry_id, $Menu_entry_menuid, $Menu_name) { $out = ''; $adminLang = $this->_AdminLang; $pageStructure = new Pagestructure($this->_SqlConnection, null); $pageStructure->LoadParentIDs(); $sql = "SELECT *\r\n\t \t\t\tFROM " . DB_PREFIX . "menu_entries\r\n\t \t\t\tWHERE menu_entries_id={$Menu_entry_id}"; $menuResult = $this->_SqlConnection->SqlQuery($sql); $menuEntry = mysql_fetch_object($menuResult); $out .= "\t\t\t<fieldset>\r\n\t\t\t\t<legend>" . $adminLang['edit_menu_entry'] . "</legend>\r\n\t\t\t\t<form action=\"admin.php\" method=\"post\">\r\n\t\t\t\t\t<input type=\"hidden\" name=\"menu_entry_id\" value=\"{$Menu_entry_id}\" />\r\n\t\t\t\t\t<input type=\"hidden\" name=\"page\" value=\"menueditor\" />\r\n\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"updateEntry\" />\r\n\t\t\t\t\t<input type=\"hidden\" name=\"menu_entry_menuid\" value=\"{$Menu_entry_menuid}\" />\r\n\t\t\t\t\t<input type=\"hidden\" name=\"menu_name\" value=\"{$Menu_name}\" />\r\n\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<label for=\"menu_entry_menuid\">\r\n\t\t\t\t\t\t\t<strong>{$adminLang['belongs_to_menu']}:</strong>\r\n\t\t\t\t\t\t\t<span class=\"info\">{$adminLang['this_is_the_title_of_the_menuentry_that_will_be_shown_in_the_menu']}</span>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<select id=\"menu_entry_menuid\" name=\"menu_entry_menuid\">"; $sql = "SELECT *\r\n\t\t\t\tFROM " . DB_PREFIX . "menu"; $menuResult = $this->_SqlConnection->SqlQuery($sql); while ($menu = mysql_fetch_object($menuResult)) { $out .= "\r\n\t\t\t\t\t\t\t<option value=\"" . $menu->menu_id . "\"" . ($menu->menu_id == $Menu_entry_menuid ? ' selected="selected"' : '') . ">" . $menu->menu_id . ". " . $menu->menu_name . "</option>"; } $out .= "\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<label for=\"menu_entry_title\">\r\n\t\t\t\t\t\t\t<strong>{$adminLang['menu_entry_title']}:</strong>\r\n\t\t\t\t\t\t\t<span class=\"info\">{$adminLang['this_is_the_title_of_the_menuentry_that_will_be_shown_in_the_menu']}</span>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"text\" id=\"menu_entry_title\" name=\"menu_entry_title\" value=\"" . $menuEntry->menu_entries_title . "\" />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<label for=\"menu_entry_link\">\r\n\t\t\t\t\t\t\t<strong>{$adminLang['menu_entry_link']}:</strong>\r\n\t\t\t\t\t\t\t<span class=\"info\">{$adminLang['choose_here_the_page_to_which_the_link_should_refer']}</span>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<select id=\"menu_entry_link\" name=\"menu_entry_link\">\r\n\t\t\t\t\t\t\t" . $pageStructure->PageStructurePulldown(0, 0, '', -1, $menuEntry->menu_entries_page_id) . "\r\n\t\t\t\t\t\t</select>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<label for=\"menu_entry_css_id\">\r\n\t\t\t\t\t\t\t<strong>{$adminLang['menu_entry_css']}:</strong>\r\n\t\t\t\t\t\t\t<span class=\"info\">{$adminLang['type_in_here_the_css_id_for_the_menuentry_if_you_need_one_for_it']}</span>\r\n\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t<input type=\"text\" id=\"menu_entry_css_id\" name=\"menu_entry_css_id\" value=\"" . $menuEntry->menu_entries_css_id . "\" />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"row\">\r\n\t\t\t\t\t\t<input type=\"reset\" class=\"button\" value=\"" . $adminLang['reset'] . "\" /> \r\n\t\t\t\t\t\t<input type=\"submit\" class=\"button\" value=\"" . $adminLang['save'] . "\" />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</form>\r\n\t\t\t</fieldset>"; return $out; }
/** * @return string * @access private */ function _ShowPreferences() { // If there are no settings load return if (count($this->_Preferences->Settings) <= 0) { return ''; } // Initialize the formMaker class $formMaker = new FormMaker($this->_Translation->GetTranslation('todo'), $this->_SqlConnection); // Add necessary inputs $formMaker->AddForm('settings'); $formMaker->AddHiddenInput('settings', 'page', 'preferences'); $formMaker->AddHiddenInput('settings', 'action', 'save'); // Go through each preferences group foreach ($this->_Preferences->Settings as $settingsGroup => $settings) { // Add a new form to the formmaker $formMaker->AddForm("settings_group_{$settingsGroup}", '', $this->_Translation->GetTranslation('save'), $settingsGroup); // Display all pereferences of the actual group foreach ($settings as $setting) { // Load the current config and if it isn't available use the default $setting['value'] = $this->_Config->Get($setting['name'], $setting['default']); // Make it possible to define simple options lists if (substr($setting['datatype'], 0, 6) == 'array(') { $setting['data'] = explode(',', substr($setting['datatype'], 6, -1)); $setting['datatype'] = 'array'; } switch ($setting['datatype']) { // 'simple options list' case 'array': $formMaker->AddInput("settings_group_{$settingsGroup}", "setting_{$setting['name']}", 'select', $setting['display'], $setting['description']); // Add the possible values foreach ($setting['data'] as $option) { $formMaker->AddSelectEntry("settings_group_{$settingsGroup}", "setting_{$setting['name']}", $option == $setting['value'] ? true : false, $option, $option); } break; // The pages-tree // The pages-tree case 'page_select': $pageStructure = new Pagestructure($this->_SqlConnection, $this->_User, $this->_ComaLib); $pageStructure->LoadParentIDs(); $formMaker->AddInput("settings_group_{$settingsGroup}", "setting_{$setting['name']}", 'select', $setting['display'], $setting['description']); $formMaker->AddSelectEntrysCode("settings_group_{$settingsGroup}", "setting_{$setting['name']}", $pageStructure->PageStructurePulldown(0, 0, '', -1, $setting['default'])); break; // 'bool'-options-list // 'bool'-options-list case 'bool': $formMaker->AddInput("settings_group_{$settingsGroup}", "setting_{$setting['name']}", 'select', $setting['display'], $setting['description']); $formMaker->AddSelectEntry("settings_group_{$settingsGroup}", "setting_{$setting['name']}", $setting['value'] == 1 ? true : false, '1', $this->_Translation->GetTranslation('yes')); $formMaker->AddSelectEntry("settings_group_{$settingsGroup}", "setting_{$setting['name']}", $setting['value'] == 0 ? true : false, '0', $this->_Translation->GetTranslation('no')); break; // Every thing else // Every thing else default: $formMaker->AddInput("settings_group_{$settingsGroup}", "setting_{$setting['name']}", 'text', $setting['display'], $setting['description'], $setting['value']); break; } } } $formMaker->SetComaLateReplacement(&$this->_ComaLate, false); // Generate the template $template = "\r\n\t\t\t\t<form action=\"admin.php\" method=\"post\"><FORM_MAKER:loop>\n\t\t\t\t\t{fieldset_start}\n\t\t\t\t\t\t<hidden_inputs:loop><input type=\"hidden\" name=\"{name}\" value=\"{value}\" />\r\n\t\t\t\t\t\t</hidden_inputs>\n\t\t\t\t\t\t{fieldset_legend}\n\t\t\t\t\t\t<inputs:loop>\n\t\t\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t\t\t<label for=\"{name}\">\n\t\t\t\t\t\t\t\t\t<strong>{translation}:</strong>\n\t\t\t\t\t\t\t\t\t<errorinformation:loop><span class=\"error\">{errortext}</span>\n\t\t\t\t\t\t\t\t\t</errorinformation>\n\t\t\t\t\t\t\t\t\t<span class=\"info\">{information}</span>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t{start_input} name=\"{name}\" id=\"{name}\" {end_input}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</inputs>\n\t\t\t\t\t\t{submit_button}\n\t\t\t\t\t{fieldset_end}\n\t\t\t\t</FORM_MAKER>\n\t\t\t\t</form>"; return $template; }
/** * Returns a formular to edit any errors if there are any or set the user back to showmenu page * @access private * @return string A template for a formular to edit the errors */ function _CheckMenuEntry() { // Get external parameters $MenuID = GetPostOrGet('menu_id'); $MenuEntryID = GetPostOrGet('menu_entry_id'); $MenuEntryType = GetPostOrGet('menu_entry_type'); $MenuEntryTitle = GetPostOrGet('menu_entry_title'); $MenuEntryLink = GetPostOrGet('menu_entry_link'); $MenuEntryCssID = GetPostOrGet('menu_entry_css_id'); // Initialize the formmaker class $formMaker = new FormMaker($this->_Translation->GetTranslation('todo'), &$this->_SqlConnection); $formMaker->AddForm('check_menu_entry', 'admin.php', $this->_Translation->GetTranslation('save'), $this->_Translation->GetTranslation('add_menu_entry'), 'post'); // Add hidden inputs to give some variables to next page $formMaker->AddHiddenInput('check_menu_entry', 'page', 'menueditor'); $formMaker->AddHiddenInput('check_menu_entry', 'action', 'add_menu_entry'); $formMaker->AddHiddenInput('check_menu_entry', 'menu_entry_type', $MenuEntryType); // Add the inputs to the formmakerclass $formMaker->AddInput('check_menu_entry', 'menu_id', 'select', $this->_Translation->GetTranslation('belongs_to_menu'), $this->_Translation->GetTranslation('this_is_the_menu_the_new_entry_should_be_added_to')); // Get the existing menus from the database $sql = "SELECT *\n\t\t\t\t\tFROM " . DB_PREFIX . "menu"; $menuResult = $this->_SqlConnection->SqlQuery($sql); while ($menu = mysql_fetch_object($menuResult)) { // Add an entry for each existing menu $formMaker->AddSelectEntry('check_menu_entry', 'menu_id', $menu->menu_id == $MenuID ? true : false, $menu->menu_id, $menu->menu_id . ". " . $menu->menu_name); } $formMaker->AddInput('check_menu_entry', 'menu_entry_title', 'text', $this->_Translation->GetTranslation('menu_entry_title'), $this->_Translation->GetTranslation('this_is_the_title_of_the_menuentry_that_will_be_shown_in_the_menu'), $MenuEntryTitle); $formMaker->AddCheck('check_menu_entry', 'menu_entry_title', 'empty', $this->_Translation->GetTranslation('you_have_to_define_a_title_for_the_menu_entry')); if ($MenuEntryType == 'intern_link') { // Add select input for all pages in the system $formMaker->AddInput('check_menu_entry', 'menu_entry_link', 'select', $this->_Translation->GetTranslation('menu_entry_link'), $this->_Translation->GetTranslation('choose_here_the_page_to_which_the_link_should_refer')); // Add all existing pages to the select $pageStructure = new Pagestructure(&$this->_SqlConnection, &$this->_User, &$this->_ComaLib); $pageStructure->LoadParentIDs(); $formMaker->AddSelectEntrysCode('check_menu_entry', 'menu_entry_link', $pageStructure->PageStructurePulldown(0, 0, '', -1, $MenuEntryLink)); } elseif ($MenuEntryType == 'extern_link') { // Add input for the extern url $formMaker->AddInput('check_menu_entry', 'menu_entry_link', 'text', $this->_Translation->GetTranslation('menu_entry_link'), $this->_Translation->GetTranslation('type_here_the_url_of_the_page_to_link_to'), $MenuEntryLink); $formMaker->AddCheck('check_menu_entry', 'menu_entry_link', 'empty', $this->_Translation->GetTranslation('you_have_to_define_an_extern_url_for_this_link')); } elseif ($MenuEntryType == 'download') { // Add select input for the downloads $formMaker->AddInput('check_menu_entry', 'menu_entry_link', 'select', $this->_Translation->GetTranslation('download'), $this->_Translation->GetTranslation('choose_here_the_download_you_want_to_link_to')); // Add all existing files to the select input $sql = "SELECT *\n\t\t\t\t\t\tFROM " . DB_PREFIX . "files\n\t\t\t\t\t\tORDER BY file_name"; $files_result = $this->_SqlConnection->SqlQuery($sql); while ($file = mysql_fetch_object($files_result)) { if (file_exists($file->file_path)) { $formMaker->AddSelectEntry('check_menu_entry', 'menu_entry_link', $MenuEntryLink == $file->file_id ? true : false, $file->file_id, utf8_encode($file->file_name) . " (" . kbormb($file->file_size) . ")"); } } } $formMaker->AddInput('check_menu_entry', 'menu_entry_css_id', 'text', $this->_Translation->GetTranslation('menu_entry_css'), $this->_Translation->GetTranslation('type_in_here_the_css_id_for_the_menuentry_if_you_need_one_for_it')); if ($formMaker->CheckInputs('check_menu_entry', true)) { if ($MenuEntryType == 'intern_link') { // Get the name of the page $sql = "SELECT *\n\t\t \t\t\t\tFROM " . DB_PREFIX . "pages\n\t \t\t\t\t\tWHERE page_id='{$MenuEntryLink}'"; $pageResult = $this->_SqlConnection->SqlQuery($sql); if ($page = mysql_fetch_object($pageResult)) { $PageID = $MenuEntryLink; $MenuEntryLink = $page->page_name; } } else { $PageID = ''; } // Add new user to the database $sql = "UPDATE " . DB_PREFIX . "menu_entries\n\t\t\t\t\t\tSET menu_entries_link='" . ($MenuEntryType == 'intern_link' ? 'l:' : ($MenuEntryType == 'download' ? 'd:' : ($MenuEntryType == 'extern_link' ? 'e:' : ''))) . "{$MenuEntryLink}', \n\t\t\t\t\t\t\tmenu_entries_title='{$MenuEntryTitle}', \n\t\t\t\t\t\t\tmenu_entries_type='{$MenuEntryType}', \n\t\t\t\t\t\t\tmenu_entries_css_id='{$MenuEntryCssID}', \n\t\t\t\t\t\t\tmenu_entries_menuid='{$MenuID}', \n\t\t\t\t\t\t\tmenu_entries_page_id='{$PageID}'\n\t\t\t\t\t\tWHERE menu_entries_id='{$MenuEntryID}'"; $this->_SqlConnection->SqlQuery($sql); // Set user to the HomePage of the usermanager $template = "\r\n\t\t\t\t" . $this->_ShowMenu($MenuID); return $template; } else { // Generate to edit the errors $template = "\r\n\t\t\t\t" . $formMaker->GenerateMultiFormTemplate(&$this->_ComaLate, true); return $template; } }
/** * @return string * @access private */ function _ShowPreferences() { $adminLang = $this->_AdminLang; if (count($this->_Preferences->Settings) <= 0) { return ''; } $out = "<form action=\"admin.php\" method=\"post\">\r\n \t\t\t\t<input type=\"hidden\" name=\"page\" value=\"preferences\" />\r\n\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"save\" />"; // Go through each preferences group foreach ($this->_Preferences->Settings as $settingsGroup => $settings) { $out .= "<fieldset>\r\n \t\t\t\t\t<legend>{$settingsGroup}</legend>"; // Display all pereferneces of the actual group foreach ($settings as $setting) { // Load the current config and if it isn't available use the default $setting['default'] = $this->_Config->Get($setting['name'], $setting['default']); $out .= "<div class=\"row\">\r\n \t\t\t\t\t\t\t<label class=\"row\" for=\"setting_{$setting['name']}\"><strong>{$setting['display']}:</strong>\r\n \t\t\t\t\t\t\t\t<span class=\"info\">" . $setting['description'] . "</span></label>"; // Make it possible to define simpla options lists if (substr($setting['datatype'], 0, 6) == 'array(') { $setting['data'] = explode(',', substr($setting['datatype'], 6, -1)); $setting['datatype'] = 'array'; } switch ($setting['datatype']) { // 'simple options list' case 'array': $out .= "<select id=\"setting_" . $setting['name'] . "\" name=\"setting_" . $setting['name'] . "\">"; foreach ($setting['data'] as $option) { $out .= "<option value=\"{$option}\"" . ($option == $setting['default'] ? ' selected="selected"' : '') . ">{$option}</option>"; } $out .= '</select>'; break; // The pages-tree // The pages-tree case 'page_select': $pageStructure = new Pagestructure($this->_SqlConnection, null); $pageStructure->LoadParentIDs(); $out .= "<select id=\"setting_" . $setting['name'] . "\" name=\"setting_" . $setting['name'] . "\">" . $pageStructure->PageStructurePulldown(0, 0, '', -1, $setting['default']) . '</select>'; break; // 'bool'-options-list // 'bool'-options-list case 'bool': $out .= "<select id=\"setting_" . $setting['name'] . "\" name=\"setting_" . $setting['name'] . "\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"1\"" . ($setting['default'] == 1 ? ' selected="selected"' : '') . ">" . $adminLang['yes'] . "</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value=\"0\"" . ($setting['default'] == 0 ? ' selected="selected"' : '') . ">" . $adminLang['no'] . "</option>\r\n\t\t\t\t\t\t\t\t\t\t\t</select>"; break; // Every thing else // Every thing else default: $out .= "<input id=\"setting_" . $setting['name'] . "\" name=\"setting_" . $setting['name'] . "\" type=\"text\" value=\"" . $setting['default'] . "\"/>"; break; } $out .= "</div>"; } $out .= "<div class=\"row\"><input type=\"submit\" class=\"button\" value=\"" . $adminLang['save'] . "\"/>\r\n \t\t\t\t</div>"; $out .= "</fieldset>"; } $out .= "</form>"; return $out; }