17 require_once SQ_SYSTEM_ROOT.
'/core/assets/system/simple_report/simple_report.inc';
43 parent::__construct($assetid);
67 $generated = $report[
'generated'];
68 $report = $report[
'report_data'];
70 $am = $GLOBALS[
'SQ_SYSTEM']->am;
74 <td class="sq-backend-table-cell" style="width: 10px">
77 <td class="sq-backend-table-cell">
80 <td class="sq-backend-table-cell" align="right">
87 foreach ($report[
'user_assets'] as $asset_type_code => $user_asset_stats) {
88 $rows_string .= sprintf($row_format, $am->getAssetIconURL($asset_type_code), $user_asset_stats[
'asset_type_name'], $user_asset_stats[
'total']);
91 $table_format =
' <b>%s</b><br><br>
92 <table class="sq-backend-table">
94 <th class="sq-backend-table-header" colspan="2">Asset Type</th>
95 <th class="sq-backend-table-header" width="70" align="right">Total</th>
101 $user_assets_table = sprintf($table_format,
'User Asset Types', $rows_string);
105 foreach ($report[
'system_assets'] as $asset_type_code => $system_asset_stats) {
106 $rows_string .= sprintf($row_format, $am->getAssetIconURL($asset_type_code), $system_asset_stats[
'asset_type_name'], $system_asset_stats[
'total']);
109 $system_assets_table = sprintf($table_format,
'System Asset Types', $rows_string);
113 echo $user_assets_table;
114 echo
'<br>'.$system_assets_table;
134 'generated' => $today,
135 'report_data' => Array(
136 'user_assets' => Report_Most_Used_Asset_Types::_getTopAssetTypes(
'user'),
137 'system_assets' => Report_Most_Used_Asset_Types::_getTopAssetTypes(
'system'),
157 private static function _getTopAssetTypes($asset_access_type=
'all')
159 $access_type_query =
'';
161 $am = $GLOBALS[
'SQ_SYSTEM']->am;
164 $sql =
'SELECT type_code, count(*) AS total '.
166 'GROUP BY type_code '.
167 'ORDER BY total DESC';
172 if (($asset_access_type ==
'system') || ($asset_access_type ==
'user')) {
173 if ($asset_access_type ==
'system') {
174 $access_type_query =
't.allowed_access = '.MatrixDAL::quote(
'system').
' ';
175 }
else if ($asset_access_type ==
'user') {
176 $access_type_query =
't.allowed_access != '.MatrixDAL::quote(
'system').
' ';
179 $sql =
'SELECT a.type_code, count(*) AS total '.
180 'FROM sq_ast a, sq_ast_typ t '.
181 'WHERE a.type_code = t.type_code AND t.instantiable = '.MatrixDAL::quote(
'1').
' AND '.$access_type_query.
182 'GROUP BY a.type_code '.
183 'ORDER BY total DESC';
188 $asset_types = Array();
190 foreach ($rows as $row) {
191 $asset_type_name = $am->getTypeInfo($row[
'type_code'],
'name');
193 $asset_types[$row[
'type_code']] = Array(
194 'asset_type_name' => $asset_type_name,
195 'total' => $row[
'total'],