foreach ($groupids as $groupid) {
     $group = API::HostGroup()->get(array('groupids' => $groupid, 'output' => API_OUTPUT_EXTEND));
     array_push($groupNames, $group[0]['name']);
 }
 if (!zbx_empty($_REQUEST['newgroup'])) {
     # new group
     $response = addRack($_REQUEST['newgroup']);
     if (isset($response['error'])) {
         show_messages(false, '', 'Updating racktables rack ' . $_REQUEST['newgroup'] . ' is failed');
     }
     array_push($groupNames, $_REQUEST['newgroup']);
 }
 $response = array();
 $operate = '';
 if ($createNew) {
     $response = addObject($_REQUEST['host'], $groupNames, $_REQUEST['status']);
     $operate = "Updating";
 } else {
     $response = updateObject($hostOld['host'], $_REQUEST['host'], $groupNames, $_REQUEST['status']);
     $operate = "Adding";
 }
 if (isset($response['error'])) {
     show_messages(false, '', $operate . " racktables object is failed. Error message:" . $response['error']);
 } else {
     $response = updateObjectIP($_REQUEST['host'], $interfaces);
     if (isset($response['error'])) {
         show_messages(false, '', $operate . " racktables object is failed. Error message:" . $response['error']);
     }
 }
 ##############################################################################################
 if ($createNew) {
Example #2
0
function createObject($node = NULL, $hasBack = FALSE, $useStackObjects = FALSE)
{
    static $level = 0;
    if (!$node) {
        $node = My_Test::create();
        $level = 0;
    }
    if (++$level > C('test.max-levels')) {
        return $node;
    }
    if (rand(0, 100) < C('test.object-propability')) {
        addObject($node);
    } else {
        addText($node);
    }
    return $hasBack && rand(0, 100) < C('test.comeback-propability') ? $node : createObject($node);
}
Example #3
0
    }
    unset($post_date["main_form_submit"]);
    addObject($post_date, $bd);
    header("Location: {$location}");
    exit;
}
//варианты действий при получении данных в GET
if (isset($_GET['id_del'])) {
    //удаление объявления id из БД с ID = $id_del
    $id_del = $_GET['id_del'];
    Advertisement::sql_DELETE($bd, $id_del);
}
//подключение таблицы заполненных форм
$announcements_massiv = $bd->select("select *,id AS ARRAY_KEY  from form");
foreach ($announcements_massiv as $key => $value) {
    addObject($value, $bd);
}
$repository = RepositoryAds::getinstance();
//подключение к хранилищу
$announcementsObgect = $repository->repositoryGet();
//извлечение массива с объектами объявлений из хранилища
//var_dump($announcementsObgect);
//var_dump($writer);
if (isset($_GET['id'])) {
    // передача переменных в шаблон
    $id = $_GET['id'];
    if (isset($announcementsObgect[$id])) {
        $smarty->assign('announcements_show', $announcementsObgect[$id]);
        $smarty->assign('save', 'Сохранить изменения');
    }
}
****************************************************************************/
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$section = db_get_row("SELECT * FROM ?:settings_sections WHERE name = 'bestsellers'");
if (empty($section)) {
    db_query("INSERT INTO ?:settings_sections (edition_type, name, type) VALUES ('ROOT,ULT:VENDOR', 'bestsellers', 'ADDON');");
}
$section = db_get_row("SELECT * FROM ?:settings_sections WHERE name = 'bestsellers'");
if ($section) {
    db_query("INSERT INTO ?:settings_sections (parent_id, edition_type, name, type) VALUES (" . $section['section_id'] . ", 'ROOT,ULT:VENDOR', 'general', 'TAB');");
    db_query("INSERT INTO ?:settings_sections (parent_id, edition_type, name, type) VALUES (" . $section['section_id'] . ",'ROOT,ULT:VENDOR', 'newest', 'TAB');");
    $tab_general = db_get_row("SELECT * FROM ?:settings_sections WHERE name = 'general' AND parent_id = " . $section['section_id']);
    $tab_newest = db_get_row("SELECT * FROM ?:settings_sections WHERE name = 'newest' AND parent_id = " . $section['section_id']);
    addObject('final_sale_from', $section['section_id'], $tab_general['section_id'], 'I', 40, 0);
    addObject('sales_amount_from', $section['section_id'], $tab_general['section_id'], 'I', 1, 10);
    addObject('period', $section['section_id'], $tab_newest['section_id'], 'S', 'all', 0);
    addObject('last_days', $section['section_id'], $tab_newest['section_id'], 'I', '3', 10);
    $object_period = db_get_row("SELECT * FROM ?:settings_objects WHERE name = 'period' AND section_id = " . $section['section_id'] . " AND section_tab_id = " . $tab_newest['section_id']);
    addVariant($object_period['object_id'], 'all', 0);
    addVariant($object_period['object_id'], 'today', 10);
    addVariant($object_period['object_id'], 'last_days', 20);
}
function addObject($name, $section_id, $tab, $type, $value, $pos)
{
    db_query("INSERT INTO ?:settings_objects (edition_type, name, section_id, section_tab_id, type, value, position, is_global, handler, parent_id) VALUES" . "('ROOT,ULT:VENDOR','" . $name . "', " . $section_id . ", " . $tab . ", '" . $type . "', '" . $value . "', " . $pos . ", 'N', '', 0);");
}
function addVariant($object_id, $name, $position)
{
    db_query("INSERT INTO ?:settings_variants (object_id, name, position) VALUES" . "(" . $object_id . ",'" . $name . "', " . $position . ");");
}