/** * Set default template * * @return array|string */ public function defaultTemplate() { if (isset($_GET['cut_page'])) { return array('page'); } $page_name = 'page/' . strtolower($this->short_name); // See if we can locate the page try { $p = $this->app->locate('template', $page_name . '.html'); } catch (Exception_PathFinder $e) { return array('page'); } return array($page_name, '_top'); }
/** * Call this if you are adding this inside a grid. * * @param string $name Field Name (must not contain spaces) * @param string $title Header for the column * @param array|string $buttontext Text to put on the button * @param Grid $grid Specify grid to use, other than $owner * * @return $this */ public function addColumn($name, $title = null, $buttontext = null, $grid = null) { if ($grid === null) { $grid = $this->owner; } /** @type Grid $this->owner */ /** @type Grid $grid */ if (!is_array($buttontext)) { $buttontext = array(); } if (!$buttontext['descr']) { $buttontext['descr'] = $title ?: ucwords(str_replace('_', ' ', $name)); } $icon = ''; if ($buttontext['icon']) { if ($buttontext['icon'][0] != '<') { $icon .= '<i class="icon-' . $buttontext['icon'] . '"></i>'; } else { $icon .= $buttontext['icon']; } $icon .= ' '; } $grid->addColumn('template', $name, $buttontext ?: $title); $grid->setTemplate('<button type="button" class="atk-button-small pb_' . $name . '">' . $icon . $this->app->encodeHtmlChars($buttontext['descr']) . '</button>'); $grid->columns[$name]['thparam'] .= ' style="width: 40px; text-align: center"'; //$grid->js(true)->_selector('#'.$grid->name.' .pb_'.$name)->button(); $t = $this->type; $grid->js('click')->_selector('#' . $grid->name . ' .pb_' . $name)->univ()->{$t}($title, array($this->getURL($name), $this->name . '_id' => $grid->js()->_selectorThis()->closest('tr')->attr('data-id')), $this->frame_options); return $this; }
/** * Do not override this function. */ public function processLogin() { $this->memorizeURL(); $this->app->template->tryDel('Menu'); $this->showLoginForm(); $this->app->hook('post-init'); $this->app->hook('pre-exec'); if (isset($_GET['submit']) && $_POST) { $this->app->hook('submitted'); } $this->app->hook('post-submit'); $this->app->execute(); exit; }
/** * @todo Description */ public function initLayout() { if ($this->pathfinder->sandbox) { $this->initAddons(); } else { if (preg_match('/^sandbox_/', $this->app->page)) { $this->app->redirect('sandbox'); } } $this->addLayout('mainMenu'); parent::initLayout(); $this->initTopMenu(); if (!$this->pathfinder->sandbox && !$this->app->getConfig('production', false)) { $this->menu->addItem(array('Install Developer Toools', 'icon' => 'tools'), 'sandbox'); } if (@$this->sandbox) { $this->sandbox->initLayout(); } }
/** * @todo Description * * @param Exception $e */ public function caughtException($e) { if ($e instanceof Exception_Migration) { try { // The mesage is for user. Let's display it nicely. $this->app->pathfinder->addLocation(array('public' => '.'))->setCDN('http://www.agiletoolkit.org/'); /** @type Layout_Basic $l */ $l = $this->app->add('Layout_Basic', null, null, array('layout/installer')); /** @type View $i */ $i = $l->add('View'); $i->addClass('atk-align-center'); /** @type H1 $h */ $h = $i->add('H1'); $h->set($e->getMessage()); if ($e instanceof Exception_Migration) { /** @type P $p */ $p = $i->add('P'); $p->set('Hello and welcome to Agile Toolkit 4.3. ' . 'Your project may require some minor tweaks before you can use 4.3.'); } /** @type Button $b */ $b = $i->add('Button'); $b->addClass('atk-swatch-green')->set(array('Migration Guide', 'icon' => 'book'))->link('https://github.com/atk4/docs/blob/master/articles/migration42/index.md'); if ($this->app->template && $this->app->template->hasTag('Layout')) { $t = $this->app->template; } else { /** @type GiTemplate $t */ $t = $this->add('GiTemplate'); $t->loadTemplate('html'); } $t->setHTML('Layout', $l->getHTML()); $t->trySet('css', 'http://css.agiletoolkit.org/framework/css/installer.css'); echo $t->render(); exit; } catch (BaseException $e) { echo 'here'; $this->app->add('Logger'); return parent::caughtException($e); } } return parent::caughtException($e); }
function defaultTemplate() { $this->readConfig("websites/www/config.php"); $url = "{$_SERVER['HTTP_HOST']}"; $domain = str_replace('www.', '', $this->extract_domain($url)) ?: 'www'; $sub_domain = str_replace('www.', '', $this->extract_subdomains($url)) ?: 'www'; $service_host = $this->getConfig('xepan-service-host', false); if ($service_host && $service_host !== $domain) { $epan = $domain; } else { $epan = $sub_domain; } $this->dbConnect(); $epan = $this->db->dsql()->table('epan')->where($this->db->dsql()->orExpr()->where('name', $epan)->where('aliases', 'like', '"%' . $epan . '%"'))->getHash(); // die(print_r($epan,true)); // die($epan['name']); $current_website = $this->current_website_name = $epan['name']; $this->readConfig("websites/{$this->current_website_name}/config.php"); $this->addLocation(array('page' => array("websites/{$current_website}/www"), 'js' => array("websites/{$current_website}/www/js"), 'css' => array("websites/{$current_website}/www", "websites/{$current_website}/www/css"), 'template' => ["websites/{$current_website}/www"], 'addons' => ['websites/' . $current_website . '/www']))->setParent($this->pathfinder->base_location); return parent::defaultTemplate(); }