575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
|
int iterations = 0; /* # of active time periods. */
int n = 0; /* Number of entries in azYear */
char **azYear = 0; /* Year dropdown menu */
int rowCount = 0;
int total = 0;
stats_report_init_view();
db_prepare(&q,
"SELECT DISTINCT substr(date(mtime),1,4) AS y"
" FROM v_reports"
" WHERE ifnull(coalesce(euser,user,'')=%Q,1)"
" GROUP BY y ORDER BY y DESC", zUserName);
while( SQLITE_ROW == db_step(&q) ){
azYear = fossil_realloc(azYear, sizeof(char*)*(n+2));
azYear[n] = fossil_strdup(db_column_text(&q,0));
azYear[n+1] = azYear[n];
if( !isValidYear && fossil_strcmp(zYear,azYear[n])==0 ) isValidYear = 1;
n += 2;
}
db_finalize(&q);
if( !isValidYear ){
if( n ){
zYear = azYear[0];
}else{
zYear = db_text("1970","SELECT substr(date('now'),1,4);");
}
}
style_submenu_multichoice("y", n/2, (const char**)azYear, 0);
cgi_printf("<br/>");
db_prepare(&q,
"SELECT DISTINCT strftime('%%W',mtime) AS wk, "
" count(*) AS n "
" FROM v_reports "
" WHERE %Q=substr(date(mtime),1,4) "
" AND mtime < current_timestamp "
|
|
>
|
|
|
|
<
<
<
<
<
<
<
<
<
|
<
<
|
|
<
<
|
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
|
int iterations = 0; /* # of active time periods. */
int n = 0; /* Number of entries in azYear */
char **azYear = 0; /* Year dropdown menu */
int rowCount = 0;
int total = 0;
stats_report_init_view();
style_submenu_sql("y", "Year:",
"WITH RECURSIVE a(b) AS ("
" SELECT substr(date('now'),1,4) UNION ALL"
" SELECT b-1 FROM a"
" WHERE b>0+(SELECT substr(date(min(mtime)),1,4) FROM event)"
") SELECT b, b FROM a ORDER BY b DESC");
if( zYear==0 || strlen(zYear)!=4 ){
zYear = db_text("1970","SELECT substr(date('now'),1,4);");
}
cgi_printf("<br/>");
db_prepare(&q,
"SELECT DISTINCT strftime('%%W',mtime) AS wk, "
" count(*) AS n "
" FROM v_reports "
" WHERE %Q=substr(date(mtime),1,4) "
" AND mtime < current_timestamp "
|
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
|
azView[nView++] = aViewType[i].zName;
}
style_submenu_multichoice("view", nView/2, azView, 0);
if( eType!=RPT_BYFILE ){
style_submenu_multichoice("type", ArraySize(azType)/2, azType, 0);
}
if( eType!=RPT_BYUSER ){
style_submenu_entry("u", "User:", 12, 0);
}
}
style_submenu_element("Stats", "Stats", "%R/stat");
url_reset(&url);
style_header("Activity Reports");
switch( eType ){
case RPT_BYYEAR:
|
|
>
>
>
>
>
>
|
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
|
azView[nView++] = aViewType[i].zName;
}
style_submenu_multichoice("view", nView/2, azView, 0);
if( eType!=RPT_BYFILE ){
style_submenu_multichoice("type", ArraySize(azType)/2, azType, 0);
}
if( eType!=RPT_BYUSER ){
style_submenu_sql("u","User:",
"SELECT '', 'All Users' UNION ALL "
"SELECT x, x FROM ("
" SELECT DISTINCT trim(coalesce(euser,user)) AS x FROM event %s"
" ORDER BY 1 COLLATE nocase) WHERE x!=''",
eType==RPT_BYFILE ? "WHERE type='ci'" : ""
);
}
}
style_submenu_element("Stats", "Stats", "%R/stat");
url_reset(&url);
style_header("Activity Reports");
switch( eType ){
case RPT_BYYEAR:
|