public function attached($presenter) { parent::attached($presenter); $this->wdata = $this->WDataModel->get($this->presenter->getParameter('destination')); $this->template->village = $this->village = $this->villageService->getVillage($this->presenter->getParameter('id')); $this->units = $this->unitService->getUnits($this->village); $this->template->units = $this->units; $this->template->names = $this->unitService->getNames(); $unitData = []; switch ($this->village->getOwner()->tribe) { case App\FrontModule\Model\User\UserService::TRIBE_ROMANS: foreach (App\GameModule\Model\Units\UnitService::ROMANS as $unit) { $unitData[] = $this->unitFactory->getUnit($unit); } break; case App\FrontModule\Model\User\UserService::TRIBE_TEUTONS: foreach (App\GameModule\Model\Units\UnitService::TEUTONS as $unit) { $unitData[] = $this->unitFactory->getUnit($unit); } break; case App\FrontModule\Model\User\UserService::TRIBE_GAULS: foreach (App\GameModule\Model\Units\UnitService::GAULS as $unit) { $unitData[] = $this->unitFactory->getUnit($unit); } break; } $this->template->unitData = $unitData; $this->template->setFile(__DIR__ . '/SendUnitsControl.latte'); }
/** * @param \Nette\ComponentModel\Container $obj */ protected function attached($obj) { parent::attached($obj); if ($obj instanceof Nette\Application\IPresenter) { $this->currentUrl = new UrlScript($this->link('//response!')); } }
protected function attached($presenter) { if ($presenter instanceof \Nette\Application\UI\Presenter) { $this->setSessionSection($this->presenter->session->getSection('paypal')); } parent::attached($presenter); }
protected function attached($presenter) { parent::attached($presenter); $this->addComponent(new Container(), 'columns'); $this->addComponent(new Container(), 'actions'); $this->init($presenter); }
/** * @param \Nette\ComponentModel\Container $obj */ protected function attached($obj) { parent::attached($obj); if ($obj instanceof Nette\Application\UI\Presenter) { $this->payPal->setReturnAddress($this->link('//return!'), $this->link('//cancel!')); } }
/** * @param Nette\ComponentModel\Container $obj */ protected function attached($obj) { parent::attached($obj); if ($obj instanceof Nette\Application\IPresenter) { $this->client->getConsumer()->setCallbackUrl(new Http\UrlScript($this->link('//response!'))); } }
public function attached($presenter) { parent::attached($presenter); $this->column = $this->lookup('Brabijan\\Datagrid\\Renderer')->getColumn($this->columnId); if ($this->templateRowCallback) { $this->templateRowCallback->invokeArgs(array($this)); } }
/** * @param \Nette\ComponentModel\IComponent $component */ protected function attached($component) { parent::attached($component); if (!$component instanceof Presenter) { return; } $this->configure($component); }
/** * @param \Nette\Application\UI\Presenter $presenter */ public function attached($presenter) { parent::attached($presenter); if ($presenter instanceof Presenter) { foreach ($this->views as $view) { $view->onAttached($this); } } }
protected function attached($presenter) { parent::attached($presenter); if ($presenter instanceof Presenter) { foreach ($this->rootItem->getItems(TRUE) as $item) { !$item->isUrl() and $item->setCurrent($presenter->isLinkCurrent($item->link, $item->linkArgs)); } } }
public function attached($presenter) { parent::attached($presenter); $this->template->current = $this->presenter->template->current; $this->template->next = $this->presenter->template->next; $this->village = $this->villageService->getVillage($this->presenter->getParameter('id')); $building = $this->presenter->getParameter('building'); switch ($building) { case App\GameModule\Model\Building\BuildingModel::WOODCUTTER: case App\GameModule\Model\Building\BuildingModel::CLAY_PIT: case App\GameModule\Model\Building\BuildingModel::IRON_MINE: case App\GameModule\Model\Building\BuildingModel::CROPLAND: $this->renderResourceField(); break; case App\GameModule\Model\Building\BuildingModel::WAREHOUSE: case App\GameModule\Model\Building\BuildingModel::CRANNY: case App\GameModule\Model\Building\BuildingModel::GRANARY: case App\GameModule\Model\Building\BuildingModel::TRAPPER: $this->renderCapacity(); break; case App\GameModule\Model\Building\BuildingModel::MAIN_BUILDING: $this->renderMainBuilding(); break; case App\GameModule\Model\Building\BuildingModel::BARRACKS: $this->renderBarracks(); break; case App\GameModule\Model\Building\BuildingModel::STABLE: $this->renderStable(); break; case App\GameModule\Model\Building\BuildingModel::ACADEMY: $this->renderAcademy(); break; case App\GameModule\Model\Building\BuildingModel::ARMOURY: $this->renderArmoury(); break; case App\GameModule\Model\Building\BuildingModel::BLACKSMITH: $this->renderBlacksmith(); break; case App\GameModule\Model\Building\BuildingModel::MARKET_PLACE: $this->renderMarketPlace(); break; case App\GameModule\Model\Building\BuildingModel::EMBASSY: $this->renderEmbassy(); break; case App\GameModule\Model\Building\BuildingModel::HERO_MANSION: $this->renderHeroMansion(); break; case App\GameModule\Model\Building\BuildingModel::RALLY_POINT: $this->renderRallyPoint(); break; default: $this->template->setFile(__DIR__ . '/Template/Blank.latte'); break; } }
/** * @param \Nette\Application\UI\Presenter $presenter */ protected function attached($presenter) { parent::attached($presenter); if (!$presenter instanceof Presenter) { return; } $this->addComponent(new \Nette\ComponentModel\Container(), "columns"); $this->addComponent(new \Nette\ComponentModel\Container(), "buttons"); $this->addComponent(new \Nette\ComponentModel\Container(), "globalButtons"); $this->addComponent(new \Nette\ComponentModel\Container(), "actions"); $this->addComponent(new \Nette\ComponentModel\Container(), "subGrids"); if ($presenter->isAjax()) { $this->invalidateControl(); } $this->configure($presenter); if ($this->isSubGrid && !empty($this->afterConfigureSettings)) { call_user_func($this->afterConfigureSettings, $this); } if ($this->hasActiveSubGrid()) { $subGrid = $this->addComponent($this['subGrids']->components[$this->activeSubGridName]->getGrid(), "subGrid" . $this->activeSubGridName); $subGrid->registerSubGrid("subGrid" . $this->activeSubGridName); } if ($this->hasActionForm()) { $actions = array(); foreach ($this['actions']->components as $name => $action) { $actions[$name] = $action->getAction(); } $this['gridForm'][$this->name]['action']['action_name']->setItems($actions); } if ($this->paginate) { if ($this->hasActiveItemPerPage()) { if (in_array($this->perPage, $this['gridForm'][$this->name]['perPage']['perPage']->items)) { $this['gridForm'][$this->name]['perPage']->setDefaults(array("perPage" => $this->perPage)); } else { $items = $this['gridForm'][$this->name]['perPage']['perPage']->getItems(); $this->perPage = reset($items); } } else { $items = $this['gridForm'][$this->name]['perPage']['perPage']->getItems(); $this->perPage = reset($items); } $this->getPaginator()->itemsPerPage = $this->perPage; } if ($this->hasActiveFilter()) { $this->filterData(); $this['gridForm'][$this->name]['filter']->setDefaults($this->filter); } if ($this->hasActiveOrder() && $this->hasEnabledSorting()) { $this->orderData($this->order); } if (!$this->hasActiveOrder() && $this->hasDefaultOrder() && $this->hasEnabledSorting()) { $order = explode(" ", $this->defaultOrder); $this->dataSource->orderData($order[0], $order[1]); } }
/** * @param \Nette\Application\UI\PresenterComponent * @throws \Nette\InvalidStateException */ protected function attached($obj) { parent::attached($obj); if ($obj instanceof Nette\Application\IPresenter) { $this->startup(); if (!$this->startupCheck) { $class = $this->getReflection()->getMethod('startup')->getDeclaringClass()->getName(); throw new \Nette\InvalidStateException("Method {$class}::startup() or its descendant doesn't call parent::startup()."); } } }
/** * @param NPresenter $presenter * @return void */ protected function attached($presenter) { if ($presenter instanceof NPresenter) { $this->build(); parent::attached($presenter); $this->session = $presenter->getSession(__CLASS__ . '-' . $this->getName()); if (!isset($presenter->payload->twiGrid)) { $presenter->payload->twiGrid['forms'] = $this->presenter->payload->twiGrid = []; } } }
public function attached($presenter) { parent::attached($presenter); if ($presenter instanceof UI\Presenter) { if (!$presenter->getName()) { throw new InvalidArgumentException('Parameter name is required.'); } /** @var Mesour\Components\Application\IApplication $application */ $this->mesourApplication = $presenter->getContext()->getByType(Mesour\Components\Application\IApplication::class); $this->mesourApplication->setLink(new Mesour\Bridges\Nette\Link($this)); if (isset($this->mesourApplication[$this->getName()])) { $this->mesourApplication->removeComponent($this->getName()); } $this->grid = new Mesour\UI\DataGrid($this->getName(), $this->mesourApplication); } }
/** * @param \Nette\ComponentModel\IComponent $component */ protected function attached($component) { parent::attached($component); if (!$component instanceof Presenter) { return; } $this->configure($component); // sorting validation $directions = [self::SORT_ASC, self::SORT_DESC]; foreach ($this->sortBy as $column => $direction) { if (!isset($this->columns[$column]) || !$this->columns[$column]->isSortable() || !in_array($direction, $directions)) { unset($this->sortBy[$column]); continue; } } $this->paginator->setPage($this->page)->setItemsPerPage($this->perPage); }
protected function attached($presenter) { return $this->control->attached($presenter); }
protected function attached($presenter) { parent::attached($presenter); $this->filterDataSource = $this->filter; }
/** * @param Nette\ComponentModel\IComponent $presenter * @return void */ protected function attached($presenter) { $this->build(); parent::attached($presenter); !isset($this->presenter->payload->twiGrid) && ($this->presenter->payload->twiGrid['forms'] = $this->presenter->payload->twiGrid = array()); }
/** * {inheritDoc} * @return void */ public function attached($presenter) { parent::attached($presenter); if ($presenter instanceof Nette\Application\UI\Presenter) { /** * Get session */ $this->grid_session = $this->getPresenter()->getSession($this->getSessionSectionName()); /** * Try to find previous filters/pagination/sort in session */ $this->findSessionFilters(); } }
public function attached($presenter) { parent::attached($presenter); $this->renderer = $this->lookup('Brabijan\\Datagrid\\Renderer'); }
/** * {inheritDoc} * @return void */ public function attached($presenter) { parent::attached($presenter); if ($presenter instanceof Nette\Application\UI\Presenter) { /** * Get session */ if ($this->remember_state) { $this->grid_session = $presenter->getSession($this->getSessionSectionName()); } } }
/** * Automatic snippet invalidation */ public function attached($presenter) { parent::attached($presenter); $this->startup(); if ($this->translator === NULL) { $this->translator = $presenter->translator; } if ($this->autoAjax && $this->ajaxEnabled && $presenter->isAjax()) { $this->redrawControl(); $this->presenter->payload->setUrl = $this->link('this'); } }
/** * @param IComponent $component */ protected function attached($component) { parent::attached($component); if (!$component instanceof Presenter) { return; } if ($this->visible) { self::$ACTIVE_MODAL = $this; } }
/** * @param \Nette\ComponentModel\Container $container */ protected function attached($container) { if ($container instanceof Presenter) { $this->configure($container); foreach ($this->getComponents() as $component) { $this->active = $component->name; break; } } parent::attached($container); }
protected function attached($presenter) { parent::attached($presenter); $this->views = $this->getViews(); $this->related = array_fill_keys(array_keys($this->views), []); }
/** * @param $container */ protected function attached($container) { if ($container instanceof Presenter) { $this->configure($container); } parent::attached($container); }
public function attached($presenter) { parent::attached($presenter); $this->template->errorsLayout = __DIR__ . "/errors.latte"; $this->template->flashesLayout = __DIR__ . "/flashes.latte"; }
/** * @param \Nette\Application\IPresenter $presenter */ protected function attached($presenter) { parent::attached($presenter); // template configurator if ($this->presenter->context->hasService('venne.templateConfigurator')) { $this->setTemplateConfigurator($this->presenter->context->venne->templateConfigurator); } // startup check $this->startup(); if (!$this->startupCheck) { $class = $this->getReflection()->getMethod('startup')->getDeclaringClass()->getName(); throw new \Nette\InvalidStateException("Method {$class}::startup() or its descendant doesn't call parent::startup()."); } }
/** * @param ITranslatableComponent $parent */ protected function attached($parent) { parent::attached($parent); $this->translator = $parent->getTranslator(); }