$group = "doc_ged.doc_ged_id";
if ($sort_by == 'ref') {
    $sort_way = "ASC";
    if (CAppUI::conf("dPqualite CDocGed _reference_doc")) {
        $sort_by = $group = "doc_categories.code, doc_chapitres.code, doc_ged.num_ref";
    } else {
        $sort_by = $group = "doc_chapitres.code, doc_categories.code, doc_ged.num_ref";
    }
} else {
    // Tri par date
    $sort_way = "DESC";
    $sort_by = " doc_ged_suivi.{$sort_by}";
}
$procedure = new CDocGed();
/** @var CDocGed[] $list_procedures */
$list_procedures = $procedure->loadList($where, "{$sort_by} {$sort_way}", "{$first},20", $group, $ljoin);
foreach ($list_procedures as $curr_proc) {
    $curr_proc->loadRefs();
    $curr_proc->loadLastActif();
}
$count_procedures = $procedure->countList($where, null, $ljoin);
if ($count_procedures >= 20) {
    $pages = range(0, $count_procedures, 20);
} else {
    $pages = array();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("procedures", $list_procedures);
$smarty->assign("count_procedures", $count_procedures);
$smarty->assign("pages", $pages);
 /**
  * Chargement des Procédures
  *
  * @param null    $user_id Utilisateur de la procédure
  * @param array() $where   Paramètres SQL where
  * @param null    $annule  Prise en compte des procédures annulées
  *
  * @return CDocGed[]
  */
 static function loadProc($user_id = null, $where = array(), $annule = null)
 {
     if ($user_id) {
         $where["user_id"] = "= '{$user_id}'";
     }
     if ($annule !== null) {
         $where["annule"] = "= '{$annule}'";
     }
     $proc = new CDocGed();
     return $proc->loadList($where);
 }
Exemple #3
0
    $procDemande[$keyProc]->getEtatRedac();
    $procDemande[$keyProc]->loadLastActif();
    $procDemande[$keyProc]->loadLastEntry();
}
// Procédure non terminé Hors demande
$procEnCours = CDocGed::loadProcRedacAndValid();
foreach ($procEnCours as $_proc) {
    $_proc->loadRefs();
    $_proc->getEtatValid();
    $_proc->loadLastEntry();
}
// Procédures Terminée et Annulée
$where = array();
$where["annule"] = "= '1'";
/** @var CDocGed[] $procTermine */
$procTermine = $docGed->loadList($where);
if ($procAnnuleVisible) {
    foreach ($procTermine as $_proc) {
        $_proc->loadRefs();
        $_proc->getEtatValid();
        $_proc->loadLastEntry();
    }
}
$versionDoc = array();
if ($docGed->version) {
    $versionDoc[] = $docGed->version + 0.1;
    $versionDoc[] = intval($docGed->version) + 1;
} else {
    $versionDoc[] = "1";
}
// Création du template
        $docGed = new CDocGed();
    } else {
        $docGed->_lastentry->loadFile();
    }
}
if (!$docGed->_lastentry) {
    $docGed->loadLastEntry();
}
// Modèles de procédure
$modele = new CDocGed();
$where = array();
$where["doc_ged.etat"] = "= '0'";
$where["group_id"] = "= '{$group->_id}'";
$order = "titre ASC";
$ljoin = array();
$ljoin["doc_ged_suivi"] = "doc_ged.doc_ged_id = doc_ged_suivi.doc_ged_id";
/** @var CDocGed[] $modeles */
$modeles = $modele->loadList($where, $order, null, null, $ljoin);
foreach ($modeles as $_proc) {
    $_proc->loadLastEntry();
}
// Liste des Etablissements selon Permissions
$user = new CMediusers();
$etablissements = $user->loadEtablissements(PERM_READ);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("etablissements", $etablissements);
$smarty->assign("modeles", $modeles);
$smarty->assign("docGed", $docGed);
$smarty->assign("fileSel", $fileSel);
$smarty->display("vw_modeles.tpl");