Minor fixes to statement, services and internal things
Many misc updates
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
class Controller_Admin_Account extends Controller_TemplateDefault_Admin {
|
||||
protected $secure_actions = array(
|
||||
'autocomplete'=>FALSE, // @todo To Change
|
||||
'listlog'=>TRUE,
|
||||
);
|
||||
|
||||
@@ -36,5 +37,40 @@ class Controller_Admin_Account extends Controller_TemplateDefault_Admin {
|
||||
)),
|
||||
));
|
||||
}
|
||||
|
||||
public function action_autocomplete() {
|
||||
$return = array();
|
||||
|
||||
$a = ORM::factory('account')->where('status','=',1);
|
||||
if (isset($_REQUEST['term']) AND trim($_REQUEST['term'])) {
|
||||
$t = $_REQUEST['term'];
|
||||
|
||||
// @todo - Implement different search criteria, eg: @ by email, space for first/last, etc
|
||||
if (FALSE) {
|
||||
|
||||
// All search
|
||||
} else {
|
||||
$a = $a
|
||||
->where_open()
|
||||
->where('first_name','like','%'.$t.'%')
|
||||
->or_where('last_name','like','%'.$t.'%')
|
||||
->or_where('company','like','%'.$t.'%')
|
||||
->or_where('email','like','%'.$t.'%')
|
||||
->where_close();
|
||||
}
|
||||
}
|
||||
|
||||
// @todo The results should be limited so that users dont see what they shouldnt.
|
||||
foreach ($a->find_all() as $ao)
|
||||
array_push($return,array(
|
||||
'id'=>$ao->id,
|
||||
'label'=>sprintf('%s (%s)',$ao->name(),$ao->email),
|
||||
'value'=>$ao->id,
|
||||
));
|
||||
|
||||
$this->auto_render = FALSE;
|
||||
$this->response->headers('Content-Type','application/json');
|
||||
$this->response->body(json_encode($return));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -126,7 +126,7 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template {
|
||||
foreach (array('file'=>array(
|
||||
'js/jquery.cookie.js',
|
||||
'js/jquery.jstree-1.0rc3.js',
|
||||
'js/jquery-1.4.2.js',
|
||||
'js/jquery-1.6.4.min.js',
|
||||
)) as $type => $datas) {
|
||||
|
||||
foreach ($datas as $data) {
|
||||
|
@@ -18,7 +18,7 @@ class Controller_lnApp_Tree extends Controller_Default {
|
||||
|
||||
public function after() {
|
||||
$this->response->headers('Content-Type','application/json');
|
||||
$this->response->body(sprintf('[%s]',json_encode($this->output)));
|
||||
$this->response->body(json_encode($this->output));
|
||||
|
||||
parent::after();
|
||||
}
|
||||
@@ -29,6 +29,7 @@ class Controller_lnApp_Tree extends Controller_Default {
|
||||
return '
|
||||
<div id="tree" class=""></div>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
$(function () {
|
||||
$("#tree").jstree({
|
||||
themes : {
|
||||
@@ -40,6 +41,7 @@ $(function () {
|
||||
},
|
||||
cookies : {
|
||||
"save_selected" : false,
|
||||
"cookie_options" : { path : "'.URL::site().'" }
|
||||
},
|
||||
json_data : {
|
||||
"correct_state" : "true",
|
||||
@@ -60,7 +62,7 @@ $(function () {
|
||||
id = data.rslt.obj.attr(\'id\').substr(a+1);
|
||||
|
||||
if (href = $("#N_"+id).attr("href")) {
|
||||
$("#ajBODY").empty().html("<img src=\"'.URL::site('media/img/ajax-progress.gif').'\"/>");
|
||||
$("#ajBODY").empty().html("<img src=\"'.URL::site('media/img/ajax-progress.gif').'\" alt=\"Loading...\" />");
|
||||
$("#ajBODY").load(href, function(r,s,x) {
|
||||
if (s == "error") {
|
||||
var msg = "Sorry but there was an error: ";
|
||||
@@ -72,6 +74,7 @@ $(function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
// -->
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
@@ -43,8 +43,8 @@ class Controller_Tree extends Controller_lnApp_Tree {
|
||||
|
||||
} else {
|
||||
$idx = NULL;
|
||||
if (preg_match('/:/',$id))
|
||||
list($id,$idx) = explode(':',$id,2);
|
||||
if (preg_match('/_/',$id))
|
||||
list($id,$idx) = explode('_',$id,2);
|
||||
|
||||
$mo = ORM::factory('module',$id);
|
||||
|
||||
@@ -106,7 +106,7 @@ class Controller_Tree extends Controller_lnApp_Tree {
|
||||
|
||||
else
|
||||
foreach ($subdata as $t=>$x)
|
||||
array_push($data,array('id'=>$mmo->module_id.':'.$t,'name'=>$t,'state'=>'closed'));
|
||||
array_push($data,array('id'=>$mmo->module_id.'_'.$t,'name'=>$t,'state'=>'closed'));
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user