\n"; $elements=array(); if($qt->quota_type['ELEMENTS_LABEL']){ $typ_quota_form=str_replace("!!quotas_elements_list!!",sprintf($msg['quotas_elements_list_label'],$qt->quota_type['ELEMENTS_LABEL']),$typ_quota_form); $typ_quota_form=str_replace("!!quotas_elements_conflicts!!",sprintf($msg['quotas_elements_conflicts_label'],$qt->quota_type['ELEMENTS_LABEL']),$typ_quota_form); }else{ $typ_quota_form=str_replace("!!quotas_elements_list!!",$msg['quotas_elements_list'],$typ_quota_form); $typ_quota_form=str_replace("!!quotas_elements_conflicts!!",$msg['quotas_elements_conflicts'],$typ_quota_form); } $typ_quota_form=str_replace("!!quotas_elements_list!!",$label,$typ_quota_form); for($i=0;$iquota_type["QUOTAS"]);$i++) { $elts=explode(",",$qt->quota_type["QUOTAS"][$i]); $index=array(); for ($j=0; $jdescriptor]['_elements_'][$qt->get_element_by_name($elts[$j])]["COMMENT"]; } if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onmousedown=\"document.location='./admin.php?categ=$categ&sub=$sub&elements=".$qt->get_elements_id_by_names($qt->quota_type["QUOTAS"][$i]).$query_compl."';\" "; $list_elements.="".implode(" ".$msg["quotas_and"]." ",$index)."\n"; $elements[]=implode(" ".$msg["quotas_and"]." ",$index); } $list_elements.="\n"; $typ_quota_form=str_replace("!!list_elements!!",$list_elements,$typ_quota_form); //Vérification du formulaire if ($first) { $min_value=abs($min_value); $max_value=abs($max_value); if(!$qt->quota_type['SPECIALCLASS']){ $default_value=abs($default_value); } if (($qt->quota_type["MAX"])&&($qt->quota_type["MIN"])) { if ($min_value>$max_value) { error_message_history($msg["quotas_error"], $msg["quotas_error_max_lt_min"], 1); exit(); } } if (($qt->quota_type["MAX"])&&($default_value>$max_value)&&(($max_value*1)!=0)) { error_message_history($msg["quotas_error"], $msg["quotas_error_default_gt_max"], 1); exit(); } if (($qt->quota_type["MIN"])&&($default_value<$min_value)&&(($min_value*1)!=0)) { error_message_history($msg["quotas_error"], $msg["quotas_error_default_lt_min"], 1); exit(); } $already=array(); for ($i=0; $itable." where quota_type=".$qt->quota_type["ID"]." "; // and constraint_type in ('MIN','MAX','DEFAULT','CONFLICT','PRIORITY','FORCE_LEND','MAX_QUOTA')"; pmb_mysql_query($requete); } //Enregistrement des éléments dans la base $recorded=""; if ($first==1) { //Nettoyage $requete="delete from ".$qt->table." where quota_type=".$qt->quota_type["ID"]." and constraint_type in ('MIN','MAX','DEFAULT','CONFLICT','PRIORITY','FORCE_LEND','MAX_QUOTA')"; pmb_mysql_query($requete); //Max $requete="insert into ".$qt->table." (quota_type,constraint_type,elements,value) values(".$qt->quota_type["ID"].",'MAX',0,'".$max_value."')"; pmb_mysql_query($requete); //Min $requete="insert into ".$qt->table." (quota_type,constraint_type,elements,value) values(".$qt->quota_type["ID"].",'MIN',0,'".$min_value."')"; pmb_mysql_query($requete); //Default if($qt->quota_type['SPECIALCLASS']){ global $class_path; require_once($class_path."/".$qt->quota_type['SPECIALCLASS'].".class.php"); $default_value = call_user_func(array($qt->quota_type['SPECIALCLASS'],'get_storable_value'),$default_value); } $requete="insert into ".$qt->table." (quota_type,constraint_type,elements,value) values(".$qt->quota_type["ID"].",'DEFAULT',0,'".$default_value."')"; pmb_mysql_query($requete); //Conflict value $requete="insert into ".$qt->table." (quota_type,constraint_type,elements,value) values(".$qt->quota_type["ID"].",'CONFLICT',0,'".$conflict_value."')"; pmb_mysql_query($requete); //Forçage du prêt $requete="insert into ".$qt->table." (quota_type,constraint_type,elements,value) values(".$qt->quota_type["ID"].",'FORCE_LEND',0,'".$force_lend."')"; pmb_mysql_query($requete); //Max_quota $requete="insert into ".$qt->table." (quota_type,constraint_type,elements,value) values(".$qt->quota_type["ID"].",'MAX_QUOTA',0,'".$max_quota."')"; pmb_mysql_query($requete); //Priorités for ($i=0; $itable." (quota_type,constraint_type,elements,value) values(".$qt->quota_type["ID"].",'PRIORITY',$id,'".$i."')"; pmb_mysql_query($requete); } $recorded="".$msg["quotas_recorded"].""; } $typ_quota_form=str_replace("!!recorded!!",$recorded,$typ_quota_form); //Récupération des paramètres dans la base ou les valeurs par défaut $qt->get_values(); //Paramètres généraux if ($qt->quota_type["MAX"]) { $max_value_="
"; if ($qt->quota_type["MAX_QUOTA"]) { if ($max_quota) $checked="checked"; else $checked=""; $max_value_.="  ".htmlentities(sprintf($msg["quotas_max_quota"],$qt->get_title_by_elements_id($qt->get_elements_id_by_names($qt->quota_type["ENTITY"]))),ENT_QUOTES,$charset).""; } $max_value_.="
"; } else { $max_value_=""; } if ($qt->quota_type["MIN"]) { $min_value_="
"; $min_value_.="
"; } else { $min_value_=""; } //label valeur par défaut if($qt->quota_type["DEFAULT_VALUE_LABEL"]){ $label = $qt->quota_type["DEFAULT_VALUE_LABEL"]; //TODO }else{ $label = sprintf($msg["quotas_elements_default"],htmlentities($qt->quota_type["SHORT_COMMENT"],ENT_QUOTES,$charset)); } //valeur par défaut if($qt->quota_type["SPECIALCLASS"]){ require_once($class_path."/".$qt->quota_type['SPECIALCLASS'].".class.php"); $default_value_form= call_user_func(array($qt->quota_type['SPECIALCLASS'],'get_quota_form'),"default_value",stripslashes($default_value)); }else{ $default_value_form = ""; } $typ_quota_form=str_replace("!!max_value!!",$max_value_,$typ_quota_form); $typ_quota_form=str_replace("!!min_value!!",$min_value_,$typ_quota_form); $typ_quota_form=str_replace("!!default_value!!",$default_value_form,$typ_quota_form); $typ_quota_form=str_replace("!!short_type_comment!!",$label,$typ_quota_form); //gestion des conflits if($qt->quota_type['CONFLIT_MAX']){ $conflit_max = "
".$msg['quotas_plus_grand']."
"; }else{ $conflit_max = ""; } $typ_quota_form=str_replace("!!conflit_max!!",$conflit_max,$typ_quota_form); if($qt->quota_type['CONFLIT_MIN']){ $conflit_min = "
".$msg['quotas_plus_petit']."
"; }else{ $conflit_min = ""; } $typ_quota_form=str_replace("!!conflit_min!!",$conflit_min,$typ_quota_form); for ($i=1; $i<=4; $i++) { if ($conflict_value==$i) $checked="checked"; else $checked=""; $typ_quota_form=str_replace("!!checked_$i!!",$checked,$typ_quota_form); } //liste des éléments en cas de confilt $conflict_list_elements=""; for ($i=0; $i\n"; for ($j=0; $jget_elements_id_by_names($qt->quota_type["QUOTAS"][$j]); if ($id==$conflict_list[$i]) $checked="selected"; else $checked=""; $conflict_list_elements.="\n"; } $conflict_list_elements.="
"; } $typ_quota_form=str_replace("!!conflict_list_elements!!",$conflict_list_elements,$typ_quota_form); if ($qt->quota_type["FORCELEND"]) { $typ_quota_form=str_replace("!!force_lend!!","
".sprintf($msg["quotas_force_lend"],$qt->quota_type["COMMENTFORCELEND"])." 
",$typ_quota_form); if ($force_lend) $checked_force_lend="checked"; else $checked_force_lend=""; $typ_quota_form=str_replace("!!checked_force_lend!!",$checked_force_lend,$typ_quota_form); } else $typ_quota_form=str_replace("!!force_lend!!","",$typ_quota_form); if ($conflict_value==4) $typ_quota_form.="\n"; print $typ_quota_form; ?>