Custom dashboard with pictures under each goal and groups for organizing

I guess I should post this under its own thread, too.

Here’s some bad coding for a custom dashboard, if you’d like it. (The
Beeminder api files need to be placed in the appropriate places alongside
this, as well.)

Once it’s up and running, tweak to your heart’s content to make any kind of
groups you’d like. Also, it pulls a picture for each goal from a Dropbox
folder, making it easier to find graphs quickly if you have many of them,
as well as giving you something visual to add to your motivation.

dashboard.php

div.outter { float:left; border:thin solid black; padding-top: 0px; padding-right: 5px; padding-bottom: 0in; padding-left: 5px; margin: 5px; }
div.inner {  

float:left;
height: 275px;
width: 160px;
}

div.innersmall {  

float:left;
width: 205px;
}

div.outterarchive { 

background: #BABABA;
float:left;
border:thin solid black;
padding-top: 0px;
padding-right: 5px;
padding-bottom: 0in;
padding-left: 5px;
margin: 5px;
}

div.innerarchive {  

background: #BABABA;
float:left;
height: 275px;
width: 160px;
}

img.MaxSized {
max-width: 150px;
max-height:43.63%;
}

<?php /* 1. Create a folder inside your Dropbox "public" folder called "goalpics" and add a jpg that represents each goal (named with the slug for each goal: goalslug.jpg). Keep the picture small in size so you don't waste bandwidth for nothing. 2. Change the placeholders below to your own info. The items you need to change are preceded and followed by "xx" to make it easier to search for them (as well as to find and replace them without unintentionally wiping out anything else). */ require_once 'lib/Beeminder/Autoloader.php'; Beeminder_Autoloader::register(); // Include the autoloader require_once dirname(__FILE__) . '/lib/Beeminder/Autoloader.php'; Beeminder_Autoloader::register(); // Create new client $api = new Beeminder_Client(); // Setup auth (private token) $api->login('xxyourusernamexx', 'xxyourprivatetokenxx', Beeminder_Client::AUTH_PRIVATE_TOKEN); // Fetch a list of goals for the user $goals = $api->getGoalApi()->getGoals(); $date = new DateTime(); $startToday = strtotime('today'); $endToday = strtotime('tomorrow'); $endTomorrow = $endToday + (24 * 60 * 60); $endWeek = $endToday + (6 * 24 * 60 * 60); $fourWeeks = $endToday + (27 * 24 * 60 * 60); $countDays = 0; $countDiff = 0; $countAver = 0; // Output today's derail risks echo "
"; echo "

Could Derail Today

"; foreach ($goals as $goal) { if ( ($goal->losedate < $endToday) ){ echo "
"; echo "{$goal->title} \n
"; echo "{$goal->limsum} \n
"; echo "slug}\" target=\"_blank\"> thumb_url}\" alt=\"{$goal->title}\"> \n
"; echo "
"; } } echo "
"; // NEEDS TODAY'S DATA echo "
"; echo "

Needs Today's Data

"; foreach ($goals as $goal) { if ( // NAME ( // As soon as I figure out how to request whether "pessimistic presumptive" is set to "on" for a goal, I will add that here. ($goal-> goal_type == "drinker") // If you've changed your goals to the custom type, you'll have to change this to list the do-less goals individually, which uses this format: ($goal-> slug == "goalslugtitlegoeshere") || ($goal-> slug == "nextgoalslugtitle") ) && ($goal->lastday < $startToday) && ($goal->burner != "backburner") && ($goal->frozen != 1) ) { echo "
"; echo "{$goal->title} \n
"; echo "{$goal->limsum} \n
"; echo "slug}\" target=\"_blank\"> thumb_url}\" alt=\"{$goal->title}\"> \n
"; echo "slug}\" target=\"_blank\">slug}.jpg\" alt=\"{$goal->title}\"> \n
"; echo "
"; } } echo "
"; // LIMIT SET echo "
"; echo "

Limit Set

"; foreach ($goals as $goal) { if ( // Limit Set ( ($goal-> goal_type == "drinker") // The same note about custom goals applies here ) && ($goal->burner != "backburner") && ($goal->frozen != 1) ) { echo "
"; echo "{$goal->title} \n
"; echo "Max: "; echo "{$goal->limsum} \n
"; echo "slug}\" target=\"_blank\"> thumb_url}\" alt=\"{$goal->title}\"> \n
"; echo "slug}\" target=\"_blank\">slug}.jpg\" alt=\"{$goal->title}\"> \n
"; echo "
"; } } echo "
"; // COULD DERAIL TOMORROW echo "
"; echo "

Could Derail Tomorrow

"; foreach ($goals as $goal) { if ( // NAME ($endToday < $goal->losedate) && ($goal->losedate < $endTomorrow) && ($goal->burner != "backburner") && ($goal->frozen != 1) ) { echo "
"; echo "{$goal->title} \n
"; echo "{$goal->limsum} \n
"; echo "slug}\" target=\"_blank\"> thumb_url}\" alt=\"{$goal->title}\"> \n
"; echo "slug}\" target=\"_blank\">slug}.jpg\" alt=\"{$goal->title}\"> \n
"; echo "
"; } } echo "
"; // COULD DERAIL THIS WEEK echo "
"; echo "

Could Derail This Week

"; foreach ($goals as $goal) { if ( // NAME ($endTomorrow < $goal->losedate) && ($goal->losedate < $endWeek) && ($goal->burner != "backburner") && ($goal->frozen != 1)) { echo "
"; echo "{$goal->title} \n
"; echo "{$goal->limsum} \n
"; echo "slug}\" target=\"_blank\"> thumb_url}\" alt=\"{$goal->title}\"> \n
"; echo "slug}\" target=\"_blank\">slug}.jpg\" alt=\"{$goal->title}\"> \n
"; echo "
"; } } echo "
"; // SOME GROUP I WANT TO TRACK // (add something specific to the end of the title of each goal, "(Projects)" in this example, and then adjust what's below to have those grouped together. echo "
"; echo "

Work Projects

"; foreach ($goals as $goal) { if ( ((substr($goal->title, -6)) == "(Work)") // When you change this, don't forget to change the "6" to the right number of characters ) { echo "
"; echo "{$goal->title} \n
"; echo "{$goal->limsum} \n
"; echo "slug}\" target=\"_blank\"> thumb_url}\" alt=\"{$goal->title}\"> \n
"; echo "slug}\" target=\"_blank\">slug}.jpg\" alt=\"{$goal->title}\"> \n
"; echo "
"; } } echo "
"; // ALL ACTIVE GOALS echo "
"; echo "

Active Goals

"; foreach ($goals as $goal) { if ( ($goal->burner != "backburner") ) { echo "
"; echo "{$goal->title} \n
"; echo "{$goal->limsum} \n
"; echo "slug}\" target=\"_blank\"> thumb_url}\" alt=\"{$goal->title}\"> \n
"; echo "slug}\" target=\"_blank\">slug}.jpg\" alt=\"{$goal->title}\"> \n
"; echo "
"; } } echo "
"; // 'ON HOLD' OR 'TO BE ARCHIVED' echo "
"; echo "

'On Hold' or 'To Be Archived'

"; foreach ($goals as $goal) { if ( // NAME ($goal->burner == "backburner") ) { echo "
"; echo "{$goal->title} \n
"; echo "{$goal->limsum} \n
"; echo "slug}\" target=\"_blank\"> thumb_url}\" alt=\"{$goal->title}\"> \n
"; echo "slug}\" target=\"_blank\">slug}.jpg\" alt=\"{$goal->title}\"> \n
"; echo "{$goal->frozen} \n
"; echo "
"; } } echo "
"; ?>

==================================