function getAllItems($id)
{
    $items = PodioItem::filter($id);
    //$result = json_decode($items);
    //var_dump($result);
    //echo $result->app;
}
 public function getExternalId_values($allExteral_ids)
 {
     $i = 0;
     $items = PodioItem::filter($this->app_id, array('limit' => 60));
     foreach ($items['items'] as $item) {
         // Now you can extract values from the individual item. E.g.:
         for ($j = 0; $j < count($allExteral_ids); $j++) {
             $field = $item->field($allExteral_ids[$j]);
             $allValue[$j] = $field->humanized_value();
         }
         $allItems[$i] = $allValue;
         $i++;
     }
     return $allItems;
 }
Example #3
0
        echo "</a>";
    }
    echo "</div>";
    echo "</div>";
}
?>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="col-md-6">
					<h1>Podio</h1>
					<?php 
Podio::setup($config['podio']['client-id'], $config['podio']['client-secret']);
Podio::authenticate_with_app($config['podio']['ww-app-id'], $config['podio']['ww-app-secret']);
$ww = PodioItem::filter($config['podio']['ww-app-id']);
foreach ($ww as $week) {
    if ($week->title == 'Jake Neumann') {
        $week_start = $week->fields['1']->values['start'];
        if (time() - 60 * 60 * 24 * 7 < strtotime($week_start->format('Y-m-d H:i:s'))) {
            // var_dump( $week->fields );
            foreach ((array) $week->fields as $week) {
                foreach ((array) $week as $day) {
                    if (is_object($day) && $day->type == 'app') {
                        echo '<h4>' . $day->label . '</h4>';
                        foreach ($day->values as $proj) {
                            echo '<a href="' . $proj->link . '" target="_blank">';
                            echo $proj->title;
                            echo '</a>';
                            echo '<br />';
                        }
Example #4
0
 public static function addAllProjectsToArray()
 {
     $category_status_id = 62473690;
     //filtering by client name here
     //1 , 2, 3, 6, 7, 8, 9, 10, 11, 14
     $planning_collection = PodioItem::filter(APP_ID, array('filters' => array($category_status_id => array(1, 2, 3, 7, 8, 9, 10, 11, 14)), 'limit' => 200, 'sort_by' => 'created_on'));
     foreach ($planning_collection as $item) {
         //Add one to global variable each time to $project_count
         global $active_project_count;
         //the the global keyword to reference global scope
         global $start_day_array;
         global $start_month_array;
         global $start_year_array;
         global $due_day_array;
         global $due_month_array;
         global $due_year_array;
         global $title_array;
         global $client_array;
         global $job_number_array;
         global $id_array;
         $active_project_count += 1;
         array_push($start_day_array, intval(date_format($item->created_on, 'd')));
         //Maybe try intval(variablehere);
         array_push($start_month_array, intval(date_format($item->created_on, 'm')) - 1);
         //Subtracting 1 from month for some reason its off ... strange
         array_push($start_year_array, intval(date_format($item->created_on, 'Y')));
         //Maybe try intval(variablehere);
         //Add the values to the DUE DAY array's
         $due_date = $item->fields["due-date"];
         //get the due date by external id as object
         //$due_date = $item->fields["start-date"]; //get the due date by external id as object
         $blah = 0;
         $due_date->start != null ? $blah = intval(date_format($due_date->start, 'd')) : ($blah = intval(date('d')));
         array_push($due_day_array, $due_date->start == null ? intval(date('d')) : intval(date_format($due_date->start, 'd')));
         //TODO ask about default due and start days if they are null
         array_push($due_month_array, $due_date->start == null ? intval(date('m')) : intval(date_format($due_date->start, 'm')));
         array_push($due_year_array, $due_date->start == null ? intval(date('Y')) : intval(date_format($due_date->start, 'Y')));
         //TITLE
         array_push($title_array, ucfirst(strtolower($item->title)));
         //JOB NUMBER
         $job = $item->fields["job"];
         array_push($job_number_array, (double) $job->values);
         //CLIENT NAME ARRAY
         $client_name = $item->fields["client"];
         array_push($client_array, $client_name);
         //ID ARRAY
         array_push($id_array, $item->id);
     }
 }
$item_collection = PodioItem::filter(YOUR_APP_ID);
// A collection is an associative array with some extra data in addition to the list of items.
print $item_collection['total'];
// The total amount of items in the app
print $item_collection['filtered'];
// Number of items matching the current filter
print_r($item_collection['items']);
// Array of PodioItem instances
// PodioItem::filter is very powerful. You can filter and sort on almost any field. See all the details on https://developers.podio.com/doc/filters
// If you have a money field with a field_id of '1234' and you want to get all items in the app where the value is between 100 and 200:
$item_collection = PodioItem::filter(YOUR_APP_ID, array('filters' => array(1234 => array('from' => 100, 'to' => 200))));
// The following field types use the 'from' / 'to' format for filtering: number, money, calculation, progress, duration, date
// With other fields -- category, app reference, contact, question -- you provide an array of ids to match. E.g. if you want to get a collection of items where the app reference field with the field_id 5678 only matches items referencing items with the item_ids 1, 2 and 3:
$item_collection = PodioItem::filter(YOUR_APP_ID, array('filters' => array(5678 => array(1, 2, 3))));
// You can set sorting options and limit and offset values also. E.g. getting the 100 first items, sorted by their last edit date:
$item_collection = PodioItem::filter(YOUR_APP_ID, array('sort_by' => 'last_edit_on', 'sort_desc' => true, 'limit' => 100, 'offset' => 0));
// It's also doable to create new items from scratch (useful if you are migrating data from another system).
// Create the base item. Notice how you have to create a PodioApp instance. This is so we know what app to store the item in.
$item = new PodioItem(array('app' => new PodioApp(YOUR_APP_ID), 'fields' => array(), 'external_id' => 'my-legacy-id-number'));
// We can add some fields to the item:
$item->fields = array(new PodioTextItemField('title'), new PodioImageItemField('image-field'));
// Or you can use add_field and remove_field methods to add/remove fields one at a time:
$item->add_field(new PodioNumberItemField('number-field'));
// Field object must have a field_id or an external_id
$item->remove_field('number-field');
// Remove by field_id or external_id
// Notice how the external_id of the fields is being passed as the first argument to the constructor? When you create new instances of any of the Podio objects you can send three things to the constructor:
// 1. An associative array of properties. Like we did above when creating the item.
// 2. A string representing the external_id you want to set. Like we did for the PodioItemFields just above
// 3. An id value. Like we did for the PodioApp we attached to the PodioItem above.
// Give the fields values: