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


PHP astercrm::getFieldsByField方法代码示例

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


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

示例1: createSqlWithStype

 /**
  *  create a 'where string' with 'like,<,>,=' assign by stype 
  *
  *	@param $stype		(array)		assign search type
  *	@param $filter		(array) 	filter in sql
  *	@param $content		(array)		content in sql
  *	@return $joinstr	(string)	sql where string
  */
 function createSqlWithStype($filter, $content, $stype, $table)
 {
     $i = 0;
     $joinstr = '';
     foreach ($stype as $type) {
         //echo $filter[$i];exit;
         $content[$i] = preg_replace("/'/", "\\'", $content[$i]);
         if ($filter[$i] != '' && trim($content[$i]) != '') {
             if ($filter[$i] == 'groupname' and $table != "accountgroup" and $table != "") {
                 $group_res = astercrm::getFieldsByField('id', 'groupname', $content[$i], 'accountgroup', $type);
                 while ($group_res->fetchInto($group_row)) {
                     $group_str .= "OR {$table}.groupid = '" . $group_row['id'] . "' ";
                 }
                 if ($group_str == '') {
                     $group_str .= " {$table}.groupid = '-1' ";
                 }
             } elseif ($filter[$i] == 'resellername' and $table != "resellergroup" and $table != "") {
                 $reseller_res = astercrm::getFieldsByField('id', 'resellername', $content[$i], 'resellergroup', $type);
                 while ($reseller_res->fetchInto($reseller_row)) {
                     $reseller_str .= "OR {$table}.resellerid = '" . $reseller_row['id'] . "' ";
                 }
                 if ($reseller_str == '') {
                     $reseller_str .= " {$table}.resellerid = '-1' ";
                 }
             } else {
                 if ($type == "equal") {
                     $joinstr .= "AND {$filter[$i]} = '" . trim($content[$i]) . "' ";
                 } elseif ($type == "more") {
                     $joinstr .= "AND {$filter[$i]} > '" . trim($content[$i]) . "' ";
                 } elseif ($type == "less") {
                     $joinstr .= "AND {$filter[$i]} < '" . trim($content[$i]) . "' ";
                 } else {
                     $joinstr .= "AND {$filter[$i]} like '%" . trim($content[$i]) . "%' ";
                 }
             }
         }
         $i++;
     }
     if ($group_str != '') {
         $group_str = ltrim($group_str, 'OR');
         $joinstr .= "AND (" . $group_str . ")";
     }
     if ($reseller_str != '') {
         $reseller_str = ltrim($reseller_str, 'OR');
         $joinstr .= "AND (" . $reseller_str . ")";
     }
     //echo $joinstr;exit;
     return $joinstr;
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:57,代码来源:astercrm.class.php

示例2: createSqlWithStype

 /**
  *  create a 'where string' with 'like,<,>,=' assign by stype
  *
  *	@param $stype		(array)		assign search type
  *	@param $filter		(array) 	filter in sql
  *	@param $content		(array)		content in sql
  *	@return $joinstr	(string)	sql where string
  */
 function createSqlWithStype($filter, $content, $stype = array(), $table = '', $option = 'search')
 {
     //print_r($filter);echo $table;exit;
     $i = 0;
     $joinstr = '';
     foreach ($stype as $type) {
         $content[$i] = preg_replace("/'/", "\\'", $content[$i]);
         if ($filter[$i] != '' && trim($content[$i]) != '') {
             if ($filter[$i] == 'groupname' and $table != "astercrm_accountgroup" and $table != "" and $table != "mycdr") {
                 $group_res = astercrm::getFieldsByField('id', 'groupname', $content[$i], 'astercrm_accountgroup', $type);
                 while ($group_res->fetchInto($group_row)) {
                     $group_str .= "OR {$table}.groupid = '" . $group_row['id'] . "' ";
                 }
                 if ($group_str == '') {
                     $group_str .= " {$table}.groupid = '-1' ";
                 }
             } elseif (($filter[$i] == 'campaignname' or $filter[$i] == 'campaign.campaignname' and $option = 'delete') and $table != "campaign" and $table != "") {
                 $campaign_res = astercrm::getFieldsByField('id', 'campaignname', $content[$i], 'campaign', $type);
                 while ($campaign_res->fetchInto($campaign_row)) {
                     $campaign_str .= "OR {$table}.campaignid = '" . $campaign_row['id'] . "' ";
                 }
                 if ($campaign_str == '') {
                     $campaign_str .= " {$table}.campaignid = '0' ";
                 }
             } else {
                 if ($table == 'monitorrecord' && $filter[$i] == 'dstchannel') {
                     $content[$i] = 'agent/' . $content[$i];
                 }
                 //echo $filter[$i] == 'username' && $table != "" && $table == "mycdr";exit;
                 if ($filter[$i] == 'username' && $table != "" && $table == "mycdr") {
                     $filter[$i] = 'astercrm_account.username';
                 } else {
                     if ($filter[$i] == 'groupname' && $table != "" && $table == "mycdr") {
                         $filter[$i] = 'astercrm_accountgroup.groupname';
                     }
                 }
                 if ($type == "equal") {
                     $joinstr .= "AND {$filter[$i]} = '" . trim($content[$i]) . "' ";
                 } elseif ($type == "more") {
                     $joinstr .= "AND {$filter[$i]} > '" . trim($content[$i]) . "' ";
                 } elseif ($type == "less") {
                     $joinstr .= "AND {$filter[$i]} < '" . trim($content[$i]) . "' ";
                 } else {
                     $joinstr .= "AND {$filter[$i]} like '%" . trim($content[$i]) . "%' ";
                 }
             }
         }
         $i++;
     }
     if ($group_str != '') {
         $group_str = ltrim($group_str, 'OR');
         $joinstr .= "AND (" . $group_str . ")";
     }
     if ($campaign_str != '') {
         $campaign_str = ltrim($campaign_str, 'OR');
         $joinstr .= "AND (" . $campaign_str . ")";
     }
     //echo $joinstr;exit;
     return $joinstr;
 }
开发者ID:ljhcj,项目名称:IRISCC,代码行数:68,代码来源:astercrm.class.php


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