當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BlockType類代碼示例

本文整理匯總了PHP中BlockType的典型用法代碼示例。如果您正苦於以下問題:PHP BlockType類的具體用法?PHP BlockType怎麽用?PHP BlockType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了BlockType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: view

 public function view()
 {
     $uh = Loader::helper('concrete/urls');
     $bt = BlockType::getByHandle('switch_language');
     Loader::model('section', 'multilingual');
     $ml = MultilingualSection::getList();
     $c = Page::getCurrentPage();
     $al = MultilingualSection::getBySectionOfSite($c);
     $languages = array();
     $locale = ACTIVE_LOCALE;
     if (is_object($al)) {
         $locale = $al->getLanguage();
     }
     foreach ($ml as $m) {
         $languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : '');
     }
     $this->set('languages', $languages);
     $this->set('languageSections', $ml);
     $this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch');
     if (is_object($al)) {
         $this->set('activeLanguage', $al->getCollectionID());
     }
     $pkg = Package::getByHandle('multilingual');
     $mdl = Loader::helper('default_language', 'multilingual');
     $this->set('defaultLanguage', $mdl->getSessionDefaultLocale());
     $this->set('cID', $c->getCollectionID());
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:27,代碼來源:controller.php

示例2: run

 public function run()
 {
     $sp = Page::getByPath('/dashboard/system/seo/excluded');
     if (!is_object($sp) || $sp->isError()) {
         $sp = SinglePage::add('/dashboard/system/seo/excluded');
         $sp->update(array('cName' => t('Excluded URL Word List')));
         $sp->setAttribute('meta_keywords', 'pretty, slug');
     }
     $bt = BlockType::getByHandle('next_previous');
     if (is_object($bt)) {
         $bt->refresh();
     }
     $db = Loader::db();
     $columns = $db->MetaColumns('Pages');
     if (isset($columns['PTID'])) {
         $db->Execute('alter table Pages drop column ptID');
     }
     if (isset($columns['CTID'])) {
         $db->Execute('alter table Pages drop column ctID');
     }
     $bt = BlockType::getByHandle('search');
     if (is_object($bt)) {
         $bt->refresh();
     }
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:25,代碼來源:version_561.php

示例3: run

 public function run()
 {
     $bt = BlockType::getByHandle('youtube');
     if (is_object($bt)) {
         $bt->refresh();
     }
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:7,代碼來源:version_5421.php

示例4: up

 public function up(Schema $schema)
 {
     $bt = \BlockType::getByHandle('image_slider');
     if (is_object($bt)) {
         $bt->refresh();
     }
 }
開發者ID:kreativmind,項目名稱:concrete5-5.7.0,代碼行數:7,代碼來源:Version20160314000000.php

示例5: run

 public function run()
 {
     // Since we added the origfilename column in 5.0.0b1 we need to populate it
     Loader::block('library_file');
     $bl = new LibraryFileBlockController();
     $bl->populateOriginalFilenames();
     // install the new block types made available
     BlockType::installBlockType('flash_content');
     BlockType::installBlockType('guestbook');
     BlockType::installBlockType('slideshow');
     BlockType::installBlockType('search');
     BlockType::installBlockType('google_map');
     BlockType::installBlockType('video');
     BlockType::installBlockType('rss_displayer');
     BlockType::installBlockType('youtube');
     BlockType::installBlockType('survey');
     // rename external form
     $bt = BlockType::getByHandle('custom_form');
     $db = Loader::db();
     $tables = $db->MetaTables('TABLES');
     if (isset($tables['btCustomForm']) && !isset($tables['btExternalForm'])) {
         $db->Execute("alter table btCustomForm rename btExternalForm");
     }
     if (is_object($bt)) {
         BlockType::installBlockType('external_form', $bt->getBlockTypeID());
     }
     // add new theme
     $th = PageTheme::getByHandle('greensalad');
     if (!is_object($th)) {
         PageTheme::add('greensalad');
     }
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:32,代碼來源:version_500b1.php

示例6: testSave

 public function testSave()
 {
     $bt = BlockType::installBlockType($this->btHandle);
     $btx = BlockType::getByID(1);
     $class = $btx->getBlockTypeClass();
     $btc = new $class();
     $bID = 1;
     foreach ($this->requestData as $type => $requestData) {
         $nb = $bt->add($requestData);
         $data = $this->expectedRecordData[$type];
         $db = Loader::db();
         $r = $db->GetRow('select * from `' . $btc->getBlockTypeDatabaseTable() . '` where bID = ?', array($bID));
         foreach ($data as $key => $value) {
             $this->assertTrue($r[$key] == $value, 'Key `' . $key . '` did not equal expected value `' . $value . '` instead equalled `' . $r[$key] . '` (type `' . $type . '`)');
         }
         $bID++;
         ob_start();
         $bv = new BlockView($nb);
         $bv->render('view');
         $contents = ob_get_contents();
         ob_end_clean();
         $contents = trim($contents);
         if (isset($this->expectedOutput[$type])) {
             $this->assertTrue($this->expectedOutput[$type] == $contents, 'Output `' . $contents . '` did not equal expected output `' . $this->expectedOutput[$type] . '` (type `' . $type . '`)');
         }
     }
 }
開發者ID:ceko,項目名稱:concrete5-1,代碼行數:27,代碼來源:BlockTypeTestCase.php

示例7: run

 public function run()
 {
     $bt = BlockType::getByHandle('google_map');
     if (is_object($bt) && !$bt->isError()) {
         $bt->refresh();
     }
 }
開發者ID:ojalehto,項目名稱:concrete5-legacy,代碼行數:7,代碼來源:version_5632.php

示例8: install

 public function install()
 {
     $pkg = parent::install();
     Loader::model('single_page');
     Loader::model('job');
     // install job
     $jb = Job::installByPackage('generate_multilingual_sitemap', $pkg);
     $p = SinglePage::add('/dashboard/multilingual', $pkg);
     if (is_object($p)) {
         $p->update(array('cName' => t('Multilingual'), 'cDescription' => t('Translate your site.')));
     }
     $p1 = SinglePage::add('/dashboard/multilingual/setup', $pkg);
     if (is_object($p1)) {
         $p1->update(array('cName' => t('Setup'), 'cDescription' => ''));
     }
     $p2 = SinglePage::add('/dashboard/multilingual/page_report', $pkg);
     if (is_object($p2)) {
         $p2->update(array('cName' => t('Page Report'), 'cDescription' => ''));
     }
     BlockType::installBlockTypeFromPackage('switch_language', $pkg);
     $ak = CollectionAttributeKey::getByHandle('multilingual_exclude_from_copy');
     if (!is_object($ak)) {
         CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'multilingual_exclude_from_copy', 'akName' => t('Exclude from Internationalization Copy'), 'akIsSearchable' => true), $pkg);
     }
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:25,代碼來源:controller.php

示例9: addBlock

 public function addBlock($blockTypeHandle)
 {
     $bt = BlockType::getByHandle($blockTypeHandle);
     $cct = ComposerControlType::getByHandle('block');
     $control = $ctca->getPageTypeComposerControlByIdentifier($bt->getBlockID());
     // add control
     $composerFLS = $control->addToPageTypeComposerFormLayoutSet($this->layoutSet);
 }
開發者ID:ExchangeCore,項目名稱:razor-commerce,代碼行數:8,代碼來源:Composer.php

示例10: uninstall

 public function uninstall()
 {
     BlockType::getByHandle('tweetcrete')->controller->uninstall();
     parent::uninstall();
     //make sure the block table gets dropped
     $db = Loader::db();
     $db->Execute('DROP TABLE IF EXISTS btTweetcrete');
     $db->Execute('DROP TABLE IF EXISTS btTweetcreteUserOrHashSettings');
 }
開發者ID:robchenski,項目名稱:ids,代碼行數:9,代碼來源:controller.php

示例11: getOrInstallBlockType

 private function getOrInstallBlockType($pkg, $btHandle)
 {
     $bt = BlockType::getByHandle($btHandle);
     if (empty($bt)) {
         BlockType::installBlockTypeFromPackage($btHandle, $pkg);
         $bt = BlockType::getByHandle($btHandle);
     }
     return $bt;
 }
開發者ID:Trapulo,項目名稱:c5-bootstrap-autonav,代碼行數:9,代碼來源:controller.php

示例12: save

	public function save() {	
		if (isset($this->notesBlock)) {
			$this->notesBlock->delete();
		}		
		$data['content'] = $this->post('dashboard_notes');
		$bt = BlockType::getByHandle('content');
		$this->uc->addBlock($bt, 'dashboard_notes', $data);
		$this->redirect('/dashboard/', 'module','notes','notes_saved'); 
	}
開發者ID:rii-J,項目名稱:concrete5-de,代碼行數:9,代碼來源:notes.php

示例13: run

	public function run() {
		$bt = BlockType::getByHandle('image');
		if (is_object($bt)) { 
			$bt->refresh();
		}
		$bt = BlockType::getByHandle('form');
		if (is_object($bt)) { 
			$bt->refresh();
		}
	}
開發者ID:nbourguig,項目名稱:concrete5,代碼行數:10,代碼來源:version_552.php

示例14: up

 public function up(Schema $schema)
 {
     $bt = \BlockType::getByHandle('file');
     if (is_object($bt)) {
         $bt->refresh();
     }
     if (\Config::get('conversation.banned_words')) {
         \Config::set('conversations.banned_words', true);
     }
 }
開發者ID:ppiedaderawnet,項目名稱:concrete5,代碼行數:10,代碼來源:Version20150610000000.php

示例15: install

 public function install()
 {
     $pkg = parent::install();
     //Install block
     BlockType::installBlockTypeFromPackage('custom_contact_form', $pkg);
     //Install dashboard page
     Loader::model('single_page');
     $p = SinglePage::add('/dashboard/reports/custom_contact_form', $pkg);
     $p->update(array('cName' => t('Contact Form Submissions')));
     $p->setAttribute('icon_dashboard', 'icon-list-alt');
 }
開發者ID:felixb101,項目名稱:c5_custom_contact_form,代碼行數:11,代碼來源:controller.php


注:本文中的BlockType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。