本文整理汇总了PHP中comments::countComments方法的典型用法代码示例。如果您正苦于以下问题:PHP comments::countComments方法的具体用法?PHP comments::countComments怎么用?PHP comments::countComments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comments
的用法示例。
在下文中一共展示了comments::countComments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCommentList
private function getCommentList(comments $tree, $parent_id, $TEMPLATE)
{
$all_count = $tree->countComments($parent_id);
$list = '';
$num = 0;
while ($comment = $tree->getComment($parent_id)) {
$sub_comments = $tree->issetComments($parent_id) ? $this->getCommentList($tree, $comment->id(), $TEMPLATE) : '';
$num++;
page::assign('obj.num', $num);
page::assign('class-first', $num == 1 ? 'first' : '');
page::assign('class-last', $num == $all_count ? 'last' : '');
page::assign('class-odd', $num % 2 == 0 ? 'odd' : '');
page::assign('class-even', $num % 2 != 0 ? 'even' : '');
page::assign('class-third', $num % 3 == 0 ? 'third' : '');
page::assign('obj.id', $comment->id());
page::assign('obj.parent_id', $comment->getParentId());
page::assign('obj.user_id', $comment->getUserId());
page::assign('obj.publ_date', $comment->getPublDate());
page::assign('obj.username', $comment->getUserName());
page::assign('obj.email', $comment->getEmail());
page::assign('obj.text', $comment->getText());
page::assign('obj.rate', $comment->getRate());
if (isset($_SESSION['comments_rate'][$comment->id()])) {
page::fParse('rate', $TEMPLATE['rate_change']);
} else {
page::fParse('rate', $TEMPLATE['rate']);
}
if (!empty($sub_comments)) {
page::assign('list', $sub_comments);
page::fParse('list', $TEMPLATE['frame_list']);
} else {
page::assign('list', '');
}
$list .= page::parse($TEMPLATE['list']);
}
return $list;
}
示例2: 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');
}
}
示例3: 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');
}
}