本文整理汇总了PHP中astercrm::getRecordsByField方法的典型用法代码示例。如果您正苦于以下问题:PHP astercrm::getRecordsByField方法的具体用法?PHP astercrm::getRecordsByField怎么用?PHP astercrm::getRecordsByField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astercrm
的用法示例。
在下文中一共展示了astercrm::getRecordsByField方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
global $locate, $config, $db;
$objResponse = new xajaxResponse();
$myAsterisk = new Asterisk();
$myAsterisk->config['asmanager'] = $config['asterisk'];
$res = $myAsterisk->connect();
if (!$res) {
$objResponse->addAssign("divAMIStatus", "innerHTML", $locate->Translate("AMI_connection_failed"));
}
$objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
$objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
// get all groups
if ($_SESSION['curuser']['usertype'] == 'admin') {
$groups = astercrm::getAll("astercrm_accountgroup");
} else {
$groups = astercrm::getRecordsByField('id', $_SESSION['curuser']['groupid'], 'astercrm_accountgroup');
}
while ($groups->fetchInto($group)) {
// get all enabled campaigns
$query = "SELECT * FROM campaign WHERE enable = 1 AND groupid = " . $group['groupid'];
$campaigns = $db->query($query);
$campaignHTML = '';
while ($campaigns->fetchInto($campaign)) {
// get worktime
$localtime = localtime(time(), true);
$wday = $localtime['tm_wday'];
if ($localtime['tm_wday'] == 0) {
$wday = 7;
}
$cur = $localtime['tm_hour'] . ":" . $localtime['tm_min'] . ":" . $localtime['tm_sec'];
$query = " SELECT worktimes.*,worktimepackages.worktimepackage_status FROM worktimepackage_worktimes LEFT JOIN worktimes ON worktimes.id = worktimepackage_worktimes.worktime_id LEFT JOIN worktimepackages ON worktimepackages.id = worktimepackage_worktimes.worktimepackage_id WHERE worktimepackages.worktimepackage_status = 'enable' AND worktimepackage_id = " . $campaign['worktime_package_id'] . " AND ( starttime <= '{$cur}' AND endtime >= '{$cur}' ) AND (startweek <= {$wday} AND endweek >= {$wday} ) ";
$worktime = $db->getOne($query);
// get numbers in diallist
$query = "SELECT COUNT(*) FROM diallist WHERE campaignid = " . $campaign['id'];
$phoneNumber = $db->getOne($query);
$has_queue = 0;
// check if we have a queue in queue_name
if ($campaign['queuename'] != "") {
$query = "SELECT id FROM queue_name WHERE queuename = '" . $campaign['queuename'] . "' ";
$has_queue = $db->getOne($query);
}
$status = "";
$channel_checked = "";
$queue_checked = "";
if ($campaign['status'] == "busy") {
$status = "checked";
}
if ($campaign['limit_type'] == "channel") {
$channel_checked = "checked";
} else {
if ($campaign['limit_type'] == "queue") {
$queue_checked = "checked";
}
}
if ($campaign['enablebalance'] == 'strict' && $campaign['balance'] <= 0) {
$curStyle = ' style="color:gray" ';
$curInputAbled = ' disabled ';
} else {
$curStyle = ' ';
$curInputAbled = '';
}
$campaignHTML .= '<div class="group01content" ' . $curStyle . '>';
if ($has_queue != 0) {
$campaignHTML .= "<div class='group01l'>" . '<img src="images/groups_icon02.gif" width="20" height="20" align="absmiddle" /><acronym title="' . $locate->Translate("inexten") . ':' . $campaign['inexten'] . ' | ' . $locate->Translate("Outcontext") . ':' . $campaign['outcontext'] . ' | ' . $locate->Translate("Incontext") . ':' . $campaign['incontext'] . '"> ' . $campaign['campaignname'] . ' ( ' . $locate->Translate("queue") . ': ' . $campaign['queuename'] . ' ) ( <span id="numbers-' . $campaign['id'] . '">' . $phoneNumber . '</span> ' . $locate->Translate("numbers in dial list") . ' )</acronym> </div>';
if (!$worktime && $campaign['worktime_package_id'] != 0) {
$campaignHTML .= '
<div class="group01r">' . $locate->Translate("not in worktime") . '</div>';
} else {
$campaignHTML .= '
<div class="group01r">
<input type="checkbox" ' . $curInputAbled . ' onclick="setStatus(this);" id="' . $campaign['id'] . '-ckb" ' . $status . '>' . $locate->Translate("Start") . '
<input type="radio" ' . $curInputAbled . ' onclick="setLimitType(this);" id="' . $campaign['id'] . '-limittpye" name="' . $campaign['id'] . '-limittpye" value="channel" ' . $channel_checked . '> ' . $locate->Translate("Limited by max calls") . '
<input type="text" ' . $curInputAbled . ' value="' . $campaign['max_channel'] . '" id="' . $campaign['id'] . '-maxchannel" name="' . $campaign['id'] . '-maxchannel" size="2" maxlength="3" class="inputlimit" onblur="setMaxChannel(this);">
<input type="radio" ' . $curInputAbled . ' onclick="setLimitType(this);" id="' . $campaign['id'] . '-limittpye" name="' . $campaign['id'] . '-limittpye" value="queue" ' . $queue_checked . '> ' . $locate->Translate("Limited by agents and multipled by") . '
<input type="text" ' . $curInputAbled . ' value="' . $campaign['queue_increasement'] . '" id="' . $campaign['id'] . '-rate" name="' . $campaign['id'] . '-rate" size="4" maxlength="4" class="inputlimit" onblur="setQueueRate(this);">
</div>';
}
} else {
$campaignHTML .= "<div class='group01l'>" . '<img src="images/groups_icon02.gif" width="20" height="20" align="absmiddle" /><acronym title="' . $locate->Translate("inexten") . ':' . $campaign['inexten'] . ' | ' . $locate->Translate("Outcontext") . ':' . $campaign['outcontext'] . ' | ' . $locate->Translate("Incontext") . ':' . $campaign['incontext'] . '">' . $campaign['campaignname'] . ' ( ' . $locate->Translate("no queue for this campaign") . ' ) ( <span id="numbers' . $campaign['id'] . '">' . $phoneNumber . '</span> ' . $locate->Translate("numbers in dial list") . ' ) </acronym></div>';
if (!$worktime && $campaign['worktime_package_id'] != 0) {
$campaignHTML .= '
<div class="group01r">' . $locate->Translate("not in worktime") . '</div>';
} else {
$campaignHTML .= '
<div class="group01r">
<input type="checkbox" ' . $curInputAbled . ' onclick="setStatus(this);" id="' . $campaign['id'] . '-ckb" ' . $status . '>' . $locate->Translate("Start") . '
<input type="radio" ' . $curInputAbled . ' name="' . $campaign['id'] . '-limittpye[]" value="channel" ' . $channel_checked . '>
' . $locate->Translate("Limited by max calls") . '
<input type="text" ' . $curInputAbled . ' value="' . $campaign['max_channel'] . '" id="' . $campaign['id'] . '-maxchannel" name="' . $campaign['id'] . '-maxchannel" size="3" maxlength="3" class="inputlimit" onblur="setMaxChannel(this);">
</div>';
}
}
$campaignHTML .= '</div>';
$campaignHTML .= '<div class="group01_channel" id="campaign' . $campaign['id'] . '" ></div>';
}
$divGroup .= '<div class="group01"><img src="images/groups_icon01.gif" align="absmiddle" />' . $group['groupname'] . '</div>
<div id="group' . $group['groupid'] . '">' . $campaignHTML . '</div>
<div class="group01_channel" id="unknown' . $group['groupid'] . '"></div>
</div>';
//.........这里部分代码省略.........
示例2: saveSchedulerDial
function saveSchedulerDial($dialnumber = '', $campaignid = '', $dialtime = '', $customerid)
{
global $locate, $db;
$objResponse = new xajaxResponse();
if ($dialnumber == '') {
$objResponse->addAlert($locate->Translate("Number can not be blank"));
return $objResponse->getXML();
}
if ($campaignid == '') {
$objResponse->addAlert($locate->Translate("Campaign can not be blank"));
return $objResponse->getXML();
}
$customerMsg = astercrm::getRecordsByField('id', $customerid, 'customer');
while ($customerMsg->fetchInto($tmp)) {
$customername = $tmp['customer'];
}
/*
if($dialtime == ''){
$objResponse->addAlert($locate->Translate("Dial time can not be blank"));
return $objResponse->getXML();
}
*/
$f['customerid'] = $customerid;
$f['customername'] = $customername;
$f['curCampaignid'] = $campaignid;
$f['sDialNum'] = $dialnumber;
$f['sDialtime'] = $dialtime;
$res = astercrm::insertNewSchedulerDial($f);
$resultId = mysql_insert_id();
if ($res) {
$objResponse->addAlert($locate->Translate("Add scheduler dial success"));
$objResponse->addAssign("formdAddSechedualaraDiv", "style.visibility", "hidden");
$objResponse->addAssign("formdAddSechedualaraDiv", "innerHTML", '');
$objResponse->addAssign("addedSchedulerDialId", "value", $resultId);
//$objResponse->addAssign("trAddSchedulerDial", "style.display", "none");
} else {
$objResponse->addAlert($locate->Translate("Add scheduler dial failed"));
$objResponse->addAssign("formdAddSechedualaraDiv", "style.visibility", "hidden");
$objResponse->addAssign("formdAddSechedualaraDiv", "innerHTML", '');
}
return $objResponse->getXML();
}
示例3: addSchedulerDial
function addSchedulerDial($display = '', $number)
{
global $locate, $db;
$objResponse = new xajaxResponse();
if ($display == "none") {
$campaignflag = false;
$html = '<td nowrap align="left">' . $locate->Translate("Scheduler Dial") . '</td>
<td align="left">' . $locate->Translate("Number") . ' : <input type="text" id="sDialNum" name="sDialNum" size="15" maxlength="35" value="' . $number . '">';
if ($number != '') {
$curtime = date("Y-m-d H:i:s");
$curtime = date("Y-m-d H:i:s", strtotime("{$curtime} -30 seconds"));
$sql = "SELECT campaignid FROM dialedlist WHERE dialednumber = '" . $number . "' AND dialedtime > '" . $curtime . "' ";
$curcampaignid = $db->getOne($sql);
if ($curcampaignid != '') {
$campaignflag = true;
$curcampaign = astercrm::getRecordByID($curcampaignid, 'campaign');
$curcampaign_name = $curcampaign['campaignname'];
$html .= ' ' . $locate->Translate("campaign") . ' : <input type="text" value="' . $curcampaign_name . '" id="campaignname" name="campaignname" size="15" readonly><input type="hidden" value="' . $curcampaignid . '" id="curCampaignid" name="curCampaignid" size="15" readonly>';
}
}
if (!$campaignflag) {
$campaign_res = astercrm::getRecordsByField("groupid", $_SESSION['curuser']['groupid'], "campaign");
while ($campaign_res->fetchInto($campaign)) {
$campaignoption .= '<option value="' . $campaign['id'] . '">' . $campaign['campaignname'] . '</option>';
}
$html .= ' ' . $locate->Translate("campaign") . ' : <select id="curCampaignid" name="curCampaignid" >' . $campaignoption . '</select>';
}
//
$html .= '<br>' . $locate->Translate("Dialtime") . ' : <input type="text" name="sDialtime" id="sDialtime" size="15" value="" onfocus="displayCalendar(this,\'yyyy-mm-dd hh:ii\',this,true)"> <input type="button" value="' . $locate->Translate("Add") . '" onclick="saveSchedulerDial();">
</td>';
$objResponse->addAssign("trAddSchedulerDial", "innerHTML", $html);
$objResponse->addAssign("trAddSchedulerDial", "style.display", "");
} else {
$objResponse->addAssign("trAddSchedulerDial", "style.display", "none");
}
return $objResponse->getXML();
}
示例4: surveyAdd
/**
* general survey add html
*
* @param $customerid (int) customerid
* @param $contactid (int) contactid
* @return $html (array) HTML
*/
function surveyAdd($surveyid, $customerid = 0, $contactid = 0, $callerid = '', $campaignid = 0)
{
global $locate, $db, $config;
$html = '<form method="post" name="formSurvey" id="formSurvey"><table border="1" width="100%" class="adminlist">';
$survey = astercrm::getRecordById($surveyid, "survey");
$html .= '<tr><td>
<input type="hidden" value="' . $survey['id'] . '" name="surveyid" id="surveyid">
<input type="hidden" value="' . $customerid . '" name="customerid" id="customerid">
<input type="hidden" value="' . $contactid . '" name="contactid" id="contactid">
<input type="hidden" value="' . $callerid . '" name="callerid" id="contactid">
<input type="hidden" value="' . $campaignid . '" name="campaignid" id="contactid">' . $survey['surveyname'] . ' <input type="button" value="' . $locate->Translate("Save") . '" onclick="xajax_surveySave(xajax.getFormValues(\'formSurvey\'));"></td></tr>';
if (trim($survey['surveynote']) != "") {
$html .= '<tr><td>' . $survey['surveynote'] . '</td></tr>';
}
$options = astercrm::getRecordsByField("surveyid", $surveyid, "surveyoptions");
while ($options->fetchInto($option)) {
$html .= '<tr id="tr-option-' . $option['id'] . '"><td>' . $option['surveyoption'] . "(" . $option['optionnote'] . ")<input type=\"hidden\" name=\"surveyoption[]\" value=\"" . $option['id'] . "\"></td></tr>";
if ($option['optiontype'] == "text") {
$html .= "<tr><td><input type=\"text\" name=\"" . $option['id'] . "-note\" size='60'></td></tr>";
} else {
$items = astercrm::getRecordsByField("optionid", $option['id'], "surveyoptionitems");
if ($items) {
$html .= '<tr id="tr-items-' . $option['id'] . '"><td>';
while ($items->fetchInto($item)) {
$html .= '<input type="' . $option['optiontype'] . '" name="' . $option['id'] . '-item[]" value="' . $item['id'] . '-' . $item['itemcontent'] . '" ' . $additional . '>' . $item['itemcontent'];
}
if ($config['survey']['enable_surveynote'] == true) {
$html .= " | " . $locate->Translate("Note") . " <input type=\"text\" name=\"" . $option['id'] . "-note\" size='20'></td></tr>";
}
}
}
}
$html .= '</table></form>';
return $html;
}
示例5: edit
/**
* show group edit form
* @param id int group id
* @return objResponse object xajax response object
*/
function edit($id)
{
global $locate, $db;
$html = Table::Top($locate->Translate("Edit Worktimepackage"), "formDiv");
$html .= Customer::formEdit($id);
$html .= Table::Footer();
// End edit zone
$objResponse = new xajaxResponse();
$objResponse->addAssign("formDiv", "style.visibility", "visible");
$objResponse->addAssign("formDiv", "innerHTML", $html);
$objResponse->addScript("resetC();");
$res = astercrm::getRecordsByField('worktimepackage_id', $id, 'worktimepackage_worktimes');
while ($res->fetchInto($row)) {
$wp[] = $row['worktime_id'];
}
$query = "SELECT * FROM worktimes";
if ($_SESSION['curuser']['usertype'] != 'admin') {
$query .= " WHERE groupid = " . $_SESSION['curuser']['groupid'];
}
$worktimes_res = $db->query($query);
$i = 0;
$weekShow = array('', $locate->Translate("Monday"), $locate->Translate('Tuesday'), $locate->Translate('Wednesday'), $locate->Translate('Thursday'), $locate->Translate('Friday'), $locate->Translate('Saturday'), $locate->Translate('Sunday'));
while ($worktimes_res->fetchInto($worktimes_row)) {
$i++;
if (in_array($worktimes_row['id'], $wp)) {
$cur_content = $worktimes_row['id'] . '-' . $locate->Translate("from") . ':' . $worktimes_row['starttime'] . ' ' . $locate->Translate("to") . ':' . $worktimes_row['endtime'] . ' (' . $weekShow[$worktimes_row['startweek']] . '->' . $weekShow[$worktimes_row['endweek']] . ')';
$objResponse->addScript("mf_click(" . $i . ",'" . $cur_content . "');");
}
}
return $objResponse->getXML();
}