Exemplo n.º 1
0
 /**
  * Builds the condition to be used for the specified event.
  * @param \ManiaScript\Builder\Event\MenuNavigation $event The event.
  * @return string The condition.
  */
 protected function buildCondition($event)
 {
     $conditions = array();
     foreach ($event->getActions() as $action) {
         $conditions[$action] = 'Event.MenuNavAction == CMlEvent::EMenuNavAction::' . $action;
     }
     $result = '';
     if (!empty($conditions)) {
         $result = implode(' || ', $conditions);
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Adds a MenuNavigation event to the ManiaScript.
  * @param string $code The code to be executed.
  * @param array $actions The actions on which the code should be executed.
  * @param int $priority The priority, 0 for most important, bigger for less important.
  * @param boolean $inline Whether this event is handled inline, i.e. without wrapping function.
  * @return $this Implementing fluent interface.
  */
 public function addMenuNavigation($code, $actions = array(), $priority = 5, $inline = false)
 {
     $menuNavigation = new MenuNavigation();
     $menuNavigation->setCode($code)->setActions($actions)->setPriority($priority)->setInline($inline);
     $this->builder->addEvent($menuNavigation);
     return $this;
 }