protected function createComponentGrid($name) { $grid = new Gridito\Grid($this, $name); $model = $this->context->doctrineUsersModel; $model->addColumnAliases('username', 'credentials.username', 'c.username'); $grid->setModel($model); $grid->setHighlightOrderedColumn(FALSE); $grid->setRowClass(function ($iterator, $row) { $classes = array(); $classes[] = $iterator->isOdd() ? 'odd' : 'even'; if (!$row->active) { $classes[] = 'inactive'; } return empty($classes) ? null : implode(' ', $classes); }); // columns $grid->addColumn('id', 'ID')->setSortable(true); $grid->addColumn('username', 'Username')->setSortable(true)->setCellClass('important'); $grid->addColumn('name', 'Name')->setSortable(true); $grid->addColumn('surname', 'Surname')->setSortable(true); $grid->addColumn('mail', 'E-mail', array('renderer' => function ($row) { echo Nette\Utils\Html::el('a')->href("mailto:{$row->mail}")->setText($row->mail); }, 'sortable' => true)); $grid->addColumn('active', 'Active')->setSortable(true); // buttons $grid->addButton('button', 'Button', array('icon' => 'icon-tick', 'handler' => function ($row) use($grid) { $grid->flashMessage("Button {$row->name} {$row->surname} pressed."); $grid->redirect('this'); })); $grid->addWindowButton('winbtn', 'Window', array('handler' => function ($row) { echo "{$row->name} {$row->surname}<br>({$row->mail})"; }, 'icon' => 'icon-window')); }
function eu_cookies($lang = 'cs', $force = FALSE) { if ($lang === 'cs') { $lang = 'cz'; } if ($force || !eu_cookies_allowed()) { return Nette\Utils\Html::el()->setHtml('<script src="//s3-eu-west-1.amazonaws.com/f*****g-eu-cookies/' . $lang . '.js" async></script>'); } return ''; }
function analytics($googleAnalyticsId = null) { global $App; if (!$googleAnalyticsId) { if (!empty($App->parameters['UA'])) { $googleAnalyticsId = $App->parameters['UA']; } } if ($googleAnalyticsId && $googleAnalyticsId !== 'UA-XXXXXXX-X') { return Nette\Utils\Html::el()->setHtml("<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\nm=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n})(window,document,'script','//www.google-analytics.com/analytics.js','ga');\nga('create', '{$googleAnalyticsId}', 'auto'); ga('send', 'pageview');</script>"); } return ''; }
protected function createComponentGrid($name) { $grid = new Gridito\Grid($this, $name); $grid->setDefaultSorting('id', 'asc'); // model $model = $this->context->doctrineUsersModel; $model->addColumnAliases('username', 'credentials.username', 'c.username'); $grid->setModel($model); // columns $grid->addColumn('id', 'ID')->setSortable(true); $grid->addColumn('username', 'Username')->setSortable(true); $grid->addColumn('name', 'Name')->setSortable(true); $grid->addColumn('surname', 'Surname')->setSortable(true); $grid->addColumn('mail', 'E-mail', array('sortable' => true, 'renderer' => function ($row) { echo Nette\Utils\Html::el('a')->href("mailto:{$row->mail}")->setText($row->mail); })); $grid->addColumn('active', 'Active')->setSortable(true); // toolbar buttons $grid->addToolbarButton('create', 'Create new user', array('handler' => function () use($grid) { $grid->flashMessage('Unable to create user.', 'error'); $grid->redirect('this'); }, 'icon' => 'ui-icon-plusthick')); $grid->addToolbarWindowButton('hello', 'New window')->setHandler(function () { echo 'Hello!'; })->setIcon('ui-icon-newwin'); $grid->addToolbarButton('back', 'Go back to examples', array('link' => $this->link('Homepage:'), 'icon' => 'ui-icon-home')); $grid->addWindowButton('detail', 'Detail', array('handler' => function ($user) { // todo fix XSS echo '<p><strong>' . $user->name . ' ' . $user->surname . '</strong></p>'; echo '<table>'; echo '<tr><th>ID</th><td>' . $user->id . '</td></tr>'; echo '<tr><th>Username</th><td>' . $user->credentials->username . '</td></tr>'; echo '<tr><th>E-mail</th><td>' . $user->mail . '</td></tr>'; echo '<tr><th>Active</th><td>' . ($user->active ? 'yes' : 'no') . '</td></tr>'; echo '</table>'; }, 'icon' => 'ui-icon-search')); // action buttons $grid->addButton('delete', 'Delete', array('handler' => function ($user) use($grid) { $grid->flashMessage("Unable to delete user {$user->name} {$user->surname}.", 'error'); $grid->redirect('this'); }, 'icon' => 'ui-icon-closethick', 'confirmationQuestion' => function ($user) { if ($user->active) { return "Really delete use {$user->name} {$user->surname}?"; } else { return null; } }, 'showText' => false, 'visible' => function ($user) { return !$user->isActive(); })); }
public function renderJavascript() { if ($this->asynchronous) { $el = Nette\Utils\Html::el('script type="text/javascript"'); $el->add("window.___gcfg = {lang: '" . $this->lang . "'};"); $el->add("(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://apis.google.com/js/plusone.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();"); echo $el; } else { $el = Nette\Utils\Html::el('script type="text/javascript"'); $el->src = self::GOOGLE_PLUSONE_URL; $el->add("{lang: '" . $this->lang . "'}"); echo $el; } }
public function getTab() { global $wpdb; $span = Nette\Utils\Html::el('span'); $src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAFIklEQVRYhaXXcazWVR3H8dd9JoKzDGHLyQ0YGBg4bAobMIuuHn87YRiBAGJYkcPW/KdarvVPgDO3Nlv902YLVjXHBAGRUDkcz5JMlqPWWibjBmIFwNwAHEgg4W3b/V338OMhL/O7PXt2ts/5ft+/53x/n+95uvr6+gw2YhWuRg9mYw7GAt7EFiT8LuXyn8Hm7BoMQKzCrbgXo3AKf8c/cBQwEhMxGR/Bv/FUyuWvHwogVmE8VuDjWI2tKZezsQoj0V0X7qtBDqZcjsUqXIU5eACHsCrl8s/LBohVWIpv4mcpl7WxCt1YjvkYj6sBAKfwBjZgdcrlcKzCV+ocP025rBs0QKzCKkzHPLTwYyzDlZd6kkacwRo8jCuwEb9PuTzaFLY6FF+JySmXz2MG9uEbl1EchuEhHMZMzMa0WIXv/1+AWIUlmJ5yWRirsBAF111G4WZsx+mUy3nMw+2xCvcAwPtHEKswButq2h488yEKw6splxkAEKswCpswL+VyGK4AwCP6m+VErMJcbMXb2ItRWI49+A2urz9X4jxOYS9G4wHAS02ilMuhWIUnsAoPvg8Qq3Azrhvo1JTLsjbqmbgdcBK78OeUy7HG092GHgDc3ASIVbgq5fKrW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DbWpVxe/6DcgwJoAxmCHvRgNj6FPuzGC3gJO2q/GFT8D05h6xsz7ZrcAAAAAElFTkSuQmCC'; $img = Nette\Utils\Html::el('img width=16', array('alt' => 'WordPress icon', 'src' => $src)); $span->addHtml($img); $time = 0; foreach ($wpdb->queries as $q) { $time += $q[1]; } $count = $wpdb->num_queries; $span->addText(($time ? sprintf(' %0.1f ms / ', $time * 1000) : '') . $count); return $span; }
public static function maskVoucherCode($voucherCode, $user = null) { if (empty($voucherCode)) { return false; } // Maybe this hould not be hardcoded?! $knownVouchers = array("QUICKLY", "FRIEND", "INVITE"); if (in_array($voucherCode, $knownVouchers)) { return $voucherCode; } $maskedCode = substr($voucherCode, 0, 1) . str_repeat('*', strlen($voucherCode) - 2) . substr($voucherCode, -1); if (!is_null($user) && $user instanceof Nette\Security\User && $user->isAllowed("Backend:Admin:UnmaskedVouchers", "show")) { return Nette\Utils\Html::el("abbr")->rel("tooltip")->title($voucherCode)->setText($maskedCode); } return $maskedCode; }
protected function createComponentGrid($name) { $grid = new Gridito\Grid($this, $name); $db = $this->context->dibiConnection; $grid->setModel(new Gridito\DibiFluentModel($db->select('*')->from('users'))); $grid->setItemsPerPage(5); // columns $grid->addColumn('id', 'ID')->setSortable(true); $grid->addColumn('name', 'Name')->setSortable(true); $grid->addColumn('surname', 'Surname')->setSortable(true); $grid->addColumn('mail', 'E-mail', array('renderer' => function ($row) { echo Nette\Utils\Html::el('a')->href("mailto:{$row->mail}")->setText($row->mail); }, 'sortable' => true)); $grid->addColumn('active', 'Active', array('renderer' => function ($row) { Gridito\Column::renderBoolean($row->active); }, 'sortable' => true)); }
protected function createComponentGrid($name) { $grid = new Gridito\Grid($this, $name); // model $model = $this->context->doctrineUsersModel; $model->addColumnAliases('username', 'credentials.username', 'c.username'); $grid->setModel($model); $grid->setItemsPerPage(5); // columns $grid->addColumn('id', 'ID')->setSortable(true); $grid->addColumn('username', 'Username')->setSortable(true); $grid->addColumn('name', 'Name')->setSortable(true); $grid->addColumn('surname', 'Surname')->setSortable(true); $grid->addColumn('mail', 'E-mail', array('sortable' => true, 'renderer' => function ($row) { echo Nette\Utils\Html::el('a')->href("mailto:{$row->mail}")->setText($row->mail); })); $grid->addColumn('active', 'Active')->setSortable(true); }
function web_fonts($config = null) { if (!$config) { return ''; } $deferFlags = ' async defer'; if (!empty($_COOKIE['webfonts-preloaded'])) { $deferFlags = ''; } return Nette\Utils\Html::el()->setHtml(' <script> ;(function(){ WebFontConfig = ' . json_encode($config) . '; var el = document.documentElement; el.className += " wf-loading"; setTimeout(function() { el.className = el.className.replace(/(^|\\s)wf-loading(\\s|$)/g, " "); }, 800)})(); </script> <script src="https://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js"' . $deferFlags . '></script>'); }
protected function createComponentGrid($name) { $grid = new Gridito\Grid($this, $name); $db = $this->context->dibiConnection; $model = new Model\UsersGriditoDibiModel($db); if ($this->getParam('activeOnly')) { $model->filterActiveOnly(); } $search = $this->getParam('search', false); if ($search) { $model->filterSearch($search); } $grid->setModel($model); // columns $grid->addColumn('id', 'ID')->setSortable(true); $grid->addColumn('name', 'Name')->setSortable(true); $grid->addColumn('surname', 'Surname')->setSortable(true); $grid->addColumn('mail', 'E-mail', array('renderer' => function ($row) { echo Nette\Utils\Html::el('a')->href("mailto:{$row->mail}")->setText($row->mail); }, 'sortable' => true)); $grid->addColumn('active', 'Active', array('renderer' => function ($row) { Gridito\Column::renderBoolean($row->active); }, 'sortable' => true)); }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('/home/www/Git/nette/app/../temp/cache/latte'); $service->setAutoRefresh(TRUE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('/home/vencs88/public_html/import_time/app/../temp/cache/latte'); $service->setAutoRefresh(FALSE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('C:\\Users\\prcharom\\Desktop\\EasyPHP-DevServer-14.1VC9\\data\\localweb\\nastenka\\app/../temp/cache/latte'); $service->setAutoRefresh(TRUE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
$form['cancel']->onClick[] = function () { $this->redirect('Pokladnicka:'); }; return $this->_vzhladForm($form); } // ----------- Spracovanie vymazavania --------
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('E:\\xampp\\htdocs\\pskeleton\\tests/../temp/cache/latte'); $service->setAutoRefresh(FALSE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('C:\\Users\\Raiper34\\Desktop\\server\\root\\nette\\app/../temp/cache/latte'); $service->setAutoRefresh(TRUE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
protected function createComponentFileUploadForm() { $form = new AppForm(); $form->setTranslator($this->translator); $renderer = $form->getRenderer(); $renderer->wrappers['controls']['container'] = 'div class="well"'; $renderer->wrappers['pair']['container'] = 'div class="control-group"'; $renderer->wrappers['label']['container'] = 'div class="control-label"'; $renderer->wrappers['control']['container'] = 'div class="controls"'; $renderer->wrappers['error']['container'] = 'ul class="alert alert-error"'; $form->getElementPrototype()->addAttributes(array('class' => 'form-horizontal')); $form->addMultiUpload("image", "Choose image(s)")->setRequired()->addRule(Form::IMAGE, "You can choose images only!")->addRule(Form::MAX_FILE_SIZE, 'File is too big! Please, choose smaller one. It could be 3 megs large.', 3 * 1024 * 1024)->setOption('description', Nette\Utils\Html::el('div class="alert alert-info"')->setHtml('Minimální velikost obrázku <strong>440 x 440 px</strong>, maximální velikost souboru <strong>3 MB</strong>. Formát obrázků <strong>jpg</strong>, <strong>gif</strong> a <strong>png</strong>.')); $form->addSubmit('send', 'Upload image(s)')->getControlPrototype()->class('btn btn-primary'); $form->addSubmit('cancel', 'Přeskočit nahrávání obrázků')->setValidationScope(FALSE)->onClick[] = array($this, 'cancelClicked'); $form['cancel']->getControlPrototype()->class('btn btn-grey btn-small'); $form->onSuccess[] = callback($this, 'fileUploadSuccess'); return $form; }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('/home/richmond/vhosts/nette-test/sandbox/app/../temp/cache/latte'); $service->setAutoRefresh(FALSE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; $service->onCompile = $this->container->getService('events.manager')->createEvent(array('Latte\\Engine', 'onCompile'), $service->onCompile, NULL, FALSE); return $service; }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('/www/plavbyolomouc.cz/rezervace.plavbyolomouc.cz/app/../temp/cache/latte'); $service->setAutoRefresh(TRUE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
<?php $View->mangoSnippet = NULL; $mangoSnippetPath = BASE_DIR . '/.mango-snippet.html'; if (!empty($App->parameters['mango']) && file_exists($mangoSnippetPath)) { $View->mangoSnippet = Nette\Utils\Html::el()->setHtml(file_get_contents($mangoSnippetPath)); }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('C:\\Users\\Hadi.k\\Dropbox\\vyvojraskaSekce\\WebDesign\\BrowserGameLikeRust\\src\\buildModule\\app/../temp/cache/latte'); $service->setAutoRefresh(TRUE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
* @return Nette\Application\UI\Form */ protected function createComponentEditUdajeForm() { $form = $this->editUdajeForm->create($this->user->isInRole("admin"), $this->druh->findAll()->fetchPairs('id', 'popis'), $this->ur_reg); $form['uloz']->onClick[] = function ($form) { $this->flashOut(!count($form->errors), 'Udaje:', 'Údaj bol uložený!', 'Došlo k chybe a údaj sa neuložil. Skúste neskôr znovu...');
/** * Zostavenie otázky pre ConfDialog s parametrom * @param Nette\Utils\Html $dialog * @param array $params * @return string $question */ public function questionDelete($dialog, $params) { $dialog->getQuestionPrototype(); return sprintf($this->trLang('base_delete_text'), isset($params['zdroj_na_zmazanie']) ? $params['zdroj_na_zmazanie'] : "položku", isset($params['nazov']) ? $params['nazov'] : ''); }
public function getControl() { $this->setOption('rendered', TRUE); return Nette\Utils\Html::el()->add("<span class='{$this->iconClass}'>{$this->text}</span>"); }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('/Applications/MAMP/htdocs/orbinet/app/../temp/cache/latte'); $service->setAutoRefresh(FALSE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('C:\\xampp\\htdocs\\TransportCompany\\app/../temp/cache/latte'); $service->setAutoRefresh(TRUE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }
public function create() { $service = new Latte\Engine(); $service->setTempDirectory('/www/jvitasek.cz/priority.jvitasek.cz/app/../temp/cache/latte'); $service->setAutoRefresh(FALSE); $service->setContentType('html'); Nette\Utils\Html::$xhtml = FALSE; return $service; }