Esempio n. 1
0
function WriteActivity($Activity, &$Sender, &$Session, $Comment)
{
    $Activity = (object) $Activity;
    // If this was a status update or a wall comment, don't bother with activity strings
    $ActivityType = explode(' ', $Activity->ActivityType);
    // Make sure you strip out any extra css classes munged in here
    $ActivityType = $ActivityType[0];
    $Author = UserBuilder($Activity, 'Activity');
    $PhotoAnchor = UserPhoto($Author, 'Photo');
    $CssClass = 'Item Activity ' . $ActivityType;
    if ($PhotoAnchor != '') {
        $CssClass .= ' HasPhoto';
    }
    if (in_array($ActivityType, array('WallComment', 'WallPost', 'AboutUpdate'))) {
        $CssClass .= ' Condensed';
    }
    $Title = '';
    $Excerpt = $Activity->Story;
    if (!in_array($ActivityType, array('WallComment', 'WallPost', 'AboutUpdate'))) {
        $Title = '<div class="Title">' . Gdn_Format::ActivityHeadline($Activity, $Sender->ProfileUserID) . '</div>';
    } else {
        if ($ActivityType == 'WallPost') {
            $RegardingUser = UserBuilder($Activity, 'Regarding');
            $PhotoAnchor = UserPhoto($RegardingUser);
            $Title = '<div class="Title">' . UserAnchor($RegardingUser, 'Name') . ' <span>&rarr;</span> ' . UserAnchor($Author, 'Title Name') . '</div>';
            $Excerpt = Gdn_Format::Display($Excerpt);
        } else {
            $Title = UserAnchor($Author, 'Title Name');
            $Excerpt = Gdn_Format::Display($Excerpt);
        }
    }
    $Sender->EventArguments['Activity'] =& $Activity;
    $Sender->EventArguments['CssClass'] =& $CssClass;
    $Sender->FireEvent('BeforeActivity');
    ?>
<li id="Activity_<?php 
    echo $Activity->ActivityID;
    ?>
" class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($Session->IsValid() && ($Session->UserID == $Activity->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete'))) {
        echo '<div class="OptionButton">' . Anchor(T('Activity.Delete', 'Delete'), 'dashboard/activity/delete/' . $Activity->ActivityID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'Delete') . '</div>';
    }
    if ($PhotoAnchor != '') {
        ?>
   <div class="Author Photo"><?php 
        echo $PhotoAnchor;
        ?>
</div>
   <?php 
    }
    ?>
   <div class="ItemContent Activity">
      <?php 
    echo $Title;
    ?>
      <div class="Excerpt"><?php 
    echo $Excerpt;
    ?>
</div>
      <div class="Meta">
         <span class="DateCreated"><?php 
    echo Gdn_Format::Date($Activity->DateInserted);
    ?>
</span>
         <?php 
    if ($Activity->AllowComments == '1' && $Session->IsValid()) {
        echo '<span class="AddComment">' . Anchor(T('Activity.Comment', 'Comment'), '#CommentForm_' . $Activity->ActivityID, 'CommentOption') . '</span>';
    }
    $Sender->FireEvent('AfterMeta');
    ?>
      </div>
   </div>
   <?php 
    if ($Activity->AllowComments == '1') {
        // If there are comments, show them
        $FoundComments = FALSE;
        if (property_exists($Sender, 'CommentData') && is_object($Sender->CommentData)) {
            foreach ($Sender->CommentData->Result() as $Comment) {
                if (is_object($Comment) && $Comment->CommentActivityID == $Activity->ActivityID) {
                    if ($FoundComments == FALSE) {
                        echo '<ul class="DataList ActivityComments">';
                    }
                    $FoundComments = TRUE;
                    WriteActivityComment($Comment, $Sender, $Session);
                }
            }
        }
        if ($FoundComments == FALSE) {
            echo '<ul class="DataList ActivityComments Hidden">';
        }
        if ($Session->IsValid()) {
            ?>
         <li class="CommentForm">
         <?php 
            echo Anchor(T('Write a comment'), '/dashboard/activity/comment/' . $Activity->ActivityID, 'CommentLink');
            $CommentForm = Gdn::Factory('Form');
            $CommentForm->SetModel($Sender->ActivityModel);
            $CommentForm->AddHidden('ActivityID', $Activity->ActivityID);
            $CommentForm->AddHidden('Return', Gdn_Url::Request());
            echo $CommentForm->Open(array('action' => Url('/dashboard/activity/comment'), 'class' => 'Hidden'));
            echo $CommentForm->TextBox('Body', array('MultiLine' => TRUE, 'value' => ''));
            echo $CommentForm->Close('Comment');
            ?>
</li>
      <?php 
        }
        ?>
      </ul>
   <?php 
    }
    ?>
</li>
<?php 
}
Esempio n. 2
0
function WriteActivity($Activity, &$Sender, &$Session, $Comment)
{
    ?>
<li id="Activity_<?php 
    echo $Activity->ActivityID;
    ?>
" class="Activity<?php 
    echo ' ' . $Activity->ActivityType;
    ?>
"><?php 
    if ($Session->IsValid() && ($Session->UserID == $Activity->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete'))) {
        echo Anchor('Delete', 'garden/activity/delete/' . $Activity->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'Delete');
    }
    if ($Activity->ActivityPhoto != '' && $Activity->ShowIcon == '1') {
        if ($Activity->InsertUserID == $Session->UserID) {
            echo '<a href="' . Url('/garden/profile/' . urlencode($Activity->ActivityName)) . '">' . $Sender->Html->Image('uploads/n' . $Activity->ActivityPhoto) . '</a>';
        } else {
            echo $Sender->Html->Image('uploads/n' . $Activity->ActivityPhoto);
        }
    }
    ?>
<h3><?php 
    echo Format::ActivityHeadline($Activity, $Sender->ProfileUserID);
    ?>
<em><?php 
    echo Format::Date($Activity->DateInserted);
    ?>
</em><?php 
    echo $Activity->AllowComments == '1' && $Session->IsValid() ? ' ' . Anchor('Comment', '#CommentForm_' . $Activity->ActivityID, 'CommentOption') : '';
    ?>
</h3><?php 
    if ($Activity->Story != '') {
        ?>
<blockquote><?php 
        echo $Activity->Story;
        // story should be cleaned before being saved.
        ?>
</blockquote>
   <?php 
    }
    if ($Activity->AllowComments == '1') {
        // If there are comments, show them
        if (is_object($Comment) && $Comment->CommentActivityID == $Activity->ActivityID) {
            ?>
<ul class="Comments"><?php 
            while (is_object($Comment) && $Comment->CommentActivityID == $Activity->ActivityID) {
                if (is_object($Comment)) {
                    WriteActivityComment($Comment, $Sender, $Session);
                }
                $Comment = $Sender->CommentData->NextRow();
            }
        } else {
            ?>
<ul class="Comments Hidden"><?php 
        }
        if ($Session->IsValid()) {
            ?>
            <li class="CommentForm">
            <?php 
            echo Anchor('Write a comment', '/garden/activity/comment/' . $Activity->ActivityID, 'CommentLink');
            $CommentForm = new Form();
            $CommentForm->SetModel($Sender->ActivityModel);
            $CommentForm->AddHidden('ActivityID', $Activity->ActivityID);
            $CommentForm->AddHidden('Return', Gdn_Url::Request());
            echo $CommentForm->Open(array('action' => Url('/garden/activity/comment'), 'class' => 'Hidden'));
            echo $CommentForm->TextBox('Body', array('MultiLine' => TRUE, 'value' => ''));
            echo $CommentForm->Close('Comment');
            ?>
</li>
         <?php 
        }
        ?>
         </ul>
      <?php 
    }
    ?>
</li>
<?php 
}
Esempio n. 3
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
$Session = Gdn::session();
if (!property_exists($this, 'ProfileUserID')) {
    $this->ProfileUserID = '';
}
if (!function_exists('WriteActivityComment')) {
    include $this->fetchViewLocation('helper_functions', 'activity');
}
if ($this->data('Comment')) {
    WriteActivityComment($this->data('Comment'), $this, $Session);
}
Esempio n. 4
0
function WriteActivity($Activity, &$Sender, &$Session)
{
    $Activity = (object) $Activity;
    // If this was a status update or a wall comment, don't bother with activity strings
    $ActivityType = explode(' ', $Activity->ActivityType);
    // Make sure you strip out any extra css classes munged in here
    $ActivityType = $ActivityType[0];
    $Author = UserBuilder($Activity, 'Activity');
    $PhotoAnchor = Anchor(Img($Activity->Photo, array('class' => 'ProfilePhoto ProfilePhotoMedium')), $Activity->PhotoUrl, 'PhotoWrap');
    $CssClass = 'Item Activity Activity-' . $ActivityType;
    if ($PhotoAnchor != '') {
        $CssClass .= ' HasPhoto';
    }
    $Format = GetValue('Format', $Activity);
    $Title = '';
    $Excerpt = $Activity->Story;
    if ($Format) {
        $Excerpt = Gdn_Format::To($Excerpt, $Format);
    }
    if (!in_array($ActivityType, array('WallComment', 'WallPost', 'AboutUpdate'))) {
        $Title = '<div class="Title">' . GetValue('Headline', $Activity) . '</div>';
    } else {
        if ($ActivityType == 'WallPost') {
            $RegardingUser = UserBuilder($Activity, 'Regarding');
            $PhotoAnchor = UserPhoto($RegardingUser);
            $Title = '<div class="Title">' . UserAnchor($RegardingUser, 'Name') . ' <span>&rarr;</span> ' . UserAnchor($Author, 'Name') . '</div>';
            if (!$Format) {
                $Excerpt = Gdn_Format::Display($Excerpt);
            }
        } else {
            $Title = UserAnchor($Author, 'Name');
            if (!$Format) {
                $Excerpt = Gdn_Format::Display($Excerpt);
            }
        }
    }
    $Sender->EventArguments['Activity'] =& $Activity;
    $Sender->EventArguments['CssClass'] =& $CssClass;
    $Sender->FireEvent('BeforeActivity');
    ?>
<li id="Activity_<?php 
    echo $Activity->ActivityID;
    ?>
" class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($Session->IsValid() && ($Session->UserID == $Activity->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete'))) {
        echo '<div class="Options">' . Anchor('×', 'dashboard/activity/delete/' . $Activity->ActivityID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'Delete') . '</div>';
    }
    if ($PhotoAnchor != '') {
        ?>
   <div class="Author Photo"><?php 
        echo $PhotoAnchor;
        ?>
</div>
   <?php 
    }
    ?>
   <div class="ItemContent Activity">
      <?php 
    echo $Title;
    ?>
      <div class="Excerpt"><?php 
    echo $Excerpt;
    ?>
</div>
      <?php 
    $Sender->EventArguments['Activity'] = $Activity;
    $Sender->FireAs('ActivityController')->FireEvent('AfterActivityBody');
    ?>
      <div class="Meta">
         <span class="MItem DateCreated"><?php 
    echo Gdn_Format::Date($Activity->DateUpdated);
    ?>
</span>
         <?php 
    $SharedString = FALSE;
    $ID = GetValue('SharedNotifyUserID', $Activity->Data);
    if (!$ID) {
        $ID = GetValue('CommentNotifyUserID', $Activity->Data);
    }
    if ($ID) {
        $SharedString = FormatString(T('Comments are between {UserID,you}.'), array('UserID' => array($Activity->NotifyUserID, $ID)));
    }
    $AllowComments = $Activity->NotifyUserID < 0 || $SharedString;
    if ($AllowComments && $Session->CheckPermission('Garden.Profiles.Edit')) {
        echo '<span class="MItem AddComment">' . Anchor(T('Activity.Comment', 'Comment'), '#CommentForm_' . $Activity->ActivityID, 'CommentOption');
    }
    if ($SharedString) {
        echo ' <span class="MItem"><i>' . $SharedString . '</i></span>';
    }
    echo '</span>';
    $Sender->FireEvent('AfterMeta');
    ?>
      </div>
   </div>
   <?php 
    $Comments = GetValue('Comments', $Activity, array());
    if (count($Comments) > 0) {
        echo '<ul class="DataList ActivityComments">';
        foreach ($Comments as $Comment) {
            WriteActivityComment($Comment, $Sender, $Session);
        }
    } else {
        echo '<ul class="DataList ActivityComments Hidden">';
    }
    if ($Session->CheckPermission('Garden.Profiles.Edit')) {
        ?>
      <li class="CommentForm">
      <?php 
        echo Anchor(T('Write a comment'), '/dashboard/activity/comment/' . $Activity->ActivityID, 'CommentLink');
        $CommentForm = Gdn::Factory('Form');
        $CommentForm->SetModel($Sender->ActivityModel);
        $CommentForm->AddHidden('ActivityID', $Activity->ActivityID);
        $CommentForm->AddHidden('Return', Gdn_Url::Request());
        echo $CommentForm->Open(array('action' => Url('/dashboard/activity/comment'), 'class' => 'Hidden'));
        echo '<div class="TextBoxWrapper">' . $CommentForm->TextBox('Body', array('MultiLine' => TRUE, 'value' => '')) . '</div>';
        echo $CommentForm->Close('Comment');
        ?>
</li>
   <?php 
    }
    echo '</ul>';
    ?>
</li>
<?php 
}
Esempio n. 5
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
$Session = Gdn::Session();
if (!property_exists($this, 'ProfileUserID')) {
    $this->ProfileUserID = '';
}
if (!function_exists('WriteActivityComment')) {
    include $this->FetchViewLocation('helper_functions', 'activity');
}
WriteActivityComment($this->Comment, $this, $Session);
Esempio n. 6
0
function WriteActivity($Activity, &$Sender, &$Session, $Comment)
{
    ?>
<li id="Activity_<?php 
    echo $Activity->ActivityID;
    ?>
" class="Activity<?php 
    echo ' ' . $Activity->ActivityType;
    if ($Activity->ActivityPhoto != '' && $Activity->ShowIcon == '1') {
        echo ' HasPhoto';
    }
    ?>
"><?php 
    if ($Session->IsValid() && ($Session->UserID == $Activity->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete'))) {
        echo Anchor('Delete', 'garden/activity/delete/' . $Activity->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'Delete');
    }
    // If this was a status update or a wall comment, don't bother with activity strings
    $ActivityType = explode(' ', $Activity->ActivityType);
    // Make sure you strip out any extra css classes munged in here
    $ActivityType = $ActivityType[0];
    if (in_array($ActivityType, array('WallComment', 'AboutUpdate'))) {
        if ($Activity->ActivityPhoto != '') {
            echo '<a href="' . Url('/garden/profile/' . urlencode($Activity->ActivityName)) . '" class="Photo">' . $Sender->Html->Image('uploads/n' . $Activity->ActivityPhoto) . '</a>';
        }
        echo '<div>';
        echo UserAnchor($Activity->ActivityName, 'Name');
        if ($Activity->ActivityType == 'WallComment' && $Activity->RegardingUserID > 0 && (!property_exists($Sender, 'ProfileUserID') || $Sender->ProfileUserID != $Activity->RegardingUserID)) {
            echo '<span>&gt;</span>' . UserAnchor($Activity->RegardingName, 'Name');
        }
        echo Format::Display($Activity->Story);
        echo '<div class="Meta">';
        echo Format::Date($Activity->DateInserted);
        echo $Activity->AllowComments == '1' && $Session->IsValid() ? '<span>&bull;</span>' . Anchor('Comment', '#CommentForm_' . $Activity->ActivityID, 'CommentOption') : '';
        echo '</div>';
        echo '</div>';
    } else {
        if ($Activity->ActivityPhoto != '' && $Activity->ShowIcon == '1') {
            echo '<a href="' . Url('/garden/profile/' . urlencode($Activity->ActivityName)) . '" class="Photo">' . $Sender->Html->Image('uploads/n' . $Activity->ActivityPhoto) . '</a>';
        }
        echo '<div>';
        echo Format::ActivityHeadline($Activity, $Sender->ProfileUserID);
        echo '<div class="Meta">';
        echo Format::Date($Activity->DateInserted);
        echo $Activity->AllowComments == '1' && $Session->IsValid() ? '<span>&bull;</span>' . Anchor('Comment', '#CommentForm_' . $Activity->ActivityID, 'CommentOption') : '';
        if ($Activity->Story != '') {
            echo '<div class="Story">';
            echo $Activity->Story;
            // story should be cleaned before being saved.
            echo '</div>';
        }
        echo '</div>';
        echo '</div>';
    }
    if ($Activity->AllowComments == '1') {
        // If there are comments, show them
        $FoundComments = FALSE;
        if (property_exists($Sender, 'CommentData') && is_object($Sender->CommentData)) {
            foreach ($Sender->CommentData->Result() as $Comment) {
                if (is_object($Comment) && $Comment->CommentActivityID == $Activity->ActivityID) {
                    if ($FoundComments == FALSE) {
                        echo '<ul class="Comments">';
                    }
                    $FoundComments = TRUE;
                    WriteActivityComment($Comment, $Sender, $Session);
                }
            }
        }
        if ($FoundComments == FALSE) {
            echo '<ul class="Comments Hidden">';
        }
        if ($Session->IsValid()) {
            ?>
         <li class="CommentForm">
         <?php 
            echo Anchor('Write a comment', '/garden/activity/comment/' . $Activity->ActivityID, 'CommentLink');
            $CommentForm = Gdn::Factory('Form');
            $CommentForm->SetModel($Sender->ActivityModel);
            $CommentForm->AddHidden('ActivityID', $Activity->ActivityID);
            $CommentForm->AddHidden('Return', Gdn_Url::Request());
            echo $CommentForm->Open(array('action' => Url('/garden/activity/comment'), 'class' => 'Hidden'));
            echo $CommentForm->TextBox('Body', array('MultiLine' => TRUE, 'value' => ''));
            echo $CommentForm->Close('Comment');
            ?>
</li>
      <?php 
        }
        ?>
      </ul>
   <?php 
    }
    ?>
</li>
<?php 
}