public function getPageMenu(\AbstractView $view, Model_Page $page) { if ($view->template->hasTag('SubMenu') && ($siblings = $page->getSiblings())) { $menu = $view->add('Menu_Vertical', null, 'SubMenu'); foreach ($siblings as $page) { $page->page_translation = $page->getTranslation(true); $url = $page['hash_url'] ?: $page['url_first_child']; $this->app->addMenuItem($menu, $page->page_translation['meta_title'], 'home-1', 'atk-swatch-beigeDarken', $url); } } }
private function showLangButtons(\AbstractView $view) { $langs = $this->app->getConfig('atk4-home-page/available_languages'); $button_set = $view->add('ButtonSet')->addClass('atk-box-small'); foreach ($langs as $key => $lang) { $button = $button_set->addButton($key); if ($key == $this->app->getCurrentLanguage()) { $button->setAttr('disabled', 'disabled')->addClass('atk-swatch-gray'); } $button->js('click')->univ()->ajaxec($this->app->url(null, ['language' => $key])); } }
function init() { parent::init(); $this->template->set('slot1', rand(1, 9)); $this->template->set('slot2', rand(1, 9)); $this->template->set('slot3', rand(1, 9)); }
function init() { parent::init(); if (@$_GET[$this->owner->name . '_cut_field'] == $this->name) { $this->api->addHook('pre-render', array($this, '_cutField')); } }
public function render() { # make sure we have a template if ($this->template === false) { throw new TemplateUndefined(); } parent::render(); # unpack the props extract($this->props); # trap the buffer ob_start(); # include the template require \options('views') . '/' . $this->template . '.' . $this->extension; # get the buffer contents $parsed = ob_get_contents(); # clean the buffer ob_clean(); # if there is a layout if ($this->layout) { # push the content into the layout $content_for_layout = $parsed; # include the template include \options('views') . '/' . $this->layout . "." . $this->extension; # get the buffer contents $parsed = ob_get_contents(); } # close the output buffer ob_end_clean(); # echo the result echo $parsed; }
function initializeTemplate() { $l = $this->api->locate('addons', __NAMESPACE__, 'location'); $lp = $this->api->locate('addons', __NAMESPACE__); $this->api->addLocation($lp, array('template' => 'templates/default'))->setParent($l); return parent::initializeTemplate(); }
function parse($layout_template = false) { parent::parse($layout_template); # unpack the props #extract($this->props); # trap the buffer ob_start(); # include the template include $this->template; # get the buffer contents $parsed = ob_get_contents(); # clean the buffer ob_clean(); # if there is a layout if ($this->layout) { # find the type $type = ViewFactory::get_template_type($layout_template); if ($type) { # push the content into the layout $content_for_layout = $parsed; # include the template include $this->layout . ".{$type}"; # get the buffer contents $parsed = ob_get_contents(); } } # close the output buffer ob_end_clean(); # save the result $this->parsed = $parsed; return $parsed; }
public function __construct($action, $token, $vars) { parent::__construct(); $this->layout = 'new_admin.html.twig'; $this->addVar('action', $action); $this->addVar('token', $token); $this->addVar('vars', $vars); }
public function __construct(AbstractModel $model, array $config) { parent::__construct($model, $config); Head::getInstance()->link(CSS_DIR . 'style.css'); if (isset($this->config['style'])) { Head::getInstance()->link($this->config['style']); } }
public function __construct($post, $action, $cancel, $categories) { parent::__construct(); $this->layout = 'post_modif.html.twig'; $this->addVar('post', $post); $this->addVar('action', $action); $this->addVar('cancel', $cancel); $this->addVar('categories', $categories); }
public function __construct($action, $cancel, $categories, $vars = array()) { parent::__construct(); $this->layout = 'post_add.html.twig'; $this->addVar('action', $action); $this->addVar('cancel', $cancel); $this->addVar('categories', $categories); $this->addVar('vars', $vars); }
function render($controller_name, $layout_template = false) { parent::parse($controller_name, $layout_template); $xsl = new DomDocument(); $xsl->load($this->template); $proc = new xsltprocessor(); $proc->importStyleSheet($xsl); echo $proc->transformToXML($this->props_to_xml()); }
function recursiveRender() { if (isset($_GET['cut_page']) && !isset($_GET['cut_object']) && !isset($_GET['cut_region'])) { $_GET['cut_object'] = $this->short_name; } if ($this->title && $this->owner instanceof ApiFrontend) { $this->owner->template->trySet('page_title', $this->title); } parent::recursiveRender(); }
function init() { parent::init(); $this->grabTemplateChunk('link'); $this->grabTemplateChunk('prev'); $this->grabTemplateChunk('cur_item'); $this->grabTemplateChunk('separator'); $this->grabTemplateChunk('next'); $this->skip = $this->learn('skip', @$_GET[$this->name . '_skip']) + 0; $this->api->addHook('pre-exec', array($this, 'applyHook'), 1); }
function setModel($m) { $m = parent::setModel($m); if ($m instanceof filestore\Model_Image) { $this->initializeTemplate(null, array($this->addon . './view/thumb')); } else { $this->initializeTemplate(null, array($this->addon . './view/file')); } $this->uploader = $this->add($this->addon . '/View_Uploader'); $this->uploader->addHook('afterUpload', $this); }
/** * Creates a new {@link DebugView}. * @param $smarty Smarty The smarty template. */ public function __construct($smarty) { parent::__construct('debug', 'Debug', $smarty); /* fetch the test suite page */ try { ob_start(); $test = new M2MTestSuite(); $test->run(new HtmlReporter()); } finally { $this->smarty->assign('testResults', ob_get_clean()); } }
function init() { $this->api->page_object = $this; if ($this->owner != $this->api && !$this->owner instanceof BasicAuth) { throw $this->exception('Do not add page manually. Page is automatically initialized by the Application class')->addMoreInfo('owner', $this->owner->name)->addMoreInfo('api', $this->api->name); } if (isset($_GET['cut_page']) && !isset($_GET['cut_object']) && !isset($_GET['cut_region'])) { $_GET['cut_object'] = $this->short_name; } $this->template->trySet('_page', $this->short_name); parent::init(); }
/** * Constructor * * Register Zend_View_Stream stream wrapper if short tags are disabled. * * @param array $config * @return void */ public function __construct($config = array()) { $this->_useViewStream = (bool) ini_get('short_open_tag') ? false : true; if ($this->_useViewStream) { if (!in_array('zend.view', stream_get_wrappers())) { stream_wrapper_register('zend.view', 'Zend\\View\\Stream'); } } if (array_key_exists('useStreamWrapper', $config)) { $this->setUseStreamWrapper($config['useStreamWrapper']); } parent::__construct($config); }
protected function _getBlock(Model_Block $model, \AbstractView $v, $app_type = 'frontend') { if (Config::getInstance($this->app)->isFrontendEditingMode() && $_GET['edit'] == 1) { $this->app->stickyGet('edit'); $this->app->stickyGet('access_code'); $app_type = 'admin'; } if ($app_type == 'admin') { $view = $v->add('atk4\\atk4homepage\\View_DynamicBlock', ['app_type' => $app_type]); } else { $view = $this->add('atk4\\atk4homepage\\View_DynamicBlock', ['template_path' => $this->app->getConfig('atk4-home-page/block_types/' . $model['type'] . '/template')], $model['system_name']); } $view->setModel($model); $view->get(); }
function init() { $this->api->page_object = $this; if ($this->owner != $this->api && !$this->owner instanceof BasicAuth) { throw $this->exception('Do not add page manually. Page is automatically initialized by the Application class')->addMoreInfo('owner', $this->owner->name)->addMoreInfo('api', $this->api->name); } if (isset($_GET['cut_page']) && !isset($_GET['cut_object']) && !isset($_GET['cut_region'])) { $_GET['cut_object'] = $this->short_name; } $this->template->trySet('_page', $this->short_name); if (method_exists($this, get_class($this))) { throw $this->exception('Your sub-page name matches your page cass name. PHP will assume that your method is constructor')->addMoreInfo('method and class', get_class($this)); } parent::init(); }
function render() { $c = $this->template->get('current'); $this->template->del('current'); $parts = explode('_', $this->api->page); $matched = false; while ($parts) { $tag = implode('_', $parts); if ($this->template->is_set('current_' . $tag)) { $this->template->trySet('current_' . $tag, $c); $matched = true; } array_pop($parts); } if (!$matched) { $this->template->set('current', $c); } parent::render(); }
function init() { parent::init(); $this->facebook = new Facebook(array('appId' => $this->api->getConfig('appId'), 'secret' => $this->api->getConfig('secret'))); // Get User ID $this->user = $this->facebook->getUser(); // We may or may not have this data based on whether the user is logged in. // // If we have a $this->user id here, it means we know the user is logged into // Facebook, but we don't know if the access token is valid. An access // token is invalid if the user logged out of Facebook. if ($this->user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $this->facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); $this->user = null; } } $this->loginUrl = $this->facebook->getLoginUrl(array('scope' => $this->api->getConfig('permissions'))); $this->logoutUrl = $this->facebook->getLogoutUrl(); }
public function render() { # make sure we have a template if ($this->template === false) { throw new TemplateUndefined(); } parent::render(); # unpack the props extract($this->props); # trap the buffer ob_start(); # include the template $f = $this->template_dir . DIRECTORY_SEPARATOR . $this->template . '.' . $this->extension; if (!file_exists($f)) { throw new TemplateFileNotFound(); } else { require $f; } # get the buffer contents $parsed = ob_get_contents(); # clean the buffer ob_clean(); # if there is a layout if ($this->layout) { # push the content into the layout $yield = $parsed; # include the template include $this->template_dir . DIRECTORY_SEPARATOR . $this->layout . '.' . $this->extension; # get the buffer contents $parsed = ob_get_contents(); } # close the output buffer ob_end_clean(); # echo the result echo $parsed; }
public function __construct(IDataGridComposite &$datagrid) { parent::__construct(); $this->setModel($datagrid); }
function init() { parent::init(); $this->setModel('helloworld/Test'); }
/** * Regular objects in Agile Toolkit use init() and are added through add(). * Application class is differente, you use "new" keyword because it's the * first class to be created. That's why constructor will perform quite a * bit of initialization. * * Do not redefine constructor but instead use init(); * * $realm defines a top-level name of your application. This impacts all * id= prefixes in your HTML code, form field names and many other things, * such as session name. If you have two application classes which are part * of same web app and may want to use same realm, but in other cases it's * preferably that you keep realm unique on your domain in the interests * of security. * * @param string $realm Will become $app->name * @param array $options */ public function __construct($realm = null, $options = array()) { parent::__construct($options); if ($realm === null) { $realm = get_class($this); } $this->owner = $this; $this->name = $realm; $this->app = $this; $this->api = $this->app; // compatibility with ATK 4.2 and lower // Profiler is a class for benchmarking your application. All calls to pr /**/ $this->pr = new Dummy(); try { $this->_beforeInit(); $this->init(); } catch (Exception $e) { // This exception is used to abort initialisation of the objects, // but when normal rendering is still required if ($e instanceof Exception_StopInit) { return; } // Handles output of the exception $this->caughtException($e); } }
function destroy() { parent::destroy(); if ($this->form != $this->owner) { $this->form->_removeElement($this->short_name); } }
function render() { $this->template->set($this->properties); parent::render(); }
function init() { parent::init(); $this->message = 'Hello world'; }
/** @obsolete */ function upCall($type, $args = array()) { /** * Uncaught call default handler. * * In your application you should handle your own calls. If you do not, * the call will be forwarded to API and finaly this method will be * executed displaying error message about uncaught call */ if (($x = parent::upCall($type, $args)) === false) { throw new BaseException("Uncaught upCall"); } }