From 1372d8339d78c01b1514708f26520e244cc991e2 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sat, 16 Apr 2011 20:34:18 +0200 Subject: [PATCH] add a date format function for more eyecandy --- admin/apps.php | 35 ++++++++++++++++++++++++++--------- admin/templates/apps.php | 4 ++-- lib/base.php | 12 ++++++++++++ lib/ocsclient.php | 2 +- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/admin/apps.php b/admin/apps.php index b03357a0fb0..b433fe0875b 100644 --- a/admin/apps.php +++ b/admin/apps.php @@ -28,25 +28,42 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' exit(); } - // Load the files we need //OC_UTIL::addStyle( "", "files" ); //OC_UTIL::addScript( "", "files" ); +if(isset($_GET['id'])) $id=$_GET['id']; else $id=0; +if(isset($_GET['cat'])) $cat=$_GET['cat']; else $cat=0; + $categories=OC_OCSCLIENT::getCategories(); -//print_r($categories); -$apps=OC_OCSCLIENT::getApplications($categories); -//print_r($apps); +if($id==0) { + + if($cat==0){ + $apps=OC_OCSCLIENT::getApplications($categories); + }else{ + $apps=OC_OCSCLIENT::getApplications($cat); + } + + // return template + $tmpl = new OC_TEMPLATE( "admin", "apps", "admin" ); -// return template -$tmpl = new OC_TEMPLATE( "admin", "apps", "admin" ); + $tmpl->assign( "categories", $categories ); + $tmpl->assign( "apps", $apps ); + $tmpl->printPage(); + unset($tmpl); -$tmpl->assign( "categories", $categories ); -$tmpl->assign( "apps", $apps ); -$tmpl->printPage(); +}else{ + $app=OC_OCSCLIENT::getApplication($id); + + $tmpl = new OC_TEMPLATE( "admin", "app", "admin" ); + $tmpl->assign( "app", $app ); + $tmpl->printPage(); + unset($tmpl); + +} ?> diff --git a/admin/templates/apps.php b/admin/templates/apps.php index c3f4fdfcc19..2f584775815 100644 --- a/admin/templates/apps.php +++ b/admin/templates/apps.php @@ -18,9 +18,9 @@ - "") { echo(''); } ?> + "") { echo(''); } ?> - + + diff --git a/lib/base.php b/lib/base.php index 93d6fb66c7e..8504518dbfb 100644 --- a/lib/base.php +++ b/lib/base.php @@ -222,6 +222,18 @@ class OC_UTIL { self::$styles[] = "$application/css/$file"; } + /** + * formats a timestamp in the "right" way + * + * @param timestamp $timestamp + */ + public static function formatDate( $timestamp ){ + $timeformat='F j, Y, H:i'; + return date($timeformat,$timestamp); + } + + + /** * check if the current server configuration is suitable for ownCloud * @return array arrays with error messages and hints diff --git a/lib/ocsclient.php b/lib/ocsclient.php index e58a210077e..d9ce11d537e 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -74,7 +74,7 @@ class OC_OCSCLIENT{ $app['personid']=$tmp[$i]->personid; $app['detailpage']=$tmp[$i]->detailpage; $app['preview']=$tmp[$i]->smallpreviewpic1; - $app['changed']=$tmp[$i]->changed; + $app['changed']=strtotime($tmp[$i]->changed); $app['description']=$tmp[$i]->description; $apps[]=$app; -- 2.39.5