예제 #1
0
 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
0
파일: Domainname.php 프로젝트: habtom/uas
 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
0
 /**
  * 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
0
    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
0
 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
0
 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
0
파일: User.php 프로젝트: rayku/rayku
 /**
  * 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
0
	<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
0
 public function executeResult()
 {
     $this->myid = $this->getUser()->getAttribute('userid');
     //Changes in the next 3 lines are to cater the issue # 72
     $orgflag = 1;
     /*if($this->getUser()->getAttribute('userid')){
      		$orgflag = 1;
      	}*/
     $sortcriteria = $this->getRequestParameter('sort');
     if (!$sortcriteria) {
         $sortcriteria = $this->getUser()->getAttribute('lastsortparam');
     } else {
         //$this->getUser()->setAttribute('assort', $sortcriteria);
         if ($this->getUser()->getAttribute('lastsortparam') == $sortcriteria) {
             if ($this->getUser()->getAttribute('lastsortact') == 123) {
                 $sorttype = 321;
             } else {
                 $sorttype = 123;
             }
         }
         $this->getUser()->setAttribute('lastsortparam', $sortcriteria);
         $this->getUser()->setAttribute('lastsortact', $sorttype);
     }
     $this->fname = $firstname = $this->getsets('firstname');
     $this->lname = $lastname = $this->getsets('lastname');
     $this->br = $branchid = $this->getsetd('branch');
     $this->yr = $yearid = $this->getsetd('year');
     $this->chap = $chapterid = $this->getsetd('chapter');
     $this->usertypeid = $usertypeid = $this->getsetd('usertype');
     $this->loc = $location = $this->getsets('location');
     $this->cn = $countryid = $this->getsetd('country');
     $chjoin = 0;
     $c = new Criteria();
     $c->addJoin(UserPeer::ID, PersonalPeer::USER_ID);
     if ($firstname) {
         $c->add(PersonalPeer::FIRSTNAME, $firstname);
     }
     if ($lastname) {
         $c->add(PersonalPeer::LASTNAME, $lastname);
     }
     $this->privacyfilter($branchid, $orgflag, $c, 'user.BRANCH_ID', 'user.BRANCHFLAG');
     $this->privacyfilter($yearid, $orgflag, $c, 'user.GRADUATIONYEAR', 'user.GRADUATIONYEARFLAG');
     if ($chapterid != 0) {
         $c->addJoin(UserPeer::ID, UserchapterregionPeer::USER_ID);
         $c->addJoin(UserchapterregionPeer::CHAPTERREGION_ID, ChapterregionPeer::ID);
         $c->add(ChapterregionPeer::CHAPTER_ID, $chapterid);
         $chjoin = 1;
     }
     $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
0
 public function getOnlineUsersCount()
 {
     return \UserPeer::doCount(\UserPeer::getOnlineUsersCriteria());
 }
예제 #11
0
파일: User.php 프로젝트: rapila/cms-base
 public function isFirstAdministrator()
 {
     return UserPeer::doCount(new Criteria()) === 1 && $this->getIsAdmin() && !$this->getIsInactive() && $this->getIsBackendLoginEnabled();
 }
예제 #12
0
 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
0
 public function getLeadersCount($c = null)
 {
     $c = UserPeer::getUsergroupLeaderCriteria($this->getId(), $c);
     return UserPeer::doCount($c);
 }