mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Merge branch 'feature/NewTreeView' of https://github.com/pandorafms/pandorafms into feature/NewTreeView
Conflicts resolved: pandora_console/include/class/Tree.class.php
This commit is contained in:
commit
000e393f4e
@ -129,6 +129,7 @@ class Tree {
|
|||||||
$remove_group = false;
|
$remove_group = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($remove_group)
|
if ($remove_group)
|
||||||
unset($groups[$iterator]);
|
unset($groups[$iterator]);
|
||||||
}
|
}
|
||||||
@ -145,7 +146,16 @@ class Tree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $groups;
|
if ($parent == 0) {
|
||||||
|
$agents = array();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$agents = $this->getDataAgents('group', $parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = array_merge($groups, $agents);
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDataGroup() {
|
public function getDataGroup() {
|
||||||
@ -157,19 +167,19 @@ class Tree {
|
|||||||
$parent = 0;
|
$parent = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$groups = $this->getRecursiveGroup($parent, 1);
|
$data = $this->getRecursiveGroup($parent, 1);
|
||||||
switch ($this->childrenMethod) {
|
switch ($this->childrenMethod) {
|
||||||
case 'on_demand':
|
case 'on_demand':
|
||||||
foreach ($groups as $iterator => $group) {
|
foreach ($data as $iterator => $item) {
|
||||||
if (!empty($group['children'])) {
|
if (!empty($item['children'])) {
|
||||||
$groups[$iterator]['searchChildren'] = 1;
|
$data[$iterator]['searchChildren'] = 1;
|
||||||
// I hate myself
|
// I hate myself
|
||||||
unset($groups[$iterator]['children']);
|
unset($data[$iterator]['children']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$groups[$iterator]['searchChildren'] = 0;
|
$data[$iterator]['searchChildren'] = 0;
|
||||||
// I hate myself
|
// I hate myself
|
||||||
unset($groups[$iterator]['children']);
|
unset($data[$iterator]['children']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -195,19 +205,41 @@ class Tree {
|
|||||||
|
|
||||||
// Make the data
|
// Make the data
|
||||||
$this->tree = array();
|
$this->tree = array();
|
||||||
foreach ($groups as $group) {
|
foreach ($data as $item) {
|
||||||
$data = array();
|
$temp = array();
|
||||||
$data['id'] = $group['id_grupo'];
|
$temp['id'] = $item['id_grupo'];
|
||||||
$data['type'] = 'group';
|
$temp['type'] = 'group';
|
||||||
$data['name'] = $group['nombre'];
|
$temp['name'] = $item['nombre'];
|
||||||
$data['icon'] = $group['icon'];
|
$temp['icon'] = $item['icon'];
|
||||||
$data['searchChildren'] = $group['searchChildren'];
|
$temp['searchChildren'] = $item['searchChildren'];
|
||||||
$data['searchCounters'] = $group['searchCounters'];
|
$temp['searchCounters'] = $item['searchCounters'];
|
||||||
|
|
||||||
$this->tree[] = $data;
|
$this->tree[] = $temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getDataAgents($type, $id) {
|
||||||
|
switch ($type) {
|
||||||
|
case 'group':
|
||||||
|
$filter = array(
|
||||||
|
'id_grupo' => $id,
|
||||||
|
'status' => $this->filter['status'],
|
||||||
|
'nombre' => "%" . $this->filter['search'] . "%"
|
||||||
|
);
|
||||||
|
$agents = agents_get_agents($filter);
|
||||||
|
if (empty($agents)) {
|
||||||
|
$agents = array();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($agents as $iterator => $agent) {
|
||||||
|
$agents[$iterator]['type'] = 'agent';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $agents;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDataModuleGroup() {
|
public function getDataModuleGroup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +367,8 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
|
|||||||
|
|
||||||
$where = db_format_array_where_clause_sql ($filter, 'AND', '');
|
$where = db_format_array_where_clause_sql ($filter, 'AND', '');
|
||||||
|
|
||||||
$where_nogroup = db_format_array_where_clause_sql ($filter_nogroup, 'AND', '');
|
$where_nogroup = db_format_array_where_clause_sql(
|
||||||
|
$filter_nogroup, 'AND', '');
|
||||||
|
|
||||||
if ($where_nogroup == '') {
|
if ($where_nogroup == '') {
|
||||||
$where_nogroup = '1 = 1';
|
$where_nogroup = '1 = 1';
|
||||||
|
@ -159,7 +159,7 @@ echo "</div>";
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo $config['homeurl']; ?>/ajax.php",
|
url: "<?php echo $config['homeurl']; ?>ajax.php",
|
||||||
data: parameters,
|
data: parameters,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
@ -170,8 +170,8 @@ echo "</div>";
|
|||||||
detailRecipient: $("div#tree-controller-detail-recipient"),
|
detailRecipient: $("div#tree-controller-detail-recipient"),
|
||||||
page: page,
|
page: page,
|
||||||
tree: data.tree,
|
tree: data.tree,
|
||||||
baseURL: "<?php echo $config['homeurl']; ?>/",
|
baseURL: "<?php echo $config['homeurl']; ?>",
|
||||||
ajaxURL: "<?php echo $config['homeurl']; ?>/ajax.php",
|
ajaxURL: "<?php echo $config['homeurl']; ?>ajax.php",
|
||||||
filter: {
|
filter: {
|
||||||
search: parameters['filter']['search'],
|
search: parameters['filter']['search'],
|
||||||
status: parameters['filter']['status']
|
status: parameters['filter']['status']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user