当前位置: 首页>>代码示例>>PHP>>正文


PHP PHOTO_BOL_PhotoService::countPhotos方法代码示例

本文整理汇总了PHP中PHOTO_BOL_PhotoService::countPhotos方法的典型用法代码示例。如果您正苦于以下问题:PHP PHOTO_BOL_PhotoService::countPhotos方法的具体用法?PHP PHOTO_BOL_PhotoService::countPhotos怎么用?PHP PHOTO_BOL_PhotoService::countPhotos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHOTO_BOL_PhotoService的用法示例。


在下文中一共展示了PHOTO_BOL_PhotoService::countPhotos方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: viewList

    public function viewList($params)
    {
        // is moderator
        $modPermissions = OW::getUser()->isAuthorized('photo');
        if (!$modPermissions && !OW::getUser()->isAuthorized('photo', 'view')) {
            $status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'view');
            $this->assign('authError', $status['msg']);
            return;
        }
        $type = !empty($params['listType']) ? $params['listType'] : 'latest';
        $limit = 12;
        $validLists = array('latest', 'toprated', 'featured');
        if (!in_array($type, $validLists)) {
            $this->redirect(OW::getRouter()->urlForRoute('view_photo_list', array('listType' => 'latest')));
        }
        $menu = $this->getMenu();
        $el = $menu->getElement($type);
        $el->setActive(true);
        $this->addComponent('menu', $menu);
        $initialCmp = new PHOTO_MCMP_PhotoList($type, $limit, array());
        $this->addComponent('photos', $initialCmp);
        $checkPrivacy = !OW::getUser()->isAuthorized('photo');
        $total = $this->photoService->countPhotos($type, $checkPrivacy);
        $this->assign('loadMore', $total > $limit);
        if (OW::getUser()->isAuthenticated() && !OW::getUser()->isAuthorized('photo', 'upload')) {
            $id = uniqid('photo_add');
            $status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'upload');
            OW::getDocument()->addScriptDeclaration(UTIL_JsGenerator::composeJsString(';$("#" + {$btn}).on("click", function()
                {
                    OWM.authorizationLimitedFloatbox({$msg});
                });', array('btn' => $id, 'msg' => $status['msg'])));
            $this->assign('id', $id);
        } else {
            $this->assign('uploadUrl', OW::getRouter()->urlForRoute('photo_upload'));
        }
        $script = '
        OWM.bind("photo.hide_load_more", function(){
            $("#btn-photo-load-more").hide();
        });

        $("#btn-photo-load-more").click(function(){
            var node = $(this);
            node.addClass("owm_preloader");
            var exclude = $("div.owm_photo_list_item").map(function(){ return $(this).data("ref"); }).get();
            OWM.loadComponent(
                "PHOTO_MCMP_PhotoList",
                {type: "' . $type . '", count:' . $limit . ', exclude: exclude},
                {
                    onReady: function(html){
                        $("#photo-list-cont").append(html);
                        node.removeClass("owm_preloader");
                    }
                }
            );
        });';
        OW::getDocument()->addOnloadScript($script);
        OW::getDocument()->setHeading(OW::getLanguage()->text('photo', 'page_title_browse_photos'));
        OW::getDocument()->setTitle(OW::getLanguage()->text('photo', 'meta_title_photo_' . $type));
        OW::getDocument()->setDescription(OW::getLanguage()->text('photo', 'meta_description_photo_' . $type));
    }
开发者ID:tammyrocks,项目名称:photo,代码行数:60,代码来源:photo.php

示例2: __construct

 public function __construct($listType, $count, $exclude = null, $albumId = null)
 {
     parent::__construct();
     $this->photoService = PHOTO_BOL_PhotoService::getInstance();
     $this->photoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance();
     $checkPrivacy = !OW::getUser()->isAuthorized('photo');
     if ($albumId) {
         $photos = $this->photoService->getAlbumPhotos($albumId, 1, $count, $exclude);
     } else {
         $photos = $this->photoService->findPhotoList($listType, 1, $count, $checkPrivacy, $exclude);
     }
     $this->assign('photos', $photos);
     foreach ($photos as $photo) {
         array_push($exclude, $photo['id']);
     }
     if ($albumId) {
         $loadMore = $this->photoAlbumService->countAlbumPhotos($albumId, $exclude);
     } else {
         $loadMore = $this->photoService->countPhotos($listType, $checkPrivacy, $exclude);
     }
     if (!$loadMore) {
         $script = "OWM.trigger('photo.hide_load_more', {});";
         OW::getDocument()->addOnloadScript($script);
     }
 }
开发者ID:vazahat,项目名称:dudex,代码行数:25,代码来源:photo_list.php

示例3: viewToplist

    public function viewToplist()
    {
        // is moderator
        $modPermissions = OW::getUser()->isAuthorized('photo');
        if (!$modPermissions && !OW::getUser()->isAuthorized('photo', 'view')) {
            $status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'view');
            $this->assign('authError', $status['msg']);
            return;
        }
        $menu = $this->getMenu();
        $el = $menu->getElement('toprated');
        $el->setActive(true);
        $this->addComponent('menu', $menu);
        $type = 'toprated';
        $limit = 12;
        $initialCmp = new PHOTO_MCMP_PhotoList($type, $limit, array());
        $this->addComponent('photos', $initialCmp);
        $checkPrivacy = !OW::getUser()->isAuthorized('photo');
        $total = $this->photoService->countPhotos($type, $checkPrivacy);
        $this->assign('loadMore', $total > $limit);
        $this->assign('uploadUrl', OW::getRouter()->urlForRoute('photo_upload'));
        $script = '
        OWM.bind("photo.hide_load_more", function(){
            $("#btn-photo-load-more").hide();
        });

        $("#btn-photo-load-more").click(function(){
            var node = $(this);
            node.addClass("owm_preloader");
            var exclude = $("div.owm_photo_list_item").map(function(){ return $(this).data("ref"); }).get();
            OWM.loadComponent(
                "PHOTO_MCMP_PhotoList",
                {type: "' . $type . '", count:' . $limit . ', exclude: exclude},
                {
                    onReady: function(html){
                        $("#photo-list-cont").append(html);
                        node.removeClass("owm_preloader");
                    }
                }
            );
        });';
        OW::getDocument()->addOnloadScript($script);
        OW::getDocument()->setHeading(OW::getLanguage()->text('photo', 'page_title_browse_photos'));
        OW::getDocument()->setTitle(OW::getLanguage()->text('photo', 'meta_title_photo_latest'));
        OW::getDocument()->setDescription(OW::getLanguage()->text('photo', 'meta_description_photo_latest'));
    }
开发者ID:hardikamutech,项目名称:loov,代码行数:46,代码来源:photo.php

示例4: __construct

    /**
     * Class constructor
     *
     * @param string $listType
     * @param int $count
     * @param string $tag
     */
    public function __construct(array $params)
    {
        parent::__construct();
        $listType = $params['type'];
        $count = isset($params['count']) ? $params['count'] : 5;
        $this->photoService = PHOTO_BOL_PhotoService::getInstance();
        $page = !empty($_GET['page']) && (int) $_GET['page'] ? abs((int) $_GET['page']) : 1;
        $config = OW::getConfig();
        $photosPerPage = $config->getValue('photo', 'photos_per_page');
        if (isset($params['tag']) && strlen($tag = $params['tag'])) {
            $photos = $this->photoService->findTaggedPhotos($tag, $page, $photosPerPage);
            $records = $this->photoService->countTaggedPhotos($tag);
        } else {
            $checkPrivacy = $listType == 'latest' && !OW::getUser()->isAuthorized('photo');
            $photos = $this->photoService->findPhotoList($listType, $page, $photosPerPage, $checkPrivacy);
            $records = $this->photoService->countPhotos($listType, $checkPrivacy);
        }
        if ($photos) {
            $userIds = array();
            foreach ($photos as $photo) {
                if (!in_array($photo['userId'], $userIds)) {
                    array_push($userIds, $photo['userId']);
                }
            }
            $names = BOL_UserService::getInstance()->getDisplayNamesForList($userIds);
            $this->assign('names', $names);
            $usernames = BOL_UserService::getInstance()->getUserNamesForList($userIds);
            $this->assign('usernames', $usernames);
            // Paging
            $pages = (int) ceil($records / $photosPerPage);
            $paging = new BASE_CMP_Paging($page, $pages, 10);
            $this->addComponent('paging', $paging);
            $this->assign('photos', $photos);
            $this->assign('no_content', false);
        } else {
            $this->assign('no_content', true);
        }
        $this->assign('listType', $listType);
        $this->assign('widthConfig', $config->getValue('photo', 'preview_image_width'));
        $this->assign('heightConfig', $config->getValue('photo', 'preview_image_height'));
        $this->assign('count', $count);
        OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'jquery.bbq.min.js');
        OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('photo')->getStaticJsUrl() . 'photo.js');
        OW::getLanguage()->addKeyForJs('photo', 'tb_edit_photo');
        OW::getLanguage()->addKeyForJs('photo', 'confirm_delete');
        OW::getLanguage()->addKeyForJs('photo', 'mark_featured');
        OW::getLanguage()->addKeyForJs('photo', 'remove_from_featured');
        $objParams = array('ajaxResponder' => OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'), 'fbResponder' => OW::getRouter()->urlForRoute('photo.floatbox'));
        $script = '$("div.ow_photo_list_item_thumb a").on("click", function(e){
            e.preventDefault();
            var photo_id = $(this).attr("rel");

            if ( !window.photoViewObj ) {
                window.photoViewObj = new photoView(' . json_encode($objParams) . ');
            }
            
            window.photoViewObj.setId(photo_id);
        });
        
        $(window).bind( "hashchange", function(e) {
            var photo_id = $.bbq.getState("view-photo");
            if ( photo_id != undefined )
            {
                if ( window.photoFBLoading ) { return; }
                window.photoViewObj.showPhotoCmp(photo_id);
            }
        });';
        OW::getDocument()->addOnloadScript($script);
    }
开发者ID:vazahat,项目名称:dudex,代码行数:76,代码来源:photo_list.php

示例5: __construct

    /**
     * Class constructor
     *
     * @param string $listType
     * @param int $count
     * @param string $tag
     */
    public function __construct(array $params)
    {
        parent::__construct();
        $listType = $params['listType'];
        $this->assign('listType', $listType);
        $this->assign('idPrefix', $params['idPrefix']);
        $this->assign('format', isset($params['format']) ? $params['format'] : '');
        $this->photoService = PHOTO_BOL_PhotoService::getInstance();
        $this->advancePhotoService = ADVANCEDPHOTO_BOL_PhotoService::getInstance();
        $page = !empty($_GET['page']) && (int) $_GET['page'] ? abs((int) $_GET['page']) : 1;
        $config = OW::getConfig();
        $photosPerPage = $config->getValue('photo', 'photos_per_page');
        $result = array();
        $photos = array();
        if (isset($params['tag']) && strlen($tag = $params['tag'])) {
            $photos = $this->photoService->findTaggedPhotos($tag, $page, $photosPerPage);
            $records = $this->photoService->countTaggedPhotos($tag);
        } else {
            if (is_numeric($listType)) {
                $checkPrivacy = !OW::getUser()->isAuthorized('photo');
                $photos = $this->advancePhotoService->getPhotoListCategory($listType, $page, $photosPerPage, $checkPrivacy);
                $records = $this->advancePhotoService->countPhotoListCategory($listType, $checkPrivacy);
            } else {
                if ($listType == 'featured') {
                    $checkPrivacy = false;
                    $photosPerPage = OW::getConfig()->getValue('advancedphoto', 'photofeature_per_page');
                    $photos = $this->advancePhotoService->findPhotoList($listType, $page, $photosPerPage, $checkPrivacy);
                    $records = $this->advancePhotoService->countPhotosFeature($listType, $checkPrivacy);
                } else {
                    //echo $listType;die;
                    $checkPrivacy = $listType == 'latest' && !OW::getUser()->isAuthorized('photo');
                    $photos = $this->photoService->findPhotoList($listType, $page, $photosPerPage, $checkPrivacy);
                    $records = $this->photoService->countPhotos($listType, $checkPrivacy);
                }
            }
        }
        $aPhotos = array();
        if ($photos) {
            $userIds = array();
            foreach ($photos as $photo) {
                if (!in_array($photo['userId'], $userIds)) {
                    array_push($userIds, $photo['userId']);
                }
                $photo['url'] = $this->photoService->getPhotoUrl($photo['id']);
                $album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo['albumId']);
                $ownerName = BOL_UserService::getInstance()->getUserName($album->userId);
                $photo['album_title'] = $album->name;
                $photo['album_href'] = OW::getRouter()->urlForRoute('photo_user_album', array('user' => $ownerName, 'album' => $album->id));
                $aPhotos[] = $photo;
            }
            $names = BOL_UserService::getInstance()->getDisplayNamesForList($userIds);
            $this->assign('names', $names);
            $usernames = BOL_UserService::getInstance()->getUserNamesForList($userIds);
            $this->assign('usernames', $usernames);
            // Paging
            $pages = (int) ceil($records / $photosPerPage);
            ADVANCEDPHOTO_CTRL_Photo::$isNext = $result['isNext'] = $isNext = $pages > $page ? true : false;
            ADVANCEDPHOTO_CTRL_Photo::$item_count = $result['item_count'] = count($aPhotos);
            $this->assign('photos', $aPhotos);
            $this->assign('no_content', false);
        } else {
            $this->assign('no_content', true);
        }
        if (OW::getPluginManager()->isPluginActive('gphotoviewer')) {
            $script = "PhotoViewer.bindPhotoViewer();";
            OW::getDocument()->addOnloadScript($script);
        } else {
            $objParams = array('ajaxResponder' => OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'), 'fbResponder' => OW::getRouter()->urlForRoute('photo.floatbox'));
            OW::getLanguage()->addKeyForJs('photo', 'tb_edit_photo');
            OW::getLanguage()->addKeyForJs('photo', 'confirm_delete');
            OW::getLanguage()->addKeyForJs('photo', 'mark_featured');
            OW::getLanguage()->addKeyForJs('photo', 'remove_from_featured');
            $script = '$("div.photo a").on("click", function(e){
				e.preventDefault();
				var photo_id = $(this).attr("rel");
				if ( !window.photoViewObj ) {
					window.photoViewObj = new photoView(' . json_encode($objParams) . ');
				}
				window.photoViewObj.setId(photo_id);
			}); ';
            OW::getDocument()->addOnloadScript($script);
        }
    }
开发者ID:vazahat,项目名称:dudex,代码行数:90,代码来源:photo_list.php


注:本文中的PHOTO_BOL_PhotoService::countPhotos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。