protected function addField($name) { switch ($name) { case 'creators': $criteria = new Criteria(); $this->resource->addEventsCriteria($criteria); $criteria->add(QubitEvent::ACTOR_ID, null, Criteria::ISNOTNULL); $criteria->add(QubitEvent::TYPE_ID, QubitTerm::CREATION_ID); $value = $choices = array(); foreach ($this->events = QubitEvent::get($criteria) as $item) { $choices[$value[] = $this->context->routing->generate(null, array($item->actor, 'module' => 'actor'))] = $item->actor; } $this->form->setDefault('creators', $value); $this->form->setValidator('creators', new sfValidatorPass()); $this->form->setWidget('creators', new sfWidgetFormSelect(array('choices' => $choices, 'multiple' => true))); break; case 'appraisal': $this->form->setDefault('appraisal', $this->resource['appraisal']); $this->form->setValidator('appraisal', new sfValidatorString()); $this->form->setWidget('appraisal', new sfWidgetFormTextarea()); break; default: return parent::addField($name); } }
protected function addField($name) { switch ($name) { case 'type': $criteria = new Criteria(); $this->resource->addObjectTermRelationsRelatedByObjectIdCriteria($criteria); QubitObjectTermRelation::addJoinTermCriteria($criteria); $criteria->add(QubitTerm::TAXONOMY_ID, QubitTaxonomy::MODS_RESOURCE_TYPE_ID); $value = array(); foreach ($this->relations = QubitObjectTermRelation::get($criteria) as $item) { $value[] = $this->context->routing->generate(null, array($item->term, 'module' => 'term')); } $this->form->setDefault('type', $value); $this->form->setValidator('type', new sfValidatorPass()); $choices = array(); foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::MODS_RESOURCE_TYPE_ID) as $item) { $choices[$this->context->routing->generate(null, array($item, 'module' => 'term'))] = $item; } $this->form->setWidget('type', new sfWidgetFormSelect(array('choices' => $choices, 'multiple' => true))); break; default: return parent::addField($name); } }
protected function addField($name) { switch ($name) { case 'alternateTitle': case 'edition': $this->form->setDefault($name, $this->resource[$name]); $this->form->setValidator($name, new sfValidatorString()); $this->form->setWidget($name, new sfWidgetFormInput()); break; case 'editionStatementOfResponsibility': case 'issuingJurisdictionAndDenomination': case 'noteOnPublishersSeries': case 'numberingWithinPublishersSeries': case 'otherTitleInformation': case 'otherTitleInformationOfPublishersSeries': case 'parallelTitleOfPublishersSeries': case 'standardNumber': case 'statementOfCoordinates': case 'statementOfProjection': case 'statementOfResponsibilityRelatingToPublishersSeries': case 'statementOfScaleArchitectural': case 'statementOfScaleCartographic': case 'titleStatementOfResponsibility': case 'titleProperOfPublishersSeries': $this->form->setDefault($name, $this->rad[$name]); $this->form->setValidator($name, new sfValidatorString()); $this->form->setWidget($name, new sfWidgetFormInput()); break; case 'type': $criteria = new Criteria(); $this->resource->addObjectTermRelationsRelatedByObjectIdCriteria($criteria); QubitObjectTermRelation::addJoinTermCriteria($criteria); $criteria->add(QubitTerm::TAXONOMY_ID, QubitTaxonomy::MATERIAL_TYPE_ID); $value = array(); foreach ($this->relations = QubitObjectTermRelation::get($criteria) as $item) { $value[] = $this->context->routing->generate(null, array($item->term, 'module' => 'term')); } $this->form->setDefault('type', $value); $this->form->setValidator('type', new sfValidatorPass()); $choices = array(); foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::MATERIAL_TYPE_ID) as $item) { $choices[$this->context->routing->generate(null, array($item, 'module' => 'term'))] = $item; } $this->form->setWidget('type', new sfWidgetFormSelect(array('choices' => $choices, 'multiple' => true))); break; default: return parent::addField($name); } }