本文整理汇总了PHP中Default_Model_Countries::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Countries::count方法的具体用法?PHP Default_Model_Countries::count怎么用?PHP Default_Model_Countries::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Default_Model_Countries
的用法示例。
在下文中一共展示了Default_Model_Countries::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCountry
public function getCountry()
{
if ($this->_country === null) {
$Countries = new Default_Model_Countries();
$Countries->filter->id->equals($this->getCountryID());
if ($Countries->count() > 0) {
$this->_country = $Countries->items[0];
}
}
return $this->_country;
}
示例2: loginAction
public function loginAction()
{
/* Check whether the user is already logged in */
if ($this->session->userid !== null) {
if (!$this->handle_actions()) {
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
header('Location: https://' . $_SERVER['HTTP_HOST'] . '/');
}
return;
}
$this->view->session = $this->session;
$ldap = ApplicationConfiguration::service('egi.ldap.host');
if (array_key_exists('username', $_POST)) {
$this->view->username = $_POST['username'];
$username = "uid=" . $_POST['username'] . ",ou=People,dc=egi,dc=eu";
$password = $_POST['password'];
$ds = $this->initLDAP(true, $username, $password);
if (is_resource($ds)) {
@ldap_close($ds);
$username = $_POST['username'];
$this->session->username = $username;
$users = new Default_Model_Researchers();
$users->viewModerated = true;
$users->filter->username->equals($username);
if ($users->count() == 1) {
if (!$users->items[0]->deleted) {
$this->session->userid = $users->items[0]->Id;
$this->session->userRole = $users->items[0]->positionTypeID;
$this->session->userCountryID = $users->items[0]->countryID;
$this->session->userCountryName = $users->items[0]->country->name;
$this->session->user = $users->items[0];
$this->session->fullName = $users->items[0]->firstName . " " . $users->items[0]->lastName;
$this->session->cname = $users->items[0]->cname;
setAuthCookies($username, md5($password));
$user = $users->items[0];
$user->lastLogin = time();
$user->password = md5($password);
// TODO: remove this when SAML has been implemented
$user->save();
$this->saveUserCredentials($user->id, md5($password));
// TODO: replace with SAML Auth token
$this->handle_actions();
} else {
$this->view->accountDeleted = true;
error_log(var_export($users->items[0]->delInfo, true));
$this->view->accountDeleter = $users->items[0]->delInfo->deleter->name;
$this->view->accountDeleterID = $users->items[0]->delInfo->deleter->id;
$this->view->accountDeletedOn = $users->items[0]->delInfo->deletedOn;
}
} else {
$this->session->claimPassword = md5($password);
$ds = $this->initLDAP(true);
// no rdn/pwd: root connection
if ($ds !== false) {
$users2 = new Default_Model_Contacts();
$sr = ldap_search($ds, "ou=people,dc=egi,dc=eu", "(uid=" . $_POST['username'] . ")");
$info = ldap_get_entries($ds, $sr);
ldap_close($ds);
if ($info["count"] > 0) {
$this->session->fullName = $info[0]['cn'][0];
$users2->filter->data->ilike($info[0]['mail'][0]);
if ($users2->refresh()->count() != 0) {
// Found existing profiles
$ids = array();
for ($i = 0; $i < $users2->count(); $i++) {
$ids[] = $users2->items[$i]->researcherid;
}
$users->viewModerated = false;
$users->filter->id->in($ids);
$users->refresh();
$entries = array();
$canClaim = array();
for ($i = 0; $i < $users->count(); $i++) {
$entries[] = $users->items[$i];
$canClaim[] = $users->items[$i]->id;
}
$this->view->entries = $entries;
$this->session->canClaim = $canClaim;
} else {
// Create a new profile
$roleTypeID = 3;
if (array_key_exists('usercertificatesubject', $info[0])) {
$sub = explode('/', $info[0]['usercertificatesubject'][0]);
foreach ($sub as $s) {
if (substr($s, 0, 2) == 'C=') {
$country = substr($s, 2);
$cs = new Default_Model_Countries();
$cs->filter->isocode->equals($country);
if ($cs->count() > 0) {
$this->view->country = $cs->items[0]->name;
}
break;
}
}
}
if (array_key_exists('sn', $info[0])) {
$this->view->lastname = $info[0]['sn'][0];
$this->view->firstname = str_replace($info[0]['sn'][0], "", $info[0]['cn'][0]);
}
//.........这里部分代码省略.........