本文整理汇总了PHP中Activity::addActivity方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::addActivity方法的具体用法?PHP Activity::addActivity怎么用?PHP Activity::addActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::addActivity方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: approveFriendRequest
/**
* This function adds a friend to the database, remove the equivalent friend request.
*
* @param int the member being approved, not "MYSELF"
*/
function approveFriendRequest($friend_id){
global $db;
$friend_id = intval($friend_id);
if ($friend_id < 1){
return;
}
//TODO: hardcoded relationship = 1
$sql = "INSERT INTO ".TABLE_PREFIX."social_friends SET member_id=$_SESSION[member_id], friend_id=$friend_id, relationship=1";
$is_succeeded = mysql_query($sql, $db);
//remove the equivalent friend request
if ($is_succeeded){
$is_succeeded = removeFriendRequest($friend_id, $_SESSION['member_id']);
}
//add to activities log
if ($is_succeeded){
$act = new Activity();
$str1 = _AT('now_friends1', printSocialName($friend_id));
$act->addActivity($_SESSION['member_id'], $str1);
$str2 = _AT('now_friends2', printSocialName($_SESSION['member_id']));
$act->addActivity($friend_id, $str2);
unset($act);
}
}
示例2: addMemberApplication
/**
* Add this application to the member's application list
* @param int member_id
* @param int application_id
*/
function addMemberApplication($member_id, $app_id)
{
$member_id = intval($member_id);
$app_id = intval($app_id);
$sql = "REPLACE INTO %ssocial_members_applications (member_id, application_id) VALUES (%d,%d)";
$result = queryDB($sql, array(TABLE_PREFIX, $member_id, $app_id));
if ($result > 0) {
//Add this to the home page
$home_settings = $this->getHomeDisplaySettings();
$home_settings[$app_id] = 1;
//manually set this application
$this->setHomeDisplaySettings($home_settings);
$act = new Activity();
$act->addActivity($_SESSION['member_id'], '', $app_id);
unset($act);
}
}
示例3: updateGroup
/**
* Update a group
* @param int group id
* @param int member_id, to update the owner of this group
* @param int the group type specified in the table, social_groups_type
* @param string name of the group
* @param string description of the group
* @param string the filename of the logo
* @param string group privacy, private for 1, public for 0
*/
function updateGroup($group_id, $member_id, $type_id, $name, $description, $logo, $privacy)
{
global $addslashes;
$group_id = intval($group_id);
$member_id = intval($member_id);
$type_id = intval($type_id);
$name = $addslashes($name);
$description = $addslashes($description);
$logo = $addslashes($logo);
$privacy = $privacy == 'private' ? 1 : 0;
//only include logo sql iff it is not empty, otherwise the old entry will be erased.
if ($logo != '') {
$logo_sql = "`logo`='{$logo}', ";
} else {
$logo_sql = '';
}
$sql = "UPDATE %ssocial_groups SET `member_id`=%d, `type_id`=%d, " . $logo_sql . "`name`='%s', `privacy`=%d, `description`='%s', `last_updated`=NOW() WHERE id=%d";
$result = queryDB($sql, array(TABLE_PREFIX, $member_id, $type_id, $name, $privacy, $description, $group_id));
if ($result > 0) {
$act = new Activity();
$str1 = _AT('has_updated_group', '<a href="' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/view.php?id=' . $group_id) . '">' . htmlentities_utf8($name)) . '</a>';
$act->addActivity($member_id, $str1);
unset($act);
return true;
}
return false;
}
示例4: addActivityAction
/**
* 发布活动
*/
public function addActivityAction()
{
$json_data = $this->request->getJsonRawBody(true);
$new_activity_id = Activity::addActivity($json_data);
if ($new_activity_id === false) {
$return_data = array('success' => false, 'err_msg' => '活动发布失败');
} else {
$return_data = array('success' => true, 'err_msg' => '活动发布成功', 'activity_id' => $new_activity_id);
}
$this->view->setVars($return_data);
}
示例5: addMemberApplication
/**
* Add this application to the member's application list
* @param int member_id
* @param int application_id
*/
function addMemberApplication($member_id, $app_id)
{
global $db;
$member_id = intval($member_id);
$app_id = intval($app_id);
$sql = 'INSERT INTO ' . TABLE_PREFIX . "social_members_applications (member_id, application_id) VALUES ({$member_id}, {$app_id})";
$result = mysql_query($sql, $db);
if ($result) {
//Add this to the home page
$home_settings = $this->getHomeDisplaySettings();
$home_settings[$app_id] = 1;
//manually set this application
$this->setHomeDisplaySettings($home_settings);
$act = new Activity();
$act->addActivity($_SESSION['member_id'], '', $app_id);
unset($act);
}
}
示例6: User
<?php
require "../php/init.php";
$mainUser = new User();
if (!$mainUser->inRole(1)) {
die('nope. not allowed!');
}
$actId = Input::get('id');
$act = new Activity();
$oldRoles = $act->showRoles($actId);
if ($userData = Input::get('info')) {
$newRoles = $userData['roles'];
unset($userData['roles']);
if (Input::get('add')) {
Activity::addActivity($userData, $newRoles);
} else {
try {
Activity::updateActivity($actId, $userData);
} catch (Exception $e) {
echo $e;
$error = true;
}
if (!$error) {
foreach ($oldRoles as $key => $oldRole) {
if (!in_array($key, $newRoles)) {
Activity::removeRole($actId, $key);
}
}
foreach ($newRoles as $key => $newRole) {
if (!array_key_exists($newRole, $oldRoles)) {
Activity::addRole($actId, $newRole);
示例7: addMember
/**
* Add a member to the group
* @param int member id
* @return boolean true if succeded, false otherwise.
*/
function addMember($member_id)
{
global $db;
$member_id = intval($member_id);
$sql = 'INSERT INTO ' . TABLE_PREFIX . 'social_groups_members (group_id, member_id) VALUES (' . $this->group_id . ", {$member_id})";
$result = mysql_query($sql, $db);
if ($result) {
//add a record to the activities
$act = new Activity();
$str1 = _AT('has_joined_group', '<a href="' . url_rewrite(AT_SOCIAL_BASENAME . 'groups/view.php?id=' . $this->getID(), AT_PRETTY_URL_IS_HEADER) . '">' . htmlentities_utf8($this->getName()) . '</a>');
$act->addActivity($member_id, $str1);
unset($act);
return true;
}
return false;
}