本文整理汇总了PHP中Problem::getTypeName方法的典型用法代码示例。如果您正苦于以下问题:PHP Problem::getTypeName方法的具体用法?PHP Problem::getTypeName怎么用?PHP Problem::getTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Problem
的用法示例。
在下文中一共展示了Problem::getTypeName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
switch ($item->getType()) {
case 'Problem':
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countElementsInTable('glpi_items_problems', "`problems_id` = '" . $item->getID() . "'");
}
return self::createTabEntry(_n('Item', 'Items', Session::getPluralNumber()), $nb);
case 'User':
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countDistinctElementsInTable('glpi_problems_users', 'problems_id', "`users_id` = '" . $item->getID() . "'");
}
return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
case 'Group':
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countDistinctElementsInTable('glpi_groups_problems', 'problems_id', "`groups_id` = '" . $item->getID() . "'");
}
return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
case 'Supplier':
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
$nb = countDistinctElementsInTable('glpi_problems_suppliers', 'problems_id', "`suppliers_id` = '" . $item->getID() . "'");
}
return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
default:
if (Session::haveRight("problem", Problem::READALL)) {
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
// Direct one
$nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'");
// Linked items
$linkeditems = $item->getLinkedItems();
if (count($linkeditems)) {
foreach ($linkeditems as $type => $tab) {
foreach ($tab as $ID) {
$nb += countElementsInTable('glpi_items_problems', " `itemtype` = '{$type}'\n AND `items_id` = '{$ID}'");
}
}
}
}
return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
}
}
}
return '';
}
示例2: Problem_User
$problem_user = new Problem_User();
$problem_user->check($_POST['id'], 'd');
$problem_user->delete($_POST);
Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']);
} else {
if (isset($_POST['delete_group'])) {
$group_problem = new Group_Problem();
$group_problem->check($_POST['id'], 'd');
$group_problem->delete($_POST);
Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']);
} else {
if (isset($_POST['delete_supplier'])) {
$problem_supplier = new Problem_Supplier();
$problem_supplier->check($_POST['id'], 'd');
$problem_supplier->delete($_POST);
Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s deletes an actor'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']);
} else {
Html::header(Problem::getTypeName(2), $_SERVER['PHP_SELF'], "maintain", "problem");
$problem->showForm($_GET["id"], $_GET);
Html::footer();
}
}
}
}
}
}
}
}
示例3: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
switch ($item->getType()) {
case 'Problem':
return _n('Item', 'Items', 2);
default:
if (Session::haveRight("show_all_problem", "1")) {
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
// Direct one
$nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'");
// Linked items
$linkeditems = $item->getLinkedItems();
if (count($linkeditems)) {
foreach ($linkeditems as $type => $tab) {
foreach ($tab as $ID) {
$nb += countElementsInTable('glpi_items_problems', " `itemtype` = '{$type}'\n AND `items_id` = '{$ID}'");
}
}
}
}
return self::createTabEntry(Problem::getTypeName(2), $nb);
}
}
}
return '';
}
示例4: getSearchOptions
//.........这里部分代码省略.........
$tab[95]['field'] = 'name';
$tab[95]['linkfield'] = 'users_id_tech';
$tab[95]['name'] = __('Technician');
$tab[95]['datatype'] = 'itemlink';
$tab[95]['right'] = 'own_ticket';
$tab[95]['forcegroupby'] = true;
$tab[95]['massiveaction'] = false;
$tab[95]['joinparams'] = array('beforejoin' => array('table' => 'glpi_tickettasks', 'joinparams' => array('jointype' => 'child')));
$tab[96]['table'] = 'glpi_tickettasks';
$tab[96]['field'] = 'actiontime';
$tab[96]['name'] = __('Duration');
$tab[96]['datatype'] = 'timestamp';
$tab[96]['massiveaction'] = false;
$tab[96]['joinparams'] = array('jointype' => 'child');
$tab[97]['table'] = 'glpi_tickettasks';
$tab[97]['field'] = 'date';
$tab[97]['name'] = __('Date');
$tab[97]['datatype'] = 'datetime';
$tab[97]['massiveaction'] = false;
$tab[97]['joinparams'] = array('jointype' => 'child');
$tab['solution'] = _n('Solution', 'Solutions', 1);
$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['cost'] = __('Cost');
$tab[48]['table'] = 'glpi_ticketcosts';
$tab[48]['field'] = 'totalcost';
$tab[48]['name'] = __('Total cost');
$tab[48]['datatype'] = 'decimal';
$tab[48]['forcegroupby'] = true;
$tab[48]['usehaving'] = true;
$tab[48]['massiveaction'] = false;
$tab[48]['joinparams'] = array('jointype' => 'child');
$tab[42]['table'] = 'glpi_ticketcosts';
$tab[42]['field'] = 'cost_time';
$tab[42]['name'] = __('Time cost');
$tab[42]['datatype'] = 'decimal';
$tab[42]['forcegroupby'] = true;
$tab[42]['massiveaction'] = false;
$tab[42]['joinparams'] = array('jointype' => 'child');
$tab[49]['table'] = 'glpi_ticketcosts';
$tab[49]['field'] = 'actiontime';
$tab[49]['name'] = sprintf(__('%1$s - %2$s'), __('Cost'), __('Duration'));
$tab[49]['datatype'] = 'timestamp';
$tab[49]['forcegroupby'] = true;
$tab[49]['massiveaction'] = false;
$tab[49]['joinparams'] = array('jointype' => 'child');
$tab[43]['table'] = 'glpi_ticketcosts';
$tab[43]['field'] = 'cost_fixed';
$tab[43]['name'] = __('Fixed cost');
$tab[43]['datatype'] = 'decimal';
$tab[43]['forcegroupby'] = true;
$tab[43]['massiveaction'] = false;
$tab[43]['joinparams'] = array('jointype' => 'child');
$tab[44]['table'] = 'glpi_ticketcosts';
$tab[44]['field'] = 'cost_material';
$tab[44]['name'] = __('Material cost');
$tab[44]['datatype'] = 'decimal';
$tab[44]['forcegroupby'] = true;
$tab[44]['massiveaction'] = false;
$tab[44]['joinparams'] = array('jointype' => 'child');
$tab['problem'] = Problem::getTypeName(2);
$tab[141]['table'] = 'glpi_problems_tickets';
$tab[141]['field'] = 'count';
$tab[141]['name'] = __('Number of problems');
$tab[141]['forcegroupby'] = true;
$tab[141]['usehaving'] = true;
$tab[141]['datatype'] = 'number';
$tab[141]['massiveaction'] = false;
$tab[141]['joinparams'] = array('jointype' => 'child');
}
// Filter search fields for helpdesk
if (!Session::isCron() && (!isset($_SESSION['glpiactiveprofile']['interface']) || $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk')) {
$tokeep = array('common', 'requester');
if (Session::haveRight('validate_request', 1) || Session::haveRight('validate_incident', 1) || Session::haveRight('create_incident_validation', 1) || Session::haveRight('create_request_validation', 1)) {
$tokeep[] = 'validation';
}
$keep = false;
foreach ($tab as $key => $val) {
if (!is_array($val)) {
$keep = in_array($key, $tokeep);
}
if (!$keep) {
if (is_array($val)) {
$tab[$key]['nosearch'] = true;
}
}
}
// last updater no search
$tab[64]['nosearch'] = true;
}
return $tab;
}
示例5: getSearchOptions
//.........这里部分代码省略.........
$tab[27]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition);
$tab[29]['table'] = 'glpi_requesttypes';
$tab[29]['field'] = 'name';
$tab[29]['name'] = __('Request source');
$tab[29]['datatype'] = 'dropdown';
$tab[29]['forcegroupby'] = true;
$tab[29]['massiveaction'] = false;
$tab[29]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition)));
$tab[91]['table'] = 'glpi_ticketfollowups';
$tab[91]['field'] = 'is_private';
$tab[91]['name'] = __('Private followup');
$tab[91]['datatype'] = 'bool';
$tab[91]['forcegroupby'] = true;
$tab[91]['splititems'] = true;
$tab[91]['massiveaction'] = false;
$tab[91]['joinparams'] = array('jointype' => 'child', 'condition' => $followup_condition);
$tab[93]['table'] = 'glpi_users';
$tab[93]['field'] = 'name';
$tab[93]['name'] = __('Writer');
$tab[93]['datatype'] = 'itemlink';
$tab[93]['right'] = 'all';
$tab[93]['forcegroupby'] = true;
$tab[93]['massiveaction'] = false;
$tab[93]['joinparams'] = array('beforejoin' => array('table' => 'glpi_ticketfollowups', 'joinparams' => array('jointype' => 'child', 'condition' => $followup_condition)));
$tab += $this->getSearchOptionsStats();
$tab[150]['table'] = $this->getTable();
$tab[150]['field'] = 'takeintoaccount_delay_stat';
$tab[150]['name'] = __('Take into account time');
$tab[150]['datatype'] = 'timestamp';
$tab[150]['forcegroupby'] = true;
$tab[150]['massiveaction'] = false;
if (Session::haveRightsOr(self::$rightname, array(self::READALL, self::READASSIGN, self::OWN))) {
$tab['linktickets'] = _n('Linked ticket', 'Linked tickets', Session::getPluralNumber());
$tab[40]['table'] = 'glpi_tickets_tickets';
$tab[40]['field'] = 'tickets_id_1';
$tab[40]['name'] = __('All linked tickets');
$tab[40]['massiveaction'] = false;
$tab[40]['forcegroupby'] = true;
$tab[40]['searchtype'] = 'equals';
$tab[40]['joinparams'] = array('jointype' => 'item_item');
$tab[40]['additionalfields'] = array('tickets_id_2');
$tab[47]['table'] = 'glpi_tickets_tickets';
$tab[47]['field'] = 'tickets_id_1';
$tab[47]['name'] = __('Duplicated tickets');
$tab[47]['massiveaction'] = false;
$tab[47]['searchtype'] = 'equals';
$tab[47]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH);
$tab[47]['additionalfields'] = array('tickets_id_2');
$tab[47]['forcegroupby'] = true;
$tab[41]['table'] = 'glpi_tickets_tickets';
$tab[41]['field'] = 'id';
$tab[41]['name'] = __('Number of all linked tickets');
$tab[41]['massiveaction'] = false;
$tab[41]['datatype'] = 'count';
$tab[41]['usehaving'] = true;
$tab[41]['joinparams'] = array('jointype' => 'item_item');
$tab[46]['table'] = 'glpi_tickets_tickets';
$tab[46]['field'] = 'id';
$tab[46]['name'] = __('Number of duplicated tickets');
$tab[46]['massiveaction'] = false;
$tab[46]['datatype'] = 'count';
$tab[46]['usehaving'] = true;
$tab[46]['joinparams'] = array('jointype' => 'item_item', 'condition' => "AND NEWTABLE.`link` = " . Ticket_Ticket::DUPLICATE_WITH);
$tab += TicketTask::getSearchOptionsToAdd();
$tab += $this->getSearchOptionsSolution();
if (Session::haveRight('ticketcost', READ)) {
$tab += TicketCost::getSearchOptionsToAdd();
}
$tab['problem'] = Problem::getTypeName(Session::getPluralNumber());
$tab[141]['table'] = 'glpi_problems_tickets';
$tab[141]['field'] = 'id';
$tab[141]['name'] = _x('quantity', 'Number of problems');
$tab[141]['forcegroupby'] = true;
$tab[141]['usehaving'] = true;
$tab[141]['datatype'] = 'count';
$tab[141]['massiveaction'] = false;
$tab[141]['joinparams'] = array('jointype' => 'child');
}
// Filter search fields for helpdesk
if (!Session::isCron() && (!isset($_SESSION['glpiactiveprofile']['interface']) || $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk')) {
$tokeep = array('common', 'requester', 'satisfaction');
if (Session::haveRightsOr('ticketvalidation', array_merge(TicketValidation::getValidateRights(), TicketValidation::getCreateRights()))) {
$tokeep[] = 'validation';
}
$keep = false;
foreach ($tab as $key => $val) {
if (!is_array($val)) {
$keep = in_array($key, $tokeep);
}
if (!$keep) {
if (is_array($val)) {
$tab[$key]['nosearch'] = true;
}
}
}
// last updater no search
$tab[64]['nosearch'] = true;
}
return $tab;
}
示例6: showForProblem
/**
* Show tickets for a problem
*
* @param $problem Problem object
**/
static function showForProblem(Problem $problem)
{
global $DB, $CFG_GLPI;
$ID = $problem->getField('id');
if (!$problem->can($ID, 'r')) {
return false;
}
$canedit = $problem->can($ID, 'w');
$rand = mt_rand();
$showentities = Session::isMultiEntitiesMode();
$query = "SELECT DISTINCT `glpi_changes_problems`.`id` AS linkID,\n `glpi_changes`.*\n FROM `glpi_changes_problems`\n LEFT JOIN `glpi_changes`\n ON (`glpi_changes_problems`.`changes_id` = `glpi_changes`.`id`)\n WHERE `glpi_changes_problems`.`problems_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='problems_id' value='{$ID}'>";
Change::dropdown(array('used' => $used, 'entity' => $problem->getEntityID(), 'entity_sons' => $problem->isRecursive()));
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') . "?problems_id={$ID}'>";
_e('Create a change from this problem');
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>" . _n('Change', 'Changes', 2);
echo "</th>";
if ($showentities) {
echo "<th>" . __('Entity') . "</th>";
}
echo "</tr>";
$used = array();
if ($numrows) {
Session::initNavigateListItems('Change', sprintf(__('%1$s = %2$s'), Problem::getTypeName(1), $problem->fields["name"]));
foreach ($changes as $data) {
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>";
if ($showentities) {
echo "<td>" . Dropdown::getDropdownName('glpi_entities', $data["entities_id"]) . "</td>";
}
echo "</tr>";
}
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions(__CLASS__, $massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例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("problem", Problem::READALL) || !$ticket->can($ID, READ)) {
return false;
}
$canedit = $ticket->can($ID, UPDATE);
$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, 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='noHover'><th colspan='12'>" . 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'], array('row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID']));
$i++;
}
Problem::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例8: Copyright
Copyright (C) 2003-2013 by the INDEPNET Development Team.
http://indepnet.net/ http://glpi-project.org
-------------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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::checkSeveralRightsOr(array('show_all_problem' => '1', 'show_my_problem' => '1'));
Html::header(Problem::getTypeName(2), '', "maintain", "problem");
Search::show('Problem');
Html::footer();
示例9: sprintf
Event::log($_POST["id"], "problem", 4, "maintain", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
$problem->redirectToList();
} else {
if (isset($_POST["update"])) {
$problem->check($_POST["id"], UPDATE);
$problem->update($_POST);
Event::log($_POST["id"], "problem", 4, "maintain", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
// Copy solution to KB redirect to KB
if (isset($_POST['_sol_to_kb']) && $_POST['_sol_to_kb']) {
Html::redirect($CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?id=new&item_itemtype=Problem&item_items_id=" . $_POST["id"]);
} else {
Html::back();
}
} else {
if (isset($_POST['addme_assign'])) {
$problem_user = new Problem_User();
$problem->check($_POST['problems_id'], READ);
$input = array('problems_id' => $_POST['problems_id'], 'users_id' => Session::getLoginUserID(), 'use_notification' => 1, 'type' => CommonITILActor::ASSIGN);
$problem_user->add($input);
Event::log($_POST['problems_id'], "problem", 4, "maintain", sprintf(__('%s adds an actor'), $_SESSION["glpiname"]));
Html::redirect($CFG_GLPI["root_doc"] . "/front/problem.form.php?id=" . $_POST['problems_id']);
} else {
Html::header(Problem::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "helpdesk", "problem");
$problem->display($_GET);
Html::footer();
}
}
}
}
}
}
示例10: Copyright
based on GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2003-2014 by the INDEPNET Development Team.
-------------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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::checkRightsOr('problem', array(Problem::READALL, Problem::READMY));
Html::header(Problem::getTypeName(Session::getPluralNumber()), '', "helpdesk", "problem");
Search::show('Problem');
Html::footer();
示例11: showForChange
/**
* Show problems for a change
*
* @param $change Change object
**/
static function showForChange(Change $change)
{
global $DB, $CFG_GLPI;
$ID = $change->getField('id');
if (!$change->can($ID, READ)) {
return false;
}
$canedit = $change->canEdit($ID);
$rand = mt_rand();
$showentities = Session::isMultiEntitiesMode();
$query = "SELECT DISTINCT `glpi_changes_problems`.`id` AS linkID,\n `glpi_problems`.*\n FROM `glpi_changes_problems`\n LEFT JOIN `glpi_problems`\n ON (`glpi_changes_problems`.`problems_id` = `glpi_problems`.`id`)\n WHERE `glpi_changes_problems`.`changes_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='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='2'>" . __('Add a problem') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>";
echo "<input type='hidden' name='changes_id' value='{$ID}'>";
Problem::dropdown(array('used' => $used, 'entity' => $change->getEntityID()));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
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 table-striped table-hover'>";
echo "<tr class='noHover'><th colspan='12'>" . Problem::getTypeName($numrows) . "</th>";
echo "</tr>";
if ($numrows) {
Problem::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
Session::initNavigateListItems('Problem', sprintf(__('%1$s = %2$s'), Change::getTypeName(1), $change->fields["name"]));
$i = 0;
foreach ($problems as $data) {
Session::addToNavigateListItems('Problem', $data["id"]);
Problem::showShort($data['id'], array('row_num' => $i, 'type_for_massiveaction' => __CLASS__, 'id_for_massiveaction' => $data['linkID']));
$i++;
}
Problem::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例12: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
switch ($item->getType()) {
case 'Problem':
return _n('Item', 'Items', 2);
default:
if (Session::haveRight("show_all_problem", "1")) {
$nb = 0;
if ($_SESSION['glpishow_count_on_tabs']) {
// Direct one
$nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'");
// Linked items
if ($subquery = $item->getSelectLinkedItem()) {
$nb += countElementsInTable('glpi_items_problems', " (`itemtype`,`items_id`) IN (" . $subquery . ")");
}
}
return self::createTabEntry(Problem::getTypeName(2), $nb);
}
}
}
return '';
}