Exemple #1
0
 /**
  * Récupération du taux d'occupation de la plage et du nombre d'interventions
  *
  * @param string $addedTime      Durée ajouté manuellement
  * @param bool   $useTimeInterOp Utilisation des durées ajoutées entre chaque intervention
  *
  * @return int
  */
 function multicountOperations($addedTime = null, $useTimeInterOp = true)
 {
     if ($useTimeInterOp == true) {
         $select_time = "\nSUM(TIME_TO_SEC(`operations`.`temp_operation`) + TIME_TO_SEC(`plagesop`.`temps_inter_op`)) AS time";
     } else {
         $select_time = "\nSUM(TIME_TO_SEC(`operations`.`temp_operation`)) AS time";
     }
     $sql = "SELECT COUNT(`operations`.`operation_id`) AS total, {$select_time}\r\n        FROM `operations`, `plagesop`\r\n        WHERE `operations`.`plageop_id` = '{$this->plageop_id}'\r\n        AND `operations`.`plageop_id` = `plagesop`.`plageop_id`\r\n        AND `operations`.`annulee` = '0'";
     $result = $this->_spec->ds->loadHash($sql);
     $this->_count_operations = $result["total"];
     if ($addedTime) {
         $result["time"] = $result["time"] + $addedTime;
     }
     $this->_fill_rate = number_format($result["time"] * 100 / (strtotime($this->fin) - strtotime($this->debut)), 2);
     $sql = "SELECT COUNT(`operations`.`operation_id`) AS total, {$select_time}\r\n        FROM `operations`, `plagesop`\r\n        WHERE `operations`.`plageop_id` = '{$this->plageop_id}'\r\n        AND `operations`.`plageop_id` = `plagesop`.`plageop_id`\r\n        AND `operations`.`rank` > 0\r\n        AND `operations`.`annulee` = '0'";
     $result = $this->_spec->ds->loadHash($sql);
     $this->_count_operations_placees = $result["total"];
     if ($this->verrouillage == "oui") {
         $this->_verrouillee = array("force");
     } elseif ($this->verrouillage == "non") {
         $this->_verrouillee = array();
     } else {
         $this->loadRefSalle();
         $this->_ref_salle->loadRefBloc();
         $date_min = CMbDT::date("+ " . $this->_ref_salle->_ref_bloc->days_locked . " DAYS");
         $check_datemin = $this->date < $date_min;
         $check_fill = $this->_fill_rate > 100 && CAppUI::conf("dPbloc CPlageOp locked");
         $check_max = $this->max_intervention && $this->_count_operations >= $this->max_intervention;
         if ($check_datemin) {
             $this->_verrouillee[] = "datemin";
         }
         if ($check_fill) {
             $this->_verrouillee[] = "fill";
         }
         if ($check_max) {
             $this->_verrouillee[] = "max";
         }
     }
     $this->countOperationsAnnulees();
     return $this->_count_all_operations = $this->_count_operations + $this->_count_operations_annulees;
 }
 * @category Bloc
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:$
 * @link     http://www.mediboard.org
 */
CCanDo::read();
$listBlocs = CGroups::loadCurrent()->loadBlocs();
$listSalles = array();
foreach ($listBlocs as $_bloc) {
    $listSalles = $listSalles + $_bloc->loadRefsSalles();
}
$salle = new CSalle();
$salle->load(CValue::get("salle_id"), reset($listSalles)->_id);
$salle->loadRefBloc();
$date = CValue::get("date", CMbDT::date());
// Liste des jours
$listDays = array();
for ($i = 0; $i < 19 * 7; $i += 7) {
    $dateArr = CMbDT::date("+{$i} day", $date);
    $listDays[$dateArr] = $dateArr;
}
// Création du tableau de visualisation
$affichages = array();
foreach ($listDays as $keyDate => $valDate) {
    foreach (CPlageOp::$hours as $keyHours => $valHours) {
        foreach (CPlageOp::$minutes as $keyMins => $valMins) {
            // Initialisation du tableau
            $affichages["{$keyDate}-{$valHours}:{$valMins}:00"] = "empty";
            $affichages["{$keyDate}-HorsPlage"] = array();