<?php require_once 'include/kiwi_exception.inc.php'; require_once 'include/project.inc.php'; require_once 'include/dbc.inc.php'; require_once 'include/kiwi_product_copy.class.php'; $test = new Kiwi_Product_Copy(2); echo $test->getCopyPID();
public function handleInput($get, $post) { // todo: přidat práva $self = basename($_SERVER['PHP_SELF']); if (!empty($get)) { if (array_key_exists('ei', $get)) { if (($ei = (int) $get['ei']) < 1) { throw new Exception("Neplatná hodnota parametru \"ei\": {$ei}"); } $this->eshop_item = $ei; } if (array_key_exists('sei', $get)) { if ($this->eshop_item) { throw new Exception("Souběžné použití parametrů \"ei\" a \"sei\""); } if (($sei = (int) $get['sei']) < 1) { throw new Exception("Neplatná hodnota parametru \"sei\": {$sei}"); } $this->s_eshop_item = $sei; } if (isset($get['gp'])) { if (($this->grouped_product = (int) $get['gp']) < 1) { throw new Exception("Neplatné ID sdruženého produktu: {$this->grouped_product}"); } } if (array_key_exists('sqs', $get)) { $this->sqs = $get['sqs']; } if (isset($get['p'])) { if (($p = (int) $get['p']) < 1) { throw new Exception("Neplatná hodnota parametru \"p\": {$p}"); } $this->id = $p; $anchor = new CurrentKiwiAnchor(); $anchor->set_key_value(KIWI_PRODUCTS, $this->id); } if (isset($get['rp'])) { $qs = $this->consQS(); $this->removeProductPhoto(); $this->redirection = $self . $qs . '#stred'; return; } if (isset($get['rpe'])) { if (($rpe = (int) $get['rpe']) < 1) { throw new Exception("Neplatná hodnota parametru \"rpe\": {$rpe}"); } $qs = $this->consQS(); $this->removeExtraPhoto($rpe); $this->redirection = $self . $qs . '#stred'; return; } if (isset($get['rpi'])) { if (($rpi = (int) $get['rpi']) < 1) { throw new Exception("Neplatná hodnota parametru \"rpi\": {$rpi}"); } $qs = $this->consQS(); $this->removeIllustrativePhoto($rpi); $this->redirection = $self . $qs . '#stred'; return; } if (isset($get['rpv'])) { $qs = $this->consQS(); if (($rpv = (int) $get['rpv']) < 1) { throw new Exception("Neplatná hodnota parametru \"rpv\": {$rpv}"); } $propid = $this->removePropertyValue($rpv); $this->redirection = $self . $qs . '#prp' . $propid; return; } if (isset($get['apv'])) { $qs = $this->consQS(); if (($apv = (int) $get['apv']) < 1) { throw new Exception("Neplatná hodnota parametru \"apv\": {$apv}"); } $propid = $this->addPropertyValue($apv); $this->redirection = $self . $qs . '#prp' . $propid; return; } if (isset($get['anpv'])) { $qs = $this->consQS(); $anpv = explode(':', $get['anpv'], 2); try { if (sizeof($anpv) != 2) { throw new Exception(); } $propid = $anpv[0]; if ($propid < 1) { throw new Exception(); } $pval = $anpv[1]; } catch (Exception $e) { throw new Exception("Neplatná hodnota parametru \"anpv\": {$anpv}"); } $this->addNewPropertyValue($propid, $pval); $this->redirection = $self . $qs . '#prp' . $propid; return; } if (array_key_exists('eg', $get)) { if ($this->id == 0) { throw new Exception('Pokus o editaci sdružených produktů s dosud nevytvořeným produktem'); } $group = $this->acquireGroupedProductsGroup(); $this->redirection = KIWI_EDIT_ESHOPITEM . "?ei={$group}&gp={$this->id}"; return; } } if (!empty($post)) { $xpost = strip_gpc_slashes($post); switch ($post['cmd']) { case 'speichern': $this->title = $xpost['Nazev_vyrobku']; if ($this->title == '') { throw new Exception('Název výrobku nebyl vyplněn'); } $this->code = $xpost['Kod_vyrobku']; $this->shortdesc = $xpost['ZkracenyPopis']; $this->longdesc = $this->parseFckEditorInput($xpost['kprofc_ldsc']); //$this->longdesc = $xpost['Popis']; $this->auto = array_key_exists('Auto', $xpost); if (array_key_exists('URL_vyrobku', $xpost)) { $this->url = $xpost['URL_vyrobku']; } if (array_key_exists('htitle_vyrobku', $xpost)) { $this->htitle = $xpost['htitle_vyrobku']; } $this->collection = $xpost['Kolekce']; $this->original_cost = (double) $xpost['Puvodni_cena']; $this->new_cost = (double) $xpost['Nova_cena']; $this->ws_cost = (double) $xpost['VO_cena']; $this->novelty = array_key_exists('Novinka', $xpost) && $xpost['Novinka'] == 'on' ? 1 : 0; $this->action = array_key_exists('Akce', $xpost) && $xpost['Akce'] == 'on' ? 1 : 0; $this->discount = array_key_exists('Sleva', $xpost) && $xpost['Sleva'] == 'on' ? 1 : 0; $this->sellout = array_key_exists('Vyprodej', $xpost) && $xpost['Vyprodej'] == 'on' ? 1 : 0; $this->exposed = array_key_exists('Exponovany', $xpost) && $xpost['Exponovany'] == 'on' ? 1 : 0; $this->active = array_key_exists('Aktivni', $xpost) && $xpost['Aktivni'] == 'on' ? 1 : 0; $this->handleUploads(); $this->saveData(); $qs = $this->consQS(); $this->redirection = $self . $qs . '#stred'; break; case 'kopieren': if ($this->id === 0) { throw new Exception('Pokus kopírovat dosud nevytvořený produkt!'); } $copy = new Kiwi_Product_Copy($this->id); $this->redirection = $self . "?p=" . $copy->getCopyPID(); break; default: throw new Exception('Neočekávaný příkaz formuláře: ' . __CLASS__); } } }