本文整理汇总了PHP中Nette\Application\UI\Control::attached方法的典型用法代码示例。如果您正苦于以下问题:PHP Control::attached方法的具体用法?PHP Control::attached怎么用?PHP Control::attached使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Control
的用法示例。
在下文中一共展示了Control::attached方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attached
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');
}
示例2: attached
/**
* @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!'));
}
}
示例3: attached
protected function attached($presenter)
{
if ($presenter instanceof \Nette\Application\UI\Presenter) {
$this->setSessionSection($this->presenter->session->getSection('paypal'));
}
parent::attached($presenter);
}
示例4: attached
protected function attached($presenter)
{
parent::attached($presenter);
$this->addComponent(new Container(), 'columns');
$this->addComponent(new Container(), 'actions');
$this->init($presenter);
}
示例5: attached
/**
* @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!'));
}
}
示例6: attached
/**
* @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!')));
}
}
示例7: attached
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));
}
}
示例8: attached
/**
* @param \Nette\ComponentModel\IComponent $component
*/
protected function attached($component)
{
parent::attached($component);
if (!$component instanceof Presenter) {
return;
}
$this->configure($component);
}
示例9: attached
/**
* @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);
}
}
}
示例10: attached
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));
}
}
}
示例11: attached
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;
}
}
示例12: attached
/**
* @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]);
}
}
示例13: attached
/**
* @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().");
}
}
}
示例14: attached
/**
* @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 = [];
}
}
}
示例15: attached
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);
}
}