Beispiel #1
0
function setCampaign($groupid)
{
    $objResponse = new xajaxResponse();
    $res = Customer::getRecordsByGroupid($groupid, "campaign");
    //添加option
    while ($res->fetchInto($row)) {
        $objResponse->addScript("addOption('campaignid','" . $row['id'] . "','" . $row['campaignname'] . "');");
    }
    return $objResponse;
}
    /**
     *  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 #3
0
function setAsteriskcalls($groupid)
{
    global $locate;
    $objResponse = new xajaxResponse();
    $res = Customer::getRecordsByGroupid($groupid, 'asteriskcalls');
    //添加option
    while ($res->fetchInto($row)) {
        $objResponse->addScript("addOption('asteriskcallsid','" . $row['id'] . "','" . $row['asteriskcallsname'] . "');");
    }
    return $objResponse;
}
Beispiel #4
0
function setCampaign($groupid)
{
    global $locate;
    $objResponse = new xajaxResponse();
    $res = Customer::getRecordsByGroupid($groupid, "campaign");
    //添加option
    $objResponse->addScript("addSltOption('campaignid','0','" . $locate->Translate("All") . "');");
    while ($res->fetchInto($row)) {
        $objResponse->addScript("addSltOption('campaignid','" . $row['id'] . "','" . $row['campaignname'] . "');");
    }
    return $objResponse;
}
    /**
     *  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;
    }
Beispiel #6
0
    function formAdd($surveyid = 0, $optionid = 0)
    {
        global $locate;
        $html = '
				<!-- No edit the next line -->
				<form method="post" name="f" id="f">
				
				<table border="1" width="100%" class="adminlist" id="tblSurvey">
				';
        $html .= '<tr><td colspan=2>
					' . $locate->Translate("survey_title") . '*
				</td></tr>';
        if ($surveyid == 0) {
            $html .= '<tr><td colspan=2>
						<input type="text" size="50" maxlangth="100" id="surveyname" name="surveyname"/>
					 </td></tr>';
            $html .= '<tr><td colspan=2>
						' . $locate->Translate("Survey Note") . '
					</td></tr>';
            $html .= '<tr><td colspan=2>
						<input type="text" size="50" maxlangth="254" id="surveynote" name="surveynote"/>
					 </td></tr>';
            $enable_html = '<tr>
								<td colspan=2>
								<input type="radio" value="1" id="radEnable" name="radEnable" checked>' . $locate->Translate("enable") . '
								<input type="radio" value="0" id="radEnable" name="radEnable">' . $locate->Translate("disable") . '
								</td>
							 </tr>';
        } else {
            $survey = Customer::getRecord($surveyid, 'survey');
            $nameCell = "TitleCol";
            $html .= '<tr><td colspan="2" id="' . $nameCell . '" style="cursor: pointer;"  onDblClick="xajax_editField(\'survey\',\'surveyname\',\'' . $nameCell . '\',\'' . $survey['surveyname'] . '\',\'' . $survey['id'] . '\');return false">' . $survey['surveyname'] . '<input type="hidden" id="surveyid" name="surveyid" value="' . $surveyid . '"/></td></tr>';
            $nameCell = "NoteCol";
            $html .= '<tr><td colspan=2>
						' . $locate->Translate("Survey Note") . '
					</td></tr>';
            $html .= '<tr><td colspan="2" id="' . $nameCell . '" style="cursor: pointer;"  onDblClick="xajax_editField(\'survey\',\'surveynote\',\'' . $nameCell . '\',\'' . $survey['surveynote'] . '\',\'' . $survey['id'] . '\');return false">' . $survey['surveynote'] . '&nbsp;</td></tr>';
            if ($survey['enable'] == 1) {
                $enable_html = '<tr>
								<td colspan=2>
								<input type="radio" value="1" id="radEnable" name="radEnable" checked>' . $locate->Translate("enable") . '
								<input type="radio" value="0" id="radEnable" name="radEnable">' . $locate->Translate("disable");
            } else {
                $enable_html = '<tr>
								<td colspan=2>
								<input type="radio" value="1" id="radEnable" name="radEnable" >' . $locate->Translate("enable") . '
								<input type="radio" value="0" id="radEnable" name="radEnable" checked>' . $locate->Translate("disable");
            }
            $enable_html .= '<input type="button" onclick="xajax_setSurvey(xajax.getFormValues(\'f\'));return false;" value="' . $locate->Translate("update") . '">
								</td>
							 </tr>';
        }
        $options = Customer::getOptions($surveyid);
        if ($options) {
            $ind = 0;
            while ($options->fetchInto($row)) {
                $nameRow = "formDivRow" . $row['id'];
                $nameCell = $nameRow . "Col" . $ind;
                $html .= '<tr id="' . $nameRow . '" >' . "\n";
                $item_html = "";
                if ($row['optiontype'] == "text") {
                } else {
                    $item_html = '(<a href=? onclick="showItem(\'' . $row['id'] . '\');return false;">' . $locate->Translate("Item") . '</a>)';
                }
                $option_item_number = astercrm::getCountByField("optionid", $row['id'], "surveyoptionitems");
                $html .= '
					<td align="left" width="25%">' . $locate->Translate("option") . '(<a href="?" onclick="xajax_edit(\'' . $surveyid . '\',\'' . $row['id'] . '\');return false;"><img src="skin/default/images/edit.png"></a><a href="?" onclick="deleteOption(\'' . $row['id'] . '\',\'' . $nameRow . '\');return false;"><img src="skin/default/images/trash.png"></a>)' . $item_html . '
					</td><td id="' . $nameCell . '" >' . $row['surveyoption'] . "(" . $locate->Translate($row['optiontype']) . ", {$option_item_number} " . $locate->Translate('items') . ")" . '</td></tr>
					<tr>
						<td align="left" width="25%">' . $locate->Translate("Option Note") . '</td>
						<td id="' . $nameCell . '_note">' . $row['optionnote'] . '</td>
					</tr>
					<tr><td colspan="2" height="1" bgcolor="#ccc"></td></tr>
					';
                $ind++;
            }
        }
        $html .= '<tr><td colspan=2>
					' . $locate->Translate("option") . '
				 </td></tr>';
        if ($optionid == 0) {
            $button_value = $locate->Translate("Add Option");
            $optionid = 0;
        } else {
            $button_value = $locate->Translate("Update Option");
            $option = astercrm::getRecordById($optionid, "surveyoptions");
            $optiontype[$option['optiontype']] = "selected";
        }
        $html .= '<tr><td colspan=2>' . $locate->Translate("Title") . ': 
					<input type="text" size="50" maxlength="50" id="surveyoption" name="surveyoption" value="' . $option['surveyoption'] . '"/>
					<SELECT id="optiontype" name="optiontype">
						<option value="radio" ' . $optiontype['radio'] . '>' . $locate->Translate("Radio") . '</option>
						<option value="checkbox" ' . $optiontype['checkbox'] . '>' . $locate->Translate("Checkbox") . '</option>
						<option value="text" ' . $optiontype['text'] . '>' . $locate->Translate("Text") . '</option>
					</SELECT>
					</td></tr>';
        $html .= '<tr><td colspan=2>' . $locate->Translate("Note") . ': 
					<input type="text" size="50" maxlength="254" id="optionnote" name="optionnote" value="' . $option['optionnote'] . '"/>
					<input type="button" value="' . $button_value . '" onclick="addOption(\'f\',\'' . $optionid . '\');return false;">
				 </td></tr>';
        $html .= $enable_html;
        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 ($survey['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'] . '">';
        }
        if ($survey['campaignid'] == 0) {
            $campaignoptions = '<option value="0">' . $locate->Translate("All") . '</option>';
        }
        $campaignres = Customer::getRecordsByGroupid($survey['groupid'], "campaign");
        while ($row = $campaignres->fetchRow()) {
            $campaignoptions .= '<option value="' . $row['id'] . '"';
            if ($survey['campaignid'] == $row['id']) {
                $campaignoptions .= ' selected';
            }
            $campaignoptions .= '>' . $row['campaignname'] . '</option>';
        }
        $html .= '
					<tr>
						<td align="left" width="25%">' . $locate->Translate("Group Name") . '</td>
						<td>' . $groupoptions . '</td>
					</tr>
					<tr>
						<td align="left" width="25%">' . $locate->Translate("Campaign Name") . '*</td>
						<td><SELECT id="campaignid" name="campaignid">' . $campaignoptions . '</SELECT></td>
					</tr>';
        $html .= '
				</table>
				</form>
				' . $locate->Translate("obligatory_fields") . '
				';
        return $html;
    }