Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
payment_gateway_datacash_edit_fns.inc
1 <?php
18 require_once dirname(__FILE__).'/../../payment_gateway/payment_gateway_edit_fns.inc';
19 
30 {
31 
32 
43  function paintBodycopyInfo(&$asset, &$o, $prefix)
44  {
45  $bodycopy_asset =& $asset->getBodycopy('display_format');
46 
47  $o->openRaw();
48  echo '<div style="padding:1ex;">';
49  echo get_asset_tag_line($bodycopy_asset->id, 'contents');
50  echo '</div>';
51  $o->closeRaw();
52 
53  }//end paintBodycopyInfo()
54 
55 
66  function paintBodycopy(&$asset, &$o, $prefix)
67  {
68  $write_access = $asset->writeAccess('menu');
69 
70  $bodycopy =& $asset->getBodycopy('display_format');
71  $bodycopy_edit_fns =& $bodycopy->getEditFns();
72 
73  $o->openRaw();
74  $bodycopy_edit_fns->paintBodycopy($bodycopy, $o, $bodycopy->getPrefix());
75  $o->closeRaw();
76 
77  return $write_access;
78 
79  }//end paintBodycopy()
80 
81 
92  function processBodycopy(&$asset, &$o, $prefix)
93  {
94  if (!$asset->writeAccess('menu')) return FALSE;
95 
96  $bodycopy =& $asset->getBodycopy('display_format');
97  $bodycopy_edit_fns =& $bodycopy->getEditFns();
98 
99  $status = $bodycopy_edit_fns->processBodycopy($bodycopy, $o, $bodycopy->getPrefix());
100 
101  return $status;
102 
103  }//end processBodycopy()
104 
105 
116  function paintDatacashAPIPath(&$asset, &$o, $prefix)
117  {
118  $current_path = $asset->attr('datacash_api_path');
119 
120  if ($asset->writeAccess('attributes')) {
121  text_box($prefix.'_datacash_api_path', $current_path, 80);
122  } else {
123  if (trim($current_path) == '') {
124  echo '<b>[Empty]</b>';
125  } else {
126  echo '<b>'.$current_path.'</b>';
127  }
128  }
129 
130  if (!is_file($current_path)) {
131  ?><br /><span class="sq-backend-warning"><?php echo translate('path_to_not_valid', 'Datacash PHP API'); ?></span><?php
132  } else {
133  include_once $current_path;
134  if (!class_exists('DataCash_Document')) {
135  ?><br /><span class="sq-backend-warning"><?php echo translate('datacash_api_no_required_class'); ?></span><?php
136  } else if (!method_exists('DataCash_Document', 'readDocumentFromString')) {
137  ?><br /><span class="sq-backend-warning"><?php echo translate('datacash_api_no_required_method'); ?></span><?php
138  }
139  }//end if
140 
141  return TRUE;
142 
143  }//end paintDatacashAPIPath()
144 
145 
156  function processDatacashAPIPath(&$asset, &$o, $prefix)
157  {
158  if (!$asset->writeAccess('attributes')) return FALSE;
159  if (!isset($_POST[$prefix.'_datacash_api_path'])) return FALSE;
160 
161  return $asset->setAttrValue('datacash_api_path', trim($_POST[$prefix.'_datacash_api_path']));
162 
163  }//end processDatacashAPIPath()
164 
165 
176  function paintCardInfoDirPath(&$asset, &$o, $prefix)
177  {
178  $current_path = $asset->attr('cardinfo_dir_path');
179 
180  if ($asset->writeAccess('attributes')) {
181  text_box($prefix.'_cardinfo_dir_path', $current_path, 80);
182  } else {
183  if (trim($current_path) == '') {
184  echo '<b>[Empty]</b>';
185  } else {
186  echo '<b>'.$current_path.'</b>';
187  }
188  }
189 
190  if (!is_dir($current_path)) {
191  ?><br /><span class="sq-backend-warning"><?php echo translate('path_to_not_valid', 'Datacash CardInfo Directory'); ?></span><?php
192  } else if (!is_file($current_path.'/CardInfo1.bin') || !is_file($current_path.'/CardInfo2.bin')) {
193  ?><br /><span class="sq-backend-warning"><?php echo translate('datacash_cardinfo_dir_no_required_files'); ?></span><?php
194  }
195 
196  return TRUE;
197 
198  }//end paintCardInfoDirPath()
199 
200 
211  function processCardInfoDirPath(&$asset, &$o, $prefix)
212  {
213  if (!$asset->writeAccess('attributes')) return FALSE;
214  if (!isset($_POST[$prefix.'_cardinfo_dir_path'])) return FALSE;
215 
216  return $asset->setAttrValue('cardinfo_dir_path', trim($_POST[$prefix.'_cardinfo_dir_path']));
217 
218  }//end processCardInfoDirPath()
219 
220 
221 }//end class
222 
223 ?>