<?php

global $gContent;
require_once TICKETS_PKG_PATH . 'BitMilestone.php';
require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php';
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if (empty($gContent) || !is_object($gContent) || !$gContent->isValid()) {
    // if milestone_id supplied, use that
    if (@BitBase::verifyId($_REQUEST['milestone_id'])) {
        $gContent = new BitMilestone($_REQUEST['milestone_id']);
        // if content_id supplied, use that
    } elseif (@BitBase::verifyId($_REQUEST['content_id'])) {
        $gContent = new BitMilestone(NULL, $_REQUEST['content_id']);
    } elseif (@BitBase::verifyId($_REQUEST['milestones']['milestone_id'])) {
        $gContent = new BitMilestone($_REQUEST['milestones']['milestone_id']);
        // otherwise create new object
    } else {
        $gContent = new BitMilestone();
    }
    $gContent->load();
    $gBitSmarty->assign_by_ref("gContent", $gContent);
}
Exemple #2
0
if (!$gContent->isValid()) {
    $gBitSystem->setHttpStatus(404);
    $gBitSystem->fatalError("The tickets you requested could not be found.");
}
// Now check permissions to access this content
$gContent->verifyViewPermission();
// Add a hit to the counter
$gContent->addHit();
if (is_object($gContent) && $gContent->isCommentable()) {
    $commentsParentId = $gContent->mContentId;
    $comments_vars = array(BITTICKET_CONTENT_TYPE_GUID);
    $comments_prefix_var = BITTICKET_CONTENT_TYPE_GUID . ':';
    $comments_object_var = BITTICKET_CONTENT_TYPE_GUID;
    $comments_return_url = $gContent->getDisplayUrl();
    $comments_sort_mode = "commentDate_asc";
    $gBitSmarty->assign('item_display_comments', TRUE);
    include_once LIBERTY_PKG_PATH . 'comments_inc.php';
}
// Get necessary lists.
$contextTicket = new BitTicket();
$fieldDefinitions = $contextTicket->getFieldDefinitions();
$gBitSmarty->assign('fieldDefinitions', $fieldDefinitions);
$fieldValues = $contextTicket->getFieldValues();
$gBitSmarty->assign('fieldValues', $fieldValues);
$milestone = new BitMilestone();
$pParamHash = array();
$milestones = $milestone->getList($pParamHash);
$gBitSmarty->assign('milestones', $milestones);
$gBitThemes->loadJavascript(TICKETS_PKG_PATH . 'scripts/BitTicket.js', TRUE);
// Display the template
$gBitSystem->display('bitpackage:tickets/ticket_display.tpl', tra('Tickets'), array('display_mode' => 'display'));