user_remark.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class User_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             // load object
00026             $oUser = oxNew("oxuser");
00027             $oUser->load($soxId);
00028             $this->_aViewData["edit"] = $oUser;
00029 
00030             // all remark
00031             $oRems = oxNew("oxlist");
00032             $oRems->init("oxremark");
00033             $sQuotedUserId = oxDb::getDb()->quote($oUser->getId());
00034             $sSelect = "select * from oxremark where oxparentid=" . $sQuotedUserId . " order by oxcreate desc";
00035             $oRems->selectString($sSelect);
00036             foreach ($oRems as $key => $val) {
00037                 if ($val->oxremark__oxid->value == $sRemoxId) {
00038                     $val->selected = 1;
00039                     $oRems[$key] = $val;
00040                     break;
00041                 }
00042             }
00043 
00044             $this->_aViewData["allremark"] = $oRems;
00045 
00046             if (isset($sRemoxId)) {
00047                 $oRemark = oxNew("oxRemark");
00048                 $oRemark->load($sRemoxId);
00049                 $this->_aViewData["remarktext"] = $oRemark->oxremark__oxtext->value;
00050                 $this->_aViewData["remarkheader"] = $oRemark->oxremark__oxheader->value;
00051             }
00052         }
00053 
00054         return "user_remark.tpl";
00055     }
00056 
00060     public function save()
00061     {
00062         parent::save();
00063 
00064         $oRemark = oxNew("oxremark");
00065 
00066         // try to load if exists
00067         $oRemark->load(oxRegistry::getConfig()->getRequestParameter("rem_oxid"));
00068 
00069         $oRemark->oxremark__oxtext = new oxField(oxRegistry::getConfig()->getRequestParameter("remarktext"));
00070         $oRemark->oxremark__oxheader = new oxField(oxRegistry::getConfig()->getRequestParameter("remarkheader"));
00071         $oRemark->oxremark__oxparentid = new oxField($this->getEditObjectId());
00072         $oRemark->oxremark__oxtype = new oxField("r");
00073         $oRemark->save();
00074     }
00075 
00079     public function delete()
00080     {
00081         $oRemark = oxNew("oxRemark");
00082         $oRemark->delete(oxRegistry::getConfig()->getRequestParameter("rem_oxid"));
00083     }
00084 }