Can also sort on username. Uniformize code of index page.

This commit is contained in:
Laurent Destailleur 2014-03-05 11:37:32 +01:00
parent e9adec49eb
commit 6c536d43e5
5 changed files with 48 additions and 18 deletions

View File

@ -35,6 +35,7 @@ AddNewColumn=Add new column
TitleChoice=Choice label
ExportSpreadsheet=Export result spreadsheet
ExpireDate=Limit date
NbOfSurveys=Number of surveys
NbOfVoters=Nb of voters
SurveyResults=Results
PollAdminDesc=You are allowed to change all vote lines of this poll with button "Edit". You can, as well, remove a column or a line with %s. You can also add a new column with %s.

View File

@ -35,6 +35,7 @@ AddNewColumn=Ajouter nouvelle colonne
TitleChoice=Libellé du choix
ExportSpreadsheet=Exporter feuille de résultats
ExpireDate=Date expiration
NbOfSurveys=Nombre de sondage
NbOfVoters=Nombre de votants
SurveyResults=Résultats
PollAdminDesc=Vous êtes habilité à modifier toutes les lignes de votes par le bouton "Éditer". Vous pouvez supprimer une colonne ou ligne avec %s. Vous pouvez aussi ajouter une nouvelle colonne avec %s.

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -46,9 +46,38 @@ if ($resql)
}
else dol_print_error($db,'');
print_fiche_titre($langs->trans("OpenSurveyArea"));
echo $langs->trans("NoSurveysInDatabase",$nbsondages).'<br><br>'."\n";
print '<div class="fichecenter"><div class="fichethirdleft">';
$nbsondages=0;
$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage';
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
$nbsondages=$obj->nb;
}
else dol_print_error($db,'');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("OpenSurveyArea").'</td></tr>';
print "<tr ".$bc[0].">";
print '<td>'.$langs->trans("NbOfSurveys").'</td><td align="right"><a href="list.php">'.$nbsondages.'</a></td>';
print "</tr>";
//print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">';
//print $total;
//print '</td></tr>';
print '</table>';
print '</div></div></div>';
llxFooter();

View File

@ -75,6 +75,7 @@ $now = dol_now();
llxHeader();
$param='';
$fieldtosortuser=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?'firstname':'lastname';
print '<div class="corps">'."\n";
@ -93,7 +94,7 @@ print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.id_sondage",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Title"), $_SERVER["PHP_SELF"], "p.titre",$param,"","",$sortfield,$sortorder);
print '<td>'. $langs->trans("Type") .'</td>';
print '<td>'. $langs->trans("Author") .'</td>';
print_liste_field_titre($langs->trans("Author"), $_SERVER["PHP_SELF"], "u.".$fieldtosortuser,$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpireDate"), $_SERVER["PHP_SELF"], "p.date_fin",$param,"",'align="center"',$sortfield,$sortorder);
print '<td align="center">'. $langs->trans("NbOfVoters") .'</td>';
print '</tr>'."\n";
@ -112,7 +113,7 @@ print '</td>';
print '</tr>'."\n";
$sql = "SELECT p.id_sondage, p.fk_user_creat, p.format, p.date_fin, p.titre, p.nom_admin,";
$sql.= " u.login";
$sql.= " u.login, u.firstname, u.lastname";
$sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p";
$sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat";
// Count total nb of records
@ -162,7 +163,9 @@ while ($i < min($num,$limit))
if ($obj->fk_user_creat) {
$userstatic = new User($db);
$userstatic->id = $obj->fk_user_creat;
$userstatic->login = $obj->login;
$userstatic->firstname = $obj->firstname;
$userstatic->lastname = $obj->lastname;
$userstatic->login = $userstatic->getFullName($langs, 0, -1, 48);
print $userstatic->getLoginUrl(1);
} else {

View File

@ -68,8 +68,6 @@ llxHeader("",$langs->trans("ProductsAndServices"),$helpurl);
print_fiche_titre($transAreaType);
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
@ -122,19 +120,19 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
if (! empty($conf->product->enabled))
{
$statProducts = "<tr $bc[0]>";
$statProducts = "<tr ".$bc[0].">";
$statProducts.= '<td><a href="liste.php?type=0&amp;tosell=0&amp;tobuy=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
$statProducts.= "</tr>";
$statProducts.= "<tr $bc[1]>";
$statProducts.= "<tr ".$bc[1].">";
$statProducts.= '<td><a href="liste.php?type=0&amp;tosell=1">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
$statProducts.= "</tr>";
}
if (! empty($conf->service->enabled))
{
$statServices = "<tr $bc[0]>";
$statServices = "<tr ".$bc[0].">";
$statServices.= '<td><a href="liste.php?type=1&amp;tosell=0&amp;tobuy=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
$statServices.= "</tr>";
$statServices.= "<tr $bc[1]>";
$statServices.= "<tr ".$bc[1].">";
$statServices.= '<td><a href="liste.php?type=1&amp;tosell=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
$statServices.= "</tr>";
}
@ -160,7 +158,6 @@ print '</td></tr>';
print '</table>';
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
@ -261,7 +258,7 @@ else
// TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter"
// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover":
// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover":
// "commitment engagment" method and "cash accounting" method
if ($conf->global->MAIN_FEATURES_LEVEL)
{
@ -270,7 +267,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL)
}
//print '</td></tr></table>';
print '</div></div></div>';
llxFooter();
@ -283,8 +279,8 @@ $db->close();
function activitytrim($product_type)
{
global $conf,$langs,$db;
// on affiche les 3 dernières années
// on affiche les 3 dernières années
$yearofbegindate=date('Y',dol_time_plus_duree(time(), -3, "y"));
// ventilation par trimestre
@ -311,7 +307,7 @@ function activitytrim($product_type)
$trim4=0;
$lgn = 0;
$num = $db->num_rows($result);
if ($num > 0 )
{
print '<br>';
@ -353,7 +349,7 @@ function activitytrim($product_type)
$trim3=0;
$trim4=0;
}
if ($objp->mois == "01" || $objp->mois == "02" || $objp->mois == "03")
$trim1 += $objp->Mnttot;