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


PHP Presenter::convertUserIdsToPresenterIds方法代码示例

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


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

示例1: search

 /**
  * Search function for Parties
  * Provides limited fields to display in a list of
  * possible matches.
  * This function prepares a list of party ids
  * based on the search type, then sends then into
  * _getSearchResults to get the party objects
  *
  * See _getSearchResults for structure
  *
  * @param string $search_term
  * @param array $filters
  * @param string $search_type
  * @return array|bool
  */
 public function search($search_term, $filters, $search_type)
 {
     $sql = "SELECT p.id as party_id " . "FROM {$this->_table_name} p ";
     switch ($search_type) {
         case "party_name":
             $column_name = "name";
             $sql .= "WHERE p.{$column_name} " . "LIKE CONCAT('%', :st,'%') ";
             break;
         case "party_hostess_name":
             require_once APPLICATION_PATH . MODEL_DIR . '/User.php';
             $user = new User();
             $filters["presenter_only"] = "false";
             $filters["active_only"] = "false";
             $user_ids_string = '';
             if ($user_ids_first_name_array = $user->getUsersByName($search_term, $filters, "first", FALSE)) {
                 $user_ids_string = implode(',', $user_ids_first_name_array);
             }
             if ($user_ids_last_name_array = $user->getUsersByName($search_term, $filters, "last", FALSE)) {
                 if ($user_ids_string != '') {
                     $user_ids_string .= ",";
                 }
                 $user_ids_string .= implode(',', $user_ids_last_name_array);
             }
             $column_name = "hostess_id";
             if ($user_ids_string != '') {
                 $sql .= " WHERE p.{$column_name} " . " IN ({$user_ids_string}) ";
             } else {
                 return FALSE;
             }
             break;
         case "party_presenter_name":
             require_once APPLICATION_PATH . MODEL_DIR . '/User.php';
             require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php';
             $user = new User();
             $presenter = new Presenter();
             $filters["presenter_only"] = "false";
             $filters["active_only"] = "false";
             $user_ids_string = '';
             if ($user_ids_first_name_array = $user->getUsersByName($search_term, $filters, "first", FALSE)) {
                 $user_ids_string = implode(',', $user_ids_first_name_array);
             }
             if ($user_ids_last_name_array = $user->getUsersByName($search_term, $filters, "last", FALSE)) {
                 if ($user_ids_string != '') {
                     $user_ids_string .= ",";
                 }
                 $user_ids_string .= implode(',', $user_ids_last_name_array);
             }
             $presenter_ids_string = $presenter->convertUserIdsToPresenterIds($user_ids_string);
             $column_name = "presenter_id";
             if ($user_ids_string != '') {
                 $sql .= " WHERE p.{$column_name} " . " IN ({$presenter_ids_string}) ";
             } else {
                 return FALSE;
             }
             break;
         case "party_presenter_sequence_id":
             require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php';
             $presenter = new Presenter();
             $presenter_id = $presenter->getIdBySequenceId($search_term);
             $sql .= " WHERE p.presenter_id = {$presenter_id} ";
             break;
         case "party_id":
         default:
             $party_ids = array($search_term);
     }
     if ($filters["recent_only"] != "false") {
         $sql .= "AND DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= p.end_time ";
     }
     if (!isset($party_ids)) {
         $party_ids = array();
         $query = $this->_db->prepare($sql);
         $query->bindParam(':st', $search_term);
         $query->execute();
         while ($row = $query->fetch()) {
             $party_ids[] = $row['party_id'];
         }
     }
     $result = array();
     if (count($party_ids) > 0) {
         $results = $this->_getSearchResults($party_ids);
     }
     return $results;
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:98,代码来源:Party.php


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