Ejemplo n.º 1
0
 /**
  * @param Mvc $page
  *
  * @return void;
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Nda::class)) {
         /** @var Nda $nda */
         $nda = $this->getEntities()->get(Nda::class);
         if (!is_null($nda->getCall())) {
             $page->setParams(array_merge($page->getParams(), ['id' => $nda->getId(), 'callId' => $nda->getCall()->getId()]));
             $label = (string) $nda;
         } else {
             $page->setParams(array_merge($page->getParams(), ['id' => $nda->getId()]));
             $label = (string) $nda;
         }
     } else {
         $label = $this->translate('txt-nav-nda');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 2
0
 /**
  * @param Mvc $page
  *
  * @return void
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Selection::class)) {
         /** @var Selection $selection */
         $selection = $this->getEntities()->get(Selection::class);
         $page->setParams(array_merge($page->getParams(), ['id' => $selection->getId()]));
         $label = (string) $selection->getSelection();
     } else {
         $label = $this->translate('txt-nav-selection');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 3
0
 /**
  * Parse a Funder Facebook label
  *
  * @param Mvc $page
  *
  * @return void
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Facebook::class)) {
         /** @var Facebook $facebook */
         $facebook = $this->getEntities()->get(Facebook::class);
         $page->setParams(array_merge($page->getParams(), ['id' => $facebook->getId()]));
         $label = (string) $facebook->getFacebook();
     } else {
         $label = $this->translate('txt-nav-facebook');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 4
0
 /**
  * @param Mvc $page
  *
  * @return void
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Organisation::class)) {
         /** @var Organisation $organisation */
         $organisation = $this->getEntities()->get(Organisation::class);
         $page->setParams(array_merge($page->getParams(), ['id' => $organisation->getId()]));
         $label = (string) $organisation;
     } else {
         $label = $this->translate('txt-nav-view');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 5
0
 /**
  * @param Mvc $page
  *
  * @return void;
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Calendar::class)) {
         /** @var Calendar $calendar */
         $calendar = $this->getEntities()->get(Calendar::class);
         $page->setParams(array_merge($page->getParams(), ['id' => $calendar->getId()]));
         $label = (string) $calendar;
     } else {
         $label = $this->translate('txt-nav-calendar');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 6
0
 /**
  * Parse a Funder Contact label
  *
  * @param Mvc $page
  *
  * @return void
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Contact::class)) {
         /** @var Contact $contact */
         $contact = $this->getEntities()->get(Contact::class);
         $page->setParams(array_merge($page->getParams(), ['id' => $contact->getId()]));
         $label = (string) $contact->getDisplayName();
     } else {
         $label = $this->translate('txt-nav-contact');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 7
0
 /**
  * @param Mvc $page
  *
  * @return void
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Affiliation::class)) {
         /** @var Affiliation $affiliation */
         $affiliation = $this->getEntities()->get(Affiliation::class);
         $this->getEntities()->set(Project::class, $affiliation->getProject());
         $page->setParams(array_merge($page->getParams(), ['id' => $affiliation->getId()]));
         $label = (string) $affiliation;
     } else {
         $label = $this->translate('txt-nav-view');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 8
0
 /**
  * @param Mvc $page
  *
  * @return void;
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Document::class)) {
         /** @var Document $document */
         $document = $this->getEntities()->get(Document::class);
         $this->getEntities()->set(Calendar::class, $document->getCalendar());
         $page->setParams(array_merge($page->getParams(), ['id' => $document->getId()]));
         $label = (string) $document;
     } else {
         $label = $this->translate('txt-nav-document');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 9
0
 /**
  * @param Mvc $page
  *
  * @return void
  */
 public function __invoke(Mvc $page)
 {
     if ($this->getEntities()->containsKey(Doa::class)) {
         /** @var Doa $doa */
         $doa = $this->getEntities()->get(Doa::class);
         $this->getEntities()->set(Affiliation::class, $doa->getAffiliation());
         $this->getEntities()->set(Project::class, $doa->getAffiliation()->getProject());
         $page->setParams(array_merge($page->getParams(), ['id' => $doa->getId()]));
         $label = $this->translate('txt-doa');
     } else {
         $label = $this->translate('txt-nav-view');
     }
     $page->set('label', $label);
 }
Ejemplo n.º 10
0
    public function testSetAndGetParams()
    {
        $page = new Page\Mvc(array(
            'label' => 'foo',
            'action' => 'index',
            'controller' => 'index'
        ));

        $params = array('foo' => 'bar', 'baz' => 'bat');

        $page->setParams($params);
        $this->assertEquals($params, $page->getParams());

        $page->setParams();
        $this->assertEquals(array(), $page->getParams());

        $page->setParams($params);
        $this->assertEquals($params, $page->getParams());

        $page->setParams(array());
        $this->assertEquals(array(), $page->getParams());
    }