Example #1
0
<?php

header("Content-type:text/xml");
$id = get_request_variable('id', 'root');
if ($id != 'root') {
    $id = intval($id);
}
$db = db_class::get_instance();
if ($id === 0) {
    echo '<?xml version="1.0" ?>' . "\n";
}
if ($id === 'root') {
    $categories = new io_categories();
    $categories->id = null;
    $childs = $categories->ChildExists();
    echo '<tree id="root">' . "\n";
    echo '<item text="ККС СИТО" id="0" child="' . ($childs ? 1 : 0) . '"></item>';
    echo '</tree>' . "\n";
} else {
    $type_collection = new collection();
    $type_collection->Load(TABLE_CATEGORIES, false, $id > 0 ? 'id=' . $id . ' AND is_main=TRUE' : 'is_main=TRUE', ' name ASC');
    echo '<tree id="' . $id . '">' . "\n";
    for ($i = 0; $i < count($type_collection->_collection); $i++) {
        $childs = $type_collection->_collection[$i]->ChildExists();
        if ($id == 0) {
            echo '<item child="' . ($childs ? 1 : 0) . '" id="' . $type_collection->_collection[$i]->id . '" text="' . escape($type_collection->_collection[$i]->name) . '" im0="folderOpen.gif" im1="folderOpen.gif" im2="folderClosed.gif">';
        }
        if ($childs == true) {
            $child = $type_collection->_collection[$i]->id_child;
            if ($child > 0 && $id > 0) {
                $type_coll = new collection();
Example #2
0
$enable_sort_fields = array('id');
//get table name
$id = intval(get_request_variable('id', 0));
$records = array();
$attr_types = array();
if ($id > 0) {
    $io_object = new io_objects();
    $io_object->id = $id;
    $table_name = '';
    if ($id > 0) {
        if (!$io_object->Load()) {
            $io_object->id = 0;
        } else {
            $table_name = $io_object->table_name;
            $parent_category = new io_categories();
            $parent_category->id = $io_object->id_io_category;
            if (!$parent_category->Load()) {
                $errors[] = "Can't get category!!!";
            }
        }
    }
}
if ($parent_category->id_child > 0) {
    $db = db_class::get_instance();
    $query = 'SELECT * FROM cgetcategoryattrs(' . $parent_category->id_child . ');';
    // echo $query;
    $db->query($query);
    $data = array();
    $attr_title = array();
    $attr_ids = array();
Example #3
0
<?php

$id = intval(get_request_variable('id', 0));
$parent_id = intval(get_request_variable('parent_id', 0));
$kio_id = get_request_variable('kio_id', 0);
$id_child = get_request_variable('id_child', 0);
$is_main = get_request_variable('is_main', 0);
$is_system = get_request_variable('is_system', 'FALSE');
$name = get_request_variable('name', '');
$code = get_request_variable('code', '');
$description = get_request_variable('description', '');
$save = get_request_variable('save', '');
$_REQUEST['callback'] = get_request_variable('callback', '');
$db = db_class::get_instance();
$category = new io_categories();
$category->id = $id;
if ($id > 0) {
    if (!$category->Load()) {
        $category->id = 0;
    }
}
if ($save && $kio_id > 0) {
    $category->is_system = $is_system;
    //
    $category->is_main = $is_main;
    //
    $category->id_child = $id_child;
    //
    $category->id_io_type = $kio_id;
    $category->name = $name;
    $category->code = $code;
Example #4
0
<?php

$page_title = 'Удаление категории';
$errors = array();
$id = intval(get_request_variable('id', 0));
$_REQUEST['callback'] = get_request_variable('callback', '');
$cat = new io_categories();
$cat->id = $id;
if ($id > 0) {
    if ($cat->Load()) {
        $errors = $cat->IsValidData();
        if (!$errors) {
            $cat->Delete();
        }
    }
}
include SITE_FILE_ROOT . 'template/simple_header.php';
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/' . $STORAGE['action'] . '.php';
include SITE_FILE_ROOT . 'template/simple_footer.php';
Example #5
0
}
$type_id = intval($type_id);
$db = db_class::get_instance();
echo '<?xml version="1.0" ?>' . "\n";
echo '<tree id="' . $id . '">' . "\n";
switch ($type) {
    case 'root':
        $categories = new io_categories();
        $categories->id = null;
        $childs = true;
        echo '<item text="Категории и шаблоны:" id="folder-0" child="' . ($childs ? 1 : 0) . '"></item>';
        break;
    case 'folder':
        $type_collection = new collection();
        $type_collection->Load(TABLE_CATEGORIES, false, $type_id > 0 ? 'id=' . $type_id : 'is_main = TRUE', 'name ASC');
        $cat = new io_categories();
        for ($i = 0; $i < count($type_collection->_collection); $i++) {
            if ($type_id <= 0) {
                $cat->id = $type_collection->_collection[$i]->id;
            } else {
                $cat->id = $type_collection->_collection[$i]->id_child;
            }
            $cat->Load();
            $childs = $cat->ChildExists();
            if ($cat->id > 0) {
                echo '<item child="' . ($childs ? 1 : 0) . '" id="folder-' . $cat->id . '" text="' . escape($cat->name) . '" im0="folderOpen.gif" im1="folderOpen.gif" im2="folderClosed.gif">';
                echo '</item>';
            }
        }
        break;
}