Exemplo n.º 1
0
 /**
  * Retrieves totals for 'online', 'offline' and 'marked' lists. 
  * To make the union of 2 types use for example 'marked+online'. 
  * $_POST['types'] must be an array : for example : ['marked','online','offline'] or ['marked+online','marked+offline'] 
  */
 public static function list_get_total()
 {
     parent::$json_data += array('total_items' => 0, 'types' => array());
     if (!empty($_POST['types']) && is_array($_POST['types'])) {
         $total_items = array();
         foreach ($_POST['types'] as $type) {
             $total_items[$type] = ApmListData::get_total(explode('+', $type));
         }
         parent::$json_data['total_items'] = $total_items;
         parent::$json_data['types'] = $_POST['types'];
     }
     parent::send_json();
 }
Exemplo n.º 2
0
 public static function nodes_unmark_all()
 {
     parent::$json_data += array('unmarked_nodes' => array());
     $unmarked_nodes = ApmTreeData::unmark_all_current_user_nodes();
     parent::$json_data['unmarked_nodes'] = $unmarked_nodes;
     parent::send_json();
 }
Exemplo n.º 3
0
 /**
  * Loads a subtree given its root.
  * Not used yet TODO: see if we remove this function 
  */
 public static function tree_load_sub_tree()
 {
     parent::$json_data += array('sub_tree' => '', 'node_to_replace' => '', 'sub_tree_nodes' => array());
     $root_node = isset($_POST['root_node']) && is_numeric($_POST['root_node']) ? $_POST['root_node'] : ApmTreeData::root_id;
     $tree = new ApmTreeData();
     $tree->load_last_tree();
     //Set the "tree_nodes" variable retrieved and used in the following included template:
     $sub_tree_nodes = $tree->get_ready_to_display_tree($root_node);
     parent::$json_data['sub_tree'] = self::get_html_tree($sub_tree_nodes);
     parent::$json_data['node_to_replace_by_subtree'] = $root_node;
     parent::$json_data['sub_tree_nodes'] = array_keys($sub_tree_nodes);
     parent::send_json();
 }