Inheritance: extends Nette\Application\UI\Presenter
 protected function startup()
 {
     parent::startup();
     if ($this->token && $this->addonId) {
         $this->error('Parameters token and addonId must not be present at the same time.', 409);
     }
     if ($this->token) {
         $this->addon = $this->manager->restoreAddon($this->token);
     } elseif ($this->addonId) {
         $deleted = $this->auth->isAllowed('addon', 'delete');
         $row = $this->addons->find($this->addonId, $deleted);
         if (!$row) {
             $this->error('Addon not found.');
         }
         $this->addon = Addon::fromActiveRow($row);
     }
     if ($this->addon && !$this->auth->isAllowed($this->addon, 'manage')) {
         $this->error('You are not allowed to manage this addon.', 403);
     }
 }
 protected function beforeRender()
 {
     parent::beforeRender();
     $this->template->addonVotes = Callback::closure($this->addonVotes, 'calculatePopularity');
 }
 /**
  * @param string
  */
 public function __construct($pagesDataPath)
 {
     parent::__construct();
     $this->pagesDataPath = realpath($pagesDataPath . '/page');
 }
 protected function beforeRender()
 {
     parent::beforeRender();
     $currentVersion = $this->addonVersions->getCurrent($this->addon->versions);
     if ($this->getUser()->isLoggedIn()) {
         $row = $this->addonVotes->findOneBy(array('userId' => $this->getUser()->getId(), 'addonId' => $this->addon->id));
         $myVote = $row ? $row->vote : NULL;
     } else {
         $myVote = NULL;
     }
     $this['subMenu']->setAddon($this->addon);
     $this->template->addon = $this->addon;
     $this->template->version = $currentVersion;
     $this->template->composer = $currentVersion->composerJson;
     $this->template->myVote = $myVote;
 }
 protected function beforeRender()
 {
     parent::beforeRender();
     $this->template->addonVotes = array($this->addonVotes, 'calculatePopularity');
 }