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


PHP DAO::next方法代码示例

本文整理汇总了PHP中DAO::next方法的典型用法代码示例。如果您正苦于以下问题:PHP DAO::next方法的具体用法?PHP DAO::next怎么用?PHP DAO::next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DAO的用法示例。


在下文中一共展示了DAO::next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executeIndex

 /**
  * Performs the logic for logging into the LWS backend CMS.
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->setLayout('login');
     if ($request->isMethod('POST')) {
         $dao = new DAO();
         $pw = md5($dao->getEscapedSQLString(trim($request->getPostParameter('pw'))));
         $email = $dao->getEscapedSQLString(trim(strtolower($request->getPostParameter('email'))));
         $dao->query("\n  \t\t\tSELECT be_user.*, role \n  \t\t\tFROM be_user INNER JOIN be_role USING(role_id) \n  \t\t\tWHERE email='{$email}' AND password='{$pw}' LIMIT 1\n  \t\t");
         if ($dao->queryOK()) {
             $user = $dao->next();
             $dao->query("SELECT last_login_ts FROM be_user WHERE email='{$user['email']}'");
             // I know that there is a record in the DB with this email, so no need to check
             $ts_row = $dao->next();
             $last_login = is_null($ts_row['last_login_ts']) ? 'N/A' : date('M jS Y @ g:i A', $ts_row['last_login_ts']);
             $dao->query("UPDATE be_user SET last_login_ts=UNIX_TIMESTAMP() WHERE email='{$user['email']}'");
             $this->getUser()->setAttribute('be_user', array('first_name' => $user['first_name'], 'last_name' => $user['last_name'], 'full_name' => "{$user['first_name']} {$user['last_name']}", 'email' => $user['email'], 'role' => $user['role'], 'phone' => $user['phone'], 'phone_ext' => $user['phone_ext'], 'last_login' => $last_login, 'password' => $user['password']));
             $this->getUser()->setAuthenticated(true);
             $this->getUser()->addCredential($user['role']);
         } else {
             if ($this->getUser()->hasAttribute('be_user')) {
                 $this->getUser()->getAttributeHolder()->remove('be_user');
             }
             $this->getUser()->setAuthenticated(false);
             $this->getUser()->setFlash('login_error', 'Invalid email and/or password!');
         }
         // allows users to go directly to requested page after login
         $uri = $this->getContext()->getRouting()->getCurrentInternalUri(true);
         $this->redirect($uri);
     }
     return sfView::SUCCESS;
 }
开发者ID:morganney,项目名称:livewire,代码行数:36,代码来源:actions.class.php

示例2: createSections

 public function createSections(DAO $dao)
 {
     if ($dao->queryOK()) {
         $sections = array();
         $row = $dao->next();
         $count = $row['cnt'];
         $letter = $row[$this->_subcat_field][0];
         $first_section = $last_section = $row[$this->_subcat_field];
         while ($row = $dao->next()) {
             if ($row[$this->_subcat_field][0] == $letter) {
                 // aggregating mode
                 $count += $row['cnt'];
                 $last_section = $row[$this->_subcat_field];
             } else {
                 // section assignment mode
                 $section = $first_section == $last_section ? $first_section : "{$first_section}-{$last_section}";
                 $sections[] = array('section' => $section, 'section_slug' => LWS::slugify($section), 'count' => $count);
                 // update loop values for next section
                 $count = $row['cnt'];
                 $letter = $row[$this->_subcat_field][0];
                 $first_section = $last_section = $row[$this->_subcat_field];
             }
         }
         // end while()
         // add last section aggregated
         $section = $first_section == $last_section ? $first_section : "{$first_section}-{$last_section}";
         $sections[] = array('section' => $section, 'section_slug' => LWS::slugify($section), 'count' => $count);
     } else {
         $sections = NULL;
     }
     return $sections;
 }
开发者ID:morganney,项目名称:livewire,代码行数:32,代码来源:FrameTypeSubcategory.class.php


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