Initial commit: Kimai TMS
Kimai time management system (PHP 5.6 / MySQL) with custom extensions: - Budget tracking (ki_budget) - Change request form (ki_changerequest) - Invoice generation (ki_invoice) - Expense tracking (ki_expenses) - Flexi time (ki_flexitime) - Export, admin panel, timesheets, tasks, summary Database: ~900K time entries, 2,000+ users, 439 projects. Config: includes/autoconf.php — localhost/kimai/kimai
This commit is contained in:
45
extensions/ki_listprojects/templates/index.php
Normal file
45
extensions/ki_listprojects/templates/index.php
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
<div class="CSSTableGenerator" >
|
||||
|
||||
<p>
|
||||
<?php
|
||||
try {
|
||||
$con = new PDO('mysql:host=localhost;port=3306;dbname=kimai', "kimai", "kimai");
|
||||
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$query = "select DISTINCT
|
||||
k.knd_name as 'Company Name',
|
||||
p.pct_name as 'Project'
|
||||
from kimai15_pct p
|
||||
inner join kimai15_knd k on p.pct_kndID=k.knd_ID
|
||||
where p.pct_visible = 1
|
||||
order by p.pct_name";
|
||||
|
||||
//first pass just gets the column names
|
||||
echo '<table id="myTable" border="1" cellpadding="3" cellspacing="0">';
|
||||
$result = $con->query($query);
|
||||
//return only the first row (we only need field names)
|
||||
$row = $result->fetch(PDO::FETCH_ASSOC);
|
||||
echo " <tr> \n";
|
||||
foreach ($row as $field => $value) {
|
||||
echo " <th>$field</th> \n";
|
||||
} // end foreach
|
||||
echo " </tr> \n";
|
||||
//second query gets the data
|
||||
$data = $con->query($query);
|
||||
$data->setFetchMode(PDO::FETCH_ASSOC);
|
||||
foreach ($data as $row) {
|
||||
echo " <tr> \n";
|
||||
foreach ($row as $name => $value) {
|
||||
echo " <td>$value</td> \n";
|
||||
} // end field loop
|
||||
echo " </tr> \n";
|
||||
} // end record loop
|
||||
echo "</table> \n";
|
||||
} catch (PDOException $e) {
|
||||
echo 'ERROR: ' . $e->getMessage();
|
||||
} // end try
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user