Esempio n. 1
0
 /**
  * Approves the specified version of this Mailing and all embedded Cblocks and creates a new working version
  *
  * @param int $version (optional) Mailing version
  * @return int|false New version or FALSE in case of an error
  */
 public function approveVersion($version = 0)
 {
     $result = parent::approveVersion($version);
     // Check if there are blind entrymasks in this mailing (and add a version)
     $colist = $this->getCblockList();
     foreach ($colist as $colist_item) {
         if ($colist_item['EMBEDDED'] == 1) {
             $tmpCb = sCblockMgr()->getCblock($colist_item['OBJECTID'], $colist_item['VERSION']);
             $tmpCb->approveVersion();
         }
     }
     if ((int) $version == 0) {
         $version = (int) $this->getVersion();
     }
     $this->history->add(HISTORYTYPE_MAILING, NULL, $version, 'TXT_MAILING_H_APPROVE');
     if ($this->getPublishedVersion() == ALWAYS_LATEST_APPROVED_VERSION) {
         $this->history->add(HISTORYTYPE_MAILING, NULL, $version, 'TXT_MAILING_H_AUTOPUBLISH');
         sMailingMgr()->callExtensionHook("onPublish", $this->_id, $version);
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/MAILING_PUBLISH") == "true") {
             Singleton::FC()->emptyBucket();
         }
     }
     sMailingMgr()->callExtensionHook('onApprove', (int) $this->_id, (int) $this->_version);
     return result;
 }
Esempio n. 2
0
 /**
  * Approves the specified version of this Cblock
  *
  * @param int $version (optional) Cblock version
  * @return int|false New version or FALSE in case of an error
  */
 public function approveVersion($version = 0)
 {
     $result = parent::approveVersion($version);
     if ((int) $version == 0) {
         $version = (int) $this->getVersion();
     }
     $this->history->add(HISTORYTYPE_CO, NULL, $version, 'TXT_CBLOCK_H_APPROVE');
     if ($this->getPublishedVersion() == ALWAYS_LATEST_APPROVED_VERSION) {
         $this->history->add(HISTORYTYPE_CO, NULL, $version, 'TXT_CBLOCK_H_AUTOPUBLISH');
         sCblockMgr()->callExtensionHook("onPublish", $this->_id, $version);
         if (Singleton::cache_config()->getVar("CONFIG/INVALIDATEON/CBLOCK_PUBLISH") == "true") {
             Singleton::FC()->emptyBucket();
         }
     }
     return $result;
 }