user_remark.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class User_Remark extends oxAdminDetails
00010 {
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             // load object
00025             $oUser = oxNew( "oxuser" );
00026             $oUser->load( $soxId);
00027             $this->_aViewData["edit"] =  $oUser;
00028 
00029             // all remark
00030             $oRems = oxNew( "oxlist" );
00031             $oRems->init( "oxremark");
00032             $sSelect = "select * from oxremark where oxparentid='".$oUser->oxuser__oxid->value."' order by oxcreate desc";
00033             $oRems->selectString( $sSelect );
00034             foreach ($oRems as $key => $val) {
00035                 if ( $val->oxremark__oxid->value == $sRemoxId) {
00036                     $val->selected = 1;
00037                     $oRems[$key] = $val;
00038                     break;
00039                 }
00040             }
00041 
00042             $this->_aViewData["allremark"] = $oRems;
00043 
00044             if ( isset( $sRemoxId)) {
00045                 $oRemark = oxNew( "oxRemark" );
00046                 $oRemark->load( $sRemoxId);
00047                 $this->_aViewData["remarktext"]      = $oRemark->oxremark__oxtext->value;
00048                 $this->_aViewData["remarkheader"]    = $oRemark->oxremark__oxheader->value;
00049             }
00050         }
00051 
00052         return "user_remark.tpl";
00053     }
00054 
00060     public function save()
00061     {
00062 
00063         $soxId      = oxConfig::getParameter( "oxid");
00064         $sRemoxId   = oxConfig::getParameter( "rem_oxid");
00065 
00066         if ( $sRedirect = $this->autosave() ) {
00067             return $sRedirect;
00068         }
00069 
00070         $oRemark = oxNew( "oxremark" );
00071         $oRemark->load( $sRemoxId);
00072 
00073         $sNewText   = oxConfig::getParameter( "remarktext");
00074         $sNewHeader = oxConfig::getParameter( "remarkheader");
00075         $oRemark->oxremark__oxtext = new oxField($sNewText);
00076         $oRemark->oxremark__oxheader = new oxField($sNewHeader);
00077         $oRemark->oxremark__oxparentid = new oxField($soxId);
00078 
00079         $oRemark->save();
00080 
00081         return $this->autosave();
00082     }
00083 
00089     public function delete()
00090     {
00091         $sRemoxId = oxConfig::getParameter( "rem_oxid");
00092         $oRemark  = oxNew( "oxRemark" );
00093         $oRemark->load( $sRemoxId);
00094         $oRemark->delete();
00095     }
00096 }

Generated on Thu Dec 4 12:04:56 2008 for OXID eShop CE by  doxygen 1.5.5