本文整理汇总了PHP中fileupload::deleteFile方法的典型用法代码示例。如果您正苦于以下问题:PHP fileupload::deleteFile方法的具体用法?PHP fileupload::deleteFile怎么用?PHP fileupload::deleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fileupload
的用法示例。
在下文中一共展示了fileupload::deleteFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$tpl = new template();
if (isset($_GET['id'])) {
$id = (int) $_GET['id'];
$project = $this->getProject($id);
$helper = new helper();
$language = new language();
$language->setModule('projects');
$lang = $language->readIni();
//Calculate projectdetails
$opentickets = $this->getOpenTickets($id);
$closedTickets = $project['numberOfTickets'] - $opentickets['openTickets'];
if ($project['numberOfTickets'] != 0) {
$projectPercentage = round($closedTickets / $project['numberOfTickets'] * 100, 2);
} else {
$projectPercentage = 0;
}
if ($project['numberOfTickets'] == NULL) {
$project['numberOfTickets'] = 1;
}
//Post comment
$comments = new comments();
if (isset($_POST['comment']) === true) {
$values = array('text' => $_POST['text'], 'datetime' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
$comments->addComment($values, 'project');
$tpl->setNotification('COMMENT_ADDED', 'success');
}
$file = new files();
if (isset($_POST['upload'])) {
if (isset($_FILES['file'])) {
$file->upload($_FILES, 'project', $id);
$tpl->setNotification('FILE_UPLOADED', 'success');
} else {
$tpl->setNotification('NO_FILE', 'error');
}
}
$timesheets = new timesheets();
$language = new language();
$language->setModule('projects');
$lang = $language->readIni();
$data = array();
$months = array();
$results = $timesheets->getProjectHours($id);
$allHours = 0;
$max = 0;
foreach ($results as $row) {
if ($row['month'] != NULL) {
$data[] = (int) $row['summe'];
$months[] = substr($language->lang_echo('MONTH_' . $row['month'] . ''), 0, 3);
if ($row['summe'] > $max) {
$max = $row['summe'];
}
} else {
$allHours = $row['summe'];
}
}
$steps = 10;
if ($max > 100) {
$steps = 50;
}
$max = $max + $steps;
$tpl->assign('timesheetsAllHours', $allHours);
$chart = "";
$tpl->assign('chart', $chart);
//Delete File
if (isset($_GET['delFile']) === true) {
$file = $_GET['delFile'];
$upload = new fileupload();
$upload->initFile($file);
$upload->deleteFile($file);
$this->deleteFile($file);
$this->setNotification('FILE_DELETED', 'success');
}
//Delete comment
if (isset($_GET['delComment']) === true) {
$commentId = (int) $_GET['delComment'];
$this->deleteComment($commentId);
$this->setNotification('COMMENT_DELETED');
}
//Delete account
if (isset($_GET['delAccount']) === true) {
$accountId = (int) $_GET['delAccount'];
$this->deleteAccount($accountId);
$this->setNotification('ACCOUNT_DELETED');
}
//Timesheets
$invEmplCheck = '0';
$invCompCheck = '0';
$projectFilter = $id;
$dateFrom = mktime(0, 0, 0, date("m"), '1', date("Y"));
$dateFrom = date("Y-m-d", $dateFrom);
$dateTo = date("Y-m-d 00:00:00");
$kind = 'all';
//.........这里部分代码省略.........
示例2: deleteAllFiles
/**
* deleteAllFiles - delete the whole list and the files on the server
*
* @access public
* @param $id
*
*/
public function deleteAllFiles($id)
{
$upload = new fileupload();
$query1 = "SELECT encName FROM zp_ticketFiles WHERE ticketId = '" . $id . "'";
foreach ($this->db->dbQuery($query1)->dbFetchResults() as $row) {
$upload->deleteFile($row['encName']);
}
}
示例3: run
/**
* run - display template and edit data
*
* @access public
*
*/
public function run()
{
$tpl = new template();
$msgKey = '';
if (isset($_GET['id']) === true) {
$id = (int) $_GET['id'];
$ticket = $this->getTicket($id);
$editable = true;
if (!empty($ticket)) {
$helper = new helper();
$file = new files();
$user = new users();
$comment = new comments();
// Has the user seen this ticket already
$read = new read();
if (!$read->isRead('ticket', $id, $_SESSION['userdata']['id'])) {
$read->markAsRead('ticket', $id, $_SESSION['userdata']['id']);
}
//TODO New access right management...This is dumb
if ($ticket['userId'] == $_SESSION['userdata']['id'] || $ticket['editorId'] == $_SESSION['userdata']['id'] || $ticket['editorId'] == '') {
$editable = true;
}
//Punch times
if (isset($_POST['punchIn']) && $this->isClocked($_SESSION['userdata']['id']) != true) {
$this->punchIn($ticket['id']);
} else {
if (isset($_POST['punchOut']) && $this->isClocked($_SESSION['userdata']['id']) == true) {
$this->punchOut($ticket['id']);
}
}
//Upload File
if (isset($_POST['upload'])) {
if (isset($_FILES['file'])) {
if ($file->upload($_FILES, 'ticket', $id) !== false) {
$tpl->setNotification('FILE_UPLOADED', 'success');
} else {
$tpl->setNotification('ERROR_WHILE_UPLOADING', 'error');
}
} else {
$tpl->setNotification('NO_FILE', 'error');
}
}
//Add comment
if (isset($_POST['comment']) === true) {
$mail = new mailer();
$values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
$comment->addComment($values, 'ticket');
$tpl->setNotification('COMMENT_ADDED', 'success');
}
//Only admins
if ($_SESSION['userdata']['role'] == 'admin') {
$editable = true;
//Delete file
if (isset($_GET['delFile']) === true) {
$file = $_GET['delFile'];
$upload = new fileupload();
$upload->initFile($file);
//Delete file from server
$upload->deleteFile($file);
//Delete file from db
$this->deleteFile($file);
$msgKey = 'FILE_DELETED';
}
//Delete comment
if (isset($_GET['delComment']) === true) {
$commentId = (int) $_GET['delComment'];
$comment->deleteComment($commentId);
$msgKey = 'COMMENT_DELETED';
}
}
$allHours = 0;
$values = array('userId' => $_SESSION['userdata']['id'], 'ticket' => $id, 'date' => '', 'kind' => '', 'hours' => '', 'description' => '', 'invoicedEmpl' => '', 'invoicedComp' => '', 'invoicedEmplDate' => '', 'invoicedCompDate' => '');
$timesheets = new timesheets();
$ticketHours = $timesheets->getTicketHours($id);
$tpl->assign('ticketHours', $ticketHours);
$tpl->assign('userHours', $timesheets->getUsersTicketHours($id, $_SESSION['userdata']['id']));
$userinfo = $user->getUser($values['userId']);
$tpl->assign('kind', $timesheets->kind);
$tpl->assign('userInfo', $userinfo);
if (isset($_POST['saveTimes']) === true) {
if (isset($_POST['kind']) && $_POST['kind'] != '') {
$values['kind'] = $_POST['kind'];
}
if (isset($_POST['date']) && $_POST['date'] != '') {
$date = $helper->date2timestamp($_POST['date']);
//die($date);
//$values['date'] = ($helper->timestamp2date($date, 4));
$values['date'] = $date;
}
$values['rate'] = $userinfo['wage'];
if (isset($_POST['hours']) && $_POST['hours'] != '') {
$values['hours'] = $_POST['hours'];
}
if (isset($_POST['description']) && $_POST['description'] != '') {
//.........这里部分代码省略.........