Esempio n. 1
0
 public function testSetters()
 {
     $page = new Page();
     $page->setTitle('Imprint');
     $this->assertEquals('Imprint', $page->getTitle());
     $page->setRoute('imprint');
     $this->assertEquals('imprint', $page->getRoute());
     $page->setContent('lorem ipsum');
     $this->assertEquals('lorem ipsum', $page->getContent());
     $page->setStatus('published');
     $this->assertEquals('published', $page->getStatus());
     $now = new \DateTime('now');
     $page->setCreated($now);
     $this->assertEquals($now, $page->getCreated());
     $page->setUpdated($now);
     $this->assertEquals($now, $page->getUpdated());
 }
Esempio n. 2
0
 /**
  * Save page
  * 
  * @access public
  * @param CMS\Entity\Page $page
  * @param array $data ,default is empty array
  * @param bool $editFlag ,default is false
  */
 public function save($page, $data = array(), $editFlag = false)
 {
     if (array_key_exists(FormButtons::SAVE_AND_PUBLISH_BUTTON, $data)) {
         $page->setStatus(Status::STATUS_ACTIVE);
     } elseif (array_key_exists(FormButtons::UNPUBLISH_BUTTON, $data)) {
         $page->setStatus(Status::STATUS_INACTIVE);
     } elseif (array_key_exists(FormButtons::SAVE_BUTTON, $data) && $editFlag === false) {
         $page->setStatus(Status::STATUS_INACTIVE);
     }
     if ($editFlag === true) {
         $data = array();
     }
     $this->query->setEntity("CMS\\Entity\\Page")->save($page, $data);
 }