コード例 #1
0
ファイル: CopyTest.php プロジェクト: rukzuk/rukzuk
 /**
  * @param  \Cms\Data\Page $result
  * @param string          $expectedData
  */
 protected function assertResultSuccess($result, $expectedData = '')
 {
     $this->assertInstanceOf('Cms\\Data\\Page', $result);
     $this->assertSame($result->getName(), $expectedData);
     $this->assertNotSame($result->getId(), $this->testEntry->getId());
     $this->assertSame($result->getWebsiteId(), $this->testEntry->getWebsiteId());
     $this->assertEquals($result->getPageType(), $this->testEntry->getPageType());
     $this->assertEquals($result->getPageAttributes(), $this->testEntry->getPageAttributes());
 }
コード例 #2
0
ファイル: UpdateTest.php プロジェクト: rukzuk/rukzuk
 /**
  * @test
  * @group library
  */
 public function success()
 {
     $attributes = array('name' => 'new name', 'pageType' => 'the_new_page_type_id', 'pageAttributes' => (object) array('newKey' => 'newValue'));
     $this->assertNotEquals($attributes['name'], $this->testEntry->getName());
     $this->assertNotEquals($attributes['pageType'], $this->testEntry->getPageType());
     $this->assertNotEquals($attributes['pageAttributes'], json_decode($this->testEntry->getPageAttributes()));
     $lastUpdateBeforUpdate = $this->testEntry->getLastupdate();
     // kurz warten, damit updateTime geprueft werden kann (sonst ist Zeit zu kurz)
     sleep(1);
     $this->service->update($this->testEntry->getId(), $this->websiteId, $attributes);
     $page = $this->service->getById($this->testEntry->getId(), $this->websiteId);
     $this->assertEquals($attributes['name'], $page->getName());
     $this->assertEquals($attributes['pageType'], $page->getPageType());
     $this->assertEquals($attributes['pageAttributes'], json_decode($page->getPageAttributes()));
     // Timestamp der letzten Aenderung darf nicht aelter sein als ein paar Sekunden
     $this->assertNotNull($page->getLastupdate());
     $this->assertNotEquals($lastUpdateBeforUpdate, $page->getLastupdate());
     $currentTime = time();
     $this->assertLessThanOrEqual($currentTime, $page->getLastupdate());
     $this->assertGreaterThan($currentTime - 2, $page->getLastupdate());
 }
コード例 #3
0
ファイル: Reparser.php プロジェクト: meixelsberger/rukzuk
 /**
  * Page reparsen und updaten
  *
  * @param Cms\Data\Page     $page
  * @param Cms\Data\Template $template
  * @param string            $reparseType
  */
 public static function reparseAndUpdatePage(Page &$page, Template $template, $reparseType = self::TYPE_REPARSE)
 {
     // Content reparsen
     $newPageContent = array();
     $newPageContent = self::reparseContent($page->getWebsiteid(), $page->getContent(), $page->getTemplatecontent(), $template->getContent(), $reparseType);
     // Page mit den neuen Werten updaten
     $page->setContent(\Zend_Json::encode($newPageContent));
     $page->setTemplatecontent($template->getContent());
     $page->setTemplatecontentchecksum($template->getContentchecksum());
     // Page speichern
     $pageBusiness = new \Cms\Business\Page('Page');
     $pageBusiness->update($page->getId(), $page->getWebsiteId(), array('content' => \Zend_Json::encode($newPageContent), 'templatecontent' => $template->getContent(), 'templatecontentchecksum' => $template->getContentchecksum()));
     return true;
 }
コード例 #4
0
ファイル: Page.php プロジェクト: rukzuk/rukzuk
 protected function setValuesFromData(PageData $data)
 {
     $this->setId($data->getId());
     $this->setWebsiteId($data->getWebsiteid());
     $this->setTemplateId($data->getTemplateid());
     $this->setMediaId($data->getMediaId());
     $this->setName($data->getName());
     $this->setDescription($data->getDescription());
     $this->setInNavigation($data->getInnavigation());
     $this->setDate($data->getDate());
     $this->setNavigationTitle($data->getNavigationtitle());
     $this->setContent($data->getContent());
     $this->setPageType($data->getPageType());
     $this->setPageAttributes($data->getPageAttributes());
     $this->setScreenshot();
 }
コード例 #5
0
ファイル: Website.php プロジェクト: rukzuk/rukzuk
 public function addPageToNavigation(Data\Page $page, $websiteId, $parentId, $insertBeforeId)
 {
     $dataPage = array('id' => $page->getId());
     $website = $this->getById($websiteId);
     $navigation = \Zend_Json::decode($website->getNavigation());
     $data = new \Seitenbau\ArrayData();
     $result = $data->insert($navigation, $dataPage, $parentId, $insertBeforeId);
     if ($result == false) {
         throw new CmsException(752, __METHOD__, __LINE__);
     }
     $result = \Zend_Json::encode($result);
     $attributes = array('navigation' => $result);
     $this->update($websiteId, $attributes);
     $result = array('id' => $page->getId(), 'navigation' => $result);
     return $result;
 }
コード例 #6
0
ファイル: GetByIdTest.php プロジェクト: rukzuk/rukzuk
 /**
  * @test
  * @group library
  */
 public function success()
 {
     $result = $this->service->getById($this->testEntry->getId(), $this->testEntry->getWebsiteId());
     $this->assertResultSuccess($result);
 }
コード例 #7
0
ファイル: Website.php プロジェクト: rukzuk/rukzuk
 /**
  * Fuegt in der Website-Navigation eine Page hinter eine andere angegebene
  * Page-ID ein
  *
  * @param \Orm\Entity\Page $insertPage
  * @param string $pageId
  * @return array  Neue Navigation
  */
 public function addPageToNavigationAfterPageId(Data\Page $insertPage, $pageId)
 {
     $dataPage = array('id' => $insertPage->getId());
     $website = $this->getService()->getById($insertPage->getWebsiteid());
     $navigation = \Zend_Json::decode($website->getNavigation());
     $data = new \Seitenbau\ArrayData();
     $newNavigation = $data->insertAfter($navigation, $dataPage, $pageId);
     $newNavigation = \Zend_Json::encode($newNavigation);
     $attributes = array('navigation' => $newNavigation);
     $this->getService()->update($insertPage->getWebsiteid(), $attributes);
     return $newNavigation;
 }