00001 <?php
00002
00008 class Order_Remark extends oxAdminDetails
00009 {
00017 public function render()
00018 {
00019 parent::render();
00020
00021 $soxId = oxConfig::getParameter( "oxid");
00022 $sRemoxId = oxConfig::getParameter( "rem_oxid");
00023 if ( $soxId != "-1" && isset( $soxId)) {
00024 $oOrder = oxNew( "oxorder" );
00025 $oOrder->load( $soxId);
00026
00027
00028 $oRems = oxNew( "oxlist" );
00029 $oRems->init( "oxremark");
00030 $sSelect = "select * from oxremark where oxparentid='".$oOrder->oxorder__oxuserid->value."' order by oxcreate desc";
00031 $oRems->selectString( $sSelect );
00032 foreach ($oRems as $key => $val) {
00033 if ( $val->oxremark__oxid->value == $sRemoxId) {
00034 $val->selected = 1;
00035 $oRems[$key] = $val;
00036 break;
00037 }
00038 }
00039
00040 $this->_aViewData["allremark"] = $oRems;
00041
00042 if ( isset( $sRemoxId)) {
00043 $oRemark = oxNew( "oxRemark" );
00044 $oRemark->load( $sRemoxId);
00045 $this->_aViewData["remarktext"] = $oRemark->oxremark__oxtext->value;
00046 $this->_aViewData["remarkheader"] = $oRemark->oxremark__oxheader->value;
00047 }
00048 }
00049
00050 return "order_remark.tpl";
00051 }
00052
00058 public function save()
00059 {
00060
00061 $soxId = oxConfig::getParameter( "oxid");
00062 $sRemoxId = oxConfig::getParameter( "rem_oxid");
00063
00064 $oOrder = oxNew( "oxorder" );
00065 $oOrder->load( $soxId);
00066
00067 $oRemark = oxNew( "oxremark" );
00068 $oRemark->load( $sRemoxId);
00069
00070 $sNewText = oxConfig::getParameter( "remarktext");
00071 $sNewHeader = oxConfig::getParameter( "remarkheader");
00072 $oRemark->oxremark__oxtext->setValue($sNewText);
00073 $oRemark->oxremark__oxheader->setValue($sNewHeader);
00074 $oRemark->oxremark__oxparentid->setValue($oOrder->oxorder__oxuserid->value);
00075 $oRemark->save();
00076 }
00077
00083 public function delete()
00084 {
00085 $sRemoxId = oxConfig::getParameter( "rem_oxid");
00086 $oRemark = oxNew( "oxRemark" );
00087 $oRemark->load( $sRemoxId);
00088 $oRemark->delete();
00089 }
00090 }