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


PHP Group::getTypeName方法代码示例

本文整理汇总了PHP中Group::getTypeName方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::getTypeName方法的具体用法?PHP Group::getTypeName怎么用?PHP Group::getTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


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

示例1: pdfForGroup

 static function pdfForGroup(PluginPdfSimplePDF $pdf, Group $group, $tree)
 {
     global $DB, $CFG_GLPI;
     $used = array();
     $ids = array();
     // Retrieve member list
     $entityrestrict = Group_User::getDataForGroup($group, $used, $ids, '', $tree);
     $title = "<b>" . sprintf(__('%1$s (%2$s)'), _n('User', 'Users', 2) . "</b>", __('D=Dynamic'));
     $number = count($used);
     if ($number > $_SESSION['glpilist_limit']) {
         $title = sprintf(__('%1$s (%2$s)'), $title, $_SESSION['glpilist_limit'] . "/" . $number);
     } else {
         $title = sprintf(__('%1$s (%2$s)'), $title, $number);
     }
     $pdf->setColumnsSize(100);
     $pdf->displayTitle($title);
     if ($number) {
         $user = new User();
         $group = new Group();
         if ($tree) {
             $pdf->setColumnsSize(35, 45, 10, 10);
             $pdf->displayTitle(User::getTypeName(1), Group::getTypeName(1), __('Manager'), __('Delegatee'));
         } else {
             $pdf->setColumnsSize(60, 20, 20);
             $pdf->displayTitle(User::getTypeName(1), __('Manager'), __('Delegatee'));
         }
         for ($i = 0; $i < $number && $i < $_SESSION['glpilist_limit']; $i++) {
             $data = $used[$i];
             $name = Html::clean(getUserName($data["id"]));
             if ($data["is_dynamic"]) {
                 $name = sprintf(__('%1$s (%2$s)'), $name, '<b>' . __('D') . '</b>');
             }
             if ($tree) {
                 $group->getFromDB($data["groups_id"]);
                 $pdf->displayLine($name, $group->getName(), Dropdown::getYesNo($data['is_manager']), Dropdown::getYesNo($data['is_userdelegate']));
             } else {
                 $pdf->displayLine($name, Dropdown::getYesNo($data['is_manager']), Dropdown::getYesNo($data['is_userdelegate']));
             }
         }
     } else {
         $pdf->setColumnsAlign('center');
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:45,代码来源:group_user.class.php

示例2: pdfItems

 static function pdfItems(PluginPdfSimplePDF $pdf, Group $group, $tech, $tree, $user)
 {
     global $CFG_GLPI;
     if ($tech) {
         $types = $CFG_GLPI['linkgroup_tech_types'];
         $field = 'groups_id_tech';
         $title = __('Managed items');
     } else {
         $types = $CFG_GLPI['linkgroup_types'];
         $field = 'groups_id';
         $title = __('Used items');
     }
     $datas = array();
     $max = $group->getDataItems($types, $field, $tree, $user, 0, $datas);
     $nb = count($datas);
     if ($nb < $max) {
         $title = sprintf(__('%1$s (%2$s)'), $title, $nb / $max);
     } else {
         $title = sprintf(__('%1$s (%2$s)'), $title, $nb);
     }
     $pdf->setColumnsSize(100);
     $pdf->displayTitle($title);
     if ($nb) {
         if ($tree || $user) {
             $pdf->setColumnsSize(16, 20, 34, 30);
             $pdf->displayTitle(__('Type'), __('Name'), __('Entity'), Group::getTypeName(1) . " / " . User::getTypeName(1));
         } else {
             $pdf->setColumnsSize(20, 25, 55);
             $pdf->displayTitle(__('Type'), __('Name'), __('Entity'));
         }
     } else {
         $pdf->displayLine(__('No item found'));
     }
     $tmpgrp = new Group();
     $tmpusr = new User();
     foreach ($datas as $data) {
         if (!($item = getItemForItemtype($data['itemtype']))) {
             continue;
         }
         $item->getFromDB($data['items_id']);
         $col4 = '';
         if ($tree || $user) {
             if ($grp = $item->getField($field)) {
                 if ($tmpgrp->getFromDB($grp)) {
                     $col4 = $tmpgrp->getNameID();
                 }
             } else {
                 if ($usr = $item->getField(str_replace('groups', 'users', $field))) {
                     $col4 = Html::clean(getUserName($usr));
                 }
             }
         }
         $pdf->displayLine($item->getTypeName(1), $item->getName(), Html::clean(Dropdown::getDropdownName("glpi_entities", $item->getEntityID())), $col4);
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:56,代码来源:group.class.php

示例3: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         switch ($item->getType()) {
             case 'User':
                 if (Group::canView()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         return self::createTabEntry(Group::getTypeName(Session::getPluralNumber()), countElementsInTable($this->getTable(), "users_id\n                                                                        = '" . $item->getID() . "'"));
                     }
                     return Group::getTypeName(Session::getPluralNumber());
                 }
                 break;
             case 'Group':
                 if (User::canView()) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         return self::createTabEntry(User::getTypeName(Session::getPluralNumber()), countElementsInTable("glpi_groups_users", "`groups_id`\n                                                                        = '" . $item->getID() . "'"));
                     }
                     return User::getTypeName(Session::getPluralNumber());
                 }
                 break;
         }
     }
     return '';
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:24,代码来源:group_user.class.php

示例4: Group

-------------------------------------------------------------------------

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("group", READ);
Html::header(Group::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "admin", "group");
$group = new Group();
$group->title();
Search::show('Group');
Html::footer();
开发者ID:glpi-project,项目名称:glpi,代码行数:30,代码来源:group.php

示例5: Group

}
$group = new Group();
if (isset($_POST["add"])) {
    $group->check(-1, CREATE, $_POST);
    if ($newID = $group->add($_POST)) {
        Event::log($newID, "groups", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($group->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["purge"])) {
        $group->check($_POST["id"], PURGE);
        if ($group->isUsed() && empty($_POST["forcepurge"])) {
            Html::header($group->getTypeName(1), $_SERVER['PHP_SELF'], "admin", "group", str_replace('glpi_', '', $group->getTable()));
            $group->showDeleteConfirmForm($_SERVER['PHP_SELF']);
            Html::footer();
        } else {
            $group->delete($_POST, 1);
            Event::log($_POST["id"], "groups", 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
            $group->redirectToList();
        }
    } else {
        if (isset($_POST["update"])) {
            $group->check($_POST["id"], UPDATE);
            $group->update($_POST);
            Event::log($_POST["id"], "groups", 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
        } else {
            if (isset($_GET['_in_modal'])) {
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:group.form.php

示例6: showForGroup

 /**
  * Display notification registered for a group
  *
  * @since version 0.83
  *
  * @param $group Group object
  *
  * @return nothing
  **/
 static function showForGroup(Group $group)
 {
     global $DB;
     if (!Notification::canView()) {
         return false;
     }
     $sql = "SELECT `glpi_notifications`.`id`\n              FROM `glpi_notificationtargets`\n              INNER JOIN `glpi_notifications`\n                    ON (`glpi_notifications`.`id` = `glpi_notificationtargets`.`notifications_id`)\n              WHERE `items_id` = '" . $group->getID() . "'\n                    AND (`type` = '" . Notification::SUPERVISOR_GROUP_TYPE . "'\n                         OR `type` = '" . Notification::GROUP_TYPE . "') " . getEntitiesRestrictRequest('AND', 'glpi_notifications', '', '', true);
     $req = $DB->request($sql);
     echo "<table class='tab_cadre_fixe'>";
     if ($req->numrows()) {
         echo "<tr><th>" . __('Name') . "</th>";
         echo "<th>" . Entity::getTypeName(1) . "</th>";
         echo "<th>" . __('Active') . "</th>";
         echo "<th>" . __('Type') . "</th>";
         echo "<th>" . __('Notification method') . "</th>";
         echo "<th>" . NotificationEvent::getTypeName(1) . "</th>";
         echo "<th>" . NotificationTemplate::getTypeName(1) . "</th></tr>";
         $notif = new Notification();
         Session::initNavigateListItems('Notification', sprintf(__('%1$s = %2$s'), Group::getTypeName(1), $group->getName()));
         foreach ($req as $data) {
             Session::addToNavigateListItems('Notification', $data['id']);
             if ($notif->getFromDB($data['id'])) {
                 echo "<tr class='tab_bg_2'><td>" . $notif->getLink();
                 echo "</td><td>" . Dropdown::getDropdownName('glpi_entities', $notif->getEntityID());
                 echo "</td><td>" . Dropdown::getYesNo($notif->getField('is_active')) . "</td><td>";
                 $itemtype = $notif->getField('itemtype');
                 if ($tmp = getItemForItemtype($itemtype)) {
                     echo $tmp->getTypeName(1);
                 } else {
                     echo "&nbsp;";
                 }
                 echo "</td><td>" . Notification::getMode($notif->getField('mode'));
                 echo "</td><td>" . NotificationEvent::getEventName($itemtype, $notif->getField('event'));
                 echo "</td>" . "<td>" . Dropdown::getDropdownName('glpi_notificationtemplates', $notif->getField('notificationtemplates_id'));
                 echo "</td></tr>";
             }
         }
     } else {
         echo "<tr class='tab_bg_2'><td class='b center'>" . __('No item found') . "</td></tr>";
     }
     echo "</table>";
 }
开发者ID:kipman,项目名称:glpi,代码行数:51,代码来源:notificationtarget.class.php

示例7: Group

http://indepnet.net/   http://glpi-project.org
-------------------------------------------------------------------------

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("group", "r");
Html::header(Group::getTypeName(2), $_SERVER['PHP_SELF'], "admin", "group");
$group = new Group();
$group->title();
Search::show('Group');
Html::footer();
开发者ID:gaforeror,项目名称:glpi,代码行数:31,代码来源:group.php

示例8: showForGroup

 /**
  * Show users of a group
  *
  * @param $target string : where to go on action
  * @param $group the group
  **/
 static function showForGroup($target, Group $group)
 {
     global $DB, $LANG;
     $ID = $group->fields['id'];
     if (!haveRight("user", "r") || !$group->can($ID, 'r')) {
         return false;
     }
     // Have right to manage members
     $canedit = $group->can($ID, 'r') && $group->canUpdate();
     $rand = mt_rand();
     $nb_per_line = 3;
     $query = "SELECT `glpi_users`.*,\n                       `glpi_groups_users`.`id` AS linkID,\n                       `glpi_groups_users`.`is_dynamic` AS is_dynamic\n                FROM `glpi_groups_users`\n                LEFT JOIN `glpi_users` ON (`glpi_users`.`id` = `glpi_groups_users`.`users_id`)\n                WHERE `glpi_groups_users`.`groups_id`='{$ID}'\n                ORDER BY `glpi_users`.`name`,\n                         `glpi_users`.`realname`,\n                         `glpi_users`.`firstname`";
     $used = array();
     $result = $DB->query($query);
     if ($DB->numrows($result) > 0) {
         while ($data = $DB->fetch_array($result)) {
             $used[$data["id"]] = $data;
         }
     }
     $used_ids = array_keys($used);
     if ($canedit) {
         $headerspan = $nb_per_line * 2;
         echo "<form name='groupuser_form{$rand}' id='groupuser_form{$rand}' method='post'\n                action='{$target}'>";
         echo "<input type='hidden' name='groups_id' value='{$ID}'>";
         if ($group->fields['is_recursive']) {
             $entityrestrict = getSonsOf('glpi_entities', $group->fields['entities_id']);
             // active entity could be a child of object entity
             if ($_SESSION['glpiactive_entity'] != $group->fields['entities_id'] && in_array($_SESSION['glpiactive_entity'], $entityrestrict)) {
                 $entityrestrict = getSonsOf('glpi_entities', $_SESSION['glpiactive_entity']);
             }
         } else {
             $entityrestrict = $group->fields['entities_id'];
         }
         $res = User::getSqlSearchResult(true, "all", $entityrestrict, 0, $used_ids);
         $nb = $res ? $DB->result($res, 0, "CPT") : 0;
         if ($nb) {
             echo "<div class='firstbloc'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr class='tab_bg_1'><th colspan='2'>" . $LANG['setup'][603] . "</tr>";
             echo "<tr><td class='tab_bg_2 center'>";
             User::dropdown(array('right' => "all", 'entity' => $entityrestrict, 'used' => $used_ids));
             echo "</td><td class='tab_bg_2 center'>";
             echo "<input type='hidden' name'is_dynamic' value='0'>";
             echo "<input type='submit' name='adduser' value=\"" . $LANG['buttons'][8] . "\"\n                   class='submit'>";
             echo "</td></tr>";
             echo "</table></div>";
         }
     } else {
         $headerspan = $nb_per_line;
     }
     if (count($used)) {
         echo "<div class='spaced'><table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='{$headerspan}'>" . $LANG['Menu'][14] . " (D=" . $LANG['profiles'][29] . ")";
         echo "</th></tr>";
         initNavigateListItems('User', $group->getTypeName() . " = " . $group->getName());
         $i = 0;
         $user = new User();
         foreach ($used as $id => $data) {
             if (!$user->can($id, 'r')) {
                 // For recursive group, could be in another (sister) entity
                 continue;
             }
             addToNavigateListItems('User', $data["id"]);
             if ($i % $nb_per_line == 0) {
                 if ($i != 0) {
                     echo "</tr>";
                 }
                 echo "<tr class='tab_bg_1'>";
             }
             if ($canedit) {
                 echo "<td width='10'>";
                 $sel = "";
                 if (isset($_GET["select"]) && $_GET["select"] == "all") {
                     $sel = "checked";
                 }
                 echo "<input type='checkbox' name='item[" . $data["linkID"] . "]' value='1' {$sel}>";
                 echo "</td>";
             }
             echo "<td>";
             echo $user->getLink();
             if ($data["is_dynamic"]) {
                 echo "<strong>&nbsp;(D)</strong>";
             }
             echo "</td>";
             $i++;
         }
         while ($i % $nb_per_line != 0) {
             echo "<td>&nbsp;</td>";
             if ($canedit) {
                 echo "<td>&nbsp;</td>";
             }
             $i++;
         }
         echo "</tr>";
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:group_user.class.php

示例9: showGrupos

 static function showGrupos(CommonDBTM $item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $objeto = $item->getType();
     $appli = new $objeto();
     $ID = $item->fields['id'];
     $appli->getFromDB($item->fields['id']);
     //$canedit = $appli->can($appli->fields['id'],'w');
     $canedit = $appli->canCreate();
     //$canedit = Session::haveRight('update_ticket', 1);
     $rand = mt_rand();
     $groups = self::getFormGroups($ID);
     $used = array();
     if (!empty($groups)) {
         foreach ($groups as $data) {
             $used[$data["id"]] = $data["id"];
         }
     }
     echo "<div class='center'>";
     echo "<form name='form_grupo' id='form_grupo' method='post' action='../front/formgroup.form.php'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<th colspan=2>" . __('Grupos', 'Grupos') . "</th>";
     echo "<tr>";
     echo "<th>" . __('Grupo', 'Grupo') . "&nbsp;:" . "</th>";
     echo "<td>";
     if ($canedit) {
         Group::dropdown(array('name' => 'groups_id', 'entity' => $_SESSION['glpiactive_entity'], 'condition' => '`is_assign`'));
     }
     echo "</td>";
     //-----------------------------
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='2' align = 'center'>";
     echo "<input type='submit' name='agregarGrupo' value='Agregar' class='submit'>";
     echo "</td></tr>";
     echo "</table>";
     echo "<input type='hidden' name='itemtype' value='Group'>";
     echo "<input type='hidden' name='peticion_id' value='" . $item->fields['id'] . "'>";
     //echo "</form>";
     Html::closeForm();
     echo "</div>";
     // Listado de Grupos
     echo "<div class='spaced'>";
     /*
           if ($canedit && count($used)) {
              $rand = mt_rand();
              Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
              echo "<input type='hidden' name='plugin_formcreator_forms_id' value='".$item->fields['id']."'>";
              $massiveactionparams = array('num_displayed' => count($used),
                                'container'     => 'mass'.__CLASS__.$rand);
              Html::showMassiveActions($massiveactionparams);
           }*/
     if ($canedit && $withtemplate < 2) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => count($used));
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov'>";
     $header_begin = "<tr>";
     $header_top = '';
     $header_bottom = '';
     $header_end = '';
     if ($canedit && count($used)) {
         $header_begin .= "<th width='10'>";
         $header_top .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_bottom .= Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_end .= "</th>";
     }
     $header_end .= "<th>" . Group::getTypeName(1) . "</th>";
     echo $header_begin . $header_top . $header_end;
     $group = new Group();
     if (!empty($groups)) {
         Session::initNavigateListItems('PluginFormcreatorForm', sprintf(__('%1$s = %2$s'), $item::getTypeName(1), $item->getName()));
         foreach ($groups as $data) {
             if (!$group->getFromDB($data["id"])) {
                 continue;
             }
             Session::addToNavigateListItems('PluginFormcreatorForm', $data["id"]);
             echo "<tr class='tab_bg_1'>";
             if ($canedit && count($used)) {
                 echo "<td width='10'>";
                 // echo __CLASS__;
                 Html::showMassiveActionCheckBox('PluginFormcreatorForm_Item', $data["linkID"]);
                 echo "</td>";
             }
             $link = $data["completename"];
             if ($_SESSION["glpiis_ids_visible"]) {
                 $link = sprintf(__('%1$s (%2$s)'), $link, $data["id"]);
             }
             $href = "<a href='" . $CFG_GLPI["root_doc"] . "/front/group.form.php?id=" . $data["id"] . "'>" . $link . "</a>";
             echo "<td>" . $group->getLink() . "</td>";
             echo "</tr>";
         }
         echo $header_begin . $header_bottom . $header_end;
     } else {
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='5' class='center'>" . __('None') . "</td></tr>";
     }
     echo "</table>";
     if ($canedit && count($used)) {
//.........这里部分代码省略.........
开发者ID:OscarLoayzaB,项目名称:formcreator,代码行数:101,代码来源:formgroup.class.php


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