<?php

class documentComponents extends sfComponents {

  public function executeCreatedirect() {
    $catItem = blogStore::$catTree->getCatItem($this->cat_id);
    $this->exts = $catItem->getAllowExts();
  }

  public function executeCreateselect() {
    $c = new Criteria();
    $c->add(TbldocumentPeer::DOC_USER, blogStore::$userId);
    $c->add(TbldocumentPeer::DOC_STATUS, 0);
    $c->addDescendingOrderByColumn(TbldocumentPeer::DOC_DATE);
    $this->page = $this->getRequestParameter('page', 1);
    $this->pager = new PropelPager($c, 'TbldocumentPeer', 'doSelect', $this->page, 18);
  }

  public function executeCreatepaste() {
  }

  public function executeSame() {
    $this->same = $this->getRequestParameter('same', 'show');
    $this->page = $this->getRequestParameter('page', 1);
    
    if ($this->same == 'author') {
      $c = new Criteria();
      $c->add(TblblogentryPeer::ENTRY_USER, $this->tblblogentry->getEntryUser());
      $c->add(TblblogentryPeer::ENTRY_TYPE, 1);
      $c->addDescendingOrderByColumn(TblblogentryPeer::ENTRY_MODIFYDATE);
      $c->addIndex('userindex');
      $this->pager = new PropelPager($c, 'TblblogentryPeer', 'doSelect', $this->page, 18);
      $this->tblblogentrys = $this->pager->getResult();
    }
    elseif ($this->same == 'downloader') {
      $c = new Criteria();
      $c->add(TbluserdocumentPeer::USDOC_DOCUMENT, $this->tblblogentry->getEntryLink());
      $c->addDescendingOrderByColumn(TbluserdocumentPeer::USDOC_DATE);
      $this->pager = new PropelPager($c, 'TbluserdocumentPeer', 'doSelect', $this->page, 18);
    }
    $this->entry_id = $this->tblblogentry->getEntryId();
    $this->tbldocument = $this->tblblogentry->getTbldocument();
  }
}
?>