mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Error fixes
This commit is contained in:
parent
3e2fd15302
commit
89fe54d28a
@ -55,6 +55,7 @@ if (is_ajax ()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tree->setFilter($filter);
|
$tree->setFilter($filter);
|
||||||
|
ob_clean();
|
||||||
echo json_encode(array('success' => 1, 'tree' => $tree->getArray()));
|
echo json_encode(array('success' => 1, 'tree' => $tree->getArray()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1029,6 +1029,10 @@ class Tree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function getProcessedItem ($item, $server = false, &$items = array(), &$items_tmp = array(), $remove_empty = false) {
|
protected function getProcessedItem ($item, $server = false, &$items = array(), &$items_tmp = array(), $remove_empty = false) {
|
||||||
|
|
||||||
|
if (isset($processed_item['is_processed']) && $processed_item['is_processed'])
|
||||||
|
return $item;
|
||||||
|
|
||||||
// For strict items
|
// For strict items
|
||||||
if (isset($item['_id_'])) {
|
if (isset($item['_id_'])) {
|
||||||
$item['id'] = $item['_id_'];
|
$item['id'] = $item['_id_'];
|
||||||
@ -1171,6 +1175,7 @@ class Tree {
|
|||||||
// Get the children of the group (special case)
|
// Get the children of the group (special case)
|
||||||
if ($processed_item['type'] == 'group') {
|
if ($processed_item['type'] == 'group') {
|
||||||
$children = $this->getGroupsChildren($items, $items_tmp, $item['id'], $server, $remove_empty);
|
$children = $this->getGroupsChildren($items, $items_tmp, $item['id'], $server, $remove_empty);
|
||||||
|
|
||||||
if (!empty($children)) {
|
if (!empty($children)) {
|
||||||
$processed_item['children'] = $children;
|
$processed_item['children'] = $children;
|
||||||
|
|
||||||
@ -1194,6 +1199,9 @@ class Tree {
|
|||||||
$processed_item = array();
|
$processed_item = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($processed_item))
|
||||||
|
$processed_item['is_processed'] = true;
|
||||||
|
|
||||||
return $processed_item;
|
return $processed_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1967,20 +1975,16 @@ class Tree {
|
|||||||
$items = $this->getItems();
|
$items = $this->getItems();
|
||||||
|
|
||||||
// Build the group hierarchy
|
// Build the group hierarchy
|
||||||
foreach ($items as $key => $item) {
|
while (($item = array_shift($items)) !== null) {
|
||||||
if (empty($item['parent'])) {
|
$processed_item = $this->getProcessedItem($item, false, $items, $processed_items, true);
|
||||||
|
|
||||||
unset($items[$key]);
|
if (!empty($processed_item)
|
||||||
$items_tmp = array();
|
&& isset($processed_item['counters'])
|
||||||
$processed_item = $this->getProcessedItem($item, false, $items, $items_tmp, true);
|
&& isset($processed_item['counters']['total'])
|
||||||
|
&& !empty($processed_item['counters']['total']))
|
||||||
if (!empty($processed_item)
|
$processed_items[] = $processed_item;
|
||||||
&& isset($processed_item['counters'])
|
|
||||||
&& isset($processed_item['counters']['total'])
|
|
||||||
&& !empty($processed_item['counters']['total']))
|
|
||||||
$processed_items[] = $processed_item;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// groupID filter. To access the view from tactical views f.e.
|
// groupID filter. To access the view from tactical views f.e.
|
||||||
if (!empty($processed_items) && !empty($this->filter['groupID'])) {
|
if (!empty($processed_items) && !empty($this->filter['groupID'])) {
|
||||||
$result = self::extractItemWithID($processed_items, $this->filter['groupID'], "group", $this->strictACL);
|
$result = self::extractItemWithID($processed_items, $this->filter['groupID'], "group", $this->strictACL);
|
||||||
|
@ -57,9 +57,9 @@ TreeController = {
|
|||||||
|
|
||||||
container.append($group);
|
container.append($group);
|
||||||
|
|
||||||
elements.forEach(function(element, index) {
|
_.each(elements, function(element) {
|
||||||
element.jqObject = _processNode($group, element);
|
element.jqObject = _processNode($group, element);
|
||||||
}, $group);
|
});
|
||||||
|
|
||||||
return $group;
|
return $group;
|
||||||
}
|
}
|
||||||
@ -560,9 +560,9 @@ TreeController = {
|
|||||||
$node.append($group);
|
$node.append($group);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.tree.forEach(function(element, index) {
|
_.each(data.tree, function(element) {
|
||||||
element.jqObject = _processNode($group, element);
|
element.jqObject = _processNode($group, element);
|
||||||
}, $group);
|
});
|
||||||
|
|
||||||
$group.slideDown();
|
$group.slideDown();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user