コード例 #1
0
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();
$columns['quote_title'] = array('title' => 'Quote Title', 'callback' => function ($quote) {
    echo module_quote::link_open($quote['quote_id'], true, $quote);
}, 'cell_class' => 'row_action');
$columns['quote_start_date'] = array('title' => 'Create Date', 'callback' => function ($quote) {
    echo print_date($quote['date_create']);
});
$columns['quote_completed_date'] = array('title' => 'Accepted Date', 'callback' => function ($quote) {
    echo print_date($quote['date_approved']);
});
if (class_exists('module_website', false) && module_website::is_plugin_enabled()) {
    $columns['quote_website'] = array('title' => module_config::c('project_name_single', 'Website'), 'callback' => function ($quote) {
コード例 #2
0
        if (!module_security::check_page(array('category' => 'Quote', 'page_name' => 'Quotes', 'module' => 'quote', 'feature' => 'edit'))) {
            // user does not have edit quote perms
            $do_perm_finish_check = true;
        }
    } else {
        if (!module_security::check_page(array('category' => 'Quote', 'page_name' => 'Quotes', 'module' => 'quote', 'feature' => 'create'))) {
            // user does not have create quote perms.
        }
    }
}
$fields = array('fields' => array('name' => 'Name'));
module_form::set_required($fields);
module_form::set_default_field('task_desc_new');
module_form::prevent_exit(array('valid_exits' => array('.submit_button', '.save_task', '.delete', '.task_defaults', '.exit_button', '.apply_discount')));
/**** QUOTE DETAILS ****/
$fieldset_data = array('id' => 'quote_details', 'heading' => array('type' => 'h3', 'title' => 'Quote Details'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array('name' => array('title' => 'Quote Title', 'field' => array('type' => 'text', 'name' => 'name', 'value' => $quote['name'])), 'type' => array('title' => 'Type', 'field' => array('type' => 'select', 'name' => 'type', 'value' => $quote['type'], 'blank' => false, 'options' => module_quote::get_types(), 'allow_new' => true)), 'hourly_rate' => array('title' => 'Hourly Rate', 'field' => array('type' => 'currency', 'id' => 'main_hourly_rate', 'name' => 'hourly_rate', 'value' => number_out($quote['hourly_rate']))), 'status' => array('title' => 'Status', 'field' => array('type' => 'select', 'name' => 'status', 'value' => $quote['status'], 'blank' => false, 'options' => module_quote::get_statuses(), 'allow_new' => true)), 'date_create' => array('title' => 'Create Date', 'field' => array('type' => 'date', 'name' => 'date_create', 'value' => print_date($quote['date_create']), 'help' => 'This is the date the Quote is scheduled to start work. This can be a date in the future.')), 'date_approved' => array('title' => 'Approved Date', 'field' => array('type' => 'date', 'name' => 'date_approved', 'value' => print_date($quote['date_approved']), 'help' => 'This is the date the Quote was accepted by the client. This date is automatically set if the client clicks "Approve"')), 'approved_by' => array('title' => 'Approved By', 'field' => array('type' => 'text', 'name' => 'approved_by', 'value' => $quote['approved_by']))), 'extra_settings' => array('owner_table' => 'quote', 'owner_key' => 'quote_id', 'owner_id' => $quote['quote_id'], 'layout' => 'table_row', 'allow_new' => module_quote::can_i('create', 'Quotes'), 'allow_edit' => module_quote::can_i('create', 'Quotes')));
if (module_config::c('quote_allow_staff_assignment', 1)) {
    $fieldset_data['elements']['user_id'] = array('title' => 'Staff Member', 'field' => array('type' => 'select', 'options' => $staff_member_rel, 'name' => 'user_id', 'value' => $quote['user_id'], 'help' => 'Assign a staff member to this quote. You can also assign individual tasks to different staff members. Staff members are users who have EDIT permissions on Quote Tasks.'));
}
$incrementing = false;
if (!isset($quote['taxes']) || !count($quote['taxes'])) {
    $quote['taxes'][] = array();
    // at least have 1?
}
foreach ($quote['taxes'] as $tax) {
    if (isset($tax['increment']) && $tax['increment']) {
        $incrementing = true;
    }
}
ob_start();
?>