本文整理汇总了PHP中Ticket::getTypeName方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::getTypeName方法的具体用法?PHP Ticket::getTypeName怎么用?PHP Ticket::getTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::getTypeName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkLoginUser();
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
Html::helpHeader(Ticket::getTypeName(2), '', $_SESSION["glpiname"]);
} else {
Html::header(Ticket::getTypeName(2), '', "maintain", "ticket");
}
if ($_SESSION['glpirefresh_ticket_list'] > 0) {
// Refresh automatique sur tracking.php
echo "<script type=\"text/javascript\">\n";
echo "setInterval(\"window.location.reload()\"," . 60000 * $_SESSION['glpirefresh_ticket_list'] . ");\n";
echo "</script>\n";
}
Search::show('Ticket');
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
Html::helpFooter();
} else {
Html::footer();
}
示例2: showForProjectTask
/**
* Show tickets for a projecttask
*
* @param $projecttask ProjectTask object
**/
static function showForProjectTask(ProjectTask $projecttask)
{
global $DB, $CFG_GLPI;
$ID = $projecttask->getField('id');
if (!$projecttask->can($ID, READ)) {
return false;
}
$canedit = $projecttask->canEdit($ID);
$rand = mt_rand();
$query = "SELECT DISTINCT `glpi_projecttasks_tickets`.`id` AS linkID,\n `glpi_tickets`.*\n FROM `glpi_projecttasks_tickets`\n LEFT JOIN `glpi_tickets`\n ON (`glpi_projecttasks_tickets`.`tickets_id` = `glpi_tickets`.`id`)\n WHERE `glpi_projecttasks_tickets`.`projecttasks_id` = '{$ID}'\n ORDER BY `glpi_tickets`.`name`";
$result = $DB->query($query);
$tickets = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$tickets[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='projecttaskticket_form{$rand}' id='projecttaskticket_form{$rand}'\n method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='3'>" . __('Add a ticket') . "</th></tr>";
echo "<tr class='tab_bg_2'><td class='right'>";
echo "<input type='hidden' name='projecttasks_id' value='{$ID}'>";
$condition = "`glpi_tickets`.`status`\n NOT IN ('" . implode("', '", array_merge(Ticket::getSolvedStatusArray(), Ticket::getClosedStatusArray())) . "')";
Ticket::dropdown(array('used' => $used, 'entity' => $projecttask->getEntityID(), 'entity_sons' => $projecttask->isRecursive(), 'condition' => $condition, 'displaywith' => array('id')));
echo "</td><td width='20%'>";
echo "<a href='" . Toolbox::getItemTypeFormURL('Ticket') . "?_projecttasks_id={$ID}'>";
_e('Create a ticket from this task');
echo "</a>";
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $numrows) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='12'>" . Ticket::getTypeName($numrows) . "</th>";
echo "</tr>";
if ($numrows) {
Ticket::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
Session::initNavigateListItems('Ticket', sprintf(__('%1$s = %2$s'), ProjectTask::getTypeName(1), $projecttask->fields["name"]));
$i = 0;
foreach ($tickets as $data) {
Session::addToNavigateListItems('Ticket', $data["id"]);
Ticket::showShort($data['id'], array('followups' => false, 'row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID']));
$i++;
}
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例3:
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkLoginUser();
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
Html::helpHeader(Ticket::getTypeName(Session::getPluralNumber()), '', $_SESSION["glpiname"]);
} else {
Html::header(Ticket::getTypeName(Session::getPluralNumber()), '', "helpdesk", "ticket");
}
if ($_SESSION['glpirefresh_ticket_list'] > 0) {
// Refresh automatique sur tracking.php
echo "<script type=\"text/javascript\">\n";
echo "setInterval(\"window.location.reload()\"," . 60000 * $_SESSION['glpirefresh_ticket_list'] . ");\n";
echo "</script>\n";
}
Search::show('Ticket');
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
Html::helpFooter();
} else {
Html::footer();
}
示例4: getCentral
//.........这里部分代码省略.........
if (in_array($ticket->fields['status'], $ticket->getClosedStatusArray())) {
$canupdate = false;
}
$showuserlink = 0;
if (Session::haveRight('user', 'r')) {
$showuserlink = 1;
}
if (!$options['template_preview']) {
$ticket->showTabs($options);
} else {
// Add all values to fields of tickets for template preview
foreach ($values as $key => $val) {
if (!isset($ticket->fields[$key])) {
$ticket->fields[$key] = $val;
}
}
}
// In percent
$colsize1 = '13';
$colsize2 = '29';
$colsize3 = '13';
$colsize4 = '45';
$canupdate_descr = $canupdate || $ticket->fields['status'] == Ticket::INCOMING && $ticket->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID()) && $ticket->numberOfFollowups() == 0 && $ticket->numberOfTasks() == 0;
if (!$options['template_preview']) {
echo "<form method='post' name='form_ticket' enctype='multipart/form-data' action='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'>";
}
echo "<div class='spaced' id='tabsbody'>";
echo "<table class='tab_cadre_fixe' id='mainformtable'>";
// Optional line
$ismultientities = Session::isMultiEntitiesMode();
echo "<tr class='headerRow'>";
echo "<th colspan='4'>";
if ($ID) {
$text = sprintf(__('%1$s - %2$s'), $ticket->getTypeName(1), sprintf(__('%1$s: %2$s'), __('ID'), $ID));
if ($ismultientities) {
$text = sprintf(__('%1$s (%2$s)'), $text, Dropdown::getDropdownName('glpi_entities', $ticket->fields['entities_id']));
}
echo $text;
} else {
if ($ismultientities) {
printf(__('The ticket will be added in the entity %s'), Dropdown::getDropdownName("glpi_entities", $ticket->fields['entities_id']));
} else {
_e('New ticket');
}
}
echo "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>";
echo $tt->getBeginHiddenFieldText('date');
if (!$ID) {
printf(__('%1$s%2$s'), __('Opening date'), $tt->getMandatoryMark('date'));
} else {
_e('Opening date');
}
echo $tt->getEndHiddenFieldText('date');
echo "</th>";
echo "<td width='{$colsize2}%'>";
echo $tt->getBeginHiddenFieldValue('date');
$date = $ticket->fields["date"];
if ($canupdate) {
Html::showDateTimeFormItem("date", $date, 1, false);
} else {
echo Html::convDateTime($date);
}
echo $tt->getEndHiddenFieldValue('date', $ticket);
echo "</td>";
示例5: showForTicket
/**
* Show changes for a ticket
*
* @param $ticket Ticket object
**/
static function showForTicket(Ticket $ticket)
{
global $DB, $CFG_GLPI;
$ID = $ticket->getField('id');
if (!$ticket->can($ID, READ)) {
return false;
}
$canedit = $ticket->canEdit($ID);
$rand = mt_rand();
$query = "SELECT DISTINCT `glpi_changes_tickets`.`id` AS linkID,\n `glpi_changes`.*\n FROM `glpi_changes_tickets`\n LEFT JOIN `glpi_changes`\n ON (`glpi_changes_tickets`.`changes_id` = `glpi_changes`.`id`)\n WHERE `glpi_changes_tickets`.`tickets_id` = '{$ID}'\n ORDER BY `glpi_changes`.`name`";
$result = $DB->query($query);
$changes = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$changes[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='changeticket_form{$rand}' id='changeticket_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='3'>" . __('Add a change') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>";
echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
Change::dropdown(array('used' => $used, 'entity' => $ticket->getEntityID()));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td><td>";
if (Session::haveRight('change', CREATE)) {
echo "<a href='" . Toolbox::getItemTypeFormURL('Change') . "?tickets_id={$ID}'>";
_e('Create a change from this ticket');
echo "</a>";
}
echo "</td></tr></table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $numrows) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='noHover'><th colspan='12'>" . Change::getTypeName($numrows) . "</th>";
echo "</tr>";
if ($numrows) {
Change::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
Session::initNavigateListItems('Change', sprintf(__('%1$s = %2$s'), Ticket::getTypeName(1), $ticket->fields["name"]));
$i = 0;
foreach ($changes as $data) {
Session::addToNavigateListItems('Change', $data["id"]);
Change::showShort($data['id'], array('row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID']));
$i++;
}
Change::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例6: getSearchOptions
//.........这里部分代码省略.........
$tab[7]['table'] = 'glpi_itilcategories';
$tab[7]['field'] = 'completename';
$tab[7]['name'] = __('Category');
$tab[7]['datatype'] = 'dropdown';
$tab[80]['table'] = 'glpi_entities';
$tab[80]['field'] = 'completename';
$tab[80]['name'] = __('Entity');
$tab[80]['massiveaction'] = false;
$tab[80]['datatype'] = 'dropdown';
$tab[45]['table'] = $this->getTable();
$tab[45]['field'] = 'actiontime';
$tab[45]['name'] = __('Total duration');
$tab[45]['datatype'] = 'timestamp';
$tab[45]['massiveaction'] = false;
$tab[45]['nosearch'] = true;
$tab[64]['table'] = 'glpi_users';
$tab[64]['field'] = 'name';
$tab[64]['linkfield'] = 'users_id_lastupdater';
$tab[64]['name'] = __('Last edit by');
$tab[64]['massiveaction'] = false;
$tab[64]['datatype'] = 'dropdown';
$tab[64]['right'] = 'all';
$tab[65]['table'] = 'glpi_items_problems';
$tab[65]['field'] = 'count';
$tab[65]['name'] = _x('quantity', 'Number of items');
$tab[65]['forcegroupby'] = true;
$tab[65]['usehaving'] = true;
$tab[65]['datatype'] = 'number';
$tab[65]['massiveaction'] = false;
$tab[65]['joinparams'] = array('jointype' => 'child');
$tab += $this->getSearchOptionsActors();
$tab['analysis'] = __('Analysis');
$tab[60]['table'] = $this->getTable();
$tab[60]['field'] = 'impactcontent';
$tab[60]['name'] = __('Impacts');
$tab[60]['massiveaction'] = false;
$tab[60]['datatype'] = 'text';
$tab[61]['table'] = $this->getTable();
$tab[61]['field'] = 'causecontent';
$tab[61]['name'] = __('Causes');
$tab[61]['massiveaction'] = false;
$tab[61]['datatype'] = 'text';
$tab[62]['table'] = $this->getTable();
$tab[62]['field'] = 'symptomcontent';
$tab[62]['name'] = __('Symptoms');
$tab[62]['massiveaction'] = false;
$tab[62]['datatype'] = 'text';
$tab[90]['table'] = $this->getTable();
$tab[90]['field'] = 'notepad';
$tab[90]['name'] = __('Notes');
$tab[90]['massiveaction'] = false;
$tab[90]['datatype'] = 'text';
$tab['task'] = _n('Task', 'Tasks', 2);
$tab[26]['table'] = 'glpi_problemtasks';
$tab[26]['field'] = 'content';
$tab[26]['name'] = __('Task description');
$tab[26]['forcegroupby'] = true;
$tab[26]['splititems'] = true;
$tab[26]['massiveaction'] = false;
$tab[26]['joinparams'] = array('jointype' => 'child');
$tab[26]['datatype'] = 'text';
$tab[28]['table'] = 'glpi_problemtasks';
$tab[28]['field'] = 'count';
$tab[28]['name'] = _x('quantity', 'Number of tasks');
$tab[28]['forcegroupby'] = true;
$tab[28]['usehaving'] = true;
$tab[28]['datatype'] = 'number';
$tab[28]['massiveaction'] = false;
$tab[28]['joinparams'] = array('jointype' => 'child');
$tab[20]['table'] = 'glpi_taskcategories';
$tab[20]['field'] = 'name';
$tab[20]['name'] = __('Task category');
$tab[20]['datatype'] = 'dropdown';
$tab[20]['forcegroupby'] = true;
$tab[20]['splititems'] = true;
$tab[20]['massiveaction'] = false;
$tab[20]['joinparams'] = array('beforejoin' => array('table' => 'glpi_problemtasks', 'joinparams' => array('jointype' => 'child')));
$tab['solution'] = _n('Solution', 'Solutions', 2);
$tab[23]['table'] = 'glpi_solutiontypes';
$tab[23]['field'] = 'name';
$tab[23]['name'] = __('Solution type');
$tab[23]['datatype'] = 'dropdown';
$tab[24]['table'] = $this->getTable();
$tab[24]['field'] = 'solution';
$tab[24]['name'] = _n('Solution', 'Solutions', 1);
$tab[24]['datatype'] = 'text';
$tab[24]['htmltext'] = true;
$tab[24]['massiveaction'] = false;
$tab += $this->getSearchOptionsStats();
$tab['ticket'] = Ticket::getTypeName(2);
$tab[141]['table'] = 'glpi_problems_tickets';
$tab[141]['field'] = 'count';
$tab[141]['name'] = __('Number of tickets');
$tab[141]['forcegroupby'] = true;
$tab[141]['usehaving'] = true;
$tab[141]['datatype'] = 'number';
$tab[141]['massiveaction'] = false;
$tab[141]['joinparams'] = array('jointype' => 'child');
return $tab;
}
示例7: showForTicket
/**
* Show problems for a ticket
*
* @param $ticket Ticket object
**/
static function showForTicket(Ticket $ticket)
{
global $DB, $CFG_GLPI;
$ID = $ticket->getField('id');
if (!Session::haveRight("show_all_problem", 1) || !$ticket->can($ID, 'r')) {
// if (!$ticket->can($ID,'r')) {
return false;
}
$canedit = $ticket->can($ID, 'w');
$rand = mt_rand();
$query = "SELECT DISTINCT `glpi_problems_tickets`.`id` AS linkID,\n `glpi_problems`.*\n FROM `glpi_problems_tickets`\n LEFT JOIN `glpi_problems`\n ON (`glpi_problems_tickets`.`problems_id` = `glpi_problems`.`id`)\n WHERE `glpi_problems_tickets`.`tickets_id` = '{$ID}'\n ORDER BY `glpi_problems`.`name`";
$result = $DB->query($query);
$problems = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$problems[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='problemticket_form{$rand}' id='problemticket_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='3'>" . __('Add a problem') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>";
echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
$condition = "`glpi_problems`.`status` NOT IN ('" . implode("', '", array_merge(Problem::getSolvedStatusArray(), Problem::getClosedStatusArray())) . "')";
Problem::dropdown(array('used' => $used, 'entity' => $ticket->getEntityID(), 'condition' => $condition));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td><td>";
echo "<a href='" . Toolbox::getItemTypeFormURL('Problem') . "?tickets_id={$ID}'>";
_e('Create a problem from this ticket');
echo "</a>";
echo "</td></tr></table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $numrows) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $numrows);
Html::showMassiveActions(__CLASS__, $massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='11'>" . Problem::getTypeName($numrows) . "</th>";
echo "</tr>";
if ($numrows) {
Problem::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
Session::initNavigateListItems('Problem', sprintf(__('%1$s = %2$s'), Ticket::getTypeName(1), $ticket->fields["name"]));
$i = 0;
foreach ($problems as $data) {
Session::addToNavigateListItems('Problem', $data["id"]);
Problem::showShort($data['id'], Search::HTML_OUTPUT, $i, $data['linkID']);
$i++;
}
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions(__CLASS__, $massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例8: Ticket
// IRMA, Information Resource-Management and Administration
// Christian Bauer
/** @file
* @brief
*/
include '../inc/includes.php';
if (empty($_POST["_type"]) || $_POST["_type"] != "Helpdesk" || !$CFG_GLPI["use_anonymous_helpdesk"]) {
Session::checkRight("ticket", CREATE);
}
$track = new Ticket();
// Security check
if (empty($_POST) || count($_POST) == 0) {
Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
}
if (isset($_POST["_type"]) && $_POST["_type"] == "Helpdesk") {
Html::nullHeader(Ticket::getTypeName(Session::getPluralNumber()));
} else {
if ($_POST["_from_helpdesk"]) {
Html::helpHeader(__('Simplified interface'), '', $_SESSION["glpiname"]);
} else {
Html::header(__('Simplified interface'), '', $_SESSION["glpiname"], "helpdesk", "tracking");
}
}
if (isset($_POST["my_items"]) && !empty($_POST["my_items"])) {
$splitter = explode("_", $_POST["my_items"]);
if (count($splitter) == 2) {
$_POST["itemtype"] = $splitter[0];
$_POST["items_id"] = $splitter[1];
}
}
if (!isset($_POST["itemtype"]) || empty($_POST["items_id"]) && $_POST["itemtype"] != 0) {
示例9: getSearchOptions
function getSearchOptions()
{
$tab = array();
$tab += $this->getSearchOptionsMain();
$tab[63]['table'] = 'glpi_items_problems';
$tab[63]['field'] = 'id';
$tab[63]['name'] = _x('quantity', 'Number of items');
$tab[63]['forcegroupby'] = true;
$tab[63]['usehaving'] = true;
$tab[63]['datatype'] = 'count';
$tab[63]['massiveaction'] = false;
$tab[63]['joinparams'] = array('jointype' => 'child');
$tab[13]['table'] = 'glpi_items_problems';
$tab[13]['field'] = 'items_id';
$tab[13]['name'] = _n('Associated element', 'Associated elements', Session::getPluralNumber());
$tab[13]['datatype'] = 'specific';
$tab[13]['comments'] = true;
$tab[13]['nosort'] = true;
$tab[13]['nosearch'] = true;
$tab[13]['additionalfields'] = array('itemtype');
$tab[13]['joinparams'] = array('jointype' => 'child');
$tab[13]['forcegroupby'] = true;
$tab[13]['massiveaction'] = false;
$tab[131]['table'] = 'glpi_items_problems';
$tab[131]['field'] = 'itemtype';
$tab[131]['name'] = _n('Associated item type', 'Associated item types', Session::getPluralNumber());
$tab[131]['datatype'] = 'itemtypename';
$tab[131]['itemtype_list'] = 'ticket_types';
$tab[131]['nosort'] = true;
$tab[131]['additionalfields'] = array('itemtype');
$tab[131]['joinparams'] = array('jointype' => 'child');
$tab[131]['forcegroupby'] = true;
$tab[131]['massiveaction'] = false;
$tab += $this->getSearchOptionsActors();
$tab['analysis'] = __('Analysis');
$tab[60]['table'] = $this->getTable();
$tab[60]['field'] = 'impactcontent';
$tab[60]['name'] = __('Impacts');
$tab[60]['massiveaction'] = false;
$tab[60]['datatype'] = 'text';
$tab[61]['table'] = $this->getTable();
$tab[61]['field'] = 'causecontent';
$tab[61]['name'] = __('Causes');
$tab[61]['massiveaction'] = false;
$tab[61]['datatype'] = 'text';
$tab[62]['table'] = $this->getTable();
$tab[62]['field'] = 'symptomcontent';
$tab[62]['name'] = __('Symptoms');
$tab[62]['massiveaction'] = false;
$tab[62]['datatype'] = 'text';
$tab += Notepad::getSearchOptionsToAdd();
$tab += ProblemTask::getSearchOptionsToAdd();
$tab += $this->getSearchOptionsSolution();
$tab += $this->getSearchOptionsStats();
$tab += ProblemCost::getSearchOptionsToAdd();
$tab['ticket'] = Ticket::getTypeName(Session::getPluralNumber());
$tab[141]['table'] = 'glpi_problems_tickets';
$tab[141]['field'] = 'id';
$tab[141]['name'] = _x('quantity', 'Number of tickets');
$tab[141]['forcegroupby'] = true;
$tab[141]['usehaving'] = true;
$tab[141]['datatype'] = 'count';
$tab[141]['massiveaction'] = false;
$tab[141]['joinparams'] = array('jointype' => 'child');
return $tab;
}
示例10: showForTicket
/**
* Print the ticket costs
*
* @param $ticket Ticket object
* @param $withtemplate boolean Template or basic item (default '')
*
* @return Nothing (call to classes members)
**/
static function showForTicket(Ticket $ticket, $withtemplate = '')
{
global $DB, $CFG_GLPI;
$ID = $ticket->fields['id'];
if (!$ticket->getFromDB($ID) || !$ticket->can($ID, "r") || !Session::haveRight('ticketcost', 'r')) {
return false;
}
$canedit = Session::haveRight('ticketcost', 'w');
echo "<div class='center'>";
$query = "SELECT *\n FROM `glpi_ticketcosts`\n WHERE `tickets_id` = '{$ID}'\n ORDER BY `begin_date`";
$rand = mt_rand();
if ($canedit) {
echo "<div id='viewcost" . $ID . "_{$rand}'></div>\n";
echo "<script type='text/javascript' >\n";
echo "function viewAddCost" . $ID . "_{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $ID, 'id' => -1);
Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo "};";
echo "</script>\n";
echo "<div class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddCost" . $ID . "_{$rand}();'>";
echo __('Add a new cost') . "</a></div>\n";
}
if ($result = $DB->query($query)) {
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='7'>" . self::getTypeName($DB->numrows($result)) . "</th>";
echo "<th>" . __('Ticket duration') . "</th>";
echo "<th>" . CommonITILObject::getActionTime($ticket->fields['actiontime']) . "</th>";
echo "</tr>";
if ($DB->numrows($result)) {
echo "<tr><th>" . __('Name') . "</th>";
echo "<th>" . __('Begin date') . "</th>";
echo "<th>" . __('End date') . "</th>";
echo "<th>" . __('Budget') . "</th>";
echo "<th>" . __('Duration') . "</th>";
echo "<th>" . __('Time cost') . "</th>";
echo "<th>" . __('Fixed cost') . "</th>";
echo "<th>" . __('Material cost') . "</th>";
echo "<th>" . __('Total cost') . "</th>";
echo "</tr>";
Session::initNavigateListItems(__CLASS__, sprintf(__('%1$s = %2$s'), Ticket::getTypeName(1), $ticket->getName()));
$total = 0;
$total_time = 0;
$total_costtime = 0;
$total_fixed = 0;
$total_material = 0;
while ($data = $DB->fetch_assoc($result)) {
echo "<tr class='tab_bg_2' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditCost" . $data['tickets_id'] . "_" . $data['id'] . "_{$rand}();\"" : '') . ">";
$name = empty($data['name']) ? sprintf(__('%1$s (%2$s)'), $data['name'], $data['id']) : $data['name'];
echo "<td>";
printf(__('%1$s %2$s'), $name, Html::showToolTip($data['comment'], array('display' => false)));
if ($canedit) {
echo "\n<script type='text/javascript' >\n";
echo "function viewEditCost" . $data['tickets_id'] . "_" . $data["id"] . "_{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $data["tickets_id"], 'id' => $data["id"]);
Ajax::updateItemJsCode("viewcost" . $ID . "_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo "};";
echo "</script>\n";
}
echo "</td>";
echo "<td>" . Html::convDate($data['begin_date']) . "</td>";
echo "<td>" . Html::convDate($data['end_date']) . "</td>";
echo "<td>" . Dropdown::getDropdownName('glpi_budgets', $data['budgets_id']) . "</td>";
echo "<td>" . CommonITILObject::getActionTime($data['actiontime']) . "</td>";
$total_time += $data['actiontime'];
echo "<td class='numeric'>" . Html::formatNumber($data['cost_time']) . "</td>";
$total_costtime += $data['actiontime'] * $data['cost_time'] / HOUR_TIMESTAMP;
echo "<td class='numeric'>" . Html::formatNumber($data['cost_fixed']) . "</td>";
$total_fixed += $data['cost_fixed'];
echo "<td class='numeric'>" . Html::formatNumber($data['cost_material']) . "</td>";
$total_material += $data['cost_material'];
$cost = self::computeTotalCost($data['actiontime'], $data['cost_time'], $data['cost_fixed'], $data['cost_material']);
echo "<td class='numeric'>" . Html::formatNumber($cost) . "</td>";
$total += $cost;
echo "</tr>";
Session::addToNavigateListItems(__CLASS__, $data['id']);
}
echo "<tr class='b'><td colspan='4' class='right'>" . __('Total') . '</td>';
echo "<td>" . CommonITILObject::getActionTime($total_time) . "</td>";
echo "<td class='numeric'>" . Html::formatNumber($total_costtime) . "</td>";
echo "<td class='numeric'>" . Html::formatNumber($total_fixed) . '</td>';
echo "<td class='numeric'>" . Html::formatNumber($total_material) . '</td>';
echo "<td class='numeric'>" . Html::formatNumber($total) . '</td></tr>';
} else {
echo "<tr><th colspan='9'>" . __('No item found') . "</th></tr>";
}
echo "</table>";
}
echo "</div><br>";
}
示例11: Ticket
// IRMA, Information Resource-Management and Administration
// Christian Bauer
/** @file
* @brief
*/
include '../inc/includes.php';
if (empty($_POST["_type"]) || $_POST["_type"] != "Helpdesk" || !$CFG_GLPI["use_anonymous_helpdesk"]) {
Session::checkRight("create_ticket", "1");
}
$track = new Ticket();
// Security check
if (empty($_POST) || count($_POST) == 0) {
Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
}
if (isset($_POST["_type"]) && $_POST["_type"] == "Helpdesk") {
Html::nullHeader(Ticket::getTypeName(2));
} else {
if ($_POST["_from_helpdesk"]) {
Html::helpHeader(__('Simplified interface'), '', $_SESSION["glpiname"]);
} else {
Html::header(__('Simplified interface'), '', $_SESSION["glpiname"], "maintain", "tracking");
}
}
if (isset($_POST["_my_items"]) && !empty($_POST["_my_items"])) {
$splitter = explode("_", $_POST["_my_items"]);
if (count($splitter) == 2) {
$_POST["itemtype"] = $splitter[0];
$_POST["items_id"] = $splitter[1];
}
}
if (!isset($_POST["itemtype"]) || empty($_POST["items_id"]) && $_POST["itemtype"] != 0) {
示例12: showForTicket
/**
* Show changes for a ticket
*
* @param $ticket Ticket object
**/
static function showForTicket(Ticket $ticket)
{
global $DB, $CFG_GLPI;
$ID = $ticket->getField('id');
if (!$ticket->can($ID, 'r')) {
return false;
}
$canedit = $ticket->can($ID, 'w');
$rand = mt_rand();
echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
$query = "SELECT DISTINCT `glpi_changes_tickets`.`id` AS linkID,\n `glpi_changes`.*\n FROM `glpi_changes_tickets`\n LEFT JOIN `glpi_changes`\n ON (`glpi_changes_tickets`.`changes_id` = `glpi_changes`.`id`)\n WHERE `glpi_changes_tickets`.`tickets_id` = '{$ID}'\n ORDER BY `glpi_changes`.`name`";
$result = $DB->query($query);
$changes = array();
$used = array();
if ($numrows = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$changes[$data['id']] = $data;
$used[$data['id']] = $data['id'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='changeproblem_form{$rand}' id='changeproblem_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='3'>" . __('Add a change') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>";
echo "<input type='hidden' name='tickets_id' value='{$ID}'>";
Change::dropdown(array('used' => $used, 'entity' => $ticket->getEntityID()));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td><td>";
echo "<a href='" . Toolbox::getItemTypeFormURL('Change') . "?tickets_id={$ID}'>";
_e('Create a change from this ticket');
echo "</a>";
echo "</td></tr></table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $numrows) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $numrows);
Html::showMassiveActions(__CLASS__, $massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr>";
if ($canedit && $numrows) {
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
}
echo "<th>" . __('Title') . "</th>";
echo "</tr>";
$used = array();
if ($numrows) {
Session::initNavigateListItems('Change', sprintf(__('%1$s = %2$s'), Ticket::getTypeName(1), $ticket->fields["name"]));
foreach ($changes as $data) {
$used[$data['id']] = $data['id'];
Session::addToNavigateListItems('Change', $data["id"]);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
echo "</td>";
}
echo "<td><a href='" . Toolbox::getItemTypeFormURL('Change') . "?id=" . $data['id'] . "'>" . $data["name"] . "</a></td>";
echo "</tr>";
}
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions(__CLASS__, $massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例13: getAlreadyPlannedInformation
/**
* Display a Planning Item
*
* @param $val Array of the item to display
*
* @return Already planned information
**/
static function getAlreadyPlannedInformation($val)
{
global $CFG_GLPI;
$out = Ticket::getTypeName() . ' : ' . convDateTime($val["begin"]) . ' -> ' . convDateTime($val["end"]) . ' : ';
$out .= "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . $val["tickets_id"] . "'>";
$out .= resume_text($val["name"], 80) . '</a>';
return $out;
}