id = $id;
$this->module = $module;
$this->table = $table;
}
public function instanciate_procedure() {
global $msg, $charset;
global $pmb_procedure_server_credentials, $pmb_procedure_server_address;
global $remote_type;
$pmb_procedure_server_credentials_exploded = explode("\n", $pmb_procedure_server_credentials);
$the_procedure = 0;
if ($pmb_procedure_server_address && (count($pmb_procedure_server_credentials_exploded) == 2)) {
$this->remote_procedure_client = new remote_procedure_client($pmb_procedure_server_address, trim($pmb_procedure_server_credentials_exploded[0]), trim($pmb_procedure_server_credentials_exploded[1]));
if($this->module == 'admin') {
$procedure = $this->remote_procedure_client->get_proc($this->id, 'AP');
} elseif($this->module == 'circ') {
$procedure = $this->remote_procedure_client->get_proc($this->id);
} else {
$procedure = $this->remote_procedure_client->get_proc($this->id,$remote_type);
}
if ($procedure["error_message"]) {
$buf_contenu=htmlentities($msg["remote_procedures_error_server"], ENT_QUOTES, $charset).":
".$procedure["error_message"]."";
print $buf_contenu;
} else {
$this->the_procedure = $procedure["procedure"];
switch ($this->module) {
case 'circ':
break;
case 'catalog':
caddie_procs::get_parameters_remote();
global $allowed_proc_types;
if (!in_array($this->the_procedure->type, $allowed_proc_types)) {
echo htmlentities($msg["remote_procedures_circ_nocatalogproc"],ENT_QUOTES, $charset);
return false;
}
break;
}
return true;
}
}
echo htmlentities($msg["remote_procedures_error_client"],ENT_QUOTES, $charset);
return false;
}
public function display() {
global $msg, $charset;
global $admin_proc_view_remote;
global $cart_proc_view_remote;
global $type_list;
if ($this->instanciate_procedure()) {
$the_procedure = $this->get_the_procedure();
if($this->module == 'admin') {
$form = $admin_proc_view_remote;
} else {
$form = $cart_proc_view_remote;
}
$form = str_replace('!!id!!', $this->id, $form);
$form = str_replace('!!form_title!!', htmlentities($msg["remote_procedures_detail_procedure_distante"],ENT_QUOTES, $charset), $form);
$additional_information = $the_procedure->untested ? $msg["remote_procedures_procedure_non_validated_additional_information"] : "";
$form = str_replace('!!additional_information!!', htmlentities($additional_information,ENT_QUOTES, $charset), $form);
$form = str_replace('!!name!!', htmlentities($the_procedure->name,ENT_QUOTES, $charset), $form);
$form = str_replace('!!name_suppr!!', htmlentities(addslashes($the_procedure->name),ENT_QUOTES, $charset), $form);
if($this->module != 'admin') {
$form = str_replace('!!ptype!!', htmlentities(($the_procedure->type == "PEMPS" ? $msg["caddie_procs_type_SELECT"] : $msg["caddie_procs_type_ACTION"]),ENT_QUOTES, $charset), $form);
}
$form = str_replace('!!code!!', htmlentities($the_procedure->sql,ENT_QUOTES, $charset), $form);
$form = str_replace('!!comment!!', htmlentities($the_procedure->comment,ENT_QUOTES, $charset), $form);
$parameters = $the_procedure->params;
$parameters = $this->remote_procedure_client->parse_parameters($parameters);
// highlight_string(print_r($parameters, true));
if ($parameters) {
$form = str_replace('!!parameters_title!!', "", $form);
$parameters_display = '
'.htmlentities($msg["remote_procedures_procedure_parameters_name"],ENT_QUOTES, $charset).' | '.htmlentities($msg["remote_procedures_procedure_parameters_title"],ENT_QUOTES, $charset).' | '.htmlentities($msg["remote_procedures_procedure_parameters_type"],ENT_QUOTES, $charset).' | '.htmlentities($msg["remote_procedures_procedure_parameters"],ENT_QUOTES, $charset).' | |||||
---|---|---|---|---|---|---|---|---|
'.htmlentities($parametername,ENT_QUOTES, $charset).' | '; $parameters_display .= ''.htmlentities($parameter["title"]['value'],ENT_QUOTES, $charset).' | '; $parameters_display .= ''.htmlentities($type_list[$parameter["type"]["value"]],ENT_QUOTES, $charset).' | '; switch ($parameter["type"]["value"]) { case "query_list": $parameters_display .= '
| ';
break;
case "text":
$parameters_display .= '
| ';
break;
case "list":
$parameters_display .= '
| ';
break;
case "date_box":
$parameters_display .= '
| ';
break;
case "file_box":
$parameters_display .= '
| ';
break;
default:
break;
}
$parameters_display .= '