OXID eShop CE  4.9.10
 All Classes Files Functions Variables Pages
user_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  // load object
26  $oUser = oxNew("oxuser");
27  $oUser->load($soxId);
28  $this->_aViewData["edit"] = $oUser;
29 
30  // all remark
31  $oRems = oxNew("oxlist");
32  $oRems->init("oxremark");
33  $sQuotedUserId = oxDb::getDb()->quote($oUser->getId());
34  $sSelect = "select * from oxremark where oxparentid=" . $sQuotedUserId . " order by oxcreate desc";
35  $oRems->selectString($sSelect);
36  foreach ($oRems as $key => $val) {
37  if ($val->oxremark__oxid->value == $sRemoxId) {
38  $val->selected = 1;
39  $oRems[$key] = $val;
40  break;
41  }
42  }
43 
44  $this->_aViewData["allremark"] = $oRems;
45 
46  if (isset($sRemoxId)) {
47  $oRemark = oxNew("oxRemark");
48  $oRemark->load($sRemoxId);
49  $this->_aViewData["remarktext"] = $oRemark->oxremark__oxtext->value;
50  $this->_aViewData["remarkheader"] = $oRemark->oxremark__oxheader->value;
51  }
52  }
53 
54  return "user_remark.tpl";
55  }
56 
60  public function save()
61  {
62  parent::save();
63 
64  $oRemark = oxNew("oxremark");
65 
66  // try to load if exists
67  $oRemark->load(oxRegistry::getConfig()->getRequestParameter("rem_oxid"));
68 
69  $oRemark->oxremark__oxtext = new oxField(oxRegistry::getConfig()->getRequestParameter("remarktext"));
70  $oRemark->oxremark__oxheader = new oxField(oxRegistry::getConfig()->getRequestParameter("remarkheader"));
71  $oRemark->oxremark__oxparentid = new oxField($this->getEditObjectId());
72  $oRemark->oxremark__oxtype = new oxField("r");
73  $oRemark->save();
74  }
75 
79  public function delete()
80  {
81  $oRemark = oxNew("oxRemark");
82  $oRemark->delete(oxRegistry::getConfig()->getRequestParameter("rem_oxid"));
83  }
84 }