Пример #1
0
 /**
  * Limit CMS page save
  *
  * @param Mage_Cms_Model_Page $model
  */
 public function cmsPageSaveBefore($model)
 {
     $originalStoreIds = $model->getResource()->lookupStoreIds($model->getId());
     if ($model->getId() && !$this->_role->hasStoreAccess($originalStoreIds)) {
         $this->_throwSave();
     }
     if (!$this->_role->hasExclusiveStoreAccess($originalStoreIds)) {
         $this->_throwSave();
     }
     $model->setData('stores', $this->_forceAssignToStore($this->_updateSavingStoreIds($model->getData('stores'), $originalStoreIds)));
 }
Пример #2
0
 public function createVersion(Mage_Cms_Model_Page $page)
 {
     $data = $page->getData();
     $versionData = array();
     $versionData['content'] = $data['content'];
     $versionData['parent_id'] = $data['page_id'];
     $versionData['creation_time'] = $data['update_time'];
     $versionData['user_id'] = Mage::getSingleton('admin/session')->getUser()->getId();
     $this->setData($versionData);
     $this->save();
     return $this;
 }