? or (d.year=? and d.month>?) or (d.year=? and d.month=? and d.day>=?) ) and ( d.year or (d.year=? and d.month) or (d.year=? and d.month=? and d.day<=?) )"; $params = array("s",$activity_type,"s",$from_y,"s",$from_y,"s",$from_m,"s",$from_y,"s",$from_m,"s",$from_d,"s",$to_y,"s",$to_y,"s",$to_m,"s",$to_y,"s",$to_m,"s",$to_d); if ($groups != "") { $groups_explode = explode(",", $groups); $condition .= " and d.usergroup in (" . ps_param_insert(count($groups_explode)) . ")"; $params = array_merge($params, ps_param_fill($groups_explode, "i")); } // Activity types in table daily_stat where object_ref refers to a resource ID $resource_activity_types = array( 'Add resource to collection', 'Create resource', 'Removed resource from collection', 'Resource download', 'Resource edit', 'Resource upload', 'Resource view'); // Add extra SQL condition if filtering by resource type if ($resource_type != "" && in_array($activity_type, $resource_activity_types)) { $condition .= " and d.object_ref in (select resource.ref from resource join resource_type where resource.resource_type=resource_type.ref and resource_type.ref=?)"; $params[] = "i"; $params[] = $resource_type; } $join = ""; # Using a subquery has proven to be faster for collection limitation (at least with MySQL 5.5 and MyISAM)... left the original join method here in case that proves to be faster with MySQL 5.6 and/or a switch to InnoDB. #if ($collection!="") {$join.=" join collection_resource cr on cr.collection='$collection' and d.object_ref=cr.resource ";} if ($collection != "") { $condition .= " and d.object_ref in (select cr.resource from collection_resource cr where cr.collection=?)"; $params[] = "i"; $params[] = $collection; } # External conditions # 0 = external shares are ignored # 1 = external shares are combined with the user group of the sharing user # 2 = external shares are reported as a separate user group if ($external == 0) { $condition .= " and external=0"; } $css_color_scheme = $_COOKIE['css_color_scheme'] ?? 'light'; $graph_dark_mode = false; if ( isset($user_pref_appearance) && ( $user_pref_appearance == "dark" || ($user_pref_appearance == "device" && $css_color_scheme == "dark") ) ) { $graph_dark_mode = true; } if (!$from_dash) { $title = get_translated_activity_type($activity_type); if (isset($lang["report-graph-by-" . $type])) { $title .= " " . $lang["report-graph-by-" . $type]; } ?>
" . escape($lang["report_total"]) . ""; } else { echo escape($lang["report_total"]); } ?> | " . escape($lang["report_average"]) . ""; } else { echo escape($lang["report_average"]); } ?> |