/** * Factory ! We check that the requested class is a valid service. * * @param string $container name of widget container. * @param string $actionName name of action. * @param array $options validator options. * @return service * @access public * @final * * @author (c) Etienne de Longeaux <*****@*****.**> */ public final function FactoryFunction($container, $actionName, $options = null) { if ($this->isServiceSupported($container, $actionName)) { // Gestion des options if (!isset($options['widget-id']) || empty($options['widget-id'])) { throw ServiceException::optionValueNotSpecified('widget-id', __CLASS__); } if (!isset($options['widget-lang']) || empty($options['widget-lang'])) { throw ServiceException::optionValueNotSpecified('widget-lang', __CLASS__); } // we set params $this->setParams($options); $method = "render" . ucfirst($this->action); //print_r($method); //print_r($this->getServiceWidget()->getAction()); //print_r($this->action); //print_r($this->service); //print_r($container); //print_r($actionName); if (method_exists($this->serviceWidget, $method)) { return $this->getServiceWidget()->{$method}($options); } elseif (method_exists($this->serviceWidget, 'render')) { return $this->getServiceWidget()->run($options); } else { throw ServiceException::serviceMethodUnDefined($method); } } }
/** * * * @access public * @return void * * @author (c) Etienne de Longeaux <*****@*****.**> * @since 2012-09-11 */ public function XmlConfigWidget(array $data) { throw ServiceException::serviceMethodUnDefined('XmlConfigWidget'); }
/** * Set progress text for Progress flash dialog. * * @param $options tableau d'options. * @access protected * @return void * * @author (c) Etienne de Longeaux <*****@*****.**> */ protected function render($options = null) { // Options management if (!isset($options['action']) || empty($options['action']) || isset($options['action']) && !in_array(strtolower($options['action']), self::$actions)) { throw ExtensionException::optionValueNotSpecified('action', __CLASS__); } if (!isset($options['menu']) || empty($options['menu']) || isset($options['menu']) && !in_array(strtolower($options['menu']), self::$menus)) { throw ExtensionException::optionValueNotSpecified('menu', __CLASS__); } // we set method names $method = strtolower($options['menu']) . "Menu"; $action = strtolower($options['action']) . "Action"; // we set result if (method_exists($this, $method)) { $result = $this->{$method}($options); } else { throw ServiceException::serviceMethodUnDefined($method); } return $this->{$action}($result, $options); }