Exemple #1
0
function ConfirmDeletion($Class_Group = '')
{
    global $db;
    global $UI_CONFIG;
    $ask = false;
    $class_id = 0;
    $class_id_array = array();
    print "<form method='post' action='index.php'>";
    $nc_core = nc_Core::get_object();
    $template_class_id_array = array();
    $input = $nc_core->input->fetch_get_post();
    if (!empty($input)) {
        foreach ($input as $key => $val) {
            if (nc_substr($key, 0, 6) == "Delete" && $val) {
                $ask = true;
                $class_id = intval($val);
                $SelectArray = $db->get_var("SELECT `Class_Name` FROM `Class` WHERE `Class_ID`='" . $class_id . "'");
                // check template existence
                if (!$SelectArray) {
                    nc_print_status(sprintf(CONTROL_CLASS_CLASS_NOT_FOUND, $class_id), 'error');
                    continue;
                }
                $class_id_array[] = $class_id;
                print "<input type='hidden' name='" . $key . "' value='" . $val . "'>";
                $class_counter++;
                $template_ids = $db->get_col("SELECT Class_ID FROM Class WHERE ClassTemplate = '" . $class_id . "'");
                if ($template_ids) {
                    $template_class_id_array = array_merge($template_class_id_array, $template_ids);
                }
            }
        }
    }
    if (!$ask) {
        return false;
    }
    if ($class_counter > 1) {
        $UI_CONFIG = new ui_config_class("delete", "", $ClassGroup);
        $post_f1 = CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_WARNING_SITEDELETE_I;
        $post_f2 = CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_WARNING_SITEDELETE_U;
    } else {
        print "<input type='hidden' name='ClassGroup' value='" . $db->get_var("SELECT md5(`Class_Group`) FROM `Class` WHERE `Class_ID` = '" . $class_id . "' GROUP BY `Class_Group`") . "'>";
        $UI_CONFIG = new ui_config_class('delete', $class_id, $ClassGroup);
    }
    print $nc_core->token->get_input();
    print "<input type='hidden' name='fs' value='" . $_REQUEST['fs'] . "'>" . "<input type='hidden' name='phase' value='7'>" . "</form>";
    if (!empty($class_id_array)) {
        nc_print_status(CONTROL_CLASS_CLASS_DELETE_WARNING, 'info', array($post_f1, $post_f2));
        nc_list_class_use($class_id_array, 0, 0);
        if ($template_class_id_array) {
            echo "<br/>";
            nc_list_class_template_use($template_class_id_array);
        }
    }
    $UI_CONFIG->actionButtons[] = array("id" => "submit", "caption" => CONTROL_CONTENT_CATALOUGE_FUNCS_CATALOGUEFORM_CONFIRMDELETE, "action" => "mainView.submitIframeForm()", "red_border" => true);
    return true;
}
Exemple #2
0
        echo "<tr>\n<td align=right>" . REPORTS_SYSMSG_TOTAL . ":</td><td>\n";
        printf(REPORTS_USERS, $count_user_sum, $count_user_off_sum);
        echo "</td></tr>\n</table></fieldset>\n";
        break;
    case 2:
        #class, sub_class
        $UI_CONFIG = new ui_config_general_stat('class_stat');
        show_form_for_select($type);
        nc_list_class_use($a, $type);
        break;
    case 3:
        #Подтверждение удаления
        $UI_CONFIG = new ui_config_general_stat('class_stat');
        confim_delete_sub_class_object($_POST);
        break;
    case 4:
        #Delete
        $UI_CONFIG = new ui_config_general_stat('class_stat');
        nc_print_status(REPORTS_STAT_CLASS_CLEARED, 'ok');
        show_form_for_select($type);
        nc_list_class_use($a, $type);
        require_once $INCLUDE_FOLDER . "s_files.inc.php";
        if ($sub_class) {
            $del_sub_class = explode(',', $sub_class);
        }
        foreach ($del_sub_class as $v) {
            SubClassClear((int) $v);
        }
        break;
}
EndHtml();