Exemplo n.º 1
0
/**
 * $Id: inc_personnel.php 20938 2013-11-13 11:02:47Z aurelie17 $
 *
 * @package    Mediboard
 * @subpackage bloodSalvage
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 20938 $
 */
function loadAffected(&$blood_salvage_id, &$list_nurse_sspi, &$tabAffected, &$timingAffect)
{
    $affectation = new CAffectationPersonnel();
    $affectation->object_class = "CBloodSalvage";
    $affectation->object_id = $blood_salvage_id;
    $tabAffected = $affectation->loadMatchingList();
    foreach ($tabAffected as $key => $affect) {
        if (array_key_exists($affect->personnel_id, $list_nurse_sspi)) {
            unset($list_nurse_sspi[$affect->personnel_id]);
        }
        $affect->_ref_personnel->loadRefUser();
    }
    // Initialisations des tableaux des timings
    foreach ($tabAffected as $key => $affectation) {
        $timingAffect[$affectation->_id]["_debut"] = array();
        $timingAffect[$affectation->_id]["_fin"] = array();
    }
    // Remplissage des tableaux des timings
    foreach ($tabAffected as $id => $affectation) {
        foreach ($timingAffect[$affectation->_id] as $key => $value) {
            for ($i = -10; $i < 10 && $affectation->{$key} !== null; $i++) {
                $timingAffect[$affectation->_id][$key][] = CMbDT::time("{$i} minutes", $affectation->{$key});
            }
        }
    }
}
 /**
  * Trouve les affectations avec cible et personnel identique
  *
  * @return array Liste des siblings
  */
 function getSiblings()
 {
     // Version complete
     $clone = new CAffectationPersonnel();
     $clone->load($this->_id);
     $clone->extendsWith($this);
     // Filtre exact
     $sibling = new CAffectationPersonnel();
     $sibling->object_class = $clone->object_class;
     $sibling->object_id = $clone->object_id;
     $sibling->personnel_id = $clone->personnel_id;
     // Chargement des siblings
     $siblings = $sibling->loadMatchingList();
     unset($siblings[$this->_id]);
     return $siblings;
 }
 * @package    Mediboard
 * @subpackage dPpersonnel
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
global $can;
$can->needsAdmin();
$affectation = new CAffectationPersonnel();
$ds = $affectation->_spec->ds;
$query = "CREATE TEMPORARY TABLE `affectations_multiples` AS (\r\n  SELECT COUNT(*) AS `affect_count`, `object_class`, `object_id`, `personnel_id`\r\n  FROM `affectation_personnel` \r\n  GROUP BY `object_class`, `object_id`, `personnel_id`)";
$ds->exec($query);
$query = "SELECT * \r\n  FROM `affectations_multiples`\r\n  WHERE `affect_count` > 1\r\n  ORDER BY `affect_count` DESC";
$multiples = $ds->loadList($query);
$objects = array();
$personnels = array();
foreach ($multiples as &$_multiple) {
    $affectation->object_class = $_multiple["object_class"];
    $affectation->object_id = $_multiple["object_id"];
    $affectation->personnel_id = $_multiple["personnel_id"];
    $affectation->_ref_object = null;
    $affectation->loadTargetObject();
    $_multiple["object"] = $affectation->_ref_object;
    $affectation->loadRefPersonnel();
    $_multiple["personnel"] = $affectation->_ref_personnel;
    $_multiple["affectations"] = $affectation->loadMatchingList();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("multiples", $multiples);
$smarty->display("vw_affectations_multiples.tpl");