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


PHP modResource::fromArray方法代码示例

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


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

示例1: process

 public function process()
 {
     if (!$this->validate()) {
         return $this->failure();
     }
     $this->resource->fromArray($this->getProperties());
     if ($this->resource->save() === false) {
         return $this->failure($this->modx->lexicon('resource_err_save'));
     }
     return $this->success();
 }
开发者ID:e-gob,项目名称:apps.gob.cl,代码行数:11,代码来源:updatefromgrid.class.php

示例2: process

 public function process(array $scriptProperties = array())
 {
     $placeholders = array();
     $reloadData = $this->getReloadData();
     $loaded = $this->getResource();
     if ($loaded !== true) {
         return $this->failure($loaded);
     }
     if (is_array($reloadData) && !empty($reloadData)) {
         $this->resource->fromArray($reloadData);
     }
     /* get context */
     $this->setContext();
     /* check for locked status */
     $this->checkForLocks();
     /* set template overrides */
     if (isset($scriptProperties['template'])) {
         $this->resource->set('template', $scriptProperties['template']);
     }
     $this->setParent();
     /* invoke OnDocFormRender event */
     $this->fireOnRenderEvent();
     /* check permissions */
     $this->setPermissions();
     /* register FC rules */
     $this->resourceArray = $this->resource->toArray();
     $overridden = $this->checkFormCustomizationRules($this->resource);
     $this->resourceArray = array_merge($this->resourceArray, $overridden);
     $this->resourceArray['published'] = intval($this->resourceArray['published']) == 1 ? true : false;
     $this->resourceArray['hidemenu'] = intval($this->resourceArray['hidemenu']) == 1 ? true : false;
     $this->resourceArray['isfolder'] = intval($this->resourceArray['isfolder']) == 1 ? true : false;
     $this->resourceArray['richtext'] = intval($this->resourceArray['richtext']) == 1 ? true : false;
     $this->resourceArray['searchable'] = intval($this->resourceArray['searchable']) == 1 ? true : false;
     $this->resourceArray['cacheable'] = intval($this->resourceArray['cacheable']) == 1 ? true : false;
     $this->resourceArray['deleted'] = intval($this->resourceArray['deleted']) == 1 ? true : false;
     $this->resourceArray['uri_override'] = intval($this->resourceArray['uri_override']) == 1 ? true : false;
     if (!empty($this->resourceArray['parent'])) {
         if ($this->parent->get('id') == $this->resourceArray['parent']) {
             $this->resourceArray['parent_pagetitle'] = $this->parent->get('pagetitle');
         } else {
             $overriddenParent = $this->modx->getObject('modResource', $this->resourceArray['parent']);
             if ($overriddenParent) {
                 $this->resourceArray['parent_pagetitle'] = $overriddenParent->get('pagetitle');
             }
         }
     }
     /* get TVs */
     $this->resource->set('template', $this->resourceArray['template']);
     $this->prepareResource();
     $this->loadTVs($reloadData);
     $this->getPreviewUrl();
     /* single-use token for reloading resource */
     $this->setResourceToken();
     $this->setPlaceholder('resource', $this->resource);
     return $placeholders;
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:56,代码来源:update.class.php

示例3: updateResource

 public function updateResource($id, $tempDir)
 {
     include_once MODX_BASE_PATH . 'assets/lib/MODxAPI/modResource.php';
     @rename(MODX_BASE_PATH . 'assets/images/' . $tempDir, MODX_BASE_PATH . 'assets/images/' . $this->params['contentDir'] . '/' . $id);
     $doc = new \modResource($this->modx);
     $fields = $doc->edit($id)->toArray();
     foreach ($fields as &$field) {
         if (is_string($field)) {
             $field = str_replace($tempDir, $this->params['contentDir'] . '/' . $id, $field);
         }
     }
     $doc->fromArray($fields)->save(false, true);
 }
开发者ID:dukeRD,项目名称:kcAutoFolder,代码行数:13,代码来源:plugin.class.php


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