FrameBeurk File
Fmbk/Module/Dnlod/Ressource/modeleRessource.php
<?php //FrameBeurk V0.65 Copyright ToolOscope 2016. Licence CeCILL-C.
function Dnlod_queryToutesRessources() {
return array('SELECT' => array('R.IdRessource', 'R.Ressource',
'U.IdUser', 'U.User',
'H.TsAction', 'Q.TsAction',
'R.IdEtat', 'R.Donnees'),
'FROM' => 'Dnlod_Ressource AS R '
. 'LEFT JOIN Beurk_Historique AS H ON H.IdNoeud = R.IdRessource AND H.NoVersion = 1 '
. 'LEFT JOIN Beurk_Historique AS Q ON Q.IdNoeud = R.IdRessource AND Q.NoVersion = R.NoVersion '
. 'LEFT JOIN Uzers_User AS U ON U.IdUser = H.IdUser ');
}
function Dnlod_queryRessource($IdRessource) {
$tabQuery = Dnlod_queryToutesRessources();
$tabQuery['WHERE'] = "R.IdRessource = '$IdRessource'";
return Kom1_pagineRequete($tabQuery);
}
/*function Dnlod_queryRessourceHistorique($IdRessource) {
$tabQuery = Dnlod_queryToutesRessources();
$tabQuery['FROM'] .= 'LEFT JOIN Dnlod_Ressource AS R2 ON R.Ressource = R2.Ressource ';
$tabQuery['WHERE'] = "R2.IdRessource = '$IdRessource'";
$tabQuery['ORDER BY'] = 'R.VersionRessource DESC';
return Kom1_pagineRequete($tabQuery);
}*/
function Dnlod_queryListeRessources() {
global $DIALOG;
$tabQuery = Dnlod_queryToutesRessources();
$tabQuery['WHERE'] = 'R.IdEtat IN (' . $DIALOG['IdEtatsAutorises'] . ')';
$tabQuery['ORDER BY'] = 'R.Ressource ASC';
return Kom1_pagineRequete($tabQuery);
}
// fonction appelée par la fonction de recherche commune
function Dnlod_queryRechercheRessource($TsCREMin, $TsCREMax, $MotCle, $Createur) {
$tabQuery['SELECT'] = array("'Ressource'", 'C.IdRessource', 'C.Ressource', 'U.IdUser', 'U.User', 'H.TsAction', 0, 0, 'C.Donnees', '0');
$tabQuery['FROM'] = 'Dnlod_Ressource AS C '
. 'LEFT JOIN Beurk_Historique AS H ON H.IdNoeud = C.IdRessource AND H.NoVersion = 1 '
. 'LEFT JOIN Uzers_User AS U ON U.IdUser = H.IdUser ';
$tabQuery['WHERE'] = '';
if ($MotCle != '') {
$tabQuery['SELECT']['score'] = "MATCH(C.Ressource, C.Donnees) AGAINST ('$MotCle')";
$tabQuery['WHERE'] = db_AND($tabQuery['WHERE'], "MATCH(C.Ressource, C.Donnees) AGAINST ('$MotCle')");
} else
$tabQuery['SELECT']['score'] = '1'; // score
if ($TsCREMin != '' && $TsCREMax != '')
$tabQuery['WHERE'] = db_AND($tabQuery['WHERE'], "H.TsAction BETWEEN $TsCREMin AND $TsCREMax");
if ($Createur != '')
$tabQuery['WHERE'] = db_AND($tabQuery['WHERE'], "U.User = '$Createur'");
$tabQuery['SELECT'][] = "''"; // champs utile pour les permissions
$tabQuery['SELECT'][] = 'U.IdEtat';
return Uzers_ajoutePermissionQUERY($tabQuery);
}