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


PHP CollectionAttributeKey类代码示例

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


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

示例1: run

	public function run() {
		Cache::disableCache();

		Loader::library('database_indexed_search');
		$is = new IndexedSearch();
		if ($_GET['force'] == 1) {
			Loader::model('attribute/categories/collection');
			Loader::model('attribute/categories/file');
			Loader::model('attribute/categories/user');
			$attributes = CollectionAttributeKey::getList();
			$attributes = array_merge($attributes, FileAttributeKey::getList());
			$attributes = array_merge($attributes, UserAttributeKey::getList());
			foreach($attributes as $ak) {
				$ak->updateSearchIndex();
			}

			$result = $is->reindexAll(true);
		} else {
			$result = $is->reindexAll();
		}
		if ($result->count == 0) {
			return t('Indexing complete. Index is up to date');
		} else {
			if ($result->count == $is->searchBatchSize) {
				return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count);
			} else {
				return t('Index updated. %s %s required reindexing.', $result->count, $result->count == 1 ? t('page') : t('pages'));
			}
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:30,代码来源:index_search.php

示例2: installOrUpgrade

 private function installOrUpgrade($pkg, $fromVersion)
 {
     $at = AttributeType::getByHandle('handle_https');
     if (!is_object($at)) {
         $at = AttributeType::add('handle_https', tc('AttributeTypeName', 'HTTPS handling'), $pkg);
     }
     $akc = AttributeKeyCategory::getByHandle('collection');
     if (is_object($akc)) {
         if (!$akc->hasAttributeKeyTypeAssociated($at)) {
             $akc->associateAttributeKeyType($at);
         }
     }
     if (empty($fromVersion)) {
         $ak = CollectionAttributeKey::getByHandle('handle_https');
         if (!is_object($ak)) {
             $hhh = Loader::helper('https_handling', 'handle_https');
             /* @var $hhh HttpsHandlingHelper */
             $httpDomain = defined('BASE_URL') ? BASE_URL : Config::get('BASE_URL');
             if (!$httpDomain) {
                 $httpDomain = 'http://' . $hhh->getRequestDomain();
             }
             $httpsDomain = defined('BASE_URL_SSL') ? BASE_URL_SSL : Config::get('BASE_URL_SSL');
             if (!$httpsDomain) {
                 $httpsDomain = 'https://' . $hhh->getRequestDomain();
             }
             $ak = CollectionAttributeKey::add($at, array('akHandle' => 'handle_https', 'akName' => tc('AttributeKeyName', 'Page HTTP/HTTPS'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => 1, 'akIsInternal' => 0, 'akEnabled' => 0, 'akDefaultRequirement' => HttpsHandlingHelper::SSLHANDLING_DOESNOT_MATTER, 'akCustomDomains' => 0, 'akHTTPDomain' => $httpDomain, 'akHTTPSDomain' => $httpsDomain), $pkg);
         }
     }
 }
开发者ID:mlocati,项目名称:concrete5-handle_https,代码行数:29,代码来源:controller.php

示例3: _setupDashboardIcon

 private function _setupDashboardIcon($page, $icon)
 {
     $cak = CollectionAttributeKey::getByHandle('icon_dashboard');
     if (is_object($cak)) {
         $page->setAttribute('icon_dashboard', $icon);
     }
 }
开发者ID:robchenski,项目名称:ids,代码行数:7,代码来源:controller.php

示例4: run

 public function run()
 {
     Cache::disableAll();
     $is = new IndexedSearch();
     if ($_GET['force'] == 1) {
         $attributes = \CollectionAttributeKey::getList();
         $attributes = array_merge($attributes, \FileAttributeKey::getList());
         $attributes = array_merge($attributes, \UserAttributeKey::getList());
         foreach ($attributes as $ak) {
             $ak->updateSearchIndex();
         }
         $result = $is->reindexAll(true);
     } else {
         $result = $is->reindexAll();
     }
     if ($result->count == 0) {
         return t('Indexing complete. Index is up to date');
     } else {
         if ($result->count == $is->searchBatchSize) {
             return t('Index partially updated. %s pages indexed (maximum number.) Re-run this job to continue this process.', $result->count);
         } else {
             return t('Index updated.') . ' ' . t2('%d page required reindexing.', '%d pages required reindexing.', $result->count, $result->count);
         }
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:25,代码来源:index_search.php

示例5: edit

 public function edit($akID = 0)
 {
     if ($this->post('akID')) {
         $akID = $this->post('akID');
     }
     $key = CollectionAttributeKey::getByID($akID);
     if (!is_object($key) || $key->isAttributeKeyInternal()) {
         $this->redirect('/dashboard/pages/attributes');
     }
     $type = $key->getAttributeType();
     $this->set('key', $key);
     $this->set('type', $type);
     if ($this->isPost()) {
         $cnt = $type->getController();
         $cnt->setAttributeKey($key);
         $e = $cnt->validateKey($this->post());
         if ($e->has()) {
             $this->set('error', $e);
         } else {
             $type = AttributeType::getByID($this->post('atID'));
             $key->update($this->post());
             $this->redirect('/dashboard/pages/attributes/', 'attribute_updated');
         }
     }
 }
开发者ID:nveid,项目名称:concrete5,代码行数:25,代码来源:attributes.php

示例6: do_search

 public function do_search()
 {
     $q = $_REQUEST['query'];
     $_q = $q;
     Loader::library('database_indexed_search');
     $ipl = new IndexedPageList();
     $aksearch = false;
     $ipl->ignoreAliases();
     if (is_array($_REQUEST['akID'])) {
         Loader::model('attribute/categories/collection');
         foreach ($_REQUEST['akID'] as $akID => $req) {
             $fak = CollectionAttributeKey::getByID($akID);
             if (is_object($fak)) {
                 $type = $fak->getAttributeType();
                 $cnt = $type->getController();
                 $cnt->setAttributeKey($fak);
                 $cnt->searchForm($ipl);
                 $aksearch = true;
             }
         }
     }
     if (isset($_REQUEST['month']) && isset($_REQUEST['year'])) {
         $month = strtotime($_REQUEST['year'] . '-' . $_REQUEST['month'] . '-01');
         $month = date('Y-m-', $month);
         $ipl->filterByPublicDate($month . '%', 'like');
         $aksearch = true;
     }
     if (empty($_REQUEST['query']) && $aksearch == false) {
         return false;
     }
     $ipl->setSimpleIndexMode(true);
     if (isset($_REQUEST['query'])) {
         $ipl->filterByKeywords($_q);
     }
     if (is_array($_REQUEST['search_paths'])) {
         foreach ($_REQUEST['search_paths'] as $path) {
             if (!strlen($path)) {
                 continue;
             }
             $ipl->filterByPath($path);
         }
     } elseif ($this->baseSearchPath != '') {
         $ipl->filterByPath($this->baseSearchPath);
     }
     $ipl->filter(false, '(ak_exclude_page_list = 0 or ak_exclude_page_list is null)');
     $ipl->filter(false, '(ak_exclude_search_index = 0 or ak_exclude_search_index is null)');
     $ipl->setItemsPerPage(5);
     $res = $ipl->getPage();
     foreach ($res as $r) {
         $results[] = new IndexedSearchResult($r['cID'], $r['cName'], $r['cDescription'], $r['score'], $r['cPath'], $r['content']);
     }
     $this->set('query', $q);
     $this->set('paginator', $ipl->getPagination());
     $this->set('results', $results);
     $this->set('do_search', true);
     $this->set('searchList', $ipl);
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:57,代码来源:controller.php

示例7: getPages

 function getPages($query = null)
 {
     Loader::model('page_list');
     $db = Loader::db();
     $bID = $this->bID;
     if ($this->bID) {
         $q = "select * from btDateNav where bID = '{$bID}'";
         $r = $db->query($q);
         if ($r) {
             $row = $r->fetchRow();
         }
     } else {
         $row['num'] = $this->num;
         $row['cParentID'] = $this->cParentID;
         $row['cThis'] = $this->cThis;
         $row['orderBy'] = $this->orderBy;
         $row['ctID'] = $this->ctID;
         $row['rss'] = $this->rss;
     }
     $pl = new PageList();
     $pl->setNameSpace('b' . $this->bID);
     $cArray = array();
     //$pl->sortByPublicDate();
     $pl->sortByPublicDateDescending();
     $num = (int) $row['num'];
     if ($num > 0) {
         $pl->setItemsPerPage($num);
     }
     $c = $this->getCollectionObject();
     if (is_object($c)) {
         $this->cID = $c->getCollectionID();
     }
     $cParentID = $row['cThis'] ? $this->cID : $row['cParentID'];
     if ($this->displayFeaturedOnly == 1) {
         Loader::model('attribute/categories/collection');
         $cak = CollectionAttributeKey::getByHandle('is_featured');
         if (is_object($cak)) {
             $pl->filterByIsFeatured(1);
         }
     }
     $pl->filter('cvName', '', '!=');
     if ($row['ctID']) {
         $pl->filterByCollectionTypeID($row['ctID']);
     }
     $pl->filterByAttribute('exclude_nav', false);
     if ($row['cParentID'] != 0) {
         $pl->filterByParentID($cParentID);
     }
     if ($num > 0) {
         $pages = $pl->getPage();
     } else {
         $pages = $pl->get();
     }
     $this->set('pl', $pl);
     return $pages;
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:56,代码来源:date_nav.php

示例8: testUnsetCommonAttributes

 /**
  *  @dataProvider commonAttributeHandles
  */
 public function testUnsetCommonAttributes($handle)
 {
     $page = Page::getByPath('/about');
     $ak = CollectionAttributeKey::getByHandle($handle);
     $page->clearAttribute($ak);
     $cav = $page->getAttributeValueObject($ak);
     if (is_object($cav)) {
         $this->fail(t("Page::clearAttribute did not delete '%s'.", $handle));
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:13,代码来源:PageAttributesExistenceTest.php

示例9: import_wordpress_xml

 public function import_wordpress_xml()
 {
     if ($this->post('import-images') == 'on') {
         $this->importImages = true;
         $filesetname;
         $this->post('file-set-name') ? $this->filesetname = $this->post('file-set-name') : ($this->filesetname = t("Imported Wordpress Files"));
         $this->createFileSet = true;
     }
     $pages = array();
     if (intval($this->post('wp-file')) > 0) {
         Loader::model('file');
         $co = new Config();
         $pkg = Package::getByHandle('wordpress_site_importer');
         $co->setPackageObject($pkg);
         $co->save("WORDPRESS_IMPORT_FID", $this->post('wp-file'));
         $importFile = File::getByID($this->post('wp-file'));
         $nv = $importFile->getVersion();
         $fileUrl = $nv->getDownloadURL();
         $xml = @simplexml_load_file($fileUrl, "SimpleXMLElement", LIBXML_NOCDATA);
         $items = array();
         foreach ($xml->channel->item as $item) {
             $items[] = $item->asxml();
         }
         $db = Loader::db();
         $sql = $db->Prepare('insert into WordpressItems (wpItem) values(?)');
         foreach ($items as $item) {
             $db->Execute($sql, $item);
         }
         $categories = array();
         $namespaces = $xml->getDocNamespaces();
         foreach ($xml->xpath('/rss/channel/wp:category') as $term_arr) {
             $t = $term_arr->children($namespaces['wp']);
             $categories[] = array('term_id' => (int) $t->term_id, 'category_nicename' => (string) $t->category_nicename, 'category_parent' => (string) $t->category_parent, 'cat_name' => (string) $t->cat_name, 'category_description' => (string) $t->category_description);
         }
         Loader::model('attribute/categories/collection');
         $akt = CollectionAttributeKey::getByHandle("wordpress_category");
         for ($i = 0; $i < count($categories); $i++) {
             $opt = new SelectAttributeTypeOption(0, $categories[$i]['cat_name'], $i);
             $opt = $opt->saveOrCreate($akt);
         }
         foreach ($xml->xpath('/rss/channel/wp:tag') as $term_arr) {
             $t = $term_arr->children($namespaces['wp']);
             $tags[] = array('term_id' => (int) $t->term_id, 'tag_slug' => (string) $t->tag_slug, 'tag_name' => (string) $t->tag_name, 'tag_description' => (string) $t->tag_description);
         }
         $akt = CollectionAttributeKey::getByHandle("tags");
         for ($i = 0; $i < count($tags); $i++) {
             $opt = new SelectAttributeTypeOption(0, $tags[$i]['tag_name'], $i);
             $opt = $opt->saveOrCreate($akt);
         }
     } else {
         echo t("No file");
         exit;
     }
     $this->view();
 }
开发者ID:herent,项目名称:wordpress_site_importer,代码行数:55,代码来源:file.php

示例10: run

	public function run() {
		$db = Loader::db();
		Loader::model('collection_attributes');
		Loader::model('single_page');
		Loader::model('file_version');
		
		// Add in stuff that may have gotten missed before
		$p = Page::getByPath('/profile');
		if ($p->isError()) {
			$d1 = SinglePage::add('/profile');
			$d2 = SinglePage::add('/profile/edit');
			$d3 = SinglePage::add('/profile/avatar');				
		}
		$p2 = Page::getByPath('/dashboard/users/registration');
		if ($p2->isError()) {
			$d4 = SinglePage::add('/dashboard/users/registration');
		}
		
		// Move any global blocks to new scrapbook page.
		$sc = Page::getByPath("/dashboard/scrapbook/global");
		$scn = Page::getByPath('/dashboard/scrapbook');
		$scu = Page::getByPath('/dashboard/scrapbook/user');
		if (!$sc->isError()) {
			$blocks = $sc->getBlocks("Global Scrapbook");
			if (count($blocks) > 0) {
				// we create the new shared scrapbook 1
				$a = Area::getOrCreate($scn, t('Shared Scrapbook 1'));
				foreach($blocks as $_b) {
					// we move them into the area on the new page. 
					$_b->move($scn, $a);
					$_b->refreshCacheAll();
				}
			}
			$sc->delete();
		}
		if (!$scu->isError()) {
			$scu->delete();
		}
		//add the new collection attribute keys
		$cak=CollectionAttributeKey::getByHandle('header_extra_content');
		if(!is_object($cak)) {
			CollectionAttributeKey::add('header_extra_content', t('Header Extra Content'), true, null, 'TEXT');
		}
		$cak=CollectionAttributeKey::getByHandle('exclude_search_index');
		if (!is_object($cak)) {
			CollectionAttributeKey::add('exclude_search_index', t('Exclude From Search Index'), true, null, 'BOOLEAN');
		}
		
		//convert file tags to new format, cleaned up with leading and trailing line breaks  
		$fileVersionsData=$db->GetAll('SELECT fID, fvID, fvTags FROM FileVersions');
		foreach($fileVersionsData as $fvData){
			$vals=array( FileVersion::cleanTags($fvData['fvTags']) , $fvData['fID'] , $fvData['fvID'] );
			$db->query('UPDATE FileVersions SET fvTags=? WHERE fID=? AND fvID=?',  $vals );
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:55,代码来源:version_530.php

示例11: setAuthor

 public function setAuthor($p)
 {
     $ak = CollectionAttributeKey::getByHandle('blog_author');
     if ($this->wp_post->author) {
         Loader::model('userinfo');
         $ui = UserInfo::getByUserName($this->wp_post->author);
         if (is_object($ui)) {
             $p->setAttribute($ak, $ui->getUserID());
         }
     }
 }
开发者ID:pranastae,项目名称:problog_importer,代码行数:11,代码来源:wp.php

示例12: processMetaData

	function processMetaData($nvc){			
		Loader::model('collection_attributes');
		$nvc->clearCollectionAttributes($_POST['selectedAKIDs']);
		if (is_array($_POST['selectedAKIDs'])) {
			foreach($_POST['selectedAKIDs'] as $akID) {
				if ($akID > 0) {
					$ak = CollectionAttributeKey::getByID($akID);
					$ak->saveAttributeForm($nvc);
				}
			} 
		}
	}
开发者ID:rii-J,项目名称:concrete5-de,代码行数:12,代码来源:process.php

示例13: install

 public function install()
 {
     $pkg = parent::install();
     Loader::model('single_page');
     Loader::model('attribute/categories/collection');
     // install attributes
     $cab1 = CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'easynews_section', 'akName' => t('NEWS Section'), 'akIsSearchable' => true), $pkg);
     //install pages
     $def = SinglePage::add('/dashboard/easy_news', $pkg);
     $def->update(array('cName' => 'Easy News', 'cDescription' => t('Manage site news.')));
     $def = SinglePage::add('/dashboard/easy_news/help', $pkg);
     $def->update(array('cName' => 'Easy News Help', 'cDescription' => t('Easy News help.')));
     //install block
     BlockType::installBlockTypeFromPackage('easynews_list', $pkg);
 }
开发者ID:hanicker,项目名称:Concrete5-EasyNews,代码行数:15,代码来源:controller.php

示例14: save

 public function save($data)
 {
     //parent::save($data);
     $db = Loader::db();
     $page = Page::getCurrentPage();
     $cID = $page->getCollectionID();
     $page = Page::getByID($cID);
     $page->update(array('cName' => $_REQUEST['collectionName']));
     $collectionAttributes = CollectionAttributeKey::getList();
     foreach ($collectionAttributes as $collectionAttribute) {
         if (array_key_exists($collectionAttribute->akID, $_REQUEST['akID'])) {
             $collectionAttribute->setAttribute($page, false);
         }
     }
 }
开发者ID:haeflimi,项目名称:concrete5-composer-list,代码行数:15,代码来源:controller.php

示例15: run

 /** Executes the job.
  * @return string Returns a string describing the job result in case of success.
  * @throws Exception Throws an exception in case of errors.
  */
 public function run()
 {
     Cache::disableCache();
     Cache::disableLocalCache();
     try {
         $db = Loader::db();
         $instances = array('navigation' => Loader::helper('navigation'), 'dashboard' => Loader::helper('concrete/dashboard'), 'view_page' => PermissionKey::getByHandle('view_page'), 'guestGroup' => Group::getByID(GUEST_GROUP_ID), 'now' => new DateTime('now'), 'ak_exclude_sitemapxml' => CollectionAttributeKey::getByHandle('exclude_sitemapxml'), 'ak_sitemap_changefreq' => CollectionAttributeKey::getByHandle('sitemap_changefreq'), 'ak_sitemap_priority' => CollectionAttributeKey::getByHandle('sitemap_priority'));
         $instances['guestGroupAE'] = array(GroupPermissionAccessEntity::getOrCreate($instances['guestGroup']));
         $xmlDoc = new SimpleXMLElement('<' . '?xml version="1.0" encoding="' . APP_CHARSET . '"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
         $rs = Loader::db()->Query('SELECT cID FROM Pages');
         while ($row = $rs->FetchRow()) {
             self::addPage($xmlDoc, intval($row['cID']), $instances);
         }
         $rs->Close();
         Events::fire('on_sitemap_xml_ready', $xmlDoc);
         $dom = dom_import_simplexml($xmlDoc)->ownerDocument;
         $dom->formatOutput = true;
         $addedPages = count($xmlDoc->url);
         $relName = ltrim(SITEMAPXML_FILE, '\\/');
         $osName = rtrim(DIR_BASE, '\\/') . '/' . $relName;
         $urlName = rtrim(BASE_URL . DIR_REL, '\\/') . '/' . $relName;
         if (!file_exists($osName)) {
             @touch($osName);
         }
         if (!is_writable($osName)) {
             throw new Exception(t('The file %s is not writable', $osName));
         }
         if (!($hFile = @fopen($osName, 'w'))) {
             throw new Exception(t('Cannot open file %s', $osName));
         }
         if (!@fwrite($hFile, $dom->saveXML())) {
             throw new Exception(t('Error writing to file %s', $osName));
         }
         @fflush($hFile);
         @fclose($hFile);
         unset($hFile);
         return t('%1$s file saved (%2$d pages).', sprintf('<a href="%s" target="_blank">%s</a>', $urlName, preg_replace('/^https?:\\/\\//i', '', $urlName)), $addedPages);
     } catch (Exception $x) {
         if (isset($hFile) && $hFile) {
             @fflush($hFile);
             @ftruncate($hFile, 0);
             @fclose($hFile);
             $hFile = null;
         }
         throw $x;
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:51,代码来源:generate_sitemap.php


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