} $prat = new CMediusers(); $prat->load($chirSel); $function_prat = $prat->loadRefFunction(); $user = new CMediusers(); $nbjours = 7; $listPlageConsult = new CPlageconsult(); $listPlageOp = new CPlageOp(); $where = array(); $where["date"] = "= '{$fin}'"; $where["chir_id"] = " = '{$chirSel}'"; $operation = new COperation(); $operation->chir_id = $chirSel; $operation->date = $fin; // find for day number if (!$listPlageConsult->countList($where) && !$listPlageOp->countList($where) && !$operation->countMatchingList()) { $nbjours--; // Aucune plage le dimanche, on peut donc tester le samedi. $dateArr = CMbDT::date("-1 day", $fin); $where["date"] = "= '{$dateArr}'"; $operation->date = $dateArr; if (!$listPlageConsult->countList($where) && !$listPlageOp->countList($where) && !$operation->countMatchingList()) { $nbjours--; } } // Instanciation du planning $planning = new CPlanningWeek($debut, $debut, $fin, $nbjours, false, null, null, true); if ($user->load($chirSel)) { $planning->title = $user->load($chirSel)->_view; } else { $planning->title = "";
$purge_start_date = CValue::post('purge_start_date', CMbDT::date()); $purge_limit = CValue::post('purge_limit'); $practitioner_id = CValue::post('practitioner_id'); $just_count = CValue::post('just_count'); if (!$purge_start_date) { CAppUI::stepAjax("common-error-You must select a start date", UI_MSG_ERROR); } $purge_limit = $purge_limit ? $purge_limit : 100; $ds = CSQLDataSource::get('std'); $plage_op = new CPlageOp(); $ljoin = array('operations' => '`plagesop`.`plageop_id` = `operations`.`plageop_id`'); $where = array('plagesop.date' => $ds->prepare('>= ?', $purge_start_date), 'operations.plageop_id' => 'IS NULL'); if ($practitioner_id) { $where['plagesop.chir_id'] = $ds->prepare('= ?', $practitioner_id); } $count = $plage_op->countList($where, null, $ljoin); $msg = '%d CPlageOp to be removed.'; if ($count == 1) { $msg = 'One CPlageOp to be removed.'; } elseif (!$count) { $msg = 'No CPlageOp to be removed.'; } CAppUI::stepAjax("CPlageOp-msg-{$msg}", UI_MSG_OK, $count); if ($just_count || !$count) { CAppUI::js("\$('clean_plage_auto').checked = false"); CApp::rip(); } $plages_op = $plage_op->loadList($where, null, $purge_limit, null, $ljoin); if (!$plages_op) { CAppUI::js("\$('clean_plage_auto').checked = false"); CAppUI::stepAjax("CPlageOp-msg-No CPlageOp to be removed.", UI_MSG_OK);
$where = array(); $_date_min = $date_temp; $_date_max = CMbDT::date("+1 WEEK -1 DAY", $date_temp); $dates_planning[$date_temp] = $date_temp; $results[$date_temp] = array("date_min" => $_date_min, "date_max" => $_date_max); $dates[$date_temp] = array(); for ($date = $_date_min; $date <= $_date_max; $date = CMbDT::date("+1 DAY", $date)) { $dates[$date_temp][$date] = $date; } // On teste si l'on peut retirer le dimanche $where["date"] = "= '{$date_max}'"; if ($bloc_id) { $ljoin["sallesbloc"] = "sallesbloc.salle_id = plagesop.salle_id"; $where["sallesbloc.bloc_id"] = "= '{$bloc_id}'"; } if ($plage->countList($where, null, $ljoin) == 0) { array_pop($dates[$date_temp]); } // Puis le samedi $where["date"] = "= '" . CMbDT::date("-1 day", $date_max) . "'"; if ($plage->countList($where, null, $ljoin) == 0) { array_pop($dates[$date_temp]); } unset($where["sallesbloc.bloc_id"]); foreach ($blocs as $_bloc) { foreach ($_bloc->_ref_salles as $_salle) { foreach ($dates[$date_temp] as $date) { $where["salle_id"] = "= '{$_salle->_id}'"; $results[$date_temp][$_salle->_id][$date] = array("am" => "", "pm" => ""); foreach ($results[$date_temp][$_salle->_id][$date] as $key => &$_result_by_creneau) { $where["date"] = " = '{$date}'";