order_remark.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class Order_Remark extends oxAdminDetails
00009 {
00010 
00018     public function render()
00019     {
00020         parent::render();
00021 
00022         $soxId = $this->getEditObjectId();
00023         $sRemoxId = oxRegistry::getConfig()->getRequestParameter("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             $sUserIdField = 'oxorder__oxuserid';
00032             $sQuotedUserId = oxDb::getDb()->quote($oOrder->$sUserIdField->value);
00033             $sSelect = "select * from oxremark where oxparentid=" . $sQuotedUserId . " order by oxcreate desc";
00034             $oRems->selectString($sSelect);
00035             foreach ($oRems as $key => $val) {
00036                 if ($val->oxremark__oxid->value == $sRemoxId) {
00037                     $val->selected = 1;
00038                     $oRems[$key] = $val;
00039                     break;
00040                 }
00041             }
00042 
00043             $this->_aViewData["allremark"] = $oRems;
00044 
00045             if (isset($sRemoxId)) {
00046                 $oRemark = oxNew("oxRemark");
00047                 $oRemark->load($sRemoxId);
00048                 $this->_aViewData["remarktext"] = $oRemark->oxremark__oxtext->value;
00049                 $this->_aViewData["remarkheader"] = $oRemark->oxremark__oxheader->value;
00050             }
00051         }
00052 
00053         return "order_remark.tpl";
00054     }
00055 
00059     public function save()
00060     {
00061         parent::save();
00062 
00063         $oOrder = oxNew("oxorder");
00064         if ($oOrder->load($this->getEditObjectId())) {
00065             $oRemark = oxNew("oxremark");
00066             $oRemark->load(oxRegistry::getConfig()->getRequestParameter("rem_oxid"));
00067 
00068             $oRemark->oxremark__oxtext = new oxField(oxRegistry::getConfig()->getRequestParameter("remarktext"));
00069             $oRemark->oxremark__oxheader = new oxField(oxRegistry::getConfig()->getRequestParameter("remarkheader"));
00070             $oRemark->oxremark__oxtype = new oxField("r");
00071             $oRemark->oxremark__oxparentid = new oxField($oOrder->oxorder__oxuserid->value);
00072             $oRemark->save();
00073         }
00074     }
00075 
00079     public function delete()
00080     {
00081         $oRemark = oxNew("oxRemark");
00082         $oRemark->delete(oxRegistry::getConfig()->getRequestParameter("rem_oxid"));
00083     }
00084 }