当前位置: 首页>>代码示例>>PHP>>正文


PHP calendar::get_open_days方法代码示例

本文整理汇总了PHP中calendar::get_open_days方法的典型用法代码示例。如果您正苦于以下问题:PHP calendar::get_open_days方法的具体用法?PHP calendar::get_open_days怎么用?PHP calendar::get_open_days使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在calendar的用法示例。


在下文中一共展示了calendar::get_open_days方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: do_retour


//.........这里部分代码省略.........
            $transfert_mauvais_site = true;
        } else {
            //if (($pmb_transferts_actif)&&($stuff->pret_idempr))
            //le message à l'écran
            $html_erreur_site .= $msg[expl_retour_bad_location];
        }
        $html_erreur_site .= "</div>";
        print pmb_bidi($html_erreur_site);
        // fin de if ($stuff->expl_location != $deflt_docs_location)
    }
    if ($stuff->expl_note) {
        $alert_sound_list[] = "critique";
        print pmb_bidi("<hr /><div class='erreur'>{$msg[377]} :</div><div class='message_important'>" . $stuff->expl_note . "</div>");
    } elseif ($pmb_play_pret_sound) {
        $alert_sound_list[] = "information";
    }
    // zone du dernier emrunteur
    if ($stuff->expl_lastempr) {
        $dernier_empr = "<hr /><div class='row'>{$msg['expl_prev_empr']} ";
        $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($stuff->lastempr_cb) . "'>";
        $dernier_empr .= $link . $stuff->lastempr_prenom . ' ' . $stuff->lastempr_nom . ' (' . $stuff->lastempr_cb . ')</a>';
        $dernier_empr .= "</div><hr />";
    }
    if ($stuff->pret_idempr) {
        // l'exemplaire était effectivement emprunté
        // calcul du retard éventuel
        $rqt_date = "select ((TO_DAYS(CURDATE()) - TO_DAYS('{$stuff->pret_retour}'))) as retard ";
        $resultatdate = mysql_query($rqt_date);
        $resdate = mysql_fetch_object($resultatdate);
        $retard = $resdate->retard;
        if ($retard > 0) {
            //Calcul du vrai nombre de jours
            $date_debut = explode("-", $stuff->pret_retour);
            $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
            if ($ndays > 0) {
                $retard = (int) $ndays;
                print "<br /><div class='erreur'>" . $msg[369] . "&nbsp;: " . $retard . " " . $msg[370] . "</div>";
                $alert_sound_list[] = "critique";
            }
        }
        //Calcul du blocage
        if ($pmb_blocage_retard) {
            $date_debut = explode("-", $stuff->pret_retour);
            $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
            if ($ndays > $pmb_blocage_delai) {
                $ndays = $ndays * $pmb_blocage_coef;
                if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                    $ndays = $pmb_blocage_max;
                }
            } else {
                $ndays = 0;
            }
            if ($ndays > 0) {
                //Le lecteur est-il déjà bloqué ?
                $date_fin_blocage_empr = mysql_result(mysql_query("select date_fin_blocage from empr where id_empr='" . $stuff->pret_idempr . "'"), 0, 0);
                //Calcul de la date de fin
                $date_fin = calendar::add_days(date("d"), date("m"), date("Y"), $ndays);
                if ($date_fin > $date_fin_blocage_empr) {
                    //Mise à jour
                    mysql_query("update empr set date_fin_blocage='" . $date_fin . "' where id_empr='" . $stuff->pret_idempr . "'");
                    print "<br /><div class='erreur'>" . sprintf($msg["blocage_retard_pret"], formatdate($date_fin)) . "</div>";
                    $alertsound_list[] = "critique";
                } else {
                    print "<br /><div class='erreur'>" . sprintf($msg["blocage_already_retard_pret"], formatdate($date_fin_blocage_empr)) . "</div>";
                    $alertsound_list[] = "critique";
                }
开发者ID:bouchra012,项目名称:PMB,代码行数:67,代码来源:pret_func.inc.php

示例2: do_retour_doc

 function do_retour_doc()
 {
     global $dbh;
     global $msg;
     global $pmb_gestion_amende, $pmb_gestion_financiere, $pmb_blocage_retard, $pmb_blocage_max, $pmb_blocage_delai, $pmb_blocage_coef;
     // récupération localisation exemplaire
     $query = "select t.tdoc_libelle as type_doc";
     $query .= ", l.location_libelle as location";
     $query .= ", s.section_libelle as section";
     $query .= " from docs_type t";
     $query .= ", docs_location l";
     $query .= ", docs_section s";
     $query .= " where t.idtyp_doc=" . $this->expl_typdoc;
     $query .= " and l.idlocation=" . $this->expl_location;
     $query .= " and s.idsection=" . $this->expl_section;
     $query .= " limit 1";
     $result = pmb_mysql_query($query, $dbh);
     $info_doc = pmb_mysql_fetch_object($result);
     $this->type_doc = $info_doc->type_doc;
     if ($this->nbparts > 1) {
         $this->type_doc .= " (" . $this->nbparts . ")";
     }
     $this->location = $info_doc->location;
     $this->section = $info_doc->section;
     if ($this->expl_note) {
         $this->error_message = $msg[377];
     }
     if ($this->pret_idempr) {
         // calcul du retard éventuel
         $rqt_date = "select ((TO_DAYS(CURDATE()) - TO_DAYS('{$this->pret_retour}'))) as retard ";
         $resultatdate = pmb_mysql_query($rqt_date);
         $resdate = pmb_mysql_fetch_object($resultatdate);
         $retard = $resdate->retard;
         if ($retard > 0) {
             //Calcul du vrai nombre de jours
             $date_debut = explode("-", $this->pret_retour);
             $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
             if ($ndays > 0) {
                 $retard = (int) $ndays;
                 $this->error_message = $msg[369] . " : " . $retard . " " . $msg[370];
             } else {
                 $this->error_message = $msg["calendrier_active_aucun_retard"];
             }
         }
         //Calcul du blocage
         if ($pmb_blocage_retard) {
             $date_debut = explode("-", $this->pret_retour);
             $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
             if ($ndays > $pmb_blocage_delai) {
                 $ndays = $ndays * $pmb_blocage_coef;
                 if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                     $ndays = $pmb_blocage_max;
                 }
             } else {
                 $ndays = 0;
             }
             if ($ndays > 0) {
                 //Le lecteur est-il déjà bloqué ?
                 $date_fin_blocage_empr = pmb_mysql_result(pmb_mysql_query("select date_fin_blocage from empr where id_empr='" . $this->pret_idempr . "'"), 0, 0);
                 //Calcul de la date de fin
                 $date_fin = calendar::add_days(date("d"), date("m"), date("Y"), $ndays);
                 if ($date_fin > $date_fin_blocage_empr) {
                     //Mise à jour
                     pmb_mysql_query("update empr set date_fin_blocage='" . $date_fin . "' where id_empr='" . $this->pret_idempr . "'");
                     $this->error_message = sprintf($msg["blocage_retard_pret"], formatdate($date_fin));
                 } else {
                     $this->error_message = sprintf($msg["blocage_already_retard_pret"], formatdate($date_fin_blocage_empr));
                 }
             }
         }
         //Vérification des amendes
         if ($pmb_gestion_financiere && $pmb_gestion_amende) {
             $amende = new amende($this->pret_idempr);
             $amende_t = $amende->get_amende($this->pret_idexpl);
             //Si il y a une amende, je la débite
             if ($amende_t["valeur"]) {
                 $this->error_message = $msg["finance_retour_amende"] . "&nbsp;: " . comptes::format($amende_t["valeur"]);
                 $compte_id = comptes::get_compte_id_from_empr($this->pret_idempr, 2);
                 if ($compte_id) {
                     $cpte = new comptes($compte_id);
                     if ($cpte->id_compte) {
                         $cpte->record_transaction("", $amende_t["valeur"], -1, sprintf($msg["finance_retour_amende_expl"], $this->pret_idexpl), 0);
                         $this->error_message .= " " . $msg["finance_retour_amende_recorded"];
                     }
                 }
             }
         }
         // Suppression prêt et la mise en table de stat
         $query = "delete from pret where pret_idexpl = '" . $this->pret_idexpl . "' ";
         $result = pmb_mysql_query($query, $dbh);
         if ($result) {
             $this->retour_message = $msg["retour_ok"];
             if (!$this->maj_stat_pret()) {
                 // impossible de maj en table stat
                 $this->error_message = $msg[371];
             }
         } else {
             // impossible de supprimer en table pret
             $this->error_message = $msg[372];
         }
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:ajax_retour_class.php

示例3: do_fiche


//.........这里部分代码省略.........
                 }
                 if ($amende_neg * 1) {
                     $this->amendes_en_cours = abs($amende_neg);
                 }
             }
         }
     }
     if ($pmb_blocage_retard && $force_finance == 0) {
         if ($this->date_blocage && $this->blocage_active) {
             $this->blocage_retard = $pmb_blocage_retard_force;
             //pas de forçage possible
             if ($pmb_blocage_retard_force == 2) {
                 $message_pret .= sprintf($msg["blocage_retard_pret"], formatdate($this->date_blocage)) . "<br />";
             } else {
                 $message_pret .= sprintf($msg["blocage_retard_pret"], formatdate($this->date_blocage)) . "&nbsp;<input type='button' value='" . $msg["blocage_params"] . "' class='bouton' onClick=\"openPopUp('./circ/blocage.php?id_empr=" . $this->id . "','blocage_params',400,200,-2,-2,'toolbar=no, dependent=yes,resizable=yes');\"/><br />";
             }
             if ($pret_ok < 2) {
                 $pret_ok = $pmb_blocage_retard_force;
             }
         }
     }
     // Ajout de l'impossibilité d'effectuer un prêt si un document n'est pas rendu
     // alors qu'il a dépassé le délai de blocage (NG72) .
     if ($pmb_blocage_retard && $force_finance == 0) {
         // Recherche la date de retour du document la plus petite, soit le plus gros retard potentiel
         $requete = "select MIN(pret_retour)as pret_retour";
         $requete .= " from pret p";
         $requete .= " where p.pret_idempr=" . $this->id;
         $result = mysql_query($requete, $dbh);
         while ($bloca = mysql_fetch_object($result)) {
             if ($bloca->pret_retour) {
                 $pret_retour = $bloca->pret_retour;
                 $date_debut = explode("-", $pret_retour);
                 $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
                 if ($ndays > $pmb_blocage_delai) {
                     $ndays = $ndays * $pmb_blocage_coef;
                     if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                         $ndays = $pmb_blocage_max;
                     }
                 } else {
                     $ndays = 0;
                 }
                 if ($ndays) {
                     // Interdire alors de nouveau pret
                     if ($pret_ok < 2) {
                         $pret_ok = $pmb_blocage_retard_force;
                     }
                     $this->blocage_retard = $pmb_blocage_retard_force;
                 }
             }
         }
     }
     if (!$pret_ok && $this->allow_loan) {
         $this->fiche = str_replace("!!empr_case_pret!!", $empr_pret_allowed, $this->fiche);
         $this->fiche = str_replace('!!id!!', $this->id, $this->fiche);
     } else {
         if ($pret_ok == 1 && $this->allow_loan) {
             $message_pret .= "<input type='button' class='bouton' value=\"" . $msg["finance_pret_force_pret"] . "\" onClick=\"this.form.force_finance.value=1; this.form.submit();\">";
         } elseif ($this->allow_loan) {
             $message_pret .= "<div class='erreur'>" . $msg["finance_pret_bloque"] . "</div>";
         } else {
             $message_pret .= "<div class='erreur'>" . $msg["empr_no_allow_loan"] . "</div>";
         }
         $this->fiche = str_replace("!!empr_case_pret!!", $message_pret, $this->fiche);
     }
     $abonnement = "";
开发者ID:bouchra012,项目名称:PMB,代码行数:67,代码来源:emprunteur.class.php

示例4: del_pret

 function del_pret()
 {
     global $dbh;
     global $msg, $pmb_blocage_retard, $pmb_blocage_delai, $pmb_blocage_coef, $pmb_blocage_max, $pmb_gestion_financiere, $pmb_gestion_amende;
     global $selfservice_retour_retard_msg, $selfservice_retour_blocage_msg, $selfservice_retour_amende_msg;
     global $alertsound_list;
     if (!$this->expl->pret_idempr) {
         return '';
     }
     // calcul du retard éventuel
     $rqt_date = "select ((TO_DAYS(CURDATE()) - TO_DAYS('" . $this->expl->pret_retour . "'))) as retard ";
     $resultatdate = pmb_mysql_query($rqt_date);
     $resdate = pmb_mysql_fetch_object($resultatdate);
     $retard = $resdate->retard;
     if ($retard > 0) {
         //Calcul du vrai nombre de jours
         $date_debut = explode("-", $this->expl->pret_retour);
         $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
         if ($ndays > 0) {
             $retard = (int) $ndays;
             $message .= "<br /><div class='erreur'>" . $msg[369] . "&nbsp;: " . $retard . " " . $msg[370] . "</div>";
             $alertsound_list[] = "critique";
             $this->message_retard = $selfservice_retour_retard_msg . " " . $msg[369] . " : " . $retard . " " . $msg[370];
         }
     }
     //Calcul du blocage
     if ($pmb_blocage_retard) {
         $date_debut = explode("-", $this->expl->pret_retour);
         $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
         if ($ndays > $pmb_blocage_delai) {
             $ndays = $ndays * $pmb_blocage_coef;
             if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                 $ndays = $pmb_blocage_max;
             }
         } else {
             $ndays = 0;
         }
         if ($ndays > 0) {
             //Le lecteur est-il déjà bloqué ?
             $date_fin_blocage_empr = pmb_mysql_result(pmb_mysql_query("select date_fin_blocage from empr where id_empr='" . $this->expl->pret_idempr . "'"), 0, 0);
             //Calcul de la date de fin
             $date_fin = calendar::add_days(date("d"), date("m"), date("Y"), $ndays);
             if ($date_fin > $date_fin_blocage_empr) {
                 //Mise à jour
                 pmb_mysql_query("update empr set date_fin_blocage='" . $date_fin . "' where id_empr='" . $this->expl->pret_idempr . "'");
                 $message .= "<br /><div class='erreur'>" . sprintf($msg["blocage_retard_pret"], formatdate($date_fin)) . "</div>";
                 $alertsound_list[] = "critique";
                 $this->message_blocage = sprintf($selfservice_retour_blocage_msg, formatdate($date_fin));
             } else {
                 $message .= "<br /><div class='erreur'>" . sprintf($msg["blocage_already_retard_pret"], formatdate($date_fin_blocage_empr)) . "</div>";
                 $alertsound_list[] = "critique";
                 $this->message_blocage = sprintf($selfservice_retour_blocage_msg, formatdate($date_fin_blocage_empr));
             }
         }
     }
     //Vérification des amendes
     if ($pmb_gestion_financiere && $pmb_gestion_amende) {
         $amende = new amende($this->expl->pret_idempr);
         $amende_t = $amende->get_amende($this->expl_id);
         //Si il y a une amende, je la débite
         if ($amende_t["valeur"]) {
             $message .= pmb_bidi("<br /><div class='erreur'>" . $msg["finance_retour_amende"] . "&nbsp;: " . comptes::format($amende_t["valeur"]));
             $this->message_amende = $selfservice_retour_amende_msg . " : " . comptes::format($amende_t["valeur"]);
             $alertsound_list[] = "critique";
             $compte_id = comptes::get_compte_id_from_empr($this->expl->pret_idempr, 2);
             if ($compte_id) {
                 $cpte = new comptes($compte_id);
                 if ($cpte->id_compte) {
                     $cpte->record_transaction("", $amende_t["valeur"], -1, sprintf($msg["finance_retour_amende_expl"], $this->expl_id), 0);
                     $message .= " " . $msg["finance_retour_amende_recorded"];
                 }
             }
             $message .= "</div>";
             $req = "delete from cache_amendes where id_empr=" . $this->expl->pret_idempr;
             pmb_mysql_query($req);
         }
     }
     $query = "delete from pret where pret_idexpl=" . $this->expl_id;
     if (!pmb_mysql_query($query, $dbh)) {
         return '';
     }
     $query = "update empr set last_loan_date=sysdate() where id_empr='" . $this->expl->pret_idempr . "' ";
     @pmb_mysql_query($query, $dbh);
     $query = "update exemplaires set expl_lastempr='" . $this->expl->pret_idempr . "', last_loan_date=sysdate() where expl_id='" . $this->expl->expl_id . "' ";
     if (!pmb_mysql_query($query, $dbh)) {
         return '';
     }
     $this->maj_stat_pret();
     $this->empr = new emprunteur($this->expl->pret_idempr, $erreur_affichage, FALSE, 2);
     $this->expl->pret_idempr = 0;
     $this->flag_rendu = 1;
     return $message;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:93,代码来源:expl_to_do.class.php

示例5: get_amende

 function get_amende($id_expl)
 {
     global $pmb_amende_comptabilisation;
     $requete = "select pret_date, pret_retour, niveau_relance, date_relance from pret where pret_idexpl={$id_expl}";
     $resultat = pmb_mysql_query($requete);
     $amende = array();
     $amende["valeur"] = 0;
     $amende["recouvrement"] = false;
     if (@pmb_mysql_num_rows($resultat)) {
         $r = pmb_mysql_fetch_object($resultat);
         $dr = explode("-", $r->pret_retour);
         //$calendar=new calendar();
         $njours = calendar::get_open_days($dr[2], $dr[1], $dr[0], date("d"), date("m"), date("Y"));
         $amende_param = $this->get_parameters($id_expl);
         if ($njours > 0) {
             $amende["njours"] = $njours;
             if ($njours > $amende_param["delai_avant_amende"]) {
                 //En recouvrement ?
                 if ($r->niveau_relance == 3) {
                     $drel = explode("-", $r->date_relance);
                     $njours_recouvrement = calendar::get_open_days($drel[2], $drel[1], $drel[0], date("d"), date("m"), date("Y"));
                     if ($njours_recouvrement > $amende_param["delai_recouvrement"]) {
                         $amende["recouvrement"] = true;
                         $njours = calendar::get_open_days($dr[2], $dr[1], $dr[0], $drel[2], $drel[1], $drel[0]);
                     }
                 }
                 //Calcul de l'amende à partir du délai de grâce ?
                 if ($pmb_amende_comptabilisation) {
                     $amende["njours"] = $njours - $amende_param["delai_avant_amende"];
                 }
                 //Montant maximum dépassé ?
                 $amende["valeur"] = $amende["njours"] * $amende_param["amende_jour"];
                 if ($amende["valeur"] > $amende_param["amende_maximum"] && $amende_param["amende_maximum"] > 0) {
                     $amende["valeur"] = $amende_param["amende_maximum"];
                 }
             }
         }
         //Calcul du niveau théorique de l'exemplaire
         //calcul de Date retour+delai_avant_amende
         $date_1 = calendar::add_days($dr[2], $dr[1], $dr[0], $amende_param["delai_avant_amende"]);
         //calcul de Date retour+delai_avant_amende+delai_1_2
         $dr1 = explode("-", $date_1);
         $date_2 = calendar::add_days($dr1[2], $dr1[1], $dr1[0], $amende_param["delai_1_2"]);
         //calcul de Date retour+delai_avant_amende+delai_1_2+delai_2_3
         $dr2 = explode("-", $date_2);
         $date_3 = calendar::add_days($dr2[2], $dr2[1], $dr2[0], $amende_param["delai_2_3"]);
         //calcul de Date retour+delai_avant_amende+delai_1_2+delai_2_3+delai_recouvrement
         $dr3 = explode("-", $date_3);
         $date_recouvrement = calendar::add_days($dr3[2], $dr3[1], $dr3[0], $amende_param["delai_recouvrement"]);
         $time = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
         $niveau = 0;
         if ($time > calendar::maketime($date_1) && $time <= calendar::maketime($date_2)) {
             $niveau = 1;
         } else {
             if ($time > calendar::maketime($date_2) && $time <= calendar::maketime($date_3)) {
                 $niveau = 2;
             } else {
                 if ($time > calendar::maketime($date_3) && $time <= calendar::maketime($date_recouvrement)) {
                     $niveau = 3;
                 } else {
                     if ($time > calendar::maketime($date_recouvrement)) {
                         $niveau = 4;
                     }
                 }
             }
         }
         $amende["niveau"] = $niveau;
         $amende["date_pret"] = $r->pret_date;
         $amende["date_retour"] = $r->pret_retour;
         $amende["niveau_relance"] = $r->niveau_relance;
         $amende["date_relance"] = $r->date_relance;
     }
     return $amende;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:74,代码来源:amende.class.php


注:本文中的calendar::get_open_days方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。