Admin()==0) { die(); } set_language(); // From admin, grant the access to a folder to an // user if ($op=='folder_add') // operation { $cn=new Database(); $user_id=HtmlInput::default_value_get("p_user", 0); // get variable $dossier_id=HtmlInput::default_value_get("p_dossier", 0); // get variable if ($user_id==0||$dossier_id==0||isNumber($user_id)==0||$dossier_id==0) { $content=_('Erreur paramètre'); $status="NOK"; } else { $user=new User($cn, $user_id); $user->set_folder_access($dossier_id, true); $dossier=new Dossier($dossier_id); $dossier->load(); $content="".h($dossier->dos_name)."".h($dossier->dos_description)."". "". HtmlInput::anchor(_('Enleve'), "", " onclick=\"folder_remove({$user_id},{$dossier_id});\""). ""; $status='OK'; } //---------------------------------------------------------------- // Answer in XML header('Content-type: text/xml; charset=UTF-8'); $dom=new DOMDocument('1.0', 'UTF-8'); $xml_content=$dom->createElement('content', $content); $xml_status=$dom->createElement('status', $status); $root=$dom->createElement("root"); $root->appendChild($xml_content); $root->appendChild($xml_status); $dom->appendChild($root); echo $dom->saveXML(); exit(); } // From admin, revoke the access to a folder from an // user if ($op=='folder_remove') // operation { $cn=new Database(); $user_id=HtmlInput::default_value_get("p_user", 0); // get variable $dossier_id=HtmlInput::default_value_get("p_dossier", 0); // get variable if ($user_id==0||$dossier_id==0||isNumber($user_id)==0||$dossier_id==0) { $content=_('Erreur paramètre'); $status="NOK"; } else { $user=new User($cn, $user_id); $user->set_folder_access($dossier_id, false); $content=""; $status='OK'; } //---------------------------------------------------------------- // Answer in XML header('Content-type: text/xml; charset=UTF-8'); $dom=new DOMDocument('1.0', 'UTF-8'); $xml_content=$dom->createElement('content', $content); $xml_status=$dom->createElement('status', $status); $root=$dom->createElement("root"); $root->appendChild($xml_content); $root->appendChild($xml_status); $dom->appendChild($root); echo $dom->saveXML(); exit(); } /** * Display the forbidden folders if the request comes from a form * with an input text (id:database_filter_input) then this text is * used as a filter * */ if ($op=='folder_display') // operation { $cn=new Database(); $user_id=HtmlInput::default_value_get("p_user", 0); // get variable $p_filter=HtmlInput::default_value_get('p_filter', ''); if ($user_id==0||isNumber($user_id)==0) { $content=_('Erreur paramètre'); $status="NOK"; } else { ob_start(); $user=new User($cn, $user_id); $a_dossier=Dossier::show_dossier('X', $user->id, $p_filter, MAX_FOLDER_TO_SHOW); echo HtmlInput::title_box(_("Liste dossier"), 'folder_list_div'); ?>

=MAX_FOLDER_TO_SHOW)?MAX_FOLDER_TO_SHOW:$nb_dossier; echo _('Dossiers trouvés').':'.$nb_dossier." "._('Dossiers affichés').$max; ?>

createElement('content', $xml); $xml_status=$dom->createElement('status', $status); $root=$dom->createElement("root"); $root->appendChild($xml_content); $root->appendChild($xml_status); $dom->appendChild($root); echo $dom->saveXML(); exit(); } // For the operation 'modele_drop','modele_modify','folder_modify','folder_drop' // the p_dossier parameter is mandatory if (in_array($op, array('modele_drop', 'modele_modify', 'folder_modify', 'folder_drop'))) { $dossier=HtmlInput::default_value_get('p_dossier', 0); $content=_('Erreur paramètre'); $status="NOK"; // check if we receive a valid parameter if ($dossier==0||isNumber($dossier)==0) { //---------------------------------------------------------------- // Answer in XML header('Content-type: text/xml; charset=UTF-8'); $dom=new DOMDocument('1.0', 'UTF-8'); $xml=escape_xml($content); $xml_content=$dom->createElement('content', $xml); $xml_status=$dom->createElement('status', $status); $root=$dom->createElement("root"); $root->appendChild($xml_content); $root->appendChild($xml_status); $dom->appendChild($root); echo $dom->saveXML(); exit(); } // Modify the description or the name of folder if ($op=='folder_modify') { $dos=new Dossier($dossier); ob_start(); $dos->load(); echo HtmlInput::title_box(_('Modification'), 'folder_admin_div'); $wText=new IText(); echo '
'; echo HtmlInput::hidden('action', 'dossier_mgt'); echo HtmlInput::hidden('d', $dos->get_parameter("id")); echo _('Nom').' : '; echo $wText->input('name', $dos->get_parameter('name')); echo '
'; $wDesc=new ITextArea(); $wDesc->heigh=5; echo _('Description').' :
'; echo $wDesc->input('desc', $dos->get_parameter('desc')); echo '
'; echo HtmlInput::submit('upd', _('Modifie')); echo '
'; $content=ob_get_clean(); $status='OK'; } else if ($op=='folder_drop') { // ask to confirm the removal a folder $dos=new Dossier($dossier); ob_start(); echo HtmlInput::title_box(_('Efface'), 'folder_admin_div'); $dos->load(); echo '
'; echo HtmlInput::hidden('action', 'dossier_mgt'); echo HtmlInput::hidden('d', $dossier); echo HtmlInput::hidden('sa', 'remove'); echo '

'._('Etes vous sûr et certain de vouloir effacer ').$dos->dos_name.' ???

'; $confirm=new ICheckBox(); $confirm->name="p_confirm"; echo '

'; echo _('Cochez la case si vous êtes sûr de vouloir effacer ce dossier'); echo $confirm->input(); echo '

'; echo '

'; echo HtmlInput::submit('remove', _('Effacer')); echo '

'; echo '
'; $content=ob_get_clean(); $status='OK'; } else if ($op=='modele_drop') { // ask to confirm the removal a folder $cn=new Database(); $name=$cn->get_value('select mod_name from modeledef where mod_id=$1', array($dossier)); ob_start(); echo HtmlInput::title_box(_('Efface'), 'folder_admin_div'); echo '
'; echo HtmlInput::hidden('m', $dossier); echo HtmlInput::hidden('sa', 'remove'); echo HtmlInput::hidden('action', 'modele_mgt'); echo '

'._('Etes vous sure et certain de vouloir effacer ').$name.' ?

'; $confirm=new ICheckBox(); $confirm->name="p_confirm"; echo '

'; echo _('Cochez la case si vous êtes sûr de vouloir effacer ce modèle'); echo $confirm->input(); echo '

'; echo '

'; echo HtmlInput::submit('remove', 'Effacer'); echo '

'; echo '
'; $content=ob_get_clean(); $status='OK'; } else if ($op=='modele_modify') { // Modify the description or the name of a template $cn=new Database(); ob_start(); echo HtmlInput::title_box(_('Modification'), 'folder_admin_div'); echo '
'; $name=$cn->get_value( "select mod_name from modeledef where ". " mod_id=$1", array($dossier)); $desc=$cn->get_value( "select mod_desc from modeledef where ". " mod_id=$1", array($dossier)); $wText=new IText(); echo 'Nom : '.$wText->input('name', $name); $wDesc=new ITextArea(); $wDesc->heigh=5; echo '
Description :
'; echo $wDesc->input('desc', $desc); echo HtmlInput::hidden('m', $dossier); echo HtmlInput::hidden('action', 'modele_mgt'); echo '
'; echo HtmlInput::submit('upd', 'Modifie'); echo '
'; $content=ob_get_clean(); $status='OK'; } //---------------------------------------------------------------- // Answer in XML header('Content-type: text/xml; charset=UTF-8'); $dom=new DOMDocument('1.0', 'UTF-8'); $xml=escape_xml($content); $xml_content=$dom->createElement('content', $xml); $xml_status=$dom->createElement('status', $status); $root=$dom->createElement("root"); $root->appendChild($xml_content); $root->appendChild($xml_status); $dom->appendChild($root); echo $dom->saveXML(); exit(); } ?>