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


PHP CMSForm::sessionMessage方法代码示例

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


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

示例1: clear

 public function clear($data, CMSForm $form)
 {
     if (isset($data['ToClear'])) {
         $cleared = array();
         foreach ($data['ToClear'] as $name) {
             $cache = $this->getCache($name);
             if ($cache) {
                 if (isset($data['Key']) && strlen($data['Key'])) {
                     $cache->delete($data['Key']);
                 } else {
                     $cache->clear();
                 }
                 $cleared[] = $name;
             }
         }
         $cleared = implode(',', $cleared);
         $form->sessionMessage("Cleared {$cleared}", 'good');
     } else {
         $form->sessionMessage("No caches cleared", 'good');
     }
     return $form->getResponseNegotiator()->respond($this->getRequest());
 }
开发者ID:nyeholt,项目名称:silverstripe-simplecache,代码行数:22,代码来源:SimpleCacheAdmin.php

示例2: doAddMockChildren

 /**
  * Handles the creation of mock children with {@link MockDataBuilder}
  *
  * @param array $data The data passed in from the form
  * @param CMSForm $form The Form object that was used
  * @return SSViewer
  */
 public function doAddMockChildren($data, $form)
 {
     $parentPage = SiteTree::get()->byID((int) $data['ID']);
     if (!$parentPage) {
         return false;
     }
     $className = isset($data['PageType']) ? $data['PageType'] : "Page";
     $builder = new MockDataBuilder($className);
     $builder->setCount((int) $data['Count'])->setIncludeRelations((bool) $data['IncludeRelations'])->setDownloadImages((bool) $data['DownloadImages'])->setParentField("ParentID")->setParentObj($parentPage);
     try {
         $ids = $builder->generate();
     } catch (Exception $e) {
         $form->sessionMessage($e->getMessage(), "bad");
         return $this->redirectBack();
     }
     $this->response->addHeader('X-Status', _t('MockData.CREATESUCCESS', 'Created {count} mock children under {title}', array('count' => $data['Count'], 'title' => $parentPage->Title)));
     $this->redirect(Controller::join_links(singleton('CMSPagesController')->Link()));
     return $this->getResponseNegotiator()->respond($this->request);
 }
开发者ID:helpfulrobot,项目名称:unclecheese-mock-dataobjects,代码行数:26,代码来源:MockChildrenController.php


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