original_string: public function Add($ActivityUserID, $ActivityType, $Story = NULL, $RegardingUserID = NULL, $CommentActivityID = NULL, $Route = NULL, $SendEmail = '') {
        static $ActivityTypes = array();
  
        // Get the ActivityTypeID & see if this is a notification.
        $ActivityTypeRow = self::GetActivityType($ActivityType);
           
        if ($ActivityTypeRow !== FALSE) {
           $ActivityTypeID = $ActivityTypeRow['ActivityTypeID'];
           $Notify = (bool)$ActivityTypeRow['Notify'];
        } else {
           trigger_error(ErrorMessage(sprintf('Activity type could not be found: %s', $ActivityType), 'ActivityModel', 'Add'), E_USER_ERROR);
        }
        
        $Activity = array(
            'ActivityUserID' => $ActivityUserID,
            'ActivityType' => $ActivityType,
            'Story' => $Story,
            'RegardingUserID' => $RegardingUserID,
            'Route' => $Route
        );
        
  
        // Massage $SendEmail to allow for only sending an email.
        $QueueEmail = FALSE;
        if ($SendEmail === 'Only') {
           $SendEmail = '';
           $AddActivity = FALSE;
        } else if ($SendEmail === 'QueueOnly') {
           $SendEmail = '';
           $QueueEmail = TRUE;
           $AddActivity = TRUE;
           $Notify = TRUE;
        } else {
           $AddActivity = TRUE;
        }
        
        // If $SendEmail was FALSE or TRUE, let it override the $Notify setting.
        if ($SendEmail === FALSE || $SendEmail === TRUE)
           $Notify = $SendEmail;
        
        $Preference = FALSE;
        if (($ActivityTypeRow['Notify'] || !$ActivityTypeRow['Public']) && $RegardingUserID) {
           $Activity['NotifyUserID'] = $Activity['RegardingUserID'];
           $Preference = $ActivityType;
        } else {
           $Activity['NotifyUserID'] = self::NOTIFY_PUBLIC;
        }
  
        // Otherwise let the decision to email lie with the $Notify setting.
        if ($SendEmail == 'Force' || $Notify) {
           $Activity['Emailed'] = self::SENT_PENDING;
        } elseif ($Notify) {
           $Activity['Emailed'] = self::SENT_PENDING;
        } elseif ($SendEmail === FALSE) {
           $Activity['Emailed'] = self::SENT_ARCHIVE;
        }
        
        $Activity = $this->Save($Activity, $Preference);
        
        return GetValue('ActivityID', $Activity);
     }
code: public function Add($ActivityUserID, $ActivityType, $Story = NULL, $RegardingUserID = NULL, $CommentActivityID = NULL, $Route = NULL, $SendEmail = '') {
        static $ActivityTypes = array();
  
        // Get the ActivityTypeID & see if this is a notification.
        $ActivityTypeRow = self::GetActivityType($ActivityType);
           
        if ($ActivityTypeRow !== FALSE) {
           $ActivityTypeID = $ActivityTypeRow['ActivityTypeID'];
           $Notify = (bool)$ActivityTypeRow['Notify'];
        } else {
           trigger_error(ErrorMessage(sprintf('Activity type could not be found: %s', $ActivityType), 'ActivityModel', 'Add'), E_USER_ERROR);
        }
        
        $Activity = array(
            'ActivityUserID' => $ActivityUserID,
            'ActivityType' => $ActivityType,
            'Story' => $Story,
            'RegardingUserID' => $RegardingUserID,
            'Route' => $Route
        );
        
  
        // Massage $SendEmail to allow for only sending an email.
        $QueueEmail = FALSE;
        if ($SendEmail === 'Only') {
           $SendEmail = '';
           $AddActivity = FALSE;
        } else if ($SendEmail === 'QueueOnly') {
           $SendEmail = '';
           $QueueEmail = TRUE;
           $AddActivity = TRUE;
           $Notify = TRUE;
        } else {
           $AddActivity = TRUE;
        }
        
        // If $SendEmail was FALSE or TRUE, let it override the $Notify setting.
        if ($SendEmail === FALSE || $SendEmail === TRUE)
           $Notify = $SendEmail;
        
        $Preference = FALSE;
        if (($ActivityTypeRow['Notify'] || !$ActivityTypeRow['Public']) && $RegardingUserID) {
           $Activity['NotifyUserID'] = $Activity['RegardingUserID'];
           $Preference = $ActivityType;
        } else {
           $Activity['NotifyUserID'] = self::NOTIFY_PUBLIC;
        }
  
        // Otherwise let the decision to email lie with the $Notify setting.
        if ($SendEmail == 'Force' || $Notify) {
           $Activity['Emailed'] = self::SENT_PENDING;
        } elseif ($Notify) {
           $Activity['Emailed'] = self::SENT_PENDING;
        } elseif ($SendEmail === FALSE) {
           $Activity['Emailed'] = self::SENT_ARCHIVE;
        }
        
        $Activity = $this->Save($Activity, $Preference);
        
        return GetValue('ActivityID', $Activity);
     }
code_tokens: public function Add ( $ ActivityUserID , $ ActivityType , $ Story = NULL , $ RegardingUserID = NULL , $ CommentActivityID = NULL , $ Route = NULL , $ SendEmail = '' ) { static $ ActivityTypes = array ( ) ; // Get the ActivityTypeID & see if this is a notification. $ ActivityTypeRow = self :: GetActivityType ( $ ActivityType ) ; if ( $ ActivityTypeRow !== FALSE ) { $ ActivityTypeID = $ ActivityTypeRow [ 'ActivityTypeID' ] ; $ Notify = ( bool ) $ ActivityTypeRow [ 'Notify' ] ; } else { trigger_error ( ErrorMessage ( sprintf ( 'Activity type could not be found: %s' , $ ActivityType ) , 'ActivityModel' , 'Add' ) , E_USER_ERROR ) ; } $ Activity = array ( 'ActivityUserID' => $ ActivityUserID , 'ActivityType' => $ ActivityType , 'Story' => $ Story , 'RegardingUserID' => $ RegardingUserID , 'Route' => $ Route ) ; // Massage $SendEmail to allow for only sending an email. $ QueueEmail = FALSE ; if ( $ SendEmail === 'Only' ) { $ SendEmail = '' ; $ AddActivity = FALSE ; } else if ( $ SendEmail === 'QueueOnly' ) { $ SendEmail = '' ; $ QueueEmail = TRUE ; $ AddActivity = TRUE ; $ Notify = TRUE ; } else { $ AddActivity = TRUE ; } // If $SendEmail was FALSE or TRUE, let it override the $Notify setting. if ( $ SendEmail === FALSE || $ SendEmail === TRUE ) $ Notify = $ SendEmail ; $ Preference = FALSE ; if ( ( $ ActivityTypeRow [ 'Notify' ] || ! $ ActivityTypeRow [ 'Public' ] ) && $ RegardingUserID ) { $ Activity [ 'NotifyUserID' ] = $ Activity [ 'RegardingUserID' ] ; $ Preference = $ ActivityType ; } else { $ Activity [ 'NotifyUserID' ] = self :: NOTIFY_PUBLIC ; } // Otherwise let the decision to email lie with the $Notify setting. if ( $ SendEmail == 'Force' || $ Notify ) { $ Activity [ 'Emailed' ] = self :: SENT_PENDING ; } elseif ( $ Notify ) { $ Activity [ 'Emailed' ] = self :: SENT_PENDING ; } elseif ( $ SendEmail === FALSE ) { $ Activity [ 'Emailed' ] = self :: SENT_ARCHIVE ; } $ Activity = $ this -> Save ( $ Activity , $ Preference ) ; return GetValue ( 'ActivityID' , $ Activity ) ; }
docstring: Add a new activity item.
  
  Getting reworked for 2.1 so I'm cheating and skipping params for now. -mlr
  
  @since 2.0.0
  @access public
  @param int $ActivityUserID
  @param string $ActivityType
  @param string $Story
  @param int $RegardingUserID
  @param int $CommentActivityID
  @param string $Route
  @param mixed $SendEmail
  @return int ActivityID of item created.
docstring_tokens: Add a new activity item .