/** * Show the extended profile, or the edit form */ public function show() { if ($this->editable) { parent::show(); } else { $this->showSections(); } }
/** * Default dispatcher * * @param string $action * @param string $subaction */ public function index($action = '') { template('Install/templates/header')->show('info'); new Menu_Tabs(array('name' => 'install', 'render' => 'content', 'elements' => array(array('label' => t('1. Начало'), 'link' => '', 'active' => check_route('install$')), array('label' => t('2. Проверка'), 'link' => '', 'active' => check_route('check$')), array('label' => t('3. Настройки'), 'link' => '', 'active' => check_route('site$')), array('label' => t('4. Завершение'), 'link' => '', 'active' => check_route('finish$'))))); switch ($action) { case 'check': $tpl = new Template('Install/templates/check'); $tpl->show(); break; case 'site': append('content', '<p class="alert alert-info">' . t('Определите базовые настройки сайта.') . '</p>'); $form = new Form('Install/forms/site'); if ($result = $form->result()) { $site = new Config(SITE . DS . 'site' . EXT); $config = new Config(SITE . DS . 'config' . EXT); $config->site->name = $result->sitename; $site->key or $site->key = md5(md5(time()) + time() + $site->site->name); $result->port or $result->port = 3306; $site->database = array('driver' => config('database.driver'), 'host' => $result->host, 'base' => $result->base, 'user' => $result->user, 'pass' => $result->pass, 'port' => $result->port, 'prefix' => $result->prefix); $db = Db::factory('temp', $site->database); if (!$db->connect()) { if ($result->create_db && $db->connect(FALSE)) { $db->query("CREATE DATABASE `{$site->database->base}` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;\n CREATE USER '{$site->database->user}'@'{$site->database->host}' IDENTIFIED BY '{$site->database->pass}';\n GRANT ALL ON `{$site->database->base}`.* TO '{$site->database->user}'@'localhost';\n FLUSH PRIVILEGES;"); } $db->connect(); } if ($db->is_connected) { $site->store(TRUE); $config->store(TRUE); if ($db->import($this->dir . DS . 'cogear.sql', $site->database->prefix)) { redirect(l('/install/finish')); } } else { error(t("Не удалось установить подключение к базе данных."), '', 'content'); } } else { $form->save->label = t('Попробуйте снова'); } $form->show(); break; case 'finish': $tpl = new Template('Install/templates/finish'); $tpl->show(); break; case 'done': // $site = new Config(SITE . DS . 'site' . EXT); // $site->store(TRUE); flash_success(t('Ваш сайт успешно настроен! <p> Данные для входа – логин <b>admin</b> и пароль <b>password</b>.'), '', 'info'); $this->disable(); redirect(); break; default: case 'welcome': $tpl = new Template('Install/templates/welcome'); $tpl->show(); } }
/** * Настройки */ public function admin_action() { $form = new Form(array('#name' => 'admin.parser', 'title' => array('label' => t('Настройки')), 'nl2br' => array('type' => 'checkbox', 'label' => t('Автоматическая обработка строк'), 'value' => config('Parser.nl2br')), 'save' => array())); if ($result = $form->result()) { $this->set('Parser.nl2br', $result->nl2br); flash_success(t('Настройки сохранены!')); reload(); } $form->show(); }
/** * Панель управления */ public function admin_action() { $this->theme->hookAdminMenu(); $form = new Form(array('#name' => 'admin.bootstrap', 'title' => array('label' => icon('wrench') . ' ' . t('Настройки')), 'theme' => array('type' => 'select', 'label' => t('Выберите тему'), 'values' => array('default' => t('Стандартная'), 'amelia' => 'Amelia', 'cerulean' => 'Cerulean', 'cosmo' => 'Cosmo', 'cyborg' => 'Cyborg', 'journal' => 'Journal', 'readable' => 'Readable', 'simplex' => 'Simplex', 'slate' => 'Slate', 'spacelab' => 'Spacelab', 'spruce' => 'Spruce', 'superhero' => 'Superhero', 'united' => 'United'), 'value' => config('bootstrap.theme', 'default')), 'save' => array())); if ($result = $form->result()) { $this->set('bootstrap.theme', $result->theme); flash_success(t('Настройки сохранены успешно!')); reload(); } $form->show(); }
/** * Настройки */ public function settings() { $form = new Form(array('#name' => 'widget.html', 'content' => array('type' => 'editor', 'validate' => array('Required'), 'value' => $this->options->content), 'actions' => array('#class' => 'form-actions', 'save' => array()))); if ($result = $form->result()) { $this->options->title = $result->title; $this->options->content = $result->content; if ($this->save()) { return TRUE; } } $form->show(); }
function showFullname() { $fp = new Text($this->getPath(), 3, true); $btnDel = new Button("clearLog", "Log leeren"); $hdnDel = new Hiddenfield("clearLogFile", $this->FULLPATH); $frmDel = new Form(); $tblTtl = new Table(array("", "")); $tblTtl->setColSizes(array(null, 100)); $tblTtl->setAlignments(array("left", "right")); $rTtl = $tblTtl->createRow(); $rTtl->setAttribute(0, $fp); $rTtl->setAttribute(1, $btnDel); $tblTtl->addRow($rTtl); $frmDel->add($tblTtl); $frmDel->add($hdnDel); $frmDel->show(); }
/** * Настройки */ public function settings() { $handler = menu(); $menus = array(); if ($result = $handler->findAll()) { foreach ($result as $menu) { $menus[$menu->id] = $menu->name; } } $form = new Form(array('#name' => 'widget.menu', 'id' => array('type' => 'select', 'validate' => array('Required'), 'label' => t('Выберите меню'), 'value' => $this->options->id, 'values' => $menus), 'actions' => array('#class' => 'form-actions', 'save' => array()))); if ($result = $form->result()) { $this->options->id = $result->id; if ($this->save()) { return TRUE; } } $form->show(); }
/** * Show comment post form * * @param object $Page */ public function showForm($Page) { if (access('comments post')) { $form = new Form('Comments.add'); if ($result = $form->result()) { $comment = new Comments_Object(); $comment->pid = $Page->id; $comment->aid = $this->user->id; $comment->created_date = time(); $comment->body = $result->body; $comment->ip = $this->session->ip; if ($comment->save()) { $Page->comments = $this->db->where('pid', $Page->id)->count('comments'); $Page->save(); flash_success(t('Your comment has been successfully posted!')); redirect($Page->getUrl()); } } $form->show(); } }
/** * Настройки */ public function settings() { $form = new Form(array('#name' => 'widget.pages.list', 'root' => array('type' => 'select', 'validate' => array('Required'), 'value' => $this->options->root, 'values' => page()->getSelectValues(), 'label' => t('Выберите корневую страницу')), 'current' => array('type' => 'checkbox', 'label' => t('Использовать текущую страницу как корневую'), 'value' => $this->options->current), 'template' => array('type' => 'text', 'value' => $this->options->template, 'label' => t('Шаблон для вывода'), 'description' => t('Будьте внимательны! Указывайте только существующий шаблон во избежание ошибок.')), 'actions' => array('#class' => 'form-actions', 'save' => array()))); inline_js('$(document).ready(function(){ $("input[type=checkbox]").on("change",function(){ if($(this).attr("checked")){ $("#form-widget-pages-list-root").slideUp("fast"); } else { $("#form-widget-pages-list-root").slideDown("fast"); } }).trigger("change"); })'); if ($result = $form->result()) { $this->options->root = $result->root; $this->options->template = $result->template; $this->options->current = (bool) $result->current; if ($this->save()) { return TRUE; } } $form->show(); }
function getSearchMask() { $ft = new FontType(); $ft->setFontsize(2); $table = new Table(array("")); $table->setFonttypes(array($ft)); $table->setHeadEnabled(false); $table->setDesignJN("J"); $r = $table->createRow(); $r->setAttribute(0, new Text("Geben Sie hier ihren Suchbegriff ein")); $table->addRow($r); $r = $table->createRow(); $r->setAttribute(0, new Textfield("SuchString")); $table->addRow($r); $hidden = new Hiddenfield($this->TABLENAME . "SEARCH", "doSearch"); $form = new Form($_SERVER['SCRIPT_NAME']); $form->add($hidden); $form->add($table); $form->show(); }
/** * Импорт и экспорт */ public function tools_action() { $this->hookSiteSettingsMenu(); template('Admin/templates/tools')->show(); $form = new Form('Admin/forms/import'); if ($result = $form->result()) { if ($file = $result->file) { $zip = new Zip(array('file' => $file->path, 'check' => array('type' => 'config'))); if ($zip->extract(ROOT)) { success(t('<b>Архив успешно распакован!</b> Новый файл конфигурации установлен.')); } $zip->close(); unlink($file->path); } } $form->show(); }
function show() { if ($this->EDIT_MODE) { echo "<a href=\"?editControl=" . $this->ID . "\" style=\"position:absolute; left:" . $this->X . "px; top:" . ($this->Y + $_SESSION['additionalLayoutHeight']) . "px; width:" . $this->CONTROL_IMAGE_WIDTH . "px; height:" . $this->CONTROL_IMAGE_HEIGHT . "px;\">"; echo $this->getControlArtIconSrc(); echo "</a>"; } else { echo "<div style=\"position:absolute; left:" . $this->X . "px; top:" . ($this->Y + $_SESSION['additionalLayoutHeight']) . "px; width:" . $this->CONTROL_IMAGE_WIDTH . "px; height:" . $this->CONTROL_IMAGE_HEIGHT . "px;\">"; echo $this->getControlArtIconSrc(); if ($_SESSION['config']->PUBLICVARS['switchButtonsOnIconActive'] == "J") { $this->getSwitchButtons()->show(); } echo "</div>"; if ($this->DIMMER == "J") { $f = new Form(); $cobDimmLvl = new Combobox("dimmer", getNumberComboArray(1, 16), "", " "); $cobDimmLvl->setDirectSelect(true); $cobDimmLvl->setStyle("position", "absolute"); $cobDimmLvl->setStyle("left", $this->X . "px"); $cobDimmLvl->setStyle("top", $this->Y + $this->CONTROL_IMAGE_HEIGHT - 3 + $_SESSION['additionalLayoutHeight'] . "px"); $f->add($cobDimmLvl); $f->add(new Hiddenfield("schalte", $this->FUNK_ID)); $f->show(); } } }
public function show() { global $MAIN_ROOT, $hooksObj; $hooksObj->run($this->formName); uasort($this->components, array("Form", "sortForm")); $countRichTextbox = 0; $blnFileUploadForm = false; $displayForm = ""; $afterJS = $this->embedJS; foreach ($this->components as $componentName => $componentInfo) { $dispAttributes = $this->convertAttributes($componentInfo['attributes']); $displayForm .= $componentInfo['before_html']; // Output Component Name if ($componentInfo['display_name'] != "") { $dispToolTip = $componentInfo['tooltip'] != "" ? " <a href='javascript:void(0)' onmouseover=\"showToolTip('" . addslashes($componentInfo['tooltip']) . "')\" onmouseout='hideToolTip()'>(?)</a>" : ""; $displayForm .= "\n\t\t\t\t\t\t<label class='formLabel' style='display: inline-block'>" . $componentInfo['display_name'] . ":" . $dispToolTip . "</label>\t\t\n\t\t\t\t\t"; } // Output input switch ($componentInfo['type']) { case "autocomplete": $afterJS .= $this->autocompleteJS($componentInfo['options']['list'], $componentInfo['options']['real_id'], $componentInfo['options']['fake_id']); $fakeComponentName = "fake" . $componentName; $displayForm .= "<input type='text' name='" . $fakeComponentName . "' value='" . filterText($_POST[$fakeComponentName]) . "' " . $dispAttributes . " id='" . $componentInfo['options']['fake_id'] . "'><input type='hidden' name='" . $componentName . "' value='" . $componentInfo['value'] . "' id='" . $componentInfo['options']['real_id'] . "'>"; break; case "textarea": $displayForm .= "<textarea name='" . $componentName . "' " . $dispAttributes . ">" . $componentInfo['value'] . "</textarea>"; break; case "richtextbox": $afterJS .= $this->richTextboxJS($componentInfo['attributes']['id'], $componentInfo['allowHTML']); $displayForm .= "\n\t\t\t\t\t\t\t<div class='formInput' style='width: 100%'>\n\t\t\t\t\t\t\t\t<textarea name='" . $componentName . "' " . $dispAttributes . ">" . $componentInfo['value'] . "</textarea>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t"; $countRichTextbox++; unset($GLOBALS['richtextEditor']); break; case "codeeditor": $afterJS .= $this->codeEditorJS($componentInfo['attributes']['id']); $displayForm .= "\n\t\t\t\t\t\t\t<div style='background-color: white; position: relative; margin-top: 10px'><div id='" . $componentInfo['attributes']['id'] . "' class='codeEditor'>" . $componentInfo['value'] . "</div></div>\n\t\t\t\t\t\t\t<textarea id='" . $componentInfo['attributes']['id'] . "_code' name='" . $componentName . "' style='display: none'></textarea>\n\t\t\t\t\t\t"; break; case "datepicker": $datePick = new DateTime(); $datePick->setTimestamp($componentInfo['value'] / 1000); $datePick->setTimezone(new DateTimeZone("UTC")); $formatDatePick = $datePick->format("n-j-Y"); $afterJS .= $this->datepickerJS($componentInfo['attributes']['id'], $componentInfo['options']); $displayForm .= "<input type='text' value='" . $componentInfo['options']['defaultDate'] . "' " . $dispAttributes . " readonly='readonly'><input type='hidden' id='" . $componentInfo['options']['altField'] . "' name='" . $componentName . "' value='" . $formatDatePick . "'>"; break; case "select": $displayForm .= "<select name='" . $componentName . "' " . $dispAttributes . ">"; foreach ($componentInfo['options'] as $optionValue => $displayValue) { $dispSelected = ""; if ($optionValue == $componentInfo['value']) { $dispSelected = " selected"; } if (in_array($optionValue, $componentInfo['non_selectable_items'])) { $dispSelected = " disabled class='disabledSelectItem'"; } $displayForm .= "<option value='" . $optionValue . "'" . $dispSelected . ">" . $displayValue . "</option>"; } $displayForm .= "</select>"; break; case "checkbox": // Checkbox and radio are basically same thing, so checkbox falls through to radio section // Checkbox and radio are basically same thing, so checkbox falls through to radio section case "radio": if (is_array($componentInfo['options'])) { $componentCounter = 1; foreach ($componentInfo['options'] as $optionValue => $displayValue) { $dispSelected = ""; $newComponentName = $componentName; if (count($componentInfo['options']) > 1) { $newComponentName .= "_" . $componentCounter; if ($componentCounter > 1) { $displayForm .= "<label class='formLabel' style='display: inline-block'></label> "; } $componentCounter++; } if ($optionValue == $componentInfo['value']) { $dispSelected = " checked"; } $dispLabel = $displayValue != "" ? "<label class='formLabel formInput'>" . $displayValue . "</label><br>" : ""; $displayForm .= "<input name='" . $newComponentName . "' type='" . $componentInfo['type'] . "' value='" . $optionValue . "' " . $dispAttributes . " " . $dispSelected . "> " . $dispLabel; } } else { $dispChecked = ""; if ($componentInfo['checked']) { $dispChecked = " checked"; } $displayForm .= "<input name='" . $componentName . "' type='" . $componentInfo['type'] . "' value='" . $componentInfo['value'] . "' " . $dispAttributes . $dispChecked . ">"; } break; case "file": $blnFileUploadForm = true; $displayForm .= "\n\t\t\t\t\t\t\t<div class='formInput' style='margin-bottom: 20px'>\n\t\t\t\t\t\t\t\tFile:<br>\n\t\t\t\t\t\t\t\t<input type='file' name='" . $componentName . "_file' " . $dispAttributes . ">\n\t\t\t\t\t\t\t\t<ul class='tinyFont' style='margin-top: 0px'>"; if (is_array($componentInfo['options']['file_types'])) { $displayForm .= "<li>File Types: " . implode(", ", $componentInfo['options']['file_types']) . "</li>"; } if ($componentInfo['options']['default_dimensions'] != "") { $displayForm .= "<li>Dimensions: " . $componentInfo['options']['default_dimensions'] . "</li>"; } $displayForm .= "<li><a href='javascript:void(0)' onmouseover=\"showToolTip('The file size upload limit is controlled by your PHP settings in the php.ini file.')\" onmouseout='hideToolTip()'>File Size: " . ini_get("upload_max_filesize") . "B or less</a></li></ul>"; $displayForm .= "<p><b><i>OR</i></b></p>"; $displayForm .= "URL:<br><input type='text' name='" . $componentName . "_url' " . $dispAttributes . ">"; if ($componentInfo['value'] != "") { $displayForm .= "<br><a href='" . $MAIN_ROOT . $componentInfo['value'] . "' target='_blank'>View Saved File</a>"; } $displayForm .= "</div>"; break; case "section": $displayForm .= "<div " . $dispAttributes . ">"; if ($componentInfo['options']['section_title'] != "") { $displayForm .= "<p class='dottedLine' style='margin: 0px; margin-top: 25px; padding-bottom: 2px'><b>" . $componentInfo['options']['section_title'] . "</b></p>"; } if ($componentInfo['options']['section_description'] != "") { $displayForm .= "<p>" . $componentInfo['options']['section_description'] . "</p>"; } if ($componentInfo['components'] != "" && is_array($componentInfo['components'])) { $sectionFormObj = new Form(); $sectionFormObj->isContainer = true; $sectionFormObj->components = $componentInfo['components']; $displayForm .= $sectionFormObj->show(); } $displayForm .= "</div>"; break; case "beforeafter": $this->beforeAfter = true; foreach ($componentInfo['options'] as $optionValue => $displayValue) { $dispSelected = ""; if ($optionValue == $componentInfo['before_after_value']) { $dispSelected = " selected"; } if ($optionValue != $componentInfo['value']) { $displayOptions .= "<option value='" . $optionValue . "'" . $dispSelected . ">" . $displayValue . "</option>"; } } $afterSelected = $componentInfo['after_selected'] == "after" ? " selected" : ""; $displayForm .= "<div class='formInput'>\n\t\t\t\t\t\t\t\t\t\t\t<select name='" . $componentName . "_beforeafter' " . $dispAttributes . ">\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='before'>Before</option>\n\t\t\t\t\t\t\t\t\t\t\t\t<option value='after'" . $afterSelected . ">After</option>\n\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t<select name='" . $componentName . "' " . $dispAttributes . ">\n\t\t\t\t\t\t\t\t\t\t\t" . $displayOptions . "\n\t\t\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t"; break; case "custom": break; case "colorpick": $afterJS .= $this->colorpickerJS($componentInfo['attributes']['id'], $componentInfo['allowHTML']); $displayForm .= "<input type='text' name='" . $componentName . "' value='" . $componentInfo['value'] . "' " . $dispAttributes . ">"; break; default: $displayForm .= "<input type='" . $componentInfo['type'] . "' name='" . $componentName . "' value='" . $componentInfo['value'] . "' " . $dispAttributes . ">"; } $displayForm .= $componentInfo['html']; if ($componentInfo['type'] != "section") { $displayForm .= "<br>"; } } $dispFormAttributes = $this->convertAttributes($this->attributes); if ($blnFileUploadForm) { $dispFormAttributes .= " enctype='multipart/form-data'"; } $dispErrors = ""; if (count($this->errors) > 0) { $dispErrors = "<div class='errorDiv'><strong>The following errors occurred:</strong><ul>"; foreach ($this->errors as $dispError) { $dispErrors .= "<li>" . $dispError . "</li>"; } $dispErrors .= "</ul></div>"; } if (!$this->isContainer) { echo "<form " . $dispFormAttributes . ">" . $this->wrapper[0] . $dispErrors . $this->description . "<div class='formTable'>" . $displayForm . "</div>" . $this->wrapper[1] . "<input type='hidden' name='checkCSRF' value='" . $_SESSION['csrfKey'] . "'></form>"; } if ($afterJS != "" && !$this->isContainer) { echo "\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\t" . $afterJS . "\n\t\t\t\t\t</script>\n\t\t\t\t"; } if ($this->isContainer) { $js = ""; if ($afterJS != "") { $js = "<script type='text/javascript'>\n\t\t\t\t\t\t\t" . $afterJS . "\n\t\t\t\t\t\t</script>"; } return $displayForm . $js; } }
$dbTblBenutzer->doUpdate(); } if ($dbTblBenutzer->isDeleteInUpdate()) { $deleteMask = $dbTblBenutzer->doDeleteFromUpdatemask() ? null : $dbTblBenutzer->doDeleteFromUpdatemask(); if ($deleteMask != null) { $lS = $tblMain->createRow(); $lS->setSpawnAll(true); $lS->setAttribute(0, $deleteMask); $tblMain->addRow($lS); } } if (isset($_REQUEST["showUpdateMask" . $dbTblBenutzer->TABLENAME]) && strlen($_REQUEST["showUpdateMask" . $dbTblBenutzer->TABLENAME]) > 0) { $dbTblBenutzer->setAdditionalUpdateFields(array("Passwort" => new PasswordField("Pw" . $_REQUEST["showUpdateMask" . $dbTblBenutzer->TABLENAME]))); } $tblArduinoBenutzeres = $dbTblBenutzer->getUpdateMask(); $tblMain->addSpacer(0, 20); $lS = $tblMain->createRow(); $lS->setSpawnAll(true); $lS->setAttribute(0, $tblArduinoBenutzeres); $tblMain->addRow($lS); $lS = $tblMain->createRow(); $lS->setSpawnAll(true); $lS->setAttribute(0, $newBenutzerBtn); $tblMain->addRow($lS); $tblMain->addSpacer(0, 20); $tblMain->addSpacer(1, 15); $tblMain->addSpacer(0, 20); $f = new Form(); $f->add($tblMain); $f->show();
/** * Show the form * * Uses a recipe to output the form. * * @return void * @see Widget::show() */ function show() { $this->elementStart('div', 'input_forms'); $this->elementStart('div', array('id' => 'input_form_direct', 'class' => 'input_form current nonav')); parent::show(); $this->elementEnd('div'); $this->elementEnd('div'); }
/** * Управление элементами отдельного меню * * @param mixed $id */ public function items_action($menu_id, $id = NULL) { $this->theme->hookAdminMenu(); $this->hookAdminMenu(); if ($menu = menu($menu_id)) { append('content', '<div class="page-header"><h2>' . $menu->name . '</h2></div>'); } else { return event('empty'); } $pills = new Menu_Pills(array('name' => 'admin.menu.items', 'render' => FALSE, 'elements' => array(array('label' => icon('list') . ' ' . t('Список пунктов'), 'link' => l('/admin/theme/menu/' . $menu_id . '/items')), array('label' => icon('plus') . ' ' . t('Добавить'), 'link' => l('/admin/theme/menu/' . $menu_id . '/item/add'), 'class' => 'fl_r'), array('label' => icon('pencil') . ' ' . t('Редактировать'), 'link' => l('/admin/theme/menu/' . $menu_id . '/item/' . $this->router->getSegments(5)), 'access' => check_route('admin/theme/menu/\\d+/item/\\d+'), 'class' => 'fl_r')))); append('content', $pills->render()); if (NULL === $id) { $handler = new Menu_Db_Item(); $handler->menu_id = $menu->id; if ($items = $handler->findAll()) { $tree = new Db_Tree_DDList(array('items' => $items, 'saveUri' => l('/admin/theme/menu/ajax/saveItemsTree/'))); } else { return event('empty'); } } else { $form = new Form('Menu/forms/item'); $item = new Menu_Db_Item(); if ($id != 'add' && is_numeric($id)) { $item->id = $id; if ($item->find()) { $form->object($item); } else { return event('empty'); } } else { $form->remove('delete'); $item->menu_id = $menu_id; } $form->pid->setValues($item->getSelectValues('label')); if ($result = $form->result()) { if ($result->delete && $item->delete()) { flash_success(t('Элемент меню <b>«%s»</b> был удалён!', $item->label), '', 'growl'); redirect(l('admin/theme/menu/' . $menu_id . '/items')); } $item->object()->extend($result); if ($id !== 'add') { $item->branching(); } if ($item->save()) { flash_success($id == 'add' ? t('Элемент меню <b>«%s»</b> успешно создан!', $item->label) : t('Элемент меню <b>«%s»</b> успешно отредактирован!', $item->label), '', 'growl'); redirect(l('admin/theme/menu/' . $menu_id . '/items')); } } $form->show(); } }
/** * Dateiupload-Dialog */ function showFileUploadMask() { $title = new Title("Bild hochladen."); $title->show(); $form = new Form(basename($_SERVER['SCRIPT_NAME']), "", "", "Upload"); $form->setParam("enctype='multipart/form-data'"); if ($this->HIDDEN_OBJECT instanceof Object) { $form->add($this->HIDDEN_OBJECT); } $text = new Text("Im folgenden Dialog wählen sie das hochzuladende Bild aus und können es anschließend durch klicken des *Datei Hochladen* Buttons auf den Server laden. \n \n Es sollten nur .JPG Dateien hochgeladen werden da andere Formate Probleme verursachen können, und evtl nicht angezeigt werden.\n"); $form->add($text); $fileChooser = new Filechooser("probe", "image/*"); $fileChooser->setToolTip("Wählen Sie Hier die hochzuladende Datei aus."); $form->add($fileChooser); $hidden = new HiddenField("picImportUpload", "doUpload"); $form->add($hidden); if (isset($_REQUEST['targetPath'])) { $hiddenpath = new HiddenField("targetPath", $_REQUEST['targetPath']); $form->add($hiddenpath); } if (isset($_REQUEST['filePrefix'])) { $hiddenpre = new HiddenField("filePrefix", $_REQUEST['filePrefix']); $form->add($hiddenpre); } if (isset($_REQUEST['DbInsertTable'])) { $hiddent = new HiddenField("DbInsertTable", $_REQUEST['DbInsertTable']); $form->add($hiddent); } if (isset($_REQUEST['DbInsertCol'])) { $hiddenc = new HiddenField("DbInsertCol", $_REQUEST['DbInsertCol']); $form->add($hiddenc); } if (isset($_REQUEST['DbInsertId'])) { $hiddeni = new HiddenField("DbInsertId", $_REQUEST['DbInsertId']); $form->add($hiddeni); } $btn = new Button("upload", "Datei hochladen", "alert('Datei wird hochgeladen.Dieser Vorgang kann einige Zeit in Anspruch nehmen!Nach Abschluss erhalten Sie eine Bestätigung des Upload-Vorgangs.Brechen Sie nicht vorher Ab!')"); $btn->setOnClickType("Submit"); $form->add($btn); $form->show(); }
function show() { //Wenn notwendig Eingabemaske, ansonsten Standard-Anzeige if (!$this->showInsertMaskIfNeeded()) { $rowsToShow = $this->getRowsToShow(); //Tabelle fÃÂÃÂÃÂür gesamte NEWS $tbl = new Table(array("News")); $tbl->setHeadEnabled(false); $tbl->setBorder(0); foreach ($rowsToShow as $row) { $tt = new Text($row['Text']); $tt->setFilter(false); $ta = new Text($row['Autor']); $tblxTitle = new Table(array("", "")); $tblxTitle->setColSizes(array("50")); $tblxTitle->setAlign("left"); $rxtitle = $tblxTitle->createRow(); $t0 = new Title(getFormatedDate($row['Datum'], "standard") . ":"); $t0->setWidth(20); $rxtitle->setAttribute(0, $t0); $t1 = new Title($row['Title']); $rxtitle->setAttribute(1, $t1); $rxtitle->setAlign("left"); $tblxTitle->addRow($rxtitle); //Tabelle fÃÂÃÂÃÂür den jeweiligen Eintrag $tblx = new Table(array("")); if (strlen($row['pic']) > 0) { $tblx = new Table(array("", "")); $tblx->setColSizes(array("180")); } $tblx->setBorder($this->CONFIG->GB_CONFIG['border']); $tblx->setWidth("100%"); //TEXT $rx = $tblx->createRow(); if (strlen($row['pic']) > 0 && !(isset($_REQUEST['removeNewsPicId']) && $_REQUEST['removeNewsPicId'] == $row['id'])) { $img = new Image($row['pic']); $img->setWidth(175); $rx->setAttribute(0, $img); $rx->setAttribute(1, $tt); } else { $rx->setAttribute(0, $tt); } $rx->setAlign("left"); $tblx->addRow($rx); $f = new FontType(); $rx->setFonttypes(array(0 => $f)); $f = new FontType(); $f->setFontsize(1); $f->setItalic(false); $rx->setFonttypes(array(0 => $f)); $r = $tbl->createRow(); $r->setAttribute(0, $tblxTitle); $tbl->addRow($r); $r1 = $tbl->createRow(); $r1->setAttribute(0, $tblx); $tbl->addRow($r1); $ytElem = new YouTubeElement($row['yt_video'], "news", "yt_video", $row['id']); $r1 = $tbl->createRow(); $r1->setAttribute(0, $ytElem); $tbl->addRow($r1); $tbl->addSpacer(0, 7); if ($_SESSION['config']->CURRENTUSER->STATUS == "admin" || $_SESSION['config']->CURRENTUSER->STATUS == "user") { $r2 = $tbl->createRow(); $xDv = new Div(); $xDv->setWidth(450); $xDv->setHeight(40); $txChngePic = new Text("Bild Hochladen/ÃÂÃÂÃÂÃÂndern<br>"); $txChngePic->setFilter(false); $newPicLink = new Link("?popupRunLink=imageUploaderPopup&targetPath=pics/news&DbInsertTable=news&DbInsertCol=pic&DbInsertId=" . $row['id'] . "&stayAlive=ok", $txChngePic); $txRemPic = new Text("Bild Entfernen<br>"); $txRemPic->setFilter(false); $removePicLink = new Link("?removeNewsPicId=" . $row['id'] . "", $txRemPic); $spTx = new Text(" "); $spTx->setFilter(false); $xDv->add($newPicLink); if (strlen($row['pic']) > 0) { if (isset($_REQUEST['removeNewsPicId']) && $_REQUEST['removeNewsPicId'] == $row['id']) { $sql = "UPDATE news SET pic = null WHERE id = " . $_REQUEST['removeNewsPicId']; $_SESSION['config']->DBCONNECT->executeQuery($sql); } else { $xDv->add($removePicLink); } } $newPicLink->setPopup(true); $r2->setAttribute(0, $xDv); $tbl->addRow($r2); } $tbl->addSpacer(0, 35); } if ($_SESSION['config']->CURRENTUSER->STATUS == "admin" || $_SESSION['config']->CURRENTUSER->STATUS == "user") { // Neuer Eintrag- BUTTON //-------------------------------- $insertButton = new Button('dbTableNew', 'News eintragen'); $form = new Form($_SERVER['SCRIPT_NAME']); $form->add($insertButton); $form->show(); } // Tabelle anzeigen //-------------------------------- $tbl->show(); if ($_SESSION['config']->CURRENTUSER->STATUS == "admin" || $_SESSION['config']->CURRENTUSER->STATUS == "user" && $tbl->getRowcount() > 2) { // Neuer Eintrag- BUTTON //-------------------------------- $insertButton = new Button('dbTableNew', 'News eintragen'); $form = new Form($_SERVER['SCRIPT_NAME']); $form->add($insertButton); $form->show(); } } }
if ($boardObj->objPost->get_info("member_id") == $memberInfo['member_id'] || $blnManagePosts) { $countManagablePosts++; $boardObj->objPost->blnManageable = true; } $boardObj->objPost->show(); } $pageSelector->show(); echo "\n<div class='formDiv' style='background: none; border: 0px; overflow: auto'>\n\t<div style='float: right'>" . $dispManagePosts . $dispPostReply . "</div>\n</div>\n\n"; if (LOGGED_IN && $topicInfo['lockstatus'] == 0) { $forumConsoleObj = new ConsoleOption($mysqli); $postCID = $forumConsoleObj->findConsoleIDByName("Post Topic"); $forumConsoleObj->select($postCID); $postReplyLink = $forumConsoleObj->getLink(); $i = 1; $arrComponents = array("message" => array("type" => "richtextbox", "sortorder" => $i++, "display_name" => "Message", "attributes" => array("id" => "richTextarea", "style" => "width: 90%", "rows" => "10"), "validate" => array("NOT_BLANK")), "submit" => array("type" => "submit", "sortorder" => $i++, "attributes" => array("class" => "submitButton formSubmitButton"), "value" => "Post")); $arrSetupReplyForm = array("name" => "forum-quick-reply", "components" => $arrComponents, "wrapper" => array(), "attributes" => array("method" => "post", "action" => $postReplyLink . "&bID=" . $boardInfo['forumboard_id'] . "&tID=" . $topicInfo['forumtopic_id'])); $quickReplyForm->buildForm($arrSetupReplyForm); echo "\n\n\t\t<div class='formDiv'>\n\t\t\t<b>Quick Reply:</b>\n\n\t\t\t"; $quickReplyForm->show(); echo "\n\t\t</div>\n\t\n\t"; } if ($blnPageSelect) { echo "\n\t\t<script type='text/javascript'>\n\t\n\t\t\t\$(document).ready(function() {\n\t\t\t\t\$('#btnPageSelectTop, #btnPageSelectBottom').click(function() {\n\t\t\t\t\t\n\t\t\t\t\tvar jqPageSelect = \"#pageSelectBottom\";\n\t\t\t\t\tvar intNewPage = 0;\n\t\t\t\t\t\n\t\t\t\t\tif(\$(this).attr('id') == \"btnPageSelectTop\") {\n\t\t\t\t\t\tjqPageSelect = \"#pageSelectTop\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tintNewPage = \$(jqPageSelect).val();\n\t\t\t\t\t\n\t\t\t\t\twindow.location = 'viewtopic.php?tID=" . $_GET['tID'] . "&pID='+intNewPage;\n\t\t\t\t\t\n\t\t\t\t});\n\t\t\t});\n\t\t</script>\n\t"; } if ($blnManagePosts) { echo "\n\t\t<div id='confirmDeleteTopicDiv' style='display: none'>\n\t\t\t<p align='center' class='main'>\n\t\t\t\tAre you sure you want to delete this topic?<br><br>\n\t\t\t\tAll posts will be deleted within the topic as well.\n\t\t\t</p>\n\t\t</div>\n\t\t<script type='text/javascript'>\n\t\t\tfunction deleteTopic() {\n\t\t\t\n\t\t\t\t\$(document).ready(function() {\n\t\n\t\t\t\t\t\$('#confirmDeleteTopicDiv').dialog({\n\t\t\t\t\t\ttitle: 'Delete Topic - Confirm Delete',\n\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t'Yes': function() {\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t\twindow.location = '" . $MAIN_ROOT . "members/console.php?cID=" . $intManagePostsCID . "&tID=" . $topicInfo['forumtopic_id'] . "&action=delete'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'Cancel': function() {\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t});\n\t\n\t\t\t}\n\t\t</script>\n\t"; } if ($countManagablePosts > 0) { echo "\n\t\n\t<div id='confirmDeleteDiv' style='display: none'>\n\t\t\t<p align='center' class='main'>\n\t\t\t\tAre you sure you want to delete this post?<br><br>\n\t\t\t</p>\n\t\t</div>\n\t\t<script type='text/javascript'>\n\t\t\tfunction deletePost(intPostID) {\n\t\t\t\n\t\t\t\t\$(document).ready(function() {\n\t\n\t\t\t\t\t\$('#confirmDeleteDiv').dialog({\n\t\t\t\t\t\ttitle: 'Delete Post - Confirm Delete',\n\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t'Yes': function() {\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t\twindow.location = '" . $MAIN_ROOT . "members/console.php?cID=" . $intManagePostsCID . "&pID='+intPostID+'&action=delete'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'Cancel': function() {\n\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t});\n\t\n\t\t\t}\n\t\t</script>\n\t"; } include $prevFolder . "themes/" . $THEME . "/_footer.php";
/** * Загрузка тем */ public function upload_action() { $this->hookAdminMenu(); $this->hookAdminMenu(2); $form = new Form('Gears/forms/add'); if ($result = $form->result()) { if ($file = $result->file ? $result->file : $result->url) { $zip = new Zip(array('file' => UPLOADS . $file, 'check' => array('type' => 'gears'))); if ($zip->extract(GEARS)) { $info = $zip->info(); success(t('<b>Архив успешно распакован!</b> <p>Он содержал в себе следующие шестерёнки: <ul><li>%s</li></ul>', implode('</li><li>', $info['gears'])), '', 'content'); } $zip->close(); unlink(UPLOADS . $file); } } $form->show(); }
/** * Управление виджетами * * @param mixed $action */ public function widgets_action($action = 'list', $subaction = NULL) { $this->hookAdminMenu(); new Menu_Tabs(array('name' => 'admin.theme.widgets', 'elements' => array(array('label' => icon('list') . ' ' . t('Список'), 'link' => l('/admin/theme/widgets')), array('label' => icon('plus') . ' ' . t('Добавить'), 'link' => l('/admin/theme/widgets/add') . e('uri', $this->input->get('uri')), 'class' => 'fl_r'), array('label' => icon('pencil') . ' ' . t('Редактировать'), 'link' => l('/admin/theme/widgets/' . $this->router->getSegments(3)), 'access' => check_route('widgets/(\\d+)'), 'active' => check_route('widgets/(\\d+)$'), 'class' => 'fl_r'), array('label' => icon('wrench') . ' ' . t('Настройки'), 'link' => l('/admin/theme/widgets/' . $this->router->getSegments(3) . '/options'), 'access' => check_route('widgets/(\\d+)'), 'active' => check_route('widgets/(\\d+)/options'), 'class' => 'fl_r')))); if ($action == 'ajax' && ($widgets = $this->input->post('widgets'))) { $ajax = new Ajax(); $position = 0; foreach ($widgets as $config) { if ($widget = widget($config['id'])) { $widget->region = $config['region']; $widget->position = ++$position; $widget->save(); } } $this->cache->remove('widgets'); $ajax->success = TRUE; $ajax->json(); } else { if ($action == 'list') { jqueryui(); template('Theme/templates/widgets/search')->show(); $widget = widget(); $widget->order('position'); $widgets = $widget->findAll(); // Фильтруем, если задан параметр if ($uri = $this->input->get('uri')) { $remove_ids = array(); foreach ($widgets as $key => $widget) { if (!check_route($widget->route, $uri)) { $remove_ids[] = $key; } } foreach ($remove_ids as $id) { $widgets->offsetUnset($id); } } template('Theme/templates/widgets/list', array('regions' => $this->regions, 'widgets' => $widgets))->show(); } else { $form = new Form('Theme/forms/widget'); $form->callback->setValues($this->getWidgets()); $form->region->setValues(array_combine($this->regions, $this->regions)); if (is_numeric($action) && ($widget = widget($action))) { if ($subaction === 'options') { template('Theme/templates/widgets/options.header', array('widget' => $widget))->show(); $class = $widget->callback; $current_widget = new $class($widget->object()->options); $current_widget->object($widget); if ($current_widget->settings()) { $this->cache->remove('widgets'); flash_success(t('Настройки виджета <b>%s</b> сохранены!', $widget->name), '', 'growl'); redirect(l(TRUE)); } return; } $form->object($widget); $form->callback->options->disabled = TRUE; } elseif ($action == 'add') { if ($uri = $this->input->get('uri')) { $form->route->setValue($uri); } if ($region = $this->input->get('region')) { $form->region->setValue($region); } $form->remove('delete'); $widget = widget(); } else { return event('empty'); } if ($result = $form->result()) { $this->cache->remove('widgets'); if ($result->delete && $widget->delete()) { flash_success(t('Виджет «<b>%s</b>»успешно удалён!', $widget->name), '', 'growl'); redirect(l('/admin/theme/widgets')); } if ($action == 'add') { $result->position = 1 + widget()->where('region', $result->region)->countAll(); } $widget->object()->extend($result); if ($widget->save()) { if ($action == 'add') { flash_success(t('Виджет «<b>%s</b>» успешно добавлен!', $widget->name), '', 'growl'); redirect(l('/admin/theme/widgets/' . $widget->id . '/options')); } else { flash_success(t('Виджет «<b>%s</b>» успешно отредактирован!', $widget->name)); redirect(l(TRUE)); } } } $form->show(); } } }
$rZuordnung->setSpawnAll(true); $rZuordnung->setAttribute(0, $newItemBtn); $itemsTable->addRow($rZuordnung); $form = new Form(); $form->add($spc); $form->add($itemsTable); $form->add($spc); $form->show(); } else { // Regel-Auswahl Combobox anzeigen, // wenn noch keine Regel ausgewählt wurde $form = new Form(); $form->add($spc); $form->add($table); $form->add($spc); $form->show(); } // ------------------------------------------- // Klassen und Funktionen // ------------------------------------------- function doUpdateAlarm() { if (isset($_REQUEST['editEtage'])) { if (isset($_REQUEST['showUpdateMaskhomecontrol_regeln'])) { $_REQUEST['SelectedRegelToEdit'] = $_REQUEST['showUpdateMaskhomecontrol_regeln']; } } if (isset($_REQUEST['SelectedRegelToEdit'])) { $_SESSION['SelectedRegelToEdit'] = $_REQUEST['SelectedRegelToEdit']; } }
/** * Редактирование настроек */ public function admin_settings_action() { $this->hookPagesAdminMenu(); $form = new Form(array('name' => 'admin.pages.settings', 'elements' => array('main_page' => array('label' => t('Главная страница'), 'type' => 'select', 'values' => page()->getSelectValues(), 'value' => config('Pages.main_id', 1)), 'actions' => array('elements' => array('save' => array()))))); if ($result = $form->result()) { if ($result->main_page) { $this->set('Pages.main_id', $result->main_page); } } $form->show(); }
$cID = $consoleObj->findConsoleIDByName("Plugin Manager"); $consoleObj->select($cID); $consoleInfo = $consoleObj->get_info_filtered(); $consoleTitle = $consoleInfo['pagetitle']; $member = new Member($mysqli); $member->select($_SESSION['btUsername']); $PAGE_NAME = $pluginInfo['name'] . " Plugin Settings - " . $consoleTitle . " - "; $EXTERNAL_JAVASCRIPT .= "\n<script type='text/javascript' src='" . $MAIN_ROOT . "members/js/console.js'></script>\n<script type='text/javascript' src='" . $MAIN_ROOT . "members/js/main.js'></script>\n"; $formObj = new Form(); require BASE_DIRECTORY . "plugins/" . $pluginInfo['filepath'] . "/settings_form.php"; $hooksObj->run("pluginsettings-" . $pluginInfo['filepath']); include BASE_DIRECTORY . "themes/" . $THEME . "/_header.php"; $breadcrumbObj->setTitle($pluginInfo['name'] . " Plugin Settings"); $breadcrumbObj->addCrumb("Home", $MAIN_ROOT); $breadcrumbObj->addCrumb("My Account", $MAIN_ROOT . "members"); $breadcrumbObj->addCrumb($consoleTitle, $MAIN_ROOT . "members/console.php?cID=" . $cID); $breadcrumbObj->addCrumb($pluginInfo['name'] . " Plugin Settings"); include BASE_DIRECTORY . "include/breadcrumb.php"; // Check Login $LOGIN_FAIL = true; if ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj)) { $formObj->buildForm($setupFormArgs); if ($_POST['submit'] && $formObj->save()) { $formObj->saveMessageTitle = $pluginInfo['name'] . " Plugin Settings"; $formObj->showSuccessDialog(); } $formObj->show(); } else { die("<script type='text/javascript'>window.location = '" . $MAIN_ROOT . "login.php';</script>"); } include BASE_DIRECTORY . "themes/" . $THEME . "/_footer.php";
/** * */ public function index_action($action = 'import') { $this->hookAdminMenu(1); $this->hookAdminMenu(3); switch ($action) { case 'import': $form = new Form('Lang/forms/import'); if ($result = $form->result()) { if ($file = $result->file) { $zip = new Zip(array('file' => $file->path, 'check' => array('type' => 'lang'))); if ($zip->extract(LANG)) { $info = $zip->info(); $langs = $this->getLangs(array($info['lang'])); success(t('<b>Архив успешно распакован!</b> Индекс для языка <b>«%s»</b> установлен.', implode($langs)), '', 'content'); } $zip->close(); unlink($file->path); } } $form->show(); break; case 'export': template('Lang/templates/download')->show(); break; case 'download': $file = ROOT . $this->prepareFilePath(); $archive = TEMP . DS . pathinfo($file, PATHINFO_FILENAME) . '.zip'; $zip = new Zip(array('file' => $archive, 'create' => TRUE)); $zip->add($file); $zip->info(array('type' => 'lang', 'lang' => config('lang.lang'))); $zip->close(); File::download($archive, basename($archive), TRUE); break; } }
<script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/validation.js"></script> </head> <body> <div align='center'> <?php include_once 'FormCreator/Form.php'; //FormHelper ile amele işlerin yaptırılacağı bir class yazılabilir. try { $form = new Form("test.php"); $form->setFormAttributes(array('id' => 'formId')); $form->setTableAttributes(array("class" => "table")); $form->addInput("text", "name", "Email")->setValidation(array("required" => true, "min" => 3)); $form->addInput("password", "pass", "Şifre")->setValidation(array("required" => true, "min" => 8)); $form->addInput("text", "yas", "Yaş"); $form->addLabel("Cinsiyet:"); $form->addRadioButton("cinsiyet", "erkek", "Erkek", array("checked" => "checked")); $form->addRadioButton("cinsiyet", "bayan", "Bayan"); $form->addComboBox("carbrand", "Arabanızın Markası", array('mercedes' => 'Mercedes', 'bmw' => 'BMW')); //$form->addTextArea(32, 5, "adres","Adres"); //$form->addCheckBox("termofuse", "read", "Kullanmıcı Sözleşmesini okudum")->setValidation(array("mustBeChecked"=>true)); $form->addTermsOfUse("files/file.txt", true); $form->addInput("submit", "dugme", "Kaydet"); echo $form->show(); } catch (Exception $ex) { echo $ex->getMessage(); } ?> </div> </body> </html>
/** * Add action */ public function create_action() { $post = new Post(); // if ($pid = $this->session->get('draft')) { // $post->id = $pid; // $post->find(); // } else { // $post->aid = $this->user->id; // $post->created_date = time(); // $post->insert(); // $this->session->set('draft', $post->id); // } $form = new Form('Post/forms/post'); if ($result = $form->result()) { $post->object()->extend($result); if ($result->preview) { $post->preview = TRUE; $post->aid = user()->id; $post->created_date = time(); $post->show(); } else { // if (Ajax::is() && $this->input->get('autosave')) { // $post->update(); // $ajax = new Ajax(); // $ajax->message(t('Post saved!', 'Post')); // $ajax->send(); // } $post->last_update = time(); if ($result->draft) { $post->published = 0; } elseif ($result->publish) { $post->published = 1; } if ($post->save()) { $this->session->remove('draft'); flash_success($post->published ? t('Пост опубликован!') : t('Сохранено в черновиках!'), NULL, 'growl'); redirect($post->getLink()); } } } else { $form->object($post); } // Remove 'delete' button from create post form $form->elements->offsetUnset('delete'); $form->show(); // js($this->folder . '/js/inline/autosave.js','footer'); }
/** * Добавление или редактирование сниппета * * @param int $id */ public function snippet_action($id = NULL) { $this->hookAdminMenu(); $form = new Form('Code/forms/snippet'); $tpl = new Template('Code/templates/form'); $snippet = new Code_Snippet(); if ($id) { $snippet->id = $id; if ($snippet->find()) { $tpl->code = $snippet->code; $form->object($snippet); } } else { $tpl->code = htmlspecialchars('<?php '); } $snippet->name or $form->remove('delete'); $form->code_editor->options->label = $tpl->render(); if ($result = $form->result()) { $snippet->name = $result->name; $snippet->code = $result->code; $snippet->aid or $snippet->aid = user()->id; $snippet->type = $result->type; $snippet->created_date or $snippet->created_date = time(); if ($snippet->save()) { flash_success(t('Сниппет кода успешно сохранён!')); redirect(l('/admin/code/snippet/' . $snippet->id)); } } $form->show(); }
/** * User Регистрация */ public function register_action($code = NULL) { $this->theme->template('User/templates/login'); if (!config('user.register.active', FALSE)) { return error(t('Регистрация отключена администрацией сайта.')); } if ($this->isLogged()) { return error('Вы уже авторизированы!'); } $this->showMenu(); if ($code) { $user = new User(); $user->hash = $code; if ($user->find()) { $form = new Form('User/forms/verify'); $form->email->setValue($user->email); if ($result = $form->result()) { $user->object()->extend($result); $result->realname && ($user->name = $result->realname); $user->hashPassword(); $user->hash = $this->secure->genHash($user->password); $user->reg_date = time(); $user->last_visit = time(); if ($user->save()) { event('user.register', $user); if ($user->login()) { flash_success(t('Регистрация завершена!')); redirect($user->getLink()); } } } $form->show(); } else { error(t('Регистрационный код не найден.')); } } else { $form = new Form('User/forms/register'); if ($result = $form->result()) { $user = new User(); $user->email = $result->email; $user->find(); $user->hash = $this->secure->genHash(date('H d.m.Y') . $this->session->get('ip') . $result->email); if (config('user.register.verification', TRUE)) { $verify_link = l('/user/register/' . $user->hash, TRUE); $mail = new Mail(array('name' => 'register.verify', 'subject' => t('Регистрация на сайте %s', SITE_URL), 'body' => t('Вы успешно зарегистрировались на сайте http://%s. <br/> Пожалуйста, перейдите по ссылке ниже, для того чтобы подтвердить данный почтовый ящик:<p> <a href="%s">%s</a>', SITE_URL, $verify_link, $verify_link))); $mail->to($user->email); if ($mail->send()) { $user->save(); event('user.confirmation', $user); success(t('Письмо с подтвержденим регистрации было отправлено на почтовый адрес <b>%s</b>. Следуйте инструкциям.', $user->email)); } } else { $user->save(); redirect(l('/user/register/' . $user->hash)); } } else { $form->show(); } } }
// ------------------------- // Show // ------------------------- $tbl = new Table(array("", "")); $tbl->setColSizes(array(130)); $rTtl = $tbl->createRow(); $rTtl->setSpawnAll(true); $rTtl->setAttribute(0, $ttl); $tbl->addRow($rTtl); $tbl->addSpacer(0, 30); $rSelect = $tbl->createRow(); $rSelect->setAttribute(0, $txtSelect); $rSelect->setAttribute(1, $cboSensorSelect); $tbl->addRow($rSelect); $tbl->addSpacer(0, 10); $rTimeSelect = $tbl->createRow(); $rTimeSelect->setSpawnAll(true); $rTimeSelect->setAttribute(0, $timeSelect); $tbl->addRow($rTimeSelect); $tbl->addSpacer(0, 30); if (isset($_REQUEST['sensorSelectCob']) && strlen($_REQUEST['sensorSelectCob']) > 0) { $imgTxt = new Text("<img src='includes/pictures/sensorLogGraphs.inc.php?width=800&height=350&sensorId=" . $_REQUEST['sensorSelectCob'] . "&startTime=" . $_REQUEST['startTimeCob'] . "&endTime=" . $_REQUEST['endTimeCob'] . "'>"); $imgTxt->setFilter(false); $rGraph = $tbl->createRow(); $rGraph->setSpawnAll(true); $rGraph->setAttribute(0, $imgTxt); $tbl->addRow($rGraph); } $frmSelect->add($tbl); $frmSelect->show();