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