本文整理汇总了PHP中Html::timestampToString方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::timestampToString方法的具体用法?PHP Html::timestampToString怎么用?PHP Html::timestampToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::timestampToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayTotal
function displayTotal($output_type)
{
if ($this->export_timestamp) {
return $this->total;
}
return Html::timestampToString($this->total, $this->withsec);
}
示例2: pdfForTicket
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $job, $private)
{
global $CFG_GLPI, $DB;
$ID = $job->getField('id');
//////////////Tasks///////////
$RESTRICT = "";
if (!$private) {
// Don't show private'
$RESTRICT = " AND `is_private` = '0' ";
} else {
if (!Session::haveRight("show_full_ticket", "1")) {
// No right, only show connected user private one
$RESTRICT = " AND (`is_private` = '0'\n OR `users_id` ='" . Session::getLoginUserID() . "' ) ";
}
}
$query = "SELECT *\n FROM `glpi_tickettasks`\n WHERE `tickets_id` = '{$ID}'\n {$RESTRICT}\n ORDER BY `date` DESC";
$result = $DB->query($query);
if (!$DB->numrows($result)) {
$pdf->setColumnsSize(100);
$pdf->displayLine(__('No task found.'));
} else {
$pdf->displayTitle("<b>" . TicketTask::getTypeName($DB->numrows($result) . "</b>"));
$pdf->setColumnsSize(20, 20, 20, 20, 20);
$pdf->displayTitle("<b><i>" . __('Type') . "</i></b>", "<b><i>" . __('Date') . "</i></b>", "<b><i>" . __('Duration') . "</i></b>", "<b><i>" . __('Writer') . "</i></b>", "<b><i>" . __('Planning') . "</i></b>");
while ($data = $DB->fetch_array($result)) {
$actiontime = Html::timestampToString($data['actiontime'], false);
$planification = '';
if (empty($data['begin'])) {
if (isset($data["state"])) {
$planification = Planning::getState($data["state"]) . "<br>";
}
$planification .= _e('None');
} else {
if (isset($data["state"])) {
$planification = sprintf(__('%1$s: %2$s'), _x('item', 'State'), Planning::getState($data["state"]));
}
$planificiation = sprintf(__('%1$s - %2$s'), $planification, Html::convDateTime($data["begin"]) . " -> " . Html::convDateTime($data["end"]));
$planificiation = sprintf(__('%1$s - %2$s'), $planification, sprintf(__('%1$s %2$s'), __('By'), getUserName($data["users_id_tech"])));
}
if ($data['taskcategories_id']) {
$lib = Dropdown::getDropdownName('glpi_taskcategories', $data['taskcategories_id']);
} else {
$lib = '';
}
if ($data['is_private']) {
$lib = sprintf(__('%1$s (%2$s)'), $lib, __('Private'));
}
toolbox::logdebug("lib", $data);
$pdf->displayLine(Html::clean($lib), Html::convDateTime($data["date"]), Html::timestampToString($data["actiontime"], 0), Html::clean(getUserName($data["users_id"])), Html::clean($planification), 1);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Description') . "</i></b>", Html::clean($data["content"]), 1));
}
}
$pdf->displaySpace();
}
示例3: getDatasForTemplate
/**
* @param $event
* @param $options array
**/
function getDatasForTemplate($event, $options = array())
{
if ($options['diff'] > 1000000000) {
$tmp = __("Can't connect to the database.");
} else {
$tmp = Html::timestampToString($options['diff'], true);
}
$this->datas['##dbconnection.delay##'] = $tmp . " (" . $options['name'] . ")";
$this->getTags();
foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
if (!isset($this->datas[$tag])) {
$this->datas[$tag] = $values['label'];
}
}
}
示例4: getSpecificValueToDisplay
/**
* @since version 0.84
*
* @param $field
* @param $values
* @param $options array
**/
static function getSpecificValueToDisplay($field, $values, array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
switch ($field) {
case 'periodicity':
if (preg_match('/([0-9]+)MONTH/', $values[$field], $matches)) {
return sprintf(_n('%d month', '%d months', $matches[1]), $matches[1]);
}
if (preg_match('/([0-9]+)YEAR/', $values[$field], $matches)) {
return sprintf(_n('%d year', '%d years', $matches[1]), $matches[1]);
}
return Html::timestampToString($values[$field], false);
break;
}
return parent::getSpecificValueToDisplay($field, $values, $options);
}
示例5: pdfStat
static function pdfStat(PluginPdfSimplePDF $pdf, Ticket $job)
{
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . _n('Date', 'Dates', 2) . "</b>");
$pdf->setColumnsSize(50, 50);
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Opening date'), Html::convDateTime($job->fields['date'])));
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Due date'), Html::convDateTime($job->fields['due_date'])));
if (in_array($job->fields["status"], $job->getSolvedStatusArray()) || in_array($job->fields["status"], $job->getClosedStatusArray())) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Solution date'), Html::convDateTime($job->fields['solvedate'])));
}
if (in_array($job->fields["status"], $job->getClosedStatusArray())) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Closing date'), Html::convDateTime($job->fields['closedate'])));
}
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . _n('Time', 'Times', 2) . "</b>");
$pdf->setColumnsSize(50, 50);
if ($job->fields['takeintoaccount_delay_stat'] > 0) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Take into account'), Html::clean(Html::timestampToString($job->fields['takeintoaccount_delay_stat'], 0))));
}
if (in_array($job->fields["status"], $job->getSolvedStatusArray()) || in_array($job->fields["status"], $job->getClosedStatusArray())) {
if ($job->fields['solve_delay_stat'] > 0) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Solution'), Html::clean(Html::timestampToString($job->fields['solve_delay_stat'], 0))));
}
}
if (in_array($job->fields["status"], $job->getClosedStatusArray())) {
if ($job->fields['close_delay_stat'] > 0) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Closing'), Html::clean(Html::timestampToString($job->fields['close_delay_stat'], 0))));
}
}
if ($job->fields['waiting_duration'] > 0) {
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Pending'), Html::clean(Html::timestampToString($job->fields['waiting_duration'], 0))));
}
$pdf->displaySpace();
}
示例6: showForTicket
//.........这里部分代码省略.........
//
// echo "<table class='tab_cadre_fixe'>";
// echo "<tr class='tab_bg_2'><th colspan='3'>".__('Add a project task')."</th></tr>";
//
// echo "<tr class='tab_bg_2'><td class='right'>";
// echo "<input type='hidden' name='tickets_id' value='$ID'>";
// $condition = "`glpi_projecttasks`.`projectstates_id` <> 3";
// ProjectTask::dropdown(array('used' => $used,
// 'entity' => $ticket->getEntityID(),
// 'entity_sons' => $ticket->isRecursive(),
// 'condition' => $condition,
// 'displaywith' => array('id')));
// echo "</td><td width='20%'>";
// // echo "<a href='".Toolbox::getItemTypeFormURL('ProjectTask')."?tickets_id=$ID'>";
// // _e('Create a project task from this ticket');
// // 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 ($numrows) {
$columns = array('projectname' => Project::getTypeName(Session::getPluralNumber()), 'name' => ProjectTask::getTypeName(Session::getPluralNumber()), 'tname' => __('Type'), 'sname' => __('Status'), 'percent_done' => __('Percent done'), 'plan_start_date' => __('Planned start date'), 'plan_end_date' => __('Planned end date'), 'planned_duration' => __('Planned duration'), '_effect_duration' => __('Effective duration'), 'fname' => __('Father'));
if (isset($_GET["order"]) && $_GET["order"] == "DESC") {
$order = "DESC";
} else {
$order = "ASC";
}
if (!isset($_GET["sort"]) || empty($_GET["sort"])) {
$_GET["sort"] = "plan_start_date";
}
if (isset($_GET["sort"]) && !empty($_GET["sort"]) && isset($columns[$_GET["sort"]])) {
$sort = "`" . $_GET["sort"] . "`";
} else {
$sort = "`plan_start_date` {$order}, `name`";
}
$query = "SELECT `glpi_projecttasks`.*,\n `glpi_projecttasktypes`.`name` AS tname,\n `glpi_projectstates`.`name` AS sname,\n `glpi_projectstates`.`color`,\n `father`.`name` AS fname,\n `father`.`id` AS fID,\n `glpi_projects`.`name` AS projectname,\n `glpi_projects`.`content` AS projectcontent\n FROM `glpi_projecttasks`\n LEFT JOIN `glpi_projecttasktypes`\n ON (`glpi_projecttasktypes`.`id` = `glpi_projecttasks`.`projecttasktypes_id`)\n LEFT JOIN `glpi_projectstates`\n ON (`glpi_projectstates`.`id` = `glpi_projecttasks`.`projectstates_id`)\n LEFT JOIN `glpi_projecttasks` as father\n ON (`father`.`id` = `glpi_projecttasks`.`projecttasks_id`)\n LEFT JOIN `glpi_projecttasks_tickets`\n ON (`glpi_projecttasks_tickets`.`projecttasks_id` = `glpi_projecttasks`.`id`)\n LEFT JOIN `glpi_projects`\n ON (`glpi_projecttasks`.`projects_id` = `glpi_projects`.`id`)\n WHERE `glpi_projecttasks_tickets`.`tickets_id` = '{$ID}'\n ORDER BY {$sort} {$order}";
Session::initNavigateListItems('ProjectTask', sprintf(__('%1$s = %2$s'), $ticket::getTypeName(1), $ticket->getName()));
if ($result = $DB->query($query)) {
if ($DB->numrows($result)) {
echo "<table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='10'>" . ProjectTask::getTypeName($numrows) . "</th>";
echo "</tr>";
$sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
$header = '<tr>';
foreach ($columns as $key => $val) {
// Non order column
if ($key[0] == '_') {
$header .= "<th>{$val}</th>";
} else {
$header .= "<th>" . ($sort == "`{$key}`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort={$key}&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>{$val}</a></th>";
}
}
$header .= "</tr>\n";
echo $header;
while ($data = $DB->fetch_assoc($result)) {
Session::addToNavigateListItems('ProjectTask', $data['id']);
$rand = mt_rand();
echo "<tr class='tab_bg_2'>";
echo "<td>";
$link = "<a id='Project" . $data["projects_id"] . $rand . "' href='project.form.php?id=" . $data['projects_id'] . "'>" . $data['projectname'] . (empty($data['projectname']) ? "(" . $data['projects_id'] . ")" : "") . "</a>";
echo sprintf(__('%1$s %2$s'), $link, Html::showToolTip($data['projectcontent'], array('display' => false, 'applyto' => "Project" . $data["projects_id"] . $rand)));
echo "</td>";
echo "<td>";
$link = "<a id='ProjectTask" . $data["id"] . $rand . "' href='projecttask.form.php?id=" . $data['id'] . "'>" . $data['name'] . (empty($data['name']) ? "(" . $data['id'] . ")" : "") . "</a>";
echo sprintf(__('%1$s %2$s'), $link, Html::showToolTip($data['content'], array('display' => false, 'applyto' => "ProjectTask" . $data["id"] . $rand)));
echo "</td>";
echo "<td>" . $data['tname'] . "</td>";
echo "<td";
echo " style=\"background-color:" . $data['color'] . "\"";
echo ">" . $data['sname'] . "</td>";
echo "<td>";
echo Dropdown::getValueWithUnit($data["percent_done"], "%");
echo "</td>";
echo "<td>" . Html::convDateTime($data['plan_start_date']) . "</td>";
echo "<td>" . Html::convDateTime($data['plan_end_date']) . "</td>";
echo "<td>" . Html::timestampToString($data['planned_duration'], false) . "</td>";
echo "<td>" . Html::timestampToString(ProjectTask::getTotalEffectiveDuration($data['id']), false) . "</td>";
echo "<td>";
if ($data['projecttasks_id'] > 0) {
$father = Dropdown::getDropdownName('glpi_projecttasks', $data['projecttasks_id']);
echo "<a id='ProjectTask" . $data["projecttasks_id"] . $rand . "' href='projecttask.form.php?id=" . $data['projecttasks_id'] . "'>" . $father . (empty($father) ? "(" . $data['projecttasks_id'] . ")" : "") . "</a>";
}
echo "</td></tr>";
}
echo $header;
echo "</table>\n";
} else {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No item found') . "</th></tr>";
echo "</table>\n";
}
}
echo "</div>";
}
}
示例7: plugin_fusioninventory_displayMigrationMessage
function plugin_fusioninventory_displayMigrationMessage($id, $msg = "")
{
static $created = 0;
static $deb;
if ($created != $id) {
if (empty($msg)) {
$msg = __('Work in progress...');
}
echo "<div id='migration_message_{$id}'><p class='center'>{$msg}</p></div>";
$created = $id;
$deb = time();
} else {
if (empty($msg)) {
$msg = __('Task completed.');
}
$fin = time();
$tps = Html::timestampToString($fin - $deb);
echo "<script type='text/javascript'>document.getElementById('migration_message_{$id}')." . "innerHTML = '<p class=\"center\">{$msg} ({$tps})</p>';</script>\n";
}
Html::glpi_flush();
}
示例8: giveItem
//.........这里部分代码省略.........
// Force solution tab if solved
if ($item = getItemForItemtype($itemtype)) {
if (in_array($data[$num][0]['status'], $item->getSolvedStatusArray())) {
$out .= "&forcetab={$itemtype}\$2";
}
}
$out .= "\">";
$name = $data[$num][0]['name'];
if ($_SESSION["glpiis_ids_visible"] || empty($data[$num][0]['name'])) {
$name = sprintf(__('%1$s (%2$s)'), $name, $data[$num][0]['id']);
}
$out .= $name . "</a>";
$hdecode = Html::entity_decode_deep($data[$num][0]['content']);
$content = Toolbox::unclean_cross_side_scripting_deep($hdecode);
$out = sprintf(__('%1$s %2$s'), $out, Html::showToolTip(nl2br(Html::Clean($content)), array('applyto' => $itemtype . $data[$num][0]['id'], 'display' => false)));
return $out;
}
case 'glpi_ticketvalidations.status':
$out = '';
for ($k = 0; $k < $data[$num]['count']; $k++) {
if ($data[$num][$k]['name']) {
$status = TicketValidation::getStatus($data[$num][$k]['name']);
$bgcolor = TicketValidation::getStatusColor($data[$num][$k]['name']);
$out .= (empty($out) ? '' : self::LBBR) . "<div style=\"background-color:" . $bgcolor . ";\">" . $status . '</div>';
}
}
return $out;
case 'glpi_ticketsatisfactions.satisfaction':
if (self::$output_type == self::HTML_OUTPUT) {
return TicketSatisfaction::displaySatisfaction($data[$num][0]['name']);
}
break;
case 'glpi_projects._virtual_planned_duration':
return Html::timestampToString(ProjectTask::getTotalPlannedDurationForProject($data["id"]), false);
case 'glpi_projects._virtual_effective_duration':
return Html::timestampToString(ProjectTask::getTotalEffectiveDurationForProject($data["id"]), false);
case 'glpi_cartridgeitems._virtual':
return Cartridge::getCount($data["id"], $data[$num][0]['alarm_threshold'], self::$output_type != self::HTML_OUTPUT);
case 'glpi_printers._virtual':
return Cartridge::getCountForPrinter($data["id"], self::$output_type != self::HTML_OUTPUT);
case 'glpi_consumableitems._virtual':
return Consumable::getCount($data["id"], $data[$num][0]['alarm_threshold'], self::$output_type != self::HTML_OUTPUT);
case 'glpi_links._virtual':
$out = '';
$link = new Link();
if (($item = getItemForItemtype($itemtype)) && $item->getFromDB($data['id']) && $link->getfromDB($data[$num][0]['id']) && $item->fields['entities_id'] == $link->fields['entities_id']) {
if (count($data[$num])) {
$count_display = 0;
foreach ($data[$num] as $val) {
if (is_array($val)) {
$links = Link::getAllLinksFor($item, $val);
foreach ($links as $link) {
if ($count_display) {
$out .= self::LBBR;
}
$out .= $link;
$count_display++;
}
}
}
}
}
return $out;
case 'glpi_reservationitems._virtual':
if ($data[$num][0]['is_active']) {
return "<a href='reservation.php?reservationitems_id=" . $data["refID"] . "' title=\"" . __s('See planning') . "\">" . "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/reservation-3.png\" alt='' title=''></a>";
示例9: showStats
function showStats()
{
if (!$this->canUpdate() || !isset($this->fields['id'])) {
return false;
}
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . _n('Date', 'Dates', Session::getPluralNumber()) . "</th></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Opening date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields['date']) . "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Due date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields['due_date']) . "</td></tr>";
if (in_array($this->fields['status'], array_merge($this->getSolvedStatusArray(), $this->getClosedStatusArray()))) {
echo "<tr class='tab_bg_2'><td>" . __('Resolution date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields['solvedate']) . "</td></tr>";
}
if (in_array($this->fields['status'], $this->getClosedStatusArray())) {
echo "<tr class='tab_bg_2'><td>" . __('Closing date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields['closedate']) . "</td></tr>";
}
echo "<tr><th colspan='2'>" . _n('Time', 'Times', Session::getPluralNumber()) . "</th></tr>";
if (isset($this->fields['takeintoaccount_delay_stat'])) {
echo "<tr class='tab_bg_2'><td>" . __('Take into account') . "</td><td>";
if ($this->fields['takeintoaccount_delay_stat'] > 0) {
echo Html::timestampToString($this->fields['takeintoaccount_delay_stat'], 0);
} else {
echo ' ';
}
echo "</td></tr>";
}
if (in_array($this->fields['status'], array_merge($this->getSolvedStatusArray(), $this->getClosedStatusArray()))) {
echo "<tr class='tab_bg_2'><td>" . __('Resolution') . "</td><td>";
if ($this->fields['solve_delay_stat'] > 0) {
echo Html::timestampToString($this->fields['solve_delay_stat'], 0);
} else {
echo ' ';
}
echo "</td></tr>";
}
if (in_array($this->fields['status'], $this->getClosedStatusArray())) {
echo "<tr class='tab_bg_2'><td>" . __('Closure') . "</td><td>";
if ($this->fields['close_delay_stat'] > 0) {
echo Html::timestampToString($this->fields['close_delay_stat']);
} else {
echo ' ';
}
echo "</td></tr>";
}
echo "<tr class='tab_bg_2'><td>" . __('Pending') . "</td><td>";
if ($this->fields['waiting_duration'] > 0) {
echo Html::timestampToString($this->fields['waiting_duration'], 0);
} else {
echo ' ';
}
echo "</td></tr>";
echo "</table>";
echo "</div>";
}
示例10: showFor
//.........这里部分代码省略.........
$sort = "`plan_start_date` {$order}, `name`";
}
$canedit = false;
if ($item->getType() == 'Project') {
$canedit = $item->canEdit($ID);
}
switch ($item->getType()) {
case 'Project':
$where = "WHERE `glpi_projecttasks`.`projects_id` = '{$ID}'";
break;
case 'ProjectTask':
$where = "WHERE `glpi_projecttasks`.`projecttasks_id` = '{$ID}'";
break;
default:
// Not available type
return;
}
echo "<div class='spaced'>";
if ($canedit) {
echo "<div class='center firstbloc'>";
echo "<a class='vsubmit' href='projecttask.form.php?projects_id={$ID}'>" . _x('button', 'Add a task') . "</a>";
echo "</div>";
}
if ($item->getType() == 'ProjectTask' && $item->can($ID, UPDATE)) {
$rand = mt_rand();
echo "<div class='firstbloc'>";
echo "<form name='projecttask_form{$rand}' id='projecttask_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL('ProjectTask') . "'>";
$projet = $item->fields['projects_id'];
echo "<a href='" . Toolbox::getItemTypeFormURL('ProjectTask') . "?projecttasks_id={$ID}&projects_id={$projet}'>";
_e('Create a sub task from this task of project');
echo "</a>";
Html::closeForm();
echo "</div>";
}
$addselect = '';
$addjoin = '';
if (Session::haveTranslations('ProjectTaskType', 'name')) {
$addselect .= ", `namet2`.`value` AS transname2";
$addjoin .= " LEFT JOIN `glpi_dropdowntranslations` AS namet2\n ON (`namet2`.`itemtype` = 'ProjectTaskType'\n AND `namet2`.`items_id` = `glpi_projecttasks`.`projecttasktypes_id`\n AND `namet2`.`language` = '" . $_SESSION['glpilanguage'] . "'\n AND `namet2`.`field` = 'name')";
}
if (Session::haveTranslations('ProjectState', 'name')) {
$addselect .= ", `namet3`.`value` AS transname3";
$addjoin .= "LEFT JOIN `glpi_dropdowntranslations` AS namet3\n ON (`namet3`.`itemtype` = 'ProjectState'\n AND `namet3`.`language` = '" . $_SESSION['glpilanguage'] . "'\n AND `namet3`.`field` = 'name')";
$where .= " AND `namet3`.`items_id` = `glpi_projectstates`.`id` ";
}
$query = "SELECT `glpi_projecttasks`.*,\n `glpi_projecttasktypes`.`name` AS tname,\n `glpi_projectstates`.`name` AS sname,\n `glpi_projectstates`.`color`,\n `father`.`name` AS fname,\n `father`.`id` AS fID\n {$addselect}\n FROM `glpi_projecttasks`\n {$addjoin}\n LEFT JOIN `glpi_projecttasktypes`\n ON (`glpi_projecttasktypes`.`id` = `glpi_projecttasks`.`projecttasktypes_id`)\n LEFT JOIN `glpi_projectstates`\n ON (`glpi_projectstates`.`id` = `glpi_projecttasks`.`projectstates_id`)\n LEFT JOIN `glpi_projecttasks` as father\n ON (`father`.`id` = `glpi_projecttasks`.`projecttasks_id`)\n {$where}\n ORDER BY {$sort} {$order}";
Session::initNavigateListItems('ProjectTask', sprintf(__('%1$s = %2$s'), $item::getTypeName(1), $item->getName()));
if ($result = $DB->query($query)) {
if ($DB->numrows($result)) {
echo "<table class='tab_cadre_fixehov'>";
$sort_img = "<img src=\"" . $CFG_GLPI["root_doc"] . "/pics/" . ($order == "DESC" ? "puce-down.png" : "puce-up.png") . "\" alt='' title=''>";
$header = '<tr>';
foreach ($columns as $key => $val) {
// Non order column
if ($key[0] == '_') {
$header .= "<th>{$val}</th>";
} else {
$header .= "<th>" . ($sort == "`{$key}`" ? $sort_img : "") . "<a href='javascript:reloadTab(\"sort={$key}&order=" . ($order == "ASC" ? "DESC" : "ASC") . "&start=0\");'>{$val}</a></th>";
}
}
$header .= "</tr>\n";
echo $header;
while ($data = $DB->fetch_assoc($result)) {
Session::addToNavigateListItems('ProjectTask', $data['id']);
$rand = mt_rand();
echo "<tr class='tab_bg_2'>";
echo "<td>";
$link = "<a id='ProjectTask" . $data["id"] . $rand . "' href='projecttask.form.php?id=" . $data['id'] . "'>" . $data['name'] . (empty($data['name']) ? "(" . $data['id'] . ")" : "") . "</a>";
echo sprintf(__('%1$s %2$s'), $link, Html::showToolTip($data['content'], array('display' => false, 'applyto' => "ProjectTask" . $data["id"] . $rand)));
echo "</td>";
$name = !empty($data['transname2']) ? $data['transname2'] : $data['tname'];
echo "<td>" . $name . "</td>";
echo "<td";
$statename = !empty($data['transname3']) ? $data['transname3'] : $data['sname'];
echo " style=\"background-color:" . $data['color'] . "\"";
echo ">" . $statename . "</td>";
echo "<td>";
echo Dropdown::getValueWithUnit($data["percent_done"], "%");
echo "</td>";
echo "<td>" . Html::convDateTime($data['plan_start_date']) . "</td>";
echo "<td>" . Html::convDateTime($data['plan_end_date']) . "</td>";
echo "<td>" . Html::timestampToString($data['planned_duration'], false) . "</td>";
echo "<td>" . Html::timestampToString(self::getTotalEffectiveDuration($data['id']), false) . "</td>";
echo "<td>";
if ($data['projecttasks_id'] > 0) {
$father = Dropdown::getDropdownName('glpi_projecttasks', $data['projecttasks_id']);
echo "<a id='ProjectTask" . $data["projecttasks_id"] . $rand . "' href='projecttask.form.php?id=" . $data['projecttasks_id'] . "'>" . $father . (empty($father) ? "(" . $data['projecttasks_id'] . ")" : "") . "</a>";
}
echo "</td></tr>";
}
echo $header;
echo "</table>\n";
} else {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('No item found') . "</th></tr>";
echo "</table>\n";
}
}
echo "</div>";
}
示例11: showTimeline
//.........这里部分代码省略.........
$long_text = "long_text";
}
echo "<div class='item_content {$long_text}'>";
echo "<p>";
if (isset($item_i['state'])) {
$onClick = "onclick='change_task_state(" . $item_i['id'] . ", this)'";
if (!$item_i['can_edit']) {
$onClick = "style='cursor: not-allowed;'";
}
echo "<span class='state state_" . $item_i['state'] . "'\n {$onClick}\n title='" . Planning::getState($item_i['state']) . "'>";
echo "</span>";
}
echo $content;
echo "</p>";
if (!empty($long_text)) {
echo "<p class='read_more'>";
echo "<a class='read_more_button'>.....</a>";
echo "</p>";
}
echo "</div>";
}
echo "<div class='b_right'>";
if (isset($item_i['solutiontypes_id']) && !empty($item_i['solutiontypes_id'])) {
echo Dropdown::getDropdownName("glpi_solutiontypes", $item_i['solutiontypes_id']) . "<br>";
}
if (isset($item_i['taskcategories_id']) && !empty($item_i['taskcategories_id'])) {
echo Dropdown::getDropdownName("glpi_taskcategories", $item_i['taskcategories_id']) . "<br>";
}
if (isset($item_i['requesttypes_id']) && !empty($item_i['requesttypes_id'])) {
echo Dropdown::getDropdownName("glpi_requesttypes", $item_i['requesttypes_id']) . "<br>";
}
if (isset($item_i['actiontime']) && !empty($item_i['actiontime'])) {
echo "<span class='actiontime'>";
echo Html::timestampToString($item_i['actiontime'], false);
echo "</span>";
}
if (isset($item_i['begin'])) {
echo "<span class='planification'>";
echo Html::convDateTime($item_i["begin"]);
echo " ⇒ ";
echo Html::convDateTime($item_i["end"]);
echo "</span>";
}
if (isset($item_i['users_id_tech']) && $item_i['users_id_tech'] > 0) {
echo "<div class='users_id_tech' id='users_id_tech_" . $item_i['users_id_tech'] . "'>";
$user->getFromDB($item_i['users_id_tech']);
echo Html::image($CFG_GLPI['root_doc'] . "/pics/user.png") . " ";
$userdata = getUserName($item_i['users_id_tech'], 2);
echo $user->getLink() . " ";
echo Html::showToolTip($userdata["comment"], array('link' => $userdata['link']));
echo "</div>";
}
if (isset($item_i['groups_id_tech']) && $item_i['groups_id_tech'] > 0) {
echo "<div class='groups_id_tech'>";
$group->getFromDB($item_i['groups_id_tech']);
echo Html::image($CFG_GLPI['root_doc'] . "/pics/group.png") . " ";
echo $group->getLink() . " ";
echo Html::showToolTip($group->getComments(), array('link' => $group->getLinkURL()));
echo "</div>";
}
// show "is_private" icon
if (isset($item_i['is_private']) && $item_i['is_private']) {
echo "<div class='private'>" . __('Private') . "</div>";
}
echo "</div>";
// b_right
示例12: showStats
function showStats()
{
if (!Session::haveRight('observe_ticket', 1) || !isset($this->fields['id'])) {
return false;
}
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . _n('Date', 'Dates', 2) . "</th></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Opening date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields['date']) . "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Due date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields['due_date']) . "</td></tr>";
if ($this->fields['status'] == self::SOLVED || $this->fields['status'] == self::CLOSED) {
echo "<tr class='tab_bg_2'><td>" . __('Resolution date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields['solvedate']) . "</td></tr>";
}
if ($this->fields['status'] == self::CLOSED) {
echo "<tr class='tab_bg_2'><td>" . __('Closing date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields['closedate']) . "</td></tr>";
}
echo "<tr><th colspan='2'>" . _n('Time', 'Times', 2) . "</th></tr>";
if (isset($this->fields['takeintoaccount_delay_stat'])) {
echo "<tr class='tab_bg_2'><td>" . __('Take into account') . "</td><td>";
if ($this->fields['takeintoaccount_delay_stat'] > 0) {
echo Html::timestampToString($this->fields['takeintoaccount_delay_stat'], 0);
} else {
echo ' ';
}
echo "</td></tr>";
}
if ($this->fields['status'] == self::SOLVED || $this->fields['status'] == self::CLOSED) {
echo "<tr class='tab_bg_2'><td>" . __('Resolution') . "</td><td>";
if ($this->fields['solve_delay_stat'] > 0) {
echo Html::timestampToString($this->fields['solve_delay_stat'], 0);
} else {
echo ' ';
}
echo "</td></tr>";
}
if ($this->fields['status'] == self::CLOSED) {
echo "<tr class='tab_bg_2'><td>" . __('Closure') . "</td><td>";
if ($this->fields['close_delay_stat'] > 0) {
echo Html::timestampToString($this->fields['close_delay_stat']);
} else {
echo ' ';
}
echo "</td></tr>";
}
echo "<tr class='tab_bg_2'><td>" . __('Pending') . "</td><td>";
if ($this->fields['waiting_duration'] > 0) {
echo Html::timestampToString($this->fields['waiting_duration'], 0);
} else {
echo ' ';
}
echo "</td></tr>";
echo "</table>";
echo "</div>";
}
示例13: showForSLA
/**
* @param $sla SLA object
**/
function showForSLA(SLA $sla)
{
global $DB;
$ID = $sla->getField('id');
if (!$sla->can($ID, READ)) {
return false;
}
$canedit = $sla->can($ID, UPDATE);
$rand = mt_rand();
if ($canedit) {
echo "<div class='center first-bloc'>";
echo "<form name='slalevel_form{$rand}' id='slalevel_form{$rand}' method='post' action='";
echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='7'>" . __('Add an escalation level') . "</tr>";
echo "<tr class='tab_bg_2'><td class='center'>" . __('Name') . "";
echo "<input type='hidden' name='slas_id' value='{$ID}'>";
echo "<input type='hidden' name='entities_id' value='" . $sla->getEntityID() . "'>";
echo "<input type='hidden' name='is_recursive' value='" . $sla->isRecursive() . "'>";
echo "<input type='hidden' name='match' value='AND'>";
echo "</td><td><input name='name' value=''>";
echo "</td><td class='center'>" . __('Execution') . "</td><td>";
$resolution_time = $sla->getResolutionTime();
self::dropdownExecutionTime('execution_time', array('max_time' => $resolution_time, 'used' => self::getAlreadyUsedExecutionTime($sla->fields['id'])));
echo "</td><td class='center'>" . __('Active') . "</td><td>";
Dropdown::showYesNo("is_active", 1);
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>";
}
$query = "SELECT *\n FROM `glpi_slalevels`\n WHERE `slas_id` = '{$ID}'\n ORDER BY `execution_time`";
$result = $DB->query($query);
$numrows = $DB->numrows($result);
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>";
if ($canedit && $numrows) {
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
}
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Execution') . "</th>";
echo "<th>" . __('Active') . "</th>";
echo "</tr>";
Session::initNavigateListItems('SlaLevel', sprintf(__('%1$s = %2$s'), SLA::getTypeName(1), $sla->getName()));
while ($data = $DB->fetch_assoc($result)) {
Session::addToNavigateListItems('SlaLevel', $data["id"]);
echo "<tr class='tab_bg_2'>";
if ($canedit) {
echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
}
echo "<td>";
if ($canedit) {
echo "<a href='" . Toolbox::getItemTypeFormURL('SlaLevel') . "?id=" . $data["id"] . "'>";
}
echo $data["name"];
if (empty($data["name"])) {
echo "(" . $data['id'] . ")";
}
if ($canedit) {
echo "</a>";
}
echo "</td>";
echo "<td>" . ($data["execution_time"] != 0 ? Html::timestampToString($data["execution_time"], false) : __('Due date')) . "</td>";
echo "<td>" . Dropdown::getYesNo($data["is_active"]) . "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>";
$this->getRuleWithCriteriasAndActions($data['id'], 1, 1);
$this->showCriteriasList($data["id"], array('readonly' => true));
echo "</td><td colspan='2'>";
$this->showActionsList($data["id"], array('readonly' => true));
echo "</td></tr>";
}
echo "</table>";
if ($canedit && $numrows) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
}
echo "</div>";
}
示例14: showTimeline
//.........这里部分代码省略.........
if (!in_array($item['type'], array('Document_Item', 'Assign')) && $item_i['can_edit']) {
echo " ondblclick='javascript:viewEditSubitem" . $this->fields['id'] . "{$rand}(event, \"" . $item['type'] . "\", " . $item_i['id'] . ", this)'";
}
echo ">";
if (isset($item_i['requesttypes_id']) && file_exists("{$pics_url}/" . $item_i['requesttypes_id'] . ".png")) {
echo "<img src='{$pics_url}/" . $item_i['requesttypes_id'] . ".png' title='' class='h_requesttype' />";
}
if (isset($item_i['content'])) {
$content = $item_i['content'];
$content = linkUrlsInTrustedHtml($content);
//$content = nl2br($content);
$long_text = "";
if (substr_count($content, "<br") > 30 || strlen($content) > 2000) {
$long_text = "long_text";
}
echo "<div class='item_content {$long_text}'>";
echo "<p>{$content}</p>";
if (!empty($long_text)) {
echo "<p class='read_more'>";
echo "<a class='read_more_button'>.....</a>";
echo "</p>";
}
echo "</div>";
}
echo "<div class='b_right'>";
if (isset($item_i['solutiontypes_id']) && !empty($item_i['solutiontypes_id'])) {
echo Dropdown::getDropdownName("glpi_solutiontypes", $item_i['solutiontypes_id']) . "<br>";
}
if (isset($item_i['taskcategories_id']) && !empty($item_i['taskcategories_id'])) {
echo Dropdown::getDropdownName("glpi_taskcategories", $item_i['taskcategories_id']) . "<br>";
}
if (isset($item_i['actiontime']) && !empty($item_i['actiontime'])) {
echo "<span class='actiontime'>";
echo Html::timestampToString($item_i['actiontime'], false);
echo "</span>";
}
if (isset($item_i['state'])) {
echo "<span class='state state_" . $item_i['state'] . "'>";
echo Planning::getState($item_i['state']);
echo "</span>";
}
if (isset($item_i['begin'])) {
echo "<span class='planification'>";
echo Html::convDateTime($item_i["begin"]);
echo " ⇒ ";
echo Html::convDateTime($item_i["end"]);
echo "</span>";
}
if (isset($item_i['users_id_tech'])) {
echo "<div class='users_id_tech'>";
$user->getFromDB($item_i['users_id_tech']);
echo "<div class='tooltip_picture_border'>";
echo "<img class='user_picture' alt=\"" . __s('Picture') . "\" src='" . User::getThumbnailURLForPicture($user->fields['picture']) . "'>";
echo "</div>";
echo $user->getLink();
echo "</div>";
}
// show "is_private" icon
if (isset($item_i['is_private']) && $item_i['is_private']) {
echo "<div class='private'>" . __('Private') . "</div>";
}
echo "</div>";
// b_right
if ($item['type'] == 'Document_Item') {
$filename = $item_i['filename'];
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
示例15: getDatasForTemplate
/**
* @see NotificationTarget::getDatasForTemplate()
**/
function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI, $DB;
//----------- Reservation infos -------------- //
$events = $this->getAllEvents();
$item = $this->obj;
$this->datas['##projecttask.action##'] = $events[$event];
$this->datas['##projecttask.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "ProjectTask_" . $item->getField("id"));
$this->datas["##projecttask.name##"] = $item->getField('name');
$this->datas["##projecttask.project##"] = Dropdown::getDropdownName('glpi_projects', $item->getField('projects_id'));
$this->datas["##projecttask.projecturl##"] = $this->formatURL($options['additionnaloption']['usertype'], "Project_" . $item->getField("projects_id"));
$this->datas["##projecttask.description##"] = $item->getField('content');
$this->datas["##projecttask.comments##"] = $item->getField('comment');
$this->datas["##projecttask.creationdate##"] = Html::convDateTime($item->getField('date'));
$this->datas["##projecttask.lastupdatedate##"] = Html::convDateTime($item->getField('date_mod'));
$this->datas["##projecttask.percent##"] = Dropdown::getValueWithUnit($item->getField('percent_done'), "%");
$this->datas["##projecttask.planstartdate##"] = Html::convDateTime($item->getField('plan_start_date'));
$this->datas["##projecttask.planenddate##"] = Html::convDateTime($item->getField('plan_end_date'));
$this->datas["##projecttask.realstartdate##"] = Html::convDateTime($item->getField('real_start_date'));
$this->datas["##projecttask.realenddate##"] = Html::convDateTime($item->getField('real_end_date'));
$this->datas["##projecttask.plannedduration##"] = Html::timestampToString($item->getField('planned_duration'), false);
$this->datas["##projecttask.effectiveduration##"] = Html::timestampToString($item->getField('effective_duration'), false);
$ticket_duration = ProjectTask_Ticket::getTicketsTotalActionTime($item->getID());
$this->datas["##projecttask.ticketsduration##"] = Html::timestampToString($ticket_duration, false);
$this->datas["##projecttask.totalduration##"] = Html::timestampToString($ticket_duration + $item->getField('effective_duration'), false);
$entity = new Entity();
$this->datas["##projecttask.entity##"] = '';
$this->datas["##projecttask.shortentity##"] = '';
if ($entity->getFromDB($this->getEntity())) {
$this->datas["##projecttask.entity##"] = $entity->getField('completename');
$this->datas["##projecttask.shortentity##"] = $entity->getField('name');
}
$this->datas["##projecttask.father##"] = '';
if ($item->getField('projecttasks_id')) {
$this->datas["##projecttask.father##"] = Dropdown::getDropdownName('glpi_projecttasks', $item->getField('projecttasks_id'));
}
$this->datas["##projecttask.state##"] = '';
if ($item->getField('projectstates_id')) {
$this->datas["##projecttask.state##"] = Dropdown::getDropdownName('glpi_projectstates', $item->getField('projectstates_id'));
}
$this->datas["##projecttask.type##"] = '';
if ($item->getField('projecttasktypes_id')) {
$this->datas["##projecttask.type##"] = Dropdown::getDropdownName('glpi_projecttasktypes', $item->getField('projecttasktypes_id'));
}
$this->datas["##projecttask.createbyuser##"] = '';
if ($item->getField('users_id')) {
$user_tmp = new User();
$user_tmp->getFromDB($item->getField('users_id'));
$this->datas["##projecttask.createbyuser##"] = $user_tmp->getName();
}
// Team infos
$restrict = "`projecttasks_id` = '" . $item->getField('id') . "'";
$items = getAllDatasFromTable('glpi_projecttaskteams', $restrict);
$this->datas['teammembers'] = array();
if (count($items)) {
foreach ($items as $data) {
if ($item2 = getItemForItemtype($data['itemtype'])) {
if ($item2->getFromDB($data['items_id'])) {
$tmp = array();
$tmp['##teammember.itemtype##'] = $item2->getTypeName();
$tmp['##teammember.name##'] = $item2->getName();
$this->datas['teammembers'][] = $tmp;
}
}
}
}
$this->datas['##projecttask.numberofteammembers##'] = count($this->datas['teammembers']);
// Task infos
$restrict = "`projecttasks_id`='" . $item->getField('id') . "'";
$restrict .= " ORDER BY `date` DESC, `id` ASC";
$tasks = getAllDatasFromTable('glpi_projecttasks', $restrict);
$this->datas['tasks'] = array();
foreach ($tasks as $task) {
$tmp = array();
$tmp['##task.creationdate##'] = Html::convDateTime($task['date']);
$tmp['##task.lastupdatedate##'] = Html::convDateTime($task['date_mod']);
$tmp['##task.name##'] = $task['name'];
$tmp['##task.description##'] = $task['content'];
$tmp['##task.comments##'] = $task['comment'];
$tmp['##task.state##'] = Dropdown::getDropdownName('glpi_projectstates', $task['projectstates_id']);
$tmp['##task.type##'] = Dropdown::getDropdownName('glpi_projecttasktypes', $task['projecttasktypes_id']);
$tmp['##task.percent##'] = Dropdown::getValueWithUnit($task['percent_done'], "%");
$this->datas["##task.planstartdate##"] = '';
$this->datas["##task.planenddate##"] = '';
$this->datas["##task.realstartdate##"] = '';
$this->datas["##task.realenddate##"] = '';
if (!is_null($task['plan_start_date'])) {
$tmp['##task.planstartdate##'] = Html::convDateTime($task['plan_start_date']);
}
if (!is_null($task['plan_end_date'])) {
$tmp['##task.planenddate##'] = Html::convDateTime($task['plan_end_date']);
}
if (!is_null($task['real_start_date'])) {
$tmp['##task.realstartdate##'] = Html::convDateTime($task['real_start_date']);
}
if (!is_null($task['real_end_date'])) {
$tmp['##task.realenddate##'] = Html::convDateTime($task['real_end_date']);
//.........这里部分代码省略.........