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 = $this->getEditObjectId();
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         parent::save();
00063 
00064         $oRemark = oxNew( "oxremark" );
00065 
00066         // try to load if exists
00067         $oRemark->load( oxConfig::getParameter( "rem_oxid" ) );
00068 
00069         $oRemark->oxremark__oxtext     = new oxField( oxConfig::getParameter( "remarktext") );
00070         $oRemark->oxremark__oxheader   = new oxField( oxConfig::getParameter( "remarkheader") );
00071         $oRemark->oxremark__oxparentid = new oxField( $this->getEditObjectId() );
00072         $oRemark->oxremark__oxtype     = new oxField( "r" );
00073         $oRemark->save();
00074     }
00075 
00081     public function delete()
00082     {
00083         $oRemark = oxNew( "oxRemark" );
00084         $oRemark->delete( oxConfig::getParameter( "rem_oxid" ) );
00085     }
00086 }