/**
  * Handle a user application.
  *
  * @since 2.0.0
  * @access private
  * @see self::Decline, self::Approve
  * @param string $Action Approve or Decline.
  * @param int $UserID Unique ID.
  */
 private function handleApplicant($Action, $UserID)
 {
     $this->permission('Garden.Users.Approve');
     //$this->_DeliveryType = DELIVERY_TYPE_BOOL;
     if (!in_array($Action, array('Approve', 'Decline')) || !is_numeric($UserID)) {
         $this->Form->addError('ErrorInput');
         $Result = false;
     } else {
         $Session = Gdn::session();
         $UserModel = new UserModel();
         if (is_numeric($UserID)) {
             try {
                 $this->EventArguments['UserID'] = $UserID;
                 $this->fireEvent("Before{$Action}User");
                 $Email = new Gdn_Email();
                 $Result = $UserModel->{$Action}($UserID, $Email);
                 // Re-calculate applicant count
                 $RoleModel = new RoleModel();
                 $RoleModel->GetApplicantCount(true);
                 $this->fireEvent("After{$Action}User");
             } catch (Exception $ex) {
                 $Result = false;
                 $this->Form->addError(strip_tags($ex->getMessage()));
             }
         }
     }
 }
 /**
  * @param SiteNavModule $sender
  */
 public function SiteNavModule_default_handler($sender)
 {
     if (Gdn::Session()->IsValid()) {
         $sender->addLink('main.profile', array('text' => t('Profile'), 'url' => '/profile', 'icon' => icon('user'), 'sort' => 10));
     }
     $sender->addLink('main.activity', array('text' => t('Activity'), 'url' => '/activity', 'icon' => icon('time'), 'sort' => 10));
     // Add the moderation items.
     $sender->addGroup('moderation', array('text' => t('Moderation'), 'sort' => 90));
     if (Gdn::Session()->CheckPermission('Garden.Users.Approve')) {
         $RoleModel = new RoleModel();
         $applicant_count = (int) $RoleModel->GetApplicantCount();
         if ($applicant_count > 0 || true) {
             $sender->addLink('moderation.applicants', array('text' => t('Applicants'), 'url' => '/user/applicants', 'icon' => icon('user'), 'badge' => countString($applicant_count)));
         }
     }
     if (Gdn::Session()->CheckPermission('Garden.Modertion.Manage')) {
         $sender->addLink('moderation.spam', array('text' => 'Spam Queue', 'url' => '/log/spam', 'icon' => icon('spam')));
         //         $sender->addLink('moderation.queue', array('text' => 'Moderaton Queue', 'url' => '/log/moderation', 'icon' => icon('report')));
     }
     if (Gdn::Session()->CheckPermission('Garden.Settings.Manage')) {
         $sender->addLink('etc.dashboard', array('text' => t('Dashboard'), 'url' => '/settings', 'icon' => icon('dashboard')));
     }
 }
Beispiel #3
0
$CssClass = '';
if ($this->CssClass) {
    $CssClass .= ' ' . $this->CssClass;
}
$DashboardCount = 0;
// Spam & Moderation Queue
if ($Session->CheckPermission('Garden.Settings.Manage') || $Session->CheckPermission('Garden.Moderation.Manage')) {
    $LogModel = new LogModel();
    $SpamCount = $LogModel->GetOperationCount('spam');
    $ModerationCount = $LogModel->GetOperationCount('moderate');
    $DashboardCount += $SpamCount + $ModerationCount;
}
// Applicant Count
if ($Session->CheckPermission('Garden.Applicants.Manage')) {
    $RoleModel = new RoleModel();
    $ApplicantCount = $RoleModel->GetApplicantCount();
    $DashboardCount += $ApplicantCount;
}
if ($Session->IsValid()) {
    echo '<div class="MeBox' . $CssClass . '">';
    echo UserPhoto($User);
    echo '<div class="WhoIs">';
    echo UserAnchor($User, 'Username');
    echo '<div class="MeMenu">';
    // Notifications
    $CountNotifications = $User->CountNotifications;
    $CNotifications = is_numeric($CountNotifications) && $CountNotifications > 0 ? '<span class="Alert">' . $CountNotifications . '</span>' : '';
    echo '<span class="ToggleFlyout" rel="/profile/notificationspopin">';
    echo Anchor(Sprite('SpNotifications', 'Sprite Sprite16') . Wrap(T('Notifications'), 'em') . $CNotifications, UserUrl($User), 'MeButton FlyoutButton', array('title' => T('Notifications')));
    echo Sprite('SpFlyoutHandle', 'Arrow');
    echo '<div class="Flyout FlyoutMenu"></div></span>';
 /**
  * Show how many applicants are in the queue.
  *
  * @since 2.0.0
  * @access public
  */
 public function ApplicantCount()
 {
     $this->Permission('Garden.Applicants.Manage');
     $RoleModel = new RoleModel();
     $Count = $RoleModel->GetApplicantCount();
     if ($Count > 0) {
         echo '<span class="Alert">', $Count, '</span>';
     }
 }