} else {
    $show_customer_details = false;
}
$users = module_user::get_contacts($search, true, false);
if (class_exists('module_group', false)) {
    module_group::enable_pagination_hook(array('fields' => array('owner_id' => 'user_id', 'owner_table' => 'user', 'name' => 'name', 'email' => 'email')));
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_user::can_i('view', 'Export ' . $contact_type_permission . ' Contacts')) {
    if (isset($_REQUEST['import_export_go'])) {
        $users = query_to_array($users);
        foreach ($users as $user_id => $user) {
            $users[$user_id]['is_primary'] = $user['is_primary'] == $user['user_id'] ? _l('Yes') : _l('No');
        }
    }
    module_import_export::enable_pagination_hook(array('name' => $contact_type_permission . ' Contact Export', 'fields' => array($contact_type_permission . ' Contact ID' => 'user_id', 'First Name' => 'name', 'Last Name' => 'last_name', $contact_type_permission . ' ID' => $contact_module_name . '_id', $contact_type_permission . ' Name' => $contact_module_name . '_name', 'Primary Contact' => 'is_primary', 'Phone' => 'phone', 'Email' => 'email', 'Fax' => 'fax', 'Mobile' => 'mobile'), 'extra' => array('owner_table' => 'user', 'owner_id' => 'user_id'), 'group' => array(array('title' => 'Contact Group', 'owner_table' => 'user', 'owner_id' => 'user_id'))));
}
$heading = array('main' => true, 'type' => 'h2', 'title' => _l(($show_customer_details ? 'All ' : '') . $contact_type_permission . ' Contacts'), 'button' => array());
if (isset($search[$use_master_key]) && $search[$use_master_key] && module_user::can_i('create', 'Contacts', $contact_type_permission)) {
    $heading['button'][] = array('title' => 'Add New Contact', 'url' => module_user::link_generate('new', array('type' => 'contact', $use_master_key => isset($search[$use_master_key]) ? $search[$use_master_key] : false)), 'type' => 'add');
}
print_heading($heading);
?>



<form action="" method="<?php 
echo _DEFAULT_FORM_METHOD;
?>
">
    <?php 
Example #2
0
 public static function enable_pagination_hook($options = array())
 {
     $GLOBALS['pagination_import_export_hack'] = true;
     self::$pagination_options = $options;
 }
Example #3
0
    foreach ($quotes as $quote_id => $quote) {
        $quotes[$quote_id] = array_merge($quote, module_quote::get_quote($quote['quote_id']));
        $quotes[$quote_id]['website_name'] = $quote['website_name'];
    }
    module_table_sort::enable_pagination_hook(array('table_id' => 'quote_list', 'sortable' => array('quote_title' => array('field' => 'name', 'current' => 1), 'quote_start_date' => array('field' => 'date_create'), 'quote_completed_date' => array('field' => 'date_approved'), 'quote_website' => array('field' => 'website_name'), 'quote_customer' => array('field' => 'customer_name'), 'quote_type' => array('field' => 'type'), 'quote_status' => array('field' => 'status'), 'quote_progress' => array('field' => 'total_percent_complete'), 'quote_total' => array('field' => 'total_amount'), 'quote_total_amount_invoiced' => array('field' => 'total_amount_invoiced'), 'quote_group' => array('group_sort' => true, 'owner_table' => 'quote', 'owner_id' => 'quote_id'))));
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_quote::can_i('view', 'Export Quotes')) {
    module_import_export::enable_pagination_hook(array('name' => 'Quote Export', 'fields' => array('Quote ID' => 'quote_id', 'Quote Title' => 'name', 'Hourly Rate' => 'hourly_rate', 'Start Date' => 'date_create', 'Completed Date' => 'date_approved', module_config::c('project_name_single', 'Website') . ' Name' => 'website_name', 'Customer Name' => 'customer_name', 'Type' => 'type', 'Status' => 'status', 'Staff Member' => 'staff_member', 'Tax Name' => 'total_tax_name', 'Tax Percent' => 'total_tax_rate', 'Renewal Date' => 'date_renew'), 'extra' => array('owner_table' => 'quote', 'owner_id' => 'quote_id')));
}
$header = array('title' => _l('Customer Quotes'), 'main' => true, 'button' => array());
if (module_quote::can_i('create', 'Quotes')) {
    $header['button'][] = array('url' => module_quote::link_open('new'), 'title' => 'Add New Quote', 'type' => 'add');
}
if (class_exists('module_import_export', false) && module_quote::can_i('view', 'Import Quotes')) {
    $link = module_import_export::import_link(array('callback' => 'module_quote::handle_import', 'callback_preview' => 'module_quote::handle_import_row_debug', 'name' => 'Quotes', 'return_url' => $_SERVER['REQUEST_URI'], 'group' => 'quote', 'fields' => array('Quote Title' => 'name', 'Hourly Rate' => 'hourly_rate', 'Start Date' => 'date_create', 'Completed Date' => 'date_approved', module_config::c('project_name_single', 'Website') . ' Name' => 'website_name', 'Customer Name' => 'customer_name', 'Type' => 'type', 'Status' => 'status', 'Staff Member' => 'staff_member', 'Tax Name' => 'total_tax_name', 'Tax Percent' => 'total_tax_rate', 'Renewal Date' => 'date_renew'), 'extra' => array('owner_table' => 'quote', 'owner_id' => 'quote_id')));
    $header['button'][] = array('url' => $link, 'title' => 'Import Quotes', 'type' => 'add');
}
print_heading($header);
?>



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

<?php 
$search_bar = array('elements' => array('name' => array('title' => _l('Quote Title:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : '', 'size' => 30)), 'type' => array('title' => _l('Type:'), 'field' => array('type' => 'select', 'name' => 'search[type]', 'value' => isset($search['type']) ? $search['type'] : '', 'options' => module_quote::get_types())), 'status' => array('title' => _l('Status:'), 'field' => array('type' => 'select', 'name' => 'search[status]', 'value' => isset($search['status']) ? $search['status'] : '', 'options' => module_quote::get_statuses())), 'accepted' => array('title' => _l('Accepted:'), 'field' => array('type' => 'select', 'name' => 'search[accepted]', 'value' => isset($search['accepted']) ? $search['accepted'] : '', 'options' => array(1 => _l('Both Accepted and Un-Accepted Quotes'), 2 => _l('Only Accepted Quotes'), 3 => _l('Only Un-Accepted Quotes'))))));
echo module_form::search_bar($search_bar);
/** START TABLE LAYOUT **/
$table_manager = module_theme::new_table_manager();
$columns = array();
Example #4
0
                    } else {
                        _h('You will be reminded to renew this job on this date. You will be given the option to renew this job closer to the renewal date (a new button will appear).');
                    }
                }
                echo '<br/>';
                $element = array('type' => 'checkbox', 'name' => 'renew_auto', 'value' => isset($job['renew_auto']) && $job['renew_auto'], 'label' => 'Automatically Renew', 'help' => 'This Job will be automatically renewed on this date. A new Job will be created as a copy from this Job.');
                module_form::generate_form_element($element);
                echo '<br/>';
                $element = array('type' => 'checkbox', 'name' => 'renew_invoice', 'value' => isset($job['renew_invoice']) && $job['renew_invoice'], 'label' => 'Automatically Invoice', 'help' => 'When this Job is renewed the tasks will be automatically completed and an invoice will be automatically created and emailed to the customer.');
                module_form::generate_form_element($element);
            }
        }));
    } else {
        $fieldset_data['elements'][] = array('title' => 'Renewal Date', 'fields' => array('(recurring jobs available in <a href="http://codecanyon.net/item/ultimate-client-manager-pro-edition/2621629?ref=dtbaker" target="_blank">UCM Pro Edition</a>)'));
    }
    if ((int) $job_id > 0 && class_exists('module_import_export', false) && module_import_export::is_plugin_enabled() && isset($import_tasks_link)) {
        $fieldset_data['elements'][] = array('title' => 'Task CSV Data', 'fields' => array(function () use($job_id, $import_tasks_link) {
            // hack to add a "export" link to this page
            if (module_job::can_i('view', 'Export Job Tasks')) {
                ?>

						    <a href="<?php 
                echo module_job::link_open($job_id, false) . '&import_export_go=yes';
                ?>
"
						       class=""><?php 
                _e('Export Tasks');
                ?>
</a>
					    <?php 
            }
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!$module->can_i('view', 'Products') || !$module->can_i('edit', 'Products')) {
    redirect_browser(_BASE_HREF);
}
// hack to add a "group" option to the pagination results.
if (class_exists('module_group', false) && module_product::can_i('edit', 'Products')) {
    module_group::enable_pagination_hook(array('bulk_actions' => array('delete' => array('label' => 'Delete selected products', 'type' => 'delete', 'callback' => 'module_product::bulk_handle_delete'))));
}
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : array();
$products = module_product::get_products($search);
$heading = array('title' => 'Products', 'type' => 'h2', 'main' => true, 'button' => array());
if (module_product::can_i('create', 'Products')) {
    if (class_exists('module_import_export', false)) {
        $link = module_import_export::import_link(array('callback' => 'module_product::handle_import', 'name' => 'Products', 'return_url' => $_SERVER['REQUEST_URI'], 'fields' => array('Product ID' => 'product_id', 'Product Name' => 'name', 'Product Category' => 'category_name', 'Hours/Qty' => 'quantity', 'Amount' => 'amount', 'Description' => 'description')));
        $heading['button'][] = array('title' => "Import Products", 'type' => 'add', 'url' => $link);
    }
    $heading['button'][] = array('title' => "Create New Product", 'type' => 'add', 'url' => module_product::link_open('new'));
}
print_heading($heading);
?>



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

<?php 
/** START TABLE LAYOUT **/
$table_manager = module_theme::new_table_manager();
$columns = array();
if (!module_customer::can_i('view', $page_type)) {
    redirect_browser(_BASE_HREF);
}
$module->page_title = _l($page_type);
$staff_members = module_user::get_staff_members();
$staff_member_rel = array();
foreach ($staff_members as $staff_member) {
    $staff_member_rel[$staff_member['user_id']] = $staff_member['name'];
}
$customers = module_customer::get_customers($search, array('as_resource' => true));
$header_buttons = array();
if (module_customer::can_i('create', $page_type)) {
    $header_buttons[] = array('url' => module_customer::link_open('new', false), 'title' => 'Create New ' . $page_type_single, 'type' => 'add');
}
if (class_exists('module_import_export', false) && module_customer::can_i('view', 'Import ' . $page_type)) {
    $header_buttons[] = array('url' => module_import_export::import_link(array('callback' => 'module_customer::handle_import' . ($current_customer_type_id ? '_leads' : ''), 'name' => $page_type, 'return_url' => $_SERVER['REQUEST_URI'], 'group' => 'customer', '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', 'Password' => 'password', 'User Role Name' => 'role', 'Notes' => 'notes', 'Staff' => 'customer_staff'), 'extra' => array(array('owner_table' => 'customer', 'owner_id' => 'customer_id'), array('owner_table' => 'user', 'owner_id' => 'primary_user_id')))), 'title' => 'Import ' . $page_type, 'type' => 'add');
}
if (file_exists('includes/plugin_user/pages/contact_admin_list.php') && module_user::can_i('view', 'All ' . $page_type_single . ' Contacts', 'Customer', 'customer')) {
    $header_buttons[] = array('url' => module_user::link_open_contact(false), 'title' => 'View All Contacts');
}
print_heading(array('main' => true, 'type' => 'h2', 'title' => $page_type, 'button' => $header_buttons));
?>


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

    <?php 
$search_bar = array('elements' => array('name' => array('title' => _l('Names, Phone or Email:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : '', 'size' => 15)), 'address' => array('title' => _l('Address:'), 'field' => array('type' => 'text', 'name' => 'search[address]', 'value' => isset($search['address']) ? $search['address'] : '', 'size' => 15))));
if (class_exists('module_extra', false)) {
    $search_bar['extra_fields'] = 'customer';
}
	        </tbody>
	    </table>
	    <input type="hidden" name="duplicate_ids" value="<?php 
    echo json_encode(array_keys($duplicate_word_ids));
    ?>
">
		<?php 
    $form_actions = array('class' => 'action_bar action_bar_center', 'elements' => array(array('type' => 'delete_button', 'name' => 'delete_duplicates', 'value' => _l('Remove These Incorrect Words')), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'onclick' => "window.location.href='" . str_replace('check_duplicates', '', htmlspecialchars($_SERVER['REQUEST_URI'])) . "';")));
    echo module_form::generate_form_actions($form_actions);
    ?>
	</form>
		<?php 
} else {
    $heading = array('title' => _l('Translation for: %s', htmlspecialchars($language['language_name'] ? $language['language_name'] : _l('New'))), 'type' => 'h2', 'main' => true, 'button' => array(array('url' => htmlspecialchars($_SERVER['REQUEST_URI']) . (strpos($_SERVER['REQUEST_URI'], '?') === false ? '?' : '&') . 'export=true', 'title' => 'Export CSV')));
    if (class_exists('module_import_export', false)) {
        $heading['button'][] = array('url' => module_import_export::import_link(array('callback' => 'module_language::handle_import', 'name' => _l('Language'), 'return_url' => $_SERVER['REQUEST_URI'], 'options' => array('new_words' => array('label' => _l('New Words'), 'form_element' => array('name' => 'new_words', 'type' => 'select', 'blank' => false, 'value' => 'ignore', 'options' => array('add_new' => _l('Add missing words from CSV into Database'), 'ignore' => _l('Skip missing words, only add those already in Database')))), array('label' => '', 'form_element' => array('name' => 'language_id', 'type' => 'hidden', 'value' => $language_id))), 'fields' => array('Word' => 'word', 'Translation' => 'translation'))), 'title' => 'Import CSV');
    }
    print_heading($heading);
    ?>


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

    <input type="hidden" name="_process" value="save_language_translation">

	<?php 
    module_form::print_form_auth();
    module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
    $fieldset_data = array('elements' => array(array('title' => _l('Language Code'), 'field' => array('name' => 'language_code', 'value' => isset($language['language_code']) ? $language['language_code'] : '', 'type' => 'text', 'help' => 'Example: es or de', 'size' => 5)), array('title' => _l('Language Name'), 'field' => array('name' => 'language_name', 'value' => isset($language['language_name']) ? $language['language_name'] : '', 'type' => 'text', 'help' => 'Example: Spanish or German;'))));
    echo module_form::generate_fieldset($fieldset_data);
    unset($fieldset_data);
Example #8
0
    $hook = array('fields' => array('owner_id' => 'member_id', 'owner_table' => 'member'), 'bulk_actions' => array('delete' => array('label' => 'Delete these members', 'type' => 'delete', 'callback' => 'module_member::handle_bulk_delete')));
    if (class_exists('module_newsletter', false)) {
        $hook['bulk_actions']['delete_double_optin'] = array('label' => 'Delete failed double-opt-in members', 'type' => 'delete', 'callback' => 'module_member::handle_bulk_delete_double_optin');
    }
    module_group::enable_pagination_hook($hook);
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_member::can_i('view', 'Export Members')) {
    module_import_export::enable_pagination_hook(array('name' => 'Member Export', 'fields' => array('Member ID' => 'member_id', 'First Name' => 'first_name', 'Last Name' => 'last_name', 'Business Name' => 'business', 'Email' => 'email', 'Phone' => 'phone', 'Mobile' => 'mobile'), 'extra' => array('owner_table' => 'member', 'owner_id' => 'member_id')));
}
$header = array('title' => _l('Members'), 'type' => 'h2', 'main' => true, 'button' => array());
if (module_member::can_i('create', 'Members')) {
    $header['button'] = array(array('url' => module_member::link_open('new'), 'title' => _l('Create New Member'), 'type' => 'add'));
}
if (class_exists('module_import_export', false) && module_member::can_i('view', 'Import Members')) {
    $link = module_import_export::import_link(array('callback' => 'module_member::handle_import', 'name' => 'Members', 'return_url' => $_SERVER['REQUEST_URI'], 'group' => array('member', 'newsletter_subscription'), 'fields' => array('Member ID' => 'member_id', 'First Name' => 'first_name', 'Last Name' => 'last_name', 'Business Name' => 'business', 'Email' => 'email', 'Phone' => 'phone', 'Mobile' => 'mobile'), 'extra' => array('owner_table' => 'member', 'owner_id' => 'member_id')));
    $header['button'][] = array('url' => $link, 'title' => 'Import members', 'type' => 'add');
}
print_heading($header);
?>


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

<?php 
$search_bar = array('elements' => array('name' => array('title' => _l('Names, Phone or Email:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : ''))));
if (class_exists('module_group', false) && module_member::can_i('view', 'Member Groups')) {
    $search_bar['elements']['group'] = array('title' => _l('Group:'), 'field' => array('type' => 'select', 'name' => 'search[group_id]', 'value' => isset($search['group_id']) ? $search['group_id'] : '', 'options' => module_group::get_groups('member'), 'options_array_id' => 'name'));
}
if (class_exists('module_newsletter', false)) {
    $search_bar['elements']['group'] = array('title' => _l('Newsletter:'), 'field' => array('type' => 'select', 'name' => 'search[group_id2]', 'value' => isset($search['group_id2']) ? $search['group_id2'] : '', 'options' => module_group::get_groups('newsletter_subscription'), 'options_array_id' => 'name'));
Example #9
0
        if (!isset($finance_debit_total[$finance['currency_id']])) {
            $finance_debit_total[$finance['currency_id']] = 0;
        }
        $finance_debit_total[$finance['currency_id']] += $finance['debit'];
    }
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_finance::can_i('view', 'Export Finance')) {
    $export_settings = array('name' => 'Finance Export', 'parent_form' => 'finance_form', 'fields' => array('Date' => 'transaction_date', 'Name' => 'name', 'URL' => 'url', 'Description' => 'description', 'Credit' => 'credit', 'Debit' => 'debit', 'Account' => 'account_name', 'Categories' => 'categories'), 'summary' => array());
    if (module_config::c('finance_list_show_totals', 1)) {
        foreach ($finance_debit_total + $finance_credit_total as $currency_id => $foo) {
            $currency = get_single('currency', 'currency_id', $currency_id);
            $export_settings['summary'][] = array('description' => _l('%s Totals:', $currency && isset($currency['code']) ? $currency['code'] : ''), 'credit' => dollar(isset($finance_credit_total[$currency_id]) ? $finance_credit_total[$currency_id] : 0, true, $currency_id), 'debit' => dollar(isset($finance_debit_total[$currency_id]) ? $finance_debit_total[$currency_id] : 0, true, $currency_id));
        }
    }
    module_import_export::enable_pagination_hook($export_settings);
}
$upcoming_finances = array();
print_heading(array('title' => _l('Financial Transactions'), 'type' => 'h2', 'main' => true, 'button' => array('title' => _l('Add New'), 'url' => module_finance::link_open('new'), 'type' => 'add')));
?>



<form action="" method="post" id="finance_form" class="search_form">

    <?php 
$categories_rel = array();
foreach (module_finance::get_categories() as $category) {
    $categories_rel[$category['finance_category_id']] = $category['name'];
}
$accounts_rel = array();
Example #10
0
if (class_exists('module_group', false)) {
    module_group::enable_pagination_hook(array('fields' => array('owner_id' => 'website_id', 'owner_table' => 'website', 'name' => 'name', 'email' => '')));
}
if (class_exists('module_table_sort', false)) {
    module_table_sort::enable_pagination_hook(array('table_id' => 'website_list', 'sortable' => array('website_name' => array('field' => 'name', 'current' => 1), 'website_url' => array('field' => 'url'), 'website_customer' => array('field' => 'customer_name'), 'website_status' => array('field' => 'status'), 'website_group' => array('group_sort' => true, 'owner_table' => 'website', 'owner_id' => 'website_id'))));
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_website::can_i('view', 'Export ' . module_config::c('project_name_plural', 'Websites'))) {
    module_import_export::enable_pagination_hook(array('name' => module_config::c('project_name_single', 'Website') . ' Export', 'fields' => array(module_config::c('project_name_single', 'Website') . ' ID' => 'website_id', 'Customer Name' => 'customer_name', 'Customer Contact First Name' => 'customer_contact_fname', 'Customer Contact Last Name' => 'customer_contact_lname', 'Customer Contact Email' => 'customer_contact_email', module_config::c('project_name_single', 'Website') . ' Name' => 'name', 'URL' => 'url', module_config::c('project_name_single', 'Website') . ' Status' => 'status'), 'extra' => array('owner_table' => 'website', 'owner_id' => 'website_id')));
}
$header_buttons = array();
if (module_website::can_i('create', 'Websites')) {
    $header_buttons[] = array('url' => module_website::link_open('new'), 'type' => 'add', 'title' => _l('Add New ' . module_config::c('project_name_single', 'Website')));
}
if (class_exists('module_import_export', false) && module_website::can_i('view', 'Import ' . module_config::c('project_name_plural', 'Websites'))) {
    $link = module_import_export::import_link(array('callback' => 'module_website::handle_import', 'callback_preview' => 'module_website::handle_import_row_debug', 'name' => module_config::c('project_name_plural', 'Websites'), 'return_url' => $_SERVER['REQUEST_URI'], 'group' => 'website', 'fields' => array(module_config::c('project_name_single', 'Website') . ' ID' => 'website_id', 'Customer Name' => 'customer_name', 'Customer Contact First Name' => 'customer_contact_fname', 'Customer Contact Last Name' => 'customer_contact_lname', 'Customer Contact Email' => 'customer_contact_email', module_config::c('project_name_single', 'Website') . ' Name' => 'name', 'URL' => 'url', module_config::c('project_name_single', 'Website') . ' Status' => 'status', 'Notes' => 'notes'), 'options' => array('duplicates' => array('label' => _l('Duplicates'), 'form_element' => array('name' => 'duplicates', 'type' => 'select', 'blank' => false, 'value' => 'ignore', 'options' => array('ignore' => _l('Skip Duplicates'), 'overwrite' => _l('Overwrite/Update Duplicates'))))), 'extra' => array('owner_table' => 'website', 'owner_id' => 'website_id')));
    $header_buttons[] = array('url' => $link, 'type' => 'add', 'title' => _l("Import " . module_config::c('project_name_plural', 'Websites')));
}
print_heading(array('type' => 'h2', 'main' => true, 'title' => _l('Customer ' . module_config::c('project_name_plural', 'Websites')), 'button' => $header_buttons));
?>



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


<?php 
$search_bar = array('elements' => array('name' => array('title' => _l('Name/URL:'), 'field' => array('type' => 'text', 'name' => 'search[generic]', 'value' => isset($search['generic']) ? $search['generic'] : '', 'size' => 30)), 'status' => array('title' => _l('Status:'), 'field' => array('type' => 'select', 'name' => 'search[status]', 'value' => isset($search['status']) ? $search['status'] : '', 'options' => module_website::get_statuses()))));
echo module_form::search_bar($search_bar);
/** START TABLE LAYOUT **/
$table_manager = module_theme::new_table_manager();
Example #11
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;
}
Example #12
0
						    <?php 
                _h('This will be the ' . module_config::c('project_name_single', 'Website') . ' this quote is assigned to - and therefor the customer. Every quote should have a' . module_config::c('project_name_single', 'Website') . ' assigned. Clicking the open link will take you to the ' . module_config::c('project_name_single', 'Website'));
            } else {
                if ($quote['website_id']) {
                    echo module_website::link_open($quote['website_id'], true);
                } else {
                    _e('N/A');
                }
            }
        }));
    } else {
        if (!class_exists('module_website', false) && module_config::c('show_ucm_ads', 1)) {
            $fieldset_data['elements'][] = array('title' => module_config::c('project_name_single', 'Website'), 'fields' => array('(website option available in <a href="http://codecanyon.net/item/ultimate-client-manager-pro-edition/2621629?ref=dtbaker" target="_blank">UCM Pro Edition</a>)'));
        }
    }
    if ((int) $quote_id > 0 && class_exists('module_import_export', false) && module_import_export::is_plugin_enabled()) {
        $fieldset_data['elements'][] = array('title' => 'Task CSV Data', 'fields' => array(function () use($quote_id, $import_tasks_link) {
            // hack to add a "export" link to this page
            if (module_quote::can_i('view', 'Export Quote Tasks')) {
                ?>

						    <a href="<?php 
                echo module_quote::link_open($quote_id, false) . '&import_export_go=yes';
                ?>
"
						       class=""><?php 
                _e('Export Tasks');
                ?>
</a>
					    <?php 
            }
Example #13
0
$search = isset($_REQUEST['search']) ? $_REQUEST['search'] : array();
$recent_transactions = module_finance::get_finances($search);
$total_debit = $total_credit = 0;
foreach ($recent_transactions as $recent_transaction) {
    $total_credit += $recent_transaction['credit'];
    $total_debit += $recent_transaction['debit'];
}
if (!module_finance::can_i('view', 'Finance')) {
    redirect_browser(_BASE_HREF);
}
if (class_exists('module_table_sort', false)) {
    module_table_sort::enable_pagination_hook(array('table_id' => 'finance_list', 'sortable' => array('sort_date' => array('field' => 'transaction_date', 'current' => 2), 'sort_name' => array('field' => 'name'), 'sort_credit' => array('field' => 'credit'), 'sort_debit' => array('field' => 'debit'))));
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_finance::can_i('view', 'Export Finance')) {
    module_import_export::enable_pagination_hook(array('name' => 'Finance Export', 'parent_form' => 'finance_form', 'fields' => array('Date' => 'transaction_date', 'Name' => 'name', 'URL' => 'url', 'Description' => 'description', 'Credit' => 'credit', 'Debit' => 'debit', 'Account' => 'account_name', 'Categories' => 'categories')));
}
$recent_transactions_pagination = process_pagination($recent_transactions);
$upcoming_finances = array();
?>





            <h2>
            <?php 
if (module_finance::can_i('create', 'Finance')) {
    ?>

                <span class="button">
Example #14
0
<h2>
    <?php 
if (module_report::can_i('create', 'reports')) {
    ?>
	<span class="button">
		<?php 
    echo create_link("Add New " . _l('Report'), "add", module_report::link_open('new'));
    ?>
	</span>
    <?php 
}
?>
    <?php 
if (class_exists('module_import_export', false) && module_report::can_i('view', 'Import ' . _l('Reports'))) {
    $link = module_import_export::import_link(array('callback' => 'module_report::handle_import', 'name' => _l('Reports'), 'return_url' => $_SERVER['REQUEST_URI'], 'group' => 'report', 'fields' => array(_l('Report') . ' ID' => 'report_id', 'Report Title' => 'report_title', 'Sql' => 'notes'), 'extra' => array('owner_table' => 'report', 'owner_id' => 'report_id')));
    ?>
      <!--  <span class="button">
            <?php 
    echo create_link("Import " . _l('Reports'), "add", $link);
    ?>
        </span> -->
        <?php 
}
?>
	<?php 
echo _l('Reports');
?>
</h2>

<form action="" method="post">
 public function enable_export($options)
 {
     if (class_exists('module_import_export', false)) {
         module_import_export::enable_pagination_hook($options);
     }
 }
Example #16
0
}
// check permissions.
if (class_exists('module_security', false)) {
    module_security::sanatise_data('job', $job);
}
$job_tasks = module_job::get_tasks($job_id);
if (class_exists('module_import_export', false)) {
    if (module_job::can_i('view', 'Export Job Tasks')) {
        module_import_export::enable_pagination_hook(array('name' => 'Job Tasks Export', 'fields' => array('Job Name' => 'job_name', 'Task ID' => 'task_id', 'Order' => 'task_order', 'Short Description' => 'description', 'Long Description' => 'long_description', 'Hours' => 'hours', 'Hours Completed' => 'completed', 'Amount' => 'amount', 'Billable' => 'billable', 'Fully Completed' => 'fully_completed', 'Date Due' => 'date_due', 'Invoice #' => 'invoice_number', 'Staff Member' => 'user_name', 'Approval Required' => 'approval_required')));
        if (isset($_REQUEST['import_export_go']) && $_REQUEST['import_export_go'] == 'yes') {
            // do the task export.
            module_import_export::run_pagination_hook($job_tasks);
        }
    }
    if (module_job::can_i('view', 'Import Job Tasks')) {
        $import_tasks_link = module_import_export::import_link(array('callback' => 'module_job::handle_import_tasks', 'name' => 'Job Tasks', 'job_id' => $job_id, 'return_url' => $_SERVER['REQUEST_URI'], 'fields' => array('Task ID' => array('task_id', false, 'The existing system ID for this task. Will overwrite existing task ID. Leave blank to create new task.'), 'Order' => array('task_order', false, 'The numerical order the tasks will appear in.'), 'Short Description' => array('description', true), 'Long Description' => 'long_description', 'Hours' => 'hours', 'Hours Completed' => 'completed', 'Amount' => 'amount', 'Billable' => array('billable', false, '1 for billable, 0 for non-billable'), 'Fully Completed' => array('fully_completed', false, '1 for fully completed, 0 for not completed'), 'Date Due' => array('date_due', false, 'When this task is due for completion'), 'Staff Member' => array('user_name', false, 'One of: ' . implode(', ', $staff_member_rel)), 'Approval Required' => array('approval_required', false, '1 if the administrator needs to approve this task, 0 if it does not require approval'))));
    }
}
?>


<script type="text/javascript">
    var completed_tasks_hidden = false; // set with session variable / cookie
    var editing_task_id = false;
    var loading_task_html = '<tr class="task_edit_loading"><td colspan="9" align="center"><?php 
_e('Loading...');
?>
</td></tr>';
    function show_completed_tasks(){
        $('.tasks_completed').show(); $('#show_completed_tasks').hide(); $('#hide_completed_tasks').show();
        set_task_numbers();