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


PHP DB_Helper::getNoWeekendDateDiffSQL方法代碼示例

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


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

示例1: getWhereClause

 /**
  * Method used to generate a where clause from the given list of conditions.
  *
  * @param   array $reminder An array of reminder info.
  * @param   array $conditions The list of conditions
  * @return  string The where clause
  */
 public function getWhereClause($reminder, $conditions)
 {
     $stmt = '
               WHERE
                 iss_prj_id=' . $reminder['rem_prj_id'] . "\n";
     $requirement = self::getRequirements($reminder['rem_id']);
     if ($requirement['type'] == 'issue') {
         $stmt .= ' AND iss_id IN (' . implode(', ', $requirement['values']) . ")\n";
     } else {
         if (CRM::hasCustomerIntegration($reminder['rem_prj_id'])) {
             $crm = CRM::getInstance($reminder['rem_prj_id']);
             if ($requirement['type'] == 'customer') {
                 $stmt .= ' AND iss_customer_id IN (' . implode(', ', $requirement['values']) . ")\n";
             } elseif ($requirement['type'] == 'support_level') {
                 $customer_ids = $crm->getCustomerIDsBySupportLevel($requirement['values'], array(CRM_EXCLUDE_EXPIRED));
                 // break the query on purpose if no customers could be found
                 if (count($customer_ids) == 0) {
                     $customer_ids = array(-1);
                 }
                 $stmt .= ' AND iss_customer_id IN (' . implode(', ', $customer_ids) . ")\n";
             }
         }
     }
     $priorities = self::getAssociatedPriorities($reminder['rem_id']);
     if (count($priorities) > 0) {
         $stmt .= ' AND iss_pri_id IN (' . implode(', ', $priorities) . ")\n";
     }
     $products = self::getAssociatedProducts($reminder['rem_id']);
     if (count($products) > 0) {
         $stmt .= ' AND ipv_iss_id = iss_id AND ipv_pro_id IN (' . implode(', ', $products) . ")\n";
     }
     $severities = self::getAssociatedSeverities($reminder['rem_id']);
     if (count($severities) > 0) {
         $stmt .= ' AND iss_sev_id IN (' . implode(', ', $severities) . ")\n";
     }
     // now for the interesting stuff
     foreach ($conditions as &$cond) {
         if (empty($cond['rmf_sql_representation'])) {
             continue;
         }
         // check for fields that compare to other fields
         if (!empty($cond['rlc_comparison_rmf_id'])) {
             $sql_field = Reminder_Condition::getSQLField($cond['rlc_comparison_rmf_id']);
             $stmt .= sprintf(" AND %s %s %s\n", $cond['rmf_sql_field'], $cond['rmo_sql_representation'], $sql_field);
         } else {
             // date field values are always saved as number of hours, so let's calculate them now as seconds
             if (stristr($cond['rmf_title'], 'date')) {
                 // support NULL as values for a date field
                 if (strtoupper($cond['rlc_value']) == 'NULL') {
                     $cond['rmf_sql_representation'] = $cond['rmf_sql_field'];
                 } elseif (strtoupper($cond['rlc_value']) == 'NOW') {
                     $cond['rmf_sql_representation'] = 'UNIX_TIMESTAMP(' . $cond['rmf_sql_field'] . ')';
                     $cond['rlc_value'] = 'UNIX_TIMESTAMP()';
                 } else {
                     $cond['rlc_value'] = $cond['rlc_value'] * 60 * 60;
                     if (@$reminder['rem_skip_weekend'] == 1) {
                         $sql_field = Reminder_Condition::getSQLField($cond['rlc_rmf_id']);
                         $cond['rmf_sql_representation'] = DB_Helper::getNoWeekendDateDiffSQL($sql_field);
                     }
                 }
             }
             $stmt .= sprintf(" AND %s %s %s\n", $cond['rmf_sql_representation'], $cond['rmo_sql_representation'], $cond['rlc_value']);
         }
     }
     return $stmt;
 }
開發者ID:dabielkabuto,項目名稱:eventum,代碼行數:73,代碼來源:class.reminder.php


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