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