本文整理汇总了PHP中Document::getTypeName方法的典型用法代码示例。如果您正苦于以下问题:PHP Document::getTypeName方法的具体用法?PHP Document::getTypeName怎么用?PHP Document::getTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::getTypeName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTableGroup
/**
* Get the group of elements regarding given item.
* Two kind of item :
* - Device* feed by a link to the attached item (Computer, Printer ...)
* - Computer, Printer ...: feed by the "global" properties of the CommonDevice
* Then feed with the specificities of the Item_Device elements
* In cas of $item is an instance, then $options contains the type of the item (Computer,
* Printer ...).
*
* @param $item
* @param $table
* @param $options array
* @param $delete_all_column (default NULL)
* @param $common_column
* @param $specific_column
* @param $delete_column (default NULL)
* @param $dynamic_column
**/
function getTableGroup(CommonDBTM $item, HTMLTableMain $table, array $options, HTMLTableSuperHeader $delete_all_column = NULL, HTMLTableSuperHeader $common_column, HTMLTableSuperHeader $specific_column, HTMLTableSuperHeader $delete_column = NULL, $dynamic_column)
{
global $DB;
$is_device = $item instanceof CommonDevice;
if ($is_device) {
$peer_type = $options['itemtype'];
if (empty($peer_type)) {
$column_label = __('Dissociated devices');
$group_name = 'None';
} else {
$column_label = $peer_type::getTypeName(Session::getPluralNumber());
$group_name = $peer_type;
}
$table_group = $table->createGroup($group_name, '');
$peer_column = $table_group->addHeader('item', $column_label, $common_column, NULL);
if (!empty($peer_type)) {
//TRANS : %1$s is the type of the device
// %2$s is the type of the item
// %3$s is the name of the item (used for headings of a list),
$itemtype_nav_title = sprintf(__('%1$s of %2$s: %3$s'), $peer_type::getTypeName(Session::getPluralNumber()), $item->getTypeName(1), $item->getName());
$peer_column->setItemType($peer_type, $itemtype_nav_title);
}
} else {
$peer_type = $this->getDeviceType();
$table_group = $table->createGroup($peer_type, '');
//TRANS : %1$s is the type of the device
// %2$s is the type of the item
// %3$s is the name of the item (used for headings of a list),
$options['itemtype_title'] = sprintf(__('%1$s of %2$s: %3$s'), $peer_type::getTypeName(Session::getPluralNumber()), $item->getTypeName(1), $item->getName());
$peer_type::getHTMLTableHeader($item->getType(), $table_group, $common_column, NULL, $options);
}
$specificity_columns = array();
$link_column = $table_group->addHeader('spec_link', '', $specific_column);
$spec_column = $link_column;
foreach ($this->getSpecificities() as $field => $attributs) {
$spec_column = $table_group->addHeader('spec_' . $field, $attributs['long name'], $specific_column, $spec_column);
$specificity_columns[$field] = $spec_column;
}
$infocom_column = $table_group->addHeader('infocom', Infocom::getTypeName(Session::getPluralNumber()), $specific_column, $spec_column);
$document_column = $table_group->addHeader('document', Document::getTypeName(Session::getPluralNumber()), $specific_column, $spec_column);
if ($item->isDynamic()) {
$dynamics_column = $table_group->addHeader('one', ' ', $dynamic_column, $spec_column);
$previous_column = $dynamics_column;
} else {
$previous_column = $spec_column;
}
if ($options['canedit']) {
$group_checkbox_tag = empty($peer_type) ? '__' : $peer_type;
$content = Html::getCheckbox(array('criterion' => array('tag_for_massive' => $group_checkbox_tag)));
$delete_one = $table_group->addHeader('one', $content, $delete_column, $previous_column);
}
if ($is_device) {
$fk = 'items_id';
// Entity restrict
$leftjoin = '';
$where = "";
if (!empty($peer_type)) {
$leftjoin = "LEFT JOIN `" . getTableForItemType($peer_type) . "`\n ON (`" . $this->getTable() . "`.`items_id` = `" . getTableForItemType($peer_type) . "`.`id`\n AND `" . $this->getTable() . "`.`itemtype` = '{$peer_type}')";
$where = getEntitiesRestrictRequest(" AND", getTableForItemType($peer_type));
}
$query = "SELECT `" . $this->getTable() . "`.*\n FROM `" . $this->getTable() . "`\n {$leftjoin}\n WHERE `" . $this->getDeviceForeignKey() . "` = '" . $item->getID() . "'\n AND `" . $this->getTable() . "`.`itemtype` = '{$peer_type}'\n AND `" . $this->getTable() . "`.`is_deleted` = '0'\n {$where}\n ORDER BY `" . $this->getTable() . "`.`itemtype`, `" . $this->getTable() . "`.`{$fk}`";
} else {
$fk = $this->getDeviceForeignKey();
$query = "SELECT *\n FROM `" . $this->getTable() . "`\n WHERE `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'\n AND `is_deleted` = '0'\n ORDER BY {$fk}";
}
if (!empty($peer_type)) {
$peer = new $peer_type();
$peer->getEmpty();
} else {
$peer = NULL;
}
foreach ($DB->request($query) as $link) {
Session::addToNavigateListItems(static::getType(), $link["id"]);
$this->getFromDB($link['id']);
if (is_null($peer) || $link[$fk] != $peer->getID()) {
if ($peer instanceof CommonDBTM) {
$peer->getFromDB($link[$fk]);
}
$current_row = $table_group->createRow();
$peer_group = $peer_type . '_' . $link[$fk] . '_' . mt_rand();
$current_row->setHTMLID($peer_group);
if ($options['canedit']) {
//.........这里部分代码省略.........
示例2: Copyright
based on GLPI - Gestionnaire Libre de Parc Informatique
Copyright (C) 2003-2014 by the INDEPNET Development Team.
-------------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("document", READ);
Html::header(Document::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "management", "document");
Search::show('Document');
Html::footer();
示例3: sprintf
$doc->redirectToList();
} else {
if (isset($_POST["restore"])) {
$doc->check($_POST["id"], 'd');
if ($doc->restore($_POST)) {
Event::log($_POST["id"], "documents", 4, "document", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
}
$doc->redirectToList();
} else {
if (isset($_POST["purge"])) {
$doc->check($_POST["id"], 'd');
if ($doc->delete($_POST, 1)) {
Event::log($_POST["id"], "documents", 4, "document", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
}
$doc->redirectToList();
} else {
if (isset($_POST["update"])) {
$doc->check($_POST["id"], 'w');
if ($doc->update($_POST)) {
Event::log($_POST["id"], "documents", 4, "document", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
}
Html::back();
} else {
Html::header(Document::getTypeName(2), $_SERVER['PHP_SELF'], "financial", "document");
$doc->showForm($_GET["id"]);
Html::footer();
}
}
}
}
}
示例4: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
$nbdoc = $nbitem = 0;
switch ($item->getType()) {
case 'Document':
$ong = array();
if ($_SESSION['glpishow_count_on_tabs']) {
$nbdoc = self::countForDocument($item);
$nbitem = self::countForItem($item);
}
$ong[1] = self::createTabEntry(_n('Associated item', 'Associated items', Session::getPluralNumber()), $nbdoc);
$ong[2] = self::createTabEntry(Document::getTypeName(Session::getPluralNumber()), $nbitem);
return $ong;
default:
// Can exist for template
if (Document::canView() || $item->getType() == 'Ticket' || $item->getType() == 'Reminder' || $item->getType() == 'KnowbaseItem') {
if ($_SESSION['glpishow_count_on_tabs']) {
$nbitem = self::countForItem($item);
}
return self::createTabEntry(Document::getTypeName(Session::getPluralNumber()), $nbitem);
}
}
return '';
}
示例5: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
if ($item->getType() == __CLASS__) {
return __('See the map', 'positions');
} else {
if ($item->getType() == "Location") {
if ($_SESSION['glpishow_count_on_tabs']) {
return self::createTabEntry(Document::getTypeName(Session::getPluralNumber()), Document_Item::countForItem($item));
}
return Document::getTypeName(Session::getPluralNumber());
} else {
if (in_array($item->getType(), self::getTypes(true)) && Session::haveRight('plugin_positions', READ)) {
if ($_SESSION['glpishow_count_on_tabs']) {
return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), self::countForItem($item));
}
return self::getTypeName(Session::getPluralNumber());
}
}
}
}
return '';
}
示例6: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
switch ($item->getType()) {
case 'Document':
$ong = array();
if ($_SESSION['glpishow_count_on_tabs']) {
$ong[1] = self::createTabEntry(_n('Associated item', 'Associated items', self::countForDocument($item)));
}
$ong[1] = _n('Associated item', 'Associated items', 2);
if ($_SESSION['glpishow_count_on_tabs']) {
$ong[2] = Document::createTabEntry(Document::getTypeName(2), self::countForItem($item));
}
$ong[2] = Document::getTypeName(2);
return $ong;
default:
// Can exist for template
if (Session::haveRight("document", "r") || $item->getType() == 'Ticket' || $item->getType() == 'KnowbaseItem') {
if ($_SESSION['glpishow_count_on_tabs']) {
return Document::createTabEntry(Document::getTypeName(2), self::countForItem($item));
}
return Document::getTypeName(2);
}
}
return '';
}
示例7: dropdownTaskItems
function dropdownTaskItems($ID, $name, $used = array())
{
global $DB, $CFG_GLPI;
$restrict = "`plugin_projet_projets_id` = '{$ID}'";
$items = getAllDatasFromTable("glpi_plugin_projet_projets_items", $restrict);
$restrictdoc = "`items_id` = '{$ID}' AND `itemtype` = 'PluginProjetProjet'";
$docs = getAllDatasFromTable("glpi_documents_items", $restrictdoc);
$restrictcontract = "`items_id` = '{$ID}' AND `itemtype` = 'PluginProjetProjet'";
$contracts = getAllDatasFromTable("glpi_contracts_items", $restrictcontract);
echo "<select name='{$name}'>";
echo "<option value='0' selected>" . Dropdown::EMPTY_VALUE . "</option>";
if (!empty($items)) {
foreach ($items as $item) {
$table = getTableForItemType($item["itemtype"]);
$query = "SELECT `" . $table . "`.*\n FROM `glpi_plugin_projet_projets_items`\n INNER JOIN `" . $table . "` ON (`" . $table . "`.`id` = `glpi_plugin_projet_projets_items`.`items_id`)\n WHERE `glpi_plugin_projet_projets_items`.`itemtype` = '" . $item["itemtype"] . "'\n AND `glpi_plugin_projet_projets_items`.`items_id` = '" . $item["items_id"] . "' ";
if (count($used)) {
$query .= " AND `" . $table . "`.`id` NOT IN (0";
foreach ($used as $ID) {
$query .= ",{$ID}";
}
$query .= ")";
}
$query .= " GROUP BY `" . $table . "`.`name`";
$query .= " ORDER BY `" . $table . "`.`name`";
$result_linked = $DB->query($query);
if ($DB->numrows($result_linked)) {
while ($data = $DB->fetch_assoc($result_linked)) {
$name = $data["name"];
$itemclass = new $item["itemtype"]();
if ($item["itemtype"] == 'User') {
$name = getUserName($data["id"]);
}
echo "<option value='" . $data["id"] . "," . $item["itemtype"] . "'>" . $itemclass->getTypeName() . " - " . $name;
if (empty($data["name"]) || $_SESSION["glpiis_ids_visible"] == 1) {
echo " (";
echo $data["id"] . ")";
}
echo "</option>";
}
}
}
}
if (!empty($docs)) {
foreach ($docs as $doc) {
$docclass = new Document();
if ($docclass->getFromDB($doc["documents_id"])) {
$name = $docclass->fields["name"];
echo "<option value='" . $doc["documents_id"] . ",Document'>" . $docclass->getTypeName() . " - " . $name;
if (empty($name) || $_SESSION["glpiis_ids_visible"] == 1) {
echo " (";
echo $doc["documents_id"] . ")";
}
echo "</option>";
}
}
}
if (!empty($contracts)) {
foreach ($contracts as $contract) {
$contractclass = new Contract();
if ($contractclass->getFromDB($contract["contracts_id"])) {
$name = $contractclass->fields["name"];
echo "<option value='" . $contract["contracts_id"] . ",Contract'>" . $contractclass->getTypeName() . " - " . $name;
if (empty($name) || $_SESSION["glpiis_ids_visible"] == 1) {
echo " (";
echo $contract["contracts_id"] . ")";
}
echo "</option>";
}
}
}
echo "</select>";
}