public function ToString()
 {
     $HasPermission = Gdn::Session()->CheckPermission('Vanilla.Discussions.Add', TRUE, 'Category', 'any');
     if ($HasPermission) {
         echo Anchor(T('Ask a Question'), '/post/discussion?Type=Question', 'Button BigButton NewQuestion');
     }
 }
 /**
  * Grabs all new notifications and adds them to the sender's inform queue.
  *
  * This method gets called by dashboard's hooks file to display new
  * notifications on every pageload. 
  *
  * @since 2.0.18
  * @access public
  *
  * @param Gdn_Controller $Sender The object calling this method.
  */
 public static function InformNotifications($Sender)
 {
     $Session = Gdn::Session();
     if (!$Session->IsValid()) {
         return;
     }
     $ActivityModel = new ActivityModel();
     // Get five pending notifications.
     $Where = array('NotifyUserID' => Gdn::Session()->UserID, 'Notified' => ActivityModel::SENT_PENDING);
     // If we're in the middle of a visit only get very recent notifications.
     $Where['DateUpdated >'] = Gdn_Format::ToDateTime(strtotime('-5 minutes'));
     $Activities = $ActivityModel->GetWhere($Where, 0, 5)->ResultArray();
     $ActivityIDs = ConsolidateArrayValuesByKey($Activities, 'ActivityID');
     $ActivityModel->SetNotified($ActivityIDs);
     foreach ($Activities as $Activity) {
         if ($Activity['Photo']) {
             $UserPhoto = Anchor(Img($Activity['Photo'], array('class' => 'ProfilePhotoMedium')), $Activity['Url'], 'Icon');
         } else {
             $UserPhoto = '';
         }
         $Excerpt = Gdn_Format::Display($Activity['Story']);
         $ActivityClass = ' Activity-' . $Activity['ActivityType'];
         $Sender->InformMessage($UserPhoto . Wrap($Activity['Headline'], 'div', array('class' => 'Title')) . Wrap($Excerpt, 'div', array('class' => 'Excerpt')), 'Dismissable AutoDismiss' . $ActivityClass . ($UserPhoto == '' ? '' : ' HasIcon'));
     }
 }
    public function ToString()
    {
        $String = '';
        ob_start();
        ?>
      <div class="Box">
         <h4><?php 
        echo Gdn::Translate('In this Discussion');
        ?>
</h4>
         <ul class="PanelInfo">
         <?php 
        foreach ($this->_UserData->Result() as $User) {
            ?>
            <li>
               <strong><?php 
            echo Anchor($User->Name, '/profile/' . urlencode($User->Name), 'UserLink');
            ?>
</strong>
               <?php 
            echo Format::Date($User->DateLastActive);
            ?>
            </li>
            <?php 
        }
        ?>
         </ul>
      </div>
      <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
 public function ToString() {
    if ($this->_TagData->NumRows() == 0)
       return '';
    
    $String = '';
    ob_start();
    ?>
    <div class="Box Tags">
       <h4><?php echo T($this->_DiscussionID > 0 ? 'Tagged' : 'Popular Tags'); ?></h4>
       <ul class="PanelInfo">
       <?php
       foreach ($this->_TagData->Result() as $Tag) {
          if ($Tag->Name != '') {
       ?>
          <li><strong><?php 
                         if (urlencode($Tag->Name) == $Tag->Name) {
                            echo Anchor(htmlspecialchars($Tag->Name), 'discussions/tagged/'.urlencode($Tag->Name));
                         } else {
                            echo Anchor(htmlspecialchars($Tag->Name), 'discussions/tagged?Tag='.urlencode($Tag->Name));
                         }
                      ?></strong><span class="Count"><?php echo number_format($Tag->CountDiscussions); ?></span></li>
       <?php
          }
       }
       ?>
       </ul>
    </div>
    <?php
    $String = ob_get_contents();
    @ob_end_clean();
    return $String;
 }
Exemplo n.º 5
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 
}
Exemplo n.º 6
0
function DPRenderQuestionForm($PollForm, $DiscussionPoll, $Disabled, $Closed)
{
    echo '<div class="P" id="DP_Form">';
    if (!C('Plugins.DiscussionPolls.DisablePollTitle', FALSE)) {
        echo $PollForm->Label('Discussion Poll Title', 'DP_Title');
        echo Wrap($PollForm->TextBox('DP_Title', array_merge($Disabled, array('maxlength' => 100, 'class' => 'InputBox BigInput'))), 'div', array('class' => 'TextBoxWrapper'));
    }
    echo Anchor(' ', '/plugin/discussionpolls/', array('id' => 'DP_PreviousQuestion', 'title' => T('Previous Question')));
    $QuestionCount = 0;
    // set and the form data for existing questions and render a form
    foreach ($DiscussionPoll->Questions as $Question) {
        DPRenderQuestionField($PollForm, $QuestionCount, $Question, $Disabled);
        $QuestionCount++;
    }
    // If there is no data, render a single question form with 2 options to get started
    if (!$QuestionCount) {
        DPRenderQuestionField($PollForm);
    }
    // the end of the form
    if (!$Closed) {
        echo Anchor(T('Add a Question'), '/plugin/discussionpolls/addquestion/', array('id' => 'DP_NextQuestion', 'title' => T('Add a Question')));
        echo Anchor(T('Add an Option'), '/plugin/discussionpolls/addoption', array('id' => 'DP_AddOption', 'title' => T('Add an Option')));
    } else {
        if ($QuestionCount > 1) {
            echo Anchor(T('Next Question'), '/plugin/discussionpolls/addquestion/', array('id' => 'DP_NextQuestion', 'title' => T('Next Question')));
        }
    }
    echo '</div>';
}
Exemplo n.º 7
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 
}
Exemplo n.º 8
0
 public function DiscussionController_CommentOptions_Handler($Sender)
 {
     $Comment = $Sender->CurrentComment;
     $Session = Gdn::Session();
     $Inc = $this->GetScoreIncrements($Comment->CommentID);
     $Signs = array(-1 => 'Neg', +1 => 'Pos');
     // Create a container for the score.
     echo '<div class="CommentScore">';
     $SumScore = is_null($Comment->SumScore) ? 0 : $Comment->SumScore;
     // Write the current score.
     echo '<span class="Score">' . sprintf(Plural($SumScore, '%s point', '%s points'), $SumScore) . '</span>';
     // Write the buttons.
     foreach ($Inc as $Key => $IncAmount) {
         $Button = '<span>' . ($Key < 0 ? '-' : '+') . '</span>';
         $Attributes = array();
         $CssClass = $Signs[$Key] . ' Inc';
         $Href = '/vanilla/discussion/score/' . $Comment->CommentID . '/' . $Signs[$Key] . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl);
         if ($IncAmount == 0) {
             $Attributes['href2'] = Url($Href);
             $CssClass .= ' Disabled';
             $Href = '';
         } else {
             $Attributes['title'] = ($Key > 0 ? '+' : '') . $Inc[$Key];
         }
         // Display an increment button.
         $Foo = Anchor($Button, $Href, $CssClass, $Attributes, TRUE);
         echo $Foo;
     }
     echo '</div>';
 }
 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;
 }
Exemplo n.º 10
0
/**
 * Render options that the user has for this discussion.
 */
function GetOptions($Category, $Sender)
{
    if (!Gdn::Session()->IsValid()) {
        return;
    }
    $Result = '';
    $Options = '';
    $CategoryID = GetValue('CategoryID', $Category);
    $Result = '<div class="Options">';
    $TKey = urlencode(Gdn::Session()->TransientKey());
    // Mark category read.
    $Options .= '<li>' . Anchor(T('Mark Read'), "/vanilla/category/markread?categoryid={$CategoryID}&tkey={$TKey}") . '</li>';
    // Follow/Unfollow category.
    if (!GetValue('Following', $Category)) {
        $Options .= '<li>' . Anchor(T('Follow'), "/vanilla/category/follow?categoryid={$CategoryID}&value=1&tkey={$TKey}") . '</li>';
    } else {
        $Options .= '<li>' . Anchor(T('Unfollow'), "/vanilla/category/follow?categoryid={$CategoryID}&value=0&tkey={$TKey}") . '</li>';
    }
    // Allow plugins to add options
    $Sender->FireEvent('DiscussionOptions');
    if ($Options != '') {
        $Result .= '<div class="ToggleFlyout OptionsMenu"><div class="MenuTitle">' . T('Options') . '</div>' . '<ul class="Flyout MenuItems">' . $Options . '</ul>' . '</div>';
        $Result .= '</div>';
        return $Result;
    }
}
Exemplo n.º 11
0
function smarty_function_anchor($Params, &$Smarty)
{
    $Text = ArrayValue('text', $Params, '');
    $Destination = ArrayValue('destination', $Params, '');
    $CssClass = ArrayValue('class', $Params, '');
    return Anchor($Text, $Destination, $CssClass);
}
Exemplo n.º 12
0
    public function ToString()
    {
        if ($this->_TagData->NumRows() == 0) {
            return '';
        }
        $String = '';
        ob_start();
        ?>
      <div class="Box Tags">
         <h4><?php 
        echo T($this->_DiscussionID > 0 ? 'Tagged' : 'Popular Tags');
        ?>
</h4>
         <ul class="PanelInfo">
         <?php 
        foreach ($this->_TagData->Result() as $Tag) {
            ?>
            <li><strong><?php 
            echo Anchor($Tag->Name, 'discussions/tagged/' . $Tag->Name);
            ?>
</strong> <?php 
            echo $Tag->CountDiscussions;
            ?>
</li>
         <?php 
        }
        ?>
         </ul>
      </div>
      <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
Exemplo n.º 13
0
    public function SettingsController_Render_Before(&$Sender)
    {
        // Save the action if editing registration settings
        if (strcasecmp($Sender->RequestMethod, 'registration') == 0 && $Sender->Form->AuthenticatedPostBack() === TRUE) {
            $this->SaveStep('Plugins.GettingStarted.Registration');
        }
        // Save the action if they reviewed plugins
        if (strcasecmp($Sender->RequestMethod, 'plugins') == 0) {
            $this->SaveStep('Plugins.GettingStarted.Plugins');
        }
        // Save the action if they reviewed plugins
        if (strcasecmp($Sender->RequestMethod, 'managecategories') == 0) {
            $this->SaveStep('Plugins.GettingStarted.Categories');
        }
        // Add messages & their css on dashboard
        if (strcasecmp($Sender->RequestMethod, 'index') == 0) {
            $Sender->AddCssFile('plugins/GettingStarted/style.css');
            $Session = Gdn::Session();
            $WelcomeMessage = '<div class="GettingStarted">' . Anchor('×', '/dashboard/plugin/dismissgettingstarted/' . $Session->TransientKey(), 'Dismiss') . "<p>Here's how to get started:</p>" . '<ul>
      <li class="One' . (Gdn::Config('Plugins.GettingStarted.Registration', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Define how users register for your forum'), '/settings/registration') . '</li>
      <li class="Two' . (Gdn::Config('Plugins.GettingStarted.Plugins', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Manage your plugins'), 'settings/plugins') . '</li>
      <li class="Three' . (Gdn::Config('Plugins.GettingStarted.Categories', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Organize your discussion categories'), 'vanilla/settings/managecategories') . '</li>
      <li class="Four' . (Gdn::Config('Plugins.GettingStarted.Profile', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Customize your profile'), 'profile') . '</li>
      <li class="Five' . (Gdn::Config('Plugins.GettingStarted.Discussion', '0') == '1' ? ' Done' : '') . '">' . Anchor(T('Start your first discussion'), 'post/discussion') . '</li>
   </ul>
</div>';
            $Sender->AddAsset('Messages', $WelcomeMessage, 'WelcomeMessage');
        }
    }
 public function ToString()
 {
     $Session = Gdn::Session();
     $Controller = Gdn::Controller();
     $UserID = $Controller->User->UserID;
     $MemberOptions = array();
     $ProfileOptions = array();
     $Controller->EventArguments['UserID'] = $UserID;
     $Controller->EventArguments['ProfileOptions'] =& $ProfileOptions;
     $Controller->EventArguments['MemberOptions'] =& $MemberOptions;
     if ($Controller->EditMode) {
         return '<div class="ProfileOptions">' . Anchor(T('Back to Profile'), UserUrl($Controller->User), array('class' => 'ProfileButtons')) . '</div>';
         //         $ProfileOptions[] = array('Text' => T('Back to Profile'), 'Url' => UserUrl($Controller->User), 'CssClass' => 'BackToProfile');
     } else {
         // Profile Editing
         if (hasEditProfile($Controller->User->UserID)) {
             $ProfileOptions[] = array('Text' => Sprite('SpEditProfile') . ' ' . T('Edit Profile'), 'Url' => UserUrl($Controller->User, '', 'edit'));
         }
         // Ban/Unban
         $MayBan = CheckPermission('Garden.Moderation.Manage') || CheckPermission('Garden.Users.Edit') || CheckPermission('Moderation.Users.Ban');
         if ($MayBan && $UserID != $Session->UserID) {
             if ($Controller->User->Banned) {
                 $ProfileOptions[] = array('Text' => Sprite('SpBan') . ' ' . T('Unban'), 'Url' => "/user/ban?userid={$UserID}&unban=1", 'CssClass' => 'Popup');
             } elseif (!$Controller->User->Admin) {
                 $ProfileOptions[] = array('Text' => Sprite('SpBan') . ' ' . T('Ban'), 'Url' => "/user/ban?userid={$UserID}", 'CssClass' => 'Popup');
             }
         }
         // Delete content.
         if (CheckPermission('Garden.Moderation.Manage')) {
             $ProfileOptions[] = array('Text' => Sprite('SpDelete') . ' ' . T('Delete Content'), 'Url' => "/user/deletecontent?userid={$UserID}", 'CssClass' => 'Popup');
         }
     }
     return parent::ToString();
 }
Exemplo n.º 15
0
function WriteHomepageOption($Title, $Url, $CssClass, $Current, $Description = '')
{
    $SpriteClass = $CssClass;
    if ($Current == $Url) {
        $CssClass .= ' Current';
    }
    echo Anchor(T($Title) . Wrap(Sprite($SpriteClass), 'span', array('class' => 'Wrap')), $Url, array('class' => $CssClass, 'title' => $Description));
}
Exemplo n.º 16
0
 /**
  *
  * @param Gdn_Controller $Sender
  * @param array $Args
  */
 public function SettingsController_Render_Before($Sender, $Args)
 {
     if (strcasecmp($Sender->RequestMethod, 'locales') != 0) {
         return;
     }
     // Add a little pointer to the settings.
     $Text = '<div class="Info">' . sprintf(T('Locale Developer Settings %s.'), Anchor(T('here'), '/dashboard/settings/localedeveloper')) . '</div>';
     $Sender->AddAsset('Content', $Text, 'LocaleDeveloperLink');
 }
Exemplo n.º 17
0
 public function DiscussionsController_AfterDiscussionTabs_Handler(&$Sender)
 {
     $Count = $this->GetCountParticipated();
     if ($Count > 0) {
         $MyParticipated = T('Participated Discussions');
         $MyParticipated .= '<span>' . $Count . '</span>';
         echo '<li ' . ($Sender->RequestMethod == 'participated' ? ' class="Active"' : '') . '>' . Anchor($MyParticipated, '/discussions/participated', 'MyParticipated') . '</li>';
     }
 }
Exemplo n.º 18
0
 protected function showLink($Sender)
 {
     $Discussion = $Sender->Data('Discussion');
     if (!isset($_GET['noiseless'])) {
         echo Anchor(T('Noiseless_on', 'noiseless'), '/discussion/' . $Discussion->DiscussionID . '?noiseless', 'noiseless_btn noiseless_on');
     } else {
         echo Anchor(T('Noiseless_off', 'show all'), '/discussion/' . $Discussion->DiscussionID, 'noiseless_btn noiseless_off');
     }
 }
Exemplo n.º 19
0
function TutLink($TutorialCode, $WriteTitle = TRUE, $ThumbnailSize = 'medium')
{
    $Tutorial = GetTutorials($TutorialCode);
    if (!$Tutorial) {
        return '';
    }
    $Thumbnail = $ThumbnailSize == 'medium' ? $Tutorial['Thumbnail'] : $Tutorial['LargeThumbnail'];
    return Anchor('<img src="' . $Thumbnail . '" alt="' . $Tutorial['Name'] . '" title="' . $Tutorial['Name'] . '" />' . ($WriteTitle ? Wrap($Tutorial['Name']) : ''), 'settings/tutorials/' . $Tutorial['Code']);
}
Exemplo n.º 20
0
 /**
  * Add 'Unanswered' option to discussion filters.
  */
 public function Base_AfterDiscussionFilters_Handler($Sender, $Args)
 {
     if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage')) {
         $DiscussionModel = new DiscussionModel();
         $Active = $Controller->RequestMethod == 'unanswered' ? ' Active' : '';
         $Unanswered = Sprite('SpUnansweredQuestionsSpUnansweredQuestions') . ' ' . T('Unanswered') . FilterCountString($DiscussionModel->UnansweredCount());
         echo '<li class="Unanswered ' . $Active . '">' . Anchor($Unanswered, 'discussions/unanswered') . '</li>';
     }
 }
 /**
  * Build footer link to change locale.
  */
 public function BuildLocaleLink($Name, $UrlCode)
 {
     $Url = 'profile/setlocale/' . $UrlCode . '/' . Gdn::Session()->TransientKey();
     $Attrs = array('class' => 'LocaleOption');
     // Mark active link
     if (substr(Gdn::Locale()->Current(), 0, 2) === substr($UrlCode, 0, 2)) {
         $Attrs['class'] .= ' Active';
     }
     return Wrap(Anchor(ucwords($Name), $Url), 'span', $Attrs);
 }
Exemplo n.º 22
0
 /**
  * Adds a "Spoof" link to the site management list.
  */
 public function ManageController_SiteListOptions_Handler($Sender)
 {
     if (!Gdn::Session()->CheckPermission('Garden.Settings.Manage')) {
         return;
     }
     $Site = GetValue('Site', $Sender->EventArguments);
     if ($Site) {
         echo Anchor(T('Spoof'), '/user/autospoof/' . $Site->InsertUserID . '/' . Gdn::Session()->TransientKey(), 'PopConfirm SmallButton');
     }
 }
Exemplo n.º 23
0
 public static function FormatMentions($Mixed)
 {
     if (C('Garden.Format.Mentions')) {
         $Mixed = preg_replace('/@([\\d\\w_\\x{0800}-\\x{9fa5}]+)/iu', Anchor('@\\1', '/profile/\\1'), $Mixed);
     }
     if (C('Garden.Format.Hashtags')) {
         $Mixed = preg_replace('/(^|[\\s,\\.])\\#([\\S]{1,30}?)#/i', '\\1' . Anchor('#\\2#', '/search?Search=%23\\2%23&Mode=like') . '\\3', $Mixed);
     }
     return $Mixed;
 }
Exemplo n.º 24
0
function WriteRangeTab($Range, $Sender) {
   echo Wrap(
      Anchor(
         Capitalize($Range),
         'settings?'
         .http_build_query(array('Range' => $Range))
      ),
      'li',
      $Range == $Sender->Range ? array('class' => 'Active') : ''
   )."\n";
}
Exemplo n.º 25
0
 /**
  * Adds "Mark All Viewed" and (conditionally) "Mark Category Viewed" to MeModule menu.
  *
  * @since 2.0
  * @access public
  */
 public function meModule_flyoutMenu_handler($Sender)
 {
     // Add "Mark All Viewed" to menu
     if (Gdn::session()->isValid()) {
         echo wrap(Anchor(sprite('SpMarkAllViewed') . ' ' . t('Mark All Viewed'), '/discussions/markallviewed'), 'li', array('class' => 'MarkAllViewed'));
         $CategoryID = (int) (empty(Gdn::controller()->CategoryID) ? 0 : Gdn::controller()->CategoryID);
         if ($CategoryID > 0) {
             echo wrap(Anchor(sprite('SpMarkCategoryViewed') . ' ' . t('Mark Category Viewed'), "/discussions/markcategoryviewed/{$CategoryID}"), 'li', array('class' => 'MarkCategoryViewed'));
         }
     }
 }
 /**
  * Adds "Mark All Viewed" and (conditionally) "Mark Category Viewed" to MeModule menu.
  *
  * @since 2.0
  * @access public
  */
 public function MeModule_FlyoutMenu_Handler($Sender)
 {
     // Add "Mark All Viewed" to menu
     if (Gdn::Session()->IsValid()) {
         echo Wrap(Anchor(T('Mark All Viewed'), '/discussions/markallviewed'), 'li', array('class' => 'MarkAllViewed'));
         $CategoryID = (int) (empty(Gdn::Controller()->CategoryID) ? 0 : Gdn::Controller()->CategoryID);
         if ($CategoryID > 0) {
             echo Wrap(Anchor(T('Mark Category Viewed'), "/discussions/markcategoryviewed/{$CategoryID}"), 'li', array('class' => 'MarkCategoryViewed'));
         }
     }
 }
Exemplo n.º 27
0
 public function PluginController_MembersListEnh_Create($Sender)
 {
     $Session = Gdn::Session();
     if ($Sender->Menu && (CheckPermission('Plugins.MembersListEnh.GenView') || CheckPermission('Plugins.MembersListEnh.IPEmailView'))) {
         $Sender->ClearCssFiles();
         $Sender->AddCssFile('style.css');
         $Sender->MasterView = 'default';
         $Sender->Render('memtable', '', 'plugins/MembersListEnh');
     } else {
         echo Wrap(Anchor(Img('/plugins/MembersListEnh/design/AccessDenied.png', array('width' => '100%'), array('title' => T('You Have No Permission To View This Page Go Back'))), '/discussions', array('target' => '_self')), 'h1');
     }
 }
Exemplo n.º 28
0
    public function SettingsController_Render_Before($Sender)
    {
        // Have they visited their dashboard?
        if (strtolower($Sender->RequestMethod) != 'index') {
            $this->SaveStep('Plugins.GettingStarted.Dashboard');
        }
        // Save the action if editing registration settings
        if (strcasecmp($Sender->RequestMethod, 'registration') == 0 && $Sender->Form->AuthenticatedPostBack() === TRUE) {
            $this->SaveStep('Plugins.GettingStarted.Registration');
        }
        // Save the action if they reviewed plugins
        if (strcasecmp($Sender->RequestMethod, 'plugins') == 0) {
            $this->SaveStep('Plugins.GettingStarted.Plugins');
        }
        // Save the action if they reviewed plugins
        if (strcasecmp($Sender->RequestMethod, 'managecategories') == 0) {
            $this->SaveStep('Plugins.GettingStarted.Categories');
        }
        // Add messages & their css on dashboard
        if (strcasecmp($Sender->RequestMethod, 'index') == 0) {
            $Sender->AddCssFile('plugins/GettingStarted/style.css');
            $Session = Gdn::Session();
            $WelcomeMessage = '<div class="GettingStarted">' . Anchor('×', '/dashboard/plugin/dismissgettingstarted/' . $Session->TransientKey(), 'Dismiss') . "<h1>" . T("Here's how to get started:") . "</h1>" . '<ul>
      <li class="One' . (C('Plugins.GettingStarted.Dashboard', '0') == '1' ? ' Done' : '') . '">
	 <strong>' . Anchor(T('Welcome to your Dashboard'), 'settings') . '</strong>
         <p>' . T('This is the administrative dashboard for your new community. Check out the configuration options to the left: from here you can configure how your community works. <b>Only users in the "Administrator" role can see this part of your community.</b>') . '</p>
      </li>
      <li class="Two' . (C('Plugins.GettingStarted.Discussions', '0') == '1' ? ' Done' : '') . '">
	 <strong>' . Anchor(T("Where is your Community Forum?"), '/') . '</strong>
         <p>' . T('Access your community forum by clicking the "Visit Site" link on the top-left of this page, or by ') . Anchor(T('clicking here'), '/') . T('. The community forum is what all of your users &amp; customers will see when they visit ') . Anchor(Gdn::Request()->Url('/', TRUE), Gdn::Request()->Url('/', TRUE)) . '.</p>
      </li>
      <li class="Three' . (C('Plugins.GettingStarted.Categories', '0') == '1' ? ' Done' : '') . '">
         <strong>' . Anchor(T('Organize your Categories'), 'vanilla/settings/managecategories') . '</strong>
         <p>' . T('Discussion categories are used to help your users organize their discussions in a way that is meaningful for your community.') . '</p>
      </li>
      <li class="Four' . (C('Plugins.GettingStarted.Profile', '0') == '1' ? ' Done' : '') . '">
         <strong>' . Anchor(T('Customize your Public Profile'), 'profile') . '</strong>
         <p>' . T('Everyone who signs up for your community gets a public profile page where they can upload a picture of themselves, manage their profile settings, and track cool things going on in the community. You should ') . Anchor(T('customize your profile now'), 'profile') . '.</p>
      </li>
      <li class="Five' . (C('Plugins.GettingStarted.Discussion', '0') == '1' ? ' Done' : '') . '">
         <strong>' . Anchor(T('Start your First Discussion'), 'post/discussion') . '</strong>
	 <p>' . T('Get the ball rolling in your community by ') . Anchor(T('starting your first discussion'), 'post/discussion') . T(' now.') . '</p>
      </li>
      <li class="Six' . (C('Plugins.GettingStarted.Plugins', '0') == '1' ? ' Done' : '') . '">
         <strong>' . Anchor(T('Manage your Plugins'), 'settings/plugins') . '</strong>
         <p>' . T('Change the way your community works with plugins. We\'ve bundled popular plugins with the software, and there are more available online.') . '</p>
      </li>
   </ul>
</div>';
            $Sender->AddAsset('Messages', $WelcomeMessage, 'WelcomeMessage');
        }
    }
Exemplo n.º 29
0
 /**
  * Allow mods to bump via discussion options.
  */
 public function Base_DiscussionOptions_Handler($Sender, $Args)
 {
     $Discussion = $Args['Discussion'];
     if (CheckPermission('Garden.Moderation.Manage')) {
         $Label = T('Bump');
         $Url = "/discussion/bump?discussionid={$Discussion->DiscussionID}";
         // Deal with inconsistencies in how options are passed
         if (isset($Sender->Options)) {
             $Sender->Options .= Wrap(Anchor($Label, $Url, 'Bump'), 'li');
         } else {
             $Args['DiscussionOptions']['Bump'] = array('Label' => $Label, 'Url' => $Url, 'Class' => 'Bump');
         }
     }
 }
 /**
  * Allow admin to Change Author via discussion options.
  */
 public function Base_DiscussionOptions_Handler($Sender, $Args)
 {
     $Discussion = $Args['Discussion'];
     if (Gdn::Session()->CheckPermission('Vanilla.Discussions.Edit', TRUE, 'Category', $Discussion->PermissionCategoryID)) {
         $Label = T('Change Author');
         $Url = "/discussion/author?discussionid={$Discussion->DiscussionID}";
         // Deal with inconsistencies in how options are passed
         if (isset($Sender->Options)) {
             $Sender->Options .= Wrap(Anchor($Label, $Url, 'ChangeAuthor'), 'li');
         } else {
             $Args['DiscussionOptions']['ChangeAuthor'] = array('Label' => $Label, 'Url' => $Url, 'Class' => 'ChangeAuthor');
         }
     }
 }