Exemplo n.º 1
0
 /**
  * Get a command by name
  *
  * @param string $name  The command name
  * @param array $config An optional associative array of configuration settings
  * @return mixed ControllerToolbarCommand if found, false otherwise.
  */
 public function getCommand($name, $config = array())
 {
     //Create the config object
     $command = new ControllerToolbarCommand($name, $config);
     //Attach the command to the toolbar
     $command->setToolbar($this);
     //Find the command function to call
     if (method_exists($this, '_command' . ucfirst($name))) {
         $function = '_command' . ucfirst($name);
         $this->{$function}($command);
     } else {
         //Don't set an action for GET commands
         if (!isset($command->href)) {
             $command->append(array('attribs' => array('data-action' => $command->getName())));
         }
     }
     return $command;
 }
Exemplo n.º 2
0
 /**
  * Get a command by name
  *
  * @param string $name  The command name
  * @param array $config An optional associative array of configuration settings
  * @return mixed ControllerToolbarCommand if found, false otherwise.
  */
 public function getCommand($name, $config = array())
 {
     if (!$this->getDelegate()->hasCommand($name)) {
         //Create the config object
         $command = new ControllerToolbarCommand($name, $config);
         //Attach the command to the toolbar
         $command->setToolbar($this);
         //Find the command function to call
         if (method_exists($this, '_command' . ucfirst($name))) {
             $function = '_command' . ucfirst($name);
             $this->{$function}($command);
         } else {
             $this->getDelegate()->getCommand($name, $config);
         }
     } else {
         $command = $this->getDelegate()->getCommand($name);
     }
     return $command;
 }
Exemplo n.º 3
0
 /**
  * Modal toolbar command
  *
  * @param   ControllerToolbarCommand $command  A ControllerToolbarCommand object
  * @return  void
  */
 protected function _commandDialog(ControllerToolbarCommand $command)
 {
     $command->append(array('href' => ''))->append(array('attribs' => array('class' => array('koowa-modal'), 'href' => $command->href), 'data' => array('koowa-modal' => array('type' => 'ajax'))));
 }
Exemplo n.º 4
0
 /**
  * Dialog toolbar command
  *
  * @param   ControllerToolbarCommand $command  A ControllerToolbarCommand object
  * @return  void
  */
 protected function _commandDialog(ControllerToolbarCommand $command)
 {
     $option = $this->getIdentifier()->package;
     $command->append(array('width' => '640', 'height' => '480'))->append(array('attribs' => array('class' => array('modal'), 'rel' => '{handler: \'url\', ajaxOptions:{method:\'get\'}}')));
 }