當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。