本文整理汇总了PHP中Toolbox::ucfirst方法的典型用法代码示例。如果您正苦于以下问题:PHP Toolbox::ucfirst方法的具体用法?PHP Toolbox::ucfirst怎么用?PHP Toolbox::ucfirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toolbox
的用法示例。
在下文中一共展示了Toolbox::ucfirst方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
return;
if ($item->getType() == 'PluginCustomTab' && $item->canView()) {
return Toolbox::ucfirst(_n("Profile", "Profiles", 1));
}
return '';
}
示例2: pdfDevice
static function pdfDevice(PluginPdfSimplePDF $pdf, Computer $computer)
{
global $DB;
$devtypes = Item_Devices::getDeviceTypes();
$ID = $computer->getField('id');
if (!$computer->can($ID, 'r')) {
return false;
}
$pdf->setColumnsSize(100);
$pdf->displayTitle('<b>' . Toolbox::ucfirst(_n('Component', 'Components', 2)) . '</b>');
$pdf->setColumnsSize(3, 14, 42, 41);
foreach ($devtypes as $itemtype) {
$devicetypes = new $itemtype();
$specificities = $devicetypes->getSpecificities();
$specif_fields = array_keys($specificities);
$specif_text = implode(',', $specif_fields);
if (!empty($specif_text)) {
$specif_text = " ," . $specif_text . " ";
}
$associated_type = str_replace('Item_', '', $itemtype);
$linktable = getTableForItemType($itemtype);
$fk = getForeignKeyFieldForTable(getTableForItemType($associated_type));
$query = "SELECT count(*) AS NB, `id`, `" . $fk . "`" . $specif_text . "\n FROM `" . $linktable . "`\n WHERE `items_id` = '" . $ID . "'\n AND `itemtype` = 'Computer'\n GROUP BY `" . $fk . "`" . $specif_text;
$device = new $associated_type();
foreach ($DB->request($query) as $data) {
if ($device->getFromDB($data[$fk])) {
$spec = $device->getAdditionalFields();
$col4 = '';
if (count($spec)) {
$colspan = 60 / count($spec);
foreach ($spec as $i => $label) {
if (isset($device->fields[$label["name"]]) && !empty($device->fields[$label["name"]])) {
if ($label["type"] == "dropdownValue" && $device->fields[$label["name"]] != 0) {
$table = getTableNameForForeignKeyField($label["name"]);
$value = Dropdown::getDropdownName($table, $device->fields[$label["name"]]);
$col4 .= '<b><i>' . sprintf(__('%1$s: %2$s'), $label["label"] . '</i></b>', Html::clean($value) . " ");
} else {
$value = $device->fields[$label["name"]];
$col4 .= '<b><i>' . sprintf(__('%1$s: %2$s'), $label["label"] . '</i></b>', $value . " ");
}
} else {
if (isset($device->fields[$label["name"] . "_default"]) && !empty($device->fields[$label["name"] . "_default"])) {
$col4 .= '<b><i>' . sprintf(__('%1$s: %2$s'), $label["label"] . '</i></b>', $device->fields[$label["name"] . "_default"] . " ");
}
}
}
}
$pdf->displayLine($data['NB'], $device->getTypeName(), $device->getName(), $col4);
}
}
}
$pdf->displaySpace();
}
示例3: getItemTypeForTable
/**
* Return ItemType for a table
*
* @param $table string table name
*
* @return string itemtype corresponding to a table name parameter
**/
function getItemTypeForTable($table)
{
global $CFG_GLPI;
if (isset($CFG_GLPI['glpiitemtypetables'][$table])) {
return $CFG_GLPI['glpiitemtypetables'][$table];
} else {
$inittable = $table;
$table = str_replace("glpi_", "", $table);
$prefix = "";
if (preg_match('/^plugin_([a-z0-9]+)_/', $table, $matches)) {
$table = preg_replace('/^plugin_[a-z0-9]+_/', '', $table);
$prefix = "Plugin" . Toolbox::ucfirst($matches[1]);
}
if (strstr($table, '_')) {
$split = explode('_', $table);
foreach ($split as $key => $part) {
$split[$key] = Toolbox::ucfirst(getSingular($part));
}
$table = implode('_', $split);
} else {
$table = Toolbox::ucfirst(getSingular($table));
}
$itemtype = $prefix . $table;
// Get real existence of itemtype
if ($item = getItemForItemtype($itemtype)) {
$itemtype = get_class($item);
$CFG_GLPI['glpiitemtypetables'][$inittable] = $itemtype;
$CFG_GLPI['glpitablesitemtype'][$itemtype] = $inittable;
return $itemtype;
}
return "UNKNOWN";
}
}
示例4: getItemtypeByInjectionClass
/**
* Get an itemtype by giving an injection class object
*
* @param $injectionClassName the injection class object
*
* @return an instance of the itemtype associated to the injection class
*/
static function getItemtypeByInjectionClass($injectionClass)
{
return Toolbox::ucfirst(getItemTypeForTable($injectionClass->getTable()));
}