user_input = stripslashes($user_input);
} else {
$this->user_input = '';
}
parent::__construct($id);
}
protected function get_display_label_column($label='', $infobulle='') {
global $charset;
// htmlentities($label, ENT_QUOTES, $charset)
$display = "
get_edit_link($this->authority->get_num_object())."&user_input=".rawurlencode($this->user_input)."&nbr_lignes=".$this->nbr_lignes."&page=".$this->page."';\" title='".$infobulle."'>
".$this->authority->get_display_statut_class_html().$label."
| ";
return $display;
}
protected function get_display_line($authority_id=0) {
global $msg;
$display = '';
// On va chercher les infos spécifique à l'autorité
$this->authority = new authority($authority_id);
if ($this->parity % 2) {
$pair_impair = "even";
} else {
$pair_impair = "odd";
}
$this->parity += 1;
if(static::class == 'entities_categories_controller') {
$notice_count = $this->get_query_notice_count();
} else {
$notice_count_sql = $this->get_query_notice_count();
$notice_count = pmb_mysql_result(pmb_mysql_query($notice_count_sql), 0, 0);
}
$tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" ";
$display.= "";
$display.= "
| ";
$display .= $this->get_display_columns();
if($notice_count) {
$display .= "get_search_mode()."&etat=aut_search&aut_type=".$this->get_aut_type()."&aut_id=".$this->authority->get_num_object()."'\">".$notice_count." | ";
} else {
$display .= " | ";
}
$display.= ''.$this->authority->get_caddie().' | ';
$display .= "
";
return $display;
}
protected function search_form() {
$model_class_name = $this->get_model_class_name();
$model_class_name::search_form();
}
protected function get_pagination_link() {
global $authority_statut;
return $this->url_base."&sub=reach&user_input=".rawurlencode($this->user_input).'&authority_statut='.$authority_statut;
}
public function get_display_list() {
global $page, $nb_per_page_gestion, $categ;
global $last_param;
$display = '';
if(!$this->user_input) $this->user_input = '*';
$this->search_form();
$this->searcher_instance = $this->get_searcher_instance();
$this->nbr_lignes = $this->searcher_instance->get_nb_results();
if(!$page) {
$page=1;
$this->page = $page;
} else {
$this->page = (int) $page;
}
$debut =($this->page-1)*$nb_per_page_gestion;
if($this->nbr_lignes) {
$display .= $this->get_display_header_list();
$this->parity=1;
$sorted_objects = $this->searcher_instance->get_sorted_result('default', $debut, $nb_per_page_gestion);
$this->set_session_history($this->searcher_instance->get_human_query(), $categ, 'QUERY', 'classic');
$this->set_session_history($this->searcher_instance->get_human_query(), $categ, 'AUT', 'classic');
if (is_array($sorted_objects)) {
foreach ($sorted_objects as $authority_id) {
$display .= $this->get_display_line($authority_id);
} // fin while
}
if (!$last_param) $nav_bar = aff_pagination ($this->get_pagination_link(), $this->nbr_lignes, $nb_per_page_gestion, $this->page, 10, false, true) ;
else $nav_bar="";
// affichage du résultat
print $this->searcher_instance->get_results_list_from_search($this->get_results_title(), $this->user_input, $display, $nav_bar);
} else {
// la requête n'a produit aucun résultat
$this->display_no_results();
}
}
public function proceed() {
global $sub;
global $force_unlock;
global $PMBuserid, $save_and_continue;
//parade pour la facto
$formatted_sub = $sub;
if($sub) {
$exploded_sub = explode('_', $sub);
if(isset($exploded_sub[1])) {
if($exploded_sub[1] == 'form') $formatted_sub = 'form';
if($exploded_sub[1] == 'last') $formatted_sub = 'last';
}
}
switch($formatted_sub) {
case 'reach':
print $this->get_display_list();
break;
case 'delete':
$entity_locking = new entity_locking($this->id, $this->get_aut_const());
if($entity_locking->is_locked()){
print $entity_locking->get_locked_form();
break;
}
$this->proceed_delete();
break;
case 'replace':
$entity_locking = new entity_locking($this->id, $this->get_aut_const());
if($entity_locking->is_locked()){
print $entity_locking->get_locked_form();
break;
}
$this->proceed_replace();
break;
case 'duplicate' :
$this->proceed_duplicate();
break;
case 'update':
$entity_locking = new entity_locking($this->id, $this->get_aut_const());
if ($this->id && $entity_locking->is_locked()) {
if($PMBuserid == $entity_locking->get_locked_user_id()){
$updated_id = $this->proceed_update();
$entity_locking->unlock_entity();
}else{
print $entity_locking->get_save_error_message();
break;
}
} else{
$updated_id = $this->proceed_update();
}
if($updated_id) {
if ($save_and_continue) {
$this->id = 0;
$this->proceed_form();
} else {
print $this->get_display_view($updated_id);
}
}
break;
case 'form':
if($this->id){
$entity_locking = new entity_locking($this->id, $this->get_aut_const());
if($entity_locking->is_locked()){
print $entity_locking->get_locked_form();
break;
}
}
$this->proceed_form();
break;
case 'last':
$this->proceed_last();
break;
case 'unlock':
$entity_locking = new entity_locking($this->id, $this->get_aut_const());
$entity_locking->unlock_entity();
break;
default:
$this->proceed_default();
break;
}
}
public function proceed_delete() {
global $msg;
$object_instance = $this->get_object_instance();
$sup_result = $object_instance->delete();
if(!$sup_result) {
print $this->get_display_list();
}else {
error_message($msg[132], $sup_result, 1, $this->get_edit_link());
}
}
public function proceed_replace() {
global $msg;
global $by, $aut_link_save;
$object_instance = $this->get_object_instance();
if(!$by) {
$object_instance->replace_form();
}else {
// routine de remplacement
$rep_result = $object_instance->replace($by,$aut_link_save);
if(!$rep_result) {
print $this->get_display_list();
}else {
error_message($msg[132], $rep_result, 1, $this->get_edit_link());
}
}
}
public function proceed_duplicate() {
$object_instance = $this->get_object_instance();
$id = 0;
$object_instance->show_form(true);
}
public function proceed_update() {
}
public function proceed_form() {
global $cataloging_scheme_id, $id;
$unlock_unload_script = "";
if($this->id){
$entity_locking = new entity_locking($id, $this->get_type_const());
$entity_locking->lock_entity();
$unlock_unload_script = $entity_locking->get_polling_script();
}
$object_instance = $this->get_object_instance();
ob_start();
$object_instance->show_form();
$entity_form = ob_get_contents();
ob_end_clean();
$entity_form = str_replace('