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


PHP AddActivity函数代码示例

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


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

示例1: Approve

 /**
  * Approve a membership applicant.
  */
 public function Approve($UserID, $Email)
 {
     $ApplicantRoleID = C('Garden.Registration.ApplicantRoleID', 0);
     // Make sure the $UserID is an applicant
     $RoleData = $this->GetRoles($UserID);
     if ($RoleData->NumRows() == 0) {
         throw new Exception(T('ErrorRecordNotFound'));
     } else {
         $ApplicantFound = FALSE;
         foreach ($RoleData->Result() as $Role) {
             if ($Role->RoleID == $ApplicantRoleID) {
                 $ApplicantFound = TRUE;
             }
         }
     }
     if ($ApplicantFound) {
         // Retrieve the default role(s) for new users
         $RoleIDs = Gdn::Config('Garden.Registration.DefaultRoles', array(8));
         // Wipe out old & insert new roles for this user
         $this->SaveRoles($UserID, $RoleIDs, FALSE);
         // Send out a notification to the user
         $User = $this->Get($UserID);
         if ($User) {
             $Email->Subject(sprintf(T('[%1$s] Membership Approved'), C('Garden.Title')));
             $Email->Message(sprintf(T('EmailMembershipApproved'), $User->Name, Url(Gdn::Authenticator()->SignInUrl(), TRUE)));
             $Email->To($User->Email);
             //$Email->From(C('Garden.SupportEmail'), C('Garden.SupportName'));
             $Email->Send();
         }
         // Report that the user was approved
         $Session = Gdn::Session();
         AddActivity($Session->UserID, 'JoinApproved', T('Welcome Aboard!'), $UserID, '', FALSE);
     }
     return TRUE;
 }
开发者ID:TiGR,项目名称:Garden,代码行数:38,代码来源:class.usermodel.php

示例2: RecordActivity

 public function RecordActivity($Discussion, $ActivityUserID, $CommentID, $SendEmail = '')
 {
     // Get the author of the discussion
     if ($Discussion->InsertUserID != $ActivityUserID) {
         AddActivity($ActivityUserID, 'DiscussionComment', Anchor(Gdn_Format::Text($Discussion->Name), 'discussion/comment/' . $CommentID . '/#Comment_' . $CommentID), $Discussion->InsertUserID, 'discussion/comment/' . $CommentID . '/#Comment_' . $CommentID, $SendEmail);
     }
 }
开发者ID:TiGR,项目名称:Garden,代码行数:7,代码来源:class.commentmodel.php

示例3: AddUserToConversation

 public function AddUserToConversation($ConversationID, $UserID)
 {
     if (!is_array($UserID)) {
         $UserID = array($UserID);
     }
     // First define the current users in the conversation
     $OldContributorData = $this->GetRecipients($ConversationID);
     $OldContributorUserIDs = ConsolidateArrayValuesByKey($OldContributorData->ResultArray(), 'UserID');
     $AddedUserIDs = array();
     // Get some information about this conversation
     $ConversationData = $this->SQL->Select('MessageID', 'max', 'LastMessageID')->Select('MessageID', 'count', 'CountMessages')->From('ConversationMessage')->Where('ConversationID', $ConversationID)->Get()->FirstRow();
     // Add the user(s) if they are not already in the conversation
     foreach ($UserID as $NewUserID) {
         if (!in_array($NewUserID, $OldContributorUserIDs)) {
             $AddedUserIDs[] = $NewUserID;
             $this->SQL->Insert('UserConversation', array('UserID' => $NewUserID, 'ConversationID' => $ConversationID, 'LastMessageID' => $ConversationData->LastMessageID, 'CountMessages' => $ConversationData->CountMessages, 'CountNewMessages' => $ConversationData->CountMessages));
         }
     }
     if (count($AddedUserIDs) > 0) {
         $Session = Gdn::Session();
         // Update the Contributors field on the conversation
         $Contributors = array_unique(array_merge($AddedUserIDs, $OldContributorUserIDs));
         sort($Contributors);
         $this->SQL->Update('Conversation')->Set('Contributors', Format::Serialize($Contributors))->Where('ConversationID', $ConversationID)->Put();
         // NOTIFY ALL NEWLY ADDED USERS THAT THEY WERE ADDED TO THE CONVERSATION
         foreach ($AddedUserIDs as $AddedUserID) {
             AddActivity($Session->UserID, 'AddedToConversation', '', $AddedUserID, '/messages/' . $ConversationID);
         }
         // Update the unread conversation count for each affected user
         $this->SQL->Update('User')->Set('CountUnreadConversations', 'CountUnreadConversations + 1', FALSE)->WhereIn('UserID', $AddedUserIDs)->Put();
     }
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:32,代码来源:class.conversationmodel.php

示例4: RecordActivity

 public function RecordActivity($UserID, $DiscussionID, $DiscussionName)
 {
     // Report that the discussion was created
     AddActivity($UserID, 'NewDiscussion', Anchor(Gdn_Format::Text($DiscussionName), 'vanilla/discussion/' . $DiscussionID . '/' . Gdn_Format::Url($DiscussionName)));
     // Get the user's discussion count
     $Data = $this->SQL->Select('DiscussionID', 'count', 'CountDiscussions')->From('Discussion')->Where('InsertUserID', $UserID)->Get();
     // Save the count to the user table
     $this->SQL->Update('User')->Set('CountDiscussions', $Data->NumRows() > 0 ? $Data->FirstRow()->CountDiscussions : 0)->Where('UserID', $UserID)->Put();
 }
开发者ID:sipp11,项目名称:Garden,代码行数:9,代码来源:class.discussionmodel.php

示例5: RecordActivity

 public function RecordActivity($ReplyCommentID, $ActivityUserID, $CommentID)
 {
     // Get the author of the discussion
     $CommentModel = new CommentModel();
     $Comment = $CommentModel->GetID($ReplyCommentID);
     if ($ActivityUserID != $Comment->InsertUserID) {
         AddActivity($ActivityUserID, 'CommentReply', '', $Comment->InsertUserID, 'discussion/reply/' . $CommentID . '/#Comment_' . $ReplyCommentID);
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:9,代码来源:class.replymodel.php

示例6: RecordAdvancedNotications

 /**
  * Record advanced notifications for users.
  * 
  * @param ActivityModel $ActivityModel
  * @param array $Discussion
  * @param int $CommentID
  * @param array $NotifiedUsers 
  */
 public function RecordAdvancedNotications($ActivityModel, $Discussion, $Comment, &$NotifiedUsers)
 {
     // Grab all of the users that need to be notified.
     $Data = $this->SQL->GetWhere('UserMeta', array('Name' => 'Preferences.Email.NewDiscussion'))->ResultArray();
     // Grab all of their follow/unfollow preferences.
     $UserIDs = ConsolidateArrayValuesByKey($Data, 'UserID');
     $CategoryID = GetValue('CategoryID', $Discussion);
     $UserPrefs = $this->SQL->Select('*')->From('UserCategory')->Where('CategoryID', $CategoryID)->WhereIn('UserID', $UserIDs)->Get()->ResultArray();
     $UserPrefs = Gdn_DataSet::Index($UserPrefs, 'UserID');
     $CommentID = $Comment['CommentID'];
     foreach ($UserIDs as $UserID) {
         //         if ($UserID == $Comment['InsertUserID'])
         //            continue;
         if (in_array($UserID, $NotifiedUsers)) {
             continue;
         }
         if (array_key_exists($UserID, $UserPrefs) && $UserPrefs[$UserID]['Unfollow']) {
             continue;
         }
         $ActivityID = AddActivity($Comment['InsertUserID'], 'NewComment', Gdn_Format::Text(Gdn_Format::To($Comment['Body'], $Comment['Format'])), $UserID, "/discussion/comment/{$CommentID}#Comment_{$CommentID}", TRUE);
         //         $ActivityModel->QueueNotification($ActivityID);
         $NotifiedUsers[] = $UserID;
     }
 }
开发者ID:Raz0r,项目名称:Garden,代码行数:32,代码来源:class.commentmodel.php

示例7: Approve

 public function Approve($UserID, $Email)
 {
     // Make sure the $UserID is an applicant
     $RoleData = $this->GetRoles($UserID);
     if ($RoleData->NumRows() == 0) {
         throw new Exception(Gdn::Translate('ErrorRecordNotFound'));
     } else {
         $ApplicantFound = FALSE;
         foreach ($RoleData->Result() as $Role) {
             if ($Role->RoleID == 4) {
                 $ApplicantFound = TRUE;
             }
         }
     }
     if ($ApplicantFound) {
         // Retrieve the default role(s) for new users
         $RoleIDs = Gdn::Config('Garden.Registration.DefaultRoles', array(8));
         // Wipe out old & insert new roles for this user
         $this->SaveRoles($UserID, $RoleIDs);
         // Send out a notification to the user
         $SignInUrl = CombinePaths(array(Gdn_Url::WebRoot(TRUE), 'entry', 'signin'), '/');
         $User = $this->Get($UserID);
         if ($User) {
             $Email->Subject(Gdn::Translate('MembershipApprovedSubject'));
             $Email->Message(sprintf(Gdn::Translate('MembershipApprovedEmail'), $User->Name, $SignInUrl));
             $Email->To($User->Email);
             $Email->Send();
         }
         // Report that the user was approved
         $Session = Gdn::Session();
         AddActivity($UserID, 'JoinApproved', Gdn::Translate('Welcome Aboard!'), $Session->UserID);
     }
     return TRUE;
 }
开发者ID:jhampha,项目名称:Garden,代码行数:34,代码来源:class.usermodel.php

示例8: SaveUser

 public function SaveUser($User, $BannedValue)
 {
     $Banned = $User['Banned'];
     if ($Banned == $BannedValue) {
         return;
     }
     // Add the activity.
     $ActivityType = $BannedValue ? 'Banned' : 'Unbanned';
     AddActivity(Gdn::Session()->UserID, $ActivityType, '', $User['UserID']);
     $this->SQL->Update('User u')->Set('u.Banned', $BannedValue)->Where('u.UserID', $User['UserID'])->Put();
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:11,代码来源:class.banmodel.php

示例9: NotifyNewDiscussion

 public function NotifyNewDiscussion($Discussion)
 {
     if (is_numeric($Discussion)) {
         $Discussion = $this->GetID($Discussion);
     }
     // Grab all of the users that need to be notified.
     $Data = $this->SQL->GetWhere('UserMeta', array('Name' => 'Preferences.Email.NewDiscussion'))->ResultArray();
     // Grab all of their follow/unfollow preferences.
     $UserIDs = ConsolidateArrayValuesByKey($Data, 'UserID');
     $CategoryID = $Discussion['CategoryID'];
     $UserPrefs = $this->SQL->Select('*')->From('UserCategory')->Where('CategoryID', $CategoryID)->WhereIn('UserID', $UserIDs)->Get()->ResultArray();
     $UserPrefs = Gdn_DataSet::Index($UserPrefs, 'UserID');
     foreach ($Data as $Row) {
         $UserID = $Row['UserID'];
         if ($UserID == $Discussion['InsertUserID']) {
             continue;
         }
         if (array_key_exists($UserID, $UserPrefs) && $UserPrefs[$UserID]['Unfollow']) {
             continue;
         }
         AddActivity($Discussion['InsertUserID'], 'NewDiscussion', Anchor(Gdn_Format::Text($Discussion['Name']), ExternalUrl('discussion/' . $Discussion['DiscussionID'] . '/' . Gdn_Format::Url($Discussion['Name']))), $UserID, '/discussion/' . $Discussion['DiscussionID'] . '/' . Gdn_Format::Url($Discussion['Name']), TRUE);
     }
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:23,代码来源:class.discussionmodel.php

示例10: AddUserToConversation

 /**
  * Add another user to the conversation.
  * 
  * @since 2.0.0
  * @access public
  *
  * @param int $ConversationID Unique ID of conversation effected.
  * @param int $UserID Unique ID of current user.
  */
 public function AddUserToConversation($ConversationID, $UserID)
 {
     if (!is_array($UserID)) {
         $UserID = array($UserID);
     }
     // First define the current users in the conversation
     $OldContributorData = $this->GetRecipients($ConversationID);
     $OldContributorData = Gdn_DataSet::Index($OldContributorData, 'UserID');
     $AddedUserIDs = array();
     // Get some information about this conversation
     $ConversationData = $this->SQL->Select('LastMessageID')->Select('CountMessages')->From('Conversation')->Where('ConversationID', $ConversationID)->Get()->FirstRow();
     // Add the user(s) if they are not already in the conversation
     foreach ($UserID as $NewUserID) {
         if (!array_key_exists($NewUserID, $OldContributorData)) {
             $AddedUserIDs[] = $NewUserID;
             $this->SQL->Insert('UserConversation', array('UserID' => $NewUserID, 'ConversationID' => $ConversationID, 'LastMessageID' => $ConversationData->LastMessageID, 'CountReadMessages' => 0));
         } elseif ($OldContributorData[$NewUserID]->Deleted) {
             $AddedUserIDs[] = $NewUserID;
             $this->SQL->Put('UserConversation', array('Deleted' => 0), array('ConversationID' => $ConversationID, 'UserID' => $NewUserID));
         }
     }
     if (count($AddedUserIDs) > 0) {
         $Session = Gdn::Session();
         // Update the Contributors field on the conversation
         $Contributors = array_unique(array_merge($AddedUserIDs, array_keys($OldContributorData)));
         sort($Contributors);
         $this->SQL->Update('Conversation')->Set('Contributors', Gdn_Format::Serialize($Contributors))->Where('ConversationID', $ConversationID)->Put();
         foreach ($AddedUserIDs as $AddedUserID) {
             // And notify them that they were added to the conversation
             AddActivity($Session->UserID, 'AddedToConversation', '', $AddedUserID, '/messages/' . $ConversationID);
         }
         $this->UpdateUserUnreadCount($AddedUserIDs);
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:43,代码来源:class.conversationmodel.php

示例11: NotifyNewDiscussion

   public function NotifyNewDiscussion($Discussion) {
      if (is_numeric($Discussion)) {
         $Discussion = $this->GetID($Discussion);
      }

      // Grab all of the users that are need to be notified.
      $Data = $this->SQL->GetWhere('UserMeta', array('Name' => 'Preferences.Email.NewDiscussion'))->ResultArray();

      foreach ($Data as $Row) {
         $UserID = $Row['UserID'];
         if ($UserID == $Discussion['InsertUserID'])
            continue;

         AddActivity($Discussion['InsertUserID'],
            'NewDiscussion',
            Anchor(Gdn_Format::Text($Discussion['Name']), ExternalUrl('discussion/'.$Discussion['DiscussionID'].'/'.Gdn_Format::Url($Discussion['Name']))),
            $UserID,
            '/discussion/'.$Discussion['DiscussionID'].'/'.Gdn_Format::Url($Discussion['Name']),
            TRUE);
      }
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:21,代码来源:class.discussionmodel.php

示例12: nl2br

     if ($uploadOk == 0) {
         echo nl2br("\r\n Error 64: Sorry, your file was not uploaded.");
         echo nl2br("\r\nYou will be redirected to the upload page in 5 seconds.");
         header('refresh: 5; url=upload.html');
         // if everything is ok, try to upload file
     } else {
         if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
             echo nl2br("\r\nThe file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded.");
             $Query = 'CALL UpdateDocument (?, ?, ?)';
             $Statement = $PDOconn->prepare($Query);
             $Statement->bindParam(1, $filename, PDO::PARAM_STR, 255);
             $Statement->bindParam(2, $Email, PDO::PARAM_STR, 45);
             $Statement->bindParam(3, $Name, PDO::PARAM_STR, 45);
             $Statement->execute();
             $ActivityMSG = "You uploaded " . $Name . "'s document.";
             AddActivity($Email, $ActivityMSG);
             $Action = "Upload";
             $AdminAccounts = FetchAdmins($Action);
             foreach ($AdminAccounts as $AdminEmail) {
                 mail($AdminEmail['Email'], "Pet document uploaded", "The following account: " . $Email . " has uploaded the pet documentation for " . $Name . ".  Pet is awaiting your approval.");
             }
             echo nl2br("\r\nYou will be redirected to the homepage in 5 seconds.");
             header('refresh: 5; url=index.html');
         } else {
             echo nl2br("\r\n Error 65: Sorry, there was an error uploading your file.");
             echo nl2br("\r\nYou will be redirected to the upload page in 5 seconds.");
             header('refresh: 5; url=upload.html');
         }
     }
 } else {
     echo nl2br("\r\n Error 63: Sorry, you don't have a pet named " . $Name . ".");
开发者ID:alibkaba,项目名称:petsignin,代码行数:31,代码来源:upload.php

示例13: RecordActivity

 public function RecordActivity($DiscussionID, $ActivityUserID, $CommentID)
 {
     // Get the author of the discussion
     $DiscussionModel = new Gdn_DiscussionModel();
     $Discussion = $DiscussionModel->GetID($DiscussionID);
     if ($Discussion->InsertUserID != $ActivityUserID) {
         AddActivity($ActivityUserID, 'DiscussionComment', '', $Discussion->InsertUserID, 'discussion/comment/' . $CommentID . '/#Comment_' . $CommentID);
     }
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:9,代码来源:class.commentmodel.php

示例14: SignOut

function SignOut($Action)
{
    $Email = ValidateSession($Action);
    DeleteSession($Action, $Email);
    $ActivityMSG = "You signed out.";
    AddActivity($Action, $Email, $ActivityMSG);
    session_unset();
    session_destroy();
    echo json_encode("refresh");
}
开发者ID:alibkaba,项目名称:petsignin,代码行数:10,代码来源:operations.php

示例15: error_reporting

require_once '../db.php';
require_once '../operations.php';
error_reporting(E_ALL);
ini_set('display_errors', 1);
if (isset($_POST['add'])) {
    $Action = "admin.php";
    $Email = $_POST['Email'];
    $Password = $_POST['Password'];
    $HashedPassword = HashIt($Password);
    $Disabled = 0;
    $Attempt = 0;
    $AdminCode = 2;
    global $PDOconn;
    $Query = 'CALL AddAdminAccount (?,?,?,?,?)';
    $Statement = $PDOconn->prepare($Query);
    $Statement->bindParam(1, $Email, PDO::PARAM_STR, 45);
    $Statement->bindParam(2, $HashedPassword, PDO::PARAM_STR, 255);
    $Statement->bindParam(3, $Disabled, PDO::PARAM_INT, 1);
    $Statement->bindParam(4, $Attempt, PDO::PARAM_INT, 1);
    $Statement->bindParam(5, $AdminCode, PDO::PARAM_INT, 1);
    $Statement->execute();
    $ActivityMSG = "Your account was created by an admin.";
    AddActivity($Action, $Email, $ActivityMSG);
    $MSG = "Super Admin created.";
    $PDOconn = null;
    echo "<script type='text/javascript'>alert('{$MSG}'); window.location = \"/petsignin/sa/admin.php\";</script>";
}
?>
</form>
</body>
</html>
开发者ID:alibkaba,项目名称:petsignin,代码行数:31,代码来源:admin.php


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