本文整理汇总了PHP中uploader::setStatusFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP uploader::setStatusFiles方法的具体用法?PHP uploader::setStatusFiles怎么用?PHP uploader::setStatusFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uploader
的用法示例。
在下文中一共展示了uploader::setStatusFiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SaveProjectNew
//.........这里部分代码省略.........
$prj['name'] = '';
}
if ($prj['descr'] === false) {
$prj['descr'] = '';
}
if (!$prj['end_date']) {
$prj['end_date'] = NULL;
}
if (!$prj['win_date']) {
$prj['win_date'] = NULL;
}
$prj['budget_type'] = intval($prj['budget_type']);
if (!intval($prj['draft_prj_id'])) {
$prj['prj_id'] = NULL;
} else {
$prj['prj_id'] = $prj['draft_prj_id'];
}
$prj['draft_id'] = intval($prj['draft_id']);
if (!isset($prj['kind'])) {
$prj['kind'] = 7;
}
$prj['cost'] = $prj['agreement'] ? 0 : floatval($prj['cost']);
$date = date("Y-m-d H:i:s");
$prj['strong_top'] = hasPermissions('projects') ? (int) $prj['strong_top'] : 0;
$prj['verify_only'] = (bool) $prj['verify_only'];
// платные опции
$prj['urgent'] = (bool) $prj['urgent'];
$prj['hide'] = (bool) $prj['hide'];
$topDays = $prj['top_ok'] ? $prj['top_days'] : 0;
if ($prj['logo_ok']) {
$logoAttach = new attachedfiles($prj['logo_attachedfiles_session']);
$logoFiles = $logoAttach->getFiles();
if (is_array($logoFiles) && count($logoFiles)) {
$logoFile = array_pop($logoFiles);
// файлов может быть несколько, берем последний
$logoAttach->setStatusTo3($logoFile['id']);
$logoFileID = $logoFile['id'];
} elseif ($prj['logo_file_id']) {
$logoFileID = $prj['logo_file_id'];
}
$logoLink = $prj['link'];
}
if (self::isDraftExists($prj['draft_id'], $prj['uid'], 1, $prj['prj_id'])) {
$sql = "UPDATE draft_projects SET \n name = ?u,\n descr = ?u,\n cost = ?,\n currency = ?i,\n kind = ?i,\n pro_only = ?,\n strong_top = ?i,\n end_date = ?,\n win_date = ?,\n country = ?i,\n city = ?i,\n categories = ?,\n date = ?,\n prj_id = ?,\n priceby = ?i,\n prefer_sbr = ?,\n budget_type = ?i,\n verify_only = ?,\n urgent = ?,\n hide = ?,\n top_days = ?i,\n logo_id = ?,\n logo_link = ?,\n contacts = ?\n WHERE (id=? OR prj_id=?)AND uid=?i";
$DB->query($sql, $prj['name'], $prj['descr'], $prj['cost'], $prj['currency_db_id'], $prj['kind'], $prj['pro_only'] == 1 ? 't' : 'f', $prj['strong_top'], $prj['end_date'], $prj['win_date'], (int) $prj['project_location_columns'][0], (int) $prj['project_location_columns'][1], $categories, $date, $prj['prj_id'], intval($prj['priceby_db_id']), $prj['prefer_sbr'] == 1 ? 't' : 'f', $prj['budget_type'], $prj['verify_only'], $prj['urgent'], $prj['hide'], $topDays, $logoFileID, $logoLink, $prj['contacts'], $prj['draft_id'], $prj['prj_id'], $prj['uid']);
$id = $prj['draft_id'];
} else {
$new_draft = true;
$sql = "INSERT INTO draft_projects (\n name,\n descr,\n cost,\n currency,\n kind,\n pro_only,\n end_date,\n win_date,\n country,\n city,\n categories,\n date,\n uid,\n prj_id,\n priceby,\n prefer_sbr,\n budget_type,\n strong_top,\n verify_only,\n urgent,\n hide, \n top_days,\n logo_id,\n logo_link,\n contacts\n ) VALUES (\n ?u,\n ?u,\n ?,\n ?i,\n ?i,\n ?,\n ?,\n ?,\n ?i,\n ?i,\n ?,\n ?,\n ?i,\n ?,\n ?i,\n ?,\n ?i,\n ?i,\n ?,\n ?,\n ?,\n ?i,\n ?,\n ?,\n ?\n ) RETURNING id;";
$id = $DB->val($sql, $prj['name'], $prj['descr'], $prj['cost'], $prj['currency_db_id'], $prj['kind'], $prj['pro_only'] == 1 ? 't' : 'f', $prj['end_date'], $prj['win_date'], (int) $prj['project_location_columns'][0], (int) $prj['project_location_columns'][1], $categories, $date, $prj['uid'], $prj['prj_id'], intval($prj['priceby_db_id']), $prj['prefer_sbr'] == 1 ? 't' : 'f', $prj['budget_type'], (int) $prj['strong_top'], $prj['verify_only'], $prj['urgent'], $prj['hide'], $topDays, $logoFileID, $logoLink, $prj['contacts']);
}
// - BEGIN атачи
if (!$attachedfiles_files) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes//uploader/uploader.php";
$mask_files = array(1, 3);
$uploader = new uploader(current($prj['IDResource']));
$attachedfiles_files = $uploader->getFiles($mask_files);
}
$file_id = array();
// массив с ID файлов которые не надо удалять
$noDeletedFiles = array();
foreach ($attachedfiles_files as $attachedfiles_file) {
$noDeletedFiles[] = $attachedfiles_file['id'];
// старые файлы не трогаем
if ($attachedfiles_file['status'] == 3) {
continue;
}
if (in_array($f->id, $file_id)) {
continue;
}
// Чтобы не было дублей
$file_id[] = $f->id;
$f = new CFile($attachedfiles_file['id']);
$f->table = 'file';
$f->makeLink();
$sql = "INSERT INTO draft_attaches(draft_id, draft_type, file_id) VALUES(?i, 4, ?i)";
$DB->hold()->query($sql, $id, $f->id);
}
if ($DB->sqls) {
$DB->query();
}
if ($uploader && $attachedfiles_files) {
$uploader->setStatusFiles(uploader::STATUS_CREATE, uploader::STATUS_ADDED);
}
$sqlNoDeletedFiles = count($noDeletedFiles) ? $DB->parse('AND file_id NOT IN (?l)', $noDeletedFiles) : '';
$sql = "SELECT * FROM draft_attaches WHERE draft_id = ?i AND draft_type = 4 {$sqlNoDeletedFiles};";
$files = $DB->rows($sql, $id, $noDeletedFiles);
if ($files) {
foreach ($files as $f) {
$cf = new CFile($f['file_id']);
$cf->table = 'file';
$cf->Delete($cf->id);
}
}
$sql = "DELETE FROM draft_attaches WHERE draft_id = ?i AND draft_type = 4 {$sqlNoDeletedFiles};";
$DB->query($sql, $id, array());
// - END атачи
$_SESSION['drafts_count'] = drafts::getCount($msg['uid']);
return array('id' => $id, 'date' => $date);
}