當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WebPage::is_pdf方法代碼示例

本文整理匯總了PHP中WebPage::is_pdf方法的典型用法代碼示例。如果您正苦於以下問題:PHP WebPage::is_pdf方法的具體用法?PHP WebPage::is_pdf怎麽用?PHP WebPage::is_pdf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WebPage的用法示例。


在下文中一共展示了WebPage::is_pdf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetDisplaySet

 /**
  * Get the HTML fragment corresponding to the display of a table representing a set of objects
  * @param WebPage $oPage The page object is used for out-of-band information (mostly scripts) output
  * @param CMDBObjectSet The set of objects to display
  * @param Hash $aExtraParams Some extra configuration parameters to tweak the behavior of the display
  * @return String The HTML fragment representing the table of objects
  */
 public static function GetDisplaySet(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array())
 {
     if ($oPage->IsPrintableVersion() || $oPage->is_pdf()) {
         return self::GetDisplaySetForPrinting($oPage, $oSet, $aExtraParams);
     }
     if (empty($aExtraParams['currentId'])) {
         $iListId = $oPage->GetUniqueId();
         // Works only if not in an Ajax page !!
     } else {
         $iListId = $aExtraParams['currentId'];
     }
     // Initialize and check the parameters
     $bViewLink = isset($aExtraParams['view_link']) ? $aExtraParams['view_link'] : true;
     $sLinkageAttribute = isset($aExtraParams['link_attr']) ? $aExtraParams['link_attr'] : '';
     $iLinkedObjectId = isset($aExtraParams['object_id']) ? $aExtraParams['object_id'] : 0;
     $sTargetAttr = isset($aExtraParams['target_attr']) ? $aExtraParams['target_attr'] : '';
     if (!empty($sLinkageAttribute)) {
         if ($iLinkedObjectId == 0) {
             // if 'links' mode is requested the id of the object to link to must be specified
             throw new ApplicationException(Dict::S('UI:Error:MandatoryTemplateParameter_object_id'));
         }
         if ($sTargetAttr == '') {
             // if 'links' mode is requested the d of the object to link to must be specified
             throw new ApplicationException(Dict::S('UI:Error:MandatoryTemplateParameter_target_attr'));
         }
     }
     $bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true;
     $bTruncated = isset($aExtraParams['truncated']) ? $aExtraParams['truncated'] == true : true;
     $bSelectMode = isset($aExtraParams['selection_mode']) ? $aExtraParams['selection_mode'] == true : false;
     $bSingleSelectMode = isset($aExtraParams['selection_type']) ? $aExtraParams['selection_type'] == 'single' : false;
     $aExtraFieldsRaw = isset($aExtraParams['extra_fields']) ? explode(',', trim($aExtraParams['extra_fields'])) : array();
     $aExtraFields = array();
     foreach ($aExtraFieldsRaw as $sFieldName) {
         // Ignore attributes not of the main queried class
         if (preg_match('/^(.*)\\.(.*)$/', $sFieldName, $aMatches)) {
             $sClassAlias = $aMatches[1];
             $sAttCode = $aMatches[2];
             if ($sClassAlias == $oSet->GetFilter()->GetClassAlias()) {
                 $aExtraFields[] = $sAttCode;
             }
         } else {
             $aExtraFields[] = $sFieldName;
         }
     }
     $sHtml = '';
     $oAppContext = new ApplicationContext();
     $sClassName = $oSet->GetFilter()->GetClass();
     $sZListName = isset($aExtraParams['zlist']) ? $aExtraParams['zlist'] : 'list';
     if ($sZListName !== false) {
         $aList = self::FlattenZList(MetaModel::GetZListItems($sClassName, $sZListName));
         $aList = array_merge($aList, $aExtraFields);
     } else {
         $aList = $aExtraFields;
     }
     // Filter the list to removed linked set since we are not able to display them here
     foreach ($aList as $index => $sAttCode) {
         $oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
         if ($oAttDef instanceof AttributeLinkedSet) {
             // Removed from the display list
             unset($aList[$index]);
         }
     }
     if (!empty($sLinkageAttribute)) {
         // The set to display is in fact a set of links between the object specified in the $sLinkageAttribute
         // and other objects...
         // The display will then group all the attributes related to the link itself:
         // | Link_attr1 | link_attr2 | ... || Object_attr1 | Object_attr2 | Object_attr3 | .. | Object_attr_n |
         $aDisplayList = array();
         $aAttDefs = MetaModel::ListAttributeDefs($sClassName);
         assert(isset($aAttDefs[$sLinkageAttribute]));
         $oAttDef = $aAttDefs[$sLinkageAttribute];
         assert($oAttDef->IsExternalKey());
         // First display all the attributes specific to the link record
         foreach ($aList as $sLinkAttCode) {
             $oLinkAttDef = $aAttDefs[$sLinkAttCode];
             if (!$oLinkAttDef->IsExternalKey() && !$oLinkAttDef->IsExternalField()) {
                 $aDisplayList[] = $sLinkAttCode;
             }
         }
         // Then display all the attributes neither specific to the link record nor to the 'linkage' object (because the latter are constant)
         foreach ($aList as $sLinkAttCode) {
             $oLinkAttDef = $aAttDefs[$sLinkAttCode];
             if ($oLinkAttDef->IsExternalKey() && $sLinkAttCode != $sLinkageAttribute || $oLinkAttDef->IsExternalField() && $oLinkAttDef->GetKeyAttCode() != $sLinkageAttribute) {
                 $aDisplayList[] = $sLinkAttCode;
             }
         }
         // First display all the attributes specific to the link
         // Then display all the attributes linked to the other end of the relationship
         $aList = $aDisplayList;
     }
     $sSelectMode = 'none';
     if ($bSelectMode) {
         $sSelectMode = $bSingleSelectMode ? 'single' : 'multiple';
//.........這裏部分代碼省略.........
開發者ID:besmirzanaj,項目名稱:itop-code,代碼行數:101,代碼來源:cmdbabstract.class.inc.php

示例2: DisplaySet

 public static function DisplaySet(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array())
 {
     if ($oPage->is_pdf()) {
         $oPage->add(self::DisplaySetForPrinting($oPage, $oSet, $aExtraParams));
     } else {
         $oPage->add(self::GetDisplaySet($oPage, $oSet, $aExtraParams));
     }
 }
開發者ID:henryavila,項目名稱:itop,代碼行數:8,代碼來源:cmdbabstract.class.inc.php


注:本文中的WebPage::is_pdf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。