示例#1
0
<?php

/**
 * Modification de liste de choix
 *
 * @category CompteRendu
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
// Liste sélectionnée
$liste_id = CValue::getOrSession("liste_id");
$liste = new CListeChoix();
$liste->load($liste_id);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("liste", $liste);
$smarty->display("inc_list_choix.tpl");
示例#2
0
             }
             if ($footer_id != $cr->footer_id) {
                 $_POST["_source"] = CCompteRendu::replaceComponent($_POST["_source"], $footer_id, "footer");
             }
         }
     }
 }
 // Application des listes de choix
 $fields = array();
 $values = array();
 if (isset($_POST["_CListeChoix"])) {
     $listes = $_POST["_CListeChoix"];
     foreach ($listes as $list_id => $options) {
         $options = array_map(array('CMbString', 'htmlEntities'), $options);
         $list = new CListeChoix();
         $list->load($list_id);
         $is_empty = false;
         if ($check_to_empty_field && isset($_POST["_empty_list"][$list_id]) || !$check_to_empty_field && !isset($_POST["_empty_list"][$list_id])) {
             $values[] = "";
             $is_empty = true;
         } else {
             if ($options === array(0 => "undef")) {
                 continue;
             }
             CMbArray::removeValue("undef", $options);
             $values[] = nl2br(implode(", ", $options));
         }
         $nom = CMbString::htmlEntities($list->nom, ENT_QUOTES);
         if ($is_empty) {
             $fields[] = "<span class=\"name\">[Liste - " . $nom . "]</span>";
         } else {
 * Export CSV des listes de choix
 *
 * @category CompteRendu
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$list = CValue::get('ids', array());
$owner_guid = CValue::get('owner_guid');
if (!is_array($list)) {
    $list = explode("-", $list);
}
$owner_view = "";
if ($owner_guid) {
    $owner = CMbObject::loadFromGuid($owner_guid);
    $owner_view = " - {$owner->_view}";
}
$out = fopen('php://output', 'w');
header("Content-Type: application/csv");
header("Content-Disposition: attachment; filename=\"Listes de choix{$owner_view}.csv\"");
$liste_choix = new CListeChoix();
fputcsv($out, array_keys($liste_choix->getCSVFields()));
foreach ($list as $id) {
    if (!$liste_choix->load($id)) {
        continue;
    }
    fputcsv($out, $liste_choix->getCSVFields());
}