opac_views_list);$i++) {
if ($i % 2) $pair_impair = "even"; else $pair_impair = "odd";
$td_javascript=" onmousedown=\"document.location='./admin.php?categ=opac&sub=opac_view§ion=list&action=form&opac_view_id=!!opac_view_id!!'\" ";
$tr_surbrillance = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" ";
$line = str_replace('!!td_javascript!!',$td_javascript , $tpl_opac_view_list_tableau_ligne);
$line = str_replace('!!tr_surbrillance!!',$tr_surbrillance , $line);
$line = str_replace('!!pair_impair!!',$pair_impair , $line);
$line =str_replace('!!opac_view_id!!', $this->opac_views_list[$i]->id, $line);
$line = str_replace('!!name!!', $this->opac_views_list[$i]->name, $line);
$line = str_replace('!!comment!!', $this->opac_views_list[$i]->comment, $line);
$liste.=$line;
}
return str_replace('!!lignes_tableau!!',$liste , $tpl_opac_view_list_tableau);
}
function do_sel_list() {
global $tpl_opac_view_list_sel_tableau,$tpl_opac_view_list_sel_tableau_ligne;
global $pmb_opac_view_class;
global $base_path,$include_path,$lang,$msg;
global $charset;
// on reprend...
global $pmb_opac_view_activate;
$j=0;
$list = $disabled = "";
//on a une classe spécifique pour la gestion des vues...
//on ne peut pas proposer le forcage, mais on peut peut etre afficher les valeurs
if($pmb_opac_view_class){
$tpl = "
".htmlentities($msg['opac_view_class_exists'],ENT_QUOTES,$charset)."
";
}else{
if($pmb_opac_view_activate==2){
//définition en administration, on va chercher les valeurs...
$qt = new quota("OPAC_VIEW",$include_path."/quotas/own/".$lang."/opac_views.xml");
//Tableau de passage des paramètres
if($this->id_empr){
$struct["READER"] = ($this->id_empr ? $this->id_empr : 0) ;
$values = $qt->get_quota_value_with_id($struct);
}else{
$values = $qt->apply_conflict(array(""));
}
if($values['VALUE']){
$allowed = unserialize($values['VALUE']);
}
//on a peut etre déjà forcer
if(count($this->view_list_empr)==0){
$disabled = "disabled='disabled'";
}
}
//OPAC Classique
$line = str_replace('!!class!!',"even", $tpl_opac_view_list_sel_tableau_ligne);
$line = str_replace('!!name!!', $msg['opac_view_classic_opac'], $line);
$line = str_replace('!!comment!!', $msg['opac_view_classic_opac_comment'], $line);
$line = str_replace('!!opac_view_id!!', 0, $line);
$tr_surbrillance = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='even'\" ";
$line = str_replace('!!tr_surbrillance!!',$tr_surbrillance , $line);
if($disabled == ""){
if(in_array (0,$this->view_list_empr) || !count($this->view_list_empr)){
$checked = "checked='checked'";
}else $checked = "";
$line = str_replace("!!checked!!",$checked,$line);
if($this->view_list_empr_default == 0){
$checked_default = "checked='checked'";
}else{
$checked_default = "";
}
$line = str_replace("!!radio_checked!!",$checked_default,$line);
$line = str_replace("!!disabled!!",$disabled,$line);
}else{
if(in_array (0,$allowed['allowed'])){
$checked = "checked='checked'";
}else $checked = "";
$line = str_replace("!!checked!!",$checked,$line);
if($allowed['default'] == 0){
$checked_default = "checked='checked'";
}else{
$checked_default = "";
}
$line = str_replace("!!radio_checked!!",$checked_default,$line);
}
$line = str_replace("!!disabled!!",$disabled,$line);
$liste.=$line;
//Pour les vues
for($i=0;$iopac_views_list);$i++) {
if($this->opac_views_list[$i]->visible==0) continue;
if($this->opac_views_list[$i]->visible>0) {
$j++;
}
$line = str_replace('!!class!!',($j%2 ? "odd" : "even"), $tpl_opac_view_list_sel_tableau_ligne);
$line = str_replace('!!name!!', $this->opac_views_list[$i]->name, $line);
$line = str_replace('!!comment!!', $this->opac_views_list[$i]->comment, $line);
$line = str_replace('!!opac_view_id!!', $this->opac_views_list[$i]->id, $line);
$tr_surbrillance = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".($j%2 ? "odd" : "even")."'\" ";
$line = str_replace('!!tr_surbrillance!!',$tr_surbrillance , $line);
//gestion simple ou forçage pour l'utilisateur...
if($disabled == ""){
if(in_array ($this->opac_views_list[$i]->id,$this->view_list_empr)){
$checked = "checked='checked'";
}else $checked = "";
$line = str_replace("!!checked!!",$checked,$line);
if($this->view_list_empr_default == $this->opac_views_list[$i]->id){
$checked_default = "checked='checked'";
}else{
$checked_default = "";
}
$line = str_replace("!!radio_checked!!",$checked_default,$line);
}else{
if(in_array ($this->opac_views_list[$i]->id,$allowed['allowed'])){
$checked = "checked='checked'";
}else $checked = "";
$line = str_replace("!!checked!!",$checked,$line);
if($allowed['default'] == $this->opac_views_list[$i]->id){
$checked_default = "checked='checked'";
}else{
$checked_default = "";
}
$line = str_replace("!!radio_checked!!",$checked_default,$line);
}
$line = str_replace("!!disabled!!",$disabled,$line);
$liste.=$line;
}
$tpl = str_replace('!!lignes_tableau!!',$liste , $tpl_opac_view_list_sel_tableau);
if($pmb_opac_view_activate == 2 && !$pmb_opac_view_class){
$forcage = "
".$msg['40']."
".$msg['39']."
";
}else{
$forcage = "";
}
$tpl = str_replace("!!forcage!!",$forcage,$tpl);
}
return $tpl;
}
function update_sel_list() {
global $dbh;
global $form_empr_opac_view; // issu du formulaire
global $form_empr_opac_view_default; // issu du formulaire
if($this->id_empr) mysql_query("DELETE from opac_views_empr WHERE emprview_empr_num=".$this->id_empr, $dbh);
if(is_array($form_empr_opac_view) && $this->id_empr){
foreach($form_empr_opac_view as $view_num){
$found=0;
for($i=0;$iopac_views_list);$i++) {
if( $this->opac_views_list[$i]->id == $view_num){$found=1;break;}
}
if($found || $view_num == 0){
if($view_num==$form_empr_opac_view_default)$default=1; else $default=0;
$req="INSERT INTO opac_views_empr SET emprview_view_num=$view_num, emprview_empr_num=".$this->id_empr.", emprview_default=$default ";
mysql_query($req, $dbh);
}
}
}
}
function delete() {
global $dbh;
if($this->id) {
// relation vues / empr
mysql_query("DELETE from opac_views_empr WHERE emprview_view_num=".$this->id, $dbh);
// table de la liste des notices de la vue
$req="DROP TABLE opac_view_notices_".$this->id;
mysql_query($req);
// la vue
mysql_query("DELETE from opac_views WHERE opac_view_id='".$this->id."' ", $dbh);
$this->id=0;
}
$this->fetch_data();
}
function make_hidden_search_form() {
global $search;
global $charset;
global $page;
$url = "./catalog.php?categ=search&mode=6" ;
// remplir $search
$this->search_class->unserialize_search($this->requete);
$r="";
return $r;
}
} // fin définition classe