Exemplo n.º 1
0
 /**
  * Build the <tfoot> element.
  */
 protected function _renderFooter()
 {
     $thead = array('@type' => 'tfoot', '@html' => array('@type' => 'tr', '@html' => array()));
     foreach ($this->_options['@columns'] as $col) {
         array_push($thead['@html']['@html'], \Athem\Utils::arrayMergeRecursiveRight(array('@type' => 'th'), $col));
     }
     // trigger
     $argv = $this->getEventManager()->prepareArgs(array('o' => $thead));
     $this->getEventManager()->trigger(__FUNCTION__ . 'Post', $this, $argv);
     array_push($this->_options['@html'], $thead);
     return $this;
 }
Exemplo n.º 2
0
 /**
  * @param ElementInterface $element
  * @return string|void
  */
 public function render(ElementInterface $element)
 {
     $twitter = $element->getOption('twitter_date');
     $twitter = empty($twitter) ? array() : $twitter;
     $hasButton = !empty($twitter['has-button']) || !empty($twitter['has_button']);
     unset($twitter['has-button']);
     unset($twitter['has_button']);
     $attrs = $element->getAttributes();
     if ($hasButton) {
         $attrsw = array('class' => 'input-append date', 'id' => 'div-' . $attrs['id']);
         $attrsw = Utils::arrayMergeRecursiveRight($attrsw, $twitter);
         $openW = '<div ' . $this->createAttributesString($attrsw) . '>';
         $closeW = '<span class="add-on"><i class="icon-calendar"></i></span></div>';
     } else {
         $attrs = Utils::arrayMergeRecursiveRight($attrs, $twitter);
         $element->setAttributes($attrs);
         $openW = '';
         $closeW = '';
     }
     return $openW . parent::render($element) . $closeW;
 }
Exemplo n.º 3
0
 /**
  * @param $route
  * @param array $data
  * @throws Exception\InvalidRouteException
  */
 public function urlByRoute($route, $data = array())
 {
     $chunk = false;
     $options = ApplicationFactory::getInstance()->getConfig();
     foreach ($options['routes'] as $r) {
         if ($r[0] == $route) {
             $chunk = $r[1][0];
             if (!empty($r[1][1])) {
                 $data = Utils::arrayMergeRecursiveRight($r[1][1], $data);
             }
         }
     }
     if (false === $chunk) {
         throw new Exception\InvalidRouteException(sprintf('Could not load route by name \'%s\'. Please check if route exists.', $route));
     }
     preg_match_all('/\\{[^\\}]+\\}/i', $chunk, $keys);
     foreach ($keys[0] as $key) {
         $key = substr($key, 1, -1);
         if (isset($data[$key]) && $data[$key] !== NULL && $data[$key] !== '') {
             $regexp = $regexp = "/\\{{$key}\\}/i";
             $value = $data[$key];
         } else {
             $regexp = $regexp = "/\\/\\{{$key}\\}.*/i";
             $value = '';
         }
         $chunk = preg_replace($regexp, $value, $chunk);
     }
     return $this->url($chunk);
     return '';
 }
Exemplo n.º 4
0
 /**
  * @param array $options
  */
 public function __construct($options = array())
 {
     $this->options = Utils::arrayMergeRecursiveRight($this->options, $options);
 }
Exemplo n.º 5
0
 /**
  * @param $model
  * @param array $options
  * @param string $fwk
  */
 public function __construct(ModelInterface $model, $options = array())
 {
     $this->setModel($model);
     $this->options = Utils::arrayMergeRecursiveRight($this->options, $options);
 }
Exemplo n.º 6
0
 public function testCamelCase()
 {
     $this->assertEquals(Utils::toCamelCase('ana_are_mere'), 'anaAreMere');
 }
Exemplo n.º 7
0
 /**
  * @see \Netis\Application\ApplicationInterface#registerLoader()
  * @param array $options
  * @return $this
  * @throws \Exception
  */
 public function registerLoader($options = array())
 {
     if (empty($options['type'])) {
         $option['type'] = 'composer';
     }
     $zf2Path = isset($options['zf2path']) ? $options['zf2path'] : 'vendor/zendframework/zendframework/library';
     switch ($options['type']) {
         case 'composer':
             self::$loader = (include 'vendor/autoload.php');
             if (empty(self::$loader)) {
                 throw new Exception\MissingClassLoaderException('Missing ClassLoader Composer!');
             }
             break;
         case 'zend':
             // register zend autoloader (since the entire CMS is based on Zend)
             require_once $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
             \Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'fallback_autoloader' => true)));
             require_once $zf2Path . '/Zend/Loader/StandardAutoloader.php';
             self::$loader = \Zend\Loader\AutoloaderFactory::getRegisteredAutoloader('Zend\\Loader\\StandardAutoloader');
             break;
         case 'symfony':
             // @TODO: Implement Symfony ClassLoader when you need it!
             throw new Exception\MissingClassLoaderException('Symfony ClassLoader is not implemented yet.');
     }
     // register needed namespaces
     $namespaces = array('Athem' => 'vendor/athem/athem/library', 'Netis' => 'vendor/athemcms/netis/library');
     if (!empty($options['namespaces'])) {
         $namespaces = \Athem\Utils::arrayMergeRecursiveRight($namespaces, $options['namespaces']);
     }
     $this->registerNamespaces($namespaces);
     // register doctrine annotation namespaces
     // @TODO: Not correct! This way, application is depended 100% of Zend Lbrary. Should remove Zend\Form\Annotation, to be added in configs
     $annotationNamespaces = array("Doctrine\\ORM\\Mapping" => getcwd() . "/vendor/doctrine/orm/lib/", "Zend\\Form\\Annotation" => getcwd() . "/vendor/zendframework/zendframework/library");
     if (!empty($options['annotationNamespaces'])) {
         $annotationNamespaces = \Athem\Utils::arrayMergeRecursiveRight($annotationNamespaces, $options['annotationNamespaces']);
     }
     $this->registerAnnotationNamespaces($annotationNamespaces);
     return $this;
 }