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 = $this->getEditObjectId();
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         parent::save();
00061 
00062         $oOrder = oxNew( "oxorder" );
00063         if ( $oOrder->load( $this->getEditObjectId() ) ) {
00064             $oRemark = oxNew( "oxremark" );
00065             $oRemark->load( oxConfig::getParameter( "rem_oxid" ) );
00066 
00067             $oRemark->oxremark__oxtext     = new oxField( oxConfig::getParameter( "remarktext" ) );
00068             $oRemark->oxremark__oxheader   = new oxField( oxConfig::getParameter( "remarkheader" ) );
00069             $oRemark->oxremark__oxtype     = new oxField( "r" );
00070             $oRemark->oxremark__oxparentid = new oxField( $oOrder->oxorder__oxuserid->value );
00071             $oRemark->save();
00072         }
00073     }
00074 
00080     public function delete()
00081     {
00082         $oRemark = oxNew( "oxRemark" );
00083         $oRemark->delete( oxConfig::getParameter( "rem_oxid" ) );
00084     }
00085 }