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


PHP Element::setDescription方法代码示例

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


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

示例1: testGetDescription

 /**
  * @covers Xoops\Form\Element::getDescription
  */
 public function testGetDescription()
 {
     $name = 'name';
     $this->object->setDescription($name);
     $value = $this->object->getDescription();
     $this->assertSame($name, $value);
 }
开发者ID:RanLee,项目名称:XoopsCore,代码行数:10,代码来源:ElementTest.php

示例2: parsePages


//.........这里部分代码省略.........
                    }
                    $objTpl->setVariable("FORM_ACTIVE_VALUE", isset($_POST["frm_active"]) && $_POST["frm_active"] == "on" ? "checked=\"checked\"" : "");
                    $objTpl->setVariable("FORM_NAME_VALUE", $_POST["frm_name"]);
                    $objTpl->setVariable("FORM_APINAME_VALUE", $_POST["frm_apiname"]);
                    //$objTpl->setVariable("FORM_ALIAS_VALUE", $_POST["frm_alias"]);
                    if ($blnIsDynamic) {
                        $objTpl->setVariable("FORM_MAXITEMS_VALUE", $_POST["frm_maxitems"]);
                    }
                    $objTpl->setVariable("FORM_NOTES_VALUE", $_POST["frm_description"]);
                    $objTpl->setVariable("ERROR_MAIN", $objLang->get("main", "formerror"));
                    //*** Display element specific errors.
                    //*** TODO!!
                } else {
                    //*** Input is valid. Save the element.
                    if ($strCommand == CMD_EDIT) {
                        $objElement = Element::selectByPK($intElmntId);
                        $objParent = Element::selectByPK($objElement->getParentId());
                    } else {
                        $objParent = Element::selectByPK($_POST["eid"]);
                        $objPermissions = new ElementPermission();
                        if (is_object($objParent)) {
                            $objPermissions->setUserId($objParent->getPermissions()->getUserId());
                            $objPermissions->setGroupId($objParent->getPermissions()->getGroupId());
                        }
                        $objElement = new Element();
                        $objElement->setParentId($_POST["eid"]);
                        $objElement->setAccountId($_CONF['app']['account']->getId());
                        $objElement->setPermissions($objPermissions);
                    }
                    $objElement->setActive(empty($_CLEAN_POST["frm_active"]) ? 0 : 1);
                    $objElement->setIsPage(empty($_CLEAN_POST["frm_ispage"]) ? 0 : 1);
                    $objElement->setName($_CLEAN_POST["frm_name"]);
                    $objElement->setApiName($_CLEAN_POST["frm_apiname"]);
                    $objElement->setDescription($_CLEAN_POST["frm_description"]);
                    $objElement->setUsername($objLiveUser->getProperty("name"));
                    //*** Get remote settings.
                    $strServer = Setting::getValueByName('ftp_server');
                    $strUsername = Setting::getValueByName('ftp_username');
                    $strPassword = Setting::getValueByName('ftp_password');
                    $strRemoteFolder = Setting::getValueByName('ftp_remote_folder');
                    if ($blnIsFolder) {
                        $objElement->setTypeId(ELM_TYPE_FOLDER);
                    } else {
                        if ($blnIsDynamic) {
                            $objElement->setTypeId(ELM_TYPE_DYNAMIC);
                            $objElement->setTemplateId($_CLEAN_POST["frm_template"]);
                        } else {
                            $objElement->setTypeId(ELM_TYPE_ELEMENT);
                            $objElement->setTemplateId($_CLEAN_POST["frm_template"]);
                        }
                    }
                    $objElement->save();
                    if ($blnIsDynamic) {
                        $intFeedId = $_CLEAN_POST["frm_feed"];
                        if (empty($intFeedId)) {
                            $intFeedId = $objParent->getFeed()->getFeedId();
                        }
                        $objElementFeed = new ElementFeed();
                        $objElementFeed->setFeedId($intFeedId);
                        $objElementFeed->setFeedPath($_CLEAN_POST["frm_feedpath"]);
                        $objElementFeed->setMaxItems($_CLEAN_POST["frm_maxitems"]);
                        if ($_CLEAN_POST["frm_dynamic_alias_check"]) {
                            $objElementFeed->setAliasField($_CLEAN_POST["frm_dynamic_alias"]);
                        } else {
                            $objElementFeed->setAliasField("");
                        }
开发者ID:laiello,项目名称:punchcms,代码行数:67,代码来源:inc.tplparse_element.php

示例3: _getElementInfos

 protected function _getElementInfos()
 {
     $elementInfos = array();
     $elementTable = $this->_helper->db->getTable('Element');
     if (isset($_POST['elements'])) {
         $currentElements = $_POST['elements'];
         foreach ($currentElements as $elementId => $info) {
             $element = $elementTable->find($elementId);
             if ($info['delete'] == 1) {
                 $element->delete();
             } else {
                 $elementInfos[] = array('element' => $element, 'temp_id' => null, 'description' => isset($info['description']) ? $info['description'] : '', 'order' => $info['order'], 'required' => isset($info['required']));
             }
         }
     }
     if (isset($_POST['new-elements'])) {
         $newElements = $_POST['new-elements'];
         foreach ($newElements as $tempId => $info) {
             if (empty($info['name']) || isset($info['type'])) {
                 continue;
             }
             $element = new Element();
             $element->element_set_id = $this->_elementSet->id;
             $element->setName($info['name']);
             $element->setDescription($info['description']);
             $element->order = null;
             $elementInfos[] = array('element' => $element, 'temp_id' => $tempId, 'order' => $info['order'], 'required' => isset($info['required']));
         }
     }
     return $elementInfos;
 }
开发者ID:Daniel-KM,项目名称:UserProfiles,代码行数:31,代码来源:TypesController.php

示例4: installDefaults

 /**
  * Install default profile
  *
  * Install default item types, elements, and profiles for easy setup
  *
  * @param array An array of parameters with names and descriptions
  *  of the default values we are setting up
  * @return void
  */
 public function installDefaults($params)
 {
     if (!($itemType = get_db()->getTable('ItemType')->findByName($params['typeName']))) {
         $itemType = new ItemType();
         $itemType->name = $params['typeName'];
         $itemType->description = $params['typeDesc'];
         $id = $itemType->save();
     }
     require_once dirname(dirname(dirname(__FILE__))) . '/models/MmdProfile.php';
     $profile = new MmdProfile();
     $profile->setViewer($this);
     $profile->name = $params['profileName'];
     $profile->viewer = $this->name;
     foreach ($this->_paramInfo as $param) {
         //$element = new Element();
         //check if element exists in Dublin Core
         $element = get_db()->getTable('Element')->findByElementSetNameAndElementName('Dublin Core', $param['name']);
         if (empty($element)) {
             $element = get_db()->getTable('Element')->findByElementSetNameAndElementName('Dublin Core', ucfirst($param['name']));
         }
         if (empty($element)) {
             $element = get_db()->getTable('Element')->findByElementSetNameAndElementName('Dublin Core', strtoupper($param['name']));
         }
         if (empty($element)) {
             $element = get_db()->getTable('Element')->findByElementSetNameAndElementName('Item Type Metadata', $param['name']);
         }
         if (empty($element)) {
             $element = get_db()->getTable('Element')->findByElementSetNameAndElementName('Item Type Metadata', ucfirst($param['name']));
         }
         if (empty($element)) {
             $element = get_db()->getTable('Element')->findByElementSetNameAndElementName('Item Type Metadata', strtoupper($param['name']));
         }
         if (empty($element)) {
             $element = new Element();
             $element->setElementSet('Item Type Metadata');
             $element->setName($param['name']);
             $element->setDescription($param['description']);
             try {
                 $element->save();
             } catch (Exception $e) {
                 print_r($e);
                 die;
             }
         }
         $itemType->addElementById($element->id);
         if (isset($param['default']) && $param['default'] !== '') {
             $profile->setAuxParam($param['name'], $param['default'], 1);
         }
         if (isset($param['files'])) {
             $multiple = isset($param['multiple']) && $param['multiple'] != 'single' && $param['multiple'] ? 1 : 0;
             $fileparam = array('multiple' => isset($param['multiple']) && $param['multiple'] != 'single' && $param['multiple'] ? 1 : 0, 'extensions' => $param['files']);
             $profile->setAuxParam($param['name'], $fileparam, 2);
         }
         $profile->setAuxParam($param['name'], $element->id, 0);
     }
     $itemType->save();
     $item_type_id = $itemType->id;
     $profile->save();
     $profile_id = $profile->id;
     require_once dirname(dirname(dirname(__FILE__))) . '/models/MmdAssign.php';
     $assign = new MmdAssign();
     $assign->item_type_id = $item_type_id;
     $assign->profile_id = $profile_id;
     $assign->filetypes = $this->_allowedFiletypes;
     $assign->save();
     return 'Defaults installed successfully';
 }
开发者ID:bijanisa,项目名称:MultimediaDisplay,代码行数:76,代码来源:AbstractViewer.php

示例5: importElements

 public static function importElements($objElements, $intAccountId, $arrTemplateIds, $arrTemplateFieldIds, &$arrElementIds, &$arrElementFieldIds, $arrLinkFieldIds, $arrLanguageIds, $arrUserIds, $arrGroupIds, $arrStorageIds, $arrFeedIds, $intParentId = 0)
 {
     global $intDefaultLanguage;
     $strElmntPattern = "/(\\?eid=)([0-9]+)/ie";
     $strStoragePattern = "/(\\?mid=)([0-9]+)/ie";
     foreach ($objElements->childNodes as $elementNode) {
         if (!is_null($arrTemplateIds[$elementNode->getAttribute("templateId")])) {
             $objElement = new Element();
             $objElement->setAccountId($intAccountId);
             $objElement->setParentId($intParentId);
             $objElement->setActive($elementNode->getAttribute("active"));
             $objElement->setIsPage($elementNode->getAttribute("isPage"));
             $objElement->setName($elementNode->getAttribute("name"));
             $objElement->setApiName($elementNode->getAttribute("apiName"));
             $objElement->setDescription($elementNode->getAttribute("description"));
             $objElement->setUsername($elementNode->getAttribute("username"));
             $objElement->setTypeId($elementNode->getAttribute("typeId"));
             $objElement->setTemplateId($arrTemplateIds[$elementNode->getAttribute("templateId")]);
             $objElement->setSort($elementNode->getAttribute("sort"));
             $objElement->save(false, false);
             if ($elementNode->getAttribute("typeId") == 1) {
                 $objElement->setLanguageActive($intDefaultLanguage, 1);
             }
             $arrElementIds[$elementNode->getAttribute("id")] = $objElement->getId();
             //*** Schedule.
             $objSchedule = new ElementSchedule();
             $objSchedule->setStartActive($elementNode->getAttribute("scheduleStartActive"));
             $objSchedule->setStartDate($elementNode->getAttribute("scheduleStartDate"));
             $objSchedule->setEndActive($elementNode->getAttribute("scheduleEndActive"));
             $objSchedule->setEndDate($elementNode->getAttribute("scheduleEndDate"));
             $objElement->setSchedule($objSchedule);
             //*** Add fields to the element.
             foreach ($elementNode->childNodes as $subNode) {
                 switch ($subNode->nodeName) {
                     case "fields":
                         $arrActiveLangs = array();
                         foreach ($subNode->childNodes as $fieldNode) {
                             switch ($fieldNode->nodeName) {
                                 case "field":
                                     $objField = new ElementField();
                                     $objField->setElementId($objElement->getId());
                                     $objField->setTemplateFieldId($arrTemplateFieldIds[$fieldNode->getAttribute("templateFieldId")]);
                                     $objField->setSort($fieldNode->getAttribute("sort"));
                                     $objField->save();
                                     foreach ($fieldNode->childNodes as $languageNode) {
                                         $objValue = $objField->getNewValueObject();
                                         $objValue->setValue($languageNode->nodeValue);
                                         $objValue->setLanguageId($arrLanguageIds[$languageNode->getAttribute("id")]);
                                         $objValue->setCascade($languageNode->getAttribute("cascade"));
                                         $objField->setValueObject($objValue);
                                         $arrActiveLangs[$languageNode->getAttribute("id")] = $languageNode->getAttribute("active");
                                         if (preg_match($strElmntPattern, $languageNode->nodeValue) > 0) {
                                             array_push($arrElementFieldIds["largeText"], $objField->getId());
                                         }
                                         if (preg_match($strStoragePattern, $languageNode->nodeValue) > 0) {
                                             array_push($arrElementFieldIds["largeText"], $objField->getId());
                                         }
                                     }
                                     if (in_array($fieldNode->getAttribute("templateFieldId"), $arrLinkFieldIds)) {
                                         array_push($arrElementFieldIds["link"], $objField->getId());
                                     }
                                     break;
                             }
                         }
                         foreach ($arrActiveLangs as $key => $value) {
                             $objElement->setLanguageActive($arrLanguageIds[$key], $value);
                         }
                         break;
                     case "feed":
                         foreach ($subNode->childNodes as $feedFieldNode) {
                             if ($feedFieldNode->nodeName == "feedfield") {
                                 $objFeedField = new ElementFieldFeed();
                                 $objFeedField->setElementId($objElement->getId());
                                 $objFeedField->setTemplateFieldId($arrTemplateFieldIds[$feedFieldNode->getAttribute("templateFieldId")]);
                                 $objFeedField->setFeedPath($feedFieldNode->getAttribute("feedPath"));
                                 $objFeedField->setXpath($feedFieldNode->getAttribute("xpath"));
                                 $objFeedField->setLanguageId($arrLanguageIds[$feedFieldNode->getAttribute("languageId")]);
                                 $objFeedField->setCascade($feedFieldNode->getAttribute("cascade"));
                                 $objFeedField->setSort($feedFieldNode->getAttribute("sort"));
                                 $objFeedField->save();
                             }
                         }
                         $objFeed = new ElementFeed();
                         $objFeed->setElementId($objElement->getId());
                         $objFeed->setFeedId($arrFeedIds[$subNode->getAttribute("feedId")]);
                         $objFeed->setFeedPath($subNode->getAttribute("feedPath"));
                         $objFeed->setMaxItems($subNode->getAttribute("maxItems"));
                         $objFeed->setSortBy($subNode->getAttribute("sortBy"));
                         $objFeed->setAliasField($subNode->getAttribute("aliasField"));
                         $objFeed->save();
                         break;
                     case "meta":
                         $arrMetaFields = array("title", "keywords", "description");
                         foreach ($subNode->childNodes as $metaFieldNode) {
                             if ($metaFieldNode->nodeName == "language") {
                                 $intLanguageId = $arrLanguageIds[$metaFieldNode->getAttribute("id")];
                                 foreach ($arrMetaFields as $value) {
                                     $objMeta = new ElementMeta();
                                     $objMeta->setName($value);
                                     $objMeta->setValue($metaFieldNode->getAttribute($value));
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:punchcms,代码行数:101,代码来源:class.impex.php

示例6: makeElementFromDb

 private function makeElementFromDb($dbElement, $firstLevel)
 {
     $newElement = new Element($dbElement['id'], $this->getName());
     $newElement->setButtonTitle($dbElement['button_title']);
     $newElement->setPageTitle($dbElement['page_title']);
     $newElement->setKeywords($dbElement['keywords']);
     $newElement->setDescription($dbElement['description']);
     $newElement->setUrl($dbElement['url']);
     $newElement->setText($dbElement['cached_text']);
     $newElement->setLastModified($dbElement['last_modified']);
     $newElement->setCreatedOn($dbElement['created_on']);
     $newElement->setModifyFrequency($dbElement['modify_frequency']);
     $newElement->setRss($dbElement['rss']);
     $newElement->setVisible($dbElement['visible']);
     if ($firstLevel) {
         $newElement->setParentId(null);
     } else {
         $newElement->setParentId($dbElement['parent']);
     }
     $newElement->setHtml($dbElement['html']);
     $newElement->setType($dbElement['type']);
     $newElement->setRedirectUrl($dbElement['redirect_url']);
     $newElement->setDynamicModules($dbElement['dynamic_modules']);
     return $newElement;
 }
开发者ID:notzen,项目名称:ImpressPages-CMS,代码行数:25,代码来源:zone.php

示例7: _getElementInfosFromPost

 private function _getElementInfosFromPost()
 {
     $elementTable = get_db()->getTable('Element');
     $elementInfos = array();
     if (isset($_POST[self::ELEMENTS_INPUT_NAME])) {
         $currentElements = $_POST[self::ELEMENTS_INPUT_NAME];
         foreach ($currentElements as $elementId => $info) {
             $elementInfos[] = array('element' => $elementTable->find($elementId), 'temp_id' => null, 'order' => $info['order']);
         }
     }
     if (isset($_POST[self::ELEMENTS_TO_ADD_INPUT_NAME])) {
         $elementsToAdd = $_POST[self::ELEMENTS_TO_ADD_INPUT_NAME];
         foreach ($elementsToAdd as $tempId => $info) {
             if (empty($info['id'])) {
                 continue;
             }
             $elementInfos[] = array('element' => $elementTable->find($info['id']), 'temp_id' => $tempId, 'order' => $info['order']);
         }
     }
     if (isset($_POST[self::NEW_ELEMENTS_INPUT_NAME])) {
         $newElements = $_POST[self::NEW_ELEMENTS_INPUT_NAME];
         foreach ($newElements as $tempId => $info) {
             if (empty($info['name'])) {
                 continue;
             }
             $element = new Element();
             $element->setElementSet(ElementSet::ITEM_TYPE_NAME);
             $element->setName($info['name']);
             $element->setDescription($info['description']);
             $element->order = null;
             $elementInfos[] = array('element' => $element, 'temp_id' => $tempId, 'order' => $info['order']);
         }
     }
     return $elementInfos;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:35,代码来源:ItemTypes.php


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