* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/printipp/admin/printipp.php * \ingroup core * \brief Page to setup printipp module */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolprintipp.class.php'; require_once DOL_DOCUMENT_ROOT.'/printipp/lib/printipp.lib.php'; $langs->load("admin"); $langs->load("printipp"); if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha'); if (!$mode) $mode='config'; /* * Action */ if ($action == 'setvalue' && $user->admin) { $db->begin(); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PRINTIPP_HOST",GETPOST('PRINTIPP_HOST','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PRINTIPP_PORT",GETPOST('PRINTIPP_PORT','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PRINTIPP_USER",GETPOST('PRINTIPP_USER','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "PRINTIPP_PASSWORD",GETPOST('PRINTIPP_PASSWORD','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; if (! $error) { $db->commit(); setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); dol_print_error($db); } } /* * View */ $form = new Form($db); llxHeader('',$langs->trans("PrintIPPSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("PrintIPPSetup"),$linkback,'setup'); $head=printippadmin_prepare_head(); dol_fiche_head($head, $mode, $langs->trans("ModuleSetup")); print $langs->trans("PrintIPPDesc")."
\n"; print '
'; if ($mode=='config'&& $user->admin) { print '
'; print ''; print ''; print ''; $var=true; print ''; print ''; print ''; print "\n"; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; //$var=true; //print ''; //print ''; //print ''; //print "\n"; print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'; print $langs->trans("PRINTIPP_ENABLED").''; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('PRINTIPP_ENABLED'); } else { if (empty($conf->global->PRINTIPP_ENABLED)) { print ''.img_picto($langs->trans("Disabled"),'off').''; } else { print ''.img_picto($langs->trans("Enabled"),'on').''; } } print '
'; print $langs->trans("PRINTIPP_HOST").''; print ''; print '   '.$langs->trans("Example").': localhost'; print '
'; print $langs->trans("PRINTIPP_PORT").''; print ''; print '   '.$langs->trans("Example").': 631'; print '
'; print $langs->trans("PRINTIPP_USER").''; print ''; print '
'; print $langs->trans("PRINTIPP_PASSWORD").''; print ''; print '
'.$langs->trans("OtherParameter").''.$langs->trans("Value").'

'; print '
'; } if ($mode=='test'&& $user->admin) { print ''; $printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD); $var=true; print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; //print ''; print ''; print ''; print "\n"; $list = $printer->getlist_available_printers(); $var = True; foreach ($list as $value ) { $var=!$var; $printer_det = $printer->get_printer_detail($value); print ""; print ''; //print ''; print ''; print ''; print ''; print ''; print ''; print ''; //print ''; print ''; print ''; print "\n"; } print '
UriNameStateState_reasonState_reason1BWColorDeviceMediaSupported
'.$value.'
'.print_r($printer_det,true).'
'.$printer_det->printer_name->_value0.''.$printer_det->printer_state->_value0.''.$printer_det->printer_state_reasons->_value0.''.$printer_det->printer_state_reasons->_value1.''.$printer_det->printer_type->_value2.''.$printer_det->printer_type->_value3.''.$printer_det->device_uri->_value0.''.$printer_det->media_default->_value0.''.$printer_det->media_type_supported->_value1.'
'; if (count($list) == 0) print $langs->trans("NoPrinterFound"); } dol_fiche_end(); llxFooter(); $db->close(); ?>