本文整理汇总了PHP中comments::addComment方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::addComment方法的具体用法?PHP comments::addComment怎么用?PHP comments::addComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments
的用法示例。
在下文中一共展示了comments::addComment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
示例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');
}
}
示例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; });
示例4: addComment
function addComment($inputs)
{
include "comments.php";
$comments = new comments();
$comments->addComment($inputs[0]);
}
示例5: 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';
//.........这里部分代码省略.........
示例6: 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'] != '') {
//.........这里部分代码省略.........