本文整理汇总了PHP中QubitAcl::addFilterDraftsCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP QubitAcl::addFilterDraftsCriteria方法的具体用法?PHP QubitAcl::addFilterDraftsCriteria怎么用?PHP QubitAcl::addFilterDraftsCriteria使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QubitAcl
的用法示例。
在下文中一共展示了QubitAcl::addFilterDraftsCriteria方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($request)
{
$this->resource = $request->getAttribute('sf_route')->resource;
$criteria = new Criteria();
$criteria->add(QubitEvent::ACTOR_ID, $this->resource->id);
$criteria->addJoin(QubitEvent::INFORMATION_OBJECT_ID, QubitInformationObject::ID);
$criteria->addAscendingOrderByColumn(QubitEvent::TYPE_ID);
// Sort info objects alphabetically (w/ fallback)
$criteria->addAscendingOrderByColumn('title');
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitInformationObject');
// Filter draft descriptions
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
$this->relatedInfoObjects = array();
foreach (QubitEvent::get($criteria) as $item) {
$this->relatedInfoObjects[$item->type->getRole()][] = $item->informationObject;
}
// Get "subject of" information objects (name access point)
$criteria = new Criteria();
$criteria->add(QubitRelation::OBJECT_ID, $this->resource->id);
$criteria->add(QubitRelation::TYPE_ID, QubitTerm::NAME_ACCESS_POINT_ID);
$this->subjectInfoObjects = array();
foreach (QubitRelation::get($criteria) as $item) {
$this->subjectInfoObjects[] = $item->subject;
}
}
示例2: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$criteria = new Criteria();
if (isset($this->getRoute()->resource)) {
$this->resource = $this->getRoute()->resource;
$criteria->add(QubitInformationObject::PARENT_ID, $this->resource->id);
} else {
$criteria->add(QubitInformationObject::PARENT_ID, QubitInformationObject::ROOT_ID);
}
if (isset($request->repositoryId)) {
$criteria->add(QubitInformationObject::REPOSITORY_ID, $request->repositoryId);
}
if (isset($request->collectionType)) {
$criteria->add(QubitInformationObject::COLLECTION_TYPE_ID, $request->collectionType);
}
$fallbackTable = 'QubitInformationObject';
switch ($request->sort) {
case 'repositoryDown':
$fallbackTable = 'QubitActor';
$criteria->addJoin(QubitInformationObject::REPOSITORY_ID, QubitActor::ID, Criteria::LEFT_JOIN);
$criteria->addDescendingOrderByColumn('authorized_form_of_name');
break;
case 'repositoryUp':
$fallbackTable = 'QubitActor';
$criteria->addJoin(QubitInformationObject::REPOSITORY_ID, QubitActor::ID, Criteria::LEFT_JOIN);
$criteria->addAscendingOrderByColumn('authorized_form_of_name');
break;
case 'titleDown':
$criteria->addDescendingOrderByColumn('title');
break;
case 'titleUp':
$criteria->addAscendingOrderByColumn('title');
break;
case 'updatedDown':
$criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
break;
case 'updatedUp':
$criteria->addAscendingOrderByColumn(QubitObject::UPDATED_AT);
break;
default:
if (!$this->getUser()->isAuthenticated()) {
$criteria->addAscendingOrderByColumn('title');
} else {
$criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
}
}
// Do source culture fallback
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, $fallbackTable);
// Filter drafts
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
// Page results
$this->pager = new QubitPager('QubitInformationObject');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
}
示例3: execute
/**
* Execute digitalobject list action
*
* @param sfWebRequest $request
*/
public function execute($request)
{
// Build funky join query to get a count of top level digital objects
// for each media type (term)
$criteria = new Criteria();
$criteria->add(QubitTerm::TAXONOMY_ID, QubitTaxonomy::MEDIA_TYPE_ID);
$criteria->addJoin(QubitTerm::ID, QubitDigitalObject::MEDIA_TYPE_ID, Criteria::LEFT_JOIN);
$criteria->addAsColumn('hits', 'COUNT(' . QubitDigitalObject::ID . ')');
$criteria->addGroupByColumn(QubitTerm::ID);
// Add I18n fallback
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitTerm');
$criteria->addAscendingOrderByColumn('name');
// Filter drafts
$criteria->addJoin(QubitDigitalObject::INFORMATION_OBJECT_ID, QubitInformationObject::ID);
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
$this->terms = QubitTerm::get($criteria);
}
示例4: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$this->resource = $this->getRoute()->resource;
$criteria = new Criteria();
$criteria->add(QubitObjectTermRelation::TERM_ID, $this->resource->id);
$criteria->addJoin(QubitObjectTermRelation::OBJECT_ID, QubitInformationObject::ID);
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitInformationObject');
$criteria->addAscendingOrderByColumn('title');
$this->pager = new QubitPager('QubitInformationObject');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
$this->informationObjects = $this->pager->getResults();
}
示例5: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
// HACK Use id deliberately, vs. slug, because "Subjects" and "Places"
// menus still use id
$this->resource = QubitTaxonomy::getById($request->id);
if (!isset($this->resource)) {
$this->forward404();
}
$criteria = new Criteria();
$criteria->add(QubitTerm::TAXONOMY_ID, $this->resource->id);
$criteria->addJoin(QubitTerm::ID, QubitObjectTermRelation::TERM_ID);
$criteria->addJoin(QubitObjectTermRelation::OBJECT_ID, QubitInformationObject::ID);
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
// Do culture fallback
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitTerm');
$criteria->addGroupByColumn(QubitTerm::ID);
$criteria->addAsColumn('hits', 'COUNT(' . QubitTerm::ID . ')');
switch ($request->sort) {
case 'hitsDown':
$criteria->addDescendingOrderByColumn('hits');
break;
case 'hitsUp':
$criteria->addAscendingOrderByColumn('hits');
break;
case 'termNameDown':
$criteria->addDescendingOrderByColumn('name');
break;
case 'termNameUp':
default:
$criteria->addAscendingOrderByColumn('name');
break;
}
$this->pager = new QubitPager('QubitTerm');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
$this->terms = $this->pager->getResults();
}
示例6: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = 25;
}
$this->mediaType = QubitTerm::getById($request->mediatype);
if (!$this->mediaType instanceof QubitTerm) {
$this->forward404();
}
$criteria = new Criteria();
$criteria->add(QubitDigitalObject::MEDIA_TYPE_ID, $this->mediaType->id);
$criteria->add(QubitDigitalObject::SEQUENCE);
$criteria->addJoin(QubitDigitalObject::INFORMATION_OBJECT_ID, QubitInformationObject::ID);
// Sort by name ascending
$criteria->addAscendingOrderByColumn(QubitDigitalObject::NAME);
// Filter draft descriptions
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
$this->pager = new QubitPager('QubitDigitalObject');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
}
示例7: generateReport
public function generateReport($request)
{
// Get "file" term in "level of description" taxonomy
$c2 = new Criteria();
$c2->addJoin(QubitTerm::ID, QubitTermI18n::ID, Criteria::INNER_JOIN);
$c2->add(QubitTermI18n::NAME, 'file');
$c2->add(QubitTermI18n::CULTURE, 'en');
$c2->add(QubitTerm::TAXONOMY_ID, QubitTaxonomy::LEVEL_OF_DESCRIPTION_ID);
$lod = QubitTermI18n::getOne($c2);
if (null === $lod) {
throw new sfException('Can\'t find "file" level of description in term table');
}
$criteria = new Criteria();
$criteria->add(QubitInformationObject::LFT, $this->resource->lft, Criteria::GREATER_EQUAL);
$criteria->add(QubitInformationObject::RGT, $this->resource->rgt, Criteria::LESS_EQUAL);
$criteria->addAscendingOrderByColumn(QubitInformationObject::LFT);
// Filter drafts
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
$this->results = array();
$this->resultCount = 0;
$informationObjects = QubitInformationObject::get($criteria);
foreach ($informationObjects as $item) {
if ($lod->id == $item->levelOfDescriptionId) {
$parentIsad = new sfIsadPlugin($item->parent);
$isad = new sfIsadPlugin($item);
$creationDates = self::getCreationDates($item);
$this->results[$parentIsad->__toString()][] = array('resource' => $item, 'referenceCode' => $isad->referenceCode, 'title' => $item->getTitle(array('cultureFallback' => true)), 'dates' => isset($creationDates) ? Qubit::renderDateStartEnd($creationDates->getDate(array('cultureFallback' => true)), $creationDates->startDate, $creationDates->endDate) : ' ', 'startDate' => isset($creationDates) ? $creationDates->startDate : null, 'accessConditions' => $item->getAccessConditions(array('cultureFallback' => true)), 'locations' => self::getLocationString($item));
$this->resultCount++;
}
}
// Sort items by selected criteria
$sortBy = $this->form->getValue('sortBy');
foreach ($this->results as $key => &$items) {
uasort($items, function ($a, $b) use($sortBy) {
return strnatcasecmp($a[$sortBy], $b[$sortBy]);
});
}
}
示例8: execute
public function execute($request)
{
$this->version = '1.3';
$this->verbose = 'false';
$this->noOp = 'false';
$this->maxUploadSize = QubitDigitalObject::getMaxUploadSize() / 1024;
// From bytes to kilobytes
$this->mediation = 'false';
// Should be based in auth + X-On-Behalf-Of
if (isset($request->getAttribute('sf_route')->resource)) {
$this->resource = $this->getRoute()->resource;
$this->title = $this->resource->__toString();
$this->workspaces = $this->resource->getChildren();
} else {
$this->title = sfConfig::get('app_siteTitle');
$criteria = new Criteria();
$criteria->add(QubitInformationObject::PARENT_ID, QubitInformationObject::ROOT_ID, Criteria::IN);
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
$this->workspaces = QubitInformationObject::get($criteria);
}
$this->response->setHttpHeader('Content-Type', 'application/atom+xml; charset="utf-8"');
$request->setRequestFormat('xml');
}
示例9: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$this->resource = $request->getAttribute('sf_route')->resource;
if (!isset($this->resource)) {
return sfView::NONE;
}
$criteria = new Criteria();
$criteria->addJoin(QubitInformationObject::ID, QubitObject::ID);
$criteria->add(QubitInformationObject::REPOSITORY_ID, $this->resource->id);
$criteria->addAscendingOrderByColumn('title');
// Sort holdings alphabetically (w/ fallback)
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitInformationObject');
// Filter draft descriptions
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
// Paginate holdings list
$this->pager = new QubitPager('QubitInformationObject');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
$this->holdings = $this->pager->getResults();
}
示例10: countRelatedInformationObjects
/**
* Get a count of objects related via q_object_term_relation that have a
* class_name = $objectClassName (i.e. only 'QubitInformationObject's)
*
* @param string $objectClassName related object class_name column value
* @return integer count of related object.
*/
public function countRelatedInformationObjects()
{
$criteria = new Criteria();
$criteria->add(QubitTerm::ID, $this->id);
$criteria->addJoin(QubitTerm::ID, QubitObject::ID);
$criteria->addJoin(QubitTerm::ID, QubitObjectTermRelation::TERM_ID);
$criteria->addJoin(QubitObjectTermRelation::OBJECT_ID, QubitInformationObject::ID);
// Only get published info objects
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
return BasePeer::doCount($criteria)->fetchColumn(0);
}
示例11: getCount
/**
* Get count of digital objects by media-type
*/
public static function getCount($mediaTypeId)
{
$criteria = new Criteria();
$criteria->add(QubitDigitalObject::PARENT_ID, null, Criteria::ISNULL);
$criteria->add(QubitDigitalObject::MEDIA_TYPE_ID, $mediaTypeId);
$criteria->addJoin(QubitDigitalObject::INFORMATION_OBJECT_ID, QubitInformationObject::ID);
$criteria = QubitAcl::addFilterDraftsCriteria($criteria);
return BasePeer::doCount($criteria)->fetchColumn(0);
}