function _get(&$db, $case)
{
    global $conf;
    switch ($case) {
        case 'tasks':
            $onlyUseGrid = isset($_REQUEST['gridMode']) && $_REQUEST['gridMode'] == 1 ? true : false;
            $var = explode('|', GETPOST('status'));
            $Tab = array();
            foreach ($var as $statut) {
                $Tab = array_merge($Tab, _tasks($db, (int) GETPOST('id_project'), $statut, $onlyUseGrid));
            }
            print json_encode($Tab);
            break;
        case 'task-ordo-simulation':
            if ($conf->workstation->enabled) {
                define('INC_FROM_DOLIBARR', true);
                dol_include_once('/workstation/config.php');
                $ATMdb = new TPDOdb();
                $TWorkstation = TWorkstation::getWorstations($ATMdb, true);
            } else {
                print 'module non configuré';
                exit;
            }
            $Tab = ordonnanceur(array_merge(_tasks_ordo($db, $TWorkstation, 'inprogress|todo', 0), _task_commande($db, GETPOST('fk_commande'))), $TWorkstation, 0, false);
            $time_max = 0;
            foreach ($Tab['tasks'] as &$task) {
                if ($task['time_estimated_end'] > $time_max) {
                    $time_max = (int) $task['time_estimated_end'];
                }
            }
            print dol_print_date($time_max + $conf->global->SCRUM_TIME_MORE_PREVISION * 86400, 'day');
            break;
        case 'tasks-ordo':
            $TWorkstation = array(0 => array('nb_ressource' => 1, 'velocity' => 1, 'background' => 'linear-gradient(to right,white, #ccc)', 'name' => 'Non ordonnancé'));
            if ($conf->workstation->enabled) {
                define('INC_FROM_DOLIBARR', true);
                dol_include_once('/workstation/config.php');
                $ATMdb = new TPDOdb();
                $TWorkstation = TWorkstation::getWorstations($ATMdb, true, false, $TWorkstation);
            }
            //     var_dump($TWorkstation);
            $Tab = ordonnanceur(_tasks_ordo($db, $TWorkstation, GETPOST('status'), GETPOST('fk_workstation')), $TWorkstation, (int) GETPOST('fk_workstation'));
            if (!empty($conf->global->SCRUM_LINK_EVENT_TO_TASK)) {
                ordonnanceur_link_event($Tab);
            }
            print json_encode($Tab);
            break;
        case 'task':
            print json_encode(_task($db, (int) GETPOST('id')));
            break;
        case 'velocity':
            print json_encode(_velocity($db, (int) GETPOST('id_project')));
            break;
    }
}
function _get(&$db, $case)
{
    global $conf;
    switch ($case) {
        case 'logged-status':
            echo 'ok';
            break;
        case 'tasks':
            $onlyUseGrid = isset($_REQUEST['gridMode']) && $_REQUEST['gridMode'] == 1 && empty($conf->global->SCRUM_ALLOW_ALL_TASK_IN_GRID) ? true : false;
            $var = explode('|', GETPOST('status'));
            $Tab = array();
            foreach ($var as $statut) {
                $Tab = array_merge($Tab, _tasks($db, (int) GETPOST('id_project'), $statut, $onlyUseGrid));
            }
            print json_encode($Tab);
            break;
        case 'task-ordo-simulation':
            if ($conf->workstation->enabled) {
                define('INC_FROM_DOLIBARR', true);
                dol_include_once('/workstation/config.php');
                $PDOdb = new TPDOdb();
                $TWorkstation = TWorkstation::getWorstations($PDOdb, true);
            } else {
                print 'module non configuré';
                exit;
            }
            $type_object = GETPOST('type_object');
            $TTaskObject = $type_object == 'propal' ? _task_propal($db, GETPOST('fk_object')) : _task_commande($db, GETPOST('fk_object'));
            $Tab = ordonnanceur(array_merge(_tasks_ordo($db, $TWorkstation, 'inprogress|todo', 0), $TTaskObject), $TWorkstation, 0, false);
            $time_max = 0;
            foreach ($Tab['tasks'] as &$task) {
                if ($task['time_estimated_end'] > $time_max) {
                    $time_max = (int) $task['time_estimated_end'];
                }
            }
            if ($type_object == 'propal') {
                print dol_print_date($time_max + $conf->global->SCRUM_TIME_MORE_PREVISION_PROPAL * 86400, 'day');
            } else {
                print dol_print_date($time_max + $conf->global->SCRUM_TIME_MORE_PREVISION * 86400, 'day');
            }
            break;
        case 'tasks-ordo':
            $TWorkstation = array(0 => array('nb_ressource' => 1, 'velocity' => 1, 'background' => 'linear-gradient(to right,white, #ccc)', 'name' => 'Non ordonnancé'));
            if ($conf->workstation->enabled) {
                define('INC_FROM_DOLIBARR', true);
                dol_include_once('/workstation/config.php');
                $PDOdb = new TPDOdb();
                $TWorkstation = TWorkstation::getWorstations($PDOdb, true, false, $TWorkstation);
            }
            //     var_dump($TWorkstation);
            $Tab = ordonnanceur(_tasks_ordo($db, $TWorkstation, GETPOST('status'), GETPOST('fk_workstation')), $TWorkstation, (int) GETPOST('fk_workstation'));
            if (!empty($conf->global->SCRUM_LINK_EVENT_TO_TASK)) {
                ordonnanceur_link_event($Tab);
            }
            print json_encode($Tab);
            break;
        case 'task':
            print json_encode(_task($db, (int) GETPOST('id')));
            break;
        case 'velocity':
            print json_encode(_velocity($db, (int) GETPOST('id_project')));
            break;
        case 'select-task':
            dol_include_once('/core/class/html.formother.class.php');
            $formother = new FormOther($db);
            //selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0)
            echo $formother->selectProjectTasks(GETPOST('fk_task'), GETPOST('fk_project'), 'fk_project_task', 0, 1, 0, 1);
            break;
    }
}