print caNavUrl($this->request, 'client/orders', 'Communications', 'ViewMessage', array('communication_id' => $pn_communication_id));
?>
');"><?php 
print _t('Cancel');
?>
 &rsaquo;</a>
<?php 
print caFormTag($this->request, 'SendReply', 'caClientCommunicationsReplyForm');
$t_comm = new ca_commerce_communications($pn_communication_id);
$vn_to_user_id = $t_comm->get('from_user_id');
if (!preg_match('!' . _t("Re:") . '!i', $vs_subject = $t_comm->get('subject'))) {
    $vs_subject = _t("Re:") . ' ' . $vs_subject;
}
$t_comm->clear();
$t_comm->set('subject', $vs_subject);
print "<div class='replyMessageHeader'><span class='replyMessageHeaderHeading'>" . _t('Date') . ':</span> ' . caGetLocalizedDateRange($t = time(), $t) . "</div>";
print "<div class='replyMessageHeader'><span class='replyMessageHeaderHeading'>" . _t('To') . ':</span> ' . caClientServicesGetSenderName(array('from_user_id' => $vn_to_user_id)) . "</div>";
foreach ($t_comm->getFormFields() as $vs_f => $va_info) {
    switch ($vs_f) {
        case 'subject':
        case 'message':
        case 'transaction_id':
            print $t_comm->htmlFormElement($vs_f) . "<br/>\n";
            break;
    }
}
print caHTMLHiddenInput('transaction_id', array('value' => $t_transaction->getPrimaryKey()));
print caFormSubmitButton($this->request, __CA_NAV_BUTTON_SAVE__, _t("Send"), 'caClientCommunicationsReplyForm');
?>
		</form>
	</div>
 /**
  *
  */
 public function getLoanReturnDates()
 {
     if (!($vn_order_id = $this->getPrimaryKey())) {
         return null;
     }
     $o_db = $this->getDb();
     $qr_res = $o_db->query("\n\t\t\tSELECT min(loan_return_date) mindate, max(loan_return_date) maxdate\n\t\t\tFROM ca_commerce_order_items\n\t\t\tWHERE order_id = ?\n\t\t", (int) $vn_order_id);
     if ($qr_res->nextRow()) {
         $vn_min = $qr_res->get('mindate');
         $vn_max = $qr_res->get('maxdate');
         if (!$vn_min) {
             $vn_min = $vn_max;
         }
         if (!$vn_max) {
             $vn_max = $vn_min;
         }
         if (!$vn_min || !$vn_max) {
             return null;
         }
         return array('min' => caGetLocalizedDate($vn_min, array('dateFormat' => 'delimited')), 'max' => caGetLocalizedDate($vn_max, array('dateFormat' => 'delimited')), 'min_raw' => $vn_min, 'max_raw' => $vn_max, 'range' => caGetLocalizedDateRange($vn_min, $vn_max, array('timeOmit' => true)));
     }
     return null;
 }
 * CollectiveAccess is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 *
 * This source code is free and modifiable under the terms of 
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$va_stats = $this->getVar('stats');
$va_panels = $this->getVar('panels');
$ps_daterange = $this->getVar('daterange');
$va_dates = caDateToUnixTimestamps($ps_daterange);
$vs_daterange_proc = caGetLocalizedDateRange($va_dates[0], $va_dates[1], array('timeOmit' => true));
?>
	<h1><?php 
print _t('Statistics Dashboard');
?>
</h1>
<?php 
print caFormTag($this->request, 'Index', 'libraryDashboardOptions', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
print _t('Dates') . ': ' . caHTMLTextInput('daterange', array('value' => $ps_daterange, 'class' => 'dateBg'), array('width' => '200px'));
?>
</form>

<br style="clear"/>

<div class="caLibraryDashboardPanel">
	<div class="caLibraryDashboardCallout">
 $vn_count = 0;
 foreach ($va_display_list as $vs_column_code => $vs_column_name) {
     // Skip first few columns as needed
     if ($vn_count < $vn_start) {
         $vn_count++;
         continue;
     }
     $vs_size_attr = '';
     switch ($vs_column_code) {
         case 'client':
             $vs_display_value = $va_order['billing_fname'] . ' ' . $va_order['billing_lname'] . " " . ($va_order['billing_organization'] ? "(" . $va_order['billing_organization'] . ")" : "");
             break;
         case 'loan_checkout_date':
         case 'loan_due_date':
         case 'loan_return_date':
             $vs_display_value = caGetLocalizedDateRange($va_order[$vs_column_code . '_start'], $va_order[$vs_column_code . '_end'], array('timeOmit' => true, 'dateFormat' => 'delimited'));
             $vs_size_attr = ' width="60"';
             break;
         case 'summary':
             $vs_display_value = "<strong>" . ($va_order['num_items'] == 1 ? _t('%1 item', $va_order['num_items']) : _t('%1 items', $va_order['num_items'])) . "</strong>\n";
             $va_items = $t_order->getItems(array('order_id' => $va_order['order_id']));
             if (is_array($va_items) && sizeof($va_items)) {
                 $va_idnos = array();
                 foreach ($va_items as $vn_i => $va_item) {
                     if ($vs_idno = trim($va_item['idno'])) {
                         $va_idnos[] = $vs_idno;
                     }
                 }
                 $vs_display_value .= ":<br/>\n" . join(",<br/>\n", $va_idnos);
             }
             if ($va_order['shipped_on_date']) {