OXID eShop CE  4.10.3
 All Classes Namespaces Files Functions Variables Pages
order_remark.php
Go to the documentation of this file.
1 <?php
2 
9 {
10 
18  public function render()
19  {
21 
22  $soxId = $this->getEditObjectId();
23  $sRemoxId = oxRegistry::getConfig()->getRequestParameter("rem_oxid");
24  if ($soxId != "-1" && isset($soxId)) {
25  $oOrder = oxNew("oxorder");
26  $oOrder->load($soxId);
27 
28  // all remark
29  $oRems = oxNew("oxlist");
30  $oRems->init("oxremark");
31  $sUserIdField = 'oxorder__oxuserid';
32  $sQuotedUserId = oxDb::getDb()->quote($oOrder->$sUserIdField->value);
33  $sSelect = "select * from oxremark where oxparentid=" . $sQuotedUserId . " order by oxcreate desc";
34  $oRems->selectString($sSelect);
35  foreach ($oRems as $key => $val) {
36  if ($val->oxremark__oxid->value == $sRemoxId) {
37  $val->selected = 1;
38  $oRems[$key] = $val;
39  break;
40  }
41  }
42 
43  $this->_aViewData["allremark"] = $oRems;
44 
45  if (isset($sRemoxId)) {
46  $oRemark = oxNew("oxRemark");
47  $oRemark->load($sRemoxId);
48  $this->_aViewData["remarktext"] = $oRemark->oxremark__oxtext->value;
49  $this->_aViewData["remarkheader"] = $oRemark->oxremark__oxheader->value;
50  }
51  }
52 
53  return "order_remark.tpl";
54  }
55 
59  public function save()
60  {
61  parent::save();
62 
63  $oOrder = oxNew("oxorder");
64  if ($oOrder->load($this->getEditObjectId())) {
65  $oRemark = oxNew("oxremark");
66  $oRemark->load(oxRegistry::getConfig()->getRequestParameter("rem_oxid"));
67 
68  $oRemark->oxremark__oxtext = new oxField(oxRegistry::getConfig()->getRequestParameter("remarktext"));
69  $oRemark->oxremark__oxheader = new oxField(oxRegistry::getConfig()->getRequestParameter("remarkheader"));
70  $oRemark->oxremark__oxtype = new oxField("r");
71  $oRemark->oxremark__oxparentid = new oxField($oOrder->oxorder__oxuserid->value);
72  $oRemark->save();
73  }
74  }
75 
79  public function delete()
80  {
81  $oRemark = oxNew("oxRemark");
82  $oRemark->delete(oxRegistry::getConfig()->getRequestParameter("rem_oxid"));
83  }
84 }