本文整理汇总了PHP中CFile::GetInfoById方法的典型用法代码示例。如果您正苦于以下问题:PHP CFile::GetInfoById方法的具体用法?PHP CFile::GetInfoById怎么用?PHP CFile::GetInfoById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFile
的用法示例。
在下文中一共展示了CFile::GetInfoById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateFactura
/**
* Обновить файл счет-фактуры.
*
* @param type $invoice_id
* @param type $file
*/
public function updateFactura($invoice_id, $uploaded_file)
{
if (!$uploaded_file || !is_array($uploaded_file) || !$uploaded_file['size']) {
return false;
}
$data = $this->getInvoice($invoice_id);
if (!$data) {
return false;
}
$old_file = new CFile();
$old_file->table = self::$_TABLE_FILE;
$old_file->GetInfoById($data['file_factura_id']);
$file = new CFile($uploaded_file);
$file->table = self::$_TABLE_FILE;
$file->src_id = $old_file->src_id;
$file->original_name = $old_file->original_name;
$file->server_root = 1;
$file->MoveUploadedFile($old_file->path);
$old_file->Delete($data['file_factura_id']);
$this->update($invoice_id, array('file_factura_id' => $file->id));
return true;
}
示例2: DeleteEditFile
function DeleteEditFile($id)
{
$objResponse = new xajaxResponse();
if (hasPermissions('docs')) {
if ($id == 0) {
$objResponse->script('$("file_' . $id . '").destroy();');
return $objResponse;
} else {
$objResponse->script('$("attach_files_' . $id . '").destroy();');
$objResponse->script('$("file_' . $id . '").destroy();');
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/CFile.php';
$tmp = new CFile();
$tmp->GetInfoById($id);
$tmp->Delete($id);
}
}
return $objResponse;
}
示例3: updateDocument
//.........这里部分代码省略.........
$data['letters_doc_frm_user2_status_date_data'] = null;
}
if (!$data['letters_doc_frm_user1_status_date_data']) {
$data['letters_doc_frm_user1_status_date_data'] = null;
}
if (!$data['letters_doc_frm_user3_status_data']) {
$data['letters_doc_frm_user3_status_data'] = null;
}
if (!$data['letters_doc_frm_user2_status_data']) {
$data['letters_doc_frm_user2_status_data'] = null;
}
if (!$data['letters_doc_frm_user1_status_data']) {
$data['letters_doc_frm_user1_status_data'] = null;
}
if (!$data['letters_doc_frm_parent_db_id'] || $data['letters_doc_frm_parent_db_id'] == 'null') {
$data['letters_doc_frm_parent_db_id'] = null;
}
if (!$data['letters_doc_frm_group'] || $data['letters_doc_frm_group'] == 'null') {
$data['letters_doc_frm_group'] = null;
}
if (!$data['letters_doc_frm_group_db_id'] || $data['letters_doc_frm_group_db_id'] == 'null') {
$data['letters_doc_frm_group_db_id'] = null;
}
if (!$data['letters_doc_frm_group_db_id'] && !empty($data['letters_doc_frm_group'])) {
$data['letters_doc_frm_group_db_id'] = letters::checkCreateGroup($data['letters_doc_frm_group']);
}
if ($data['letters_doc_frm_user_1_section'] == '1') {
$data['letters_doc_frm_user_1_section'] = true;
} else {
$data['letters_doc_frm_user_1_section'] = false;
}
if ($data['letters_doc_frm_user_2_section'] == '1') {
$data['letters_doc_frm_user_2_section'] = true;
} else {
$data['letters_doc_frm_user_2_section'] = false;
}
if ($data['letters_doc_frm_user_3_section'] == '1') {
$data['letters_doc_frm_user_3_section'] = true;
} else {
$data['letters_doc_frm_user_3_section'] = false;
}
if ($data['letters_doc_frm_withoutourdoc'] == '1') {
$data['letters_doc_frm_withoutourdoc'] = true;
} else {
$data['letters_doc_frm_withoutourdoc'] = false;
}
$doc = self::getDocument($id);
$doc_data['title'] = $data['letters_doc_frm_title'];
$doc_data['user_1'] = $data['letters_doc_frm_user_1_db_id'];
$doc_data['user_2'] = $data['letters_doc_frm_user_2_db_id'];
$doc_data['user_3'] = $data['letters_doc_frm_user_3_db_id'];
$doc_data['group_id'] = $data['letters_doc_frm_group_db_id'];
$doc_data['parent'] = $data['letters_doc_frm_parent_db_id'];
$doc_data['user_status_1'] = $data['letters_doc_frm_user1_status_data'];
$doc_data['user_status_2'] = $data['letters_doc_frm_user2_status_data'];
$doc_data['user_status_3'] = $data['letters_doc_frm_user3_status_data'];
$doc_data['user_status_date_1'] = $data['letters_doc_frm_user1_status_date_data'];
$doc_data['user_status_date_2'] = $data['letters_doc_frm_user2_status_date_data'];
$doc_data['user_status_date_3'] = $data['letters_doc_frm_user3_status_date_data'];
$doc_data['is_user_1_company'] = $data['letters_doc_frm_user_1_section'] ? 't' : 'f';
$doc_data['is_user_2_company'] = $data['letters_doc_frm_user_2_section'] ? 't' : 'f';
$doc_data['is_user_3_company'] = $data['letters_doc_frm_user_3_section'] ? 't' : 'f';
$doc_data['withoutourdoc'] = $data['withoutourdoc'] ? 't' : 'f';
if (isset($data['letters_doc_frm_comment']) && $data['letters_doc_frm_comment']) {
$doc_data['comment'] = $data['letters_doc_frm_comment'];
} else {
$data['letters_doc_frm_comment'] = $doc['comment'];
}
if ($doc_data['user_status_1'] != $doc['user_status_1'] || $doc_data['user_status_2'] != $doc['user_status_2'] || $doc_data['user_status_3'] != $doc['user_status_3']) {
letters::updateDateStatusChange($id);
}
letters::saveHistory($id, $doc_data);
$sql = "UPDATE letters SET\n date_add = " . ($data['letters_doc_frm_dateadd_eng_format'] ? "'{$data['letters_doc_frm_dateadd_eng_format']}'" : "NOW()") . ",\n title = ?,\n user_1 = ?,\n user_2 = ?,\n user_3 = ?,\n group_id = ?,\n parent = ?,\n user_status_1 = ?, \n user_status_2 = ?, \n user_status_3 = ?, \n user_status_date_1 = ?, \n user_status_date_2 = ?, \n user_status_date_3 = ?,\n is_user_1_company = ?, \n is_user_2_company = ?, \n is_user_3_company = ?, \n withoutourdoc = ?,\n comment = ?\n WHERE id = ?i;";
$DB->query($sql, $data['letters_doc_frm_title'], $data['letters_doc_frm_user_1_db_id'], $data['letters_doc_frm_user_2_db_id'], $data['letters_doc_frm_user_3_db_id'], $data['letters_doc_frm_group_db_id'], $data['letters_doc_frm_parent_db_id'], $data['letters_doc_frm_user1_status_data'], $data['letters_doc_frm_user2_status_data'], $data['letters_doc_frm_user3_status_data'], $data['letters_doc_frm_user1_status_date_data'], $data['letters_doc_frm_user2_status_date_data'], $data['letters_doc_frm_user3_status_date_data'], $data['letters_doc_frm_user_1_section'], $data['letters_doc_frm_user_2_section'], $data['letters_doc_frm_user_3_section'], $data['letters_doc_frm_withoutourdoc'], $data['letters_doc_frm_comment'], $id);
$sql = "UPDATE letters SET is_out=false WHERE (user_status_1 IS DISTINCT FROM 1 AND user_status_2 IS DISTINCT FROM 1 AND user_status_3 IS DISTINCT FROM 1) AND id=?i";
$DB->query($sql, $id);
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/attachedfiles.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/CFile.php";
$attachedfiles = new attachedfiles($data['attachedfiles_session']);
$attachedfiles_files = $attachedfiles->getFiles();
if ($attachedfiles_files) {
foreach ($attachedfiles_files as $attachedfiles_file) {
$cFile = new CFile();
$cFile->table = 'file';
$cFile->GetInfoById($attachedfiles_file['id']);
if ($cFile->id != $doc['file_id']) {
$ext = $cFile->getext();
$tmp_dir = "letters/";
$tmp_name = $cFile->secure_tmpname($tmp_dir, '.' . $ext);
$tmp_name = substr_replace($tmp_name, "", 0, strlen($tmp_dir));
$cFile->_remoteCopy($tmp_dir . $tmp_name, true);
$sql = "UPDATE letters SET file_id = ?i WHERE id = ?i";
$DB->query($sql, $cFile->id, intval($id));
$cFile->delete($doc['file_id']);
}
}
}
$attachedfiles->clear();
return $id;
}
示例4: array
if ($rf == $interview['main_foto']) {
$files->Delete(0, $interview['path'], 'sm_' . $interview['fname']);
$result['main_photo'] = array();
}
}
}
}
if (!isset($alert)) {
$result['success'] = true;
$int_files = $int->getInterviewFiles($id);
$result['attaches'] = $int_files;
$result['id'] = $id;
$result['WDCPREFIX'] = WDCPREFIX;
$result['user'] = array('id' => $user->uid, 'login' => $user->login, 'fullname' => iconv('CP1251', 'UTF-8', $user->uname . ' ' . $user->usurname));
if ($attached['main']) {
$files->GetInfoById($attached['main']);
$result['main_photo'] = array('id' => $files->id, 'path' => $files->path, 'fname' => $files->name);
}
$result['page_view'] = __paramInit('string', null, 'page_view');
if ($result['page_view']) {
$int_text = $txt;
$s = array();
$r = array();
if ($int_files) {
foreach ($int_files as $int_file) {
$url = WDCPREFIX . '/' . $int_file['path'] . $int_file['fname'];
$s[] = '<img id="' . $int_file['id'] . '">';
$r[] = "<img id=\"{$int_file['id']}\" src=\"{$url}\">";
}
}
if (count($s) && count($r)) {
示例5: foreach
$tmp->server_root = true;
$tmp->MoveUploadedFile('/docs/');
$files_attache[] = $tmp;
if ($tmp->error && !$tmp->id) {
$error_add_file = $tmp->error;
$error = true;
}
}
}
}
if (count($_POST['attach_files_id']) > 0) {
foreach ($_POST['attach_files_id'] as $key => $value) {
$tmp = new CFile();
$tmp->max_size = 10485760;
$tmp->server_root = true;
$tmp->GetInfoById($value);
$files_attache[] = $tmp;
}
}
switch ($_POST['action_form']) {
case 'add':
if (count($files_attache) == 0) {
$error_add_file = 'Необходимо загрузить хотя бы один файл';
$error = true;
}
if ($error !== false) {
$docs = docs::getDocs();
$sections = docs_sections::getSections();
} else {
$docs_id = docs::Add($_POST['name'], $_POST['desc'], intval($_POST['section']));
if ($docs_id) {