当前位置: 首页>>代码示例>>PHP>>正文


PHP Support::buildWhereClause方法代码示例

本文整理汇总了PHP中Support::buildWhereClause方法的典型用法代码示例。如果您正苦于以下问题:PHP Support::buildWhereClause方法的具体用法?PHP Support::buildWhereClause怎么用?PHP Support::buildWhereClause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Support的用法示例。


在下文中一共展示了Support::buildWhereClause方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getEmailListing

 /**
  * Method used to get the list of emails to be displayed in the
  * grid layout.
  *
  * @access  public
  * @param   array $options The search parameters
  * @param   integer $current_row The current page number
  * @param   integer $max The maximum number of rows per page
  * @return  array The list of issues to be displayed
  */
 function getEmailListing($options, $current_row = 0, $max = 5)
 {
     $prj_id = Auth::getCurrentProject();
     $usr_id = Auth::getUserID();
     if ($max == "ALL") {
         $max = 9999999;
     }
     $start = $current_row * $max;
     $stmt = "SELECT\n                    sup_id,\n                    sup_ema_id,\n                    sup_iss_id,\n                    sup_customer_id,\n                    sup_from,\n                    sup_date,\n                    sup_to,\n                    sup_subject,\n                    sup_has_attachment\n                 FROM\n                    (\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email,\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_account";
     if (!empty($options['keywords'])) {
         $stmt .= "," . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email_body";
     }
     $stmt .= "\n                    )\n                    LEFT JOIN\n                        " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue\n                    ON\n                        sup_iss_id = iss_id";
     $stmt .= Support::buildWhereClause($options);
     $stmt .= "\n                 ORDER BY\n                    " . Misc::escapeString($options["sort_by"]) . " " . Misc::escapeString($options["sort_order"]);
     $total_rows = Pager::getTotalRows($stmt);
     $stmt .= "\n                 LIMIT\n                    " . Misc::escapeInteger($start) . ", " . Misc::escapeInteger($max);
     $res = $GLOBALS["db_api"]->dbh->getAll($stmt, DB_FETCHMODE_ASSOC);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return array("list" => "", "info" => "");
     } else {
         if (count($res) < 1 && $current_row > 0) {
             // if there are no results, and the page is not the first page reset page to one and reload results
             Auth::redirect(APP_RELATIVE_URL . "emails.php?pagerRow=0&rows={$max}");
         }
         if (Customer::hasCustomerIntegration($prj_id)) {
             $customer_ids = array();
             for ($i = 0; $i < count($res); $i++) {
                 if (!empty($res[$i]['sup_customer_id']) && !in_array($res[$i]['sup_customer_id'], $customer_ids)) {
                     $customer_ids[] = $res[$i]['sup_customer_id'];
                 }
             }
             if (count($customer_ids) > 0) {
                 $company_titles = Customer::getTitles($prj_id, $customer_ids);
             }
         }
         for ($i = 0; $i < count($res); $i++) {
             $res[$i]["sup_date"] = Date_API::getFormattedDate($res[$i]["sup_date"]);
             $res[$i]["sup_subject"] = Mime_Helper::fixEncoding($res[$i]["sup_subject"]);
             $res[$i]["sup_from"] = join(', ', Mail_API::getName($res[$i]["sup_from"], true));
             if (empty($res[$i]["sup_to"]) && !empty($res[$i]["sup_iss_id"])) {
                 $res[$i]["sup_to"] = "Notification List";
             } else {
                 $res[$i]["sup_to"] = Mime_Helper::fixEncoding(Mail_API::getName($res[$i]["sup_to"]));
             }
             if (Customer::hasCustomerIntegration($prj_id)) {
                 @($res[$i]['customer_title'] = $company_titles[$res[$i]['sup_customer_id']]);
             }
         }
         $total_pages = ceil($total_rows / $max);
         $last_page = $total_pages - 1;
         return array("list" => $res, "info" => array("current_page" => $current_row, "start_offset" => $start, "end_offset" => $start + count($res), "total_rows" => $total_rows, "total_pages" => $total_pages, "previous_page" => $current_row == 0 ? "-1" : $current_row - 1, "next_page" => $current_row == $last_page ? "-1" : $current_row + 1, "last_page" => $last_page));
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:65,代码来源:class.support.php


注:本文中的Support::buildWhereClause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。