Source of file ElementGalleryPortal.php

Size: 3,193 Bytes - Last Modified: 2016-05-18T03:08:26+02:00

buildproject/core/module_mediamanager/portal/elements/ElementGalleryPortal.php

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
<?php
/*"******************************************************************************************************
*   (c) 2007-2016 by Kajona, www.kajona.de                                                              *
*       Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt                                 *
*-------------------------------------------------------------------------------------------------------*
*	$Id$                                            *
********************************************************************************************************/

namespace Kajona\Mediamanager\Portal\Elements;

use Kajona\Mediamanager\Portal\MediamanagerPortal;
use Kajona\Pages\Portal\ElementPortal;
use Kajona\Pages\Portal\PortalElementInterface;
use Kajona\Rating\System\RatingRate;
use Kajona\System\System\SystemModule;


/**
 * Portal-part of the gallery-element
 *
 * @package module_mediamanager
 * @author sidler@mulchprod.de
 *
 * @targetTable element_gallery.content_id
 */
class ElementGalleryPortal extends ElementPortal implements PortalElementInterface
{


    /**
     * Contructor
     *
     * @param $objElementData
     */
    public function __construct($objElementData)
    {
        parent::__construct($objElementData);

        //we support ratings, so add cache-busters
        if (SystemModule::getModuleByName("rating") !== null) {
            $this->setStrCacheAddon(getCookie(RatingRate::RATING_COOKIE));
        }
    }


    /**
     * Loads the gallery-class and passes control
     *
     * @return string
     */
    public function loadData()
    {
        $strReturn = "";

        $objMediamanagerModule = SystemModule::getModuleByName("mediamanager");
        if ($objMediamanagerModule != null) {

            $this->arrElementData["repo_id"] = $this->arrElementData["gallery_id"];
            $this->arrElementData["repo_elementsperpage"] = $this->arrElementData["gallery_imagesperpage"];
            $this->arrElementData["repo_template"] = $this->arrElementData["gallery_template"];

            $objGallery = $objMediamanagerModule->getPortalInstanceOfConcreteModule($this->arrElementData);
            $strReturn = $objGallery->action();
        }

        return $strReturn;
    }

    public static function providesNavigationEntries()
    {
        return true;
    }

    public function getNavigationEntries()
    {
        $arrData = $this->getElementContent($this->getSystemid());

        //skip random galleries
        if ($arrData["gallery_mode"] == "1") {
            return false;
        }

        $arrData["repo_id"] = $arrData["gallery_id"];
        $arrData["repo_elementsperpage"] = $arrData["gallery_imagesperpage"];
        $arrData["repo_template"] = $arrData["gallery_template"];

        $objMediamanagerModule = SystemModule::getModuleByName("mediamanager");

        if ($objMediamanagerModule != null) {

            /** @var $objDownloads MediamanagerPortal */
            $objDownloads = $objMediamanagerModule->getPortalInstanceOfConcreteModule($arrData);
            $arrReturn = $objDownloads->getNavigationNodes();

            return $arrReturn;
        }

        return false;
    }

}