Works on canvas capability
Works on custom list add php template version
This commit is contained in:
parent
649aca796a
commit
eba07e7e47
@ -30,7 +30,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<form action="liste.php?canvas=default" method="post" name="formulaire">
|
||||
<form action="{$smarty.server.PHP_SELF}?canvas=default" method="post" name="formulaire">
|
||||
|
||||
<table class="liste" width="100%">
|
||||
|
||||
97
htdocs/product/canvas/default/templates/list.tpl.php
Normal file
97
htdocs/product/canvas/default/templates/list.tpl.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;">
|
||||
<tr>
|
||||
<td class="nobordernopadding" width="40" align="left" valign="middle">
|
||||
<?php echo $title_picto; ?>
|
||||
</td>
|
||||
<td class="nobordernopadding" valign="middle">
|
||||
<div class="titre"><?php echo $title_text; ?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"];?>?canvas=default" method="post" name="formulaire">
|
||||
|
||||
<table class="liste" width="100%">
|
||||
|
||||
<!-- FIELDS TITLE -->
|
||||
|
||||
<tr class="liste_titre">
|
||||
<?php
|
||||
foreach($fieldlist as $field) {
|
||||
if ($field['enabled']) {
|
||||
if ($field['sort']) { ?>
|
||||
<td class="liste_titre" align="<?php echo $field['align']; ?>"><?php echo $field['title']; ?>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"];?>?sortfield=p.<?php echo $field['name']; ?>&sortorder=asc&begin=&envente=&canvas=default&fourn_id=&snom=&sref=">
|
||||
<img src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/1downarrow.png" border="0" alt="A-Z" title="A-Z">
|
||||
</a>
|
||||
<a href="<?php echo $_SERVER["PHP_SELF"];?>?sortfield=p.<?php echo $field['name']; ?>&sortorder=desc&begin=&envente=&canvas=default&fourn_id=&snom=&sref=">
|
||||
<img src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/1uparrow.png" border="0" alt="Z-A" title="Z-A">
|
||||
</a>
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td class="liste_titre" align="<?php echo $field['align']; ?>"><?php echo $field['title']; ?></td>
|
||||
<?php } } } ?>
|
||||
</tr>
|
||||
|
||||
<!-- FIELDS SEARCH -->
|
||||
|
||||
<tr class="liste_titre">
|
||||
<?php
|
||||
$num = count($fieldlist);
|
||||
foreach($fieldlist as $key => $searchfield) {
|
||||
if ($searchfield['enabled']) {
|
||||
if ($searchfield['search']) { ?>
|
||||
<td class="liste_titre" align="<?php echo $field['align']; ?>"><input class="flat" type="text" name="s<?php echo $field['name']; ?>" value=""></td>
|
||||
<?php } else if ($key == $num) { ?>
|
||||
<td class="liste_titre" align="right">
|
||||
<input type="image" class="liste_titre" name="button_search" src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/search.png" alt="<?php echo $langs->trans('Search'); ?>">
|
||||
<input type="image" class="liste_titre" name="button_removefilter" src="<?php echo DOL_URL_ROOT; ?>/theme/<?php echo $conf->theme; ?>/img/searchclear.png" alt="<?php echo $langs->trans('RemoveFilter'); ?>">
|
||||
</td>
|
||||
<?php } else { ?>
|
||||
<td class="liste_titre"> </td>
|
||||
<?php } } } ?>
|
||||
</tr>
|
||||
|
||||
<!-- FIELDS DATA -->
|
||||
|
||||
<?php
|
||||
$var=True;
|
||||
foreach($datas as $line) {
|
||||
$var=!$var; ?>
|
||||
<tr class="<?php echo $bc[$var];?>">
|
||||
<?php
|
||||
foreach($line as $key => $value) {
|
||||
foreach($fieldlist as $field) {
|
||||
if ($field['alias'] == $key) { ?>
|
||||
<td align="<?php echo $field['align']; ?>"><?php echo $value; ?></td>
|
||||
<?php } } } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -230,44 +230,59 @@ if ($resql)
|
||||
|
||||
if ($_GET["canvas"] <> '' && file_exists('canvas/'.$_GET["canvas"].'/product.'.$_GET["canvas"].'.class.php'))
|
||||
{
|
||||
$smarty->assign('fieldlist', $object->field_list);
|
||||
$smarty->assign('datas', $object->list_datas);
|
||||
$smarty->assign('url_root', $dolibarr_main_url_root);
|
||||
$smarty->assign('theme', $conf->theme);
|
||||
$smarty->assign('langs', $langs);
|
||||
$fieldlist = $object->field_list;
|
||||
$datas = $object->list_datas;
|
||||
$picto='title.png';
|
||||
if (empty($conf->browser->firefox)) $picto='title.gif';
|
||||
$smarty->assign('title_picto', img_picto('',$picto));
|
||||
$smarty->assign('title_text', $title);
|
||||
|
||||
$title_picto = img_picto('',$picto);
|
||||
$title_text = $title;
|
||||
|
||||
// Check if a custom template is present
|
||||
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/liste.tpl'))
|
||||
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/list.tpl'))
|
||||
{
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/';
|
||||
$template = 'liste.tpl';
|
||||
$template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/';
|
||||
$template = 'list.tpl';
|
||||
}
|
||||
// Check if a default template is present
|
||||
else if (file_exists(DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/liste.tpl'))
|
||||
else if (file_exists(DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/list.tpl'))
|
||||
{
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/';
|
||||
$template = 'liste.tpl';
|
||||
$template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/templates/';
|
||||
$template = 'list.tpl';
|
||||
}
|
||||
// Error template
|
||||
else
|
||||
{
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/core/templates/';
|
||||
$template_dir = DOL_DOCUMENT_ROOT . '/core/templates/';
|
||||
$template = 'error.tpl';
|
||||
}
|
||||
|
||||
// Enable caching
|
||||
//$smarty->caching = true;
|
||||
|
||||
//$smarty->debugging = true;
|
||||
|
||||
$smarty->display($template, $_GET["canvas"]);
|
||||
|
||||
// Suppression de la version compilee
|
||||
$smarty->clear_compiled_tpl($template);
|
||||
// START SMARTY
|
||||
if ($conf->global->MAIN_SMARTY)
|
||||
{
|
||||
$smarty->template_dir = $template_dir;
|
||||
|
||||
$smarty->assign('fieldlist', $fieldlist);
|
||||
$smarty->assign('datas', $datas);
|
||||
$smarty->assign('url_root', $dolibarr_main_url_root);
|
||||
$smarty->assign('theme', $conf->theme);
|
||||
$smarty->assign('langs', $langs);
|
||||
$smarty->assign('title_picto', $title_picto);
|
||||
$smarty->assign('title_text', $title_text);
|
||||
|
||||
// Enable caching
|
||||
//$smarty->caching = true;
|
||||
|
||||
//$smarty->debugging = true;
|
||||
|
||||
$smarty->display($template, $_GET["canvas"]);
|
||||
|
||||
// Suppression de la version compilee
|
||||
$smarty->clear_compiled_tpl($template);
|
||||
}
|
||||
else
|
||||
{
|
||||
include($template_dir.'list.tpl.php'); // To use native PHP
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user