1: <?php
2: namespace Izberg\Resource;
3: use Izberg\Resource;
4:
5: class ProductChannel extends Resource
6: {
7: public function output($params = array(), $save_in_path = null)
8: {
9: $outputs = self::$Izberg->get_list("productChannelFileOutput", $params, "Accept: application/json", $this->getName()."/".$this->id."/file_outputs/");
10:
11: ini_set('memory_limit', '2048M');
12: set_time_limit(0);
13:
14: if (count($outputs) == 0) {
15:
16: return $this->getViewer($params, $save_in_path);
17: } else {
18:
19: $output = $outputs[0];
20: return self::$Izberg->getHelper()->readFromUrl($output->output_file, $save_in_path);
21: }
22: }
23:
24: public function getViewer($params = array(), $save_in_path = null) {
25: if (!isset($params["format"])) $params["format"] = "xml";
26: unset($params["output_format"]);
27: return self::$Izberg->Call("product_channel/" . $this->id . "/viewer/", 'GET', $params, 'Accept: application/xml', 'Content-Type: application/xml; charset=UTF-8', $save_in_path);
28: }
29:
30: }
31: