public function delete() { if ($this->file_id && module_file::can_i('delete', 'Files')) { $file_data = $this->get_data(); if ($this->can_i_access()) { // delete any sub files of buckets first. // todo: recurisive testing. if ($file_data['bucket']) { $sub_files = module_file::get_files(array('bucket_parent_file_id' => $file_data['file_id'])); foreach ($sub_files as $sub_file) { if ($sub_file['file_id'] && $sub_file['bucket_parent_file_id'] == $this->file_id) { $sub_file_ucm = new ucm_file($sub_file['file_id']); $sub_file_ucm->delete(); } } } // delete the physical file. if ($file_data['file_path'] && is_file($file_data['file_path'])) { unlink($file_data['file_path']); } // delete the db entry. delete_from_db('file', 'file_id', $this->file_id); // delete any comments. delete_from_db('file_comment', 'file_id', $this->file_id); // delete any staff rel. delete_from_db('file_user_rel', 'file_id', $this->file_id); // delete any notifications delete_from_db('file_notification', 'file_id', $this->file_id); } } }
}); } if (class_exists('module_job', false)) { $columns['file_job'] = array('title' => 'Job', 'callback' => function ($file) { echo module_job::link_open($file['job_id'], true); }); } if (class_exists('module_quote', false) && module_quote::is_plugin_enabled()) { $columns['file_quote'] = array('title' => 'Quote', 'callback' => function ($file) { echo module_quote::link_open($file['quote_id'], true); }); } $columns['file_date_added'] = array('title' => 'Date Added', 'callback' => function ($file) { echo _l('%s by %s', print_date($file['date_created']), module_user::link_open($file['create_user_id'], true)); }); if (module_file::can_i('edit', 'Files')) { $columns['file_action'] = array('title' => ' ', 'callback' => function ($file) { echo '<input type="checkbox" name="bulk_operation[' . $file['file_id'] . ']" value="yes">'; }); } if (class_exists('module_extra', false)) { $table_manager->display_extra('file', function ($file) { module_extra::print_table_data('file', $file['file_id']); }); } $table_manager->set_columns($columns); $table_manager->row_callback = function ($row_data) { // load the full file data before displaying each row so we have access to more details if (isset($row_data['file_id']) && (int) $row_data['file_id'] > 0) { // not needed in this case //return module_file::get_file($row_data['file_id']);
<?php /** * Copyright: dtbaker 2012 * Licence: Please check CodeCanyon.net for licence details. * More licence clarification available here: http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca * Package Date: 2015-11-25 02:55:20 * IP Address: 67.79.165.254 */ if (!$file_safe) { die('wrong page'); } if (!module_file::can_i('edit', 'File Approval')) { die('no perms'); } $ucm_file = new ucm_file($file_id); $ucm_file->check_page_permissions(); $file = $ucm_file->get_data(); $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.
?> <div style="border-top:1px dashed #CCCCCC; padding:3px; margin:3px 0;"> <?php echo $note_text; ?> <div style="font-size:10px; text-align:right; color:#CCCCCC;">From <?php echo $item['create_user_id'] ? module_user::link_open($item['create_user_id'], true) : _l('Customer'); ?> on <?php echo print_date($item['date_created'], true); ?> <?php if (module_file::can_i('delete', 'File Comments') || $item['create_user_id'] == module_security::get_loggedin_id()) { ?> <a href="#" onclick="if(confirm('<?php echo _l('Really remove this comment?'); ?> ')){$('#delete_file_comment_id').val('<?php echo $item['file_comment_id']; ?> '); $('#butt_save_note').click(); } return false;" style="color:#FF0000">x</a> <?php } ?> </div> </div>
?> </th> <td> <?php echo print_select_box(get_multiple('currency', '', 'currency_id'), 'currency_id', $job['currency_id'], '', false, 'code'); ?> </td> </tr> <?php } ?> <?php if ((int) $job_id > 0 && $job['job_id'] && class_exists('module_file', false) && module_file::can_i('view', 'Files')) { ?> <tr> <th> <?php echo _l('Files'); ?> </th> <td> <?php $files = module_file::get_files(array('job_id' => $job['job_id']), true); if (count($files) > 0) { ?>