Exemplo n.º 1
0
 /**
  *
  */
 public function preparePage()
 {
     $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
     $this->P->cb_pagetype = 'content';
     $this->P->cb_subnav = 'admin';
     $this->P->cb_customcontenttemplate = 'shop/itemadmin';
     if (isset($this->get["action"]) && $this->get["action"] == 'insert_lang') {
         $aItemdata = $this->admin_getItem();
         if (isset($aItemdata["base"]) && !isset($aItemdata["text"])) {
             $aData = ['itml_pid' => $aItemdata["base"]['itm_id'], 'itml_lang' => HelperConfig::$lang];
             $sql = DBTools::buildInsertQuery($aData, 'item_lang');
             $this->db->exec($sql);
             header('Location: /_admin/itemadmin.html?itemno=' . $this->get["itemno"] . '&action=showitem');
             die;
         }
     }
     $this->P->cb_customdata["searchform"] = $this->admin_prepareItemlistsearchform();
     if (isset($this->get["action"])) {
         if ($this->get["action"] == 'search') {
             $this->P->cb_customdata["searchresult"] = true;
             if ($aItemlist = $this->admin_getItemlist()) {
                 if (count($aItemlist["data"]) == 1) {
                     $aItemdata = $this->admin_getItem($aItemlist["data"][0]['itm_no']);
                     $this->P->cb_customdata["item"] = $this->admin_prepareItem($aItemdata);
                 } else {
                     $this->P->cb_customdata["itemlist"] = $this->admin_prepareItemlist($aItemlist);
                 }
             }
         } elseif (isset($this->post["doaction"]) && $this->post["doaction"] == 'edititem') {
             $this->admin_updateItem(\HaaseIT\HCSF\Helper::getPurifier('item'));
             $this->P->cb_customdata["itemupdated"] = true;
             $aItemdata = $this->admin_getItem();
             $this->P->cb_customdata["item"] = $this->admin_prepareItem($aItemdata);
         } elseif ($this->get["action"] == 'showitem') {
             $aItemdata = $this->admin_getItem();
             $this->P->cb_customdata["item"] = $this->admin_prepareItem($aItemdata);
         } elseif ($this->get["action"] == 'additem') {
             $aErr = [];
             if (isset($this->post["additem"]) && $this->post["additem"] == 'do') {
                 if (strlen($this->post["itemno"]) < 4) {
                     $aErr["itemnotooshort"] = true;
                 } else {
                     $sql = 'SELECT itm_no FROM item_base WHERE itm_no = \'';
                     $sql .= \trim(\filter_input(INPUT_POST, 'itemno', FILTER_SANITIZE_SPECIAL_CHARS)) . "'";
                     $hResult = $this->db->query($sql);
                     $iRows = $hResult->rowCount();
                     if ($iRows > 0) {
                         $aErr["itemnoalreadytaken"] = true;
                     } else {
                         $aData = ['itm_no' => trim(\filter_input(INPUT_POST, 'itemno', FILTER_SANITIZE_SPECIAL_CHARS))];
                         $sql = DBTools::buildInsertQuery($aData, 'item_base');
                         $this->db->exec($sql);
                         $iInsertID = $this->db->lastInsertId();
                         $sql = 'SELECT itm_no FROM item_base WHERE itm_id = ' . $iInsertID;
                         $hResult = $this->db->query($sql);
                         $aRow = $hResult->fetch();
                         header('Location: /_admin/itemadmin.html?itemno=' . $aRow['itm_no'] . '&action=showitem');
                         die;
                     }
                 }
             }
             $this->P->cb_customdata["showaddform"] = true;
             $this->P->cb_customdata["err"] = $aErr;
         }
     }
 }
Exemplo n.º 2
0
 public function insert($iParentID)
 {
     $aData = ['cl_cb' => $iParentID, 'cl_lang' => HelperConfig::$lang];
     $sql = DBTools::buildInsertQuery($aData, 'content_lang');
     $this->serviceManager->get('db')->exec($sql);
 }
Exemplo n.º 3
0
 /**
  * @param $sKey
  * @return mixed
  */
 public function addTextKey($sKey)
 {
     $aData = ['tc_key' => trim(filter_var($sKey, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW))];
     $sql = \HaaseIT\DBTools::buildInsertQuery($aData, 'textcat_base');
     $this->DB->exec($sql);
     $iId = $this->DB->lastInsertId();
     return $iId;
 }