//Get by Id if (!empty($_DATA['id'])) { if ($_DATA['id'] == 'types') { echo json_encode($transactions->getTypes()); } exit; //Get by Tag } elseif (!empty($_DATA['tag'])) { isset($_DATA['count']) ? $count = intval($_DATA['count']) : ($count = 10); isset($_DATA['from']) ? $from = $_DATA['from'] : ($from = ""); isset($_DATA['to']) ? $to = $_DATA['to'] : ($to = ""); isset($_DATA['account']) ? $account = $_DATA['account'] : ($account = ""); isset($_DATA['tag']) ? $tag = $_DATA['tag'] : ($tag = ""); isset($_DATA['orderby']) ? $orderby = $_DATA['orderby'] : ($orderby = 'id'); isset($_DATA['order']) ? $order = $_DATA['order'] : ($order = 'asc'); echo json_encode($transactions->getByTag($count, $from, $to, $account, $tag, $orderby, $order)); exit; //Get ALL } else { isset($_DATA['count']) ? $count = intval($_DATA['count']) : ($count = 10); isset($_DATA['from']) ? $from = $_DATA['from'] : ($from = ""); isset($_DATA['to']) ? $to = $_DATA['to'] : ($to = ""); isset($_DATA['account']) ? $account = $_DATA['account'] : ($account = ""); isset($_DATA['orderby']) ? $orderby = $_DATA['orderby'] : ($orderby = 'id'); isset($_DATA['order']) ? $order = $_DATA['order'] : ($order = 'asc'); echo json_encode($transactions->get($count, $from, $to, $account, "", $orderby, $order)); exit; } break; /* * ======================================