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