Beispiel #1
0
 /**
  * Default view helper. Takes the same parameters as PicoraController::render().
  */
 public static final function render($file, $local_variables = false)
 {
     return PicoraController::render($file, $local_variables);
 }
Beispiel #2
0
 protected final function getValueFromFlash()
 {
     if (!class_exists('PicoraController')) {
         return null;
     }
     $flash = PicoraController::getFlash();
     if ($this->record) {
         $key = $this->record->getKeyForFlash($this->params['name']) . '.value';
         if (isset($flash[$key])) {
             return $flash[$key];
         }
     } elseif (isset($flash[$this->params['name'] . '.value'])) {
         return $flash[$this->params['name'] . '.value'];
     }
     return null;
 }
Beispiel #3
0
 protected static function generateResponse($response)
 {
     if ($response === null) {
         $method_name = strtolower(preg_replace('/([a-z])([A-Z])/e', "'\\1_'.strtolower('\\2')", self::$status['current_method']));
         $controller_name = strtolower(preg_replace('/([a-z])([A-Z])/e', "'\\1_'.strtolower('\\2')", self::$status['current_controller']));
         $try_one = self::getDefaultViewDirectory() . $controller_name . '/' . $method_name . '.php';
         $try_two = self::getDefaultViewDirectory() . PicoraSupport::pluralize($controller_name) . '/' . $method_name . '.php';
         if (file_exists($try_one)) {
             $response = PicoraController::render($try_one);
         } elseif (file_exists($try_two)) {
             $response = PicoraController::render($try_two);
         } else {
             throw new Exception(self::$status['current_controller'] . 'Controller->' . self::$status['current_method'] . '() returned null, and no matching view was found.');
         }
     }
     return self::getRequestMethod() == 'ajax' ? $response : call_user_func(self::$layout_handler, $response instanceof PicoraView ? $response->display() : $response, self::getCurrentController());
 }
Beispiel #4
0
 /**
  * @return void
  */
 public final function clearErrorList()
 {
     $this->__error_list__ = array();
     $flash =& PicoraController::getFlash();
     $key = $this->getKeyForFlash($field);
     if (isset($flash[$key])) {
         unset($flash[$key]);
     }
 }