本文整理汇总了PHP中parametres_perso::read_search_fields_from_form方法的典型用法代码示例。如果您正苦于以下问题:PHP parametres_perso::read_search_fields_from_form方法的具体用法?PHP parametres_perso::read_search_fields_from_form怎么用?PHP parametres_perso::read_search_fields_from_form使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parametres_perso
的用法示例。
在下文中一共展示了parametres_perso::read_search_fields_from_form方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getQueryFilter
static function getQueryFilter($idetat, $iduser, $idempr, $user_input, $date_dmde, $date_but, $id_theme, $id_type, $dmde_loc)
{
$date_deb = str_replace('-', '', $date_dmde);
$date_fin = str_replace('-', '', $date_but);
$params = array();
//Filtre d'etat
if ($idetat) {
$etat = " etat_demande = '" . $idetat . "'";
$params[] = $etat;
}
//Filtre d'utilisateur
$join_filtre_user = "";
if ($iduser) {
if ($iduser == -1) {
$user = " nom is null ";
} else {
$user = " duf.num_user = '" . (is_array($iduser) ? $iduser[0] : $iduser) . "' and duf.users_statut=1";
}
$join_filtre_user = "left join demandes_users duf on (duf.num_demande=d.id_demande )";
$params[] = $user;
}
//Filtre de demandeur
if ($idempr) {
$empr = " num_demandeur = '" . $idempr . "'";
$params[] = $empr;
}
//Filtre de recherche
if ($user_input) {
$user_input = str_replace('*', '%', $user_input);
$saisie = " titre_demande like '%" . $user_input . "%'";
$params[] = $saisie;
}
//Filtre date
if ($date_deb < $date_fin) {
$date = " (date_demande >= '" . $date_dmde . "' and deadline_demande <= '" . $date_but . "' )";
$params[] = $date;
}
//Filtre theme
if ($id_theme) {
$theme = " theme_demande = '" . $id_theme . "'";
$params[] = $theme;
}
//Filtre type
if ($id_type) {
$type = " type_demande = '" . $id_type . "'";
$params[] = $type;
}
//Filtre localisation
$join_loc = "";
if ($dmde_loc) {
$join_loc = "left join empr on (num_demandeur=id_empr)";
$loc = " empr_location = '" . $dmde_loc . "'";
$params[] = $loc;
}
//Champs perso
$join_cp = "";
$p_perso = new parametres_perso("demandes");
$perso_ = $p_perso->read_search_fields_from_form();
if (count($perso_["FIELDS"])) {
for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
$p = $perso_["FIELDS"][$i];
if (is_array($p["VALUE"]) && count($p["VALUE"])) {
$join_cp .= " join demandes_custom_values as d_c_v_" . $i . " on (d_c_v_" . $i . ".demandes_custom_origine=d.id_demande)";
$join_cp .= " and d_c_v_" . $i . ".demandes_custom_" . $p["DATATYPE"] . " IN ('" . implode("','", $p["VALUE"]) . "') ";
}
}
}
if ($params) {
$clause = "where " . implode(" and ", $params);
}
$req = "select id_demande\n\t\t\t\tfrom demandes d \n\t\t\t\tjoin demandes_type dy on d.type_demande=dy.id_type\n\t\t\t\tjoin demandes_theme dt on d.theme_demande=dt.id_theme\t\t\t\t\n\t\t\t\tleft join demandes_users du on du.num_demande=d.id_demande\n\t\t\t\tleft join users on (du.num_user=userid and du.users_statut=1)\n\t\t\t\t{$join_filtre_user}\n\t\t\t\t{$join_loc}\n\t\t\t\t{$join_cp}\n\t\t\t\t{$clause}\n\t\t\t\tgroup by id_demande\n\t\t\t\torder by date_demande desc";
return $req;
}