order_remark.php

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

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5