From 0bc03907b6206dc55bc8d3b18a5f6ae99936c82f Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sun, 20 Apr 2014 16:40:00 -0500 Subject: [PATCH] Adding icon Updating fileutil to show html in correct block updating user view to include correct stats --- indefero/src/IDF/FileUtil.php | 3 +- indefero/src/IDF/Views.php | 36 +++++++++++++++++++++++ indefero/src/IDF/Views/User.php | 4 ++- indefero/www/media/idf/img/feed-icon.png | Bin 0 -> 689 bytes 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 indefero/www/media/idf/img/feed-icon.png diff --git a/indefero/src/IDF/FileUtil.php b/indefero/src/IDF/FileUtil.php index db9563c..3b2c388 100644 --- a/indefero/src/IDF/FileUtil.php +++ b/indefero/src/IDF/FileUtil.php @@ -40,7 +40,8 @@ class IDF_FileUtil public static $map = array("cxx" => "cpp", "h" => "cpp", "hpp" => "cpp", "rc"=>"text", "sh"=>"bash", "cs"=>"csharp"); - public static $syntaxhighlightext = array("as3", "cf", "cpp", "c", "css", "pas", "diff", "patch", "erl", "java", "jfx", "js", "pl", "php", "py", "rb", "sass", "scss", "scala", "sql", "vb", ); + public static $syntaxhighlightext = array("html", "as3", "cf", "cpp", "c", "css", "pas", "diff", "patch", "erl", "java", "jfx", "js", "pl", "php", "py", "rb", "sass", "scss", "scala", "sql", "vb", ); + /** * Test if an extension is supported by the syntax highlighter. diff --git a/indefero/src/IDF/Views.php b/indefero/src/IDF/Views.php index 7f351a7..9bea911 100644 --- a/indefero/src/IDF/Views.php +++ b/indefero/src/IDF/Views.php @@ -565,4 +565,40 @@ class IDF_Views $forgestats['proj_count'] = count($projects); return $forgestats; } + + /** + * Returns statistics by a userID + * + * @param ArrayObject IDF_Project + * @return Associative array of statistics + */ + public static function getProjectsStatisticsByUser($uid) + { + $forgestats = array(); + + // count overall project stats + $forgestats['total'] = 0; + $what = array( + 'downloads' => 'IDF_Upload', + 'reviews' => 'IDF_Review', + 'issues' => 'IDF_Issue', + 'docpages' => 'IDF_Wiki_Page', + + ); + foreach ($what as $key => $model) { + $count = Pluf::factory($model)->getCount(array( + 'filter' => sprintf('submitter = %d', $uid) + )); + $forgestats[$key] = $count; + $forgestats['total'] += $count; + } + // 'commits' => 'IDF_Commit', + $count = Pluf::factory('IDF_Commit')->getCount(array( + 'filter' => sprintf('author = %d', $uid) + )); + $forgestats['commits'] = $count; + $forgestats['total'] += $count; + + return $forgestats; + } } diff --git a/indefero/src/IDF/Views/User.php b/indefero/src/IDF/Views/User.php index 04803f3..b9da9f5 100644 --- a/indefero/src/IDF/Views/User.php +++ b/indefero/src/IDF/Views/User.php @@ -304,7 +304,9 @@ class IDF_Views_User } } } - $projectstats = IDF_Views::getProjectsStatistics($pubprojects); + //$projectstats = IDF_Views::getProjectsStatistics($pubprojects); + $projectstats = IDF_Views::getProjectsStatisticsByUser($user->id); + $projectstats["proj_count"] = count($pubprojects); //print_r($projectstats); //echo $privprojects; diff --git a/indefero/www/media/idf/img/feed-icon.png b/indefero/www/media/idf/img/feed-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b3c949d2244f2c0c81d65e74719af2a1b56d06a3 GIT binary patch literal 689 zcmV;i0#5yjP)(tky!*UETcH-TCU7SrqEjJM#?B`_A)!p7(kFf9-P@=@15kkTkGK zgFusyy#KECqZzRdBLb=P?$(kUP;>kYTDeG&{|a+iOiRbI6nbQ)j#7bOf>iF=C+|_py<&Fo1F5cC*iEM?zZGC{ejNg4LWYp=S$L6Qaby6y zp$+F`250{%tU{Lg$5*ROH}y!1UKJS4*xqd7P(Y3JQF?lrnf?yerr%&6yGXLG1ur*B z{$&R1@Oj)yl@%rY5rh?j(j10Yz_DBs`AKFU_QnB;)(aqQmGi&ieOS|21^NP9UMpa< zU&p!f6RZ6Owp^X!EXA=0SbN&h?CrQK%Q3(=YBqqHD^9ZUM0Hxt-6-KT;>lf@j?Z+v zHm(}`>85I&E<7e}oz?6UwjAogowzGO8kSN7+2`b^$Az9L{K5*ko87EV45LT-`_##3 z>d3AGh@>=mbg34|6}+-gT9N+6Dr@44VEl44O&{&|w=qpbzC#iWMKa?5)>tI+KLQK@ Xq0QFqn(9Yl00000NkvXXu0mjfZ8t