public function discussionController_beforeCommentDisplay_handler($sender, $args)
 {
     // Find the previous comment.
     if (!$this->previous) {
         $this->previous = $args['Discussion'];
         if ($sender->data('Page', 1) != 1) {
             $this->previous = $sender->CommentModel->get($sender->DiscussionID, 1, $sender->Offset - 1)->firstRow();
         }
     }
     // Calculate the date difference.
     $date = new DateTime($args['Comment']->DateInserted);
     $gap = $date->diff(new DateTime($this->previous->DateInserted))->days;
     $this->previous = $args['Comment'];
     if ($gap < c('TimeGap.MinDays', 7) - 1) {
         return;
     } elseif ($gap < 30) {
         $gap = sprintf(t('%s days later'), (int) $gap);
         $class = 'Days';
     } elseif ($gap < 60) {
         $gap = t('1 month later');
         $class = 'Month';
     } elseif ($gap < 365) {
         $gap = sprintf(t('%s months later'), (int) ($gap / 30));
         $class = 'Months';
     } elseif ($gap < 720) {
         $gap = t('1 year later');
         $class = 'Year';
     } else {
         $gap = sprintf(t('%s years later'), (int) ($gap / 365));
         $class = 'Years';
     }
     echo wrap(sprite('Time', 'InformSprite') . $gap, 'li', array('class' => 'TimeGap ' . $class));
 }
Example #2
0
function writeHomepageOption($Title, $Url, $CssClass, $Current, $Description = '')
{
    $SpriteClass = $CssClass;
    if ($Current == $Url) {
        $CssClass .= ' Current';
    }
    $CssClass .= ' Choice';
    echo anchor(t($Title) . Wrap(sprite($SpriteClass), 'span', array('class' => 'Wrap')), $Url, array('class' => $CssClass, 'title' => $Description, 'rel' => $Url));
}
 /**
  * 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'));
         }
     }
 }
Example #4
0
 /**
  * General "post" form, allows posting of any kind of form. Attach to PostController_AfterFormCollection_Handler.
  *
  * @since 2.0.0
  * @access public
  */
 public function index($CurrentFormName = 'discussion')
 {
     $this->addJsFile('jquery.autosize.min.js');
     $this->addJsFile('autosave.js');
     $this->addJsFile('post.js');
     $this->setData('CurrentFormName', $CurrentFormName);
     $Forms = array();
     $Forms[] = array('Name' => 'Discussion', 'Label' => sprite('SpNewDiscussion') . t('New Discussion'), 'Url' => 'vanilla/post/discussion');
     /*
     $Forms[] = array('Name' => 'Question', 'Label' => sprite('SpAskQuestion').t('Ask Question'), 'Url' => 'vanilla/post/discussion');
     $Forms[] = array('Name' => 'Poll', 'Label' => sprite('SpNewPoll').t('New Poll'), 'Url' => 'activity');
     */
     $this->setData('Forms', $Forms);
     $this->fireEvent('AfterForms');
     $this->setData('Breadcrumbs', array(array('Name' => t('Post'), 'Url' => '/post')));
     $this->render();
 }
 public function SettingsController_DiscussionEvent_create($Sender)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Sender->Form = new Gdn_Form();
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->setField(array('Plugins.DiscussionEvent.DisplayInSidepanel', 'Plugins.DiscussionEvent.MaxDiscussionEvents'));
     $Sender->Form->setModel($ConfigurationModel);
     if ($Sender->Form->authenticatedPostBack()) {
         if ($Sender->Form->save() !== false) {
             $Sender->informMessage(sprite('Check', 'InformSprite') . T('Your changes have been saved.'), 'Dismissable AutoDismiss HasSprite');
         }
     } else {
         $Sender->Form->setData($ConfigurationModel->Data);
     }
     $Sender->title(T('Discussion Event Settings'));
     $Sender->addSideMenu();
     $Sender->render($this->GetView('settings.php'));
 }
 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'));
         } elseif ($Session->isValid() && $UserID == $Session->UserID) {
             $ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Preferences'), 'Url' => userUrl($Controller->User, '', 'preferences'));
         }
         // Ban/Unban
         $MayBan = checkPermission('Garden.Moderation.Manage') || checkPermission('Garden.Users.Edit') || checkPermission('Moderation.Users.Ban');
         if ($MayBan && $UserID != $Session->UserID) {
             if (BanModel::isBanned($Controller->User->Banned, BanModel::BAN_AUTOMATIC | BanModel::BAN_MANUAL)) {
                 $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();
 }
 /**
  * This is the asynchronous callback.
  *
  * This method is triggerd on every page request via a callback AJAX request
  * so that it may execute asychronously and reduce lag for users. It tracks
  * views, handles registration for new installations, and sends stats every day as needed.
  *
  * @return void
  */
 public function tick()
 {
     // Fire an event for plugins to track their own stats.
     // TODO: Make this analyze the path and throw a specific event (this event will change in future versions).
     $this->EventArguments['Path'] = Gdn::Request()->Post('Path');
     $this->fireEvent('Tick');
     // Store the view, using denormalization if enabled
     $ViewType = 'normal';
     if (preg_match('`discussion/embed`', Gdn::request()->post('ResolvedPath', ''))) {
         $ViewType = 'embed';
     }
     $this->addView($ViewType);
     if (Gdn::session()->isValid()) {
         Gdn::userModel()->updateVisit(Gdn::session()->UserID);
     }
     if (!self::checkIsEnabled()) {
         return;
     }
     if (Gdn::session()->checkPermission('Garden.Settings.Manage')) {
         if (Gdn::get('Garden.Analytics.Notify', false) !== false) {
             $CallMessage = Sprite('Bandaid', 'InformSprite');
             $CallMessage .= sprintf(T("There's a problem with Vanilla Analytics that needs your attention.<br/> Handle it <a href=\"%s\">here &raquo;</a>"), Url('dashboard/statistics'));
             Gdn::controller()->informMessage($CallMessage, array('CssClass' => 'HasSprite'));
         }
     }
     $InstallationID = Gdn::installationID();
     // Check if we're registered with the central server already. If not, this request is
     // hijacked and used to perform that task instead of sending stats or recording a tick.
     if (is_null($InstallationID)) {
         // If the config file is not writable, gtfo
         $ConfFile = PATH_CONF . '/config.php';
         if (!is_writable($ConfFile)) {
             // Admins see a helpful notice
             if (Gdn::session()->checkPermission('Garden.Settings.Manage')) {
                 $Warning = sprite('Sliders', 'InformSprite');
                 $Warning .= T('Your config.php file is not writable.<br/> Find out <a href="http://vanillaforums.org/docs/vanillastatistics">how to fix this &raquo;</a>');
                 Gdn::controller()->informMessage($Warning, array('CssClass' => 'HasSprite'));
             }
             return;
         }
         $AttemptedRegistration = Gdn::get('Garden.Analytics.Registering', false);
         // If we last attempted to register less than 60 seconds ago, do nothing. Could still be working.
         if ($AttemptedRegistration !== false && time() - $AttemptedRegistration < 60) {
             return;
         }
         return $this->register();
     }
     // If we get here, the installation is registered and we can decide on whether or not to send stats now.
     $LastSentDate = self::lastSentDate();
     if (empty($LastSentDate) || $LastSentDate < date('Ymd', strtotime('-1 day'))) {
         return $this->stats();
     }
 }
 function writeReactions($Row)
 {
     $Attributes = GetValue('Attributes', $Row);
     if (is_string($Attributes)) {
         $Attributes = @unserialize($Attributes);
         SetValue('Attributes', $Row, $Attributes);
     }
     Gdn::controller()->EventArguments['ReactionTypes'] = array();
     if ($ID = GetValue('CommentID', $Row)) {
         $RecordType = 'comment';
     } elseif ($ID = GetValue('ActivityID', $Row)) {
         $RecordType = 'activity';
     } else {
         $RecordType = 'discussion';
         $ID = GetValue('DiscussionID', $Row);
     }
     Gdn::controller()->EventArguments['RecordType'] = $RecordType;
     Gdn::controller()->EventArguments['RecordID'] = $ID;
     echo '<div class="Reactions">';
     Gdn_Theme::bulletRow();
     // Write the flags.
     static $Flags = null;
     if ($Flags === null) {
         Gdn::controller()->EventArguments['Flags'] =& $Flags;
         Gdn::controller()->fireEvent('Flags');
     }
     // Allow addons to work with flags
     Gdn::controller()->EventArguments['Flags'] =& $Flags;
     Gdn::controller()->fireEvent('BeforeFlag');
     if (!empty($Flags) && is_array($Flags)) {
         echo Gdn_Theme::bulletItem('Flags');
         echo ' <span class="FlagMenu ToggleFlyout">';
         // Write the handle.
         echo anchor(sprite('ReactFlag', 'ReactSprite') . ' ' . wrap(t('Flag'), 'span', array('class' => 'ReactLabel')), '', 'Hijack ReactButton-Flag FlyoutButton', array('title' => t('Flag')), true);
         echo sprite('SpFlyoutHandle', 'Arrow');
         echo '<ul class="Flyout MenuItems Flags" style="display: none;">';
         foreach ($Flags as $Flag) {
             if (is_callable($Flag)) {
                 echo '<li>' . call_user_func($Flag, $Row, $RecordType, $ID) . '</li>';
             } else {
                 echo '<li>' . reactionButton($Row, $Flag['UrlCode']) . '</li>';
             }
         }
         Gdn::controller()->fireEvent('AfterFlagOptions');
         echo '</ul>';
         echo '</span> ';
     }
     Gdn::controller()->fireEvent('AfterFlag');
     Gdn::controller()->fireEvent('AfterReactions');
     echo '</div>';
     Gdn::controller()->fireEvent('Replies');
 }
 /**
  * Output Quote link.
  */
 protected function addReactButton($Sender, $Args)
 {
     if ($this->accessToken()) {
         $CssClass = 'ReactButton Hijack';
     } else {
         $CssClass = 'ReactButton PopupWindow';
     }
     echo ' ' . anchor(sprite('ReactFacebook', 'Sprite ReactSprite', t('Share on Facebook')), url("post/facebook/{$Args['RecordType']}?id={$Args['RecordID']}", true), $CssClass) . ' ';
 }
Example #10
0
 public function get_sprite($sprite = '', $title = '', $args = [])
 {
     return sprite($this->get_alias($sprite), $title, array_merge($args, ['prefix' => $this->get_prefix(), 'url' => $this->get_url()]));
 }
Example #11
0
 /**
  * Add the question form to vanilla's post page.
  *
  * @param PostController $sender Sending controller instance.
  */
 public function postController_afterForms_handler($sender)
 {
     $Forms = $sender->data('Forms');
     $Forms[] = array('Name' => 'Question', 'Label' => sprite('SpQuestion') . t('Ask a Question'), 'Url' => 'post/question');
     $sender->setData('Forms', $Forms);
 }
 function writeCommentOptions($Comment)
 {
     $Controller = Gdn::controller();
     $Session = Gdn::session();
     $Id = $Comment->CommentID;
     $Options = GetCommentOptions($Comment);
     if (empty($Options)) {
         return;
     }
     echo '<span class="ToggleFlyout OptionsMenu">';
     echo '<span class="OptionsTitle" title="' . t('Options') . '">' . t('Options') . '</span>';
     echo sprite('SpFlyoutHandle', 'Arrow');
     echo '<ul class="Flyout MenuItems">';
     foreach ($Options as $Code => $Option) {
         echo wrap(Anchor($Option['Label'], $Option['Url'], val('Class', $Option, $Code)), 'li');
     }
     echo '</ul>';
     echo '</span>';
     if (c('Vanilla.AdminCheckboxes.Use')) {
         // Only show the checkbox if the user has permission to affect multiple items
         $Discussion = Gdn::controller()->data('Discussion');
         $PermissionCategoryID = val('PermissionCategoryID', $Discussion);
         if ($Session->checkPermission('Vanilla.Comments.Delete', TRUE, 'Category', $PermissionCategoryID)) {
             if (!property_exists($Controller, 'CheckedComments')) {
                 $Controller->CheckedComments = $Session->getAttribute('CheckedComments', array());
             }
             $ItemSelected = InSubArray($Id, $Controller->CheckedComments);
             echo '<span class="AdminCheck"><input type="checkbox" name="' . 'Comment' . 'ID[]" value="' . $Id . '"' . ($ItemSelected ? ' checked="checked"' : '') . ' /></span>';
         }
     }
 }
Example #13
0
<span class="ToggleFlyout OptionsMenu <?php 
echo val('cssClass', $this);
?>
">
    <span class="OptionsTitle" title="Options"><?php 
echo val('text', val('trigger', $this));
?>
</span>
    <?php 
echo sprite('SpFlyoutHandle', 'Arrow');
?>
    <ul class="Flyout MenuItems <?php 
echo val('listCssClass', $this);
?>
" role="menu" aria-labelledby="<?php 
echo val('triggerId', $this);
?>
">
        <?php 
foreach (val('items', $this) as $item) {
    if (val('type', $item) == 'group') {
        ?>
                <li role="presentation" class="dropdown-header <?php 
        echo val('cssClass', $item);
        ?>
">
                    <?php 
        if (val('icon', $item)) {
            echo icon(val('icon', $item));
        }
Example #14
0
    ?>
            <li <?php 
    if ($Controller->data('Filter') == 'mods') {
        echo 'class="Active"';
    }
    ?>
>
                <?php 
    echo anchor(sprite('SpMod') . ' ' . t('Moderator Activity'), '/activity/mods');
    ?>
            </li>
        <?php 
}
if ($AdminPermission) {
    ?>
            <li <?php 
    if ($Controller->data('Filter') == 'admins') {
        echo 'class="Active"';
    }
    ?>
>
                <?php 
    echo anchor(sprite('SpDashboard') . ' ' . t('Administrator Activity'), '/activity/admins');
    ?>
            </li>
        <?php 
}
?>
    </ul>
</div>
Example #15
0
    ?>
</li>
        <?php 
}
if (($CountDiscussions > 0 || $Controller->RequestMethod == 'mine') && c('Vanilla.Discussions.ShowMineTab', true)) {
    ?>
            <li class="MyDiscussions<?php 
    echo $Controller->RequestMethod == 'mine' ? ' Active' : '';
    ?>
"><?php 
    echo anchor(sprite('SpMyDiscussions') . ' ' . $MyDiscussions, '/discussions/mine');
    ?>
</li>
        <?php 
}
if ($CountDrafts > 0 || $Controller->ControllerName == 'draftscontroller') {
    ?>
            <li class="MyDrafts<?php 
    echo $Controller->ControllerName == 'draftscontroller' ? ' Active' : '';
    ?>
"><?php 
    echo anchor(sprite('SpMyDrafts') . ' ' . $MyDrafts, '/drafts');
    ?>
</li>
        <?php 
}
$Controller->fireEvent('AfterDiscussionFilters');
?>
    </ul>
</div>
Example #16
0
 /**
  *
  *
  * @param null $Selected
  * @param null $Options
  */
 function writeDiscussionSorter($Selected = null, $Options = null)
 {
     deprecated('writeDiscussionSorter', 'DiscussionSortFilterModule', 'March 2016');
     if ($Selected === null) {
         $Selected = Gdn::session()->getPreference('Discussions.SortField', 'DateLastComment');
     }
     $Selected = stringBeginsWith($Selected, 'd.', TRUE, true);
     $Options = array('DateLastComment' => t('Sort by Last Comment', 'by Last Comment'), 'DateInserted' => t('Sort by Start Date', 'by Start Date'));
     ?>
     <span class="ToggleFlyout SelectFlyout">
     <?php 
     if (isset($Options[$Selected])) {
         $Text = $Options[$Selected];
     } else {
         $Text = reset($Options);
     }
     echo wrap($Text . ' ' . sprite('', 'DropHandle'), 'span', array('class' => 'Selected'));
     ?>
         <div class="Flyout MenuItems">
             <ul>
                 <?php 
     foreach ($Options as $SortField => $SortText) {
         echo wrap(Anchor($SortText, '#', array('class' => 'SortDiscussions', 'data-field' => $SortField)), 'li');
     }
     ?>
             </ul>
         </div>
      </span>
     <?php 
 }
Example #17
0
 /**
  * test the helper function to get sprites
  */
 public function testSprite()
 {
     // get the sprite html
     $sprite_markup = sprite('test', 'movies-icon.png');
     $this->assertEquals($sprite_markup, '<span class="sprite_test cell_22"></span>');
 }
 /**
  * Add 'Google+' option to the row.
  */
 public function base_AfterReactions_handler($Sender, $Args)
 {
     if (!$this->socialReactions()) {
         return;
     }
     echo Gdn_Theme::bulletItem('Share');
     //      if ($this->AccessToken()) {
     //         $Url = url("post/twitter/{$Args['RecordType']}?id={$Args['RecordID']}", true);
     //         $CssClass = 'ReactButton Hijack';
     //      } else {
     $Url = url("post/googleplus/{$Args['RecordType']}?id={$Args['RecordID']}", true);
     $CssClass = 'ReactButton PopupWindow';
     //      }
     echo ' ' . anchor(sprite('ReactGooglePlus', 'ReactSprite', t('Share on Google+')), $Url, $CssClass) . ' ';
 }
Example #19
0
 /**
  * Adds 'Discussions' tab to profiles and adds CSS & JS files to their head.
  *
  * @since 2.0.0
  * @package Vanilla
  *
  * @param object $Sender ProfileController.
  */
 public function profileController_addProfileTabs_handler($Sender)
 {
     if (is_object($Sender->User) && $Sender->User->UserID > 0) {
         $UserID = $Sender->User->UserID;
         // Add the discussion tab
         $DiscussionsLabel = sprite('SpDiscussions') . ' ' . t('Discussions');
         $CommentsLabel = sprite('SpComments') . ' ' . t('Comments');
         if (c('Vanilla.Profile.ShowCounts', true)) {
             $DiscussionsLabel .= '<span class="Aside">' . CountString(GetValueR('User.CountDiscussions', $Sender, null), "/profile/count/discussions?userid={$UserID}") . '</span>';
             $CommentsLabel .= '<span class="Aside">' . CountString(GetValueR('User.CountComments', $Sender, null), "/profile/count/comments?userid={$UserID}") . '</span>';
         }
         $Sender->addProfileTab(t('Discussions'), 'profile/discussions/' . $Sender->User->UserID . '/' . rawurlencode($Sender->User->Name), 'Discussions', $DiscussionsLabel);
         $Sender->addProfileTab(t('Comments'), 'profile/comments/' . $Sender->User->UserID . '/' . rawurlencode($Sender->User->Name), 'Comments', $CommentsLabel);
         // Add the discussion tab's CSS and Javascript.
         $Sender->addJsFile('jquery.gardenmorepager.js');
         $Sender->addJsFile('discussions.js', 'vanilla');
     }
 }
Example #20
0
    <h1 class="H"><?php 
echo $this->data('Title');
?>
</h1>
<?php 
// Pager setup
$PagerOptions = array('CurrentRecords' => count($this->data('Conversations')));
if ($this->data('_PagerUrl')) {
    $PagerOptions['Url'] = $this->data('_PagerUrl');
}
// Pre Pager
echo '<div class="PageControls Top">';
PagerModule::write($PagerOptions);
if (checkPermission('Conversations.Conversations.Add')) {
    echo '<div class="BoxButtons BoxNewConversation">';
    echo anchor(sprite('SpMessage') . ' ' . t('New Message'), '/messages/add', 'Button NewConversation Primary');
    echo '</div>';
}
echo '</div>';
?>
    <div class="DataListWrap">
        <h2 class="Hidden"><?php 
echo $this->data('Title');
?>
</h2>
        <ul class="Condensed DataList Conversations">
            <?php 
if (count($this->data('Conversations') > 0)) {
    $ViewLocation = $this->fetchViewLocation('conversations');
    include $ViewLocation;
} else {
 /**
  * Add 'Unresolved' discussions filter to menu.
  *
  * @return void
  */
 public function base_afterDiscussionFilters_handler($sender)
 {
     if (checkPermission('Plugins.Resolved.Manage')) {
         $unresolved .= T('Unresolved') . filterCountString(self::countUnresolved());
         echo '<li class="Unresolved">' . anchor(sprite('SpUnresolved') . ' ' . $unresolved, '/discussions/unresolved') . '</li>';
     }
 }
 /**
  * Build the user profile.
  *
  * Set the page title, add data to page modules, add modules to assets,
  * add tabs to tab menu. $this->User must be defined, or this method will throw an exception.
  *
  * @since 2.0.0
  * @access public
  * @return bool Always true.
  */
 public function buildProfile()
 {
     if (!is_object($this->User)) {
         throw new Exception(t('Cannot build profile information if user is not defined.'));
     }
     $Session = Gdn::session();
     if (strpos($this->CssClass, 'Profile') === false) {
         $this->CssClass .= ' Profile';
     }
     $this->title(Gdn_Format::text($this->User->Name));
     if ($this->_DeliveryType != DELIVERY_TYPE_VIEW) {
         // Javascript needed
         // see note above about jcrop
         $this->addJsFile('jquery.jcrop.min.js');
         $this->addJsFile('profile.js');
         $this->addJsFile('jquery.gardenmorepager.js');
         $this->addJsFile('activity.js');
         // Build activity URL
         $ActivityUrl = 'profile/activity/';
         if ($this->User->UserID != $Session->UserID) {
             $ActivityUrl = userUrl($this->User, '', 'activity');
         }
         // Show activity?
         if (c('Garden.Profile.ShowActivities', true)) {
             $this->addProfileTab(t('Activity'), $ActivityUrl, 'Activity', sprite('SpActivity') . ' ' . t('Activity'));
         }
         // Show notifications?
         if ($this->User->UserID == $Session->UserID) {
             $Notifications = t('Notifications');
             $NotificationsHtml = sprite('SpNotifications') . ' ' . $Notifications;
             $CountNotifications = $Session->User->CountNotifications;
             if (is_numeric($CountNotifications) && $CountNotifications > 0) {
                 $NotificationsHtml .= ' <span class="Aside"><span class="Count">' . $CountNotifications . '</span></span>';
             }
             $this->addProfileTab($Notifications, 'profile/notifications', 'Notifications', $NotificationsHtml);
         }
         // Show invitations?
         if (c('Garden.Registration.Method') == 'Invitation') {
             $this->addProfileTab(t('Invitations'), 'profile/invitations', 'InvitationsLink', sprite('SpInvitations') . ' ' . t('Invitations'));
         }
         $this->fireEvent('AddProfileTabs');
     }
     return true;
 }
function writeConnection($Connection)
{
    $c = Gdn::controller();
    $Enabled = val('Enabled', $Connection);
    $SettingsUrl = val('SettingsUrl', $Connection);
    $Css = array();
    $Css[] = $Enabled ? 'Enabled' : 'Disabled';
    $CssClasses = implode(' ', $Css);
    $Addendums = array();
    //   $RequiresRegistration = val('RequiresRegistration', $Connection);
    //   if ($RequiresRegistration)
    //      $Addendums[] = wrap(t('requires registration'), 'span', array('class' => 'RequiresRegistration'));
    $Configured = val('Configured', $Connection);
    if (!$Configured) {
        $Addendums[] = wrap(t('not configured'), 'span', array('class' => 'NotConfigured'));
    }
    $Index = val('Index', $Connection, val('ProviderKey', $Connection));
    ?>
    <li id="<?php 
    echo "Provider_{$Index}";
    ?>
" class="Item <?php 
    echo $CssClasses;
    ?>
">
        <div class="Connection-Header">
         <span class="IconWrap">
            <?php 
    echo img(Asset(val('Icon', $Connection, '/applications/dashboard/design/images/connection-64.png'), '//'));
    ?>
         </span>
         <span class="Connection-Info">
            <span class="Connection-Name">
               <?php 
    if ($Enabled) {
        echo anchor(val('Name', $Connection, t('Unknown')), $SettingsUrl);
    } else {
        echo val('Name', $Connection, t('Unknown'));
    }
    ?>

                <?php 
    if (sizeof($Addendums)) {
        ?>
                    <span class="Addendums">
                  <?php 
        echo implode(', ', $Addendums);
        ?>
                  </span>
                <?php 
    }
    ?>
            </span>
            <span
                class="Connection-Description"><?php 
    echo val('Description', $Connection, t('Unknown'));
    ?>
</span>
         </span>
         <span class="Connection-Buttons">
            <?php 
    if ($Enabled) {
        echo anchor(sprite('SpOptions'), "/social/{$Connection['Index']}", 'Connection-Configure') . ' ';
        $SliderState = 'Active';
        echo wrap(Anchor(t('Enabled'), "/social/disable/{$Index}", 'Hijack SmallButton'), 'span', array('class' => "ActivateSlider ActivateSlider-{$SliderState}"));
    } else {
        $SliderState = 'InActive';
        echo wrap(Anchor(t('Disabled'), "/social/enable/{$Index}", 'Hijack SmallButton'), 'span', array('class' => "ActivateSlider ActivateSlider-{$SliderState}"));
    }
    ?>
</span>
        </div>
    </li>
<?php 
}
Example #24
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
/** Displays the "Edit My Profile" or "Back to Profile" buttons on the top of the profile page. */
?>
<div class="ProfileOptions">
    <?php 
$Controller = Gdn::controller();
$Controller->fireEvent('BeforeProfileOptions');
echo ButtonGroup($Controller->EventArguments['MemberOptions'], 'NavButton MemberButtons');
echo ' ';
echo ButtonDropDown($Controller->EventArguments['ProfileOptions'], 'NavButton ProfileButtons Button-EditProfile', sprite('SpEditProfile', 'Sprite16') . ' <span class="Hidden">' . t('Edit Profile') . '</span>');
?>
</div>
 /**
  * Output Quote link.
  */
 protected function addReactButton($Sender, $Args)
 {
     if ($this->accessToken()) {
         $Url = url("post/twitter/{$Args['RecordType']}?id={$Args['RecordID']}", true);
         $CssClass = 'ReactButton Hijack';
     } else {
         $Url = url("post/twitter/{$Args['RecordType']}?id={$Args['RecordID']}", true);
         $CssClass = 'ReactButton PopupWindow';
     }
     echo anchor(sprite('ReactTwitter', 'Sprite ReactSprite', t('Share on Twitter')), $Url, $CssClass);
 }
Example #26
0
                    echo wrap(sprite('Warning', 'BigSprite', 'Unsure') . T('The community is split.'), 'p', ['title' => $title]);
                }
            }
        }
        if ($session->isValid()) {
            $data = $this->data('UserConfidenceRecord', false);
            $worksClass = 'WorksButton Button Hijack';
            $brokenClass = 'BrokenButton Button Hijack';
            if ($data) {
                $worksClass .= $data->Weight > 0 ? ' Active' : ' Disabled';
                $brokenClass .= $data->Weight <= 0 ? ' Active' : ' Disabled';
            }
            echo '<div>';
            echo wrap(t('What do you think?'), 'h4');
            echo anchor(sprite('Check', 'Sprite', 'It works!') . 'It works!', 'addon/works/' . $addonVersionID . '/' . $coreVersion->AddonVersionID, ['class' => $worksClass]);
            echo anchor(sprite('Cross', 'Sprite', 'It\'s broken!') . 'It\'s broken!', 'addon/broken/' . $addonVersionID . '/' . $coreVersion->AddonVersionID, ['class' => $brokenClass]);
            echo '</div>';
        }
        ?>
            </div>
            <?php 
    }
    ?>

            <?php 
    if (is_array($this->data('Requirements')) && count($this->data('Requirements'))) {
        ?>
            <div class="Box RequirementBox">
                <h3><?php 
        echo t('Requirements');
        ?>
 /**
  * Output Quote link.
  */
 protected function addQuoteButton($Sender, $Args)
 {
     if (!Gdn::session()->UserID) {
         return;
     }
     if (isset($Args['Comment'])) {
         $Object = $Args['Comment'];
         $ObjectID = 'Comment_' . $Args['Comment']->CommentID;
     } elseif (isset($Args['Discussion'])) {
         $Object = $Args['Discussion'];
         $ObjectID = 'Discussion_' . $Args['Discussion']->DiscussionID;
     } else {
         return;
     }
     echo Gdn_Theme::BulletItem('Flags');
     echo anchor(sprite('ReactQuote', 'ReactSprite') . ' ' . t('Quote'), url("post/quote/{$Object->DiscussionID}/{$ObjectID}", true), 'ReactButton Quote Visible') . ' ';
 }
Example #28
0
        $CModeration = $ModerationCount > 0 ? ' ' . Wrap($ModerationCount, 'span class="Alert"') : '';
        if ($Session->checkPermission('Garden.Users.Approve')) {
            echo wrap(Anchor(sprite('SpApplicants') . ' ' . t('Applicants') . $CApplicant, '/dashboard/user/applicants'), 'li', array('class' => 'link-applicants'));
        }
        if ($Session->checkPermission(array('Garden.Settings.Manage', 'Garden.Moderation.Manage', 'Moderation.ModerationQueue.Manage'), false)) {
            echo wrap(Anchor(sprite('SpSpam') . ' ' . t('Spam Queue') . $CSpam, '/dashboard/log/spam'), 'li', array('class' => 'link-spam'));
        }
        if ($Session->checkPermission(array('Garden.Settings.Manage', 'Garden.Moderation.Manage', 'Moderation.ModerationQueue.Manage'), false)) {
            echo wrap(Anchor(sprite('SpMod') . ' ' . t('Moderation Queue') . $CModeration, '/dashboard/log/moderation'), 'li', array('class' => 'link-moderation'));
        }
        if ($Session->checkPermission(array('Garden.Settings.View', 'Garden.Settings.Manage'), false)) {
            echo wrap(Anchor(sprite('SpDashboard') . ' ' . t('Dashboard'), '/dashboard/settings'), 'li', array('class' => 'link-dashboard'));
        }
    }
    $this->fireEvent('FlyoutMenu');
    echo wrap('<hr />' . anchor(sprite('SpSignOut') . ' ' . t('Sign Out'), SignOutUrl()), 'li', array('class' => 'SignInOutWrap SignOutWrap link-signout'));
    echo '</ul>';
    echo '</div>';
    echo '</span>';
    // Sign Out
    // echo anchor(sprite('SpSignOut', 'Sprite16').Wrap(t('Sign Out'), 'em'), SignOutUrl(), 'MeButton', array('title' => t('Sign Out')));
    echo '</div>';
    echo '</div>';
    echo '</div>';
} else {
    echo '<div class="MeBox MeBox-SignIn' . $CssClass . '">';
    echo '<div class="SignInLinks">';
    echo anchor(t('Sign In'), SignInUrl($this->_Sender->SelfUrl), SignInPopup() ? ' SignInPopup' : '', array('rel' => 'nofollow'));
    $Url = RegisterUrl($this->_Sender->SelfUrl);
    if (!empty($Url)) {
        echo Bullet(' ') . anchor(t('Register'), $Url, 'ApplyButton', array('rel' => 'nofollow')) . ' ';
Example #29
0
 /**
  * Add "Message" option to profile options.
  */
 public function profileController_beforeProfileOptions_handler($Sender, $Args)
 {
     if (!$Sender->EditMode && Gdn::session()->UserID != $Sender->User->UserID && Gdn::session()->checkPermission('Conversations.Conversations.Add')) {
         $Sender->EventArguments['MemberOptions'][] = array('Text' => sprite('SpMessage') . ' ' . t('Message'), 'Url' => '/messages/add/' . $Sender->User->Name, 'CssClass' => 'MessageUser');
     }
 }
Example #30
0
    ?>
        </ul>
        <div class="P PagerContainer">
            <?php 
    if (checkPermission('Conversations.Conversations.Add')) {
        echo anchor(sprite('SpNewConversation SpAdd') . t('New Message'), '/messages/add');
    }
    ?>
            <span class="Pager"><?php 
    echo anchor(t('Moreā€¦'), '/messages/inbox');
    ?>
</span>
        </div>
    <?php 
} else {
    ?>
        <?php 
    echo wrap(t('Your private conversations with other members.'), 'div', array('class' => 'P'));
    ?>
        <div class="P PagerContainer">
            <?php 
    if (checkPermission('Conversations.Conversations.Add')) {
        echo anchor(sprite('SpNewConversation SpAdd') . t('New Message'), '/messages/add');
    }
    ?>
        </div>
    <?php 
}
?>
</div>