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


PHP Templates::getFromParent方法代码示例

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


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

示例1: buildXmlNodes

 private static function buildXmlNodes($intElmntId = 0, $strType = "elements", $strAction = "list", $childId = 0, $strChildren = "")
 {
     global $objLang, $objLiveUser;
     $strReturn = "";
     switch ($strType) {
         case "elements-ckeditor":
         case "elements":
             $objElements = Elements::getFromParent($intElmntId);
             foreach ($objElements as $objElement) {
                 if ($objLiveUser->checkRightLevel(PUNCHCMS_ELEMENTS_VIEW, $objElement->getPermissions()->getUserId(), $objElement->getPermissions()->getGroupId())) {
                     $objChildren = $objElement->getElements();
                     $isPage = $objElement->isPage() ? 'font-weight:bold;' : '';
                     if (is_object($objChildren) && $objChildren->count() > 0 && $objElement->getTypeId() != ELM_TYPE_FOLDER) {
                         if (!$objElement->getActive()) {
                             $strReturn .= "<item text=\"" . self::escapeForXml($objElement->getName()) . "\" id=\"{$objElement->getId()}\" style=\"{$isPage}color:#999\" im0=\"elementClosedInactive.gif\" im1=\"elementOpenInactive.gif\" im2=\"elementClosedInactive.gif\" child=\"1\">";
                         } else {
                             $strReturn .= "<item text=\"" . self::escapeForXml($objElement->getName()) . "\" id=\"{$objElement->getId()}\" style=\"{$isPage}\" im0=\"elementClosed.gif\" im1=\"elementOpen.gif\" im2=\"elementClosed.gif\" child=\"1\">";
                         }
                         if ($childId == $objElement->getId()) {
                             $strReturn .= $strChildren;
                         }
                         $strReturn .= "</item>";
                     } else {
                         if ($objElement->getTypeId() == ELM_TYPE_FOLDER) {
                             $intChild = is_object($objChildren) && $objChildren->count() > 0 ? 1 : 0;
                             if (!$objElement->getActive()) {
                                 $strReturn .= "<item text=\"" . self::escapeForXml($objElement->getName()) . "\" id=\"{$objElement->getId()}\" style=\"{$isPage}color:#999\" im0=\"folderClosedInactive.gif\" im1=\"folderOpenInactive.gif\" im2=\"folderClosedInactive.gif\" child=\"{$intChild}\">";
                             } else {
                                 $strReturn .= "<item text=\"" . self::escapeForXml($objElement->getName()) . "\" id=\"{$objElement->getId()}\" style=\"{$isPage}\" im0=\"folderClosed.gif\" im1=\"folderOpen.gif\" im2=\"folderClosed.gif\" child=\"{$intChild}\">";
                             }
                             if ($childId == $objElement->getId()) {
                                 $strReturn .= $strChildren;
                             }
                             $strReturn .= "</item>";
                         } else {
                             if (!$objElement->getActive()) {
                                 $strReturn .= "<item text=\"" . self::escapeForXml($objElement->getName()) . "\" id=\"{$objElement->getId()}\" style=\"{$isPage}color:#999\" im0=\"leafInactive.gif\" im1=\"leafInactive.gif\" im2=\"leafInactive.gif\" child=\"0\" />";
                             } else {
                                 $strReturn .= "<item text=\"" . self::escapeForXml($objElement->getName()) . "\" id=\"{$objElement->getId()}\" style=\"{$isPage}\" child=\"0\" />";
                             }
                         }
                     }
                 }
             }
             if ($strAction == "init") {
                 $objParent = Element::selectByPk($intElmntId);
                 if (is_object($objParent)) {
                     $intParent = $objParent->getParentId();
                     $strReturn = self::buildXmlNodes($intParent, $strType, $strAction, $intElmntId, $strReturn);
                 }
             }
             break;
         case "templates":
             $objTemplates = Templates::getFromParent($intElmntId);
             foreach ($objTemplates as $objTemplate) {
                 $objChildren = $objTemplate->getTemplates();
                 if (is_object($objChildren) && $objChildren->count() > 0) {
                     $strReturn .= "<item text=\"" . self::escapeForXml($objTemplate->getName()) . "\" id=\"{$objTemplate->getId()}\" im0=\"templateClosed.gif\" im1=\"templateOpen.gif\" im2=\"templateClosed.gif\" child=\"1\">";
                     if ($childId == $objTemplate->getId()) {
                         $strReturn .= $strChildren;
                     }
                     $strReturn .= "</item>";
                 } else {
                     $strReturn .= "<item text=\"" . self::escapeForXml($objTemplate->getName()) . "\" id=\"{$objTemplate->getId()}\" im0=\"template.gif\" im1=\"template.gif\" im2=\"template.gif\" child=\"0\" />";
                 }
             }
             if ($strAction == "init") {
                 $objParent = Template::selectByPk($intElmntId);
                 if (is_object($objParent)) {
                     $intParent = $objParent->getParentId();
                     $strReturn = self::buildXmlNodes($intParent, $strType, $strAction, $intElmntId, $strReturn);
                 }
             }
             break;
         case "users":
             $strReturn = "<item text=\"" . self::escapeForXml($objLang->get("users", "usersLabel")) . "\" id=\"" . NAV_MYPUNCH_USERS_USER . "\" im0=\"misc.gif\" im1=\"misc.gif\" im2=\"misc.gif\" child=\"0\" />";
             $strReturn .= "<item text=\"" . self::escapeForXml($objLang->get("groups", "usersLabel")) . "\" id=\"" . NAV_MYPUNCH_USERS_GROUP . "\" im0=\"misc.gif\" im1=\"misc.gif\" im2=\"misc.gif\" child=\"0\" />";
             $strReturn .= "<item text=\"" . self::escapeForXml($objLang->get("applications", "usersLabel")) . "\" id=\"" . NAV_MYPUNCH_USERS_APPLICATION . "\" im0=\"misc.gif\" im1=\"misc.gif\" im2=\"misc.gif\" child=\"0\" />";
             $strReturn .= "<item text=\"" . self::escapeForXml($objLang->get("areas", "usersLabel")) . "\" id=\"" . NAV_MYPUNCH_USERS_AREA . "\" im0=\"misc.gif\" im1=\"misc.gif\" im2=\"misc.gif\" child=\"0\" />";
             $strReturn .= "<item text=\"" . self::escapeForXml($objLang->get("rights", "usersLabel")) . "\" id=\"" . NAV_MYPUNCH_USERS_RIGHT . "\" im0=\"misc.gif\" im1=\"misc.gif\" im2=\"misc.gif\" child=\"0\" />";
             break;
         case "forms":
             $objForms = Form::selectByAccountId();
             foreach ($objForms as $objForm) {
                 $strReturn .= "<item text=\"" . self::escapeForXml($objForm->getName()) . "\" id=\"{$objForm->getId()}\" im0=\"template.gif\" im1=\"template.gif\" im2=\"template.gif\" child=\"0\" />";
             }
             break;
         case "media-ckeditor":
         case "storage":
             $objFolders = StorageItems::getFromParent($intElmntId, STORAGE_TYPE_ALL);
             foreach ($objFolders as $objElement) {
                 $objChildren = $objElement->getItems(STORAGE_TYPE_ALL);
                 if ($objElement->getTypeId() != STORAGE_TYPE_FOLDER) {
                     $strReturn .= "<item text=\"" . self::escapeForXml($objElement->getName()) . "\" id=\"{$objElement->getId()}\" child=\"0\">";
                     if ($childId == $objElement->getId()) {
                         $strReturn .= $strChildren;
                     }
                     $strReturn .= "</item>";
                 } else {
                     if ($objElement->getTypeId() == STORAGE_TYPE_FOLDER) {
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:punchcms,代码行数:101,代码来源:class.tree.php

示例2: getTemplates

 public function getTemplates($blnRecursive = FALSE)
 {
     if ($this->id > 0) {
         if (!is_object($this->objTemplateCollection)) {
             $this->objTemplateCollection = Templates::getFromParent($this->id, $blnRecursive);
         }
     } else {
         $this->objTemplateCollection = new DBA__Collection();
     }
     return $this->objTemplateCollection;
 }
开发者ID:laiello,项目名称:punchcms,代码行数:11,代码来源:class.template.php

示例3: exportTemplate

 public static function exportTemplate($objDoc, $intAccountId, $intId, $arrTemplateFilters = NULL, $includeSelf = false)
 {
     $objTemplates = $objDoc->createElement('templates');
     if ($includeSelf) {
         $objTemplate = Template::selectByPK($intId);
         $objDbTemplates = new DBA__Collection();
         $objDbTemplates->addObject($objTemplate);
     } else {
         $objDbTemplates = Templates::getFromParent($intId, false, $intAccountId);
     }
     if ($objDbTemplates->count() > 0) {
         foreach ($objDbTemplates as $objDbTemplate) {
             if ($arrTemplateFilters == NULL || in_array($objDbTemplate->getId(), $arrTemplateFilters)) {
                 $objTemplate = $objDoc->createElement('template');
                 $objTemplate->setAttribute("id", $objDbTemplate->getId());
                 $objTemplate->setAttribute("name", $objDbTemplate->getName());
                 $objTemplate->setAttribute("apiName", $objDbTemplate->getApiName());
                 $objTemplate->setAttribute("description", $objDbTemplate->getDescription());
                 $objTemplate->setAttribute("sort", $objDbTemplate->getSort());
                 $objTemplate->setAttribute("isPage", $objDbTemplate->getIsPage());
                 $objTemplate->setAttribute("forceCreation", $objDbTemplate->getForceCreation());
                 $objTemplate->setAttribute("isContainer", $objDbTemplate->getIsContainer());
                 $objTemplate->setAttribute("active", $objDbTemplate->getActive());
                 $objFields = $objDoc->createElement('fields');
                 foreach ($objDbTemplate->getFields() as $objDbField) {
                     $objField = $objDoc->createElement('field');
                     $objField->setAttribute("id", $objDbField->getId());
                     $objField->setAttribute("required", $objDbField->getRequired());
                     $objField->setAttribute("typeId", $objDbField->getTypeId());
                     $objField->setAttribute("name", $objDbField->getName());
                     $objField->setAttribute("apiName", $objDbField->getApiName());
                     $objField->setAttribute("description", $objDbField->getDescription());
                     $objField->setAttribute("username", $objDbField->getUsername());
                     $objField->setAttribute("sort", $objDbField->getSort());
                     $objValues = $objDoc->createElement('values');
                     foreach ($objDbField->getValues() as $objDbValue) {
                         $objValue = $objDoc->createElement('value');
                         $objValue->setAttribute("name", $objDbValue->getName());
                         $objValue->setAttribute("value", $objDbValue->getValue());
                         $objValues->appendChild($objValue);
                     }
                     $objField->appendChild($objValues);
                     $objFields->appendChild($objField);
                 }
                 $objTemplate->appendChild($objFields);
                 $objSubTemplates = self::exportTemplate($objDoc, $intAccountId, $objDbTemplate->getId(), $arrTemplateFilters);
                 if ($objSubTemplates) {
                     $objTemplate->appendChild($objSubTemplates);
                 }
                 $objTemplates->appendChild($objTemplate);
             }
         }
     }
     return $objTemplates;
 }
开发者ID:laiello,项目名称:punchcms,代码行数:55,代码来源:class.impex.php


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