예제 #1
0
function WriteModuleDiscussion($Discussion, $Px = 'Bookmark')
{
    ?>
<li id="<?php 
    echo "{$Px}_{$Discussion->DiscussionID}";
    ?>
" class="<?php 
    echo CssClass($Discussion);
    ?>
">
   <span class="Options">
      <?php 
    //      echo OptionsList($Discussion);
    echo BookmarkButton($Discussion);
    ?>
   </span>
   <div class="Title"><?php 
    echo Anchor(Gdn_Format::Text($Discussion->Name, FALSE), DiscussionUrl($Discussion) . ($Discussion->CountCommentWatch > 0 ? '#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink');
    ?>
</div>
   <div class="Meta">
      <?php 
    $Last = new stdClass();
    $Last->UserID = $Discussion->LastUserID;
    $Last->Name = $Discussion->LastName;
    echo NewComments($Discussion);
    echo '<span class="MItem">' . Gdn_Format::Date($Discussion->LastDate, 'html') . UserAnchor($Last) . '</span>';
    ?>
   </div>
</li>
<?php 
}
    public function ToString()
    {
        $String = '';
        ob_start();
        ?>
      <div class="Box">
         <h4><?php 
        echo T('In this Discussion');
        ?>
</h4>
         <ul class="PanelInfo">
         <?php 
        foreach ($this->_UserData->Result() as $User) {
            ?>
            <li>
               <strong><?php 
            echo UserAnchor($User, 'UserLink');
            ?>
</strong>
               <?php 
            echo Gdn_Format::Date($User->DateLastActive);
            ?>
            </li>
            <?php 
        }
        ?>
         </ul>
      </div>
      <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
예제 #3
0
function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
    $CssClass = 'Item';
    $CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
    $CssClass .= $Alt . ' ';
    $CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
    $CssClass .= $Discussion->Closed == '1' ? ' Closed' : '';
    $CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
    $CssClass .= $Discussion->CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
    $Sender->EventArguments['Discussion'] =& $Discussion;
    $Sender->FireEvent('BeforeDiscussionName');
    $DiscussionName = Gdn_Format::Text($Discussion->Name);
    if ($DiscussionName == '') {
        $DiscussionName = T('Blank Discussion Topic');
    }
    static $FirstDiscussion = TRUE;
    if (!$FirstDiscussion) {
        $Sender->FireEvent('BetweenDiscussion');
    } else {
        $FirstDiscussion = FALSE;
    }
    ?>
<li class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($Discussion->FirstPhoto != '') {
        if (strtolower(substr($Discussion->FirstPhoto, 0, 7)) == 'http://' || strtolower(substr($Discussion->FirstPhoto, 0, 8)) == 'https://') {
            $PhotoUrl = $Discussion->FirstPhoto;
        } else {
            $PhotoUrl = 'uploads/' . ChangeBasename($Discussion->FirstPhoto, 'n%s');
        }
        echo Img($PhotoUrl, array('alt' => $Discussion->FirstName));
    }
    ?>
   <div class="ItemContent Discussion">
      <?php 
    echo Anchor($DiscussionName, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 && C('Vanilla.Comments.AutoOffset') ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
    ?>
      <?php 
    $Sender->FireEvent('AfterDiscussionTitle');
    ?>
      <div class="Meta">
         <span class="Author"><?php 
    echo $Discussion->FirstName;
    ?>
</span>
         <?php 
    echo '<span class="Counts' . ($Discussion->CountUnreadComments > 0 ? ' NewCounts' : '') . '">' . ($Discussion->CountUnreadComments > 0 ? $Discussion->CountUnreadComments . '/' : '') . $Discussion->CountComments . '</span>';
    if ($Discussion->LastCommentID != '') {
        echo '<span class="LastCommentBy">' . sprintf(T('Latest %1$s'), $Discussion->LastName) . '</span> ';
    }
    echo '<span class="LastCommentDate">' . Gdn_Format::Date($Discussion->FirstDate) . '</span> ';
    ?>
      </div>
   </div>
</li>
<?php 
}
 public function ToString()
 {
     if ($this->_UserData->NumRows() == 0) {
         return '';
     }
     $String = '';
     ob_start();
     ?>
   <div class="Box">
      <?php 
     echo panelHeading(T('In this Discussion'));
     ?>
      <ul class="PanelInfo">
         <?php 
     foreach ($this->_UserData->Result() as $User) {
         ?>
            <li>
               <?php 
         echo Anchor(Wrap(Wrap(Gdn_Format::Date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . Wrap(Wrap(GetValue('Name', $User), 'span', array('class' => 'Username')), 'span'), UserUrl($User));
         ?>
            </li>
         <?php 
     }
     ?>
      </ul>
   </div>
   <?php 
     $String = ob_get_contents();
     @ob_end_clean();
     return $String;
 }
 public function renderOrigin($Sender)
 {
     $Discussion = $Sender->EventArguments['Discussion'];
     if ($Discussion !== NULL && $Discussion->LastCommentID != '') {
         $Creator = UserBuilder($Discussion, 'First');
         $CreationDate = $Discussion->DateInserted;
         echo ' <span class="MItem LastCommentBy">' . sprintf(T('Started by %1$s'), UserAnchor($Creator)) . '</span>';
         echo ' <span class="MItem LastCommentDate">' . Gdn_Format::Date($CreationDate, 'html') . '</span>';
     }
 }
예제 #6
0
 public function DiscussionsController_AfterCountMeta_Handler(&$Sender)
 {
     $Discussion = $Sender->EventArguments['Discussion'];
     if (C('Plugins.AuthorTimeView.Show_AuthorTime')) {
         $First = UserBuilder($Discussion, 'First');
         $Last = UserBuilder($Discussion, 'Last');
         if ($Discussion->LastCommentID != '') {
             echo '<span class="LastCommentBy">' . sprintf(T(' %1$s'), UserAnchor($First)) . '</span>';
             echo '<span class="AuthorDate">' . Gdn_Format::Date($Discussion->FirstDate) . '</span>';
             echo '<span class="LastCommentBy">' . sprintf(T('| Recent %1$s'), UserAnchor($Last)) . '</span>';
         } else {
             // leave space preceding Started in ' Started by' or it will be removed by locale definitions
             echo '<span class="LastCommentBy">' . sprintf(T(' Started by %1$s'), UserAnchor($First)) . '</span>';
         }
     }
 }
예제 #7
0
    function WriteDiscussionEvent($Discussion, $Prefix = null)
    {
        ?>
	<li class="<?php 
        echo CssClass($Discussion);
        ?>
">
		<div class="Title">
		<?php 
        echo Anchor(Gdn_Format::Text($Discussion->Name, false), DiscussionUrl($Discussion) . ($Discussion->CountCommentWatch > 0 ? '#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink');
        ?>
		</div><div class="Meta"><span class="MItem">
		<?php 
        echo Gdn_Format::Date($Discussion->DiscussionEventDate, 'html');
        ?>
		</span></div>
	</li>
	<?php 
    }
예제 #8
0
    public function ToString()
    {
        $String = '';
        $Session = Gdn::Session();
        ob_start();
        ?>
			<div id="WhosOnline" class="Box">
				<h4><?php 
        echo T("Who's Online");
        ?>
 (<?php 
        echo $this->_OnlineUsers->NumRows();
        ?>
)</h4>
				<ul class="PanelInfo">
				<?php 
        if ($this->_OnlineUsers->NumRows() > 0) {
            foreach ($this->_OnlineUsers->Result() as $User) {
                ?>
					<li>
		 				<strong <?php 
                echo $User->Invisible == 1 ? 'class="Invisible"' : '';
                ?>
>
		    				<?php 
                echo UserAnchor($User);
                ?>
		 				</strong>
		 				<?php 
                echo Gdn_Format::Date($User->Timestamp);
                ?>
					</li>
				<?php 
            }
        }
        ?>
			</ul>
		</div>
		<?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
예제 #9
0
 protected function DrawEdited($Sender)
 {
     $Record = $Sender->Data('Discussion');
     if (!$Record) {
         $Record = $Sender->Data('Record');
     }
     if (!$Record) {
         return;
     }
     $PermissionCategoryID = GetValue('PermissionCategoryID', $Record);
     $Data = $Record;
     $RecordType = 'discussion';
     $RecordID = GetValue('DiscussionID', $Data);
     // But override if comment
     if (isset($Sender->EventArguments['Comment']) || GetValue('RecordType', $Record) == 'comment') {
         $Data = $Sender->EventArguments['Comment'];
         $RecordType = 'comment';
         $RecordID = GetValue('CommentID', $Data);
     }
     $UserCanEdit = Gdn::Session()->CheckPermission('Vanilla.' . ucfirst($RecordType) . 's.Edit', TRUE, 'Category', $PermissionCategoryID);
     if (is_null($Data->DateUpdated)) {
         return;
     }
     if (Gdn_Format::ToTimestamp($Data->DateUpdated) <= Gdn_Format::ToTimestamp($Data->DateInserted)) {
         return;
     }
     $SourceUserID = $Data->InsertUserID;
     $UpdatedUserID = $Data->UpdateUserID;
     $UserData = Gdn::UserModel()->GetID($UpdatedUserID);
     $Edited = array('EditUser' => GetValue('Name', $UserData, T('Unknown User')), 'EditDate' => Gdn_Format::Date($Data->DateUpdated, 'html'), 'EditLogUrl' => Url("/log/record/{$RecordType}/{$RecordID}"), 'EditWord' => 'at');
     $DateUpdateTime = Gdn_Format::ToTimestamp($Data->DateUpdated);
     if (date('ymd', $DateUpdateTime) != date('ymd')) {
         $Edited['EditWord'] = 'on';
     }
     $Format = T('PostEdited.Plain', 'Post edited by {EditUser} {EditWord} {EditDate}');
     if ($UserCanEdit) {
         $Format = T('PostEdited.Log', 'Post edited by {EditUser} {EditWord} {EditDate} (<a href="{EditLogUrl}">log</a>)');
     }
     $Display = '<div class="PostEdited">' . FormatString($Format, $Edited) . '</div>';
     echo $Display;
 }
예제 #10
0
 /**
  * Renders the reaction record for a specific item
  * 
  * @param int $ID
  * @param string $Type 'discussion', 'activity', or 'comment'
  */
 function RenderReactionRecord($ID, $Type)
 {
     $Reactions = Yaga::ReactionModel()->GetRecord($ID, $Type);
     $Limit = C('Yaga.Reactions.RecordLimit');
     $ReactionCount = count($Reactions);
     $i = 0;
     foreach ($Reactions as $Reaction) {
         $i++;
         // Limit the record if there are a lot of reactions
         if ($i <= $Limit || $Limit <= 0) {
             $User = Gdn::UserModel()->GetID($Reaction->UserID);
             $DateTitle = sprintf(T('Yaga.Reactions.RecordFormat'), $User->Name, $Reaction->Name, Gdn_Format::Date($Reaction->DateInserted, '%B %e, %Y'));
             $String = UserPhoto($User, array('Size' => 'Small', 'title' => $DateTitle));
             $String .= '<span class="ReactSprite Reaction-' . $Reaction->ActionID . ' ' . $Reaction->CssClass . '"></span>';
             $Wrapttributes = array('class' => 'UserReactionWrap', 'data-userid' => $User->UserID, 'title' => $DateTitle);
             echo Wrap($String, 'span', $Wrapttributes);
         }
         if ($Limit > 0 && $i >= $ReactionCount && $ReactionCount > $Limit) {
             echo Plural($ReactionCount - $Limit, 'Yaga.Reactions.RecordLimit.Single', 'Yaga.Reactions.RecordLimit.Plural');
         }
     }
 }
예제 #11
0
 public function ProfileController_AfterUserInfo_Handler($Sender)
 {
     if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage') || $Sender->User->UserID == Gdn::Session()->User->UserID) {
         $Warnings = Gdn::UserModel()->GetMeta($Sender->User->UserID, 'Warnings.%', 'Warnings.', array());
         krsort($Warnings);
         $History = False;
         echo '<div class="Warnings">';
         echo Wrap(T('Warning.Warnings', 'Warnings'), 'h2', array('class' => 'H'));
         foreach ($Warnings as $Date => $Warning) {
             $Warning = Gdn_Format::Unserialize($Warning);
             $Reason = '';
             if (is_array($Warning)) {
                 $Reason = $Warning['Reason'];
                 $Warning = $Warning['Type'];
             }
             if ($History && $Warning != 'None') {
                 $WarningClass = "{$Warning} Historical";
             } else {
                 $WarningClass = $Warning;
             }
             if (!$History && $Warning == 'None') {
                 echo '<div class="NoWarning">' . T('Warning.NoWarnings', 'There are no current warnings for this user. ') . '</div>';
             }
             echo '<div class="Warn ' . $WarningClass . '">' . T('Warning.Level.' . $Warning, $Warning) . '<span class="WarningDate">' . Gdn_Format::Date($Date) . '</span></div>';
             if ($Reason) {
                 echo '<div class="WarningReason ' . $WarningClass . '">' . Gdn_Format::Text($Reason) . '</div>';
             }
             $History = True;
         }
         if (count($Warnings) == 0) {
             echo '<div class="NoWarning">' . T('Warning.NoWarnings', 'There are no current warnings for this user. ') . '</div>';
         }
         if (count($Warnings) > 1) {
             echo '<a class="WarningTogggleHistory" href="#">' . T('Warning.ToggleHistory', 'Toggle History') . '</a>';
         }
         echo '</div>';
     }
 }
예제 #12
0
    public static function WriteReply(&$Sender, &$Session)
    {
        ?>
         <li class="Reply" id="Comment_<?php 
        echo $Sender->CurrentReply->CommentID;
        ?>
">
            <?php 
        // Delete comment
        if ($Session->CheckPermission('Vanilla.Comments.Delete', $Sender->Discussion->CategoryID)) {
            echo Anchor(T('Delete'), 'vanilla/discussion/deletecomment/' . $Sender->CurrentReply->CommentID . '/' . $Session->TransientKey(), 'DeleteReply');
        }
        ?>
            <ul class="Info<?php 
        echo $Sender->CurrentReply->InsertUserID == $Session->UserID ? ' Author' : '';
        ?>
">
               <li class="Author"><?php 
        $Author = UserBuilder($Sender->CurrentReply, 'Insert');
        echo UserPhoto($Author);
        echo UserAnchor($Author);
        ?>
</li>
               <li class="Created"><?php 
        echo Gdn_Format::Date($Sender->CurrentReply->DateInserted);
        ?>
</li>
               <li class="Permalink"><?php 
        echo Anchor(T('Permalink'), '/discussion/comment/' . (isset($Sender->CurrentComment) ? $Sender->CurrentComment->CommentID : $Sender->ReplyCommentID) . '/#Comment_' . $Sender->CurrentReply->CommentID, T('Permalink'));
        ?>
</li>
            </ul>
            <div class="Body"><?php 
        echo Gdn_Format::To($Sender->CurrentReply->Body, $Sender->CurrentReply->Format);
        ?>
</div>
         </li>
      <?php 
    }
예제 #13
0
    ?>
>
      <td><strong><?php 
    echo UserAnchor($User);
    ?>
</strong></td>
      <td class="Alt"><?php 
    echo Gdn_Format::Email($User->Email);
    ?>
</td>
      <td><?php 
    echo Gdn_Format::Date($User->DateFirstVisit);
    ?>
</td>
      <td class="Alt"><?php 
    echo Gdn_Format::Date($User->DateLastActive);
    ?>
</td>
      <?php 
    if ($EditUser || $DeleteUser) {
        ?>
         <td><?php 
        if ($EditUser) {
            echo Anchor(T('Edit'), '/user/edit/' . $User->UserID, 'Popup SmallButton');
        }
        if ($DeleteUser && $User->UserID != $Session->User->UserID) {
            echo Anchor(T('Delete'), '/user/delete/' . $User->UserID, 'SmallButton');
        }
        ?>
</td>
      <?php 
예제 #14
0
파일: popin.php 프로젝트: rnovino/Garden
      <div class="ItemContent">
         <b class="Subject"><?php 
        echo Anchor($Subject, "/messages/{$Row['ConversationID']}#latest");
        ?>
</b>
         <?php 
        $Excerpt = SliceString(Gdn_Format::PlainText($Row['LastBody'], $Row['LastFormat']), 80);
        echo Wrap(nl2br($Excerpt), 'div', array('class' => 'Excerpt'));
        ?>
         <div class="Meta">
            <?php 
        echo ' <span class="MItem">' . Plural($Row['CountMessages'], '%s message', '%s messages') . '</span> ';
        if ($Row['CountNewMessages'] > 0) {
            echo ' <strong class="HasNew"> ' . Plural($Row['CountNewMessages'], '%s new', '%s new') . '</strong> ';
        }
        echo ' <span class="MItem">' . Gdn_Format::Date($Row['LastDateInserted']) . '</span> ';
        ?>
         </div>
      </div>
   </li>
   <?php 
    }
    ?>
   <li class="Item Center">
      <?php 
    echo Anchor(sprintf(T('All %s'), T('Messages')), '/messages/inbox');
    ?>
   </li>
<?php 
} else {
    ?>
예제 #15
0
function _FormatStringCallback($Match, $SetArgs = FALSE)
{
    static $Args = array();
    if ($SetArgs) {
        $Args = $Match;
        return;
    }
    $Match = $Match[1];
    if ($Match == '{') {
        return $Match;
    }
    // Parse out the field and format.
    $Parts = explode(',', $Match);
    $Field = trim($Parts[0]);
    $Format = strtolower(trim(GetValue(1, $Parts, '')));
    $SubFormat = strtolower(trim(GetValue(2, $Parts, '')));
    $FomatArgs = GetValue(3, $Parts, '');
    if (in_array($Format, array('currency', 'integer', 'percent'))) {
        $FormatArgs = $SubFormat;
        $SubFormat = $Format;
        $Format = 'number';
    } elseif (is_numeric($SubFormat)) {
        $FormatArgs = $SubFormat;
        $SubFormat = '';
    }
    $Value = GetValueR($Field, $Args, '');
    if ($Value == '' && !in_array($Format, array('url', 'exurl'))) {
        $Result = '';
    } else {
        switch (strtolower($Format)) {
            case 'date':
                switch ($SubFormat) {
                    case 'short':
                        $Result = Gdn_Format::Date($Value, '%d/%m/%Y');
                        break;
                    case 'medium':
                        $Result = Gdn_Format::Date($Value, '%e %b %Y');
                        break;
                    case 'long':
                        $Result = Gdn_Format::Date($Value, '%e %B %Y');
                        break;
                    default:
                        $Result = Gdn_Format::Date($Value);
                        break;
                }
                break;
            case 'html':
            case 'htmlspecialchars':
                $Result = htmlspecialchars($Value);
                break;
            case 'number':
                if (!is_numeric($Value)) {
                    $Result = $Value;
                } else {
                    switch ($SubFormat) {
                        case 'currency':
                            $Result = '$' . number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 2);
                        case 'integer':
                            $Result = (string) round($Value);
                            if (is_numeric($FormatArgs) && strlen($Result) < $FormatArgs) {
                                $Result = str_repeat('0', $FormatArgs - strlen($Result)) . $Result;
                            }
                            break;
                        case 'percent':
                            $Result = round($Value * 100, is_numeric($FormatArgs) ? $FormatArgs : 0);
                            break;
                        default:
                            $Result = number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 0);
                            break;
                    }
                }
                break;
            case 'rawurlencode':
                $Result = rawurlencode($Value);
                break;
            case 'time':
                $Result = Gdn_Format::Date($Value, '%l:%M%p');
                break;
            case 'url':
                if (strpos($Field, '/') !== FALSE) {
                    $Value = $Field;
                }
                $Result = Url($Value, $SubFormat == 'domain');
                break;
            case 'exurl':
                if (strpos($Field, '/') !== FALSE) {
                    $Value = $Field;
                }
                $Result = ExternalUrl($Value);
                break;
            case 'urlencode':
                $Result = urlencode($Value);
                break;
            default:
                $Result = $Value;
                break;
        }
    }
    return $Result;
}
예제 #16
0
}
echo FormatMeAction($Discussion);
?>
            </span>
            <span class="AuthorInfo">
               <?php 
echo WrapIf(htmlspecialchars(GetValue('Title', $Author)), 'span', array('class' => 'MItem AuthorTitle'));
echo WrapIf(htmlspecialchars(GetValue('Location', $Author)), 'span', array('class' => 'MItem AuthorLocation'));
$this->FireEvent('AuthorInfo');
?>
            </span>
         </div>
         <div class="Meta DiscussionMeta">
            <span class="MItem DateCreated">
               <?php 
echo Anchor(Gdn_Format::Date($Discussion->DateInserted, 'html'), $Discussion->Url, 'Permalink', array('rel' => 'nofollow'));
?>
            </span>
            <?php 
echo DateUpdated($Discussion, array('<span class="MItem">', '</span>'));
?>
            <?php 
// Include source if one was set
if ($Source = GetValue('Source', $Discussion)) {
    echo ' ' . Wrap(sprintf(T('via %s'), T($Source . ' Source', $Source)), 'span', array('class' => 'MItem MItem-Source')) . ' ';
}
// Category
if (C('Vanilla.Categories.Use')) {
    echo ' <span class="MItem Category">';
    echo ' ' . T('in') . ' ';
    echo Anchor(htmlspecialchars($this->Data('Discussion.Category')), CategoryUrl($this->Data('Discussion.CategoryUrlCode')));
예제 #17
0
    function WriteComment($Comment, $Sender, $Session, $CurrentOffset)
    {
        static $UserPhotoFirst = NULL;
        if ($UserPhotoFirst === NULL) {
            $UserPhotoFirst = C('Vanilla.Comment.UserPhotoFirst', TRUE);
        }
        $Author = Gdn::UserModel()->GetID($Comment->InsertUserID);
        //UserBuilder($Comment, 'Insert');
        $Permalink = GetValue('Url', $Comment, '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID);
        // Set CanEditComments (whether to show checkboxes)
        if (!property_exists($Sender, 'CanEditComments')) {
            $Sender->CanEditComments = $Session->CheckPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && C('Vanilla.AdminCheckboxes.Use');
        }
        // Prep event args
        $CssClass = CssClass($Comment, $CurrentOffset);
        $Sender->EventArguments['Comment'] =& $Comment;
        $Sender->EventArguments['Author'] =& $Author;
        $Sender->EventArguments['CssClass'] =& $CssClass;
        // DEPRECATED ARGUMENTS (as of 2.1)
        $Sender->EventArguments['Object'] =& $Comment;
        $Sender->EventArguments['Type'] = 'Comment';
        // First comment template event
        $Sender->FireEvent('BeforeCommentDisplay');
        ?>
<li class="<?php 
        echo $CssClass;
        ?>
" id="<?php 
        echo 'Comment_' . $Comment->CommentID;
        ?>
">
   <div class="Comment">
      <?php 
        // Write a stub for the latest comment so it's easy to link to it from outside.
        if ($CurrentOffset == Gdn::Controller()->Data('_LatestItem')) {
            echo '<span id="latest"></span>';
        }
        ?>
      <div class="Options">
         <?php 
        WriteCommentOptions($Comment);
        ?>
      </div>
      <?php 
        $Sender->FireEvent('BeforeCommentMeta');
        ?>
      <div class="Item-Header CommentHeader">
         <div class="AuthorWrap">
            <span class="Author">
               <?php 
        if ($UserPhotoFirst) {
            echo UserPhoto($Author);
            echo UserAnchor($Author, 'Username');
        } else {
            echo UserAnchor($Author, 'Username');
            echo UserPhoto($Author);
        }
        echo FormatMeAction($Comment);
        ?>
            </span>
            <span class="AuthorInfo">
               <?php 
        echo ' ' . WrapIf(htmlspecialchars(GetValue('Title', $Author)), 'span', array('class' => 'MItem AuthorTitle'));
        $Sender->FireEvent('AuthorInfo');
        ?>
            </span>   
         </div>
         <div class="Meta CommentMeta CommentInfo">
            <span class="MItem DateCreated">
               <?php 
        echo Anchor(Gdn_Format::Date($Comment->DateInserted, 'html'), $Permalink, 'Permalink', array('name' => 'Item_' . $CurrentOffset, 'rel' => 'nofollow'));
        ?>
            </span>
            <?php 
        // Include source if one was set
        if ($Source = GetValue('Source', $Comment)) {
            echo Wrap(sprintf(T('via %s'), T($Source . ' Source', $Source)), 'span', array('class' => 'MItem Source'));
        }
        $Sender->FireEvent('CommentInfo');
        $Sender->FireEvent('InsideCommentMeta');
        // DEPRECATED
        $Sender->FireEvent('AfterCommentMeta');
        // DEPRECATED
        // Include IP Address if we have permission
        if ($Session->CheckPermission('Garden.Moderation.Manage')) {
            echo Wrap(IPAnchor($Comment->InsertIPAddress), 'span', array('class' => 'MItem IPAddress'));
        }
        ?>
         </div>
      </div>
      <div class="Item-BodyWrap">
         <div class="Item-Body">
            <div class="Message">
               <?php 
        echo FormatBody($Comment);
        ?>
            </div>
            <?php 
        $Sender->FireEvent('AfterCommentBody');
        WriteReactions($Comment);
        ?>
         </div>
      </div>
   </div>
</li>
<?php 
        $Sender->FireEvent('AfterComment');
    }
예제 #18
0
파일: popin.php 프로젝트: rnovino/Garden
        ?>
</div>
         <div class="ItemContent">
            <b class="Subject"><?php 
        echo Anchor($Row->Name, $Row->Url . '#latest');
        ?>
</b>
            <div class="Meta">
               <?php 
        echo ' <span class="MItem">' . Plural($Row->CountComments, '%s comment', '%s comments') . '</span> ';
        if ($Row->CountUnreadComments === TRUE) {
            echo ' <strong class="HasNew"> ' . T('new') . '</strong> ';
        } elseif ($Row->CountUnreadComments > 0) {
            echo ' <strong class="HasNew"> ' . Plural($Row->CountUnreadComments, '%s new', '%s new plural') . '</strong> ';
        }
        echo ' <span class="MItem">' . Gdn_Format::Date($Row->DateLastComment) . '</span> ';
        ?>
            </div>
         </div>
      </li>
      <?php 
    }
    ?>
      <li class="Item Center">
         <?php 
    echo Anchor(sprintf(T('All %s'), T('Bookmarks')), '/discussions/bookmarked');
    ?>
      </li>
<?php 
} else {
    ?>
예제 #19
0
    /**
     * Writes a discussion in table row format.
     */
    function WriteDiscussionRow($Discussion, &$Sender, &$Session, $Alt2)
    {
        if (!property_exists($Sender, 'CanEditDiscussions')) {
            $Sender->CanEditDiscussions = GetValue('PermsDiscussionsEdit', CategoryModel::Categories($Discussion->CategoryID)) && C('Vanilla.AdminCheckboxes.Use');
        }
        $CssClass = CssClass($Discussion);
        $DiscussionUrl = $Discussion->Url;
        if ($Session->UserID) {
            $DiscussionUrl .= '#latest';
        }
        $Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl;
        $Sender->EventArguments['Discussion'] =& $Discussion;
        $Sender->EventArguments['CssClass'] =& $CssClass;
        $First = UserBuilder($Discussion, 'First');
        if ($Discussion->LastUserID) {
            $Last = UserBuilder($Discussion, 'Last');
        } else {
            $Last = $First;
        }
        //   $Sender->EventArguments['FirstUser'] = &$First;
        //   $Sender->EventArguments['LastUser'] = &$Last;
        //
        //   $Sender->FireEvent('BeforeDiscussionName');
        $DiscussionName = $Discussion->Name;
        if ($DiscussionName == '') {
            $DiscussionName = T('Blank Discussion Topic');
        }
        $Sender->EventArguments['DiscussionName'] =& $DiscussionName;
        $Discussion->CountPages = ceil($Discussion->CountComments / $Sender->CountCommentsPerPage);
        $FirstPageUrl = DiscussionUrl($Discussion, 1);
        $LastPageUrl = DiscussionUrl($Discussion, FALSE) . '#latest';
        ?>
<tr id="Discussion_<?php 
        echo $Discussion->DiscussionID;
        ?>
" class="<?php 
        echo $CssClass;
        ?>
">
   <?php 
        echo AdminCheck($Discussion, array('<td class="CheckBoxColumn"><div class="Wrap">', '</div></td>'));
        ?>
	<td class="DiscussionName">
		<div class="Wrap">
         <span class="Options">
            <?php 
        echo OptionsList($Discussion);
        echo BookmarkButton($Discussion);
        ?>
         </span>
			<?php 
        echo Anchor($DiscussionName, $DiscussionUrl, 'Title') . ' ';
        $Sender->FireEvent('AfterDiscussionTitle');
        WriteMiniPager($Discussion);
        echo NewComments($Discussion);
        if ($Sender->Data('_ShowCategoryLink', TRUE)) {
            echo CategoryLink($Discussion, ' ' . T('in') . ' ');
        }
        // Other stuff that was in the standard view that you may want to display:
        echo '<div class="Meta Meta-Discussion">';
        WriteTags($Discussion);
        echo '</div>';
        //			if ($Source = GetValue('Source', $Discussion))
        //				echo ' '.sprintf(T('via %s'), T($Source.' Source', $Source));
        //
        ?>
		</div>
	</td>
	<td class="BlockColumn BlockColumn-User FirstUser">
		<div class="Block Wrap">
			<?php 
        echo UserPhoto($First, array('Size' => 'Small'));
        echo UserAnchor($First, 'UserLink BlockTitle');
        echo '<div class="Meta">';
        echo Anchor(Gdn_Format::Date($Discussion->FirstDate, 'html'), $FirstPageUrl, 'CommentDate MItem');
        echo '</div>';
        ?>
		</div>
   </td>
	<td class="BigCount CountComments">
      <div class="Wrap">
         <?php 
        // Exact Number
        // echo number_format($Discussion->CountComments);
        // Round Number
        echo BigPlural($Discussion->CountComments, '%s comment');
        ?>
      </div>
	</td>
	<td class="BigCount CountViews">
      <div class="Wrap">
         <?php 
        // Exact Number
        // echo number_format($Discussion->CountViews);
        // Round Number
        echo BigPlural($Discussion->CountViews, '%s view');
        ?>
      </div>
	</td>
	<td class="BlockColumn BlockColumn-User LastUser">
		<div class="Block Wrap">
			<?php 
        if ($Last) {
            echo UserPhoto($Last, array('Size' => 'Small'));
            echo UserAnchor($Last, 'UserLink BlockTitle');
            echo '<div class="Meta">';
            echo Anchor(Gdn_Format::Date($Discussion->LastDate, 'html'), $LastPageUrl, 'CommentDate MItem');
            echo '</div>';
        } else {
            echo '&nbsp;';
        }
        ?>
		</div>
	</td>
</tr>
<?php 
    }
예제 #20
0
function WriteTable($Results, $WriteText, $CssClass)
{
    $String = '';
    $Total = sizeof($Results);
    if ($Total == 0) {
        return $String;
        //return an empty string if no results
    }
    $Count = 0;
    //for toggling the message div if text
    ob_start();
    ?>
    <div class="SphinxSearch Table">
        <table>
            <thead>
                <tr>
                    <th class="Title">Discussion</th>
                    <th class="Starter">Starter</th>
                    <th class="Forum">Forum</th>
                    <th class="InfoCount">R / V</th>
                    <th class="Latest">Latest</th>
                </tr>
            </thead>
            <tbody>
                <?php 
    foreach ($Results as $Row) {
        ?>
                    <?php 
        $ID = 'T_' . $Count++;
        //unique identifer
        $OAuthor->Name = $Row->UserName;
        $OAuthor->UserID = $Row->UserID;
        //original author
        $LAuthor->Name = $Row->LastUserName;
        $LAuthor->UserID = $Row->LastUserID;
        //latest author
        $Row->CountCommentWatch = $Row->CountComments;
        //for discussion link
        $TitleURL = $Row->IsComment ? 'discussion/comment/' . $Row->CommentID . '/#Comment_' . $Row->CommentID : DiscussionLink($Row, FALSE);
        //if the comment is from the orignal discussion poster, simply link to the front page of that
        ?>

                    <tr <?php 
        echo Alternate();
        ?>
>
                        <td class="Title">
                            <?php 
        if ($WriteText) {
            ?>
                                <span id="<?php 
            echo $ID;
            ?>
" class="PlusImage Toggle"></span>
                            <?php 
        }
        ?>
                            <span class="Title"><?php 
        echo Anchor($Row->Title . Wrap(htmlspecialchars(SliceString($Row->DiscussionBody, SS_PREVIEW_BODY_LIMIT)), 'span', array('class' => 'ToolTip')), $TitleURL, FALSE, array('class' => 'HasToolTip'));
        ?>
</span>
                        </td>
                        <td class="Starter">
                            <?php 
        echo UserAnchor($OAuthor);
        ?>
                            <?php 
        Anchor(Gdn_Format::Date($Row->DateInserted), $TitleURL);
        ?>
                        </td>
                        <td class="Forum">
                            <?php 
        echo Anchor(Gdn_Format::Text($Row->CatName), 'categories/' . $Row->CatUrlCode);
        ?>
                        </td>
                        <td class="InfoCount">
                            <?php 
        echo Gdn_Format::BigNumber($Row->CountComments);
        ?>
                            /
                            <?php 
        echo Gdn_Format::BigNumber($Row->CountViews);
        ?>
                        </td>
                        <td class="Latest">
                            <?php 
        echo UserAnchor($LAuthor) . ' on ';
        echo Anchor(Gdn_Format::Date($Row->DateInserted), DiscussionLink($Row, $Extended = TRUE));
        ?>
                        </td>
                    </tr>
                    <?php 
        if ($WriteText) {
            ?>
                    <tr id="<?php 
            echo $ID . 'T';
            ?>
" style="display: none" class="ExpandText">
                        <td  colspan="5"> <!-- Need this since this column will expand the width of the table !-->
                        <div class="Message Excerpt">
                            <?php 
            echo nl2br(SliceString($Row->Body, SS_BODY_LIMIT));
            ?>
                        </div>
                        </td>
                    </tr>

                <?php 
        }
        ?>
            <?php 
    }
    ?>
            </tbody>
        </table>
        <div style="clear: both"></div>
    </div>
    <?php 
    $String = ob_get_contents();
    @ob_end_clean();
    return $String;
}
예제 #21
0
    ?>
</th>
      </tr>
   </thead>
   <tbody>
   <?php 
    foreach ($this->UserData->Format('Text')->Result() as $User) {
        ?>
      <tr>
         <td><?php 
        echo $this->Form->CheckBox('Applicants[]', '', array('value' => $User->UserID));
        ?>
</td>
         <td class="Alt">
            <?php 
        printf(T('<strong>%1$s</strong> (%2$s) %3$s'), $User->Name, Gdn_Format::Email($User->Email), Gdn_Format::Date($User->DateInserted));
        $this->EventArguments['User'] = $User;
        $this->FireEvent("ApplicantInfo");
        echo '<blockquote>' . $User->DiscoveryText . '</blockquote>';
        $this->EventArguments['User'] = $User;
        $this->FireEvent("AppendApplicantInfo");
        ?>
</td>
         <td><?php 
        echo Anchor(T('Approve'), '/user/approve/' . $User->UserID . '/' . $Session->TransientKey()) . ', ' . Anchor(T('Decline'), '/user/decline/' . $User->UserID . '/' . $Session->TransientKey());
        ?>
</td>
      </tr>
   <?php 
    }
    ?>
예제 #22
0
        echo $Invitation->Code;
        ?>
</td>
      <td class="Alt"><?php 
        if ($Invitation->AcceptedName == '') {
            echo $Invitation->Email;
        } else {
            echo Anchor($Invitation->AcceptedName, '/profile/' . $Invitation->AcceptedUserID);
        }
        if ($Invitation->AcceptedName == '') {
            echo '<div>' . Anchor(T('Uninvite'), '/profile/uninvite/' . $Invitation->InvitationID . '/' . $Session->TransientKey(), 'Uninvite') . ' | ' . Anchor(T('Send Again'), '/profile/sendinvite/' . $Invitation->InvitationID . '/' . $Session->TransientKey(), 'SendAgain') . '</div>';
        }
        ?>
</td>
      <td><?php 
        echo Gdn_Format::Date($Invitation->DateInserted);
        ?>
</td>
      <td class="Alt"><?php 
        if ($Invitation->AcceptedName == '') {
            echo T('Pending');
        } else {
            echo T('Accepted');
        }
        ?>
</td>
   </tr>
<?php 
    }
    ?>
    </tbody>
예제 #23
0
 public function GetInvitationCount($UserID)
 {
     // If this user is master admin, they should have unlimited invites.
     if ($this->SQL->Select('UserID')->From('User')->Where('UserID', $UserID)->Where('Admin', '1')->Get()->NumRows() > 0) {
         return -1;
     }
     // Get the Registration.InviteRoles settings:
     $InviteRoles = Gdn::Config('Garden.Registration.InviteRoles', array());
     if (!is_array($InviteRoles) || count($InviteRoles) == 0) {
         return 0;
     }
     // Build an array of roles that can send invitations
     $CanInviteRoles = array();
     foreach ($InviteRoles as $RoleID => $Invites) {
         if ($Invites > 0 || $Invites == -1) {
             $CanInviteRoles[] = $RoleID;
         }
     }
     if (count($CanInviteRoles) == 0) {
         return 0;
     }
     // See which matching roles the user has
     $UserRoleData = $this->SQL->Select('RoleID')->From('UserRole')->Where('UserID', $UserID)->WhereIn('RoleID', $CanInviteRoles)->Get();
     if ($UserRoleData->NumRows() == 0) {
         return 0;
     }
     // Define the maximum number of invites the user is allowed to send
     $InviteCount = 0;
     foreach ($UserRoleData->Result() as $UserRole) {
         $Count = $InviteRoles[$UserRole->RoleID];
         if ($Count == -1) {
             $InviteCount = -1;
         } else {
             if ($InviteCount != -1 && $Count > $InviteCount) {
                 $InviteCount = $Count;
             }
         }
     }
     // If the user has unlimited invitations, return that value
     if ($InviteCount == -1) {
         return -1;
     }
     // Get the user's current invitation settings from their profile
     $User = $this->SQL->Select('CountInvitations, DateSetInvitations')->From('User')->Where('UserID', $UserID)->Get()->FirstRow();
     // If CountInvitations is null (ie. never been set before) or it is a new month since the DateSetInvitations
     if ($User->CountInvitations == '' || is_null($User->DateSetInvitations) || Gdn_Format::Date($User->DateSetInvitations, 'n Y') != Gdn_Format::Date('', 'n Y')) {
         // Reset CountInvitations and DateSetInvitations
         $this->SQL->Put($this->Name, array('CountInvitations' => $InviteCount, 'DateSetInvitations' => Gdn_Format::Date('', 'Y-m-01')), array('UserID' => $UserID));
         return $InviteCount;
     } else {
         // Otherwise return CountInvitations
         return $User->CountInvitations;
     }
 }
예제 #24
0
echo 'Bookmark_' . $Discussion->DiscussionID;
?>
">
   <strong><?php 
echo Anchor($Discussion->Name, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink');
?>
</strong>
   <div class="Meta">
      <?php 
echo '<span>' . $Discussion->CountComments . '</span>';
$CountUnreadComments = $Discussion->CountComments - $Discussion->CountCommentWatch;
// Logic for incomplete comment count.
if ($Discussion->CountCommentWatch == 0 && ($DateLastViewed = GetValue('DateLastViewed', $Discussion))) {
    if (Gdn_Format::ToTimestamp($DateLastViewed) >= Gdn_Format::ToTimestamp($Discussion->LastDate)) {
        $CountUnreadComments = 0;
        $Discussion->CountCommentWatch = $Discussion->CountComments;
    } else {
        $CountUnreadComments = '';
    }
}
if ($CountUnreadComments > 0 || $CountUnreadComments === '') {
    echo '<strong>' . trim(sprintf('%s new', $CountUnreadComments)) . '</strong>';
}
$Last = new stdClass();
$Last->UserID = $Discussion->LastUserID;
$Last->Name = $Discussion->LastName;
echo '<span>' . Gdn_Format::Date($Discussion->LastDate) . ' ' . UserAnchor($Last) . '</span>';
?>
   </div>
</li>
예제 #25
0
function WriteActivityComment($Comment, &$Sender, &$Session)
{
    $Author = UserBuilder($Comment, 'Activity');
    $PhotoAnchor = UserPhoto($Author, 'Photo');
    $CssClass = 'Item ActivityComment Condensed ' . $Comment->ActivityType;
    if ($PhotoAnchor != '') {
        $CssClass .= ' HasPhoto';
    }
    ?>
<li id="Activity_<?php 
    echo $Comment->ActivityID;
    ?>
" class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($PhotoAnchor != '') {
        ?>
   <div class="Author Photo"><?php 
        echo $PhotoAnchor;
        ?>
</div>
   <?php 
    }
    ?>
   <div class="ItemContent ActivityComment">
      <?php 
    echo UserAnchor($Author, 'Title Name');
    ?>
      <div class="Excerpt"><?php 
    echo Gdn_Format::Display($Comment->Story);
    ?>
</div>
      <div class="Meta">
         <span class="DateCreated"><?php 
    echo Gdn_Format::Date($Comment->DateInserted);
    ?>
</span>
         <?php 
    if ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete')) {
        echo Anchor(T('Delete'), 'dashboard/activity/delete/' . $Comment->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'DeleteComment');
    }
    ?>
      </div>
   </div>
</li>
<?php 
}
예제 #26
0
파일: info.php 프로젝트: rnovino/Garden
    ?>
</dd>
      <dt class="Label Visits"><?php 
    echo T('Visits');
    ?>
<dt>
      <dd class="Value Visits"><?php 
    echo $this->User->CountVisits;
    ?>
</dd>
      <dt class="Label LastActive"><?php 
    echo T('Last Active');
    ?>
<dt>
      <dd class="Value LastActive"><?php 
    echo Gdn_Format::Date($this->User->DateLastActive);
    ?>
</dd>
      <dt class="Label Roles"><?php 
    echo T('Roles');
    ?>
<dt>
      <dd class="Value Roles"><?php 
    echo implode(', ', $this->Roles);
    ?>
</dd>
      <?php 
    if ($this->User->InviteUserID > 0) {
        $Inviter = new stdClass();
        $Inviter->UserID = $this->User->InviteUserID;
        $Inviter->Name = $this->User->InviteName;
예제 #27
0
    if ($User->Admin > 1) {
        $RolesString = ConcatSep(', ', $RolesString, T('System'));
    }
    foreach ($Roles as $RoleID => $RoleName) {
        $Query = http_build_query(array('Keywords' => $RoleName));
        $RolesString = ConcatSep(', ', $RolesString, '<a href="' . Url('/user/browse?' . $Query) . '">' . htmlspecialchars($RoleName) . '</a>');
    }
    echo $RolesString;
    ?>
      </td>
      <td class="Alt"><?php 
    echo Gdn_Format::Date($User->DateFirstVisit, 'html');
    ?>
</td>
      <td><?php 
    echo Gdn_Format::Date($User->DateLastActive, 'html');
    ?>
</td>
      <?php 
    if ($ViewPersonalInfo) {
        ?>
      <td><?php 
        echo htmlspecialchars($User->LastIPAddress);
        ?>
</td>
      <?php 
    }
    ?>
      <?php 
    $this->EventArgs['User'] = $User;
    $this->FireEvent('UserCell');
예제 #28
0
파일: inbox.php 프로젝트: bishopb/vanilla
          }
          if ($User['UserID'] == Gdn::Session()->UserID) {
              $User['Name'] = T('You');
          }
          echo UserAnchor($User);
      }
      ?>
          </span>
          <span class="MItem CountMessages">
             <?php 
      echo Plural($Row['CountMessages'], '%s message', '%s messages');
      ?>
          </span>
          <span class="MItem DateLastMessage">
             <?php 
      echo Gdn_Format::Date($Row['DateLastMessage']);
      ?>
          </span>
       </div>
    </li>
    <?php 
  }
  ?>
 </ul>   
 <div class="P PagerContainer">
    <?php 
  echo Anchor(Sprite('SpNewConversation SpAdd') . T('New Message'), '/messages/add');
  ?>
    <span class="Pager"><?php 
  echo Anchor(T('More…'), '/messages/inbox');
  ?>
예제 #29
0
function _FormatStringCallback($Match, $SetArgs = FALSE)
{
    static $Args = array();
    if ($SetArgs) {
        $Args = $Match;
        return;
    }
    $Match = $Match[1];
    if ($Match == '{') {
        return $Match;
    }
    // Parse out the field and format.
    $Parts = explode(',', $Match);
    $Field = trim($Parts[0]);
    $Format = trim(GetValue(1, $Parts, ''));
    $SubFormat = strtolower(trim(GetValue(2, $Parts, '')));
    $FormatArgs = GetValue(3, $Parts, '');
    if (in_array($Format, array('currency', 'integer', 'percent'))) {
        $FormatArgs = $SubFormat;
        $SubFormat = $Format;
        $Format = 'number';
    } elseif (is_numeric($SubFormat)) {
        $FormatArgs = $SubFormat;
        $SubFormat = '';
    }
    $Value = GetValueR($Field, $Args, '');
    if ($Value == '' && !in_array($Format, array('url', 'exurl'))) {
        $Result = '';
    } else {
        switch (strtolower($Format)) {
            case 'date':
                switch ($SubFormat) {
                    case 'short':
                        $Result = Gdn_Format::Date($Value, '%d/%m/%Y');
                        break;
                    case 'medium':
                        $Result = Gdn_Format::Date($Value, '%e %b %Y');
                        break;
                    case 'long':
                        $Result = Gdn_Format::Date($Value, '%e %B %Y');
                        break;
                    default:
                        $Result = Gdn_Format::Date($Value);
                        break;
                }
                break;
            case 'html':
            case 'htmlspecialchars':
                $Result = htmlspecialchars($Value);
                break;
            case 'number':
                if (!is_numeric($Value)) {
                    $Result = $Value;
                } else {
                    switch ($SubFormat) {
                        case 'currency':
                            $Result = '$' . number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 2);
                        case 'integer':
                            $Result = (string) round($Value);
                            if (is_numeric($FormatArgs) && strlen($Result) < $FormatArgs) {
                                $Result = str_repeat('0', $FormatArgs - strlen($Result)) . $Result;
                            }
                            break;
                        case 'percent':
                            $Result = round($Value * 100, is_numeric($FormatArgs) ? $FormatArgs : 0);
                            break;
                        default:
                            $Result = number_format($Value, is_numeric($FormatArgs) ? $FormatArgs : 0);
                            break;
                    }
                }
                break;
            case 'plural':
                if (is_array($Value)) {
                    $Value = count($Value);
                } elseif (StringEndsWith($Field, 'UserID', TRUE)) {
                    $Value = 1;
                }
                if (!is_numeric($Value)) {
                    $Result = $Value;
                } else {
                    if (!$SubFormat) {
                        $SubFormat = rtrim("%s {$Field}", 's');
                    }
                    if (!$FormatArgs) {
                        $FormatArgs = $SubFormat . 's';
                    }
                    $Result = Plural($Value, $SubFormat, $FormatArgs);
                }
                break;
            case 'rawurlencode':
                $Result = rawurlencode($Value);
                break;
            case 'text':
                $Result = Gdn_Format::Text($Value, FALSE);
                break;
            case 'time':
                $Result = Gdn_Format::Date($Value, '%l:%M%p');
                break;
            case 'url':
                if (strpos($Field, '/') !== FALSE) {
                    $Value = $Field;
                }
                $Result = Url($Value, $SubFormat == 'domain');
                break;
            case 'exurl':
                if (strpos($Field, '/') !== FALSE) {
                    $Value = $Field;
                }
                $Result = ExternalUrl($Value);
                break;
            case 'urlencode':
                $Result = urlencode($Value);
                break;
            case 'gender':
                // Format in the form of FieldName,gender,male,female,unknown
                if (is_array($Value) && count($Value) == 1) {
                    $Value = array_shift($Value);
                }
                $Gender = 'u';
                if (!is_array($Value)) {
                    $User = Gdn::UserModel()->GetID($Value);
                    if ($User) {
                        $Gender = $User->Gender;
                    }
                }
                switch ($Gender) {
                    case 'm':
                        $Result = $SubFormat;
                        break;
                    case 'f':
                        $Result = $FormatArgs;
                        break;
                    default:
                        $Result = GetValue(4, $Parts);
                }
                break;
            case 'user':
            case 'you':
            case 'his':
            case 'her':
            case 'your':
                $Result = print_r($Value, TRUE);
                $ArgsBak = $Args;
                if (is_array($Value) && count($Value) == 1) {
                    $Value = array_shift($Value);
                }
                if (is_array($Value)) {
                    $Max = C('Garden.FormatUsername.Max', 5);
                    $Count = count($Value);
                    $Result = '';
                    for ($i = 0; $i < $Count; $i++) {
                        if ($i >= $Max && $Count > $Max + 1) {
                            $Others = $Count - $i;
                            $Result .= ' ' . T('sep and', 'and') . ' ' . Plural($Others, '%s other', '%s others');
                            break;
                        }
                        $ID = $Value[$i];
                        if (is_array($ID)) {
                            continue;
                        }
                        if ($i == $Count - 1) {
                            $Result .= ' ' . T('sep and', 'and') . ' ';
                        } elseif ($i > 0) {
                            $Result .= ', ';
                        }
                        $Special = array(-1 => T('everyone'), -2 => T('moderators'), -3 => T('administrators'));
                        if (isset($Special[$ID])) {
                            $Result .= $Special[$ID];
                        } else {
                            $User = Gdn::UserModel()->GetID($ID);
                            $User->Name = FormatUsername($User, $Format, Gdn::Session()->UserID);
                            $Result .= UserAnchor($User);
                        }
                    }
                } else {
                    $User = Gdn::UserModel()->GetID($Value);
                    $User->Name = FormatUsername($User, $Format, Gdn::Session()->UserID);
                    $Result = UserAnchor($User);
                }
                $Args = $ArgsBak;
                break;
            default:
                $Result = $Value;
                break;
        }
    }
    return $Result;
}
예제 #30
0
   <h4><?php echo T('About'); ?></h4>
   <dl>
      <dt class="Name"><?php echo T('Username'); ?></dt>
      <dd class="Name"><?php echo $this->User->Name; ?></dd>
      <?php               
      if ($this->User->ShowEmail == 1 || $Session->CheckPermission('Garden.Registration.Manage')) {
         echo '<dt class="Email">'.T('Email').'</dt>
         <dd class="Email">'.Gdn_Format::Email($this->User->Email).'</dd>';
      }
      ?>
      <dt class="Joined"><?php echo T('Joined'); ?></dt>
      <dd class="Joined"><?php echo Gdn_Format::Date($this->User->DateFirstVisit); ?></dd>
      <dt class="Visits"><?php echo T('Visits'); ?></dt>
      <dd class="Visits"><?php echo number_format($this->User->CountVisits); ?></dd>
      <dt class="LastActive"><?php echo T('Last Active'); ?></dt>
      <dd class="LastActive"><?php echo Gdn_Format::Date($this->User->DateLastActive); ?></dd>
      <dt class="Roles"><?php echo T('Roles'); ?></dt>
      <dd class="Roles"><?php echo implode(', ', $this->Roles); ?></dd>
      <?php               
      if ($this->User->InviteUserID > 0) {
         $Inviter = new stdClass();
         $Inviter->UserID = $this->User->InviteUserID;
         $Inviter->Name = $this->User->InviteName;
         echo '<dt class="Invited">'.T('Invited by').'</dt>
         <dd class="Invited">'.UserAnchor($Inviter).'</dd>';
      }
      $this->FireEvent('OnBasicInfo');
      ?>
   </dl>
</div>
<?php