当前位置: 首页>>代码示例>>PHP>>正文


PHP Control::attached方法代码示例

本文整理汇总了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');
 }
开发者ID:Spameri,项目名称:TravianZ,代码行数:29,代码来源:SendUnitsControl.php

示例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!'));
     }
 }
开发者ID:runt18,项目名称:Github-1,代码行数:10,代码来源:LoginDialog.php

示例3: attached

 protected function attached($presenter)
 {
     if ($presenter instanceof \Nette\Application\UI\Presenter) {
         $this->setSessionSection($this->presenter->session->getSection('paypal'));
     }
     parent::attached($presenter);
 }
开发者ID:MartinKokesCz,项目名称:nette-paypal,代码行数:7,代码来源:Control.php

示例4: attached

 protected function attached($presenter)
 {
     parent::attached($presenter);
     $this->addComponent(new Container(), 'columns');
     $this->addComponent(new Container(), 'actions');
     $this->init($presenter);
 }
开发者ID:kissmael,项目名称:kmgrid,代码行数:7,代码来源:KMGrid.php

示例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!'));
     }
 }
开发者ID:Hajneej,项目名称:PayPalExpress,代码行数:10,代码来源:PayControl.php

示例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!')));
     }
 }
开发者ID:jirinapravnik,项目名称:twitter,代码行数:10,代码来源:LoginDialog.php

示例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));
     }
 }
开发者ID:brabijan,项目名称:datagrid,代码行数:8,代码来源:Column.php

示例8: attached

 /**
  * @param \Nette\ComponentModel\IComponent $component
  */
 protected function attached($component)
 {
     parent::attached($component);
     if (!$component instanceof Presenter) {
         return;
     }
     $this->configure($component);
 }
开发者ID:brosland,项目名称:framework,代码行数:11,代码来源:Control.php

示例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);
         }
     }
 }
开发者ID:wodCZ,项目名称:Nette-NoGrid,代码行数:12,代码来源:NoGrid.php

示例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));
         }
     }
 }
开发者ID:kollarovic,项目名称:navigation,代码行数:9,代码来源:BaseControl.php

示例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;
     }
 }
开发者ID:Spameri,项目名称:TravianZ,代码行数:55,代码来源:BuildingDetailControl.php

示例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]);
     }
 }
开发者ID:HotelQuickly,项目名称:NiftyGrid,代码行数:58,代码来源:Grid.php

示例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().");
         }
     }
 }
开发者ID:jedenweb,项目名称:framework,代码行数:15,代码来源:Control.php

示例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 = [];
         }
     }
 }
开发者ID:uestla,项目名称:twigrid,代码行数:15,代码来源:DataGrid.php

示例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);
     }
 }
开发者ID:mesour,项目名称:nette-bridges,代码行数:16,代码来源:DataGridControl.php


注:本文中的Nette\Application\UI\Control::attached方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。