Exemplo n.º 1
0
if ($pattern != '') {
    $where[] = '"name" LIKE \'%' . db_class::escape_like($pattern) . '%\'';
    $letter = '';
} elseif ($letter != '') {
    $where[] = '"name" LIKE \'' . db_class::escape_like($letter) . '%\' OR  "name" LIKE \'' . db_class::escape_like(_strtoupper($letter)) . '%\' ';
}
if ($save) {
    if ($_REQUEST['io_id'] > 0 && $_REQUEST['cat_id'] > 0) {
        $io_rub = new io_rubricator();
        $io_rub->id_rubric = $_REQUEST['cat_id'];
        $io_rub->id_io_object = $io_id;
        $io_rub->Save();
    }
}
if ($_REQUEST['cat_id'] > 0) {
    $rubricator = new rubricator();
    $rubricator->id = $_REQUEST['cat_id'];
    $rubricator->Load();
    $db = db_class::get_instance();
    $query = 'SELECT id_io_object as id FROM ' . TABLE_IO_RUBRICATOR . ' WHERE id_rubric=' . $rubricator->id;
    $db->query($query);
    $id = '';
    for ($i = 0; $i < count($db->value); $i++) {
        $id = $db->value[$i]['id'];
        $where[] = " ID !=" . $id;
    }
    if ($rubricator->id_io_category > 0) {
        $where[] = 'id_io_category = ' . $rubricator->id_io_category . ' ';
    }
}
$contact_persons = new collection();
Exemplo n.º 2
0
<?php

$page_title = 'Изменение рубрики';
$id = intval(get_request_variable('id', 0));
$parent_id = intval(get_request_variable('parent_id', 0));
$_REQUEST['callback'] = get_request_variable('callback', '');
$rubricator = new rubricator();
$rubricator->id = $id;
if ($id > 0) {
    if ($rubricator->Load()) {
        if ($parent_id === 0) {
            $parent_id = null;
        }
        $rubricator->id_parent = $parent_id;
        $errors = $department->IsValidData();
        if (!$errors) {
            $rubricator->Save();
        }
    }
}
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';
Exemplo n.º 3
0
<?php

$page_title = 'Удаление рубрики';
$errors = array();
$id = intval(get_request_variable('id', 0));
$_REQUEST['callback'] = get_request_variable('callback', '');
$rubricator = new rubricator();
$rubricator->id = $id;
if ($id > 0) {
    if ($rubricator->Load()) {
        $errors = $rubricator->IsValidData();
        if (!$errors) {
            $rubricator->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';
Exemplo n.º 4
0
<?php

$page_title = 'Редактирование рубрики';
$id = intval(get_request_variable('id', ''));
$parent_id = intval(get_request_variable('parent_id', 0));
$io_id = intval(get_request_variable('io_id', 0));
$kio = get_request_variable('kio', '');
$code = get_request_variable('code', '');
$description = get_request_variable('description', '');
$name = get_request_variable('name', '');
$save = get_request_variable('save', '');
$_REQUEST['callback'] = get_request_variable('callback', '');
$cat_id = intval(get_request_variable('cat_id', 0));
$templ_id = intval(get_request_variable('templ_id', 0));
$rubricator = new rubricator();
$rubricator->id = $id;
if ($id > 0) {
    if (!$rubricator->Load()) {
        $rubricator->id = 0;
    }
}
/*$io_rubric = new collection();
if($rubricator->id > 0)
{
	$io_rubric->Load(TABLE_IO_RUBRICATOR, false, 'id_rubric = '.$rubricator->id);
	$io_rubric = $io_rubric->_collection;
	
	//add new io object to rubrics
	if($io_id > 0)
	{
		$io_rub = new io_rubricator();	
Exemplo n.º 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':
        $rubricator = new rubricator();
        $rubricator->id = null;
        $childs = $rubricator->ChildExists();
        echo '<item text="Рубрики:" id="folder-0" child="' . ($childs ? 1 : 0) . '"></item>';
        break;
    case 'folder':
        $type_collection = new collection();
        $type_collection->Load(TABLE_RUBRICATOR, false, $type_id > 0 ? 'id_parent=' . $type_id : 'id_parent IS NULL AND id_io_object IS NULL', 'name ASC');
        $rubricator = new rubricator();
        for ($i = 0; $i < count($type_collection->_collection); $i++) {
            $rubricator->id = $type_collection->_collection[$i]->id;
            $rubricator->Load();
            $childs = $rubricator->ObjectExists();
            if (!$childs) {
                $childs = $rubricator->ChildExists();
            }
            echo '<item child="' . ($childs ? 1 : 0) . '" id="folder-' . $rubricator->id . '" text="' . escape($type_collection->_collection[$i]->name) . '" im0="folderOpen.gif" im1="folderOpen.gif" im2="folderClosed.gif">';
            if ($rubricator->ObjectExists()) {
                if ($type_id > 0) {
                    $agr_collection = new collection();
                    $agr_collection->Load(TABLE_IO_RUBRICATOR, false, 'id_rubric=' . $rubricator->id, 'id_rubric ASC');
                    for ($k = 0; $k < count($agr_collection->_collection); $k++) {
                        $io_object = new io_objects();
                        $io_object->id = $agr_collection->_collection[$k]->id_io_object;