$before = $_POST['before'];
     }
     if (isset($_POST['trace'])) {
         $manager = new Indicator_Manager($_POST['trace']);
     }
     $a = $manager->getIndicator($name);
     if (isset($_POST['trace'])) {
         $ind = new Indicator($_POST['trace']);
     }
     $res = $ind->refresh($a, $after, $before);
     $r = json_encode($res);
     echo $r;
 }
 if ($_POST['reason'] == 'share') {
     if (isset($_POST['trace'])) {
         $store = new Indicator_Store($_POST['trace']);
         $manager = new Indicator_Manager($_POST['trace']);
         if (isset($_POST['nameind'])) {
             $ind = $manager->getIndicator($_POST['nameind']);
         }
         $res = $store->addToStore($ind);
     }
     echo json_encode($res);
 }
 if ($_POST['reason'] == 'getForView') {
     if (isset($_POST['trace'])) {
         $manager = new Indicator_Manager($_POST['trace']);
     }
     if (isset($_POST['nameind'])) {
         $ind = $manager->getIndicatorForView($_POST['nameind']);
     }
    if ($_POST['reason'] == 'getStore') {
        $id = $_POST['id'];
        $store = new Indicator_Store($_POST['trace']);
        $ind = $store->getIndicator($id);
        $manager = new Indicator_Manager($_POST['trace']);
        $res = $manager->addFromStore($ind);
        echo json_encode($res);
    }
    if ($_POST['reason'] == 'listall') {
        $st = new Indicator_Store($_POST['trace']);
        $ind = $st->getAll();
        echo json_encode($ind);
    }
    if ($_POST['reason'] == 'getToShow') {
        $st = new Indicator_Store($_POST['trace']);
        $ind = $st->getToShow($_POST['id']);
        echo json_encode($ind);
    }
    if ($_POST['reason'] == 'deletefromstore') {
        $st = new Indicator_Store($_POST['trace']);
        $id = $_POST['id'];
        $st->Delete($id);
    }
    if ($_POST['reason'] == 'search') {
        $st = new Indicator_Store($_POST['trace']);
        $keys = $_POST['Key'];
        $field = $_POST['field'];
        $res = $st->search($field, $keys);
        echo json_encode($res);
    }
}