$aparamv) {
if (is_array($aparamv)) {
foreach ($aparamv as $sparam=>$sparamv) {
global ${$sparam};
${$sparam} = $sparamv;
}
} else {
global ${$aparam};
${$aparam} = $aparamv;
}
}
}
$tocsv_checked=(isset($param['tocsv']['checked']) ? $param['tocsv']['checked'] : '');
$tocsv_sep=(isset($param['tocsv']['sep']) ? $param['tocsv']['sep'] : '');
$tocsv_filepath=(isset($param['tocsv']['filepath']) ? $param['tocsv']['filepath'] : '');
$tocsv_enclosure=(isset($param['tocsv']['enclosure']) ? $param['tocsv']['enclosure'] : '');
}
$form_task =
"";
// Procédure interne ou Procédure distante ??
$form_task .= "
";
//procédure interne
if ($type_proc == 'internal') {
//Choix d'une procédure
$form_task .= "
";
if ($form_procs) {
$form_task .=
"
";
$hp=new parameters($form_procs,"procs");
if (preg_match_all("|!!(.*)!!|U",$hp->proc->requete,$query_parameters))
$form_task .= $hp->gen_form_plann();
$form_task .=
"
";
}
} else if ($type_proc == 'remote') {
$form_task .=
"
";
//Procédures Externes
$pmb_procedure_server_credentials_exploded = explode("\n", $pmb_procedure_server_credentials);
if ($pmb_procedure_server_address && (count($pmb_procedure_server_credentials_exploded) == 2)) {
$aremote_procedure_client = new remote_procedure_client($pmb_procedure_server_address, trim($pmb_procedure_server_credentials_exploded[0]), trim($pmb_procedure_server_credentials_exploded[1]));
$procedures = $aremote_procedure_client->get_procs('AP');
if ($procedures) {
if ($procedures->error_information->error_code) {
$form_task .= $msg['remote_procedures_error_server'].":
".$procedures->error_information->error_string."";
} else if (isset($procedures->elements)){
$form_task .=
"";
} else {
$form_task .="
".$msg['remote_procedures_no_procs']."
";
}
}
$form_task .=
"
";
if ($form_procs_remote) {
$id = $form_procs_remote;
$procedure = $aremote_procedure_client->get_proc($id,'AP');
$form_task .=
"
";
if ($procedure['error_message']) {
$form_task .= htmlentities($msg['remote_procedures_error_server'], ENT_QUOTES, $charset).":
".$procedure['error_message']."";
} else {
$the_procedure = $procedure['procedure'];
if ($the_procedure->params && ($the_procedure->params != "NULL")) {
$sql = "CREATE TEMPORARY TABLE remote_proc LIKE procs";
pmb_mysql_query($sql, $dbh) or die(pmb_mysql_error());
$sql = "INSERT INTO remote_proc (idproc, name, requete, comment, autorisations, parameters, num_classement) VALUES (0, '".pmb_mysql_escape_string($the_procedure->name)."', '".pmb_mysql_escape_string($the_procedure->sql)."', '".pmb_mysql_escape_string($the_procedure->comment)."', '', '".pmb_mysql_escape_string($the_procedure->params)."', 0)";
pmb_mysql_query($sql, $dbh) or die(pmb_mysql_error());
$idproc = pmb_mysql_insert_id($dbh);
$hp=new parameters($idproc,"remote_proc");
if (preg_match_all("|!!(.*)!!|U",$hp->proc->requete,$query_parameters)) {
$form_task .= $hp->gen_form_plann();
}
}
}
$form_task .=
"
";
}
} else {
$form_task .=
"";
}
}
// Export CSV
$form_task .= "
";
return $form_task;
}
public function make_serialized_task_params() {
global $dbh, $type_proc, $form_procs, $form_procs_remote;
global $tocsv_checked, $tocsv_sep, $tocsv_filepath, $tocsv_enclosure;
global $pmb_procedure_server_credentials, $pmb_procedure_server_address;
$t = parent::make_serialized_task_params();
$t['type_proc'] = stripslashes($type_proc);
$t['form_procs'] = stripslashes($form_procs);
$t['form_procs_remote'] = stripslashes($form_procs_remote);
$t['tocsv']['checked'] = $tocsv_checked;
$t['tocsv']['sep'] = stripslashes($tocsv_sep);
$t['tocsv']['filepath'] = stripslashes($tocsv_filepath);
$t['tocsv']['enclosure'] = stripslashes($tocsv_enclosure);
if ($form_procs) {
$hp=new parameters($form_procs,'procs');
$t['envt']=$hp->make_serialized_parameters_params();
} else if ($form_procs_remote) {
$id = $form_procs_remote;
$pmb_procedure_server_credentials_exploded = explode("\n", $pmb_procedure_server_credentials);
if ($pmb_procedure_server_address && (count($pmb_procedure_server_credentials_exploded) == 2)) {
$aremote_procedure_client = new remote_procedure_client($pmb_procedure_server_address, trim($pmb_procedure_server_credentials_exploded[0]), trim($pmb_procedure_server_credentials_exploded[1]));
$procedure = $aremote_procedure_client->get_proc($id,"AP");
if (!$procedure['error_message']) {
$the_procedure = $procedure['procedure'];
if ($the_procedure) {
$sql = "CREATE TEMPORARY TABLE remote_proc LIKE procs";
pmb_mysql_query($sql, $dbh) or die(pmb_mysql_error());
$sql = "INSERT INTO remote_proc (idproc, name, requete, comment, autorisations, parameters, num_classement) VALUES (0, '".pmb_mysql_escape_string($the_procedure->name)."', '".pmb_mysql_escape_string($the_procedure->sql)."', '".pmb_mysql_escape_string($the_procedure->comment)."', '', '".pmb_mysql_escape_string($the_procedure->params)."', 0)";
pmb_mysql_query($sql, $dbh) or die(pmb_mysql_error());
$idproc = pmb_mysql_insert_id($dbh);
$hp=new parameters($idproc,"remote_proc");
$t['envt']=$hp->make_serialized_parameters_params();
}
}
}
}
return serialize($t);
}
}