當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。