Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi! I cleaned up your code for you! #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions actions/item_create.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[219912] => Array
(
[start] => 01/07/2011 20:00
[end] =>
[end] =>
)

[219913] => desc
Expand All @@ -36,8 +36,8 @@

[219912_start_date] => 01/07/2011
[219912_start_time] => 20:00
[219912_end_date] =>
[219912_end_time] =>
[219912_end_date] =>
[219912_end_time] =>
)
*/
// create that item
Expand All @@ -52,7 +52,7 @@
case 'media']:
case 'money']:
case 'video']:*/

case 'title':
case 'text':
case 'state':
Expand Down Expand Up @@ -93,7 +93,7 @@
if ($field['start'] != '') {
$newField["field_id"] = $field_id;
$dateTime = explode(" ", $field['start']);

$date = explode("/", $dateTime[0]);
$newField['values'][0]["start"] = $date[2] . "-" . $date[0] . "-" . $date[1];
if (isset($dateTime[1]) && $dateTime[1] != '') { // time given as well?
Expand All @@ -114,7 +114,7 @@
}
break;
}

if (isset($newField["field_id"])) {
$newItem['fields'][] = $newField;
}
Expand Down
2 changes: 1 addition & 1 deletion actions/item_search_app.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
} else {
$return['error'] = true;
}

echo isset($_GET['callback'])
? "{$_GET['callback']}($result)"
: $return;
Expand Down
2 changes: 1 addition & 1 deletion controllers/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class index extends Mustache {
public $APP_NAME = APP_NAME;
public $APP_ROOT_URL = APP_ROOT_URL;
public $GOOGLE_ANALYTICS_ID = false;

public function __construct ($aApp) {
if (isset($aApp['google_analytics_id'])) {
$this->GOOGLE_ANALYTICS_ID = $aApp['google_analytics_id'];
Expand Down
46 changes: 23 additions & 23 deletions controllers/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ class item extends Mustache {
public $APP_NAME = APP_NAME;
public $APP_ROOT_URL = APP_ROOT_URL;
public $PODIO_ICON_PATH = PODIO_ICON_PATH;

private $api = null;

public $appId = -1;
public $spaceId = -1;
public $spaceName = '';
public $spaceUrl = '';

private $app;

private $fields = array();

private $fieldStateFunctions = array();

public function __construct($api, $appId = -1) {
$this->api = $api;
$this->appId = $appId;

$oauth = PodioOAuth::instance();
// render fields
$app = $api->app->get($this->appId);
$this->app = $app['config'];
$this->spaceId = $app['space_id'];

// create temporary array with given values
$space = $api->space->get($app['space_id']);
if ($space['name'] != '') {
Expand All @@ -52,14 +52,14 @@ public function __construct($api, $appId = -1) {
$newField['progress'] = false;
$newField['location'] = false;
$newField['video'] = false;

$newField['value'] = "";
$newField["field_id"] = $field['field_id'];
$newField['name'] = $field['config']['name'];
$newField['required'] = $field['config']['required'];
$newField['label'] = $field['config']['label'];
$newField['type'] = $field['type'];

switch ($field['type']) {
case 'title':
$newField['title'] = true;
Expand All @@ -81,15 +81,15 @@ public function __construct($api, $appId = -1) {
$newField['state'] = true;
$stateValues = array();
// we'll create an anonymous function there to be able to show the state-values since we need to get the options into the template somehow and afaik mustache does not support multiple iterations within each other

// store new function to return array of values
$this->fieldStateFunctions[$field['field_id']] = create_function('$arg', 'return new ArrayIterator($arg);');

// create temporary array with given values
foreach ($field['config']['settings']['allowed_values'] as $key => $value) {
$stateValues[] = array("item" => $value);
}

// create variable (usable via {{#state_values_field_id}} {{item}} {{/state_values_field_id}}) in mustache
$newField['state_values_field_id'] = $this->fieldStateFunctions[$field['field_id']]($stateValues);
unset($stateValues);
Expand All @@ -111,10 +111,10 @@ public function __construct($api, $appId = -1) {
// get space members
$memberValues = array();
// we'll create an anonymous function there to be able to show the state-values since we need to get the options into the template somehow and afaik mustache does not support multiple iterations within each other

// store new function to return array of values
$this->fieldStateFunctions[$field['field_id']] = create_function('$arg', 'return new ArrayIterator($arg);');

// create temporary array with given values
$members = $api->space->getMembers($app['space_id']);
if (count($members) > 0) {
Expand All @@ -129,11 +129,11 @@ public function __construct($api, $appId = -1) {
$newField['values'][$member['user']['user_id']]['avatar'] = $member['user']['avatar'];*/
}
}

// create variable (usable via {{#state_values_field_id}} {{item}} {{/state_values_field_id}}) in mustache
$newField['member_values_field_id'] = $this->fieldStateFunctions[$field['field_id']]($memberValues);
unset($memberValues);

break;
case 'money':
$newField['money'] = true;
Expand All @@ -150,7 +150,7 @@ public function __construct($api, $appId = -1) {
break;
}
//print_r($newField);

$this->fields[] = $newField;
}
}
Expand All @@ -159,21 +159,21 @@ public function field () {
$f = new ArrayIterator($this->fields);
return $f;
}

public function notEmpty() {
return !($this->isEmpty());
}

public function isEmpty() {
return count($this->fields) === 0;
}

public function appName() {
return $this->app['item_name'];
}

public function appIcon() {
return $this->app['icon'];
}

}
4 changes: 2 additions & 2 deletions controllers/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ class login extends Mustache {
public $APP_NAME = APP_NAME;
public $APP_ROOT_URL = APP_ROOT_URL;
public $GOOGLE_ANALYTICS_ID = false;

public $message = null;

public function __construct ($aApp, $message = null) {
if (isset($aApp['google_analytics_id'])) {
$this->GOOGLE_ANALYTICS_ID = $aApp['google_analytics_id'];
Expand Down
22 changes: 11 additions & 11 deletions controllers/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ class status extends Mustache {
public $APP_NAME = APP_NAME;
public $APP_ROOT_URL = APP_ROOT_URL;
public $PODIO_ICON_PATH = PODIO_ICON_PATH;

public $GOOGLE_ANALYTICS_ID = false;

private $feedback = array();

public function __construct($aApp) {

if (isset($aApp['google_analytics_id'])) {
$this->GOOGLE_ANALYTICS_ID = $aApp['google_analytics_id'];
}

$oauthForStatus = PodioOAuth::instance();
$baseStatusAPI = PodioBaseAPI::instance($aApp['podio']['server'], $aApp['podio']['client_id'], $aApp['podio']['client_secret'], $aApp['podio']['upload_end_point']);
$baseStatusAPI->setLogHandler('file', PODIO_ERROR_LOG, '');
$oauthForStatus->getAccessToken('password', array('username' => $aApp['podio']['status']['username'], 'password' => $aApp['podio']['status']['password']));
$statusApi = new PodioAPI();
$feedbackAppId = 38098;
$feedbackAppSortFieldId = 959376;

$items = $statusApi->item->getItems($feedbackAppId, 10000, 0, $feedbackAppSortFieldId, 1, array());

foreach ($items['items'] as $index => $item) {
$status = null;
$description = null;

foreach ($item['fields'] as $field) {
if ($field['external_id'] == "status") {
$status = $field['values'][0]['value'];
Expand All @@ -41,12 +41,12 @@ public function __construct($aApp) {
$this->feedback[$index]['title'] = $item['title'];
$this->feedback[$index]['description'] = $description;
}

}

public function feedback () {
$f = new ArrayIterator($this->feedback);
return $f;
}

}
10 changes: 5 additions & 5 deletions css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ input[type="button"]:focus,
input[type="submit"]:focus,
button:focus,
textarea:focus {
border:1px solid #aaa;
border:1px solid #aaa;
color: #000;
}

Expand All @@ -233,7 +233,7 @@ input[type="button"]:hover,
input[type="submit"]:hover,
button:hover,
textarea:hover {
border:1px solid #aaa;
border:1px solid #aaa;
}

input[type="button"],input[type="submit"], button {
Expand Down Expand Up @@ -331,14 +331,14 @@ div.wrapper {
#unFavApp img,
#favApp img {
filter:alpha(opacity=50);
-moz-opacity: 0.5;
-moz-opacity: 0.5;
opacity: 0.5;
}

#unFavApp:hover img,
#favApp:hover img {
filter:alpha(opacity=100);
-moz-opacity: 1;
-moz-opacity: 1;
opacity: 1;
}

Expand Down Expand Up @@ -479,4 +479,4 @@ body.install p span {

@media only screen and (max-width: 480px), only screen and (max-device-width: 480px) {
}

12 changes: 6 additions & 6 deletions css/reset.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Author: Richard Clark - http://richclarkdesign.com
Twitter: @rich_clark
*/

Expand All @@ -15,7 +15,7 @@ b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin:0;
Expand All @@ -32,7 +32,7 @@ body {
}

article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section {
footer,header,hgroup,menu,nav,section {
display:block;
}

Expand Down Expand Up @@ -68,7 +68,7 @@ ins {
/* change colours to suit your needs */
mark {
background-color:#ff9;
color:#000;
color:#000;
font-style:italic;
font-weight:bold;
}
Expand All @@ -91,7 +91,7 @@ table {
hr {
display:block;
height:1px;
border:0;
border:0;
border-top:1px solid #cccccc;
margin:1em 0;
padding:0;
Expand Down
4 changes: 2 additions & 2 deletions css/tokeninput.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* @override http://shodio.l/css/tokeninput.css */

ul.token-input-list {
/*overflow: hidden;
height: auto !important;
/*overflow: hidden;
height: auto !important;
height: 1%;
width: 400px;
border: 1px solid #8496ba;
Expand Down
2 changes: 1 addition & 1 deletion external/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function esc($string) {

/**
* getView returns mustache template as string
*
*
* @param string $classname which template to load
* @return template as string
* @author Fabian
Expand Down
Loading