本文整理汇总了PHP中Html::convDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::convDateTime方法的具体用法?PHP Html::convDateTime怎么用?PHP Html::convDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::convDateTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayValue
function displayValue($output_type, $row)
{
if (isset($row[$this->name]) && $row[$this->name]) {
return Html::convDateTime($row[$this->name]);
}
return '';
}
示例2: pdfForTicket
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
{
global $CFG_GLPI, $DB;
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Approvals for the ticket') . "</b>");
if (!Session::haveRight('validate_request', 1) && !Session::haveRight('validate_incident', 1) && !Session::haveRight('create_incident_validation', 1) && !Session::haveRight('create_request_validation', 1)) {
return false;
}
$ID = $ticket->getField('id');
$query = "SELECT *\n FROM `glpi_ticketvalidations`\n WHERE `tickets_id` = '" . $ticket->getField('id') . "'\n ORDER BY submission_date DESC";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($number) {
$pdf->setColumnsSize(20, 19, 21, 19, 21);
$pdf->displayTitle(_x('item', 'State'), __('Request date'), __('Approval requester'), __('Approval date'), __('Approver'));
while ($row = $DB->fetch_assoc($result)) {
$pdf->setColumnsSize(20, 19, 21, 19, 21);
$pdf->displayLine(TicketValidation::getStatus($row['status']), Html::convDateTime($row["submission_date"]), getUserName($row["users_id"]), Html::convDateTime($row["validation_date"]), getUserName($row["users_id_validate"]));
$tmp = trim($row["comment_submission"]);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Request comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
if ($row["validation_date"]) {
$tmp = trim($row["comment_validation"]);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Approval comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
}
}
} else {
$pdf->displayLine(__('No item found'));
}
$pdf->displaySpace();
}
示例3: displaySpecificTypeField
/**
* Display fields that are specific to this itemtype
*
* @param ID the item's ID
* @param field array the item's fields
*
* @return nothing
**/
function displaySpecificTypeField($ID, $field = array())
{
switch ($field['type']) {
case 'echo':
echo $this->fields[$field['name']];
break;
case 'reason':
echo self::getReason($this->fields[$field['name']]);
break;
case 'echo_datetime':
echo Html::convDateTime($this->fields[$field['name']]);
break;
case 'echo_dropdown':
$result = Dropdown::getDropdownName($field['table'], $this->fields[$field['name']]);
if ($result == '') {
echo Dropdown::EMPTY_VALUE;
} else {
echo $result;
}
break;
case 'echo_rule':
echo self::getRuleMatchedMessage($this->fields[$field['name']]);
break;
}
}
示例4: pdfMain
static function pdfMain(PluginPdfSimplePDF $pdf, KnowbaseItem $item)
{
global $DB;
$ID = $item->getField('id');
if (!Session::haveRight('knowbase', 'r') || !Session::haveRight('faq', 'r')) {
return false;
}
$knowbaseitemcategories_id = $item->getField('knowbaseitemcategories_id');
$fullcategoryname = Html::clean(getTreeValueCompleteName("glpi_knowbaseitemcategories", $knowbaseitemcategories_id));
$question = Html::clean(Toolbox::unclean_cross_side_scripting_deep(html_entity_decode($item->getField('name'), ENT_QUOTES, "UTF-8")));
$answer = Html::clean(Toolbox::unclean_cross_side_scripting_deep(html_entity_decode($item->getField('answer'), ENT_QUOTES, "UTF-8")));
$pdf->setColumnsSize(100);
if (Toolbox::strlen($fullcategoryname) > 0) {
$pdf->displayTitle('<b>' . __('Category name') . '</b>');
$pdf->displayLine($fullcategoryname);
}
if (Toolbox::strlen($question) > 0) {
$pdf->displayTitle('<b>' . __('Subject') . '</b>');
$pdf->displayText('', $question, 5);
} else {
$pdf->displayTitle('<b>' . __('No question found', 'pdf') . '</b>');
}
if (Toolbox::strlen($answer) > 0) {
$pdf->displayTitle('<b>' . __('Content') . '</b>');
$pdf->displayText('', $answer, 5);
} else {
$pdf->displayTitle('<b>' . __('No answer found') . '</b>');
}
$pdf->setColumnsSize(50, 15, 15, 10, 10);
$pdf->displayTitle(__('Writer'), __('Creation date'), __('Last update'), __('FAQ'), _n('View', 'Views', 2));
$pdf->displayLine(getUserName($item->fields["users_id"]), Html::convDateTime($item->fields["date"]), Html::convDateTime($item->fields["date_mod"]), Dropdown::getYesNo($item->fields["is_faq"]), $item->fields["view"]);
$pdf->displaySpace();
}
示例5: pdfForTicket
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
{
$survey = new TicketSatisfaction();
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Satisfaction survey') . "</b>");
if (!$survey->getFromDB($ticket->getID())) {
$pdf->displayLine(__('No generated survey'));
} else {
if ($survey->getField('type') == 2) {
$url = Entity::generateLinkSatisfaction($ticket);
$pdf->displayLine(sprintf(__('%1$s (%2$s)'), __('External survey'), $url));
} else {
if ($survey->getField('date_answered')) {
$sat = $survey->getField('satisfaction');
$tabsat = array(0 => __('None'), 1 => __('1 star', 'pdf'), 2 => __('2 stars', 'pdf'), 3 => __('3 stars', 'pdf'), 4 => __('4 stars', 'pdf'), 5 => __('5 stars', 'pdf'));
if (isset($tabsat[$sat])) {
$sat = $tabsat[$sat] . " ({$sat}/5)";
}
$pdf->displayLine('<b>' . sprintf(__('%1$s: %2$s'), __('Response date to the satisfaction survey') . '</b>', Html::convDateTime($survey->getField('date_answered'))));
$pdf->displayLine('<b>' . sprintf(__('%1$s: %2$s'), __('Satisfaction with the resolution of the ticket') . '</b>', $sat));
$pdf->displayText('<b>' . sprintf(__('%1$s: %2$s'), __('Comments') . '</b>', $survey->getField('comment')));
} else {
// No answer
$pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Creation date of the satisfaction survey'), Html::convDateTime($survey->getField('date_begin'))));
$pdf->displayLine(__('No answer', 'pdf'));
}
}
}
$pdf->displaySpace();
}
示例6: 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();
}
示例7: testConvDateTime
/**
* @covers Html::convDateTime
*/
public function testConvDateTime()
{
$this->assertNull(Html::convDateTime(null));
$this->assertNull(Html::convDateTime('NULL'));
$mydate = date('Y-m-d H:i:s');
$expected = date('Y-m-d H:i');
$this->assertEquals($expected, Html::convDateTime($mydate));
$expected = date('d-m-Y H:i');
$this->assertEquals($expected, Html::convDateTime($mydate, 1));
$expected = date('m-d-Y H:i');
$this->assertEquals($expected, Html::convDateTime($mydate, 2));
}
示例8: pdfForItem
static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
{
global $DB, $CFG_GLPI;
$ID = $item->getField('id');
$type = get_class($item);
if (!Session::haveRight("reservation_central", "r")) {
return;
}
$user = new User();
$ri = new ReservationItem();
$pdf->setColumnsSize(100);
if ($ri->getFromDBbyItem($type, $ID)) {
$now = $_SESSION["glpi_currenttime"];
$query = "SELECT *\n FROM `glpi_reservationitems`\n INNER JOIN `glpi_reservations`\n ON (`glpi_reservations`.`reservationitems_id` = `glpi_reservationitems`.`id`)\n WHERE `end` > '" . $now . "'\n AND `glpi_reservationitems`.`items_id` = '{$ID}'\n ORDER BY `begin`";
$result = $DB->query($query);
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Current and future reservations') . "</b>");
if (!$DB->numrows($result)) {
$pdf->displayLine("<b>" . __('No reservation') . "</b>");
} else {
$pdf->setColumnsSize(14, 14, 26, 46);
$pdf->displayTitle('<i>' . __('Start date'), __('End date'), __('By'), __('Comments') . '</i>');
while ($data = $DB->fetch_assoc($result)) {
if ($user->getFromDB($data["users_id"])) {
$name = formatUserName($user->fields["id"], $user->fields["name"], $user->fields["realname"], $user->fields["firstname"]);
} else {
$name = "(" . $data["users_id"] . ")";
}
$pdf->displayLine(Html::convDateTime($data["begin"]), Html::convDateTime($data["end"]), $name, str_replace(array("\r", "\n"), " ", $data["comment"]));
}
}
$query = "SELECT *\n FROM `glpi_reservationitems`\n INNER JOIN `glpi_reservations`\n ON (`glpi_reservations`.`reservationitems_id` = `glpi_reservationitems`.`id`)\n WHERE `end` <= '" . $now . "'\n AND `glpi_reservationitems`.`items_id` = '{$ID}'\n ORDER BY `begin`\n DESC";
$result = $DB->query($query);
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Past reservations') . "</b>");
if (!$DB->numrows($result)) {
$pdf->displayLine("<b>" . __('No reservation') . "</b>");
} else {
$pdf->setColumnsSize(14, 14, 26, 46);
$pdf->displayTitle('<i>' . __('Start date'), __('End date'), __('By'), __('Comments') . '</i>');
while ($data = $DB->fetch_assoc($result)) {
if ($user->getFromDB($data["users_id"])) {
$name = formatUserName($user->fields["id"], $user->fields["name"], $user->fields["realname"], $user->fields["firstname"]);
} else {
$name = "(" . $data["users_id"] . ")";
}
$pdf->displayLine(Html::convDateTime($data["begin"]), Html::convDateTime($data["end"]), $name, str_replace(array("\r", "\n"), " ", $data["comment"]));
}
}
}
$pdf->displaySpace();
}
示例9: pdfMain
static function pdfMain(PluginPdfSimplePDF $pdf, Group $item)
{
$ID = $item->getField('id');
$pdf->setColumnsSize(50, 50);
$pdf->displayTitle('<b>' . sprintf(__('%1$s %2$s'), __('ID'), $item->fields['id']) . '</b>', sprintf(__('%1$s: %2$s'), __('Last update'), Html::convDateTime($item->fields['date_mod'])));
$pdf->setColumnsSize(100);
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Complete name') . '</i></b>', $item->fields['completename']));
$pdf->setColumnsSize(50, 50);
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Child entities') . '</i></b>', Dropdown::getYesNo($item->fields['is_recursive'])), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Can be notified') . '</i></b>', Dropdown::getYesNo($item->fields['is_notify'])));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), sprintf(__('%1$s - %2$s'), __('Visible in a ticket'), __('Requester')) . '</i></b>', Dropdown::getYesNo($item->fields['is_requester'])), '<b><i>' . sprintf(__('%1$s: %2$s'), sprintf(__('%1$s - %2$s'), _('Visible in a ticket'), __('Assigned to')) . '</i></b>', Dropdown::getYesNo($item->fields['is_assign'])));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), sprintf(__('%1$s - %2$s'), __('Can contain'), _n('Item', 'Items', 2)) . '</i></b>', Dropdown::getYesNo($item->fields['is_itemgroup'])), '<b><i>' . sprintf(__('%1$s: %2$s'), sprintf(__('%1$s - %2$s'), __('Can contain'), _n('User', 'Users', 2)) . '</i></b>', Dropdown::getYesNo($item->fields['is_usergroup'])));
PluginPdfCommon::mainLine($pdf, $item, 'comment');
$pdf->displaySpace();
}
示例10: pdfMain
static function pdfMain(PluginPdfSimplePDF $pdf, Software $software)
{
PluginPdfCommon::mainTitle($pdf, $software);
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Name') . '</i></b>', $software->fields['name']), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Publisher') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_manufacturers', $software->fields['manufacturers_id']))));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Location') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_locations', $software->fields['locations_id']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Category') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwarecategories', $software->fields['softwarecategories_id']))));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Technician in charge of the hardware') . '</i></b>', getUserName($software->fields['users_id_tech'])), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Associable to a ticket') . '</i></b>', $software->fields['is_helpdesk_visible'] ? __('Yes') : __('No')));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Group in charge of the hardware') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_groups', $software->fields['groups_id_tech']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('User') . '</i></b>', getUserName($software->fields['users_id'])));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Group') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_groups', $software->fields['groups_id']))));
$pdf->displayLine('<b><i>' . sprintf(__('Last update on %s'), Html::convDateTime($software->fields['date_mod'])));
if ($software->fields['softwares_id'] > 0) {
$col2 = '<b><i> ' . __('from') . ' </i></b> ' . Html::clean(Dropdown::getDropdownName('glpi_softwares', $software->fields['softwares_id']));
} else {
$col2 = '';
}
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Upgrade') . '</i></b>', $software->fields['is_update'] ? __('Yes') : __('No'), $col2));
$pdf->setColumnsSize(100);
PluginPdfCommon::mainLine($pdf, $software, 'comment');
$pdf->displaySpace();
}
示例11: getDatasForTemplate
public function getDatasForTemplate($event, $options = array())
{
$form = new PluginFormcreatorForm();
$form->getFromDB($this->obj->fields['plugin_formcreator_forms_id']);
$link = $GLOBALS['CFG_GLPI']['url_base'];
$link .= '/plugins/formcreator/front/formanswer.form.php?id=' . $this->obj->getID();
$requester = new User();
$requester->getFromDB($this->obj->fields['requester_id']);
$validator = new User();
$validator->getFromDB($this->obj->fields['validator_id']);
$this->datas['##formcreator.form_id##'] = $form->getID();
$this->datas['##formcreator.form_name##'] = $form->fields['name'];
$this->datas['##formcreator.form_requester##'] = $requester->getName();
$this->datas['##formcreator.form_validator##'] = $validator->getName();
$this->datas['##formcreator.form_creation_date##'] = Html::convDateTime($this->obj->fields['request_date']);
$this->datas['##formcreator.form_full_answers##'] = $this->obj->getFullForm();
$this->datas['##formcreator.validation_comment##'] = $this->obj->fields['comment'];
$this->datas['##formcreator.validation_link##'] = $link;
$this->datas['##formcreator.request_id##'] = $this->obj->fields['id'];
}
示例12: getDatasForTemplate
function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI;
$this->datas['##ocsmachine.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
$this->datas['##lang.ocsmachine.entity##'] = __('Entity');
$events = $this->getAllEvents();
$delay_ocs = $options["delay_ocs"];
if ($event == "newocs") {
$this->datas['##lang.ocsmachine.title##'] = $events[$event];
} else {
$this->datas['##lang.ocsmachine.title##'] = __('Computers not synchronized with OCS-NG since more', 'additionalalerts') . " " . $delay_ocs . " " . _n('Day', 'Days', 2);
}
$this->datas['##lang.ocsmachine.name##'] = __('Name');
$this->datas['##lang.ocsmachine.urlname##'] = __('URL');
$this->datas['##lang.ocsmachine.operatingsystem##'] = __('Operating system');
$this->datas['##lang.ocsmachine.state##'] = __('Status');
$this->datas['##lang.ocsmachine.location##'] = __('Location');
$this->datas['##lang.ocsmachine.user##'] = __('User') . " / " . __('Group') . " / " . __('Alternate username');
$this->datas['##lang.ocsmachine.urluser##'] = __('URL');
$this->datas['##lang.ocsmachine.urlgroup##'] = __('URL');
$this->datas['##lang.ocsmachine.lastocsupdate##'] = __('Last OCSNG inventory date', 'additionalalerts');
$this->datas['##lang.ocsmachine.lastupdate##'] = __('Import date in GLPI', 'additionalalerts');
$this->datas['##lang.ocsmachine.ocsserver##'] = __('OCSNG server', 'additionalalerts');
foreach ($options['ocsmachines'] as $id => $ocsmachine) {
$tmp = array();
$tmp['##ocsmachine.urlname##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=computer_" . $ocsmachine['id']);
$tmp['##ocsmachine.name##'] = $ocsmachine['name'];
$tmp['##ocsmachine.operatingsystem##'] = Dropdown::getDropdownName("glpi_operatingsystems", $ocsmachine['operatingsystems_id']);
$tmp['##ocsmachine.state##'] = Dropdown::getDropdownName("glpi_states", $ocsmachine['states_id']);
$tmp['##ocsmachine.location##'] = Dropdown::getDropdownName("glpi_locations", $ocsmachine['locations_id']);
$tmp['##ocsmachine.urluser##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=user_" . $ocsmachine['users_id']);
$tmp['##ocsmachine.urlgroup##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=group_" . $ocsmachine['groups_id']);
$tmp['##ocsmachine.user##'] = getUserName($ocsmachine['users_id']);
$tmp['##ocsmachine.group##'] = Dropdown::getDropdownName("glpi_groups", $ocsmachine['groups_id']);
$tmp['##ocsmachine.contact##'] = $ocsmachine['contact'];
$tmp['##ocsmachine.lastocsupdate##'] = Html::convDateTime($ocsmachine['last_ocs_update']);
$tmp['##ocsmachine.lastupdate##'] = Html::convDateTime($ocsmachine['last_update']);
$tmp['##ocsmachine.ocsserver##'] = Dropdown::getDropdownName("glpi_plugin_ocsinventoryng_ocsservers", $ocsmachine['plugin_ocsinventoryng_ocsservers_id']);
$this->datas['ocsmachines'][] = $tmp;
}
}
示例13: pdfForTicket
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $job, $private)
{
global $CFG_GLPI, $DB;
$ID = $job->getField('id');
//////////////followups///////////
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Ticket followup') . "</b>");
$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_ticketfollowups`\n WHERE `tickets_id` = '{$ID}'\n {$RESTRICT}\n ORDER BY `date` DESC";
$result = $DB->query($query);
if (!$DB->numrows($result)) {
$pdf->displayLine(__('No followup for this ticket.'));
} else {
while ($data = $DB->fetch_array($result)) {
$pdf->setColumnsSize(44, 14, 42);
$pdf->displayTitle("<b><i>" . __('Source of followup') . "</i></b>", "<b><i>" . __('Date') . "</i></b>", "<b><i>" . __('Requester') . "</i></b>");
// Author
if ($data['requesttypes_id']) {
$lib = Dropdown::getDropdownName('glpi_requesttypes', $data['requesttypes_id']);
} else {
$lib = '';
}
if ($data['is_private']) {
$lib = sprintf(__('%1$s (%2$s)'), $lib, __('Private'));
}
$pdf->displayLine(Html::clean($lib), Html::convDateTime($data["date"]), Html::clean(getUserName($data["users_id"])));
$pdf->displayText('<b><i>' . sprintf(__('%1$s: %2$s'), __('Comments') . '</i></b>', $data["content"]));
}
}
$pdf->displaySpace();
}
示例14: testAddDelete
public function testAddDelete()
{
$alert = new Alert();
$nb = countElementsInTable($alert->getTable());
$comp = getItemByTypeName('Computer', '_test_pc01');
$date = '2016-09-01 12:34:56';
// Add
$id = $alert->add(['itemtype' => $comp->getType(), 'items_id' => $comp->getID(), 'type' => Alert::END, 'date' => $date]);
$this->assertGreaterThan(0, $id);
$this->assertGreaterThan($nb, countElementsInTable($alert->getTable()));
// Getters
$this->assertFalse(Alert::alertExists($comp->getType(), $comp->getID(), Alert::NOTICE));
$this->assertEquals($id, Alert::alertExists($comp->getType(), $comp->getID(), Alert::END));
$this->assertEquals($date, Alert::getAlertDate($comp->getType(), $comp->getID(), Alert::END));
// Display
$this->expectOutputString(sprintf('Alert sent on %s', Html::convDateTime($date)));
Alert::displayLastAlert($comp->getType(), $comp->getID());
// Delete
$this->assertTrue($alert->clear($comp->getType(), $comp->getID(), Alert::END));
$this->assertEquals($nb, countElementsInTable($alert->getTable()));
// Still true, nothing to delete but no error
$this->assertTrue($alert->clear($comp->getType(), $comp->getID(), Alert::END));
}
示例15: getDatasForTemplate
function getDatasForTemplate($event, $options = array())
{
$this->datas['##consumable.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
$this->datas['##lang.consumable.entity##'] = __('Entity');
$this->datas['##consumable.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
$this->datas['##lang.consumable.entity##'] = __('Entity');
switch ($event) {
case self::CONSUMABLE_REQUEST:
$this->datas['##consumable.action##'] = __('Consumable request', 'consumables');
break;
case self::CONSUMABLE_RESPONSE:
$this->datas['##consumable.action##'] = __('Consumable validation', 'consumables');
break;
}
// Consumable request
$this->datas['##lang.consumablerequest.consumable##'] = _n('Consumable', 'Consumables', 1);
$this->datas['##lang.consumablerequest.consumabletype##'] = _n('Consumable type', 'Consumable types', 1);
$this->datas['##lang.consumablerequest.request_date##'] = __('Request date');
$this->datas['##lang.consumablerequest.requester##'] = __('Requester');
$this->datas['##lang.consumablerequest.status##'] = __('Status');
$this->datas['##lang.consumablerequest.number##'] = __('Number of used consumables');
$this->datas['##lang.consumablerequest.validator##'] = __('Approver');
$this->datas['##lang.consumablerequest.comment##'] = __('Comments');
$consumable = $options['consumablerequest'];
$this->datas['##consumablerequest.consumable##'] = Dropdown::getDropdownName(ConsumableItem::getTable(), $consumable['consumables_id']);
$this->datas['##consumablerequest.consumabletype##'] = Dropdown::getDropdownName(ConsumableItemType::getTable(), $consumable['consumableitemtypes_id']);
$this->datas['##consumablerequest.request_date##'] = Html::convDateTime($consumable['date_mod']);
$this->datas['##consumablerequest.end_date##'] = Html::convDateTime($consumable['end_date']);
$this->datas['##consumablerequest.requester##'] = Html::clean(getUserName($consumable['requesters_id']));
$this->datas['##consumablerequest.validator##'] = Html::clean(getUserName($consumable['validators_id']));
$this->datas['##consumablerequest.number##'] = $consumable['number'];
$this->datas['##consumablerequest.status##'] = CommonITILValidation::getStatus($consumable['status']);
if (isset($options['comment'])) {
$this->datas['##consumablerequest.comment##'] = Html::clean($options['comment']);
}
}