本文整理汇总了PHP中QubitAcl类的典型用法代码示例。如果您正苦于以下问题:PHP QubitAcl类的具体用法?PHP QubitAcl怎么用?PHP QubitAcl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QubitAcl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($request)
{
$this->form = new sfForm();
$this->resource = $this->getRoute()->resource;
// Check that this isn't the root
if (!isset($this->resource->parent)) {
$this->forward404();
}
// Check user authorization
if (!QubitAcl::check($this->resource, 'delete')) {
QubitAcl::forwardUnauthorized();
}
if ($request->isMethod('delete')) {
$parent = $this->resource->parent;
foreach ($this->resource->descendants->andSelf()->orderBy('rgt') as $item) {
// Delete related digitalObjects
foreach ($item->digitalObjects as $digitalObject) {
$digitalObject->informationObjectId = null;
$digitalObject->delete();
}
$item->delete();
}
if (isset($parent->parent)) {
$this->redirect(array($parent, 'module' => 'informationobject'));
}
$this->redirect(array('module' => 'informationobject', 'action' => 'browse'));
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:28,代码来源:deleteAction.class.php
示例2: execute
public function execute($request)
{
$this->resource = $this->getRoute()->resource;
if (!$this->resource instanceof QubitTerm) {
$this->forward404();
}
// Check that this isn't the root
if (!isset($this->resource->parent)) {
$this->forward404();
}
if (1 > strlen($title = $this->resource->__toString())) {
$title = $this->context->i18n->__('Untitled');
}
$this->response->setTitle("{$title} - {$this->response->getTitle()}");
if (QubitAcl::check($this->resource, 'update')) {
$validatorSchema = new sfValidatorSchema();
$values = array();
$validatorSchema->name = new sfValidatorCallback(array('callback' => array($this, 'checkForRepeatedNames')));
$values['name'] = $this->resource->getName(array('cultureFallback' => true));
try {
$validatorSchema->clean($values);
} catch (sfValidatorErrorSchema $e) {
$this->errorSchema = $e;
}
}
QubitTreeView::addAssets($this->response);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:27,代码来源:indexAction.class.php
示例3: earlyExecute
public function earlyExecute()
{
$this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
$this->resource = new QubitAccession();
if (isset($this->getRoute()->resource)) {
$this->resource = $this->getRoute()->resource;
// Check user authorization
if (!QubitAcl::check($this->resource, 'update')) {
QubitAcl::forwardUnauthorized();
}
} else {
// Check user authorization
if (!QubitAcl::check($this->resource, 'create')) {
QubitAcl::forwardUnauthorized();
}
}
$title = $this->context->i18n->__('Add new accession record');
if (isset($this->getRoute()->resource)) {
if (1 > strlen($title = $this->resource->__toString())) {
$title = $this->context->i18n->__('Untitled');
}
$title = $this->context->i18n->__('Edit %1%', array('%1%' => $title));
}
$this->response->setTitle("{$title} - {$this->response->getTitle()}");
$this->relatedDonorComponent = new AccessionRelatedDonorComponent($this->context, 'accession', 'relatedDonor');
$this->relatedDonorComponent->resource = $this->resource;
$this->relatedDonorComponent->execute($this->request);
$this->rightEditComponent = new RightEditComponent($this->context, 'right', 'edit');
$this->rightEditComponent->resource = $this->resource;
$this->rightEditComponent->execute($this->request);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:31,代码来源:editAction.class.php
示例4: execute
public function execute($request)
{
$criteria = new Criteria();
$criteria = QubitTaxonomy::addEditableTaxonomyCriteria($criteria);
$criteria->addJoin(QubitTaxonomy::ID, QubitTaxonomyI18n::ID);
$criteria->add(QubitTaxonomyI18n::CULTURE, $this->context->user->getCulture());
// Narrow results by query
if (0 < strlen($request->query)) {
$criteria->add(QubitTaxonomyI18n::NAME, "{$request->query}%", Criteria::LIKE);
}
// Limit results by ACL
$criterion = QubitAcl::getFilterCriterion($criteria, QubitTaxonomy::getById(QubitTaxonomy::ROOT_ID), 'createTerm');
if (isset($criterion) && true !== $criterion) {
$criteria->addAnd($criterion);
} else {
if (false === $criterion) {
// If access denied to all taxonomies, then return nothing
return sfView::NONE;
}
}
// Sort by name
$criteria->addAscendingOrderByColumn(QubitTaxonomyI18n::NAME);
// Show first 10 results
$criteria->setLimit(10);
$this->taxonomies = QubitTaxonomy::get($criteria);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:26,代码来源:autocompleteAction.class.php
示例5: execute
public function execute($request)
{
parent::execute($request);
$this->isdiah = new sfEhriIsdiahPlugin($this->resource);
if (1 > strlen($title = $this->resource)) {
$title = $this->context->i18n->__('Untitled');
}
$this->response->setTitle("{$title} - {$this->response->getTitle()}");
if (QubitAcl::check($this->resource, 'update')) {
$validatorSchema = new sfValidatorSchema();
$valuess = array();
$validatorSchema->authorizedFormOfName = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Authorized form of name%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-3#5.1.2">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-3#4.7">', '%4%' => '</a>'))));
$values['authorizedFormOfName'] = $this->resource->getAuthorizedFormOfName(array('culltureFallback' => true));
$validatorSchema->identifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-3#5.1.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-3#4.7">', '%4%' => '</a>'))));
$values['identifier'] = $this->resource->identifier;
$validatorSchema->primaryContact = new sfValidatorAnd(array(new QubitValidatorCountable(), new sfValidatorOr(array(new sfValidatorSchema(array('city' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true)), new sfValidatorSchema(array('countryCode' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true)), new sfValidatorSchema(array('postalCode' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true)), new sfValidatorSchema(array('region' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true)), new sfValidatorSchema(array('streetAddress' => new sfValidatorString(array('required' => true))), array('allow_extra_fields' => true))), array('required' => true), array('invalid' => $this->context->i18n->__('%1%Contact information%2% - You %3%must%4% at least include one of the following location or address fields: city, country, postal code, region or street address.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-3#5.2.1">', '%2%' => '</a>', '%3%' => '<a href="<a href="http://ica-atom.org/doc/RS-3#4.7">', '%4%' => '</a>'))))), array('required' => true), array('required' => $this->context->i18n->__('%1%Contact information%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-3#5.2.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-3#4.7">', '%4%' => '</a>'))));
if (null !== $this->resource->getPrimaryContact()) {
$values['primaryContact']['city'] = $this->resource->getPrimaryContact()->getCity(array('culltureFallback' => true));
$values['primaryContact']['countryCode'] = $this->resource->getPrimaryContact()->countryCode;
$values['primaryContact']['postalCode'] = $this->resource->getPrimaryContact()->postalCode;
$values['primaryContact']['region'] = $this->resource->getPrimaryContact()->getRegion(array('culltureFallback' => true));
$values['primaryContact']['streetAddress'] = $this->resource->getPrimaryContact()->streetAddress;
}
try {
$validatorSchema->clean($values);
} catch (sfValidatorErrorSchema $e) {
$this->errorSchema = $e;
}
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:30,代码来源:indexAction.class.php
示例6: execute
public function execute($request)
{
parent::execute($request);
$this->isaar = new sfIsaarPlugin($this->resource);
if (1 > strlen($title = $this->resource->__toString())) {
$title = $this->context->i18n->__('Untitled');
}
$this->response->setTitle("{$title} - {$this->response->getTitle()}");
if (QubitAcl::check($this->resource, 'update')) {
$validatorSchema = new sfValidatorSchema();
$values = array();
$validatorSchema->authorizedFormOfName = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Authorized form of name%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-2#5.1.2">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-2#4.7">', '%4%' => '</a>'))));
$values['authorizedFormOfName'] = $this->resource->getAuthorizedFormOfName(array('cultureFallback' => true));
$validatorSchema->datesOfExistence = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Dates of existence%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-2#5.2.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-2#4.7">', '%4%' => '</a>'))));
$values['datesOfExistence'] = $this->resource->getDatesOfExistence(array('cultureFallback' => true));
$validatorSchema->descriptionIdentifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Description identifier%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-2#5.4.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-2#4.7">', '%4%' => '</a>'))));
$values['descriptionIdentifier'] = $this->resource->descriptionIdentifier;
$validatorSchema->entityType = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Type of entity%2% - This is a %3%mandatory%4% element.', array('%1%' => '<a href="http://ica-atom.org/doc/RS-2#5.1.1">', '%2%' => '</a>', '%3%' => '<a href="http://ica-atom.org/doc/RS-2#4.7">', '%4%' => '</a>'))));
$values['entityType'] = $this->resource->entityType;
try {
$validatorSchema->clean($values);
} catch (sfValidatorErrorSchema $e) {
$this->errorSchema = $e;
}
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:26,代码来源:indexAction.class.php
示例7: execute
public function execute($request)
{
if (!$this->context->user->hasCredential(array('contributor', 'editor', 'administrator'), false)) {
QubitAcl::forwardUnauthorized();
}
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$criteria = new Criteria();
switch ($request->sort) {
case 'nameDown':
$criteria->addDescendingOrderByColumn('identifier');
break;
case 'nameUp':
$criteria->addAscendingOrderByColumn('identifier');
break;
case 'updatedDown':
$criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
break;
case 'updatedUp':
$criteria->addAscendingOrderByColumn(QubitObject::UPDATED_AT);
break;
default:
if (!$this->getUser()->isAuthenticated()) {
$criteria->addAscendingOrderByColumn('authorized_form_of_name');
} else {
$criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
}
}
// Page results
$this->pager = new QubitPager('QubitAccession');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:35,代码来源:browseAction.class.php
示例8: execute
public function execute($request)
{
parent::execute($request);
$this->dc = new sfDcPlugin($this->resource);
if (1 > strlen($title = $this->resource)) {
$title = $this->context->i18n->__('Untitled');
}
$this->response->setTitle("{$title} - {$this->response->getTitle()}");
if (QubitAcl::check($this->resource, 'update')) {
$validatorSchema = new sfValidatorSchema();
$values = array();
$validatorSchema->identifier = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is a mandatory element.', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-identifier">', '%2%' => '</a>'))));
$values['identifier'] = $this->resource->identifier;
$validatorSchema->title = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Title%2% - This is a mandatory element.', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-title">', '%2%' => '</a>'))));
$values['title'] = $this->resource->getTitle(array('cultureFallback' => true));
$validatorSchema->repository = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('%1%Relation%2% (%3%isLocatedAt%4%) - This is a mandatory element for this resource or one its higher descriptive levels (if part of a collection hierarchy).', array('%1%' => '<a href="http://dublincore.org/documents/dcmi-terms/#elements-relation">', '%2%' => '</a>', '%3%' => '<a href="http://dublincore.org/groups/collections/collection-application-profile/#colcldisLocatedAt">', '%4%' => '</a>'))));
foreach ($this->resource->ancestors->andSelf() as $item) {
$values['repository'] = $item->repository;
if (isset($values['repository'])) {
break;
}
}
try {
$validatorSchema->clean($values);
} catch (sfValidatorErrorSchema $e) {
$this->errorSchema = $e;
}
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:29,代码来源:indexAction.class.php
示例9: earlyExecute
protected function earlyExecute()
{
$this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
$this->resource = new QubitDonor();
if (isset($this->getRoute()->resource)) {
$this->resource = $this->getRoute()->resource;
// Check user authorization
if (!QubitAcl::check($this->resource, 'update')) {
QubitAcl::forwardUnauthorized();
}
// Add optimistic lock
$this->form->setDefault('serialNumber', $this->resource->serialNumber);
$this->form->setValidator('serialNumber', new sfValidatorInteger());
$this->form->setWidget('serialNumber', new sfWidgetFormInputHidden());
} else {
// Check user authorization
if (!QubitAcl::check($this->resource, 'create')) {
QubitAcl::forwardUnauthorized();
}
}
$title = $this->context->i18n->__('Add new donor');
if (isset($this->getRoute()->resource)) {
if (1 > strlen($title = $this->resource->__toString())) {
$title = $this->context->i18n->__('Untitled');
}
$title = $this->context->i18n->__('Edit %1%', array('%1%' => $title));
}
$this->response->setTitle("{$title} - {$this->response->getTitle()}");
$this->contactInformationEditComponent = new ContactInformationEditComponent($this->context, 'contactinformation', 'editContactInformation');
$this->contactInformationEditComponent->resource = $this->resource;
$this->contactInformationEditComponent->execute($this->request);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:32,代码来源:editAction.class.php
示例10: execute
public function execute($request)
{
if (!$this->getUser()->isAuthenticated()) {
QubitAcl::forwardUnauthorized();
}
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$criteria = new Criteria();
// Do source culture fallback
$criteria = QubitCultureFallback::addFallbackCriteria($criteria, 'QubitPhysicalObject');
switch ($request->sort) {
case 'nameDown':
$criteria->addDescendingOrderByColumn('name');
break;
case 'locationDown':
$criteria->addDescendingOrderByColumn('location');
break;
case 'locationUp':
$criteria->addAscendingOrderByColumn('location');
break;
case 'nameUp':
default:
$request->sort = 'nameUp';
$criteria->addAscendingOrderByColumn('name');
}
// Page results
$this->pager = new QubitPager('QubitPhysicalObject');
$this->pager->setCriteria($criteria);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:32,代码来源:browseAction.class.php
示例11: 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;
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:25,代码来源:contextMenuComponent.class.php
示例12: earlyExecute
protected function earlyExecute()
{
$this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
$this->resource = new QubitActor();
// Make root actor the parent of new actors
$this->resource->parentId = QubitActor::ROOT_ID;
if (isset($this->getRoute()->resource)) {
$this->resource = $this->getRoute()->resource;
// Check that this isn't the root
if (!isset($this->resource->parent)) {
$this->forward404();
}
// Check user authorization
if (!QubitAcl::check($this->resource, 'update')) {
QubitAcl::forwardUnauthorized();
}
// Add optimistic lock
$this->form->setDefault('serialNumber', $this->resource->serialNumber);
$this->form->setValidator('serialNumber', new sfValidatorInteger());
$this->form->setWidget('serialNumber', new sfWidgetFormInputHidden());
} else {
// Check user authorization against Actor ROOT
if (!QubitAcl::check(QubitActor::getById(QubitActor::ROOT_ID), 'create')) {
QubitAcl::forwardUnauthorized();
}
}
$this->form->setDefault('next', $this->request->getReferer());
$this->form->setValidator('next', new sfValidatorString());
$this->form->setWidget('next', new sfWidgetFormInputHidden());
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:30,代码来源:editAction.class.php
示例13: execute
public function execute($request)
{
$this->form = new sfForm();
$this->resource = $this->getRoute()->resource;
// Check that this isn't the root
if (!isset($this->resource->parent)) {
$this->forward404();
}
// Don't delete protected terms
if ($this->resource->isProtected()) {
$this->forward('admin', 'termPermission');
}
// Check user authorization
if (!QubitAcl::check($this->resource, 'delete')) {
QubitAcl::forwardUnauthorized();
}
if ($request->isMethod('delete')) {
foreach ($this->resource->descendants->andSelf()->orderBy('rgt') as $item) {
if (QubitAcl::check($item, 'delete')) {
$item->delete();
}
}
if (isset($this->resource->taxonomy)) {
$this->redirect(array($this->resource->taxonomy, 'module' => 'taxonomy'));
}
$this->redirect(array('module' => 'taxonomy', 'action' => 'list'));
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:28,代码来源:deleteAction.class.php
示例14: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$this->resource = $this->getRoute()->resource;
// Check that this isn't the root
if (!isset($this->resource->parent)) {
$this->forward404();
}
$query = QubitSearch::getInstance()->addTerm($this->resource->id, 'parentId');
if (isset($request->query)) {
$query = $request->query;
}
$query = QubitAcl::searchFilterByRepository($query, 'read');
$query = QubitAcl::searchFilterDrafts($query);
$this->pager = new QubitArrayPager();
$this->pager->hits = QubitSearch::getInstance()->getEngine()->getIndex()->find($query);
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
$ids = array();
foreach ($this->pager->getResults() as $hit) {
$ids[] = $hit->getDocument()->id;
}
$criteria = new Criteria();
$criteria->add(QubitInformationObject::ID, $ids, Criteria::IN);
$this->informationObjects = QubitInformationObject::get($criteria);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:28,代码来源:fileListAction.class.php
示例15: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
if (isset($request->subquery)) {
try {
// Parse query string
$query = QubitSearch::getInstance()->parse($request->subquery);
} catch (Exception $e) {
$this->error = $e->getMessage();
return;
}
} else {
$this->redirect(array('module' => 'actor', 'action' => 'browse'));
}
$query->addSubquery(QubitSearch::getInstance()->addTerm('QubitActor', 'className'), true);
$query = QubitAcl::searchFilterByResource($query, QubitActor::getById(QubitActor::ROOT_ID));
$this->pager = new QubitArrayPager();
try {
$this->pager->hits = QubitSearch::getInstance()->getEngine()->getIndex()->find($query);
} catch (Exception $e) {
$this->error = $e->getMessage();
return;
}
$this->pager->setMaxPerPage($request->limit);
$this->pager->setPage($request->page);
$ids = array();
foreach ($this->pager->getResults() as $hit) {
$ids[] = $hit->getDocument()->id;
}
$criteria = new Criteria();
$criteria->add(QubitActor::ID, $ids, Criteria::IN);
$this->actors = QubitActor::get($criteria);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:35,代码来源:listAction.class.php
示例16: execute
public function execute($request)
{
$this->form = new sfForm();
$this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
$this->resource = $this->getRoute()->resource;
// Check that object exists and that it is not the root
if (!isset($this->resource) || !isset($this->resource->parent)) {
$this->forward404();
}
// Check if already exists a digital object
if (null !== ($digitalObject = $this->resource->getDigitalObject())) {
$this->redirect(array($digitalObject, 'module' => 'digitalobject', 'action' => 'edit'));
}
// Check user authorization
if (!QubitAcl::check($this->resource, 'update')) {
QubitAcl::forwardUnauthorized();
}
// Check repository file upload limit
$repo = $this->resource->getRepository(array('inherit' => true));
if (null !== $repo && $repo->uploadLimit != -1 && $repo->getDiskUsage(array('units' => 'G')) >= floatval($repo->uploadLimit)) {
$this->redirect(array($repo, 'module' => 'repository', 'action' => 'uploadLimitExceeded'));
}
// Add form fields
$this->addFields($request);
// Process form
if ($request->isMethod('post')) {
$this->form->bind($request->getPostParameters(), $request->getFiles());
if ($this->form->isValid()) {
$this->processForm();
$this->resource->save();
$this->redirect(array($this->resource, 'module' => 'informationobject'));
}
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:34,代码来源:addDigitalObjectAction.class.php
示例17: execute
public function execute($request)
{
$this->resource = $this->getRoute()->resource;
// Check user authorization
if (!QubitAcl::check($this->resource, 'read')) {
QubitAcl::forwardToSecureAction();
}
if (1 > strlen($title = $this->resource->__toString())) {
$title = $this->context->i18n->__('Untitled');
}
$this->response->setTitle("{$title} - {$this->response->getTitle()}");
if (QubitAcl::check($this->resource, 'update')) {
$validatorSchema = new sfValidatorSchema();
$values = array();
$validatorSchema->date = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Acquisition date - This is a mandatory element.')));
$values['date'] = $this->resource->date;
$validatorSchema->sourceOfAcquisition = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Source of acquisition - This is a mandatory element.')));
$values['sourceOfAcquisition'] = $this->resource->getSourceOfAcquisition(array('culltureFallback' => true));
$validatorSchema->locationInformation = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Location information - This is a mandatory element.')));
$values['locationInformation'] = $this->resource->getLocationInformation(array('culltureFallback' => true));
try {
$validatorSchema->clean($values);
} catch (sfValidatorErrorSchema $e) {
$this->errorSchema = $e;
}
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:27,代码来源:indexAction.class.php
示例18: execute
public function execute($request)
{
$this->form = new sfForm();
$this->resource = $this->getRoute()->resource;
// Get related information object by first grabbing top-level digital
// object
$parent = $this->resource->parent;
if (isset($parent)) {
$this->informationObject = $parent->informationObject;
} else {
$this->informationObject = $this->resource->informationObject;
if (!isset($this->informationObject)) {
$this->forward404();
}
}
// Check user authorization
if (!QubitAcl::check($this->informationObject, 'delete')) {
QubitAcl::forwardUnauthorized();
}
if ($request->isMethod('delete')) {
// Delete the digital object record from the database
$this->resource->delete();
// Redirect to edit page for parent Info Object
if (isset($parent)) {
$this->redirect(array($parent, 'module' => 'digitalobject', 'action' => 'edit'));
} else {
$this->redirect(array($this->informationObject, 'module' => 'informationobject'));
}
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:30,代码来源:deleteAction.class.php
示例19: 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);
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:59,代码来源:browseAction.class.php
示例20: execute
public function execute($request)
{
$this->form = new sfForm();
if (!$this->context->user->hasCredential('administrator')) {
QubitAcl::forwardUnauthorized();
}
$criteria = new Criteria();
$criteria->add(QubitSetting::NAME, 'plugins');
if (1 == count($query = QubitSetting::get($criteria))) {
$setting = $query[0];
$this->form->setDefault('enabled', unserialize($setting->__get('value', array('sourceCulture' => true))));
}
$configuration = ProjectConfiguration::getActive();
$pluginPaths = $configuration->getAllPluginPaths();
foreach (sfPluginAdminPluginConfiguration::$pluginNames as $name) {
unset($pluginPaths[$name]);
}
$this->plugins = array();
foreach ($pluginPaths as $name => $path) {
$className = $name . 'Configuration';
if (sfConfig::get('sf_plugins_dir') == substr($path, 0, strlen(sfConfig::get('sf_plugins_dir'))) && is_readable($classPath = $path . '/config/' . $className . '.class.php')) {
$this->installPluginAssets($name, $path);
require_once $classPath;
$class = new $className($configuration);
// Build a list of themes
if (isset($class::$summary) && 1 === preg_match('/theme/i', $class::$summary)) {
$this->plugins[$name] = $class;
}
}
}
if ($request->isMethod('post')) {
$this->form->setValidators(array('enabled' => new sfValidatorChoice(array('choices' => array_keys($this->plugins), 'empty_value' => array(), 'multiple' => true))));
$this->form->bind($request->getPostParameters());
if ($this->form->isValid()) {
if (1 != count($query)) {
$setting = new QubitSetting();
$setting->name = 'plugins';
}
$settings = unserialize($setting->__get('value', array('sourceCulture' => true)));
foreach (array_keys($this->plugins) as $item) {
if (in_array($item, (array) $this->form->getValue('enabled'))) {
$settings[] = $item;
} else {
if (false !== ($key = array_search($item, $settings))) {
unset($settings[$key]);
}
}
}
$setting->__set('value', serialize(array_unique($settings)));
$setting->save();
// Clear cache
$cacheClear = new sfCacheClearTask(sfContext::getInstance()->getEventDispatcher(), new sfFormatter());
$cacheClear->run();
$this->redirect(array('module' => 'sfPluginAdminPlugin', 'action' => 'themes'));
}
}
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:57,代码来源:themesAction.class.php
注:本文中的QubitAcl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论