msg);
}
function process($source_id, $pmb_user_id) {
global $opac_url_base,$opac_biblio_name,$charset;
$plop = $opac_biblio_name;
$source = new mobile_source($this, $source_id, $this->msg);
$param = $source->config;
$param['opacUrl'] = $opac_url_base;
$param['connectorDriver'] = "pmb";
$param['biblioName'] = ($charset!= "UTF-8" ? utf8_encode($opac_biblio_name) : $opac_biblio_name);
echo json_encode($param);
return;
}
}
class mobile_source extends connecteur_out_source {
var $onglets = array();
function mobile_source($connector, $id, $msg) {
global $include_path;
parent::connecteur_out_source($connector, $id, $msg);
//Onglets dispo dans l'appli
$xml = new XMLtabs($include_path."/mobile/tabs.xml");
$xml->analyser();
$this->onglets = $xml->table;
}
function get_config_form() {
global $charset, $dbh, $pmb_url_base;
$result = parent::get_config_form();
//on attributs/initialise certaines valeurs par défaut
if(!$this->config['activeTabs'])
$this->config['activeTabs'] = array();
if(!$this->config['shelf_nbResultsByPage'])
$this->config['shelf_nbResultsByPage'] = 20;
if(!$this->config['search_nbResultsByPage'])
$this->config['search_nbResultsByPage'] = 20;
if(!$this->config['bulletinsList_nbResultsByPage'])
$this->config['bulletinsList_nbResultsByPage'] = 10;
if(!$this->config['analysisList_nbResultsByPage'])
$this->config['analysisList_nbResultsByPage'] = 10;
//Adresse d'utilisation
$result .= "
";
//Connecteur dédié
$connecteurs = new connecteurs_out();
foreach($connecteurs->connectors as $conn) {
if( $conn->name == 'JSON-RPC') $sources = $conn->sources;
}
//on génère l'affichage du sélecteur
$proxyIsInList = false;
if(sizeof($sources) == 0) {
$selectWS = $this->msg['mobile_admin_error_proxy'];
} else {
$selectWS="";
foreach ($sources as $source){
if ($this->config['proxyUrl'] == $pmb_url_base."ws/connector_out.php?source_id=".$source->id){
$proxyIsInList = true;
}
$selectWS.= "config['proxyUrl']== $pmb_url_base."ws/connector_out.php?source_id=".$source->id ? " selected":"").">".$source->name." ";
}
$selectWS.=" ";
}
//maintenant l'entrée manuelle...
$writeWS = " ";
$result .= "
";
//Onglets dispo dans l'appli
$result.="
".$this->msg['mobile_admin_tabs_title']."
";
//param pour l'onglet 'Accueil'
$form_infoPage="
".$this->msg['mobile_admin_firstInfoPage']." ";
$requete = "select id_infopage as id, title_infopage as title from infopages where valid_infopage = 1 order by title DESC";
$res = mysql_query($requete);
if(mysql_num_rows($res)){
$form_infoPage.= "
";
while ($infopage = mysql_fetch_object($res)){
$form_infoPage.="
config["firstInfoPage"]== $infopage->id ? " selected":"").">".$infopage->title." ";
}
$form_infoPage.="
";
}else{
$form_infoPage.=$this->msg['mobile_admin_error_infopage'];
}
$form_infoPage.= "
";
$result.= gen_plus("form_infoPage",$this->msg['mobile_admin_form_infoPagesTitle'],$form_infoPage).
"
";
//param pour l'onglet 'Etagère coup de coeur'
$form_shelf.="
".$this->msg['mobile_admin_heatShelf']." ";
$etageres = etagere::get_etagere_list();
$etagere_valid = false;
$select = "
";
foreach($etageres as $etagere){
if ($etagere['validite'] == 1 && $etagere['visible_accueil']==1){
$select .="
config['heartShelf']== $etagere['idetagere'] ? " selected":"").">".$etagere['name']." ";
$etagere_valid = true;
}
}
$select.="
";
if($etagere_valid == true){
$form_shelf .= $select;
}else{
$form_shelf.=$this->msg['mobile_admin_error_etageres'];
}
$form_shelf .= "
".$this->msg['mobile_admin_nbResultsByPage']."
";
$result .= gen_plus("form_shelf",$this->msg['mobile_admin_form_shelfTitle'],$form_shelf).
"
";
//param pour l'onglet 'Recherche Simple'
$form_search = "
".$this->msg['mobile_admin_nbResultsByPage']."
".$this->msg["mobile_admin_form_search_allowSearchByTypeDoc"]."
".$this->msg['mobile_admin_form_search_allowSearchByTypeDoc_yes']." config["allowTypDocFilter"] == 1 ? " checked " : " ")." />
".$this->msg['mobile_admin_form_search_allowSearchByTypeDoc_no']." config["allowTypDocFilter"] == 0 ? " checked " : " ")."/>
";
$result .= gen_plus("form_search",$this->msg['mobile_admin_form_searchTitle'],$form_search).
"
";
//param pour Mon Compte
$form_myAccount = "
";
$result .= gen_plus("form_myAccount",$this->msg['mobile_admin_form_myAccountTitle'],$form_myAccount).
"
";
//param pour Pret Autonome
$form_selfCheck = "
".$this->msg["mobile_admin_form_selfCheck_allowCheckIn"]."
".$this->msg['mobile_admin_form_selfCheck_allowCheckIn_yes']." config["allowCheckIn"] == 1 ? " checked " : " ")." />
".$this->msg['mobile_admin_form_selfCheck_allowCheckIn_no']." config["allowCheckIn"] == 0 ? " checked " : " ")."/>
";
$result .= gen_plus("form_selfCheck",$this->msg['mobile_admin_form_selfCheckTitle'],$form_selfCheck).
"
";
//param d'affichage général
$param_gen = "
".$this->msg['mobile_admin_form_bulletinsList_nbResultsByPage']."
".$this->msg['mobile_admin_form_analysisList_nbResultsByPage']."
";
$result .= gen_plus("paramGen",$this->msg['mobile_admin_form_paramsGen'],$param_gen).
"
";
$result.="
";
return $result;
}
function update_config_from_form() {
global $dbh;
global $proxyUrl,$appTitle,$firstTab,$firstInfoPage,$heartShelf,$search_nbResultsByPage,$shelf_nbResultsByPage;
global $allowTypDocFilter,$allowCheckIn;
global $bulletinsList_nbResultsByPage,$analysisList_nbResultsByPage;
global $onglets;
parent::update_config_from_form();
//les trucs faciles
$this->config['proxyUrl'] = $proxyUrl;
$this->config['firstInfoPage'] = (isset($firstInfoPage) ? $firstInfoPage :'');
$this->config['heartShelf'] = (isset($heartShelf) ? $heartShelf :'');
$this->config['search_nbResultsByPage'] = $search_nbResultsByPage;
$this->config['shelf_nbResultsByPage'] = $shelf_nbResultsByPage;
if($allowTypDocFilter == 1){
$this->config['allowTypDocFilter'] = true;
}else $this->config['allowTypDocFilter'] = false;
if($allowCheckIn == 1){
$this->config['allowCheckIn'] = true;
}else $this->config['allowCheckIn'] = false;
//le tableau des onglets activés ou non
$this->config['activeTabs']=array();
foreach($this->onglets as $ongletName => $value){
global $$ongletName;
if(isset($$ongletName)){
$this->config['activeTabs'][$ongletName]=$$ongletName;
}else{
$this->config['activeTabs'][$ongletName]=0;
}
}
if(isset($firstTab) && $this->config['activeTabs'][$firstTab])
$this->config['firstTab'] = $firstTab;
else{
foreach($this->onglets as $ongletName => $value){
if($this->config['activeTabs'][$ongletName] == 1)
$this->config['firstTab'] = $ongletName;
break;
}
}
$this->config['bulletinsList_nbResultsByPage'] = $bulletinsList_nbResultsByPage;
$this->config['analysisList_nbResultsByPage'] = $analysisList_nbResultsByPage;
return;
}
}
?>