00001 <?php
00002
00008 class User_Remark extends oxAdminDetails
00009 {
00016 public function render()
00017 {
00018 parent::render();
00019
00020 $soxId = oxConfig::getParameter( "oxid");
00021 $sRemoxId = oxConfig::getParameter( "rem_oxid");
00022 if ( $soxId != "-1" && isset( $soxId)) {
00023
00024 $oUser = oxNew( "oxuser" );
00025 $oUser->load( $soxId);
00026 $this->_aViewData["edit"] = $oUser;
00027
00028
00029 $oRems = oxNew( "oxlist" );
00030 $oRems->init( "oxremark");
00031 $sSelect = "select * from oxremark where oxparentid='".$oUser->oxuser__oxid->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 "user_remark.tpl";
00052 }
00053
00059 public function save()
00060 {
00061
00062 $soxId = oxConfig::getParameter( "oxid");
00063 $sRemoxId = oxConfig::getParameter( "rem_oxid");
00064
00065 $oRemark = oxNew( "oxremark" );
00066 $oRemark->load( $sRemoxId);
00067
00068 $sNewText = oxConfig::getParameter( "remarktext");
00069 $sNewHeader = oxConfig::getParameter( "remarkheader");
00070 $oRemark->oxremark__oxtext = new oxField($sNewText);
00071 $oRemark->oxremark__oxheader = new oxField($sNewHeader);
00072 $oRemark->oxremark__oxparentid = new oxField($soxId);
00073
00074 $oRemark->save();
00075 }
00076
00082 public function delete()
00083 {
00084 $sRemoxId = oxConfig::getParameter( "rem_oxid");
00085 $oRemark = oxNew( "oxRemark" );
00086 $oRemark->load( $sRemoxId);
00087 $oRemark->delete();
00088 }
00089 }