public function run() { $tpl = new template(); $id = (int) $_GET['id']; if ($id > 0) { $lead = $this->getLead($id); // Comments $comments = new comments(); if (isset($_POST['comment']) === true) { $values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']); $comments->addComment($values, 'lead'); } // files $file = new files(); if (isset($_POST['upload'])) { if (isset($_FILES['file'])) { $file->upload($_FILES, 'lead', $id); $tpl->setNotification('FILE_UPLOADED', 'success'); } else { $tpl->setNotification('NO_FILE', 'error'); } } $files = new files(); $tpl->assign('files', $files->getFilesByModule('lead', $id)); $tpl->assign('comments', $comments->getComments('lead', $id)); $tpl->assign('contactInfo', $this->getLeadContact($id)); $tpl->assign('lead', $lead); } else { $tpl->display('general.error'); } $tpl->display('leads.showLead'); }
/** * run - display template and edit data * * @access public */ public function run() { $tpl = new template(); $id = ''; if (isset($_GET['id']) === true) { $id = (int) $_GET['id']; } $client = $this->getClient($id); if (empty($client) === false) { $file = new files(); $project = new projects(); $msgKey = ''; if ($_SESSION['userdata']['role'] == 'admin') { $tpl->assign('admin', true); } if (isset($_POST['upload'])) { if (isset($_FILES['file'])) { $msgKey = $file->upload($_FILES, 'client', $id); } } $comment = new comments(); //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, 'client'); } $tpl->assign('userClients', $this->getClientsUsers($id)); $tpl->assign('comments', $comment->getComments('client', $id)); $tpl->assign('imgExtensions', array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv')); $tpl->assign('info', $msgKey); $tpl->assign('client', $client); $tpl->assign('clientProjects', $project->getClientProjects($id)); $tpl->assign('files', $file->getFilesByModule('client')); //var_dump($file->getFilesByModule('client')); die(); $tpl->display('clients.showClient'); } else { $tpl->display('general.error'); } }
<?php require_once "comments.php"; $comment = new comments(); if (isset($_GET['action']) and $_GET['action'] == "getComments") { echo $comment->getComments(); exit; } if (isset($_GET['action']) and $_GET['action'] == "delete") { $comment->deleteComment($_GET['id']); exit; } if (isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { echo $comment->addComment($_POST); exit; } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Angular Demo</title> <script type="text/javascript" src="js/angular.min.js"></script> <script type="text/javascript"> function commentsController($scope, $http){ $http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; $http.get("index.php?action=getComments") .success(function(data){ $scope.comments = data; });
//Next and previous units are needed for navigation buttons //package_ID denotes that a SCORM 2004 unit is active. if (!isset($_GET['package_ID'])) { $nextUnit = $currentContent->getNextNode($currentUnit, $visitableIterator); $smarty->assign("T_NEXT_UNIT", $nextUnit); $previousUnit = $currentContent->getPreviousNode($currentUnit, $visitableIterator); $smarty->assign("T_PREVIOUS_UNIT", $previousUnit); //Parents are needed for printing the titles $smarty->assign("T_PARENT_LIST", $currentContent->getNodeAncestors($currentUnit)); } else { //SCORM 2004 content handles navigation on its own, so it's illegal to have additional navigation handles $smarty->assign("T_PARENT_LIST", $currentContent->getNodeAncestors($_GET['package_ID'])); $smarty->assign("T_SCORM_2004_TITLE", true); } $comments = array(); $result = array_merge(comments::getComments($currentLesson->lesson['id'], false, $currentUnit['id']), comments::getComments($currentLesson->lesson['id'], $currentUser, $currentUnit['id'], false, false)); foreach ($result as $value) { if (!isset($comments[$value['id']])) { $comments[$value['id']] = $value; } } foreach ($comments as $key => $value) { //$user = EfrontUserFactory :: factory($value['users_LOGIN']); //$comments[$key]['avatar'] = $user -> getAvatar(); } if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) { //this applies to supervisors only $currentBranch = new EfrontBranch($_SESSION['s_current_branch']); $branchTreeUsers = array_keys($currentBranch->getBranchTreeUsers()); foreach ($comments as $key => $value) { if (!in_array($value['users_LOGIN'], $branchTreeUsers)) {
<?php /** * */ if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) { exit; } if (!EfrontUser::isOptionVisible('comments')) { eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=control_panel&message=" . urlencode(_UNAUTHORIZEDACCESS) . "&message_type=failure"); } //Create shorthands for user access rights, to avoid long variable names !isset($currentUser->coreAccess['comments']) || $currentUser->coreAccess['comments'] == 'change' ? $_change_ = 1 : ($_change_ = 0); $load_editor = true; if ($_professor_) { $comments = comments::getComments($currentLesson->lesson['id'], false, $currentUnit['id'], false, false); } else { $comments = comments::getComments($currentLesson->lesson['id'], $GLOBALS['currentUser'], $currentUnit['id'], false, false); } //An array of legal ids for editing entries $legalValues = array(); foreach ($comments as $value) { //if ($value['users_LOGIN'] == $GLOBALS['currentUser'] -> user['login'] || $_professor_) { $legalValues[] = $value['id']; //} } //Theses values will be used for the new comment $values = array('content_ID' => $currentUnit['id'], 'users_LOGIN' => $currentUser->user['login']); $entityForm = new HTML_QuickForm("create_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=comments&view_unit=" . $currentUnit['id'] . (isset($_GET['add']) ? '&add=1' : '&edit=' . $_GET['edit']), "", null, true); $entityName = 'comments'; include "entity.php";
/** * run - display template and edit data * * @access public * */ public function run() { $login = new login(session::getSID()); //Check if user is logged in if ($login->logged_in() !== true) { exit; } $helper = new helper(); $projects = new projects(); $tickets = new tickets(); $module = $_GET['module']; //Organize ajax handlers by module and action if ($module == "tickets.showAll") { // AJAX status change if (isset($_POST['ticketId'])) { $ticketId = $_POST['ticketId']; $newStatus = $_POST['newStatus']; if ($tickets->getAccessRights($ticketId)) { if ($tickets->changeStatus($ticketId, $newStatus) === true) { echo "Status was changed"; } else { echo "Error with change"; } } else { echo "You have no rights to do that."; } } } else { if ($module == "tickets.showTicket") { $users = new users(); $id = $_GET['id']; $results = $tickets->getTimelineHistory($id); $ticket = $tickets->getTicket($id); $jsonArr = array(); $description = strip_tags($ticket['description']); $description = str_replace("\n", "", $description); $description = str_replace("\r", "", $description); $json = '{"timeline": { "headline":"Ticket History for ' . $ticket['headline'] . '", "type":"default", "text":"' . $description . '", "startDate":"' . $ticket['timelineDate'] . '", "date": [ '; //Creation Date $items[] = '{ "startDate":"' . $ticket['timelineDate'] . '", "headline":"Ticket Created", "text":"<p>Ticket created by ' . $ticket['userFirstname'] . ', ' . $ticket['userLastname'] . '</p>", "asset": { "media":"", "credit":"", "caption":"" } }'; foreach ($results as $row) { $items[] = '{ "startDate":"' . $row['date'] . '", "headline":"Ticket Update", "text":"<p>' . $row['firstname'] . ', ' . $row['lastname'] . ' changed ' . $row['changeType'] . ' to ' . $row['changeValue'] . '</p>", "asset": { "media":"' . $users->getProfilePicture($row['userId']) . '", "credit":"' . $row['firstname'] . ', ' . $row['lastname'] . '", "caption":"" } }'; } $comments = new comments(); $allcomments = $comments->getComments('ticket', $id); foreach ($allcomments as $comment) { $items[] = '{ "startDate":"' . $comment['timelineDate'] . '", "headline":"New Comment", "text":' . json_encode('<p>' . $comment['firstname'] . ', ' . $comment['lastname'] . ' said:<br /> </p>' . $comment['text']) . ', "asset": { "media":"' . $users->getProfilePicture($comment['userId']) . '", "credit":"' . $comment['firstname'] . ', ' . $comment['lastname'] . '", "caption":"" } }'; } $file = new files(); $files = $file->getFilesByModule('ticket', $id); $tempStr = ''; $tempStr3 = ''; $imgExtensions = array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv'); foreach ($files as $fileRow) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/userdata/' . $fileRow['module'] . '/' . $fileRow['encName'] . '.' . $fileRow['extension'])) { $tempStr3 .= "<img style='max-height: 50px; max-width: 70px;' src='userdata/" . $fileRow["module"] . "/" . $fileRow['encName'] . "." . $fileRow["extension"] . "' />"; $filepath = "userdata/" . $fileRow["module"] . "/" . $fileRow['encName'] . "." . $fileRow["extension"] . ""; } else { $tempStr3 .= "<img style='max-height: 50px; max-width: 70px;' src='userdata/file.png' />"; $filepath = "userdata/file.png"; } $tempStr = '{ "startDate":"' . $fileRow['timelineDate'] . '", "headline":"New File", "text":"' . $fileRow['firstname'] . ', ' . $fileRow['lastname'] . ' uploaded:<br /><a href=\'' . $filepath . '\'>' . $fileRow['realName'] . '.' . $fileRow['extension'] . '</a>",'; $tempStr3 .= '<span class=\'filename\'>' . $fileRow['realName'] . '.' . $fileRow['extension'] . '</span> </a>",'; $tempStr .= ' "asset": { "media":"' . $filepath . '", "credit":"' . $fileRow['realName'] . '.' . $fileRow['extension'] . '", "caption":"" } }'; $items[] = $tempStr; } $json .= implode(",", $items); $json .= ' ] } }'; header('Content-type: text/json'); header('Content-type: application/json'); echo $json; } else { echo "There are no ajax actions for this module"; } } }
$forum_lessons_ID = eF_getTableData("f_forums", "id", "lessons_ID=" . $_SESSION['s_lessons_ID']); $smarty->assign("T_FORUM_MESSAGES", $forum_messages); $smarty->assign("T_FORUM_LESSONS_ID", $forum_lessons_ID[0]['id']); $forumOptions = array(); if ($forum_lessons_ID[0]['id']) { if (!isset($currentUser->coreAccess['forum']) || $currentUser->coreAccess['forum'] == 'change') { $forumOptions[] = array('text' => _SENDMESSAGEATFORUM, 'image' => "16x16/add.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=forum&add=1&type=topic&forum_id=" . $forum_lessons_ID[0]['id'] . "&popup=1", 'onclick' => "eF_js_showDivPopup(event, '" . _NEWMESSAGE . "', 2)", 'target' => 'POPUP_FRAME'); } } $forumOptions[] = array('text' => _GOTOFORUM, 'image' => "16x16/go_into.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=forum"); $smarty->assign("T_FORUM_OPTIONS", $forumOptions); $smarty->assign("T_FORUM_LINK", basename($_SERVER['PHP_SELF']) . "?ctg=forum&forum=" . $forum_lessons_ID[0]['id']); } //Comments block if (!isset($currentUser->coreAccess['content']) || $currentUser->coreAccess['content'] != 'hidden') { $comments = comments::getComments(false, false, false, 5); if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) { //this applies to supervisors only $currentBranch = new EfrontBranch($_SESSION['s_current_branch']); $branchTreeUsers = array_keys($currentBranch->getBranchTreeUsers()); foreach ($comments as $key => $value) { if (!in_array($value['users_LOGIN'], $branchTreeUsers)) { unset($comments[$key]); } } } $smarty->assign("T_COMMENTS", array_values($comments)); } if (G_VERSIONTYPE != 'community') { #cpp#ifndef COMMUNITY //Lesson timeline events block
if ($_POST['idComments'] == 0) { $_POST['author'] = trim(htmlentities($_POST['author'])); $_POST['content'] = trim(htmlentities($_POST['content'])); if (empty($_POST['author']) || empty($_POST['author'])) { $error = 'Merci de remplir tous les champs'; } else { $comments->addComments($pdo, $date); header("Location: index.php?pages=viewArticles&&id=" . $_POST['idArticles']); exit; } } else { $_POST['author'] = trim(htmlentities($_POST['author'])); $_POST['content'] = trim(htmlentities($_POST['content'])); $comments->updateComments($pdo, $date); header("Location: index.php?pages=viewArticles&&id=" . $_POST['idArticles']); exit; } } if (isset($_GET['deleteComments'])) { //Supprimer un article $comments->deleteComments($pdo); header("Location: index.php?pages=viewArticles&&id=" . $_POST['idArticles']); exit; } if (isset($_GET['updateComments'])) { $result = $comments->getComments($pdo); } else { $result['author'] = ''; $result['content'] = ''; $result['id'] = 0; }
/** * 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'; $userId = 'all'; if (isset($_POST['kind']) && $_POST['kind'] != '') { $kind = $_POST['kind']; } if (isset($_POST['userId']) && $_POST['userId'] != '') { $userId = $_POST['userId']; } if (isset($_POST['dateFrom']) && $_POST['dateFrom'] != '') { $dateFrom = $helper->timestamp2date($_POST['dateFrom'], 4); } if (isset($_POST['dateTo']) && $_POST['dateTo'] != '') { $dateTo = $helper->timestamp2date($_POST['dateTo'], 4); } if (isset($_POST['invEmpl']) === true) { $invEmplCheck = $_POST['invEmpl']; if ($invEmplCheck == 'on') { $invEmplCheck = '1'; } else { $invEmplCheck = '0'; } } else { $invEmplCheck = '0'; } if (isset($_POST['invComp']) === true) { $invCompCheck = $_POST['invComp']; if ($invCompCheck == 'on') { $invCompCheck = '1'; } else { $invCompCheck = '0'; } } else { $invCompCheck = '0'; } $user = new users(); $employees = $user->getEmployees(); $timesheets = new timesheets(); $projects = new projects(); $tpl->assign('employeeFilter', $userId); $tpl->assign('employees', $employees); $tpl->assign('dateFrom', $helper->timestamp2date($dateFrom, 2)); $tpl->assign('dateTo', $helper->timestamp2date($dateTo, 2)); $tpl->assign('actKind', $kind); $tpl->assign('kind', $timesheets->kind); $tpl->assign('invComp', $invCompCheck); $tpl->assign('invEmpl', $invEmplCheck); $tpl->assign('helper', $helper); $tpl->assign('projectFilter', $projectFilter); $tpl->assign('allTimesheets', $timesheets->getAll($projectFilter, $kind, $dateFrom, $dateTo, $userId, $invEmplCheck, $invCompCheck)); /* 'name' = :name AND 'username' = :username AND 'password' = :password AND 'host' = :host AND 'kind' = :kind */ if (isset($_POST['accountSubmit'])) { $values = array('name' => $_POST['accountName'], 'username' => $_POST['username'], 'password' => $_POST['password'], 'host' => $_POST['host'], 'kind' => $_POST['kind']); $this->addAccount($values, $id); } //Assign vars $ticket = new tickets(); $tpl->assign('imgExtensions', array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv')); $tpl->assign('projectTickets', $this->getProjectTickets($id)); $tpl->assign('projectPercentage', $projectPercentage); $tpl->assign('openTickets', $opentickets['openTickets']); $tpl->assign('project', $project); $files = $file->getFilesByModule('project', $id); $tpl->assign('files', $files); $tpl->assign('numFiles', count($files)); $bookedHours = $this->getProjectBookedHours($id); if ($bookedHours['totalHours'] != '') { $booked = round($bookedHours['totalHours'], 3); } else { $booked = 0; } $tpl->assign('bookedHours', $booked); $bookedDollars = $this->getProjectBookedDollars($id); if ($bookedDollars['totalDollars'] != '') { $dollars = round($bookedDollars['totalDollars'], 3); } else { $dollars = 0; } $tpl->assign('bookedDollars', $dollars); $tpl->assign("bookedHoursArray", $this->getProjectBookedHoursArray($id)); // die($id); $comment = $comments->getComments('project', $_GET['id']); $tpl->assign('comments', $comment); $tpl->assign('numComments', $comments->countComments('project', $_GET['id'])); $tpl->assign('state', $this->state); $tpl->assign('helper', $helper); $tpl->assign('role', $_SESSION['userdata']['role']); $accounts = $this->getProjectAccounts($id); $tpl->assign('accounts', $accounts); $tpl->display('projects.showProject'); } else { $tpl->display('general.error'); } }
echo $e->getMessage() . ' (' . $e->getCode() . ')'; } exit; } elseif (isset($_GET['show_test']) && in_array($_GET['show_test'], $legalValues) && eF_checkParameter($_GET['show_test'], 'id') || isset($_GET['view_unit']) && in_array($_GET['view_unit'], $legalUnits) && eF_checkParameter($_GET['view_unit'], 'id')) { if (isset($_GET['view_unit'])) { $showTest = new EfrontTest($_GET['view_unit'], true); $smarty->assign("T_UNIT", $currentUnit); $smarty->assign("T_NEXT_UNIT", $currentContent->getNextNode($currentUnit, $visitableIterator)); $smarty->assign("T_PREVIOUS_UNIT", $currentContent->getPreviousNode($currentUnit, $visitableIterator)); //Next and previous units are needed for navigation buttons $smarty->assign("T_PARENT_LIST", $currentContent->getNodeAncestors($currentUnit)); //Parents are needed for printing the title $smarty->assign("T_SHOW_TOOLS", true); //Tools is the right upper corner table box, that lists tools such as 'upload files', 'copy content' etc if (EfrontUser::isOptionVisible('comments')) { $smarty->assign("T_COMMENTS", comments::getComments($_SESSION['s_lessons_ID'], false, $currentUnit['id'])); //Retrieve any comments regarding this unit } $smarty->assign("T_SHOW_TOOLS", true); //Tools is the right upper corner table box, that lists tools such as 'upload files', 'copy content' etc } else { $showTest = new EfrontTest($_GET['show_test']); } $smarty->assign("T_CURRENT_TEST", $showTest); if (isset($_GET['print'])) { $printTest = $showTest; if (isset($_GET['show_all'])) { $printTest->options['random_pool'] = false; } if (isset($_GET['preview_correct']) && $_SESSION['s_lesson_user_type'] != 'student') { $printTest->preview_correct = true;
/** * 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'] != '') { $values['description'] = $_POST['description']; } if ($values['kind'] != '') { if ($values['date'] != '') { if ($values['hours'] != '' && $values['hours'] > 0) { $timesheets->addTime($values); $tpl->setNotification('TIME_SAVED', 'success'); } else { $tpl->setNotification('NO_HOURS', 'success'); } } else { $tpl->setNotification('NO_DATE', 'error'); } } else { $tpl->setNotification('NO_KIND', 'success'); } $tpl->assign('userId', $values['userId']); } $timesheets = new timesheets(); $language = new language(); $language->setModule('tickets'); $lang = $language->readIni(); $data = array(); $data2 = array(); $months = array(); $results = $timesheets->getTicketHours($id); $allHours = 0; foreach ($results as $row) { if ($row['summe']) { $allHours += $row['summe']; } } $tpl->assign('timesheetsAllHours', $allHours); $remainingHours = $ticket['planHours'] - $allHours; $comments = $comment->getComments('ticket', $ticket['id']); $files = $file->getFilesByModule('ticket', $id); $unreadCount = count($this->getUnreadTickets($_SESSION['userdata']['id'])); $tpl->assign('unreadCount', $unreadCount); $tpl->assign('imgExtensions', array('jpg', 'jpeg', 'png', 'gif', 'psd', 'bmp', 'tif', 'thm', 'yuv')); $tpl->assign('ticketHistory', $this->getTicketHistory((int) $_GET['id'])); $tpl->assign('remainingHours', $remainingHours); $tpl->assign('ticketPrice', $this->getTicketCost($_GET['id'])); $tpl->assign('info', $msgKey); $tpl->assign('role', $_SESSION['userdata']['role']); $tpl->assign('ticket', $ticket); $tpl->assign('objTicket', $this); $tpl->assign('state', $this->state); $tpl->assign('statePlain', $this->statePlain); $tpl->assign('numComments', $comment->countComments('ticket', $ticket['id'])); $tpl->assign('comments', $comments); $tpl->assign('editable', $editable); $tpl->assign('files', $files); $tpl->assign('numFiles', count($files)); $tpl->assign('helper', $helper); $tpl->display('tickets.showTicket'); } else { $tpl->display('general.error'); } } else { $tpl->display('general.error'); } }