本文整理汇总了PHP中SC_Utils_Ex::makeArrayIDToKey方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Utils_Ex::makeArrayIDToKey方法的具体用法?PHP SC_Utils_Ex::makeArrayIDToKey怎么用?PHP SC_Utils_Ex::makeArrayIDToKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Utils_Ex
的用法示例。
在下文中一共展示了SC_Utils_Ex::makeArrayIDToKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTreeTrail
/**
* 階層情報が含まれている配列から親ID配列を取得する.
*
* @param integer $start_id 取得起点
* @param string $primary_key 主キー名
* @param string $glue_key 親IDキー名
* @param array $correction 階層構造が含まれている配列
* @param boolean $cid_is_key キーがIDの配列の場合はtrue
* @param integer $root_id ルートID
* @param boolean $id_only IDだけの配列を返す場合はtrue
* @return array 親ID配列
*/
public static function getTreeTrail($start_id, $primary_key, $glue_key, $correction = array(), $cid_is_key = FALSE, $root_id = 0, $id_only = TRUE)
{
if ($cid_is_key) {
$arrIDToKay = $correction;
} else {
$arrIDToKay = SC_Utils_Ex::makeArrayIDToKey($primary_key, $correction);
}
$id = $start_id;
$arrTrail = array();
while ($id != $root_id && !SC_Utils_Ex::isBlank($id)) {
if ($id_only) {
$arrTrail[] = $id;
} else {
$arrTrail[] = $arrIDToKay[$id];
}
if (isset($arrIDToKay[$id][$glue_key])) {
$id = $arrIDToKay[$id][$glue_key];
} else {
$id = $root_id;
}
}
return array_reverse($arrTrail);
}
示例2: getListByProductIds
/**
* 商品IDを指定し、商品一覧を取得する
*
* SC_Query::setOrder() や SC_Query::setLimitOffset() を設定して, 商品一覧
* の配列を取得する.
* FIXME: 呼び出し元で設定した、SC_Query::setWhere() も有効に扱いたい。
*
* @param SC_Query $objQuery SC_Query インスタンス
* @param array $arrProductId 商品ID
* @return array 商品一覧の配列 (キー: 商品ID)
*/
public function getListByProductIds(&$objQuery, $arrProductId = array())
{
if (empty($arrProductId)) {
return array();
}
$where = 'alldtl.product_id IN (' . SC_Utils_Ex::repeatStrWithSeparator('?', count($arrProductId)) . ')';
$where .= ' AND alldtl.del_flg = 0';
$objQuery->setWhere($where, $arrProductId);
$arrProducts = $this->lists($objQuery);
// 配列のキーを商品IDに
$arrProducts = SC_Utils_Ex::makeArrayIDToKey('product_id', $arrProducts);
// SC_Query::setOrder() の指定がない場合、$arrProductId で指定された商品IDの順に配列要素を並び替え
if (strlen($objQuery->order) === 0) {
$arrTmp = array();
foreach ($arrProductId as $product_id) {
$arrTmp[$product_id] = $arrProducts[$product_id];
}
$arrProducts =& $arrTmp;
unset($arrTmp);
}
// 税込金額を設定する
SC_Product_Ex::setIncTaxToProducts($arrProducts);
return $arrProducts;
}
示例3: getList
/**
* カテゴリー一覧の取得.
*
* @param boolean $cid_to_key 配列のキーをカテゴリーIDにする場合はtrue
* @return array カテゴリー一覧の配列
*/
public function getList($cid_to_key = FALSE)
{
static $arrCategory = array(), $cidIsKey = array();
if (!isset($arrCategory[$this->count_check])) {
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = 'dtb_category.*, dtb_category_total_count.product_count';
$from = 'dtb_category left join dtb_category_total_count ON dtb_category.category_id = dtb_category_total_count.category_id';
// 登録商品数のチェック
if ($this->count_check) {
$where = 'del_flg = 0 AND product_count > 0';
} else {
$where = 'del_flg = 0';
}
$objQuery->setOption('ORDER BY rank DESC');
$arrTmp = $objQuery->select($col, $from, $where);
$arrCategory[$this->count_check] = $arrTmp;
}
if ($cid_to_key) {
if (!isset($cidIsKey[$this->count_check])) {
// 配列のキーをカテゴリーIDに
$cidIsKey[$this->count_check] = SC_Utils_Ex::makeArrayIDToKey('category_id', $arrCategory[$this->count_check]);
}
return $cidIsKey[$this->count_check];
}
return $arrCategory[$this->count_check];
}
示例4: search
static function search(LC_Page $objPage, SC_FormParam $objFormParam, SC_Query $objQuery)
{
// edit_** を除外する
$objSql = new SC_DeviceAndroidSelect_Ex($objFormParam->getSearchArray(), "master");
$objPage->tpl_linemax = $objSql->getCount();
if ($objPage->tpl_linemax == 0) {
return;
}
$objPage->page_max = $objFormParam->getValue("search_page_max", SEARCH_PMAX);
$objPage->page = $objFormParam->getValue("search_pageno", 1);
$objPage->objPageNavi = new SC_PageNavi_Ex($objPage->page, $objPage->tpl_linemax, $objPage->page_max, 'eccube.moveSearchPage', NAVI_PMAX);
$objPage->arrPagenavi = $objPage->objPageNavi->arrPagenavi;
$objSql->setOrder("device_name ASC");
$objPage->arrData = $objSql->getList($objPage->objPageNavi, $objPage->page_max);
$objPage->arrData = SC_Utils_Ex::makeArrayIDToKey("device_id", $objPage->arrData);
foreach ($objPage->arrData as $device_id => &$arrData) {
$arrData["category_id"] = $objQuery->getCol("category_id", "cp_dtb_device_categories", "device_id=?", (array) $device_id);
$release_date = SC_Utils_Ex::sfDispDBDate($arrData["release_date"], false);
if ($release_date) {
$arrData["release_date"] = str_replace("1970/01/01", "", $release_date);
}
$last_access_date = SC_Utils_Ex::sfDispDBDate($arrData["last_access_date"], false);
if ($last_access_date) {
$arrData["last_access_date"] = str_replace("1970/01/01", "", $last_access_date);
}
$device_name = trim($arrData["device_name"]);
$arrData["disp_device_name"] = str_replace("(", "\n(", $device_name);
}
}
示例5: init
function init()
{
parent::init();
$objCustomer = new SC_Customer_Ex();
if (isset($_GET["sid"]) && isset($_GET["admin"])) {
$sid = $_REQUEST["sid"];
$email = $objCustomer->getValue("email");
$osid = session_id();
if ($osid != $sid) {
session_destroy();
session_id($sid);
session_start();
}
$objCustomer->setLogin($email);
$get = $_GET;
unset($get["sid"]);
SC_Response_Ex::reload($get, true);
}
$objQuery = SC_Query_Ex::getSingletonInstance();
$objProduct = new SC_Product_Ex();
if (GC_Utils_Ex::isFrontFunction() && $this->skip_load_page_layout == false) {
$objCustomer = new SC_Customer_Ex();
// 画面更新毎に情報を更新する
if ($objCustomer->isLoginSuccess()) {
// 初回アクセス時に更新
$objCustomer->updateSession();
$this->tpl_login = true;
$this->tpl_point = $objCustomer->getValue("point");
$this->tpl_customer_id = $objCustomer->getValue("customer_id");
$this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date");
$this->tpl_carrier = $objCustomer->getValue("carrier");
$downloadable_days = $this->arrSiteInfo["downloadable_days"];
$downloadable_days_unlimited = $this->arrSiteInfo["downloadable_days_unlimited"];
$date = null;
if ($downloadable_days_unlimited) {
$date = SC_Utils_Ex::sfGetTimestamp(RELEASE_YEAR, 1, 1, false);
$date2 = SC_Utils_Ex::sfGetTimestamp(9999, 12, 31, false);
} else {
$xdate = strtotime("-{$downloadable_days} day");
$date = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false);
$xdate = strtotime("+{$downloadable_days} day");
$date2 = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false);
}
$this->downloadable_days = $date;
$this->downloadable_days2 = $date2;
$objPurchase = new SC_Helper_Purchase_Ex();
$arrOrderId = $objQuery->getCol("order_id", "dtb_order", "payment_date > ? AND customer_id = ?", array($date, $this->tpl_customer_id));
$this->arrRedownloadProduct = array();
foreach ($arrOrderId as $order_id) {
$arrOrderDetail = $objPurchase->getOrderDetail($order_id, true);
$this->arrRedownloadProduct = array_merge($this->arrRedownloadProduct, $arrOrderDetail);
}
// 再ダウンロード可能な商品一覧
$this->arrRedownloadProduct = SC_Utils_Ex::makeArrayIDToKey("product_id", $this->arrRedownloadProduct);
foreach ($this->arrRedownloadProduct as $product_id => $row) {
$row["product"] = $objProduct->getDetail($product_id);
$this->arrRedownloadProduct[$product_id] = $row;
}
} else {
$this->tpl_login = false;
$this->tpl_point = 0;
$this->tpl_customer_id = 0;
$this->tpl_first_buy_date = null;
$this->tpl_carrier = 9;
$this->arrRedownloadProduct = array();
}
$objDb = new SC_Helper_DB_Ex();
if ($objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) {
$where = " customer_id = ? AND transaction_status = ? AND continue_account_id IS NOT NULL AND del_flg = 0";
$arrWhereVal = array($this->tpl_customer_id, 40);
if ($objQuery->exists("cp_dtb_customer_transaction", $where, $arrWhereVal)) {
// OK
} else {
switch (basename(dirname($_SERVER["SCRIPT_NAME"]))) {
case "au":
break;
default:
if ($objCustomer->isLoginSuccess()) {
$objCustomer->EndSession();
SC_Response_Ex::reload();
}
break;
}
}
}
$objCategory = new SC_Helper_Category_Ex();
$this->arrCommonCategory = $objCategory->getList(true);
$this->arrCommonCategoryTree = $objCategory->getTree();
$detect = new Mobile_Detect();
$script_file = $_SERVER["SCRIPT_NAME"];
$script_file = ltrim($script_file, "/");
$script_file2 = str_replace("ios/", "", $script_file);
if ($detect->is("iOS")) {
if (file_exists(HTML_REALDIR . "ios/{$script_file}")) {
SC_Response_Ex::sendRedirect(HTTP_URL . "ios/{$script_file}", $_GET);
}
} elseif (strcmp($script_file, $script_file2) !== 0) {
SC_Response_Ex::sendRedirect(HTTP_URL . "{$script_file2}", $_GET);
}
$_SESSION["is_android"] = $detect->is("AndroidOS");
//.........这里部分代码省略.........