Ncsvginterface.php
3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* @package anc_image
* @category magento
* @mailto code [at] netz.coop
* @author netz.coop eG*
* @copyright (c) 2014, netz.coop eG
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
class Anc_Image_Helper_Ncsvginterface extends Mage_Core_Helper_Abstract {
/**
* Bearbeiten eines BildElementes in einer SVG (erstellt mit Inkscape Erweiterung)
* @param type $domel
* @param type $p_parentitemId
* @param type $MagentoID
* @return type
*/
public function editImageSVG(DOMNode $domel, $p_parentitemId, $MagentoID) {
/**
* anc_image ....
*/
if (true) {
$ChildrenItemIds = Mage::helper('anc_printconfigproduct/cart')->getChildrenItemIds($p_parentitemId, $MagentoID);
$CropfilePath = Mage::helper('anc_image/ncimage')->getCropfilePath($ChildrenItemIds[0], 'absolute');
if($CropfilePath) {
$domel->setAttribute('xlink:href', 'file://' . $CropfilePath);
} else {
$ItemProductOptionByOptionSku = Mage::helper('anc_lib/quoteitem')->getItemProductOptionByOptionSku($ChildrenItemIds[0], Mage::helper('anc_image/ncconstant')->ancSPAncImage);
if ($ItemProductOptionByOptionSku) {
$NcImageRelativePath = Mage::helper('anc_image/ncimage')->getNcImagePath($ItemProductOptionByOptionSku, 'absolute', 'original');
if ($NcImageRelativePath) {
$domel->setAttribute('xlink:href', 'file://' . $NcImageRelativePath);
}
} else {
// D::ulli("editImageSVG($domel, $p_parentitemId, $MagentoID)".$ChildrenItemIds[0].": es wurde kein Bild zum ersetzen angegeben, also gibts das svg bild");
}
}
}
/**
* version wenns eine magento datei ist und nicht das neue anc_image gennutzt wird
*/ else {
$ary_backdata = Mage::helper('anc_printconfigproduct/cart')->doGetChildItemOptionInfoBuyRequest($p_parentitemId, $MagentoID);
$file = $this->getImagefromOptions($ary_backdata[0]['options']);
if ($file) {
$domel->setAttribute('xlink:href', 'file://' . $file);
}
}
return $domel;
}
/**
* Gibt ein Bildpfad aus dem Optionen Array der Media Gallery zurück
* bei mehr Bildern eine Ausgabe in der mc_log
* @param array $p_options
* @param type $parmam_what
* @return array
*/
private function getImagefromOptions(array $p_options, $parmam_what = "fullpath") {
$filename = null;
foreach ($p_options as $key => $valarray) {
if (!$filename) {
$filename = $p_options[$key]['fullpath'];
} else {
$filename2 = $p_options[$key]['fullpath'];
}
}
return $filename;
}
public function replaceSignature($customerid=null,$param_char='A'){
$fontname = Mage::helper('anc_image/ncimage')->getFontName($customerid,$param_char);
if($fontname){
$string = '<flowSpan id="flowSpanUnterschrift" style="font-size:1em;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:\''.$fontname.' Font\';-inkscape-font-specification:\''.$fontname.' Font\'">A</flowSpan>';
}else{
$string= 'Unterschrift ist nicht im System';
}
// D::ulli('$string'.$string,1,1);
return $string;
//
// $fontname =
//
// return $replacestring;
}
}