17 require_once SQ_INCLUDE_PATH.
'/asset.inc';
45 parent::__construct($assetid);
93 protected static function saveReport($type_code, $report_data)
98 $am = $GLOBALS[
'SQ_SYSTEM']->am;
99 if ($am->installed($type_code)) {
100 $fd = fopen(SQ_CACHE_PATH.
'/'.$type_code.
'.dat',
'w');
102 fwrite($fd, serialize($report_data));
123 $report_data = Array();
126 $am = $GLOBALS[
'SQ_SYSTEM']->am;
127 if ($am->installed($type_code)) {
128 $filename = SQ_CACHE_PATH.
'/'.$type_code.
'.dat';
129 if (file_exists($filename)) {
130 $fd = fopen($filename,
'r');
132 $report_data = fread($fd, filesize($filename));
133 $report_data = unserialize($report_data);
134 if (!is_array($report_data)) $report_data = Array();
156 $generate_link =
'<a href="#'.$type_code.
'" onclick="regen(\''.$type_code.
'\');
">'.translate('generate_report').'</a>';
158 $table_format = '<table class="sq-backend-table
">
160 <th class="sq-backend-table-header
" width="35%%
">'.translate('last_generated').'</th>
161 <td class="sq-backend-table-cell
" id="'.$type_code.'_regen
" align="right
">%s ( %s )</td>
165 $table = sprintf($table_format, translate('report_not_generated'), $generate_link);
168 }//end paintReportNotGenerated()
181 protected static function paintLastGeneratedDate($type_code, $date)
183 $regenerate_link = '<a href="#
'.$type_code.'" onclick="regen(\
''.$type_code.
'\');
">'.translate('regenerate_report').'</a>';
185 $table_format = '<table class="sq-backend-table
">
187 <th class="sq-backend-table-header
" width="35%%
">'.translate('last_generated').'</th>
188 <td class="sq-backend-table-cell
" id="'.$type_code.'_regen
" align="right
">%s ( %s )</td>
192 $table = sprintf($table_format, $date, $regenerate_link);
195 }//end paintLastGeneratedDate()
209 protected static function paintRecommendedTasks(Backend_Outputter &$o, $type_code, $report_type_codes)
211 $table_format = '<table class="sq-backend-table
">
213 <th class="sq-backend-table-header
" width="35%%
">'.translate('recommended_maintenance_tasks').'</th>
214 <td class="sq-backend-table-cell
" align="right
">%s</td>
218 // Get report name and description and sort reports by name
219 $report_list = Array();
220 foreach ($report_type_codes as $report_type_code) {
221 $report_info = $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($report_type_code);
222 $report_name = $report_info['name'];
223 $report_list[$report_name] = Array(
224 'type_code' => $report_type_code,
225 'description' => $report_info['description'],
234 // Link to the relevant tools
235 foreach ($report_list as $report_name => $report) {
236 $row_string .= '<img src="'.sq_web_path('lib
').'/web/images/icons/asset_map/myspace.png
"> <a href="./?SQ_BACKEND_PAGE=main&backend_section=tools&tool_type_code=
'.$report['type_code
'].'&redirect_to_sys_maintenance=1
">'.$report_name.'</a>';
239 $table = sprintf($table_format, $row_string);
242 }//end paintRecommendedTasks()