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; }
function loadVersionObject($cvID = "ACTIVE") { $cvID = CollectionVersion::getNumericalVersionID($this->getCollectionID(), $cvID); $this->vObj = CollectionVersion::get($this, $cvID); $vp = new Permissions($this->vObj); return $vp; }
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; }
/** * @param int $cID Collection ID of a page * @param string $versionOrig ACTIVE or RECENT * @param string $class * @return Page */ public static function getByID($cID, $versionOrig = 'RECENT', $class = 'Page') { if ($versionOrig == 'RECENT' || $versionOrig == 'ACTIVE') { $c = Cache::get(strtolower($class . '_' . $versionOrig), $cID); if ($c instanceof $class) { return $c; } } $version = CollectionVersion::getNumericalVersionID($cID, $versionOrig); $where = "where Pages.cID = ?"; $c = new $class(); $c->populatePage($cID, $where, $version); // must use cID instead of c->getCollectionID() because cID may be the pointer to another page if ($versionOrig == 'RECENT' || $versionOrig == 'ACTIVE') { Cache::set(strtolower($class . '_' . $versionOrig), $cID, $c); } return $c; }
/** * @param int $cID Collection ID of a page * @param string $versionOrig ACTIVE or RECENT * @param string $class * @return Page */ public static function getByID($cID, $versionOrig = 'RECENT', $class = 'Page') { if ($versionOrig) { $version = CollectionVersion::getNumericalVersionID($cID, $versionOrig); } $ca = new Cache(); $c = $version > 0 ? $ca->get(strtolower($class), $cID . ':' . $version) : ''; if ($c instanceof $class) { return $c; } $where = "where Pages.cID = ?"; $c = new $class(); $c->populatePage($cID, $where, $version); // must use cID instead of c->getCollectionID() because cID may be the pointer to another page if ($version > 0) { $ca->set(strtolower($class), $cID . ':' . $version, $c); } return $c; }
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $pkgHandle = 'easy_news'; Loader::library('controller', $pkgHandle); //Get info about category $cat = (int) $_GET['c']; Loader::model('page_list'); Loader::model("collection_types"); $ct = Collection::getByID($cat); //$a=$ct->getAttribute('easynews_section'); //if(empty($a)||(!$a)){ // die(); //} $cvID = CollectionVersion::getNumericalVersionID($ct->getCollectionID(), 'ACTIVE'); $vObj = CollectionVersion::get($ct, $cvID); $newsList = new PageList(); $newsList->filterByParentID($cat); $newsList->sortBy('cvDatePublic', 'desc'); $newsPage = $newsList->getPage(); //Start creation Loader::library('3rdparty/feedcreator/include/feedcreator.class', $pkgHandle); //define channel $rss = new UniversalFeedCreator(); $rss->useCached(); $rss->title = SITE . ' - ' . $vObj->cvName; $rss->description = $vObj->cvName . ' updates'; $rss->link = SITE_URL; $rss->syndicationURL = EasyNewsController::getRssPagePath() . '?c=' . $cat; //channel items/entries foreach ($newsPage as $page) {
public function getNextVersionComments() { $cvID = CollectionVersion::getNumericalVersionID($this->getCollectionID(), 'ACTIVE'); return t("Version %d", $cvID+1); }