|
|
|
|
@@ -84,7 +84,7 @@ $tablib[1] = "Websites";
|
|
|
|
|
|
|
|
|
|
// Requests to extract data
|
|
|
|
|
$tabsql = array();
|
|
|
|
|
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status, f.date_creation FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
|
|
|
|
|
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status, f.date_creation, f.lastaccess, f.pageviews_previous_month, f.pageviews_total FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
|
|
|
|
|
|
|
|
|
|
// Criteria to sort dictionaries
|
|
|
|
|
$tabsqlsort = array();
|
|
|
|
|
@@ -92,7 +92,7 @@ $tabsqlsort[1] = "ref ASC";
|
|
|
|
|
|
|
|
|
|
// Nom des champs en resultat de select pour affichage du dictionnaire
|
|
|
|
|
$tabfield = array();
|
|
|
|
|
$tabfield[1] = "ref,description,virtualhost,position,date_creation";
|
|
|
|
|
$tabfield[1] = "ref,description,virtualhost,position,date_creation,lastaccess,pageviews_previous_month,pageviews_total";
|
|
|
|
|
|
|
|
|
|
// Nom des champs d'edition pour modification d'un enregistrement
|
|
|
|
|
$tabfieldvalue = array();
|
|
|
|
|
@@ -186,7 +186,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
|
|
|
|
$sql .= $tabrowid[$id].",";
|
|
|
|
|
}
|
|
|
|
|
$sql .= $tabfieldinsert[$id];
|
|
|
|
|
$sql .= ",status)";
|
|
|
|
|
$sql .= ", status, date_creation)";
|
|
|
|
|
$sql .= " VALUES(";
|
|
|
|
|
|
|
|
|
|
// List of values
|
|
|
|
|
@@ -211,7 +211,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
|
|
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$sql .= ",1)";
|
|
|
|
|
$sql .= ", 1, '".$db->idate(dol_now())."')";
|
|
|
|
|
|
|
|
|
|
dol_syslog("actionadd", LOG_DEBUG);
|
|
|
|
|
$result = $db->query($sql);
|
|
|
|
|
@@ -441,12 +441,10 @@ if ($id) {
|
|
|
|
|
|
|
|
|
|
// Form to add a new line
|
|
|
|
|
if ($tabname[$id]) {
|
|
|
|
|
$fieldlist = explode(',', $tabfield[$id]);
|
|
|
|
|
|
|
|
|
|
// Line for title
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
foreach ($fieldlist as $field => $value) {
|
|
|
|
|
if ($fieldlist[$field] == 'date_creation') {
|
|
|
|
|
if (in_array($fieldlist[$field], array('date_creation', 'lastaccess', 'pageviews_previous_month', 'pageviews_month', 'pageviews_total'))) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -522,6 +520,7 @@ if ($id) {
|
|
|
|
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
|
|
|
|
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
|
|
|
|
|
|
|
|
|
print '<div class="div-table-responsive">';
|
|
|
|
|
print '<table class="noborder centpercent">';
|
|
|
|
|
|
|
|
|
|
// Title of lines
|
|
|
|
|
@@ -533,6 +532,10 @@ if ($id) {
|
|
|
|
|
$align = "left";
|
|
|
|
|
$sortable = 1;
|
|
|
|
|
$valuetoshow = '';
|
|
|
|
|
if (in_array($fieldlist[$field], array('pageviews_total', 'pageviews_previous_month'))) {
|
|
|
|
|
$align = 'right';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
$tmparray=getLabelOfField($fieldlist[$field]);
|
|
|
|
|
$showfield=$tmp['showfield'];
|
|
|
|
|
@@ -554,14 +557,24 @@ if ($id) {
|
|
|
|
|
if ($fieldlist[$field] == 'date_creation') {
|
|
|
|
|
$valuetoshow = $langs->trans("DateCreation");
|
|
|
|
|
}
|
|
|
|
|
if ($fieldlist[$field] == 'lastaccess') {
|
|
|
|
|
$valuetoshow = $langs->trans("LastAccess");
|
|
|
|
|
}
|
|
|
|
|
if ($fieldlist[$field] == 'pageviews_previous_month') {
|
|
|
|
|
$valuetoshow = $langs->trans("PagesViewedPreviousMonth");
|
|
|
|
|
}
|
|
|
|
|
if ($fieldlist[$field] == 'pageviews_total') {
|
|
|
|
|
$valuetoshow = $langs->trans("PagesViewedTotal");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Affiche nom du champ
|
|
|
|
|
if ($showfield) {
|
|
|
|
|
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder);
|
|
|
|
|
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", '', $sortfield, $sortorder, $align.' ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", 'align="center"', $sortfield, $sortorder);
|
|
|
|
|
// Status
|
|
|
|
|
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", '', $sortfield, $sortorder, 'center ');
|
|
|
|
|
print getTitleFieldOfList('');
|
|
|
|
|
print getTitleFieldOfList('');
|
|
|
|
|
print '</tr>';
|
|
|
|
|
@@ -581,8 +594,9 @@ if ($id) {
|
|
|
|
|
fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button button-edit" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
|
|
|
|
print ' <input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
|
|
|
|
print '<td colspan="7" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a>';
|
|
|
|
|
print '<input type="submit" class="button button-edit small" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
|
|
|
|
print ' <input type="submit" class="button button-cancel small" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
|
|
|
|
} else {
|
|
|
|
|
$tmpaction = 'view';
|
|
|
|
|
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
|
|
|
|
@@ -593,13 +607,16 @@ if ($id) {
|
|
|
|
|
if (empty($reshook)) {
|
|
|
|
|
foreach ($fieldlist as $field => $value) {
|
|
|
|
|
$showfield = 1;
|
|
|
|
|
$align = "left";
|
|
|
|
|
$fieldname = $fieldlist[$field];
|
|
|
|
|
$align = "left";
|
|
|
|
|
if (in_array($fieldname, array('pageviews_total', 'pageviews_previous_month'))) {
|
|
|
|
|
$align = 'right';
|
|
|
|
|
}
|
|
|
|
|
$valuetoshow = $obj->$fieldname;
|
|
|
|
|
|
|
|
|
|
// Show value for field
|
|
|
|
|
if ($showfield) {
|
|
|
|
|
print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
|
|
|
|
print '<td class="'.$align.'">'.$valuetoshow.'</td>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -612,6 +629,7 @@ if ($id) {
|
|
|
|
|
|
|
|
|
|
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '').'&';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Active
|
|
|
|
|
print '<td align="center" class="nowrap">';
|
|
|
|
|
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status ? 1 : 0)].'">'.$actl[($obj->status ? 1 : 0)].'</a>';
|
|
|
|
|
@@ -633,6 +651,7 @@ if ($id) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
print '</table>';
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
print '</form>';
|
|
|
|
|
}
|
|
|
|
|
@@ -668,6 +687,10 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
|
|
|
|
|
$formadmin = new FormAdmin($db);
|
|
|
|
|
|
|
|
|
|
foreach ($fieldlist as $field => $value) {
|
|
|
|
|
if (in_array($fieldlist[$field], array('lastaccess', 'pageviews_previous_month', 'pageviews_month', 'pageviews_total'))) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$fieldname = $fieldlist[$field];
|
|
|
|
|
|
|
|
|
|
if ($fieldlist[$field] == 'lang') {
|
|
|
|
|
|