예제 #1
0
 public function convert($ClassID, $action = 'convert')
 {
     $nc_core = nc_Core::get_object();
     $db = $nc_core->db;
     $fs = $action == 'convert' ? 1 : 0;
     if ($action == 'convert') {
         $this->db->query("UPDATE `Class` SET `File_Mode` = 1, `File_Path` = IF(`ClassTemplate` > 0, CONCAT('/', `ClassTemplate`, '/', `Class_ID`,'/'), CONCAT('/', `Class_ID`,'/')) WHERE `Class_ID` = " . $ClassID . " OR `ClassTemplate` = " . $ClassID);
     }
     if ($this->db->errno) {
         return nc_print_status(CONTROL_CLASS_CONVERT_DB_ERROR, 'error', null, 1);
     }
     $classes_data = $this->db->get_results("SELECT * FROM `Class` WHERE `Class_ID` = " . $ClassID . " OR `ClassTemplate` = " . $ClassID . " ORDER BY `ClassTemplate` ASC", ARRAY_A);
     foreach ($classes_data as $class_data) {
         $templates = $this->get_class_templates_list();
         //save tpls
         $class_editor = new nc_class_editor($nc_core->CLASS_TEMPLATE_FOLDER, $db);
         $class_editor->load($class_data['ClassTemplate']);
         $path = $class_editor->get_absolute_path() . $class_data['Class_ID'] . "/class_v40_backup.html";
         if ($action == 'convert') {
             $new_temlates = $this->convert_class_templates($class_data);
             $class_editor->save_new_class($class_data['Class_ID'], $new_temlates);
             foreach ($templates as $field_name => $tmp) {
                 $fields[$field_name] = "<!-- {$field_name} -->" . $class_data[$field_name] . "<!-- /{$field_name} -->";
             }
             $backup_content = join("\n\n", $fields);
             nc_save_file($path, $backup_content);
         } else {
             $restore_content = nc_check_file($path) ? nc_get_file($path) : false;
             if (!$restore_content) {
                 return nc_print_status(CONTROL_CLASS_CONVERT_UNDO_FILE_ERROR, 'error', null, 1);
             }
             foreach ($templates as $field_name => $tmp) {
                 if (preg_match("#<!-- ?{$field_name} ?-->(.*)<!-- ?/ ?{$field_name} ?-->#is", $restore_content, $matches)) {
                     $restored_templates[$field_name] = $matches[1];
                 }
             }
             if ($restored_templates && is_array($restored_templates)) {
                 $query = array();
                 foreach ($restored_templates as $field_name => $tmp) {
                     $query[] = "`" . $field_name . "` = '" . $db->prepare($tmp) . "'";
                 }
                 // сообственно, добавление
                 $SQL = "\nUPDATE `Class`";
                 $SQL .= "\n    SET `File_Mode` = 0 , " . join(",\n        ", $query);
                 $SQL .= "\n        WHERE `Class_ID` = " . $class_data['Class_ID'];
                 $this->db->query($SQL);
                 if ($this->db->errno) {
                     return nc_print_status(CONTROL_CLASS_CONVERT_DB_ERROR, 'error', null, 1);
                 }
             }
         }
         $message = nc_print_status(CONTROL_CLASS_CONVERT_OK, 'OK', null, 1);
         $message .= "<a href='index.php?phase=4&ClassID=" . $ClassID . "&fs=" . $fs . "'>" . CONTROL_CLASS_CONVERT_OK_GOEDIT . "</a>";
     }
     return $message;
     //no errors
 }
예제 #2
0
function ClassForm($ClassID, $action, $phase, $type, $BaseClassID)
{
    global $ROOT_FOLDER, $ClassGroup, $ADMIN_PATH, $UI_CONFIG;
    // system superior object
    $nc_core = nc_Core::get_object();
    $db = $nc_core->db;
    // compile main MySQL query
    $select = "SELECT `Class_ID`, `Class_Name`, `DaysToHold`, `AllowTags`, `NL2BR`, `System_Table_ID`, `File_Hash`, ";
    $select .= "`FormPrefix`, `FormSuffix`, `RecordTemplate`, `RecordsPerPage`, ";
    $select .= "`SortBy`, `RecordTemplateFull`, `TitleTemplate`, `UseAltTitle`, `TitleList`, `Settings`, `Class_Group`, `UseCaptcha`, `CustomSettingsTemplate`, `ClassDescription`, `ClassTemplate`, `Type` ";
    if ($nc_core->modules->get_by_keyword("cache")) {
        $select .= ", `CacheForUser`";
    }
    $select .= "FROM `Class` WHERE ";
    if ($BaseClassID) {
        $type_o = $type;
        $type = 2;
        $ClassID = $BaseClassID;
    }
    $File_Mode = nc_get_file_mode('Class', $ClassID);
    if ($File_Mode) {
        $class_editor = new nc_class_editor($nc_core->CLASS_TEMPLATE_FOLDER, $nc_core->db);
    }
    if (isset($_POST['Class_Group_New']) && ($_POST['Class_Group_New'] || !$ClassGroup) && $ClassID) {
        ?>
            <script>
                parent.window.frames[0].window.location.href += '&selected_node=dataclass-<?php 
        echo $ClassID;
        ?>
';
            </script>
            <?php 
    }
    ?>
 <form method='post' id='ClassForm' action='<?php 
    echo $action;
    ?>
'>
        <?php 
    if ($File_Mode) {
        ?>
 <input type="hidden" value="1" name="fs" /> <?php 
    } else {
        echo "<br /><div>" . CONTROL_CLASS_INFO_ADDSLASHES . "</div>";
    }
    if (!is_object($Array)) {
        $Array = new stdClass();
    }
    if ($type == 1) {
        if (!$nc_core->input->fetch_post()) {
            if (!$Array->Class_Name) {
                $Array->Class_Name = CONTROL_CLASS_NEWCLASS;
            }
            if (!$Array->FormPrefix) {
                $Array->FormPrefix = "\$f_AdminCommon";
                if ($File_Mode) {
                    $Array->FormPrefix = '<? echo ' . $Array->FormPrefix . '; ?>';
                }
            }
            if (!$Array->RecordTemplate) {
                $Array->RecordTemplate = "\$f_AdminButtons";
            }
            if (!$Array->RecordsPerPage) {
                $Array->RecordsPerPage = "20";
            }
            if (!$Array->Class_Group) {
                $Array->Class_Group = $db->get_var("SELECT `Class_Group` FROM `Class` WHERE md5(`Class_Group`) = '" . $ClassGroup . "'");
            }
            if ($File_Mode) {
                $Array->RecordTemplate = '<? echo ' . $Array->RecordTemplate . '; ?>';
            }
        } else {
            $Array->FormPrefix = $nc_core->input->fetch_post('FormPrefix');
            $Array->FormSuffix = $nc_core->input->fetch_post('FormSuffix');
            $Array->RecordTemplate = $nc_core->input->fetch_post('RecordTemplate');
            $Array->RecordTemplateFull = $nc_core->input->fetch_post('RecordTemplateFull');
            $Array->Settings = $nc_core->input->fetch_post('Settings');
            $Array->Class_Name = $nc_core->input->fetch_post('Class_Name');
            $Array->Class_Group = $nc_core->input->fetch_post('Class_Group');
            $Array->Class_Group_New = $nc_core->input->fetch_post('Class_Group_New');
            $Array->RecordsPerPage = $nc_core->input->fetch_post('RecordsPerPage');
            $Array->SortBy = $nc_core->input->fetch_post('SortBy');
            $Array->AllowTags = $nc_core->input->fetch_post('AllowTags');
            $Array->NL2BR = $nc_core->input->fetch_post('NL2BR');
            $Array->TitleTemplate = $nc_core->input->fetch_post('TitleTemplate');
            $Array->TitleList = $nc_core->input->fetch_post('TitleList');
            $Array->UseAltTitle = $nc_core->input->fetch_post('UseAltTitle');
            $Array->UseCaptcha = $nc_core->input->fetch_post('UseCaptcha');
            $Array->CustomSettingsTemplate = $nc_core->input->fetch_post('CustomSettingsTemplate');
            $Array->ClassDescription = $nc_core->input->fetch_post('ClassDescription');
            if ($nc_core->modules->get_by_keyword("cache")) {
                $Array->CacheForUser = $nc_core->input->fetch_post('CacheForUser');
            }
        }
    } elseif ($type == 2) {
        $select .= " `Class_ID` = '" . $ClassID . "'";
        $Array = $db->get_row($select);
        if ($ClassGroup) {
            $Array->Class_Group = $db->get_var("SELECT `Class_Group` FROM `Class` WHERE md5(`Class_Group`) = '" . $ClassGroup . "'");
        }
        if ($phase == 5) {
            if ($ClassGroup) {
                $Array->Class_Group = $ClassGroup;
            }
        }
        if (!$Array) {
            nc_print_status(CONTROL_CLASS_ERRORS_DB, 'error');
        }
    } elseif ($type == 3) {
        $select .= " `System_Table_ID` = '" . $ClassID . "' AND `ClassTemplate` = 0 AND File_Mode = " . +$_REQUEST['fs'];
        $Array = $db->get_row($select);
        if (!$Array) {
            nc_print_status(CONTROL_CLASS_ERRORS_DB, 'error');
        }
    }
    if ($File_Mode && ($type == 2 || $type == 3)) {
        $class_editor->load($Array->Class_ID, null, $Array->File_Hash);
        $class_editor->fill_fields();
        $class_fields = $class_editor->get_fields();
        $Array->FormPrefix = $class_fields['FormPrefix'];
        $Array->FormSuffix = $class_fields['FormSuffix'];
        $Array->RecordTemplate = $class_fields['RecordTemplate'];
        $Array->RecordTemplateFull = $class_fields['RecordTemplateFull'];
        $Array->Settings = $class_fields['Settings'];
        $class_absolute_path = $class_editor->get_absolute_path();
        $class_filemanager_link = $nc_core->SUB_FOLDER . $nc_core->HTTP_ROOT_PATH . "modules/filemanager/admin.php?page=manager&phase=1&dir=" . $nc_core->SUB_FOLDER . $nc_core->HTTP_TEMPLATE_PATH . 'class' . $class_editor->get_relative_path();
        echo "<br />" . PHP_EOL . "<div>" . sprintf(CONTROL_CLASS_CLASSFORM_TEMPLATE_PATH, $class_filemanager_link, $class_absolute_path) . "</div>";
    }
    if ($type == 1 && !$Array->Settings && $File_Mode) {
        $Array->Settings = "<?php\n\n\n?>";
    }
    $Array->RecordTemplate = nc_cleaned_RecordTemplate_of_string_service($Array->RecordTemplate);
    if ($type == 1 || $BaseClassID) {
        echo "<h2>" . CONTROL_CLASS_CLASSFORM_INFO_FOR_NEWCLASS . "</h2>";
        ?>
            </div>
                <?php 
        echo CONTROL_CLASS_CLASS_NAME . ":<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)) {
            $classGroups = $db->get_col("SELECT DISTINCT `Class_Group` FROM `Class` WHERE `Class_Group` <> ''");
            if (!empty($classGroups)) {
                echo CONTROL_USER_GROUP . ":<br/><select name='Class_Group' style='width:auto;'>\n";
                foreach ($classGroups as $Class_Group) {
                    if ($Array->Class_Group == $Class_Group) {
                        echo "\t<option value='" . $Class_Group . "' selected='selected'>" . $Class_Group . "</option>\n";
                    } else {
                        echo "\t<option value='" . $Class_Group . "'>" . $Class_Group . "</option>\n";
                    }
                }
                echo "</select>&nbsp;&nbsp;&nbsp;";
            }
            unset($classGroups);
            echo CONTROL_CLASS_NEWGROUP . "&nbsp;&nbsp;&nbsp;<input type='text' name='Class_Group_New' size='25' maxlength='64' value='" . htmlspecialchars($Array->Class_Group_New) . "'><br/><br/>";
        } else {
            echo CONTROL_USER_GROUP . ": " . CONTROL_CLASS_CLASS_TEMPLATE_GROUP . "";
            echo "<input type='hidden' name='Class_Group' value='" . CONTROL_CLASS_CLASS_TEMPLATE_GROUP . "'>";
        }
        if ($Array->ClassTemplate) {
            if (!$Array->Type) {
                $Array->Type = 'useful';
            }
            echo "<br/> " . CONTROL_CLASS_COMPONENT_TEMPLATE_TYPE . ":  ";
            echo '' . constant("CONTROL_CLASS_COMPONENT_TEMPLATE_TYPE_" . strtoupper($Array->Type)) . '';
        }
        if ($nc_core->modules->get_by_keyword("cache")) {
            ?>
                    <table border='0' cellpadding='0' cellspacing='0' width='98%'>
                        <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>
                    <br/>
                <?php 
        }
        ?>
                <br/>
                <?php 
    } else {
        ?>
 <input type="hidden" value="<?php 
        echo $Array->Class_Name ? $Array->Class_Name : $_GET['Class_Name'];
        ?>
" name="Class_Name" /> <?php 
    }
    $set = $nc_core->get_settings();
    if ($set['CMEmbeded']) {
        ?>
                                <div id="classFields" class="completionData" style="display:none"></div>
                                <div id="classCustomSettings" class="completionData" style="display:none"></div>
                                <script>
				   $nc('#classFields').data('completionData', $nc.parseJSON("<?php 
        echo addslashes(json_safe_encode(getCompletionDataForClassFields($ClassID)));
        ?>
"));
				   $nc('#classCustomSettings').data('completionData', $nc.parseJSON("<?php 
        echo addslashes(json_safe_encode(getCompletionDataForClassCustomSettings($ClassID)));
        ?>
"));
				</script>
				<?php 
    }
    ob_start();
    ?>

            <table border='0' cellpadding='0' cellspacing='0' width='99%'>
                <tr>
                    <td  style='border: none;'>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_TITLE;
    ?>
:<br>
                        <input type='text' name='TitleList' size='50' maxlength='255' value="<?php 
    echo htmlspecialchars($Array->TitleList);
    ?>
">
                        <br />&nbsp;
                    </td>
                </tr>
                <tr>
                    <td  style='border: none;'>
                        <?php 
    /* <a name='ListPrefixLink' href='#ListPrefix' onclick="window.open('<?= $ADMIN_PATH
       ?>class/index.php?phase=12&formtype=class&window=opener&form=ClassForm&textarea=ListPrefix<?= (($type != 3) ? "&classid=$ClassID&systemclassid=0" : "&classid=0&systemclassid=$ClassID")
       ?>','LIST','top=50, left=100,directories=no,height=600,location=no,menubar=no,resizable=no,scrollbars=yes,status=yes,toolbar=no,width=400'); return false;"><?= CONTROL_CLASS_CLASS_SHOW_VAR_FUNC_LIST
       ?></a><br/> */
    ?>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_PREFIX;
    ?>
:<br/>
                        <textarea id='ListPrefix' wrap='OFF' rows='10' cols='60' name='FormPrefix'><?php 
    echo htmlspecialchars($Array->FormPrefix);
    ?>
</textarea>
                        <br />&nbsp;
                    </td>
                </tr>
                <tr>
                    <td  style='border: none;'>
                        <?php 
    /* <a name='ListBodyLink' href='#ListBody' onclick="window.open('<?= $ADMIN_PATH
       ?>class/index.php?phase=12&formtype=class&window=opener&form=ClassForm&textarea=ListBody<?= (($type != 3) ? "&classid=$ClassID&systemclassid=0" : "&classid=0&systemclassid=$ClassID")
       ?>','LIST','top=50, left=100,directories=no,height=600,location=no,menubar=no,resizable=no,scrollbars=yes,status=yes,toolbar=no,width=400'); return false;"><?= CONTROL_CLASS_CLASS_SHOW_VAR_FUNC_LIST
       ?></a><br/> */
    ?>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_BODY;
    ?>
:<br/>
                        <textarea id='ListBody' wrap='OFF' rows='10' cols='60' name='RecordTemplate'><?php 
    echo htmlspecialchars($Array->RecordTemplate);
    ?>
</textarea>
                        <br />&nbsp;
                    </td>
                </tr>
                <tr>
                    <td  style='border: none;'>
                        <?php 
    /* <a name='ListSuffixLink' href='#ListSuffix' onclick="window.open('<?= $ADMIN_PATH
       ?>class/index.php?phase=12&formtype=class&window=opener&form=ClassForm&textarea=ListSuffix<?= (($type != 3) ? "&classid=$ClassID&systemclassid=0" : "&classid=0&systemclassid=$ClassID")
       ?>','LIST','top=50, left=100,directories=no,height=600,location=no,menubar=no,resizable=no,scrollbars=yes,status=yes,toolbar=no,width=400'); return false;"><?= CONTROL_CLASS_CLASS_SHOW_VAR_FUNC_LIST
       ?></a><br/> */
    ?>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SUFFIX;
    ?>
:<br/>
                        <textarea id='ListSuffix' wrap='OFF' rows='10' cols='60' name='FormSuffix'><?php 
    echo htmlspecialchars($Array->FormSuffix);
    ?>
</textarea>
                        <br />&nbsp;
                    </td>
                </tr>
                <tr>
                    <td  style='border: none;'>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SHOW;
    ?>
 <input type='text' name='RecordsPerPage' SIZE='4' maxlength='255' value="<?php 
    echo htmlspecialchars($Array->RecordsPerPage);
    ?>
"> <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ;
    ?>
<br />&nbsp;
                    </td>
                </tr>
                <tr>
                    <td style='border: none;'>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SORT;
    ?>
*:<br/><input id='SortBy' type='text' name='SortBy' size='50' maxlength='255' value="<?php 
    echo htmlspecialchars($Array->SortBy);
    ?>
"><br/>
                        * <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SORTNOTE;
    ?>
                    </td>
                </tr>
            </table>

            <?php 
    $fieldset = new nc_admin_fieldset(CONTROL_CLASS_CLASS_OBJECTSLIST);
    echo $fieldset->add(ob_get_clean())->result();
    ob_start();
    ?>

            <table border=0 cellpadding=0 cellspacing=0 width=98%>
                <tr>
                    <td  style='border: none;'>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ_PAGETITLE;
    ?>
:<br />
                        <input type='text' name='TitleTemplate' size='50' maxlength='255' value="<?php 
    echo htmlspecialchars($Array->TitleTemplate);
    ?>
">
                    </td>
                </tr>
                <tr>
                    <td style='border: none;'>
                        <input type='checkbox' name='UseAltTitle' id='UseAltTitle'  value='1' <?php 
    echo $Array->UseAltTitle ? "checked" : "";
    ?>
 />
                        <label for='UseAltTitle'><?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ_USEASALT;
    ?>
</label>
                        <br /><br />
                    </td>
                </tr>
                <tr>
                    <td  style='border: none;'>
                        <?php 
    /* <a name='PageBodyLink' href='#PageBody' onclick="window.open('<?= $ADMIN_PATH
       ?>class/index.php?phase=12&formtype=class&window=opener&form=ClassForm&textarea=PageBody<?= (($type != 3) ? "&classid=$ClassID&systemclassid=0" : "&classid=0&systemclassid=$ClassID")
       ?>','LIST','top=50, left=100,directories=no,height=600,location=no,menubar=no,resizable=no,scrollbars=yes,status=yes,toolbar=no,width=400'); return false;"><?= CONTROL_CLASS_CLASS_SHOW_VAR_FUNC_LIST
       ?></a><br/> */
    ?>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ_PAGEBODY;
    ?>
:<br />
                        <textarea id='PageBody' wrap='OFF' rows='10' cols='60' name='RecordTemplateFull'><?php 
    echo htmlspecialchars($Array->RecordTemplateFull);
    ?>
</textarea>
                    </td>
                </tr>
            </table>
            <?php 
    $fieldset = new nc_admin_fieldset(CONTROL_CLASS_CLASS_OBJECTVIEW);
    echo $fieldset->add(ob_get_clean())->result();
    ob_start();
    ?>

            <table border='0' cellpadding='0' cellspacing='0' width='99%'>
                <tr>
                    <td colspan='2'  style='border: none;'>
                        <input type='checkbox' id='tags' name='AllowTags' <?php 
    echo $Array->AllowTags ? "checked" : "";
    ?>
 value='1' />
                        <label for='tags'><?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ_HTML;
    ?>
</label>
                    </td>
                </tr>
                <tr>
                    <td colspan='2' style='border: none;'>
                        <input type='checkbox' id='br' name='NL2BR' <?php 
    echo $Array->NL2BR ? "checked" : "";
    ?>
 value='1' />
                        <label for='br'><?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ_BR;
    ?>
</label>
                    </td>
                </tr>
                <tr>
                    <td colspan='2' style='border: none;'>
                        <input type='checkbox' id='captcha' name='UseCaptcha' <?php 
    echo $Array->UseCaptcha ? "checked" : "";
    ?>
 value='1' />
                        <label for='captcha'><?php 
    echo CONTROL_CLASS_USE_CAPTCHA;
    ?>
</label>
                        <br /><br />
                    </td>
                </tr>
                <tr>
                    <td colspan='2' style='border: none;'>
                        <?php 
    echo CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ_SYSTEM;
    ?>
:<br/><textarea id='Settings' wrap='OFF' rows='8' cols='60' name='Settings'><?php 
    echo htmlspecialchars($Array->Settings);
    ?>
</textarea>
                    </td>
                </tr>

                <tr  style="display:none">
                    <td colspan='2' style='border: none;'>
                        <input type='hidden' name='DaysToHold' size='4' value="<?php 
    echo htmlspecialchars($Array->DaysToHold);
    ?>
" />
                    </td>
                </tr>
                <?php 
    echo $type == 2 && !$BaseClassID && !($Array->ClassTemplate || $phase == 15) ? "\n    <tr><td colspan='2'  style='border: none;'>\n      <a href='" . $nc_core->SUB_FOLDER . $nc_core->HTTP_ROOT_PATH . "action.php?ctrl=admin.backup&amp;action=export_run&amp;raw=1&amp;type=component&amp;id=" . $ClassID . "&amp;" . $nc_core->token->get_url() . "'>" . CONTROL_CLASS_EXPORT . "</a>\n    </td></tr>" : "";
    ?>
                <?php 
    echo !+$_REQUEST['fs'] && !$Array->ClassTemplate && !$Array->System_Table_ID ? "\n                    <tr><td colspan='2'  style='border: none;'>\n      <a href='convert.php?ClassID=" . $ClassID . "&amp;fs=0&amp;phase=1'>" . CONTROL_CLASS_CONVERT_BUTTON . "</a>\n    </td></tr>" : "";
    ?>
                <?php 
    $file_path = $db->get_var("SELECT `File_Path` FROM `Class` WHERE `Class_ID` = '" . $ClassID . "'");
    $bakup_file_exist = file_exists($nc_core->CLASS_TEMPLATE_FOLDER . $file_path . "class_v40_backup.html");
    ?>
                <?php 
    echo $bakup_file_exist && +$_REQUEST['fs'] && !$Array->ClassTemplate && !$Array->System_Table_ID ? "\n                    <tr><td colspan='2'  style='border: none;'>\n      <a href='convert.php?ClassID=" . $ClassID . "&amp;fs=1&amp;phase=3'>" . CONTROL_CLASS_CONVERT_BUTTON_UNDO . "</a>\n    </td></tr>" : "";
    ?>
            </table>
            <?php 
    $fieldset = new nc_admin_fieldset(CONTROL_CLASS_CLASS_OBJECTSLIST_SHOWOBJ_DOPL);
    echo $fieldset->add(ob_get_clean())->result();
    ?>

            <div align='right'>
                <?php 
    if ($type == 1 || $BaseClassID) {
        $UI_CONFIG->actionButtons[] = array("id" => "submit", "caption" => $phase == 15 ? CONTROL_CLASS_CLASS_TEMPLATE_ADD : CONTROL_CLASS_ADD, "action" => "mainView.submitIframeForm()");
    } elseif ($type > 1) {
        $UI_CONFIG->actionButtons[] = array("id" => "submit", "caption" => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_SAVE, "action" => 'return false;" id="nc_class_save');
        // add component template button
        if (!($Array->ClassTemplate || $phase == 15)) {
            $UI_CONFIG->actionButtons[] = array("id" => "submit", "align" => "left", "caption" => CONTROL_CLASS_CLASS_TEMPLATE_ADD, "location" => "classtemplate" . (+$_REQUEST['fs'] ? '_fs' : '') . ".add(" . ($type == 3 ? $Array->Class_ID : $ClassID) . ")");
        }
        global $system_env;
        if ($system_env['SyntaxCheck']) {
            $UI_CONFIG->actionButtons[] = array("id" => "debug", "caption" => NETCAT_DEBUG_BUTTON_CAPTION, "action" => "document.getElementById('mainViewIframe').contentWindow.FormAsyncDebug()");
        }
        $UI_CONFIG->actionButtons[] = array("id" => "preview", "caption" => NETCAT_PREVIEW_BUTTON_CAPTIONCLASS, "align" => "left", "action" => "document.getElementById('mainViewIframe').contentWindow.SendClassPreview('','../../index.php')");
    }
    ?>
            </div>

            <?php 
    nc_print_admin_save_script('ClassForm');
    // Используется для мастера создания шаблонов
    global $Class_Type;
    echo "<input type='hidden' name='Class_Type' value='" . $Class_Type . "'>\n";
    if ($BaseClassID) {
        print "<input type='hidden' name='BaseClassID' value='" . $BaseClassID . "'>\n";
    } else {
        print "<input type='hidden' name='ClassID' value='" . $ClassID . "'>\n";
    }
    print $nc_core->token->get_input();
    if ($Array->System_Table_ID) {
        print "<input type='hidden' name='System_Table_ID' value='" . $Array->System_Table_ID . "'>\n";
    }
    ?>


            <input type='hidden' name='ClassGroup' value='<?php 
    echo $ClassGroup;
    ?>
'>
            <input type='hidden' name='phase' value='<?php 
    echo $phase;
    ?>
'>
            <input type='hidden' name='type' value='<?php 
    echo $BaseClassID ? 1 : $type;
    ?>
'>
            <?php 
    if ($phase == 15) {
        echo "<input type='hidden' name='ClassTemplate' value='" . $BaseClassID . "'>";
    }
    ?>
            <?php 
    if ($Array->ClassTemplate) {
        echo "<input type='hidden' name='ClassTemplate' value='" . $Array->ClassTemplate . "'>";
    }
    ?>
            <input type='submit' class='hidden'>
        </form>

        <?php 
    $UI_CONFIG->remind[] = 'remind_redaction';
    ?>
        <?php 
    if ($nc_core->get_settings('TextareaResize')) {
        ?>
        <script type="text/javascript">bindTextareaResizeButtons();</script>
        <?php 
    }
    ?>
        <?php 
}