本文整理汇总了PHP中UserPeer::doCount方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::doCount方法的具体用法?PHP UserPeer::doCount怎么用?PHP UserPeer::doCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::doCount方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeHeader
public function executeHeader()
{
$this->modname = $this->getContext()->getModuleName();
$this->actname = $this->getContext()->getActionName();
$this->fullaction = $this->modname . "*" . $this->actname;
if ($this->fullaction === "user*lorform" || $this->fullaction === "user*composemail") {
$this->modname = 'search';
}
if ($this->getUser()->hasCredential('masterauth')) {
$c = new Criteria();
$c->add(UserPeer::AUTHCODE, sfConfig::get('app_authcode_masterauth'));
$c->add(UserPeer::ISLOCKED, '2');
$this->claimed = UserPeer::doCount($c);
} else {
$c = new Criteria();
$c->add(UserPeer::ISLOCKED, '2');
$this->claimed = UserPeer::doCount($c);
}
if ($this->getUser()->hasCredential('masterauth')) {
$c = new Criteria();
$c->add(UserPeer::AUTHCODE, sfConfig::get('app_authcode_masterauth'));
$c->add(UserPeer::ISLOCKED, '3');
$this->newreg = UserPeer::doCount($c);
} else {
$c = new Criteria();
$c->add(UserPeer::ISLOCKED, '3');
$this->newreg = UserPeer::doCount($c);
}
}
示例2: getUserCount
public function getUserCount()
{
// select count(*) from user where domainname_id = $this->getId()
$criteria = new Criteria();
$criteria->add(UserPeer::DOMAINNAME_ID, $this->getId());
// do the counting on the user model
return UserPeer::doCount($criteria);
}
示例3: countUsers
/**
* Returns the number of related User objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related User objects.
* @throws PropelException
*/
public function countUsers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if ($criteria === null) {
$criteria = new Criteria(EnumItemPeer::DATABASE_NAME);
} else {
$criteria = clone $criteria;
}
if ($distinct) {
$criteria->setDistinct();
}
$count = null;
if ($this->collUsers === null) {
if ($this->isNew()) {
$count = 0;
} else {
$criteria->add(UserPeer::TYPE_ID, $this->id);
$count = UserPeer::doCount($criteria, $con);
}
} else {
// criteria has no effect for a new object
if (!$this->isNew()) {
// the following code is to determine if a new query is
// called for. If the criteria is the same as the last
// one, just return count of the collection.
$criteria->add(UserPeer::TYPE_ID, $this->id);
if (!isset($this->lastUserCriteria) || !$this->lastUserCriteria->equals($criteria)) {
$count = UserPeer::doCount($criteria, $con);
} else {
$count = count($this->collUsers);
}
} else {
$count = count($this->collUsers);
}
}
return $count;
}
示例4: link_to
echo link_to($yearstat->getYear(), 'search/result?usertype=1&year=' . $yearstat->getYear(), array('title' => 'Click here to see a list of users from ' . $yearstat->getYear()));
?>
</b>
</div>
<?php
$ytotal = 0;
foreach ($branchstats as $branchstat) {
?>
<?php
$c = new Criteria();
$c->add(UserPeer::BRANCH_ID, $branchstat->getBrid());
$c->add(UserPeer::GRADUATIONYEAR, $yearstat->getYear());
?>
<div class="statCol">
<?php
$yb = UserPeer::doCount($c);
$ytotal += $yb;
$btotal[$branchstat->getBrid()] += $yb;
$gtotal += $yb;
echo link_to($yb, 'search/result?usertype=1&branch=' . $branchstat->getBrid() . '&year=' . $yearstat->getYear(), array('title' => 'Click here to see a list of users from ' . $branchstat->getBranch()->getCode() . ' ' . $yearstat->getYear() . ' batch'));
?>
</div>
<?php
}
?>
<div class="statColTot">
<b><?php
echo link_to($ytotal, 'search/result?usertype=1&year=' . $yearstat->getYear(), array('title' => 'Click here to see a list of users from year ' . $yearstat->getYear()));
?>
</b>
</div>
示例5: executeDeletebadge
public function executeDeletebadge()
{
$badgeid = $this->getRequestParameter('id');
$c = new Criteria();
$c->add(UserbadgePeer::BADGE_ID, $badgeid);
$ucount = UserPeer::doCount($c);
$exuser = UserPeer::doSelectOne($c);
if ($exuser) {
$this->setFlash('notice', 'Badge could not be deleted. <b>' . $ucount . '</b> users are holding this badge.');
} else {
$badge = BadgePeer::retrieveByPK($badgeid);
$badge->delete();
$this->setFlash('notice', 'Badge deleted successfully.');
}
$this->redirect('/admin/badges');
}
示例6: countUsers
public function countUsers($criteria = null, $distinct = false, $con = null)
{
include_once 'lib/model/om/BaseUserPeer.php';
if ($criteria === null) {
$criteria = new Criteria();
} elseif ($criteria instanceof Criteria) {
$criteria = clone $criteria;
}
$criteria->add(UserPeer::DEPARTMENT_ID, $this->getId());
return UserPeer::doCount($criteria, $distinct, $con);
}
示例7: generatePasswordRecoverKey
/**
* Generate new password reset key for this user
*
*/
public function generatePasswordRecoverKey()
{
do {
$key = stringGenerator::generate();
$key = sha1($key);
// make sure that key isn't in use elsewhere..
$c = new Criteria();
$c->add(UserPeer::PASSWORD_RECOVER_KEY, $key);
$count = UserPeer::doCount($c);
$failure = $count > 0;
} while ($failure);
$this->setPasswordRecoverKey($key);
$this->save();
}
示例8: Criteria
<div class="<?php
if ($i % 2 == 0) {
echo 'evenRow';
} else {
echo 'oddRow';
}
?>
">
<div class="statColB1"><?php
echo $branchstat->getBranch()->getName() . " (" . $branchstat->getBranch()->getCode() . ") ";
?>
</div>
<?php
$c = new Criteria();
$c->add(UserPeer::BRANCH_ID, $branchstat->getBrid());
$currentcount = UserPeer::doCount($c);
$gtotal += $currentcount;
?>
<div class="statColB2"><?php
echo link_to($currentcount, 'search/result?usertype=1&branch=' . $branchstat->getBranch()->getId(), array('title' => 'Click here to see a list of users from ' . $branchstat->getBranch()->getCode()));
?>
</div>
</div>
<?php
}
?>
<div class="<?php
$i++;
if ($i % 2 == 0) {
echo 'evenRow';
} else {
示例9: executeResult
//.........这里部分代码省略.........
$c->add(UserPeer::USERTYPE, $usertypeid);
if ($location) {
$c->add(UserPeer::CURRENTLYAT, $location);
if ($orgflag) {
$c->add(UserPeer::CURRENTLYATFLAG, sfConfig::get('app_privacycode_me'), Criteria::NOT_EQUAL);
} else {
$c->add(UserPeer::CURRENTLYATFLAG, sfConfig::get('app_privacycode_world'), Criteria::EQUAL);
}
}
//$this->privacyfilter($countryid, $orgflag, $c, 'address.COUNTRY', 'address.COUNTRYFLAG');
if ($countryid != 0) {
$c->add(AddressPeer::COUNTRY, $countryid);
if ($orgflag) {
$c->add(AddressPeer::COUNTRYFLAG, sfConfig::get('app_privacycode_me'), Criteria::NOT_EQUAL);
} else {
$c->add(AddressPeer::COUNTRYFLAG, sfConfig::get('app_privacycode_world'), Criteria::EQUAL);
}
}
if ($sortcriteria) {
switch ($sortcriteria) {
case "name":
$this->ascdesc($sorttype, 'personal.FIRSTNAME', $c);
break;
case "roll":
$this->ascdesc($sorttype, 'user.ROLL', $c);
break;
case "year":
$this->ascdesc($sorttype, 'user.GRADUATIONYEAR', $c);
break;
case "branch":
$this->ascdesc($sorttype, 'user.BRANCH_ID', $c);
break;
case "degree":
$this->ascdesc($sorttype, 'user.DEGREE_ID', $c);
break;
case "chapter":
if (!$chjoin) {
$c->addJoin(UserPeer::ID, UserchapterregionPeer::USER_ID);
$c->addJoin(UserchapterregionPeer::CHAPTERREGION_ID, ChapterregionPeer::ID);
$c->addJoin(ChapterregionPeer::CHAPTER_ID, ChapterPeer::ID);
}
$this->ascdesc($sorttype, 'chapter.NAME', $c);
break;
case "reg":
$this->ascdesc($sorttype, 'user.ISLOCKED', $c);
break;
case "lastlogin":
$this->ascdesc($sorttype, 'user.LASTLOGIN', $c);
break;
}
}
$pageoptions = array();
for ($i = sfConfig::get('app_pager_min'); $i <= sfConfig::get('app_pager_max'); $i += sfConfig::get('app_pager_step')) {
$pageoptions[$i] = "View " . $i . " Results";
}
$this->pageoptions = $pageoptions;
$maxresult = $this->getRequestParameter('maxresult');
if (!$maxresult) {
$maxresult = $this->getUser()->getAttribute('maxresult');
} else {
$this->getUser()->setAttribute('maxresult', $maxresult);
}
if ($maxresult) {
$pager = new sfPropelPager('User', $maxresult);
$this->maxresult = $maxresult;
} else {
$pager = new sfPropelPager('User', sfConfig::get('app_pager_min'));
}
$cr = new Criteria();
$cr->add(RolePeer::ASSIGNABLE, '1');
$cr->addAscendingOrderByColumn(RolePeer::DISPLAYNAME);
$roles = RolePeer::doSelect($cr);
$rolelist = array();
foreach ($roles as $role) {
$rolelist[$role->getId()] = $role->getDisplayname();
}
$this->rolelist = $rolelist;
$cx = new Criteria();
$this->worktypes = WorktypePeer::doSelect($cx);
//$c->addJoin(PersonalPeer::ID, PersonalWorktypePeer::PERSONAL_ID);
$c->setDistinct();
foreach ($this->worktypes as $worktype) {
if ($this->getRequestParameter($worktype->getId())) {
$c->addJoin(PersonalPeer::ID, PersonalWorktypePeer::PERSONAL_ID);
$c->add(PersonalWorktypePeer::WORKTYPE_ID, $worktype->getId());
}
}
//$c->addGroupByColumn(PersonalWorktypePeer::PERSONAL_ID);
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
$this->getUser()->setAttribute('srpage', $this->getRequestParameter('page', 1));
if (!$this->getUser()->getAttribute('resultcount')) {
$this->count = UserPeer::doCount($c);
$this->getUser()->setAttribute('resultcount', $this->count);
} else {
$this->count = $this->getUser()->getAttribute('resultcount');
}
}
示例10: getOnlineUsersCount
public function getOnlineUsersCount()
{
return \UserPeer::doCount(\UserPeer::getOnlineUsersCriteria());
}
示例11: isFirstAdministrator
public function isFirstAdministrator()
{
return UserPeer::doCount(new Criteria()) === 1 && $this->getIsAdmin() && !$this->getIsInactive() && $this->getIsBackendLoginEnabled();
}
示例12: isEmailUnique
public static function isEmailUnique($email)
{
$c = new Criteria();
$c->add(UserPeer::EMAIL, $email);
$c->add(UserPeer::PASSWORD, null, Criteria::ISNOTNULL);
$count = UserPeer::doCount($c);
return $count == 0 ? 1 : 0;
}
示例13: getLeadersCount
public function getLeadersCount($c = null)
{
$c = UserPeer::getUsergroupLeaderCriteria($this->getId(), $c);
return UserPeer::doCount($c);
}