예제 #1
0
function resursiveConvert($input, $maxIterations, $iteration = 1)
{
    $output = convertValue($input);
    if ($maxIterations == $iteration) {
        return $output;
    }
    return resursiveConvert($output, $maxIterations, ++$iteration);
}
예제 #2
0
function getTasks()
{
    global $data, $userData, $connected;
    $respond = array();
    $respond['status'] = false;
    $userTasks = array();
    $stat = 1;
    $parentId = 0;
    if (isset($_SESSION['login']) && $_SESSION['login'] == true) {
        $userId = $_SESSION['userId'];
        /*$sql = "SELECT * from tasks where userId = ? and taskStatus = ? and projectId = ? order by priority desc";
        		$rs = $connected->prepare($sql);
        		$rs->bind_param('sss', $userId, $stat, $parentId);
        		$rs->execute();
        		$result = $rs->get_result();*/
        $result = $connected->query("SELECT * FROM tasks WHERE userId = '{$userId}' and taskStatus = '{$stat}' and projectId = 'parentId' ORDER BY priority DESC");
        if ($result->num_rows == 0) {
            $respond['status'] = false;
            $respond['message'] = "No Task.";
            header('Content-Type: application/json');
            echo json_encode($respond);
        } else {
            while ($row = $result->fetch_assoc()) {
                $row['name'] = convertValue($row['name']);
                $row['description'] = convertValue($row['description']);
                $userTasks[] = $row;
            }
            $respond['message'] = "";
            $respond['status'] = true;
            $respond['data'] = $userTasks;
            header('Content-Type: application/json');
            echo json_encode($respond);
        }
    } else {
        header('Content-Type: application/json');
        echo json_encode($respond);
    }
}