Beispiel #1
0
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'] . "'>&nbsp;&nbsp;\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&amp;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>&nbsp;&nbsp;\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;
}
Beispiel #2
0
function nc_subdivision_show_add_form($catalogue_id = 0, $parent_sub_id = 0)
{
    $nc_core = nc_Core::get_object();
    $db = $nc_core->db;
    if ($parent_sub_id = intval($parent_sub_id)) {
        $catalogue_id = $nc_core->subdivision->get_by_id($parent_sub_id, 'Catalogue_ID');
    }
    $catalogue_id = intval($catalogue_id);
    echo "<form action='index.php' method='post' enctype='multipart/form-data' >";
    echo "<input type='hidden' name='CatalogueID' value='" . intval($catalogue_id) . "' />";
    echo "<input type='hidden' name='ParentSubID' value='" . intval($parent_sub_id) . "' />";
    echo "<input type='hidden' name='phase' value='3' />";
    echo "<input type='hidden' name='posting' value='1' />";
    echo "<input type='submit' class='hidden' />";
    echo nc_Core::get_object()->token->get_input();
    $Priority = $db->get_var("SELECT (Priority+1) FROM Subdivision WHERE Parent_Sub_ID='" . $parent_sub_id . "' AND Catalogue_ID='" . $catalogue_id . "' ORDER BY Priority DESC LIMIT 1");
    echo nc_subdivision_moderate_form(array('Checked' => 1, 'Priority' => $Priority + 0));
    $field_main = new nc_admin_fieldset(CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA);
    $field_main->add(nc_admin_input(CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_NAME, 'Subdivision_Name', $nc_core->input->fetch_get_post('Subdivision_Name'), 50));
    $field_main->add(nc_admin_input(CONTROL_CONTENT_SUBDIVISION_FUNCS_MAINDATA_KEYWORD, 'EnglishName', $nc_core->input->fetch_get_post('EnglishName'), 50, "", " data-type='transliterate' data-from='Subdivision_Name' data-is-url='yes' "));
    echo $field_main->result();
    echo nc_subdivision_show_component($catalogue_id);
    $template_id = $parent_sub_id ? $nc_core->subdivision->get_by_id($parent_sub_id, 'Template_ID') : $nc_core->catalogue->get_by_id($catalogue_id, 'Template_ID');
    echo nc_subdivision_form_design(array('_db_inherit_Template_ID' => $template_id));
    echo "</form>";
}