本文整理汇总了PHP中Change::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP Change::getID方法的具体用法?PHP Change::getID怎么用?PHP Change::getID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Change
的用法示例。
在下文中一共展示了Change::getID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForChange
/**
* Show tickets 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();
$query = "SELECT DISTINCT `glpi_changes_tickets`.`id` AS linkID,\n `glpi_tickets`.*\n FROM `glpi_changes_tickets`\n LEFT JOIN `glpi_tickets`\n ON (`glpi_changes_tickets`.`tickets_id` = `glpi_tickets`.`id`)\n WHERE `glpi_changes_tickets`.`changes_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='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='2'>" . __('Add a ticket') . "</th></tr>";
echo "<tr class='tab_bg_2'><td class='right'>";
echo "<input type='hidden' name='changes_id' value='{$ID}'>";
Ticket::dropdown(array('used' => $used, 'entity' => $change->getEntityID(), 'entity_sons' => $change->isRecursive()));
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, 'specific_actions' => array('purge' => _x('button', 'Delete permanently'), __CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'solveticket' => __('Solve tickets')), 'container' => 'mass' . __CLASS__ . $rand, 'extraparams' => array('changes_id' => $change->getID()), 'width' => 1000, 'height' => 500);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='noHover'><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'), Change::getTypeName(1), $change->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++;
}
Ticket::commonListHeader(Search::HTML_OUTPUT, 'mass' . __CLASS__ . $rand);
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}