Пример #1
0
            $a->generate_auto = false;
            $db = DB::instance();
            if (isset($rc[4])) {
                $Page->content(h::{'p.cs-test-result'}($db->test([$rc[3], $rc[4]]) ? $L->success : $L->failed));
            } elseif (isset($rc[3])) {
                $Page->content(h::{'p.cs-test-result'}($db->test([$rc[3]]) ? $L->success : $L->failed));
            } else {
                $Page->content(h::{'p.cs-test-result'}($db->test($_POST['db']) ? $L->success : $L->failed));
            }
    }
} else {
    $test_dialog = true;
    $db_list = [];
    $databases = $Config->db;
    if (!empty($databases)) {
        foreach ($databases as $i => &$db_data) {
            $db_list[] = [[[h::{'a.cs-button-compact'}([h::icon('plus'), ['href' => "{$a->action}/add/{$i}", 'data-title' => "{$L->add} {$L->mirror} {$L->of_db}"]], $i ? [h::icon('pencil'), ['href' => "{$a->action}/edit/{$i}", 'data-title' => "{$L->edit} {$L->db}"]] : false, $i ? [h::icon('trash-o'), ['href' => "{$a->action}/delete/{$i}", 'data-title' => $L->delete . ' ' . $L->db]] : false, [h::icon('signal'), ['onMouseDown' => "cs.db_test('{$a->action}/test/{$i}', true);", 'data-title' => $L->test_connection]]), ['class' => 'cs-left-all']], $i ? $db_data['host'] : $Core->db_host, $i ? $db_data['type'] : $Core->db_type, $i ? $db_data['prefix'] : $Core->db_prefix, $i ? $db_data['name'] : $Core->db_name, $i ? $db_data['user'] : '******', $i ? $db_data['charset'] : $Core->db_charset], ['class' => $i ? '' : 'text-primary']];
            foreach ($Config->db[$i]['mirrors'] as $m => &$mirror) {
                if (is_array($mirror) && !empty($mirror)) {
                    $db_list[] = [[h::{'a.cs-button-compact'}([h::icon('pencil'), ['href' => "admin/System/{$rc['0']}/{$rc['1']}/edit/{$i}/{$m}", 'data-title' => "{$L->edit} {$L->mirror} {$L->of_db}"]], [h::icon('trash-o'), ['href' => "admin/System/{$rc['0']}/{$rc['1']}/delete/{$i}/{$m}", 'data-title' => "{$L->delete} {$L->mirror} {$L->of_db}"]], [h::icon('signal'), ['onMouseDown' => "cs.db_test('{$a->action}/test/{$i}/{$m}', true);", 'data-title' => $L->test_connection]]), ['class' => 'cs-right-all']], $mirror['host'], $mirror['type'], $mirror['prefix'], $mirror['name'], $mirror['user'], $mirror['charset']];
                }
            }
            unset($m, $mirror);
        }
        unset($i, $db_data);
    }
    unset($databases);
    $a->content(h::{'table.cs-table'}(h::{'thead tr th'}($L->action, $L->db_host, $L->db_type, $L->db_prefix, $L->db_name, $L->db_user, $L->db_charset) . h::tbody(h::{'tr| td'}([$db_list]))) . h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}([[h::info('db_balance'), h::{'input[type=radio]'}(['name' => 'core[db_balance]', 'checked' => $Config->core['db_balance'], 'value' => [0, 1], 'in' => [$L->off, $L->on]])], [h::info('maindb_for_write'), h::{'input[type=radio]'}(['name' => 'core[maindb_for_write]', 'checked' => $Config->core['maindb_for_write'], 'value' => [0, 1], 'in' => [$L->off, $L->on]])]]) . h::{'p a.cs-button'}($L->add_database, ['href' => "admin/System/{$rc['0']}/{$rc['1']}/add"]) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => 'config']));
}
$test_dialog && $a->content(h::{'div#cs-db-test.uk-modal div'}(h::h3($L->test_connection) . h::div()));
Пример #2
0
 /**
  *
  */
 public function toHtml(array $params = array(), array $innerCallbacks = array())
 {
     require_once 'lib/lib.htmlgen.php';
     $o = $this;
     //h::li(function () use ($o, $params, $innerCallbacks) {
     h::li(array('id' => $o->getInternalId()), function () use($o, $params, $innerCallbacks) {
         h::div(array('class' => 'builderElementLine'), function () use($o, $params) {
             h::h3($params['title']);
             /*
                       h::div(array('class' => 'builderElementActionItems'), function() use ($o) {
                         if ($o->isEditable()) {
                           h::a('Details', '#', array('class' => 'btn details'));
                         }
                         if ($o->isDeletable()) {
                           h::a('Delete', '#', array('class' => 'delete btn danger'));
                         }
                       });*/
         });
         h::div(array('class' => 'popover builderElementPopover right'), function () use($o, $params, $innerCallbacks) {
             h::div(array('class' => 'arrow'));
             h::div(array('class' => 'inner'), function () use($o, $params, $innerCallbacks) {
                 h::h3(array('class' => 'title'), function () use($o, $params) {
                     h::div(array('class' => 'actualTitle'), 'Details for ' . $params['title']);
                 });
                 h::div(array('class' => 'content'), function () use($o, $innerCallbacks) {
                     h::form(array('class' => 'form', 'action' => ''), function () use($o, $innerCallbacks) {
                         h::fieldset(function () use($o, $innerCallbacks) {
                             $params = array('help' => "Uncheck this if you don't want this task to execute at all.", 'label' => 'Active?', 'name' => 'active', 'checked' => $o->isActive());
                             $o->getHtmlInputCheckbox($params);
                             foreach ($innerCallbacks as $cb) {
                                 //
                                 // Filesets are special cases, because we might need to
                                 // iterate on more than one (in the future)
                                 //
                                 if ($cb['cb'] == 'getFilesets') {
                                     if ($o->getFilesets()) {
                                         $filesets = $o->getFilesets();
                                         foreach ($filesets as $fileset) {
                                             $fileset->toHtml();
                                         }
                                     }
                                     //
                                     // Normal to-HTML callbacks
                                     //
                                 } else {
                                     call_user_func(array($o, $cb['cb']), $cb);
                                 }
                             }
                             h::div(array('class' => 'actions'), function () {
                                 h::input(array('type' => 'submit', 'class' => 'btn', 'value' => 'Nothing to save', 'disabled' => 'disabled'));
                                 h::button(array('class' => 'btn delete danger'), 'Delete');
                             });
                         });
                     });
                 });
             });
         });
     });
     //});
 }
Пример #3
0
    $groups[$c['group']]['categories'][] = $c['id'];
}
$categories = $categories_;
unset($categories_, $c);
$Page->js('cs.home = ' . _json_encode(['categories' => $categories, 'reporter' => in_array(STREAMER_GROUP, $User->get_groups() ?: []) ? _json_encode($User->get_data('stream_url') ?: 1) : 0, 'automaidan' => (int) in_array(AUTOMAIDAN_GROUP, $User->get_groups() ?: []), 'automaidan_coord' => (int) in_array(AUTOMAIDAN_COORD_GROUP, $User->get_groups() ?: [])]) . ';', 'code');
$Index = Index::instance();
if (isset($Index->route_ids[0])) {
    $event = Events::instance()->get($Index->route_ids[0]);
    if ($event) {
        $Page->Description = 'Додано: ' . date('H:i d.m.Y', $event['added']);
        if ($event['timeout'] > 0) {
            $Page->Description .= ' Актуально до: ' . date('H:i d.m.Y', $event['timeout']);
        }
        if ($event['img']) {
            $Page->replace('https://opir.org/components/modules/Home/includes/img/share.png', $event['img']);
        }
        if (strpos($event['text'], 'stream:') === false) {
            $Page->Description .= ' ' . $event['text'];
        }
        $Page->og('title', array_column(Events_categories::instance()->get_all(), 'name', 'id')[$event['category']]);
    }
    unset($event);
}
$Page->content(h::{'aside.cs-home-add-panel'}() . h::{'aside.cs-home-events-stream-panel'}() . (!in_array(AUTOMAIDAN_COORD_GROUP, $User->get_groups() ?: []) ? h::{'aside.cs-home-settings-panel'}(h::{'a.cs-app-store[target=_blank]'}('App Store', ['href' => 'https://itunes.apple.com/in/app/opir/id828565038']) . h::{'div.cs-hot-line'}(h::h3('Гаряча лінія:') . '+38 050 258 17 05<br><small>(медичні питання)</small><br>+38 050 258 17 43<br><small>(координація самооборони)</small><br>+38 093 01 222 11<br><small>(інше)</small>') . h::{'input.cs-home-address-search'}(['placeholder' => 'Пошук адреси на карті']) . h::h2('Фільтр') . h::{'div.cs-home-added-tags[level=0]'}() . h::{'input.cs-home-filter-tags'}(['placeholder' => 'Фільтр по адресі']) . h::{'div.cs-home-found-tags[level=0]'}() . h::{'ul.cs-home-filter-category li'}(array_map(function ($g) use($categories) {
    $return = [[h::h2($g['name']), ['data-group' => $g['id']]]];
    foreach ($g['categories'] as $c) {
        $c = $categories[$c];
        $return[] = [h::img(['src' => "components/modules/Home/includes/img/{$c['id']}.png"]) . h::span($c['name']), ['data-id' => $c['id'], 'data-group' => $g['id']]];
    }
    return $return;
}, array_values($groups)))) : h::{'aside.cs-home-settings-coordinator'}(h::h2('Фільтр') . h::{'div.all'}())) . h::{'div.cs-home-events-stream.uk-icon-chevron-left'}() . h::{'div.cs-home-settings.uk-icon-chevron-right'}());