public function execute($request) { $this->resource = $this->getRoute()->resource; $value = array(); if (isset($this->resource->actor)) { $value['actor'] = $this->context->routing->generate(null, array($this->resource->actor, 'module' => 'actor')); } if (isset($this->resource->date)) { $value['date'] = $this->resource->date; } $value['endDate'] = Qubit::renderDate($this->resource->endDate); $value['startDate'] = Qubit::renderDate($this->resource->startDate); if (isset($this->resource->description)) { $value['description'] = $this->resource->description; } if (isset($this->resource->informationObject)) { $value['informationObject'] = $this->context->routing->generate(null, array($this->resource->informationObject, 'module' => 'informationobject')); } $place = $this->resource->getPlace(); if (isset($place)) { $value['place'] = $this->context->routing->generate(null, array($place, 'module' => 'term')); } if (isset($this->resource->type)) { $value['type'] = $this->context->routing->generate(null, array($this->resource->type, 'module' => 'term')); } return $this->renderText(json_encode($value)); }
public static function renderDateStartEnd($date, $start, $end) { if (isset($date)) { return $date; } if (isset($start) || isset($end)) { $start = Qubit::renderDate($start); $end = Qubit::renderDate($end); if ($end == $start) { return $start; } return "{$start} - {$end}"; } }
public function execute($request) { $this->resource = $this->getRoute()->resource; $value = array(); $value['date'] = $this->resource->date; $value['endDate'] = Qubit::renderDate($this->resource->endDate); $value['startDate'] = Qubit::renderDate($this->resource->startDate); $value['description'] = $this->resource->description; if (isset($this->resource->object)) { $value['object'] = $this->context->routing->generate(null, array($this->resource->object)); } if (isset($this->resource->subject)) { $value['subject'] = $this->context->routing->generate(null, array($this->resource->subject)); } if (isset($this->resource->type)) { $value['type'] = $this->context->routing->generate(null, array($this->resource->type, 'module' => 'term')); } if (method_exists($this, 'extraQueries')) { $value = $this->extraQueries($value); } return $this->renderText(json_encode($value)); }
</td><td> <div class="animateNicely"> <?php echo $form->getWidgetSchema()->renderField('date', $item->getDate(array('cultureFallback' => true))); ?> </div> </td><td> <div class="animateNicely"> <?php echo $form->getWidgetSchema()->renderField('startDate', Qubit::renderDate($item->startDate)); ?> </div> </td><td> <div class="animateNicely"> <?php echo $form->getWidgetSchema()->renderField('endDate', Qubit::renderDate($item->endDate)); ?> </div> </td><td style="text-align: right"> <div class="animateNicely"> <input class="multiDelete" name="deleteEvents[]" type="checkbox" value="<?php echo url_for(array($item, 'module' => 'event')); ?> "/> </div> </td> </tr> <?php } ?>
public static function renderDates($item) { $dates = null; if (isset($item->startDate)) { $startDate = Qubit::renderDate($item->startDate); if (isset($item->endDate)) { $endDate = Qubit::renderDate($item->endDate); $dates = <<<str <dateRange> <fromDate standardDate="{$startDate}">{$startDate}</fromDate> <toDate standardDate="{$endDate}">{$endDate}</toDate> </dateRange> str; } else { $dates = <<<str <date standardDate="{$startDate}">{$startDate}</date> str; } } return $dates; }
</li> <?php } ?> </ul> </div> <?php } ?> <?php echo render_show(__('Accession number'), render_value($resource->identifier)); ?> <?php echo render_show(__('Acquisition date'), render_value(Qubit::renderDate($resource->date))); ?> <?php echo render_show(__('Source of acquisition'), render_value($resource->getSourceOfAcquisition(array('cultureFallback' => true)))); ?> <?php echo render_show(__('Location information'), render_value($resource->getLocationInformation(array('cultureFallback' => true)))); ?> <div class="section" id="donorArea"> <?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h2>' . __('Donor/Transferring body area') . '</h2>', array($resource, 'module' => 'accession', 'action' => 'edit'), array('anchor' => 'donorArea', 'title' => __('Edit donor/transferring body area'))); ?>
public function execute($request) { $this->resource = $this->getRoute()->resource; $value = array(); if (isset($this->resource->act)) { $value['act'] = $this->context->routing->generate(null, array($this->resource->act, 'module' => 'term')); } $value['restriction'] = $this->resource->restriction; $value['startDate'] = Qubit::renderDate($this->resource->startDate); $value['endDate'] = Qubit::renderDate($this->resource->endDate); if (isset($this->resource->rightsHolder)) { $value['rightsHolder'] = $this->context->routing->generate(null, array($this->resource->rightsHolder, 'module' => 'rightsholder')); } if (isset($this->resource->rightsNote)) { $value['rightsNote'] = $this->resource->rightsNote; } if (isset($this->resource->basis)) { $value['basis'] = $this->context->routing->generate(null, array($this->resource->basis, 'module' => 'term')); } /** * Basis: copyright */ if (isset($this->resource->copyrightStatus)) { $value['copyrightStatus'] = $this->context->routing->generate(null, array($this->resource->copyrightStatus, 'module' => 'term')); } if (isset($this->resource->copyrightStatusDate)) { $value['copyrightStatusDate'] = $this->resource->copyrightStatusDate; } if (isset($this->resource->copyrightJurisdiction)) { $value['copyrightJurisdiction'] = $this->resource->copyrightJurisdiction; } if (isset($this->resource->copyrightNote)) { $value['copyrightNote'] = $this->resource->copyrightNote; } /** * Basis: license */ if (isset($this->resource->licenseIdentifier)) { $value['licenseIdentifier'] = $this->resource->licenseIdentifier; } if (isset($this->resource->licenseTerms)) { $value['licenseTerms'] = $this->resource->licenseTerms; } if (isset($this->resource->licenseNote)) { $value['licenseNote'] = $this->resource->licenseNote; } /** * Basis: statute */ if (isset($this->resource->statuteJurisdiction)) { $value['statuteJurisdiction'] = $this->resource->statuteJurisdiction; } if (isset($this->resource->statuteCitation)) { $value['statuteCitation'] = $this->resource->statuteCitation; } if (isset($this->resource->statuteDeterminationDate)) { $value['statuteDeterminationDate'] = $this->resource->statuteDeterminationDate; } if (isset($this->resource->statuteNote)) { $value['statuteNote'] = $this->resource->statuteNote; } return $this->renderText(json_encode($value)); }
"> <td> <?php echo $item->object->act; ?> </td><td> <?php echo $item->object->restriction ? __('Allow') : __('Disallow'); ?> </td><td> <?php echo Qubit::renderDate($item->object->startDate); ?> </td><td> <?php echo Qubit::renderDate($item->object->endDate); ?> </td><td style="text-align: center"> <input class="multiDelete" name="deleteRights<?php echo $suffix; ?> []" type="checkbox" value="<?php echo url_for(array($item->object, 'module' => 'right')); ?> "/> </td> </tr> <?php } ?> </tbody>
?> </unitid> <?php } foreach ($descendant->getDates() as $date) { ?> <unitdate <?php if ($type = $date->getType()->__toString()) { echo 'datechar="' . strtolower($type) . '" '; } if ($startdate = $date->getStartDate()) { echo 'normal="'; echo Qubit::renderDate($startdate); if (0 < strlen($enddate = $date->getEndDate())) { echo '/'; echo Qubit::renderDate($enddate); } echo '"'; } ?> encodinganalog="3.1.3"><?php echo esc_specialchars(Qubit::renderDateStartEnd($date->getDate(array('cultureFallback' => true)), $date->startDate, $date->endDate)); ?> </unitdate> <?php } if (0 < count($creators = $descendant->getCreators())) { ?> <origination encodinganalog="3.2.1"> <?php foreach ($creators as $creator) {
protected function addField($name) { switch ($name) { case 'acquisitionType': $this->form->setDefault('acquisitionType', $this->context->routing->generate(null, array($this->resource->acquisitionType, 'module' => 'term'))); $this->form->setValidator('acquisitionType', new sfValidatorString()); $choices = array(); $choices[null] = null; foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::ACCESSION_ACQUISITION_TYPE_ID) as $item) { $choices[$this->context->routing->generate(null, array($item, 'module' => 'term'))] = $item; } $this->form->setWidget('acquisitionType', new sfWidgetFormSelect(array('choices' => $choices))); break; case 'processingPriority': $this->form->setDefault('processingPriority', $this->context->routing->generate(null, array($this->resource->processingPriority, 'module' => 'term'))); $this->form->setValidator('processingPriority', new sfValidatorString()); $choices = array(); $choices[null] = null; foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::ACCESSION_PROCESSING_PRIORITY_ID) as $item) { $choices[$this->context->routing->generate(null, array($item, 'module' => 'term'))] = $item; } $this->form->setWidget('processingPriority', new sfWidgetFormSelect(array('choices' => $choices))); break; case 'processingStatus': $this->form->setDefault('processingStatus', $this->context->routing->generate(null, array($this->resource->processingStatus, 'module' => 'term'))); $this->form->setValidator('processingStatus', new sfValidatorString()); $choices = array(); $choices[null] = null; foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::ACCESSION_PROCESSING_STATUS_ID) as $item) { $choices[$this->context->routing->generate(null, array($item, 'module' => 'term'))] = $item; } $this->form->setWidget('processingStatus', new sfWidgetFormSelect(array('choices' => $choices))); break; case 'resourceType': $this->form->setDefault('resourceType', $this->context->routing->generate(null, array($this->resource->resourceType, 'module' => 'term'))); $this->form->setValidator('resourceType', new sfValidatorString()); $choices = array(); $choices[null] = null; foreach (QubitTaxonomy::getTermsById(QubitTaxonomy::ACCESSION_RESOURCE_TYPE_ID) as $item) { $choices[$this->context->routing->generate(null, array($item, 'module' => 'term'))] = $item; } $this->form->setWidget('resourceType', new sfWidgetFormSelect(array('choices' => $choices))); break; case 'creators': $value = $choices = array(); foreach ($this->creators = QubitRelation::getRelationsByObjectId($this->resource->id, array('typeId' => QubitTerm::CREATION_ID)) as $item) { $choices[$value[] = $this->context->routing->generate(null, array($item->subject, 'module' => 'actor'))] = $item->subject; } $this->form->setDefault('creators', $value); $this->form->setValidator('creators', new sfValidatorPass()); $this->form->setWidget('creators', new sfWidgetFormSelect(array('choices' => $choices, 'multiple' => true))); break; case 'date': $this->form->setDefault('date', Qubit::renderDate($this->resource['date'])); if (!isset($this->resource->id)) { $dt = new DateTime(); $this->form->setDefault('date', $dt->format('Y-m-d')); } $this->form->setValidator('date', new sfValidatorString()); $this->form->setWidget('date', new sfWidgetFormInput()); break; case 'identifier': $this->form->setDefault('identifier', $this->resource['identifier']); if (!isset($this->resource->id)) { $dt = new DateTime(); $this->form->setDefault('identifier', QubitAccession::generateAccessionIdentifier()); } $this->form->setValidator('identifier', new sfValidatorString()); $this->form->setWidget('identifier', new sfWidgetFormInput(array(), array('disabled' => 'disabled'))); break; case 'receivedExtentUnits': case 'title': $this->form->setDefault($name, $this->resource[$name]); $this->form->setValidator($name, new sfValidatorString()); $this->form->setWidget($name, new sfWidgetFormInput()); break; case 'appraisal': case 'archivalHistory': case 'locationInformation': case 'physicalCharacteristics': case 'processingNotes': case 'scopeAndContent': case 'sourceOfAcquisition': $this->form->setDefault($name, $this->resource[$name]); $this->form->setValidator($name, new sfValidatorString()); $this->form->setWidget($name, new sfWidgetFormTextarea()); break; default: return parent::addField($name); } }
?> <?php echo render_show(__('Act'), render_value($resource->act)); ?> <?php echo render_show(__('Restriction'), render_value($resource->restriction ? __('Allow') : __('Disallow'))); ?> <?php echo render_show(__('Start date'), render_value(Qubit::renderDate($resource->startDate))); ?> <?php echo render_show(__('End date'), render_value(Qubit::renderDate($resource->endDate))); ?> <?php if (isset($resource->rightsHolder)) { ?> <?php echo render_show(__('Rights holder'), link_to(render_value($resource->rightsHolder), array($resource->rightsHolder, 'module' => 'rightsholder'))); ?> <?php } ?> <?php echo render_show(__('Rights note(s)'), render_value($resource->getRightsNote(array('cultureFallback' => true)))); ?>