本文整理汇总了PHP中Html::convDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::convDate方法的具体用法?PHP Html::convDate怎么用?PHP Html::convDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::convDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayValue
function displayValue($output_type, $row)
{
if (isset($row[$this->name]) && $row[$this->name]) {
return Html::convDate($row[$this->name]);
}
return '';
}
示例2: pdfForItem
static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
{
global $DB, $CFG_GLPIG;
if (!Session::haveRight("contract", "r")) {
return false;
}
$type = $item->getType();
$ID = $item->getField('id');
$con = new Contract();
$query = "SELECT *\n FROM `glpi_contracts_items`\n WHERE `glpi_contracts_items`.`items_id` = '" . $ID . "'\n AND `glpi_contracts_items`.`itemtype` = '" . $type . "'";
$result = $DB->query($query);
$number = $DB->numrows($result);
$i = $j = 0;
$pdf->setColumnsSize(100);
if ($number > 0) {
$pdf->displayTitle('<b>' . _N('Associated contract', 'Associated contracts', 2) . '</b>');
$pdf->setColumnsSize(19, 19, 19, 16, 11, 16);
$pdf->displayTitle(__('Name'), _x('phone', 'Number'), __('Contract type'), __('Supplier'), __('Start date'), __('Initial contract period'));
$i++;
while ($j < $number) {
$cID = $DB->result($result, $j, "contracts_id");
$assocID = $DB->result($result, $j, "id");
if ($con->getFromDB($cID)) {
$pdf->displayLine(empty($con->fields["name"]) ? "(" . $con->fields["id"] . ")" : $con->fields["name"], $con->fields["num"], Html::clean(Dropdown::getDropdownName("glpi_contracttypes", $con->fields["contracttypes_id"])), str_replace("<br>", " ", $con->getSuppliersNames()), Html::convDate($con->fields["begin_date"]), sprintf(_n('%d month', '%d months', $con->fields["duration"]), $con->fields["duration"]));
}
$j++;
}
} else {
$pdf->displayTitle("<b>" . __('No item found') . "</b>");
}
$pdf->displaySpace();
}
示例3: pdfForTicket
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $job)
{
global $CFG_GLPI, $DB;
$ID = $job->getField('id');
//////////////followups///////////
$query = "SELECT *\n FROM `glpi_ticketcosts`\n WHERE `tickets_id` = '{$ID}'\n ORDER BY `begin_date`";
$result = $DB->query($query);
if (!$DB->numrows($result)) {
$pdf->setColumnsSize(100);
$pdf->displayLine(__('No ticket cost for this ticket', 'pdf'));
} else {
$pdf->setColumnsSize(60, 20, 20);
$pdf->displayTitle("<b>" . TicketCost::getTypeName($DB->numrows($result)), __('Ticket duration'), CommonITILObject::getActionTime($job->fields['actiontime']) . "</b>");
$pdf->setColumnsSize(20, 10, 10, 10, 10, 10, 10, 10, 10);
$pdf->setColumnsAlign('center', 'center', 'center', 'left', 'right', 'right', 'right', 'right', 'right');
$pdf->displayTitle("<b><i>" . __('Name') . "</i></b>", "<b><i>" . __('Begin date') . "</i></b>", "<b><i>" . __('End date') . "</i></b>", "<b><i>" . __('Budget') . "</i></b>", "<b><i>" . __('Duration') . "</i></b>", "<b><i>" . __('Time cost') . "</i></b>", "<b><i>" . __('Fixed cost') . "</i></b>", "<b><i>" . __('Material cost') . "</i></b>", "<b><i>" . __('Total cost') . "</i></b>");
while ($data = $DB->fetch_array($result)) {
$cost = TicketCost::computeTotalCost($data['actiontime'], $data['cost_time'], $data['cost_fixed'], $data['cost_material']);
$pdf->displayLine($data['name'], Html::convDate($data['begin_date']), Html::convDate($data['end_date']), Dropdown::getDropdownName('glpi_budgets', $data['budgets_id']), CommonITILObject::getActionTime($data['actiontime']), Html::formatNumber($data['cost_time']), Html::formatNumber($data['cost_fixed']), Html::formatNumber($data['cost_material']), Html::formatNumber($cost));
$total_time += $data['actiontime'];
$total_costtime += $data['actiontime'] * $data['cost_time'] / HOUR_TIMESTAMP;
$total_fixed += $data['cost_fixed'];
$total_material += $data['cost_material'];
$total += $cost;
}
$pdf->setColumnsSize(50, 10, 10, 10, 10, 10);
$pdf->setColumnsAlign('right', 'right', 'right', 'right', 'right', 'right');
$pdf->displayLine('<b>' . __('Total'), CommonITILObject::getActionTime($total_time), Html::formatNumber($total_costtime), Html::formatNumber($total_fixed), Html::formatNumber($total_material), Html::formatNumber($total));
}
$pdf->displaySpace();
}
示例4: pdfMain
static function pdfMain(PluginPdfSimplePDF $pdf, SoftwareLicense $license, $main = true, $cpt = true)
{
global $DB;
$ID = $license->getField('id');
$pdf->setColumnsSize(100);
$entity = '';
if (Session::isMultiEntitiesMode() && !$main) {
$entity = ' (' . Html::clean(Dropdown::getDropdownName('glpi_entities', $license->fields['entities_id'])) . ')';
}
$pdf->displayTitle('<b><i>' . sprintf(__('%1$s: %2$s'), __('ID') . "</i>", $ID . "</b>" . $entity));
$pdf->setColumnsSize(50, 50);
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), Software::getTypeName(1) . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwares', $license->fields['softwares_id']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Type') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwarelicensetypes', $license->fields['softwarelicensetypes_id']))));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Name') . '</i></b>', $license->fields['name']), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Serial number') . '</i></b>', $license->fields['serial']));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Purchase version') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwareversions', $license->fields['softwareversions_id_buy']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Inventory number') . '</i></b>', $license->fields['otherserial']));
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), __('Version in use') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_softwareversions', $license->fields['softwareversions_id_use']))), '<b><i>' . sprintf(__('%1$s: %2$s'), __('Expiration') . '</i></b>', Html::convDate($license->fields['expire'])));
$col2 = '';
if ($cpt) {
$col2 = '<b><i>' . sprintf(__('%1$s: %2$s'), __('Affected computers') . '</i></b>', Computer_SoftwareLicense::countForLicense($ID));
}
$pdf->displayLine('<b><i>' . sprintf(__('%1$s: %2$s'), _x('quantity', 'Number') . '</i></b>', $license->fields['number'] > 0 ? $license->fields['number'] : __('Unlimited')), $col2);
$pdf->setColumnsSize(100);
PluginPdfCommon::mainLine($pdf, $license, 'comment');
if ($main) {
$pdf->displaySpace();
}
}
示例5: Footer
/**
* Page footer
*
* @see TCPDF::Footer()
**/
public function Footer()
{
// Position at 15 mm from bottom
$this->SetY(-15);
$text = "GLPI PDF export - " . Html::convDate(date("Y-m-d")) . " - " . $this->getAliasNumPage() . "/" . $this->getAliasNbPages();
// Page number
$this->Cell(0, 10, $text, 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
示例6: getSubName
function getSubName()
{
//TODO
global $LANG;
$date = $this->getDate();
$title = $this->getCriteriaLabel($this->getName());
if (empty($title) && isset($LANG['plugin_reports']['subname'][$this->getName()])) {
$title = $LANG['plugin_reports']['subname'][$this->getName()];
}
return $title . ' (' . Html::convDate($date) . ')';
}
示例7: getDatasForTemplate
function getDatasForTemplate($event, $options = array())
{
$this->datas['##certificate.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
$this->datas['##lang.certificate.entity##'] = __('Entity');
$this->datas['##certificate.action##'] = $event == "ExpiredCertificates" ? __('Expired certificates', 'certificates') : __('Expiring certificates', 'certificates');
$this->datas['##lang.certificate.name##'] = __('Name');
$this->datas['##lang.certificate.dateexpiration##'] = __('Expiration date');
foreach ($options['certificates'] as $id => $certificate) {
$tmp = array();
$tmp['##certificate.name##'] = $certificate['name'];
$tmp['##certificate.dateexpiration##'] = Html::convDate($certificate['date_expiration']);
$this->datas['certificates'][] = $tmp;
}
}
示例8: getDatasForTemplate
function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI;
$this->datas['##domain.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
$this->datas['##lang.domain.entity##'] = __('Entity');
$this->datas['##domain.action##'] = $event == "ExpiredDomains" ? __('Expired domains', 'domains') : __('Expiring domains', 'domains');
$this->datas['##lang.domain.name##'] = __('Name');
$this->datas['##lang.domain.dateexpiration##'] = __('Expiration date');
foreach ($options['domains'] as $id => $domain) {
$tmp = array();
$tmp['##domain.name##'] = $domain['name'];
$tmp['##domain.dateexpiration##'] = Html::convDate($domain['date_expiration']);
$this->datas['domains'][] = $tmp;
}
}
示例9: setBackground
private function setBackground()
{
$id_pdf = $this->pdf->openObject();
$this->pdf->saveState();
$this->pdf->ezStartPageNumbers($this->width - 20, 10, 10, 'left', Html::convDate(date("Y-m-d")) . " - {PAGENUM}/{TOTALPAGENUM}");
$this->pdf->setStrokeColor(0, 0, 0);
$this->pdf->setLineStyle(1, 'round', 'round');
$this->pdf->rectangle(20, 20, $this->width - 40, $this->height - 40);
$this->pdf->addJpegFromFile(GLPI_ROOT . "/plugins/pdf/pics/fd_logo.jpg", 25, $this->height - 50);
// 61x25
$this->pdf->selectFont(GLPI_ROOT . "/plugins/pdf/fonts/Times-Roman.afm");
$this->pdf->setFontFamily('Times-Roman.afm', array('b' => 'Times-Bold.afm', 'i' => 'Times-Italic.afm', 'bi' => 'Times-BoldItalic.afm'));
$this->pdf->restoreState();
$this->pdf->closeObject();
$this->pdf->addObject($id_pdf, 'all');
}
示例10: testConvDate
/**
* @covers Html::convDate
*/
public function testConvDate()
{
$this->assertNull(Html::convDate(null));
$this->assertNull(Html::convDate('NULL'));
$mydate = date('Y-m-d H:i:s');
$expected = date('Y-m-d');
unset($_SESSION['glpidate_format']);
$this->assertEquals($expected, Html::convDate($mydate));
$_SESSION['glpidate_format'] = 0;
$this->assertEquals($expected, Html::convDate($mydate));
$this->assertEquals($expected, Html::convDate(date('Y-m-d')));
$expected = date('d-m-Y');
$this->assertEquals($expected, Html::convDate($mydate, 1));
$expected = date('m-d-Y');
$this->assertEquals($expected, Html::convDate($mydate, 2));
}
示例11: getDatasForTemplate
function getDatasForTemplate($event, $options = array())
{
$this->datas['##badge.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
$this->datas['##lang.badge.entity##'] = __('Entity');
$this->datas['##badge.action##'] = $event == "ExpiredBadges" ? __('Badges at the end of the validity', 'badges') : __('Badges which expires', 'badges');
$this->datas['##lang.badge.name##'] = __('Name');
$this->datas['##lang.badge.dateexpiration##'] = __('Date of end of validity', 'badges');
$this->datas['##lang.badge.serial##'] = __('Serial number');
$this->datas['##lang.badge.users##'] = __('Allotted to', 'badges');
foreach ($options['badges'] as $id => $badge) {
$tmp = array();
$tmp['##badge.name##'] = $badge['name'];
$tmp['##badge.serial##'] = $badge['serial'];
$tmp['##badge.users##'] = Html::clean(getUserName($badge["users_id"]));
$tmp['##badge.dateexpiration##'] = Html::convDate($badge['date_expiration']);
$this->datas['badges'][] = $tmp;
}
}
示例12: getDatasForTemplate
/**
* Get all data needed for template processing
*
* @param $event
* @param $options array
**/
function getDatasForTemplate($event, $options = array())
{
$events = $this->getAllEvents();
$this->datas['##license.action##'] = $events[$event];
$this->datas['##license.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
foreach ($options['licenses'] as $id => $license) {
$tmp = array();
$tmp['##license.item##'] = $license['softname'];
$tmp['##license.name##'] = $license['name'];
$tmp['##license.serial##'] = $license['serial'];
$tmp['##license.expirationdate##'] = Html::convDate($license["expire"]);
$tmp['##license.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "SoftwareLicense_" . $id);
$this->datas['licenses'][] = $tmp;
}
$this->getTags();
foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
if (!isset($this->datas[$tag])) {
$this->datas[$tag] = $values['label'];
}
}
}
示例13: pdfForItem
static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
{
global $CFG_GLPI;
$ID = $item->getField('id');
if (!Session::haveRight("infocom", "r")) {
return false;
}
$ic = new Infocom();
$pdf->setColumnsSize(100);
if ($ic->getFromDBforDevice(get_class($item), $ID)) {
$pdf->displayTitle("<b>" . __('Financial and administrative information') . "</b>");
$pdf->setColumnsSize(50, 50);
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Supplier') . "</i></b>", Html::clean(Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Budget') . "</i></b>", Html::clean(Dropdown::getDropdownName("glpi_budgets", $ic->fields["budgets_id"]))));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Order number') . "</i></b>", $ic->fields["order_number"]), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Order date') . "</i></b>", Html::convDate($ic->fields["order_date"])));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Immobilization number') . "</i></b>", $ic->fields["immo_number"]), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Date of purchase') . "</i></b>", Html::convDate($ic->fields["buy_date"])));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Invoice number') . "</i></b>", $ic->fields["bill"]), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Delivery date') . "</i></b>", Html::convDate($ic->fields["delivery_date"])));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Delivery form') . "</i></b>", $ic->fields["delivery_number"]), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Startup date') . "</i></b>", Html::convDate($ic->fields["use_date"])));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Value') . "</i></b>", Html::clean(Html::formatNumber($ic->fields["value"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), _('Date of last physical inventory') . "</i></b>", Html::convDate($ic->fields["inventory_date"])));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Warranty extension value') . "</i></b>", Html::clean(Html::formatNumber($ic->fields["warranty_value"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Amortization duration') . "</i></b>", sprintf(__('%1$s (%2$s)'), sprintf(_n('%d year', '%d years', $ic->fields["sink_time"]), $ic->fields["sink_time"]), Infocom::getAmortTypeName($ic->fields["sink_type"]))));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Account net value') . "</i></b>", Infocom::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $CFG_GLPI['date_tax'], "n")), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Amortization coefficient') . "</i></b>", $ic->fields["sink_coeff"]));
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('TCO (value + tracking cost)') . "</i></b>", Html::clean(Infocom::showTco($item->getField('ticket_tco'), $ic->fields["value"]))), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Monthly TCO') . "</i></b>", Html::clean(Infocom::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]))));
PluginPdfCommon::mainLine($pdf, $ic, 'comment');
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Warranty information') . "</b>");
$pdf->setColumnsSize(50, 50);
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Start date of warranty') . "</i></b>", Html::convDate($ic->fields["warranty_date"])), "<b><i>" . sprintf(__('%1$s: %2$s'), __('Warranty duration') . "</i></b>", sprintf(__('%1$s - %2$s'), sprintf(_n('%d month', '%d months', $ic->fields["warranty_duration"]), $ic->fields["warranty_duration"]), sprintf(__('Valid to %s'), Infocom::getWarrantyExpir($ic->fields["buy_date"], $ic->fields["warranty_duration"])))));
$col1 = "<b><i>" . __('Alarms on financial and administrative information') . "</i></b>";
if ($ic->fields["alert"] == 0) {
$col1 = sprintf(__('%1$s: %2$s'), $col1, __('No'));
} else {
if ($ic->fields["alert"] == 4) {
$col1 = sprintf(__('%1$s: %2$s'), $col1, __('Warranty expiration date'));
}
}
$pdf->displayLine("<b><i>" . sprintf(__('%1$s: %2$s'), __('Warranty information') . "</i></b>", $ic->fields["warranty_info"]), $col1);
} else {
$pdf->displayTitle("<b>" . __('No financial information', 'pdf') . "</b>");
}
$pdf->displaySpace();
}
示例14: getDatasForTemplate
/**
* Get all data needed for template processing
*
* @param $event
* @param $options array
**/
function getDatasForTemplate($event, $options = array())
{
global $CFG_GLPI;
$events = $this->getAllEvents();
$this->datas['##license.action##'] = $events[$event];
$this->datas['##license.entity##'] = Dropdown::getDropdownName('glpi_entities', $options['entities_id']);
foreach ($options['licenses'] as $id => $license) {
$tmp = array();
$tmp['##license.item##'] = $license['softname'];
$tmp['##license.name##'] = $license['name'];
$tmp['##license.serial##'] = $license['serial'];
$tmp['##license.expirationdate##'] = Html::convDate($license["expire"]);
$tmp['##license.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=softwarelicense_" . $id);
$this->datas['licenses'][] = $tmp;
}
$this->getTags();
foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
if (!isset($this->datas[$tag])) {
$this->datas[$tag] = $values['label'];
}
}
}
示例15: giveItem
//.........这里部分代码省略.........
$options['criteria'][0]['link'] = 'AND';
}
} else {
if ($itemtype == 'ITILCategory') {
$options['criteria'][0]['field'] = 7;
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = $data['id'];
$options['criteria'][0]['link'] = 'AND';
} else {
$options['criteria'][0]['field'] = 12;
$options['criteria'][0]['searchtype'] = 'equals';
$options['criteria'][0]['value'] = 'all';
$options['criteria'][0]['link'] = 'AND';
$options['metacriteria'][0]['itemtype'] = $itemtype;
$options['metacriteria'][0]['field'] = self::getOptionNumber($itemtype, 'name');
$options['metacriteria'][0]['searchtype'] = 'equals';
$options['metacriteria'][0]['value'] = $data['id'];
$options['metacriteria'][0]['link'] = 'AND';
}
}
$options['reset'] = 'reset';
$out = "<a id='ticket{$itemtype}" . $data['id'] . "' ";
$out .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&') . "\">";
$out .= $data[$num][0]['name'] . "</a>";
return $out;
}
}
break;
case "glpi_tickets.due_date":
case "glpi_problems.due_date":
case "glpi_changes.due_date":
// Due date + progress
if ($ID == 151) {
$out = Html::convDate($data[$num][0]['name']);
// No due date in waiting status
if ($data[$num][0]['status'] == CommonITILObject::WAITING) {
return '';
}
if (empty($data[$num][0]['name'])) {
return '';
}
if ($data[$num][0]['status'] == Ticket::SOLVED || $data[$num][0]['status'] == Ticket::CLOSED) {
return $out;
}
$itemtype = getItemTypeForTable($table);
$item = new $itemtype();
$item->getFromDB($data['id']);
$percentage = 0;
$totaltime = 0;
$currenttime = 0;
if ($item->isField('slas_id') && $item->fields['slas_id'] != 0) {
// Have SLA
$sla = new SLA();
$sla->getFromDB($item->fields['slas_id']);
$currenttime = $sla->getActiveTimeBetween($item->fields['date'], date('Y-m-d H:i:s'));
$totaltime = $sla->getActiveTimeBetween($item->fields['date'], $data[$num][0]['name']);
} else {
$calendars_id = Entity::getUsedConfig('calendars_id', $item->fields['entities_id']);
if ($calendars_id != 0) {
// Ticket entity have calendar
$calendar = new Calendar();
$calendar->getFromDB($calendars_id);
$currenttime = $calendar->getActiveTimeBetween($item->fields['date'], date('Y-m-d H:i:s'));
$totaltime = $calendar->getActiveTimeBetween($item->fields['date'], $data[$num][0]['name']);
} else {
// No calendar