function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); // Retrieve hires $sql = "\r\n\tSELECT *,\r\n\t\t(SELECT username FROM cubit.users WHERE userid=user_id) AS username,\r\n\t\t(SELECT surname FROM cubit.customers WHERE cusnum=cust_id) AS surname,\r\n\t\t(SELECT cusname FROM cubit.customers WHERE cusnum=cust_id) AS cusname,\r\n\t\t(SELECT EXTRACT('EPOCH' FROM from_time)) AS e_from,\r\n\t\t(SELECT EXTRACT('EPOCH' FROM to_time)) AS e_to\r\n\tFROM hire.hires\r\n\tWHERE from_time BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59' OR\r\n\t\tto_time BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59'\r\n\tORDER BY e_from ASC"; $hire_rslt = db_exec($sql) or errDie("Unable to retrieve hires."); $hire_out = ""; while ($hire_data = pg_fetch_array($hire_rslt)) { $time = date("d-m-Y G:i:s", $hire_data["e_from"]); $hire_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$time}</td>\r\n\t\t\t<td>{$hire_data['inv_id']}</td>\r\n\t\t\t<td>{$hire_data['username']}</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='../cust-det.php?cusnum={$hire_data['cust_id']}'>\r\n\t\t\t\t\t{$hire_data['cusname']} {$hire_data['surname']}\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($hire_out)) { $hire_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No items found for this date range</li></td>\r\n\t\t</tr>"; } if (empty($invoice_out)) { $invoice_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No items found for this date range</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Daily Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4' style='font-size: 16px'>HIRES</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Sales Person</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t</tr>\r\n\t\t{$hire_out}\r\n\t\t<tr>\r\n\t\t\t<th colspan='4' style='font-size: 16px'>INVOICES</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Sales Person</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t</tr>\r\n\t\t{$invoice_out}\r\n\t</table>\r\n\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); $sql = "SELECT invid, invnum, customers.surname, hire_invid,\r\n\t\t\t\textract('epoch' FROM reprint_invoices.odate) AS e_date\r\n\t\t\t\tFROM hire.reprint_invoices\r\n\t\t\t\t\tLEFT JOIN cubit.customers\r\n\t\t\t\t\t\tON reprint_invoices.cusnum=customers.cusnum\r\n\t\t\tWHERE reprint_invoices.odate BETWEEN '{$from_date}' AND '{$to_date}'\r\n\t\t\tORDER BY invnum DESC"; $reprint_rslt = db_exec($sql) or errDie("Unable to retrieve reprints."); $reprint_out = ""; while ($reprint_data = pg_fetch_array($reprint_rslt)) { if (!$reprint_data["invnum"]) { continue; } $reprint_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>H{$reprint_data['invnum']}" . rrev($reprint_data["invid"]) . "</td>\r\n\t\t\t<td>{$reprint_data['surname']}</td>\r\n\t\t\t<td>" . date("d-m-Y", $reprint_data["e_date"]) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='javascript:printer" . "(\"hire/hire_note_reprint.php?invid={$reprint_data['invid']}\")'>\r\n\t\t\t\t\tReprint\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($reprint_out)) { $reprint_out = "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No results found.</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>View Hire Note Reprints</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='4'>Date Range</th></tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b>To</b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Date</th>\r\n\t\t\t<th>Reprint</th>\r\n\t\t</tr>\r\n\t\t{$reprint_out}\r\n\t</table>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); $sql = "SELECT assets_hired.invnum, surname, des, assets_hired.invid,\r\n\t\t\t\textract('epoch' FROM hired_time) AS e_hired,\r\n\t\t\t\textract('epoch' FROM return_time) AS e_return\r\n\t\t\tFROM hire.assets_hired\r\n\t\t\t\tLEFT JOIN hire.notes_reprint\r\n\t\t\t\t\tON assets_hired.invid=notes_reprint.invid\r\n\t\t\t\tLEFT JOIN cubit.customers\r\n\t\t\t\t\tON assets_hired.cust_id=customers.cusnum\r\n\t\t\t\tLEFT JOIN cubit.assets\r\n\t\t\t\t\tON assets_hired.asset_id=assets.id\r\n\t\t\tWHERE hired_time BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59' OR\r\n\t\t\t\treturn_time BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59'\r\n\t\t\tORDER BY invnum DESC"; $history_rslt = db_exec($sql) or errDie("Unable to retrieve history."); $history_out = ""; while ($history_data = pg_fetch_array($history_rslt)) { if ($history_data["e_return"]) { $return = date("d-m-Y", $history_data["e_return"]); } else { $return = "Still on Hire"; } $history_out .= "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>H" . getHirenum($history_data["invid"], 1) . "</td>\r\n\t\t\t<td>{$history_data['surname']}</td>\r\n\t\t\t<td>{$history_data['des']}</td>\r\n\t\t\t<td>" . date("d-m-Y", $history_data["e_hired"]) . "</td>\r\n\t\t\t<td>{$return}</td>\r\n\t\t</tr>"; } if (empty($history_out)) { $history_out = "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='5'><li>No results found</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Hire History Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='4'>Date Range</th></tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b>To</b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Company / Name</th>\r\n\t\t\t<th>Product</th>\r\n\t\t\t<th>Date Hired</th>\r\n\t\t\t<th>Date Returned</th>\r\n\t\t</tr>\r\n\t\t{$history_out}\r\n\t</table>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["date_year"] = date("Y"); $fields["date_month"] = date("m"); $fields["date_day"] = date("d"); extract($fields, EXTR_SKIP); $date = dateFmt($date_year, $date_month, $date_day); for ($i = 0; $i < 2; $i++) { if ($i) { $collection = "collect"; } else { $collection = "deliver"; } $sql = "SELECT * FROM hire.collection\r\n\t\t\t\tWHERE {$collection}='1'\r\n\t\t\t\t\tAND time BETWEEN '{$date} 0:00:00' AND '{$date} 23:59:59'"; $clct_rslt = db_exec($sql) or errDie("Unable to retrieve collection."); while ($clct_data = pg_fetch_array($clct_rslt)) { if (!$clct_data["item_id"]) { continue; } $sql = "SELECT * FROM cubit.assets WHERE id='{$clct_data['asset_id']}'"; $asset_rslt = db_exec($sql) or errDie("Unable to retrieve assets."); $sql = "SELECT * FROM hire.hire_invitems WHERE id='{$clct_data['item_id']}'"; $item_rslt = db_exec($sql) or errDie("Unable to retrieve items."); $item_data = pg_fetch_array($item_rslt); if (empty($item_data["invid"])) { continue; } $sql = "SELECT * FROM hire.hire_invoices WHERE invid='{$item_data['invid']}'"; $inv_rslt = db_exec($sql) or errDie("Unable to retrieve invoices."); $inv_data = pg_fetch_array($inv_rslt); while ($asset_data = pg_fetch_array($asset_rslt)) { ${$collection} .= "<tr class='" . bg_class() . "'>\r\n\t\t\t\t\t<td>H" . getHirenum($inv_data["invid"], 1) . "</td>\r\n\t\t\t\t\t<td>{$asset_data['des']}</td>\r\n\t\t\t\t\t<td>{$inv_data['cusname']} {$inv_data['surname']}</td>\r\n\t\t\t\t\t<td>" . hireAddress($inv_data["invid"]) . "</td>\r\n\t\t\t\t\t<td>" . getSerial($asset_data["id"]) . "</td>\r\n\t\t\t\t</tr>"; } } if (empty(${$collection})) { ${$collection} = "<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td colspan='5'><li>No results found.</li></td>\r\n\t\t\t</tr>"; } } $OUTPUT = "<center>\r\n\t<h3>Collect and Deliver Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='2'>Date</th></tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("date", $date_year, $date_month, $date_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select' style='font-weight: bold' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='5'>Deliver</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Asset</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Address</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t</tr>\r\n\t\t{$deliver}\r\n\t\t<tr>\r\n\t\t\t<th colspan='5'>Collect</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Asset</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Address</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t</tr>\r\n\t\t{$collect}\r\n\t</table>\r\n\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["frm_year"] = date("Y"); $fields["frm_month"] = date("m"); $fields["frm_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("t"); extract($fields, EXTR_SKIP); // Dates from date range $frm_date = dateFmt($frm_year, $frm_month, $frm_day); $to_date = dateFmt($to_year, $to_month, $to_day); $OUTPUT = "<center>\r\n\t<h3>View Bookings</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("frm", $frm_year, $frm_month, $frm_day) . "</td>\r\n\t\t\t<td><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Continue »' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>"; // Retrieve bookings $sql = "SELECT *,\r\n\t\t\t\textract('epoch' FROM from_date) AS e_from,\r\n\t\t\t\textract('epoch' FROM to_date) AS e_to\r\n\t\t\t\tFROM hire.bookings\r\n\t\t\t\tWHERE from_date BETWEEN '{$frm_date}' AND '{$to_date}' OR\r\n\t\t\t\t\tto_date BETWEEN '{$frm_date}' AND '{$to_date}'"; $booking_rslt = db_exec($sql) or errDie("Unable to retrieve bookings."); $booking_out = ""; while ($booking_data = pg_fetch_array($booking_rslt)) { // Retrieve asset $sql = "SELECT * FROM cubit.assets WHERE id='{$booking_data['asset_id']}'"; $asset_rslt = db_exec($sql) or errDie("Unable to retrieve asset."); $asset_data = pg_fetch_array($asset_rslt); if (!isOurs($asset_data["id"])) { continue; } // Retrieve customer $sql = "SELECT * FROM cubit.customers WHERE cusnum='{$booking_data['cust_id']}'"; $cust_rslt = db_exec($sql) or errDie("Unable to retrieve customer."); $cust_data = pg_fetch_array($cust_rslt); // Create the output $booking_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td align='center'>{$booking_data['id']}</td>\r\n\t\t\t<td>" . date("d-m-Y", $booking_data["e_from"]) . "</td>\r\n\t\t\t<td>" . date("d-m-Y", $booking_data["e_to"]) . "</td>\r\n\t\t\t<td>{$asset_data['des']}</td>\r\n\t\t\t<td>" . getSerial($asset_data["id"]) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='../cust-det.php?cusnum={$cust_data['cusnum']}'>\r\n\t\t\t\t\t{$cust_data['surname']}\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='booking_save.php?id={$booking_data['id']}&page_option=edit'>\r\n\t\t\t\t\tEdit Booking\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='booking_remove.php?id={$booking_data['id']}'>\r\n\t\t\t\t\tRemove Booking\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='" . SELF . "?key=hire&id={$booking_data['id']}'\r\n\t\t\t\tstyle='font-size: 1.2em; padding: 0 1em'>\r\n\t\t\t\t\t<b>Hire</b></a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($booking_out)) { $booking_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='7'><li>No bookings found.</li></td>\r\n\t\t</tr>"; } $OUTPUT .= "<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Booking No.</th>\r\n\t\t\t<th>From Date</th>\r\n\t\t\t<th>To Date</th>\r\n\t\t\t<th>Small Plant</th>\r\n\t\t\t<th>Serial No.</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th colspan='3'>Options</th>\r\n\t\t</tr>\r\n\t\t{$booking_out}\r\n\t</table>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); $fields["perc_search"] = "100"; $fields["export"] = 0; extract($fields, EXTR_SKIP); $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); $sql = "SELECT id, serial, des, grpname\r\n\t\t\tFROM cubit.assets\r\n\t\t\t\tLEFT JOIN cubit.assetgrp ON assets.grpid=assetgrp.grpid\r\n\t\t\tORDER BY serial ASC"; $asset_rslt = db_exec($sql) or errDie("Unable to retrieve assets."); $asset_out = ""; while ($asset_data = pg_fetch_array($asset_rslt)) { $percentage = utilisationPerc($asset_data["id"], $from_date, $to_date); if (!is_numeric($perc_search) || $percentage > $perc_search) { continue; } $asset_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$asset_data['grpname']}</td>\r\n\t\t\t<td>" . getSerial($asset_data["id"]) . "</td>\r\n\t\t\t<td>{$asset_data['des']}</td>\r\n\t\t\t<td align='center'>\r\n\t\t\t\t<b>" . utilisationDays($asset_data["id"], $from_date, $to_date) . "</b>\r\n\t\t\t</td>\r\n\t\t\t<td align='center' >\r\n\t\t\t\t<b>{$percentage}%</b>\r\n\t\t\t</td>\r\n\t\t\t<td width='2%' bgcolor='" . ext_progressColor($percentage) . "'> </td>\r\n\t\t</tr>"; } if (empty($asset_out)) { $asset_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='6'><li>No results found</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Hire Utilisation Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='3'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b> To </b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th colspan='3'>Utilisation Percentage Filter (Less Than or Equal)</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='3' align='center'>\r\n\t\t\t\t<input type='text' name='perc_search' value='{$perc_search}'\r\n\t\t\t\tsize='2' style='text-align: center' />%\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td colspan='3' align='center'>\r\n\t\t\t\t<input type='submit' value='Apply to Report'\r\n\t\t\t\tstyle='font-weight: bold; font-size: 1.1em' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>"; $OUTPUT .= $xls_out = "\r\n\t<h3>Hire Utilisation Report For {$from_date} to {$to_date}</h3>\r\n\t<table " . TMPL_tblDflts . " width='70%'>\r\n\t\t<tr>\r\n\t\t\t<th>Group</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Description</th>\r\n\t\t\t<th>Days Hired</th>\r\n\t\t\t<th>Utilisation Percentage</th>\r\n\t\t\t<th width='2%'> </th>\r\n\t\t</tr>\r\n\t\t{$asset_out}\r\n\t</table>"; $OUTPUT .= "\r\n\t<form method='post' action='" . SELF . "'>\r\n\t\t<input type='hidden' name='export' value='1' />\r\n\t\t<input type='submit' value='Export to Spreadsheet' />\r\n\t</form>\r\n\t</center>"; if ($export) { $xls_out = clean_html($xls_out); require_lib("xls"); StreamXLS("hire_utilisation", $xls_out); } return $OUTPUT; }
<th class="tiny"> </th> <th class="tiny"> </th> </tr> <?php foreach ($blog_posts as $post) { ?> <tr class="<?php echo !$post['published'] ? 'draft' : ''; ?> "> <td><?php echo in_array('blog_edit', $this->permission->permissions) ? anchor('/admin/blog/edit_post/' . $post['postID'], $post['postTitle']) : $post['postTitle']; ?> </td> <td><?php echo dateFmt($post['dateCreated'], '', '', TRUE); ?> </td> <td> <?php if ($post['published']) { echo '<span style="color:green;">Yes</span>'; } else { echo 'No'; } ?> </td> <td class="tiny"> <?php if (in_array('blog_edit', $this->permission->permissions)) { ?>
<?php } ?> <br /> <?php if ($subchild['active'] && (!$subchild['newBlocks'] && !$subchild['newVersions'])) { ?> <small>Published: <strong><?php echo dateFmt($subchild['datePublished'], '', '', TRUE); ?> </strong> <?php } else { ?> <small>Modified: <strong><?php echo dateFmt($subchild['dateModified'], '', '', TRUE); ?> </strong> <?php } ?> <em>by <?php echo $this->core->lookup_user($subchild['userID'], TRUE); ?> </em></small> </div> <div class="buttons"> <?php echo anchor($subchild['uri'], '<img src="' . base_url() . $this->config->item('staticPath') . '/images/btn_view.png" alt="View" title="View" />'); ?> <?php
function _populate_posts($posts = '') { if ($posts && is_array($posts)) { $x = 0; foreach ($posts as $post) { // get author details $author = $this->blog->lookup_user($post['userID']); // populate template array $data[$x] = array('post:link' => site_url('blog/' . dateFmt($post['dateCreated'], 'Y/m') . '/' . $post['uri']), 'post:title' => $post['postTitle'], 'post:date' => dateFmt($post['dateCreated'], $this->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'post:day' => dateFmt($post['dateCreated'], 'd'), 'post:month' => dateFmt($post['dateCreated'], 'M'), 'post:year' => dateFmt($post['dateCreated'], 'y'), 'post:body' => $this->template->parse_body($post['body'], TRUE, site_url('blog/' . dateFmt($post['dateCreated'], 'Y/m') . '/' . $post['uri'])), 'post:excerpt' => $this->template->parse_body($post['excerpt'], TRUE, site_url('blog/' . dateFmt($post['dateCreated'], 'Y/m') . '/' . $post['uri'])), 'post:author' => $author['displayName'] ? $author['displayName'] : $author['firstName'] . ' ' . $author['lastName'], 'post:author-id' => $author['userID'], 'post:author-email' => $author['email'], 'post:author-gravatar' => 'http://www.gravatar.com/avatar.php?gravatar_id=' . md5(trim($author['email'])) . '&default=' . urlencode(site_url('/static/uploads/avatars/noavatar.gif')), 'post:author-bio' => $author['bio'], 'post:comments-count' => $post['numComments']); // get cats if ($cats = $this->blog->get_cats_for_post($post['postID'])) { $i = 0; foreach ($cats as $cat) { $data[$x]['post:categories'][$i]['category:link'] = site_url('blog/' . url_title(strtolower(trim($cat)))); $data[$x]['post:categories'][$i]['category'] = $cat; $i++; } } // get tags if ($post['tags']) { $tags = explode(',', $post['tags']); $i = 0; foreach ($tags as $tag) { $data[$x]['post:tags'][$i]['tag:link'] = site_url('blog/tag/' . $this->tags->make_safe_tag($tag)); $data[$x]['post:tags'][$i]['tag'] = $tag; $i++; } } $x++; } return $data; } else { return FALSE; } }
function add_event() { // check permissions for this page if (!in_array('events_edit', $this->permission->permissions)) { redirect('/admin/dashboard/permissions'); } // required $this->core->required = array('eventTitle' => array('label' => 'Event title', 'rules' => 'required|trim'), 'description' => 'Description'); // get values $output['data'] = $this->core->get_values('events'); if (count($_POST)) { // set date $this->core->set['dateCreated'] = date("Y-m-d H:i:s"); $this->core->set['tags'] = trim(strtolower($this->input->post('tags'))); $this->core->set['userID'] = $this->session->userdata('userID'); $this->core->set['eventDate'] = date("Y-m-d H:i:s", strtotime($this->input->post('eventDate') . ' 12AM')); $this->core->set['eventEnd'] = $this->input->post('eventEnd') ? date("Y-m-d H:i:s", strtotime($this->input->post('eventEnd') . ' 11.59PM')) : ''; // update if ($this->core->update('events')) { $eventID = $this->db->insert_id(); // update tags $this->events->update_tags($eventID, $this->input->post('tags')); // where to redirect to redirect($this->redirect); } } // set default date $output['data']['eventDate'] = $this->input->post('eventDate') ? $this->input->post('eventDate') : dateFmt(date("Y-m-d H:i:s"), 'd M Y'); // templates $this->load->view($this->includes_path . '/header'); $this->load->view('admin/add_event', $output); $this->load->view($this->includes_path . '/footer'); }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("t"); $fields["group_id"] = -1; $fields["type_id"] = -1; extract($fields, EXTR_SKIP); $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); $sql = "SELECT * FROM cubit.assetgrp ORDER BY grpname ASC"; $group_rslt = db_exec($sql) or errDie("Unable to retrieve asset group."); if ($group_id == -1) { $none_sel = "selected='selected'"; $all_sel = ""; } elseif ($group_id == 0) { $none_sel = ""; $all_sel = "selected='selected'"; } else { $none_sel = ""; $all_sel = ""; } $group_sel = "<select name='group_id' style='width: 100%'\r\n\t\t\t\t onchange='javascript:document.form.submit()'>"; $group_sel .= "<option value='-1' {$none_sel}>[None]</option>"; $group_sel .= "<option value='0' {$all_sel}>[All]</option>"; while ($group_data = pg_fetch_array($group_rslt)) { if ($group_id == $group_data["grpid"]) { $sel = "selected='selected'"; } else { $sel = ""; } $group_sel .= "<option value='{$group_data['grpid']}' {$sel}>\r\n\t\t\t{$group_data['grpname']}\r\n\t\t</option>"; } $group_sel .= "</select>"; $sql = "SELECT * FROM cubit.asset_types ORDER BY name ASC"; $type_rslt = db_exec($sql) or errDie("Unable to retrieve asset type."); if ($type_id == -1) { $none_sel = "selected='selected'"; $all_sel = ""; } elseif ($type_id == 0) { $none_sel = ""; $all_sel = "selected='selected'"; } else { $none_sel = ""; $all_sel = ""; } $type_sel = "<select name='type_id' style='width: 100%'\r\n\t\t\t\t onchange='javascript:document.form.submit()'>"; $type_sel .= "<option value='-1' {$none_sel}>[None]</option>"; $type_sel .= "<option value='0' {$all_sel}>[All]</option>"; while ($type_data = pg_fetch_array($type_rslt)) { if ($type_id == $type_data["id"]) { $sel = "selected='selected'"; } else { $sel = ""; } $type_sel .= "<option value='{$type_data['id']}' {$sel}>\r\n\t\t\t\t\t\t{$type_data['name']}\r\n\t\t\t\t\t </option>"; } $type_sel .= "</select>"; $OUTPUT = "\r\n\t<center>\r\n\t<h3>Availability Report</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td bgcolor='#ff0000'> </td><td>Hired Out</td>\r\n\t\t\t<td bgcolor='#00ff00'> </td><td>Available</td>\r\n\t\t\t<td bgcolor='#ffa200'> </td><td>Booked</td>\r\n\t\t\t<td bgcolor='#ffff00'> </td><td>In Workshop</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t<p></p>\r\n\t<form method='post' action='" . SELF . "' name='form'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select »' /></td>\r\n\t\t</tr>\r\n\t\t<tr><td colspan='4'>\r\n\t\t<table " . TMPL_tblDflts . " width='100%'>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td colspan='2' width='50%'>{$group_sel}</td>\r\n\t\t\t\t<td colspan='2' width='50%'>{$type_sel}</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</td></tr>\r\n\t</table>\r\n\t</form>"; $where = array(); if ($group_id) { $where[] = "grpid='{$group_id}'"; } if ($type_id) { $where[] = "type_id='{$type_id}'"; } if (count($where)) { $where = "WHERE " . implode(" AND ", $where); } else { $where = ""; } // Retrieve assets $sql = "SELECT * FROM cubit.assets {$where}"; $asset_rslt = db_exec($sql) or errDie("Unable to retrieve assets."); $assets_out = ""; while ($asset_data = pg_fetch_array($asset_rslt)) { if (!isOurs($asset_data["id"])) { continue; } $assets_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td align='center'>\r\n\t\t\t\t" . getSerial($asset_data["id"], 1) . "<br />\r\n\t\t\t\t{$asset_data['des']}\r\n\t\t\t</td>\r\n\t\t\t" . availability($from_date, $to_date, $asset_data["id"]) . "\r\n\t\t</tr>"; } // Do the headers here so we can choose not to show it when no results found $headers = date_headers($from_date, $to_date); if (empty($assets_out)) { $headers = ""; $assets_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td><li>No results found.</li></td>\r\n\t\t</tr>"; } $OUTPUT .= "<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Plant</th>\r\n\t\t\t{$headers}\r\n\t\t</tr>\r\n\t\t{$assets_out}\r\n\t</table>"; return $OUTPUT; }
?> "> <td class="col1"><?php echo in_array('shop_edit', $this->permission->permissions) ? anchor('/admin/shop/edit_product/' . $product['productID'], $product['productName']) : $product['productName']; ?> </td> <td class="col2"><?php echo $product['subtitle']; ?> </td> <td class="col3"><?php echo $product['catalogueID']; ?> </td> <td class="col4"><?php echo dateFmt($product['dateCreated'], '', '', TRUE); ?> </td> <td class="col5"><?php echo currency_symbol(); echo number_format($product['price'], 2); ?> </td> <?php if ($this->site->config['shopStockControl']) { ?> <td class="col6"><?php echo $product['stock'] > 0 ? '<span style="color:green;">' . $product['stock'] . '</span>' : '<span style="color:red;">' . $product['stock'] . '</span>'; ?> </td> <?php
function cusDetailsAll() { extract($_REQUEST); global $set_mainFont; $fields = array(); $fields["stmnt_type"] = "detailed"; extract($fields, EXTR_SKIP); if (!isset($report_type)) { $report_type = "all"; } switch ($report_type) { case "all": $search = ""; break; case "bal": $search = "balance != '0.00' AND "; break; default: $search = "true"; } $search2 = ""; if (isset($filt_class) and strlen($filt_class) > 0 and $filt_class != "0") { $search2 .= " class = '{$filt_class}' AND "; } if (isset($filt_cat) and strlen($filt_cat) > 0 and $filt_cat != "0") { $search2 .= " category = '{$filt_cat}' AND "; } $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); $fdate = $from_date; $pdf =& new Cezpdf(); $pdf->selectFont($set_mainFont); // Heading -------------------------------------------------------------- $heading = array(array('')); #check for sort ... if (isset($sort) and $sort == "branch") { $sortinga = "ORDER BY branch"; $sorting = "branch,"; } else { $sortinga = ""; $sorting = ""; } // Customer info --------------------------------------------------------- db_conn("cubit"); $sql = "SELECT * FROM customers WHERE {$search} {$search2} div='" . USER_DIV . "' ORDER BY surname"; $custmnt_rslt = db_exec($sql) or errDie("Unable to retrieve customer information from Cubit."); if (pg_numrows($custmnt_rslt) < 1) { return "<li class='err'>No Customers Found Matching Criteria.</li>"; } while ($cust_data = pg_fetch_array($custmnt_rslt)) { $totout = 0; $cusnum = $cust_data["cusnum"]; // Company info ---------------------------------------------------------- db_conn("cubit"); $sql = "SELECT * FROM compinfo WHERE div='" . USER_DIV . "'"; $ciRlst = db_exec($sql) or errDie("Unable to retrieve the company information from Cubit."); $compinf = pg_fetch_array($ciRlst); $compinfo = array(array(COMP_NAME), array("{$compinf['addr1']}"), array("{$compinf['addr2']}"), array("{$compinf['addr3']}"), array("{$compinf['addr4']}"), array(""), array("<b>Tel:</b> {$compinf['tel']}"), array("<b>Fax:</b> {$compinf['fax']}"), array("<b>VAT REG:</b> {$compinf['vatnum']}"), array("<b>COMPANY REG:</b> {$compinf['regnum']}")); $info = array(); /* base for balance brought forward */ $info[0] = array("Date" => "", "Ref no" => "", "Details" => "<b>Balance Brought Forward: </b>", "Amount" => "", "Balance" => ""); #check for sort ... if (isset($sort) and $sort == "branch") { $sortinga = "ORDER BY branch, date"; $sorting = "branch,"; } else { $sortinga = "ORDER BY date"; $sorting = ""; } // Should payments or credit notes be displayed $payment_sql = ""; if ($stmnt_type == "open") { $payment_sql = "\n\t\t\tAND type NOT LIKE 'Payment for%'\n\t\t\tAND type NOT LIKE '%Credit Note%for invoice%'"; } // Retrieve statement information $sql = "\n\t\tSELECT date, invid, type, amount, docref, branch FROM cubit.stmnt\n\t\tWHERE cusnum='{$cusnum}' {$payment_sql} AND\n\t\t\tdate BETWEEN '{$from_date}' AND '{$to_date}'\n\t\tORDER BY date, id ASC"; $stmnt_rslt = db_exec($sql) or errrDie("Unable to retrieve statement."); // Retrieve balance before the 'from date' $sql = "\n\t\tSELECT sum(amount) FROM cubit.stmnt\n\t\tWHERE cusnum='{$cusnum}' AND date < '{$from_date}'"; $balance_rslt = db_exec($sql) or errDie("Unable to retrieve balance."); $balance = pg_fetch_result($balance_rslt, 0); // $oldest_date = mktime(0, 0, 0, date("m"), 1, date("Y")); $oldest_date = mktime(0, 0, 0, $from_month, $from_day - 1, $from_year); if (pg_numrows($stmnt_rslt) < 1) { $info[] = array("Date" => "", "Ref no" => "", "Details" => "No invoices for this month", "Amount" => ""); // Fill the info array } else { while ($stmnt_data = pg_fetch_array($stmnt_rslt)) { // Deduct payments and credit notes from balances only // if this is an open item statement if ($stmnt_type == "open" && ($stmnt_data["type"] == "Invoice" || $stmnt_data["type"] == "Non-Stock Invoice")) { $sql = "\n\t\t\t\t\tSELECT sum(amount) FROM cubit.stmnt\n\t\t\t\t\tWHERE type LIKE 'Payment for % {$stmnt_data['invid']}'\n\t\t\t\t\t\tOR type LIKE '%Credit Note%for invoice%{$stmnt_data['invid']}'"; $payment_rslt = db_exec($sql) or errDie("Unable to retrieve payments."); $payment = pg_fetch_result($payment_rslt, 0); // If the amount has been paid/credit note'ed in full // then no need to display this line if ($stmnt_data["amount"] == $payment * -1) { continue; } $stmnt_data["amount"] += $payment; } // Increase the balance $balance += $stmnt_data["amount"]; // What should we prepend the ref num with, either invoice or credit note if (preg_match("/Invoice/", $stmnt_data["type"])) { $refnum = "INV"; } elseif (preg_match("/Credit Note/", $stmnt_data["type"])) { $refnum = "CR"; } else { $refnum = ""; } $refnum .= " " . $stmnt_data["invid"]; $info[] = array("Date" => makewidth(&$pdf, 60, 12, $stmnt_data['date']), "Ref no" => makewidth(&$pdf, 70, 12, $refnum), "Details" => makewidth(&$pdf, 200, 12, "{$stmnt_data['type']} {$stmnt_data['branch']}"), "Amount" => makewidth(&$pdf, 75, 12, "{$cust_data['currency']}{$stmnt_data['amount']}"), "Balance" => makewidth(&$pdf, 75, 12, "{$cust_data['currency']}" . sprint($balance) . "")); } } if (isset($from_date) && isset($to_date)) { # get overlapping amount // $sql = " // SELECT sum(amount) as amount FROM cubit.stmnt // WHERE cusnum='$cusnum' AND date>'$to_date'"; // $balRslt = db_exec ($sql) or errDie ("Unable to retrieve invoices statement from database."); // $bal = pg_fetch_array ($balRslt); $get_bal = "SELECT sum(amount) FROM stmnt WHERE cusnum = '{$cust_data['cusnum']}'"; $run_bal = db_exec($get_bal) or errDie("Unable to get customer balance."); if (pg_numrows($run_bal) < 1) { $cust_data['balance'] = sprint(0); } else { $cust_data['balance'] = sprint(pg_fetch_result($run_bal, 0, 0)); } $get_bal = "SELECT sum(amount) FROM stmnt WHERE cusnum = '{$cust_data['cusnum']}' AND date>'{$from_date}'"; $run_bal = db_exec($get_bal) or errDie("Unable to get customer balance."); if (pg_numrows($run_bal) < 1) { $bal['amount'] = sprint(0); } else { $bal['amount'] = sprint(pg_fetch_result($run_bal, 0, 0)); } $cust_data['balance'] = $cust_data['balance'] - $bal['amount']; } /* alter the balance brought forward entry's (info[0]) amount */ if ($cust_data['location'] == 'int') { $cust_data['balance'] = $cust_data['fbalance']; } $balbf = $cust_data['balance'] - $totout; $balbf = sprint($balbf); // $balbf = "test"; $info[0]["Date"] = date("d-m-Y", $oldest_date); // - 24*60*60); $info[0]["Amount"] = "{$cust_data['currency']}{$balbf}"; $custinfo = array(array("{$cust_data['surname']}")); // Add the address to the array $custaddr_ar = explode("\n", $cust_data["paddr1"]); foreach ($custaddr_ar as $addr) { $custinfo[] = array(pdf_lstr("{$addr}", 70)); } $custinfo[] = array(""); $custinfo[] = array("<b>Account Number:</b> {$cust_data['accno']}"); //$custinfo[] = array("<b>Balance Brought Forward: </b>$cust_data[currency]$balbf"); // Comments -------------------------------------------------------------- if (isset($comment)) { db_conn("cubit"); $sql = "SELECT comment FROM saved_statement_comments WHERE id='{$comment}'"; $rslt = db_exec($sql) or errDie("Unable to retrieve comments from Cubit."); $default_comment = base64_decode(pg_fetch_result($rslt, 0)); } elseif (isset($b64_comments)) { $default_comment = base64_decode($b64_comments); } else { db_conn("cubit"); $sql = "SELECT value FROM settings WHERE constant='DEFAULT_STMNT_COMMENTS'"; $cmntRslt = db_exec($sql) or errDie("Unable to retrieve comments from Cubit."); $default_comment = base64_decode(pg_fetch_result($cmntRslt, 0)); } $comments = array(); $default_comment = wordwrap($default_comment, 55, "\n"); $default_comment_ar = explode("\n", $default_comment); $i = 1; foreach ($default_comment_ar as $val) { if ($i == 4) { $comments[] = array(pdf_lstr($val, 55)); break; } else { $comments[] = array($val); } $i++; } #handle unset bank information if ($cust_data['bankid'] == "0") { $get_bid = "SELECT * FROM bankacct LIMIT 1"; $run_bid = db_exec($get_bid) or errDie("Unable to get default bank information."); if (pg_numrows($run_bid) < 1) { #no bank accounts in cubit ???? $bank_data = array(); $bank_data['bankname'] = ""; $bank_data['branchname'] = ""; $bank_data['branchcode'] = ""; $bank_data['accnum'] = ""; } else { $cust_data['bankid'] = pg_fetch_result($run_bid, 0, 0); $bank_data = qryBankAcct($cust_data['bankid']); } } else { $bank_data = qryBankAcct($cust_data['bankid']); } $banking = array(array("{$bank_data['bankname']}"), array("<b>Branch: </b>{$bank_data['branchname']}"), array("<b>Branch Code: </b>{$bank_data['branchcode']}"), array("<b>Account Number: </b>{$bank_data['accnum']}")); $get_bal = "SELECT sum(amount) FROM stmnt WHERE cusnum = '{$cust_data['cusnum']}'"; $run_bal = db_exec($get_bal) or errDie("Unable to get customer balance."); if (pg_numrows($run_bal) < 1) { $cust_data['balance'] = sprint(0); } else { $cust_data['balance'] = sprint(pg_fetch_result($run_bal, 0, 0)); } // Totals ---------------------------------------------------------------- $totals = array(array(""), array("<b>Total Outstanding Balance</b> : {$cust_data['currency']} " . sprint($cust_data["balance"]))); // Age analysis ---------------------------------------------------------- if ($cust_data['location'] == 'int') { $cust_data['balance'] = $cust_data['fbalance']; } $balbf = $cust_data['balance'] - $totout; $balbf = sprint($balbf); $cust_data['balance'] = sprint($cust_data['balance']); // $from_date = date ("Y-m-d",mktime (0,0,0,date("m"),"01",date("Y"))); $from_date = "{$from_year}-{$from_month}-{$from_day}"; # Check type of age analisys if (div_isset("DEBT_AGE", "mon")) { $curr = ageage($cust_data['cusnum'], 0, $cust_data['fcid'], $cust_data['location']); $age30 = ageage($cust_data['cusnum'], 1, $cust_data['fcid'], $cust_data['location']); $age60 = ageage($cust_data['cusnum'], 2, $cust_data['fcid'], $cust_data['location']); $age90 = ageage($cust_data['cusnum'], 3, $cust_data['fcid'], $cust_data['location']); $age120 = ageage($cust_data['cusnum'], 4, $cust_data['fcid'], $cust_data['location']); } else { $curr = cust_age($cust_data['cusnum'], 29, $cust_data['fcid'], $cust_data['location'], $to_month, $to_date, $from_date); $age30 = cust_age($cust_data['cusnum'], 59, $cust_data['fcid'], $cust_data['location'], $to_month, $to_date, $from_date); $age60 = cust_age($cust_data['cusnum'], 89, $cust_data['fcid'], $cust_data['location'], $to_month, $to_date, $from_date); $age90 = cust_age($cust_data['cusnum'], 119, $cust_data['fcid'], $cust_data['location'], $to_month, $to_date, $from_date); $age120 = cust_age($cust_data['cusnum'], 149, $cust_data['fcid'], $cust_data['location'], $to_month, $to_date, $from_date); } $custtot = $curr + $age30 + $age60 + $age90 + $age120; // if(sprint($custtot) != sprint($cust_data['balance'])) { // $curr = sprint($curr + $cust_data['balance'] - $custtot); // $custtot = sprint($cust_data['balance']); // } $age = array(array("Current" => "<b>Current</b>", "30 Days" => "<b>30 Days:</b>", "60 Days" => "<b>60 Days</b>", "90 Days" => "<b>90 Days</b>", "120 Days" => "<b>120 Days</b>"), array("Current" => $curr, "30 Days" => $age30, "60 Days" => $age60, "90 Days" => $age90, "120 Days" => $age120)); // Table layout ---------------------------------------------------------- $ic = 0; while (++$ic * 25 < count($info)) { } // Draw the pages, determine by the amount of items how many pages // if items > 25 start a new page $info_print = array(); for ($i = 0; $i < $ic; $i++) { if ($i) { $pdf->ezNewPage(); } if (isset($from_date) && isset($to_date)) { $date = "{$from_date} to {$to_date}"; $dalign_x = 130; } else { $date = date("d-m-Y"); $dalign_x = 105; } // Heading $heading_pos = drawTable(&$pdf, $heading, 0, 0, 520, 5); drawText(&$pdf, "<b>Page " . ($i + 1) . "</b>", 8, $heading_pos['x'] / 2 - 8, 10); drawText(&$pdf, "<b>{$compinf['compname']}</b>", 18, 8, $heading_pos['y'] / 2 + 6); drawText(&$pdf, "<b>Statement</b>", 18, $heading_pos['x'] - 120, $heading_pos['y'] / 2); drawText(&$pdf, $date, 10, $heading_pos['x'] - $dalign_x, $heading_pos['y'] / 2 + 18); $custinfo_pos = drawTable(&$pdf, $custinfo, 0, $heading_pos['y'] + 5, 300, 10); $compinfo_pos = drawTable(&$pdf, $compinfo, $custinfo_pos['x'], $heading_pos['y'] + 5, 220, 10); $info_start = $i * 25; if ($i) { $info_start++; } if ($info_start >= count($info) - 25) { $info_end = count($info) - 1; } else { $info_end = ($i + 1) * 25; } $info_print = array(); for ($j = $info_start; $j <= $info_end; $j++) { $info_print[$j] = $info[$j]; } // Adjust the column widths $cols = array("Date" => array("width" => 60), "Proforma Inv no" => array("width" => 70), "Ref no" => array("width" => 80), "Amount" => array("width" => 75, "justification" => "right"), "Balance" => array("width" => 75, "justification" => "right")); $info_pos = drawTable(&$pdf, $info_print, 0, $custinfo_pos['y'] + 5, 520, 25, $cols, 1); $comments_pos = drawTable(&$pdf, $comments, 0, $info_pos['y'] + 5, 260, 4); $banking_pos = drawTable(&$pdf, $banking, $comments_pos['x'], $info_pos['y'] + 5, 260, 4); $totals_pos = drawTable(&$pdf, $totals, 0, $comments_pos['y'] + 5, 520, 3); $age_pos = drawTable(&$pdf, $age, 0, $totals_pos['y'], 520, 2); drawText(&$pdf, "<b>Cubit Accounting</b>", 6, 0, $age_pos['y'] + 20); } $pdf->ezNewPage(); } $pdf->ezStream(); }
function edit($page) { // check user is logged in, if not send them away from this controller if (!$this->session->userdata('session_user')) { redirect('/users/login/' . $this->core->encode($this->uri->uri_string())); } // get page $uri = $this->core->decode($page); // deal with post if (count($_POST)) { if ($this->wiki->update_page($uri)) { redirect('/wiki/' . $uri); } } // load wiki page $wikipage = $this->wiki->get_page(FALSE, $uri); // get versions if ($versions = $this->wiki->get_versions($wikipage['pageID'])) { foreach ($versions as $version) { $output['versions'][] = array('version' => $wikipage['versionID'] == $version['versionID'] ? '<strong>' . dateFmt($version['dateCreated']) . (($user = $this->wiki->lookup_user($version['userID'], TRUE)) ? ', by ' . $user : '') . (($notes = $version['notes']) ? ' <em>(' . $notes . ')</em>' : '') . '</strong>' : dateFmt($version['dateCreated']) . (($user = $this->wiki->lookup_user($version['userID'], TRUE)) ? ', by ' . $user : '') . (($notes = $version['notes']) ? ' <em>(' . $notes . ')</em>' : '') . ' | ' . anchor('/wiki/revert/' . $this->core->encode($uri) . '/' . $version['versionID'], 'Revert', 'onclick="return confirm(\'You will lose unsaved changes. Continue?\');"')); } } // get categories if ($categories = $this->wiki->get_categories()) { foreach ($categories as $category) { $options[$category['catID']] = $category['catName']; } } $options[0] = 'No Category'; // populate template $output['wikipage:link'] = site_url('/wiki/' . $wikipage['uri']); $output['form:title'] = $wikipage['pageName']; $output['select:categories'] = @form_dropdown('catID', $options, set_value('catID', $wikipage['catID']), 'id="category" class="formelement"'); $output['form:body'] = $wikipage['body']; $output['form:notes'] = $this->input->post('notes'); // set title $output['page:title'] = $this->site->config['siteName'] . ' | Edit Wiki'; $output['page:heading'] = 'Edit Page - "' . $uri . '"'; // display with cms layer $this->pages->view('wiki_form', $output, TRUE); }
<?php foreach ($versions as $version) { ?> <li> <?php if ($data['versionID'] == $version['versionID']) { ?> <strong><?php echo dateFmt($version['dateCreated'], '', '', TRUE) . (($user = $this->core->lookup_user($version['userID'], TRUE)) ? ' <em>(by ' . $user . ')</em>' : ''); ?> </strong> <?php } else { ?> <?php echo dateFmt($version['dateCreated'], '', '', TRUE) . (($user = $this->core->lookup_user($version['userID'], TRUE)) ? ' <em>(by ' . $user . ')</em>' : ''); ?> - <?php echo anchor('/admin/pages/revert_template/' . $version['objectID'] . '/' . $version['versionID'], 'Revert', 'onclick="return confirm(\'You will lose unsaved changes. Continue?\');"'); ?> <?php } ?> </li> <?php } ?> <?php } ?> </ul>
function search($forumID, $tag = '') { // get forum info and redirect if forum isn't set if (!$forumID || !($forum = $this->forums->get_forum($forumID))) { redirect('/forums'); } // get partials $output = $this->partials; // set tags $query = $tag ? $tag : $this->input->post('query'); if ($topicIDs = $this->forums->search_forums($query)) { // get topics if ($topics = $this->forums->get_topics($forumID, NULL, $topicIDs)) { foreach ($topics as $topic) { $output['topics'][] = array('topic:title' => $topic['topicTitle'], 'topic:link' => site_url('/forums/viewtopic/' . $topic['topicID']), 'topic:user' => anchor('/users/profile/' . $topic['userID'], $this->forums->lookup_user($topic['userID'], TRUE)), 'topic:class' => $topic['sticky'] ? 'sticky' : '', 'topic:replies' => $topic['replies'], 'topic:views' => $topic['views'], 'topic:latest-post' => ($latestPost = $this->forums->get_post($topic['lastPostID'])) ? '<small>Posted: ' . dateFmt($latestPost['dateCreated']) . ' by ' . anchor('/users/profile/' . $latestPost['userID'], $latestPost['displayName'] ? $latestPost['displayName'] : $latestPost['firstName'] . ' ' . $latestPost['lastName']) . '</small>' : ''); } } } // populate template $output['forum:title'] = $forum['forumName']; $output['forum:id'] = $forum['forumID']; // set title $output['page:title'] = $this->site->config['siteName'] . ' | Searching forums for "' . $query . '"'; $output['page:heading'] = 'Search forum for: "' . $query . '"'; // set pagination and breadcrumb $output['pagination'] = ($pagination = $this->pagination->create_links()) ? $pagination : ''; $output['breadcrumb'] = (isset($forum['catName']) ? anchor('/forums', $forum['catName']) : anchor('/forums', 'Forums')) . ' > ' . anchor('/forums/viewforum/' . $forum['forumID'], $forum['forumName']); // display with cms layer $this->pages->view('forums_search', $output, TRUE); }
<ul> <?php foreach ($yesterdaysActivity as $visit) { $style = ''; ?> <?php // get userdata $userdata = @unserialize($visit['userdata']); ?> <li> <?php if ($userdata) { ?> <small><?php echo dateFmt($visit['date'], 'g:i a'); ?> :</small> <?php if ($userdata['userID']) { ?> <?php echo anchor('/admin/users/edit/' . $userdata['userID'], $userdata['firstName'] . ' ' . $userdata['lastName']); ?> <?php echo strtotime($userdata['dateCreated']) >= strtotime(date("Y-m-d 00:00:00", strtotime('1 day ago'))) ? '<strong>signed up</strong>' : 'returned'; ?> <?php } else { ?> <?php
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); $fields["search"] = "~:BLANK:~"; $fields["filter"] = ""; $fields["rsearch"] = ""; extract($fields, EXTR_SKIP); $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); $filter_list = array("cust" => "Customers", "inv" => "Hire No"); $filter_sel = "<select name='filter' style='width: 100%'>"; foreach ($filter_list as $key => $value) { if ($filter == $key) { $sel = "selected='selected'"; } else { $sel = ""; } $filter_sel .= "<option value='{$key}' {$sel}>{$value}</option>"; } $filter_sel .= "</select>"; if (!empty($search) && $filter == "inv") { $nsearch = $search; if (!is_numeric($search)) { $nsearch = 0; } $rsearch = "AND invnum='{$nsearch}'"; } if ($search == "~:BLANK:~") { $sql = "SELECT * FROM hire.hire_invoices\r\n\t\t\t\t\tWHERE done='haha notreally' and printed='youmustbekidding'"; $search = ""; } else { $sql = "SELECT * FROM hire.hire_invoices\r\n\t\t\t\tWHERE done='y' AND printed='y'\r\n\t\t\t\t\tAND odate BETWEEN '{$from_date}' AND '{$to_date}' {$rsearch}\r\n\t\t\t\tORDER BY odate DESC"; } $hinv_rslt = db_exec($sql) or errDie("Unable to retrieve hire notes."); $notes_out = ""; while ($hinv_data = pg_fetch_array($hinv_rslt)) { if (!empty($search) && $filter == "cust") { $sql = "SELECT * FROM cubit.customers\r\n\t\t\t\t\tWHERE cusname ILIKE '%{$search}%' OR surname ILIKE '%{$search}%'"; $cust_rslt = db_exec($sql) or errDie("Unable to retrieve customers."); if (!pg_num_rows($cust_rslt)) { continue; } } // Retrieve the customer $sql = "SELECT * FROM cubit.customers WHERE cusnum='{$hinv_data['cusnum']}'"; $cust_rslt = db_exec($sql) or errDie("Unable to retrieve customer."); $cust_data = pg_fetch_array($cust_rslt); // Check if we've got a signed hire note $sql = "SELECT * FROM hire.signed_hirenotes WHERE invid='{$hinv_data['invid']}'"; $sh_rslt = db_exec($sql) or errDie("Unable to check for scanned hire note."); $sh_data = pg_fetch_array($sh_rslt); if (!pg_num_rows($sh_rslt)) { continue; } $notes_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$hinv_data['odate']}</td>\r\n\t\t\t<td>H" . getHirenum($hinv_data["invid"], 1) . "</td>\r\n\t\t\t<td>{$cust_data['surname']} {$cust_data['cusname']}</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='" . SELF . "?key=get&id={$sh_data['id']}'>\r\n\t\t\t\t\tSigned Hire Note\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($notes_out)) { $notes_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No results, please enter a customer name or hire\r\n\t\t\tno.</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Signed Hire Notes</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select' style='font-weight: bold' /></td>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<th colspan='4'>Search</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='2'>\r\n\t\t\t\t<input type='text' name='search' value='{$search}' style='width: 100%;' />\r\n\t\t\t</td>\r\n\t\t\t<td>{$filter_sel}</td>\r\n\t\t\t<td><input type='submit' value='Search' style='font-weight: bold' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Date</th>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Options</th>\r\n\t\t</tr>\r\n\t\t{$notes_out}\r\n\t</table>\r\n\t</center>"; return $OUTPUT; }
} elseif (@in_array($user['groupID'], $adminGroups)) { $class = 'class="orange"'; } $username = $user['username'] ? $user['username'] : '******'; $userlink = in_array('users_edit', $this->permission->permissions) ? anchor('/admin/users/edit/' . $user['userID'], $username) : $username; ?> <tr <?php echo $class; ?> > <td><?php echo $userlink; ?> </td> <td><?php echo dateFmt($user['dateCreated'], '', '', TRUE); ?> </td> <td><?php echo trim($user['firstName'] . ' ' . $user['lastName']); ?> </td> <td><?php echo $user['email']; ?> </td> <td> <?php if ($user['groupID'] == $this->site->config['groupID'] || $user['groupID'] < 0) { echo 'Administrator'; } elseif (@in_array($user['groupID'], $adminGroups)) {
<?php $i = 0; foreach ($sites as $site) { $class = $i % 2 ? ' class="alt"' : ''; $i++; ?> <tr<?php echo $class; ?> > <td><?php echo anchor('/halogy/edit_site/' . $site['siteID'], $site['siteName']); ?> </td> <td><?php echo dateFmt($site['dateCreated']); ?> </td> <td><?php echo $site['siteDomain']; ?> </td> <td><?php echo $site['altDomain']; ?> </td> <td> <?php if ($site['active']) { echo '<span style="color:green"><strong>Active</strong></span>'; }
<title><?php echo xml_convert($entry['postTitle']); ?> </title> <link><?php echo site_url('blog/' . dateFmt($entry['dateCreated'], 'Y/m') . '/' . $entry['uri']); ?> </link> <guid><?php echo site_url('blog/' . dateFmt($entry['dateCreated'], 'Y/m') . '/' . $entry['uri']); ?> </guid> <description><![CDATA[ <?php echo $this->template->parse_body($entry['body'], TRUE, site_url('blog/' . dateFmt($entry['dateCreated'], 'Y/m') . '/' . $entry['uri'])); ?> ]]></description> <pubDate><?php echo dateFmt($entry['dateCreated'], 'r'); ?> </pubDate> </item> <?php } ?> </channel></rss>
function write() { extract($_REQUEST); require_lib("validate"); $v = new validate(); $v->isOk($asset_id, "num", 1, 9, "Invalid asset selection."); $v->isOk($cust_id, "num", 1, 9, "Invalid customer selection."); $v->isOk($from_year, "num", 4, 4, "Invalid from date (year)."); $v->isOk($from_month, "num", 1, 2, "Invalid from date (month)."); $v->isOk($from_day, "num", 1, 2, "Invalid from date (day)."); $v->isOk($to_year, "num", 4, 4, "Invalid to date (year)."); $v->isOk($to_month, "num", 1, 2, "Invalid to date (month)."); $v->isOk($to_day, "num", 1, 2, "Invalid to date (day)."); $v->isOk($units, "num", 1, 80, "Invalid units."); // Booking date $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); $e_from = getDTEpoch("{$from_date} 0:00:00"); $e_to = getDTEpoch("{$to_date} 23:59:59"); for ($i = $e_from; $i < $e_to; $i += DAYS) { $date = date("Y-m-d", $i); if (unitsAvailable($asset_id, $date) - $units < 0) { $available = unitsAvailable($asset_id, $date); $v->addError(0, "Only {$available} units available on {$date}."); } } if ($v->isError()) { return enter($v->genErrors()); } if ($page_option == "edit") { $sql = "\r\n\t\tUPDATE hire.bookings SET asset_id='{$asset_id}', cust_id='{$cust_id}',\r\n\t\t\tfrom_date='{$from_date}', to_date='{$to_date}', units='{$units}'\r\n\t\tWHERE id='{$id}'"; } else { $sql = "\r\n\t\tINSERT INTO hire.bookings (asset_id, cust_id, from_date, to_date, units)\r\n\t\tVALUES ('{$asset_id}', '{$cust_id}', '{$from_date}', '{$to_date}', '{$units}')"; } db_exec($sql) or errDie("Unable to save booking."); $OUTPUT = "<h3>" . ucfirst($page_option) . " Booking</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Write</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><li>Successfully saved booking.</li></td>\r\n\t\t</tr>\r\n\t</table>"; return $OUTPUT; }
<input type="submit" value="Update Ticket" class="button nolabel" /> </div> <div class="clear"></div> <div class="message"> <p> <strong>Subject:</strong> [#<?php echo $data['ticketID']; ?> ]:</strong> <?php echo $data['subject']; ?> <br /> <strong>Date sent:</strong> <?php echo dateFmt($data['dateCreated']); ?> <br /> <?php if ($data['formName']) { ?> <strong>Web Form:</strong> <?php echo $data['formName']; ?> <?php } ?> </p> </div> <div id="tpl-2col">
function search($query = '') { // load helper $this->load->helper('bbcode'); // get partials $output = $this->partials; // set query $data['query'] = $query ? $query : $this->input->post('query'); // search if ($messages = $this->messages->search_messages($data['query'])) { foreach ($messages as $message) { $output['messages'][] = array('message:class' => $message['unread'] && $message['userID'] != $this->session->userdata('userID') ? ' unread ' : '', 'user:avatar' => anchor('/users/profile/' . $message['userID'], display_image($this->users->get_avatar($message['avatar']), 'User Avatar', 40, 'class="avatar"', $this->config->item('staticPath') . '/images/noavatar.gif')), 'user:name' => $message['displayName'] ? $message['displayName'] : $message['firstName'] . ' ' . $message['lastName'], 'user:link' => site_url('/users/profile/' . $message['userID']), 'message:link' => site_url('/messages/read/' . ($message['parentID'] > 0 ? $message['parentID'] . '#reply' . $message['lastMessageID'] : $message['messageID'])), 'message:title' => $message['subject'], 'message:date' => dateFmt($message['dateCreated'], $this->site->config['dateOrder'] == 'MD' ? 'M jS Y, H:i' : 'jS M Y, H:i'), 'message:body' => strlen(bbcode($message['message'])) > 80 ? substr(bbcode($message['message']), 0, 100) . '...' : bbcode($message['message']), 'message:id' => $message['messageID']); } } // set pagination $output['pagination'] = ($pagination = $this->pagination->create_links()) ? $pagination : ''; // set title $output['page:title'] = $this->site->config['siteName'] . ' - Searching Messages for "' . $data['query'] . '"'; $output['page:heading'] = 'Search Messages for: "' . $data['query'] . '"'; // display with cms layer $this->pages->view('community_messages', $output, 'community'); }
$style = 'background: #FFFCDF;'; } ?> <?php // get userdata $userdata = @unserialize($visit['userdata']); ?> <tr class="<?php echo $class; ?> " style="<?php echo $style; ?> "> <td><small><?php echo dateFmt($visit['date'], '', '', TRUE); ?> </small></td> <td> <?php if ($visit['userdata']) { ?> <?php echo anchor('/admin/users/edit/' . $userdata['userID'], $userdata['firstName'] . ' ' . $userdata['lastName']); ?> <?php } else { ?> Guest <?php }
function orders() { // get partials $output = $this->partials; // check user is logged in, if not send them away from this controller if (!$this->session->userdata('session_user')) { redirect('/shop/login/' . $this->core->encode($this->uri->uri_string())); } // grab data and display if ($orders = $this->shop->get_orders('ALL', $this->session->userdata('userID'))) { foreach ($orders as $order) { $output['orders'][] = array('order:id' => $order['transactionCode'], 'order:date' => dateFmt($order['dateCreated']), 'order:amount' => currency_symbol() . number_format($order['amount'], 2), 'order:link' => site_url('/shop/view_order/' . $order['transactionID'])); } } // set pagination and breadcrumb $output['pagination'] = ($pagination = $this->pagination->create_links()) ? $pagination : ''; // set page title $output['page:title'] = 'My Orders' . ($this->site->config['siteName'] ? ' - ' . $this->site->config['siteName'] : ''); // display with cms layer $this->pages->view('shop_orders', $output, TRUE); }
<?php echo $message; ?> </div> <?php } ?> <div class="message"> <p> <strong>Order ID #:</strong> <?php echo $order['transactionCode']; ?> <br /> <strong>Date:</strong> <?php echo dateFmt($order['dateCreated'], '', '', TRUE); ?> <br /> <?php if ($order['discountCode']) { ?> <strong>Discount Code:</strong> <?php echo $order['discountCode']; ?> <?php } ?> </p> </div> <div id="tpl-3col">
<tr> <th>Date Posted</th> <th>Product</th> <th>Author</th> <th>Email</th> <th>Review</th> <th class="narrow">Status</th> <th class="tiny"> </th> <th class="tiny"> </th> </tr> <?php foreach ($reviews as $review) { ?> <tr> <td><?php echo dateFmt($review['dateCreated']); ?> </td> <td><?php echo anchor('/shop/viewproduct/' . $review['productID'], $review['productName']); ?> </td> <td><?php echo $review['fullName']; ?> </td> <td><?php echo $review['email']; ?> </td> <td><?php
function parse_modules($body, $template) { // get web forms if (preg_match_all('/{webform:([A-Za-z0-9_\\-]+)}/i', $body, $matches)) { // filter matches $webformID = preg_replace('/{|}/', '', $matches[0][0]); $webform = $this->CI->core->get_web_form_by_ref($matches[1][0]); $template[$webformID] = ''; $required = array(); // get web form if ($webform) { // set fields if ($webform['fieldSet'] == 1) { $required[] = 'fullName'; $required[] = 'subject'; $required[] = 'message'; // populate template $template[$webformID] .= ' <div class="formrow field-fullName"> <label for="fullName">Full Name</label> <input type="text" id="fullName" name="fullName" value="' . $this->CI->input->post('fullName') . '" class="formelement" /> </div> <div class="formrow field-email"> <label for="email">Email</label> <input type="text" id="email" name="email" value="' . $this->CI->input->post('email') . '" class="formelement" /> </div> <div class="formrow field-subject"> <label for="subject">Subject</label> <input type="text" id="subject" name="subject" value="' . $this->CI->input->post('subject') . '" class="formelement" /> </div> <div class="formrow field-message"> <label for="message">Message</label> <textarea id="message" name="message" class="formelement small">' . $this->CI->input->post('message') . '</textarea> </div> '; } // set fields if ($webform['fieldSet'] == 2) { $required[] = 'fullName'; // populate template $template[$webformID] .= ' <div class="formrow field-fullName"> <label for="fullName">Full Name</label> <input type="text" id="fullName" name="fullName" value="' . $this->CI->input->post('fullName') . '" class="formelement" /> </div> <div class="formrow field-email"> <label for="email">Email</label> <input type="text" id="email" name="email" value="' . $this->CI->input->post('email') . '" class="formelement" /> </div> <input type="hidden" name="subject" value="' . $webform['formName'] . '" /> '; } // set fields if ($webform['fieldSet'] == 0) { // populate template $template[$webformID] .= ' <input type="hidden" name="subject" value="' . $webform['formName'] . '" /> '; } // set account if ($webform['account'] == 1) { // populate template $template[$webformID] .= ' <input type="hidden" name="subject" value="' . $webform['formName'] . '" /> <input type="hidden" name="message" value="' . $webform['outcomeMessage'] . '" /> <input type="hidden" name="groupID" value="' . $webform['groupID'] . '" /> '; } // set required if ($required) { $template[$webformID] .= ' <input type="hidden" name="required" value="' . implode('|', $required) . '" /> '; } // output encoded webform ID $template[$webformID] .= ' <input type="hidden" name="formID" value="' . $this->CI->core->encode($matches[1][0]) . '" /> '; } else { $template[$webformID] = ''; } } // get blog headlines if (preg_match_all('/{headlines:blog(:category(\\(([A-Za-z0-9_-]+)\\))?)?(:limit(\\(([0-9]+)\\))?)?}/i', $body, $matches)) { // load blog model $this->CI->load->model('blog/blog_model', 'blog'); // filter through matches for ($x = 0; $x < sizeof($matches[0]); $x++) { // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][$x]); $limit = $matches[6][$x] ? $matches[6][$x] : $this->CI->site->config['headlines']; $headlines = $matches[3][$x] ? $this->CI->blog->get_posts_by_category($matches[3][$x], $limit) : $this->CI->blog->get_posts($limit); // get latest posts if ($headlines) { // fill up template array $i = 0; foreach ($headlines as $headline) { // get rid of any template tags $headlineBody = $this->parse_body($headline['body'], TRUE, site_url('blog/' . dateFmt($headline['dateCreated'], 'Y/m') . '/' . $headline['uri'])); $headlineExcerpt = $this->parse_body($headline['excerpt'], TRUE, site_url('blog/' . dateFmt($headline['dateCreated'], 'Y/m') . '/' . $headline['uri'])); // populate loop $template[$headlineID][$i] = array('headline:link' => site_url('blog/' . dateFmt($headline['dateCreated'], 'Y/m') . '/' . $headline['uri']), 'headline:title' => $headline['postTitle'], 'headline:date' => dateFmt($headline['dateCreated'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'headline:day' => dateFmt($headline['dateCreated'], 'd'), 'headline:month' => dateFmt($headline['dateCreated'], 'M'), 'headline:year' => dateFmt($headline['dateCreated'], 'y'), 'headline:body' => $headlineBody, 'headline:excerpt' => $headlineExcerpt, 'headline:comments-count' => $headline['numComments'], 'headline:author' => $this->CI->blog->lookup_user($headline['userID'], TRUE), 'headline:author-id' => $headline['userID'], 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } } else { $template[$headlineID] = array(); } } } // get events headlines if (preg_match_all('/{headlines:events(:limit(\\(([0-9]+)\\))?)?}/i', $body, $matches)) { // load events model $this->CI->load->model('events/events_model', 'events'); // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[3][0] ? $matches[3][0] : $this->CI->site->config['headlines']; // get latest posts if ($headlines = $this->CI->events->get_events($limit)) { // fill up template array $i = 0; foreach ($headlines as $headline) { $headlineBody = $this->parse_body($headline['description'], TRUE, site_url('events/viewevent/' . $headline['eventID'])); $headlineExcerpt = $this->parse_body($headline['excerpt'], TRUE, site_url('events/viewevent/' . $headline['eventID'])); $template[$headlineID][$i] = array('headline:link' => site_url('events/viewevent/' . $headline['eventID']), 'headline:title' => $headline['eventTitle'], 'headline:date' => dateFmt($headline['eventDate'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'headline:day' => dateFmt($headline['eventDate'], 'd'), 'headline:month' => dateFmt($headline['eventDate'], 'M'), 'headline:year' => dateFmt($headline['eventDate'], 'y'), 'headline:body' => $headlineBody, 'headline:excerpt' => $headlineExcerpt, 'headline:author' => $this->CI->events->lookup_user($headline['userID'], TRUE), 'headline:author-id' => $headline['userID'], 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } } else { $template[$headlineID] = array(); } } // get wiki headlines if (preg_match_all('/{headlines:wiki(:category(\\(([A-Za-z0-9_-]+)\\))?)?(:limit(\\(([0-9]+)\\))?)?}/i', $body, $matches)) { // load wiki model $this->CI->load->model('wiki/wiki_model', 'wiki'); // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[3][0] ? $matches[3][0] : $this->CI->site->config['headlines']; // get latest posts if ($headlines = $this->CI->wiki->get_pages($limit)) { // fill up template array $i = 0; foreach ($headlines as $headline) { $template[$headlineID][$i] = array('headline:link' => site_url('wiki/' . $headline['uri']), 'headline:title' => $headline['pageName']); $i++; } } else { $template[$headlineID] = array(); } } // get gallery if (preg_match_all('/{gallery:([A-Za-z0-9_-]+)(:limit\\(([0-9]+)\\))?}/i', $body, $matches)) { // load libs etc $this->CI->load->model('images/images_model', 'images'); // filter through matches for ($x = 0; $x < sizeof($matches[0]); $x++) { // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[3][$x] ? $matches[3][$x] : 9; // get latest posts if ($gallery = $this->CI->images->get_images_by_folder_ref($matches[1][$x], $limit)) { // fill up template array $i = 0; foreach ($gallery as $galleryimage) { if ($imageData = $this->get_image($galleryimage['imageRef'])) { $imageHTML = display_image($imageData['src'], $imageData['imageName']); $imageHTML = preg_replace('/src=("[^"]*")/i', 'src="' . site_url('/images/' . $imageData['imageRef'] . strtolower($imageData['ext'])) . '"', $imageHTML); $thumbHTML = display_image($imageData['src'], $imageData['imageName']); $thumbHTML = preg_replace('/src=("[^"]*")/i', 'src="' . site_url('/thumbs/' . $imageData['imageRef'] . strtolower($imageData['ext'])) . '" width="120px"', $imageHTML); $template[$headlineID][$i] = array('galleryimage:link' => site_url('images/' . $imageData['imageRef'] . $imageData['ext']), 'galleryimage:title' => $imageData['imageName'], 'galleryimage:image' => $imageHTML, 'galleryimage:thumb' => $thumbHTML, 'galleryimage:filename' => $imageData['imageRef'] . $imageData['ext'], 'galleryimage:date' => dateFmt($imageData['dateCreated'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'galleryimage:author' => $this->CI->images->lookup_user($imageData['userID'], TRUE), 'galleryimage:author-id' => $imageData['userID'], 'galleryimage:class' => $imageData['class']); $i++; } } } else { $template[$headlineID] = array(); } } } // get shop gateway if (preg_match('/{shop:(.+)}|{headlines:shop/i', $body)) { // load messages model $this->CI->load->model('shop/shop_model', 'shop'); // shop globals $template['shop:email'] = $this->CI->site->config['shopEmail']; $template['shop:paypal'] = $this->CI->shop->paypal_url; $template['shop:gateway'] = $this->CI->site->config['shopGateway'] == 'sagepay' || $this->CI->site->config['shopGateway'] == 'authorize' ? site_url('/shop/checkout') : $this->CI->shop->gateway_url; // get shop headlines if (preg_match_all('/{headlines:shop(:category\\(([A-Za-z0-9_-]+)\\))?(:limit\\(([0-9]+)\\))?}/i', $body, $matches)) { // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[4][0] ? $matches[4][0] : $this->CI->site->config['headlines']; $catSafe = $matches[2][0]; // get latest posts if ($headlines = $this->CI->shop->get_latest_products($catSafe, $limit)) { // fill up template array $i = 0; foreach ($headlines as $headline) { // get body and excerpt $headlineBody = strlen($headline['description']) > 100 ? substr($headline['description'], 0, 100) . '...' : $headline['description']; $headlineExcerpt = nl2br($headline['excerpt']); // get images if (!($headlineImage = $this->CI->uploads->load_image($headline['productID'], false, true))) { $headlineImage['src'] = $this->CI->config->item('staticPath') . '/images/nopicture.jpg'; } // get images if (!($headlineThumb = $this->CI->uploads->load_image($headline['productID'], true, true))) { $headlineThumb['src'] = $this->CI->config->item('staticPath') . '/images/nopicture.jpg'; } // populate template $template[$headlineID][$i] = array('headline:id' => $headline['productID'], 'headline:link' => site_url('shop/' . $headline['productID'] . '/' . strtolower(url_title($headline['productName']))), 'headline:title' => $headline['productName'], 'headline:subtitle' => $headline['subtitle'], 'headline:date' => dateFmt($headline['dateCreated'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'headline:body' => $headlineBody, 'headline:excerpt' => $headlineExcerpt, 'headline:price' => currency_symbol() . number_format($headline['price'], 2), 'headline:image-path' => $headlineImage['src'], 'headline:thumb-path' => $headlineThumb['src'], 'headline:cell-width' => floor(1 / $limit * 100), 'headline:price' => currency_symbol() . number_format($headline['price'], 2), 'headline:stock' => $headline['stock'], 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } } else { $template[$headlineID] = array(); } } // get shop headlines if (preg_match_all('/{headlines:shop:featured(:limit(\\(([0-9]+)\\))?)?}/i', $body, $matches)) { // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[3][0] ? $matches[3][0] : $this->CI->site->config['headlines']; // get latest posts if ($headlines = $this->CI->shop->get_latest_featured_products($limit)) { // fill up template array $i = 0; foreach ($headlines as $headline) { // get body and excerpt $headlineBody = strlen($headline['description']) > 100 ? substr($headline['description'], 0, 100) . '...' : $headline['description']; $headlineExcerpt = nl2br($headline['excerpt']); // get images if (!($headlineImage = $this->CI->uploads->load_image($headline['productID'], false, true))) { $headlineImage['src'] = $this->CI->config->item('staticPath') . '/images/nopicture.jpg'; } // get thumb if (!($headlineThumb = $this->CI->uploads->load_image($headline['productID'], true, true))) { $headlineThumb['src'] = $this->CI->config->item('staticPath') . '/images/nopicture.jpg'; } $template[$headlineID][$i] = array('headline:id' => $headline['productID'], 'headline:link' => site_url('shop/' . $headline['productID'] . '/' . strtolower(url_title($headline['productName']))), 'headline:title' => $headline['productName'], 'headline:subtitle' => $headline['subtitle'], 'headline:date' => dateFmt($headline['dateCreated'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'headline:body' => $headlineBody, 'headline:excerpt' => $headlineExcerpt, 'headline:price' => currency_symbol() . number_format($headline['price'], 2), 'headline:image-path' => $headlineImage['src'], 'headline:thumb-path' => $headlineThumb['src'], 'headline:cell-width' => floor(1 / $limit * 100), 'headline:price' => currency_symbol() . number_format($headline['price'], 2), 'headline:stock' => $headline['stock'], 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } } else { $template[$headlineID] = array(); } } // get shop cart headlines if (preg_match('/({headlines:shop:((.+)?)})+/i', $body)) { // get shopping cart $cart = $this->CI->shop->load_cart(); // get latest posts if ($headlines = $cart['cart']) { // fill up template array $i = 0; foreach ($headlines as $headline) { $template['headlines:shop:cartitems'][$i] = array('headline:link' => site_url('shop/' . $headline['productID'] . '/' . strtolower(url_title($headline['productName']))), 'headline:title' => $headline['productName'], 'headline:quantity' => $headline['quantity'], 'headline:price' => currency_symbol() . number_format($headline['price'] * $headline['quantity'], 2), 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } $template['headlines:shop:numitems'] = count($headlines); $template['headlines:shop:subtotal'] = currency_symbol() . number_format($cart['subtotal'], 2); } else { $template['headlines:shop:numitems'] = 0; $template['headlines:shop:subtotal'] = currency_symbol() . number_format(0, 2); $template['headlines:shop:cartitems'] = array(); } } // get shop navigation if (preg_match('/({shop:categories((.+)?)})+/i', $body)) { $template['shop:categories'] = ''; if ($categories = $this->CI->shop->get_category_parents()) { $i = 1; foreach ($categories as $nav) { // get subnav if ($children = $this->CI->shop->get_category_children($nav['catID'])) { $template['shop:categories'] .= '<li class="expanded '; if ($i == 1) { $template['shop:categories'] .= 'first '; } if ($i == sizeof($categories)) { $template['shop:categories'] .= 'last '; } $template['shop:categories'] .= '"><a href="/shop/' . $nav['catSafe'] . '">' . htmlentities($nav['catName'], NULL, 'UTF-8') . '</a><ul class="subnav">'; foreach ($children as $child) { $template['shop:categories'] .= '<li class="'; if ($child['catID'] == $this->CI->uri->segment(3) || $nav['catSafe'] == $this->CI->uri->segment(2)) { $template['shop:categories'] .= 'active selected'; } $template['shop:categories'] .= '"><a href="/shop/' . $nav['catSafe'] . '/' . $child['catSafe'] . '">' . htmlentities($child['catName'], NULL, 'UTF-8') . '</a></li>'; } $template['shop:categories'] .= '</ul>'; } else { $template['shop:categories'] .= '<li class="'; if ($nav['catID'] == $this->CI->uri->segment(3) || $nav['catSafe'] == $this->CI->uri->segment(2)) { $template['shop:categories'] .= 'active selected '; } if ($i == 1) { $template['shop:categories'] .= 'first '; } if ($i == sizeof($categories)) { $template['shop:categories'] .= 'last '; } $template['shop:categories'] .= '"><a href="/shop/' . $nav['catSafe'] . '">' . htmlentities($nav['catName'], NULL, 'UTF-8') . '</a>'; } $template['shop:categories'] .= '</li>'; $i++; } } } } // message centre stuff if (preg_match('/({((.+)?)messages:unread((.+)?)})+/i', $body)) { // load messages model $this->CI->load->model('community/messages_model', 'messages'); // get message count @($template['messages:unread'] = ($messageCount = $this->CI->messages->get_unread_message_count()) ? $messageCount : 0); } return $template; }
<th>Email</th> <th>Comment</th> <th>Status</th> <th class="tiny"> </th> <th class="tiny"> </th> </tr> <?php foreach ($comments as $comment) { ?> <tr> <td><?php echo dateFmt($comment['dateCreated']); ?> </td> <td><?php echo anchor('/blog/' . dateFmt($comment['uriDate'], 'Y/m/') . $comment['uri'], $comment['postTitle']); ?> </td> <td><?php echo $comment['fullName']; ?> </td> <td><?php echo $comment['email']; ?> </td> <td><small><?php echo strlen($comment['comment'] > 50) ? htmlentities(substr($comment['comment'], 0, 50)) . '...' : htmlentities($comment['comment']); ?> </small></td> <td><?php