当前位置: 首页>>代码示例>>PHP>>正文


PHP CommonDBTM类代码示例

本文整理汇总了PHP中CommonDBTM的典型用法代码示例。如果您正苦于以下问题:PHP CommonDBTM类的具体用法?PHP CommonDBTM怎么用?PHP CommonDBTM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CommonDBTM类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'add':
             $input = $ma->getInput();
             $ticket = new Ticket();
             if (isset($input['link']) && isset($input['tickets_id_1'])) {
                 if ($item->getFromDB($input['tickets_id_1'])) {
                     foreach ($ids as $id) {
                         $input2 = array();
                         $input2['id'] = $input['tickets_id_1'];
                         $input2['_link']['tickets_id_1'] = $input['tickets_id_1'];
                         $input2['_link']['link'] = $input['link'];
                         $input2['_link']['tickets_id_2'] = $id;
                         if ($item->can($input['tickets_id_1'], UPDATE)) {
                             if ($ticket->update($input2)) {
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                             } else {
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                                 $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                             }
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                             $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                         }
                     }
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:stweil,项目名称:glpi,代码行数:37,代码来源:ticket_ticket.class.php

示例2: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'delete_for_user':
             $input = $ma->getInput();
             if (isset($input['users_id'])) {
                 $user = new User();
                 $user->getFromDB($input['users_id']);
                 foreach ($ids as $id) {
                     if ($input['users_id'] == Session::getLoginUserID()) {
                         if ($item->deleteByCriteria(array('users_id' => $input['users_id'], 'itemtype' => $id))) {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                             $ma->addMessage($user->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($user->getErrorMessage(ERROR_RIGHT));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:stweil,项目名称:glpi,代码行数:33,代码来源:displaypreference.class.php

示例3: 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();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:32,代码来源:contract_item.class.php

示例4: countForItem

 /**
  * @param CommonDBTM $item
  **/
 static function countForItem(CommonDBTM $item)
 {
     global $DB;
     $query = "SELECT COUNT(*) AS cpt FROM `glpi_plugin_monitoring_componentscatalogs_hosts`\n         LEFT JOIN `glpi_plugin_monitoring_services`\n            ON `glpi_plugin_monitoring_services`.`plugin_monitoring_componentscatalogs_hosts_id` =\n               `glpi_plugin_monitoring_componentscatalogs_hosts`.`id`\n         WHERE `itemtype` = '" . $item->getType() . "'\n            AND `items_id` ='" . $item->getField('id') . "'\n            AND `glpi_plugin_monitoring_services`.`id` IS NOT NULL";
     $result = $DB->query($query);
     $ligne = $DB->fetch_assoc($result);
     return $ligne['cpt'];
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:11,代码来源:host.class.php

示例5: pdfForItem

 static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
 {
     global $DB;
     $ID = $item->getField('id');
     $type = $item->getType();
     $crit = $type == 'Software' ? 'softwares_id' : 'id';
     if ($type == 'Software') {
         $crit = 'softwares_id';
         // Software ID
         $innerjoin = "INNER JOIN `glpi_softwareversions`\n                           ON (`glpi_computers_softwareversions`.`softwareversions_id`\n                               = `glpi_softwareversions`.`id`)";
         $where = "WHERE `glpi_softwareversions`.`softwares_id` = '" . $ID . "'";
     } else {
         $crit = 'id';
         //SoftwareVersion ID
         $innerjoin = '';
         $where = "WHERE `glpi_computers_softwareversions`.`softwareversions_id` = '" . $ID . "'";
     }
     $query_number = "SELECT COUNT(*) AS cpt\n                       FROM `glpi_computers_softwareversions`\n                       {$innerjoin}\n                       INNER JOIN `glpi_computers`\n                           ON (`glpi_computers_softwareversions`.`computers_id` = `glpi_computers`.`id`)\n                       {$where}" . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n                            AND `glpi_computers`.`is_deleted` = '0'\n                            AND `glpi_computers`.`is_template` = '0'";
     $total = 0;
     if ($result = $DB->query($query_number)) {
         $total = $DB->result($result, 0, 0);
     }
     $query = "SELECT DISTINCT `glpi_computers_softwareversions`.*,\n                          `glpi_computers`.`name` AS compname,\n                          `glpi_computers`.`id` AS cID,\n                          `glpi_computers`.`serial`,\n                          `glpi_computers`.`otherserial`,\n                          `glpi_users`.`name` AS username,\n                          `glpi_users`.`id` AS userid,\n                          `glpi_users`.`realname` AS userrealname,\n                          `glpi_users`.`firstname` AS userfirstname,\n                          `glpi_softwareversions`.`name` AS version,\n                          `glpi_softwareversions`.`id` AS vID,\n                          `glpi_softwareversions`.`softwares_id` AS sID,\n                          `glpi_softwareversions`.`name` AS vername,\n                          `glpi_entities`.`completename` AS entity,\n                          `glpi_locations`.`completename` AS location,\n                          `glpi_states`.`name` AS state,\n                          `glpi_groups`.`name` AS groupe\n                FROM `glpi_computers_softwareversions`\n                INNER JOIN `glpi_softwareversions`\n                     ON (`glpi_computers_softwareversions`.`softwareversions_id`\n                              = `glpi_softwareversions`.`id`)\n                INNER JOIN `glpi_computers`\n                     ON (`glpi_computers_softwareversions`.`computers_id` = `glpi_computers`.`id`)\n                LEFT JOIN `glpi_entities` ON (`glpi_computers`.`entities_id` = `glpi_entities`.`id`)\n                LEFT JOIN `glpi_locations`\n                     ON (`glpi_computers`.`locations_id` = `glpi_locations`.`id`)\n                LEFT JOIN `glpi_states` ON (`glpi_computers`.`states_id` = `glpi_states`.`id`)\n                LEFT JOIN `glpi_groups` ON (`glpi_computers`.`groups_id` = `glpi_groups`.`id`)\n                LEFT JOIN `glpi_users` ON (`glpi_computers`.`users_id` = `glpi_users`.`id`)\n                WHERE (`glpi_softwareversions`.`{$crit}` = '{$ID}') " . getEntitiesRestrictRequest(' AND', 'glpi_computers') . "\n                      AND `glpi_computers`.`is_deleted` = '0'\n                      AND `glpi_computers`.`is_template` = '0'\n                ORDER BY version, compname\n                LIMIT 0," . intval($_SESSION['glpilist_limit']);
     $pdf->setColumnsSize(100);
     if (($result = $DB->query($query)) && ($number = $DB->numrows($result)) > 0) {
         if ($number == $total) {
             $pdf->displayTitle('<b>' . sprintf(__('%1$s: %2$s'), _n('Installation', 'Installations', 2), $number) . "</b>");
         } else {
             $pdf->displayTitle('<b>' . sprintf(__('%1$s: %2$s'), _n('Installation', 'Installations', 2), $number / $total) . "</b>");
         }
         $pdf->setColumnsSize(12, 16, 15, 15, 22, 20);
         $pdf->displayTitle('<b><i>' . _n('Version', 'Versions', 2), __('Name'), __('Serial number'), __('Inventory number'), __('Location'), _n('License', 'Licenses', 2) . '</i></b>');
         while ($data = $DB->fetch_assoc($result)) {
             $compname = $data['compname'];
             if (empty($compname) || $_SESSION['glpiis_ids_visible']) {
                 $compname = sprintf(__('%1$s (%2$s)'), $compname, $data['cID']);
             }
             $lics = Computer_SoftwareLicense::GetLicenseForInstallation($data['cID'], $data['vID']);
             $tmp = array();
             if (count($lics)) {
                 foreach ($lics as $lic) {
                     $licname = $lic['name'];
                     if (!empty($lic['type'])) {
                         $licname = sprintf(__('%1$s (%2$s)'), $licname, $lic['type']);
                     }
                     $tmp[] = $licname;
                 }
             }
             $pdf->displayLine($data['version'], $compname, $data['serial'], $data['otherserial'], $data['location'], implode(', ', $tmp));
         }
     } else {
         $pdf->displayTitle('<b>' . _n('Installation', 'Installations', 2) . '</b>');
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:56,代码来源:computer_softwareversion.class.php

示例6: pdfForItem

 static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
 {
     global $DB;
     $ID = $item->getField('id');
     $type = get_class($item);
     if (!Session::haveRight("link", "r")) {
         return false;
     }
     $query = "SELECT `glpi_links`.`id` AS ID, `glpi_links`.`link`, `glpi_links`.`name`,\n                       `glpi_links`.`data`\n                FROM `glpi_links`\n                INNER JOIN `glpi_links_itemtypes`\n                     ON `glpi_links`.`id` = `glpi_links_itemtypes`.`links_id`\n                WHERE `glpi_links_itemtypes`.`itemtype` = '" . $type . "'\n                ORDER BY `glpi_links`.`name`";
     $result = $DB->query($query);
     $pdf->setColumnsSize(100);
     if ($DB->numrows($result) > 0) {
         $pdf->displayTitle('<b>' . __('External Links') . '</b>');
         while ($data = $DB->fetch_assoc($result)) {
             $name = $data["name"];
             if (empty($name)) {
                 $name = $data["link"];
             }
             $link = $data["link"];
             $file = trim($data["data"]);
             if (empty($file)) {
                 $links = Link::generateLinkContents($data['link'], $item, $name);
                 $i = 1;
                 foreach ($links as $key => $link) {
                     $url = $link;
                     $pdf->displayLine(sprintf(__('%1$s: %2$s'), "<b>{$name} #{$i}</b>", $link));
                     $i++;
                     $i++;
                 }
             } else {
                 // Generated File
                 $files = Link::generateLinkContents($data['link'], $item);
                 $links = Link::generateLinkContents($data['data'], $item);
                 $i = 1;
                 foreach ($links as $key => $data) {
                     if (isset($files[$key])) {
                         // a different name for each file, ex name = foo-[IP].txt
                         $file = $files[$key];
                     } else {
                         // same name for all files, ex name = foo.txt
                         $file = reset($files);
                     }
                     $pdf->displayText(sprintf(__('%1$s: %2$s'), "<b>{$name} #{$i} - {$file}</b>", trim($data), 1, 10));
                     $i++;
                 }
             }
         }
         // Each link
     } else {
         $pdf->displayTitle('<b>' . __('No link defined') . '</b>');
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:53,代码来源:link.class.php

示例7: 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();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:52,代码来源:reservation.class.php

示例8: processMassiveActionsForOneItemtype

 /**
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  * @param MassiveAction $ma
  * @param CommonDBTM $item
  * @param array $ids
  * @return void
  */
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'deleteSelected':
             if (isset($_POST['items']['PluginFpsoftwareCommon']) && is_array($_POST['items']['PluginFpsoftwareCommon'])) {
                 foreach ($_POST['items']['PluginFpsoftwareCommon'] as $id => $val) {
                     self::deleteItem($id);
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 }
             }
             break;
     }
 }
开发者ID:dawidplocki,项目名称:glpi-fpsoftware,代码行数:20,代码来源:common.class.php

示例9: doSpecificMassiveActions

 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "delete_for_user":
             if (isset($input['users_id'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         //Get software name and manufacturer
                         if ($input['users_id'] == Session::getLoginUserID()) {
                             //Process rules
                             if ($this->deleteByCriteria(array('users_id' => $input['users_id'], 'itemtype' => $key))) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:35,代码来源:displaypreference.class.php

示例10: showForItem

 /**
  * Show OcsLink of an item
  *
  * @param $item CommonDBTM object
  *
  * @return nothing
  **/
 static function showForItem(CommonDBTM $item)
 {
     global $DB, $LANG;
     if (in_array($item->getType(), array('Computer'))) {
         $items_id = $item->getField('id');
         $query = "SELECT `glpi_ocslinks`.`tag` AS tag\n                   FROM `glpi_ocslinks`\n                   WHERE `glpi_ocslinks`.`computers_id` = '{$items_id}' " . getEntitiesRestrictRequest("AND", "glpi_ocslinks");
         $result = $DB->query($query);
         if ($DB->numrows($result) > 0) {
             $data = $DB->fetch_assoc($result);
             $data = clean_cross_side_scripting_deep(addslashes_deep($data));
             echo "<div class='center'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr><th>" . $LANG['ocsng'][0] . "</th>";
             echo "<tr class='tab_bg_2'>";
             echo "<td class='center'>" . $LANG['ocsconfig'][39] . "&nbsp;: " . $data['tag'] . "</td></tr>";
         }
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:25,代码来源:ocslink.class.php

示例11: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case "use_filter_assign_group":
             $escalade_user = new self();
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 if ($escalade_user->getFromDBByQuery("WHERE users_id = {$id}")) {
                     $escalade_user->fields['use_filter_assign_group'] = $input['use_filter_assign_group'];
                     if ($escalade_user->update($escalade_user->fields)) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                     }
                 }
             }
     }
 }
开发者ID:korial29,项目名称:escalade,代码行数:23,代码来源:user.class.php

示例12: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $CFG_GLPI;
     switch ($ma->getAction()) {
         case "uninstall":
             $itemtype = $ma->getItemtype(false);
             foreach ($ids as $id) {
                 if ($item->getFromDB($id)) {
                     //Session::addMessageAfterRedirect(sprintf(__('Form duplicated: %s', 'formcreator'), $item->getName()));
                     $_SESSION['glpi_uninstalllist'][$itemtype][$id] = $id;
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 }
             }
             Html::redirect($CFG_GLPI["root_doc"] . '/plugins/uninstall/front/action.php?device_type=' . $itemtype . "&model_id=" . $_POST["model_id"]);
             return;
             break;
     }
     return;
 }
开发者ID:pluginsGLPI,项目名称:uninstall,代码行数:24,代码来源:uninstall.class.php

示例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();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:40,代码来源:infocom.class.php

示例14: pdfForItem

 static function pdfForItem(PluginPdfSimplePDF $pdf, CommonDBTM $item)
 {
     global $DB;
     $ID = $item->getField('id');
     $type = get_class($item);
     if (!Session::haveRight("document", "r")) {
         return false;
     }
     $query = "SELECT `glpi_documents_items`.`id` AS assocID,\n                       `glpi_documents`.*\n                FROM `glpi_documents_items`\n                LEFT JOIN `glpi_documents`\n                     ON (`glpi_documents_items`.`documents_id` = `glpi_documents`.`id`)\n                WHERE `glpi_documents_items`.`items_id` = '" . $ID . "'\n                      AND `glpi_documents_items`.`itemtype` = '" . $type . "'";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $pdf->setColumnsSize(100);
     if (!$number) {
         $pdf->displayTitle('<b>' . __('No associated documents', 'pdf') . '</b>');
     } else {
         $pdf->displayTitle('<b>' . __('Associated documents', 'pdf') . '</b>');
         $pdf->setColumnsSize(32, 15, 21, 19, 13);
         $pdf->displayTitle('<b>' . __('Name'), __('File'), __('Web link'), __('Heading'), _('MIME type') . '</b>');
         while ($data = $DB->fetch_assoc($result)) {
             $pdf->displayLine($data["name"], basename($data["filename"]), $data["link"], Html::clean(Dropdown::getDropdownName("glpi_documentcategories", $data["documentcategories_id"])), $data["mime"]);
         }
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:24,代码来源:document.class.php

示例15: countForItem

 static function countForItem(CommonDBTM $item)
 {
     $restrict = "`glpi_documents_items`.`documents_id` = `glpi_documents`.`id`\n                   AND `glpi_documents_items`.`items_id` = '" . $item->getField('id') . "'\n                   AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "'";
     if (getLoginUserID()) {
         $restrict .= getEntitiesRestrictRequest(" AND ", "glpi_documents", '', '', true);
     } else {
         // Anonymous access from FAQ
         $restrict .= " AND `glpi_documents`.`entities_id` = '0' ";
     }
     $nb = countElementsInTable(array('glpi_documents_items', 'glpi_documents'), $restrict);
     // Document case : search in both
     if ($item->getType() == 'Document') {
         $restrict = "`glpi_documents_items`.`items_id` = `glpi_documents`.`id`\n                      AND `glpi_documents_items`.`documents_id` = '" . $item->getField('id') . "'\n                      AND `glpi_documents_items`.`itemtype` = '" . $item->getType() . "'";
         if (getLoginUserID()) {
             $restrict .= getEntitiesRestrictRequest(" AND ", "glpi_documents", '', '', true);
         } else {
             // Anonymous access from FAQ
             $restrict .= " AND `glpi_documents`.`entities_id` = '0' ";
         }
         $nb += countElementsInTable(array('glpi_documents_items', 'glpi_documents'), $restrict);
     }
     return $nb;
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:23,代码来源:document_item.class.php


注:本文中的CommonDBTM类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。