]> source.dussan.org Git - nextcloud-server.git/commitdiff
add a date format function for more eyecandy
authorFrank Karlitschek <karlitschek@kde.org>
Sat, 16 Apr 2011 18:34:18 +0000 (20:34 +0200)
committerFrank Karlitschek <karlitschek@kde.org>
Sat, 16 Apr 2011 18:34:18 +0000 (20:34 +0200)
admin/apps.php
admin/templates/apps.php
lib/base.php
lib/ocsclient.php

index b03357a0fb0965711509da04c78bb366cf781cd4..b433fe0875bdbf8692228cdc9b830871669dfb6f 100644 (file)
@@ -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);
+
+}
 
 
 ?>
index c3f4fdfcc19869147278ede0714ca82cfafb7e7c..2f58477581503ddbd2101619e5d50cf23d98a204 100644 (file)
@@ -18,9 +18,9 @@
        <tbody>
                <?php foreach($_["apps"] as $app): ?>
                        <tr>
-                               <td class="filename"><?php if($app["preview"] <> "") { echo('<a href=""><img border="0" src="'.$app["preview"].'" /></a>'); } ?> </a></td>
+                               <td width="1"><?php if($app["preview"] <> "") { echo('<a href=""><img border="0" src="'.$app["preview"].'" /></a>'); } ?> </a></td>
                                <td class="filename"><a href="" title=""><?php echo $app["name"]; ?></a></td>
-                               <td class="date"><?php echo date($app["changed"]); ?></td>
+                               <td class="date"><?php echo OC_UTIL::formatdate($app["changed"]); ?></td>
                                <td class="fileaction"><a href="" title=""><img src="images/drop-arrow.png" alt="+" /></a></td>
                        </tr>
                <?php endforeach; ?>
index 93d6fb66c7e4a29d04323f058a98a0d7c0bd7f96..8504518dbfb80f53fd6600f8e25e5923381fb8b8 100644 (file)
@@ -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
index e58a210077ecd18fd2b4a59b7a37e3d0f2a4f6b1..d9ce11d537e7ea48476672dfd6a6bc265b275a8d 100644 (file)
@@ -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;