Example #1
0
 protected function _isSubmit()
 {
     if (is_string($this->submitButton)) {
         if ($this->dataIn->has(strval($this->submitButton))) {
             $this->mode = $this->submitButton;
             return true;
         }
     } else {
         if (is_array($this->submitButton)) {
             foreach ($this->submitButton as $id) {
                 if ($this->dataIn->has($id)) {
                     $this->mode = $id;
                     return true;
                 }
             }
         }
     }
     $button = $this->dataIn->get('CT_Form_SubmitButton');
     if ($button) {
         if (is_string($this->submitButton) && $this->submitButton == $button || is_array($this->submitButton) && in_array($button, $this->submitButton)) {
             $this->mode = $button;
             return true;
         } else {
             return false;
         }
     }
     return false;
 }
Example #2
0
 protected function _retrieveUrl()
 {
     if ($this->usesModRewrite) {
         $self = $this->_server->needs('PHP_SELF');
         //            if(($pathInfo = $this->_server->get('PATH_INFO')) || ($pathInfo = $this->_server->get('ORIG_PATH_INFO'))){
         //                $self = substr($self, 0, strlen($self) - strlen($pathInfo));
         //            }
         if (($pos = strrpos($self, '/')) !== false) {
             $self = substr($self, 0, $pos);
         } else {
             $self = substr($self, 0, strrpos($self, '\\'));
         }
         $url = substr($this->_server->needs('REQUEST_URI'), strlen($self));
         if ($url === false) {
             $url = '';
         } elseif ($url !== '') {
             $posQueryString = strpos($url, '?');
             if ($posQueryString !== false) {
                 $url = substr($url, 0, $posQueryString);
             }
         }
         $url = substr($url, 1);
     } else {
         if ($this->_server->has('PATH_INFO')) {
             $url = substr($this->_server->get('PATH_INFO'), 1);
         } else {
             $url = substr($this->_server->get('ORIG_PATH_INFO'), 1);
         }
     }
     if (substr($url, -1, 1) != '/') {
         $url .= '/';
     }
     return $url;
 }
Example #3
0
 protected function _isSubmit()
 {
     if (is_string($this->submitButton)) {
         if ($this->dataIn->has(strval($this->submitButton))) {
             $this->mode = $this->submitButton;
             $this->action = 'next';
             return true;
         }
     } else {
         if (is_array($this->submitButton)) {
             foreach ($this->submitButton as $id => $action) {
                 if ($this->dataIn->has($id)) {
                     $this->mode = $id;
                     $this->action = $action;
                     return true;
                 }
             }
         }
     }
     for ($i = 1; $i <= $this->steps; $i++) {
         if ($this->dataIn->has('step' . $i)) {
             $this->mode = 'step' . $i;
             $this->action = $i;
             return true;
         }
     }
     $button = $this->dataIn->get('CT_Form_SubmitButton');
     if ($button) {
         $this->mode = $button;
         if (is_array($this->submitButton)) {
             $this->action = ArrayTools::get($this->submitButton, $button);
         } else {
             if ($button == $this->submitButton) {
                 $this->action = 'next';
             }
         }
         if ($this->action) {
             return true;
         }
         if (!$this->action) {
             for ($i = 1; $i <= $this->steps; $i++) {
                 if ($button == 'step' . $i) {
                     $this->action = $i;
                     return true;
                 }
             }
         }
         return false;
     }
     return false;
 }
Example #4
0
 public function hasAppTool($tool)
 {
     return $this->_tools->has($tool);
 }
Example #5
0
<?php

use Cyantree\Grout\AutoLoader;
use Cyantree\Grout\Filter\ArrayFilter;
use Cyantree\Mosaic\Outputs\ReadableOutput;
use Cyantree\Mosaic\Outputs\JsonOutput;
use Cyantree\Mosaic\Mosaic;
require_once __DIR__ . '/../../../autoload.php';
ini_set('memory_limit', '1024M');
AutoLoader::init();
$options = new ArrayFilter(getopt('f:c:j:o:', ['debug']));
$outputMode = $options->get('o', 'readable');
$s = new Mosaic();
$s->debug = $options->has('debug');
$s->basePath = realpath(dirname($options->needs('f'))) . '/';
$s->applicationPath = __DIR__ . '/../src/';
$s->configuration->load($options->needs('f'));
if ($options->has('c')) {
    $s->configuration->extend(json_decode(rawurldecode($options->get('c'))));
}
if ($options->has('j')) {
    $includedJobs = explode(',', $options->get('j'));
} else {
    $includedJobs = null;
}
$jobs = $s->compile($includedJobs);
switch ($outputMode) {
    case 'json':
        $output = new JsonOutput();
        break;
    default:
Example #6
0
 /** @return Route */
 public function addErrorRoute($code, $page, $pageData = null)
 {
     $f = new ArrayFilter($pageData);
     if (!$f->has('responseCode')) {
         $f->set('responseCode', $code);
     }
     $url = null;
     $activated = false;
     $priority = 0;
     if ($code == ResponseCode::CODE_404) {
         $url = '%%url,.*%%';
         $activated = true;
         $priority = -1;
     }
     $codeDigit = substr($code, 0, 3);
     return $this->addNamedRoute('GroutError' . $codeDigit, $url, $page, $f->getData(), $priority, $activated);
 }