예제 #1
0
/**
 * Takes a route and prepends the web root (expects "/controller/action/params" as $Path).
 *
 * @param array The parameters passed into the function.
 * The parameters that can be passed to this function are as follows.
 * - <b>path</b>: The relative path for the url. There are some special paths that can be used to return "intelligent" links:
 *    - <b>signinout</b>: This will return a signin/signout url that will toggle depending on whether or not the user is already signed in. When this path is given the text is automaticall set.
 * - <b>withdomain</b>: Whether or not to add the domain to the url.
 * - <b>text</b>: Html text to be put inside an anchor. If this value is set then an html <a></a> is returned rather than just a url.
 * - <b>id, class, etc.</b>: When an anchor is generated then any other attributes are passed through and will be written in the resulting tag.
 * @param Smarty The smarty object rendering the template.
 * @return The url.
 */
function smarty_function_link($Params, &$Smarty)
{
    $Path = GetValue('path', $Params, '', TRUE);
    $Text = GetValue('text', $Params, '', TRUE);
    $NoTag = GetValue('notag', $Params, FALSE, TRUE);
    $CustomFormat = GetValue('format', $Params, FALSE, TRUE);
    if (!$Text && $Path != 'signinout' && $Path != 'signin') {
        $NoTag = TRUE;
    }
    if ($CustomFormat) {
        $Format = $CustomFormat;
    } else {
        if ($NoTag) {
            $Format = '%url';
        } else {
            $Format = '<a href="%url" class="%class">%text</a>';
        }
    }
    $Options = array();
    if (isset($Params['withdomain'])) {
        $Options['WithDomain'] = $Params['withdomain'];
    }
    if (isset($Params['class'])) {
        $Options['class'] = $Params['class'];
    }
    if (isset($Params['tk'])) {
        $Options['TK'] = $Params['tk'];
    }
    if (isset($Params['target'])) {
        $Options['Target'] = $Params['target'];
    }
    $Result = Gdn_Theme::Link($Path, $Text, $Format, $Options);
    return $Result;
}
/**
 */
function smarty_function_signin_link($Params, &$Smarty)
{
    if (!Gdn::Session()->IsValid()) {
        $Wrap = GetValue('wrap', $Params, 'li');
        return Gdn_Theme::Link('signinout', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" rel="nofollow" class="%class">%text</a>', $Wrap)), $Params);
    }
}
예제 #3
0
/**
 * A placeholder for future menu items.
 *
 * @param array The parameters passed into the function. This currently takes no parameters.
 * @param Smarty The smarty object rendering the template.
 * @return
 */
function smarty_function_custom_menu($Params, &$Smarty)
{
    $Controller = $Smarty->Controller;
    if (is_object($Menu = GetValue('Menu', $Controller))) {
        $Format = GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', GetValue('wrap', $Params, 'li')));
        $Result = '';
        foreach ($Menu->Items as $Group) {
            foreach ($Group as $Item) {
                // Make sure the item is a custom item.
                if (GetValueR('Attributes.Standard', $Item)) {
                    continue;
                }
                // Make sure the user has permission for the item.
                if ($Permission = GetValue('Permission', $Item)) {
                    if (!Gdn::Session()->CheckPermission($Permission)) {
                        continue;
                    }
                }
                if (($Url = GetValue('Url', $Item)) && ($Text = GetValue('Text', $Item))) {
                    $Result .= Gdn_Theme::Link($Url, $Text, $Format);
                }
            }
        }
        return $Result;
    }
    return '';
}
/**
 */
function smarty_function_nomobile_link($Params, &$Smarty)
{
    $Path = GetValue('path', $Params, '', TRUE);
    $Text = GetValue('text', $Params, '', TRUE);
    $Wrap = GetValue('wrap', $Params, 'li');
    return Gdn_Theme::Link('profile/nomobile', GetValue('text', $Params, T("Full Site")), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
/**
 */
function smarty_function_category_link($Params, &$Smarty)
{
    $Path = GetValue('path', $Params, '', TRUE);
    $Text = GetValue('text', $Params, '', TRUE);
    $Wrap = GetValue('wrap', $Params, 'li');
    return Gdn_Theme::Link('category', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
/**
 * Takes a route and prepends the web root (expects "/controller/action/params" as $Path).
 *
 * @param array The parameters passed into the function.
 * The parameters that can be passed to this function are as follows.
 * - <b>path</b>: The relative path for the url. There are some special paths that can be used to return "intelligent" links:
 *    - <b>signinout</b>: This will return a signin/signout url that will toggle depending on whether or not the user is already signed in. When this path is given the text is automaticall set.
 * - <b>withdomain</b>: Whether or not to add the domain to the url.
 * - <b>text</b>: Html text to be put inside an anchor. If this value is set then an html <a></a> is returned rather than just a url.
 * - <b>id, class, etc.></b>: When an anchor is generated then any other attributes are passed through and will be written in the resulting tag.
 * @param Smarty The smarty object rendering the template.
 * @return The url.
 */
function smarty_function_forum_root_link($Params, &$Smarty)
{
    $Text = GetValue('text', $Params, '', TRUE);
    $Format = GetValue('format', $Params, '<li><a href="%url" class="%class">%text</a></li>');
    $Options = array();
    if (isset($Params['class'])) {
        $Options['class'] = $Params['class'];
    }
    $Result = Gdn_Theme::Link('forumroot', $Text, $Format, $Options);
    return $Result;
}
/**
 */
function smarty_function_photo_link($Params, &$Smarty)
{
    $Wrap = GetValue('wrap', $Params, 'li');
    return Gdn_Theme::Link('photo', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
/**
 */
function smarty_function_drafts_link($Params, &$Smarty)
{
    $Wrap = GetValue('wrap', $Params, 'li');
    return Gdn_Theme::Link('drafts', GetValue('text', $Params, T('My Drafts')), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
/**
 */
function smarty_function_activity_link($Params, &$Smarty)
{
    return Gdn_Theme::Link('activity', GetValue('text', $Params, T('Activity')), GetValue('format', $Params, '<li><a href="%url" class="%class">%text</a></li>'));
}
예제 #10
0
        echo Gdn_Format::Text($this->Data('MostPlayedGame')->hoursPlayed . ' hrs / ' . $this->Data('MostPlayedGame')->hoursOnRecord) . ' hrs';
        ?>
</br>
         <?php 
        echo Gdn_Theme::Link('http://steamcommunity.com/profiles/' . $this->Data('SteamProfile')->steamID64 . '/stats/' . $this->Data('MostPlayedGame')->statsName, 'View stats', '<a href="%url" class="%class" target="_blank" >%text</a>');
        ?>
      </dd>
      <?php 
    }
    ?>
      <dt></dt>
      <dd><?php 
    echo Gdn_Theme::Link('http://steamcommunity.com/profiles/' . $this->Data('SteamProfile')->steamID64 . '/games?tab=all', 'View All Games', '<a href="%url" class="%class" target="_blank" >%text</a>');
    ?>
</dd>
      <dt></dt>
      <dd><?php 
    echo Gdn_Theme::Link('http://steamcommunity.com/profiles/' . $this->Data('SteamProfile')->steamID64 . '/wishlist', 'View Wishlist', '<a href="%url" class="%class" target="_blank" >%text</a>');
    ?>
</dd>
      <?php 
}
?>
      <dt class="SteamUpdated">Updated</dt>
      <dd class="SteamUpdated"><?php 
echo Gdn_Format::FuzzyTime($this->Data('SteamProfile')->DateRetrieved, TRUE);
?>
</dd>
   </dl>
</div>
예제 #11
0
$CssClass = 'AllCategories';
if (strtolower($Controller->ControllerName) == 'categoriescontroller' && in_array(strtolower($Controller->RequestMethod), array('index', 'all'))) {
    $CssClass .= ' Active';
}
echo '<li class="' . $CssClass . '">' . Anchor(Sprite('SpAllCategories') . T('Categories'), '/categories') . '</li> ';
//      }
?>
      <li class="Discussions<?php 
echo strtolower($Controller->ControllerName) == 'discussionscontroller' && strtolower($Controller->RequestMethod) == 'index' ? ' Active' : '';
?>
"><?php 
echo Gdn_Theme::Link('forumroot', Sprite('SpDiscussions') . T('Recent Discussions'));
?>
</li>
      <li class="Activities"><?php 
echo Gdn_Theme::Link('activity', Sprite('SpActivity') . T('Activity'));
?>
</li>
      <?php 
if ($CountBookmarks > 0 || $Controller->RequestMethod == 'bookmarked') {
    ?>
      <li class="MyBookmarks<?php 
    echo $Controller->RequestMethod == 'bookmarked' ? ' Active' : '';
    ?>
"><?php 
    echo Anchor(Sprite('SpBookmarks') . $Bookmarked, '/discussions/bookmarked');
    ?>
</li>
      <?php 
}
if (($CountDiscussions > 0 || $Controller->RequestMethod == 'mine') && C('Vanilla.Discussions.ShowMineTab', TRUE)) {
예제 #12
0
    $CssClass = 'AllCategories';
    if (strtolower($Controller->ControllerName) == 'categoriescontroller' && in_array(strtolower($Controller->RequestMethod), array('index', 'all'))) {
        $CssClass .= ' Active';
    }
    echo '<li class="' . $CssClass . '">' . Anchor(Sprite('SpAllCategories') . ' ' . T('All Categories', 'Categories'), '/categories') . '</li> ';
}
?>
      <li class="Discussions<?php 
echo strtolower($Controller->ControllerName) == 'discussionscontroller' && strtolower($Controller->RequestMethod) == 'index' ? ' Active' : '';
?>
"><?php 
echo Gdn_Theme::Link('forumroot', Sprite('SpDiscussions') . ' ' . T('Recent Discussions'));
?>
</li>
      <?php 
echo Gdn_Theme::Link('activity', Sprite('SpActivity') . ' ' . T('Activity'), '<li class="Activities"><a href="%url" class="%class">%text</a></li>');
?>
      <?php 
if ($CountBookmarks > 0 || $Controller->RequestMethod == 'bookmarked') {
    ?>
      <li class="MyBookmarks<?php 
    echo $Controller->RequestMethod == 'bookmarked' ? ' Active' : '';
    ?>
"><?php 
    echo Anchor(Sprite('SpBookmarks') . ' ' . $Bookmarked, '/discussions/bookmarked');
    ?>
</li>
      <?php 
}
if (($CountDiscussions > 0 || $Controller->RequestMethod == 'mine') && C('Vanilla.Discussions.ShowMineTab', TRUE)) {
    ?>
예제 #13
0
파일: comment.php 프로젝트: Raz0r/Garden
 into account. Look at CheckPermission for more information.
if (!$Session->CheckPermission('Vanilla.Comment.Add')) {
   $CommentOptions['Disabled'] = 'disabled';
   $CommentOptions['Value'] = T('You do not have permission to write new comments.');
}
*/
$this->FireEvent('BeforeBodyField');
echo Wrap($this->Form->TextBox('Body', $CommentOptions), 'div', array('class' => 'TextBoxWrapper'));
$this->FireEvent('AfterBodyField');
echo "<div class=\"Buttons\">\n";
$this->FireEvent('BeforeFormButtons');
$CancelText = T('Back to Discussions');
$CancelClass = 'Back';
if (!$NewOrDraft) {
    $CancelText = T('Cancel');
    $CancelClass = 'MItem Cancel';
}
echo ' ' . Gdn_Theme::Link('forumroot', $CancelText, NULL, array('class' => $CancelClass)) . ' ';
$ButtonOptions = array('class' => 'Button CommentButton');
/*
 Caused non-root users to not be able to add comments. Must take categories
 into account. Look at CheckPermission for more information.
if (!Gdn::Session()->CheckPermission('Vanilla.Comment.Add'))
   $ButtonOptions['Disabled'] = 'disabled';
*/
echo $this->Form->Button($Editing ? 'Save Comment' : 'Post Comment', $ButtonOptions);
$this->FireEvent('AfterFormButtons');
echo "</div>\n";
echo $this->Form->Close();
?>
</div>
/**
 */
function smarty_function_bookmarks_link($Params, &$Smarty)
{
    $Wrap = GetValue('wrap', $Params, 'li');
    return Gdn_Theme::Link('discussions/bookmarked', GetValue('text', $Params, T('My Bookmarks')), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
예제 #15
0
$Controller->FireEvent('BeforeDiscussionFilters');
if ($Session->IsValid()) {
    //      if (C('Vanilla.Categories.ShowTabs')) {
    if (C('Vanilla.Categories.Use')) {
        $CssClass = 'AllCategories';
        if (strtolower($Controller->ControllerName) == 'categoriescontroller' && in_array(strtolower($Controller->RequestMethod), array('index', 'all'))) {
            $CssClass .= ' Active';
        }
        echo '<li class="' . $CssClass . '">' . Anchor(Sprite('SpAllCategories') . ' ' . T('Categories'), '/categories') . '</li> ';
    }
    ?>
        <li class="Discussions<?php 
    echo strtolower($Controller->ControllerName) == 'discussionscontroller' && strtolower($Controller->RequestMethod) == 'index' ? ' Active' : '';
    ?>
"><?php 
    echo Gdn_Theme::Link('forumroot', Sprite('SpDiscussions') . ' ' . T('Recent Discussions'));
    ?>
</li>
        <?php 
    /* Activities are disabled for now echo Gdn_Theme::Link('activity', Sprite('SpActivity').' '.T('Activity'), '<li class="Activities"><a href="%url" class="%class">%text</a></li>'); */
    ?>
        <?php 
    if ($CountBookmarks > 0 || $Controller->RequestMethod == 'bookmarked') {
        ?>
            <li class="MyBookmarks<?php 
        echo $Controller->RequestMethod == 'bookmarked' ? ' Active' : '';
        ?>
"><?php 
        echo Anchor(Sprite('SpBookmarks') . ' ' . $Bookmarked, '/discussions/bookmarked');
        ?>
</li>