Skip to content

Commit

Permalink
Reworded category <-> calendar confusing a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufschmidt committed Oct 7, 2015
1 parent a7f1d65 commit 893d2c5
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ protected static function getCategories($accessToken) {
/**
*
*/
protected static function getCalendarInfo($categories, $calendarInfo) {
protected static function getCalendarInfo($categories, $categoryInfo) {
// Fetch all sub calendars
$calendarId = $calendarInfo['cat_id'];
$calendarId = $categoryInfo['cat_id'];
$subCategories = $categories->getSubitemCategories($calendarId);

// Build calendar-info
$object = array(
'calendar_id' => intval($calendarId),
'title' => $calendarInfo['title']
'title' => $categoryInfo['title']
);

// Add children (if available)
Expand All @@ -91,9 +91,9 @@ function($value) { return intval($value); },
*/
public static function hasCalendar($accessToken, $calendarId) {
$categories = Calendars::getCategories($accessToken);
$calendarInfos = $categories->getCategoriesInfo();
$categoryInfos = $categories->getCategoriesInfo();

return ($calendarInfos[$calendarId] != null);
return ($categoryInfos[$calendarId] != null);
}


Expand All @@ -104,8 +104,8 @@ public static function getAllCalendars($accessToken) {
// Fetch info for each calendar (called category here)
$result = array();
$categories = self::getCategories($accessToken);
foreach($categories->getCategoriesInfo() as $calendarInfo) {
$info = self::getCalendarInfo($categories, $calendarInfo);
foreach($categories->getCategoriesInfo() as $categoryInfo) {
$info = self::getCalendarInfo($categories, $categoryInfo);
$calendarId = $info['calendar_id'];
$result[$calendarId] = $info;
}
Expand All @@ -125,12 +125,12 @@ public static function getCalendars($accessToken, $calendarIds) {
// Fetch each contact from list
$result = array();
$categories = self::getCategories($accessToken);
$calendarInfos = $categories->getCategoriesInfo();
$categoryInfos = $categories->getCategoriesInfo();
$noSuccess = true;
foreach($calendarIds as $calendarId)
// Does calendar with this id exist?
if ($calendarInfos[$calendarId]) {
$result[$calendarId] = self::getCalendarInfo($categories, $calendarInfos[$calendarId]);
if ($categoryInfos[$calendarId]) {
$result[$calendarId] = self::getCalendarInfo($categories, $categoryInfos[$calendarId]);
$noSuccess = false;
}
// Add missing calendarId information to response
Expand Down

0 comments on commit 893d2c5

Please sign in to comment.