private function get_static_prefix() { $static_prefix = self::$static_prefix; self::$static_prefix = ''; return $static_prefix; }
function CatalogueForm($CatalogueID, $phase, $action, $type, $bar_action = null) { # type = 1 - это insert # type = 2 - это update global $ROOT_FOLDER, $HTTP_FILES_PATH, $DOMAIN_NAME; global $SUB_FOLDER, $HTTP_ROOT_PATH, $ADMIN_PATH; global $systemTableID, $systemTableName, $admin_mode; global $FILES_FOLDER, $INCLUDE_FOLDER, $MODULE_FOLDER, $ADMIN_FOLDER; global $UI_CONFIG; if (!$bar_action) { $bar_action = 'edit'; } $nc_core = nc_Core::get_object(); $db = $nc_core->db; $lm_type = $nc_core->page->get_field_name('last_modified_type'); $sm_field = $nc_core->page->get_field_name('sitemap_include'); $sm_change_field = $nc_core->page->get_field_name('sitemap_changefreq'); $sm_priority_field = $nc_core->page->get_field_name('sitemap_priority'); $lang_field = $nc_core->page->get_field_name('language'); $CatalogueID = intval($CatalogueID); $params = array('Catalogue_Name', 'Domain', 'Template_ID', 'Read_Access_ID', 'Write_Access_ID', 'Edit_Access_ID', 'Subscribe_Access_ID', 'Checked_Access_ID', 'Delete_Access_ID', 'Moderation_ID', 'Checked', 'Priority', 'Mirrors', 'Robots', 'Cache_Access_ID', 'Cache_Lifetime', 'TitleSubIDName', 'TitleSubIDKeyword', 'TitleTemplateID', 'E404SubIDName', 'E404SubIDKeyword', 'E404TemplateID', 'CommentsEditRules', 'CommentAccessID', 'CommentsDeleteRules', 'DisplayType', 'last_modified_type', 'AllowIndexing', $sm_field, $sm_change_field, $sm_priority_field, 'ncOfflineText'); foreach ($params as $v) { ${$v} = $nc_core->input->fetch_get_post($v); } $st = new nc_Component(0, 1); foreach ($st->get_fields(0, 0) as $v) { $v = 'f_' . $v; ${$v} = $nc_core->input->fetch_get_post($v); } $showFields = false; if ($type == 1) { $mandatoryFields = array(); foreach ($st->get_fields() as $f) { if ($f['not_null']) { $mandatoryFields[] = $f['name']; } } $showFields = count($mandatoryFields) > 0; } if ($nc_core->modules->get_by_keyword('calendar', 0)) { echo nc_set_calendar(0); } echo "<form id='adminForm' class='nc-form' enctype='multipart/form-data' method='post' name='adminForm' action='" . $action . "'>"; if ($type == 1) { if ($Priority == "" && $Checked == "") { $Checked = 1; } if ($Priority == "") { $Priority = $db->get_var("SELECT MAX(`Priority`)+1 FROM `Catalogue`"); } foreach ($params as $v) { $Array[$v] = ${$v}; } $Array['Read_Access_ID'] = 1; $Array['Write_Access_ID'] = 3; $Array['Edit_Access_ID'] = 3; $Array['Checked_Access_ID'] = 3; $Array['Delete_Access_ID'] = 3; } else { if ($type == 2) { try { $Array = $nc_core->catalogue->get_by_id($CatalogueID); } catch (Exception $e) { nc_print_status(CONTROL_CONTENT_CATALOUGE_FUNCS_ERROR_NOCATALOGUE, 'info'); EndHtml(); exit; } } } //по умолчанию: публикация объекта сразу после добавления if (!$Array["Moderation_ID"]) { $Array["Moderation_ID"] = 1; } if (!$Array[$lm_type]) { $Array[$lm_type] = 1; } if (!$Array[$sm_change_field]) { $Array[$sm_change_field] = 'daily'; } if (!$Array[$sm_priority_field]) { $Array[$sm_priority_field] = 0.5; } $fieldsets = new nc_admin_fieldset_collection(); $access_actions = array('Read', 'Write', 'Edit', 'Checked', 'Delete'); foreach ($access_actions as $access_action) { $Array["_db_{$access_action}_Access_ID"] = $Array[$access_action . "_Access_ID"]; } $fields_hack = array($nc_core->page->get_field_name('last_modified'), $nc_core->page->get_field_name('last_modified_type'), 'Moderation_ID', 'Cache_Access_ID', 'Cache_Lifetime', 'DisallowIndexing', 'Template_ID'); if ($nc_core->modules->get_by_keyword('search')) { $fields_hack[] = $nc_core->page->get_field_name('sitemap_include'); $fields_hack[] = $nc_core->page->get_field_name('sitemap_changefreq'); $fields_hack[] = $nc_core->page->get_field_name('sitemap_priority'); } foreach ($fields_hack as $field_name) { $Array['_db_' . $field_name] = $Array[$field_name]; } $Array['_db_inherit_' . $sm_change_field] = $Array['_db_' . $sm_change_field]; $Array['_db_inherit_Template_ID'] = $Array['Template_ID']; $bar_all = $bar_action == 'all'; $display = array('edit' => $bar_all || $bar_action == 'edit' || $bar_action == 'wizard', 'design' => $bar_action == 'design' || $bar_action == 'wizard', 'seo' => $bar_action == 'seo' || $bar_action == 'wizard', 'system' => $bar_action == 'system' || $bar_action == 'wizard', 'fields' => $bar_action == 'fields' || $bar_action == 'wizard' || $showFields); $p_div_bar_action = ''; $s_div_bar_action = ''; if ($bar_action == 'all') { $p_div_bar_action = "<div style='display: none;'>"; $s_div_bar_action = '</div>'; } $fieldsets->set_prefix("\n {$p_div_bar_action}\n <div id='nc_seo_edit_info'" . ($bar_action != 'edit' ? " style='display:none;'" : "") . " class='nc_admin_settings_info'>\n <div class='nc_admin_settings_info_actions'>\n <div>\n <span>" . CLASS_TAB_CUSTOM_ADD . ":</span> {$Array['Created']}\n </div>\n " . ($Array['LastUpdated'] ? "<div>\n <span>" . CLASS_TAB_CUSTOM_EDIT . ":</span> {$Array['LastUpdated']}\n </div>" : "") . "\n </div>\n\n <div class='nc_admin_settings_info_priority'>\n <div>\n " . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_PRIORITY . ":\n </div>\n\n <div>\n " . nc_admin_input_simple('Priority', intval($Array["Priority"]), 3, '', "maxlength='5'") . "\n </div>\n </div>\n\n <div class='nc_admin_settings_info_checked'>\n <div>\n " . nc_admin_checkbox_simple('Checked', 1, CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_ON, $Array["Checked"] == 1 || !$CatalogueID, 'turnon') . "\n </div>\n </div>\n </div>{$s_div_bar_action}"); $fieldsets->set_suffix($nc_core->token->get_input() . "\n <input type='hidden' name='CatalogueID' value='{$CatalogueID}' />\n <input type='hidden' name='phase' value='{$phase}' />\n <input type='hidden' name='type' value='{$type}' />\n <input type='hidden' name='posting' value='1' />\n <input type='hidden' name='action' value='{$bar_action}' />\n <input type='submit' class='hidden' />\n </form><br />" . nc_admin_js_resize()); $fieldsets->new_fieldset('main_info', CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MAININFO)->show($display['edit']); $fieldsets->new_fieldset('template', CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_TEMPLATE)->add(nc_subdivision_form_design($Array, $CatalogueID, false))->show($display['design']); //$fieldsets->new_fieldset('mobile', CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_SETTINGS)->show($display['edit'] && $bar_action != 'all'); $fieldsets->new_fieldset('seo', '')->add(nc_subdivision_form_seo($Array, false))->show($display['seo']); $fieldsets->new_fieldset('access', CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_ACCESS)->add(nc_subdivision_show_access($Array, false))->show($display['system']); if ($nc_core->modules->get_by_keyword('minishop')) { $fieldsets->new_fieldset('shop_mode', $p_div_bar_action ? null : NETCAT_MODULE_MINISHOP_INFOBLOCK_MODE)->add("{$p_div_bar_action}<div>" . NETCAT_MODULE_MINISHOP_INFOBLOCK_GOOD_MODE . ":</div>" . nc_catalogue_form_shop_mode($CatalogueID))->show($display['edit'] . $s_div_bar_action); } if (nc_module_check_by_keyword("cache")) { $fieldsets->new_fieldset('cache', CONTROL_CONTENT_CATALOGUE_FUNCS_CACHE)->add(nc_subdivision_show_cache($Array, false))->show($display['system']); } if (nc_module_check_by_keyword("comments")) { $fieldsets->new_fieldset('comments', CONTROL_CONTENT_CATALOGUE_FUNCS_COMMENTS)->add(nc_subdivision_show_comments($Array, false))->show($display['system']); } ob_start(); echo nc_admin_input(CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_NAME, 'Catalogue_Name', $Array["Catalogue_Name"], 32) . "\n " . nc_admin_input(CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_DOMAIN, 'Domain', $Array["Domain"], 32) . "\n {$p_div_bar_action}\n <br />" . nc_admin_textarea_simple('Mirrors', $Array["Mirrors"], CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MIRRORS, 4, 10, '', '', 'no_cm') . "<br /><br />\n " . nc_admin_textarea_simple('Robots', $Array["Robots"] ? $Array["Robots"] : "# NetCat Robots file\nUser-agent: *\nDisallow: /install/", CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_ROBOTS, 4, 10) . "<br /><br />\n " . nc_admin_textarea_simple('ncOfflineText', $Array["ncOfflineText"], CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_OFFLINE, 4, 10) . "<br /><br />\n\n <table border='0' cellpadding=0 cellspacing=0 width=100%>\n <tr>\n <td>\n " . CONTROL_CONTENT_SUBDIVISION_FUNCS_CATALOGUEFORM_LANG . ":</br>\n " . nc_admin_input_simple('language', $Array[$lang_field], 50) . "<br/>\n </td>\n </tr>"; if ($type == 2) { $subdivisions = $db->get_results("SELECT Subdivision_ID as value,\n CONCAT(Subdivision_ID, '. ', Subdivision_Name) as description,\n Parent_Sub_ID as parent\n FROM Subdivision\n WHERE Catalogue_ID='" . $CatalogueID . "'\n ORDER BY Subdivision_ID", ARRAY_A); echo "\n <tr>\n <td>\n <br />\n <table border='0' cellspacing='0' width='100%' class='border-bottom'>\n <col width='40%'/><col/>\n <tr>\n <td>\n " . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_TITLEPAGE . "\n </td>\n <td>"; if (!empty($subdivisions)) { echo "<select name='TitleSubID'>"; echo nc_select_options($subdivisions, $Array["Title_Sub_ID"]); echo "</select>"; } else { echo CONTROL_USER_NOONESECSINSITE; } echo " </td>\n </tr>\n <tr>\n <td>\n " . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_NOTFOUND . "\n </td>\n <td>"; if (!empty($subdivisions)) { echo "<select name='E404SubID'>"; echo nc_select_options($subdivisions, $Array["E404_Sub_ID"]); echo "</select>"; } else { echo CONTROL_USER_NOONESECSINSITE; } echo "</td>\n</tr>\n</table><br><br></td></tr>"; } echo "</table>{$s_div_bar_action}"; $fieldsets->main_info->add(ob_get_clean()); $templates = $db->get_results("SELECT Template_ID as value,\n CONCAT(Template_ID, '. ', Description) as description,\n Parent_Template_ID as parent\n FROM Template\n ORDER BY Priority, Template_ID", ARRAY_A); ob_start(); echo "<tr><td>"; if ($type == 1) { echo $p_div_bar_action; echo WIZARD_SITE_STEP_TWO_DESCRIPTION . "<br/><br/>"; if ($Array["Title_Sub_ID"]) { $title_sub = $db->get_row("SELECT Subdivision_Name, EnglishName FROM Subdivision WHERE Subdivision_ID = '" . intval($Array["Title_Sub_ID"]) . "'", ARRAY_A); } if ($Array["E404_Sub_ID"]) { $e404_sub = $db->get_row("SELECT Subdivision_Name, EnglishName FROM Subdivision WHERE Subdivision_ID = '" . intval($Array["E404_Sub_ID"]) . "'", ARRAY_A); } echo "<legend><h3>" . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_TITLEPAGE . "</h3></legend>\n"; echo CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_NAME . ":<br>\n"; echo nc_admin_input_simple('TitleSubIDName', $title_sub['Subdivision_Name'] ? $title_sub['Subdivision_Name'] : CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_TITLEPAGE) . "<br><br>\n"; echo CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_KEYWORD . ":<br>\n"; echo nc_admin_input_simple('TitleSubIDKeyword', $title_sub['EnglishName'] ? $title_sub['EnglishName'] : "index") . "<br><br>\n"; if (!empty($templates)) { echo CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_DTEMPLATE . ":<br>\n"; echo "<select name='TitleTemplateID'>\n"; echo "<option value='0'>" . CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_DTEMPLATE_N . "</option>"; echo nc_select_options($templates, $Array["Title_Sub_ID"]); echo "</select><br>\n"; } else { echo CONTROL_TEMPLATE_NONE; } echo "<legend><h3>" . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_NOTFOUND . "</h3></legend>\n"; echo CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_NAME . ":<br>\n"; echo nc_admin_input_simple('E404SubIDName', $title_sub['Subdivision_Name'] ? $title_sub['Subdivision_Name'] : CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_NOTFOUND) . "<br><br>\n"; echo CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_KEYWORD . ":<br>\n"; echo nc_admin_input_simple('E404SubIDKeyword', $title_sub['EnglishName'] ? $title_sub['EnglishName'] : "404") . "<br><br>\n"; if (!empty($templates)) { echo CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_DTEMPLATE . ":<br>\n"; echo "<select name='E404TemplateID'>\n"; echo "<option value='0'>" . CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_DTEMPLATE_N . "</option>"; echo nc_select_options($templates, $Array["E404_Sub_ID"]); echo "</select><br>\n"; } else { echo CONTROL_TEMPLATE_NONE; } echo $s_div_bar_action; } $fieldsets->template->add(ob_get_clean()); $display_type_fieldset = new nc_admin_fieldset(CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_DISPLAYTYPE); ob_start(); echo nc_get_modal_radio('DisplayType', array(array('attr' => array('value' => 'traditional'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_DISPLAYTYPE_TRADITIONAL), array('attr' => array('value' => 'shortpage'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_DISPLAYTYPE_SHORTPAGE), array('attr' => array('value' => 'longpage_vertical'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_DISPLAYTYPE_LONGPAGE_VERTICAL)), $Array['DisplayType']); $display_type_fieldset->add(ob_get_clean()); $fieldsets->template->add($display_type_fieldset->result()); ob_start(); echo nc_get_modal_radio('ncMobile', array(array('attr' => array('value' => '0'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_SIMPLE), array('attr' => array('value' => '1'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE), array('attr' => array('value' => '2'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_ADAPTIVE)), $Array['ncMobile'] ? 1 : ($Array['ncResponsive'] ? 2 : 0)); require_once $ADMIN_FOLDER . "related/format.inc.php"; $field = new field_relation_catalogue(); echo "\n\n <span id='nc_mobilesrc'>\n <br />\n <span id='mobility_text'>\n <font>" . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_FOR . ":</font>\n <span id='cs_ncMobileSrc_caption' style='font-weight:bold;'>" . ($Array['ncMobileSrc'] ? listQuery($field->get_object_query($Array['ncMobileSrc']), $field->get_full_admin_template()) : '[нет]') . "</span>\n </span>\n <input id='cs_ncMobileSrc_value' name='ncMobileSrc' type='hidden' value='" . $Array['ncMobileSrc'] . "'> \n <span class='mobility_notMobile' style='display: none; color: #aaa'>" . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_FOR_NOTICE . "</span>\n <span class='moblilty_links'>\n <a href='#' onclick='window.open(\"" . $ADMIN_PATH . "related/select_catalogue.php?cs_type=rel_catalogue&cs_field_name=ncMobileSrc\", \"nc_popup_ncMobileSrc\", \"width=800,height=500,menubar=no,resizable=no,scrollbars=yes,toolbar=no,resizable=yes\"); return false;'>" . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_CHANGE . "</a> \n <a href='#' onclick='document.getElementById(\"cs_ncMobileSrc_value\").value=\"\";document.getElementById(\"cs_ncMobileSrc_caption\").innerHTML = \"" . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_NONE . "\";return false;'>" . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_DELETE . "</a></span> <br /><br />\n " . nc_admin_checkbox(CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_REDIRECT, 'ncMobileRedirect', $Array["ncMobileRedirect"], "class='ncMobileIdentity'") . "\n </span>\n <br />" . CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_CRITERION . "\n\n\n <script type='text/javascipt'>\n function nc_mobile_change() {\n if (\$nc('input[name=ncMobile]').filter(':checked').val() == 1) {\n \$nc('.ncMobileIdentity').each(function() {\n \$nc(this).removeAttr('disabled');\n })\n \$nc('.moblilty_links, #cs_ncMobileSrc_caption').css('display', '');\n \$nc('.mobility_notMobile').css('display', 'none');\n \$nc('#mobility_text').css('color', '#505050');\n } else {\n \$nc('.ncMobileIdentity').each(function() {\n \$nc(this).attr('disabled', 'disabled');\n });\n \$nc('.moblilty_links, #cs_ncMobileSrc_caption').css('display', 'none');\n \$nc('.mobility_notMobile').css('display', '');\n \$nc('#mobility_text').css('color', '#aaa');\n }\n }\n\n \$nc(document).ready(function() {\n nc_mobile_change();\n \$nc('input[name=ncMobile]').change(function(){\n nc_mobile_change();\n });\n });\n\n </script>"; echo nc_get_modal_radio('ncMobileIdentity', array(array('attr' => array('value' => '1', 'class' => 'ncMobileIdentity'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_USERAGENT), array('attr' => array('value' => '2', 'class' => 'ncMobileIdentity', 'id' => 'ncMobileCatalogue'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_SCREEN_RESOLUTION), array('attr' => array('value' => '3', 'class' => 'ncMobileIdentity'), 'desc' => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_ALL_CRITERION)), +$Array['ncMobileIdentity']); $mobile_fieldset = new nc_admin_fieldset(CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MOBILE_SETTINGS); $mobile_fieldset->add(ob_get_clean()); $fieldsets->template->add($mobile_fieldset->result()); if ($type == 1) { $action = "add"; } if ($type == 2) { $action = "change"; $message = $CatalogueID; } require $ROOT_FOLDER . "message_fields.php"; if ($fldCount) { $fieldsets->new_fieldset('ext_fields', CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_EXTFIELDS); ob_start(); if ($type == 2) { $fieldQuery = join($fld, ","); $fldValue = $db->get_row("SELECT " . $fieldQuery . " FROM `Catalogue` WHERE `Catalogue_ID`='" . $CatalogueID . "'", ARRAY_N); } echo "<table border='0' cellpadding='6' cellspacing='0' width='100%'><tr><td><font>"; require $ROOT_FOLDER . "message_edit.php"; echo "</td></tr></table>"; $fieldsets->ext_fields->add(ob_get_clean())->show($display['fields']); } echo $fieldsets->to_string(); if ($type == 1) { $UI_CONFIG->actionButtons[] = array("id" => "submit", "caption" => CONTROL_CONTENT_CATALOUGE_FUNCS_SHOWCATALOGUELIST_ADDSITE, "action" => "mainView.submitIframeForm()"); } elseif ($type == 2) { $UI_CONFIG->actionButtons[] = array("id" => "submit", "caption" => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_SAVE, "align" => "right", "action" => "mainView.submitIframeForm()"); } return 0; }
function ActionForm_for_modal($SubClassID) { global $CatalogueID, $SubdivisionID, $loc, $perm; global $SUB_FOLDER, $HTTP_ROOT_PATH, $MODULE_FOLDER, $ADMIN_FOLDER, $ADMIN_PATH; $nc_core = nc_Core::get_object(); $db = $nc_core->db; $type = 2; $SubdivisionID = $SubdivisionID ? +$SubdivisionID : $nc_core->sub_class->get_by_id($SubClassID, 'Subdivision_ID'); $CatalogueID = $CatalogueID ? +$CatalogueID : $nc_core->subdivision->get_by_id($SubdivisionID, 'Catalogue_ID'); $SubEnv = $nc_core->sub_class->get_by_id($SubClassID); $ClassEnv = $db->get_row("SELECT * FROM `Class` WHERE `Class_ID` = '" . intval($SubEnv["Class_ID"]) . "'", ARRAY_A); if (nc_module_check_by_keyword("cache")) { $cache_select_fields = "s.`Cache_Access_ID`, s.`Cache_Lifetime`, s.`CacheForUser`,"; } else { $cache_select_fields = ""; } $select = "SELECT " . $cache_select_fields . "\n s.`Sub_Class_Name`,\n s.`Subdivision_ID`,\n s.`Priority`,\n s.`Read_Access_ID`,\n s.`Write_Access_ID`,\n s.`Edit_Access_ID`,\n s.`Checked_Access_ID`,\n s.`Delete_Access_ID`,\n s.`Moderation_ID`,\n s.`EnglishName`,\n s.`Checked`,\n s.`Subscribe_Access_ID`,\n s.`DaysToHold`,\n s.`AllowTags`,\n s.`NL2BR`,\n s.`RecordsPerPage`,\n s.`SortBy`,\n s.`Created`,\n s.`LastUpdated`,\n c.`Class_Name`,\n c.`Class_ID`,\n c.`System_Table_ID`,\n s.`DefaultAction`,\n s.`UseCaptcha`,\n c.`CustomSettingsTemplate`,\n s.`CustomSettings`,\n s.`Class_Template_ID`,\n s.`isNaked`,\n s.`SrcMirror`,\n s.`AllowRSS`,\n s.`Edit_Class_Template`\n FROM `Sub_Class` as s,\n `Class` as c\n WHERE `Sub_Class_ID` = " . +$SubClassID . "\n AND c.`Class_ID` = s.`Class_ID`"; $Array = $db->get_row($select, ARRAY_A); if ($db->is_error) { throw new nc_Exception_DB_Error($db->last_query, $db->last_error); } if (empty($Array)) { nc_print_status(CONTROL_CONTENT_CATALOUGE_FUNCS_ERROR_NOSUBCLASS, 'info'); return; } if ($Array['Class_Template_ID']) { $Array['CustomSettingsTemplate'] = $db->get_var("SELECT `CustomSettingsTemplate`\n FROM `Class`\n WHERE `Class_ID` = " . $Array['Class_Template_ID']); } $mobile = $nc_core->catalogue->get_by_id($CatalogueID, 'ncMobile'); $classTemplatesArr = $db->get_results("SELECT `Class_Name`,\n `Class_ID`\n FROM `Class`\n WHERE `ClassTemplate` = '" . $Array['Class_ID'] . "'\n AND `Type` " . (!$mobile ? "IN ('useful', 'title', 'mobile')" : "= 'mobile'"), ARRAY_A); $class_array = nc_get_class_template_array_by_id($Array['Class_Template_ID'] ? $Array['Class_Template_ID'] : $Array['Class_ID']); $edit_class_select = null; if (count($class_array) > 1) { $edit_class_select = nc_get_class_template_form_select_by_array($class_array, $Array['Edit_Class_Template']); } $classInfo = nc_sub_class_get_classInfo($perm, $Array, $classTemplatesArr, $edit_class_select); if ($loc->SubdivisionID) { $wsts = CONTROL_CONTENT_SUBCLASS_ONSECTION; } else { $wsts = CONTROL_CONTENT_SUBCLASS_ONSITE; } $wsts_msg = nc_sub_class_get_wsts_msg($wsts); require_once $ADMIN_FOLDER . "related/format.inc.php"; $field = new field_relation_subclass(); $fieldsets = new nc_admin_fieldset_collection(); $fieldsets->set_prefix(nc_sub_class_get_prefix($SubClassID, $Array)); $fieldsets->set_static_prefix(nc_sub_class_get_style_prefix()); $fieldsets->set_suffix("\n </div>\n " . $nc_core->token->get_input() . "\n <input type='hidden' name='phase' value='4' />\n <input type='hidden' name='SubClassID' value='{$SubClassID}' />\n <input type='hidden' name='SubdivisionID' value='{$loc->SubdivisionID}' />\n <input type='hidden' name='CatalogueID' value='{$loc->CatalogueID}' />\n <input type='submit' style='display: none;' />\n "); $fieldsets->new_fieldset('main_info', CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_MAININFO)->add(nc_sub_class_get_main_info($Array, $classInfo, $wsts_msg, $field)); $fieldsets->new_fieldset('objlist', CONTROL_CONTENT_SUBDIVISION_FUNCS_OBJ_HOWSHOW)->add(nc_sub_class_get_objlist($Array)); if ($Array['CustomSettingsTemplate']) { require_once $ADMIN_FOLDER . 'array_to_form.inc.php'; $values = $CustomSettings ? $CustomSettings : $Array['CustomSettings']; $a2f = new nc_a2f($Array['CustomSettingsTemplate'], 'CustomSettings'); $a2f->set_value($values); $fieldsets->new_fieldset('CustomSettings', CONTROL_CONTENT_SUBDIVISION_CUSTOM_SETTINGS_TEMPLATE)->add(nc_sub_class_get_CustomSettings($a2f)); } $fieldsets->new_fieldset('access', CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_ACCESS)->add(nc_subdivision_show_access($SubEnv)); #$fieldsets->new_fieldset('rss', 'RSS')->add(nc_subclass_show_export('rss', $SubdivisionID, $SubClassID)); #$fieldsets->new_fieldset('xml', 'XML')->add(nc_subclass_show_export('xml', $SubdivisionID, $SubClassID)); if (nc_module_check_by_keyword('cache')) { $fieldsets->new_fieldset('cache', CONTROL_CONTENT_SUBCLASS_FUNCS_CACHE)->add(nc_subdivision_show_cache($SubEnv)); } if (nc_module_check_by_keyword('comments')) { $fieldsets->new_fieldset('comments', CONTROL_CONTENT_SUBCLASS_FUNCS_COMMENTS)->add(nc_subdivision_show_comments($SubEnv)); } echo $fieldsets->to_string(); }
function ClassInformation($ClassID, $action, $phase) { global $ROOT_FOLDER, $ClassGroup, $ADMIN_PATH, $UI_CONFIG; $nc_core = nc_Core::get_object(); $db = $nc_core->db; $ClassID = +$ClassID; $select = "SELECT `Class_ID`,\n `Class_Name`,\n `System_Table_ID`,\n `File_Hash`,\n `File_Mode`,\n `Class_Group`"; if ($nc_core->modules->get_by_keyword("cache")) { $select .= ", `CacheForUser`"; } $select .= "FROM `Class` WHERE "; $select .= " `Class_ID` = '" . $ClassID . "'"; $Array = $db->get_row($select); if ($File_Mode) { $class_editor->load($ClassID); $class_editor->fill_fields(); $class_filds = $class_editor->get_fields(); $Array->Class_Name = $class_filds['Class_Name']; $Array->Settings = $class_filds['Settings']; } if (!$Array) { nc_print_status(CONTROL_CLASS_ERRORS_DB, 'error'); } $fieldsets = new nc_admin_fieldset_collection(); ob_start(); ?> <script type="text/javascript"> function refreshTree(){ var newClassGroup = $("#Class_Group option:selected").attr('md5'); var tree = parent.document.getElementById('treeIframe').contentWindow.tree if (classGroup != newClassGroup) { tree.moveNode('dataclass-<?php echo $ClassID; ?> ','inside','group-'+newClassGroup); } } </script> <form method='post' id='ClassForm' action='<?php echo $action; ?> ' onsubmit="refreshTree();"> <input type='hidden' name='ClassID' value='<?php echo $ClassID; ?> ' /> <input type='hidden' name='phase' value='<?php echo $phase; ?> ' /> <input type='hidden' name='action_type' value='1' /> <input type='hidden' name='fs' value='<?php echo $Array->File_Mode; ?> ' /> <?php echo $nc_core->token->get_input(); ?> <?php $fieldsets->set_prefix(ob_get_clean())->set_suffix("</form>"); $fieldsets->new_fieldset('main_info', CONTROL_CLASS_CLASSFORM_MAININFO); ob_start(); ?> <div id='maininfoOn'> <?php echo "<div class='inf_block'><label>" . CONTROL_CLASS_CLASS_NAME . ":</label><br/>"; echo "<input type='text' name='Class_Name' size='50' value=\"" . htmlspecialchars($Array->Class_Name) . "\"><br/><br/>"; // if not component template - show groups if (!($Array->ClassTemplate || $phase == 15 || $phase == 17)) { $classGroups = $db->get_col("SELECT DISTINCT `Class_Group` FROM `Class`"); if (!empty($classGroups)) { echo "<div class='inf_block'><label>" . CONTROL_USER_GROUP . "</label>:<br /><select name='Class_Group' id='Class_Group' style='width:320px; margin-right: 5px;'>\n"; foreach ($classGroups as $Class_Group) { if ($Array->Class_Group == $Class_Group) { echo "\t<option value='" . $Class_Group . "' md5='" . md5($Class_Group) . "' selected='selected'>" . $Class_Group . "</option>\n"; } else { echo "\t<option value='" . $Class_Group . "' md5='" . md5($Class_Group) . "'>" . $Class_Group . "</option>\n"; } } echo "</select></div>"; } unset($classGroups); echo "<br /><div class='inf_block'><label>" . CONTROL_CLASS_NEWGROUP . "</label><br/><input type='text' name='Class_Group_New' size='50' value='" . htmlspecialchars($Array->Class_Group_New) . "'></div>"; } else { echo "<div class='inf_block'><label>" . CONTROL_USER_GROUP . ":</label><br/> " . CONTROL_CLASS_CLASS_TEMPLATE_GROUP . "</div>"; echo "<input type='hidden' name='Class_Group' value='" . CONTROL_CLASS_CLASS_TEMPLATE_GROUP . "'>"; } ?> <script type="text/javascript"> classGroup = "<?php echo md5($Array->Class_Group); ?> "; </script> </div> <?php $fieldsets->main_info->add(ob_get_clean()); if ($nc_core->modules->get_by_keyword("cache")) { $fieldsets->new_fieldset('cache_info', CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ_CACHE); ob_start(); ?> <div id='cacheinfoOn'> <?php $CacheForUser = $db->get_var("SELECT `CacheForUser` FROM `Class` WHERE `Class_ID` = " . $ClassID); ?> <table border='0' cellpadding='0' cellspacing='0' width='99%'> <tr> <td style='border: none;'> <?php echo CONTROL_CLASS_CACHE_FOR_AUTH; ?> *:<br/> <select name='CacheForUser' style='width:320px; margin-right: 5px;'> <option value='0'<?php echo !$CacheForUser ? " selected" : ""; ?> ><?php echo CONTROL_CLASS_CACHE_FOR_AUTH_NONE; ?> </option> <option value='1'<?php echo $CacheForUser == 1 ? " selected" : ""; ?> ><?php echo CONTROL_CLASS_CACHE_FOR_AUTH_USER; ?> </option> <option value='2'<?php echo $CacheForUser == 2 ? " selected" : ""; ?> ><?php echo CONTROL_CLASS_CACHE_FOR_AUTH_GROUP; ?> </option> </select><br/> * <?php echo CONTROL_CLASS_CACHE_FOR_AUTH_DESCRIPTION; ?> </td> </tr> </table> </div> <?php $fieldsets->cache_info->add(ob_get_clean()); } return $fieldsets->to_string(); }