Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use new podio-php instead of legacy

  • Loading branch information...
commit 72892366dc6c47651aa74386d68718af444a0152 1 parent a99172d
@haugstrup authored
Showing with 25 additions and 19 deletions.
  1. +9 −6 index.php
  2. +5 −6 init.php
  3. +11 −7 scrumio.classes.php
View
15 index.php
@@ -18,7 +18,11 @@ function scrumboard() {
// Grab sprints and find current sprint
// $filters = array(array('key' => SPRINT_STATE_ID, 'values' => array('Active')));
- $sprints = $api->item->getItems(SPRINT_APP_ID, 5, 0, 'created_on', 1);
+ $sprints = $api->item->getItems(SPRINT_APP_ID, array(
+ 'limit' => 5,
+ 'sort_by' => 'created_on',
+ 'sort_desc' => 1
+ ));
foreach ($sprints['items'] as $item) {
if (params('id') == $item['item_id']) {
$current_sprint = $item;
@@ -46,16 +50,15 @@ function scrumboard() {
dispatch('/authorize', 'authorize');
function authorize() {
- global $oauth;
+ global $api;
$story_app = NULL;
// Successful authorization. Store the access token in the session
if (!isset($_GET['error'])) {
- $oauth->getAccessToken('authorization_code', array('code' => $_GET['code'], 'redirect_uri' => option('OAUTH_REDIRECT_URI')));
- $api = new PodioAPI();
- $_SESSION['access_token'] = $oauth->access_token;
- $_SESSION['refresh_token'] = $oauth->refresh_token;
+ $api->authenticate('authorization_code', array('code' => $_GET['code'], 'redirect_uri' => option('OAUTH_REDIRECT_URI')));
+ $_SESSION['access_token'] = $api->oauth->access_token;
+ $_SESSION['refresh_token'] = $api->oauth->refresh_token;
$story_app = $api->app->get(STORY_APP_ID);
}
View
11 init.php
@@ -4,13 +4,12 @@
session_start();
// Setup API client and get access token
-$oauth = PodioOAuth::instance();
-$baseAPI = PodioBaseAPI::instance(CLIENT_ID, CLIENT_SECRET);
+$api = Podio::instance(CLIENT_ID, CLIENT_SECRET);
+
+// $api->debug = true;
// If there's an access token in the session, make podio-php use it
if (!empty($_SESSION['access_token'])) {
- $oauth->access_token = $_SESSION['access_token'];
- $oauth->refresh_token = $_SESSION['refresh_token'];
+ $api->oauth->access_token = $_SESSION['access_token'];
+ $api->oauth->refresh_token = $_SESSION['refresh_token'];
}
-$api = new PodioAPI();
-
View
18 scrumio.classes.php
@@ -179,9 +179,6 @@ public function __construct($sprint) {
}
}
// Find active sprint
- // $filters = array(array('key' => SPRINT_STATE_ID, 'values' => array('Active')));
- // $sprints = $api->item->getItems(SPRINT_APP_ID, 1, 0, 'title', 0, $filters);
- // $sprint = $sprints['items'][0];
$sprint_id = $sprint['item_id'];
// Set sprint properties
@@ -195,10 +192,14 @@ public function __construct($sprint) {
}
// Get all stories in this sprint
- $filters = array(array('key' => STORY_SPRINT_ID, 'values' => array($sprint_id)));
$sort_by = defined('STORY_IMPORTANCE_ID') && STORY_IMPORTANCE_ID ? STORY_IMPORTANCE_ID : 'title';
$sort_desc = defined('STORY_IMPORTANCE_ID') && STORY_IMPORTANCE_ID ? 1 : 0;
- $stories = $api->item->getItems(STORY_APP_ID, 200, 0, $sort_by, $sort_desc, $filters);
+ $stories = $api->item->getItems(STORY_APP_ID, array(
+ 'limit' => 200,
+ 'sort_by' => $sort_by,
+ 'sort_desc' => $sort_desc,
+ STORY_SPRINT_ID => $sprint_id,
+ ));
// Grab all story items for all stories in one go
$stories_ids = array();
@@ -211,8 +212,11 @@ public function __construct($sprint) {
$stories_estimates[$story['item_id']] = 0;
$stories_time_left[$story['item_id']] = 0;
}
- $filters = array(array('key' => ITEM_STORY_ID, 'values' => $stories_ids));
- $raw = $api->item->getItems(ITEM_APP_ID, 200, 0, 'title', 0, $filters);
+ $raw = $api->item->getItems(ITEM_APP_ID, array(
+ 'limit' => 200,
+ 'sort_by' => 'title',
+ ITEM_STORY_ID => join(';', $stories_ids),
+ ));
foreach ($raw['items'] as $item) {
$item = new ScrumioItem($item);
$stories_items[$item->story_id][] = $item;
Please sign in to comment.
Something went wrong with that request. Please try again.