예제 #1
0
파일: Validator.php 프로젝트: ark8/security
 /**
  * @param \Nette\Application\UI\PresenterComponent $component
  * @param string $destination
  * @param array $args
  */
 public function onLink(PresenterComponent $component, $destination, array $args = [])
 {
     $component->link($destination, $args);
     if ($request = $component->getPresenter()->lastCreatedRequest) {
         return $this->onPresenter($request);
     }
 }
예제 #2
0
파일: Link.php 프로젝트: kovkus/r-cms
 /**
  * Converts link to URL.
  * @return string
  */
 public function __toString()
 {
     try {
         return $this->component->link($this->destination, $this->params);
     } catch (\Exception $e) {
         Nette\Diagnostics\Debugger::toStringException($e);
     }
 }
예제 #3
0
 /**
  * Converts link to URL.
  * @return string
  */
 public function __toString()
 {
     try {
         return (string) $this->component->link($this->destination, $this->params);
     } catch (\Exception $e) {
         trigger_error("Exception in " . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
     }
 }
예제 #4
0
 public function getComponents($deep = FALSE, $filterType = NULL)
 {
     $components = $this->component->getComponents($deep, $filterType);
     $result = [];
     foreach ($components as $name => $component) {
         $result[$name] = $this->wrapComponent($name, $component);
     }
     return new RecursiveComponentIterator($result);
 }
예제 #5
0
 public function getStateForComponent(PresenterComponent $component)
 {
     $name = $component->getUniqueId();
     if (isset($this->state->{$name})) {
         return $this->state->{$name};
     } else {
         $state = new \Nette\Utils\ArrayHash();
         $this->state->{$name} = $state;
         return $state;
     }
 }
예제 #6
0
 /**
  * Converts link to URL.
  * @return string
  */
 public function __toString()
 {
     try {
         return (string) $this->component->link($this->destination, $this->params);
     } catch (\Throwable $e) {
     } catch (\Exception $e) {
     }
     if (isset($e)) {
         if (func_num_args()) {
             throw $e;
         }
         trigger_error("Exception in " . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
     }
 }
예제 #7
0
파일: Helpers.php 프로젝트: svobodni/web
 /**
  * @param Nette\Application\UI\PresenterComponent $component
  * @return array
  */
 public static function nullLinkParams(Nette\Application\UI\PresenterComponent $component)
 {
     $parent = $component;
     $presenter = $component instanceof Nette\Application\UI\Presenter ? NULL : $component->lookup('Nette\\Application\\UI\\Presenter');
     $params = array();
     do {
         if ($parent && method_exists($parent, 'getPersistentParams')) {
             $name = $parent instanceof Nette\Application\UI\Presenter ? '' : $parent->lookupPath(get_class($presenter));
             foreach ($parent->reflection->getPersistentParams() as $param => $info) {
                 $params[($name ? $name . $component::NAME_SEPARATOR : NULL) . $param] = $info['def'] ?: NULL;
             }
         }
     } while ($parent && ($parent = $parent->getParent()));
     return $params;
 }
예제 #8
0
 /**
  * @param Google $google
  */
 public function __construct(Google $google)
 {
     $this->google = $google;
     $this->config = $google->config;
     $this->session = $google->getSession();
     parent::__construct();
 }
예제 #9
0
 /**
  * @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!'));
     }
 }
예제 #10
0
파일: Column.php 프로젝트: kissmael/kmgrid
 /**
  * @param string $name Table column name
  * @param string $label Column label
  */
 public function __construct($container, $name, $label, $parent)
 {
     parent::__construct($container, $name);
     $this->label = $label;
     $this->parent = $parent;
     $this->valueEditor = function ($value) {
         return $value;
     };
     return $this;
 }
예제 #11
0
 public function __construct(\Fabian\Linkedin\Linkedin $linkedin)
 {
     parent::__construct();
     $this->linkedin = $linkedin;
 }
예제 #12
0
파일: Action.php 프로젝트: kissmael/kmgrid
 public function __construct($container, $name, $label, $parent)
 {
     parent::__construct($container, $name);
     $this->label = $label;
     $this->parent = $parent;
 }
예제 #13
0
 public function __construct($factory)
 {
     parent::__construct();
     $this->factory = new Nette\Callback($factory);
 }
예제 #14
0
 public function __construct(callable $factory)
 {
     parent::__construct();
     $this->factory = $factory;
 }
예제 #15
0
파일: TreeViewLink.php 프로젝트: lohini/cf
 /**
  * @return string
  */
 public function getUrl()
 {
     return NULL === ($param = $this->getParam()) ? $this->presenterComponent->link($this->destination) : $this->presenterComponent->link($this->destination, $param);
 }
예제 #16
0
 /**
  * @param SkautIS $skautis
  */
 public function __construct(SkautIS $skautis)
 {
     $this->skautis = $skautis;
     $this->session = $skautis->getSession();
     parent::__construct();
 }
예제 #17
0
 /**
  * @param callable
  */
 public function __construct($factory)
 {
     parent::__construct();
     $this->factory = Nette\Utils\Callback::check($factory);
 }
예제 #18
0
 protected function createComponent($name) : Nette\ComponentModel\IComponent
 {
     return new Template($name, $this->templates, get_class($this->getParent())) ?: parent::createComponent($name);
 }
예제 #19
0
	/**
	 * Helper for {form ...} macro.
	 *
	 * @param    Nette\Forms\Form|string form instance or form name in given control
	 * @param    Nette\Application\UI\PresenterComponent
	 * @param    array             list of modifiers (name => value)
	 * @return   Nette\Forms\Form
	 */
	public static function beginForm($form, Nette\Application\UI\PresenterComponent $control, array $modifiers = NULL)
	{
		$form = ($form instanceof Nette\Forms\Form ? $form : $control->getComponent($form));
		self::$containerStack = array($form);

		if ($modifiers) self::addAttributes($form->getElementPrototype(), $modifiers, array('class', 'style'));
		$form->render('begin');

		return $form;
	}