當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。