<?php // first day of this month $first_day = mktime(0, 0, 0, date("n", $day), 1, date("Y", $day)); // weekday with which month starts $start_month = date("w", $first_day); // length of month $length_month = date("t", $day); // last day of this month $last_day = mktime(23, 59, 59, date("n", $day), $length_month, date("Y", $day)); // days of month before $days_month_before = date("t", strtotime("-1 month", $day)); // all entries for this month $list = listEntries($first_day, $last_day); $smarty->assign('month', $lang->get(strtolower(date("M", $day)))); $smarty->assign('prev', makeHTMLURL($lang->get('prev_month'), makeURL($mod, array('day' => strtotime("-1 Month", $day), 'view' => $view)))); $smarty->assign('next', makeHTMLURL($lang->get('next_month'), makeURL($mod, array('day' => strtotime("+1 Month", $day), 'view' => $view)))); $breadcrumbs->addElement(makeDateRange($first_day, $last_day), makeURL($mod, array('view' => 'month', 'day' => $day))); $current_day = $days_month_before - $start_month; $in_month = false; for ($i = 0; $i <= 41; $i++) { if ($i == $start_month) { $in_month = true; $current_day = 0; } if ($i == $start_month + $length_month) { $in_month = false; $current_day = 0; } $current_day++; $current_day_ts = mktime(0, 0, 0, date("n", $day), $current_day, date("Y", $day));
<?php $smarty->assign('path', $template_dir . "/view_day.tpl"); $breadcrumbs->addElement(makeDate($day), makeURL($mod, array('day' => $day, 'view' => $view))); $smarty->assign('prev', makeHTMLURL($lang->get('prev_day'), makeURL($mod, array('day' => strtotime("-1 Day", $day), 'view' => $view)))); $smarty->assign('next', makeHTMLURL($lang->get('next_day'), makeURL($mod, array('day' => strtotime("+1 Day", $day), 'view' => $view)))); $list = listEntries($day); $day_view = makeEntryArrayQuarters($list, $maxCols); $tbl_info = array(); $width = (int) floor(85 / ($maxCols + 1)); for ($i = 1; $i <= $maxCols + 1; $i++) { $tbl_info[$i] = $width; } $smarty->assign('tbl_info', $tbl_info); $smarty->assign('birthdays', $config->get('calendar', 'show-birthdays') == 1 ? getTodaysBirthdays($day) : ""); $smarty->assign('day_view', $day_view);
} elseif (array_key_exists('ClearList', $_POST)) { // Remove the table service. $deleted = $cloudStorageService->deleteTable($tasksTableName); $cloudTable = null; if ($deleted) { // Sleep until the table is deleted, otherwise, the server may still be in the deleting process sleep(25); } } elseif (array_key_exists('DestroyList', $_POST)) { // Clean and remove the storage service. $cloudSubscription->deleteStorageService($storageServiceName); $cloudSubscription = null; return; } if (!is_null($cloudTable)) { listEntries($cloudTable); } function listEntries($cloudTable) { $result = $cloudTable->queryEntities(); $entities = $result->getEntities(); foreach ($entities as $entity) { $name = $entity->getPropertyValue('Name'); $category = $entity->getPropertyValue('Category'); $date = $entity->getPropertyValue('Date'); $complete = $entity->getPropertyValue('RowKey'); $partitionKey = $entity->getPropertyValue('PartitionKey'); echo "<tr>\n <td>{$name}</td>\n <td>{$category}</td>\n <td>{$date}</td>\n <form action=\"index.php\" method=\"post\">\n <td><input type=\"input\" name=\"PartitionKey\" value=\"{$partitionKey}\" </> </td>\n <td><input type=\"checkbox\" name=\"Completed\" value=\"{$complete}\"\n onchange=\"form.submit()\"/></td>\n </form>\n </tr>"; } } ?>
} /* </functions> */ $action = Functions::get('action'); Functions::checkRights(__FILE__, $action, Functions::get('token')); switch ($action) { case 'fields_info': $data = infoFields(); break; case 'new': $data = addEntry(); break; case 'update': $data = updateEntry(Functions::get('id')); break; case 'info': $data = infoEntry(Functions::get('id')); break; case 'delete': $data = deleteEntry(Functions::get('id')); break; case 'customer_history': $data = getCustomerHistory(Functions::get('id')); break; case 'list': $data = listEntries(); break; default: Functions::setResponse(400); } /* </controller> */ loadview('json', $data);
$query = $feedUri . '?' . implode_assoc('=', '&', $params); $feed = $docsService->getDocumentListFeed($query); $data['docs']['html'] = listEntries($feed); $data['docs']['xml'] = $feed->saveXML(); // =========================================================================== // Query the Spreadsheets API ================================================ $feedUri = 'http://spreadsheets.google.com/feeds/spreadsheets/private/full'; $params = array('max-results' => 50); $req = OAuthRequest::from_consumer_and_token($consumer, $access_token, 'GET', $feedUri, $params); $req->sign_request($sig_method, $consumer, $access_token); // Note: the Authorization header changes with each request $httpClient->setHeaders($req->to_header()); $spreadsheetsService = new Zend_Gdata_Spreadsheets($httpClient); $query = $feedUri . '?' . implode_assoc('=', '&', $params); $feed = $spreadsheetsService->getSpreadsheetFeed($query); $data['spreadsheets']['html'] = listEntries($feed); $data['spreadsheets']['xml'] = $feed->saveXML(); // =========================================================================== // Query Google's Portable Contacts API ====================================== $feedUri = 'http://www-opensocial.googleusercontent.com/api/people/@me/@all'; $req = OAuthRequest::from_consumer_and_token($consumer, $access_token, 'GET', $feedUri, NULL); $req->sign_request($sig_method, $consumer, $access_token); // Portable Contacts isn't GData, but we can use send_signed_request() from // common.inc.php to make an authenticated request. $data['poco'] = send_signed_request($req->get_normalized_http_method(), $feedUri, $req->to_header(), NULL, false); // =========================================================================== } switch (@$_REQUEST['openid_mode']) { case 'checkid_setup': case 'checkid_immediate': $identifier = $_REQUEST['openid_identifier'];