function _list(&$PDOdb)
{
    global $langs, $conf, $user, $db;
    llxHeader();
    dol_fiche_head(array(), 'menu', 'Menu');
    $l = new TListviewTBS('lMenu');
    $sql = "SELECT rowid,title, type_menu, tab_object, mainmenu,leftmenu,date_cre \n\tFROM " . MAIN_DB_PREFIX . "query_menu \n\tWHERE entity IN (0," . $conf->entity . ")";
    $menu_static = new TQueryMenu();
    echo $l->render($PDOdb, $sql, array('title' => array('title' => $langs->trans('Title'), 'leftmenu' => $langs->trans('LeftMenu'), 'mainmenu' => $langs->trans('MainMenu'), 'date_cre' => $langs->trans('Date'), 'tab_object' => $langs->trans('TabsObject'), 'type_menu' => $langs->trans('TypeMenu')), 'translate' => array('tab_object' => $menu_static->TTabObject, 'type_menu' => $menu_static->TTypeMenu), 'link' => array('title' => '<a href="?id=@rowid@&action=edit">@val@</a>'), 'hide' => array('rowid'), 'type' => array('date_cre' => 'date')));
    /*$kiwi = new TKiwi;
    	$kiwi->fk_soc = $object->id;
    	$kiwi->fk_product = 1;
    	$kiwi->save($PDOdb);
    	*/
    // pied de page
    dol_fiche_end();
    llxFooter();
}
function _list(&$PDOdb)
{
    global $langs, $conf, $user, $db;
    llxHeader();
    $url = 'lib/adminer/?';
    //TODO genrate read profile
    /*
    $url.='&server='.$dolibarr_main_db_host;
    $url.='&db='.$dolibarr_main_db_name;
    $url.='&username='******'&password='******'&driver='.$dolibarr_main_db_type;
    */
    ?>
	
	<a href="<?php 
    echo $url;
    ?>
" class="butAction" target="_blank">Accès à la base de données</a>
	
<?php 
    if (!empty($user->rights->query->bdd->use_other_db)) {
        dol_fiche_head(array(), 'bdd', 'BDD');
        $l = new TListviewTBS('lMenu');
        $sql = "SELECT rowid, host, db_name,login,port,charset, '' as 'alive'\n\tFROM " . MAIN_DB_PREFIX . "query_bdd_connector \n\tWHERE entity IN (0," . $conf->entity . ")";
        echo $l->render($PDOdb, $sql, array('title' => array('host' => $langs->trans('Host'), 'db_name' => $langs->trans('DBName'), 'port' => $langs->trans('Port'), 'charset' => $langs->trans('Charset'), 'login' => $langs->trans('Login'), 'alive' => $langs->trans('Alive')), 'link' => array('host' => '<a href="?id=@rowid@&action=edit">@val@</a>'), 'hide' => array('rowid'), 'type' => array('date_cre' => 'date'), 'eval' => array('alive' => '_test_alive(@rowid@)')));
        /*$kiwi = new TKiwi;
        	$kiwi->fk_soc = $object->id;
        	$kiwi->fk_product = 1;
        	$kiwi->save($PDOdb);
        	*/
        // pied de page
        dol_fiche_end();
    }
    llxFooter();
}
Example #3
0
 *  View
 */
$form = new Form($db);
llxHeader('', $langs->trans("LoanArea") . ' - ' . $langs->trans("Notes"), '');
if ($id > 0) {
    /*
     * Affichage onglets
     */
    $head = loan_prepare_head($object);
    dol_fiche_head($head, 'note', $langs->trans("Loan"), 0, 'loan');
    print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">';
    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
    print '<table class="border" width="100%">';
    // Ref
    print '<tr><td width="25%">' . $langs->trans('Ref') . '</td>';
    print '<td colspan="3">';
    print $form->showrefnav($object, 'id', '', '', 'rowid', 'ref');
    print '</td></tr>';
    // Name
    print '<tr><td width="20%">' . $langs->trans("Name") . '</td>';
    print '<td colspan="3">' . $object->label . '</td></tr>';
    print "</table>";
    print '<br>';
    $colwidth = '25';
    $permission = $user->rights->loan->write;
    // Used by the include of notes.tpl.php
    include DOL_DOCUMENT_ROOT . '/core/tpl/notes.tpl.php';
    dol_fiche_end();
}
llxFooter();
$db->close();
Example #4
0
print '<td>' . $langs->trans("Subscriptions") . '</td>';
print '<td align="right">' . $langs->trans("Number") . '</td>';
print '<td align="right">' . $langs->trans("AmountTotal") . '</td>';
print '<td align="right">' . $langs->trans("AmountAverage") . '</td>';
print "</tr>\n";
$var = true;
krsort($Total);
foreach ($Total as $key => $value) {
    $var = !$var;
    print "<tr {$bc[$var]}>";
    print "<td><a href=\"adherent/cotisations.php?date_select={$key}\">{$key}</a></td>";
    print "<td align=\"right\">" . $Number[$key] . "</td>";
    print "<td align=\"right\">" . price($value) . "</td>";
    print "<td align=\"right\">" . price(price2num($value / $Number[$key], 'MT')) . "</td>";
    $numb += $Number[$key];
    $tot += $value;
    print "</tr>\n";
}
// Total
print '<tr class="liste_total">';
print '<td>' . $langs->trans("Total") . '</td>';
print "<td align=\"right\">" . $numb . "</td>";
print '<td align="right">' . price($tot) . "</td>";
print "<td align=\"right\">" . price(price2num($numb > 0 ? $tot / $numb : 0, 'MT')) . "</td>";
print "</tr>\n";
print "</table><br>\n";
print '</td></tr>';
print '</table>';
print dol_fiche_end();
llxFooter();
$db->close();
Example #5
0
/**
*	Show header of a VAT report
*
*	@param		string				$nom            Name of report
*	@param 	string				$variante       Link for alternate report
*	@param 	string				$period         Period of report
*	@param 	string				$periodlink     Link to switch period
*	@param 	string				$description    Description
*	@param 	timestamp|integer	$builddate      Date generation
*	@param 	string				$exportlink     Link for export or ''
*	@param		array				$moreparam		Array with list of params to add into form
*	@param		string				$calcmode		Calculation mode
*    @param     string              $varlink        Add a variable into the address of the page
*	@return	void
*/
function report_header($nom, $variante, $period, $periodlink, $description, $builddate, $exportlink = '', $moreparam = array(), $calcmode = '', $varlink = '')
{
    global $langs;
    if (empty($hselected)) {
        $hselected = 'report';
    }
    print "\n\n<!-- debut cartouche rapport -->\n";
    if (!empty($varlink)) {
        $varlink = '?' . $varlink;
    }
    $h = 0;
    $head[$h][0] = $_SERVER["PHP_SELF"] . $varlink;
    $head[$h][1] = $langs->trans("Report");
    $head[$h][2] = 'report';
    dol_fiche_head($head, 'report');
    print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . $varlink . '">';
    foreach ($moreparam as $key => $value) {
        print '<input type="hidden" name="' . $key . '" value="' . $value . '">';
    }
    print '<table width="100%" class="border">';
    // Ligne de titre
    print '<tr>';
    print '<td width="110">' . $langs->trans("ReportName") . '</td>';
    if (!$variantexxx) {
        print '<td colspan="3">';
    } else {
        print '<td>';
    }
    print $nom;
    if ($variantexxx) {
        print '</td><td colspan="2">' . $variantexxx;
    }
    print '</td>';
    print '</tr>';
    // Calculation mode
    if ($calcmode) {
        print '<tr>';
        print '<td width="110">' . $langs->trans("CalculationMode") . '</td>';
        if (!$variante) {
            print '<td colspan="3">';
        } else {
            print '<td>';
        }
        print $calcmode;
        if ($variante) {
            print '</td><td colspan="2">' . $variante;
        }
        print '</td>';
        print '</tr>';
    }
    // Ligne de la periode d'analyse du rapport
    print '<tr>';
    print '<td>' . $langs->trans("ReportPeriod") . '</td>';
    if (!$periodlink) {
        print '<td colspan="3">';
    } else {
        print '<td>';
    }
    if ($period) {
        print $period;
    }
    if ($periodlink) {
        print '</td><td colspan="2">' . $periodlink;
    }
    print '</td>';
    print '</tr>';
    // Ligne de description
    print '<tr>';
    print '<td>' . $langs->trans("ReportDescription") . '</td>';
    print '<td colspan="3">' . $description . '</td>';
    print '</tr>';
    // Ligne d'export
    print '<tr>';
    print '<td>' . $langs->trans("GeneratedOn") . '</td>';
    if (!$exportlink) {
        print '<td colspan="3">';
    } else {
        print '<td>';
    }
    print dol_print_date($builddate);
    if ($exportlink) {
        print '</td><td>' . $langs->trans("Export") . '</td><td>' . $exportlink;
    }
    print '</td></tr>';
    print '<tr>';
    print '<td colspan="4" align="center"><input type="submit" class="button" name="submit" value="' . $langs->trans("Refresh") . '"></td>';
    print '</tr>';
    print '</table>';
    print '</form>';
    dol_fiche_end();
    print "\n<!-- fin cartouche rapport -->\n\n";
}
Example #6
0
		</tr>
	</table>
	</td>
	<td colspan="3"><?php echo $this->control->tpl['sales_representatives'];	?></td>
</tr>

<?php if ($conf->adherent->enabled) { ?>
<tr>
	<td width="25%" valign="top"><?php echo $langs->trans("LinkedToDolibarrMember"); ?></td>
	<td colspan="3"><?php echo $this->control->tpl['linked_member']; ?></td>
</tr>
<?php } ?>

</table>

<?php dol_fiche_end(); ?>

<div class="tabsAction">
<?php if ($user->rights->societe->creer) { ?>
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas; ?>"><?php echo $langs->trans("Modify"); ?></a>
<?php } ?>

<?php if ($user->rights->societe->supprimer) { ?>
	<?php if ($conf->use_javascript_ajax) { ?>
		<span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span>
	<?php }	else { ?>
		<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
	<?php } ?>
<?php } ?>
</div>
function _fiche(&$PDOdb, $id)
{
    global $conf, $db, $langs, $user, $form;
    $object = new Categorie($db);
    $result = $object->fetch($id);
    $object->fetch_optionals($id, $extralabels);
    if ($result <= 0) {
        dol_print_error($db, $object->error);
        exit;
    }
    llxHeader("", "", $langs->trans("Categories"));
    $title = $langs->trans("CustomersCategoryShort");
    $head = categories_prepare_head($object, Categorie::TYPE_CUSTOMER);
    dol_fiche_head($head, 'commercial', $title, 0, 'category');
    print '<table class="border" width="100%">';
    print '<tr><td width="20%" class="notopnoleft">';
    $ways = $object->print_all_ways();
    print $langs->trans("Ref") . '</td><td>';
    print '<a href="' . DOL_URL_ROOT . '/categories/index.php?leftmenu=cat&type=' . $type . '">' . $langs->trans("Root") . '</a> >> ';
    foreach ($ways as $way) {
        print $way . "<br>\n";
    }
    print '</td></tr>';
    // Description
    print '<tr><td width="20%" class="notopnoleft">';
    print $langs->trans("Description") . '</td><td>';
    print dol_htmlentitiesbr($object->description);
    print '</td></tr>';
    print '<tr><td>' . $langs->trans("SalesRepresentatives") . '</td>';
    print '<td>';
    $TUser = TCommercialCategory::getUser($PDOdb, $object->id);
    if (!empty($TUser)) {
        foreach ($TUser as &$u) {
            echo $u->getNomUrl(1);
            if ($user->rights->societe->creer) {
                print '<a href="?id=' . $object->id . '&commid=' . $u->id . '&action=delete">';
                print img_delete();
                print '</a>';
            }
            print '<br />';
        }
    }
    print '</td></tr>';
    print '</table>';
    dol_fiche_end();
    if ($user->rights->societe->creer && $user->rights->societe->client->voir) {
        /*
         * Copier... Coller... Jobi... Joba...
         */
        $langs->load("users");
        $title = $langs->trans("ListOfUsers");
        $sql = "SELECT u.rowid, u.lastname, u.firstname, u.login";
        $sql .= " FROM " . MAIN_DB_PREFIX . "user as u LEFT JOIN " . MAIN_DB_PREFIX . "commercial_category cc ON (cc.fk_user = u .rowid AND cc.fk_category=" . $object->id . ")";
        $sql .= " WHERE u.entity IN (0," . $conf->entity . ")";
        if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) {
            $sql .= " AND u.statut<>0 ";
        }
        $sql .= " AND cc.rowid IS NULL ";
        $sql .= " ORDER BY u.lastname ASC ";
        //var_dump($sql);
        $resql = $db->query($sql);
        if ($resql) {
            $num = $db->num_rows($resql);
            $i = 0;
            print load_fiche_titre($title);
            // Lignes des titres
            print '<table class="noborder" width="100%">';
            print '<tr class="liste_titre">';
            print '<td>' . $langs->trans("Name") . '</td>';
            print '<td>' . $langs->trans("Login") . '</td>';
            print '<td>&nbsp;</td>';
            print "</tr>\n";
            $var = True;
            while ($i < $num) {
                $obj = $db->fetch_object($resql);
                $var = !$var;
                print "<tr " . $bc[$var] . "><td>";
                print '<a href="' . DOL_URL_ROOT . '/user/card.php?id=' . $obj->rowid . '">';
                print img_object($langs->trans("ShowUser"), "user") . ' ';
                print dolGetFirstLastname($obj->firstname, $obj->lastname) . "\n";
                print '</a>';
                print '</td><td>' . $obj->login . '</td>';
                print '<td><a href="?id=' . $object->id . '&commid=' . $obj->rowid . '&action=add">' . $langs->trans("Add") . '</a></td>';
                print '</tr>' . "\n";
                $i++;
            }
            print "</table>";
            $db->free($resql);
        } else {
            dol_print_error($db);
        }
    }
    llxFooter();
}
function fiche(&$dashboard, $action = 'edit', $withHeader = true)
{
    global $langs, $conf, $user, $db;
    $PDOdb = new TPDOdb();
    $form = new TFormCore();
    $cell_height = 200;
    $tab_object = GETPOST('tab_object');
    $table_element = GETPOST('table_element');
    $fk_object = GETPOST('fk_object');
    if (empty($table_element)) {
        if ($tab_object == 'thirdparty') {
            $table_element = 'societe';
        } else {
            if ($tab_object == 'project') {
                $table_element = 'projet';
            } else {
                $table_element = $tab_object;
            }
        }
    }
    if ($withHeader) {
        llxHeader('', 'Query DashBoard', '', '', 0, 0, array('/query/js/dashboard.js', '/query/js/jquery.gridster.min.js'), array('/query/css/dashboard.css', '/query/css/jquery.gridster.min.css'));
        $head = TQueryMenu::getHeadForObject($tab_object, $fk_object);
        dol_fiche_head($head, 'tabQuery' . GETPOST('menuId'), 'Query');
        print_fiche_titre($dashboard->title);
    } else {
        if (GETPOST('for_incusion') > 0) {
            ?>
		<div class="querydashboard">
			<link rel="stylesheet" type="text/css" title="default" href="<?php 
            echo dol_buildpath('/query/css/dashboard.css', 1);
            ?>
">
			<link rel="stylesheet" type="text/css" title="default" href="<?php 
            echo dol_buildpath('/query/css/jquery.gridster.min.css', 1);
            ?>
">
			<script type="text/javascript" src="<?php 
            echo dol_buildpath('/query/js/dashboard.js', 1);
            ?>
"></script>
			<script type="text/javascript" src="<?php 
            echo dol_buildpath('/query/js/jquery.gridster.min.js', 1);
            ?>
"></script>

		<?php 
        } else {
            ?>
<html>
			<head>
				<meta charset="UTF-8">
				<link rel="stylesheet" type="text/css" href="<?php 
            echo dol_buildpath('/theme/eldy/style.css.php?lang=fr_FR&theme=eldy', 1);
            ?>
">
				<link rel="stylesheet" type="text/css" title="default" href="<?php 
            echo dol_buildpath('/query/css/dashboard.css', 1);
            ?>
">
				<link rel="stylesheet" type="text/css" title="default" href="<?php 
            echo dol_buildpath('/query/css/jquery.gridster.min.css', 1);
            ?>
">

				<script type="text/javascript" src="<?php 
            echo dol_buildpath('/includes/jquery/js/jquery.min.js', 1);
            ?>
"></script>
				<script type="text/javascript" src="<?php 
            echo dol_buildpath('/query/js/dashboard.js', 1);
            ?>
"></script>
				<script type="text/javascript" src="<?php 
            echo dol_buildpath('/query/js/jquery.gridster.min.js', 1);
            ?>
"></script>
				<style type="text/css">
					.pagination { display : none; }
					<?php 
            if ((int) GETPOST('allow_gen') != 1) {
                echo '.notInGeneration { display : none; }';
            }
            ?>

					table.liste tr.impair,table.liste tr.pair,table.liste tr.liste_titre,div.titre {
						font-size: 12px;
					}
				</style>
			</head>
		<body >
		<?php 
        }
    }
    ?>
	<script type="text/javascript">
		var MODQUERY_INTERFACE = "<?php 
    echo dol_buildpath('/query/script/interface.php', 1);
    ?>
";
		
		$(document).ready(function(){ //DOM Ready
			
			gridster_width = Math.round($('.gridster').innerWidth() / 5);
			if(gridster_width<50) gridster_width = 240;
			
		    $(".gridster ul").gridster({
		        widget_margins: [10, 10]
		        ,widget_base_dimensions: [gridster_width, <?php 
    echo $cell_height;
    ?>
]
		        ,min_cols:3
		        ,min_rows:5
		        ,serialize_params: function($w, wgd) { 
		        	return { posx: wgd.col, posy: wgd.row, width: wgd.size_x, height: wgd.size_y, k : $w.attr('data-k') } 
		        }
		        <?php 
    if ($action == 'edit') {
        ?>
,resize: {
		            enabled: true
		            ,max_size: [4, 4]
		            ,min_size: [1, 1]
		        }
		        
		       
		       <?php 
    }
    ?>
		    })<?php 
    if ($action == 'view') {
        echo '.data(\'gridster\').disable()';
    }
    ?>
;
		
			var gridster = $(".gridster ul").gridster().data('gridster');
		
			$('#addQuery').click(function() {
				
				var fk_query = $('select[name=fk_query]').val();
				
				$.ajax({
					url: MODQUERY_INTERFACE
					,data: {
						put:'dashboard-query'
						,fk_query : fk_query
						,fk_qdashboard:<?php 
    echo $dashboard->getId();
    ?>
					}
					,dataType:'json'
					
				}).done(function(data) {
					
					var title = $('select[name=fk_query] option:selected').text();
					
					gridster.add_widget('<li data-k="'+data+'">'+title+'</li>',1,1,1,1);	
				});
				
			});
			
			$('#saveDashboard').click(function() {
				
				var $button = $(this);
				
				$button.hide();
				
				$.ajax({
					url: MODQUERY_INTERFACE
					,data: {
						put:'dashboard'
						,id:<?php 
    echo $dashboard->getId();
    ?>
						,title:$('input[name=title]').val()
						,fk_usergroup:$('select[name=fk_usergroup]').val()
						,send_by_mail:$('select[name=send_by_mail]').val()
						,hook:$('select[name=hook]').val()
						,use_as_landing_page:$('select[name=use_as_landing_page]').val()
						,refresh_dashboard:$('input[name=refresh_dashboard]').val()
					}
					
				}).done(function(data) {
				   <?php 
    if ($dashboard->getId() > 0) {
        ?>
$.ajax({
							url: MODQUERY_INTERFACE
							,data: {
								put:'dashboard-query-link'
								,TCoord:gridster.serialize( )
								,fk_qdashboard:<?php 
        echo $dashboard->getId();
        ?>
							}
							,dataType:'json'
							
					  }).done(function(data) {
					  	$button.show();
					  });
						
						<?php 
    } else {
        echo 'document.location.href="?action=view&id="+data;';
    }
    ?>
					  	
		              
				});
				
			});
		
		});
		
		function delTile(idTile) {
			$('li[tile-id='+idTile+']').css('opacity',.5);
			
			$.ajax({
				url: MODQUERY_INTERFACE
				,data: {
					put:'dashboard-query-remove'
					,id : idTile
				}
				,dataType:'json'
				
			}).done(function(data) {
				$('li[tile-id='+idTile+']').toggle();
				//document.location.hre
			});
			
		}
			
	</script>
	<?php 
    if ($action == 'edit') {
        ?>
<div><?php 
        $TQuery = TQuery::getQueries($PDOdb);
        echo $form->texte($langs->trans('Title'), 'title', $dashboard->title, 50, 255);
        $formDoli = new Form($db);
        echo ' - ' . $langs->trans('LimitAccessToThisGroup') . ' : ' . $formDoli->select_dolgroups($dashboard->fk_usergroup, 'fk_usergroup', 1) . '/' . $langs->trans('UseAsLandingPage') . $formDoli->selectarray('use_as_landing_page', array($langs->trans('No'), $langs->trans('Yes')), $dashboard->use_as_landing_page);
        echo $form->combo(' - ' . $langs->trans('SendByMailToThisGroup'), 'send_by_mail', $dashboard->TSendByMail, $dashboard->send_by_mail);
        echo $form->combo(' - ' . $langs->trans('ShowThisInCard'), 'hook', $dashboard->THook, $dashboard->hook);
        echo $form->number('<br />' . $langs->trans('RefreshDashboard'), 'refresh_dashboard', $dashboard->refresh_dashboard, 20, 1, 0);
        ?>
			<a href="#" class="butAction" id="saveDashboard"><?php 
        echo $langs->trans('SaveDashboard');
        ?>
</a>
		</div>
		<?php 
        if ($dashboard->getId() > 0) {
            ?>
		<div>
			<?php 
            $TQuery = TQuery::getQueries($PDOdb);
            echo $form->combo('', 'fk_query', $TQuery, 0);
            ?>
			<a href="#" class="butAction" id="addQuery"><?php 
            echo $langs->trans('AddThisQuery');
            ?>
</a>
		</div>
		
		<?php 
        }
    } else {
        if (!empty($conf->global->QUERY_SHOW_PDF_TRANSFORM)) {
            echo '<div style="text-align:right" class="notInGeneration"><a class="butAction" style=";z-index:999;" href="download-dashboard.php?uid=' . $dashboard->uid . '">' . $langs->trans('Download') . '</a></div>';
        }
    }
    ?>
		
	
	<div class="gridster">
	    <ul>
	    	<?php 
    foreach ($dashboard->TQDashBoardQuery as $k => &$cell) {
        echo '<li tile-id="' . $cell->getId() . '" data-k="' . $k . '" data-row="' . $cell->posy . '" data-col="' . $cell->posx . '" data-sizex="' . $cell->width . '" data-sizey="' . $cell->height . '" ' . ($withHeader ? '' : 'style="overflow:hidden;"') . '>';
        if ($action == 'edit') {
            echo '<a style="position:absolute; top:3px; right:3px; z-index:999;" href="javascript:delTile(' . $cell->getId() . ')">' . img_delete('DeleteThisTile') . '</a>';
        } else {
            echo '<a style="position:absolute; top:3px; right:3px; z-index:999;" href="' . dol_buildpath('/query/query.php?action=run-in&id=' . $cell->query->getId(), 1) . '">' . img_picto($langs->trans('Run'), 'object_cron.png') . '</a>';
        }
        if ($cell->query->type == 'LIST') {
            $cell->query->type = 'SIMPLELIST';
        }
        if (!empty($cell->query)) {
            if (!$withHeader) {
                echo $cell->query->run(false, $cell->height * $cell_height, $table_element, $fk_object, 0);
            } else {
                echo $cell->query->run(false, $cell->height * $cell_height, $table_element, $fk_object);
            }
        }
        echo '</li>';
    }
    ?>
	        
	
	    </ul>
	</div>
	
	<div style="clear:both"></div>

	<?php 
    if ($dashboard->refresh_dashboard > 0 && !$withHeader) {
        echo "<script type=\"text/javascript\">\n";
        echo "   // Automatically refresh\n";
        echo "   setInterval(\"window.location.reload()\"," . 60000 * $dashboard->refresh_dashboard . ");\n";
        echo "</script>\n";
    }
    ?>
	
	<?php 
    if ($withHeader) {
        if ($dashboard->getId() > 0) {
            print dol_buildpath('/query/dashboard.php?action=run&uid=' . $dashboard->uid, 2);
        }
        dol_fiche_end();
        llxFooter();
    } else {
        if (GETPOST('for_incusion') > 0) {
            ?>
</div><?php 
        } else {
            ?>
		</body></html>
		<?php 
        }
    }
}
Example #9
0
    print $langs->trans('ResourceFormLabel_' . $field);
    print '</td>';
    print '<td>';
    print '<input type="text" name="' . $field . '" value="' . ${$field} . '" />';
    print '</td>';
    print '</tr>';
    // Type
    print '<tr><td width="20%">' . $langs->trans("ResourceType") . '</td>';
    print '<td>';
    $ret = $formresource->select_types_resource($object->fk_code_type_resource, 'fk_code_type_resource', '', 2);
    print '</td></tr>';
    // Description
    $field = 'description';
    print '<tr>';
    print '<td class="tdtop">';
    print $langs->trans('ResourceFormLabel_' . $field);
    print '</td>';
    print '<td>';
    require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
    $doleditor = new DolEditor($field, ${$field}, 160, '', '', false);
    $doleditor->Create();
    print '</td>';
    print '</tr>';
    print '</table>';
    dol_fiche_end('');
    echo '<div align="center">', '<input type="submit" class="button" name="add" value="' . $langs->trans('Save') . '" />', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" />', '</div>';
    print '</form>';
}
// End of page
llxFooter();
$db->close();
function fiche_import(&$object, $error)
{
    global $langs, $user;
    $origin = GETPOST('origin');
    $head = null;
    if ($origin == 'propal') {
        $head = propal_prepare_head($object);
    } else {
        $head = commande_prepare_head($object);
    }
    if (empty($user->rights->importdevis->myactions)) {
        accessforbidden();
    } else {
        llxHeader();
        $title = $langs->trans('Import');
        if ($origin == 'propal') {
            dol_fiche_head($head, 'importdevis', $title, 0, 'propal');
        } else {
            dol_fiche_head($head, 'importdevis', $title, 0, 'commande');
        }
        ?>
		
		<table width="100%" class="border">
			<tr>
				<td width="25%"><?php 
        echo $langs->trans('Ref');
        ?>
</td>
				<td colspan="3"><div style="vertical-align: middle"><div class="inline-block floatleft refid"><?php 
        echo $object->ref;
        ?>
</div></div></td>
			</tr>
			<tr>
				<td><?php 
        echo $langs->trans('Company');
        ?>
</td>
				<td colspan="3"><?php 
        echo $object->thirdparty->getNomUrl(1);
        ?>
</td>
			</tr>
			<?php 
        if (!$error) {
            ?>
			<tr>
				<td><?php 
            echo $langs->trans('FileToImport');
            ?>
</td>
				<td>
					<form action="<?php 
            echo $_SERVER['PHP_SELF'];
            ?>
" method="POST" enctype="multipart/form-data">
						<input name="action" type="hidden" value="send_file" />
						<input name="id" type="hidden" value="<?php 
            echo $object->id;
            ?>
" />
						<input name="origin" type="hidden" value="<?php 
            echo $origin;
            ?>
"/>
						<input name="token" type="hidden" value="<?php 
            echo $_SESSION['newtoken'];
            ?>
" />
						
						<input name="fileDGPF" type="file" />
						<?php 
            echo $langs->trans('NbLineToAvoid');
            ?>
 <input name="nb_line_to_avoid" type="number" value="<?php 
            echo (int) $conf->global->IMPORTPROPAL_NB_LINE_TO_AVOID;
            ?>
" size="2" />
						
						<input class="button" type="submit" value="<?php 
            echo $langs->trans('SendFile');
            ?>
" />
					</form>
				</td>
			</tr>
			<?php 
        }
        ?>
		</table>
	    	
    	<?php 
        dol_fiche_end();
        llxFooter();
    }
}
function fiche(&$query)
{
    global $langs, $conf, $user;
    llxHeader('', 'Query', '', '', 0, 0, array('/query/js/query.js'), array('/query/css/query.css'));
    dol_fiche_head($query->title);
    if ($query->expert == 1) {
        if (!empty($query->sql_fields)) {
            $TField = explode_brackets($query->sql_fields);
            $query->TField = $TField;
        }
    }
    ?>
	<script type="text/javascript">
		var MODQUERY_INTERFACE = "<?php 
    echo dol_buildpath('/query/script/interface.php', 1);
    ?>
";
		var MODQUERY_QUERYID = <?php 
    echo $query->getId();
    ?>
;
		var MODQUERY_EXPERT = <?php 
    echo (int) $query->expert;
    ?>
;
		var MODQUERY_PREFIX = "<?php 
    echo MAIN_DB_PREFIX;
    ?>
";
		
		var select_equal = '<select sql-act="operator"> '
					+ '<option value=""> </option>'
					
					+ '<option value="LIKE">LIKE</option>'
					/*+ '<option value="=">=</option>'*/
					+ '<option value="!=">!=</option>'
					+ '<option value="&lt;">&lt;</option>'
					+ '<option value="&lt;=">&lt;=</option>'
					+ '<option value="&gt;">&gt;</option>'
					+ '<option value="&gt;=">&gt;=</option>'
					+ '<option value="IN">IN</option>'
					+ '</select>';
					
		var select_mode	= '<select sql-act="mode"> '
					+ '<option value="value">valeur</option>'
					+ '<option value="var">variable</option>'
					+ '<option value="function">fonction</option>'
					+ '</select> <input type="text" value="" sql-act="value" />';
			
		var select_null	= '<select sql-act="null"> '
					+ '<option value=""></option>'
					+ '<option value="1"><?php 
    echo $langs->transnoentities('YesAllowTestOnNull');
    ?>
</option>'
					+ '</select>';
			
		var select_order	= '<select sql-act="order"> '
					+ '<option value=""> </option>'
					+ '<option value="ASC">Ascendant</option>'
					+ '<option value="DESC">Descendant</option>'
					+ '</select>';
			
		var select_filter	= '<select sql-act="filter"> '
					+ '<option value="">Libre</option>'
					+ '<option value="calendar">Date</option>'
					+ '<option value="calendars">Dates</option>'
					+ '</select>';
			
		
			
		var select_hide	= '<select sql-act="hide"> '
					+ '<option value=""> </option>'
					+ '<option value="1"><?php 
    echo $langs->trans('Hidden');
    ?>
</option>'
					+ '</select>';
			
		var select_group	= '<select sql-act="group"> '
					+ '<option value=""> </option>'
					+ '<option value="1">Groupé</option>'
					+ '</select>';
		
		var select_total	= '<select sql-act="total"> '
					+ '<option value=""> </option>'
					+ '<option value="sum"><?php 
    echo $langs->trans('Total');
    ?>
</option>'
					+ '<option value="groupsum"><?php 
    echo $langs->trans('TotalGroup');
    ?>
</option>'
					+ '<option value="average"><?php 
    echo $langs->trans('Average');
    ?>
</option>'
					+ '<option value="count"><?php 
    echo $langs->trans('CountOf');
    ?>
</option>'
					+ '</select>';
					
		var select_total_group_field = '<select sql-act="field-total-group">'
						<?php 
    foreach ($query->TField as $field) {
        echo ' + \'<option value="' . _getFieldName($field) . '">' . _getFieldName($field) . '</option>\' ';
    }
    ?>
						+'</select>';
			
		var select_type	= '<select sql-act="type"> '
					+ '<option value=""> </option>'
					+ '<option value="number">Nombre</option>'
					+ '<option value="integer">Entier</option>'
					+ '<option value="datetime">Date/Heure</option>'
					+ '<option value="date">Date</option>'
					+ '<option value="hour">Heure</option>'
					+ '</select>';
					
		var select_function	= '<input type="text" size="10" sql-act="function" value="" placeholder="<?php 
    echo $langs->trans('FunctionToApply');
    ?>
" /><select sql-act="function-select"> '
					+ '<option value=""> </option>'
					+ '<option value="SUM(@field@)"><?php 
    echo $langs->trans('Sum');
    ?>
</option>'
					+ '<option value="ROUND(@field@,2)"><?php 
    echo $langs->trans('Round2dec');
    ?>
</option>'
					+ '<option value="COUNT(@field@)"><?php 
    echo $langs->trans('CountOf');
    ?>
</option>'
					+ '<option value="MIN(@field@)"><?php 
    echo $langs->trans('Minimum');
    ?>
</option>'
					+ '<option value="MAX(@field@)"><?php 
    echo $langs->trans('Maximum');
    ?>
</option>'
					+ '<option value="MONTH(@field@)"><?php 
    echo $langs->trans('Month');
    ?>
</option>'
					+ '<option value="YEAR"><?php 
    echo $langs->trans('Year');
    ?>
</option>'
					+ '<option value="DATE_FORMAT(@field@, \'%m/%Y\')"><?php 
    echo $langs->trans('YearMonth');
    ?>
</option>'
					//+ '<option value="FROM_UNIXTIME(@field@,\'%H:%i\')">Timestamp</option>'
					+ '<option value="SEC_TO_TIME(@field@)"><?php 
    echo $langs->trans('Timestamp');
    ?>
</option>'
					//+ '<option value="(@field@ / 3600)">/ 3600</option>'
					+ '</select>';
		
		var select_class = '<input type="text" size="10" sql-act="class" value="" placeholder="<?php 
    echo $langs->trans('Classname');
    ?>
" /><select sql-act="class-select"> '
						+ '<option value=""> </option>'

			<?php 
    foreach ($query->TClassName as $class => $label) {
        echo ' +\'<option value="' . $class . '">' . $label . '</option>\'';
    }
    ?>
			+ '</select>';

		var select_method = '<input type="text" size="10" sql-act="class-method" value="" placeholder="<?php 
    echo $langs->trans('Method');
    ?>
" /><select sql-act="class-method-select"> '
						+ '<option value=""> </option>'

			<?php 
    if (!empty($query->TMethodName)) {
        foreach ($query->TMethodName as $method => $label) {
            echo ' +\'<option value="' . $method . '">' . $label . '</option>\'';
        }
    }
    ?>
			+ '</select>';
		
		function _init_query() {
			
			<?php 
    if ($query->getId() > 0) {
        if ($query->expert == 2) {
            echo 'showQueryPreview(' . $query->getId() . ');';
            init_js($query);
        } else {
            if ($query->expert == 1) {
                echo 'showQueryPreview(' . $query->getId() . ');';
                if (!empty($query->TField)) {
                    foreach ($query->TField as $field) {
                        list($f, $t) = _getFieldAndTableName($field);
                        if (!empty($t)) {
                            $field = $t . '.' . $f;
                        } else {
                            $field = $f;
                        }
                        echo ' refresh_field_param("' . $field . '","' . $t . '"); ';
                    }
                }
                init_js($query);
            } else {
                foreach ($query->TTable as $table) {
                    echo 'addTable("' . $table . '"); ';
                }
                if (empty($query->TField) && !empty($query->sql_fields)) {
                    $query->TField = explode(',', $query->sql_fields);
                }
                //$TField =
                if (!empty($query->TField)) {
                    foreach ($query->TField as $field) {
                        echo ' checkField("' . $field . '"); ';
                    }
                    echo 'showQueryPreview(' . $query->getId() . ');';
                }
                init_js($query);
                if (!empty($query->TJoin)) {
                    foreach ($query->TJoin as $t => $join) {
                        ?>
							$("td[rel=from] select[jointure='<?php 
                        echo $t;
                        ?>
']").val("<?php 
                        echo $join[0];
                        ?>
");
							$("td[rel=to] select[jointure-to='<?php 
                        echo $t;
                        ?>
']").val("<?php 
                        echo $join[1];
                        ?>
");
							
							TJoin['<?php 
                        echo $t;
                        ?>
'] = ["<?php 
                        echo $join[0];
                        ?>
", "<?php 
                        echo $join[1];
                        ?>
"]; 
							<?php 
                    }
                }
                ?>
					refresh_sql();
					<?php 
            }
        }
    }
    ?>
		}
		
	</script>
	
	<form name="formQuery" id="formQuery">
		<input type="hidden" name="id" value="<?php 
    echo $query->getId();
    ?>
" />
		
	<div>
		<?php 
    if ($query->getId() > 0 && !empty($user->rights->query->all->expert)) {
        ?>
<div style="float:right;z-index:999; position:relative; top:40px;"><?php 
        if ($query->expert == 0) {
            ?>
<a class="butAction" href="?action=set-expert&id=<?php 
            echo $query->getId();
            ?>
"><?php 
            echo $langs->trans('setExpertMode');
            ?>
</a><?php 
        } else {
            if ($query->expert == 2) {
                ?>
<a class="butAction" href="?action=set-expert&id=<?php 
                echo $query->getId();
                ?>
"><?php 
                echo $langs->trans('setExpertMode');
                ?>
</a><?php 
                ?>
<br /><br /><a class="butAction" href="?action=unset-expert&id=<?php 
                echo $query->getId();
                ?>
"><?php 
                echo $langs->trans('unsetExpertMode');
                ?>
</a><?php 
            } else {
                ?>
<a class="butAction" href="?action=set-free&id=<?php 
                echo $query->getId();
                ?>
"><?php 
                echo $langs->trans('setExpertFreeMode');
                ?>
</a><?php 
                ?>
<br /><br /><a class="butAction" href="?action=unset-expert&id=<?php 
                echo $query->getId();
                ?>
"><?php 
                echo $langs->trans('unsetExpertMode');
                ?>
</a><?php 
            }
        }
        ?>
<br /><br /><a class="butAction" href="?action=clone&id=<?php 
        echo $query->getId();
        ?>
"><?php 
        echo $langs->trans('cloneQuery');
        ?>
</a><?php 
        ?>
<br /><br /><a class="butAction" href="?action=export&id=<?php 
        echo $query->getId();
        ?>
"><?php 
        echo $langs->trans('ExportQuery');
        ?>
</a><?php 
        ?>
</div><?php 
    }
    ?>
		<div id="query_header" style="padding: 0 20px 20px 0; background-color: #fff;z-index:1;">
			<?php 
    echo $langs->trans('Title');
    ?>
 : 
			<input type="text" name="title" size="80" value="<?php 
    echo $query->title;
    ?>
" />
			<?php 
    $form = new TFormCore();
    if (!empty($user->rights->query->bdd->use_other_db)) {
        dol_include_once('/query/class/bddconnector.class.php');
        $PDOdb = new TPDOdb();
        $formCoreBDD = new TFormCore();
        if ($query->getId() > 0) {
            $formCoreBDD->Set_typeaff('view');
        }
        echo $formCoreBDD->combo(' - ' . $langs->trans('BDD'), 'fk_bdd', TBDDConnector::getCombo($PDOdb, true), $query->fk_bdd);
    }
    echo $form->combo('- ' . $langs->trans('Type') . ' : ', 'type', $query->TGraphiqueType, $query->type);
    echo '- ' . $langs->trans('XAxis') . ' : <select name="xaxis" initValue="' . $query->xaxis . '"></select>';
    ?>
			<input class="button" type="button" id="save_query" value="<?php 
    echo $langs->trans('SaveQuery');
    ?>
" />
		</div>
		<?php 
    if ($query->getId() > 0 && !$query->expert) {
        ?>
		<div>
			<?php 
        echo $langs->trans('AddOneOfThisTables');
        ?>
 : <select id="tables"></select>
			<input class="button" type="button" id="add_this_table" value="<?php 
        echo $langs->trans('AddThisTable');
        ?>
" />
		</div>
		
		<div id="selected_tables">
			
		</div>
		<?php 
    }
    ?>
	</div>
	<?php 
    if ($query->getId() > 0 && $query->expert != 2) {
        ?>
			<div class="selected_fields">
				<div class="border" id="fields"><div class="liste_titre"><?php 
        echo $langs->trans('FieldsOrder');
        ?>
</div></div>
			</div>
			<?php 
    }
    if ($query->getId() > 0) {
        ?>
	<div id="results" style="display:<?php 
        echo $query->expert > 0 ? 'block' : 'none';
        ?>
;">
		<div>
		<?php 
        echo $langs->trans('Fields');
        ?>
<br />
		<textarea id="sql_query_fields" name="sql_fields" <?php 
        echo $query->expert == 2 ? ' style="width:700px;height:100px;" ' : '';
        ?>
><?php 
        echo htmlentities($query->sql_fields, 0, ini_get("default_charset"));
        ?>
</textarea>
		</div>
		
		<div>
		<?php 
        echo $langs->trans('From');
        ?>
<br />
		<textarea id="sql_query_from" name="sql_from" <?php 
        echo $query->expert == 2 ? 'style="width:700px;height:100px;"' : '';
        ?>
><?php 
        echo htmlentities($query->sql_from, 0, ini_get("default_charset"));
        ?>
</textarea>
		</div>
		
		<div>
		<?php 
        echo $langs->trans('Where');
        ?>
<br />
		<textarea id="sql_query_where" name="sql_where" <?php 
        echo $query->expert == 2 ? 'style="width:700px;height:200px;"' : '';
        ?>
><?php 
        echo htmlentities($query->sql_where, 0, ini_get("default_charset"));
        ?>
</textarea>
		
		<?php 
        if ($query->expert > 0) {
            echo $langs->trans('AfterWhere');
            ?>
<br /><textarea id="sql_query_afterwhere" name="sql_afterwhere" <?php 
            echo $query->expert == 2 ? 'style="width:700px;height:100px;"' : '';
            ?>
><?php 
            echo htmlentities($query->sql_afterwhere, 0, ini_get("default_charset"));
            ?>
</textarea><?php 
        } else {
            ?>
<input type="hidden" id="sql_query_afterwhere" name="sql_afterwhere" value="" /><?php 
        }
        ?>
		
		</div>
	</div>
	
	<div style="clear:both; border-top:1px solid #000;"></div>
	<?php 
        if ($query->getId() > 0 && $query->expert != 2) {
            ?>
		<div class="selected_fields_view">
			<div class="border" id="fieldsview"><div class="liste_titre"><?php 
            echo $langs->trans('FieldsView');
            ?>
</div></div>
		</div>
		<?php 
        }
        ?>
	<div id="previewRequete" style="display: none;">
		<iframe src="#" width="100%" bgcolor="#fff" frameborder="0" onload="this.height = this.contentWindow.document.body.scrollHeight + 'px'"></iframe>
	</div>
	
	<?php 
    }
    ?>
	</form>
	
	
	
	<?php 
    dol_fiche_end();
    llxFooter();
}
function _fiche(&$PDOdb, &$dispatch)
{
    global $db, $conf, $langs;
    llxHeader();
    $form = new TFormCore('auto', 'asset', 'post');
    echo $form->hidden('action', 'save');
    echo $form->hidden('id', $dispatch->fk_object);
    echo $form->hidden('type_object', $dispatch->type_object);
    $object = _header($dispatch->fk_object, $dispatch->type_object);
    $pListe[0] = "Sélectionnez une ligne";
    foreach ($object->lines as $k => &$line) {
        $label = !empty($line->label) ? $line->label : $line->libelle;
        if (empty($label) && !empty($line->desc)) {
            $label = $line->desc;
        }
        $pListe[$line->id] = $k + 1 . '/ ' . $label;
    }
    print count($dispatch->TDispatchAsset) . ' équipement(s) lié(s)<br />';
    ?>
	<table width="100%" class="border">
		<tr class="liste_titre">
			<?php 
    if (GETPOST('type_object') !== 'ticketsup') {
        print '<td>Ligne concernée</td>';
    }
    ?>
			<td>Equipement</td>
			<?php 
    if (!empty($conf->global->USE_LOT_IN_OF)) {
        ?>
<td>Numéro de Lot</td><?php 
    }
    print '<td>DLUO</td>';
    ?>
			<?php 
    if ($conf->global->clinomadic->enabled) {
        ?>
				<td>IMEI</td>
				<td>Firmware</td>
				<?php 
    }
    ?>
			<td>&nbsp;</td>
		</tr>
		
	<?php 
    foreach ($dispatch->TDispatchAsset as $k => &$da) {
        if ($da->to_delete) {
            continue;
        }
        $class = $class == 'pair' ? 'impair' : 'pair';
        ?>
<tr class="<?php 
        echo $class;
        ?>
">
			<?php 
        if (GETPOST('type_object') !== 'ticketsup') {
            echo '<td>' . $pListe[$da->fk_object] . '</td>';
        }
        ?>
			<td><?php 
        echo $da->asset->getNomUrl(1, 0, 1);
        ?>
</td>
			<td><?php 
        echo $da->asset->lot_number;
        ?>
</td>
			<?php 
        if (!empty($conf->global->USE_LOT_IN_OF)) {
            ?>
<td><?php 
            echo $da->asset->dluo ? dol_print_date($da->asset->dluo) : 'N/A';
            ?>
</td><?php 
        }
        ?>
			
			
			
			<?php 
        if ($conf->global->clinomadic->enabled) {
            ?>
				<td>IMEI</td>
				<td>Firmware</td>
				<?php 
        }
        ?>
			<td><?php 
        if ($object->statut == 0 || $type_object == 'contrat') {
            echo '<a href="?action=delete-line&k=' . $k . '&id=' . $object->id . '&type_object=' . $dispatch->type_object . '">' . img_delete() . '</a>';
        }
        ?>
</td>
		</tr>
		
		<?php 
    }
    $formproduct = new FormProduct($db);
    if ($object->statut == 0 || $type_object == 'contrat') {
        ?>
<tr style="background-color: lightblue;">
			<?php 
        if (GETPOST('type_object') !== 'ticketsup') {
            echo '<td>' . $form->combo('', 'TLine[-1][fk_object]', $pListe, '') . '</td>';
        }
        ?>
			<td><?php 
        echo $form->texte('', 'TLine[-1][serial_number]', '', 30);
        ?>
</td>
			<?php 
        if (!empty($conf->global->USE_LOT_IN_OF)) {
            ?>
<td>&nbsp;</td><?php 
        }
        ?>
			<td>&nbsp;</td>
			<?php 
        if ($conf->global->clinomadic->enabled) {
            ?>
				<td>&nbsp;</td>
				<td>&nbsp;</td>
				<?php 
        }
        ?>
			<td>Nouveau
			</td>
	</tr><?php 
    }
    ?>
	</table>
	<script type="text/javascript">
		$(document).ready(function() {
			    $( "input[name='TLine[-1][serial_number]']" ).autocomplete({
			      source: "<?php 
    echo dol_buildpath('/dispatch/script/interface.php', 1);
    ?>
?get=serial_number",
			      minLength: 1,
			      select: function( event, ui ) {
			        
			      }
			    });
		});
		
			
		</script>
	<?php 
    echo $form->btsubmit($langs->trans('Save'), 'bt_new');
    dol_fiche_end();
    $form->end();
    llxFooter();
}
function liste($type)
{
    global $conf, $langs;
    $page_name = "RemiseSetup";
    llxHeader('', $langs->trans($page_name));
    $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
    print_fiche_titre($langs->trans($page_name), $linkback);
    // Configuration header
    $head = remiseAdminPrepareHead();
    dol_fiche_head($head, $type, $page_name, 0, "remise@remise");
    $l = new TListviewTBS('lPrice');
    $sql = "SELECT rowid as Id, palier,remise,zip,fk_shipment_mode,date_maj FROM " . MAIN_DB_PREFIX . "remise \n\t\t\tWHERE type=:type";
    $PDOdb = new TPDOdb();
    $form = new TFormCore('auto', 'form1', 'get');
    echo $form->hidden('type', $type);
    echo $l->render($PDOdb, $sql, array('link' => array('Id' => '<a href="' . dol_buildpath('/remise/admin/remise.php?action=edit&id=@val@&type=' . $type, 1) . '">@val@</a>'), 'type' => array('remise' => 'money', 'palier' => 'number', 'date_maj' => 'date'), 'title' => array('palier' => $langs->trans('Palier'), 'zip' => $langs->trans('Zip'), 'fk_shipment_mode' => $langs->trans('ShipmentMode'), 'remise' => $langs->trans('Remise'), 'date_maj' => $langs->trans('Update')), 'eval' => array('fk_shipment_mode' => 'showShipmentMode(@val@)'), 'search' => array('palier' => true, 'zip' => true, 'remise' => true)), array(':type' => $type));
    $form->end();
    echo '<div class="tabsAction">';
    echo $form->bt($langs->trans('New'), 'bt_new', ' onclick="document.location.href=\'?type=' . $type . '&action=new\' "');
    echo '</div>';
    dol_fiche_end();
    llxFooter();
}
function _fiche(&$c)
{
    global $db, $conf, $langs, $user;
    llxHeader('', 'Checklist');
    $PDOdb = new TPDOdb();
    if ($c->type_object == 'project') {
        dol_include_once('/projet/class/project.class.php');
        dol_include_once('/core/lib/project.lib.php');
        $object = new Project($db);
        $object->fetch($c->fk_object);
        $head = project_prepare_head($object);
        dol_fiche_head($head, 'checklist', $langs->trans("Project"), 0, $object->public ? 'projectpub' : 'project');
    }
    ?>
	<table class="border" >
		<tr class="liste_titre">
			<td class="liste_titre"><?php 
    echo $langs->trans('Label');
    ?>
</td>
			<?php 
    for ($ii = 0; $ii < $c->levelAnswer; $ii++) {
        echo '<td class="liste_titre">&nbsp;</td>';
        // '.($ii+1).'
    }
    if ($user->rights->checklist->write) {
        ?>
			<td class="liste_titre"><?php 
        echo $langs->trans('YesIDo');
        ?>
</td>
			
			<?php 
    }
    ?>
		</tr>
	<?php 
    foreach ($c->TCheck as $k => &$check) {
        echo '<tr>';
        echo '<td>' . $check['label'] . '</td>';
        $Tab = $check['answers'];
        for ($ii = 0; $ii < $c->levelAnswer; $ii++) {
            $a = each($Tab);
            echo '<td>';
            if (!empty($a)) {
                $date = $a['key'];
                $value = $a['value'];
                if ($value['value'] === true) {
                    $u = new User($db);
                    $u->fetch($value['fk_user']);
                    echo dol_print_date($date) . img_info($u->login);
                }
            }
            echo '</td>';
        }
        if ($user->rights->checklist->write) {
            echo '<td><a href="?action=yesido&k=' . $k . '&type_object=' . $c->type_object . '&fk_object=' . $c->fk_object . '">' . img_picto($langs->trans('YesIDo'), 'history.png') . '</a></td>';
        }
        echo '</tr>';
    }
    ?>
	</table>
	<?php 
    dol_fiche_end();
    llxFooter();
}