/**
  * Call the render function of the child class called by service.
  *
  * @return string
  * @access public
  * @author Etienne de Longeaux <*****@*****.**>
  */
 public final function run($options = null)
 {
     return $this->render($options);
     try {
         return $this->render($options);
     } catch (\Exception $e) {
         throw ServiceException::serviceRenderUndefined('JQUERY');
     }
 }
 /**
  * Execute the form builder.
  *
  * <code>
  *  $options = array(
  *             'formName'        => 'myform',
  *             'formAction'    => '/admin/acl/add/type/role',
  *             'formTitle'        => $this->container->get('translator')->trans('List Roles'),
  *             'formSubmit'    => $this->container->get('translator')->trans('Register'),
  *             'formDecorator'    => 'ElementForm.phtml',
  *             'DisplayGroup'    => true,
  *            'populate'        => array(
  *                                  'name1'    => 'Mon nom',
  *                                  'name2'    => 'Mon prénom',
  *                                  'date'    => App_Tools_Date::dayDatetime()
  *                               ),
  *    );
  *   $resultform    = $this->container->get('pi_app_admin.formbuilder_manager.model.activity')->run($options);
  * </code>
  * 
  * @param  array        $options    validator options.
  * @return string                    form builder result
  * @access public
  * @final
  *
  * @author (c) Etienne de Longeaux <*****@*****.**>
  * @since 2012-06-26
  */
 public final function execute($options)
 {
     // Chargement de l'action du formulaire.
     if (!isset($options['formAction']) || empty($options['formAction'])) {
         throw ServiceException::optionValueNotSpecified($options['formAction']);
     }
     self::$_content = $options;
     try {
         return $this->_execute();
     } catch (\Exception $e) {
         throw Service::serviceNotConfiguredCorrectly();
     }
 }
Example #3
0
 /**
  * Gets the list of all tables.
  *
  * <code>
  *   $listTableClasses = $this->container->get('bootstrap.database.db')->listTables('table_class');
  *   $listTableClasses = array_combine($listTableClasses, $listTableClasses);
  * </code>
  * @return array    the list of all tables
  * @access public
  *
  * @author Etienne de Longeaux <*****@*****.**>
  * @since 2014-08-01
  */
 public function listTables($type = 'table_name')
 {
     $tables = array();
     switch ($type) {
         case 'table_name':
             $tables = $this->getConnection()->getSchemaManager()->listTables();
             break;
         case 'table_class':
             $meta = $this->getEntityManager()->getMetadataFactory()->getAllMetadata();
             foreach ($meta as $m) {
                 list($domaine, $bundle, $entity) = split("\\\\", $m->getName(), 3);
                 $tables[$m->getName()] = $domaine . $bundle . ':' . str_replace('Entity\\', '', $entity);
             }
             break;
         default:
             throw ServiceException::optionValueNotSpecified($type);
             break;
     }
     return $tables;
 }
 public function orderByFilter($objs, $orderMethod, $orderBy = "ASC")
 {
     if ($objs instanceof \Doctrine\ORM\PersistentCollection) {
         $array = array();
         foreach ($objs as $obj) {
             if (method_exists($obj, $orderMethod)) {
                 $array[$obj->{$orderMethod}()] = $obj;
             } else {
                 throw ServiceException::serviceNotConfiguredCorrectly();
             }
         }
         if ($orderBy == "ASC") {
             ksort($array);
         } elseif ($orderBy == "DESC") {
             krsort($array);
         }
         return $array;
     } else {
         throw ServiceException::serviceNotConfiguredCorrectly();
     }
 }
 /**
  * Call the render function of the child class called by service.
  *
  * @return string
  * @access    public
  * @final
  *
  * @author (c) Etienne de Longeaux <*****@*****.**>
  */
 public final function runCss($options = null)
 {
     try {
         return $this->scriptCss($options);
     } catch (\Exception $e) {
         throw ServiceException::serviceRenderUndefined('WIDGET');
     }
 }
 /**
  * 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();
     }
 }
 /**
  * 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);
 }