function _fiche(&$PDOdb, &$idea, $mode = 'view', $editValue = false)
{
    global $db, $langs, $user;
    llxHeader('', $langs->trans('IdeaboxAddItem'), '', '');
    /******/
    $TBS = new TTemplateTBS();
    $TBS->TBS->protect = false;
    $TBS->TBS->noerr = true;
    $form = new TFormCore($_SERVER['PHP_SELF'], 'form', 'POST');
    $form->Set_typeaff($mode);
    echo $form->hidden('id', $idea->getId());
    echo $form->hidden('action', 'save');
    $TIdeaboxItem = _fiche_ligne_ideabox_item($PDOdb, $idea->getId(), $mode);
    $formDoli = new Form($db);
    print $TBS->render('tpl/ideabox.tpl.php', array('TIdeaboxItem' => $TIdeaboxItem), array('TIdeabox' => array('id' => (int) $idea->getId(), 'label' => $form->texte('', 'label', $idea->label, 80, 150, '', '', 'à saisir'), 'usergroup' => $mode == 'view' ? $idea->getNameUserGroup($db) : $formDoli->select_dolgroups($idea->fk_usergroup, 'fk_usergroup', 1)), 'view' => array('type' => 'showficheideabox', 'mode' => $mode, 'user_right' => $user->rights->ideabox->create, 'url' => dol_buildpath('/ideabox/ideabox.php', 2))));
    $form->end();
    llxFooter();
}
function tabImport(&$TImport, &$expedition)
{
    global $langs, $db;
    $form = new TFormCore();
    $formDoli = new Form($db);
    $formproduct = new FormProduct($db);
    $PDOdb = new TPDOdb();
    print count($TImport) . ' équipement(s) dans votre expédition';
    ?>
	<table width="100%" class="border">
		<tr class="liste_titre">
			<td>Produit</td>
			<td>Numéro de série</td>
			<td>Numéro de Lot</td>
			<td>Quantité</td>
			<td>&nbsp;</td>
		</tr>
		
	<?php 
    $prod = new Product($db);
    $form->Set_typeaff('view');
    if (is_array($TImport)) {
        foreach ($TImport as $k => $line) {
            if ($prod->id == 0 || $line['ref'] != $prod->ref) {
                if (!empty($line['fk_product'])) {
                    $prod->fetch($line['fk_product']);
                } else {
                    $prod->fetch('', $line['ref']);
                }
            }
            $asset = new TAsset();
            $asset->loadBy($PDOdb, $line['numserie'], 'serial_number');
            $asset->load_asset_type($PDOdb);
            $assetLot = new TAssetLot();
            $assetLot->loadBy($PDOdb, $line['lot_number'], 'lot_number');
            $Trowid = TRequeteCore::get_id_from_what_you_want($PDOdb, MAIN_DB_PREFIX . "expeditiondet_asset", array('fk_asset' => $asset->rowid, 'fk_expeditiondet' => $line['fk_expeditiondet']));
            ?>
<tr>
					<td><?php 
            echo $prod->getNomUrl(1) . $form->hidden('TLine[' . $k . '][fk_product]', $prod->id) . $form->hidden('TLine[' . $k . '][ref]', $prod->ref);
            ?>
</td>
					<td><a href="<?php 
            echo dol_buildpath('/asset/fiche.php?id=' . $asset->rowid, 1);
            ?>
"><?php 
            echo $form->texte('', 'TLine[' . $k . '][numserie]', $line['numserie'], 30);
            ?>
</a></td>
					<td><a href="<?php 
            echo dol_buildpath('/asset/fiche_lot.php?id=' . $assetLot->rowid, 1);
            ?>
"><?php 
            echo $form->texte('', 'TLine[' . $k . '][lot_number]', $line['lot_number'], 30);
            ?>
</a></td>
					<td><?php 
            echo $line['quantity'] . " " . ($asset->assetType->measuring_units == 'unit' ? 'unité(s)' : measuring_units_string($line['quantity_unit'], $asset->assetType->measuring_units));
            ?>
</td>
					<td>
						<?php 
            if ($expedition->statut != 1) {
                echo '<a href="?action=DELETE_LINE&k=' . $k . '&id=' . $expedition->id . '&rowid=' . $Trowid[0] . '">' . img_delete() . '</a>';
            }
            ?>
					</td>
				</tr>
				
				<?php 
        }
    }
    ?>
			
		
	</table>
	<br>
	<?php 
}
Exemplo n.º 3
0
function _fiche(&$PDOdb, &$hero, $action = 'view')
{
    global $db;
    // création du template
    $form = new TFormCore($_SERVER['PHP_SELF'], 'form', 'POST');
    //affiche un formulaire qui définit les actions
    print $form->hidden('action', 'save');
    print $form->hidden('id', $hero->getId());
    //définit le type d'action du formulaire en fonction de la variable $action récupérée par le GETPOST
    $form->Set_typeaff($action);
    //instanciationb de l'objet template
    $TBS = new TTemplateTBS();
    $buttons = '';
    //si l'action passée en paramètre est à view :
    //on affiche les boutons modifier et supprimer
    if ($action == 'view') {
        //si l'id du héro est égal à 1 :
        //on ne peut qu'ajouter un héro (on ne peut pas supprimer un héro inexistant)
        if ($hero->getId() > 0) {
            $buttons .= "<input type=\"button\" id=\"action-delete\" value=\"Supprimer\" name=\"cancel\" class=\"butActionDelete\" onclick=\"if(confirm('Supprimer ce hero ?'))document.location.href='?action=delete&id=" . $hero->rowid . "'\" />";
        }
        $buttons .= '<a class="butAction" href="?action=edit&id=' . $hero->getId() . '">Modifier</a>';
    } else {
        $buttons .= $form->btsubmit('Valider', 'save');
    }
    /*$btSave = $form->btsubmit('Valider', 'save');
        $btCancel = $form->btsubmit('Annuler', 'cancel');
    	
    	$btDelete = ;
    	*/
    $THero = $hero->get_tab();
    //création de la zone de texte (tirée du template) qui permet d'ajouter le ,nom du héro
    $THero['name'] = $form->texte('', 'name', $hero->name, 30, 255);
    //création de la zone de texte (tirée du template) qui permet d'ajouter la description
    $THero['description'] = $form->zonetexte('', 'description', $hero->description, 80, 5);
    //récupération des pouvoirs dans TPower (tableau de pouvoirs)
    $TPower = $hero->getPower();
    $THero['powers'] = '';
    if (empty($TPower) && $action == 'view') {
        $THero['powers'] .= 'pas de chocolat';
    } else {
        foreach ($TPower as $idp => $pName) {
            if (!empty($THero['powers'])) {
                $THero['powers'] .= ', ';
            }
            $THero['powers'] .= $pName;
            if ($action == 'edit') {
                $THero['powers'] .= ' <a href="?action=delete-power&id=' . $hero->getId() . '&idPower=' . $idp . '">X</a>';
            }
        }
    }
    if ($action == 'edit') {
        $THero['powers'] .= $form->texte(' - Nouveau pouvoir', 'power', '', 30);
    }
    print $TBS->render('./tpl/hero.tpl.php', array(), array('hero' => $THero, 'view' => array('mode' => $mode), 'buttons' => array('buttons' => $buttons)));
    $form->end_form();
}
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, &$dolidacticiel, $action)
{
    global $langs, $db, $user;
    /*
     * View
     */
    $page_name = "dolidacticielSetup";
    llxHeader('', $langs->trans($page_name));
    // Subheader
    $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
    print_fiche_titre($langs->trans($page_name), $linkback);
    // Configuration header
    $head = dolidacticielAdminPrepareHead();
    dol_fiche_head($head, 'create', $langs->trans("Module104640Name"), 0, "dolidacticiel@dolidacticiel");
    $form = new TFormCore($_SERVER['PHP_SELF'], 'formDolidacticiel', 'POST');
    $form->Set_typeaff($action);
    $TBS = new TTemplateTBS();
    $tpl_fiche = "dolidacticiel_admin.tpl.php";
    print $TBS->render('../tpl/' . $tpl_fiche, array(), array('test' => array('id' => $dolidacticiel->getId(), 'rowid' => $form->hidden('rowid', $dolidacticiel->getId()), 'mainmenu' => $form->texte('', 'mainmenu', $dolidacticiel->mainmenu, 50), 'action' => $form->texte('', 'mainmenu', $dolidacticiel->action, 50), 'code' => $form->texte('', 'mainmenu', $dolidacticiel->code, 50), 'prev_code' => $form->texte('', 'mainmenu', $dolidacticiel->prev_code, 50), 'module_name' => $form->texte('', 'mainmenu', $dolidacticiel->module_name, 50), 'cond' => $form->texte('', 'mainmenu', $dolidacticiel->cond, 50), 'title' => $form->texte('', 'mainmenu', $dolidacticiel->title, 50), 'description' => $form->texte('', 'mainmenu', $dolidacticiel->description, 50), 'rights' => $form->texte('', 'mainmenu', $dolidacticiel->rights, 50), 'mainmenutips' => $form->texte('', 'mainmenu', $dolidacticiel->mainmenutips, 50), 'tips' => $form->texte('', 'mainmenu', $dolidacticiel->tips, 50)), 'view' => array('mode' => $action)));
    $form->end();
}
function _fiche_control(&$PDOdb, &$assetOf)
{
    global $langs, $db, $conf;
    llxHeader('', $langs->trans('OFAsset'), '', '');
    print dol_get_fiche_head(ofPrepareHead($assetOf, 'assetOF'), 'controle', $langs->trans('OFAsset'));
    /******/
    $TBS = new TTemplateTBS();
    $TBS->TBS->protect = false;
    $TBS->TBS->noerr = true;
    $form = new TFormCore($_SERVER['PHP_SELF'], 'form', 'POST');
    $form->Set_typeaff('view');
    $TControl = _fiche_ligne_control($PDOdb, $assetOf->getId());
    $TAssetOFControl = _fiche_ligne_control($PDOdb, $assetOf->getId(), $assetOf);
    print $TBS->render('tpl/fiche_of_control.tpl.php', array('TControl' => $TControl, 'TAssetOFControl' => $TAssetOFControl), array('assetOf' => array('id' => (int) $assetOf->getId()), 'view' => array('nbTControl' => count($TControl), 'nbTAssetOFControl' => count($TAssetOFControl), 'url' => DOL_URL_ROOT . '/custom/of/fiche_of.php')));
    $form->end();
    /******/
    llxFooter('$Date: 2011/07/31 22:21:57 $ - $Revision: 1.19 $');
}
function fiche(&$remise, $type, $mode)
{
    global $conf, $langs, $db;
    $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");
    $form = new TFormCore('auto', 'form1', 'post');
    $form->Set_typeaff($mode);
    echo $form->hidden('type', $type);
    echo $form->hidden('id', $remise->getId());
    echo $form->hidden('action', 'save');
    $f = new Form($db);
    ?>
	<table class="border" width="100%">
		<tr>
			<td  width="20%"><?php 
    echo $langs->trans('Palier');
    ?>
</td><td><?php 
    echo $form->texte('', 'palier', $remise->palier, 10, 255);
    ?>
</td>
		</tr>
		<tr>
			<td><?php 
    echo $langs->trans('Remise');
    ?>
</td><td><?php 
    echo $form->texte('', 'remise', $remise->remise, 10, 255);
    ?>
</td>
		</tr>
		<tr>
			<td><?php 
    echo $langs->trans('Zip');
    ?>
</td><td><?php 
    echo $form->texte('', 'zip', $remise->zip, 5, 255);
    ?>
</td>
		</tr>
		<tr>
			<td><?php 
    echo $langs->trans('ShipmentMode');
    ?>
</td><td>
				<?php 
    if ((double) DOL_VERSION >= 3.7) {
        $f->selectShippingMethod($remise->fk_shipment_mode, 'fk_shipment_mode', '', 1);
    } else {
        $query = "SELECT rowid, code, libelle";
        $query .= " FROM " . MAIN_DB_PREFIX . "c_shipment_mode";
        $query .= " WHERE active = 1";
        $query .= " ORDER BY libelle ASC";
        $resql = $db->query($query);
        print '<select id="fk_shipment_mode" class="flat selectshippingmethod" name="fk_shipment_mode"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
        print '<option value="">';
        print '</option>';
        while ($res = $db->fetch_object($resql)) {
            $selected = '';
            if ($remise->fk_shipment_mode == $res->rowid) {
                $selected = 'selected="selected"';
            }
            print '<option value="' . $res->rowid . '" ' . $selected . '>';
            print $langs->trans("SendingMethod" . strtoupper($res->code));
            print '</option>';
        }
        print '</select>';
    }
    ?>
</td>
		</tr>
		
	</table>
	<div class="tabsAction">
		<?php 
    echo $form->btsubmit($langs->trans('Save'), 'bt_save');
    echo $form->btsubmit($langs->trans('Cancel'), 'bt_cancel', '', 'butAction butActionCancel');
    ?>
	</div>
	<?php 
    $form->end();
    dol_fiche_end();
    llxFooter();
}
Exemplo n.º 8
0
function _fiche(&$ATMdb, &$control, $mode = 'view', $editValue = false)
{
    global $db, $langs;
    llxHeader('', $langs->trans('AssetAddControl'), '', '');
    $TBS = new TTemplateTBS();
    $form = new TFormCore();
    $form->Set_typeaff($mode);
    $TForm = array('id' => $control->getId(), 'libelle' => $form->texte('', 'libelle', $control->libelle, 50, 255), 'type' => $form->combo('', 'type', TAssetControl::$TType, $control->type), 'question' => $form->texte('', 'question', $control->question, 120, 255));
    $TFormVal = _fiche_value($ATMdb, $editValue);
    $TVal = _liste_valeur($ATMdb, $control->getId(), $control->type);
    print $TBS->render('./tpl/control.tpl.php', array('TVal' => $TVal), array('co' => $TForm, 'FormVal' => $TFormVal, 'view' => array('mode' => $mode, 'editValue' => $editValue, 'type' => $control->type, 'url' => dol_buildpath('/of/control.php', 1))));
    llxFooter();
}