[ "tasks" => "Tasks", "no tasks found" => "No tasks found." ] ]); $APPS["taskfloor_tasks"]["i18n"] = TRUE; $APPS["taskfloor_tasks"]["title"] = "tasks"; $APPS["taskfloor_tasks"]["icon"] = "tasks"; $APPS["taskfloor_tasks"]["type"] = "blue-grey"; try { $client = new GuzzleHttp\Client(); $response = $client->request('POST', TASKFLOOR_API, ['form_params' => [ 'action' => "gettasks", 'username' => $_SESSION['username'], 'password' => $_SESSION['password'], 'max' => 5 ]]); $resp = json_decode($response->getBody(), TRUE); if ($resp['status'] == "OK") { if (count($resp['tasks']) > 0) { $content = '
'; foreach ($resp['tasks'] as $task) { $content .= '
'; $content .= ' ' . $task['title'] . ''; $content .= '
'; } $content .= "
"; } else { $content = "
" . lang("no tasks found", false) . "
"; } } } catch (Exception $e) { $content = "
" . lang("error loading widget", false) . " " . $e->getMessage() . "
"; } $content .= '' . lang("open app", false) . '  '; $APPS["taskfloor_tasks"]["content"] = $content; ?>