Ejemplo n.º 1
0
 /**
  * Internal function to return a extra field object from a row.
  * @param $row array
  * @param $callHook boolean
  * @return Extra Field
  */
 function &_returnExtraFieldFromRow(&$row, $callHook = true)
 {
     $extraField = new ExtraField();
     $extraField->setId($row['extra_field_id']);
     $extraField->setExtraFieldId($row['extra_field_id']);
     $extraField->setExtraFieldType($row['type']);
     $extraField->setExtraFieldActive($row['active']);
     $this->getDataObjectSettings('extra_field_settings', 'extra_field_id', $row['extra_field_id'], $extraField);
     if ($callHook) {
         HookRegistry::call('ExtraFieldDAO::_returnExtraFieldFromRow', array(&$extraField, &$row));
     }
     return $extraField;
 }
Ejemplo n.º 2
0
 /**
  * Save extra field.
  */
 function execute()
 {
     $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
     if (isset($this->extraFieldId)) {
         $extraField =& $extraFieldDao->getExtraField($this->extraFieldId);
     }
     if (!isset($extraField)) {
         $extraField = new ExtraField();
     }
     $extraField->setExtraFieldType($this->typeConst);
     $journal = Request::getJournal();
     $extraFieldNames = $this->getData('extraFieldNames');
     foreach ($journal->getSupportedLocaleNames() as $localeKey => $localeValue) {
         $extraField->setExtraFieldName($extraFieldNames[$localeKey], $localeKey);
     }
     $extraField->setExtraFieldActive($this->getData('active'));
     if (isset($this->extraFieldId)) {
         $extraFieldDao->updateExtraField($extraField);
     } else {
         $extraFieldDao->insertExtraField($extraField);
     }
 }