예제 #1
0
/**
*  function to init import page
*
*
*  @return $objResponse
*
*/
function init($fileName)
{
    global $locate, $config;
    $objResponse = new xajaxResponse();
    $file_list = getExistfilelist();
    $objResponse->addAssign('filelist', 'innerHTML', '');
    $objResponse->addScript("addOption('filelist','0','" . $locate->Translate('select a existent file') . "');");
    foreach ($file_list as $file) {
        $objResponse->addScript("addOption('filelist','" . $file['fileid'] . "','" . $file['originalname'] . "');");
    }
    $tableList = "<select name='sltTable' id='sltTable' onchange='selectTable(this.value);' >\n\t\t\t\t\t\t\t\t\t\t\t<option value=''>" . $locate->Translate("selecttable") . "</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='customer'>customer</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='contact'>contact</option>\n\t\t\t\t\t\t\t\t\t\t\t<option value='diallist'>diallist</option>\n\t\t\t\t\t\t\t\t\t\t</select>";
    $objResponse->addAssign("divTables", "innerHTML", $tableList);
    $objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
    $objResponse->addAssign("divGrid", "innerHTML", '');
    //$objResponse->addScript("xajax_showDivMainRight(document.getElementById('hidFileName').value);");
    //$objResponse->loadXML(showDivMainRight($fileName));
    //$objResponse->addAssign("divDiallistImport", "innerHTML", '');
    $objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
    if ($_SESSION['curuser']['usertype'] == 'admin') {
        // add all group
        $res = astercrm::getGroups();
        while ($row = $res->fetchRow()) {
            $objResponse->addScript("addOption('groupid','" . $row['groupid'] . "','" . $row['groupname'] . "');");
        }
    } else {
        // add self
        $objResponse->addScript("addOption('groupid','" . $_SESSION['curuser']['groupid'] . "','" . $_SESSION['curuser']['group']['groupname'] . "');");
    }
    $objResponse->addScript("setCampaign();");
    $objResponse->loadXML(showDivMainRight($fileName));
    return $objResponse;
}
예제 #2
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;
    }