public function renderRoute($vars) { $config = Config::getInstance(); $queries = CMS7_Queries::getInstance(); $config->queries = $queries; $config->theme_path = join_path($config->base_path, 'themes'); $config->module_path = join_path($config->base_path, 'modules'); $config->plugin_path = join_path($config->base_path, 'plugin'); $config->request_vars = $vars; $config->site = $config->queries->site->get_site_details(); $this->site = $config->site; if (isset($vars->page)) { if (ctype_digit($vars->page)) { $page_id = $vars->page; } else { $page_id = $config->queries->site->find_page_id_by_name(strtolower($vars->page)); } } if (!isset($page_id) || !$page_id) { $page_id = $this->site->site_home_page_id; } $this->page_id = $page_id; $layout = new Layout($page_id); $this->layout = $layout; $layout->vars = $vars; $content = $layout->render(); return $content; }
public function view(SymphonyDOMElement $wrapper, MessageStack $errors) { $layout = new Layout(); $left = $layout->createColumn(Layout::SMALL); $right = $layout->createColumn(Layout::LARGE); // Essentials -------------------------------------------------------- $fieldset = Widget::Fieldset(__('Essentials')); // Name: $label = Widget::Label(__('Name')); $input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name)); $label->appendChild($input); if (isset($errors->{'about::name'})) { $label = Widget::wrapFormElementWithError($label, $errors->{'about::name'}); } $fieldset->appendChild($label); $left->appendChild($fieldset); $fieldset = Widget::Fieldset(__('Content')); $label = Widget::Label(__('Source XML')); $input = Widget::Textarea('fields[xml]', $this->parameters()->{'xml'}, array('rows' => '24', 'cols' => '50', 'class' => 'code')); $label->appendChild($input); if (isset($errors->{'xml'})) { $label = Widget::wrapFormElementWithError($label, $errors->{'xml'}); } $fieldset->appendChild($label); $right->appendChild($fieldset); $layout->appendTo($wrapper); }
/** * Método que redireciona para uma página personalizada de erro 404. */ public final function forge404() { $layout = new Layout(); $layout->setTitle('404 - Página não encontrada'); $view = new View(); $view->render("errors/404", $layout); }
public function actionAddComent() { $this->view = new View($this->params, PATH_VIEW_COMENT, 'add-coment_tpl.php', false); $this->html->add('content', $this->view->render()); $layout = new Layout($this->html->getArray()); $layout->get(); }
/** * @param int $type * @param int $count * @param int $level * @param Layout $previousLayout * @return Layout */ protected function _initLayout($type, $count, &$level, $previousLayout = null) { $layout = new Layout(); $layout->setLevel($level); for ($i = 0; $i < $count; $i++) { $_neuron = Factory::neuron($type, $i); $_neuron->setLayout($layout); $_neuron->hash(); if (isset($previousLayout)) { /** @var Neuron $prevNeuron */ foreach ($previousLayout->neuronGenerator() as $prevNeuron) { $_relation = new Relation($prevNeuron, $_neuron); //Init relation and add neurons there //Set relation to neurons $_neuron->addRelation($_relation, Relation::MISTAKE); //reverse $prevNeuron->addRelation($_relation, Relation::SIGNAL); //direct } } $layout->addNeuron($_neuron); } $level++; return $layout; }
public function testGetBlock() { $blockName = 'block.name'; $block = $this->getMock('Magento\\Framework\\View\\Element\\BlockInterface'); $this->layout->expects($this->once())->method('getBlock')->with($blockName)->will($this->returnValue($block)); $this->assertEquals($block, $this->model->getBlock($blockName)); }
public function renderHtml($layout = FALSE, $engine = FALSE, $engineObject = FALSE) { $this->init(); $this->setPages(); $layout = new Layout($layout, $this->pages, $engine, $engineObject); return $layout->getHTML(); }
public function actionEditProfile() { $this->view = new View($this->session->getAllParams(), PATH_VIEW_AUTHOR, 'edit-profile_tpl.php', false); $this->html->add('content', $this->view->render()); $layout = new Layout($this->html->getArray()); $layout->get(); }
public function view(SymphonyDOMElement $wrapper, MessageStack $errors) { $page = Administration::instance()->Page; $page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/bbcww_api_client/assets/view.js')); $layout = new Layout(); $left = $layout->createColumn(Layout::SMALL); $right = $layout->createColumn(Layout::LARGE); $fieldset = Widget::Fieldset(__('Essentials')); $label = Widget::Label(__('Name')); $label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name))); if (isset($errors->{'about::name'})) { $fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'})); } else { $fieldset->appendChild($label); } $field_groups = $options = array(); foreach ($this->driver->getMemberSections() as $section) { $source = $section->{'api-source'}; $field_groups[$section->handle] = array('fields' => $section->fields, 'section' => $section); if (!isset($options[$source])) { $options[$source] = array('label' => ucwords(strtr($source, '-', ' ')), 'options' => array()); } $options[$source]['options'][] = array($section->handle, $this->parameters()->section == $section->handle, $section->name); } $label = Widget::Label(__('Section')); $label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context'))); $fieldset->appendChild($label); $left->appendChild($fieldset); $fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}'); foreach ($this->driver->getMemberSections() as $section) { $this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL); } $right->appendChild($fieldset); $layout->appendTo($wrapper); }
function __construct(Layout $main, $onlyBlocks = null) { $this->main = $main; $this->onlyBlocks = $onlyBlocks; if ($main->served() !== null) { $this->served = $main->servedResponse(); $this->served->isServed = true; } }
/** * @covers Rvi\Html\Layout\Layout::toHtml */ public function testToHtml() { $this->object->addContent("phpunit-test"); $this->object->addContent("another line"); $strHtml = $this->object->toHtml(); $this->assertContains("<html", $strHtml); $this->assertContains("phpunit-test", $strHtml); $this->assertContains("another line", $strHtml); $this->assertContains("</html>", $strHtml); }
/** * method puts scalebar onto map * * @param Layout $layout */ public function putOnMap($layout = null) { $this->setLogoLayout($layout); $worldMap = $this->_map->getWorldMap(); $widthPx = $worldMap->getWidth(); $equatorPixelsPerKm = $widthPx / self::$earthCircumference; $scale = $this->_calculateScale(); $label = $this->_findOutWhichLabel($scale, $equatorPixelsPerKm); $this->_layout->putImage($this->_map, $this->_createScaleBarMap($label, $this->_calculateLengthOfScaleBar($label, $scale, $equatorPixelsPerKm))); }
static function getFile($id) { $l = new Layout(); $l->getByID($id); if ($l->layout_file != "") { return $l->layout_file; } else { return 0; } }
public function install($id) { $dir = FROG_ROOT . '/public/themes/' . $id . '/'; $files = $this->scan_directory_recursively($dir, 'php'); $data = array(); $data['name'] = $id; // Layouts $layouts = array(); $l = array(); // Snippets $snippets = array(); $s = array(); foreach ($files as $file) { switch ($file['name']) { case 'layouts': foreach ($file['content'] as $layout) { $layouts[] = $layout['name']; $l['name'] = Themr::theme_name($layout['name']); $l['content_type'] = 'text/html'; $l['content'] = file_get_contents($layout['path']); $layout = new Layout($l); if (!$layout->save()) { Flash::set('error', __('Layout has not been added. Name must be unique!')); } } break; case 'snippets': foreach ($file['content'] as $snippet) { $snippets[] = $snippet['name']; $s['name'] = $snippet['name']; $s['filter_id'] = ''; $s['content'] = file_get_contents($snippet['path']); $snippet = new Snippet($s); if (!$snippet->save()) { Flash::set('error', __('Snippet has not been added. Name must be unique!')); } } break; } } // Serialize Layout and Snippet names $data['layout'] = serialize($layouts); $data['snippet'] = serialize($snippets); // Get Current Theme Info $theme_info = Themr::findTheme($id); // Save into Themr database table $theme = new Themr($data); if (!$theme->save()) { Flash::set('error', __('Theme has not been added. Name must be unique!')); redirect(get_url('plugin/themr')); } else { Flash::set('success', __('Theme <b>:name</b> has been added!', array(':name' => $theme_info['name']))); redirect(get_url('plugin/themr')); } }
/** * Método responsável por renderizar a view. * @param string $viewName Título da view. * @param Layout $layout Objeto com as opções de layout. */ protected function render($viewName, Layout $layout) { $this->_viewFileName = $viewName; $layoutFilePath = "../app/views/layout/layout.phtml"; $this->_layout = $layout; if ($layout->getEnableLayout() && file_exists($layoutFilePath)) { require_once $layoutFilePath; } else { $this->getContent(); } }
public function view(SymphonyDOMElement $wrapper, MessageStack $errors) { $page = Administration::instance()->Page; $page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js')); $layout = new Layout(); $column_1 = $layout->createColumn(Layout::SMALL); $column_2 = $layout->createColumn(Layout::SMALL); $column_3 = $layout->createColumn(Layout::LARGE); $fieldset = Widget::Fieldset(__('Essentials')); $label = Widget::Label(__('Name')); $label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name))); if (isset($errors->{'about::name'})) { $fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'})); } else { $fieldset->appendChild($label); } $label = Widget::Label(__('Section')); $options = array(); foreach (new SectionIterator() as $section) { $options[] = array($section->handle, $this->parameters()->section == $section->handle, $section->name); } $label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context'))); $fieldset->appendChild($label); $column_1->appendChild($fieldset); $fieldset = Widget::Fieldset(__('Processing Options')); $label = Widget::Label(__('Filter Rules')); $filters = $this->parameters()->filters; if (!is_array($filters)) { $filters = array(); } $options = array(array('admin-only', in_array('admin-only', $filters), __('Admin Only')), array('send-email', in_array('send-email', $filters), __('Send Email')), array('expect-multiple', in_array('expect-multiple', $filters), __('Allow Multiple'))); ### # Delegate: AppendEventFilter # Description: Allows adding of new filter rules to the Event filter # rule select box. A reference to the $options array is provided, and selected filters Extension::notify('AppendEventFilter', '/blueprints/events/', array('selected' => $filters, 'options' => &$options)); $label->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple'))); $fieldset->appendChild($label); $label = Widget::Label(); $input = Widget::Input('fields[output-id-on-save]', 'yes', 'checkbox'); if ($this->parameters()->{'output-id-on-save'} == true) { $input->setAttribute('checked', 'checked'); } $label->appendChild($input); $label->appendChild(new DOMText(__('Add entry ID to the parameter pool in the format of $this-name-id when saving is successful.'))); $fieldset->appendChild($label); $column_2->appendChild($fieldset); $fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}'); foreach (new SectionIterator() as $section) { $this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL); } $column_3->appendChild($fieldset); $layout->appendTo($wrapper); }
function testGetSectorNames() { $f = new File("/framework/core/tests/pages/layout/my_test.layout.php"); $l = new Layout(); $l->__setup($f->getPath(), "my_test.layout.php", new Tree()); $this->assertEqual(count($l->getSectorNames()), 3, "Il numero dei settori non coincide!!"); $sector_names = $l->getSectorNames(); $this->assertEqual($sector_names[0], "/page/headers", "Il nome del settore non coincide!! : " . $sector_names[0]); $this->assertEqual($sector_names[1], "/content", "Il nome del settore non coincide!! : " . $sector_names[1]); $this->assertEqual($sector_names[2], "/footer", "Il nome del settore non coincide!! : " . $sector_names[2]); }
public static function create($name, $data) { $loader = LayoutLoader::instance(); if ($loader->has_found_layout($name)) { $layout_path = $loader->get_layout_path_by_name($name); $layout = new Layout(); $layout->__setup($layout_path, $name, new Tree($data)); return $layout; } else { return BlockFactory::create("errors/layout_not_found", array("layout_name" => $name)); } }
function alter(Layout $layout) { $matched = $layout->find($this->path); if ($matched) { $this->mergeInto($matched->blocks); } elseif (count($this->path) == 2 and !reset($this->path) and $view = $layout->find('')) { $view->add(array(join('.', end($this->path)) => $this->blocks)); } else { Log::info_Alter("No matching block [{$this->pathStr()}] to {$this->type}."); } return $this; }
public function route(HTTPRequest $request, Layout $response) { $valid_route = new Valid_WhiteList('func', $this->routes); $valid_route->required(); if ($request->valid($valid_route)) { $route = $request->get('func'); $controller = new OpenId_LoginController($this->logger, new OpenId_AccountManager(new Openid_Dao(), UserManager::instance()), $request, $response); $controller->{$route}(); } else { $response->addFeedback(Feedback::ERROR, 'Invalid request for ' . __CLASS__); $response->redirect('/'); } }
/** * 录入 * */ public function actionCreate($id) { parent::_acl('layout_create'); $model = new Layout(); if (isset($_POST['Layout'])) { $model->attributes = $_POST['Layout']; if ($model->save()) { AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入房屋布局,ID:' . $model->id)); $this->redirect(array('index', 'id' => $model->house_id)); } } $this->render('create', array('model' => $model, 'house_id' => $id)); }
public function all($id) { $arr = array(); $sql = "SELECT `layout`.`id` as `id`, `tema`.`capa` as `capa` FROM `layout` \n\t\t\t\tINNER JOIN `tema` ON `tema`.`id`=`layout`.`tema_idtema`\n\t\t\t\tWHERE `layout`.`cliente_idcliente`={$id};"; $vai = new MySQLDB(); $result = $vai->executeQuery($sql); while ($dados = mysql_fetch_array($result)) { $cliente = new Layout(); $cliente->setid(array('id' => $dados['id'])); $cliente->setcapa(array('capa' => $dados['capa'])); $arr[] = $cliente; } return $arr; }
public function init() { parent::init(); if (!Yii::app()->getUser()->getIsGuest()) { Layout::addBlock('sidebar.left', array('id' => 'profile_sidebar', 'content' => $this->widget('ProfileWidget', array('userModel' => Yii::app()->getUser()->getModel()), true))); } }
public static function process() { if (!Current_User::authorized('analytics')) { Current_User::disallow(); } $panel = self::cpanel(); if (isset($_REQUEST['command'])) { $command = $_REQUEST['command']; } else { $command = $panel->getCurrentTab(); } switch ($command) { case 'list': $panel->setContent(self::listTrackers()); break; case 'new': $panel->setContent(self::newTracker()); break; case 'create': $panel->setContent(self::createTracker()); break; case 'edit': $panel->setContent(self::editTracker()); break; case 'delete': $panel->setContent(self::deleteTracker()); break; case 'save_tracker': $panel->setContent(self::saveTracker()); break; } Layout::add(PHPWS_ControlPanel::display($panel->display())); }
/** * 得到当前布局名 * * @param $name 如果设置值则 Layout 登录这个值,否则返回当前的 Layout 名称 * @return string */ public static function name($name = '') { if ($name) { self::$_name = $name; } return self::$_name; }
public function search($user) { try { $cross_search_criteria = $this->getCrossSearchCriteriaFromRequest(); $project_id = $this->request->get('group_id'); $project = $this->getProject($project_id, $this->project_manager); $view = $this->view_builder->build($user, $project, $cross_search_criteria); $view->render($user); } catch (Tracker_CrossSearch_ProjectNotFoundException $e) { $this->layout->addFeedback('error', $e->getMessage()); $this->layout->redirect('/'); } catch (Tracker_CrossSearch_ServiceNotUsedException $e) { $this->layout->addFeedback('error', $e->getMessage()); $this->layout->redirect('/projects/' . $project->getUnixName() . '/'); } }
public function actionUpdate($id) { $model = new SettingsForm(); if (isset($_POST['SettingsForm'])) { $model->attributes = $_POST['SettingsForm']; if ($model->validate() && $model->save()) { $this->redirect(array('index')); } } else { $model->loadDataFromStore($id); } $directories = glob(Yii::getPathOfAlias('webroot.themes') . "/*", GLOB_ONLYDIR); $themes = array(); foreach ($directories as $directory) { $themes[] = basename($directory); } $layouts = CHtml::listData(Layout::model()->findAll(), 'layout_id', 'name'); $countries = CHtml::listData(Country::model()->findAll(), 'country_id', 'name'); $zones = CHtml::listData(Zone::model()->findAllByAttributes(array('country_id' => $model->country)), 'zone_id', 'name'); $languages = CHtml::listData(Language::model()->findAll(), 'language_id', 'name'); $currencies = CHtml::listData(Currency::model()->findAll(), 'currency_id', 'title'); $yesNoOptions = array(0 => Yii::t('settings', 'No'), 1 => Yii::t('settings', 'Yes')); $lengthClasses = CHtml::listData(LengthClassDescription::model()->findAll(), 'length_class_id', 'title'); $weightClasses = CHtml::listData(WeightClassDescription::model()->findAll(), 'weight_class_id', 'title'); $taxesOptions = array("" => Yii::t("settings", "--- None ---"), "shipping" => Yii::t("settings", "Shipping Address"), "payment" => Yii::t("settings", "Payment Address")); $customerGroups = CHtml::listData(CustomerGroupDescription::model()->findAll(), 'customer_group_id', 'name'); $informations = array_merge(array(0 => Yii::t("settings", "--- None ---")), CHtml::listData(InformationDescription::model()->findAll(), 'information_id', 'title')); // TODO: localisation $orderStatuses = CHtml::listData(OrderStatus::model()->findAllByAttributes(array('language_id' => 1)), 'order_status_id', 'name'); // TODO: localisation $returnStatuses = CHtml::listData(ReturnStatus::model()->findAllByAttributes(array('language_id' => 1)), 'return_status_id', 'name'); $mailProtocols = array("mail" => Yii::t("settings", "Mail"), "smtp" => Yii::t("settings", "SMTP")); $this->render('update', array('model' => $model, 'themes' => $themes, 'layouts' => $layouts, 'countries' => $countries, 'zones' => $zones, 'languages' => $languages, 'currencies' => $currencies, 'yesNoOptions' => $yesNoOptions, 'lengthClasses' => $lengthClasses, 'weightClasses' => $weightClasses, 'taxesOptions' => $taxesOptions, 'customerGroups' => $customerGroups, 'informations' => $informations, 'orderStatuses' => $orderStatuses, 'returnStatuses' => $returnStatuses, 'mailProtocols' => $mailProtocols)); }
/** * Loads the form's fields with the internship's information. * TODO: Use getter methods instead of just accessing Internship member variables directly. */ public function plugInternship() { $this->plugStudent(); $this->plugDept(); $this->plugFaculty(); $this->plugAgency(); $this->plugInternInfo(); $this->plugCourseInfo(); // We're editing an internship... // If this internship's term is in the past, then replace the term list with just that term if (!in_array($this->intern->term, array_keys(Term::getFutureTermsAssoc()))) { // Remove the term dropdown and repalce it $this->form->dropElement('term'); $this->form->addSelect('term', array($this->intern->term => Term::rawToRead($this->intern->term))); $this->form->setLabel('term', 'Select Term'); $this->form->addCssClass('term', 'form-control'); } $this->form->setMatch('term', $this->intern->term); $this->form->setMatch('experience_type', $this->intern->getExperienceType()); // Plug $this->form->plugIn($this->formVals); /** * * * Emergency Contacts */ //javascript('jquery'); PHPWS_Core::initModClass('intern', 'EmergencyContactFactory.php'); $contacts = EmergencyContactFactory::getContactsForInternship($this->intern); $emgContactJson = json_encode($contacts); Layout::add(javascriptMod('intern', 'emergencyContact', array('existing_contacts_json' => $emgContactJson))); }
public function index($arguments) { $news = new news(ConnectionFactory::get('mongo')); $articles = new articles(ConnectionFactory::get('mongo')); $notices = new notices(ConnectionFactory::get('redis')); $irc = new irc(ConnectionFactory::get('redis')); $quotes = new quotes(ConnectionFactory::get('mongo')); $forums = new forums(ConnectionFactory::get('redis')); // Set all site-wide notices. foreach ($notices->getAll() as $notice) { Error::set($notice, true); } // Fetch the easy data. $this->view['news'] = $news->getNewPosts(); $this->view['shortNews'] = $news->getNewPosts(true); $this->view['newArticles'] = $articles->getNewPosts('new', 1, 5); $this->view['ircOnline'] = $irc->getOnline(); $this->view['randomQuote'] = $quotes->getRandom(); $this->view['fPosts'] = $forums->getNew(); // Get online users. $apc = new APCIterator('user', '/' . Cache::PREFIX . 'user_.*/'); $this->view['onlineUsers'] = array(); while ($apc->valid()) { $current = $apc->current(); array_push($this->view['onlineUsers'], substr($current['key'], strlen(Cache::PREFIX) + 5)); $apc->next(); } // Set title. Layout::set('title', 'Home'); }
public function getForm() { \Layout::addStyle('filecabinet', 'FC_Forms/form_style.css'); $this->loadJavascript(); $this->loadTemplate(); return $this->template->get(); }