本文整理汇总了PHP中CMbDT::daysRelative方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbDT::daysRelative方法的具体用法?PHP CMbDT::daysRelative怎么用?PHP CMbDT::daysRelative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbDT
的用法示例。
在下文中一共展示了CMbDT::daysRelative方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fixRepet
/**
* Menu upgrade
*
* @return bool
*/
protected function fixRepet()
{
$ds = $this->ds;
$query = "SELECT * FROM menu";
$menus = $ds->loadList($query);
foreach ($menus as $menu) {
$nbDays = CMbDT::daysRelative($menu["debut"], $menu["fin"]);
$nbWeeks = floor($nbDays / 7);
if (!$nbWeeks) {
$menu["nb_repet"] = 1;
} else {
$menu["nb_repet"] = ceil($nbWeeks / $menu["repetition"]);
}
$query = "UPDATE `menu` SET `nb_repet` = '" . $menu["nb_repet"] . "' WHERE(`menu_id`='" . $menu["menu_id"] . "');";
$ds->exec($query);
$ds->error();
$query = "UPDATE `repas` SET `typerepas_id`='" . $menu["typerepas"] . "' WHERE(`menu_id`='" . $menu["menu_id"] . "');";
$ds->exec($query);
$ds->error();
}
$query = "ALTER TABLE `menu` DROP `fin`;";
$ds->exec($query);
$ds->error();
return true;
}
示例2: countSallesDaily
/**
* Count all salles before a given date
*
* @param date $before If null, count all operations ever
*
* @return int
*/
static function countSallesDaily($before = null)
{
$salle = new CSalle();
$nb_salles = $salle->countList();
$first_date = self::getMinDate();
$day_relative = CMbDT::daysRelative($first_date, CMbDT::date($before));
return $nb_salles * $day_relative;
}
示例3: __construct
/**
* constructor
*
* @param string $date current date in the planning
* @param null $date_min min date of the planning
* @param null $date_max max
* @param int $nb_days nb of day in the planning
* @param bool $selectable is the planning selectable
* @param string $height [optional] height of the planning, default : auto
* @param bool $large [optional] is the planning a large one
* @param bool $adapt_range [optional] can the planning adapt the range
*/
function __construct($date, $date_min = null, $date_max = null, $nb_days = 7, $selectable = false, $height = "auto", $large = false, $adapt_range = false)
{
parent::__construct($date);
$this->type = "week";
$this->selectable = $selectable;
$this->height = $height ? $height : "auto";
$this->large = $large;
$this->nb_days = $nb_days;
$this->adapt_range = $adapt_range;
$this->maximum_load = 6;
if (is_int($date) || is_int($date_min) || is_int($date_max)) {
$this->no_dates = true;
$this->date_min = $this->date_min_active = $this->_date_min_planning = $date_min;
$this->date_max = $this->date_max_active = $this->_date_max_planning = $date_max;
for ($i = 0; $i < $this->nb_days; $i++) {
$this->days[$i] = array();
$this->load_data[$i] = array();
}
} else {
$days = array("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday");
$last_day = $days[$this->nb_days - 1];
$monday = CMbDT::date("last monday", CMbDT::date("+1 day", $this->date));
$sunday = CMbDT::date("next {$last_day}", CMbDT::date("-1 DAY", $this->date));
if (CMbDT::daysRelative($monday, $sunday) > 7) {
$sunday = CMbDT::date("-7 DAYS", $sunday);
}
$this->date_min_active = $date_min ? max($monday, CMbDT::date($date_min)) : $monday;
$this->date_max_active = $date_max ? min($sunday, CMbDT::date($date_max)) : $sunday;
$this->date_min = $monday;
$this->date_max = $sunday;
// Days period
for ($i = 0; $i < $this->nb_days; $i++) {
$_day = CMbDT::date("+{$i} day", $monday);
$this->days[$_day] = array();
$this->load_data[$_day] = array();
}
$this->_date_min_planning = reset(array_keys($this->days));
$this->_date_max_planning = end(array_keys($this->days));
}
$this->_hours = array("00", "04", "08", "12", "16", "20");
}
示例4: array
$date_docs_max = CValue::getOrSession("date_docs_max");
$entree_min = CValue::getOrSession("entree_min");
$entree_max = CValue::getOrSession("entree_max");
$sortie_min = CValue::getOrSession("sortie_min");
$sortie_max = CValue::getOrSession("sortie_max");
$intervention_min = CValue::getOrSession("intervention_min");
$intervention_max = CValue::getOrSession("intervention_max");
$prat_interv = CValue::getOrSession("prat_interv");
$section_search = CValue::getOrSession("section_search");
$type = CValue::getOrSession("type");
$page = CValue::get("page");
$docs = array();
$where = array();
$ljoin = array();
$cr = new CCompteRendu();
$long_period = CMbDT::daysRelative($date_docs_min, $date_docs_max) > 10;
$total_docs = 0;
if (($cat_docs || $specialite_docs || $prat_docs || $date_docs_min && $date_docs_max) && !$long_period) {
switch ($section_search) {
case "sejour":
$ljoin["sejour"] = "sejour.sejour_id = compte_rendu.object_id OR sejour.sejour_id IS NULL";
$where["compte_rendu.object_class"] = "= 'CSejour'";
if ($type) {
$where["sejour.type"] = "= '{$type}'";
}
if ($entree_min) {
$where[] = "sejour.entree >= '{$entree_min} 00:00:00'";
}
if ($entree_max) {
$where[] = "sejour.entree <= '{$entree_max} 23:59:59'";
}
示例5: loadRefOperation
/**
* Operation reference loader
*
* @return COperation
*/
function loadRefOperation()
{
$this->_ref_operation = $this->loadFwdRef("operation_id", true);
if ($this->_ref_operation->date) {
$this->_day_relative = CMbDT::daysRelative($this->_ref_operation->date, CMbDT::date());
}
return $this->_ref_operation;
}
示例6: getPrestations
/**
* Charge les items de prestations souhaités et réalisés
*
* @return CItemPrestation[]
*/
function getPrestations()
{
$this->_ref_prestations = array();
$liaisons_j = $dates = array();
self::getIntervallesPrestations($liaisons_j, $dates);
// Calcul du niveau de réalisation (_quantite)
foreach ($liaisons_j as $prestation_id => $_liaisons) {
foreach ($_liaisons as $date => $_liaison) {
$_item_souhait = $_liaison->loadRefItem();
$_item_realise = $_liaison->loadRefItemRealise();
$sous_item = $_liaison->loadRefSousItem();
if (!$_item_realise->_id) {
continue;
}
$item_facture = $_item_realise;
// On ne facture pas si surclassé
if ($_item_souhait->rank < $_item_realise->rank) {
continue;
}
// Si ce qui est réalisé est supérieur au demandé (rank inférieur), c'est le souhait qui est facturé
if ($_item_realise->rank < $_item_souhait->rank) {
$item_facture = $_item_souhait;
}
if (!$item_facture->facturable) {
continue;
}
$dates_liaison = $dates[$_liaison->_id];
$quantite = CMbDT::daysRelative($dates_liaison["debut"], $dates_liaison["fin"]);
// On incrémente la quantité si ce n'est pas la dernière liaison ou que le sous-item est de type jour
if ($dates_liaison["fin"] != CMbDT::date($this->sortie) || (!$sous_item->_id || $sous_item->niveau == "jour")) {
$quantite += 1;
}
if (!$quantite) {
continue;
}
$this->_ref_prestations[$date][] = array("quantite" => $quantite, "item" => $item_facture, "sous_item_facture" => $sous_item->item_prestation_id == $item_facture->_id ? $sous_item : "");
}
}
return $this->_ref_prestations;
}
示例7: loadDossierComplet
function loadDossierComplet($permType = null, $hide_consult_sejour = true)
{
$this->_total_docs = 0;
$this->_ref_praticiens = array();
if (!$this->_id) {
return;
}
// Patient permission
$this->canDo();
// Doc items
$this->loadRefsFiles();
$this->loadRefsDocs();
$this->_total_docs += $this->countDocItems($permType);
// Photos et Notes
$this->loadRefPhotoIdentite();
$this->loadRefsNotes();
// Correspondants
$this->loadRefsCorrespondants();
$this->loadRefsCorrespondantsPatient();
// Affectations courantes
$this->loadRefsAffectations();
$affectation = $this->_ref_curr_affectation;
if ($affectation && $affectation->_id) {
$affectation->loadRefsFwd();
$affectation->_ref_lit->loadCompleteView();
}
$affectation = $this->_ref_next_affectation;
if ($affectation && $affectation->affectation_id) {
$affectation->loadRefsFwd();
$affectation->_ref_lit->loadCompleteView();
}
$maternite_active = CModule::getActive("maternite");
if ($maternite_active) {
$this->loadRefsGrossesses();
}
// Consultations
$this->loadRefsConsultations();
foreach ($this->_ref_consultations as $consult) {
if ($consult->sejour_id && $hide_consult_sejour) {
unset($this->_ref_consultations[$consult->_id]);
continue;
}
$consult->loadRefConsultAnesth();
$consult->loadRefsFichesExamen();
$consult->loadRefsExamsComp();
if (!count($consult->_refs_dossiers_anesth)) {
$this->_total_docs += $consult->countDocItems($permType);
}
// Praticien
$consult->getType();
$praticien = $consult->_ref_praticien;
$this->_ref_praticiens[$praticien->_id] = $praticien;
$praticien->loadRefFunction()->loadRefGroup();
foreach ($consult->_refs_dossiers_anesth as $_dossier_anesth) {
$_dossier_anesth->_ref_consultation = $consult;
$this->_total_docs += $_dossier_anesth->countDocItems($permType);
}
// Grossesse
if ($maternite_active && $consult->grossesse_id) {
$result = ceil(CMbDT::daysRelative($this->_ref_grossesses[$consult->grossesse_id]->_date_fecondation, $consult->_date) / 7);
$consult->_semaine_grossesse = $result;
$this->_ref_grossesses[$consult->grossesse_id]->_ref_consultations[$consult->_id] = $consult;
}
// Permission
$consult->canDo();
}
// Sejours
foreach ($this->_ref_sejours as $_sejour) {
// Permission
$_sejour->canDo();
//
$_sejour->loadNDA();
$_sejour->loadRefsAffectations();
// Praticien
$praticien = $_sejour->loadRefPraticien(1);
$this->_ref_praticiens[$praticien->_id] = $praticien;
$_sejour->countDocItems($permType);
if ($maternite_active && $_sejour->grossesse_id) {
$this->_ref_grossesses[$_sejour->grossesse_id]->_ref_sejours[$_sejour->_id] = $_sejour;
}
$_sejour->loadRefsOperations(array(), "date DESC");
foreach ($_sejour->_ref_operations as $_operation) {
$_operation->canDo();
// Praticien
$praticien = $_operation->loadRefPraticien(1);
$praticien->loadRefFunction();
$this->_ref_praticiens[$praticien->_id] = $praticien;
// Autres
$_operation->loadRefPlageOp(1);
$this->_total_docs += $_operation->countDocItems($permType);
// Consultation d'anesthésie
$consult_anesth = $_operation->loadRefsConsultAnesth();
$this->_total_docs += $consult_anesth->countDocItems($permType);
$consultation = $consult_anesth->loadRefConsultation();
$this->_total_docs += $consultation->countDocItems($permType);
$consultation->canRead();
$consultation->canEdit();
}
// RPU
$rpu = $_sejour->loadRefRPU();
//.........这里部分代码省略.........
示例8: array
$where = array();
$where[] = "((date_debut >= '{$debut_periode}' AND date_debut <= '{$fin_periode}'" . ")OR (date_fin >= '{$debut_periode}' AND date_fin <= '{$fin_periode}')" . "OR (date_debut <='{$debut_periode}' AND date_fin >= '{$fin_periode}'))";
$where["user_id"] = CSQLDataSource::prepareIn(array_keys($mediusers), $filter->user_id);
$plageconge = new CPlageConge();
$plagesconge = array();
$orderby = "user_id";
/** @var CPlageConge[] $plagesconge */
$plagesconge = $plageconge->loadList($where, $orderby);
$tabUser_plage = array();
$tabUser_plage_indices = array();
foreach ($plagesconge as $_plage) {
$_plage->loadRefUser();
$_plage->_ref_user->loadRefFunction();
$_plage->_deb = CMbDT::daysRelative($debut_periode, $_plage->date_debut);
$_plage->_fin = CMbDT::daysRelative($_plage->date_debut, $_plage->date_fin) + 1;
$_plage->_duree = CMbDT::daysRelative($_plage->date_debut, $_plage->date_fin) + 1;
}
$smarty = new CSmartyDP();
$smarty->assign("debut_periode", $debut_periode);
$smarty->assign("filter", $filter);
$smarty->assign("plagesconge", $plagesconge);
$smarty->assign("choix", $choix);
$smarty->assign("mediusers", $mediusers);
$smarty->assign("tableau_periode", $tableau_periode);
$smarty->assign("tab_start", $tab_start);
$smarty->assign("bank_holidays", $bank_holidays);
if ($choix == "semaine" || $choix == "mois") {
$smarty->display("inc_planning.tpl");
} else {
$smarty->display("inc_planning_annee.tpl");
}
示例9: is_actif
function is_actif($date)
{
$date_debut = CMbDT::date("last sunday", $this->debut);
$date_debut = CMbDT::date("+1 day", $date_debut);
$numDayMenu = CMbDT::daysRelative($date_debut, $this->debut);
$nb_weeks = $this->nb_repet * $this->repetition - 1;
$date_fin = CMbDT::date("+{$nb_weeks} week", $date_debut);
$date_fin = CMbDT::date("next monday", $date_fin);
$date_fin = CMbDT::date("-1 day", $date_fin);
if ($date < $this->debut || $date > $date_fin) {
return false;
}
$nbDays = CMbDT::daysRelative($date_debut, $date);
$nbWeeks = floor($nbDays / 7);
$numDay = $nbDays - $nbWeeks * 7;
if (!$nbWeeks || !fmod($nbWeeks, $this->repetition)) {
if ($numDay == $numDayMenu) {
return true;
}
}
return false;
}
示例10: mine
/**
* @see parent::mine()
*/
function mine(COperation $operation)
{
parent::mine($operation);
// to prevent importation logs perturbations (post-event creations)
static $days_tolerance = 3;
// Operation
$this->date_operation = $operation->_datetime;
$log = $operation->loadCreationLog();
if (CMbDT::daysRelative($operation->_datetime, $log->date) < $days_tolerance) {
$this->date_creation = $log->date;
}
$this->date_visite_anesth = $operation->date_visite_anesth;
if ($operation->annulee) {
$log = $operation->loadFirstLogForField("annulee");
if (CMbDT::daysRelative($operation->_datetime, $log->date) < $days_tolerance) {
$this->date_cancellation = $log->date;
}
}
// Consult anesthesie
$dossier = $operation->loadRefsConsultAnesth();
$consult = $dossier->loadRefConsultation();
if ($consult->_id) {
$consult->loadRefPlageConsult();
$this->date_consult_anesth = $consult->_datetime;
$log = $consult->loadCreationLog();
if (CMbDT::daysRelative($consult->_datetime, $log->date) < $days_tolerance) {
$this->date_creation_consult_anesth = $log->date;
}
}
// Consult chirurgie
$consult = $operation->loadRefConsultChir();
if ($consult->_id) {
$consult->loadRefPlageConsult();
$this->date_consult_chir = $consult->_datetime;
$log = $consult->loadCreationLog();
if (CMbDT::daysRelative($consult->_datetime, $log->date) < $days_tolerance) {
$this->date_creation_consult_chir = $log->date;
}
}
}
示例11: count
CMbArray::removeValue("perf", $elts);
CMbArray::removeValue("inj", $elts);
CMbArray::removeValue("trans", $elts);
$do_elements = count($elts) > 0;
$do_medicaments = in_array("med", $cats);
$do_injections = in_array("inj", $cats);
$do_perfusions = in_array("perf", $cats);
$do_aerosols = in_array("aerosol", $cats);
$do_stupefiants = in_array("stup", $cats);
$do_trans = in_array("trans", $cats);
// Filtres sur l'heure des prises
$time_min = CMbDT::time($dateTime_min, "00:00:00");
$time_max = CMbDT::time($dateTime_max, "23:59:59");
// Stockage des jours concernés par le chargement
$dates = array();
$nb_days = CMbDT::daysRelative($date_min, $date_max);
for ($i = 0; $i <= $nb_days; $i++) {
$dates[] = CMbDT::date("+ {$i} DAYS", $date_min);
}
$sejours = array();
$lits = array();
$trans_and_obs = array();
$list_lines = array();
$lines_by_patient = array();
if ($do) {
$sejour = new CSejour();
$where = array();
$ljoin = array();
$order_by = null;
$where["sejour.entree"] = "<= '{$dateTime_max}'";
$where["sejour.sortie"] = " >= '{$dateTime_min}'";
示例12: CSmartyDP
$sejour->load($sejour_id);
if ($new_sejour) {
$sejour->_id = null;
$entree_prevue = CMbDT::date($date_move) . " " . $hour_intervention;
$sortie_prevue = CMbDT::addDateTime($duree_hours, $entree_prevue);
}
}
if (!$date_move) {
$date_move = "{$operation->date} {$operation->time_operation}";
}
if ($entree_prevue && $sortie_prevue) {
$sejour->entree_prevue = $entree_prevue;
$sejour->sortie_prevue = $sortie_prevue;
}
if (isset($operation)) {
$nb_days = CMbDT::daysRelative("{$operation->date} {$operation->time_operation}", $date_move);
} else {
$nb_days = CMbDT::daysRelative($sejour->entree_prevue, $entree_prevue);
}
if ($nb_days > 0) {
$sejour->entree_prevue = CMbDT::dateTime("+{$nb_days} day", $sejour->entree_prevue);
$sejour->sortie_prevue = CMbDT::dateTime("+{$nb_days} day", $sejour->sortie_prevue);
} else {
$sejour->entree_prevue = CMbDT::dateTime("{$nb_days} day", $sejour->entree_prevue);
$sejour->sortie_prevue = CMbDT::dateTime("{$nb_days} day", $sejour->sortie_prevue);
}
$smarty = new CSmartyDP();
$smarty->assign("sejour", $sejour);
$smarty->assign("date_move", $date_move);
$smarty->assign("callback", $callback);
$smarty->display("inc_edit_dates_sejour.tpl");
示例13: updateFormFields
/**
* @see parent::updateFormFields()
*/
function updateFormFields()
{
parent::updateFormFields();
if ($this->date_time) {
$this->_view = $this->getFormattedValue("date_time");
$this->_heure = CMbDT::time($this->date_time);
} else {
$this->_view = "Dossier provisoire";
}
if ($this->rang) {
$this->_view .= ", rang " . $this->rang;
}
$this->_day_relative = CMbDT::daysRelative($this->date_time, CMbDT::date());
}
示例14: isAutoLock
/**
* Vérification de l'état de verrouillage automatique
*
* @return bool Etat de verrouillage automatique du document
*/
function isAutoLock()
{
$this->_is_auto_locked = false;
switch ($this->object_class) {
case "CConsultation":
$fix_edit_doc = CAppUI::conf("dPcabinet CConsultation fix_doc_edit");
if ($fix_edit_doc) {
$consult = $this->loadTargetObject();
$consult->loadRefPlageConsult();
$this->_is_auto_locked = CMbDT::dateTime("+ 24 HOUR", "{$consult->_date} {$consult->heure}") > CMbDT::dateTime();
}
break;
case "CConsultAnesth":
$fix_edit_doc = CAppUI::conf("dPcabinet CConsultation fix_doc_edit");
if ($fix_edit_doc) {
$consult = $this->loadTargetObject()->loadRefConsultation();
$consult->loadRefPlageConsult();
$this->_is_auto_locked = CMbDT::dateTime("+ 24 HOUR", "{$consult->_date} {$consult->heure}") > CMbDT::dateTime();
}
break;
default:
$this->_is_auto_locked = false;
}
if (!$this->_is_auto_locked) {
$this->loadContent();
$days = CAppUI::conf("dPcompteRendu CCompteRendu days_to_lock");
$days = isset($days[$this->object_class]) ? $days[$this->object_class] : $days["base"];
$this->_is_auto_locked = CMbDT::daysRelative($this->_ref_content->last_modified, CMbDT::dateTime()) > $days;
}
return $this->_is_auto_locked;
}
示例15: CSejour
// Chargement du sejour à dupliquer
$original_sejour = new CSejour();
$original_sejour->load($original_sejour_id);
// Chargement des references: bilan, fiche d'autonomie, prescriptions, evenements
$bilan_ssr = $original_sejour->loadRefBilanSSR();
$fiche_autonomie = $original_sejour->loadRefFicheAutonomie();
$prescription_sejour = $original_sejour->loadRefPrescriptionSejour();
$lines_element = $prescription_sejour->loadRefsLinesElement();
// Chargement evenements de la derniere semaine complete
$original_last_friday = CMbDT::date("last friday", CMbDT::date("+ 1 DAY", $original_sejour->sortie));
$monday = CMbDT::date("last monday", $original_last_friday);
$next_monday = CMbDT::date("next monday", $monday);
// 1er vendredi du nouveau sejour
$next_friday = CMbDT::date("next friday", CMbDT::date("- 1 DAY", $sejour->entree));
// Calcul du nombre de decalage entre les 2 sejours
$nb_decalage = CMbDT::daysRelative($original_last_friday, $next_friday);
$evenement_ssr = new CEvenementSSR();
$where = array();
$where["sejour_id"] = " = '{$original_sejour->_id}'";
$where["debut"] = " BETWEEN '{$monday}' AND '{$next_monday}'";
/** @var CEvenementSSR[] $evenements */
$evenements = $evenement_ssr->loadList($where);
// Chargement des refs du sejour actuel et suppression des objets existants
$sejour->loadRefBilanSSR();
if ($sejour->_ref_bilan_ssr->_id) {
$msg = $sejour->_ref_bilan_ssr->delete();
CAppUI::displayMsg($msg, "CBilanSSR-msg-delete");
}
$sejour->loadRefFicheAutonomie();
if ($sejour->_ref_fiche_autonomie->_id) {
$msg = $sejour->_ref_fiche_autonomie->delete();