Example #1
0
<?php

// $Header$
// Copyright (c) 2005 bitweaver Tickets
// All Rights Reserved. See below for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
// is this used?
//if (isset($_REQUEST["ticketsset"]) && isset($_REQUEST["homeTickets"])) {
//	$gBitSystem->storeConfig("home_tickets", $_REQUEST["homeTickets"]);
//	$gBitSmarty->assign('home_tickets', $_REQUEST["homeTickets"]);
//}
require_once TICKETS_PKG_PATH . 'BitTicket.php';
$formTicketsLists = array("tickets_list_ticket_id" => array('label' => 'Id', 'note' => 'Display the tickets id.'), "tickets_list_title" => array('label' => 'Title', 'note' => 'Display the title.'), "tickets_list_data" => array('label' => 'Text', 'note' => 'Display the text.'));
$gBitSmarty->assign('formTicketsLists', $formTicketsLists);
$processForm = set_tab();
if ($processForm) {
    $ticketsToggles = array_merge($formTicketsLists);
    foreach ($ticketsToggles as $item => $data) {
        simple_set_toggle($item, 'tickets');
    }
}
$ticket = new BitTicket();
$tickets = $ticket->getList($_REQUEST);
$gBitSmarty->assign_by_ref('tickets', $tickets['data']);
Example #2
0
 /**
  * load Load the data from the database
  * 
  * @access public
  * @return boolean TRUE on success, FALSE on failure - mErrors will contain reason for failure
  */
 function load()
 {
     if ($this->verifyId($this->mMilestoneId) || $this->verifyId($this->mContentId)) {
         // LibertyContent::load()assumes you have joined already, and will not execute any sql!
         // This is a significant performance optimization
         $lookupColumn = $this->verifyId($this->mMilestoneId) ? 'milestone_id' : 'content_id';
         $bindVars = array();
         $selectSql = $joinSql = $whereSql = '';
         array_push($bindVars, $lookupId = @BitBase::verifyId($this->mMilestoneId) ? $this->mMilestoneId : $this->mContentId);
         $this->getServicesSql('content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars);
         $query = "\n\t\t\t\tSELECT tm.*, lc.*,\n\t\t\t\tuue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,\n\t\t\t\tuuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name\n\t\t\t\t{$selectSql}\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "ticket_milestone` tm\n\t\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON( lc.`content_id` = tm.`content_id` ) {$joinSql}\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uue ON( uue.`user_id` = lc.`modifier_user_id` )\n\t\t\t\t\tLEFT JOIN `" . BIT_DB_PREFIX . "users_users` uuc ON( uuc.`user_id` = lc.`user_id` )\n\t\t\t\tWHERE tm.`{$lookupColumn}`=? {$whereSql}";
         $ticketQuery = "SELECT t.ticket_id\n                FROM `" . BIT_DB_PREFIX . "tickets` t \n                WHERE t.`milestone_id`=?";
         $result = $this->mDb->query($query, $bindVars);
         if ($result && $result->numRows()) {
             $this->mInfo = $result->fields;
             $this->mContentId = $result->fields['content_id'];
             $this->mMilestoneId = $result->fields['milestone_id'];
             $date = new BitDate();
             $this->mDateFrom = $result->fields['date_from'];
             $this->mDateTo = $result->fields['date_to'];
             $this->mInfo['creator'] = !empty($result->fields['creator_real_name']) ? $result->fields['creator_real_name'] : $result->fields['creator_user'];
             $this->mInfo['editor'] = !empty($result->fields['modifier_real_name']) ? $result->fields['modifier_real_name'] : $result->fields['modifier_user'];
             $this->mInfo['display_name'] = BitUser::getTitleFromHash($this->mInfo);
             $this->mInfo['display_url'] = $this->getDisplayUrl();
             $this->mInfo['parsed_data'] = $this->parseData();
             $ticketResult = $this->mDb->getCol($ticketQuery, array($this->mMilestoneId));
             $ticket = new BitTicket();
             $pParamHash = array();
             $this->mTickets = $ticket->getList($pParamHash, $ticketResult);
             LibertyMime::load();
         }
     }
     return count($this->mInfo);
 }
Example #3
0
            $tmpPage = new BitTicket($del);
            if ($tmpPage->load() && !empty($tmpPage->mInfo['title'])) {
                $info = $tmpPage->mInfo['title'];
            } else {
                $info = $del;
            }
            $formHash['input'][] = '<input type="hidden" name="checked[]" value="' . $del . '"/>' . $info;
        }
        $gBitSystem->confirmDialog($formHash, array('warning' => tra('Are you sure you want to delete ') . count($_REQUEST["checked"]) . ' tickets?', 'error' => tra('This cannot be undone!')));
    } else {
        foreach ($_REQUEST["checked"] as $deleteId) {
            $tmpPage = new BitTicket($deleteId);
            if (!$tmpPage->load() || !$tmpPage->expunge()) {
                array_merge($errors, array_values($tmpPage->mErrors));
            }
        }
        if (!empty($errors)) {
            $gBitSmarty->assign_by_ref('errors', $errors);
        }
    }
}
// Create new tickets object
$tickets = new BitTicket();
$ticketsList = $tickets->getList($_REQUEST);
$gBitSmarty->assign_by_ref('ticketsList', $ticketsList);
$fieldDefinitions = $tickets->getFieldDefinitions();
$gBitSmarty->assign_by_ref('fieldDefinitions', $fieldDefinitions);
// getList() has now placed all the pagination information in $_REQUEST['listInfo']
$gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']);
// Display the template
$gBitSystem->display('bitpackage:tickets/list_tickets.tpl', tra('Tickets'), array('display_mode' => 'list'));