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


PHP elgg_get_river函数代码示例

本文整理汇总了PHP中elgg_get_river函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_get_river函数的具体用法?PHP elgg_get_river怎么用?PHP elgg_get_river使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: post

 /**
  * {@inheritdoc}
  */
 public function post(ParameterBag $params)
 {
     $user = get_entity($params->guid);
     $friend = $params->friend_uid ? $this->graph->get($params->friend_uid) : null;
     if (!$user instanceof ElggUser || !$friend instanceof ElggUser) {
         throw new GraphException("User or friend not found", HttpResponse::HTTP_NOT_FOUND);
     }
     if (!$user->canEdit()) {
         throw new GraphException("You are not allowed to modify this user's friends list", HttpResponse::HTTP_FORBIDDEN);
     }
     if ($user->guid == $friend->guid) {
         throw new GraphException("You are trying to friend yourself", HttpResponse::HTTP_BAD_REQUEST);
     }
     if (check_entity_relationship($user->guid, 'friend', $friend->guid)) {
         throw new GraphException("Already a friend", HttpResponse::HTTP_BAD_REQUEST);
     }
     if (!add_entity_relationship($user->guid, 'friend', $friend->guid)) {
         throw new GraphException("Unable to create friendship");
     }
     $river_id = elgg_create_river_item(array('view' => 'river/relationship/friend/create', 'action_type' => 'friend', 'subject_guid' => $user->guid, 'object_guid' => $friend->guid));
     $return = array('nodes' => array('friend' => check_entity_relationship($user->guid, 'friend', $friend->guid), 'friend_of' => check_entity_relationship($friend->guid, 'friend', $user->guid)));
     if (!empty($river_id)) {
         $river = elgg_get_river(array('ids' => $river_id));
         $return['nodes']['activity'] = $river ? $river[0] : $river_id;
     }
     return $return;
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:30,代码来源:UserFriends.php

示例2: getGroup

 /**
  * @SWG\Get(
  *     path="/api/groups/{guid}/activities",
  *     security={{"oauth2": {"all"}}},
  *     tags={"activities"},
  *     summary="Find activities in a specific group.",
  *     description="Find the most recent activities from a specific group.",
  *     produces={"application/json"},
  *     @SWG\Parameter(
  *         name="guid",
  *         in="path",
  *         description="The guid of the specific group",
  *         required=true,
  *         type="integer",
  *         @SWG\Items(type="integer")
  *     ),
  *     @SWG\Parameter(
  *         name="offset",
  *         in="query",
  *         description="Offset the results by",
  *         default=0,
  *         required=false,
  *         type="integer",
  *         @SWG\Items(type="integer")
  *     ),
  *     @SWG\Parameter(
  *         name="limit",
  *         in="query",
  *         description="Limit the results by",
  *         default=20,
  *         required=false,
  *         type="integer",
  *         @SWG\Items(type="integer")
  *     ),
  *     @SWG\Response(
  *         response=200,
  *         description="Succesful operation.",
  *         @SWG\Schema(
  *             type="array",
  *             @SWG\Items(ref="#/definitions/Activity")
  *         ),
  *     ),
  *     @SWG\Response(
  *         response="404",
  *         description="Could not find the requested group.",
  *     )
  * )
  */
 public function getGroup($request, $response, $args)
 {
     $currentUser = elgg_get_logged_in_user_entity();
     $guid = (int) $args['guid'];
     $group = get_entity($guid);
     if (!$group | !$group instanceof \ElggGroup) {
         return $response->withStatus(404);
     }
     $params = $request->getQueryParams();
     $limit = (int) $params['limit'];
     $offset = (int) $params['offset'];
     if (!$limit | $limit < 0 | $limit > 50) {
         $limit = 20;
     }
     $dbprefix = elgg_get_config("dbprefix");
     $options = array('offset' => $offset, 'limit' => $limit, 'joins' => array("JOIN {$dbprefix}entities e1 ON e1.guid = rv.object_guid"), 'wheres' => array("(e1.container_guid = {$group->guid})"));
     $entities = array();
     foreach (elgg_get_river($options) as $entity) {
         $entities[] = $this->parseActivity($entity);
     }
     $options['count'] = true;
     $total = elgg_get_river($options);
     $handler = new \PleioRest\Services\PushNotificationHandler();
     $response = $response->withHeader('Content-type', 'application/json');
     return $response->write(json_encode(array('total' => $total, 'number_unread' => $handler->getContainerUnreadCount($currentUser, $group), 'entities' => $entities), JSON_PRETTY_PRINT));
 }
开发者ID:Pleio,项目名称:pleio_rest,代码行数:74,代码来源:Activities.php

示例3: addTaggedWirePost

function addTaggedWirePost($hook, $type, $params)
{
    global $CONFIG;
    $id = insert_data("insert into {$CONFIG->dbprefix}river " . " set type = '" . $params['type'] . "', " . " subtype = '" . $params['subtype'] . "', " . " action_type = '" . $params['action_type'] . "', " . " access_id = '" . $params['access_id'] . "', " . " view = '" . $params['view'] . "', " . " subject_guid = '" . $params['subject_guid'] . "', " . " object_guid = '" . $params['object_guid'] . "', " . " annotation_id = '" . $params['annotation_id'] . "', " . " posted = '" . $params['posted'] . "';");
    $tags = "";
    if (isset($_SESSION['role'])) {
        switch ($_SESSION['role']) {
            case "learner":
                $tags = "Learner-Apprenant";
                break;
            case "instructor":
                $tags = "Instructor-Instructeur";
                break;
            case "developer":
                $tags = "Developer-Développeur";
                break;
            case "trainingmgr":
                $tags = "trainingmgr";
                break;
        }
        $roleTags = $_SESSION['role'];
    }
    if ($roleTags) {
        $metaID = create_metadata($params['object_guid'], "tags", "{$tags}", "text", elgg_get_logged_in_user_guid(), 2, true);
    }
    if ($id) {
        update_entity_last_action($object_guid, $posted);
        $river_items = elgg_get_river(array('id' => $id));
        if ($river_items) {
            elgg_trigger_event('created', 'river', $river_items[0]);
        }
    }
    return false;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:34,代码来源:start.php

示例4: post

 /**
  * {@inheritdoc}
  */
 public function post(ParameterBag $params)
 {
     $user = elgg_get_logged_in_user_entity();
     $object = get_entity($params->guid);
     if (!$object || !$object->canWriteToContainer(0, 'object', 'comment')) {
         throw new GraphException("You are not allowed to comment on this object", 403);
     }
     $comment_text = $params->comment;
     $comment = new ElggComment();
     $comment->owner_guid = $user->guid;
     $comment->container_guid = $object->guid;
     $comment->description = $comment_text;
     $comment->access_id = $object->access_id;
     if (!$comment->save()) {
         throw new GraphException(elgg_echo("generic_comment:failure"));
     }
     // Notify if poster wasn't owner
     if ($object->owner_guid != $user->guid) {
         $owner = $object->getOwnerEntity();
         notify_user($owner->guid, $user->guid, elgg_echo('generic_comment:email:subject', array(), $owner->language), elgg_echo('generic_comment:email:body', array($object->title, $user->name, $comment->description, $comment->getURL(), $user->name, $user->getURL()), $owner->language), array('object' => $comment, 'action' => 'create'));
     }
     $return = array('nodes' => array('comment' => $comment));
     // Add to river
     $river_id = elgg_create_river_item(array('view' => 'river/object/comment/create', 'action_type' => 'comment', 'subject_guid' => $user->guid, 'object_guid' => $comment->guid, 'target_guid' => $object->guid));
     if ($river_id) {
         $river = elgg_get_river(array('ids' => $river_id));
         $return['nodes']['activity'] = $river ? $river[0] : $river_id;
     }
     return $return;
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:33,代码来源:ObjectComments.php

示例5: getActivityGuidPosition

function getActivityGuidPosition($guid, $context, $loginUser)
{
    $notFound = true;
    $offset = 0;
    while ($notFound) {
        if ($context == 'mine') {
            $options = array('distinct' => false, 'subject_guids' => $loginUser->guid, 'offset' => $offset, 'limit' => 1);
            $activity = elgg_get_river($options);
        } else {
            if ($context == 'friends') {
                $options = array('distinct' => false, 'relationship' => 'friend', 'relationship_guid' => $loginUser->guid, 'offset' => $offset, 'limit' => 1);
                $activity = elgg_get_river($options);
            }
        }
        if (sizeof($activity) > 0) {
            if ($activity[0]->object_guid == $guid) {
                $notFound = false;
            } else {
                $offset = $offset + 1;
            }
        } else {
            $notFound = false;
        }
    }
    return $offset;
}
开发者ID:manlui,项目名称:elgg_with_rest_api,代码行数:26,代码来源:activity.php

示例6: pleio_rest_created_river_async

function pleio_rest_created_river_async($river_id)
{
    $ia = elgg_set_ignore_access(true);
    $river = elgg_get_river(array('id' => $river_id, 'site_guid' => null));
    if (count($river) === 1) {
        $river = $river[0];
        $notHandler = new \PleioRest\Services\PushNotificationHandler();
        $notHandler->fanOutNotifications($river);
    }
    elgg_set_ignore_access($ia);
}
开发者ID:Pleio,项目名称:pleio_rest,代码行数:11,代码来源:events.php

示例7: get

 /**
  * {@inheritdoc}
  */
 public function get($uid = '')
 {
     switch ($uid) {
         case 'me':
             $uid = "ue" . elgg_get_logged_in_user_guid();
             break;
         case 'site':
             $uid = "se" . elgg_get_site_entity()->guid;
             break;
     }
     $abbr = substr($uid, 0, 2);
     switch ($abbr) {
         case 'an':
             $id = (int) substr($uid, 2);
             $object = elgg_get_annotation_from_id($id);
             break;
         case 'md':
             $id = (int) substr($uid, 2);
             $object = elgg_get_metadata_from_id($id);
             break;
         case 'rl':
             $id = (int) substr($uid, 2);
             $object = get_relationship($id);
             break;
         case 'rv':
             $id = (int) substr($uid, 2);
             $river = elgg_get_river(array('ids' => sanitize_int($id)));
             $object = $river ? $river[0] : false;
             break;
         case 'ue':
         case 'se':
         case 'oe':
         case 'ge':
             $id = (int) substr($uid, 2);
             $object = get_entity($id);
             break;
         default:
             $object = get_user_by_username($uid);
             if (!$object && is_numeric($uid)) {
                 $object = get_entity($uid);
             }
     }
     if (!$this->isExportable($object)) {
         return false;
     }
     return $object;
 }
开发者ID:hypejunction,项目名称:hypeapps,代码行数:50,代码来源:Graph.php

示例8: ws_pack_river_get

/**
 * Returns river data
 * 
 * @param string $filter            filter name
 * @param array  $guids             guids of groups
 * @param int    $offset            offset
 * @param int    $limit             limit
 * @param int    $posted_time_lower lower time stamp to limit results
 * 
 * @return array|ErrorResult
 */
function ws_pack_river_get($filter, $guids = array(), $offset = 0, $limit = 25, $posted_time_lower = 0)
{
    $result = false;
    $dbprefix = elgg_get_config("dbprefix");
    // default options
    $options = array("offset" => $offset, "limit" => $limit, "posted_time_lower" => $posted_time_lower, "joins" => array("JOIN " . $dbprefix . "entities sue ON rv.subject_guid = sue.guid", "JOIN " . $dbprefix . "entities obe ON rv.object_guid = obe.guid"), "wheres" => array("(sue.enabled = 'yes' AND obe.enabled = 'yes')"));
    // what to return
    switch ($filter) {
        case "mine":
            $options["subject_guid"] = elgg_get_logged_in_user_guid();
            break;
        case "friends":
            $options["relationship_guid"] = elgg_get_logged_in_user_guid();
            $options["relationship"] = "friend";
            break;
        case "groups":
            if (empty($guids)) {
                // get group guids
                $group_options = array("type" => "group", "relationship" => "member", "relationship_guid" => elgg_get_logged_in_user_guid(), "limit" => false, "callback" => "ws_pack_row_to_guid");
                $guids = elgg_get_entities_from_relationship($group_options);
            }
            // check if there are groups
            if (!empty($guids)) {
                $options["joins"] = array("JOIN " . $dbprefix . "entities e ON rv.object_guid = e.guid");
                $options["wheres"] = array("(rv.object_guid IN (" . implode(",", $guids) . ") OR e.container_guid IN (" . implode(",", $guids) . "))");
            } else {
                // no groups found, so make sure not to return anything
                $options = false;
            }
            break;
        case "all":
        default:
            // list everything
            break;
    }
    // get river items
    if ($options && ($items = elgg_get_river($options))) {
        $result = ws_pack_export_river_items($items);
    }
    // did we get river items
    if ($result === false) {
        $result = new ErrorResult(elgg_echo("river:none"), WS_PACK_API_NO_RESULTS);
    }
    return $result;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:56,代码来源:river.php

示例9: newsfeed_list_river

function newsfeed_list_river(array $options = array())
{
    global $autofeed;
    $autofeed = true;
    $defaults = array('offset' => (int) max(get_input('offset', 0), 0), 'limit' => (int) max(get_input('limit', max(20, elgg_get_config('default_limit'))), 0), 'pagination' => true, 'list_class' => 'elgg-list-river', 'no_results' => '');
    $options = array_merge($defaults, $options);
    if (!$options["limit"] && !$options["offset"]) {
        // no need for pagination if listing is unlimited
        $options["pagination"] = false;
    }
    // get the river items
    $options['count'] = false;
    $items = elgg_get_river($options);
    // get the river items count only if we need it for pagination
    if (!is_null(get_input('offset', null))) {
        $options['count'] = true;
        $count = elgg_get_river($options);
        $options['count'] = $count;
    }
    $options['items'] = $items;
    return elgg_view('page/components/list', $options);
}
开发者ID:smellems,项目名称:wet4,代码行数:22,代码来源:custom_core.php

示例10: videolist_2012022501

/**
 * Downloads the thumbnail and saves into data folder
 *
 * @param ElggObject $item
 * @return bool
 */
function videolist_2012022501($item)
{
    require_once elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php';
    // get thumbnail image
    $thumbnail = file_get_contents($item->thumbnail);
    if (!$thumbnail) {
        return false;
    }
    $prefix = "videolist/" . $item->guid;
    $filehandler = new ElggFile();
    $filehandler->owner_guid = $item->owner_guid;
    $filehandler->setFilename($prefix . ".jpg");
    $filehandler->open("write");
    $filehandler->write($thumbnail);
    $filehandler->close();
    // update properties
    if ($item->url) {
        $item->video_url = $item->url;
        $item->deleteMetadata('url');
    }
    if ($item->desc) {
        $item->description = $item->desc;
        $item->deleteMetadata('desc');
        $item->save();
    }
    if ($item->embedurl) {
        $item->deleteMetadata('embedurl');
    }
    upgrade_change_subtype($item, 'videolist_item');
    // update river
    $options = array('object_guid' => $item->guid);
    $river_items = elgg_get_river($options);
    foreach ($river_items as $river_item) {
        if ($river_item->action_type == 'create') {
            upgrade_update_river($river_item->id, 'river/object/videolist_item/create', $item->guid, 0);
        }
    }
    return true;
}
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:45,代码来源:2012022501.php

示例11: tasks_2012100501

function tasks_2012100501($task)
{
    require_once elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php';
    if ($task->long_description) {
        $task->description = $task->long_description;
        $task->deleteMetadata('long_description');
        $task->save();
    }
    if ($task->parent_guid) {
        $task->list_guid = $task->parent_guid;
        $task->deleteMetadata('parent_guid');
    } else {
        $task->list_guid = 0;
    }
    /* Active was set as default, so it is not indicative of which tasks are
    	really active */
    $task->deleteMetadata('active');
    if ($task->done) {
        $task->status = 'done';
        $task->deleteMetadata('done');
    } else {
        $task->status = 'new';
    }
    // reset priority since old system was a mess
    $task->priority = 2;
    upgrade_change_subtype($task, 'task');
    // update river
    $options = array('object_guid' => $task->guid);
    $items = elgg_get_river($options);
    foreach ($items as $item) {
        if ($item->action_type == 'create') {
            upgrade_update_river($item->id, 'river/object/task/create', $task->guid, 0);
        } elseif (in_array($item->action_type, array('done', 'undone', 'subscribe', 'unsubscribe'))) {
            elgg_delete_river(array('id' => $item->id));
        }
    }
    return true;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:38,代码来源:2012100501.php

示例12: group_get_activity

/**
 * @param $guid
 * @param int $limit
 * @param int $offset
 * @param $username
 * @param $from_guid
 * @return array
 * @throws InvalidParameterException
 */
function group_get_activity($guid, $limit = 20, $offset = 0, $username, $from_guid)
{
    if (!$username) {
        $user = elgg_get_logged_in_user_entity();
        throw new InvalidParameterException('registration:usernamenotvalid');
    } else {
        $user = get_user_by_username($username);
        if (!$user) {
            throw new InvalidParameterException('registration:usernamenotvalid');
        }
    }
    $login_user = elgg_get_logged_in_user_entity();
    $group = get_entity($guid);
    if (!elgg_instanceof($group, 'group')) {
        $return['message'] = elgg_echo('grups:error:group_not_found');
        return $return;
    }
    $db_prefix = elgg_get_config('dbprefix');
    $activities = elgg_get_river(array('limit' => $limit, 'offset' => $offset, 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid", "LEFT JOIN {$db_prefix}entities e2 ON e2.guid = rv.target_guid"), 'wheres' => array("(e1.container_guid = {$group->guid} OR e2.container_guid = {$group->guid})"), 'no_results' => elgg_echo('groups:activity:none')));
    $handle = getRiverActivity($activities, $user, $login_user);
    return $handle;
}
开发者ID:manlui,项目名称:elgg_with_rest_api,代码行数:31,代码来源:group.php

示例13: elgg_get_logged_in_user_guid

        $page_filter = 'mine';
        $options['subject_guid'] = elgg_get_logged_in_user_guid();
        break;
    case 'friends':
        $title = elgg_echo('river:friends');
        $page_filter = 'friends';
        $options['relationship_guid'] = elgg_get_logged_in_user_guid();
        $options['relationship'] = 'friend';
        break;
    default:
        $title = elgg_echo('river:all');
        $page_filter = 'all';
        break;
}
$options['count'] = true;
$count = elgg_get_river($options);
$options['count'] = false;
$options['pagination'] = false;
$options['offset'] = 0;
if (elgg_get_config('default_limit')) {
    $options['limit'] = elgg_get_config('default_limit');
} else {
    $options['limit'] = 5;
}
$script_text = '<script type="text/javascript"> 
		var options = ' . json_encode($options) . '; 
		var numactivities = ' . $count . '; 
		</script>';
$activity = '<div id="river_auto_update_activity">';
$activity .= elgg_list_river($options);
if (!$activity) {
开发者ID:n8b,项目名称:VMN,代码行数:31,代码来源:river.php

示例14: elgg_list_river

/**
 * List river items
 *
 * @param array $options Any options from elgg_get_river() plus:
 *   pagination => BOOL Display pagination links (true)
 *   no_results => STR Message to display if no items
 *
 * @return string
 * @since 1.8.0
 */
function elgg_list_river(array $options = array())
{
    global $autofeed;
    $autofeed = true;
    $defaults = array('offset' => (int) max(get_input('offset', 0), 0), 'limit' => (int) max(get_input('limit', 20), 0), 'pagination' => true, 'list_class' => 'elgg-list-river', 'no_results' => '');
    $options = array_merge($defaults, $options);
    if (!$options["limit"] && !$options["offset"]) {
        // no need for pagination if listing is unlimited
        $options["pagination"] = false;
    }
    $options['count'] = true;
    $count = elgg_get_river($options);
    if ($count > 0) {
        $options['count'] = false;
        $items = elgg_get_river($options);
    } else {
        $items = array();
    }
    $options['count'] = $count;
    $options['items'] = $items;
    return elgg_view('page/components/list', $options);
}
开发者ID:ramkameswaran,项目名称:gcconnex,代码行数:32,代码来源:river.php

示例15: ElggBatch

}
// End of Update PART 2/4
// Begin of Update PART 3/4:
// Check for album comments without a river entry and delete them (for each comment made on the activity page
// on an image upload a second comment annotation was created with Tidypics 1.8.1betaXX that showed up on the
// corresponding album page while the first comment annotation was only visible below the river entry on the
// activity page. This second comment annotation is now no longer necessary and should be removed to avoid
// comments appearing twice on album pages)
// ATTENTION: this part of the upgrade script will remove ALL album comment annotations that don't a corresponding
// river entry. If you removed the river entries by any means or prevented them from getting created in the first
// place you might not want this part of the upgrade to be executed. Then you should comment out part 3 of the upgrade
// But you will most likely end with double comments on album pages then.
$batch = new ElggBatch('elgg_get_annotations', array('annotation_name' => 'generic_comment', 'joins' => array("JOIN {$db_prefix}entities te ON te.guid = n_table.entity_guid"), 'wheres' => array("te.subtype = {$tidypics_album_subtype_id}"), 'limit' => false));
$batch->setIncrementOffset(false);
foreach ($batch as $album_comment) {
    $river_entry_count = elgg_get_river(array('type' => 'object', 'subtype' => 'album', 'action_type' => 'comment', 'annotation_id' => $album_comment->id, 'count' => true));
    if ($river_entry_count < 1) {
        elgg_delete_annotation_by_id($album_comment->id);
    }
}
// End of Update Part 3/4
// Begin of Update Part 4/4
// Update likes made to Tidypics batches and assign them either to the image uploaded (if only one) or the album
$batch = new ElggBatch('elgg_get_annotations', array('annotation_name' => 'likes', 'joins' => array("JOIN {$db_prefix}entities te ON te.guid = n_table.entity_guid"), 'wheres' => array("te.subtype = {$tidypics_batch_subtype_id}"), 'limit' => false));
$batch->setIncrementOffset(false);
foreach ($batch as $like_entry) {
    // Get the batch entity
    $tidypics_batch = get_entity($like_entry->entity_guid);
    // Get images related to this batch
    $images = elgg_get_entities_from_relationship(array('relationship' => 'belongs_to_batch', 'relationship_guid' => $tidypics_batch->getGUID(), 'inverse_relationship' => true, 'type' => 'object', 'subtype' => 'image', 'limit' => false));
    // move the like to the album if more than a single image was uploaded in this batch
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:31,代码来源:2013121301.php


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