Document_Item::showForItem PHP Method

showForItem() static public method

Show documents associated to an item
static public showForItem ( CommonDBTM $item, $withtemplate = '' )
$item CommonDBTM CommonDBTM object for which associated documents must be displayed
$withtemplate (default '')
    static function showForItem(CommonDBTM $item, $withtemplate = '')
    {
        $ID = $item->getField('id');
        if ($item->isNewID($ID)) {
            return false;
        }
        if ($item->getType() != 'Ticket' && $item->getType() != 'KnowbaseItem' && $item->getType() != 'Reminder' && !Document::canView()) {
            return false;
        }
        $params = array();
        $params['rand'] = mt_rand();
        self::showAddFormForItem($item, $withtemplate, $params);
        self::showListForItem($item, $withtemplate, $params);
    }

Usage Example

Exemplo n.º 1
0
 static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     $self = new self();
     if ($item->getType() == __CLASS__) {
         self::showAddPosition($item);
     } else {
         if ($item->getType() == "Location") {
             Document_Item::showForItem($item, $withtemplate);
         } else {
             if (in_array($item->getType(), self::getTypes(true))) {
                 $self->showPluginFromItems(get_class($item), $item->getField('id'));
             }
         }
     }
     return true;
 }