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


PHP Presenter::getIdBySequenceId方法代码示例

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


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

示例1: saveCredit

 /**
  * Saves a new product credit
  *
  * @param int $market_id
  * @param int $presenter_sequence_id The presenter sequence id
  * @param int $credit_type
  * @param decimal $amount
  * @param int $user_id
  * @return boolean
  */
 public function saveCredit($market_id, $presenter_sequence_id, $credit_type, $amount, $user_id)
 {
     $entry_type_id = 2;
     $status_type_id = 2;
     $ref = CakeSession::read('admin_user')->id;
     $entry_user = 'Customer service portal';
     //convert presenter sequence id to primary key id
     require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php';
     $presenter = new Presenter();
     $presenter_id = $presenter->getIdBySequenceId($presenter_sequence_id);
     $sql = "INSERT INTO {$this->_table_name} " . "(market_id, user_id, presenter_id, product_credit_type_id, product_credit_entry_type_id, product_credit_status_type_id, entry_user, created, reference_id, amount) " . "VALUES (:market, :user, :presenter, :type, :entry, :status, :entry_user, NOW(), :ref, :amt)";
     $query = $this->_db->prepare($sql);
     $query->bindParam(':market', $market_id);
     $query->bindParam(':user', $user_id);
     $query->bindParam(':presenter', $presenter_id);
     $query->bindParam(':type', $credit_type);
     $query->bindParam(':entry', $entry_type_id);
     $query->bindParam(':status', $status_type_id);
     $query->bindParam(':ref', $ref);
     $query->bindParam(':entry_user', $entry_user);
     $query->bindParam(':amt', $amount);
     if ($query->execute()) {
         return TRUE;
     }
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:35,代码来源:Product_credits.php

示例2: loadDataByPresenterSequenceId

 /**
  * Loads a coupon presenter record
  *
  * If noe exists, this function will create it and then load the record just created.
  *
  * @param int $presenter_sequence_id
  */
 public function loadDataByPresenterSequenceId($presenter_sequence_id)
 {
     //first get the presenter id
     require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php';
     $presenter = new Presenter();
     $presenter_id = $presenter->getIdBySequenceId($presenter_sequence_id);
     //then see if there's a record for that presenter
     $this->data = $this->getDataByPresenterId($presenter_id);
     //add if not
     if ($this->data == FALSE) {
         $sql = "INSERT INTO {$this->_table_name} " . "(presenter_id,coupon_id,start_date,end_date,max_redemptions,discount_percentage,discount_flat) " . "VALUES(:p_id, 1, NOW(),'0000-00-00 00:00:00',-1,50,0) ";
         $query = $this->_db->prepare($sql);
         $query->bindParam(':p_id', $presenter_id);
         $query->execute();
         $coupon_presenter_id = $this->_db->lastInsertId();
         $this->data = $this->getDataById($coupon_presenter_id);
     }
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:25,代码来源:Coupon_presenter.php

示例3: Presenter

            $result->message = "Hostess changed successfully.";
        } else {
            $result->success = FALSE;
            $result->message = "Failed to change hostess.";
        }
    }
}
/**
 * Handler for the change presenter functionality
 */
if (isset($_POST['form']) && $_POST['form'] == "change_presenter") {
    if (isset($_POST['presenter_sequence_id']) && isset($_POST['party_id'])) {
        //get the presenter id from the sequence id
        require_once APPLICATION_PATH . MODEL_DIR . '/Presenter.php';
        $presenter = new Presenter();
        $presenter_id = $presenter->getIdBySequenceId($_POST['presenter_sequence_id']);
        if ($presenter_id) {
            $data = array("id" => $_POST['party_id'], "presenter_id" => $presenter_id);
            require_once APPLICATION_PATH . MODEL_DIR . '/Party.php';
            $party = new Party();
            $party->set($data);
            if ($party->save()) {
                $result->success = TRUE;
                $result->message = "Presenter changed successfully.";
            } else {
                $result->success = FALSE;
                $result->message = "Failed to change presenter.";
            }
        } else {
            $result->success = FALSE;
            $result->message = "Failed to change presenter. Check the presenter id.";
开发者ID:kameshwariv,项目名称:testexample,代码行数:31,代码来源:updateParty.php

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