* * @package Mediboard * @subpackage SSR * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $activite = new CActiviteCdARR(); $activite->code = CValue::getOrSession("code"); $activite->type = CValue::getOrSession("type"); // Pagination $current = CValue::getOrSession("current", 0); $step = 20; $type_activite = new CTypeActiviteCdARR(); $listTypes = $type_activite->loadList(null, "code"); $where = array(); if ($activite->type) { $where["type"] = "= '{$activite->type}'"; } $limit = "{$current}, {$step}"; $order = "type, code"; /** @var CActiviteCdARR[] $listActivites */ $listActivites = $activite->seek($activite->code, $where, $limit, true); $total = $activite->_totalSeek; // Détail du chargement foreach ($listActivites as $_activite) { $_activite->countElements(); $_activite->countActes(); } // Création du template
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $sejour_ids = explode("-", CValue::get("sejour_ids")); $date_monday = CValue::get("date_monday"); $all_rhs = CValue::get("all_rhs"); $where["sejour_id"] = CSQLDataSource::prepareIn($sejour_ids); $where["date_monday"] = $all_rhs ? ">= '{$date_monday}'" : "= '{$date_monday}'"; $order = "sejour_id, date_monday"; $rhs = new CRHS(); /** @var CRHS[] $sejours_rhs */ $sejours_rhs = $rhs->loadList($where, $order); // Liste des catégories d'activité $type_activite = new CTypeActiviteCdARR(); $types_activite = $type_activite->loadList(); $totaux = array(); foreach ($sejours_rhs as $_rhs) { // Dépendances $dependances = $_rhs->loadRefDependances(); if (!$dependances->_id) { $dependances->store(); } $_rhs->loadRefSejour(); $_rhs->buildTotaux(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("sejours_rhs", $sejours_rhs); $smarty->assign("read_only", true); $smarty->display("print_sejour_rhs_no_charge.tpl");
/** * Constuit les totaux * * @return int[] */ function buildTotaux() { // Initialisation des totaux $totaux = array(); $type_activite = new CTypeActiviteCdARR(); /** @var CTypeActiviteCdARR[] $types_activite */ $types_activite = $type_activite->loadList(); foreach ($types_activite as $_type) { $totaux[$_type->code] = 0; } // Comptage et classement par executants $executants = array(); $lines_by_executant = array(); /** @var CLigneActivitesRHS $_line */ foreach ($this->loadBackRefs("lines") as $_line) { // Cas des actes CdARR if ($_line->code_activite_cdarr) { $activite = $_line->loadRefActiviteCdARR(); $type = $activite->loadRefTypeActivite(); $totaux[$type->code] += $_line->_qty_total; } // Cas des actes CsARR if ($_line->code_activite_csarr) { $activite = $_line->loadRefActiviteCsARR(); $activite->loadRefHierarchie(); } $_line->loadRefIntervenantCdARR(); /** @var CMediusers $executant */ $executant = $_line->loadFwdRef("executant_id", true); $executant->loadRefsFwd(); $executant->loadRefIntervenantCdARR(); // Use guids for keys instead of ids to prevent key corruption by multisorting $executants[$executant->_guid] = $executant; $lines_by_executant[$executant->_guid][] = $_line; if ($_line->code_activite_cdarr) { $this->_count_cdarr += 1; } } // Sort by executants then by code array_multisort(CMbArray::pluck($executants, "_view"), SORT_ASC, $lines_by_executant); foreach ($lines_by_executant as &$_lines) { array_multisort(CMbArray::pluck($_lines, "code_activite_cdarr"), SORT_ASC, $_lines); } $this->_ref_lines_by_executant = $lines_by_executant; $this->_ref_executants = $executants; $this->_ref_types_activite = $types_activite; return $this->_totaux = $totaux; }