Esempio n. 1
0
 /**
  * Gets the last container modification log item
  * @param Container $container The container
  * @return LogItem Returns the last log item that changed anything related to the container
  */
 static function LastContainerModLog(Container $container)
 {
     $lastLog = self::LastContainerLog($container);
     $containerContents = ContainerContent::Schema()->FetchByContainer(false, $container);
     foreach ($containerContents as $containerContent) {
         $content = $containerContent->GetContent();
         $contentLog = self::LastContentModLog($content, null);
         if (self::IsAfter($contentLog, $lastLog)) {
             $lastLog = $contentLog;
         }
     }
     return $lastLog;
 }
 protected function Init()
 {
     $this->container = new Container(Request::GetData('container'));
     $selectedID = Request::GetData('selected');
     $this->selected = $selectedID ? ContainerContent::Schema()->ByID($selectedID) : null;
     if (!$this->container->Exists()) {
         //TODO: error
         Response::Redirect(BackendRouter::ModuleUrl(new ContainerList()));
         return true;
     }
     $this->tree = new ContainerContentTreeProvider($this->container);
     $this->containerContent = $this->tree->TopMost();
     $this->hasContents = (bool) $this->containerContent;
     return parent::Init();
 }
 /**
  * Initializes a new container content branch
  * @param ContainerContent $containerContent The page content 
  */
 function __construct(ContainerContent $containerContent)
 {
     $this->container = $containerContent->GetContainer();
     parent::__construct($containerContent);
 }
 /**
  * Gets content by item
  * @param ContainerContent $item
  * @return Content
  */
 public function ContentByItem($item)
 {
     return $item ? $item->GetContent() : null;
 }
Esempio n. 5
0
 /**
  * Attaches the content to the container
  * @param boolean $isNew
  */
 private function AttachContainerContent($isNew)
 {
     $provider = new ContainerContentTreeProvider($this->Container());
     $tree = new TreeBuilder($provider);
     $containerContent = $this->Content()->GetContainerContent();
     if (!$containerContent) {
         $containerContent = new ContainerContent();
         $containerContent->SetContainer($this->Container());
         $provider->AttachContent($containerContent, $this->Content());
     }
     if ($isNew) {
         $tree->Insert($containerContent, $this->ParentItem(), $this->PreviousItem());
     }
 }
 protected function TableSchema()
 {
     return ContainerContent::Schema();
 }