/** * */ public function insert($pa_options = null) { if ($vn_rc = parent::insert($pa_options)) { $t_left = $this->getAppDatamodel()->getInstanceByTableNum($this->getLeftTableNum()); $t_right = $this->getAppDatamodel()->getInstanceByTableNum($this->getRightTableNum()); foreach (array($this->getRightTableName() => $t_left, $this->getLeftTableName() => $t_right) as $vs_other_table_name => $t_instance) { if ((bool) $t_instance->getProperty('SUPPORTS_ACL_INHERITANCE')) { if (is_array($va_inheritors = $t_instance->getProperty('ACL_INHERITANCE_LIST')) && in_array($vs_other_table_name, $va_inheritors)) { ca_acl::applyACLInheritanceToRelatedRowFromRow($t_instance, $vs_other_table_name == $this->getLeftTableName() ? $this->get($this->getRightTableFieldName()) : $this->get($this->getLeftTableFieldName()), $vs_other_table_name, $vs_other_table_name == $this->getLeftTableName() ? $this->get($this->getLeftTableFieldName()) : $this->get($this->getRightTableFieldName())); } } } } return $vn_rc; }
public function insert($pa_options = null) { // reject if media is empty if ($this->mediaIsEmpty()) { $this->postError(2710, _t('No media was specified'), 'ca_object_representations->insert()'); return false; } // do insert if ($vn_rc = parent::insert($pa_options)) { if (is_array($va_media_info = $this->getMediaInfo('media', 'original'))) { $this->set('md5', $va_media_info['MD5']); $this->set('mimetype', $va_media_info['MIMETYPE']); if (is_array($va_media_info = $this->getMediaInfo('media'))) { $this->set('original_filename', $va_media_info['ORIGINAL_FILENAME']); } } $va_metadata = $this->get('media_metadata', array('binary' => true)); caExtractEmbeddedMetadata($this, $va_metadata, $this->get('locale_id')); $vn_rc = parent::update(); } return $vn_rc; }
public function insert($pa_options = null) { $vn_rc = parent::insert($pa_options); if ($this->getPrimaryKey()) { // create root in ca_list_items $t_item_root = new ca_editor_ui_screens(); $t_item_root->setMode(ACCESS_WRITE); $t_item_root->set('ui_id', $this->getPrimaryKey()); $t_item_root->set('is_default', 0); $t_item_root->insert(); if ($t_item_root->numErrors()) { $this->delete(); $this->errors = array_merge($this->errors, $t_item_root->errors); } } return $vn_rc; }
public function insert($pa_options = null) { $this->set('type_code', $vs_type = $this->getAnnotationType()); $this->opo_annotations_properties = $this->loadProperties($vs_type); if (!$this->opo_annotations_properties) { $this->postError(1101, _t('No type code set'), 'ca_representation_annotations->insert'); return false; } if (!$this->opo_annotations_properties->validate()) { $this->errors = $this->opo_annotations_properties->errors; return false; } $this->set('props', $this->opo_annotations_properties->getPropertyValues()); $vn_rc = parent::insert($pa_options); return $vn_rc; }
/** * */ public function insert($pa_options = null) { $vn_rc = parent::insert($pa_options); if ($this->getPrimaryKey()) { // create root in ca_list_items $t_item_root = new ca_list_items(); $t_item_root->setMode(ACCESS_WRITE); if ($this->inTransaction()) { $t_item_root->setTransaction($this->getTransaction()); } $t_item_root->set('list_id', $this->getPrimaryKey()); $t_item_root->set('idno', $vs_title = 'Root node for ' . $this->get('list_code')); $t_item_root->set('is_enabled', 0); $t_item_root->set('item_value', 'Root'); $t_item_root->insert(); if ($t_item_root->numErrors()) { $this->delete(); $this->errors = array_merge($this->errors, $t_item_root->errors); return false; } $vn_locale_id = ca_locales::getDefaultCataloguingLocaleID(); $t_item_root->addLabel(array('name_singular' => $vs_title, 'name_plural' => $vs_title), $vn_locale_id, null, true); if ($t_item_root->numErrors()) { $this->delete(); $this->errors = array_merge($this->errors, $t_item_root->errors); return false; } } return $vn_rc; }
/** * Override insert() to set table_num to whatever the parent is */ public function insert($pa_options = null) { if ($vn_parent_id = $this->get('parent_id')) { $t_root_rel_type = new ca_relationship_types($vn_parent_id); if ($vn_table_num = $t_root_rel_type->get('table_num')) { $this->set('table_num', $vn_table_num); } } $vb_we_set_transaction = false; if (!$this->inTransaction()) { $this->setTransaction($o_trans = new Transaction($this->getDb())); $vb_we_set_transaction = true; } else { $o_trans = $this->getTransaction(); } if ($this->get('is_default')) { $o_trans->getDb()->query("\n\t\t\t\tUPDATE ca_relationship_types \n\t\t\t\tSET is_default = 0 \n\t\t\t\tWHERE table_num = ?\n\t\t\t", (int) $t_root_rel_type->get('table_num')); } if (!($vn_rc = parent::insert($pa_options))) { if ($vb_we_set_transaction) { $o_trans->rollback(); } } else { if ($vb_we_set_transaction) { $o_trans->commit(); } } $this->loadSubtypeLists(); return $vn_rc; }
/** * Creates new set item record. You must set all required fields before calling this method. * If errors occur you can use the standard BaseModel class error handling methods to figure out what went wrong. * * @access public * @return bool Returns true if no error, false if error occurred */ public function insert($pa_options = null) { # set vars (the set() method automatically serializes the vars array) $this->set("vars", $this->opa_set_item_vars); return parent::insert($pa_options); }
public function insert($pa_options = null) { // reject if media is empty if ($this->mediaIsEmpty()) { $this->postError(2710, _t('No media was specified'), 'ca_object_representations->insert()'); return false; } // do insert if ($vn_rc = parent::insert($pa_options)) { if (is_array($va_media_info = $this->getMediaInfo('media', 'original'))) { $this->set('md5', $va_media_info['MD5']); $this->set('mimetype', $va_media_info['MIMETYPE']); if (is_array($va_media_info = $this->getMediaInfo('media'))) { $this->set('original_filename', $va_media_info['ORIGINAL_FILENAME']); } } $va_metadata = $this->get('media_metadata', array('binary' => true)); caExtractEmbeddedMetadata($this, $va_metadata, $this->get('locale_id')); $vn_rc = parent::update(); // Trigger automatic replication $va_auto_targets = $this->getAvailableMediaReplicationTargets('media', 'original', array('trigger' => 'auto', 'access' => $this->get('access'))); if (is_array($va_auto_targets)) { foreach ($va_auto_targets as $vs_target => $va_target_info) { $this->replicateMedia('media', $vs_target); } } } return $vn_rc; }