public static function getByID($ctID, $obj = null) {
			if ($obj == null) {
				$ct = Cache::get('pageTypeByID', $ctID);
				if (is_object($ct)) {
					return $ct;
				}
			}
			
			$db = Loader::db();
			$q = "SELECT ctID, ctHandle, ctName, ctIcon, pkgID from PageTypes where PageTypes.ctID = ?";
			$r = $db->query($q, array($ctID));
			if ($r) {
				$row = $r->fetchRow();
				$r->free();
				if (is_array($row)) {
					$row['mcID'] = $db->GetOne("select cID from Pages where ctID = ? and cIsTemplate = 1", array($row['ctID']));
					$ct = new CollectionType; 
					$ct->setPropertiesFromArray($row);
					$ct->setComposerProperties();
					if ($obj) {
						$ct->limit($obj);
					} else {
						Cache::set('pageTypeByID', $ctID, $ct);
					}
				}
			}
			
			return $ct;
		}
Beispiel #2
0
		public static function getByID($ctID, $obj = null) {
			
			$db = Loader::db();
			$q = "SELECT ctID, ctHandle, ctName, ctIsInternal, ctIcon, pkgID from PageTypes where PageTypes.ctID = ?";
			$r = $db->query($q, array($ctID));
			if ($r) {
				$row = $r->fetchRow();
				$r->free();
				if (is_array($row)) {
					$row['mcID'] = $db->GetOne("select p.cID from Pages p inner join CollectionVersions cv on p.cID = cv.cID where cv.ctID = ? and cIsTemplate = 1", array($row['ctID']));
					$ct = new CollectionType; 
					$ct->setPropertiesFromArray($row);
					$ct->setComposerProperties();
					if ($obj) {
						$ct->limit($obj);
					}
				}
			}
			
			return $ct;
		}