OXID eShop CE  4.8.12
 All Classes Files Functions Variables Pages
adminguestbook_main.php
Go to the documentation of this file.
1 <?php
2 
9 {
16  public function render()
17  {
18  $myConfig = $this->getConfig();
19 
21 
22  $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
23  if ( $soxId != '-1' && isset( $soxId ) ) {
24  // load object
25  $oLinks = oxNew( 'oxgbentry' );
26  $oLinks->load( $soxId );
27 
28  // #580A - setting GB entry as viewed in admin
29  if ( !isset( $oLinks->oxgbentries__oxviewed ) || !$oLinks->oxgbentries__oxviewed->value ) {
30  $oLinks->oxgbentries__oxviewed = new oxField( 1 );
31  $oLinks->save();
32  }
33  $this->_aViewData["edit"] = $oLinks;
34  }
35 
36  //show "active" checkbox if moderating is active
37  $this->_aViewData['blShowActBox'] = $myConfig->getConfigParam( 'blGBModerate' );
38 
39  return 'adminguestbook_main.tpl';
40  }
41 
47  public function save()
48  {
49  parent::save();
50 
51  $soxId = $this->getEditObjectId();
52  $aParams = oxConfig::getParameter( "editval" );
53 
54  // checkbox handling
55  if ( !isset( $aParams['oxgbentries__oxactive'] ) ) {
56  $aParams['oxgbentries__oxactive'] = 0;
57  }
58 
59  // shopid
60  $aParams['oxgbentries__oxshopid'] = oxSession::getVar( "actshop");
61 
62  $oLinks = oxNew( "oxgbentry" );
63  if ( $soxId != "-1" ) {
64  $oLinks->load( $soxId );
65  } else {
66  $aParams['oxgbentries__oxid'] = null;
67 
68  // author
69  $aParams['oxgbentries__oxuserid'] = oxSession::getVar( 'auth' );
70  }
71 
72  $oLinks->assign( $aParams );
73  $oLinks->save();
74  $this->setEditObjectId( $oLinks->getId() );
75  }
76 
77 }