示例#1
0
 /**
  * Return the SFMU Motif
  *
  * @return CMotifSFMU
  */
 function loadRefMotifSFMU()
 {
     $motif_sfmu = new CMotifSFMU();
     $motif_sfmu->load($this->motif_sfmu);
     return $this->_ref_motif_sfmu = $motif_sfmu;
 }
<?php

/**
 * $Id$
 *  
 * @category dPurgences
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$request = new CRequest();
$request->addSelect("categorie");
$request->addTable("motif_sfmu");
$request->addGroup("categorie");
$query = $request->makeSelect();
$motif_sfmu = new CMotifSFMU();
$ds = $motif_sfmu->getDS();
$categories = $ds->loadList($query);
$smarty = new CSmartyDP();
$smarty->assign("categories", $categories);
$smarty->display("inc_search_motif_sfmu.tpl");
<?php

/**
 * $Id$
 *  
 * @category dPurgences
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$categorie = CValue::get("categorie");
$list_motif_sfmu = array();
if ($categorie) {
    $motif_sfmu = new CMotifSFMU();
    $list_motif_sfmu = $motif_sfmu->loadList(array("categorie" => "='{$categorie}'"), null, null, "motif_sfmu_id");
}
$smarty = new CSmartyDP();
$smarty->assign("list_motif_sfmu", $list_motif_sfmu);
$smarty->display("inc_display_motif_sfmu_category.tpl");
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$motif_path = "modules/dPurgences/resources/motif_sfmu.csv";
$motif_sfmu = new CMotifSFMU();
$ds = $motif_sfmu->getDS();
$ds->exec("TRUNCATE TABLE motif_sfmu");
CAppUI::stepAjax("motifs supprimés", UI_MSG_OK);
$handle = fopen($motif_path, "r");
$motif_csv = new CCSVFile($handle);
$motif_csv->jumpLine(1);
$count = 0;
$categorie = null;
while ($line = $motif_csv->readLine()) {
    list($libelle, $code) = $line;
    if (!$code) {
        $categorie = ucfirst(strtolower($libelle));
        continue;
    }
    $motif_sfmu = new CMotifSFMU();
    $motif_sfmu->code = $code;
    $motif_sfmu->libelle = $libelle;
    $motif_sfmu->categorie = $categorie;
    if ($msg = $motif_sfmu->store()) {
        CAppUI::stepAjax($msg, UI_MSG_ERROR);
        $count--;
    }
    $count++;
}
CAppUI::stepAjax("{$count} motifs ajoutés", UI_MSG_OK);