user_remark.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class User_Remark extends oxAdminDetails
00009 {
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=".oxDb::getDb()->quote( $oUser->getId() )." 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         $oRemark = oxNew( "oxremark" );
00064 
00065         // try to load if exists
00066         $oRemark->load( oxConfig::getParameter( "rem_oxid" ) );
00067 
00068         $oRemark->oxremark__oxtext     = new oxField( oxConfig::getParameter( "remarktext") );
00069         $oRemark->oxremark__oxheader   = new oxField( oxConfig::getParameter( "remarkheader") );
00070         $oRemark->oxremark__oxparentid = new oxField( oxConfig::getParameter( "oxid" ) );
00071         $oRemark->oxremark__oxtype     = new oxField( "r" );
00072         $oRemark->save();
00073     }
00074 
00080     public function delete()
00081     {
00082         $oRemark = oxNew( "oxRemark" );
00083         $oRemark->delete( oxConfig::getParameter( "rem_oxid" ) );
00084     }
00085 }