Beispiel #1
0
 /**
  * @see parent::getImages()
  */
 protected function getImages($limit = 10)
 {
     $Item = new Gallery_Item();
     $params = array();
     $params[] = $Item->getParam('type', Gallery::CAPABILITY);
     return $Item->findList($params, 'Position asc', 0, $limit);
 }
Beispiel #2
0
 /**
  * @see parent::getImages()
  */
 protected function getImages()
 {
     $Item = new Gallery_Item();
     $params = array();
     $params[] = $Item->getParam('type', Gallery::GALLERY);
     return $Item->findList($params, 'PostedAt desc', 0, 10);
 }
Beispiel #3
0
 /**
  * The backend index hanlder.
  * 
  * @access public
  * @return string The HTML code.
  */
 public function index()
 {
     $Item = new Gallery_Item();
     $Product = new Product();
     $Article = new Article();
     $this->getView()->set(array('Articles' => $Article->findShortList(array('Type = ' . Article::ARTICLE), 'PostedAt desc', 0, 5), 'News' => $Article->findShortList(array('Type = ' . Article::NEWS), 'PostedAt desc', 0, 5), 'Gallery' => $Item->findList(array(), 'PostedAt desc, Id desc', 0, 10), 'Products' => $Product->findShortList(array(), 'Id desc', 0, 10), 'Updated' => $Product->findShortList(array(), 'UpdatedAt desc', 0, 10)));
     return $this->getView()->render();
 }
Beispiel #4
0
 /**
  * The gallery items hanlder.
  * 
  * @access public
  * @param int $id The Gallery id.
  * @return string The HTML code.
  */
 public function view($id = null)
 {
     $Gallery = new Gallery();
     $Gallery = $Gallery->findItem(array('Id = ' . $id));
     if (!$Gallery->Id) {
         return $this->halt();
     }
     $Item = new Gallery_Item();
     $params = array();
     $params[] = 'GalleryId = ' . $Gallery->Id;
     $Paginator = new Paginator($Item->findSize($params), $this->getLimit(), $this->getPage());
     $Items = $Item->findList($params, 'Position asc', $this->getOffset(), $this->getLimit());
     if (Request::get('ajax')) {
         return $this->getView()->htmlItems($Items, $Paginator);
     }
     $this->getView()->set('Gallery', $Gallery);
     $this->getView()->set('Paginator', $Paginator);
     $this->getView()->set('Items', $Items);
     return $this->getView()->render();
 }
Beispiel #5
0
 /**
  * The function returns first gallery Item.
  * 
  * @access public
  * @return object The Gallery Item.
  */
 public function getImage()
 {
     $Item = new Gallery_Item();
     foreach ($Item->findList(array('GalleryId = ' . $this->Id), 'Position desc', 0, 1) as $Item) {
     }
     return $Item;
 }
Beispiel #6
0
 /**
  * The upload form handler.
  * 
  * @access public
  * @param int $id The Gallery id.
  * @return string The HTML code.
  */
 public function upload($id = null)
 {
     $error = array();
     $Gallery = new Gallery();
     $Gallery = $Gallery->findItem(array('Id = ' . $id));
     if (!$Gallery->Id) {
         return $this->halt();
     }
     if (isset($_POST['submit'])) {
         if (isset($_FILES['file'])) {
             foreach ($_FILES['file']['name'] as $id => $value) {
                 $file = array('name' => $_FILES['file']['name'][$id], 'type' => $_FILES['file']['type'][$id], 'tmp_name' => $_FILES['file']['tmp_name'][$id], 'error' => $_FILES['file']['error'][$id], 'size' => $_FILES['file']['size'][$id]);
                 $Item = new Gallery_Item();
                 $Item->GalleryId = $Gallery->Id;
                 if ($Item->save()) {
                     if (File::upload($Item, $file)) {
                         $Item->save();
                     }
                 }
             }
         }
         return $this->halt('items/' . $Gallery->Id);
     }
     $this->getView()->set('Gallery', $Gallery);
     $this->getView()->set('Error', $error);
     return $this->getView()->render();
 }
Beispiel #7
0
 /**
  * The function returns top block on index page.
  * 
  * @access protected
  * @return string The HTML code.
  */
 protected function htmlIndexTop()
 {
     $blocks = array();
     $Page = $this->getController()->getContentPage();
     foreach ($Page->getBlocks(4) as $Block) {
         $Block->Link = _L('Controller_Frontend_Service');
         $blocks[] = $Block;
     }
     if (count($blocks) < 4) {
         $count = count($blocks);
         for ($i = 0; $i < 4 - $count; $i++) {
             $Block = new Content_Page_Block();
             $Block->Link = _L('Controller_Frontend_Service');
             $blocks[] = $Block;
         }
     }
     $Item = new Gallery_Item();
     $blocks[0]->Images = $Item->findList(array($Item->getParam('type', Gallery::CAPABILITY)), 'Position asc', 0, 6);
     $blocks[0]->Link = _L('Controller_Frontend_Service_Capability');
     $blocks[1]->Link = _L('Controller_Frontend_Service_Design');
     $blocks[2]->Link = _L('Controller_Frontend_Service_Order');
     $blocks[3]->Images = $Item->findList(array($Item->getParam('type', Gallery::GALLERY)), 'PostedAt desc', 0, 6);
     $blocks[3]->Link = _L('Controller_Frontend_Service_Production');
     return $this->includeLayout('view/index/top.html', array('blocks' => $blocks));
 }