Ejemplo n.º 1
0
 public function get(&$c, $cvID)
 {
     if (is_string($cvID)) {
         $cvID = CollectionVersion::getNumericalVersionID($c->getCollectionID(), $cvID);
     }
     $cv = new CollectionVersion();
     $db = Loader::db();
     $q = "select cvID, cvIsApproved, cvIsNew, cvHandle, cvName, cvDescription, cvDateCreated, cvDatePublic, cvAuthorUID, cvApproverUID, cvComments, ptID, CollectionVersions.ctID, ctHandle, ctName from CollectionVersions left join PageTypes on CollectionVersions.ctID = PageTypes.ctID where cID = ? and cvID = ?";
     $r = $db->query($q, array($c->getCollectionID(), $cvID));
     if ($r) {
         $row = $r->fetchRow();
         if ($row) {
             $cv->setPropertiesFromArray($row);
         }
     }
     // load the attributes for a particular version object
     Loader::model('attribute/categories/collection');
     $cv->attributes = CollectionAttributeKey::getAttributes($c->getCollectionID(), $cvID);
     $cv->cID = $c->getCollectionID();
     $cv->cvIsMostRecent = $cv->_checkRecent();
     $r = $db->GetAll('select csrID, arHandle from CollectionVersionAreaStyles where cID = ? and cvID = ?', array($c->getCollectionID(), $cvID));
     foreach ($r as $styles) {
         $cv->customAreaStyles[$styles['arHandle']] = $styles['csrID'];
     }
     return $cv;
 }
Ejemplo n.º 2
0
		public function reindex($index = false) {
			if ($this->isAlias()) {
				return false;
			}
			$db = Loader::db();
			
			Loader::model('attribute/categories/collection');
			$attribs = CollectionAttributeKey::getAttributes($this->getCollectionID(), $this->getVersionID(), 'getSearchIndexValue');
	
			$db->Execute('delete from CollectionSearchIndexAttributes where cID = ?', array($this->getCollectionID()));
			$searchableAttributes = array('cID' => $this->getCollectionID());
			$rs = $db->Execute('select * from CollectionSearchIndexAttributes where cID = -1');
			AttributeKey::reindex('CollectionSearchIndexAttributes', $searchableAttributes, $attribs, $rs);
			
			if ($index == false) {
				Loader::library('database_indexed_search');
				$index = new IndexedSearch();
			}
			
			$datetime = Loader::helper('date')->getSystemDateTime();
			
			$db->Replace('PageSearchIndex', array(
				'cID' => $this->getCollectionID(), 
				'cName' => $this->getCollectionName(), 
				'cDescription' => $this->getCollectionDescription(), 
				'cPath' => $this->getCollectionPath(),
				'cDatePublic' => $this->getCollectionDatePublic(), 
				'content' => $index->getBodyContentFromPage($this),
				'cDateLastIndexed' => $datetime
			), array('cID'), true);			
		}
Ejemplo n.º 3
0
 public function get(&$c, $cvID)
 {
     if (is_string($cvID)) {
         $cvID = CollectionVersion::getNumericalVersionID($c->getCollectionID(), $cvID);
     }
     $ca = new Cache();
     $cv = $ca->get('collection_version', $c->getCollectionID() . ':' . $cvID);
     if ($cv instanceof CollectionVersion) {
         return $cv;
     }
     $cv = new CollectionVersion();
     $db = Loader::db();
     $q = "select cvID, cvIsApproved, cvIsNew, cvHandle, cvName, cvDescription, cvDateCreated, cvDatePublic, cvAuthorUID, cvApproverUID, cvComments from CollectionVersions where cID = ? and cvID = ?";
     $r = $db->query($q, array($c->getCollectionID(), $cvID));
     if ($r) {
         $row = $r->fetchRow();
         if ($row) {
             $cv->setPropertiesFromArray($row);
         }
     }
     if ($cv->cvAuthorUID > 0) {
         $uAuthor = UserInfo::getByID($cv->cvAuthorUID);
         if (is_object($uAuthor)) {
             $cv->cvAuthorUname = $uAuthor->getUserName();
         }
     }
     if ($cv->cvApproverUID > 0) {
         $uApprover = UserInfo::getByID($cv->cvApproverUID);
         if (is_object($uApprover)) {
             $cv->cvApproverUname = $uApprover->getUserName();
         }
     }
     // load the attributes for a particular version object
     Loader::model('attribute/categories/collection');
     $cv->attributes = CollectionAttributeKey::getAttributes($c->getCollectionID(), $cvID);
     $cv->cID = $c->getCollectionID();
     $cv->cvIsMostRecent = $cv->_checkRecent();
     $r = $db->GetAll('select csrID, arHandle from CollectionVersionAreaStyles where cID = ? and cvID = ?', array($c->getCollectionID(), $cvID));
     foreach ($r as $styles) {
         $cv->customAreaStyles[$styles['arHandle']] = $styles['csrID'];
     }
     $ca = new Cache();
     $ca->set('collection_version', $c->getCollectionID() . ':' . $cvID, $cv);
     return $cv;
 }
Ejemplo n.º 4
0
		public function reindex($index = false, $actuallyDoReindex = true) {
			if ($this->isAlias()) {
				return false;
			}
			if ($actuallyDoReindex || ENABLE_PROGRESSIVE_PAGE_REINDEX == false) { 
				$db = Loader::db();
				
				Loader::model('attribute/categories/collection');
				$attribs = CollectionAttributeKey::getAttributes($this->getCollectionID(), $this->getVersionID(), 'getSearchIndexValue');
		
				$db->Execute('delete from CollectionSearchIndexAttributes where cID = ?', array($this->getCollectionID()));
				$searchableAttributes = array('cID' => $this->getCollectionID());
				$rs = $db->Execute('select * from CollectionSearchIndexAttributes where cID = -1');
				AttributeKey::reindex('CollectionSearchIndexAttributes', $searchableAttributes, $attribs, $rs);
				
				if ($index == false) {
					Loader::library('database_indexed_search');
					$index = new IndexedSearch();
				}
				
				$index->reindexPage($this);
				$db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 0), array('cID'), false);

				$cache = PageCache::getLibrary();
				$cache->purge($this);

			} else { 			
				$db = Loader::db();
				Config::save('DO_PAGE_REINDEX_CHECK', true);
				$db->Replace('PageSearchIndex', array('cID' => $this->getCollectionID(), 'cRequiresReindex' => 1), array('cID'), false);
			}
		}
Ejemplo n.º 5
0
		public function reindex($index = false) {
			if ($this->isAlias()) {
				return false;
			}
			$db = Loader::db();
			
			Loader::model('attribute/categories/collection');
			$attribs = CollectionAttributeKey::getAttributes($this->getCollectionID(), $this->getVersionID(), 'getSearchIndexValue');
	
			$db->Execute('delete from CollectionSearchIndexAttributes where cID = ?', array($this->getCollectionID()));
			$searchableAttributes = array('cID' => $this->getCollectionID());
			$rs = $db->Execute('select * from CollectionSearchIndexAttributes where cID = -1');
			AttributeKey::reindex('CollectionSearchIndexAttributes', $searchableAttributes, $attribs, $rs);
			
			if ($index == false) {
				Loader::library('database_indexed_search');
				$index = new IndexedSearch();
			}
			
			$index->reindexPage($this);
		}