本文整理汇总了PHP中RoleModel::getApplicantCount方法的典型用法代码示例。如果您正苦于以下问题:PHP RoleModel::getApplicantCount方法的具体用法?PHP RoleModel::getApplicantCount怎么用?PHP RoleModel::getApplicantCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoleModel
的用法示例。
在下文中一共展示了RoleModel::getApplicantCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getApplicantCount
/**
* Get the current number of applicants waiting to be approved.
*
* @return int Returns the number of applicants or 0 if the registration method isn't set to approval.
*/
public function getApplicantCount()
{
$roleModel = new RoleModel();
$result = $roleModel->getApplicantCount();
return $result;
}
示例2: siteNavModule_init_handler
/**
*
*
* @param SiteNavModule $sender
*/
public function siteNavModule_init_handler($sender)
{
// GLOBALS
// Add a link to the community home.
$sender->addLinkToGlobals(t('Community Home'), '/', 'main.home', '', -100, array('icon' => 'home'), false);
$sender->addGroupToGlobals('', 'etc', '', 100);
$sender->addLinkToGlobalsIf(Gdn::session()->isValid() && IsMobile(), t('Full Site'), '/profile/nomobile', 'etc.nomobile', '', 100, array('icon' => 'resize-full'));
$sender->addLinkToGlobalsIf(Gdn::session()->isValid(), t('Sign Out'), SignOutUrl(), 'etc.signout', '', 100, array('icon' => 'signout'));
$sender->addLinkToGlobalsIf(!Gdn::session()->isValid(), t('Sign In'), SigninUrl(), 'etc.signin', '', 100, array('icon' => 'signin'));
// DEFAULTS
if (!Gdn::session()->isValid()) {
return;
}
$sender->addLinkIf(Gdn::session()->isValid(), t('Profile'), '/profile', 'main.profile', 'profile', 10, array('icon' => 'user'))->addLinkIf('Garden.Activity.View', t('Activity'), '/activity', 'main.activity', 'activity', 10, array('icon' => 'time'));
// Add the moderation items.
$sender->addGroup(t('Moderation'), 'moderation', 'moderation', 90);
if (Gdn::session()->checkPermission('Garden.Users.Approve')) {
$RoleModel = new RoleModel();
$applicant_count = (int) $RoleModel->getApplicantCount();
if ($applicant_count > 0 || true) {
$sender->addLink(t('Applicants'), '/user/applicants', 'moderation.applicants', 'applicants', array(), array('icon' => 'user', 'badge' => $applicant_count));
}
}
$sender->addLinkIf('Garden.Moderation.Manage', t('Spam Queue'), '/log/spam', 'moderation.spam', 'spam', array(), array('icon' => 'spam'))->addLinkIf('Garden.Settings.Manage', t('Dashboard'), '/settings', 'etc.dashboard', 'dashboard', array(), array('icon' => 'dashboard'));
$user = Gdn::controller()->data('Profile');
$user_id = val('UserID', $user);
//EDIT PROFILE SECTION
// Users can edit their own profiles and moderators can edit any profile.
$sender->addLinkToSectionIf(hasEditProfile($user_id), 'EditProfile', t('Profile'), userUrl($user, '', 'edit'), 'main.editprofile', '', array(), array('icon' => 'edit'))->addLinkToSectionIf('Garden.Users.Edit', 'EditProfile', t('Edit Account'), '/user/edit/' . $user_id, 'main.editaccount', 'Popup', array(), array('icon' => 'cog'))->addLinkToSection('EditProfile', t('Back to Profile'), userUrl($user), 'main.profile', '', 100, array('icon' => 'arrow-left'));
//PROFILE SECTION
$sender->addLinkToSectionIf(c('Garden.Profile.ShowActivities', true), 'Profile', t('Activity'), userUrl($user, '', 'activity'), 'main.activity', '', array(), array('icon' => 'time'))->addLinkToSectionIf(Gdn::controller()->data('Profile.UserID') == Gdn::session()->UserID, 'Profile', t('Notifications'), userUrl($user, '', 'notifications'), 'main.notifications', '', array(), array('icon' => 'globe', 'badge' => Gdn::controller()->data('Profile.CountNotifications')))->addLinkToSectionIf(strcasecmp(c('Garden.Registration.Method'), 'invitation') === 0, 'Profile', t('Invitations'), userUrl($user, '', 'invitations'), 'main.invitations', '', array(), array('icon' => 'ticket'))->addLinkToSectionIf(hasEditProfile($user_id), 'Profile', t('Edit Profile'), userUrl($user, '', 'edit'), 'Profile', 'main.editprofile', '', array(), array('icon' => 'edit'));
}
示例3: handleApplicant
/**
* Handle a user application.
*
* @since 2.0.0
* @access private
* @see UserModel::decline, UserModel::approve
*
* @param string $Action Approve or Decline.
* @param int $UserID Unique ID.
* @return bool Whether handling was successful.
*/
private function handleApplicant($Action, $UserID)
{
$this->permission('Garden.Users.Approve');
if (!in_array($Action, array('Approve', 'Decline')) || !is_numeric($UserID)) {
$this->Form->addError('ErrorInput');
$Result = false;
} else {
$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()));
}
}
}
return $Result;
}
示例4: siteNavModule_default_handler
/**
*
*
* @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));
}
if (Gdn::session()->checkPermission('Garden.Activity.View')) {
$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')));
}
}