/** * */ 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'); }); }); }); }); }); }); }); //}); }
/** * Module page generation, menus rendering, blocks processing, adding of form with save/apply/cancel/reset and/or custom users buttons */ protected function generate() { $Config = Config::instance(); $L = Language::instance(); $Page = Page::instance(); if ($this->api) { $Page->content($this->Content); return; } $this->main_menu_auto && $this->main_menu(); $this->main_sub_menu_auto && $this->main_sub_menu(); $this->main_menu_more_auto && $this->main_menu_more(); $this->blocks_processing(); if ($this->form) { $Page->content(h::form($this->Content . ($this->apply_button && $this->buttons ? h::button($L->apply, ['name' => 'edit_settings', 'data-title' => $L->apply_info, 'id' => 'apply_settings', 'type' => 'submit', 'value' => 'apply', 'add' => Cache::instance()->cache_state() ? '' : ' disabled']) : '') . ($this->save_button && $this->buttons ? h::button($L->save, ['name' => 'edit_settings', 'data-title' => $L->save_info, 'id' => 'save_settings', 'type' => 'submit', 'value' => 'save']) : '') . ($this->apply_button && $this->buttons || $this->cancel_button_back ? h::button($L->cancel, ['name' => 'edit_settings', 'id' => 'cancel_settings', 'value' => 'cancel', 'data-title' => $this->cancel_button_back ? false : $L->cancel_info, 'type' => $this->cancel_button_back ? 'button' : 'submit', 'onClick' => $this->cancel_button_back ? 'history.go(-1);' : false, 'add' => $this->cancel_button_back ? '' : (isset($Config->core['cache_not_saved']) ? '' : $this->cancel_button)]) : '') . ($this->buttons && $this->reset_button ? h::button($L->reset, ['id' => 'reset_settings', 'data-title' => $L->reset_info, 'type' => 'reset']) : '') . $this->post_buttons, array_merge(['enctype' => $this->file_upload ? 'multipart/form-data' : false, 'action' => $this->action], $this->form_atributes))); } elseif ($this->Content) { $Page->content($this->Content); } }
<?php /** * @package CleverStyle CMS * @subpackage System module * @category modules * @author Nazar Mokrynskyi <*****@*****.**> * @copyright Copyright (c) 2011-2014, Nazar Mokrynskyi * @license MIT License, see license.txt */ namespace cs\modules\System; use h, cs\Config, cs\Cache, cs\Index, cs\Language; $Config = Config::instance(); $L = Language::instance(); $sa = $Config->core['simple_admin_mode']; Index::instance()->content(h::{'table.cs-table-borderless.cs-left-even.cs-right-odd tr| td'}(core_input('gzip_compression', 'radio', null, zlib_compression()), core_input('cache_compress_js_css', 'radio'), core_input('put_js_after_body', 'radio'), !$sa ? core_input('inserts_limit', 'number', null, false, 1) : false, !$sa ? core_input('update_ratio', 'number', null, false, 0, 100) : false, [h::{'div#clean_cache'}(), h::{'div#clean_pcache'}()], [h::button($L->clean_settings_cache, Cache::instance()->cache_state() ? ['onMouseDown' => "cs.admin_cache('#clean_cache', '{$Config->base_url()}/api/System/admin/cache/clean_cache');"] : ['disabled']), h::button($L->clean_scripts_styles_cache, $Config->core['cache_compress_js_css'] ? ['onMouseDown' => "cs.admin_cache('#clean_pcache', '{$Config->base_url()}/api/System/admin/cache/clean_pcache');"] : ['disabled'])]));
switch ($rc[2]) { case 'add': case 'edit': if ($rc[2] == 'edit' && isset($rc[3])) { $storage =& $Config->storage[$rc[3]]; } /** * @var array $storage */ $a->action = "admin/System/{$rc['0']}/{$rc['1']}"; $Page->title($rc[2] == 'edit' ? $L->editing_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']) : $L->adding_of_storage); $a->content(h::{'p.lead.cs-center'}($rc[2] == 'edit' ? $L->editing_of_storage($Config->storage[$rc[3]]['host'] . '/' . $Config->storage[$rc[3]]['connection']) : $L->adding_of_storage) . h::{'table.cs-table-borderless.cs-center-all tr'}(\cs\modules\System\form_rows_to_cols([array_map(function ($in) { return h::{'th info'}($in); }, ['storage_url', 'storage_host', 'storage_connection', 'storage_user', 'storage_pass']), array_map(function ($in) { return h::td($in); }, [h::input(['name' => 'storage[url]', 'value' => $rc[2] == 'edit' ? $storage['url'] : '']), h::input(['name' => 'storage[host]', 'value' => $rc[2] == 'edit' ? $storage['host'] : '']), h::select(['in' => _mb_substr(get_files_list(ENGINES . '/Storage', '/^[^_].*?\\.php$/i', 'f'), 0, -4)], ['name' => 'storage[connection]', 'selected' => $rc[2] == 'edit' ? $storage['connection'] : '', 'size' => 5]), h::input(['name' => 'storage[user]', 'value' => $rc[2] == 'edit' ? $storage['user'] : '']), h::input(['name' => 'storage[password]', 'value' => $rc[2] == 'edit' ? $storage['password'] : '']) . h::{'input[type=hidden]'}(['name' => 'mode', 'value' => $rc[2] == 'edit' ? 'edit' : 'add']) . (isset($rc[3]) ? h::{'input[type=hidden]'}(['name' => 'storage_id', 'value' => $rc[3]]) : '')])])) . h::button($L->test_connection, ['onMouseDown' => "cs.storage_test('{$a->action}/test');"])); break; case 'delete': $a->buttons = false; $modules = []; foreach ($Config->components['modules'] as $module => &$mdata) { if (isset($mdata['storage']) && is_array($mdata['storage'])) { foreach ($mdata['storage'] as $storage_name) { if ($storage_name == $rc[3]) { $modules[] = h::b($module); break; } } } } unset($module, $mdata, $storage_name);