Ejemplo n.º 1
0
?>
">
		</td>
        <?php 
if (class_exists('module_group', false) && module_customer::can_i('view', 'Customer Groups')) {
    ?>

        <td width="60">
            <?php 
    _e('Group:');
    ?>

        </td>
        <td>
            <?php 
    echo print_select_box(module_group::get_groups('customer'), 'search[group_id]', isset($search['group_id']) ? $search['group_id'] : false, '', true, 'name');
    ?>

        </td>
        <?php 
}
?>

		<td align="right" rowspan="2">
			<?php 
echo create_link("Reset", "reset", module_customer::link_open(false));
?>

			<?php 
echo create_link("Search", "submit");
?>
Ejemplo n.º 2
0
$title = 'User Details';
include module_theme::include_ucm('includes/plugin_user/pages/contact_admin_form.php');
if (module_config::c('users_have_address', 0)) {
    ob_start();
    handle_hook("address_block", $module, "physical", "user", "user_id");
    $fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Address'), 'elements_before' => ob_get_clean());
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
}
if ((int) $user_id > 0) {
    //handle_hook("note_list",$module,"user","user_id",$user_id);
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'User Notes', 'owner_table' => 'user', 'owner_id' => $user_id, 'view_link' => $module->link_open($user_id)));
    }
    if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
        module_group::display_groups(array('title' => 'User Groups', 'owner_table' => 'user', 'owner_id' => $user_id, 'view_link' => module_user::link_open($user_id)));
    }
}
hook_handle_callback('layout_column_half', 2);
if (is_file('includes/plugin_user/pages/user_admin_edit_login.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_login.php');
}
if (is_file('includes/plugin_user/pages/user_admin_edit_staff.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_staff.php');
}
if (is_file('includes/plugin_user/pages/user_admin_edit_company.php')) {
    include module_theme::include_ucm('includes/plugin_user/pages/user_admin_edit_company.php');
}
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save User')), array('ignore' => !($user_id != 1 && module_user::can_i('delete', 'Users', 'Config')), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . $module->link_open(false) . "';")));
echo module_form::generate_form_actions($form_actions);
Ejemplo n.º 3
0
    include dirname(__FILE__) . '/../inc/ticket_extras_sidebar.php';
}
if (file_exists(dirname(__FILE__) . '/../inc/ticket_billing.php')) {
    include dirname(__FILE__) . '/../inc/ticket_billing.php';
}
if ((int) $ticket_id > 0 && file_exists(dirname(__FILE__) . '/../inc/ticket_priority_sidebar.php')) {
    //if($ticket['priority'] == _TICKET_PRIORITY_STATUS_ID || (isset($ticket['invoice_id']) && $ticket['invoice_id'])){
    include dirname(__FILE__) . '/../inc/ticket_priority_sidebar.php';
    // }
}
if (isset($ticket['ticket_id']) && (int) $ticket['ticket_id'] > 0 && module_ticket::can_edit_tickets()) {
    if (class_exists('module_note', false) && module_note::is_plugin_enabled() && module_config::c('ticket_enable_notes', 1)) {
        module_note::display_notes(array('title' => 'Ticket Notes', 'owner_table' => 'ticket', 'owner_id' => $ticket_id, 'view_link' => module_ticket::link_open($ticket['ticket_id'])));
    }
    if (class_exists('module_group', false) && module_config::c('ticket_enable_groups', 1)) {
        module_group::display_groups(array('title' => 'Ticket Groups', 'owner_table' => 'ticket', 'owner_id' => $ticket['ticket_id'], 'view_link' => module_ticket::link_open($ticket['ticket_id'])));
    }
}
if (module_ticket::can_edit_tickets()) {
    /** RELATED TO */
    $responsive_summary = array();
    $responsive_summary[] = module_customer::link_open($ticket['customer_id'], true);
    $fieldset_data = array('heading' => array('title' => _l('Related to'), 'type' => 'h3', 'responsive' => array('summary' => implode(', ', $responsive_summary))), 'elements' => array());
    $fieldset_data['elements'][] = array('title' => _l('Customer'), 'fields' => array(function () use($ticket_id, $ticket, $done_in_ticket_billing) {
        // moved to ticket billing..?
        if (module_ticket::can_edit_tickets() && !isset($done_in_ticket_billing)) {
            $c = array();
            $res = module_customer::get_customers();
            while ($row = array_shift($res)) {
                $c[$row['customer_id']] = $row['customer_name'];
            }
Ejemplo n.º 4
0
 public static function run_pagination_hook(&$rows)
 {
     if (isset($_REQUEST['import_export_go']) && $_REQUEST['import_export_go'] == 'yes') {
         // we are posting back tot his script with a go!
         if (is_resource($rows)) {
             $new_rows = array();
             while ($row = mysql_fetch_assoc($rows)) {
                 $new_rows[] = $row;
             }
             $rows = $new_rows;
         } else {
             // rows stays the same.
         }
         // add these items to the import_export.
         if (is_array($rows) && count($rows)) {
             $fields = self::$pagination_options['fields'];
             // export as CSV file:
             ob_end_clean();
             ob_start();
             foreach ($fields as $key => $val) {
                 echo '"' . str_replace('"', '""', $key) . '",';
             }
             // check for extra fields.
             if (class_exists('module_extra', false) && isset(self::$pagination_options['extra']) && count(self::$pagination_options['extra'])) {
                 if (isset(self::$pagination_options['extra']['owner_table'])) {
                     self::$pagination_options['extra'] = array(self::$pagination_options['extra']);
                 }
                 foreach (self::$pagination_options['extra'] as $extra_field_id => $extra_field_settings) {
                     $sql = "SELECT `extra_key` FROM `" . _DB_PREFIX . "extra` WHERE owner_table = '" . mysql_real_escape_string($extra_field_settings['owner_table']) . "' AND `extra_key` != '' GROUP BY `extra_key` ORDER BY `extra_key`";
                     self::$pagination_options['extra'][$extra_field_id]['extra_fields'] = qa($sql);
                     foreach (self::$pagination_options['extra'][$extra_field_id]['extra_fields'] as $extra_field) {
                         echo '"' . str_replace('"', '""', $extra_field['extra_key']) . '",';
                     }
                 }
             }
             // check for group fields.
             if (class_exists('module_group', false) && isset(self::$pagination_options['group']) && self::$pagination_options['group']) {
                 // find groups for this entry
                 foreach (self::$pagination_options['group'] as $group_search) {
                     echo '"' . str_replace('"', '""', $group_search['title']) . '",';
                 }
             }
             echo "\n";
             foreach ($rows as $row) {
                 foreach ($fields as $key => $val) {
                     echo '"' . str_replace('"', '""', isset($row[$val]) ? $row[$val] : '') . '",';
                 }
                 // check for extra fields.
                 if (class_exists('module_extra', false) && isset(self::$pagination_options['extra']) && count(self::$pagination_options['extra'])) {
                     foreach (self::$pagination_options['extra'] as $extra_field_id => $extra_field_settings) {
                         $extra_vals = array();
                         if (isset($row[$extra_field_settings['owner_id']]) && $row[$extra_field_settings['owner_id']] > 0) {
                             $sql = "SELECT `extra_key` AS `id`, `extra` FROM `" . _DB_PREFIX . "extra` WHERE owner_table = '" . mysql_real_escape_string($extra_field_settings['owner_table']) . "' AND `owner_id` = '" . (int) $row[$extra_field_settings['owner_id']] . "' ORDER BY `extra_key`";
                             $extra_vals = qa($sql);
                         }
                         foreach ($extra_field_settings['extra_fields'] as $extra_field) {
                             echo '"';
                             echo isset($extra_vals[$extra_field['extra_key']]) ? str_replace('"', '""', $extra_vals[$extra_field['extra_key']]['extra']) : '';
                             echo '",';
                         }
                     }
                 }
                 // check for group fields.
                 if (class_exists('module_group', false) && isset(self::$pagination_options['group']) && self::$pagination_options['group']) {
                     // find groups for this entry
                     foreach (self::$pagination_options['group'] as $group_search) {
                         $g = array();
                         $groups = module_group::get_groups_search(array('owner_table' => $group_search['owner_table'], 'owner_id' => isset($row[$group_search['owner_id']]) ? $row[$group_search['owner_id']] : 0));
                         foreach ($groups as $group) {
                             $g[] = $group['name'];
                         }
                         echo '"' . str_replace('"', '""', implode(', ', $g)) . '",';
                     }
                 }
                 echo "\n";
             }
             // is there a summary to add at the end of the export?
             if (isset(self::$pagination_options['summary']) && is_array(self::$pagination_options['summary'])) {
                 foreach (self::$pagination_options['summary'] as $summary_row) {
                     foreach ($fields as $key => $val) {
                         echo '"';
                         if (isset($summary_row[$val])) {
                             echo $summary_row[$val];
                         }
                         echo '",';
                     }
                     echo "\n";
                 }
             }
             $csv = ob_get_clean();
             if (module_config::c('export_csv_debug', 0)) {
                 echo '<pre>' . $csv . '</pre>';
                 exit;
             }
             header("Pragma: public");
             header("Expires: 0");
             header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
             header("Cache-Control: private", false);
             header("Content-Type: text/csv");
             //todo: correct file name
             header("Content-Disposition: attachment; filename=\"" . (isset(self::$pagination_options['name']) ? self::$pagination_options['name'] . '.csv' : 'Export.csv') . "\";");
             header("Content-Transfer-Encoding: binary");
             // todo: calculate file size with ob buffering
             header("Content-Length: " . strlen($csv));
             echo $csv;
             exit;
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * @param $invoice_id
  * @param $invoice_data
  * @return array
  *
  * todo: make this method call the other 'get_replace_fields' available in website/job/etc..
  */
 public static function get_replace_fields($invoice_id, $invoice_data = false)
 {
     if (!$invoice_data) {
         $invoice_data = self::get_invoice($invoice_id);
     }
     $customer_data = array();
     if ($invoice_data['customer_id']) {
         $customer_data = module_customer::get_replace_fields($invoice_data['customer_id'], $invoice_data['user_id']);
     }
     if (!is_array($customer_data)) {
         $customer_data = array();
     }
     $data = array_merge($customer_data, $invoice_data);
     // so we get total_amount_due and stuff.
     $data = array_merge($data, array('invoice_number' => htmlspecialchars($invoice_data['name']), 'project_type' => _l(module_config::c('project_name_single', 'Website')), 'print_link' => self::link_public_print($invoice_id), 'title' => module_config::s('admin_system_name'), 'invoice_paid' => $invoice_data['total_amount_due'] <= 0 ? '<p> <font style="font-size: 1.6em;"><strong>' . _l('INVOICE PAID') . '</strong></font> </p>' : '', 'is_invoice_paid' => $invoice_data['total_amount_due'] <= 0 ? 1 : '', 'date_create' => print_date($invoice_data['date_create']), 'due_date' => print_date($invoice_data['date_due'])));
     $data['total_amount'] = dollar($invoice_data['total_amount'], true, $invoice_data['currency_id']);
     $data['total_amount_due'] = dollar($invoice_data['total_amount_due'], true, $invoice_data['currency_id']);
     $data['total_amount_paid'] = dollar($invoice_data['total_amount_paid'], true, $invoice_data['currency_id']);
     $data['date_paid'] = print_date($invoice_data['date_paid']);
     $data['date_due'] = print_date($invoice_data['date_due']);
     $data['date_sent'] = print_date($invoice_data['date_sent']);
     $data['invoice_number'] = $invoice_data['name'];
     $data['invoice_url'] = module_invoice::link_public($invoice_id);
     $data['invoice_date_range'] = '';
     if ($invoice_data['date_renew'] != '0000-00-00') {
         $data['invoice_date_range'] = _l('%s to %s', print_date($invoice_data['date_create']), print_date(strtotime("-1 day", strtotime($invoice_data['date_renew']))));
     }
     if (isset($invoice_data['credit_note_id']) && $invoice_data['credit_note_id']) {
         $credit_invoice = module_invoice::get_invoice($invoice_data['credit_note_id'], true);
         $data['credit_invoice_number'] = htmlspecialchars($credit_invoice['name']);
     }
     $data['invoice_notes'] = '';
     // grab any public notes
     if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
         $notes = module_note::get_notes(array('public' => 1, 'owner_table' => 'invoice', 'owner_id' => $invoice_id));
         if (count($notes) > 1) {
             $data['invoice_notes'] .= '<ul>';
             foreach ($notes as $note) {
                 if ($note['public']) {
                     $data['invoice_notes'] .= '<li>';
                     $data['invoice_notes'] .= htmlspecialchars($note['note']);
                     $data['invoice_notes'] .= '</li>';
                 }
             }
             $data['invoice_notes'] .= '</ul>';
         } else {
             $note = array_shift($notes);
             $data['invoice_notes'] .= htmlspecialchars($note['note']);
         }
     }
     $job_names = $website_url = $project_names = $project_names_and_url = array();
     foreach ($invoice_data['job_ids'] as $job_id) {
         $job_data = module_job::get_job($job_id);
         if ($job_data && $job_data['job_id'] == $job_id) {
             $job_names[$job_data['job_id']] = $job_data['name'];
             if (module_config::c('job_invoice_show_date_range', 1)) {
                 // check if this job is a renewable job.
                 if ($job_data['date_renew'] != '0000-00-00') {
                     $data['invoice_date_range'] = _l('%s to %s', print_date($job_data['date_start']), print_date(strtotime("-1 day", strtotime($job_data['date_renew']))));
                 }
             }
             $fields = module_job::get_replace_fields($job_id, $job_data);
             foreach ($fields as $key => $val) {
                 if (!isset($data[$key]) || !$data[$key] && $val) {
                     $data[$key] = $val;
                 }
             }
             if ($job_data['website_id']) {
                 $website_data = module_website::get_website($job_data['website_id']);
                 if ($website_data && $website_data['website_id'] == $job_data['website_id']) {
                     if (isset($website_data['url']) && $website_data['url']) {
                         $website_url[$website_data['website_id']] = module_website::urlify($website_data['url']);
                         $website_data['name_url'] = $website_data['name'] . ' (' . module_website::urlify($website_data['url']) . ')';
                     } else {
                         $website_data['name_url'] = $website_data['name'];
                     }
                     $project_names[$website_data['website_id']] = $website_data['name'];
                     $project_names_and_url[$website_data['website_id']] = $website_data['name_url'];
                     $fields = module_website::get_replace_fields($website_data['website_id'], $website_data);
                     foreach ($fields as $key => $val) {
                         if (!isset($data[$key]) || !$data[$key] && $val) {
                             $data[$key] = $val;
                         }
                     }
                 }
             }
         }
     }
     if (isset($invoice_data['website_id']) && $invoice_data['website_id']) {
         $website_data = module_website::get_website($invoice_data['website_id']);
         if ($website_data && $website_data['website_id'] == $invoice_data['website_id']) {
             if (isset($website_data['url']) && $website_data['url']) {
                 $website_url[$website_data['website_id']] = module_website::urlify($website_data['url']);
                 $website_data['name_url'] = $website_data['name'] . ' (' . module_website::urlify($website_data['url']) . ')';
             } else {
                 $website_data['name_url'] = $website_data['name'];
             }
             $project_names[$website_data['website_id']] = $website_data['name'];
             $project_names_and_url[$website_data['website_id']] = $website_data['name_url'];
             $fields = module_website::get_replace_fields($website_data['website_id'], $website_data);
             foreach ($fields as $key => $val) {
                 if (!isset($data[$key]) || !$data[$key] && $val) {
                     $data[$key] = $val;
                 }
             }
         }
     }
     $data['website_name'] = $data['project_name'] = forum_text(count($project_names) ? implode(', ', $project_names) : '');
     $data['website_name_url'] = forum_text(count($project_names_and_url) ? implode(', ', $project_names_and_url) : '');
     $data['website_url'] = forum_text(count($website_url) ? implode(', ', $website_url) : '');
     $data['job_name'] = forum_text($job_names ? implode(', ', $job_names) : '');
     if (class_exists('module_group', false)) {
         // get the job groups
         $wg = array();
         $g = array();
         foreach ($invoice_data['job_ids'] as $group_job_id) {
             $group_job_id = (int) trim($group_job_id);
             if ($group_job_id > 0) {
                 $job_data = module_job::get_job($group_job_id);
                 foreach (module_group::get_groups_search(array('owner_table' => 'job', 'owner_id' => $group_job_id)) as $group) {
                     $g[$group['group_id']] = $group['name'];
                 }
                 // get the website groups
                 if ($job_data['website_id']) {
                     foreach (module_group::get_groups_search(array('owner_table' => 'website', 'owner_id' => $job_data['website_id'])) as $group) {
                         $wg[$group['group_id']] = $group['name'];
                     }
                 }
             }
         }
         if (isset($invoice_data['website_id']) && $invoice_data['website_id']) {
             foreach (module_group::get_groups_search(array('owner_table' => 'website', 'owner_id' => $invoice_data['website_id'])) as $group) {
                 $wg[$group['group_id']] = $group['name'];
             }
         }
         $data['job_group'] = implode(', ', $g);
         $data['website_group'] = implode(', ', $wg);
     }
     // addition. find all extra keys for this invoice and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('invoice');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'invoice', 'owner_id' => $invoice_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
     }
     $new_data = hook_handle_callback('invoice_replace_fields', $invoice_id, $data);
     if (is_array($new_data)) {
         foreach ($new_data as $new_d) {
             $data = array_merge($data, $new_d);
         }
     }
     return $data;
 }
Ejemplo n.º 6
0
    }
});
$columns['primary_contact_email'] = array('title' => 'Email Address', 'callback' => function ($customer) {
    if ($customer['primary_user_id']) {
        module_user::print_contact_summary($customer['primary_user_id'], 'html', array('email'));
    } else {
        echo '';
    }
});
if (class_exists('module_group', false) && module_customer::can_i('view', $page_type_single . ' Groups')) {
    $columns['customer_group'] = array('title' => 'Group', 'callback' => function ($customer) {
        if (isset($customer['group_sort_customer'])) {
            echo htmlspecialchars($customer['group_sort_customer']);
        } else {
            // find the groups for this customer.
            $groups = module_group::get_groups_search(array('owner_table' => 'customer', 'owner_id' => $customer['customer_id']));
            $g = array();
            foreach ($groups as $group) {
                $g[] = $group['name'];
            }
            echo htmlspecialchars(implode(', ', $g));
        }
    });
}
if (class_exists('module_invoice', false) && module_invoice::can_i('view', 'Invoices') && module_config::c('customer_list_show_invoices', 1)) {
    $columns['customer_invoices'] = array('title' => 'Invoices', 'callback' => function ($customer) {
        $invoices = module_invoice::get_invoices(array('customer_id' => $customer['customer_id']));
        if (count($invoices)) {
            $total_due = 0;
            $total_paid = 0;
            foreach ($invoices as $invoice) {
Ejemplo n.º 7
0
    $search['customer_id'] = $_REQUEST['customer_id'];
}
if (isset($_REQUEST['job_id']) && (int) $_REQUEST['job_id'] > 0) {
    $search['job_id'] = (int) $_REQUEST['job_id'];
    //$job = module_job::get_job($search['job_id'],false);
}
if (isset($_REQUEST['quote_id']) && (int) $_REQUEST['quote_id'] > 0) {
    $search['quote_id'] = (int) $_REQUEST['quote_id'];
    //$job = module_job::get_job($search['job_id'],false);
}
$search['bucket_parent_file_id'] = 0;
$files = module_file::get_files($search);
$module->page_title = _l('Files');
// hack to add a "group" option to the pagination results.
if (class_exists('module_group', false)) {
    module_group::enable_pagination_hook(array('bulk_actions' => array('delete' => array('label' => 'Delete selected files', 'type' => 'delete', 'callback' => 'module_file::bulk_handle_delete'))));
}
$header = array('title' => _l('Customer Files'), 'type' => 'h2', 'main' => true, 'button' => array());
if (module_file::can_i('create', 'Files')) {
    $header['button'][] = array('url' => module_file::link_open('new'), 'title' => _l('Add New File'), 'type' => 'add');
    $header['button'][] = array('url' => module_file::link_open_bucket('new'), 'title' => _l('Add New Bucket'), 'type' => 'add');
}
print_heading($header);
?>



<form action="" method="post">

    <?php 
module_form::print_form_auth();
Ejemplo n.º 8
0
 public static function get_replace_fields($customer_id, $primary_user_id = false)
 {
     $customer_data = module_customer::get_customer($customer_id);
     $address_combined = array();
     if (isset($customer_data['customer_address'])) {
         foreach ($customer_data['customer_address'] as $key => $val) {
             if (strlen(trim($val))) {
                 $address_combined[$key] = $val;
             }
         }
     }
     // do we use the primary contact or
     $contact_data = module_user::get_user($primary_user_id ? $primary_user_id : $customer_data['primary_user_id']);
     //print_r($contact_data);exit;
     if ($contact_data && $contact_data['customer_id'] != $customer_id && (!isset($contact_data['linked_parent_user_id']) || !$contact_data['linked_parent_user_id'])) {
         $contact_data = array('user_id' => 0, 'customer_id' => 0, 'name' => '', 'last_name' => '', 'email' => '', 'password' => '', 'phone' => '', 'mobile' => '', 'fax' => '');
     }
     $data = array('customer_details' => ' - todo - ', 'customer_name' => isset($customer_data['customer_name']) ? htmlspecialchars($customer_data['customer_name']) : _l('N/A'), 'customer_address' => htmlspecialchars(implode(', ', $address_combined)), 'contact_name' => $contact_data['name'] != $contact_data['email'] ? htmlspecialchars($contact_data['name'] . ' ' . $contact_data['last_name']) : '', 'contact_first_name' => $contact_data['name'], 'contact_last_name' => $contact_data['last_name'], 'first_name' => $contact_data['name'], 'last_name' => $contact_data['last_name'], 'contact_email' => htmlspecialchars($contact_data['email']), 'contact_phone' => htmlspecialchars($contact_data['phone']), 'contact_mobile' => htmlspecialchars($contact_data['mobile']), 'customer_invoice_prefix' => isset($customer_data['default_invoice_prefix']) ? $customer_data['default_invoice_prefix'] : '');
     $data = array_merge($customer_data, $data);
     foreach ($customer_data['customer_address'] as $key => $val) {
         $data['address_' . $key] = $val;
     }
     if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
         // get the customer groups
         $g = array();
         if ((int) $customer_data['customer_id'] > 0) {
             foreach (module_group::get_groups_search(array('owner_table' => 'customer', 'owner_id' => $customer_data['customer_id'])) as $group) {
                 $g[] = $group['name'];
             }
         }
         $data['customer_group'] = implode(', ', $g);
         // get the customer groups
         $g = array();
         if ($customer_id > 0) {
             $customer_data = module_customer::get_customer($customer_id);
             foreach (module_group::get_groups_search(array('owner_table' => 'customer', 'owner_id' => $customer_id)) as $group) {
                 $g[$group['group_id']] = $group['name'];
             }
         }
         $data['customer_group'] = implode(', ', $g);
     }
     // addition. find all extra keys for this customer and add them in.
     // we also have to find any EMPTY extra fields, and add those in as well.
     if (class_exists('module_extra', false) && module_extra::is_plugin_enabled()) {
         $all_extra_fields = module_extra::get_defaults('customer');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         // and find the ones with values:
         $extras = module_extra::get_extras(array('owner_table' => 'customer', 'owner_id' => $customer_id));
         foreach ($extras as $e) {
             $data[$e['extra_key']] = $e['extra'];
         }
         // and the primary contact
         $all_extra_fields = module_extra::get_defaults('user');
         foreach ($all_extra_fields as $e) {
             $data[$e['key']] = _l('N/A');
         }
         if ($contact_data && $contact_data['user_id']) {
             // and find the ones with values:
             $extras = module_extra::get_extras(array('owner_table' => 'user', 'owner_id' => $contact_data['user_id']));
             foreach ($extras as $e) {
                 $data[$e['extra_key']] = $e['extra'];
             }
         }
     }
     return $data;
 }
Ejemplo n.º 9
0
    public function external_hook($hook)
    {
        switch ($hook) {
            case 'subscribe_form':
                // handle subscriptions to the member database and also the newsletter system.
                // todo - tie in with "subscription" module to allow users to select which subscription they want as well.
            // handle subscriptions to the member database and also the newsletter system.
            // todo - tie in with "subscription" module to allow users to select which subscription they want as well.
            case 'subscribe':
                $member = isset($_REQUEST['member']) && is_array($_REQUEST['member']) ? $_REQUEST['member'] : false;
                $provided_member_id = isset($_REQUEST['i']) ? (int) $_REQUEST['i'] : false;
                $hash = isset($_REQUEST['hash']) ? trim($_REQUEST['hash']) : false;
                $member_id = false;
                if ($member) {
                    if (isset($member['email']) && $member['email']) {
                        // proceed with signup
                        $email = filter_var(strtolower(trim($member['email'])), FILTER_VALIDATE_EMAIL);
                        if (strlen($email) > 3) {
                            $adding_new_member = true;
                            // are we adding a new member to the system or updating an old one
                            if ($provided_member_id && $hash) {
                                $real_hash = $this->link_public_details($provided_member_id, true);
                                if ($real_hash == $hash) {
                                    $existing_member = get_single('member', 'email', $email);
                                    if ($existing_member && $existing_member['member_id'] != $provided_member_id) {
                                        // this user is trying to update their email address to a user who exists in the system already
                                        $template = module_template::get_template_by_key('member_subscription_error');
                                        $template->page_title = htmlspecialchars(_l('Subscription'));
                                        $template->assign_values(array('message' => _l('The email address %s is already linked to another member.', htmlspecialchars($email))));
                                        echo $template->render('pretty_html');
                                        exit;
                                    }
                                    $adding_new_member = false;
                                    // updating details in the system.
                                    update_insert("member_id", $provided_member_id, "member", $member);
                                    $member_id = $provided_member_id;
                                    // update extra fields...
                                }
                            }
                            if (!$member_id) {
                                // add member to system.
                                $existing_member = get_single('member', 'email', $email);
                                if ($existing_member && $existing_member['member_id'] > 0) {
                                    // todo: give them link to change details.
                                    $template = module_template::get_template_by_key('member_subscription_error');
                                    $template->page_title = htmlspecialchars(_l('Subscription'));
                                    $template->assign_values(array('message' => _l('The email address %s is already a member. Please click the link in our newsletter to modify your details.', htmlspecialchars($email))));
                                    echo $template->render('pretty_html');
                                    exit;
                                }
                                // todo - sanatise input here, this will allow anyone to insert member details:
                                $member_id = update_insert("member_id", 'new', "member", $member);
                            }
                            if ($member_id) {
                                // save extra fields against member.
                                $extra_fields = module_extra::get_defaults('member');
                                $extra_values = array();
                                foreach ($extra_fields as $extra_field) {
                                    // check if this field was submitted.
                                    if (isset($member[$extra_field['key']])) {
                                        $extra_values[$extra_field['key']] = array('val' => $member[$extra_field['key']], 'key' => $extra_field['key']);
                                    }
                                }
                                if (count($extra_values)) {
                                    $_REQUEST['extra_member_field'] = $extra_values;
                                    module_extra::save_extras('member', 'member_id', $member_id, false);
                                }
                                if (class_exists('module_newsletter', false)) {
                                    $newsletter_member_id = module_newsletter::member_from_email(array('email' => $email, 'member_id' => $member_id, 'data_callback' => 'module_member::get_newsletter_recipient', 'data_args' => $member_id), true, true);
                                    module_newsletter::subscribe_member($email, $newsletter_member_id);
                                    // now add thsi member to the grups they have selected.
                                    if (isset($member['group']) && is_array($member['group'])) {
                                        $group_items = module_group::get_groups('newsletter_subscription');
                                        $public_group_ids = array();
                                        foreach ($group_items as $group_item) {
                                            $public_group_ids[$group_item['group_id']] = true;
                                            // remove user group all these groups.
                                            module_group::delete_member($member_id, 'newsletter_subscription');
                                        }
                                        //print_r($member['group']);print_r($public_group_ids);exit;
                                        foreach ($member['group'] as $group_id => $tf) {
                                            if ($tf && isset($public_group_ids[$group_id])) {
                                                // add member to group - but only public group ids!
                                                module_group::add_to_group($group_id, $member_id);
                                            }
                                        }
                                    }
                                }
                                // is the newsletter module giving us a subscription redirection?
                                if ($adding_new_member) {
                                    if (module_config::c('newsletter_subscribe_redirect', '')) {
                                        redirect_browser(module_config::c('newsletter_subscribe_redirect', ''));
                                    }
                                    $template = module_template::get_template_by_key('member_subscription_success');
                                    $template->page_title = htmlspecialchars(_l('Subscription'));
                                    $template->assign_values(array('email' => $email));
                                    echo $template->render('pretty_html');
                                    exit;
                                } else {
                                    if (module_config::c('newsletter_update_details_redirect', '')) {
                                        redirect_browser(module_config::c('newsletter_update_details_redirect', ''));
                                    }
                                    $template = module_template::get_template_by_key('member_update_details_success');
                                    $template->page_title = htmlspecialchars(_l('Subscription'));
                                    $template->assign_values(array('email' => $email));
                                    echo $template->render('pretty_html');
                                    exit;
                                }
                            } else {
                                echo 'database failure.. please try again.';
                            }
                        } else {
                            $template = module_template::get_template_by_key('member_subscription_error');
                            $template->page_title = htmlspecialchars(_l('Subscription'));
                            $template->assign_values(array('message' => _l('Sorry please go back and complete all required fields (especially email address)')));
                            echo $template->render('pretty_html');
                            exit;
                        }
                    } else {
                        $template = module_template::get_template_by_key('member_subscription_error');
                        $template->page_title = htmlspecialchars(_l('Subscription'));
                        $template->assign_values(array('message' => _l('Sorry please go back and complete all required fields')));
                        echo $template->render('pretty_html');
                        exit;
                    }
                } else {
                    $template = module_template::get_template_by_key('member_subscription_form');
                    $template->page_title = htmlspecialchars(_l('Subscription'));
                    // we also treat this as a subscription modification form.
                    $newsletter_subscriptions = array();
                    $member = array('email' => '', 'first_name' => '', 'last_name' => '', 'business' => '', 'phone' => '', 'mobile' => '');
                    // extra fields:
                    $extra_fields = module_extra::get_defaults('member');
                    foreach ($extra_fields as $extra_field) {
                        $member[$extra_field['key']] = '';
                    }
                    if ($provided_member_id && $hash) {
                        $real_hash = $this->link_public_details($provided_member_id, true);
                        if ($real_hash == $hash) {
                            // we can load these details into the forum successfully.
                            $member = array_merge($member, $this->get_member($provided_member_id));
                            // get their fields:
                            $extra_fields = module_extra::get_extras(array('owner_table' => 'member', 'owner_id' => $provided_member_id));
                            foreach ($extra_fields as $extra_field) {
                                $member[$extra_field['extra_key']] = $extra_field['extra'];
                            }
                            // find out what newsletter subscriptions this member has.
                            if (class_exists('module_newsletter', false)) {
                                $newsletter_member_id = module_newsletter::member_from_email($member, true, true);
                                $newsletter_subscriptions = module_group::get_member_groups('newsletter_subscription', $provided_member_id);
                            }
                        }
                    }
                    $template->assign_values($member);
                    if (class_exists('module_newsletter', false)) {
                        $group_items = module_group::get_groups('newsletter_subscription');
                        ob_start();
                        foreach ($group_items as $group_item) {
                            ?>

                            <div class="group_select">
                                <input type="checkbox" name="member[group][<?php 
                            echo $group_item['group_id'];
                            ?>
]" value="1"<?php 
                            foreach ($newsletter_subscriptions as $newsletter_subscription) {
                                if ($newsletter_subscription['group_id'] == $group_item['group_id']) {
                                    echo ' checked';
                                }
                            }
                            ?>
 > <?php 
                            echo htmlspecialchars($group_item['name']);
                            ?>

                            </div>
                            <?php 
                        }
                        $template->assign_values(array('newsletter_options' => ob_get_clean()));
                    } else {
                        $template->assign_values(array('newsletter_options' => ''));
                    }
                    echo $template->render('pretty_html');
                    exit;
                }
                break;
        }
    }
Ejemplo n.º 10
0
print_heading($header);
?>



<form action="" method="post">

    <?php 
module_form::print_form_auth();
?>


<?php 
$search_bar = array('elements' => array('name' => array('title' => _l('Invoice Number:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : '')), 'date' => array('title' => _l('Create Date:'), 'fields' => array(array('type' => 'date', 'name' => 'search[date_from]', 'value' => isset($search['date_from']) ? $search['date_from'] : ''), _l('to'), array('type' => 'date', 'name' => 'search[date_to]', 'value' => isset($search['date_to']) ? $search['date_to'] : ''))), 'status' => array('title' => _l('Status:'), 'field' => array('type' => 'select', 'name' => 'search[status]', 'value' => isset($search['status']) ? $search['status'] : '', 'options' => module_invoice::get_statuses()))));
if (!isset($_REQUEST['customer_id']) && class_exists('module_group', false) && module_customer::can_i('view', 'Customer Groups')) {
    $search_bar['elements']['group'] = array('title' => _l('Customer Group:'), 'field' => array('type' => 'select', 'name' => 'search[customer_group_id]', 'value' => isset($search['customer_group_id']) ? $search['customer_group_id'] : '', 'options' => module_group::get_groups('customer'), 'options_array_id' => 'name'));
}
echo module_form::search_bar($search_bar);
/** START TABLE LAYOUT **/
$colspan = 9;
$colspan2 = 0;
$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);
}, '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') {
Ejemplo n.º 11
0
                        'name' => 'default_invoice_prefix',
                        'value' => $vendor['default_invoice_prefix'],
                        'help' => 'Every time an invoice is generated for this vendor the INVOICE NUMBER will be prefixed with this value.',
                        'size' => 5,
                    ),
                )
            );
        }
    }

    echo module_form::generate_fieldset($fieldset_data);
*/
hook_handle_callback('layout_column_half', 2);
if ($vendor_id && $vendor_id != 'new') {
    if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
        module_group::display_groups(array('title' => $page_type_single . ' Categories', 'owner_table' => 'vendor', 'owner_id' => $vendor_id, 'view_link' => $module->link_open($vendor_id)));
    }
    $note_summary_owners = array();
    // generate a list of all possible notes we can display for this vendor.
    // display all the notes which are owned by all the sites we have access to
    // display all the notes which are owned by all the users we have access to
    foreach (module_user::get_contacts(array('vendor_id' => $vendor_id)) as $val) {
        $note_summary_owners['user'][] = $val['user_id'];
    }
    /*if(class_exists('module_website',false) && module_website::is_plugin_enabled()){
          foreach(module_website::get_websites(array('vendor_id'=>$vendor_id)) as $val){
              $note_summary_owners['website'][] = $val['website_id'];
          }
      }
      if(class_exists('module_job',false) && module_job::is_plugin_enabled()){
          foreach(module_job::get_jobs(array('vendor_id'=>$vendor_id)) as $val){
Ejemplo n.º 12
0
    if ($vendor['primary_user_id']) {
        module_user::print_contact_summary($vendor['primary_user_id'], 'html', array('email'));
    } else {
        echo '';
    }
});
$columns['address'] = array('title' => 'Address', 'callback' => function ($vendor) {
    module_address::print_address($vendor['vendor_id'], 'vendor', 'physical');
});
if (class_exists('module_group', false) && module_vendor::can_i('view', $page_type_single . ' Groups')) {
    $columns['vendor_group'] = array('title' => 'Group', 'callback' => function ($vendor) {
        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)) {
Ejemplo n.º 13
0
    ?>
</th>
        </tr>
        </thead>
        <tbody>
        <?php 
    $c = 0;
    foreach ($groups as $group) {
        ?>
            <tr class="<?php 
        echo $c++ % 2 ? "odd" : "even";
        ?>
">
                <td class="row_action">
                    <?php 
        echo module_group::link_open($group['group_id'], true);
        ?>
                </td>
                <td>
                    <?php 
        echo $group['owner_table'];
        ?>
                </td>
                <td>
                    <?php 
        echo $group['count'];
        ?>
                </td>
            </tr>
        <?php 
    }
Ejemplo n.º 14
0
                <?php 
print_heading(array('type' => 'h3', 'title' => 'Select Recipients'));
?>
                <table class="tableclass tableclass_form tableclass_full">
                    <tbody>
                    <tr>
                        <td colspan="3">
                            <?php 
_e('Please select the groups you would like to send this email to:');
?>
                        </td>
                    </tr>
                        <?php 
// grab a list of groups from the "group" plugin
// group plugin allows us to group people by different categories throu out the application
$groups = module_group::get_groups();
foreach ($groups as $group) {
    ?>
                            <tr>
                                <td>
                                    <input type="checkbox" name="group[<?php 
    echo $group['group_id'];
    ?>
]" id="group_<?php 
    echo $group['group_id'];
    ?>
" value="yes">
                                </td>
                                <td>
                                    <label for="group_<?php 
    echo $group['group_id'];
Ejemplo n.º 15
0
/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
$group_id = (int) $_REQUEST['group_id'];
$group = array();
if ($group_id > 0) {
    if (class_exists('module_security', false)) {
        module_security::check_page(array('category' => 'Group', 'page_name' => 'Groups', 'module' => 'group', 'feature' => 'edit'));
    }
    $group = module_group::get_group($group_id);
} else {
}
if (!$group) {
    die('Creating groups this way is disabled');
    $group_id = 'new';
    $group = array('group_id' => 'new', 'name' => '', 'default_text' => '');
    module_security::sanatise_data('group', $group);
}
?>

<form action="" method="post">

      <?php 
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
?>
Ejemplo n.º 16
0
}
if (!isset($_REQUEST['customer_id']) && module_customer::can_i('view', 'Customers')) {
    $columns['website_customer'] = array('title' => 'Customer', 'callback' => function ($website) {
        echo module_customer::link_open($website['customer_id'], true);
    });
}
$columns['website_status'] = array('title' => 'Status', 'callback' => function ($website) {
    echo htmlspecialchars($website['status']);
});
if (class_exists('module_group', false)) {
    $columns['website_group'] = array('title' => 'Group', 'callback' => function ($website) {
        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) {
Ejemplo n.º 17
0
 public static function handle_import_row($row, $debug, $add_to_group, $extra_options)
 {
     $debug_string = '';
     if (isset($row['job_id']) && (int) $row['job_id'] > 0) {
         // check if this ID exists.
         $job = self::get_job($row['job_id']);
         if (!$job || $job['job_id'] != $row['job_id']) {
             $row['job_id'] = 0;
         }
     }
     if (!isset($row['job_id']) || !$row['job_id']) {
         $row['job_id'] = 0;
     }
     if (!isset($row['name']) || !strlen($row['name'])) {
         $debug_string .= _l('No job data to import');
         if ($debug) {
             echo $debug_string;
         }
         return false;
     }
     // duplicates.
     //print_r($extra_options);exit;
     if (isset($extra_options['duplicates']) && $extra_options['duplicates'] == 'ignore' && (int) $row['job_id'] > 0) {
         if ($debug) {
             $debug_string .= _l('Skipping import, duplicate of job %s', self::link_open($row['job_id'], true));
             echo $debug_string;
         }
         // don't import duplicates
         return false;
     }
     $row['customer_id'] = 0;
     // todo - support importing of this id? nah
     if (isset($row['customer_name']) && strlen(trim($row['customer_name'])) > 0) {
         // check if this customer exists.
         $customer = get_single('customer', 'customer_name', $row['customer_name']);
         if ($customer && $customer['customer_id'] > 0) {
             $row['customer_id'] = $customer['customer_id'];
             $debug_string .= _l('Linked to customer %s', module_customer::link_open($row['customer_id'], true)) . ' ';
         } else {
             $debug_string .= _l('Create new customer: %s', htmlspecialchars($row['customer_name'])) . ' ';
         }
     } else {
         $debug_string .= _l('No customer') . ' ';
     }
     if ($row['job_id']) {
         $debug_string .= _l('Replace existing job: %s', self::link_open($row['job_id'], true)) . ' ';
     } else {
         $debug_string .= _l('Insert new job: %s', htmlspecialchars($row['name'])) . ' ';
     }
     if ($debug) {
         echo $debug_string;
         return true;
     }
     if (isset($extra_options['duplicates']) && $extra_options['duplicates'] == 'ignore' && $row['customer_id'] > 0) {
         // don't update customer record with new one.
     } else {
         if (isset($row['customer_name']) && strlen(trim($row['customer_name'])) > 0 || $row['customer_id'] > 0) {
             // update customer record with new one.
             $row['customer_id'] = update_insert('customer_id', $row['customer_id'], 'customer', $row);
         }
     }
     $job_id = (int) $row['job_id'];
     // check if this ID exists.
     $job = self::get_job($job_id);
     if (!$job || $job['job_id'] != $job_id) {
         $job_id = 0;
     }
     $job_id = update_insert("job_id", $job_id, "job", $row);
     // handle any extra fields.
     $extra = array();
     foreach ($row as $key => $val) {
         if (!strlen(trim($val))) {
             continue;
         }
         if (strpos($key, 'extra:') !== false) {
             $extra_key = str_replace('extra:', '', $key);
             if (strlen($extra_key)) {
                 $extra[$extra_key] = $val;
             }
         }
     }
     if ($extra) {
         foreach ($extra as $extra_key => $extra_val) {
             // does this one exist?
             $existing_extra = module_extra::get_extras(array('owner_table' => 'job', 'owner_id' => $job_id, 'extra_key' => $extra_key));
             $extra_id = false;
             foreach ($existing_extra as $key => $val) {
                 if ($val['extra_key'] == $extra_key) {
                     $extra_id = $val['extra_id'];
                 }
             }
             $extra_db = array('extra_key' => $extra_key, 'extra' => $extra_val, 'owner_table' => 'job', 'owner_id' => $job_id);
             $extra_id = (int) $extra_id;
             update_insert('extra_id', $extra_id, 'extra', $extra_db);
         }
     }
     foreach ($add_to_group as $group_id => $tf) {
         module_group::add_to_group($group_id, $job_id, 'job');
     }
     return $job_id;
 }
Ejemplo n.º 18
0
function process_pagination($rows, $per_page = 20, $page_number = 0, $table_id = 'table')
{
    $data = array();
    $data['rows'] = array();
    $data['links'] = '';
    if ($per_page !== false && $per_page <= 0) {
        $per_page = 20;
    }
    hook_handle_callback('pagination_hook_init');
    if (isset($GLOBALS['pagination_group_hack'])) {
        module_group::run_pagination_hook($rows);
    }
    if (isset($GLOBALS['pagination_import_export_hack'])) {
        module_import_export::run_pagination_hook($rows);
    }
    if (class_exists('module_table_sort', false)) {
        module_table_sort::run_pagination_hook($rows, $per_page);
    }
    $db_resource = false;
    if (is_resource($rows)) {
        // have the db handle for the sql query
        $db_resource = $rows;
        unset($rows);
        $total = mysql_num_rows($db_resource);
    } else {
        if (is_array($rows)) {
            // we have the rows in an array.
            $total = count($rows);
        } else {
            print_header_message();
            echo 'Pagination failed. Please try going to Settings > Update and click the Manual Update button. If that does not fix this error please report this bug.';
            exit;
        }
    }
    // pagination hooks
    ob_start();
    if ($total > 0) {
        // group hack addition
        hook_handle_callback('pagination_hook_display');
        if (isset($GLOBALS['pagination_group_hack']) && module_group::groups_enabled()) {
            module_group::display_pagination_hook();
        }
        if (get_display_mode() != 'mobile') {
            // export hack addition
            if (isset($GLOBALS['pagination_import_export_hack'])) {
                module_import_export::display_pagination_hook();
            }
            if (class_exists('module_table_sort', false)) {
                module_table_sort::display_pagination_hook($per_page);
            }
        }
    }
    $pagination_hooks = ob_get_clean();
    // default summary/links content
    ob_start();
    echo '<div class="pagination_summary"><p>';
    if ($total > 0) {
        _e('Showing records %s to %s of %s', $page_number * $per_page + 1, $total, $total);
        echo $pagination_hooks;
    } else {
        _e('No results found');
    }
    echo '</p></div>';
    $data['summary'] = ob_get_clean();
    ob_start();
    echo '<div class="pagination_links">';
    //echo "\n<p>";
    echo _l('Page %s of %s', 1, 1);
    //echo '</p>';
    echo '</div>';
    $data['links'] = ob_get_clean();
    $data['page_numbers'] = 1;
    if ($per_page === false || $total <= $per_page) {
        if ($db_resource) {
            $rows = array();
            //if($per_page !== false && $total<=$per_page){
            // pull out all records.
            while ($row = mysql_fetch_assoc($db_resource)) {
                $rows[] = $row;
            }
            if (mysql_num_rows($db_resource) > 0) {
                mysql_data_seek($db_resource, 0);
            }
            //}
        }
        $data['rows'] = $rows;
    } else {
        if (isset($_REQUEST['pg' . $table_id])) {
            $page_number = $_REQUEST['pg' . $table_id];
        }
        if ($table_id && $table_id != 'table' && $total > $per_page) {
            // we remember the last page number we were on.
            if (!isset($_SESSION['_table_page_num'])) {
                $_SESSION['_table_page_num'] = array();
            }
            if (!isset($_SESSION['_table_page_num'][$table_id])) {
                $_SESSION['_table_page_num'][$table_id] = array('total_count' => 0, 'page_number' => 0);
            }
            $_SESSION['_table_page_num'][$table_id]['total_count'] = $total;
            if (isset($_REQUEST['pg' . $table_id])) {
                $page_number = $_REQUEST['pg' . $table_id];
            } else {
                if ($_SESSION['_table_page_num'][$table_id]['total_count'] == $total) {
                    $page_number = $_SESSION['_table_page_num'][$table_id]['page_number'];
                }
            }
            $_SESSION['_table_page_num'][$table_id]['page_number'] = $page_number;
            //echo $table_id.' '.$total . ' '.$per_page.' '.$page_number; print_r($_SESSION['_table_page_num']);
        }
        $page_number = min(ceil($total / $per_page) - 1, $page_number);
        // slice up the result into the number of rows requested.
        if ($db_resource) {
            // do the the mysql way:
            mysql_data_seek($db_resource, $page_number * $per_page);
            $x = 0;
            while ($x < $per_page) {
                $row_data = mysql_fetch_assoc($db_resource);
                if ($row_data) {
                    $data['rows'][] = $row_data;
                }
                $x++;
            }
            unset($row_data);
        } else {
            // the old array way.
            $data['rows'] = array_slice($rows, $page_number * $per_page, $per_page);
        }
        $data['summary'] = '';
        $data['links'] = '';
        $request_uri = preg_replace('/[&?]pg' . preg_quote($table_id) . '=\\d+/', '', $_SERVER['REQUEST_URI']);
        $request_uri .= preg_match('/\\?/', $request_uri) ? '&' : '?';
        $request_uri = htmlspecialchars($request_uri);
        if (count($data['rows'])) {
            $page_count = ceil($total / $per_page);
            // group into ranges with cute little .... around the numbers if there's too many.
            $rangestart = max(0, $page_number - 5);
            $rangeend = min($page_count - 1, $page_number + 5);
            ob_start();
            echo '<div class="pagination_summary">';
            echo '<p>';
            _e('Showing records %s to %s of %s', $page_number * $per_page + 1, $page_number * $per_page + count($data['rows']), $total);
            //echo 'Showing records ' . (($page_number*$per_page)+1) . ' to ' . (($page_number*$per_page)+count($data['rows'])) .' of ' . $total . '</p>';
            echo $pagination_hooks;
            echo '</p>';
            echo '</div>';
            $data['summary'] = ob_get_clean();
            ob_start();
            echo '<div class="pagination_links">';
            //echo "\n<p>";
            echo '<span>';
            if ($page_number > 0) {
                ?>
			    <a href="<?php 
                echo $request_uri;
                ?>
pg<?php 
                echo $table_id;
                ?>
=<?php 
                echo $page_number - 1;
                ?>
#t_<?php 
                echo $table_id;
                ?>
" rel="<?php 
                echo $page_number - 1;
                ?>
"><?php 
                _e('&laquo; Prev');
                ?>
</a> |
			<?php 
            } else {
                ?>
			    <?php 
                _e('&laquo; Prev');
                ?>
 |
			<?php 
            }
            echo '</span>';
            if ($rangestart > 0) {
                ?>
 <span><a href="<?php 
                echo $request_uri;
                ?>
pg<?php 
                echo $table_id;
                ?>
=0#t_<?php 
                echo $table_id;
                ?>
" rel="0" class="">1</a></span> <?php 
                if ($rangestart > 1) {
                    echo ' ... ';
                }
            }
            for ($x = $rangestart; $x <= $rangeend; $x++) {
                if ($x == $page_number) {
                    ?>
					<span><a href="<?php 
                    echo $request_uri;
                    ?>
pg<?php 
                    echo $table_id;
                    ?>
=<?php 
                    echo $x;
                    ?>
#t_<?php 
                    echo $table_id;
                    ?>
" rel="<?php 
                    echo $x;
                    ?>
" class="current"><?php 
                    echo $x + 1;
                    ?>
</a></span>
					<?php 
                } else {
                    ?>
					<span><a href="<?php 
                    echo $request_uri;
                    ?>
pg<?php 
                    echo $table_id;
                    ?>
=<?php 
                    echo $x;
                    ?>
#t_<?php 
                    echo $table_id;
                    ?>
" rel="<?php 
                    echo $x;
                    ?>
" class=""><?php 
                    echo $x + 1;
                    ?>
</a></span>
					<?php 
                }
            }
            if ($rangeend < $page_count - 1) {
                if ($rangeend < $page_count - 2) {
                    echo ' ... ';
                }
                ?>
 <span><a href="<?php 
                echo $request_uri;
                ?>
pg<?php 
                echo $table_id;
                ?>
=<?php 
                echo $page_count - 1;
                ?>
#t_<?php 
                echo $table_id;
                ?>
" rel="<?php 
                echo $page_count - 1;
                ?>
" class=""><?php 
                echo $page_count;
                ?>
</a></span> <?php 
            }
            if ($page_number < $page_count - 1) {
                ?>
			    | <span><a href="<?php 
                echo $request_uri;
                ?>
pg<?php 
                echo $table_id;
                ?>
=<?php 
                echo $page_number + 1;
                ?>
#t_<?php 
                echo $table_id;
                ?>
" rel="<?php 
                echo $page_number + 1;
                ?>
"><?php 
                _e('Next &raquo;');
                ?>
</a></span>
			<?php 
            } else {
                ?>
			    | <span><?php 
                _e('Next &raquo;');
                ?>
</span>
			<?php 
            }
            //echo '</p>';
            echo '</div>';
            ?>
			<script type="text/javascript">
				$(function(){
					$('.pagination_links a').each(function(){
						// make the links post the search bar on pagination.
						$(this).click(function(){
							// see if there's a search bar to post.
							var search_form = false;
							search_form = $('.search_form')[0];
							$('.search_bar').each(function(){
								var form = $(this).parents('form');
								if(typeof form != 'undefined'){
									search_form = form;
								}
							});
							if(typeof search_form == 'object'){
								$(search_form).append('<input type="hidden" name="pg<?php 
            echo $table_id;
            ?>
" value="'+$(this).attr('rel')+'">');
								search_form = search_form[0];
								if(typeof search_form.submit == 'function'){
									search_form.submit();
								}else{
									$('[name=submit]',search_form).click();
								}
								return false;
							}
						});
					});
				});
			</script>
			<?php 
            $data['links'] = ob_get_clean();
            $data['page_numbers'] = $page_count;
        }
    }
    return $data;
}
Ejemplo n.º 19
0
    }
}
if ($job_id && $job_id != 'new') {
    $note_summary_owners = array();
    // generate a list of all possible notes we can display for this job.
    // display all the notes which are owned by all the sites we have access to
    if (class_exists('module_note', false) && module_note::is_plugin_enabled()) {
        module_note::display_notes(array('title' => 'Job Notes', 'owner_table' => 'job', 'owner_id' => $job_id, 'view_link' => module_job::link_open($job_id)));
    }
    if (class_exists('module_job', false) && module_job::is_plugin_enabled()) {
        if (module_job::can_i('edit', 'Jobs')) {
            module_email::display_emails(array('title' => 'Job Emails', 'search' => array('job_id' => $job_id)));
        }
    }
    if (class_exists('module_group', false) && module_group::is_plugin_enabled()) {
        module_group::display_groups(array('title' => 'Job Groups', 'owner_table' => 'job', 'owner_id' => $job_id, 'view_link' => $module->link_open($job_id)));
    }
}
if (module_job::can_i('view', 'Job Advanced')) {
    /***** JOB ADVANCED *****/
    $fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'Advanced'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array(array('title' => 'Customer Link', 'field' => array('type' => 'html', 'value' => '<a href="' . module_job::link_public($job_id) . '" target="_blank">' . _l('Click to view external link') . '</a>', 'help' => 'You can send this link to the customer and they can view progress on their job. They can also view a list of any invoices attached to this job. This is VERY useful to stop customers asking you "how far along are you" with a job because they can see exactly where you have logged up to in the system.'))));
    if ((int) $job_id > 0 && module_job::can_i('edit', 'Jobs')) {
        $fieldset_data['elements'][] = array('title' => 'Email Job', 'field' => array('type' => 'html', 'value' => '<a href="' . module_job::link_generate($job_id, array('arguments' => array('email' => 1))) . '">' . _l('Email this Job to Customer') . '</a>', 'help' => 'You can email the customer a copy of this job. This can be a progress report or as an initial quote. '));
        $fieldset_data['elements'][] = array('title' => 'Email Staff', 'fields' => array(function () use(&$job_tasks, $job_id) {
            $allocated_staff_members = array();
            foreach ($job_tasks as $job_task) {
                if (!isset($allocated_staff_members[$job_task['user_id']])) {
                    $allocated_staff_members[$job_task['user_id']] = 0;
                }
                $allocated_staff_members[$job_task['user_id']]++;
            }
Ejemplo n.º 20
0
 public static function enable_pagination_hook($options = array())
 {
     $GLOBALS['pagination_group_hack'] = true;
     self::$pagination_options = $options;
 }
Ejemplo n.º 21
0
        if (class_exists('module_group', false) && isset($import_options['group']) && $import_options['group']) {
            // hack to support multiple groups (for members)
            if (!is_array($import_options['group'])) {
                $import_options['group'] = array($import_options['group']);
            }
            foreach ($import_options['group'] as $group_option) {
                ?>
                <tr>
                    <th>
                        <?php 
                _e('Add imported records to group:');
                ?>
                    </th>
                    <td>
                        <?php 
                $groups = module_group::get_groups($group_option);
                if (!count($groups)) {
                    _e('Sorry, no groups exist. Please create a %s group first.', $group_option);
                }
                foreach ($groups as $group) {
                    $group_id = $group['group_id'];
                    ?>
                            <input type="checkbox" class="add_to_group" name="add_to_group[<?php 
                    echo $group['group_id'];
                    ?>
]" id="groupchk<?php 
                    echo $group_id;
                    ?>
" value="yes">
                            <label for="groupchk<?php 
                    echo $group_id;
Ejemplo n.º 22
0
    echo htmlspecialchars($default['key']);
    ?>
</label>
        <input type="text" id="website_extra_<?php 
    echo $x;
    ?>
" name="website[extra][<?php 
    echo htmlspecialchars($default['key']);
    ?>
]" />
    </li>
    <?php 
    $x++;
}
$x = 1;
foreach (module_group::get_groups('website') as $group_data) {
    ?>
    <li>
        <label for="website_group_<?php 
    echo $x;
    ?>
"><?php 
    echo htmlspecialchars($group_data['name']);
    ?>
</label>
        <input type="text" id="website_group_<?php 
    echo $x;
    ?>
" name="website[group_ids][<?php 
    echo htmlspecialchars($group_data['group_id']);
    ?>
Ejemplo n.º 23
0
    $c = array();
    $res = module_customer::get_customers();
    foreach ($res as $row) {
        $c[$row['customer_id']] = $row['customer_name'];
    }
    $fieldset_data = array('heading' => array('type' => 'h3', 'title' => _l('Advanced')), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array());
    if (count($res) <= 1 && $website['customer_id'] && isset($c[$website['customer_id']])) {
        $fieldset_data['elements']['change'] = array('title' => _l('Change Customer'), 'fields' => array(htmlspecialchars($c[$website['customer_id']]), array('type' => 'hidden', 'name' => 'customer_id', 'value' => $website['customer_id'])));
    } else {
        $fieldset_data['elements']['change'] = array('title' => _l('Change Customer'), 'fields' => array(array('type' => 'select', 'name' => 'customer_id', 'options' => $c, 'value' => $website['customer_id'], 'help' => 'Changing a customer will also change all the current linked jobs and invoices across to this new customer.')));
    }
    echo module_form::generate_fieldset($fieldset_data);
}
if ((int) $website_id > 0) {
    if (class_exists('module_group', false)) {
        module_group::display_groups(array('title' => module_config::c('project_name_single', 'Website') . ' Groups', 'owner_table' => 'website', 'owner_id' => $website_id, 'view_link' => module_website::link_open($website_id)));
    }
    // and a hook for our new change request plugin
    hook_handle_callback('website_sidebar', $website_id);
}
hook_handle_callback('layout_column_half', 2, 65);
if ((int) $website_id > 0) {
    if (class_exists('module_note', false)) {
        $note_summary_owners = array();
        // generate a list of all possible notes we can display for this website.
        // display all the notes which are owned by all the sites we have access to
        $note_summary_owners['job'] = array();
        $note_summary_owners['invoice'] = array();
        if (class_exists('module_job', false) && module_job::is_plugin_enabled()) {
            foreach (module_job::get_jobs(array('website_id' => $website_id)) as $val) {
                $note_summary_owners['job'][] = $val['job_id'];
Ejemplo n.º 24
0
}
if (class_exists('module_group', false)) {
    $columns['member_group'] = array('title' => 'Group', 'callback' => function ($member) {
        // find the groups for this member.
        $g = array();
        $groups = module_group::get_groups_search(array('owner_table' => 'member', 'owner_id' => $member['member_id']));
        foreach ($groups as $group) {
            $g[] = $group['name'];
        }
        echo implode(', ', $g);
    });
    if (class_exists('module_newsletter', false)) {
        $columns['member_newsletter'] = array('title' => 'Newsletter', 'callback' => function ($member) {
            // find the groups for this member.
            $g = array();
            $groups = module_group::get_groups_search(array('owner_table' => 'newsletter_subscription', 'owner_id' => $member['member_id']));
            foreach ($groups as $group) {
                $g[] = $group['name'];
            }
            echo implode(', ', $g);
            echo ' ';
            $newsletter_member_id = module_newsletter::member_from_email($member, false);
            if ($newsletter_member_id) {
                if ($res = module_newsletter::is_member_unsubscribed($newsletter_member_id, $member)) {
                    if (isset($res['unsubscribe_send_id']) && $res['unsubscribe_send_id']) {
                        // they unsubscribed from a send.
                        $send_data = module_newsletter::get_send($res['unsubscribe_send_id']);
                        _e('(unsubscribed %s)', print_date($res['time']));
                    } else {
                        if (isset($res['reason']) && $res['reason'] == 'no_email') {
                            _e('(do not send)');
Ejemplo n.º 25
0
                    if ($invoice['total_amount_due'] > 0) {
                        echo dollar($invoice['total_amount_due'], true, $invoice['currency_id']);
                        echo ' ' . _l('due');
                    } else {
                        echo _l('%s paid', dollar($invoice['total_amount'], true, $invoice['currency_id']));
                    }
                    echo '</span>';
                    echo "<br>";
                }
            }
        });
    }
}
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) {
Ejemplo n.º 26
0
            echo $faq_product && isset($faq_product['name']) ? htmlspecialchars($faq_product['name']) : '';
        }
    });
}
if (class_exists('module_envato', false)) {
    $columns['ticket_envato'] = array('title' => _l('Envato%s', module_config::c('envato_show_ticket_earning', 0) ? ' (' . dollar($envato_count * 0.7) . ')' : ''), 'callback' => function ($ticket) {
        $items = module_envato::get_items_by_ticket($ticket['ticket_id']);
        foreach ($items as $item) {
            echo '<a href="' . $item['url'] . '">' . htmlspecialchars($item['name']) . '</a> ';
        }
    });
}
if (class_exists('module_group', false) && module_config::c('ticket_enable_groups', 1) && module_group::groups_enabled()) {
    $columns['ticket_group'] = array('title' => 'Group', 'callback' => function ($ticket) {
        // find the groups for this customer.
        $groups = module_group::get_groups_search(array('owner_table' => 'ticket', 'owner_id' => $ticket['ticket_id']));
        $g = array();
        foreach ($groups as $group) {
            $g[] = $group['name'];
        }
        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">';
    $c = array();
    $res = module_customer::get_customers();
    foreach ($res as $row) {
        $c[$row['customer_id']] = $row['customer_name'];
    }
    $fieldset_data = array('heading' => array('type' => 'h3', 'title' => _l('Advanced')), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array());
    if (count($res) <= 1 && $widget['customer_id'] && isset($c[$widget['customer_id']])) {
        $fieldset_data['elements']['change'] = array('title' => _l('Change Customer'), 'fields' => array(htmlspecialchars($c[$widget['customer_id']]), array('type' => 'hidden', 'name' => 'customer_id', 'value' => $widget['customer_id'])));
    } else {
        $fieldset_data['elements']['change'] = array('title' => _l('Change Customer'), 'fields' => array(array('type' => 'select', 'name' => 'customer_id', 'options' => $c, 'value' => $widget['customer_id'], 'help' => 'Changing a customer will also change all the current linked jobs and invoices across to this new customer.')));
    }
    echo module_form::generate_fieldset($fieldset_data);
}
if ((int) $widget_id > 0) {
    if (class_exists('module_group', false)) {
        module_group::display_groups(array('title' => 'Widget' . ' Groups', 'owner_table' => 'widget', 'owner_id' => $widget_id, 'view_link' => module_widget::link_open($widget_id)));
    }
    // and a hook for our new change request plugin
    hook_handle_callback('widget_sidebar', $widget_id);
}
hook_handle_callback('layout_column_half', 2, 65);
if ((int) $widget_id > 0) {
    if (class_exists('module_note', false)) {
        module_note::display_notes(array('title' => 'Widget' . ' Notes', 'owner_table' => 'widget', 'owner_id' => $widget_id, 'view_link' => module_widget::link_open($widget_id)));
    }
    // and a hook for our new change request plugin
    hook_handle_callback('widget_main', $widget_id);
}
hook_handle_callback('layout_column_half', 'end');
$form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save ' . 'Widget')), array('ignore' => !((int) $widget_id && module_widget::can_i('delete', 'Widgets')), 'type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . module_widget::link_open(false) . "';")));
echo module_form::generate_form_actions($form_actions);
Ejemplo n.º 28
0
 public static function run_pagination_hook(&$rows, &$per_page)
 {
     if (self::$table_sort_options) {
         self::is_currently_sorting();
         // loads the session data.
         $new_sort_column = $new_sort_direction = $new_sort_per_page = false;
         if (isset($_SESSION['_table_sort']) && isset($_SESSION['_table_sort'][self::$table_sort_options['table_id']]) && isset($_SESSION['_table_sort'][self::$table_sort_options['table_id']][0])) {
             $new_sort_column = $_SESSION['_table_sort'][self::$table_sort_options['table_id']][0];
         }
         if (isset($_SESSION['_table_sort']) && isset($_SESSION['_table_sort'][self::$table_sort_options['table_id']]) && isset($_SESSION['_table_sort'][self::$table_sort_options['table_id']][1])) {
             $new_sort_direction = $_SESSION['_table_sort'][self::$table_sort_options['table_id']][1];
         }
         if (isset($_SESSION['_table_sort']) && isset($_SESSION['_table_sort'][self::$table_sort_options['table_id']]) && isset($_SESSION['_table_sort'][self::$table_sort_options['table_id']][2])) {
             $new_sort_per_page = $_SESSION['_table_sort'][self::$table_sort_options['table_id']][2];
         }
         // count how many results for the "per page" drop down below.
         self::$table_sort_options['row_count'] = is_resource($rows) ? mysql_num_rows($rows) : count($rows);
         if (!isset($_SESSION['_table_sort']) || !isset($_SESSION['_table_sort'][self::$table_sort_options['table_id']])) {
             return;
         }
         if ($new_sort_column && $new_sort_direction) {
             // clear defaults! time for a user defined one.
             foreach (self::$table_sort_options['sortable'] as $column_id => $options) {
                 if (isset($options['current'])) {
                     unset(self::$table_sort_options['sortable'][$column_id]['current']);
                 }
                 if ($column_id == $new_sort_column) {
                     self::$table_sort_options['sortable'][$column_id]['current'] = $new_sort_direction;
                 }
             }
         }
         if ($new_sort_per_page >= 1) {
             $per_page = $new_sort_per_page;
         } else {
             if ($new_sort_per_page == -2) {
                 // special flag for "all"
                 $per_page = false;
             }
         }
         if (!$new_sort_column) {
             return;
         }
         // sort results by selected option.
         if (is_resource($rows)) {
             $new_rows = array();
             while ($row = mysql_fetch_assoc($rows)) {
                 $new_rows[] = $row;
             }
             mysql_free_result($rows);
             $rows = $new_rows;
         } else {
             // rows stays the same.
         }
         if (is_array($rows) && count($rows)) {
             foreach (self::$table_sort_options['sortable'] as $column_id => $options) {
                 if (isset($options['current'])) {
                     // we have a sortable key! yay!
                     // is this a special "group sort" ?
                     if (isset($options['group_sort']) && $options['group_sort'] && $options['owner_table'] && $options['owner_id']) {
                         // find the group(s) for EVERY row in the result set.
                         // this is super slow, but only way to sort.
                         // we also sort multiple groups in the same order that is selected here.
                         if (class_exists('module_group', false)) {
                             foreach ($rows as $row_id => $row) {
                                 if (!isset($row[$options['owner_id']]) || !$row[$options['owner_id']]) {
                                     continue;
                                 }
                                 // find the groups for this customer.
                                 $groups = module_group::get_groups_search(array('owner_table' => $options['owner_table'], 'owner_id' => $row[$options['owner_id']]));
                                 $g = array();
                                 foreach ($groups as $group) {
                                     $g[] = $group['name'];
                                 }
                                 natcasesort($g);
                                 if ($options['current'] == 1) {
                                     // ascendine
                                 } else {
                                     // descenting
                                     $g = array_reverse($g);
                                 }
                                 $rows[$row_id]['group_sort_' . $options['owner_table']] = implode($g, ', ');
                             }
                             self::$sortables['group_sort_' . $options['owner_table']] = $options['current'];
                         }
                     } else {
                         if (isset($options['extra_sort']) && $options['extra_sort'] && $options['owner_table'] && $options['owner_id']) {
                             // find the extra(s) for EVERY row in the result set.
                             // this is super slow, but only way to sort.
                             // we also sort multiple extras in the same order that is selected here.
                             if (class_exists('module_extra', false)) {
                                 foreach ($rows as $row_id => $row) {
                                     if (!isset($row[$options['owner_id']]) || !$row[$options['owner_id']]) {
                                         continue;
                                     }
                                     // find the extras for this customer.
                                     $extras = module_extra::get_extras(array('owner_table' => $options['owner_table'], 'owner_id' => $row[$options['owner_id']], 'extra_key' => $options['field']));
                                     if (count($extras) == 1) {
                                         // found a match!
                                         $extra_val = current($extras);
                                         if (isset($options['field_type']) && $options['field_type'] == 'date') {
                                             $extra_val['extra'] = input_date($extra_val['extra']);
                                         }
                                         $rows[$row_id]['extra_header_' . $options['default_field_id']] = $extra_val['extra'];
                                     }
                                 }
                                 self::$sortables['extra_header_' . $options['default_field_id']] = $options['current'];
                             }
                         } else {
                             // nope! yay! normal sort.
                             self::$sortables[$options['field']] = $options['current'];
                         }
                     }
                 }
             }
             uasort($rows, array('module_table_sort', 'dosort'));
         }
         // set the 'per page' value based on session setting.
     }
 }
Ejemplo n.º 29
0
});
if ($show_customer_details) {
    $columns['customer'] = array('title' => $contact_type_permission, 'callback' => function ($user) use($contact_module_name) {
        switch ($contact_module_name) {
            case 'customer':
                echo module_customer::link_open($user['customer_id'], true, $user);
                break;
            case 'vendor':
                echo module_vendor::link_open($user['vendor_id'], true, $user);
                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)) {
Ejemplo n.º 30
0
                    <h3><?php 
            echo _l('Perform Bulk Actions on Tickets (BETA!)');
            ?>
</h3>

                    <table width="100%" border="0" cellspacing="0" cellpadding="2" class="tableclass tableclass_form">
                        <tbody>
                        <tr>
                            <th class="width2">
                                <?php 
            echo _l('Select Ticket Group');
            ?>
                            </th>
                            <td>
                                <?php 
            echo print_select_box(module_group::get_groups('ticket'), 'group_id', false, '', true, 'name');
            ?>
                            </td>
                        </tr>
                        <tr>
                            <th>
                                <?php 
            echo _l('Change Ticket Status');
            ?>
                            </th>
                            <td>
                                <?php 
            echo print_select_box(module_ticket::get_statuses(), 'status_id', '');
            ?>
                            </td>
                        </tr>