Look and feel v10

This commit is contained in:
Laurent Destailleur 2019-03-15 10:48:10 +01:00
parent 32767a487b
commit e326c4d579
5 changed files with 93 additions and 82 deletions

View File

@ -218,66 +218,70 @@ if ($object->id)
$pdir = get_exdir($object->id, 2, 0, 0, $object, 'category') . $object->id ."/photos/"; $pdir = get_exdir($object->id, 2, 0, 0, $object, 'category') . $object->id ."/photos/";
$dir = $upload_dir.'/'.$pdir; $dir = $upload_dir.'/'.$pdir;
print '<br>'; $listofphoto = $object->liste_photos($dir);
print '<table width="100%" valign="top" align="center">';
foreach ($object->liste_photos($dir) as $key => $obj) if (is_array($listofphoto) && count($listofphoto))
{ {
$nbphoto++; print '<br>';
print '<table width="100%" valign="top" align="center">';
foreach ($listofphoto as $key => $obj)
{
$nbphoto++;
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>'; if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">'; if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">'; print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
if ($obj['photo_vignette']) if ($obj['photo_vignette'])
{ {
$filename=$obj['photo_vignette']; $filename=$obj['photo_vignette'];
} }
else else
{ {
$filename=$obj['photo']; $filename=$obj['photo'];
} }
// Nom affiche // Nom affiche
$viewfilename=$obj['photo']; $viewfilename=$obj['photo'];
// Taille de l'image // Taille de l'image
$object->get_image_size($dir.$filename); $object->get_image_size($dir.$filename);
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth; $imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight; $imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename).'">'; print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename).'">';
print '</a>'; print '</a>';
print '<br>'.$viewfilename; print '<br>'.$viewfilename;
print '<br>'; print '<br>';
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites // On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addthumb&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'), 'refresh').'&nbsp;&nbsp;</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addthumb&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'), 'refresh').'&nbsp;&nbsp;</a>';
} }
if ($user->rights->categorie->creer) if ($user->rights->categorie->creer)
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;type='.$type.'&amp;file='.urlencode($pdir.$viewfilename).'">';
print img_delete().'</a>'; print img_delete().'</a>';
} }
if ($nbbyrow) print '</td>'; if ($nbbyrow) print '</td>';
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>'; if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
}
// Ferme tableau
while ($nbphoto % $nbbyrow)
{
print '<td width="'.ceil(100/$nbbyrow).'%">&nbsp;</td>';
$nbphoto++;
}
print '</table>';
} }
// Ferme tableau
while ($nbphoto % $nbbyrow)
{
print '<td width="'.ceil(100/$nbbyrow).'%">&nbsp;</td>';
$nbphoto++;
}
print '</table>';
if ($nbphoto < 1) if ($nbphoto < 1)
{ {
print '<div class="opacitymedium">'.$langs->trans("NoPhotoYet")."</div>"; print '<div class="opacitymedium">'.$langs->trans("NoPhotoYet")."</div>";

View File

@ -313,7 +313,7 @@ else
} }
else else
{ {
print "<tr ".$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoSubCat")."</td></tr>"; print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoSubCat").'</td></tr>';
} }
print "</table>\n"; print "</table>\n";
} }
@ -342,10 +342,9 @@ if ($type == Categorie::TYPE_PRODUCT)
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addintocategory">'; print '<input type="hidden" name="action" value="addintocategory">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="40%">'; print '<tr class="liste_titre"><td>';
print $langs->trans("AddProductServiceIntoCategory").' &nbsp;'; print $langs->trans("AddProductServiceIntoCategory").' &nbsp;';
print $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1); print $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1);
print '</td><td>';
print '<input type="submit" class="button" value="'.$langs->trans("ClassifyInCategory").'"></td>'; print '<input type="submit" class="button" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
@ -354,7 +353,7 @@ if ($type == Categorie::TYPE_PRODUCT)
print "<br>"; print "<br>";
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")." (".count($prods).")</td></tr>\n"; print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices").' <span class="badge">'.count($prods).'</span></td></tr>'."\n";
if (count($prods) > 0) if (count($prods) > 0)
{ {
@ -376,8 +375,9 @@ if ($type == Categorie::TYPE_PRODUCT)
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$prod->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$prod->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat");
print $langs->trans("DeleteFromCat")."</a>"; print img_picto($langs->trans("DeleteFromCat"), 'unlink');
print "</a>";
} }
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -385,7 +385,7 @@ if ($type == Categorie::TYPE_PRODUCT)
} }
else else
{ {
print "<tr ".$bc[false].'><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoProduct")."</td></tr>"; print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoProduct").'</td></tr>';
} }
print "</table>\n"; print "</table>\n";
} }
@ -402,7 +402,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
{ {
print "<br>"; print "<br>";
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Suppliers")." (".count($socs).")</td></tr>\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Suppliers").' <span class="badge">'.count($socs)."</span></td></tr>\n";
if (count($socs) > 0) if (count($socs) > 0)
{ {
@ -423,8 +423,9 @@ if ($type == Categorie::TYPE_SUPPLIER)
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$soc->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$soc->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat");
print $langs->trans("DeleteFromCat")."</a>"; print img_picto($langs->trans("DeleteFromCat"), 'unlink');
print "</a>";
} }
print '</td>'; print '</td>';
@ -433,7 +434,7 @@ if ($type == Categorie::TYPE_SUPPLIER)
} }
else else
{ {
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoSupplier").'</td></tr>'; print '<tr class="oddeven"><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoSupplier").'</td></tr>';
} }
print "</table>\n"; print "</table>\n";
} }
@ -450,7 +451,7 @@ if($type == Categorie::TYPE_CUSTOMER)
{ {
print "<br>"; print "<br>";
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Customers")." (".count($socs).")</td></tr>\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Customers").' <span class="badge">'.count($socs).'</span></td></tr>'."\n";
if (count($socs) > 0) if (count($socs) > 0)
{ {
@ -476,8 +477,9 @@ if($type == Categorie::TYPE_CUSTOMER)
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$soc->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$soc->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat");
print $langs->trans("DeleteFromCat")."</a>"; print img_picto($langs->trans("DeleteFromCat"), 'unlink');
print "</a>";
} }
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -485,7 +487,7 @@ if($type == Categorie::TYPE_CUSTOMER)
} }
else else
{ {
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoCustomer").'</td></tr>'; print '<tr class="oddeven"><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoCustomer").'</td></tr>';
} }
print "</table>\n"; print "</table>\n";
} }
@ -505,7 +507,7 @@ if ($type == Categorie::TYPE_MEMBER)
{ {
print "<br>"; print "<br>";
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Member")." (".count($prods).")</td></tr>\n"; print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Member").' <span class="badge">'.count($prods).'</span></td></tr>'."\n";
if (count($prods) > 0) if (count($prods) > 0)
{ {
@ -529,15 +531,16 @@ if ($type == Categorie::TYPE_MEMBER)
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$member->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$member->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat");
print $langs->trans("DeleteFromCat")."</a>"; print img_picto($langs->trans("DeleteFromCat"), 'unlink');
print "</a>";
} }
print "</tr>\n"; print "</tr>\n";
} }
} }
else else
{ {
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoMember").'</td></tr>'; print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoMember").'</td></tr>';
} }
print "</table>\n"; print "</table>\n";
} }
@ -555,7 +558,7 @@ if ($type == Categorie::TYPE_CONTACT)
{ {
print "<br>"; print "<br>";
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Contact")." (".count($contacts).")</td></tr>\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Contact").' <span class="badge">'.count($contacts).'</span></td></tr>'."\n";
if (count($contacts) > 0) if (count($contacts) > 0)
{ {
@ -579,8 +582,9 @@ if ($type == Categorie::TYPE_CONTACT)
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$contact->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$contact->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat");
print $langs->trans("DeleteFromCat")."</a>"; print img_picto($langs->trans("DeleteFromCat"), 'unlink');
print "</a>";
} }
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
@ -588,7 +592,7 @@ if ($type == Categorie::TYPE_CONTACT)
} }
else else
{ {
print '<tr '.$bc[false].'><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoContact").'</td></tr>'; print '<tr class="oddeven"><td class="opacitymedium">'.$langs->trans("ThisCategoryHasNoContact").'</td></tr>';
} }
print "</table>\n"; print "</table>\n";
} }
@ -608,7 +612,7 @@ if ($type == Categorie::TYPE_ACCOUNT)
{ {
print "<br>"; print "<br>";
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account")." (".count($accounts).")</td></tr>\n"; print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Account").' <span class="badge">'.count($accounts).'</span></td></tr>'."\n";
if (count($accounts) > 0) if (count($accounts) > 0)
{ {
@ -631,15 +635,16 @@ if ($type == Categorie::TYPE_ACCOUNT)
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$account->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$account->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat");
print $langs->trans("DeleteFromCat")."</a>"; print img_picto($langs->trans("DeleteFromCat"), 'unlink');
print "</a>";
} }
print "</tr>\n"; print "</tr>\n";
} }
} }
else else
{ {
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoAccount").'</td></tr>'; print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoAccount").'</td></tr>';
} }
print "</table>\n"; print "</table>\n";
} }
@ -659,7 +664,7 @@ if ($type == Categorie::TYPE_PROJECT)
{ {
print "<br>"; print "<br>";
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Project")." (".count($projects).")</td></tr>\n"; print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Project").' <span class="badge">'.count($projects).'</span></td></tr>'."\n";
if (count($projects) > 0) if (count($projects) > 0)
{ {
@ -682,15 +687,16 @@ if ($type == Categorie::TYPE_PROJECT)
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$project->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$project->id."'>";
print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat");
print $langs->trans("DeleteFromCat")."</a>"; print img_picto($langs->trans("DeleteFromCat"), 'unlink');
print "</a>";
} }
print "</tr>\n"; print "</tr>\n";
} }
} }
else else
{ {
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoProject").'</td></tr>'; print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoProject").'</td></tr>';
} }
print "</table>\n"; print "</table>\n";
} }

View File

@ -451,7 +451,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
if ($feature == 'project') $feature='projet'; if ($feature == 'project') $feature='projet';
if ($feature == 'task') $feature='projet_task'; if ($feature == 'task') $feature='projet_task';
$check = array('adherent','banque','don','user','usergroup','product','produit','service','produit|service','categorie','resource'); // Test on entity only (Objects with no link to company) $check = array('adherent','banque','don','user','usergroup','product','produit','service','produit|service','categorie','resource','expensereport','holiday'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object $checksoc = array('societe'); // Test for societe object
$checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). $checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet','project'); // Test for project object $checkproject = array('projet','project'); // Test for project object

View File

@ -45,7 +45,8 @@ $ref=GETPOST('ref', 'alpha');
$fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id); $fuserid = (GETPOST('fuserid', 'int')?GETPOST('fuserid', 'int'):$user->id);
// Protection if external user // Protection if external user
if ($user->societe_id > 0) accessforbidden(); if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'holiday', $id, 'holiday');
$now=dol_now(); $now=dol_now();

View File

@ -144,7 +144,7 @@ if ($object->id)
print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>'; print '<td>'.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')</td>';
print '<td>'.dol_print_date($object->date_debut, 'day'); print '<td>'.dol_print_date($object->date_debut, 'day');
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print $langs->trans($listhalfday[$starthalfday]); print '<span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -166,7 +166,7 @@ if ($object->id)
print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>'; print '<td>'.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')</td>';
print '<td>'.dol_print_date($object->date_fin, 'day'); print '<td>'.dol_print_date($object->date_fin, 'day');
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
print $langs->trans($listhalfday[$endhalfday]); print '<span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }