break; } }); } if (class_exists('module_group', false) && module_user::can_i('view', 'Contact Groups')) { $columns['group'] = array('title' => 'Group', 'callback' => function ($user) { $groups = module_group::get_groups_search(array('owner_table' => 'user', 'owner_id' => $user['user_id'])); $g = array(); foreach ($groups as $group) { $g[] = $group['name']; } echo implode(', ', $g); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full vendor data before displaying each row so we have access to more details return $row_data; //module_user::get_user($row_data['user_id']); }; $table_manager->set_rows($users); if (class_exists('module_extra', false)) { $table_manager->display_extra('user', function ($user) { module_extra::print_table_data('user', $user['user_id']); }); } $table_manager->pagination = true; $table_manager->print_table(); ?> </form>
if (class_exists('module_quote', false) && module_quote::is_plugin_enabled()) { $columns['file_quote'] = array('title' => 'Quote', 'callback' => function ($file) { echo module_quote::link_open($file['quote_id'], true); }); } $columns['file_date_added'] = array('title' => 'Date Added', 'callback' => function ($file) { echo _l('%s by %s', print_date($file['date_created']), module_user::link_open($file['create_user_id'], true)); }); if (module_file::can_i('edit', 'Files')) { $columns['file_action'] = array('title' => ' ', 'callback' => function ($file) { echo '<input type="checkbox" name="bulk_operation[' . $file['file_id'] . ']" value="yes">'; }); } if (class_exists('module_extra', false)) { $table_manager->display_extra('file', function ($file) { module_extra::print_table_data('file', $file['file_id']); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full file data before displaying each row so we have access to more details if (isset($row_data['file_id']) && (int) $row_data['file_id'] > 0) { // not needed in this case //return module_file::get_file($row_data['file_id']); } return array(); }; $table_manager->set_rows($files); $table_manager->pagination = true; $table_manager->print_table(); ?>
} }); } } if (class_exists('module_group', false)) { $columns['group'] = array('title' => 'Group', 'callback' => function ($quote) { $groups = module_group::get_groups_search(array('owner_table' => 'quote', 'owner_id' => $quote['quote_id'])); $g = array(); foreach ($groups as $group) { $g[] = $group['name']; } echo implode(', ', $g); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full vendor data before displaying each row so we have access to more details return module_quote::get_quote($row_data['quote_id']); }; $table_manager->set_rows($quotes); if (class_exists('module_extra', false)) { $table_manager->display_extra('quote', function ($quote) { module_extra::print_table_data('quote', $quote['quote_id']); }); } $table_manager->pagination = true; $table_manager->print_table(); ?> </form>
?> <input type="checkbox" name="link_finance_ids[<?php echo $finance['finance_id']; ?> ]" value="<?php echo number_format($finance['credit'], 2) . '_' . number_format($finance['debit'], 2); ?> " class="link_box"> <?php } } }); if (class_exists('module_extra', false)) { $table_manager->display_extra('finance', function ($finance) { module_extra::print_table_data('finance', isset($finance['finance_id']) ? $finance['finance_id'] : 0); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($finance) { if (isset($finance['finance_id']) && $finance['finance_id']) { $finance['finance_record'] = module_finance::get_finance($finance['finance_id']); } else { $finance['finance_record'] = false; } return $finance; }; if (module_finance::can_i('create', 'Finance')) { $header_rows = array(); ob_start(); ?>
echo '<a href="' . module_invoice::link_open(false) . '">' . _l('%s invoice%s: %s', count($invoices), count($invoices) > 1 ? 's' : '', ($total_due > 0 ? '<span class="error_text">' . _l('%s due', dollar($total_due, true, $invoice['currency_id'])) . ' </span>' : '') . ($total_paid > 0 ? '<span class="success_text">' . _l('%s paid', dollar($total_paid, true, $invoice['currency_id'])) . ' </span>' : '')) . '</a>'; if ($old_customer_id) { $_REQUEST['customer_id'] = $old_customer_id; } else { unset($_REQUEST['customer_id']); } } }); } if (class_exists('module_extra', false)) { // do extra before "table sorting" so that it can hook in with the table sort call $table_manager->display_extra('customer', function ($customer) { module_extra::print_table_data('customer', $customer['customer_id']); }, 'customer_id'); $table_manager->display_extra('user', function ($customer) { module_extra::print_table_data('user', $customer['primary_user_id']); }, 'primary_user_id'); } $table_manager->enable_table_sorting(array('table_id' => 'customer_list', 'sortable' => array('customer_name' => array('field' => 'customer_name'), 'primary_contact_name' => array('field' => 'primary_user_name'), 'primary_contact_email' => array('field' => 'primary_user_email'), 'customer_group' => array('group_sort' => true, 'owner_table' => 'customer', 'owner_id' => 'customer_id')))); if (module_customer::can_i('view', 'Export ' . $page_type)) { $table_manager->enable_export(array('name' => $page_type_single . ' Export', 'fields' => array($page_type_single . ' ID' => 'customer_id', $page_type_single . ' Name' => 'customer_name', 'Credit' => 'credit', 'Address Line 1' => 'line_1', 'Address Line 2' => 'line_2', 'Address Suburb' => 'suburb', 'Address Country' => 'country', 'Address State' => 'state', 'Address Region' => 'region', 'Address Post Code' => 'post_code', 'Primary Contact First Name' => 'primary_user_name', 'Primary Contact Last Name' => 'primary_user_last_name', 'Primary Phone' => 'primary_user_phone', 'Primary Email' => 'primary_user_email', 'Primary Fax' => 'primary_user_fax', 'Primary Mobile' => 'primary_user_mobile', 'Primary Language' => 'primary_user_language', 'Invoice Prefix' => 'default_invoice_prefix', 'Tax Name' => 'default_tax_name', 'Tax Rate' => 'default_tax', 'Staff' => 'customer_staff'), 'extra' => array(array('owner_table' => 'customer', 'owner_id' => 'customer_id'), array('owner_table' => 'user', 'owner_id' => 'primary_user_id')), 'group' => array(array('title' => $page_type_single . ' Group', 'owner_table' => 'customer', 'owner_id' => 'customer_id')))); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full customer data before displaying each row so we have access to more details return module_customer::get_customer($row_data['customer_id']); }; $table_manager->set_rows($customers); $table_manager->pagination = true; $table_manager->print_table(); /** END TABLE LAYOUT **/
_e('(unsubscribed %s)', print_date($res['time'])); } else { if (isset($res['reason']) && $res['reason'] == 'no_email') { _e('(do not send)'); } else { if (isset($res['reason']) && $res['reason'] == 'doubleoptin') { _e('(double opt-in incomplete)', print_date($res['time'])); } else { _e('(unsubscribed %s)', print_date($res['time'])); } } } } } }); } } if (class_exists('module_extra', false)) { $table_manager->display_extra('member', function ($member) { module_extra::print_table_data('member', $member['member_id']); }); } $table_manager->set_columns($columns); $table_manager->set_rows($members); $table_manager->pagination = true; $table_manager->print_table(); $pagination = process_pagination($members); ?> </form>
echo implode(', ', $g); }); } if (module_config::c('ticket_allow_priority', 0) && module_config::c('ticket_show_priority', 1)) { $columns['ticket_priority'] = array('title' => 'Priority', 'callback' => function ($ticket) use($priorities) { echo $priorities[$ticket['priority']]; }); } if (module_ticket::can_edit_tickets()) { $columns['ticket_action'] = array('title' => ' <input type="checkbox" name="bulk_operation_all" id="bulk_operation_all" value="yehaw" > ', 'callback' => function ($ticket) { echo '<input type="checkbox" name="bulk_operation[' . $ticket['ticket_id'] . ']" class="ticket_bulk_check" value="yes">'; }); } if (class_exists('module_extra', false)) { $table_manager->display_extra('ticket', function ($ticket) { module_extra::print_table_data('ticket', $ticket['ticket_id']); }); } $table_manager->set_columns($columns); $time = time(); $today = strtotime(date('Y-m-d')); $table_manager->row_callback = function ($row_data) use($time, $today, $limit_time) { // load the full vendor data before displaying each row so we have access to more details /*if(class_exists('module_envato',false) && isset($_REQUEST['faq_product_envato_hack']) && (!$ticket['faq_product_id'] || $ticket['faq_product_id'] == $_REQUEST['faq_product_envato_hack'])){ }*/ $return = array(); if (isset($row_data['ticket_id']) && (int) $row_data['ticket_id'] > 0) { $return = module_ticket::get_ticket($row_data['ticket_id']); } $return['time'] = $time; $return['today'] = $today;
function customer_admin_email_generate_invoice_list($invoices, $customer_id) { ob_start(); $colspan = 9; $colspan2 = 0; $invoice_total = array(); $invoice_total_due = array(); foreach ($invoices as $invoice) { if (!isset($invoice_total[$invoice['currency_id']])) { $invoice_total[$invoice['currency_id']] = 0; } if ($invoice['c_total_amount'] == 0) { $invoice = module_invoice::get_invoice($invoice['invoice_id']); } $invoice_total[$invoice['currency_id']] += $invoice['c_total_amount']; if (!isset($invoice_total_due[$invoice['currency_id']])) { $invoice_total_due[$invoice['currency_id']] = 0; } $invoice_total_due[$invoice['currency_id']] += $invoice['c_total_amount_due']; } $table_manager = module_theme::new_table_manager(); $columns = array(); $columns['invoice_number'] = array('title' => 'Invoice Number', 'callback' => function ($invoice) { //echo module_invoice::link_open($invoice['invoice_id'],true,$invoice); echo '<a href="' . module_invoice::link_public($invoice['invoice_id']) . '">' . htmlspecialchars($invoice['name']) . '</a>'; }, 'cell_class' => 'row_action'); $columns['invoice_status'] = array('title' => 'Status', 'callback' => function ($invoice) { echo htmlspecialchars($invoice['status']); }); $columns['invoice_create_date'] = array('title' => 'Create Date', 'callback' => function ($invoice) { if (!$invoice['date_create'] || $invoice['date_create'] == '0000-00-00') { //echo print_date($invoice['date_created']); } else { echo print_date($invoice['date_create']); } }); $columns['invoice_due_date'] = array('title' => 'Due Date', 'callback' => function ($invoice) { if ((!$invoice['date_paid'] || $invoice['date_paid'] == '0000-00-00') && strtotime($invoice['date_due']) < time()) { echo '<span class="error_text">'; echo print_date($invoice['date_due']); echo '</span>'; } else { echo print_date($invoice['date_due']); } }); $columns['invoice_sent_date'] = array('title' => 'Sent Date', 'callback' => function ($invoice) { if ($invoice['date_sent'] && $invoice['date_sent'] != '0000-00-00') { ?> <?php echo print_date($invoice['date_sent']); ?> <?php } else { ?> <span class="error_text"><?php _e('Not sent'); ?> </span> <?php } }); $columns['invoice_paid_date'] = array('title' => 'Paid Date', 'callback' => function ($invoice) { if ($invoice['date_paid'] && $invoice['date_paid'] != '0000-00-00') { ?> <?php echo print_date($invoice['date_paid']); ?> <?php } else { if ($invoice['date_cancel'] && $invoice['date_cancel'] != '0000-00-00') { ?> <span class="error_text"><?php _e('Cancelled'); ?> </span> <?php } else { if ($invoice['overdue']) { ?> <span class="error_text" style="font-weight: bold; text-decoration: underline;"><?php _e('Overdue'); ?> </span> <?php } else { ?> <span class="error_text"><?php _e('Not paid'); ?> </span> <?php } } } }); if (class_exists('module_website', false) && module_website::is_plugin_enabled() && module_website::can_i('view', module_config::c('project_name_plural', 'Websites'))) { $colspan++; $columns['invoice_website'] = array('title' => module_config::c('project_name_single', 'Website'), 'callback' => function ($invoice) { if (isset($invoice['website_ids'])) { foreach ($invoice['website_ids'] as $website_id) { if ((int) $website_id > 0) { echo module_website::link_open($website_id, true); echo '<br/>'; } } } }); } $columns['invoice_job'] = array('title' => 'Job', 'callback' => function ($invoice) { foreach ($invoice['job_ids'] as $job_id) { if ((int) $job_id > 0) { //echo module_job::link_open($job_id,true); $job_data = module_job::get_job($job_id); echo '<a href="' . module_job::link_public($job_id) . '">' . htmlspecialchars($job_data['name']) . '</a>'; if ($job_data['date_start'] && $job_data['date_start'] != '0000-00-00' && $job_data['date_renew'] && $job_data['date_renew'] != '0000-00-00') { _e(' (%s to %s)', print_date($job_data['date_start']), print_date(strtotime("-1 day", strtotime($job_data['date_renew'])))); } echo "<br/>\n"; } } hook_handle_callback('invoice_admin_list_job', $invoice['invoice_id']); }); if (!isset($_REQUEST['customer_id']) && module_customer::can_i('view', 'Customers')) { $colspan++; $columns['invoice_customer'] = array('title' => 'Customer', 'callback' => function ($invoice) { echo module_customer::link_open($invoice['customer_id'], true); }); } $columns['c_invoice_total'] = array('title' => 'Invoice Total', 'callback' => function ($invoice) { echo dollar($invoice['total_amount'], true, $invoice['currency_id']); }); $columns['c_invoice_total_due'] = array('title' => 'Amount Due', 'callback' => function ($invoice) { echo dollar($invoice['total_amount_due'], true, $invoice['currency_id']); ?> <?php if ($invoice['total_amount_credit'] > 0) { ?> <span class="success_text"><?php echo _l('Credit: %s', dollar($invoice['total_amount_credit'], true, $invoice['currency_id'])); ?> </span> <?php } }); if (class_exists('module_extra', false)) { ob_start(); $colspan2 += module_extra::print_table_header('invoice'); // used in the footer calc. ob_end_clean(); $table_manager->display_extra('invoice', function ($invoice) { module_extra::print_table_data('invoice', $invoice['invoice_id']); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full vendor data before displaying each row so we have access to more details if (isset($row_data['invoice_id']) && (int) $row_data['invoice_id'] > 0) { return module_invoice::get_invoice($row_data['invoice_id']); } return array(); }; $table_manager->set_rows($invoices); if (module_config::c('invoice_list_show_totals', 1)) { $footer_rows = array(); foreach ($invoice_total + $invoice_total_due as $currency_id => $foo) { $currency = get_single('currency', 'currency_id', $currency_id); $footer_rows[] = array('invoice_number' => array('data' => '<strong>' . _l('%s Totals:', $currency && isset($currency['code']) ? $currency['code'] : '') . '</strong>', 'cell_colspan' => $colspan - 2, 'cell_class' => 'text-right'), 'c_invoice_total' => array('data' => '<strong>' . dollar(isset($invoice_total[$currency_id]) ? $invoice_total[$currency_id] : 0, true, $currency_id) . '</strong>'), 'c_invoice_total_due' => array('data' => '<strong>' . dollar(isset($invoice_total_due[$currency_id]) ? $invoice_total_due[$currency_id] : 0, true, $currency_id) . '</strong>'), 'row_bulk_action' => array('data' => ' ', 'cell_colspan' => $colspan2)); } $table_manager->set_footer_rows($footer_rows); } $table_manager->pagination = false; $table_manager->print_table(); return ob_get_clean(); }
if (isset($website['group_sort_website'])) { echo htmlspecialchars($website['group_sort_website']); } else { // find the groups for this website. $groups = module_group::get_groups_search(array('owner_table' => 'website', 'owner_id' => $website['website_id'])); $g = array(); foreach ($groups as $group) { $g[] = $group['name']; } echo htmlspecialchars(implode(', ', $g)); } }); } if (class_exists('module_extra', false)) { $table_manager->display_extra('website', function ($website) { module_extra::print_table_data('website', $website['website_id']); }); } if (class_exists('module_subscription', false)) { $table_manager->display_subscription('website', function ($website) { module_subscription::print_table_data('website', $website['website_id']); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full vendor data before displaying each row so we have access to more details return module_website::get_website($row_data['website_id']); }; $table_manager->set_rows($websites); $table_manager->pagination = true; $table_manager->print_table();
?> <span class="success_text"><?php echo _l('Credit: %s', dollar($invoice['total_amount_credit'], true, $invoice['currency_id'])); ?> </span> <?php } }); if (class_exists('module_extra', false)) { ob_start(); $colspan2 += module_extra::print_table_header('invoice'); // used in the footer calc. ob_end_clean(); $table_manager->display_extra('invoice', function ($invoice) { module_extra::print_table_data('invoice', $invoice['invoice_id']); }); } if (module_invoice::can_i('edit', 'Invoices')) { $colspan2++; // used in the footer $columns['row_bulk_action'] = array('title' => ' ', 'callback' => function ($invoice) { echo '<input type="checkbox" name="invoice_bulk_operation[' . $invoice['invoice_id'] . ']" value="yes">'; }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full vendor data before displaying each row so we have access to more details if (isset($row_data['invoice_id']) && (int) $row_data['invoice_id'] > 0) { return module_invoice::get_invoice($row_data['invoice_id']); }
if (isset($vendor['group_sort_vendor'])) { echo htmlspecialchars($vendor['group_sort_vendor']); } else { // find the groups for this vendor. $groups = module_group::get_groups_search(array('owner_table' => 'vendor', 'owner_id' => $vendor['vendor_id'])); $g = array(); foreach ($groups as $group) { $g[] = $group['name']; } echo htmlspecialchars(implode(', ', $g)); } }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full vendor data before displaying each row so we have access to more details return module_vendor::get_vendor($row_data['vendor_id']); }; $table_manager->set_rows($vendors); if (class_exists('module_extra', false)) { $table_manager->display_extra('vendor', function ($vendor) { module_extra::print_table_data('vendor', $vendor['vendor_id']); }); $table_manager->display_extra('user', function ($vendor) { module_extra::print_table_data('user', $vendor['primary_user_id']); }); } $table_manager->pagination = true; $table_manager->print_table(); ?> </form>
if (isset($job['group_sort_job'])) { echo htmlspecialchars($job['group_sort_job']); } else { // find the groups for this job. $groups = module_group::get_groups_search(array('owner_table' => 'job', 'owner_id' => $job['job_id'])); $g = array(); foreach ($groups as $group) { $g[] = $group['name']; } echo htmlspecialchars(implode(', ', $g)); } }); } if (class_exists('module_extra', false)) { $table_manager->display_extra('job', function ($job) { module_extra::print_table_data('job', $job['job_id']); }, 'job_id'); } $table_manager->enable_table_sorting(array('table_id' => 'job_list', 'sortable' => array('job_title' => array('field' => 'name', 'current' => 1), 'job_start_date' => array('field' => 'date_start'), 'job_due_date' => array('field' => 'date_due'), 'job_completed_date' => array('field' => 'date_completed'), 'job_website' => array('field' => 'website_name'), 'job_customer' => array('field' => 'customer_name'), 'job_type' => array('field' => 'type'), 'job_status' => array('field' => 'status'), 'job_progress' => array('field' => 'total_percent_complete'), 'job_total' => array('field' => 'total_amount'), 'job_total_amount_invoiced' => array('field' => 'total_amount_invoiced'), 'job_group' => array('group_sort' => true, 'owner_table' => 'job', 'owner_id' => 'job_id')))); if (class_exists('module_table_sort', false)) { if (isset($_REQUEST['table_sort_column']) || isset($_SESSION['_table_sort']) && isset($_SESSION['_table_sort']['job_list']) && isset($_SESSION['_table_sort']['job_list'][0])) { // we're sorting by something! reset($jobs); $test = current($jobs); if ($test && $test['job_id']) { $column = isset($_REQUEST['table_sort_column']) ? $_REQUEST['table_sort_column'] : $_SESSION['_table_sort']['job_list'][0]; if (isset(module_table_sort::$table_sort_options['sortable'][$column])) { $dbcolumn = module_table_sort::$table_sort_options['sortable'][$column]['field']; if (!isset($test[$dbcolumn])) { $test = module_job::get_job($test['job_id']); if (isset($test[$dbcolumn])) {