示例#1
0
 /**
  * @return Psc\CMS\Roles\Page
  */
 public function hydrateByContentStream(ContentStream $cs)
 {
     $dql = "SELECT page FROM " . $this->_entityName . " AS page ";
     $dql .= "JOIN page.contentStreams as contentStream ";
     $dql .= "WHERE contentStream.id = :csid ";
     $q = $this->_em->createQuery($dql);
     $q->setParameter('csid', $cs->getId());
     try {
         return $q->getSingleResult();
     } catch (NoResultException $e) {
         throw new EntityNotFoundException(sprintf("Page für ContentStream nicht gefunden: identifier: %s", $cs->getId()));
     }
 }
示例#2
0
 public function initControlsFor(ContentStream $cs, TranslationContainer $translationContainer)
 {
     $translator = $translationContainer->getTranslator();
     $trans = function ($key) use($translator) {
         return $translator->trans($key, array(), 'cms');
     };
     if ($cs->getType() === 'page-content') {
         foreach ($this->headlines as $level) {
             $this->addNewControl('Headline', (object) array('level' => $level), sprintf('%s (H%d)', $level === 1 ? $trans('sce.widget.headline') . ' ' : $trans('sce.widget.headline'), $level), 'text');
         }
         $this->addNewControl('Paragraph', NULL, $trans('sce.widget.paragraph'), 'text');
         $this->addNewControl('Li', NULL, $trans('sce.widget.li'), 'text');
         $this->addNewControl('Image', NULL, $trans('sce.widget.image'), 'images');
         $this->addNewControl('DownloadsList', (object) array('headline' => '', 'downloads' => array()), $trans('sce.widget.downloadsList'), 'text');
         $this->addNewControl('WebsiteWidget', (object) array('label' => $trans('sce.widget.calendar'), 'name' => 'calendar'), $trans('sce.widget.calendar'), 'misc');
     }
 }
示例#3
0
 /**
  * Konvertiert den ContentStream in eine Repräsenation die nur aus einem Array besteht
  *
  * der Javascript LayoutManager kann dies mit unserialize() lesen und daraus widgets erstellen
  * @return array
  */
 public function convertSerialized(ContentStream $cs)
 {
     $serialized = array();
     foreach ($cs->getEntries() as $entry) {
         if ($entry instanceof ContextAware) {
             $entry->setContext($this->context);
         }
         $serialized[] = $this->serializeEntry($entry);
     }
     return $serialized;
 }
 public function copy(ContentStream $from, ContentStream $to)
 {
     foreach ($from->getEntries() as $entry) {
         $entryCopy = $entry->createCopy();
         $entryCopy->setContentStream($to);
     }
 }