当前位置: 首页>>代码示例>>PHP>>正文


PHP comments::getComments方法代码示例

本文整理汇总了PHP中comments::getComments方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::getComments方法的具体用法?PHP comments::getComments怎么用?PHP comments::getComments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在comments的用法示例。


在下文中一共展示了comments::getComments方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 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');
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:32,代码来源:class.showLead.php

示例2: run

 /**
  * 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');
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:45,代码来源:class.showClient.php

示例3: comments

<?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;  });
	
开发者ID:neevan1e,项目名称:Done,代码行数:30,代码来源:index.php

示例4: array

 //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)) {
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:common_content.php

示例5: eF_redirect

<?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";
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:comments.php

示例6: run

    /**
     * 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 = '{
//.........这里部分代码省略.........
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:101,代码来源:class.ajaxRequest.php

示例7: eF_getTableData

     $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
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:control_panel.php

示例8: trim

    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;
}
开发者ID:Lucatorze,项目名称:My-Blog,代码行数:31,代码来源:commentsController.php

示例9: run


//.........这里部分代码省略.........
         $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');
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:101,代码来源:class.showProject.php

示例10: elseif

         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;
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:module_tests.php

示例11: run


//.........这里部分代码省略.........
                     $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');
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:101,代码来源:class.showTicket.php


注:本文中的comments::getComments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。