コード例 #1
0
function applyChnageParameterFaxMail($smarty, $module_name, $local_templates_dir, $pDB, $credentials)
{
    $arrFaxConfig = createForm();
    $oForm = new paloForm($smarty, $arrFaxConfig);
    if (!$oForm->validateForm($_POST)) {
        // Validation basic, not empty and VALIDATION_TYPE
        $smarty->assign("mb_title", _tr("ERROR"));
        $arrErrores = $oForm->arrErroresValidacion;
        $strErrorMsg = "<b>" . _tr("The following fields contain errors") . ":</b><br/>";
        if (is_array($arrErrores) && count($arrErrores) > 0) {
            foreach ($arrErrores as $k => $v) {
                $strErrorMsg .= "{$k} [{$v['mensaje']}], ";
            }
        }
        $smarty->assign("mb_message", $strErrorMsg);
    } else {
        $oFax = new paloFax($pDB);
        if ($oFax->setConfigurationSendingFaxMailOrg($credentials['id_organization'], $_POST['fax_remite'], $_POST['fax_remitente'], $_POST['fax_subject'], $_POST['fax_content'])) {
            $smarty->assign("mb_title", _tr("Message"));
            $smarty->assign("mb_message", _tr("Changes were applied successfully."));
        } else {
            $smarty->assign("mb_title", _tr("ERROR"));
            $smarty->assign("mb_message", _tr("Changes could not be applied.") . " " . $oFax->errMsg);
        }
    }
    return listParameterFaxMail($smarty, $module_name, $local_templates_dir, $pDB, $credentials);
}
コード例 #2
0
ファイル: index.php プロジェクト: hardikk/HNH
function _moduleContent($smarty, $module_name)
{
    include_once "libs/paloSantoFax.class.php";
    include_once "libs/paloSantoForm.class.php";
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    // Definición del formulario
    $smarty->assign("REQUIRED_FIELD", $arrLang["Required field"]);
    $smarty->assign("CANCEL", $arrLang["Cancel"]);
    $smarty->assign("APPLY_CHANGES", $arrLang["Apply changes"]);
    $smarty->assign("SAVE", $arrLang["Save"]);
    $smarty->assign("EDIT", $arrLang["Edit"]);
    $smarty->assign("EDIT_PARAMETERS", $arrLang["Edit Parameters"]);
    $smarty->assign("icon", "/modules/{$module_name}/images/fax_email_template.png");
    $arrFaxConfig = array("remite" => array("LABEL" => $arrLang['Fax From'], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:240px"), "VALIDATION_TYPE" => "email", "EDITABLE" => "si", "VALIDATION_EXTRA_PARAM" => ""), "remitente" => array("LABEL" => $arrLang["Fax From Name"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:240px"), "VALIDATION_TYPE" => "name", "EDITABLE" => "si", "VALIDATION_EXTRA_PARAM" => ""), "subject" => array("LABEL" => $arrLang["Fax Suject"], "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:240px"), "VALIDATION_TYPE" => "text", "EDITABLE" => "si", "VALIDATION_EXTRA_PARAM" => ""), "content" => array("LABEL" => $arrLang["Fax Content"], "REQUIRED" => "no", "INPUT_TYPE" => "TEXTAREA", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "EDITABLE" => "si", "COLS" => "50", "ROWS" => "4", "VALIDATION_EXTRA_PARAM" => ""));
    $oForm = new paloForm($smarty, $arrFaxConfig);
    $contenidoModulo = "";
    $action = "";
    if (isset($_POST["submit_edit"])) {
        $action = "submit_edit";
    }
    if (isset($_POST["submit_apply_change"])) {
        $action = "submit_apply_change";
    }
    switch ($action) {
        case 'submit_edit':
            $contenidoModulo = editParameterFaxMail($smarty, $module_name, $local_templates_dir, $oForm);
            break;
        case 'submit_apply_change':
            $contenidoModulo = applyChnageParameterFaxMail($smarty, $module_name, $local_templates_dir, $oForm);
            break;
        default:
            $contenidoModulo = listParameterFaxMail($smarty, $module_name, $local_templates_dir, $oForm);
            break;
    }
    return $contenidoModulo;
}