/** * Overrides EntityReferenceHandler::getLabel(). */ public function getLabel($entity) { $target_type = $this->field['settings']['target_type']; $field = $entity->{OG_AUDIENCE_FIELD}; $gid = $field[LANGUAGE_NONE][0]['target_id']; $group = entity_load_single('node', $gid); return entity_label($target_type, $entity).' ('.entity_label('node', $group).')'; }
public function mergeEntityAsSynonym($items, $field, $instance, $synonym_entity, $synonym_entity_type) { // Let's say we keep the synonyms as strings and under the 'foo' column, to // keep it consistent with the extractSynonyms() method. $label = entity_label($synonym_entity_type, $synonym_entity); return array(array('foo' => $label)); }
/** * {inheritdoc} */ protected function getTitles($idList) { $ret = []; foreach ($this->entityManager->getStorage('node')->load($idList) as $node) { $ret[$node->nid] = entity_label('node', $node); } return $ret; }
/** * @Route("/{entity_type}/{entity}", name="entity_view", defaults={"view_mode" = "full", "langcode" = null, "page" = null}) * @Method("GET") * @ParamConverter("entity", converter="drupal.entity") * @Template */ public function viewAction(Request $request, $entity_type, $entity) { $view_mode = $request->get('view_mode'); $langcode = $request->get('langcode'); $page = $request->get('page'); list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity); $entities = entity_view($entity_type, array($id => $entity), $view_mode, $langcode, $page); return array('label' => entity_label($entity_type, $entity), 'uri' => entity_uri($entity_type, $entity), 'entity_type' => $entity_type, 'id' => $id, 'vid' => $vid, 'bundle' => $bundle, 'entity' => $entity, 'content' => reset($entities[$entity_type])); }
public function genresProcess($tids) { $genres = taxonomy_term_load_multiple($tids); if (empty($genres)) { return NULL; } $element = []; foreach ($genres as $genre) { $path = entity_uri('taxonomy_term', $genre); $element[] = array('name' => entity_label('taxonomy_term', $genre), 'path' => url($path['path'], $path['options'])); } return $element; }
/** * Sends the context messages back to Drupal's messaging system using * drupal_set_message. * * Please note that this is meant to be called before using drupal_goto() * to redirect the user to a result page. * * @param array $results The context from the batch operation. */ public static function exportContextResults(array $results) { foreach ($results as $result) { if ($result['entity_id'] && $result['entity_type']) { $message = ':label [<strong>:type</strong> <code>:id</code>] !message'; $arguments = array(':label' => entity_label($result['entity_type'], entity_load_single($result['entity_type'], $result['entity_id'])), ':type' => $result['entity_type'], ':id' => $result['entity_id'], '!message' => $result['message']); } else { $message = '!message'; $arguments = array('!message' => $result['message']); } drupal_set_message(t($message, $arguments), $result['type']); } }
/** * {@inheritdoc} */ public function hookTokens($type, $tokens, array $data = array(), array $options = array()) { $replacements = array(); if ($this->isValidTokenType($type)) { foreach ($tokens as $name => $original) { if ($this->isValidToken($original)) { $entity_id = $this->getEntityIdFromToken($original); $entity_type = $type == 'term' ? 'taxonomy_term' : $type; $entity_info = entity_get_info($entity_type); $entity = $entity_info['load hook']($entity_id); $label = entity_label($entity_type, $entity); $uri = entity_uri($entity_type, $entity); $replacements[$original] = l($label, $uri['path'], array('absolute' => TRUE)); } } } return $replacements; }
function action_feedback_title() { $transaction = TransactionSession::getFromSession(); if ($transaction) { $entities = $transaction->getRootEntities(); $entity = reset($entities); /** @var \Drupal\publisher\Entity $entity_object */ $entity_object = $entity['entity']; $entity_section = entity_label($entity_object->type(), $entity_object->definition); if (count($entities) > 1) { $entity_section .= ' and ' . (count($entities) - 1) . ' others'; } if ($entity_section !== false) { $title = t('Select dependencies of %entity to send...', array('%entity' => $entity_section)); drupal_set_title($title, PASS_THROUGH); return $title; } } return false; }
public function build($form, &$form_state) { $headers = array('Entity'); $rows = array(); $transaction = TransactionSession::getFromSession(); if ($transaction !== false) { $remote = $transaction->getRemote(); $root_entities = $transaction->getRootEntities(); $form['current_session'] = array('#type' => 'fieldset', '#title' => t('Current Session')); $form['current_session']['remote'] = array('#type' => 'html_tag', '#tag' => 'p', '#value' => t('Currently sending <strong>!count</strong> entities to <strong>:remote</strong>', array('!count' => count($root_entities), ':remote' => $remote->label))); foreach ($root_entities as $root_entity) { /** @var Entity $entity */ $entity = $root_entity['entity']; $uri = entity_uri($entity->type(), $entity->definition); $url = ltrim($uri['path'], '/'); $rows[] = array(l(entity_label($entity->type(), $entity->definition), $url)); } $form['current_session']['clear'] = array('#type' => 'submit', '#value' => 'Clear Session'); } $form['table'] = array('#theme' => 'table', '#header' => $headers, '#rows' => $rows, '#empty' => t('There is currently no pending publisher session.')); return $form; }
/** * Getter callback for skills property. */ function redesign_activity_property_skills_getter_callback($item) { $skill_list = array(); if ($item->type == 'activity') { // Start a new EFQ $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'skill')->fieldCondition('field_activity', 'target_id', $item->nid, '='); $result = $query->execute(); // If results are returned, it will be in node key if (isset($result['node'])) { $nids = array_keys($result['node']); // Load all the nodes that were returned. $skills = node_load_multiple($nids, array('type' => 'skill')); $skill_list = array(); // Build array of node titles. foreach ($skills as $skill) { // Unlinked title of the node. $skill_list[] = entity_label('node', $skill); } } } return $skill_list; }
protected function overviewTableRow($conditions, $id, $entity, $additional_cols = array()) { $entity_uri = entity_uri($this->entityType, $entity); $row[] = array('data' => array('#theme' => 'entity_ui_overview_item', '#label' => entity_label($this->entityType, $entity), '#name' => !empty($this->entityInfo['exportable']) ? entity_id($this->entityType, $entity) : FALSE, '#url' => $entity_uri ? $entity_uri : FALSE, '#entity_type' => $this->entityType)); // Add in any passed additional cols. foreach ($additional_cols as $col) { $row[] = $col; } // Add a row for the exportable status. if (!empty($this->entityInfo['exportable'])) { $row[] = array('data' => array('#theme' => 'entity_status', '#status' => $entity->{$this->statusKey})); } // In case this is a bundle, we add links to the field ui tabs. $field_ui = !empty($this->entityInfo['bundle of']) && entity_type_is_fieldable($this->entityInfo['bundle of']) && module_exists('field_ui'); // For exportable entities we add an export link. $exportable = !empty($this->entityInfo['exportable']); // If i18n integration is enabled, add a link to the translate tab. $i18n = !empty($this->entityInfo['i18n controller class']); // Add operations depending on the status. if (entity_has_status($this->entityType, $entity, ENTITY_FIXED)) { $row[] = array('data' => l(t('clone'), $this->path . '/manage/' . $id . '/clone'), 'colspan' => $this->operationCount()); } else { $row[] = l(t('edit'), $this->path . '/manage/' . $id); if (empty($this->entityInfo['exportable']) || !entity_has_status($this->entityType, $entity, ENTITY_IN_CODE)) { $row[] = l(t('delete'), $this->path . '/manage/' . $id . '/delete', array('query' => drupal_get_destination())); } else { $row[] = ''; } } if ($exportable) { $row[] = l(t('export'), $this->path . '/manage/' . $id . '/export'); } $row[] = $entity->product_quantity; $row[] = l(t('quick+1'), '/product/' . $id . '/add/1'); $row[] = l(t('quick-1'), '/product/' . $id . '/sub/1'); return $row; }
/** * {@inheritdoc} */ public function hookTokens($type, $tokens, array $data = array(), array $options = array()) { $replacements = array(); if ($this->isValidTokenType($type)) { foreach ($tokens as $name => $original) { if ($this->isValidToken($original)) { $entity_id = $this->getEntityIdFromToken($original); $entity_type = $type == 'term' ? 'taxonomy_term' : $type; $entity_info = entity_get_info($entity_type); // Check if the entity is available. if ($entity = $entity_info['load hook']($entity_id)) { $label = entity_label($entity_type, $entity); $uri = entity_uri($entity_type, $entity); $replacements[$original] = l($label, $uri['path'], array('absolute' => TRUE)); } else { $this->watchdogTokenNotFound($data, $original); // Return an empty replacement to not show a broken link. $replacements[$original] = ''; } } } } return $replacements; }
/** * {@inheritdoc} */ public function label() { return entity_label('node', $this); }
/** * Build the label that will be used in the search result for each row. */ function buildLabel($entity) { return entity_label($this->plugin['entity_type'], $entity); }
/** * Implements EntityReferenceHandler::getReferencableEntities(). */ public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) { if ($match || $limit) { return parent::getReferencableEntities($match , $match_operator, $limit); } $options = array(); $entity_type = $this->field['settings']['target_type']; // We imitate core by calling taxonomy_get_tree(). $entity_info = entity_get_info('taxonomy_term'); $bundles = !empty($this->field['settings']['handler_settings']['target_bundles']) ? $this->field['settings']['handler_settings']['target_bundles'] : array_keys($entity_info['bundles']); foreach ($bundles as $bundle) { if ($vocabulary = taxonomy_vocabulary_machine_name_load($bundle)) { if ($terms = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE)) { foreach ($terms as $term) { $options[$vocabulary->machine_name][$term->tid] = str_repeat('-', $term->depth) . check_plain(entity_label('taxonomy_term', $term)); } } } } return $options; }
/** * Overrides the 'revert' action, to not delete the workflows. * * @see https://www.drupal.org/node/2051079 * @see https://www.drupal.org/node/1043634 */ public function applyOperation($op, $entity) { $label = entity_label($this->entityType, $entity); $vars = array('%entity' => $this->entityInfo['label'], '%label' => $label); $id = entity_id($this->entityType, $entity); $edit_link = l(t('edit'), $this->path . '/manage/' . $id . '/edit'); switch ($op) { case 'revert': // Do not delete the workflow, but recreate features_get_default($entity_type, $module); // entity_delete($this->entityType, $id); $workflow = $entity; $entity_type = $this->entityType; $funcname = $workflow->module . '_default_' . $this->entityType; $defaults = $funcname(); // No defaults, no processing. if (empty($defaults)) { return; } foreach ($defaults as $name => $entity) { $existing[$name] = workflow_load($name); // If we got an existing entity with the same name, we reuse its entity id. if (isset($existing[$name])) { // Set the original as later reference. $entity->original = $existing[$name]; // As we got an ID, the entity is not new. $entity->wid = $entity->original->wid; unset($entity->is_new); // Update the status to be in code. // $entity->status |= ENTITY_IN_CODE; $entity->status = ENTITY_IN_CODE; // We mark it for being in revert mode. $entity->is_reverted = TRUE; entity_save($entity_type, $entity); unset($entity->is_reverted); } // The rest of the defaults is handled by default implementation. // @see entity_defaults_rebuild() } watchdog($this->entityType, 'Reverted %entity %label to the defaults.', $vars, WATCHDOG_NOTICE, $edit_link); return t('Reverted %entity %label to the defaults.', $vars); case 'delete': case 'import': default: return parent::applyOperation($op, $entity); } }
/** * Overrides Drupal\configuration\Config\Configuration::getAllIdentifiers(). */ public static function getAllIdentifiers($component) { $options = array(); foreach (entity_load_multiple_by_name($component, FALSE) as $name => $entity) { $options[$name] = entity_label($component, $entity); } return $options; }
/** * Create a label of an entity. * * @param $entity * The entity to get the label from. * * @return * The entity label, or FALSE if not found. */ function createLabel($entity) { return filter_xss(entity_label($this->plugin['entity_type'], $entity)); }
/** * Create a label of an entity. * * @param $entity * The entity to get the label from. * * @return * The entity label, or FALSE if not found. */ function createLabel($entity) { return entity_label($this->plugin['entity_type'], $entity); }
/** * Implements EntityReferenceHandler::getLabel(). */ public function getLabel($entity) { return entity_label($this->entity_type, $entity); }
/** * Implements EntityReferenceHandler::getLabel(). */ public function getLabel($entity) { $target_type = $this->field['settings']['target_type']; return entity_access('view', $target_type, $entity) ? entity_label($target_type, $entity) : t('- Restricted access -'); }
/** * Build the label that will be used in the search result for each row. */ function buildLabel($entity) { return check_plain(entity_label($this->plugin['entity_type'], $entity)); }
/** * Save a scheduled transition. If the transition is executed, save in history. */ public function save() { // If executed, save in history. if ($this->is_executed) { // Be careful, we are not a WorkflowScheduleTransition anymore! $this->entityType = 'WorkflowTransition'; $this->setUp(); return parent::save(); // <--- exit !! } // Since we do not have an entity_id here, we cannot use entity_delete. // @todo: Add an 'entity id' to WorkflowScheduledTransition entity class. // $result = parent::save(); // Avoid duplicate entries. $clone = clone $this; $clone->delete(); // Save (insert or update) a record to the database based upon the schema. drupal_write_record('workflow_scheduled_transition', $this); // Create user message. if ($state = $this->getNewState()) { $entity_type = $this->entity_type; $entity = $this->getEntity(); $message = '%entity_title scheduled for state change to %state_name on %scheduled_date'; $args = array('@entity_type' => $entity_type, '%entity_title' => entity_label($entity_type, $entity), '%state_name' => entity_label('WorkflowState', $state), '%scheduled_date' => format_date($this->scheduled)); $uri = entity_uri($entity_type, $entity); watchdog('workflow', $message, $args, WATCHDOG_NOTICE, l('view', $uri['path'] . '/workflow')); drupal_set_message(t($message, $args)); } }
public function getLabel($entity) { return entity_label('cer', $entity); }
/** * Execute a transition (change state of a node). * * @param bool $force * If set to TRUE, workflow permissions will be ignored. * * @return int * New state ID. If execution failed, old state ID is returned, * * deprecated workflow_execute_transition() --> WorkflowTransition::execute(). */ public function execute($force = FALSE) { $user = $this->getUser(); $old_sid = $this->old_sid; $new_sid = $this->new_sid; // Load the entity, if not already loaded. // This also sets the (empty) $revision_id in Scheduled Transitions. $entity = $this->getEntity(); // Only after getEntity(), the following are surely set. $entity_type = $this->entity_type; $entity_id = $this->entity_id; $field_name = $this->field_name; // Make sure $force is set in the transition, too. if ($force) { $this->force($force); } // Store the transition, so it can be easily fetched later on. // Store in an array, to prepare for multiple workflow_fields per entity. // This is a.o. used in hook_entity_update to trigger 'transition post'. $entity->workflow_transitions[$field_name] = $this; // Prepare an array of arguments for error messages. $args = array('%user' => isset($user->name) ? $user->name : '', '%old' => $old_sid, '%new' => $new_sid); if (!$this->getOldState()) { drupal_set_message($message = t('You tried to set a Workflow State, but the entity is not relevant. Please contact your system administrator.'), 'error'); $message = 'Setting a non-relevant Entity from state %old to %new'; $uri = entity_uri($entity_type, $entity); watchdog('workflow', $message, $args, WATCHDOG_ERROR, l('view', $uri['path'])); return $old_sid; } // Check if the state has changed. $state_changed = $old_sid != $new_sid; // If so, check the permissions. if ($state_changed) { // State has changed. Do some checks upfront. if (!$force) { // Make sure this transition is allowed by workflow module Admin UI. $roles = array_keys($user->roles); $roles = array_merge(array(WORKFLOW_ROLE_AUTHOR_RID), $roles); if (!$this->isAllowed($roles, $user, $force)) { watchdog('workflow', 'User %user not allowed to go from state %old to %new', $args, WATCHDOG_NOTICE); // If incorrect, quit. return $old_sid; } } if (!$force) { // Make sure this transition is allowed by custom module. // @todo D8: remove, or replace by 'transition pre'. See WorkflowState::getOptions(). // @todo D8: replace all parameters that are included in $transition. $permitted = module_invoke_all('workflow', 'transition permitted', $old_sid, $new_sid, $entity, $force, $entity_type, $field_name, $this, $user); // Stop if a module says so. if (in_array(FALSE, $permitted, TRUE)) { watchdog('workflow', 'Transition vetoed by module.'); return $old_sid; } } // Make sure this transition is valid and allowed for the current user. // Invoke a callback indicating a transition is about to occur. // Modules may veto the transition by returning FALSE. // (Even if $force is TRUE, but they shouldn't do that.) $permitted = module_invoke_all('workflow', 'transition pre', $old_sid, $new_sid, $entity, $force, $entity_type, $field_name, $this); // Stop if a module says so. if (in_array(FALSE, $permitted, TRUE)) { watchdog('workflow', 'Transition vetoed by module.'); return $old_sid; } } elseif ($this->comment) { // No need to ask permission for adding comments. // Since you should not add actions to a 'transition pre' event, there is // no need to invoke the event. } else { // There is no state change, and no comment. // We may need to clean up something. } // The transition is allowed. Let other modules modify the comment. // @todo D8: remove all but last items from $context. $context = array('node' => $entity, 'sid' => $new_sid, 'old_sid' => $old_sid, 'uid' => $user->uid, 'transition' => $this); drupal_alter('workflow_comment', $this->comment, $context); // Now, change the database. // Log the new state in {workflow_node}. if (!$field_name) { if ($state_changed || $this->comment) { // If the node does not have an existing 'workflow' property, // save the $old_sid there, so it can be logged. if (!isset($entity->workflow)) { // This is a workflow_node sid. $entity->workflow = $old_sid; // This is a workflow_node sid. } // Change the state for {workflow_node}. // The equivalent for Field API is in WorkflowDefaultWidget::submit. $data = array('nid' => $entity_id, 'sid' => $new_sid, 'uid' => isset($entity->workflow_uid) ? $entity->workflow_uid : $user->uid, 'stamp' => REQUEST_TIME); workflow_update_workflow_node($data); $entity->workflow = $new_sid; // This is a workflow_node sid. } } else { // This is a Workflow Field. // Until now, adding code here (instead of in workflow_execute_transition() ) // doesn't work, creating an endless loop. /* if ($state_changed || $this->comment) { // Do a separate update to update the field (Workflow Field API) // This will call hook_field_update() and WorkflowFieldDefaultWidget::submit(). // $entity->{$field_name}[$this->language] = array(); // $entity->{$field_name}[$this->language][0]['workflow']['workflow_sid'] = $new_sid; // $entity->{$field_name}[$this->language][0]['workflow']['workflow_comment'] = $this->comment; $entity->{$field_name}[$this->language][0]['transition'] = $this; // Save the entity, but not through entity_save(), // since this will check permissions again and trigger rules. // @TODO: replace below by a workflow_field setter callback. // The transition was successfully executed, or else a message was raised. // entity_save($entity_type, $entity); // or // field_attach_update($entity_type, $entity); // Reset the entity cache after update. entity_get_controller($entity_type)->resetCache(array($entity_id)); $new_sid = workflow_node_current_state($entity, $entity_type, $field_name); } */ } $this->is_executed = TRUE; if ($state_changed || $this->comment) { // Log the transition in {workflow_node_history}. $this->save(); // Register state change with watchdog. if ($state_changed) { $workflow = $this->getWorkflow(); // Get the workflow_settings, unified for workflow_node and workflow_field. // @todo D8: move settings back to Workflow (like workflownode currently is). // @todo D8: to move settings back, grep for "workflow->options" and "field['settings']". $field = _workflow_info_field($field_name, $workflow); if (($new_state = $this->getNewState()) && !empty($field['settings']['watchdog_log'])) { $entity_type_info = entity_get_info($entity_type); $message = $this->isScheduled() ? 'Scheduled state change of @type %label to %state_name executed' : 'State of @type %label set to %state_name'; $args = array('@type' => $entity_type_info['label'], '%label' => entity_label($entity_type, $entity), '%state_name' => check_plain(t($new_state->label()))); $uri = entity_uri($entity_type, $entity); watchdog('workflow', $message, $args, WATCHDOG_NOTICE, l('view', $uri['path'])); } } // Remove any scheduled state transitions. foreach (WorkflowScheduledTransition::load($entity_type, $entity_id, $field_name) as $scheduled_transition) { /* @var $scheduled_transition WorkflowScheduledTransition */ $scheduled_transition->delete(); } // Notify modules that transition has occurred. // Action triggers should take place in response to this callback, not the 'transaction pre'. if (!$field_name) { // Now that workflow data is saved, reset stuff to avoid problems // when Rules etc want to resave the data. // Remember, this is only for nodes, and node_save() is not necessarily performed. unset($entity->workflow_comment); module_invoke_all('workflow', 'transition post', $old_sid, $new_sid, $entity, $force, $entity_type, $field_name, $this); entity_get_controller('node')->resetCache(array($entity->nid)); // from entity_load(), node_save(); } else { // module_invoke_all('workflow', 'transition post', $old_sid, $new_sid, $entity, $force, $entity_type, $field_name, $this); // We have a problem here with Rules, Trigger, etc. when invoking // 'transition post': the entity has not been saved, yet. we are still // IN the transition, not AFTER. Alternatives: // 1. Save the field here explicitly, using field_attach_save; // 2. Move the invoke to another place: hook_entity_insert(), hook_entity_update(); // 3. Rely on the entity hooks. This works for Rules, not for Trigger. // --> We choose option 2: // - First, $entity->workflow_transitions[] is set for easy re-fetching. // - Then, post_execute() is invoked via workflowfield_entity_insert(), _update(). } } return $new_sid; }
/** * Add an entity as a synonym into a field of another entity. * * Basically this method should be called when you want to add some entity * as a synonym to another entity (for example when you merge one entity * into another and besides merging want to add synonym of the merging * entity into the trunk entity). You should extract synonym value (according * to what value is expected in this field) and return it. We try to provide * you with as much context as possible, but normally you would only need * $synonym_entity and $synonym_entity_type parameters. Return an empty array * if entity of type $synonym_entity_type cannot be converted into a format * expected by $field. * * @param array $items * Array items that already exist in the field into which new synonyms is to * be added * @param array $field * Field array definition according to Field API of the field into which new * synonym is to be added * @param array $instance * Instance array definition according to Field API of the instance into * which new synonym is to be added * @param object $synonym_entity * Fully loaded entity object which has to be added as synonym * @param string $synonym_entity_type * Entity type of $synonym_entity * * @return array * Array of extra items to be merged into the items that already exist in * field values */ public static function mergeEntityAsSynonym($items, $field, $instance, $synonym_entity, $synonym_entity_type) { $synonym = entity_label($synonym_entity_type, $synonym_entity); switch ($field['type']) { case 'text': break; // We add synonyms for numbers only if $synonym is a number. // We add synonyms for numbers only if $synonym is a number. case 'number_integer': case 'number_float': case 'number_decimal': if (!is_numeric($synonym)) { return array(); } break; } return array(array('value' => $synonym)); }
/** * Implements EntityReferenceHandler::getLabel(). */ public function getLabel($entity) { return entity_label($this->field['settings']['target_type'], $entity); }
/** * Returns label of the entity. * * @return bool|string $label * Entity label. */ public function getLabel() { return entity_label($this->getEntityType(), $this->entity); }
/** * Implements EntityReferenceHandler::getLabel(). */ public function getLabel($entity) { return entity_access('view', 'node', $entity) ? entity_label('node', $entity) : t('- Restricted access -'); }
fwrite($fp, "@prefix owl: <http://www.w3.org/2002/07/owl#> . \n"); fwrite($fp, "@prefix : <http://www.example.com/> . \n"); fwrite($fp, "@prefix xml: <http://www.w3.org/XML/1998/namespace> . \n"); fwrite($fp, "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . \n"); fwrite($fp, "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . \n"); fwrite($fp, "@base <http://www.example.com/2014/3/Ontology1398753433956.owl> . \n"); foreach ($classes as $localname => $label) { fwrite($fp, ":c{$localname} rdf:type owl:Class ; rdfs:label \"{$label}\" . \n"); // fwrite($fp, $id . ", "); //fflush($fp); } foreach ($properties as $localname => $label) { fwrite($fp, ":p{$localname} rdf:type owl:ObjectProperty ; rdfs:label \"{$label}\" . \n"); //fflush($fp); } foreach ($obj_ids as $id) { fwrite($fp, PREFIX . $id . " rdfs:label \"" . entity_label($dbc, $id) . "\". \n"); //fflush($fp); } foreach ($ttl_segments as $ttl_segment) { fwrite($fp, $ttl_segment); } fclose($fp); echo '<div class="container">'; echo '<h1><font face="微软雅黑">中医药子本体抽取工具</font></h1>'; echo '<hr>'; echo '<p><a href = "subontology.owl">下载文件</a></p>'; echo '<p><a href = "subontology.php">返回</a></p>'; echo '</div>'; } include_once "./foot.php";