示例#1
0
文件: photos.php 项目: bizanto/Hooked
 static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new JParameter($act->params);
     $action = $param->get('action', false);
     $photoid = $param->get('photoid', 0);
     CFactory::load('models', 'photos');
     $url = $param->get('url', false);
     CFactory::load('helpers', 'albums');
     if ($action == 'wall') {
         // unfortunately, wall post can also have 'photo' as its $act->apps. If the photo id is availble
         // for (newer activity stream, inside the param), we will show the photo snippet as well. Otherwise
         // just print out the wall content
         // Version 1.6 onwards, $params will contain photoid information
         // older version would have #photoid in the $title, since we link it to the photo
         $photoid = $param->get('photoid', false);
         if ($photoid) {
             $photo = JTable::getInstance('Photo', 'CTable');
             $photo->load($act->cid);
             $helper = new CAlbumsHelper($photo->albumid);
             if ($helper->showActivity()) {
                 $tmpl = new CTemplate();
                 $tmpl->set('url', $url);
                 $tmpl->set('photo', $photo);
                 $tmpl->set('param', $param);
                 $tmpl->set('act', $act);
                 return $tmpl->fetch('activity.photos.wall');
             }
         }
         return '';
     } elseif ($action == 'upload' && $photoid > 0) {
         $albumsHelper = new CAlbumsHelper($act->cid);
         if ($albumsHelper->isPublic()) {
             // If content has link to image, we could assume it is "upload photo" action
             // since old content add this automatically.
             // The $act->cid will be the album id, Retrive the recent photos uploaded
             // If $act->activities has data, that means this is an aggregated content
             // display some of them
             $photoModel = CFactory::getModel('photos');
             $album = JTable::getInstance('Album', 'CTable');
             $album->load($act->cid);
             if (empty($act->activities)) {
                 $acts[] = $act;
             } else {
                 $acts = $act->activities;
             }
             $tmpl = new CTemplate();
             $tmpl->set('album', $album);
             $tmpl->set('acts', $acts);
             return $tmpl->fetch('activity.photos.upload');
         }
     }
     return $html;
 }
示例#2
0
            <!-- existing albums tab -->
            <div id="joms-js__select-album" class="joms-tab__content <?php 
    echo $isAlbumExist && $selectedAlbum ? '' : 'joms-popup__hide';
    ?>
">
                <div class="joms-form__group">
                    <span><?php 
    echo JText::_('COM_COMMUNITY_PHOTOS_ALBUM_NAME');
    ?>
</span>
                    <div class="joms-select--wrapper">
                        <select class="joms-select" name="album-id">
                            <?php 
    foreach ($allAlbums as $index => $album) {
        if (CAlbumsHelper::isFixedAlbum($album)) {
            continue;
        }
        ?>
                            <option value="<?php 
        echo $album->id;
        ?>
" <?php 
        echo $album->id == $selectedAlbum ? 'selected="selected"' : '';
        ?>
><?php 
        echo trim($album->name);
        ?>
</option>
                            <?php 
    }
示例#3
0
</a></li>
                            <?php 
        if ($isAuthorized) {
            ?>
                            <li><a href="javascript:" onclick="joms.api.photoRemove('<?php 
            echo $row->id;
            ?>
');"><?php 
            echo JText::_('COM_COMMUNITY_PHOTOS_DELETE');
            ?>
</a></li>
                            <?php 
        }
        ?>
                            <?php 
        if ($isAuthorized && !CAlbumsHelper::isFixedAlbum($album)) {
            ?>
                            <li><a href="javascript:" onclick="joms.api.photoSetAlbum(['<?php 
            echo $row->id;
            ?>
'], '<?php 
            echo $groupId;
            ?>
');"><?php 
            echo JText::_('COM_COMMUNITY_MOVE_TO_ANOTHER_ALBUM');
            ?>
</a></li>
                            <?php 
        }
        ?>
                        </ul>
示例#4
0
 public function setSubmenus()
 {
     //CFactory::load( 'helpers' , 'group' );
     //CFactory::load( 'helpers' , 'owner' );
     $jinput = JFactory::getApplication()->input;
     $task = $userid = $jinput->get('task', '', 'WORD');
     //JRequest::getVar( 'task', '', 'GET' );
     $albumId = $userid = $jinput->get('albumid', 0, 'INT');
     //JRequest::getInt( 'albumid', 0 , 'REQUEST');
     $eventid = $userid = $jinput->get('eventid', 0, 'INT');
     //JRequest::getInt( 'eventid', '', 'REQUEST' );
     if (!empty($albumId)) {
         $album = JTable::getInstance('Album', 'CTable');
         $album->load($albumId);
         $eventid = $album->eventid;
     }
     $config = CFactory::getConfig();
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($eventid);
     $my = CFactory::getUser();
     $albumId = $albumId != 0 ? $albumId : '';
     // Check if the current user is banned from this event
     $isBanned = false;
     $allowManagePhotos = CEventHelper::allowManagePhoto($this->eventid);
     if (($task == 'uploader' || $task == 'photo' || $task == 'album') && !empty($albumId)) {
         $this->view->addSubmenuItem('index.php?option=com_community&view=photos&eventid=' . $this->eventid . '&task=display&albumid=' . $albumId, JText::_('COM_COMMUNITY_PHOTOS_BACK_TO_ALBUM'));
     }
     if ($allowManagePhotos && $task != 'photo' && !$isBanned) {
         /* Event: Upload Photos */
         if ($task != 'newalbum' && $task != 'editAlbum') {
             //$this->view->addSubmenuItem('javascript:void(0);', JText::_('COM_COMMUNITY_PHOTOS_UPLOAD_PHOTOS'), 'joms.notifications.showUploadPhoto(\'' . $albumId . '\',' . $this->eventid . '); return false;', true, '', '');
         }
         if ($task == 'album' && ($my->id == $album->creator && $allowManagePhotos || $event->isAdmin($my->id) || COwnerHelper::isCommunityAdmin())) {
             if (!CAlbumsHelper::isFixedAlbum($album)) {
                 $this->view->addSubmenuItem('javascript:', JText::_('COM_COMMUNITY_PHOTOS_ALBUM_DELETE'), "joms.api.albumRemove('" . $album->id . "', '" . $task . "');", true);
                 $this->view->addSubmenuItem('index.php?option=com_community&view=photos&task=editAlbum&albumid=' . $album->id . '&eventid=' . $event->id . '&referrer=albumgrp', JText::_('COM_COMMUNITY_EDIT_ALBUM'), '', true);
             }
             //$this->view->addSubmenuItem('index.php?option=com_community&view=photos&task=group', JText::_('COM_COMMUNITY_PHOTOS_ALL_EVENT_PHOTOS'), '' , false , '' , 'joms-right');
             //$this->view->addSubmenuItem('index.php?option=com_community&view=photos&task=event', JText::_('COM_COMMUNITY_PHOTOS_ALL_EVENT_PHOTOS'), '' , false , '' , 'joms-right');
             //->view->addSubmenuItem('index.php?option=com_community&view=photos&task=display', JText::_('COM_COMMUNITY_PHOTOS_ALL_PHOTOS'), '' , false , '' , 'joms-right');
             if ($my->id != 0) {
                 //$this->view->addSubmenuItem('index.php?option=com_community&view=photos&task=myphotos&userid=' . $my->id, JText::_('COM_COMMUNITY_PHOTOS_MY_PHOTOS'), '' , false , '' , 'joms-right');
             }
         }
         //$this->view->addSubmenuItem('index.php?option=com_community&view=photos&task=newalbum&eventid=' . $this->eventid, JText::_('COM_COMMUNITY_PHOTOS_CREATE_PHOTO_ALBUM'), '', true, '', '');
     }
     if ($task == 'photo') {
         if ($album->hasAccess($my->id, 'deletephotos')) {
             $this->view->addSubmenuItem('', JText::_('COM_COMMUNITY_PHOTOS_DELETE'), "joms_delete_photo();", true);
         }
         if ($my->id == $album->creator) {
             $this->view->addSubmenuItem('', JText::_('COM_COMMUNITY_PHOTOS_SET_AVATAR'), "joms_set_as_profile_picture();", true);
         }
         if ($my->id == $album->creator && $allowManagePhotos || $event->isAdmin($my->id) || COwnerHelper::isCommunityAdmin()) {
             $this->view->addSubmenuItem('', JText::_('COM_COMMUNITY_PHOTOS_SET_AS_ALBUM_COVER'), "joms_set_as_album_cover();", true);
         }
         if (!$config->get('deleteoriginalphotos')) {
             $this->view->addSubmenuItem('', JText::_('COM_COMMUNITY_DOWNLOAD_IMAGE'), "joms_download_photo();", true);
         }
         if ($eventid != '' && $task == 'myphotos') {
             $this->view->addSubmenuItem('index.php?option=com_community&view=photos&task=newalbum&eventid=' . $eventid, JText::_('COM_COMMUNITY_PHOTOS_CREATE_PHOTO_ALBUM'), '', true);
         } elseif ($task == 'myphotos') {
             $this->view->addSubmenuItem('index.php?option=com_community&view=photos&task=newalbum&userid=' . $my->id, JText::_('COM_COMMUNITY_PHOTOS_CREATE_PHOTO_ALBUM'), '', true);
         }
     }
     if ($task == "display" && $task == 'myphotos') {
         $this->view->addSubmenuItem('index.php?option=com_community&view=photos&task=newalbum&eventid=' . $eventid, JText::_('COM_COMMUNITY_PHOTOS_CREATE_PHOTO_ALBUM'), '', true);
     }
     //$this->view->addSubmenuItem('index.php?option=com_community&view=groups&task=viewgroup&eventid=' . $this->eventid, JText::_('COM_COMMUNITY_EVENTS_BACK_TO_EVENT'));
 }
示例#5
0
文件: photos.php 项目: Jougito/DynWeb
 /**
  * Return HTML for acitivity stream
  * @param  JTableActiities $act activity object
  * @return string      html formatted output
  */
 public static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     //$param 	 = new CParameter( $act->params );
     $action = $act->params->get('action', false);
     $photoid = $act->params->get('photoid', 0);
     $url = $act->params->get('url', false);
     $act->title = CActivities::format($act->title, $act->params->get('mood', null));
     if ($action == 'wall') {
         // unfortunately, wall post can also have 'photo' as its $act->apps. If the photo id is availble
         // for (newer activity stream, inside the param), we will show the photo snippet as well. Otherwise
         // just print out the wall content
         // Version 1.6 onwards, $params will contain photoid information
         // older version would have #photoid in the $title, since we link it to the photo
         $photoid = $param->get('photoid', false);
         if ($photoid) {
             $photo = JTable::getInstance('Photo', 'CTable');
             $photo->load($act->cid);
             $helper = new CAlbumsHelper($photo->albumid);
             if ($helper->showActivity()) {
                 $tmpl = new CTemplate();
                 return $tmpl->set('url', $url)->set('photo', $photo)->set('param', $param)->set('act', $act)->fetch('activity.photos.wall');
             }
         }
         return '';
     } elseif ($action == 'upload' && $photoid > 0) {
         $photoModel = CFactory::getModel('photos');
         // Album object should have been created in the activities library
         $album = $act->album;
         $albumsHelper = new CAlbumsHelper($album);
         if ($albumsHelper->isPublic()) {
             // If content has link to image, we could assume it is "upload photo" action
             // since old content add this automatically.
             // The $act->cid will be the album id, Retrive the recent photos uploaded
             // If $act->activities has data, that means this is an aggregated content
             // display some of them
             $db = JFactory::getDBO();
             // If count is more than 1, get the last few photos, otherwise
             // the photo might have a custom message along with it. Show that single photo
             $count = $act->params->get('count', 1);
             $photosId = $act->params->get('photosId', null);
             $batchCount = $act->params->get('batchcount', $count);
             if (is_null($photosId)) {
                 if ($count == 1) {
                     $album->id = empty($album->id) ? 0 : $album->id;
                     $sql = "SELECT * FROM #__community_photos WHERE `albumid`=" . $album->id . " AND `id`=" . $photoid . " AND `status` != 'temp'";
                     $db->setQuery($sql);
                     $result = $db->loadObjectList();
                 } else {
                     $album->id = empty($album->id) ? 0 : $album->id;
                     $sql = "SELECT * FROM #__community_photos WHERE `albumid`=" . $album->id . " AND `status` != 'temp'" . " ORDER BY `id` DESC LIMIT 0, 5";
                     $db->setQuery($sql);
                     $result = $db->loadObjectList();
                 }
             } else {
                 $result = explode(',', $photosId);
             }
             $photos = array();
             if (is_array($result) && count($result) > 0) {
                 foreach ($result as $row) {
                     $photo = JTable::getInstance('Photo', 'CTable');
                     if (is_null($photosId)) {
                         $photo->bind($row);
                     } else {
                         $photo->load($row);
                     }
                     if ($photo->status != 'delete' && $photo->id) {
                         $photos[] = $photo;
                     }
                     if ($photo->status == 'delete') {
                         $batchCount--;
                     }
                 }
                 foreach ($photos as $key => $data) {
                     if ($data->id == $photoid) {
                         unset($photos[$key]);
                         /* remove this photo */
                         array_unshift($photos, $data);
                         /* move it to beginning of array */
                     }
                 }
                 $photos = array_slice($photos, 0, 5);
                 // limit to 5 photos only
                 if (empty($act->activities)) {
                     $acts[] = $act;
                 } else {
                     $acts = $act->activities;
                 }
                 $tmpl = new CTemplate();
                 if ($batchCount == 0) {
                     $batchCount = 1;
                 }
                 return $tmpl->set('album', $album)->set('acts', $acts)->set('photos', $photos)->set('count', $count)->set('batchCount', $batchCount)->set('stream', $act->params->get('stream', false))->fetch('stream/photo-upload');
             }
         }
     }
     return $html;
 }
示例#6
0
<?php

/**
 * @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
 * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author iJoomla.com <*****@*****.**>
 * @url https://www.jomsocial.com/license-agreement
 * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
 * More info at https://www.jomsocial.com/license-agreement
 */
defined('_JEXEC') or die;
$enableReporting = false;
if ($config->get('enablereporting') == 1 && ($my->id > 0 || $config->get('enableguestreporting') == 1)) {
    $enableReporting = true;
}
$canEdit = !CAlbumsHelper::isFixedAlbum($album) && (COwnerHelper::isCommunityAdmin() || $album->creator == $my->id || isset($groupId) && $groupId && $my->authorise('community.create', 'groups.photos.' . $groupId));
?>

<div class="joms-page">
    <div class="joms-js--photo-info">
        <div class="joms-stream__header" style="padding:0; visibility:hidden">
            <div class="joms-avatar--stream">
                <a href="javascript:"><img></a>
            </div>
            <div class="joms-stream__meta">
                <a class="joms-stream__user">&nbsp;</a>
                <span class="joms-stream__time">
                    <small>&nbsp;</small>
                    <svg viewBox="0 0 16 16" class="joms-icon">
                        <use xlink:href="#joms-icon-earth">
                    </svg>
示例#7
0
 /**
  * Get photo list by album.
  */
 public function ajaxGetPhotosByAlbum($albumId, $photoId)
 {
     $filter = JFilterInput::getInstance();
     $albumId = $filter->clean($albumId, 'int');
     $model = CFactory::getModel('photos');
     $photos = $model->getPhotos($albumId, 1000);
     $count = count($photos);
     $list = array();
     $index = 0;
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $canEdit = false;
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($albumId);
     if ($album->type == 'group' && !$my->authorise('community.view', 'photos.group.album.' . $album->groupid, $album)) {
         $json = array('title' => $album->name, 'error' => JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'));
         die(json_encode($json));
     }
     if ($album->type != 'group' && !$my->authorise('community.view', 'photos.user.album.' . $albumId)) {
         $json = array('title' => $album->name, 'error' => JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'));
         die(json_encode($json));
     }
     $canEdit = $album->hasAccess($my->id, 'upload');
     if (!($count > 0)) {
         $json = array('title' => $album->name, 'error' => JText::_('COM_COMMUNITY_PHOTOS_NO_PHOTOS_UPLOADED'));
         die(json_encode($json));
     }
     for ($i = 0; $i < $count; $i++) {
         $photo = $photos[$i];
         $list[$i] = array('id' => $photo->id, 'caption' => $photo->caption, 'thumbnail' => $photo->getThumbURI(), 'original' => $photo->getOriginalURI(), 'url' => $photo->getImageURI());
         if (!$index && $photo->id == $photoId) {
             $index = $i;
         }
     }
     $isTaggable = false;
     if (COwnerHelper::isMine($my->id, $album->creator) || CFriendsHelper::isConnected($my->id, $album->creator)) {
         $isTaggable = true;
     }
     $canMovePhoto = !CAlbumsHelper::isFixedAlbum($album) && (COwnerHelper::isCommunityAdmin() || $album->creator == $my->id || isset($groupId) && $my->authorise('community.create', 'groups.photos.' . $groupId) || isset($eventId) && $my->authorise('community.create', 'events.photos.' . $eventId));
     $json = array();
     $json['list'] = $list;
     $json['index'] = $index;
     $json['can_edit'] = $canEdit ? true : false;
     $json['can_tag'] = $isTaggable;
     $json['can_move_photo'] = $canMovePhoto;
     $json['album_name'] = $album->name;
     $json['album_url'] = CRoute::_('index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . ($album->groupid > 0 ? '&groupid=' . $album->groupid : ''));
     $json['photo_url'] = CRoute::getExternalURL('index.php?option=com_community&view=photos&task=photo&albumid=' . $album->id . '&photoid=___photo_id___' . ($album->groupid > 0 ? '&groupid=' . $album->groupid : ''), false);
     $json['my_id'] = (int) $my->id;
     $json['owner_id'] = (int) $album->creator;
     $json['is_admin'] = (int) COwnerHelper::isCommunityAdmin();
     $json['deleteoriginalphotos'] = $config->get('deleteoriginalphotos');
     $json['enablereporting'] = $config->get('enablereporting');
     $json['enablesharing'] = $config->get('enablesharethis') == 1;
     $json['enablelike'] = $config->get('likes_photo') == 1;
     // Languages.
     $json['lang'] = array('comments' => JText::_('COM_COMMUNITY_COMMENTS'), 'tag_photo' => JText::_('COM_COMMUNITY_TAG_THIS_PHOTO'), 'done_tagging' => JText::_('COM_COMMUNITY_PHOTO_DONE_TAGGING'), 'options' => JText::_('COM_COMMUNITY_OPTIONS'), 'download' => JText::_('COM_COMMUNITY_DOWNLOAD_IMAGE'), 'set_as_album_cover' => JText::_('COM_COMMUNITY_PHOTOS_SET_AS_ALBUM_COVER'), 'set_as_profile_picture' => JText::_('COM_COMMUNITY_PHOTOS_SET_AVATAR'), 'delete_photo' => JText::_('COM_COMMUNITY_PHOTOS_DELETE'), 'rotate_left' => JText::_('COM_COMMUNITY_PHOTOS_ROTATE_LEFT'), 'rotate_right' => JText::_('COM_COMMUNITY_PHOTOS_ROTATE_RIGHT'), 'next' => JText::_('COM_COMMUNITY_NEXT'), 'prev' => JText::_('COM_COMMUNITY_PREV'), 'share' => JText::_('COM_COMMUNITY_SHARE'), 'report' => JText::_('COM_COMMUNITY_REPORT'), 'upload_photos' => JText::_('COM_COMMUNITY_PHOTOS_UPLOAD_PHOTOS'), 'view_album' => JText::_('COM_COMMUNITY_VIEW_ALBUM'), 'move_to_another_album' => JText::_('COM_COMMUNITY_MOVE_TO_ANOTHER_ALBUM'));
     die(json_encode($json));
 }