404 bootstrap link fixed, user todo stats, saistart user todo stats

This commit is contained in:
Ulf Gebhardt 2015-06-06 14:51:34 +02:00
parent a5300cadee
commit bb54a0ae37
12 changed files with 100 additions and 8 deletions

View File

@ -13,6 +13,10 @@ class saimod_sys_mod extends \SYSTEM\SAI\SaiModule {
$v['you'] = \call_user_func(array($mod, 'right_right')) ? '<span class="glyphicon glyphicon-ok"></span>' : '<span class="glyphicon glyphicon-remove"></span>';
$vars['entries'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_mod/tpl/mod_tr.tpl'),$v);
}
$mod = \SYSTEM\SAI\sai::getStartModule();
$vars['start_class'] = $mod;
$vars['start_public'] = \call_user_func(array($mod, 'right_public')) ? '<span class="glyphicon glyphicon-ok"></span>' : '<span class="glyphicon glyphicon-remove"></span>';
$vars['start_access'] = \call_user_func(array($mod, 'right_right')) ? '<span class="glyphicon glyphicon-ok"></span>' : '<span class="glyphicon glyphicon-remove"></span>';
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_mod/tpl/mod_table.tpl'),$vars);
}

View File

@ -4,5 +4,10 @@
<th>Public</th>
<th>You can Access?</th>
</tr>
<tr>
<td>${start_class}</td>
<td>${start_public}</td>
<td>${start_access}</td>
</tr>
${entries}
</table>

View File

@ -5,4 +5,5 @@
\SYSTEM\SAI\sai::register_sys('\SYSTEM\SAI\saimod_sys_todo');
\SYSTEM\SAI\saimod_sys_todo::register('\SYSTEM\SAI\todo_stats_gen');
\SYSTEM\SAI\saimod_sys_todo::register('\SYSTEM\SAI\todo_stats_user');
\SYSTEM\SAI\saimod_sys_todo::register('\SYSTEM\SAI\todo_stats_user');
\SYSTEM\SAI\saimod_sys_todo::register('\SYSTEM\SAI\todo_stats_assign');

View File

@ -0,0 +1,13 @@
<?php
namespace SYSTEM\DBD;
class SYS_SAIMOD_TODO_STATS_COUNT_TODO_ASSIGNED extends \SYSTEM\DB\QQ {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'TODO',
//mys
'SELECT COUNT(*) as `count` FROM system_todo'.
' LEFT JOIN system_todo_assign ON system_todo.id = system_todo_assign.todo'.
' WHERE state = 0 AND `type` = 1 AND system_todo_assign.user IS NOT NULL;'
);}}

View File

@ -0,0 +1,19 @@
<?php
namespace SYSTEM\DBD;
class SYS_SAIMOD_TODO_STATS_USERS extends \SYSTEM\DB\QQ {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'TODO',
//mys
'SELECT username,
sum(case when state = 0 then 1 else 0 end) state_open,
sum(case when state = 1 then 1 else 0 end) state_closed,
COUNT(*) as count
FROM system_todo_assign
LEFT JOIN system_todo ON system_todo_assign.todo = system_todo.id
LEFT JOIN system_user ON system_todo_assign.user = system_user.id
GROUP BY system_todo_assign.user
ORDER BY count DESC;'
);}}

View File

@ -101,6 +101,12 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
foreach($vars['data'] as $stat){
$vars['entries'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_stats_entry.tpl'), $stat);
}
$vars['userstats'] = '';
$userstats = \SYSTEM\DBD\SYS_SAIMOD_TODO_STATS_USERS::QQ();
while($stat = $userstats->next()){
$stat['perc'] = round($stat['state_closed'] / ($stat['state_open']+$stat['state_closed']),2)*100;
$vars['userstats'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_stats_users_entry.tpl'), $stat);
}
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_stats.tpl'), $vars);
}

View File

@ -0,0 +1,9 @@
<?php
namespace SYSTEM\SAI;
class todo_stats_assign extends todo_stats {
public static function stats() {
$count = \SYSTEM\DBD\SYS_SAIMOD_TODO_STATS_COUNT_TODO_ASSIGNED::Q1()['count'];
$all = \SYSTEM\DBD\SYS_SAIMOD_TODO_STATS_COUNT_TODO_USER::Q1()['count'];
return new \SYSTEM\SAI\todo_stats_data('Assigned ToDos',$count,$all);}
}

View File

@ -1,15 +1,26 @@
<table class="table table-hover table-condensed sai_table" style="width: 100%">
<tr>
<th>Name</th>
<th>Count</th>
<th>All</th>
<th>Done</th>
<th>${table_name}</th>
<th>${table_count}</th>
<th>${table_all}</th>
<th>${table_done}</th>
</tr>
${entries}
<tr>
<td>Project</td>
<td>${table_project}</td>
<td>${project_count}</td>
<td>${project_all}</td>
<td>${project}%</td>
</tr>
</table>
<table class="table table-hover table-condensed sai_table" style="width: 100%">
<tr>
<th>${table_username}</th>
<th>${table_open}</th>
<th>${table_closed}</th>
<th>${table_percentage}</th>
<th>${table_all}</th>
</tr>
${userstats}
</table>

View File

@ -0,0 +1,7 @@
<tr>
<td>${username}</td>
<td>${state_open}</td>
<td>${state_closed}</td>
<td>${perc}%</td>
<td>${count}</td>
</tr>

View File

@ -31,6 +31,12 @@ class saistart_sys_sai extends \SYSTEM\SAI\SaiModule {
$vars['username'] = $user->username;
$vars['locale'] = $user->locale;
$vars['isadmin'] = \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) ? "yes" : "no";
$vars['userstats'] = '';
$userstats = \SYSTEM\DBD\SYS_SAIMOD_TODO_STATS_USERS::QQ();
while($stat = $userstats->next()){
$stat['perc'] = round($stat['state_closed'] / ($stat['state_open']+$stat['state_closed']),2)*100;
$vars['userstats'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_stats_users_entry.tpl'), $stat);
}
$vars = array_merge( $vars,
\SYSTEM\SAI\saimod_sys_todo::statistics(),
\SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_START),

View File

@ -9,7 +9,18 @@
<div class="inner-page">
<b>${basic_name}:</b> ${project_name}<br/>
<b>${basic_URL}:</b> <a href="${project_url}" target="_blank">${project_url}</a><br/>
<b>${basic_progress}:</b> ${project}%
<b>${basic_progress}:</b> ${project}%<br/>
<br/>
<table class="table table-hover table-condensed sai_table" style="width: 100%">
<tr>
<th>${table_username}</th>
<th>${table_open}</th>
<th>${table_closed}</th>
<th>${table_percentage}</th>
<th>${table_all}</th>
</tr>
${userstats}
</table>
</div>
</div>
</div>

View File

@ -40,7 +40,7 @@ class default_page extends \SYSTEM\PAGE\Page {
private static function js(){
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
//'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
'<script type="text/javascript" language="JavaScript" src="./sai.php?call=files&amp;cat=sys&amp;id=system.js"></script>'.
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/sai.js').'" type="text/javascript"></script>'.
'<script src="https://www.google.com/jsapi" type="text/javascript"></script>'.