本文整理汇总了PHP中SC_Utils_Ex::sfGetTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Utils_Ex::sfGetTimestamp方法的具体用法?PHP SC_Utils_Ex::sfGetTimestamp怎么用?PHP SC_Utils_Ex::sfGetTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Utils_Ex
的用法示例。
在下文中一共展示了SC_Utils_Ex::sfGetTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lfGetWhere
/**
* WHERE文の作成
*
* @param array $arrForm フォームデータ
* @return array WHERE文、判定値
*/
function lfGetWhere($arrForm)
{
//削除されていない商品を検索
$where = "A.del_flg = 0 AND B.del_flg = 0";
foreach ($arrForm as $key => $val) {
if (empty($val)) {
continue;
}
switch ($key) {
case 'search_reviewer_name':
$val = preg_replace("/ /", "%", $val);
$where .= " AND reviewer_name LIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_reviewer_url':
$val = preg_replace("/ /", "%", $val);
$where .= " AND reviewer_url LIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_name':
$val = preg_replace("/ /", "%", $val);
$where .= " AND name LIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_product_code':
$val = preg_replace("/ /", "%", $val);
$where .= " AND A.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? )";
$arrval[] = "%{$val}%";
break;
case 'search_sex':
$tmp_where = "";
//$val=配列の中身,$element=各キーの値(1,2)
if (is_array($val)) {
foreach ($val as $element) {
if ($element != "") {
if ($tmp_where == "") {
$tmp_where .= " AND (sex = ?";
} else {
$tmp_where .= " OR sex = ?";
}
$arrval[] = $element;
}
}
if ($tmp_where != "") {
$tmp_where .= ")";
$where .= " {$tmp_where} ";
}
}
break;
case 'search_recommend_level':
$where .= " AND recommend_level = ? ";
$arrval[] = $val;
break;
case 'search_startyear':
if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
$where .= " AND A.create_date >= ? ";
$arrval[] = $date;
}
break;
case 'search_endyear':
if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
$end_date = date("Y/m/d", strtotime("1 day", strtotime($date)));
$where .= " AND A.create_date <= cast('{$end_date}' as date) ";
}
break;
}
}
return array($where, $arrval);
}
示例2: buildQuery
/**
* クエリを構築する.
*
* 検索条件のキーに応じた WHERE 句と, クエリパラメーターを構築する.
* クエリパラメーターは, SC_FormParam の入力値から取得する.
*
* 構築内容は, 引数の $where 及び $arrValues にそれぞれ追加される.
*
* @param string $key 検索条件のキー
* @param string $where 構築する WHERE 句
* @param array $arrValues 構築するクエリパラメーター
* @param SC_FormParam $objFormParam SC_FormParam インスタンス
* @return void
*/
public function buildQuery($key, &$where, &$arrValues, &$objFormParam)
{
switch ($key) {
case "search_year":
case "search_month":
case "search_day":
if ($key != "search_year") {
break;
}
$y = $objFormParam->getValue('search_year');
$m = $objFormParam->getValue('search_month');
$d = $objFormParam->getValue('search_day');
$where .= ' AND create_date BETWEEN ? AND ? ';
$arrValues[] = SC_Utils_Ex::sfGetTimestamp($y, $m, $d);
$arrValues[] = SC_Utils_Ex::sfGetTimestamp($y, $m, $d, true);
break;
case 'search_order_id':
$where .= ' AND order_id = ?';
$arrValues[] = sprintf('%d', $objFormParam->getValue($key));
break;
case 'search_customer_id':
$where .= ' AND customer_id = ?';
$arrValues[] = sprintf('%d', $objFormParam->getValue($key));
break;
case 'search_product_id':
$where .= ' AND EXISTS (SELECT 1 FROM dtb_order_detail od WHERE od.order_id = dtb_order.order_id AND od.product_id = ?)';
$arrValues[] = sprintf('%d', $objFormParam->getValue($key));
break;
default:
parent::buildQuery($key, $where, $arrValues, $objFormParam);
break;
}
}
示例3: process
//.........这里部分代码省略.........
$nonmark_val = ereg_replace("[()-]+", "", $val);
$arrval[] = "%{$nonmark_val}%";
break;
case 'search_order_email':
$where .= " AND order_email ILIKE ?";
$arrval[] = "%{$val}%";
break;
case 'search_payment_id':
$tmp_where = "";
foreach ($val as $element) {
if ($element != "") {
if ($tmp_where == "") {
$tmp_where .= " AND (payment_id = ?";
} else {
$tmp_where .= " OR payment_id = ?";
}
$arrval[] = $element;
}
}
if ($tmp_where != "") {
$tmp_where .= ")";
$where .= " {$tmp_where} ";
}
break;
case 'search_total1':
$where .= " AND total >= ?";
$arrval[] = $val;
break;
case 'search_total2':
$where .= " AND total <= ?";
$arrval[] = $val;
break;
case 'search_sorderyear':
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_sorderyear'], $_POST['search_sordermonth'], $_POST['search_sorderday']);
$where .= " AND create_date >= ?";
$arrval[] = $date;
break;
case 'search_eorderyear':
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_eorderyear'], $_POST['search_eordermonth'], $_POST['search_eorderday'], true);
$where .= " AND create_date <= ?";
$arrval[] = $date;
break;
case 'search_supdateyear':
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_supdateyear'], $_POST['search_supdatemonth'], $_POST['search_supdateday']);
$where .= " AND update_date >= ?";
$arrval[] = $date;
break;
case 'search_eupdateyear':
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_eupdateyear'], $_POST['search_eupdatemonth'], $_POST['search_eupdateday'], true);
$where .= " AND update_date <= ?";
$arrval[] = $date;
break;
case 'search_sbirthyear':
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_sbirthyear'], $_POST['search_sbirthmonth'], $_POST['search_sbirthday']);
$where .= " AND order_birth >= ?";
$arrval[] = $date;
break;
case 'search_ebirthyear':
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_ebirthyear'], $_POST['search_ebirthmonth'], $_POST['search_ebirthday'], true);
$where .= " AND order_birth <= ?";
$arrval[] = $date;
break;
case 'search_order_status':
$where .= " AND status = ?";
$arrval[] = $val;
break;
示例4: buildQuery
/**
* クエリを構築する.
*
* 検索条件のキーに応じた WHERE 句と, クエリパラメーターを構築する.
* クエリパラメーターは, SC_FormParam の入力値から取得する.
*
* 構築内容は, 引数の $where 及び $arrValues にそれぞれ追加される.
*
* @param string $key 検索条件のキー
* @param string $where 構築する WHERE 句
* @param array $arrValues 構築するクエリパラメーター
* @param SC_FormParam $objFormParam SC_FormParam インスタンス
* @return void
*/
function buildQuery($key, &$where, &$arrValues, &$objFormParam)
{
$dbFactory = SC_DB_DBFactory_Ex::getInstance();
switch ($key) {
case 'search_product_name':
$where .= ' AND EXISTS (SELECT 1 FROM dtb_order_detail od WHERE od.order_id = dtb_order.order_id AND od.product_name LIKE ?)';
$arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key));
break;
case 'search_order_name':
$where .= ' AND ' . $dbFactory->concatColumn(array('order_name01', 'order_name02')) . ' LIKE ?';
$arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key));
break;
case 'search_order_kana':
$where .= ' AND ' . $dbFactory->concatColumn(array('order_kana01', 'order_kana02')) . ' LIKE ?';
$arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key));
break;
case 'search_order_id1':
$where .= ' AND order_id >= ?';
$arrValues[] = sprintf('%d', $objFormParam->getValue($key));
break;
case 'search_order_id2':
$where .= ' AND order_id <= ?';
$arrValues[] = sprintf('%d', $objFormParam->getValue($key));
break;
case 'search_order_sex':
$tmp_where = '';
foreach ($objFormParam->getValue($key) as $element) {
if ($element != '') {
if (SC_Utils_Ex::isBlank($tmp_where)) {
$tmp_where .= ' AND (order_sex = ?';
} else {
$tmp_where .= ' OR order_sex = ?';
}
$arrValues[] = $element;
}
}
if (!SC_Utils_Ex::isBlank($tmp_where)) {
$tmp_where .= ')';
$where .= " {$tmp_where} ";
}
break;
case 'search_order_tel':
$where .= ' AND (' . $dbFactory->concatColumn(array('order_tel01', 'order_tel02', 'order_tel03')) . ' LIKE ?)';
$arrValues[] = sprintf('%%%d%%', preg_replace('/[()-]+/', '', $objFormParam->getValue($key)));
break;
case 'search_order_email':
$where .= ' AND order_email LIKE ?';
$arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key));
break;
case 'search_payment_id':
$tmp_where = '';
foreach ($objFormParam->getValue($key) as $element) {
if ($element != '') {
if ($tmp_where == '') {
$tmp_where .= ' AND (payment_id = ?';
} else {
$tmp_where .= ' OR payment_id = ?';
}
$arrValues[] = $element;
}
}
if (!SC_Utils_Ex::isBlank($tmp_where)) {
$tmp_where .= ')';
$where .= " {$tmp_where} ";
}
break;
case 'search_total1':
$where .= ' AND total >= ?';
$arrValues[] = sprintf('%d', $objFormParam->getValue($key));
break;
case 'search_total2':
$where .= ' AND total <= ?';
$arrValues[] = sprintf('%d', $objFormParam->getValue($key));
break;
case 'search_sorderyear':
$date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_sorderyear'), $objFormParam->getValue('search_sordermonth'), $objFormParam->getValue('search_sorderday'));
$where .= ' AND create_date >= ?';
$arrValues[] = $date;
break;
case 'search_eorderyear':
$date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_eorderyear'), $objFormParam->getValue('search_eordermonth'), $objFormParam->getValue('search_eorderday'), true);
$where .= ' AND create_date <= ?';
$arrValues[] = $date;
break;
case 'search_supdateyear':
$date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_supdateyear'), $objFormParam->getValue('search_supdatemonth'), $objFormParam->getValue('search_supdateday'));
//.........这里部分代码省略.........
示例5: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$objView = new SC_AdminView();
$objSess = new SC_Session();
$objDate = new SC_Date();
$objQuery = new SC_Query();
// 状態の設定
// 登録・更新検索開始年
$objDate->setStartYear(RELEASE_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrStartYear = $objDate->getYear();
$this->arrStartMonth = $objDate->getMonth();
$this->arrStartDay = $objDate->getDay();
// 登録・更新検索終了年
$objDate->setStartYear(RELEASE_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrEndYear = $objDate->getYear();
$this->arrEndMonth = $objDate->getMonth();
$this->arrEndDay = $objDate->getDay();
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
// トラックバック情報のカラムの取得(viewとの結合のため、テーブルをAと定義しておく)
$select = "A.trackback_id, A.product_id, A.blog_name, A.title, A.url, ";
$select .= "A.excerpt, A.status, A.create_date, A.update_date, B.name";
$from = "dtb_trackback AS A LEFT JOIN dtb_products AS B ON A.product_id = B.product_id ";
// 検索ワードの引き継ぎ
foreach ($_POST as $key => $val) {
if (ereg("^search_", $key)) {
$this->arrHidden[$key] = $val;
}
}
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
// トラックバックの削除
if ($_POST['mode'] == "delete") {
$objQuery->exec("UPDATE dtb_trackback SET del_flg = 1, update_date = now() WHERE trackback_id = ?", array($_POST['trackback_id']));
}
if ($_POST['mode'] == 'search' || $_POST['mode'] == 'csv' || $_POST['mode'] == 'delete') {
//削除されていない商品を検索
$where = "A.del_flg = 0 AND B.del_flg = 0";
$this->arrForm = $_POST;
//エラーチェック
$this->arrErr = $this->lfCheckError();
if (!$this->arrErr) {
foreach ($_POST as $key => $val) {
$val = SC_Utils_Ex::sfManualEscape($val);
if ($val == "") {
continue;
}
switch ($key) {
case 'search_blog_name':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND A.blog_name ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_blog_title':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND A.title ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_blog_url':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND A.url ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_status':
if (isset($_POST['search_status'])) {
$where .= " AND A.status = ? ";
$arrval[] = $val;
}
break;
case 'search_name':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND B.name ILIKE ? ";
$arrval[] = "%{$val}%";
break;
case 'search_product_code':
$val = ereg_replace(" ", "%", $val);
$val = ereg_replace(" ", "%", $val);
$where .= " AND B.product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? )";
$arrval[] = "%{$val}%";
break;
case 'search_startyear':
if (isset($_POST['search_startyear']) && isset($_POST['search_startmonth']) && isset($_POST['search_startday'])) {
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
$where .= " AND A.create_date >= ? ";
$arrval[] = $date;
}
break;
case 'search_endyear':
//.........这里部分代码省略.........
示例6: lfMakeSqlVal
/**
* 会員登録に必要なSQLパラメーターの配列を生成する.
*
* フォームに入力された情報を元に, SQLパラメーターの配列を生成する.
* モバイル端末の場合は, email を email_mobile にコピーし,
* mobile_phone_id に携帯端末IDを格納する.
*
* @param mixed $objFormParam
* @access private
* @return $arrResults
*/
public function lfMakeSqlVal(&$objFormParam)
{
$arrForm = $objFormParam->getHashArray();
$arrResults = $objFormParam->getDbArray();
// 生年月日の作成
$arrResults['birth'] = SC_Utils_Ex::sfGetTimestamp($arrForm['year'], $arrForm['month'], $arrForm['day']);
// 仮会員 1 本会員 2
$arrResults['status'] = CUSTOMER_CONFIRM_MAIL == true ? '1' : '2';
/*
* secret_keyは、テーブルで重複許可されていない場合があるので、
* 本会員登録では利用されないがセットしておく。
*/
$arrResults['secret_key'] = SC_Helper_Customer_Ex::sfGetUniqSecretKey();
// 入会時ポイント
$CONF = SC_Helper_DB_Ex::sfGetBasisData();
$arrResults['point'] = $CONF['welcome_point'];
if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
// 携帯メールアドレス
$arrResults['email_mobile'] = $arrResults['email'];
// PHONE_IDを取り出す
$arrResults['mobile_phone_id'] = SC_MobileUserAgent_Ex::getId();
}
return $arrResults;
}
示例7: lfRegistData
function lfRegistData($uniqid)
{
$arrRet = $this->objFormParam->getHashArray();
$sqlval = $this->objFormParam->getDbArray();
// 登録データの作成
$sqlval['order_temp_id'] = $uniqid;
$sqlval['order_birth'] = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']);
$sqlval['update_date'] = 'Now()';
$sqlval['customer_id'] = '0';
// 既存データのチェック
$objQuery = new SC_Query();
$where = "order_temp_id = ?";
$cnt = $objQuery->count("dtb_order_temp", $where, array($uniqid));
// 既存データがない場合
if ($cnt == 0) {
$sqlval['create_date'] = 'Now()';
$objQuery->insert("dtb_order_temp", $sqlval);
} else {
$objQuery->update("dtb_order_temp", $sqlval, $where, array($uniqid));
}
}
示例8: createCustomers
/**
* テスト用 会員データ を生成する.
*
* @return void
*/
function createCustomers()
{
lfPrintLog("createCustomers START.(" . CUSTOMERS_VOLUME . " data)");
for ($i = 0; $i < CUSTOMERS_VOLUME; $i++) {
lfPrintLog("----------");
lfPrintLog("creating customer data count:[" . ($i + 1) . "] start.");
$sqlval['name01'] = "検証";
$sqlval['name02'] = sprintf("太郎%05d", $i + 1);
$sqlval['kana01'] = "ケンショウ";
$sqlval['kana02'] = "タロウ";
$sqlval['zip01'] = '101';
$sqlval['zip02'] = '0051';
$sqlval['pref'] = '13';
// 13:東京都
$sqlval['addr01'] = "千代田区神田神保町";
$sqlval['addr02'] = "1-3-5";
$sqlval['tel01'] = '012';
$sqlval['tel02'] = '3456';
$sqlval['tel03'] = '7890';
$sqlval['email'] = EMAIL_ADDRESS_ACCOUNT . "+" . sprintf("%05d", $i + 1) . EMAIL_ADDRESS_DOMAIN;
$sqlval['sex'] = '1';
// 1:男性 2:女性
$sqlval['password'] = 'test';
$sqlval['reminder'] = '1';
// 1:「母親の旧姓は?」
$sqlval['reminder_answer'] = "てすと";
$sqlval['mailmaga_flg'] = (string) '1';
// 1:HTMLメール 2:テキストメール 3:希望しない
// 生年月日の作成
$sqlval['birth'] = SC_Utils_Ex::sfGetTimestamp(2006, 9, 1);
// 仮会員 1 本会員 2
$sqlval['status'] = '2';
/*
* secret_keyは、テーブルで重複許可されていない場合があるので、
* 本会員登録では利用されないがセットしておく。
*/
$sqlval['secret_key'] = SC_Helper_Customer_Ex::sfGetUniqSecretKey();
// 入会時ポイント
$CONF = SC_Helper_DB_Ex::sfGetBasisData();
$sqlval['point'] = $CONF['welcome_point'];
// 会員データの生成
SC_Helper_Customer_Ex::sfEditCustomerData($sqlval);
print "*";
lfPrintLog("creating customer data count:[" . ($i + 1) . "] end.");
}
print "\n";
lfPrintLog("createCustomers DONE.(" . CUSTOMERS_VOLUME . " data created)");
}
示例9: process
//.........这里部分代码省略.........
//規格名称
$where_in = " (SELECT classcategory_id FROM dtb_classcategory WHERE class_id IN (SELECT class_id FROM dtb_class WHERE name LIKE ?)) ";
$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE classcategory_id1 IN " . $where_in;
$where .= " OR classcategory_id2 IN" . $where_in . ")";
$view_where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE classcategory_id1 IN " . $where_in;
$view_where .= " OR classcategory_id2 IN" . $where_in . ")";
$arrval[] = "%{$val}%";
$arrval[] = "%{$val}%";
$view_where = $where;
break;
case 'search_name':
// 商品名
$where .= " AND name ILIKE ?";
$view_where .= " AND name ILIKE ?";
$arrval[] = "%{$val}%";
break;
case 'search_category_id':
// カテゴリー
list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val);
if ($tmp_where != "") {
$where .= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
$view_where .= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
$arrval = array_merge((array) $arrval, (array) $tmp_arrval);
}
break;
case 'search_product_code':
// 商品コード
$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code ILIKE ? GROUP BY product_id)";
$view_where .= " AND EXISTS (SELECT product_id FROM dtb_products_class as cls WHERE cls.product_code ILIKE ? AND dtb_products.product_id = cls.product_id GROUP BY cls.product_id )";
$arrval[] = "%{$val}%";
break;
case 'search_startyear':
// 登録更新日(FROM)
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_startyear'], $_POST['search_startmonth'], $_POST['search_startday']);
$where .= " AND update_date >= '" . $_POST['search_startyear'] . "/" . $_POST['search_startmonth'] . "/" . $_POST['search_startday'] . "'";
$view_where .= " AND update_date >= '" . $_POST['search_startyear'] . "/" . $_POST['search_startmonth'] . "/" . $_POST['search_startday'] . "'";
break;
case 'search_endyear':
// 登録更新日(TO)
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_endyear'], $_POST['search_endmonth'], $_POST['search_endday']);
$date = date('Y/m/d', strtotime($date) + 86400);
$where .= " AND update_date < date('" . $date . "')";
$view_where .= " AND update_date < date('" . $date . "')";
break;
case 'search_product_flag':
//種別
global $arrSTATUS;
$search_product_flag = SC_Utils_Ex::sfSearchCheckBoxes($val);
if ($search_product_flag != "") {
$where .= " AND product_flag LIKE ?";
$view_where .= " AND product_flag LIKE ?";
$arrval[] = $search_product_flag;
}
break;
case 'search_status':
// ステータス
$tmp_where = "";
foreach ($val as $element) {
if ($element != "") {
if ($tmp_where == "") {
$tmp_where .= "AND (status = ? ";
} else {
$tmp_where .= "OR status = ? ";
}
$arrval[] = $element;
}
示例10: lfRegistData
/**
* データの一時登録を行う.
*
* @param integer $uniqid 受注一時テーブルのユニークID
* @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
* @param SC_Customer $objCustomer SC_Customer インスタンス
* @param SC_FormParam $objFormParam SC_FormParam インスタンス
* @param boolean $isMultiple 複数配送の場合 true
*/
function lfRegistData($uniqid, &$objPurchase, &$objCustomer, &$objFormParam, $isMultiple = false)
{
$arrParams = $objFormParam->getHashArray();
$arrValues = $objFormParam->getDbArray();
// 登録データの作成
$arrValues['order_birth'] = SC_Utils_Ex::sfGetTimestamp($arrParams['year'], $arrParams['month'], $arrParams['day']);
$arrValues['update_date'] = 'CURRENT_TIMESTAMP';
$arrValues['customer_id'] = '0';
// お届け先を指定しない場合、
if ($arrParams['deliv_check'] != '1') {
// order_* を shipping_* へコピー
$objPurchase->copyFromOrder($arrValues, $arrParams);
}
/*
* order_* と shipping_* をそれぞれ $_SESSION['shipping'][$shipping_id]
* に, shipping_* というキーで保存
*/
foreach ($arrValues as $key => $val) {
if (preg_match('/^order_/', $key)) {
$arrOrder['shipping_' . str_replace('order_', '', $key)] = $val;
} elseif (preg_match('/^shipping_/', $key)) {
$arrShipping[$key] = $val;
}
}
if ($isMultiple) {
$objPurchase->saveShippingTemp($arrOrder, 0);
if ($arrParams['deliv_check'] == '1') {
$objPurchase->saveShippingTemp($arrShipping, 1);
}
} else {
if ($arrParams['deliv_check'] == '1') {
$objPurchase->saveShippingTemp($arrShipping, 0);
} else {
$objPurchase->saveShippingTemp($arrOrder, 0);
}
}
$objPurchase->saveOrderTemp($uniqid, $arrValues, $objCustomer);
}
示例11: sfGetTimestamp
protected function sfGetTimestamp($arrList, $prefix = "", $end = false)
{
$y = $arrList["{$prefix}_year"];
$m = $arrList["{$prefix}_month"];
$d = $arrList["{$prefix}_day"];
return SC_Utils_Ex::sfGetTimestamp($y, $m, $d, $end);
}
示例12: 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");
//.........这里部分代码省略.........
示例13: buildQuery
/**
* クエリを構築する.
*
* 検索条件のキーに応じた WHERE 句と, クエリパラメーターを構築する.
* クエリパラメーターは, SC_FormParam の入力値から取得する.
*
* 構築内容は, 引数の $where 及び $arrValues にそれぞれ追加される.
*
* @param string $key 検索条件のキー
* @param string $where 構築する WHERE 句
* @param array $arrValues 構築するクエリパラメーター
* @param SC_FormParam $objFormParam SC_FormParam インスタンス
* @param SC_FormParam $objDb SC_Helper_DB_Ex インスタンス
* @return void
*/
function buildQuery($key, &$where, &$arrValues, &$objFormParam, &$objDb)
{
$dbFactory = SC_DB_DBFactory_Ex::getInstance();
switch ($key) {
// 商品ID
case 'search_product_id':
$where .= " AND product_id = ?";
$arrValues[] = sprintf('%d', $objFormParam->getValue($key));
break;
// 商品コード
// 商品コード
case 'search_product_code':
$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)";
$arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key));
break;
// 商品名
// 商品名
case 'search_name':
$where .= " AND name LIKE ?";
$arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key));
break;
// カテゴリ
// カテゴリ
case 'search_category_id':
list($tmp_where, $tmp_Values) = $objDb->sfGetCatWhere($objFormParam->getValue($key));
if ($tmp_where != "") {
$where .= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
$arrValues = array_merge((array) $arrValues, (array) $tmp_Values);
}
break;
// 種別
// 種別
case 'search_status':
$tmp_where = "";
foreach ($objFormParam->getValue($key) as $element) {
if ($element != "") {
if (SC_Utils_Ex::isBlank($tmp_where)) {
$tmp_where .= " AND (status = ?";
} else {
$tmp_where .= " OR status = ?";
}
$arrValues[] = $element;
}
}
if (!SC_Utils_Ex::isBlank($tmp_where)) {
$tmp_where .= ")";
$where .= " {$tmp_where} ";
}
break;
// 登録・更新日(開始)
// 登録・更新日(開始)
case 'search_startyear':
$date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_startyear'), $objFormParam->getValue('search_startmonth'), $objFormParam->getValue('search_startday'));
$where .= " AND update_date >= ?";
$arrValues[] = $date;
break;
// 登録・更新日(終了)
// 登録・更新日(終了)
case 'search_endyear':
$date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_endyear'), $objFormParam->getValue('search_endmonth'), $objFormParam->getValue('search_endday'), true);
$where .= " AND update_date <= ?";
$arrValues[] = $date;
break;
// 商品ステータス
// 商品ステータス
case 'search_product_statuses':
if (count($objFormParam->getValue($key)) > 0) {
$where .= " AND product_id IN (SELECT product_id FROM dtb_product_status WHERE product_status_id IN (";
foreach ($objFormParam->getValue($key) as $param) {
$where .= "?,";
$arrValues[] = $param;
}
$where = preg_replace("/,\$/", "))", $where);
}
break;
}
}
示例14: doRegister
/**
* DB更新処理
*
* @param integer $order_id 受注ID
* @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
* @param SC_FormParam $objFormParam SC_FormParam インスタンス
* @param string $message 通知メッセージ
* @param array $arrValuesBefore 更新前の受注情報
* @return integer $order_id 受注ID
*
* エラー発生時は負数を返す。
*/
function doRegister($order_id, &$objPurchase, &$objFormParam, &$message, &$arrValuesBefore)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$arrValues = $objFormParam->getDbArray();
$where = 'order_id = ?';
$objQuery->begin();
// 支払い方法が変更されたら、支払い方法名称も更新
if ($arrValues['payment_id'] != $arrValuesBefore['payment_id']) {
$arrValues['payment_method'] = $this->arrPayment[$arrValues['payment_id']];
$arrValuesBefore['payment_id'] = NULL;
}
// 受注テーブルの更新
$order_id = $objPurchase->registerOrder($order_id, $arrValues);
$arrDetail = $objFormParam->getSwapArray(array('product_id', 'product_class_id', 'product_code', 'product_name', 'price', 'quantity', 'point_rate', 'classcategory_name1', 'classcategory_name2'));
// 変更しようとしている商品情報とDBに登録してある商品情報を比較することで、更新すべき数量を計算
$max = count($arrDetail);
$k = 0;
$arrStockData = array();
for ($i = 0; $i < $max; $i++) {
if (!empty($arrDetail[$i]['product_id'])) {
$arrPreDetail = $objQuery->select('*', 'dtb_order_detail', 'order_id = ? AND product_class_id = ?', array($order_id, $arrDetail[$i]['product_class_id']));
if (!empty($arrPreDetail) && $arrPreDetail[0]['quantity'] != $arrDetail[$i]['quantity']) {
// 数量が変更された商品
$arrStockData[$k]['product_class_id'] = $arrDetail[$i]['product_class_id'];
$arrStockData[$k]['quantity'] = $arrPreDetail[0]['quantity'] - $arrDetail[$i]['quantity'];
++$k;
} elseif (empty($arrPreDetail)) {
// 新しく追加された商品 もしくは 違う商品に変更された商品
$arrStockData[$k]['product_class_id'] = $arrDetail[$i]['product_class_id'];
$arrStockData[$k]['quantity'] = -$arrDetail[$i]['quantity'];
++$k;
}
$objQuery->delete('dtb_order_detail', 'order_id = ? AND product_class_id = ?', array($order_id, $arrDetail[$i]['product_class_id']));
}
}
// 上記の新しい商品のループでDELETEされなかった商品は、注文より削除された商品
$arrPreDetail = $objQuery->select('*', 'dtb_order_detail', 'order_id = ?', array($order_id));
foreach ($arrPreDetail as $key => $val) {
$arrStockData[$k]['product_class_id'] = $val['product_class_id'];
$arrStockData[$k]['quantity'] = $val['quantity'];
++$k;
}
// 受注詳細データの更新
$objPurchase->registerOrderDetail($order_id, $arrDetail);
// 在庫数調整
if (ORDER_DELIV != $arrValues['status'] && ORDER_CANCEL != $arrValues['status']) {
foreach ($arrStockData as $stock) {
$objQuery->update('dtb_products_class', array(), 'product_class_id = ?', array($stock['product_class_id']), array('stock' => 'stock + ?'), array($stock['quantity']));
}
}
$arrAllShipping = $objFormParam->getSwapArray($this->arrShippingKeys);
$arrAllShipmentItem = $objFormParam->getSwapArray($this->arrShipmentItemKeys);
$arrDelivTime = $objPurchase->getDelivTime($objFormParam->getValue('deliv_id'));
$arrShippingValues = array();
foreach ($arrAllShipping as $shipping_index => $arrShipping) {
$shipping_id = $arrShipping['shipping_id'];
$arrShippingValues[$shipping_index] = $arrShipping;
$arrShippingValues[$shipping_index]['shipping_date'] = SC_Utils_Ex::sfGetTimestamp($arrShipping['shipping_date_year'], $arrShipping['shipping_date_month'], $arrShipping['shipping_date_day']);
// 配送業者IDを取得
$arrShippingValues[$shipping_index]['deliv_id'] = $objFormParam->getValue('deliv_id');
// お届け時間名称を取得
$arrShippingValues[$shipping_index]['shipping_time'] = $arrDelivTime[$arrShipping['time_id']];
// 複数配送の場合は配送商品を登録
if (!SC_Utils_Ex::isBlank($arrAllShipmentItem)) {
$arrShipmentValues = array();
foreach ($arrAllShipmentItem[$shipping_index] as $key => $arrItem) {
$i = 0;
foreach ($arrItem as $item) {
$arrShipmentValues[$shipping_index][$i][str_replace('shipment_', '', $key)] = $item;
$i++;
}
}
$objPurchase->registerShipmentItem($order_id, $shipping_id, $arrShipmentValues[$shipping_index]);
}
}
$objPurchase->registerShipping($order_id, $arrShippingValues, false);
$objQuery->commit();
return $order_id;
}
示例15: lfRegistData
/**
* データの一時登録を行う.
*
* 非会員向けの処理
* @param integer $uniqid 受注一時テーブルのユニークID
* @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス
* @param SC_Customer $objCustomer SC_Customer インスタンス
* @param SC_FormParam $objFormParam SC_FormParam インスタンス
* @param boolean $isMultiple 複数配送の場合 true
*/
function lfRegistData($uniqid, &$objPurchase, &$objCustomer, &$objFormParam, $isMultiple = false)
{
$arrParams = $objFormParam->getHashArray();
// 注文者をお届け先とする配列を取得
$arrShippingOwn = array();
$objPurchase->copyFromOrder($arrShippingOwn, $arrParams);
// 都度入力されたお届け先
$arrShipping = $objPurchase->extractShipping($arrParams);
if ($isMultiple) {
$objPurchase->unsetOneShippingTemp(0);
$objPurchase->unsetOneShippingTemp(1);
$objPurchase->saveShippingTemp($arrShippingOwn, 0);
if ($arrParams['deliv_check'] == '1') {
$objPurchase->saveShippingTemp($arrShipping, 1);
}
} else {
$objPurchase->unsetAllShippingTemp(true);
if ($arrParams['deliv_check'] == '1') {
$objPurchase->saveShippingTemp($arrShipping, 1);
} else {
$objPurchase->saveShippingTemp($arrShippingOwn, 0);
}
}
$arrValues = $objFormParam->getDbArray();
// 登録データの作成
$arrValues['order_birth'] = SC_Utils_Ex::sfGetTimestamp($arrParams['year'], $arrParams['month'], $arrParams['day']);
$arrValues['update_date'] = 'CURRENT_TIMESTAMP';
$arrValues['customer_id'] = '0';
$objPurchase->saveOrderTemp($uniqid, $arrValues, $objCustomer);
}