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


PHP astercrm::getall方法代码示例

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


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

示例1: checkExtensionStatus

 function checkExtensionStatus($curid, $type = 'list', $curhover)
 {
     global $db, $config;
     /* 
     	if type is list, then only check some specific extension
     	or else we get extension list from events
     */
     $panellist = array();
     $panelphones = array();
     if ($type == 'list') {
         $i = 0;
         foreach ($_SESSION['curuser']['extensions'] as $value) {
             $row = astercrm::getRecordByField('username', $value, 'astercrm_account');
             $panellist[$row['username']]['extension'] = $row['extension'];
             $panellist[$row['username']]['agent'] = $row['agent'];
             $panellist[$row['username']]['channel'] = $row['channel'];
             $panelphones[] = $row['extension'];
             $i++;
         }
         //$_SESSION['curuser']['extensions_session'] = $panellist;
     } else {
         $alluser = astercrm::getall('astercrm_account');
         while ($alluser->fetchinto($row)) {
             $panellist[$row['username']]['extension'] = $row['extension'];
             $panellist[$row['username']]['agent'] = $row['agent'];
             $panellist[$row['username']]['channel'] = $row['channel'];
             $panelphones[] = $row['extension'];
         }
     }
     if (!isset($_SESSION['extension_status'])) {
         $status = array();
         $callerid = array();
         $direction = array();
     } else {
         /*
         because there could be no all extension status data in events
         we need to inherit status from sessions
         */
         $status = $_SESSION['extension_status'];
         $callerid = $_SESSION['callerid'];
         $direction = $_SESSION['direction'];
         $srcchan = $_SESSION['srcchan'];
         $dstchan = $_SESSION['dstchan'];
     }
     if (!isset($panelphones) or $panelphones == '') {
         $panelphones = array();
     }
     if ($config['system']['eventtype'] == 'curcdr') {
         //read all peer status in table peerstatus and save to array $phone_status
         $events =& asterEvent::getPeerstatus(0);
         $phone_status = array();
         while ($events->fetchInto($list)) {
             list($tech, $peer) = split('/', $list['peername']);
             $phone_status[$peer] = $list['status'];
         }
         foreach ($panellist as $username => $phone) {
             $query = "SELECT * FROM curcdr WHERE (src = '" . $phone['extension'] . "' OR dst = '" . $phone['extension'] . "' OR srcchan = 'agent/" . $phone['agent'] . "' OR dstchan = 'agent/" . $phone['agent'] . "' OR srcchan LIKE '" . $phone['channel'] . "-%' OR dstchan LIKE '" . $phone['channel'] . "-%') AND dstchan != '' AND srcchan != '' AND dst != '' AND src != '' ORDER BY id ASC";
             $res = $db->query($query);
             if ($res->fetchInto($cdrrow)) {
                 if ($status[$username] == 1) {
                     continue;
                 }
                 //for check click to transfer
                 if (!strstr($cdrrow['dstchan'], $cdrrow['dst'])) {
                     $dst_tmp = trim($cdrrow['dst']);
                     $cdrrow['dst'] = '';
                 }
                 if ($status[$list['peer']] == 1) {
                     continue;
                 }
                 if (strstr($cdrrow['src'], $phone['extension']) or strstr($cdrrow['srcchan'], $phone['channel']) or $cdrrow['srcchan'] == "agent/" . $phone['agent']) {
                     // dial out
                     if ($cdrrow['didnumber'] != '') {
                         $callerid[$username] = trim($cdrrow['didnumber']);
                     } else {
                         if (trim($cdrrow['dst']) != '') {
                             $callerid[$username] = trim($cdrrow['dst']);
                         } else {
                             $callerid[$username] = $dst_tmp;
                         }
                     }
                     $direction[$username] = "dialout";
                     $status[$username] = 1;
                     $srcchan[$username] = trim($cdrrow['srcchan']);
                     $dstchan[$username] = trim($cdrrow['dstchan']);
                 } elseif (strstr($cdrrow['dst'], $phone['extension']) or strstr($cdrrow['dstchan'], $phone['channel']) or $cdrrow['dstchan'] == "agent/" . $phone['agent']) {
                     //dial in
                     $callerid[$username] = trim($cdrrow['src']);
                     $direction[$username] = "dialin";
                     $status[$username] = 1;
                     $srcchan[$username] = trim($cdrrow['srcchan']);
                     $dstchan[$username] = trim($cdrrow['dstchan']);
                 } else {
                     $callerid[$username] = '';
                     $direction[$username] = '';
                     $status[$username] = 0;
                 }
             } else {
                 if ($phone_status[$phone['extension']] == 'unknown' || $phone_status[$phone['extension']] == 'unreachable' || $phone_status[$phone['extension']] == '' || $phone_status[$phone['extension']] == 'unregistered') {
                     $status[$username] = 2;
//.........这里部分代码省略.........
开发者ID:ljhcj,项目名称:IRISCC,代码行数:101,代码来源:asterevent.class.php


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