/**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $asteriskcalls =& Customer::getRecordByID($id, 'asteriskcalls');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $grouphtml .= '<select name="groupid" id="groupid" >
																<option value=""></option>';
            $res = Customer::getGroups();
            while ($row = $res->fetchRow()) {
                $grouphtml .= '<option value="' . $row['groupid'] . '"';
                if ($row['groupid'] == $asteriskcalls['groupid']) {
                    $grouphtml .= ' selected ';
                }
                $grouphtml .= '>' . $row['groupname'] . '</option>';
            }
            $grouphtml .= '</select>';
        } else {
            $grouphtml .= $_SESSION['curuser']['group']['groupname'] . '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '">';
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Name") . ' *</td>
					<td align="left"><input type="text" id="asteriskcallsname" name="asteriskcallsname" size="30" maxlength="50" value="' . $asteriskcalls['asteriskcallsname'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Dialout context") . '</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $asteriskcalls['id'] . '"><input type="text" id="dialoutcontext" name="dialoutcontext" size="30" maxlength="50" value="' . $asteriskcalls['outcontext'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Dialin context") . '</td>
					<td align="left"><input type="text" id="dialincontext" name="dialincontext" size="30" maxlength="50" value="' . $asteriskcalls['incontext'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Dialin extension") . '</td>
					<td align="left"><input type="text" id="dialinextension" name="dialinextension" size="30" maxlength="50" value="' . $asteriskcalls['inextension'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">' . $grouphtml . '</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string)	Devuelve una cadena de caracteres que contiene la forma con los datos 
     *								a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $tickets =& Customer::getRecordByID($id, 'tickets');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $grouphtml = '<select name="groupid" id="groupid" onchange="javascript:relateByGid(this.value,document.getElementById(\'id\').value);return false;"><option value="0">' . $locate->Translate("None") . '</option>';
            $res = Customer::getGroups();
            while ($row = $res->fetchRow()) {
                $grouphtml .= '<option value="' . $row['groupid'] . '"';
                if ($row['groupid'] == $tickets['groupid']) {
                    $grouphtml .= ' selected ';
                }
                $grouphtml .= '>' . $row['groupname'] . '</option>';
            }
            $grouphtml .= '</select>';
        } else {
            $grouphtml = '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '" />' . $_SESSION['curuser']['group']['groupname'];
        }
        $campaignOption = Customer::getCampaignByGid($tickets['groupid'], $tickets['campaignid']);
        $parentOption = Customer::getParentCateGory($tickets['groupid'], $tickets['fid'], $tickets['id']);
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Ticket Name") . '*</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $tickets['id'] . '"><input type="text" id="ticketname" name="ticketname" size="25" maxlength="100" value="' . $tickets['ticketname'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group Name") . '</td>
					<td align="left">' . $grouphtml . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Campaign Name") . '</td>
					<td align="left" id="campaignMsg">' . $campaignOption . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Parent Category") . '</td>
					<td align="left" id="parentMsg">' . $parentOption . '</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #3
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $db, $config;
        $campaign =& Customer::getRecordByID($id, 'campaign');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $grouphtml .= '<select name="groupid" id="groupid" >
																<option value=""></option>';
            $res = Customer::getGroups();
            while ($row = $res->fetchRow()) {
                $grouphtml .= '<option value="' . $row['groupid'] . '"';
                if ($row['groupid'] == $campaign['groupid']) {
                    $grouphtml .= ' selected ';
                }
                $grouphtml .= '>' . $row['groupname'] . '</option>';
            }
            $grouphtml .= '</select>';
        } else {
            $grouphtml .= $_SESSION['curuser']['group']['groupname'] . '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '">';
        }
        $bindqueue = "";
        if ($campaign['bindqueue'] == 1) {
            $bindqueue = "checked";
        }
        $dialTochecked = "";
        if ($campaign['dialtwoparty'] == "yes") {
            $dialTochecked = "checked";
        }
        $query = "SELECT id,name From servers";
        $server_res = $db->query($query);
        $serverhtml .= '<select name="serverid" id="serverid">
						<option value="0">' . $locate->Translate("Default Server") . '</option>';
        while ($server_row = $server_res->fetchRow()) {
            $serverhtml .= '<option value="' . $server_row['id'] . '"';
            if ($server_row['id'] == $campaign['serverid']) {
                $serverhtml .= ' selected ';
            }
            $serverhtml .= '>' . $server_row['name'] . '</option>';
        }
        $serverhtml .= '</select>';
        $query = "SELECT id,worktimepackage_name From worktimepackages";
        if ($_SESSION['curuser']['usertype'] != 'admin') {
            $query .= " Where groupid =" . $_SESSION['curuser']['groupid'];
        }
        $worktimepackage_res = $db->query($query);
        $worktimepackagehtml .= '<select name="worktime_package_id" id="worktime_package_id">
						<option value="0">' . $locate->Translate("Any time") . '</option>';
        while ($worktimepackage_row = $worktimepackage_res->fetchRow()) {
            $worktimepackagehtml .= '<option value="' . $worktimepackage_row['id'] . '"';
            if ($worktimepackage_row['id'] == $campaign['worktime_package_id']) {
                $worktimepackagehtml .= ' selected ';
            }
            $worktimepackagehtml .= '>' . $worktimepackage_row['worktimepackage_name'] . '</option>';
        }
        $worktimepackagehtml .= '</select>';
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Campaign Name") . '*</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $campaign['id'] . '"><input type="text" id="campaignname" name="campaignname" size="30" maxlength="60" value="' . $campaign['campaignname'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Campaign Note") . '</td>
					<td align="left"><input type="text" id="campaignnote" name="campaignnote" size="30" maxlength="255" value="' . $campaign['campaignnote'] . '"></td>
				</tr>
				<tr>					
					<td align="left" colspan="2">' . $locate->Translate("Enable") . '&nbsp;<input type="radio" id="enable" name="enable" value="1"';
        if ($campaign['enable']) {
            $html .= 'checked>&nbsp;' . $locate->Translate("Disable") . '&nbsp;<input type="radio" id="enable" name="enable" value="0" ></td>';
        } else {
            $html .= '>&nbsp;' . $locate->Translate("Disable") . '&nbsp;<input type="radio" id="enable" name="enable" value="0" checked></td>';
        }
        if ($campaign['firstcontext'] != '' && $campaign['nextcontext'] != '') {
            $crdchecked = 'checked';
            $outcontext = $campaign['firstcontext'];
            $crdcontext = $campaign['outcontext'];
            $crdtr = '';
            $amdchecked = 'checked';
            $incontext = $campaign['nextcontext'];
            $amdcontext = $campaign['incontext'];
            $amdtr = '';
        } else {
            $outcontext = $campaign['outcontext'];
            $crdcontext = $config['system']['crdcontext'];
            $crdtr = 'style="display:none"';
            $incontext = $campaign['incontext'];
            $amdcontext = $config['system']['amdcontext'];
            $amdtr = 'style="display:none"';
        }
        if ($campaign['enablerecyle'] == 'no') {
            $recyleno = 'selected';
            $recyleyes = '';
        } else {
            $recyleno = '';
            $recyleyes = 'selected';
        }
        if ($campaign['use_ext_chan'] == 'yes') {
            $useExtChanChecked = 'checked';
        } else {
            $useExtChanChecked = '';
        }
        if ($campaign['enablebalance'] == 'no') {
            $enablebalanceNo = 'selected';
            $enablebalanceYes = '';
            $enablebalanceStrict = '';
        } else {
            if ($campaign['enablebalance'] == 'yes') {
                $enablebalanceNo = '';
                $enablebalanceYes = 'selected';
                $enablebalanceStrict = '';
            } else {
                $enablebalanceNo = '';
                $enablebalanceYes = '';
                $enablebalanceStrict = 'selected';
            }
        }
        $html .= '</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Asterisk Server") . '*</td>
					<td align="left">' . $serverhtml . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Worktime package") . '</td>
					<td align="left">' . $worktimepackagehtml . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Waitting time") . '</td>
					<td align="left"><input type="text" id="waittime" name="waittime" size="30" maxlength="3" value="' . $campaign['waittime'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Call Result Detect") . '</td>
					<td align="left"><input type="checkbox" id="crdenable" name="crdenable" onclick="if(this.checked == true){xajax.$(\'crdtr\').style.display=\'\';xajax.$(\'amdtr\').style.display=\'\';}else{xajax.$(\'crdtr\').style.display=\'none\';xajax.$(\'amdtr\').style.display=\'none\';}" ' . $crdchecked . '>&nbsp;</td>
				</tr>
				<tr id="crdtr" ' . $crdtr . '>
					<td nowrap align="left">' . $locate->Translate("CRD context") . '</td>
					<td align="left"><input type="text" id="crdcontext" name="crdcontext" size="26" maxlength="60" value="' . $crdcontext . '" ></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Outcontext") . '*</td>
					<td align="left"><input type="text" id="outcontext" name="outcontext" size="30" maxlength="60" value="' . $outcontext . '"></td>
				</tr>				
				<tr id="amdtr" ' . $amdtr . '>
					<td nowrap align="left">' . $locate->Translate("AMD context") . '</td>
					<td align="left"><input type="text" id="amdcontext" name="amdcontext" size="26" maxlength="60" value="' . $amdcontext . '" ></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Incontext") . '*</td>
					<td align="left"><input type="text" id="incontext" name="incontext" size="30" maxlength="60" value="' . $incontext . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Dial two party at same time") . '</td>
					<td align="left"><input type="checkbox" id="dialtwoparty" name="dialtwoparty" ' . $dialTochecked . '>&nbsp;</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Inexten") . '</td>
					<td align="left"><input type="text" id="inexten" name="inexten" size="30" maxlength="30" value="' . $campaign['inexten'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Queue number") . '</td>
					<td align="left">
						<input type="text" id="queuename" name="queuename" size="30" maxlength="30" value="' . $campaign['queuename'] . '">
						<input type="checkbox" name="bindqueue" id="bindqueue" ' . $bindqueue . '>' . $locate->Translate("send calls to this queue directly") . '						
						</td>
				</tr>

				<tr>
					<td nowrap align="left">' . $locate->Translate("Queue Context") . '</td>
					<td align="left"><input type="text" id="queue_context" name="queue_context" size="30" maxlength="60" value="' . $campaign['queue_context'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Use Extension Channel For Queue") . '</td>
					<td align="left"><input type="checkbox" id="use_ext_chan" name="use_ext_chan" ' . $useExtChanChecked . '/></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("CallerID") . '</td>
					<td align="left"><input type="text" id="callerid" name="callerid" size="30" maxlength="30" value="' . $campaign['callerid'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '*</td>
					<td align="left">' . $grouphtml . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Max Dialing") . '</td>
					<td align="left"><input type="text" id="max_dialing" name="max_dialing" size="10" maxlength="4" value="' . $campaign['max_dialing'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Max trytime") . '</td>
					<td align="left"><input type="text" id="maxtrytime" name="maxtrytime" size="30" maxlength="30" value="' . $campaign['maxtrytime'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Recyle time") . '</td>
					<td align="left"><input type="text" id="recyletime" name="recyletime" size="10" maxlength="10" value="' . $campaign['recyletime'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Enable Auto Recyle") . '</td>
					<td align="left"><select name="enablerecyle" id="enablerecyle"><option value="no" ' . $recyleno . ' >' . $locate->Translate("no") . '</option><option value="yes" ' . $recyleyes . '>' . $locate->Translate("yes") . '</option></select></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Min Duration") . '</td>
					<td align="left"><input type="text" id="minduration" name="minduration" size="10" maxlength="10" value="' . $campaign['minduration'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Agent Answer Min Duration") . '</td>
					<td align="left"><input type="text" id="minduration_billsec" name="minduration_billsec" size="10" maxlength="10" value="' . $campaign['minduration_billsec'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Customer Answer Min Duration") . '</td>
					<td align="left"><input type="text" id="minduration_leg_a" name="minduration_leg_a" size="10" maxlength="10" value="' . $campaign['minduration_leg_a'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("SMS Number") . '</td>
					<td align="left"><input type="text" id="sms_number" name="sms_number" size="20" maxlength="30" value="' . $campaign['sms_number'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Balance") . '</td>
					<td align="left"><input type="text" id="balance" name="balance" size="20" maxlength="11" value="' . $campaign['balance'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Init Billing") . '</td>
					<td align="left"><input type="text" id="init_billing" name="init_billing" size="20" maxlength="11" value="' . $campaign['init_billing'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Billing Block") . '</td>
					<td align="left"><input type="text" id="billing_block" name="billing_block" size="20" maxlength="11" value="' . $campaign['billing_block'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Enable Balance") . '</td>
					<td align="left"><select name="enablebalance" id="enablebalance"><option value="yes" ' . $enablebalanceYes . '>' . $locate->Translate("yes") . '</option><option value="no" ' . $enablebalanceNo . '>' . $locate->Translate("no") . '</option><option value="strict" ' . $enablebalanceStrict . '>' . $locate->Translate("strict") . '</option></select></td>
				</tr>';
        //print_r($campaign);exit;
        $ad_hours = intval($campaign['billsec'] / 3600);
        $ad_min = intval($campaign['billsec'] % 3600 / 60);
        $ad_sec = $campaign['billsec'] % 60;
        $asr = round($campaign['answered'] / $campaign['dialed'] * 100, 2);
        $acd = round($campaign['billsec'] / $campaign['answered'] / 60, 1);
        if ($acd > 1) {
            $acd = $acd . '&nbsp;' . $locate->Translate("min");
        } else {
            $acd = round($campaign['billsec'] / $campaign['answered'], 0);
            $acd = $acd . '&nbsp;' . $locate->Translate("sec");
        }
        $rsd = round(($campaign['duration_answered'] + $campaign['duration_noanswer'] - $campaign['billsec_leg_a']) / $campaign['dialed'], 0);
        $abandoned =& $db->getOne("SELECT COUNT(*) FROM campaigndialedlist WHERE billsec_leg_a > 0 AND billsec = 0 AND campaignid = '{$id}'");
        //print_r($campaign);exit;
        //统计数据
        $html .= '<tr>
					<td colspan="2" nowrap align="left"><table border="1" width="100%" class="adminlist">
						<tr>
							<td>
								' . $locate->Translate("Total calls") . ':&nbsp;<b>' . $campaign['dialed'] . '</b>
							</td>
							<td>
								' . $locate->Translate("Answered calls") . ':&nbsp;<b>' . $campaign['answered'] . '</b>
							</td>							
						<tr>
						<tr>
							<td>
								' . $locate->Translate("Transfered") . ':&nbsp;<b>' . $campaign['transfered'] . '</b>
							</td>
							<td>
								' . $locate->Translate("Transfere Rate") . ':&nbsp;<b>' . round($campaign['transfered'] / $campaign['answered'] * 100, 2) . '%</b>
							</td>							
						<tr>
						<tr>							
							<td>
								' . $locate->Translate("Answered duration") . ':&nbsp;<b>' . $ad_hours . '&nbsp;' . $locate->Translate("hour") . '&nbsp;' . $ad_min . $locate->Translate("min") . '&nbsp;' . $ad_sec . '&nbsp;' . $locate->Translate("sec") . '&nbsp;</b>
							</td>
							<td>								' . $locate->Translate("ASR") . ':&nbsp;<b>' . $asr . '%</b>
							</td>
						<tr>
						<tr>							
							<td>								' . $locate->Translate("ACD") . ':&nbsp;<b>' . $acd . '</b>
							</td>
							<td>								' . $locate->Translate("RSD") . ':&nbsp;<b>' . $rsd . '&nbsp;' . $locate->Translate("sec") . '</b>
							</td>
						<tr>

						<tr>							
							<td>								' . $locate->Translate("abandoned") . ':&nbsp;<b>' . $abandoned . '</b>
							</td>
							<td>
							<a href="dialedlist.php?cid=' . $id . '&action=abandoned">' . $locate->Translate("abandoned detail") . '</a></b>
							</td>
						<tr>
					</table></td>
				</tr>';
        $html .= '<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #4
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $config;
        $rate =& Customer::getRecordByID($id, 'myrate');
        /*
        $group = astercrm::getAll('accountgroup');
        
        if ($_SESSION['curuser']['usertype'] == 'admin'){
        	$groupoptions .= '<select id="groupid" name="groupid">';
        	while	($group->fetchInto($row)){
        		if ($row['id'] == $rate['groupid']){
        			$groupoptions .= "<OPTION value='".$row['id']."' selected>".$row['groupname']."</OPTION>";
        		}else{
        			$groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>";
        		}
        	}
        	$groupoptions .= '</select>';
        }else{
        	while	($group->fetchInto($row)){
        		if ($row['id'] == $_SESSION['curuser']['groupid']){
        			$groupoptions .= $row['groupname'].'<input type="hidden" value="'.$row['id'].'" name="groupid" id="groupid">';
        			break;
        		}
        	}
        }
        */
        $reselleroptions = '';
        $reseller = astercrm::getAll('resellergroup');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">';
            $reselleroptions .= '<option value="0"></option>';
            while ($reseller->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                }
                if ($row['id'] == $rate['resellerid']) {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                } else {
                    $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>";
                }
            }
            $reselleroptions .= '</select>';
        } else {
            while ($reseller->fetchInto($row)) {
                if ($row['id'] == $rate['resellerid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
                    }
                    $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">';
                    break;
                }
            }
        }
        $group = astercrm::getAll('accountgroup', 'resellerid', $rate['resellerid']);
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $groupoptions .= '<select id="groupid" name="groupid">';
            $groupoptions .= "<OPTION value='0'></OPTION>";
            while ($group->fetchInto($row)) {
                if ($config['synchronize']['display_synchron_server']) {
                    $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                }
                if ($row['id'] == $rate['groupid']) {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>";
                } else {
                    $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>";
                }
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $rate['groupid']) {
                    if ($config['synchronize']['display_synchron_server']) {
                        $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']);
                    }
                    $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                    break;
                }
            }
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("prefix") . '</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $rate['id'] . '"><input type="text" id="dialprefix" name="dialprefix" size="25" maxlength="30" value="' . $rate['dialprefix'] . '" onKeyUp="xajax_showBuyRate(this.value);" onclick="xajax_showBuyRate(this.value);">&nbsp;<span id="spanShowBuyRate" name="spanShowBuyRate"></span></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("length") . '</td>
					<td align="left"><input type="text" id="numlen" name="numlen" size="10" maxlength="10" value="' . $rate['numlen'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Destination") . '</td>
					<td align="left"><input type="text" id="destination" name="destination" size="25" maxlength="30" value="' . $rate['destination'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Connect charge") . '</td>
					<td align="left"><input type="text" id="connectcharge" name="connectcharge" size="20" maxlength="20" value="' . $rate['connectcharge'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Init block") . '</td>
					<td align="left"><input type="text" id="initblock" name="initblock" size="25" maxlength="100" value="' . $rate['initblock'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Rate") . '</td>
					<td align="left"><input type="text" id="rateinitial" name="rateinitial" size="25" maxlength="30" value="' . $rate['rateinitial'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Billing block") . '</td>
					<td align="left"><input type="text" id="billingblock" name="billingblock" size="25" maxlength="30" value="' . $rate['billingblock'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Reseller") . '</td>
					<td align="left">' . $reselleroptions . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">
					' . $groupoptions . '
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button>
					</td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				*' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #5
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function showAccountgroupDetail($id)
    {
        global $locate, $db;
        $account =& Customer::getRecordByID($id, 'astercrm_accountgroup');
        $contactList =& astercrm::getGroupMemberListByID($account['groupid']);
        $html = '
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left" width="45%">' . $locate->Translate("groupname") . '</td>
					<td align="left" width="55%">' . $account['groupname'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("incontext") . '</td>
					<td align="left">' . $account['incontext'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("outcontext") . '</td>
					<td align="left">' . $account['outcontext'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("groupid") . '</td>
					<td align="left">' . $account['groupid'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("force monitor") . '</td>
					<td align="left">' . $account['monitorforce'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("first ring") . '</td>
					<td align="left">' . $locate->Translate($account['firstring']) . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("allowloginqueue") . '</td>
					<td align="left">' . $locate->Translate($account['allowloginqueue']) . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("agent interval") . '</td>
					<td align="left">' . $account['agentinterval'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("clear popup") . '(s)</td>
					<td align="left">' . $account['clear_popup'] . '</td>
				</tr>';
        /*<tr>
        			<td nowrap align="left">'.$locate->Translate("pdcontext").'</td>
        			<td align="left">'.$account['pdcontext'].'</td>
        		</tr>
        		<tr>
        			<td nowrap align="left">'.$locate->Translate("pdextensions").'</td>
        			<td align="left">'.$account['pdextension'].'</td>
        		</tr>';*/
        $html .= '<tr>
					<td>
						<a href=? onclick="if (xajax.$(\'allMember\').value==\'off\'){xajax.$(\'memberList\').style.display=\'block\';xajax.$(\'allMember\').value=\'on\'}else{xajax.$(\'memberList\').style.display=\'none\';xajax.$(\'allMember\').value=\'off\'} return false;">' . $locate->Translate("display_all_member") . '</a>
						<input type="hidden" id="allMember" name="allMember" value="off">
					</td>
				</tr>
				
			 </table>
			 <table border="0" id="memberList" name="memberList" style="display:none" class="memberlist">
			 <tr><td colspan="4" width="100%" height="1px" ></td></tr>
					';
        while ($contactList->fetchInto($row)) {
            $html .= '<tr>';
            $html .= '
							<td align="left">
								' . $row['username'] . '
							</td>
							';
            for ($i = 1; $i < 4; $i++) {
                if (!$contactList->fetchInto($row)) {
                    $html .= '<td>&nbsp;</td>';
                } else {
                    $html .= '
									<td align="left">
										' . $row['username'] . '
									</td>
									';
                }
            }
            $html .= '</tr>';
        }
        $html .= '
					</table>';
        return $html;
    }
Beispiel #6
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function showAccountDetail($id)
    {
        global $locate;
        $account =& Customer::getRecordByID($id, 'account');
        $html = '
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("username") . '</td>
					<td align="left">' . $account['username'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("password") . '</td>
					<td align="left">' . $account['password'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("usertype") . '</td>
					<td align="left">' . $account['usertype'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("extensions") . '</td>
					<td align="left">' . $account['extensions'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("account_code") . '</td>
					<td align="left">' . $account['accountcode'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Callback") . '</td>
					<td align="left">' . $account['callback'] . '</td>
				</tr>
			 </table>
			';
        return $html;
    }
Beispiel #7
0
    function formEdit($id)
    {
        global $locate;
        $diallist =& Customer::getRecordByID($id, 'diallist');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $res = Customer::getGroups();
            $groupoptions .= '<select name="groupid" id="groupid" onchange="setCampaign();">';
            while ($row = $res->fetchRow()) {
                $groupoptions .= '<option value="' . $row['groupid'] . '"';
                if ($diallist['groupid'] == $row['groupid']) {
                    $groupoptions .= ' selected';
                }
                $groupoptions .= '>' . $row['groupname'] . '</option>';
            }
            $groupoptions .= '</select>';
        } else {
            $groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">';
        }
        $campaignlist = Customer::getAll("campaign", "groupid", $diallist['groupid']);
        while ($row = $campaignlist->fetchRow()) {
            $campaign_options .= '<option value="' . $row['id'] . '"';
            if ($diallist['campaignid'] == $row['id']) {
                $campaign_options .= ' selected';
            }
            $campaign_options .= '>' . $row['campaignname'] . '</option>';
        }
        $html = '
				<!-- No edit the next line -->
				<form method="post" name="formDiallist" id="formDiallist">
				
				<table border="1" width="100%" class="adminlist">
					<tr>
						<td nowrap align="left">' . $locate->Translate("number") . '*</td>
						<td align="left">
							<input type="text" id="dialnumber" name="dialnumber" size="35"  value="' . $diallist['dialnumber'] . '">
							<input type="hidden" id="id" name="id" value="' . $diallist['id'] . '">
						</td>
					</tr>
					<tr>
						<td nowrap align="left">' . $locate->Translate("Name") . '</td>
						<td align="left">
							<input type="text" id="customername" name="customername" value="' . $diallist['customername'] . '" size="35">
						</td>
					</tr>
					<tr>
						<td nowrap align="left">' . $locate->Translate("Assign To") . '</td>
						<td align="left">
							<input type="text" id="assign" name="assign" size="35" value="' . $diallist['assign'] . '">
						</td>
					</tr>
					<tr>
						<td nowrap align="left">' . $locate->Translate("Call Order") . '</td>
						<td align="left">
							<input type="text" id="callOrder" name="callOrder" size="35" value="' . $diallist['callOrder'] . '">
						</td>
					</tr>
					<tr>
						<td nowrap align="left">' . $locate->Translate("Dialtime") . '</td>
						<td align="left">
							<input type="text" name="dialtime" id="dialtime" size="20" value="' . $diallist['dialtime'] . '">
			<INPUT onclick="displayCalendar(document.getElementById(\'dialtime\'),\'yyyy-mm-dd hh:ii\',this,true)" type="button" value="' . $locate->Translate("Cal") . '">
						</td>
					</tr>';
        $html .= '
					<tr>
						<td align="left" width="25%">' . $locate->Translate("Group Name") . '</td>
						<td>' . $groupoptions . '</td>
					</tr>';
        $html .= '
					<tr>
						<td align="left" width="25%">' . $locate->Translate("Campaign Name") . '</td>
						<td><SELECT id="campaignid" name="campaignid">' . $campaign_options . '</SELECT></td>
					</tr>';
        $html .= '
					<tr>
						<td align="left" width="25%">' . $locate->Translate("Memo") . '</td>
						<td><textarea id="memo" name="memo" cols="50" rows="8">' . $diallist['memo'] . '</textarea></td>
					</tr>';
        $html .= '
					<tr>
						<td nowrap colspan=2 align=right><input type="button" id="btnAddDiallist" name="btnAddDiallist" value="' . $locate->Translate("continue") . '" onclick="xajax_update(xajax.getFormValues(\'formDiallist\'));return false;"></td>
					</tr>
				<table>
				</form>
				';
        return $html;
    }
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string)	Devuelve una cadena de caracteres que contiene la forma con los datos 
     *								a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $result =& Customer::getRecordByID($id, 'sms_templates');
        $optionHtml = '';
        if ($result['belongto'] == 'campaign') {
            $optionHtml = Customer::getCurObjId($result['belongto'], $result['campaign_id']);
        } else {
            if ($result['belongto'] == 'trunk') {
                $optionHtml = Customer::getCurObjId($result['belongto'], $result['trunkinfo_id']);
            }
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Template Title") . '*</td>
					<td align="left"><input type="text" id="templatetitle" name="templatetitle" value="' . $result['templatetitle'] . '" /><input type="hidden" id="id" name="id" value="' . $result['id'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Belong To") . '</td>
					<td><select id="belongto" name="belongto" onchange="xajax_getCurObjId(this.value);">
						<option value="all"';
        if ($result['belongto'] == 'all') {
            $html .= ' selected';
        }
        $html .= '>' . $locate->Translate("All") . '</option>
						<option value="campaign"';
        if ($result['belongto'] == 'campaign') {
            $html .= ' selected';
        }
        $html .= '>' . $locate->Translate("Campaign") . '</option>
						<option value="trunk"';
        if ($result['belongto'] == 'trunk') {
            $html .= ' selected';
        }
        $html .= '>' . $locate->Translate("Trunk") . '</option>
					</select></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Object") . '</td>
					<td id="objectSelect">' . $optionHtml . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Is_edit") . '</td>
					<td>';
        if ($result['is_edit'] == 'yes') {
            $html .= '<input type="checkbox" id="is_edit" name="is_edit" checked/>';
        } else {
            $html .= '<input type="checkbox" id="is_edit" name="is_edit"/>';
        }
        $html .= '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Content") . '</td>
					<td><textarea id="content" name="content" cols="40" rows="5">' . $result['content'] . '</textarea></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>
			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #9
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string)	Devuelve una cadena de caracteres que contiene la forma con los datos 
     *								a extraidos de la base de datos para ser editados 
     */
    function formTicketEdit($id)
    {
        global $locate;
        $result =& Customer::getRecordByID($id, 'ticket_details');
        $categoryHtml = Customer::getTicketCategory($result['ticketcategoryid']);
        $ticketHtml = Customer::getTicketByCategory($result['ticketcategoryid'], $result['ticketid']);
        $groupHtml = Customer::getGroup($result['ticketcategoryid'], $result['groupid']);
        //$customerHtml = Customer::getCustomer($result['groupid'],$result['customerid']);
        $customername = Customer::getCustomername($result['customerid']);
        $accountHtml = Customer::getAccount($result['groupid'], $result['assignto']);
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("TicketCategory Name") . '*</td>
					<td align="left">' . $categoryHtml . '<input type="hidden" id="id" name="id" value="' . $result['id'] . '"><input type="hidden" id="curTicketid" value="' . $result['ticketid'] . '"></td>
				</tr>
				<tr>
					<td align="left" width="25%">' . $locate->Translate("Ticket Name") . '*</td>
					<td id="ticketMsg">' . $ticketHtml . '</td>
				</tr>
				<tr>
					<td align="left" width="25%">' . $locate->Translate("Parent TicketDetail ID") . '</td>
					<td><input type="text" id="parent_id" name="parent_id"  maxlength="8" value="' . ($result['parent_id'] == '' ? '' : str_pad($result['parent_id'], 8, '0', STR_PAD_LEFT)) . '" /></td>
				</tr>
				<tr>
					<td align="left" width="25%">' . $locate->Translate("Group Name") . '*</td>
					<td id="groupMsg">' . $groupHtml . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Customer Name") . '*</td>
					<td id="customerMsg"><input type="text" id="ticket_customer" name="ticket_customer" value="' . $customername . '" onkeyup="ajax_showOptions(this,\'getCustomersByLetters\',event)" size="25" maxlength="50" autocomplete="off" /><input type="hidden" id="ticket_customer_hidden" name="customerid" value="' . $result['customerid'] . '" /></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Assignto") . '</td>
					<td id="accountMsg">' . $accountHtml . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Status") . '</td>
					<td><select id="status" name="status">
						<option value="new"';
        if ($result['status'] == 'new') {
            $html .= ' selected';
        }
        $html .= '>' . $locate->Translate("new") . '</option>
						<option value="panding"';
        if ($result['status'] == 'panding') {
            $html .= ' selected';
        }
        $html .= '>' . $locate->Translate("panding") . '</option>
						<option value="closed"';
        if ($result['status'] == 'closed') {
            $html .= ' selected';
        }
        $html .= '>' . $locate->Translate("closed") . '</option>
						<option value="cancel"';
        if ($result['status'] == 'cancel') {
            $html .= ' selected';
        }
        $html .= '>' . $locate->Translate("cancel") . '</option>
					</select></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Memo") . '</td>
					<td><textarea id="memo" name="memo" cols="40" rows="5">' . $result['memo'] . '</textarea></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><input type="button" id="" onclick="xajax_viewSubordinateTicket(' . $result['id'] . ')" value="' . $locate->Translate("Subordinate TicketDetails") . '">&nbsp;&nbsp;<button id="submitButton" onClick=\'xajax_updateCurTicket(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>
			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #10
0
function playmonitor($id)
{
    global $config, $locate;
    $objResponse = new xajaxResponse();
    $res = Customer::getRecordByID($id, 'monitorrecord');
    $path = $res['filename'] . "." . $res['fileformat'];
    $html = Table::Top($locate->Translate("playmonitor"), "formplaymonitor");
    if (is_file($path)) {
        if ($res['fileformat'] == 'mp3') {
            $html .= '<object type="application/x-shockwave-flash" data="skin/default/player_mp3_maxi.swf" width="200" height="20"><param name="movie" value="skin/default/player_mp3_maxi.swf" /><param name="bgcolor" value="#ffffff" /><param name="FlashVars" value="mp3=records.php?file=' . $id . '&amp;loop=0&amp;autoplay=1&amp;autoload=1&amp;volume=75&amp;showstop=1&amp;showinfo=1&amp;showvolume=1&amp;showloading=always" /></object><br><a href="###" onclick="window.location.href=\'records.php?file=' . $id . '\'">' . $locate->Translate("download") . '</a>';
        } else {
            $html .= '<embed src="records.php?file=' . $id . '" autostart="true" width="300" height="40" name="sound" id="sound" enablejavascript="true"><br><a href="###" onclick="window.location.href=\'records.php?file=' . $id . '\'">' . $locate->Translate("download") . '</a>';
        }
    } else {
        $html .= '<b>404 File not found!</b>';
    }
    $html .= Table::Footer();
    $objResponse->addAssign("formplaymonitor", "style.visibility", "visible");
    $objResponse->addAssign("formplaymonitor", "innerHTML", $html);
    return $objResponse->getXML();
}
Beispiel #11
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $result =& Customer::getRecordByID($id, 'codes');
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Code") . '</td>
					<td align="left"><input type="text" id="code" name="code" size="25" maxlength="50" value="' . $result['code'] . '"> <input type="hidden" name="id" value="' . $result['id'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Creby") . '</td>
					<td align="left">' . $result['creby'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Cretime") . '</td>
					<td align="left">' . $result['cretime'] . '</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>
			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #12
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $db;
        $worktimes =& Customer::getRecordByID($id, 'worktimes');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $grouphtml .= '<select name="groupid" id="groupid" >
																<option value=""></option>';
            $res = Customer::getGroups();
            while ($row = $res->fetchRow()) {
                $grouphtml .= '<option value="' . $row['groupid'] . '"';
                if ($row['groupid'] == $worktimes['groupid']) {
                    $grouphtml .= ' selected ';
                }
                $grouphtml .= '>' . $row['groupname'] . '</option>';
            }
            $grouphtml .= '</select>';
        } else {
            $grouphtml .= $_SESSION['curuser']['group']['groupname'] . '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '">';
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left"><input type="hidden" id= "id" name="id" value="' . $worktimes['id'] . '">' . $locate->Translate("Time") . '*</td>
					<td align="left">' . $locate->Translate("From") . ':&nbsp;<input id="starttime" name="starttime" type="text" value="' . $worktimes['starttime'] . '" readonly onclick="showTimeList(\'timelist\');_SetTime(this)"/>&nbsp;' . $locate->Translate("To") . ':&nbsp;<input id="endtime" name="endtime" type="text" value="' . $worktimes['endtime'] . '" readonly onclick="showTimeList(\'timelist\');_SetTime(this)"/><div id="timelist" ></div></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Week") . '*</td>
					<td align="left">' . $locate->Translate("From") . ':&nbsp;
							<SELECT id="startweek" name="startweek">
									<OPTION value="1"';
        if ($worktimes['startweek'] == 1) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Monday") . '</OPTION>
									<OPTION value="2"';
        if ($worktimes['startweek'] == 2) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Tuesday") . '</OPTION>
									<OPTION value="3"';
        if ($worktimes['startweek'] == 3) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Wednesday") . '</OPTION>
									<OPTION value="4"';
        if ($worktimes['startweek'] == 4) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Thursday") . '</OPTION>
									<OPTION value="5"';
        if ($worktimes['startweek'] == 5) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Friday") . '</OPTION>
									<OPTION value="6"';
        if ($worktimes['startweek'] == 6) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Saturday") . '</OPTION>
									<OPTION value="7"';
        if ($worktimes['startweek'] == 7) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Sunday") . '</OPTION>							
							</SELECT>&nbsp;' . $locate->Translate("To") . ':&nbsp;
							<SELECT id="endweek" name="endweek">
									<OPTION value="1"';
        if ($worktimes['endweek'] == 1) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Monday") . '</OPTION>
									<OPTION value="2"';
        if ($worktimes['endweek'] == 2) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Tuesday") . '</OPTION>
									<OPTION value="3"';
        if ($worktimes['endweek'] == 3) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Wednesday") . '</OPTION>
									<OPTION value="4"';
        if ($worktimes['endweek'] == 4) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Thursday") . '</OPTION>
									<OPTION value="5"';
        if ($worktimes['endweek'] == 5) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Friday") . '</OPTION>
									<OPTION value="6"';
        if ($worktimes['endweek'] == 6) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Saturday") . '</OPTION>
									<OPTION value="7"';
        if ($worktimes['endweek'] == 7) {
            $html .= 'selected';
        }
        $html .= '>' . $locate->Translate("Sunday") . '</OPTION>							
							</SELECT>
					</td>
				</tr>			
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">' . $grouphtml . '</td>
				</tr>				
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #13
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $result =& Customer::getRecordByID($id, 'user_types');
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("usertype name") . '*</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $result['id'] . '"><input type="text" id="usertype_name" name="usertype_name" size="25" maxlength="30" value="' . $result['usertype_name'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("memo") . '*</td>
					<td align="left"><textarea rows="8" cols="40" id="memo" name="memo">' . $result['memo'] . '</textarea></td>
				</tr>
				<tr style="height:200px;">
					<td nowrap align="left" colspan="2">
						<div style="width:100%;height:198px;overflow:auto;">';
        $html .= Customer::getPrivilegePage($id);
        $html .= '</div>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onclick=\'update(xajax.getFormValues(f));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>
			 </table>
			</form>
			' . $locate->Translate("obligatory_fields") . '
			';
        return $html;
    }
Beispiel #14
0
function trunkdetail($trunkid, $order)
{
    global $db, $locate;
    $trunk =& Customer::getRecordByID($trunkid, 'trunks');
    $objResponse = new xajaxResponse();
    if ($trunk['id'] > 0) {
        $objResponse->addAssign('trunkname', "value", $trunk['trunkname']);
        $objResponse->addAssign('protocoltype', "value", $trunk['trunkprotocol']);
        $objResponse->addAssign('registrystring', "value", $trunk['registrystring']);
        $objResponse->addAssign('trunkprefix', "value", $trunk['trunkprefix']);
        $objResponse->addAssign('removeprefix', "value", $trunk['removeprefix']);
        $objResponse->addAssign('timeout', "value", $trunk['trunktimeout']);
        $objResponse->addAssign('detail', "value", $trunk['trunkdetail']);
    }
    //print_r($trunk);
    //echo $trunkid;exit;
    if ($order == 1) {
        $objResponse->addAssign('whichtrunk', "value", 1);
        $objResponse->addAssign('whichtrunktip', "innerHTML", $locate->Translate("trunk1"));
    } else {
        $objResponse->addAssign('whichtrunk', "value", 2);
        $objResponse->addAssign('whichtrunktip', "innerHTML", $locate->Translate("trunk2"));
    }
    $objResponse->addScript('document.getElementById(\'trunk\').style.display=\'\'');
    return $objResponse;
}
Beispiel #15
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $remindercalls =& Customer::getRecordByID($id, 'remindercalls');
        $groupoptions = '';
        $group = astercrm::getGroups();
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $groupoptions .= '<select id="groupid" name="groupid" onchange="setAsteriskcalls();">';
            $groupoptions .= '<option value="0"></option>';
            while ($group->fetchInto($row)) {
                $groupoptions .= '<option value="' . $row['groupid'] . '"';
                if ($row['groupid'] == $remindercalls['groupid']) {
                    $groupoptions .= ' selected ';
                }
                $groupoptions .= '>' . $row['groupname'] . '</option>';
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $_SESSION['curuser']['groupid']) {
                    $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">';
                    break;
                }
            }
        }
        $asteriskcalls = Customer::getRecordsByGroupid($remindercalls['groupid'], 'asteriskcalls');
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'groupadmin') {
            $asteriskcallsoptions .= '<select id="asteriskcallsid" name="asteriskcallsid">';
            $asteriskcallsoptions .= "<OPTION value='0'></OPTION>";
            while ($asteriskcalls->fetchInto($row)) {
                if ($row['id'] == $remindercalls['asteriskcallsid']) {
                    $asteriskcallsoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['asteriskcallsname'] . "</OPTION>";
                } else {
                    $asteriskcallsoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['asteriskcallsname'] . "</OPTION>";
                }
            }
            $asteriskcallsoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $remindercalls['asteriskcallsid']) {
                    $asteriskcallsoptions .= $row['asteriskcallsname'] . '<input type="hidden" value="' . $row['id'] . '" name="asteriskcallsid" id="asteriskcallsid">';
                    break;
                }
            }
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Phone number") . ' *</td>
					<td align="left"><input type="text" id="phonenumber" name="phonenumber" size="30" maxlength="50" value="' . $remindercalls['phonenumber'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Note") . '</td>
					<td align="left"><input type="text" id="note" name="note" size="50" maxlength="255" value="' . $remindercalls['note'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">' . $groupoptions . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Call plan") . ' *</td>
					<td align="left">' . $asteriskcallsoptions . '</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_save(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
			</form>
			' . $locate->Translate("obligatory_fields") . '
			';
        return $html;
    }
Beispiel #16
0
function checkAMI($id)
{
    global $locate;
    $objResponse = new xajaxResponse();
    $server =& Customer::getRecordByID($id, 'servers');
    $myAsterisk = new Asterisk();
    $myConfig['server'] = $server["ip"];
    $myConfig['port'] = $server["port"];
    $myConfig['username'] = $server["username"];
    $myConfig['secret'] = $server["secret"];
    $myAsterisk->config['asmanager'] = $myConfig;
    $res = $myAsterisk->connect();
    if ($res) {
        $objResponse->addAssign("divCheckServer", "innerHTML", "<span class='passed'>" . $locate->Translate('AMI_connect_success') . "</span");
    } else {
        $objResponse->addAssign("divCheckServer", "innerHTML", "<span class='failed'>" . $locate->Translate('AMI_connect_failed') . "</span>");
    }
    return $objResponse;
}
Beispiel #17
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function showGroupDetail($id)
    {
        global $locate;
        $resellergroup =& Customer::getRecordByID($id, 'resellergroup');
        $html = '
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("username") . '</td>
					<td align="left">' . $resellergroup['username'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("password") . '</td>
					<td align="left">' . $resellergroup['password'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("usertype") . '</td>
					<td align="left">' . $resellergroup['usertype'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("extensions") . '</td>
					<td align="left">' . $resellergroup['extensions'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("group_code") . '</td>
					<td align="left">' . $resellergroup['groupcode'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Callback") . '</td>
					<td align="left">' . $resellergroup['callback'] . '</td>
				</tr>
			 </table>
			';
        return $html;
    }
Beispiel #18
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function showAccountDetail($id)
    {
        global $locate;
        $account =& Customer::getRecordByID($id, 'astercrm_account');
        $group =& Customer::getGroupByID($account['groupid']);
        $html = '
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("username") . '</td>
					<td align="left">' . $account['username'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("password") . '</td>
					<td align="left">' . $account['password'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("first name") . '</td>
					<td align="left">' . $account['firstname'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("last name") . '</td>
					<td align="left">' . $account['lastname'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("extension") . '</td>
					<td align="left">' . $account['extension'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("dynamic agent") . '</td>
					<td align="left">' . $account['agent'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("extensions") . '</td>
					<td align="left">' . $account['extensions'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("channel") . '</td>
					<td align="left">"' . $account['channel'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("usertype") . '</td>
					<td align="left">' . $account['usertype'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("account_code") . '</td>
					<td align="left">' . $account['accountcode'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("group_name") . '</td>
					<td align="left">' . $group['groupname'] . '</td>
				</tr>
			 </table>
			';
        return $html;
    }
Beispiel #19
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate;
        $trunkinfo =& Customer::getRecordByID($id, 'trunkinfo');
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Trunk Name") . ' *</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $trunkinfo['id'] . '"><input type="text" id="trunkname" name="trunkname" size="30" maxlength="50" value="' . $trunkinfo['trunkname'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Trunk Channel") . ' *</td>
					<td align="left"><input type="text" id="trunkchannel" name="trunkchannel" size="30" maxlength="50" value="' . $trunkinfo['trunkchannel'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("DID Number") . ' </td>
					<td align="left"><input type="text" id="didnumber" name="didnumber" size="30" maxlength="50" value="' . $trunkinfo['didnumber'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Trunk Number") . ' </td>
					<td align="left"><input type="text" id="trunk_number" name="trunk_number" size="30" maxlength="30" value="' . $trunkinfo['trunk_number'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Trunk Note") . '</td>
					<td align="left"><textarea rows="8" cols="50" id="trunknote" name="trunknote">' . $trunkinfo['trunknote'] . '</textarea></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #20
0
    function formEdit($id)
    {
        global $locate;
        $diallist =& Customer::getRecordByID($id, 'dnc_list');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $res = Customer::getGroups();
            $groupoptions .= '<select name="groupid" id="groupid" onchange="setCampaign();">';
            $groupoptions .= '<option value="0"';
            $groupoptions .= '>' . $locate->Translate("please select") . '</option>';
            while ($row = $res->fetchRow()) {
                $groupoptions .= '<option value="' . $row['groupid'] . '"';
                if ($diallist['groupid'] == $row['groupid']) {
                    $groupoptions .= ' selected';
                }
                $groupoptions .= '>' . $row['groupname'] . '</option>';
            }
            $groupoptions .= '</select>';
        } else {
            $groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">';
        }
        $campaignlist = Customer::getAll("campaign", "groupid", $diallist['groupid']);
        while ($row = $campaignlist->fetchRow()) {
            $campaign_options .= '<option value="' . $row['id'] . '"';
            if ($diallist['campaignid'] == $row['id']) {
                $campaign_options .= ' selected';
            }
            $campaign_options .= '>' . $row['campaignname'] . '</option>';
        }
        $html = '
				<!-- No edit the next line -->
				<form method="post" name="formDiallist" id="formDiallist">
				
				<table border="1" width="100%" class="adminlist">
					<tr>
						<td nowrap align="left">' . $locate->Translate("number") . '*</td>
						<td align="left">
							<input type="text" id="number" name="number" size="35"  value="' . $diallist['number'] . '">
							<input type="hidden" id="id" name="id" value="' . $diallist['id'] . '">
						</td>
					</tr>';
        $html .= '
					<tr>
						<td align="left" width="25%">' . $locate->Translate("Group Name") . '</td>
						<td>' . $groupoptions . '</td>
					</tr>';
        $html .= '
					<tr>
						<td align="left" width="25%">' . $locate->Translate("Campaign Name") . '</td>
						<td><SELECT id="campaignid" name="campaignid">' . $campaign_options . '</SELECT></td>
					</tr>';
        $html .= '
					<tr>
						<td nowrap colspan=2 align=right><input type="button" id="btnAddDiallist" name="btnAddDiallist" value="' . $locate->Translate("continue") . '" onclick="xajax_update(xajax.getFormValues(\'formDiallist\'));return false;"></td>
					</tr>
				<table>
				</form>
				';
        return $html;
    }
Beispiel #21
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function showServerDetail($id)
    {
        global $locate;
        $server =& Customer::getRecordByID($id, 'servers');
        $html = '
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Server name") . '</td>
					<td align="left">' . $server['name'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("IP") . '</td>
					<td align="left">' . $server['ip'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Port") . '</td>
					<td align="left">' . $server['port'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Username") . '</td>
					<td align="left">' . $server['username'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Secret") . '</td>
					<td align="left">' . $server['secret'] . '</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Note") . '</td>
					<td align="left">' . $server['note'] . '</td>
				</tr>				
				<tr>
					<td nowrap align="left" ><input type="button" value="' . $locate->Translate("Check AMI connection") . '" onclick="xajax_checkAMI(' . $server['id'] . ')" id="btnCheckServer" name="btnCheckServer"></td>
					<td><div id="divCheckServer" name="divCheckServer"></td>
				</tr>
			 </table>
			';
        return $html;
    }
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $db;
        $campaignresult =& Customer::getRecordByID($id, 'campaignresult');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $grouphtml .= '<select name="groupid" id="groupid" onchange="setCampaign();">
																<option value=""></option>';
            $res = Customer::getGroups();
            while ($row = $res->fetchRow()) {
                $grouphtml .= '<option value="' . $row['groupid'] . '"';
                if ($row['groupid'] == $campaignresult['groupid']) {
                    $grouphtml .= ' selected ';
                }
                $grouphtml .= '>' . $row['groupname'] . '</option>';
            }
            $grouphtml .= '</select>';
        } else {
            $grouphtml .= $_SESSION['curuser']['group']['groupname'] . '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '">';
        }
        $statusAnswered = "";
        $statusNoanswer = "";
        if ($campaignresult['status'] == 'ANSWERED') {
            $statusAnswered = "checked";
        } else {
            $statusNoanswer = "checked";
        }
        $campaign_res = Customer::getRecordsByGroupid($campaignresult['groupid'], "campaign");
        while ($campaign_row = $campaign_res->fetchRow()) {
            $campaignoption .= '<option value="' . $campaign_row['id'] . '"';
            if ($campaign_row['id'] == $campaignresult['campaignid']) {
                $campaignoption .= ' selected ';
            }
            $campaignoption .= '>' . $campaign_row['campaignname'] . '</option>';
        }
        $parentoption .= '<option value="0"';
        if ($campaignresult['parentid'] == 0) {
            $parentoption .= ' selected ';
        }
        $parentoption .= '>' . $locate->Translate("None") . '</option>';
        $parent_res = Customer::getRecordsByField('campaignid', $campaignresult['campaignid'], 'campaignresult');
        while ($parent_row = $parent_res->fetchRow()) {
            if ($parent_row['parentid'] == 0) {
                $parentoption .= '<option value="' . $parent_row['id'] . '"';
                if ($parent_row['id'] == $campaignresult['parentid']) {
                    $parentoption .= ' selected ';
                }
                $parentoption .= '>' . $parent_row['resultname'] . '</option>';
            }
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Result Name") . '*</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $campaignresult['id'] . '"><input type="text" id="resultname" name="resultname" size="30" maxlength="60" value="' . $campaignresult['resultname'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Result Note") . '</td>				<td align="left"><input type="text" id="resultnote" name="resultnote" size="30" maxlength="255" value="' . $campaignresult['resultnote'] . '"></td>
				</tr>
				<tr>					
					<td align="left" colspan="2">' . $locate->Translate("Answered") . '&nbsp;
					<input type="radio" id="status" name="status" value="Answered" ' . $statusAnswered . '>&nbsp;' . $locate->Translate("Noanswer") . '&nbsp;
					<input type="radio" id="status" name="status" value="Noanswer" ' . $statusNoanswer . '>
					</td>
				</tr>				
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">' . $grouphtml . '</td>
				</tr>
				<tr>
					<td align="left" width="25%">' . $locate->Translate("Campaign Name") . '</td>
					<td><SELECT id="campaignid" name="campaignid" onchange="setParentResult();">' . $campaignoption . '</SELECT></td>
				</tr>
				<tr>
					<td align="left" width="25%">' . $locate->Translate("Parent Result Name") . '</td>
					<td><SELECT id="parentid" name="parentid" >' . $parentoption . '</SELECT></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $db;
        $worktimepackages =& Customer::getRecordByID($id, 'worktimepackages');
        if ($_SESSION['curuser']['usertype'] == 'admin') {
            $grouphtml .= '<select name="groupid" id="groupid" >
																<option value=""></option>';
            $res = Customer::getGroups();
            while ($row = $res->fetchRow()) {
                $grouphtml .= '<option value="' . $row['groupid'] . '"';
                if ($row['groupid'] == $worktimepackages['groupid']) {
                    $grouphtml .= ' selected ';
                }
                $grouphtml .= '>' . $row['groupname'] . '</option>';
            }
            $grouphtml .= '</select>';
        } else {
            $grouphtml .= $_SESSION['curuser']['group']['groupname'] . '<input type="hidden" name="groupid" id="groupid" value="' . $_SESSION['curuser']['groupid'] . '">';
        }
        //print_r($wp);exit;
        $query = "SELECT * FROM worktimes";
        if ($_SESSION['curuser']['usertype'] != 'admin') {
            $query .= " WHERE groupid = " . $_SESSION['curuser']['groupid'];
        }
        $worktimes_res = $db->query($query);
        $worktimeshtml .= '';
        $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_row = $worktimes_res->fetchRow()) {
            $i++;
            $cur_content = $worktimes_row['id'] . '-' . $locate->Translate("from") . ':' . $worktimes_row['starttime'] . '&nbsp;' . $locate->Translate("to") . ':' . $worktimes_row['endtime'] . '&nbsp;(' . $weekShow[$worktimes_row['startweek']] . '->' . $weekShow[$worktimes_row['endweek']] . ')';
            $worktimeshtml .= '<a href="javascript:void(0);" id="op_' . $i . '" onclick="mf_click(' . $i . ', \'' . $cur_content . '\');">' . $cur_content . '</a><input type="hidden" id="worktimeVal_' . $i . '" name="worktimeVal_' . $i . '" value="' . $worktimes_row['id'] . '">';
        }
        $worktimeshtml = '
			<table width="300" border="0" cellpadding="0" cellspacing="0" id="formTable">
				<tr><td width="180"><div id="worktimeAllDiv">' . $worktimeshtml . '</div></td></tr>
				<tr><td><div id="worktimeSltdDiv"></div><input type="hidden" id="sltedWorktimes" name="sltedWorktimes" value=""></td></tr>
			</table>';
        if ($worktimepackages['worktimepackage_status'] == 'enable') {
            $enable = 'checked';
        } else {
            $disabled = 'checked';
        }
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Package Name") . '*</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $worktimepackages['id'] . '"><input type="text" id="worktimepackage_name" name="worktimepackage_name" size="30" maxlength="60" value="' . $worktimepackages['worktimepackage_name'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Package Note") . '</td>
					<td align="left"><input type="text" id="worktimepackage_note" name="worktimepackage_note" size="30" maxlength="255" value="' . $worktimepackages['worktimepackage_note'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Status") . '*</td>
					<td align="left" colspan="2">' . $locate->Translate("Enable") . '&nbsp;<input type="radio" id="worktimepackage_status" name="worktimepackage_status" value="enable" ' . $enable . '>&nbsp;' . $locate->Translate("Disable") . '&nbsp;<input type="radio" id="worktimepackage_status" name="worktimepackage_status" value="disabled"  ' . $disabled . '></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Select Worktime") . '*</td>
					<td align="left"><div class="worktimeSltDiv">' . $worktimeshtml . '</div></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Group") . '</td>
					<td align="left">' . $grouphtml . '</td>
				</tr>				
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }
Beispiel #24
0
    /**
     *  Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param $id		(int)		Identificador del registro a ser editado.
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma con los datos 
     *									a extraidos de la base de datos para ser editados 
     */
    function formEdit($id)
    {
        global $locate, $config;
        $rate =& Customer::getRecordByID($id, 'resellerrate');
        $reseller = astercrm::getAll('resellergroup');
        $options .= '<select id="resellerid" name="resellerid">';
        $flag = false;
        while ($reseller->fetchInto($row)) {
            if ($config['synchronize']['display_synchron_server']) {
                $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']);
            }
            if ($row['id'] == $rate['resellerid']) {
                $options .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>";
                $flag = true;
            } else {
                $options .= "<OPTION value='" . $row['id'] . "'>" . $row['resellername'] . "</OPTION>";
            }
        }
        if ($flag == true) {
            $options .= "<OPTION value='0'>" . $locate->Translate("All") . "</OPTION>";
        } else {
            $options .= "<OPTION value='0' selected>" . $locate->Translate("All") . "</OPTION>";
        }
        $options .= '</select>';
        $html = '
			<!-- No edit the next line -->
			<form method="post" name="f" id="f">
			
			<table border="1" width="100%" class="adminlist">
				<tr>
					<td nowrap align="left">' . $locate->Translate("Prefix") . '</td>
					<td align="left"><input type="hidden" id="id" name="id" value="' . $rate['id'] . '"><input type="text" id="dialprefix" name="dialprefix" size="25" maxlength="30" value="' . $rate['dialprefix'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Length") . '</td>
					<td align="left"><input type="text" id="numlen" name="numlen" size="10" maxlength="10" value="' . $rate['numlen'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Dest") . '</td>
					<td align="left"><input type="text" id="destination" name="destination" size="25" maxlength="30" value="' . $rate['destination'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Connect Charge") . '</td>
					<td align="left"><input type="text" id="connectcharge" name="connectcharge" size="20" maxlength="20" value="' . $rate['connectcharge'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Init Block") . '</td>
					<td align="left"><input type="text" id="initblock" name="initblock" size="25" maxlength="100" value="' . $rate['initblock'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Rate") . '</td>
					<td align="left"><input type="text" id="rateinitial" name="rateinitial" size="25" maxlength="30" value="' . $rate['rateinitial'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Billing Block") . '</td>
					<td align="left"><input type="text" id="billingblock" name="billingblock" size="25" maxlength="30" value="' . $rate['billingblock'] . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Reseller") . '</td>
					<td align="left">
					' . $options . '
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
				</form>
				*' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }