Ejemplo n.º 1
0
<form action="" method="post">
	<input type="hidden" name="_process" value="save_file" class="no_permissions" />
    <input type="hidden" name="file_id" value="<?php 
echo $file_id;
?>
" class="no_permissions" />
    <input type="hidden" name="bucket" value="1" class="no_permissions" />

    <?php 
$fields = array('fields' => array('url' => 'Name'));
module_form::set_required($fields);
module_form::prevent_exit(array('valid_exits' => array('.submit_button')));
hook_handle_callback('layout_column_half', 1);
$fieldset_data = array('heading' => array('type' => 'h3', 'title' => 'File Bucket Details'), 'class' => 'tableclass tableclass_form tableclass_full file_drop', 'elements' => array(), 'extra_settings' => array('owner_table' => 'file', 'owner_key' => 'file_id', 'owner_id' => $file_id, 'layout' => 'table_row', 'allow_new' => module_file::can_i('create', 'Files'), 'allow_edit' => module_file::can_i('create', 'Files')));
$fieldset_data['elements'][] = array('title' => 'Bucket Name', 'field' => array('type' => 'text', 'name' => 'file_name', 'value' => $file['file_name'], 'help' => 'A File Bucket is a collection of files. The customer can easily upload files to this bucket.'));
$fieldset_data['elements'][] = array('title' => 'Status', 'field' => array('type' => 'select', 'name' => 'status', 'value' => $file['status'], 'options' => module_file::get_statuses(), 'allow_new' => true));
if (class_exists('module_customer', false)) {
    $c = array();
    $res = module_customer::get_customers();
    foreach ($res as $row) {
        $c[$row['customer_id']] = $row['customer_name'];
    }
    if ($file['customer_id'] && !isset($c[$file['customer_id']])) {
        // this file is related to another job. from another customer.
        $related_customer = module_customer::get_customer($file['customer_id'], true);
        $c[$file['customer_id']] = $related_customer['customer_name'];
    }
    $fieldset_data['elements'][] = array('title' => 'Customer', 'field' => array('type' => 'select', 'name' => 'customer_id', 'value' => $file['customer_id'], 'options' => $c));
}
if (class_exists('module_job', false) && class_exists('module_customer', false)) {
    $c = array();