Exemple #1
0
 private function do_edit($action, $node_choice, $index_node)
 {
     //$synchronize_only_my_children = $this->get_updated_subtrees_roots_on_action($action,$node_choice,$index_node);
     $synchronisation_data = $this->get_synchronisation_data_on_action($action, $node_choice, $index_node);
     $went_ok = false;
     switch ($action) {
         case 'insert_before':
             $went_ok = $this->apm_tree->move_node_before($node_choice, $index_node);
             break;
         case 'insert_after':
             $went_ok = $this->apm_tree->move_node_after($node_choice, $index_node);
             break;
         case 'insert_child':
             $went_ok = $this->apm_tree->move_node_as_child($node_choice, $index_node);
             break;
         case 'delete':
             if ($node_choice == $index_node) {
                 $nb_deleted = $this->delete_nodes($node_choice);
                 if ($nb_deleted > 0) {
                     $resave_data = true;
                     $went_ok = true;
                 }
             }
             break;
     }
     if ($went_ok) {
         $this->synchronize_tree_with_wp_entities($synchronisation_data);
         wp_update_post(array('ID' => $node_choice));
         //So that date_modified changes!
     }
     return $went_ok;
 }