18 require_once SQ_CORE_PACKAGE_PATH.
'/files/image/image.inc';
38 var $allowed_extensions = Array(
'png');
55 $this->_ser_attrs = TRUE;
56 $this->
Image($assetid);
74 function create(&$link, $info=Array())
80 $name = trim(strtolower(str_replace(
' ',
'_', $this->
attr(
'title'))));
82 'name' => $name.
'.png',
83 'type' =>
'image/png',
84 'path' => SQ_DATA_PATH.
'/temp/'.$name.
'.png',
85 'filename' => $name.
'.png',
87 $this->_tmp[
'file_create_data'] = &$info;
90 trigger_localised_error(
'CORE0083', E_USER_WARNING, $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($this->type(),
'name'));
93 if (!$this->
validFile($info))
return FALSE;
96 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
97 $valid_names = make_valid_web_paths(Array($info[
'name']));
98 $name = array_shift($valid_names);
101 $bad_paths = $GLOBALS[
'SQ_SYSTEM']->am->webPathsInUse($link[
'asset'], Array($name));
102 if (!empty($bad_paths)) {
103 trigger_localised_error(
'CORE0086', E_USER_WARNING, $name);
109 return unlink($info[
'path']);
111 unlink($info[
'path']);
132 if (!$this->
id)
return TRUE;
135 $info = $this->_tmp[
'file_create_data'];
137 if (!$this->
validFile($info))
return FALSE;
139 require_once SQ_INCLUDE_PATH.
'/general_occasional.inc';
140 $name = current(make_valid_web_paths(Array(strtolower($info[
'name']))));
143 if ($this->name != $name) {
144 $parents = $GLOBALS[
'SQ_SYSTEM']->am->getLinks($this->
id, SQ_SC_LINK_SIGNIFICANT,
'', NULL,
'minor');
145 for ($i = 0; $i < count($parents); $i++) {
146 $parent = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($parents[$i][
'majorid'], $parents[$i][
'major_type_code']);
147 if (is_null($parent))
continue;
148 $bad_paths = $GLOBALS[
'SQ_SYSTEM']->am->webPathsInUse($parent, Array($name), $this->
id);
149 if (!empty($bad_paths)) {
150 trigger_localised_error(
'CORE0055', E_USER_WARNING);
157 create_directory($this->data_path);
160 if (!copy($info[
'path'], $this->data_path.
'/'.$name)) {
161 trigger_localised_error(
'CORE0036', E_USER_WARNING, $info[
'name'], $this->data_path.
'/'.$name);
166 $this->_tmp[
'graph_file_name'] = Array(
'filename' => $this->data_path.
'/'.$name);
171 $this->_tmp[
'uploading_file'] = FALSE;
174 trigger_localised_error(
'CORE0052', E_USER_WARNING);
177 $asset->_tmp[
'uploading_file'] = FALSE;
180 trigger_localised_error(
'CORE0054', E_USER_WARNING);
184 $em = $GLOBALS[
'SQ_SYSTEM']->getEventManager();
185 $em->broadcastEvent($this,
'ContentsUpdated');
201 $GLOBALS[
'SQ_SYSTEM']->am->acquireLock($this->
id,
'all');
203 trigger_localised_error(
'CORE0052', E_USER_WARNING);
206 $GLOBALS[
'SQ_SYSTEM']->am->releaseLock($this->
id,
'all');
242 $title = ($alt !=
'') ? $alt : $this->
attr(
'title');
244 if ($alt ==
'') $alt = $this->
attr(
'alt');
246 $tag =
'<img src="'.$this->getURL().
'" width="'.$this->
attr(
'width').
'" height="'.$this->
attr(
'height').
'" alt="'.$alt.
'" title="'.$title.
'" />';
247 if ($return)
return $tag;
263 $link = $GLOBALS[
'SQ_SYSTEM']->am->getLinkById($linkid);
264 switch (strtolower($link[
'value'])) {
265 case 'data_source_for_graph' :
266 return (translate(
'data_source_asset_linked_to_graph').
' '.$this->
id);
269 return parent::describeLink($linkid);
289 if (!isset($_REQUEST[
'preview_graph'])) {
290 return parent::paintBackend($o);
293 switch ($_REQUEST[
'asset_ei_screen']) {
295 case 'global_settings' :
297 $datasets = $this->
attr(
'datasets');
311 if (isset($_REQUEST[
'final_preview'])) {
316 $graph_info = unserialize(urldecode($_REQUEST[
'graph_info']));
322 return parent::paintBackend($o);
343 require_once
'Image/Graph.php';
345 $width = $this->
attr(
'width');
346 $height = $this->
attr(
'height');
347 $graph = Image_Graph::factory(
'graph', Array((
int) $width, (
int) $height));
348 $title = $this->
attr(
'show_graph_title') ? $this->
attr(
'title') :
'';
349 if ($this->
attr(
'show_legend')) {
354 if ($this->
attr(
'graph_angle')) {
356 Image_Graph::vertical(
357 Image_Graph::factory(
'title', Array($title, 12)),
358 Image_Graph::vertical(
359 $plotarea = Image_Graph::factory(
'plotarea'),
360 $legend = Image_Graph::factory(
'legend'),
366 }
else if (!$this->
attr(
'graph_angle')) {
368 'Image_Graph_Axis_Category',
373 Image_Graph::vertical(
374 Image_Graph::factory(
'title', Array($title, 12)),
375 Image_Graph::vertical(
376 $plotarea = Image_Graph::factory(
'plotarea', $param),
377 $legend = Image_Graph::factory(
'legend'),
384 $plotarea->setAxisPadding(
386 'left' => (
int) $this->
attr(
'axis_left_padding'),
387 'right' => (
int) $this->
attr(
'axis_right_padding'),
388 'top' => (
int) $this->
attr(
'axis_top_padding'),
389 'bottom' => (
int) $this->
attr(
'axis_bottom_padding'),
392 $legend->setPlotarea($plotarea);
395 $graph->setBackgroundColor($this->
attr(
'background'));
398 $graph->setBorderColor($this->
attr(
'border_colour'));
400 $x_axis_title_angle = ($this->
attr(
'x_font_label_angle') ? 90 : 0);
401 $y_axis_title_angle = ($this->
attr(
'y_font_label_angle') ? 90 : 0);
403 $x_axis =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
404 $x_axis->setTitle($this->
attr(
'x_set_title'), Array(
'size' => 13,
'angle' => $x_axis_title_angle));
405 $x_axis->setLabelInterval($this->
attr(
'x_label_interval'));
407 $y_axis =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
408 $y_axis->setTitle($this->
attr(
'y_set_title'), Array(
'size' => 13,
'angle' => $y_axis_title_angle));
409 $y_axis->setLabelInterval($this->
attr(
'y_label_interval'));
412 $x_axis->setLineColor($this->
attr(
'x_axis_colour'));
415 $x_axis_font =& $graph->addNew(
'Image_Graph_Font');
416 $x_axis_font->setSize(12);
417 $x_axis_font->setColor($this->
attr(
'x_font_axis_colour'));
418 $x_axis->setFont($x_axis_font);
419 $x_axis->setFontAngle($this->
attr(
'x_font_label_angle') ?
'vertical' :
'horizontal');
422 $y_axis->setLineColor($this->
attr(
'y_axis_colour'));
425 $y_axis_font =& $graph->addNew(
'Image_Graph_Font');
426 $y_axis_font->setSize(12);
427 $y_axis_font->setColor($this->
attr(
'y_font_axis_colour'));
428 $y_axis->setFont($y_axis_font);
429 $y_axis->setFontAngle($this->
attr(
'y_font_label_angle') ?
'vertical' :
'horizontal');
432 $this->plotarea =& $plotarea;
456 $old_err_level = error_reporting(0);
459 $datasets = $this->
attr(
'datasets');
461 $plot_order = $this->
attr(
'plot_order');
462 foreach ($plot_order as $key => $plot_name) {
463 $dataset = $datasets[$plot_name];
465 $x_axis_name = $dataset[
'settings'][
'x_axis'];
466 $y_axis_name = $dataset[
'settings'][
'y_axis'];
467 $is_accumulative = intval($dataset[
'settings'][
'accumulative']);
470 $data_source_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($dataset[
'assetid']);
471 $result = $data_source_asset->getResultSet(
'default');
474 $image_dataset = Image_Graph::factory(
'dataset');
475 foreach ($result as $record) {
476 if ($is_accumulative) {
477 $tmp += intval($record[$y_axis_name]);
478 $image_dataset->addPoint($record[$x_axis_name], $tmp);
480 $image_dataset->addPoint($record[$x_axis_name], intval($record[$y_axis_name]));
487 switch ($dataset[
'settings'][
'graph_type']) {
488 case 'Image_Graph_Plot_Bar' :
489 case 'Image_Graph_Plot_Area' :
491 if ($dataset[
'settings'][
'use_stacked']) {
492 $multiple_dataset = Array();
493 $multiple_dataset[] = $image_dataset;
495 foreach ($dataset[
'settings'][
'stacked_data'] as $stack) {
496 $image_dataset = Image_Graph::factory(
'dataset');
497 $image_dataset->setName($stack[
'title']);
500 $data_source_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($stack[
'datasource']);
501 $result = $data_source_asset->getResultSet(
'default');
502 foreach ($result as $record) {
503 $image_dataset->addPoint($record[$stack[
'x_axis']], intval($record[$stack[
'y_axis']]));
505 $multiple_dataset[] =$image_dataset;
508 $plot =& $this->plotarea->addNew($dataset[
'settings'][
'graph_type'], Array($multiple_dataset,
'stacked'));
510 $plot =& $this->plotarea->addNew($dataset[
'settings'][
'graph_type'], $image_dataset);
513 case 'Image_Graph_Plot_Smoothed_Area' :
514 case 'Image_Graph_Plot_Line' :
515 case 'Image_Graph_Plot_Smoothed_Line' :
516 case 'Image_Graph_Plot_Pie' :
517 case 'Image_Graph_Plot_Step' :
518 case 'Image_Graph_Plot_Impulse' :
519 case 'Image_Graph_Plot_Dot' :
520 case 'Image_Graph_Plot_Radar' :
521 case 'Image_Graph_Plot_CandleStick' :
522 case 'Image_Graph_Plot_Band' :
524 $plot =& $this->plotarea->addNew($dataset[
'settings'][
'graph_type'], $image_dataset);
529 if ($dataset[
'settings'][
'plot_name'] != $dataset[
'settings'][
'display_name']) {
530 $plot->setTitle($dataset[
'settings'][
'display_name']);
532 $plot->setTitle($dataset[
'settings'][
'plot_name']);
535 $fill = Image_Graph::factory(
'Image_Graph_Fill_Array');
536 if ($dataset[
'settings'][
'gradient_type'] !=
'none') {
538 $grad_type = $this->
getGradType($dataset[
'settings'][
'gradient_type']);
539 $fill->addNew(
'gradient', Array($grad_type,
'#'.$dataset[
'settings'][
'gradient_1'],
'#'.$dataset[
'settings'][
'gradient_2']));
542 $fill->addColor(
'#'.$dataset[
'settings'][
'fill_colour']);
545 switch ($dataset[
'settings'][
'graph_type']) {
546 case 'Image_Graph_Plot_Bar' :
547 $plot->setSpacing(intval($dataset[
'settings'][
'bar_spacing']));
548 case 'Image_Graph_Plot_Area' :
550 if ($dataset[
'settings'][
'use_stacked']) {
551 foreach ($dataset[
'settings'][
'stacked_data'] as $stack) {
552 if ($stack[
'gradient_type'] !=
'none') {
553 $fill->addNew(
'gradient', Array($this->
getGradType($stack[
'gradient_type']),
'#'.$stack[
'colour_1'],
'#'.$stack[
'colour_2']));
555 $fill->addColor(
'#'.$stack[
'colour_1']);
559 $plot->setFillStyle($fill);
560 $plot->setLineColor(
'#'.$dataset[
'settings'][
'line_colour']);
562 case 'Image_Graph_Plot_Line' :
563 case 'Image_Graph_Plot_Smoothed_Area' :
564 case 'Image_Graph_Plot_Smoothed_Line' :
565 case 'Image_Graph_Plot_Pie' :
566 case 'Image_Graph_Plot_Step' :
567 case 'Image_Graph_Plot_Impulse' :
568 case 'Image_Graph_Plot_Dot' :
569 case 'Image_Graph_Plot_Radar' :
570 case 'Image_Graph_Plot_CandleStick' :
571 case 'Image_Graph_Plot_Band' :
573 $plot->setFillStyle($fill);
574 $plot->setLineColor(
'#'.$dataset[
'settings'][
'line_colour']);
580 if (isset($dataset[
'settings'][
'marker_type']) && $dataset[
'settings'][
'marker_type'] !=
'none') {
587 if (empty($this->_tmp[
'graph_file_name'])) {
589 $filename = $this->data_path.
'/'.$this->name;
590 $graph->done(Array(
'filename' => $filename));
592 $graph->done(Array(
'filename' => $this->_tmp[
'graph_file_name']));
595 if ($this->
attr(
'variety_count') > 0) {
597 $GLOBALS[
'SQ_SYSTEM']->setRunLevel($GLOBALS[
'SQ_SYSTEM']->getRunLevel() & SQ_RUN_LEVEL_FORCED);
598 $am = $GLOBALS[
'SQ_SYSTEM']->am;
599 $links = $am->getLinks($this->
id, SQ_LINK_TYPE_2,
'image_variety');
600 foreach ($links as $link) {
601 $variety = $am->getAsset($link[
'minorid'],
'image_variety');
602 if (!$this->
saveVariety($variety, TRUE, TRUE, FALSE, FALSE)) {
603 trigger_error(
'Failed to update the image varieties', E_USER_WARNING);
606 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
613 error_reporting($old_err_level);
626 $datasets = $this->
attr(
'datasets');
628 foreach ($datasets as $name => $dataset) {
629 if ($dataset[
'settings'][
'x_axis'] ==
'Not saved' || $dataset[
'settings'][
'y_axis'] ==
'Not saved') {
630 $graph_ready = FALSE;
653 $old_err_level = error_reporting(0);
655 require_once
'Image/Graph.php';
656 $global_settings = $this->
attr(
'global_settings');
659 $sample_dataset = Image_Graph::factory(
'random', Array(10, 2, 15, TRUE));
662 $plot =& $this->plotarea->addNew($graph_info[
'settings'][
'graph_type'], Array(&$sample_dataset));
663 if ($graph_info[
'settings'][
'gradient_type'] !=
'none') {
665 $grad_type = $this->
getGradType($graph_info[
'settings'][
'gradient_type']);
666 $fill = Image_Graph::factory(
'Image_Graph_Fill_Array');
667 $fill->addNew(
'gradient', Array($grad_type,
'#'.$graph_info[
'settings'][
'gradient_1'],
'#'.$graph_info[
'settings'][
'gradient_2']));
670 $fill = Image_Graph::factory(
'Image_Graph_Fill_Array');
671 $fill->addColor(
'#'.$graph_info[
'settings'][
'fill_colour']);
673 $plot->setFillStyle($fill);
674 $plot->setLineColor(
'#'.$graph_info[
'settings'][
'line_colour']);
679 switch ($graph_info[
'settings'][
'graph_type']) {
680 case 'Image_Graph_Plot_Bar' :
681 $plot->setSpacing(intval($graph_info[
'settings'][
'bar_spacing']));
683 case 'Image_Graph_Plot_Line' :
684 case 'Image_Graph_Plot_Area' :
685 case 'Image_Graph_Plot_Smoothed_Line' :
686 case 'Image_Graph_Plot_Smoothed_Area' :
687 case 'Image_Graph_Plot_Pie' :
688 case 'Image_Graph_Plot_Step' :
689 case 'Image_Graph_Plot_Impulse' :
690 case 'Image_Graph_Plot_Dot' :
691 case 'Image_Graph_Plot_Radar' :
692 case 'Image_Graph_Plot_CandleStick' :
693 case 'Image_Graph_Plot_Band' :
700 if (isset($graph_info[
'settings'][
'value_marker']) && $graph_info[
'settings'][
'value_marker'] !=
'none') {
707 error_reporting($old_err_level);
728 $old_err_level = error_reporting(0);
731 $sample_dataset = Image_Graph::factory(
'random', Array(10, 2, 15, TRUE));
733 $plot = $this->plotarea->addNew(
'Image_Graph_Plot_Bar', Array(&$sample_dataset));
736 if (empty($this->_tmp[
'graph_file_name'])) {
738 $filename = SQ_DATA_PATH.
'/temp/'.strtolower(str_replace(
' ',
'_', $this->
attr(
'title'))).
'.png';
739 $graph->done(Array(
'filename' => $filename));
741 $graph->done($this->_tmp[
'graph_file_name']);
748 error_reporting($old_err_level);
765 $marker_array = NULL;
766 if ($marker_info[
'settings'][
'marker_type'] !=
'none') {
767 $marker_type = $marker_info[
'settings'][
'marker_type'];
768 $marker_value_type = $marker_info[
'settings'][
'value_marker_type'];
770 if ($marker_value_type ==
'IMAGE_GRAPH_VALUE_X') {
771 $new_marker =& $plot->addNew($marker_type, IMAGE_GRAPH_VALUE_X);
772 }
else if ($marker_value_type ==
'IMAGE_GRAPH_VALUE_Y') {
773 $new_marker =& $plot->addNew($marker_type, IMAGE_GRAPH_VALUE_Y);
776 $new_marker->setFontColor(
'#'.$marker_info[
'settings'][
'marker_font_colour']);
777 $new_marker->setLineColor(
'#'.$marker_info[
'settings'][
'marker_line_colour']);
778 $new_marker->setFillColor(
'#'.$marker_info[
'settings'][
'marker_fill_colour']);
780 $pointing_marker = NULL;
781 if ($marker_info[
'settings'][
'pointer_type'] !=
'none') {
782 $pointer_type = $marker_info[
'settings'][
'pointer_type'];
783 $pointer_length = $marker_info[
'settings'][
'pointer_length'];
784 $pointing_marker =& $plot->addNew($pointer_type, Array((
int) $pointer_length, &$new_marker));
787 if (is_null($pointing_marker)) {
789 $plot->setMarker($new_marker);
792 $plot->setMarker($pointing_marker);
814 if (SQ_IN_LIMBO)
return parent::printFrontend();
817 $GLOBALS[
'SQ_SYSTEM']->paintLogin(translate(
'login'), translate(
'cannot_access_asset', $this->name));
823 $cm = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cache_manager');
824 $result = $cm->loadFromCache($this->
id, $this->
type(),
'default');
829 if (!empty($existing)) {
830 require_once SQ_FUDGE_PATH.
'/standards_lists/mime_types.inc';
831 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
833 $ext = get_file_type($existing[
'filename']);
834 $type = (empty($standards_lists_mime_types[$ext])) ?
'text/plain' : $standards_lists_mime_types[$ext];
835 header(
'Cache-Control:');
836 header(
'Pragma: cache');
837 header(
'Expires: '.gmdate(
'D, d M Y H:i:s', (time() + 86400)).
' GMT');
838 header(
'Content-Type: '.$type);
839 header(
'Content-Disposition: inline; filename='.$existing[
'filename'].
';');
840 header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s',$existing[
'modified']).
' GMT');
841 header(
'Content-Length: '.$existing[
'size']);
842 readfile($existing[
'path']);
862 $cm = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'cache_manager');
868 $content = file_get_contents($this->data_path.
'/'.$this->name);
869 if ($content === FALSE) {
870 trigger_localised_error(
'DATA0003', E_USER_WARNING, $this->name);
874 $result = $cm->saveToCache($this->
id, $this->
type(),
'default',
'Dummy String');
917 switch ($grad_type) {
918 case 'IMAGE_GRAPH_GRAD_VERTICAL':
919 $grad_type = IMAGE_GRAPH_GRAD_VERTICAL;
921 case 'IMAGE_GRAPH_GRAD_HORIZONTAL':
922 $grad_type = IMAGE_GRAPH_GRAD_HORIZONTAL;
924 case 'IMAGE_GRAPH_GRAD_VERTICAL_MIRRORED':
925 $grad_type = IMAGE_GRAPH_GRAD_VERTICAL_MIRRORED;
927 case 'IMAGE_GRAPH_GRAD_HORIZONTAL_MIRRORED':
928 $grad_type = IMAGE_GRAPH_GRAD_HORIZONTAL_MIRRORED;
930 case 'IMAGE_GRAPH_GRAD_DIAGONALLY_TL_BR':
931 $grad_type = IMAGE_GRAPH_GRAD_DIAGONALLY_TL_BR;
933 case 'IMAGE_GRAPH_GRAD_DIAGONALLY_BL_TR':
934 $grad_type = IMAGE_GRAPH_GRAD_DIAGONALLY_BL_TR;
936 case 'IMAGE_GRAPH_GRAD_RADIAL':
937 $grad_type = IMAGE_GRAPH_GRAD_RADIAL;
963 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
966 if (!create_directory($this->data_path)) {
967 trigger_localised_error(
'CORE0049', E_USER_WARNING, $this->name);
972 if (!create_directory($this->data_path.
'/.sq_system')) {
973 trigger_localised_error(
'CORE0050', E_USER_WARNING, $this->name);
978 if (!clear_directory($this->data_path.
'/.sq_system')) {
979 trigger_localised_error(
'CORE0046', E_USER_WARNING, $this->name);
984 if (!string_to_file(serialize($this), $this->data_path.
'/.sq_system/.object_data')) {
985 trigger_localised_error(
'CORE0051', E_USER_WARNING, $this->name);
990 if (!parent::updateLookups()) {
991 trigger_localised_error(
'CORE0053', E_USER_WARNING, $this->name);
1009 $se_name = $this->
attr(
'name');
1013 $this->_tmp[
'uploading_file'] = TRUE;
1015 $this->_tmp[
'uploading_file'] = FALSE;
1018 $this->_tmp[
'uploading_file'] = FALSE;
1036 $am = $GLOBALS[
'SQ_SYSTEM']->am;
1038 $file_types = array_merge($am->getTypeAncestors($this->type(), FALSE), $am->getTypeDescendants($this->type()));
1040 if (in_array($new_type_code, $file_types)) {
1043 $am->includeAsset($new_type_code);
1044 $tmp =
new $new_type_code();
1046 if (!empty($existing)) {
1047 if (!$tmp->validFile($existing)) {
1048 trigger_localised_error(
'CORE0008', E_USER_WARNING, $this->name, $new_type_code, $existing[
'filename'], $new_type_code);
1069 if ($this->status & SQ_SC_STATUS_SAFE_EDITING)
return TRUE;
1071 require_once SQ_FUDGE_PATH.
'/general/file_system.inc';
1074 if (empty($existing))
return TRUE;
1076 $unrestricted = $this->data_path_public.
'/'.$existing[
'filename'];
1084 if (!create_directory($this->data_path_public)) {
1085 trigger_localised_error(
'CORE0049', E_USER_WARNING, $this->name);
1089 if (!file_exists($unrestricted)) {
1091 if (!copy($this->data_path.
'/'.$this->name, $unrestricted)) {
1092 trigger_localised_error(
'DATA0004', E_USER_WARNING, $this->name);
1099 if (is_file($unrestricted)) {
1101 if (!unlink($unrestricted)) {
1102 trigger_localised_error(
'DATA0004', E_USER_WARNING, $this->name);
1129 if (!$this->
id)
return TRUE;
1132 if (trim($this->
attr(
'title')) ==
'') {
1136 if (isset($this->_tmp[
'vars_set'][
'name'])) {
1138 $uploading_file = !empty($this->_tmp[
'uploading_file']);
1140 if (!$uploading_file) {
1142 $old_filename = $this->_tmp[
'vars_set'][
'name'][
'old_value'];
1143 $new_filename = $this->
attr(
'name');
1146 if (!parent::saveAttributes($dont_run_updated)) {
1150 if (is_file($this->data_path.
'/'.$old_filename)) {
1151 if (!$this->
_renameFile($this->data_path, $old_filename, $new_filename)) {
1152 parent::setAttrValue(
'name', $old_filename);
1153 parent::saveAttributes($dont_run_updated);
1159 if (is_file($this->data_path_public.
'/'.$old_filename)) {
1160 copy($this->data_path_public.
'/'.$old_filename, $this->data_path_public.
'/'.$new_filename);
1161 unlink($this->data_path_public.
'/'.$old_filename);
1174 if (isset($this->_tmp[
'vars_set'][
'allow_unrestricted'])) {
1177 $hh = $GLOBALS[
'SQ_SYSTEM']->getHipoHerder();
1178 $vars = Array(
'assetids' => Array($this->
id));
1179 $hh->queueHipo(
'hipo_job_update_lookups', $vars);
1183 return parent::saveAttributes($dont_run_updated);
1200 $fv = $GLOBALS[
'SQ_SYSTEM']->getFileVersioning();
1204 if (!copy($data_path.
'/'.$old_filename, $data_path.
'/'.$new_filename)) {
1205 trigger_localised_error(
'CORE0026', E_USER_WARNING);
1209 if (!unlink($data_path.
'/'.$old_filename)) {
1210 trigger_localised_error(
'DATA0004', E_USER_WARNING, $this->name);
1228 $path = $this->data_path.
'/'.$this->
attr(
'name');
1230 if (is_file($path)) {
1231 $info[
'path'] = $path;
1232 $info[
'filename'] = basename($info[
'path']);
1233 $info[
'modified'] = filemtime($info[
'path']);
1234 $info[
'size'] = filesize($info[
'path']);
1237 if (!empty($info[
'path'])) {
1238 $size = getimagesize($info[
'path']);
1239 $info[
'width'] = $size[0];
1240 $info[
'height'] = $size[1];