当前位置: 首页>>代码示例>>PHP>>正文


PHP Default_Model_Countries::count方法代码示例

本文整理汇总了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;
 }
开发者ID:IASA-GR,项目名称:appdb-core,代码行数:11,代码来源:AppTeamBase.php

示例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]);
                             }
//.........这里部分代码省略.........
开发者ID:IASA-GR,项目名称:appdb-core,代码行数:101,代码来源:UsersController.php


注:本文中的Default_Model_Countries::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。