/** * Execute the form manager for all models of a container. * * @param string $container name of widget container. * @return boolean * @access public * @final * * @author (c) Etienne de Longeaux <*****@*****.**> * @since 2012-06-26 */ public final function executeAllFormByContainer($container) { if (!isset($GLOBALS['FORM'][strtoupper($container)])) { throw ServiceException::serviceGlobaleUndefined(strtolower($container), 'FORM'); } $results_form = null; $all_services = $GLOBALS['FORM'][strtoupper($container)]; foreach ($all_services as $key => $service) { if ($this->container->has($service)) { $options = array('formName' => $this->_form_name, 'formAction' => $this->container->get('router')->generate('public_importmanagement_widget', array('NoLayout' => true)), 'formTitle' => $this->container->get('translator')->trans('pi.title'), 'formSubmit' => $this->container->get('translator')->trans('pi.register'), 'DisplayGroup' => true); $this->container->get($service)->setIndexWidget($this->_id_widget); $this->container->get($service)->setIndexBlock($this->_id_block); $this->container->get($service)->setIndexForm($this->_id_form); $results_form[$key] = $this->container->get($service)->getContents(); $results_form[$key][PiFormBuilderManager::CONTENT_RENDER_FORM] = $this->container->get($service)->execute($options); $results_form[$key][PiFormBuilderManager::SCRIPT_RENDER_FORM] = $this->container->get($service)->renderScript($options); } else { throw ServiceException::serviceNotSupported($service); } } return $results_form; }
/** * Sets the service and the action names and return true if the service is supported. * * @param string $container name of widget container. * @param string $actionName name of action. * * @return boolean * @access private * * @author (c) Etienne de Longeaux <*****@*****.**> */ private function isServiceSupported($container, $actionName) { if (!isset($GLOBALS['WIDGET'][strtoupper($container)][strtolower($actionName)])) { throw ServiceException::serviceGlobaleUndefined(strtolower($actionName), 'WIDGET'); } elseif (!$this->container->has($GLOBALS['WIDGET'][strtoupper($container)][strtolower($actionName)])) { throw ServiceException::serviceNotSupported($GLOBALS['WIDGET'][strtoupper($container)][strtolower($actionName)]); } $this->service = $GLOBALS['WIDGET'][strtoupper($container)][strtolower($actionName)]; $this->action = strtolower($actionName); return true; }
/** * Gets the service name. * * @param string $container name of jquery container. * @param string $NameServiceValidator name of validator. * * @static * @return boolean * @access public * @author Etienne de Longeaux <*****@*****.**> */ private function isServiceSupported($container, $NameServiceValidator) { if (!isset($GLOBALS['JQUERY'][strtoupper($container)][strtolower($NameServiceValidator)])) { throw ServiceException::serviceGlobaleUndefined(strtolower($NameServiceValidator), 'JQUERY', __CLASS__); } elseif (!$this->container->has($GLOBALS['JQUERY'][strtoupper($container)][strtolower($NameServiceValidator)])) { throw ServiceException::serviceNotSupported($GLOBALS['JQUERY'][strtoupper($container)][strtolower($NameServiceValidator)]); } else { $this->service = $GLOBALS['JQUERY'][strtoupper($container)][strtolower($NameServiceValidator)]; } return true; }
/** * Gets the Router Translator service * * @return \BeSimple\I18nRoutingBundle\Routing\Router * @access protected * * @author Etienne de Longeaux <*****@*****.**> * @since 2012-02-03 */ protected function getRouterTranslator() { if (empty($this->_RouterTranslator)) { $this->setRouterTranslator(); } if ($this->_RouterTranslator instanceof Router) { return $this->_RouterTranslator; } else { throw ServiceException::serviceNotSupported(); } }