예제 #1
0
function change_vehicle_configuration()
{
    /*if (!current_user_can('manage_options')) {
    		wp_die(__('You do not have sufficient permissions to access this page.'));
    	}
    	*/
    ?>
<h2>Vehicle Configuration</h2>
<h3>Browse Vehicle Configuration</h3>
<table>
	<thead>
		<tr>
			<th width="8%">Name</th>
			<th width="8%">ECU Reference</th>
			<th width="20%">Description</th>
			<th width="15%">Function</th>
			<th width="8%">Manufactory</th>
			<th width="3%">Remove</th>
			<th width="3%">Restore</th>
			<th width="35%"></th>
		</tr>
	</thead>
	<tbody>
		<?php 
    $myrows = fetch_configurations();
    if ($myrows != NULL) {
        foreach ($myrows as $myrow) {
            $output = "<tr><td align='center'>{$myrow->name}</td><td align='center'>{$myrow->ecuId}</td><td align='center'>{$myrow->description}</td><td align='center'>{$myrow->function}</td><td align='center'>{$myrow->manufactory}</td>";
            /*$link_arr_paras = array('action' => 'edit', 'configid' => $myrow->id);
            		$link = add_query_arg($link_arr_paras);
            		$edit = "<td align='center'><a href=$link alt='Edit Vehicle Configuration'><img src='/wordpress/wp-content/plugins/vehicle-configuration/images/edit.png' /></a></td>";
            		$output .= $edit;*/
            $link_arr_paras = array('action' => 'remove', 'configid' => $myrow->id);
            $link = add_query_arg($link_arr_paras);
            $remove = "<td align='center'><a href={$link} alt='Remove Vehicle Configuration'><img src='/wordpress/wp-content/plugins/vehicle-configuration/images/remove.png' /></a></td>";
            $output .= $remove;
            $link_arr_paras = array('action' => 'restore', 'configid' => $myrow->ecuId);
            $link = add_query_arg($link_arr_paras);
            $restore = "<td align='center'><a href={$link} alt='Restore Vehicle Configuration'><img src='/wordpress/wp-content/plugins/vehicle-configuration/images/restore.png' /></a></td>";
            $output .= $restore;
            $output .= "</tr>";
            echo $output;
        }
    }
    ?>
	</tbody>
	<tfoot>
		<tr>
			<th>Name</th>
			<th>ECU Reference</th>
			<th>Description</th>
			<th>Function</th>
			<th>Manufactory</th>
			<th>Remove</th>
			<th>Restore</th>
		</tr>
	</tfoot>
</table>
<?php 
}
예제 #2
0
파일: vehicle.php 프로젝트: johangas/moped
function vehicle_configuration_form()
{
    ?>
<h2>Vehicle Configuration</h2>
<h3>Add a new Vehicle Configuration</h3>
<form method="post" >
	<p>
		<label for="vehicle" required">Vehicle</label><br/>
		<select id="vehicle" name="vehicle">
			<?php 
    $myrows = fetch_vehicles();
    foreach ($myrows as $myrow) {
        $output = "<option value={$myrow->id}>{$myrow->VIN}</option>";
        echo $output;
    }
    ?>
		</select>
	</p>
	<p>
		<label for="name-field" required>Name</label><br/>
		<input id="name-field" name="name-field" type="text" value=""/>
	</p>
	<p>
		<label for="ecuID" required>ECU Reference</label><br/>
		<input id="ecuID" name="ecuID" type="text" value=""/>
	</p>
	<p>
		<label for="description">Description</label><br/>
		<input id="description" name="description" type="text" value=""/>
	</p>
	<p>
		<label for="function">Function</label><br/>
		<input id="function" name="function" type="text" value=""/>
	</p>
	<p>
		<label for="manufactory">Manufactory</label><br/>
		<input id="manufactory" name="manufactory" type="text" value=""/>
	</p>
	<input type="submit" name="Add_configuration" value="Add (ignored)"/>
</form>
<h3>Browse Vehicle Configuration</h3>
<table>
	<thead>
		<tr>
			<th width="10%">Name</th>
			<th width="10%">ECU</th>
			<th width="35%">Description</th>
			<th width="20%">Function</th>
			<th width="20%">Manufactory</th>
			<th width="5%">Remove</th>

		</tr>
	</thead>
	<tbody>
		<?php 
    $myrows = fetch_configurations();
    if ($myrows != NULL) {
        foreach ($myrows as $myrow) {
            $output = "<tr><td align='center'>{$myrow->name}</td><td align='center'>{$myrow->ecuId}</td><td align='center'>{$myrow->description}</td><td align='center'>{$myrow->function}</td><td align='center'>{$myrow->manufactory}</td>";
            /*$link_arr_paras = array('action' => 'edit', 'configid' => $myrow->id);
            		$link = add_query_arg($link_arr_paras);
            		$edit = "<td align='center'><a href=$link alt='Edit Vehicle Configuration'><img src='/wp/wp-content/plugins/vehicle-configuration/images/edit.png' /></a></td>";
            		$output .= $edit;*/
            $link_arr_paras = array('action' => 'remove', 'configid' => $myrow->id);
            $link = add_query_arg($link_arr_paras);
            $remove = "<td align='center'><a href={$link} alt='Remove Vehicle Configuration'><img src='/wp/wp-content/plugins/vehicle-configuration/images/remove.png' /></a></td>";
            $output .= $remove;
            $output .= "</tr>";
            echo $output;
        }
    }
    ?>
	</tbody>
	<tfoot>
		<tr>
			<th>Name</th>
			<th>ECU</th>
			<th>Description</th>
			<th>Function</th>
			<th>Manufactory</th>
			<th>Remove</th>
		</tr>
	</tfoot>
</table>
<?php 
}