order_remark.php

Go to the documentation of this file.
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             // all remark
00028             $oRems = oxNew( "oxlist" );
00029             $oRems->init( "oxremark");
00030             $sSelect = "select * from oxremark where oxparentid=".oxDb::getDb()->quote( $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         $oOrder = oxNew( "oxorder" );
00062         if ( $oOrder->load( oxConfig::getParameter( "oxid" ) ) ) {
00063             $oRemark = oxNew( "oxremark" );
00064             $oRemark->load( oxConfig::getParameter( "rem_oxid" ) );
00065 
00066             $oRemark->oxremark__oxtext     = new oxField( oxConfig::getParameter( "remarktext" ) );
00067             $oRemark->oxremark__oxheader   = new oxField( oxConfig::getParameter( "remarkheader" ) );
00068             $oRemark->oxremark__oxtype     = new oxField( "r" );
00069             $oRemark->oxremark__oxparentid = new oxField( $oOrder->oxorder__oxuserid->value );
00070             $oRemark->save();
00071         }
00072     }
00073 
00079     public function delete()
00080     {
00081         $oRemark = oxNew( "oxRemark" );
00082         $oRemark->delete( oxConfig::getParameter( "rem_oxid" ) );
00083     }
00084 }