Ejemplo n.º 1
0
$file_id = (int) $file['file_id'];
// sanatisation/permission check
module_template::init_template('file_approval_email', 'Dear {CUSTOMER_NAME},<br>
<br>
This email is regarding your file <strong>{FILE_NAME}</strong>{if:JOB_LINK} related to the job <a href="{JOB_LINK}">{JOB_NAME}</a>{endif:JOB_LINK}.<br><br>
Please view this file and comments online by <a href="{FILE_URL}">clicking here</a>.<br><br>
Thank you,<br><br>
{FROM_NAME}
', 'File for Approval: {FILE_NAME}', array('CUSTOMER_NAME' => 'Customers Name', 'FILE_NAME' => 'File Name', 'JOB_NAME' => 'Job Name', 'FROM_NAME' => 'Your name', 'FILE_URL' => 'Link to file for customer'));
// template for sending emails.
// are we sending the paid one? or the dueone.
//$template_name = 'file_email';
$template_name = isset($_REQUEST['template_name']) ? $_REQUEST['template_name'] : 'file_approval_email';
$template = module_template::get_template_by_key($template_name);
$file['from_name'] = module_security::get_loggedin_name();
$file['file_url'] = module_file::link_public($file_id);
if (class_exists('module_job', false) && $file['job_id']) {
    $job_data = module_job::get_job($file['job_id'], false);
    $file['job_name'] = htmlspecialchars($job_data['name']);
    $file['job_link'] = module_job::link_public($file['job_id']);
} else {
    $file['job_name'] = _l('N/A');
    $file['job_link'] = '';
}
// find available "to" recipients.
// customer contacts.
$to_select = false;
if ($file['customer_id']) {
    $customer = module_customer::get_customer($file['customer_id']);
    $file['customer_name'] = $customer['customer_name'];
    $to = module_user::get_contacts(array('customer_id' => $file['customer_id']));
Ejemplo n.º 2
0
        $file['staff_ids'] = array(false);
        if (count($staff_member_rel) == 1) {
            $file['staff_ids'] = array(key($staff_member_rel));
        }
    }
    $fieldset_data['elements'][] = array('title' => 'Staff', 'fields' => array(array('type' => 'hidden', 'name' => 'staff_ids_save', 'value' => 1), '<div id="staff_ids_holder" style="float:left;">', array('type' => 'select', 'name' => 'staff_ids[]', 'options' => $staff_member_rel, 'multiple' => 'staff_ids_holder', 'values' => $file['staff_ids']), '</div>', function () use(&$file) {
        if ($file['quote_id']) {
            echo ' ';
            echo '<a href="' . module_quote::link_open($file['quote_id'], false) . '">' . _l('Open Quote &raquo;') . '</a>';
        }
    }, array('type' => 'html', 'value' => '', 'help' => 'Assign a staff member to this file. Staff members are users who have EDIT permissions on Job Tasks. Click the plus sign to add more staff members. You can apply the "Only Assigned Staff" permission in User Role settings to restrict staff members to these files.<br><br>If there are assigned staff members then those members will be the only ones to receive notifications when a change is made to the file. If no staff are assigned to this file then anyone with the "Receive Alerts" permission will receive file change/comment alerts.')));
    $fieldset_data['elements'][] = array('title' => 'Approval', 'fields' => array(function () use(&$file, $file_id) {
        if (isset($file['approved_time'])) {
            switch ($file['approved_time']) {
                case -1:
                    _e('File is waiting for approval. Please <a href="%s" target="_blank">click here</a> for options.', module_file::link_public($file_id));
                    break;
                case 0:
                    _e('File has not been sent for approval.');
                    break;
                default:
                    _e('File was approved at %s by %s', print_date($file['approved_time'], true), htmlspecialchars($file['approved_by']));
            }
        }
    }));
}
echo module_form::generate_fieldset($fieldset_data);
unset($fieldset_data);
hook_handle_callback('layout_column_half', 2);
$fieldset_data = array('heading' => array('title' => _l('File Description'), 'type' => 'h3'), 'elements' => array(array('field' => array('type' => 'wysiwyg', 'name' => 'description', 'value' => $file['description']))));
echo module_form::generate_fieldset($fieldset_data);