OXID eShop CE  4.9.11
 All Classes Files Functions Variables Pages
oxonlinemoduleversionnotifier.php
Go to the documentation of this file.
1 <?php
2 
16 {
17 
19  private $_oCaller = null;
20 
22  private $_oModuleList = null;
23 
30  public function __construct(oxOnlineModuleVersionNotifierCaller $oCaller, oxModuleList $oModuleList)
31  {
32  $this->_oCaller = $oCaller;
33  $this->_oModuleList = $oModuleList;
34  }
35 
39  public function versionNotify()
40  {
41  $oOMNCaller = $this->_getOnlineModuleNotifierCaller();
42  $oOMNCaller->doRequest($this->_formRequest());
43  }
44 
50  protected function _prepareModulesInformation()
51  {
52  $aPreparedModules = array();
53  $aModules = $this->_getModules();
54  foreach ($aModules as $oModule) {
57  $oPreparedModule = new stdClass();
58  $oPreparedModule->id = $oModule->getId();
59  $oPreparedModule->version = $oModule->getInfo('version');
60 
61  $oPreparedModule->activeInShops = new stdClass();
62  $oPreparedModule->activeInShops->activeInShop = array();
63  if ($oModule->isActive()) {
64  $oPreparedModule->activeInShops->activeInShop[] = oxRegistry::getConfig()->getShopUrl();
65  }
66  $aPreparedModules[] = $oPreparedModule;
67  }
68 
69  return $aPreparedModules;
70  }
71 
77  protected function _formRequest()
78  {
79  $oRequestParams = new oxOnlineModulesNotifierRequest();
80 
81  $oRequestParams->modules = new stdClass();
82  $oRequestParams->modules->module = $this->_prepareModulesInformation();
83 
84 
85  return $oRequestParams;
86  }
87 
93  protected function _getOnlineModuleNotifierCaller()
94  {
95  return $this->_oCaller;
96  }
97 
103  protected function _getModules()
104  {
105  $aModules = $this->_oModuleList->getList();
106  ksort($aModules);
107 
108  return $aModules;
109  }
110 }