</td> <td> <input type="text" name="search[generic]" value="<?php echo isset($search['generic']) ? htmlspecialchars($search['generic']) : ''; ?> " size="30"> </td> <td width="30"> <?php _e('Status:'); ?> </td> <td> <?php echo print_select_box(module_website::get_statuses(), 'search[status]', isset($search['status']) ? $search['status'] : ''); ?> </td> <td class="search_action"> <?php echo create_link("Reset", "reset", module_website::link_open(false)); ?> <?php echo create_link("Search", "submit"); ?> </td> </tr> </table>
" /> <?php $fields = array('fields' => array('name' => 'Name')); module_form::set_required($fields); module_form::prevent_exit(array('valid_exits' => array('.submit_button', '.form_save'))); hook_handle_callback('layout_column_half', 1, '35'); $fieldset_data = array('heading' => array('type' => 'h3', 'title' => _l(module_config::c('project_name_single', 'Website') . ' Details')), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array('name' => array('title' => _l('Name'), 'field' => array('type' => 'text', 'name' => 'name', 'value' => $website['name']))), 'extra_settings' => array('owner_table' => 'website', 'owner_key' => 'website_id', 'owner_id' => $website['website_id'], 'layout' => 'table_row', 'allow_new' => module_website::can_i('create', 'Websites'), 'allow_edit' => module_website::can_i('create', 'Websites'))); if (module_config::c('project_display_url', 1)) { if (!isset($website['url']) || !strlen($website['url'])) { $website['url'] = module_config::c('project_default_url', 'http://'); } $fieldset_data['elements']['url'] = array('title' => _l('URL'), 'fields' => array(array('type' => 'text', 'name' => 'url', 'value' => $website['url'], 'style' => 'width:200px;'), $website['url'] ? ' <a href="' . module_website::urlify($website['url']) . '" target="_blank">' . _l('open »') . '</a>' : '')); } $fieldset_data['elements']['Status'] = array('title' => _l('Status'), 'fields' => array(array('type' => 'select', 'name' => 'status', 'value' => $website['status'], 'options' => module_website::get_statuses(), 'allow_new' => true))); echo module_form::generate_fieldset($fieldset_data); /*** ADVANCED ****/ if (module_website::can_i('edit', 'Websites')) { $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);
$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(); $columns = array(); $columns['website_name'] = array('title' => 'Name', 'callback' => function ($website) { echo module_website::link_open($website['website_id'], true, $website); }, 'cell_class' => 'row_action'); if (module_config::c('project_display_url', 1)) { $columns['website_url'] = array('title' => 'URL', 'callback' => function ($website) { if (strlen(trim($website['url'])) > 0) { ?> <a href="<?php echo module_website::urlify($website['url']); ?>