Exemple #1
0
/**
 * Displays the details of an object
 * @param $oP WebPage Page for the output
 * @param $sClass string The name of the class of the object
 * @param $oObj DBObject The object to display
 * @param $id mixed Identifier of the object (name or ID)
 */
function DisplayDetails($oP, $sClass, $oObj, $id)
{
    $sClassLabel = MetaModel::GetName($sClass);
    $oSearch = new DBObjectSearch($sClass);
    $oBlock = new DisplayBlock($oSearch, 'search', false);
    $oBlock->Display($oP, 0);
    // The object could be listed, check if it is actually allowed to view it
    $oSet = CMDBObjectSet::FromObject($oObj);
    if (UserRights::IsActionAllowed($sClass, UR_ACTION_READ, $oSet) == UR_ALLOWED_NO) {
        throw new SecurityException('User not allowed to view this object', array('class' => $sClass, 'id' => $id));
    }
    $oP->set_title(Dict::Format('UI:DetailsPageTitle', $oObj->GetRawName(), $sClassLabel));
    // Set title will take care of the encoding
    $oObj->DisplayDetails($oP);
}