當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Condition::getIdByIdPs方法代碼示例

本文整理匯總了PHP中Condition::getIdByIdPs方法的典型用法代碼示例。如果您正苦於以下問題:PHP Condition::getIdByIdPs方法的具體用法?PHP Condition::getIdByIdPs怎麽用?PHP Condition::getIdByIdPs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Condition的用法示例。


在下文中一共展示了Condition::getIdByIdPs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: processImportConditions

 public function processImportConditions($conditions, $id_lang)
 {
     $current_conditions = array();
     $result = Db::getInstance()->ExecuteS('SELECT `id_ps_condition` FROM ' . _DB_PREFIX_ . 'condition');
     foreach ($result as $row) {
         $current_conditions[] = (int) $row['id_ps_condition'];
     }
     foreach ($conditions as $condition) {
         if (isset($condition->id)) {
             unset($condition->id);
         }
         try {
             $cond = new Condition();
             if (in_array($condition->id_ps_condition, $current_conditions)) {
                 $cond = new Condition(Condition::getIdByIdPs($condition->id_ps_condition));
                 unset($current_conditions[(int) array_search($condition->id_ps_condition, $current_conditions)]);
             }
             $cond->hydrate((array) $condition, (int) $id_lang);
             $cond->date_upd = date('Y-m-d H:i:s', strtotime('-' . (int) $cond->calculation_detail . 'DAY'));
             $cond->date_add = date('Y-m-d H:i:s');
             $condition->calculation_detail = trim($condition->calculation_detail);
             $cond->save(false, false);
             if ($condition->calculation_type == 'hook' && !$this->isRegisteredInHook($condition->calculation_detail) && Validate::isHookName($condition->calculation_detail)) {
                 $this->registerHook($condition->calculation_detail);
             }
             unset($cond);
         } catch (Exception $e) {
             continue;
         }
     }
     // Delete conditions that are not in the file anymore
     foreach ($current_conditions as $id_ps_condition) {
         $cond = new Condition(Condition::getIdByIdPs((int) $id_ps_condition));
         $cond->delete();
     }
 }
開發者ID:WhisperingTree,項目名稱:etagerca,代碼行數:36,代碼來源:gamification.php

示例2: processImportConditions

 public function processImportConditions($conditions, $id_lang)
 {
     foreach ($conditions as $condition) {
         try {
             if (Condition::getIdByIdPs($condition->id_ps_condition)) {
                 continue;
             }
             //only add new condition, if already exist we continue
             $cond = new Condition();
             $cond->hydrate((array) $condition, (int) $id_lang);
             $time = 86400;
             if ($cond->calculation_type == 'time') {
                 $time = 86400 * (int) $cond->calculation_detail;
             }
             $cond->date_upd = date('Y-m-d H:i:s', time() - $time);
             $cond->date_add = date('Y-m-d H:i:s');
             $condition->calculation_detail = trim($condition->calculation_detail);
             $cond->add(false);
             if ($condition->calculation_type == 'hook' && !$this->isRegisteredInHook($condition->calculation_detail) && Validate::isHookName($condition->calculation_detail)) {
                 $this->registerHook($condition->calculation_detail);
             }
             unset($cond);
         } catch (Exception $e) {
             continue;
         }
     }
 }
開發者ID:juniorhq88,項目名稱:PrestaShop-modules,代碼行數:27,代碼來源:gamification.php


注:本文中的Condition::getIdByIdPs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。