当前位置: 首页>>代码示例>>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;未经允许,请勿转载。