Public Member Functions | |
zigController () | |
__construct () | |
retViewPath ($viewName) | |
Return Paths of View / Layout / Params file as an array. | |
commitViews () | |
Actually loads the View called automatically by index.php DONT CALL IT MANUALLY. | |
renderView ($viewName, $return=false) | |
Renders View View must be of this Project however it doesn't matter what Class is its Parent If you use just $this->renderView('viewName') it will search for the view file under your Controller Class If you use $this->renderView('controllerName.viewName') it will search for view file under the domein of the given controllerName. | |
queueAutoView ($viewName) | |
Queue one or more view(s) to be automatically rendered automatically after the action executes. | |
renderAutoView () | |
Render Auto views queued by $this->queueAutoView. | |
renderSharedView ($viewName, $projectName=null, $return=false) | |
Render a Shared View same as $this->renderView() except it searches for the view file in /usr/share/views if you supply a different Project name it will search for the view file in that project. | |
loadView ($viewName, $varList, $return=false) | |
loads a view NOT render remember load is not same as render as render makes all attributes aviliable locally on a view in the other hand load accepts an array/object and makes all keys local to that view. | |
loadSharedView ($viewName, $varList, $projectName=null, $return=false) | |
Loads Shared view from /usr/share/views same as $this->loadView() except it searches the view file from /usr/share/views if you supply a different Project shared view from that project will be loaded However load works Immedietly and render works after the execution of action logic has been ended. | |
switchLayout ($layoutName) | |
Switch View layout to another layout remember it will search for the layout in /usr/share/view/layout. | |
switchLayoutParams ($layoutParamsFile) | |
Switch layout Parameter file Remember the file must stay in /usr/share/view/params. | |
getLayoutParams ($var=null) | |
Get layout Params as an array However you get only those parameters that you set with setLayoutParams(). | |
setLayoutParams ($var, $value) | |
Set/Overrides Parameters for Layout. | |
setLayoutMeta ($metaTagStr) | |
Set HTML Meta Redirection in Layout. | |
multiLayout ($flag=true) | |
Turn on or Off Multiple Layout If its true Different Layouts(& Params) for Different Methods(Views) and if false Different Layout for Different Controllers(Classes). | |
noAutoViewRender ($flag=true) | |
If Its set to true the default view will not be rendered automatically by zigmoyd. | |
noLayout ($flag=true) | |
Turns No Layout On. | |
attachModel ($modelName, $projectName=null) | |
Atach more models. | |
flash ($msg, $exitFlag=false) | |
Flash a Text on the Screen Remember if a flash has been issued all views (loaded / rendered) gets Dropped. | |
redirect ($msg, $location, $timer=0) | |
Flashesd a Message on Screen and META redirect after a certain time(seconds). | |
headerRedirect ($path) | |
Redirect with a HTTp Header to the specified path. | |
forward ($httpErrorCode) | |
Forwarded the Page to an HTTP Error Page. | |
setHeader ($str) | |
Sets a HTTP header to be sent. | |
setContentType ($mimeType) | |
Set the Content-TYpe Header. | |
getHeaders () | |
returns list of headers going to be sent / has already been sent | |
getSentHeaders () | |
Returns array of sent headers. | |
validateForm ($validationMapName) | |
Initialize the Form validation. | |
validateGet ($validationMapName) | |
Same as validateForm however it validates Get request not Post Request. | |
loadOrm ($ormMapName, $projectName=null) | |
Load Orm map. | |
unloadTable ($ormClassName) | |
Unload a loaded Orm map. | |
getLoadedOrm () | |
List Currently loaded Orms. | |
getLoadedTables ($ormMapName=null) | |
List the Tables aviliable to you through the loaded Orm(s). | |
getLoadedTableAlias ($ormMapName=null) | |
List all loaded table Alias(s) may return array or object. | |
isPostRequest () | |
Check wheather the Request is a Post request Often used to make sure that the form has been posted or not Remember Upload request is also kinda post request so it will also returns true during an uploading request. | |
isPurePost () | |
Checks Wheather its a pure Post request or not. | |
isGetRequest () | |
Checks wheather the Request is a Get request or not. | |
isBlankGetRequest () | |
Check Wheather Its a Blnk Get Request or not Often used to make sure wheather its fresh request or not. | |
isUploadRequest () | |
Checks wheather its a file Upload Request or not. | |
getRequestParams () | |
Get HTTP request Headers/Parems. | |
getUrlRoot () | |
Return the url Root. | |
getCurrentUrl ($bindGet=false) | |
Returns teh Current Url e.g. | |
importStylesheet ($styleSheetName, $rewriteEngine=false) | |
Sets <link rel . | |
importJavaScript ($javaScriptsName, $rewriteEngine=false) | |
Queue's a js file to be loaded. | |
registerCache ($name, $type, $lifeTime=30) | |
Regester an object for to be Cached (While Caching Controller or Full Page use any Value for $name Ist Ignored). | |
doCache ($name, $type, $lifeTime, &$content) | |
Creates the cache. | |
cacheExists ($name, $type) | |
Checks wheather or not cache exists. | |
deleteCache ($name, $type) | |
Deletes Cache. | |
execCache ($name, $type) | |
Executes or Loads a Cache. | |
uSess ($sessId) | |
Unit Test Viewer. | |
registerFullCache () | |
Unknown. | |
registerControllerCache ($lifeTime=30) | |
Unknown. | |
registerRenderedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
registerLoadedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
registerRenderedSharedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
registerLoadedSharedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
existsFullCache () | |
Unknown. | |
existsControllerCache () | |
Unknown. | |
existsRenderedViewCache ($viewName) | |
Unknown. | |
existsLoadedViewCache ($viewName) | |
Unknown. | |
existsRenderedSharedViewCache ($viewName) | |
Unknown. | |
existsLoadedSharedViewCache ($viewName) | |
Unknown. | |
execFullCache () | |
Unknown. | |
execControllerCache ($lifeTime=30) | |
Unknown. | |
execRenderedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
execLoadedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
execRenderedSharedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
execLoadedSharedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
deleteFullCache () | |
Unknown. | |
deleteControllerCache ($lifeTime=30) | |
Unknown. | |
deleteRenderedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
deleteLoadedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
deleteRenderedSharedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
deleteLoadedSharedViewCache ($viewName, $lifeTime=30) | |
Unknown. | |
Data Fields | |
$request | |
$load | |
$prjName | |
$className | |
$methodName | |
$layoutName = null | |
$layoutPath = null | |
$paramsPath = null | |
$paramsName = null | |
$viewQueue = array() | |
$ormList = array() | |
$params = array() | |
$multiLayout = false | |
$loadedOrms = array() | |
$db | |
$noAutoViewRender = false | |
$cacheConfig = array() | |
$cacheDict = array() | |
$cache | |
$noLayout = false | |
$postPeer | |
$getPeer |
All Controler(s) ultimately Inherits this Class.
Definition at line 34 of file zigController.php.
zigController::__construct | ( | ) |
Reimplemented from zCore.
Definition at line 193 of file zigController.php.
References $app_data, $load, and $request.
Referenced by zigController().
00193 { 00194 global $app_data; 00195 global $request; 00196 global $load; 00197 $this->db = new stdClass(); 00198 $this->prjName = $app_data['prj']; 00199 $this->className = $app_data['class']; 00200 $this->methodName = $app_data['method']; 00201 $this->request =& $request; 00202 $this->postPeer =& $request->post; 00203 $this->getPeer =& $request->get; 00204 $this->load =& $load; 00205 if(!defined('Z_CACHE_FULL'))define('Z_CACHE_FULL', 'f'); 00206 if(!defined('Z_CACHE_CONTROLLER'))define('Z_CACHE_CONTROLLER', 'c'); 00207 if(!defined('Z_CACHE_RENDERED_VIEW'))define('Z_CACHE_RENDERED_VIEW', 'rv'); 00208 if(!defined('Z_CACHE_LOADED_VIEW'))define('Z_CACHE_LOADED_VIEW', 'lv'); 00209 if(!defined('Z_CACHE_RENDERED_SHARED_VIEW'))define('Z_CACHE_RENDERED_SHARED_VIEW', 'rsv'); 00210 if(!defined('Z_CACHE_LOADED_SHARED_VIEW'))define('Z_CACHE_LOADED_SHARED_VIEW', 'lsv'); 00211 //$this->cache = new zCache(&$this); 00212 parent::__construct(); 00213 }
zigController::zigController | ( | ) |
Definition at line 190 of file zigController.php.
References __construct().
00190 { 00191 $this->__construct(); 00192 }
zigController::retViewPath | ( | $ | viewName | ) |
Return Paths of View / Layout / Params file as an array.
View must be of this Project however it doesn't matter what Class is its Parent If you use just $this->retViewPath('viewName') it will search for the view file under your Controller Class If you use $this->retViewPath('controllerName.viewName') it will search for view file under the domain of the given controllerName
For internal use only.
$viewName | string |
Logic ------ if the view name doesn't contain . in it will search for it in the method Directory with the same name as $viewName and searches for the $viewName/$viewName.view.php if its not there Fires an Error if Contains one .(dot) expected Format methodName.viewName if contains two dots expected className.methodName.viewname more than 2 Invalid Remember renderView is not Cross project
Definition at line 227 of file zigController.php.
References $layoutPath, $paramsPath, multiLayout(), perror(), and strchr_occurrences().
Referenced by loadSharedView(), loadView(), renderSharedView(), and renderView().
00227 { 00238 $place = array('class' => $this->className, 'method' => $this->methodName, 'view' => $viewName); 00239 switch(strchr_occurrences($viewName, '.')){ 00240 case 0: 00241 break; 00242 case 1: 00243 $data = explode('.', $viewName);//$data[0] = methodname;$data[1]=viewname 00244 $place['method'] = $data[0]; 00245 $place['view'] = $data[1]; 00246 break; 00247 case 2: 00248 $data = explode('.', $viewName);//$data[0] = methodname;$data[1]=viewname 00249 $place['class'] = $data[0]; 00250 $place['method'] = $data[1]; 00251 $place['view'] = $data[2]; 00252 break; 00253 default: 00254 perror('<code>ZigMoyd.mvc.view</code><br />Invalid View '.$viewName); 00255 return false; 00256 } 00257 //{ Build the Path 00258 $baseSharedPath = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.fstab_getProjectDirByName($this->prjName).DRS.Z_VIEW_DIR_NAME.DRS; 00259 $commonBasePath = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.fstab_getProjectDirByName($this->prjName).DRS.Z_DIR_APPS.DRS.Z_DIR_MVC_VIEW.DRS; 00260 $viewPath = $commonBasePath.$place['class'].DRS.$place['method'].DRS.$place['view'].'.view.php'; 00261 if($this->layoutName){ 00262 $layoutPath = $baseSharedPath.$this->layoutName.'.layout.php'; 00263 }else{ 00264 if($this->multiLayout){ 00265 //$layoutPath = $commonBasePath.$place['class'].DRS.$place['method'].DRS.$place['view'].'.layout.php'; 00266 $layoutPath = $commonBasePath.$place['class'].DRS.$place['method'].DRS.$place['method'].'.layout.php'; 00267 }else{ 00268 $layoutPath = $commonBasePath.$place['class'].DRS.$place['class'].'.layout.php'; 00269 } 00270 } 00271 if($this->paramsName){ 00272 $paramsPath = $baseSharedPath.$this->paramsName.'.params.php'; 00273 }else{ 00274 if($this->multiLayout){ 00275 //$paramsPath = $commonBasePath.$place['class'].DRS.$place['method'].DRS.$place['view'].'.params.php'; 00276 $paramsPath = $commonBasePath.$place['class'].DRS.$place['method'].DRS.$place['method'].'.params.php'; 00277 }else{ 00278 $paramsPath = $commonBasePath.$place['class'].DRS.$place['class'].'.params.php'; 00279 } 00280 } 00281 //} 00282 return array($viewPath, $layoutPath, $paramsPath); 00283 }
zigController::commitViews | ( | ) |
Actually loads the View called automatically by index.php DONT CALL IT MANUALLY.
For internal use only.
Definition at line 289 of file zigController.php.
References $params, $val, zLogger::debug(), doCache(), noLayout(), perror(), and zTemplate::sysNumeric().
00289 { 00290 if(strlen($this->layoutPath) > 1 && strlen($this->paramsPath)){ 00291 //{{ Include the Layout 00292 if(!file_exists($this->layoutPath)){ 00293 exit(zTemplate::sysNumeric('l404', $this->layoutPath, getcwd())); 00294 }else{ 00295 //{{{ Include the params file 00296 if(!file_exists($this->paramsPath)){ 00297 exit(zTemplate::sysNumeric('pr404', $this->paramsPath, getcwd())); 00298 }else{ 00299 if(!include_once($this->paramsPath)){ 00300 perror("<code>zigmoyd.apps.mvc</code><br />Failed to Include $this->paramsPath"); 00301 exit; 00302 } 00303 } 00304 //}}} 00305 //{{{ If Controller cache is enabled Load the Controller from Cache 00306 if(isset($this->cacheDict[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]))$this->params['content'] = $this->cacheDict[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]; 00307 //}}} 00308 foreach($params as $var => $val){ 00309 if(!isset($this->params[$var])){ 00310 $this->params[$var] = $val; 00311 } 00312 } 00313 //{{{ Include the layout 00314 //{{{{ Start output buffering 00315 ob_start(); 00316 if(!include_once($this->layoutPath)){ 00317 perror("<code>zigmoyd.apps.mvc</code><br />Failed to include $this->layoutPath"); 00318 exit; 00319 } 00320 //do Full Page cache with [ob_get_contents() 00321 if(isset($this->cacheConfig[Z_CACHE_FULL][Z_CACHE_FULL]) && is_array($this->cacheConfig[Z_CACHE_FULL][Z_CACHE_FULL])){ 00322 zLogger::debug("Creating Full Page Cache ["."$this->className.$this->methodName.".$this->cacheConfig[Z_CACHE_FULL][Z_CACHE_FULL]['lifeTime'].'.php'."]", "cache.full"); 00323 file_put_contents(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_CACHE_MVC.DRS."full".DRS."$this->className.$this->methodName.cache", ob_get_contents()); 00324 } 00325 //Do a Controller Level Cache 00326 if(isset($this->cacheConfig[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]) && is_array($this->cacheConfig[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"])){ 00327 zLogger::debug("Creating Controller Level Cache [$this->className.$this->methodName] with a Lifetime of ".($this->cacheConfig[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]['lifeTime']-time())." Seconds from Now", "cache.controller"); 00328 $this->doCache("$this->className.$this->methodName", Z_CACHE_CONTROLLER, ($this->cacheConfig[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]['lifeTime']), $this->params['content']); 00329 } 00330 ob_end_flush(); 00331 //}}}} 00332 //}}} 00333 } 00334 //}} 00335 }else{ 00336 if(!$this->noLayout){ 00337 perror("zigmoyd mvc Engine Serving Without any layout But You need to explecitely Decleare that you really dont want a layout<br />e.g. its a Layout less application else zigmoyd will fire this error as it thinks that you did this wrongly<br />To Explecitely Decleare no Layout Application use <br />\$this->noLayout();"); 00338 return false; 00339 }else{//Its really a layout Less application 00340 //{{{ If Controller cache is enabled Load teh Controller from Cache 00341 //if(isset($this->cacheDict[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]))$this->params['content'] = $this->cacheDict[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]; 00342 //}}} 00343 if(isset($this->params['content']))echo $this->params['content']; 00344 //Do a Controller Level Cache 00345 /*if(isset($this->cacheConfig[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]) && is_array($this->cacheConfig[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"])){ 00346 zLogger::debug("Creating Controller Level Cache [$this->className.$this->methodName] with a Lifetime of ".($this->cacheConfig[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]['lifeTime']-time())." Seconds from Now", "cache.controller"); 00347 $this->doCache("$this->className.$this->methodName", Z_CACHE_CONTROLLER, ($this->cacheConfig[Z_CACHE_CONTROLLER]["$this->className.$this->methodName"]['lifeTime']), $this->params['content']); 00348 }*/ 00349 } 00350 } 00351 }
zigController::renderView | ( | $ | viewName, | |
$ | return = false | |||
) |
Renders View View must be of this Project however it doesn't matter what Class is its Parent If you use just $this->renderView('viewName') it will search for the view file under your Controller Class If you use $this->renderView('controllerName.viewName') it will search for view file under the domein of the given controllerName.
For internal use only.
MUST BE OPTIMIZED AND MUST USE A DIFFERENT SHARED METHOD THAT WOULD BE SHARED BY BOTH loadView() and renderView() (Probabbly Done on Line 266)
$viewName | string |
Definition at line 364 of file zigController.php.
References $layoutPath, $paramsPath, $val, zLogger::debug(), doCache(), perror(), retViewPath(), and zTemplate::sysNumeric().
Referenced by renderAutoView().
00364 { 00365 list($viewPath, $layoutPath, $paramsPath) = $this->retViewPath($viewName);//Get the Paths for View, layout, params file 00366 $this->paramsPath = $paramsPath; 00367 $this->layoutPath = $layoutPath; 00368 if(!file_exists($viewPath)){ 00369 //{ View File doesn't exists 00370 exit(zTemplate::sysNumeric('v404', $viewName, $viewPath)); 00371 //} 00372 }else{ 00373 //{ View file Exists 00374 //{{ Synchronize variables 00375 if(!isset($this->cacheDict[Z_CACHE_RENDERED_VIEW][$viewName])){ 00376 foreach($this as $var => $val){ 00377 ${$var} = $val; 00378 } 00379 } 00380 //}} 00381 ob_start();//Start Output Buffering 00382 //{{ Include the view file 00383 if(!isset($this->cacheDict[Z_CACHE_RENDERED_VIEW][$viewName]) && !include($viewPath)){ 00384 perror("<code>zigmoyd.apps.mvc</code><br />failed to include view on $viewPath");exit; 00385 } 00386 //}} 00387 $viewContent = (!isset($this->cacheDict[Z_CACHE_RENDERED_VIEW][$viewName])) ? ob_get_contents() : $this->cacheDict[Z_CACHE_RENDERED_VIEW][$viewName]; 00388 if($return)return $viewContent;//If $return is True Return the Output of the view Remember when $return is true the View is not Cached 00389 if(!isset($this->params['content']) || !strlen($this->params['content']) > 0){ 00390 $this->params['content'] = $viewContent;//Hold the Buffer in $this->params['content'] 00391 }else{ 00392 $this->params['content'] .= $viewContent;//Hold the Buffer in $this->params['content'] 00393 } 00394 //$this->params['content'] cache it as Controller level cache 00395 ob_end_clean();//End output Buffering 00396 //{{ Store $viewContent in Cache [View Level cache] 00397 if(isset($this->cacheConfig[Z_CACHE_RENDERED_VIEW][$viewName]) && is_array($this->cacheConfig[Z_CACHE_RENDERED_VIEW][$viewName])){ 00398 zLogger::debug("Creating View(Rendered) Level Cache [$viewName] with a Lifetime of ".($this->cacheConfig[Z_CACHE_RENDERED_VIEW][$viewName]['lifeTime']-time())." Seconds from Now", "cache.view.rendered"); 00399 $this->doCache($viewName, Z_CACHE_RENDERED_VIEW, $this->cacheConfig[Z_CACHE_RENDERED_VIEW][$viewName]['lifeTime'], $viewContent); 00400 } 00401 //}} 00402 //} 00403 } 00404 }
zigController::queueAutoView | ( | $ | viewName | ) |
Queue one or more view(s) to be automatically rendered automatically after the action executes.
$viewName | string |
Definition at line 411 of file zigController.php.
zigController::renderAutoView | ( | ) |
Render Auto views queued by $this->queueAutoView.
Definition at line 418 of file zigController.php.
References renderView().
00418 { 00419 foreach($this->viewQueue as $view){ 00420 $this->renderView($view); 00421 } 00422 }
zigController::renderSharedView | ( | $ | viewName, | |
$ | projectName = null , |
|||
$ | return = false | |||
) |
Render a Shared View same as $this->renderView() except it searches for the view file in /usr/share/views if you supply a different Project name it will search for the view file in that project.
$viewName | string | |
$projectName | string optional |
Definition at line 431 of file zigController.php.
References $val, zLogger::debug(), doCache(), perror(), and retViewPath().
00431 { 00432 list($nullDummy, $this->layoutPath, $this->paramsPath) = $this->retViewPath($viewName);//Get the Paths for View, layout, params file 00433 if(is_null($projectName))$projectName = $this->prjName; 00434 $viewPath = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.fstab_getProjectDirByName($projectName).DRS.Z_VIEW_DIR_NAME.DRS.$viewName.'.view.php'; 00435 if(!file_exists($viewPath)){ 00436 //{ View File doesn't exists 00437 perror("Failed to render Shared View $viewName as no such file exists $viewPath"); 00438 //} 00439 }else{ 00440 //{ View file Exists 00441 //{{ Synchronize variables 00442 if(!isset($this->cacheDict[Z_CACHE_RENDERED_SHARED_VIEW][$viewName])){ 00443 foreach($this as $var => $val){ 00444 ${$var} = $val; 00445 } 00446 } 00447 //}} 00448 ob_start();//Start Output Buffering//Exp 00449 //{{ Include the view file 00450 if(!isset($this->cacheDict[Z_CACHE_RENDERED_SHARED_VIEW][$viewName]) && !include($viewPath)){ 00451 perror("failed to include view on $viewPath"); 00452 } 00453 //}} 00454 //{Experimental} 00455 $viewContent = (!isset($this->cacheDict[Z_CACHE_RENDERED_SHARED_VIEW][$viewName])) ? ob_get_contents() : $this->cacheDict[Z_CACHE_RENDERED_SHARED_VIEW][$viewName]; 00456 if($return)return $viewContent;//If $return is True Return the Output of the view Remember when $return is true the View is not Cached 00457 if(!isset($this->params['content']) || !strlen($this->params['content']) > 0){ 00458 $this->params['content'] = $viewContent;//Hold the Buffer in $this->params['content'] 00459 }else{ 00460 $this->params['content'] .= $viewContent;//Hold the Buffer in $this->params['content'] 00461 } 00462 //Store $this->params['content'] in Shared View level Cache 00463 ob_end_clean();//End output Buffering 00464 if(isset($this->cacheConfig[Z_CACHE_RENDERED_SHARED_VIEW][$viewName]) && is_array($this->cacheConfig[Z_CACHE_RENDERED_SHARED_VIEW][$viewName])){ 00465 zLogger::debug("Creating Shared View(Rendered) Level Cache [$viewName] with a Lifetime of ".($this->cacheConfig[Z_CACHE_RENDERED_SHARED_VIEW][$viewName]['lifeTime']-time())." Seconds from Now", "cache.view.rendered.shared"); 00466 $this->doCache($viewName, Z_CACHE_RENDERED_SHARED_VIEW, $this->cacheConfig[Z_CACHE_RENDERED_SHARED_VIEW][$viewName]['lifeTime'], $viewContent); 00467 } 00468 //{/Experimental} 00469 //} 00470 } 00471 }
zigController::loadView | ( | $ | viewName, | |
$ | varList, | |||
$ | return = false | |||
) |
loads a view NOT render remember load is not same as render as render makes all attributes aviliable locally on a view in the other hand load accepts an array/object and makes all keys local to that view.
$viewnNme | string | |
$varList | mixed |
Definition at line 481 of file zigController.php.
References $layoutPath, $paramsPath, $val, zLogger::debug(), doCache(), perror(), and retViewPath().
00481 { 00482 list($viewPath, $layoutPath, $paramsPath) = $this->retViewPath($viewName);//Get the Paths for View, layout, params file 00483 $this->paramsPath = $paramsPath; 00484 $this->layoutPath = $layoutPath; 00485 if(!file_exists($viewPath)){ 00486 //{ View File doesn't exists 00487 perror("Failed to Load View $viewName as no such file exists $viewPath"); 00488 //} 00489 }else{ 00490 //{ View file Exists 00491 //{{ Synchronize variables 00492 if(!isset($this->cacheDict[Z_CACHE_LOADED_VIEW][$viewName])){ 00493 foreach($varList as $var => $val){ 00494 ${$var} = $val; 00495 } 00496 } 00497 //}} 00498 ob_start();//Start Output Buffering 00499 //{{ Include the view file 00500 if(!isset($this->cacheDict[Z_CACHE_LOADED_VIEW][$viewName]) && !include($viewPath)){ 00501 perror("<code>zigmoyd.apps.mvc</code><br />failed to include view on $viewPath");exit; 00502 } 00503 //}} 00504 $viewContent = (!isset($this->cacheDict[Z_CACHE_LOADED_VIEW][$viewName])) ? ob_get_contents() : $this->cacheDict[Z_CACHE_LOADED_VIEW][$viewName]; 00505 if($return)return $viewContent;//If $return is True Return the Output of the view Remember when $return is true the View is not Cached 00506 if(!isset($this->params['content']) || !strlen($this->params['content']) > 0){ 00507 $this->params['content'] = $viewContent;//Hold the Buffer in $this->params['content'] 00508 }else{ 00509 $this->params['content'] .= $viewContent;//Hold the Buffer in $this->params['content'] 00510 } 00511 ob_end_clean();//End output Buffering 00512 if(isset($this->cacheConfig[Z_CACHE_LOADED_VIEW][$viewName]) && is_array($this->cacheConfig[Z_CACHE_LOADED_VIEW][$viewName])){ 00513 zLogger::debug("Creating Shared View(Loaded) Level Cache [$viewName] with a Lifetime of ".($this->cacheConfig[Z_CACHE_LOADED_VIEW][$viewName]['lifeTime']-time())." Seconds from Now", "cache.view.loaded"); 00514 $this->doCache($viewName, Z_CACHE_LOADED_VIEW, $this->cacheConfig[Z_CACHE_LOADED_VIEW][$viewName]['lifeTime'], $viewContent); 00515 } 00516 //} 00517 } 00518 }
zigController::loadSharedView | ( | $ | viewName, | |
$ | varList, | |||
$ | projectName = null , |
|||
$ | return = false | |||
) |
Loads Shared view from /usr/share/views same as $this->loadView() except it searches the view file from /usr/share/views if you supply a different Project shared view from that project will be loaded However load works Immedietly and render works after the execution of action logic has been ended.
$viewName | string | |
$varList | mixed | |
$projectName | string optional |
Definition at line 530 of file zigController.php.
References $val, zLogger::debug(), doCache(), perror(), and retViewPath().
Referenced by flash(), redirect(), and uSess().
00530 { 00531 list($nullDummy, $this->layoutPath, $this->paramsPath) = $this->retViewPath($viewName);//Get the Paths for View, layout, params file 00532 if(is_null($projectName))$projectName = $this->prjName; 00533 $viewPath = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.fstab_getProjectDirByName($projectName).DRS.Z_VIEW_DIR_NAME.DRS.$viewName.'.view.php'; 00534 if(!file_exists($viewPath)){ 00535 //{ View File doesn't exists 00536 perror("Failed to Load Shared View $viewName as no such file exists $viewPath"); 00537 return false; 00538 //} 00539 }else{ 00540 //{ View file Exists 00541 //{{ Synchronize variables 00542 if(!isset($this->cacheDict[Z_CACHE_LOADED_SHARED_VIEW][$viewName])){ 00543 foreach($varList as $var => $val){ 00544 ${$var} = $val; 00545 } 00546 } 00547 //}} 00548 ob_start();//Start Output Buffering 00549 //{{ Include the view file 00550 if(!isset($this->cacheDict[Z_CACHE_LOADED_SHARED_VIEW][$viewName]) && !include($viewPath)){ 00551 perror("<code>zigmoyd.apps.mvc</code><br />failed to include view on $viewPath"); 00552 exit; 00553 } 00554 //}} 00555 $viewContent = (!isset($this->cacheDict[Z_CACHE_LOADED_SHARED_VIEW][$viewName])) ? ob_get_contents() : $this->cacheDict[Z_CACHE_LOADED_SHARED_VIEW][$viewName]; 00556 if($return)return $viewContent;//If $return is True Return the Output of the view Remember when $return is true the View is not Cached 00557 if(!isset($this->params['content']) || !strlen($this->params['content']) > 0){ 00558 $this->params['content'] = $viewContent;//Hold the Buffer in $this->params['content'] 00559 }else{ 00560 $this->params['content'] .= $viewContent;//Hold the Buffer in $this->params['content'] 00561 } 00562 ob_end_clean();//End output Buffering 00563 if(isset($this->cacheConfig[Z_CACHE_LOADED_SHARED_VIEW][$viewName]) && is_array($this->cacheConfig[Z_CACHE_LOADED_SHARED_VIEW][$viewName])){ 00564 zLogger::debug("Creating Shared View(Loaded) Level Cache [$viewName] with a Lifetime of ".($this->cacheConfig[Z_CACHE_LOADED_SHARED_VIEW][$viewName]['lifeTime']-time())." Seconds from Now", "cache.view.rendered"); 00565 $this->doCache($viewName, Z_CACHE_LOADED_SHARED_VIEW, $this->cacheConfig[Z_CACHE_LOADED_SHARED_VIEW][$viewName]['lifeTime'], $viewContent); 00566 } 00567 //} 00568 //} 00569 } 00570 return true; 00571 }
zigController::switchLayout | ( | $ | layoutName | ) |
Switch View layout to another layout remember it will search for the layout in /usr/share/view/layout.
$newLayoutName | string |
Definition at line 578 of file zigController.php.
References $layoutName.
00578 { 00579 $this->layoutName = $layoutName; 00580 }
zigController::switchLayoutParams | ( | $ | layoutParamsFile | ) |
Switch layout Parameter file Remember the file must stay in /usr/share/view/params.
$newLayoutParamsFile | string |
Definition at line 587 of file zigController.php.
zigController::getLayoutParams | ( | $ | var = null |
) |
Get layout Params as an array However you get only those parameters that you set with setLayoutParams().
$var | mixed optional |
Definition at line 597 of file zigController.php.
00597 { 00598 if(!is_null($var)){ 00599 if(isset($this->params[$var])){ 00600 return $this->params[$var]; 00601 }else{ 00602 return false; 00603 } 00604 }else{ 00605 return $this->params; 00606 } 00607 }
zigController::setLayoutParams | ( | $ | var, | |
$ | value | |||
) |
Set/Overrides Parameters for Layout.
$var | string | |
$value | mixed |
Definition at line 614 of file zigController.php.
zigController::setLayoutMeta | ( | $ | metaTagStr | ) |
Set HTML Meta Redirection in Layout.
$metaTagStr | string |
Definition at line 622 of file zigController.php.
Referenced by redirect().
zigController::multiLayout | ( | $ | flag = true |
) |
Turn on or Off Multiple Layout If its true Different Layouts(& Params) for Different Methods(Views) and if false Different Layout for Different Controllers(Classes).
$flag | boolean |
Definition at line 631 of file zigController.php.
Referenced by retViewPath().
00631 { 00632 $this->multiLayout = $flag; 00633 }
zigController::noAutoViewRender | ( | $ | flag = true |
) |
If Its set to true the default view will not be rendered automatically by zigmoyd.
$flag | boolean |
Definition at line 639 of file zigController.php.
Referenced by flash(), and uSess().
00639 { 00640 $this->noAutoViewRender = $flag; 00641 }
zigController::noLayout | ( | $ | flag = true |
) |
Turns No Layout On.
$flag | boolean |
Definition at line 647 of file zigController.php.
Referenced by commitViews(), and flash().
00647 { 00648 $this->noLayout = $flag; 00649 }
zigController::attachModel | ( | $ | modelName, | |
$ | projectName = null | |||
) |
Atach more models.
$modelName | string | |
$controllerName | string |
Definition at line 657 of file zigController.php.
References $className, loadOrm(), perror(), and zTemplate::sysNumeric().
00657 { 00658 //index.php will first attach the model then class the requested Method 00659 if(is_null($projectName))$projectName = $this->prjName; 00660 $modelPath = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.fstab_getProjectDirByName($projectName).DRS.Z_DIR_APPS.DRS.Z_DIR_MVC_MODEL.DRS.$modelName.'.php'; 00661 if(!file_exists($modelPath)){ 00662 exit(zTemplate::sysNumeric('m404', $modelPath, $modelName, $projectName)); 00663 }elseif(!is_readable($modelPath)){ 00664 exit(zTemplate::sysNumeric('m403', $modelPath)); 00665 } 00666 if(!include_once($modelPath)){ 00667 perror("Failed to include model on $modelPath"); 00668 return false; 00669 } 00670 if(!class_exists($modelName.'Model')){ 00671 exit(zTemplate::sysNumeric('m500', $modelName, $modelPath)); 00672 }else{ 00673 $className = $modelName.'Model'; 00674 $dummy = new $className();//Instantiate the model class 00675 $dummy->attachOrmMap(); 00676 foreach($dummy->ormList as $ormName){ 00677 $this->ormList[$ormName] = array(); 00678 $this->loadOrm($ormName); 00679 } 00680 unset($dummy); 00681 } 00682 }
zigController::flash | ( | $ | msg, | |
$ | exitFlag = false | |||
) |
Flash a Text on the Screen Remember if a flash has been issued all views (loaded / rendered) gets Dropped.
$msg | string |
Definition at line 690 of file zigController.php.
References loadSharedView(), noAutoViewRender(), and noLayout().
00690 { 00691 $this->noAutoViewRender(); 00692 $this->noLayout(); 00693 $this->loadSharedView('zig.flash', array('msg' => $msg)); 00694 $this->noAutoViewRender(false); 00695 $this->noLayout(false); 00696 if($exitFlag)exit; 00697 }
zigController::redirect | ( | $ | msg, | |
$ | location, | |||
$ | timer = 0 | |||
) |
Flashesd a Message on Screen and META redirect after a certain time(seconds).
$msg | string | |
$location | string | |
$timer | int optional |
Definition at line 705 of file zigController.php.
References loadSharedView(), and setLayoutMeta().
00705 { 00706 $this->loadSharedView('zig.flash', array('msg' => $msg)); 00707 $this->setLayoutMeta("<meta http-equiv=\"refresh\" content=\"$timer;url=$location\">"); 00708 }
zigController::headerRedirect | ( | $ | path | ) |
Redirect with a HTTp Header to the specified path.
$path | string |
Definition at line 714 of file zigController.php.
zigController::forward | ( | $ | httpErrorCode | ) |
Forwarded the Page to an HTTP Error Page.
$httpErrorCode | int |
Definition at line 722 of file zigController.php.
References zTemplate::exists(), perror(), zTemplate::sysNumeric(), and url_segment().
00722 { 00723 //perror('Under Construction'); 00724 if(zTemplate::exists($httpErrorCode, true)){ 00725 echo zTemplate::sysNumeric($httpErrorCode, '/'.implode('/', url_segment(ZIG_URL_SEGMENT_PATH))); 00726 }else{ 00727 perror("<code>zigmoyd.template</code><br />System Template for $httpErrorCode doesn't exists"); 00728 } 00729 exit; 00730 }
zigController::setHeader | ( | $ | str | ) |
Sets a HTTP header to be sent.
$str | string |
Definition at line 737 of file zigController.php.
Referenced by setContentType().
zigController::setContentType | ( | $ | mimeType | ) |
Set the Content-TYpe Header.
$mimeType | string |
Definition at line 746 of file zigController.php.
References setHeader().
00746 { 00747 return $this->setHeader('Content-Type: '.$mimeType); 00748 }
zigController::getHeaders | ( | ) |
returns list of headers going to be sent / has already been sent
Definition at line 754 of file zigController.php.
zigController::getSentHeaders | ( | ) |
zigController::validateForm | ( | $ | validationMapName | ) |
Initialize the Form validation.
$validationMapName | string |
Definition at line 771 of file zigController.php.
References isPostRequest().
00771 { 00772 if($this->isPostRequest())$this->request->post->initValidator($validationMapName); 00773 }
zigController::validateGet | ( | $ | validationMapName | ) |
Same as validateForm however it validates Get request not Post Request.
$validationMapName | string |
Definition at line 779 of file zigController.php.
References isGetRequest().
00779 { 00780 if($this->isGetRequest())$this->request->get->initValidator($validationMapName); 00781 }
zigController::loadOrm | ( | $ | ormMapName, | |
$ | projectName = null | |||
) |
Load Orm map.
$ormMapName | string | |
$projectName | string optional |
Logic ------ Expected that load_orm_map() will accept the ormMapName and projectName parse the orm Map from /projects/projectName/etc/conf.d/ormMapName.orm.map.php generate the class on /projects/projectName/apps/model/orm/ormMapName.orm.php and then include that generated class file and return the tableAlias className(s) as an numarically indexed array Then here the returned array will be stored in an Array Variable and as the files are included the classes are Expected as existing but if class doesn't Exists ?? So do this Loop through that array in to $ormClassName //Remember that its an array of class names if class exists $ormClassName Create an object variable named $this->db->$ormClassName = new $ormClassName() else Fire Error end if end loop
and index.php will first attach the model then the requested Method will be called
Definition at line 789 of file zigController.php.
References $__ZigOrm, load_orm_map(), and perror().
Referenced by attachModel().
00789 { 00790 global $__ZigOrm; 00813 if(is_null($projectName))$projectName = $this->prjName; 00814 foreach(load_orm_map($ormMapName, $projectName) as $ormClassName){ 00815 if(class_exists($ormClassName)){ 00816 $this->db->$ormClassName = new $ormClassName();//would it be a better choice to do $this->db->{strtolower($ormClassName)} here ?? 00817 $this->loadedOrms[$ormMapName][] = $ormClassName; 00818 }else{ 00819 perror("<code>zigmoyd.mvc.model.orm</code><br /> Failed to Instantiate orm Class `$ormClassName` as no such Class exists"); 00820 } 00821 } 00822 }
zigController::unloadTable | ( | $ | ormClassName | ) |
Unload a loaded Orm map.
$ormMapName | string |
Definition at line 828 of file zigController.php.
References perror().
00828 { 00829 if(!isset($this->db->$ormClassName)){perror("<code>zigmoyd.mvc.orm.unload.table</code><br />Failed to unload Table Alias <code style=\"background-color: #FFFFFF;font-weight: normal;\">$ormClassName</code> as Its instance not found on <code style=\"background-color: #FFFFFF;font-weight: normal;\">\$this->db</code>");return false;} 00830 if(!class_exists($ormClassName)){perror("<code>zigmoyd.mvc.orm.unload.table</code><br />Failed to unload Table Alias <code style=\"background-color: #FFFFFF;font-weight: normal;\">$ormClassName</code> as Its class not found");return false;} 00831 unset($this->db->$ormClassName); 00832 }
zigController::getLoadedOrm | ( | ) |
List Currently loaded Orms.
returns array or object
Definition at line 838 of file zigController.php.
zigController::getLoadedTables | ( | $ | ormMapName = null |
) |
List the Tables aviliable to you through the loaded Orm(s).
may return array or Object
$ormMapName | string optional |
Logic ----- Same as getLoadedTableAlias() but returns the actual table names instead of table Alias
Definition at line 847 of file zigController.php.
References $__ZigOrm, dataDict, getLoadedTableAlias(), and perror().
00847 { 00853 global $__ZigOrm; 00854 $tableDictFlip = array_flip($__ZigOrm->dataDict->tables); 00855 $ret = array(); 00856 $tablesList = $this->getLoadedTableAlias($ormMapName); 00857 if(is_bool($tablesList) && !$tablesList){ 00858 perror("<code>zigmoyd.mvc.orm.unload.table</code><br />Unable to fetch the orm Map <code style=\"background-color: #FFFFFF;font-weight: normal;\">$ormMapName</code>"); 00859 } 00860 if(is_array($tablesList)){ 00861 foreach($this->getLoadedTableAlias($ormMapName) as $tableAliasName){ 00862 array_push($ret, $tableDictFlip[$tableAliasName]); 00863 } 00864 } 00865 return $ret; 00866 }
zigController::getLoadedTableAlias | ( | $ | ormMapName = null |
) |
List all loaded table Alias(s) may return array or object.
$ormMapName | string optional |
Definition at line 873 of file zigController.php.
References $className.
Referenced by getLoadedTables().
00873 { 00874 $ret = array(); 00875 if(is_null($ormMapName)){ 00876 $src =& $this->loadedOrms; 00877 }else{ 00878 $src =& $this->loadedOrms[$ormMapName]; 00879 } 00880 foreach($src as $mapName => $classList){ 00881 if(is_array($classList)){//$this->loadedOrms; 00882 foreach($classList as $className){ 00883 if(isset($this->db->$className)){ 00884 array_push($ret, $className); 00885 } 00886 } 00887 }else{//$this->loadedOrms[$ormMapName] 00888 if(isset($this->db->$classList))array_push($ret, $classList); 00889 } 00890 } 00891 return $ret; 00892 }
zigController::isPostRequest | ( | ) |
Check wheather the Request is a Post request Often used to make sure that the form has been posted or not Remember Upload request is also kinda post request so it will also returns true during an uploading request.
use isPurePost() tro check wheather or not its only Post request or not.
Definition at line 902 of file zigController.php.
Referenced by isPurePost(), and validateForm().
zigController::isPurePost | ( | ) |
Checks Wheather its a pure Post request or not.
even returns false if its an upload request. Only returns true if its a post request not anything else.
Definition at line 910 of file zigController.php.
References isPostRequest(), and isUploadRequest().
00910 { 00911 return ($this->isPostRequest() && !$this->isUploadRequest()); 00912 }
zigController::isGetRequest | ( | ) |
Checks wheather the Request is a Get request or not.
Logic ------ If Blank Request return true else if $_GET exists return true else return false
Definition at line 918 of file zigController.php.
References isBlankGetRequest().
Referenced by validateGet().
00918 { 00926 if($this->isBlankGetRequest()){ 00927 return true; 00928 }else{ 00929 return (isset($_GET) && count($_GET) > 0); 00930 } 00931 }
zigController::isBlankGetRequest | ( | ) |
Check Wheather Its a Blnk Get Request or not Often used to make sure wheather its fresh request or not.
Definition at line 938 of file zigController.php.
Referenced by isGetRequest().
00938 { 00939 return (!isset($_GET) || count($_GET) <= 0 && !isset($_POST) || count($_POST) <= 0); 00940 }
zigController::isUploadRequest | ( | ) |
Checks wheather its a file Upload Request or not.
Definition at line 946 of file zigController.php.
Referenced by isPurePost().
zigController::getRequestParams | ( | ) |
zigController::getUrlRoot | ( | ) |
Return the url Root.
Definition at line 963 of file zigController.php.
Referenced by getCurrentUrl(), importJavaScript(), and importStylesheet().
zigController::getCurrentUrl | ( | $ | bindGet = false |
) |
Returns teh Current Url e.g.
http://example.com/controller/method/args if true is supplied as an argument also includes the Get query in the returned Url
$bindGet | boolean |
Definition at line 974 of file zigController.php.
References $val, getUrlRoot(), and url_segment().
00974 { 00975 if(!$bindGet) 00976 return $this->getUrlRoot().'/'.implode('/', url_segment(ZIG_URL_SEGMENT_PATH)); 00977 else{ 00978 $base = $this->getUrlRoot().'/'.implode('/', url_segment(ZIG_URL_SEGMENT_PATH)); 00979 if(is_array($this->request->get->items) && count($this->request->get->items) >= 1){ 00980 $base .= "?"; 00981 foreach($this->request->get->items as $key => $val){ 00982 $base .= "$key=$val"; 00983 } 00984 } 00985 return $base; 00986 } 00987 }
zigController::importStylesheet | ( | $ | styleSheetName, | |
$ | rewriteEngine = false | |||
) |
Sets <link rel .
...> HTML tag for the Stylesheet on the layout
$styleSheetName | string | |
$rewriteEngine | boolean |
Definition at line 994 of file zigController.php.
References getUrlRoot().
Referenced by uSess().
00994 { 00995 if(strpos($styleSheetName, '.') === false)$styleSheetName .= '.css'; 00996 if(!isset($this->params['css']) || !is_array($this->params['css']))$this->params['css'] = array(); 00997 switch(true){ 00998 case eregi(".+://.+", $styleSheetName): 00999 $this->params['css'][] = $styleSheetName; 01000 break; 01001 case eregi("^/", $styleSheetName): 01002 $this->params['css'][] = $this->getUrlRoot().$styleSheetName; 01003 break; 01004 default: 01005 //{ Add the CSS in the Params['css'] 01006 if($rewriteEngine){ 01007 $this->params['css'][] = $this->getUrlRoot()."/r/$this->prjName/c/$styleSheetName"; 01008 }else{ 01009 $this->params['css'][] = $this->getUrlRoot()."/rt.php/$this->prjName/c/$styleSheetName"; 01010 } 01011 //} 01012 } 01013 }
zigController::importJavaScript | ( | $ | javaScriptsName, | |
$ | rewriteEngine = false | |||
) |
Queue's a js file to be loaded.
$javaScriptsName | string | |
$rewriteEngine | boolean |
Definition at line 1020 of file zigController.php.
References getUrlRoot().
Referenced by uSess().
01020 { 01021 if(strpos($javaScriptsName, '.') === false)$javaScriptsName .= '.js'; 01022 if(!isset($this->params['js']) || !is_array($this->params['js']))$this->params['js'] = array(); 01023 switch(true){ 01024 case eregi(".+://.+", $javaScriptsName): 01025 $this->params['js'][] = $javaScriptsName; 01026 break; 01027 case eregi("^/", $javaScriptsName): 01028 $this->params['js'][] = $this->getUrlRoot().$javaScriptsName; 01029 break; 01030 default: 01031 //{ Add the CSS in the Params['css'] 01032 if($rewriteEngine){ 01033 $this->params['js'][] = $this->getUrlRoot()."/r/$this->prjName/j/$javaScriptsName"; 01034 }else{ 01035 $this->params['js'][] = $this->getUrlRoot()."/rt.php/$this->prjName/j/$javaScriptsName"; 01036 } 01037 //} 01038 } 01039 }
zigController::registerCache | ( | $ | name, | |
$ | type, | |||
$ | lifeTime = 30 | |||
) |
Regester an object for to be Cached (While Caching Controller or Full Page use any Value for $name Ist Ignored).
$name | string | |
$type | char | |
$lifeTime | int |
Definition at line 1048 of file zigController.php.
Referenced by registerControllerCache(), registerFullCache(), registerLoadedSharedViewCache(), registerLoadedViewCache(), registerRenderedSharedViewCache(), and registerRenderedViewCache().
01048 { 01049 if(in_array($type, array(Z_CACHE_FULL, Z_CACHE_CONTROLLER))){ 01050 $name = array_search($type, array(Z_CACHE_FULL => Z_CACHE_FULL, "$this->className.$this->methodName" => Z_CACHE_CONTROLLER)); 01051 } 01052 //$this->cacheConfig[$type] = array('name' => $name); 01053 $this->cacheConfig[$type] = array($name => array('lifeTime' => (time()+$lifeTime))); 01054 //$this->cacheConfig[$type][$name]['lifeTime'] = time()+$lifeTime; 01055 }
zigController::doCache | ( | $ | name, | |
$ | type, | |||
$ | lifeTime, | |||
&$ | content | |||
) |
Creates the cache.
$name | string | |
$type | char | |
$lifeTime | int | |
$content | string* |
Definition at line 1065 of file zigController.php.
Referenced by commitViews(), loadSharedView(), loadView(), renderSharedView(), and renderView().
01065 { 01066 foreach(glob(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_CACHE_MVC.DRS."$name.$type.*.cache") as $cacheFileName)unlink($cacheFileName); 01067 return file_put_contents(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_CACHE_MVC.DRS."$name.$type.$lifeTime.cache", $content); 01068 }
zigController::cacheExists | ( | $ | name, | |
$ | type | |||
) |
Checks wheather or not cache exists.
$name | string | |
$type | char |
Definition at line 1076 of file zigController.php.
References zLogger::debug().
Referenced by deleteCache(), execCache(), existsControllerCache(), existsFullCache(), existsLoadedSharedViewCache(), existsLoadedViewCache(), existsRenderedSharedViewCache(), and existsRenderedViewCache().
01076 { 01077 foreach(glob(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_CACHE_MVC.DRS."$name.$type.*.cache") as $cacheFileName){ 01078 if(preg_match("~$name\.$type\.(\d+)\.cache~", pathinfo($cacheFileName, PATHINFO_BASENAME), $m)){ 01079 if($m[1] >= time()){ 01080 //Content Ok 01081 if(!isset($ret)){ 01082 zLogger::debug("Cache $name exists", 'cache.exists'); 01083 $ret = true; 01084 }else{ 01085 //Multiple Cache Of same File (But with Different Lifetime Exists) [So remove them] 01086 unlink($cacheFileName); 01087 } 01088 }else{ 01089 //Content Expired 01090 if(!isset($ret)){ 01091 zLogger::debug("Cache $name expired", 'cache.exists'); 01092 $ret = false; 01093 }else{ 01094 //Multiple Cache Of same File (But with Different Lifetime Exists) [So remove them] 01095 unlink($cacheFileName); 01096 } 01097 } 01098 }else{ 01099 //Not a Valid Cache (Ignore) 01100 $ret = false; 01101 } 01102 } 01103 if(!isset($ret))$ret = false; 01104 return $ret; 01105 }
zigController::deleteCache | ( | $ | name, | |
$ | type | |||
) |
Deletes Cache.
$name | string | |
$type | cache |
Definition at line 1113 of file zigController.php.
References cacheExists().
Referenced by deleteControllerCache(), deleteFullCache(), deleteLoadedSharedViewCache(), deleteLoadedViewCache(), deleteRenderedSharedViewCache(), and deleteRenderedViewCache().
01113 { 01114 if($this->cacheExists($name, $type)){ 01115 foreach(glob(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_CACHE_MVC.DRS."$name.$type.*.cache") as $cacheFileName){ 01116 return unlink($cacheFileName); 01117 } 01118 } 01119 }
zigController::execCache | ( | $ | name, | |
$ | type | |||
) |
Executes or Loads a Cache.
$name | string | |
$type | char |
Definition at line 1126 of file zigController.php.
References cacheExists(), and zLogger::debug().
Referenced by execControllerCache(), execFullCache(), execLoadedSharedViewCache(), execLoadedViewCache(), execRenderedSharedViewCache(), and execRenderedViewCache().
01126 { 01127 if($this->cacheExists($name, $type)){ 01128 foreach(glob(ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.Z_DIR_CACHE_MVC.DRS."$name.$type.*.cache") as $cacheFileName){ 01129 zLogger::debug("Executing Cache $name", 'cache.exec'); 01130 $this->cacheDict[$type][$name] = file_get_contents($cacheFileName); 01131 } 01132 } 01133 }
zigController::uSess | ( | $ | sessId | ) |
Unit Test Viewer.
$sessId | string |
Definition at line 1139 of file zigController.php.
References importJavaScript(), importStylesheet(), loadSharedView(), noAutoViewRender(), and perror().
01139 { 01140 $this->noAutoViewRender(); 01141 $this->load->module('unitTestReader'); 01142 $this->importStylesheet('unit/unitTest'); 01143 $this->importJavaScript('unit/unitTest'); 01144 $test = new unitTestReader($sessId); 01145 $len = $test->length(); 01146 if(!$this->loadSharedView('unit/header', array('uSessId' => $sessId, 'totalPassed' => $test->totalPassed(), 'len' => $len))){ 01147 perror("<code>zigmoyd.unitTest.reader</code><br />This project is not Prepared for Unit test Reading Plese execute unit.prepare Command to Prapare it"); 01148 } 01149 while($test->hasNext()){ 01150 $testObj = $test->current(); 01151 $testObj['title'] = "(".($test->currentIndex()+1)."/$len) Test ".((trim($testObj['ExpFlag']) == 1) ? "Passed" : "Failed"); 01152 (trim($testObj['ExpFlag']) == 1) ? $this->loadSharedView('unit/test_success', &$testObj) : $this->loadSharedView('unit/test_fail', &$testObj); 01153 $test->next(); 01154 } 01155 }
zigController::registerFullCache | ( | ) |
Unknown.
Definition at line 1162 of file zigController.php.
References registerCache().
01162 { 01163 return $this->registerCache($this->className.".".$this->methodName, Z_CACHE_FULL); 01164 }
zigController::registerControllerCache | ( | $ | lifeTime = 30 |
) |
Unknown.
$lifeTime | unknown |
Definition at line 1171 of file zigController.php.
References registerCache().
01171 { 01172 return $this->registerCache($this->className.".".$this->methodName, Z_CACHE_CONTROLLER); 01173 }
zigController::registerRenderedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1181 of file zigController.php.
References registerCache().
01181 { 01182 return $this->registerCache($viewName, Z_CACHE_RENDERED_VIEW, $lifeTime); 01183 }
zigController::registerLoadedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1191 of file zigController.php.
References registerCache().
01191 { 01192 return $this->registerCache($viewName, Z_CACHE_LOADED_VIEW, $lifeTime); 01193 }
zigController::registerRenderedSharedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1201 of file zigController.php.
References registerCache().
01201 { 01202 return $this->registerCache($viewName, Z_CACHE_RENDERED_SHARED_VIEW, $lifeTime); 01203 }
zigController::registerLoadedSharedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1211 of file zigController.php.
References registerCache().
01211 { 01212 return $this->registerCache($viewName, Z_CACHE_LOADED_SHARED_VIEW, $lifeTime); 01213 }
zigController::existsFullCache | ( | ) |
Unknown.
Definition at line 1219 of file zigController.php.
References cacheExists().
01219 { 01220 return $this->cacheExists($this->className.".".$this->methodName, Z_CACHE_FULL); 01221 }
zigController::existsControllerCache | ( | ) |
Unknown.
Definition at line 1227 of file zigController.php.
References cacheExists().
01227 { 01228 return $this->cacheExists($this->className.".".$this->methodName, Z_CACHE_CONTROLLER); 01229 }
zigController::existsRenderedViewCache | ( | $ | viewName | ) |
Unknown.
$viewName | unknown |
Definition at line 1236 of file zigController.php.
References cacheExists().
01236 { 01237 return $this->cacheExists($viewName, Z_CACHE_RENDERED_VIEW); 01238 }
zigController::existsLoadedViewCache | ( | $ | viewName | ) |
Unknown.
$viewName | unknown |
Definition at line 1245 of file zigController.php.
References cacheExists().
01245 { 01246 return $this->cacheExists($viewName, Z_CACHE_LOADED_VIEW); 01247 }
zigController::existsRenderedSharedViewCache | ( | $ | viewName | ) |
Unknown.
$viewName | unknown |
Definition at line 1254 of file zigController.php.
References cacheExists().
01254 { 01255 return $this->cacheExists($viewName, Z_CACHE_RENDERED_SHARED_VIEW); 01256 }
zigController::existsLoadedSharedViewCache | ( | $ | viewName | ) |
Unknown.
$viewName | unknown |
Definition at line 1263 of file zigController.php.
References cacheExists().
01263 { 01264 return $this->cacheExists($viewName, Z_CACHE_LOADED_SHARED_VIEW); 01265 }
zigController::execFullCache | ( | ) |
Unknown.
Definition at line 1271 of file zigController.php.
References execCache().
01271 { 01272 return $this->execCache($this->className.".".$this->methodName, Z_CACHE_FULL); 01273 }
zigController::execControllerCache | ( | $ | lifeTime = 30 |
) |
Unknown.
$lifeTime | unknown |
Definition at line 1280 of file zigController.php.
References execCache().
01280 { 01281 return $this->execCache($this->className.".".$this->methodName, Z_CACHE_CONTROLLER); 01282 }
zigController::execRenderedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1290 of file zigController.php.
References execCache().
01290 { 01291 return $this->execCache($viewName, Z_CACHE_RENDERED_VIEW, $lifeTime); 01292 }
zigController::execLoadedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1300 of file zigController.php.
References execCache().
01300 { 01301 return $this->execCache($viewName, Z_CACHE_LOADED_VIEW, $lifeTime); 01302 }
zigController::execRenderedSharedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1310 of file zigController.php.
References execCache().
01310 { 01311 return $this->execCache($viewName, Z_CACHE_RENDERED_SHARED_VIEW, $lifeTime); 01312 }
zigController::execLoadedSharedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1320 of file zigController.php.
References execCache().
01320 { 01321 return $this->execCache($viewName, Z_CACHE_LOADED_SHARED_VIEW, $lifeTime); 01322 }
zigController::deleteFullCache | ( | ) |
Unknown.
Definition at line 1328 of file zigController.php.
References deleteCache().
01328 { 01329 return $this->deleteCache($this->className.".".$this->methodName, Z_CACHE_FULL); 01330 }
zigController::deleteControllerCache | ( | $ | lifeTime = 30 |
) |
Unknown.
$lifeTime | unknown |
Definition at line 1337 of file zigController.php.
References deleteCache().
01337 { 01338 return $this->deleteCache($this->className.".".$this->methodName, Z_CACHE_CONTROLLER); 01339 }
zigController::deleteRenderedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1347 of file zigController.php.
References deleteCache().
01347 { 01348 return $this->deleteCache($viewName, Z_CACHE_RENDERED_VIEW, $lifeTime); 01349 }
zigController::deleteLoadedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1357 of file zigController.php.
References deleteCache().
01357 { 01358 return $this->deleteCache($viewName, Z_CACHE_LOADED_VIEW, $lifeTime); 01359 }
zigController::deleteRenderedSharedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1367 of file zigController.php.
References deleteCache().
01367 { 01368 return $this->deleteCache($viewName, Z_CACHE_RENDERED_SHARED_VIEW, $lifeTime); 01369 }
zigController::deleteLoadedSharedViewCache | ( | $ | viewName, | |
$ | lifeTime = 30 | |||
) |
Unknown.
$viewName | unknown | |
$lifeTime | unknown |
Definition at line 1377 of file zigController.php.
References deleteCache().
01377 { 01378 return $this->deleteCache($viewName, Z_CACHE_LOADED_SHARED_VIEW, $lifeTime); 01379 }
zigController::$request |
zigController::$load |
zigController::$prjName |
Definition at line 55 of file zigController.php.
zigController::$className |
Definition at line 62 of file zigController.php.
Referenced by attachModel(), and getLoadedTableAlias().
zigController::$methodName |
Definition at line 69 of file zigController.php.
zigController::$layoutName = null |
zigController::$layoutPath = null |
Definition at line 83 of file zigController.php.
Referenced by loadView(), renderView(), and retViewPath().
zigController::$paramsPath = null |
Definition at line 90 of file zigController.php.
Referenced by loadView(), renderView(), and retViewPath().
zigController::$paramsName = null |
Definition at line 97 of file zigController.php.
zigController::$viewQueue = array() |
Definition at line 104 of file zigController.php.
zigController::$ormList = array() |
Definition at line 111 of file zigController.php.
zigController::$params = array() |
zigController::$multiLayout = false |
Definition at line 125 of file zigController.php.
zigController::$loadedOrms = array() |
Definition at line 132 of file zigController.php.
zigController::$db |
Definition at line 139 of file zigController.php.
zigController::$noAutoViewRender = false |
Definition at line 146 of file zigController.php.
zigController::$cacheConfig = array() |
Definition at line 153 of file zigController.php.
zigController::$cacheDict = array() |
Definition at line 160 of file zigController.php.
zigController::$cache |
Definition at line 167 of file zigController.php.
zigController::$noLayout = false |
Definition at line 174 of file zigController.php.
zigController::$postPeer |
Definition at line 181 of file zigController.php.
zigController::$getPeer |
Definition at line 188 of file zigController.php.