Added Object(), fixed some ajax handling
This commit is contained in:
32
classes/Object.php
Normal file
32
classes/Object.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This is class is for manupulating objects in general
|
||||
*
|
||||
* @package lnApp
|
||||
* @category Helpers
|
||||
* @author Deon George
|
||||
* @copyright (c) 2009-2013 Open Source Billing
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
class Object {
|
||||
/**
|
||||
* Provide an in_array capability for an array of Objects
|
||||
*
|
||||
* @param string Object Key that we are evaluating
|
||||
* @param string Value for that Key
|
||||
* @param array The array of objects
|
||||
* @return boolean
|
||||
*/
|
||||
public static function in_array($key,$value,array $objects) {
|
||||
if (! count($objects))
|
||||
return FALSE;
|
||||
|
||||
foreach ($objects as $object)
|
||||
if (isset($object->$key) AND $object->$key == $value)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -97,8 +97,9 @@ abstract class lnApp_Controller_TemplateDefault extends Kohana_Controller_Templa
|
||||
return;
|
||||
|
||||
// For AJAX calls, we dont need to render the complete page.
|
||||
if ($this->request->is_ajax()) {
|
||||
if ($this->request->is_ajax() OR (Kohana::$config->load('debug')->ajax AND preg_match('/^ajax/',Request::current()->action()))) {
|
||||
$this->auto_render = FALSE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user