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