ODE STYLE Formating gulliver/system/class.controller.php

Change format files in gulliver/system/class.controller.php
This commit is contained in:
norahmollo
2012-10-17 15:38:04 +00:00
parent 1d7954bcc6
commit 5c6d1230bc

View File

@@ -1,7 +1,9 @@
<?php
/**
* Controller Class
* Implementing MVC Pattern
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
* @package gulliver.system
* @access private
@@ -9,30 +11,36 @@
class Controller
{
/**
*
* @var boolean debug switch for general purpose
*/
public $debug = null;
/**
*
* @var array - private array to store proxy data
*/
private $__data__ = array ();
/**
*
* @var object - private object to store the http request data
*/
private $__request__;
/**
*
* @var object - headPublisher object to handle the output
*/
private $headPublisher = null;
/**
*
* @var string - response type var. possibles values: json|plain
*/
private $responseType = '';
/**
*
* @var string - layout to pass skinEngine
*/
private $layout = '';
@@ -61,16 +69,13 @@ class Controller
}
$trace = debug_backtrace();
trigger_error(
'Undefined property via __get(): ' . $name .
' in ' . $trace[0]['file'] .
' on line ' . $trace[0]['line'],
E_USER_NOTICE);
trigger_error( 'Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE );
return null;
}
/**
* Magic isset method
*
* @param string $name
*/
public function __isset ($name)
@@ -78,9 +83,9 @@ class Controller
return isset( $this->__data__[$name] );
}
/**
* Magic unset method
*
* @param string $name
*/
public function __unset ($name)
@@ -90,6 +95,7 @@ class Controller
/**
* Set Response type method
*
* @param string $type contains : json|plain
*/
public function setResponseType ($type)
@@ -99,6 +105,7 @@ class Controller
/**
* call to execute a internal proxy method and handle its exceptions
*
* @param string $name
*/
public function call ($name)
@@ -127,10 +134,18 @@ class Controller
$result->success = false;
$result->msg = $e->getMessage();
switch (get_class( $e )) {
case 'Exception': $error = "SYSTEM ERROR"; break;
case 'PMException': $error = "PROCESSMAKER ERROR"; break;
case 'PropelException': $error = "DATABASE ERROR"; break;
case 'UserException': $error = "USER ERROR"; break;
case 'Exception':
$error = "SYSTEM ERROR";
break;
case 'PMException':
$error = "PROCESSMAKER ERROR";
break;
case 'PropelException':
$error = "DATABASE ERROR";
break;
case 'UserException':
$error = "USER ERROR";
break;
}
$result->error = $error;
@@ -143,6 +158,7 @@ class Controller
/**
* Set the http request data
*
* @param array $data
*/
public function setHttpRequestData ($data)
@@ -151,14 +167,18 @@ class Controller
$this->__request__ = new stdclass();
}
if (is_array( $data )) {
while( $var = each($data) )
while ($var = each( $data )) {
$this->__request__->$var['key'] = $var['value'];
} else
}
} else {
$this->__request__ = $data;
}
}
/**
* Get debug var. method
* Get debug var.
* method
*
* @param boolan $val boolean value for debug var.
*/
public function setDebug ($val)
@@ -167,7 +187,8 @@ class Controller
}
/**
* Get debug var. method
* Get debug var.
* method
*/
public function getDebug ()
{
@@ -178,11 +199,13 @@ class Controller
return $this->debug;
}
/*** HeadPublisher Functions Binding ***/
/**
* * HeadPublisher Functions Binding **
*/
/**
* Include a particular extjs library or extension to the main output
*
* @param string $srcFile path of a extjs library or extension
* @param boolean $debug debug flag to indicate if the js output will be minifield or not
* $debug: true -> the js content will be not minified (readable)
@@ -195,6 +218,7 @@ class Controller
/**
* Include a javascript file that is using extjs framework to the main output
*
* @param string $srcFile path of javascrit file to include
* @param boolean $debug debug flag to indicate if the js output will be minifield or not
* $debug: true -> the js content will be not minified (readable)
@@ -207,6 +231,7 @@ class Controller
/**
* Include a Html file to the main output
*
* @param string $file path of html file to include to the main output
*/
public function setView ($file)
@@ -216,6 +241,7 @@ class Controller
/**
* Set variables to be accesible by javascripts
*
* @param string $name contains var. name
* @param string $value conatins var. value
*/
@@ -226,6 +252,7 @@ class Controller
/**
* Set variables to be accesible by the extjs layout template
*
* @param string $name contains var. name
* @param string $value conatins var. value
*/
@@ -266,3 +293,4 @@ class Controller
G::header( "Location: $url" );
}
}