/** * Display the form * * @return string The HTML result of form displaying */ public function display() { try { if (empty($this->fieldsets)) { // Generate a fake fieldset, to keep the same engine for forms that have fieldsets or not $this->addFieldset(new FormFieldset($this, '')); foreach ($this->inputs as $name => $input) { $this->fieldsets['']->inputs[$name] =& $input; } } // Generate the form content $content = View::make(Theme::getSelected()->getView(Form::VIEWS_DIR . 'form-content.tpl'), array('form' => $this, 'column' => 0)); // Wrap the content with the form tag return $this->wrap($content); } catch (\Exception $e) { App::errorHandler()->exception($e); } }
function errorHandler() { parent::errorHandler(); self::page_5xx(); }
<?php namespace Hawk; if (ini_get('display_errors')) { $errorHandler = App::errorHandler(); set_error_handler(array($errorHandler, 'error'), error_reporting()); register_shutdown_function(array($errorHandler, 'fatalError')); set_exception_handler(array($errorHandler, 'exception')); }
/** * Display the list * * @return string The HTML result of displaying */ public function display() { try { $pages = 1; $data = array(); $param = array(); $this->recordNumber = 0; if ($this->refresh) { // Get the data to display $this->get(); // Get the total number of pages $pages = ceil($this->recordNumber / $this->lines) > 0 ? ceil($this->recordNumber / $this->lines) : 1; // At least one result to display $data = array(); $param = array(); if (is_array($this->results)) { foreach ($this->results as $id => $line) { $data[$id] = array(); $param[$id] = array('class' => ''); if ($this->lineClass) { $function = $this->lineClass; $param[$id]['class'] .= $function($line); } foreach ($this->fields as $name => $field) { $data[$id][$name] = $field->displayCell($id); } } } } // Get the list views files $this->getViews(); return View::make($this->refresh ? $this->resultTpl : $this->tpl, array('list' => $this, 'data' => $data, 'linesParameters' => $param, 'pages' => $pages)) . View::make(Plugin::get('main')->getView('list.js.tpl'), array('list' => $this, 'pages' => $pages)); } catch (\Exception $e) { App::errorHandler()->exception($e); } }
/** * Display the input (alias method) * * @return string the HTML result of the input displaying */ public function display() { try { $theme = Theme::getSelected(); if ($this->name == $this->errorAt) { unset($this->errorAt); } $inputLabel = $this->label ? View::make($theme->getView(Form::VIEWS_DIR . 'form-input-label.tpl'), array('input' => $this)) : ''; $inputDisplay = View::make($this->tpl, array('input' => $this)); return View::make($theme->getView(Form::VIEWS_DIR . 'form-input-block.tpl'), array('input' => $this, 'inputLabel' => $inputLabel, 'inputDisplay' => $inputDisplay)); } catch (\Exception $e) { App::errorHandler()->exception($e); } }