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


PHP PageManager::editPageChildren方法代码示例

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


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

示例1: __actionEdit


//.........这里部分代码省略.........
                      * @delegate PagePreCreate
                      * @since Symphony 2.2
                      * @param string $context
                      * '/blueprints/pages/'
                      * @param array $fields
                      *  The `$_POST['fields']` array passed by reference
                      */
                     Symphony::ExtensionManager()->notifyMembers('PagePreCreate', '/blueprints/pages/', array('fields' => &$fields));
                     if (!($page_id = PageManager::add($fields))) {
                         $this->pageAlert(__('Unknown errors occurred while attempting to save.') . '<a href="' . SYMPHONY_URL . '/system/log/">' . __('Check your activity log') . '</a>.', Alert::ERROR);
                     } else {
                         /**
                          * Just after the creation of a new page in `tbl_pages`
                          *
                          * @delegate PagePostCreate
                          * @since Symphony 2.2
                          * @param string $context
                          * '/blueprints/pages/'
                          * @param integer $page_id
                          *  The ID of the newly created Page
                          * @param array $fields
                          *  An associative array of data that was just saved for this page
                          */
                         Symphony::ExtensionManager()->notifyMembers('PagePostCreate', '/blueprints/pages/', array('page_id' => $page_id, 'fields' => &$fields));
                         $redirect = "/blueprints/pages/edit/{$page_id}/created/{$parent_link_suffix}";
                     }
                 } else {
                     /**
                      * Just prior to updating a Page record in `tbl_pages`, provided
                      * with the `$fields` associative array. Use with caution, as no
                      * duplicate page checks are run after this delegate has fired
                      *
                      * @delegate PagePreEdit
                      * @since Symphony 2.2
                      * @param string $context
                      * '/blueprints/pages/'
                      * @param integer $page_id
                      *  The ID of the Page that is about to be updated
                      * @param array $fields
                      *  The `$_POST['fields']` array passed by reference
                      */
                     Symphony::ExtensionManager()->notifyMembers('PagePreEdit', '/blueprints/pages/', array('page_id' => $page_id, 'fields' => &$fields));
                     if (!PageManager::edit($page_id, $fields, true)) {
                         return $this->pageAlert(__('Unknown errors occurred while attempting to save.') . '<a href="' . SYMPHONY_URL . '/system/log/">' . __('Check your activity log') . '</a>.', Alert::ERROR);
                     } else {
                         /**
                          * Just after updating a page in `tbl_pages`
                          *
                          * @delegate PagePostEdit
                          * @since Symphony 2.2
                          * @param string $context
                          * '/blueprints/pages/'
                          * @param integer $page_id
                          *  The ID of the Page that was just updated
                          * @param array $fields
                          *  An associative array of data that was just saved for this page
                          */
                         Symphony::ExtensionManager()->notifyMembers('PagePostEdit', '/blueprints/pages/', array('page_id' => $page_id, 'fields' => $fields));
                         $redirect = "/blueprints/pages/edit/{$page_id}/saved/{$parent_link_suffix}";
                     }
                 }
             }
             // Only proceed if there was no errors saving/creating the page
             if (empty($this->_errors)) {
                 /**
                  * Just before the page's types are saved into `tbl_pages_types`.
                  * Use with caution as no further processing is done on the `$types`
                  * array to prevent duplicate `$types` from occurring (ie. two index
                  * page types). Your logic can use the PageManger::hasPageTypeBeenUsed
                  * function to perform this logic.
                  *
                  * @delegate PageTypePreCreate
                  * @since Symphony 2.2
                  * @see toolkit.PageManager#hasPageTypeBeenUsed
                  * @param string $context
                  * '/blueprints/pages/'
                  * @param integer $page_id
                  *  The ID of the Page that was just created or updated
                  * @param array $types
                  *  An associative array of the types for this page passed by reference.
                  */
                 Symphony::ExtensionManager()->notifyMembers('PageTypePreCreate', '/blueprints/pages/', array('page_id' => $page_id, 'types' => &$types));
                 // Assign page types:
                 PageManager::addPageTypesToPage($page_id, $types);
                 // Find and update children:
                 if ($this->_context[0] == 'edit') {
                     PageManager::editPageChildren($page_id, $fields['path'] . '/' . $fields['handle']);
                 }
                 if ($redirect) {
                     redirect(SYMPHONY_URL . $redirect);
                 }
             }
         }
         // If there was any errors, either with pre processing or because of a
         // duplicate page, return.
         if (is_array($this->_errors) && !empty($this->_errors)) {
             return $this->pageAlert(__('An error occurred while processing this form. See below for details.'), Alert::ERROR);
         }
     }
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:101,代码来源:content.blueprintspages.php

示例2: editPageChildren

 /**
  * This function will update all children of a particular page (if any)
  * by renaming/moving all related files to their new path and updating
  * their database information. This is a recursive function and will work
  * to any depth.
  *
  * @param integer $page_id
  *  The ID of the Page whose children need to be updated
  * @param string $page_path
  *  The path of the Page, which is the handles of the Page parents. If the
  *  page has multiple parents, they will be separated by a forward slash.
  *  eg. article/read. If a page has no parents, this parameter should be null.
  * @return boolean
  */
 public static function editPageChildren($page_id = null, $page_path = null)
 {
     if (!is_int($page_id)) {
         return false;
     }
     $page_path = trim($page_path, '/');
     $children = PageManager::fetchChildPages($page_id);
     foreach ($children as $child) {
         $child_id = (int) $child['id'];
         $fields = array('path' => $page_path);
         if (!PageManager::createPageFiles($page_path, $child['handle'], $child['path'], $child['handle'])) {
             $success = false;
         }
         if (!PageManager::edit($child_id, $fields)) {
             $success = false;
         }
         $success = PageManager::editPageChildren($child_id, $page_path . '/' . $child['handle']);
     }
     return $success;
 }
开发者ID:davjand,项目名称:codecept-symphonycms-db,代码行数:34,代码来源:class.pagemanager.php


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