function render_symptom($dbc, $db_name, $id) { echo '<p>症状:</p>'; $diseases = array(); $values = array_merge(get_values($dbc, PREFIX . $id, "症状加(调整)"), get_values($dbc, PREFIX . $id, "症状减(调整)")); foreach ($values as $value) { if (array_key_exists($value, $diseases)) { $diseases[$value] = $diseases[$value] + 1; } else { $diseases[$value] = 1; } } arsort($diseases); //$diseases = array_slice(array_keys($diseases), 0, 5); $diseases = array_keys($diseases); echo '<ul>'; foreach ($diseases as $value) { //echo '<li class="list-group-item">'; echo '<li>'; echo render_value($dbc, $db_name, $value, true); echo ' <a class="btn btn-xs btn-primary" href="qa.php?db_name=' . $db_name . '&keywords=' . get_entity_name($dbc, $value) . '&question_type=症状" ><span class="glyphicon glyphicon-search"></span></a>'; echo '<p/></li>'; } echo '</ul>'; }
function echo_spectrum($operation, $path, $note, $hint = '') { $io = get_io_by_name($operation['id'], $path, $note); $allSame = true; echo render_value($io[0], null, $allSame, $hint); echo "<br/>"; }
function get_herb_plus($dbc, $db_name, $value) { $herb_links = array(); $herbs = array_merge(get_values($dbc, $value, '中药加(调整)')); foreach ($herbs as $herb) { $herb_links[] = render_value($dbc, $db_name, $herb, false); } $herb_title = ''; if (count($herb_links) != 0) { $herb_title = '加' . implode(', ', $herb_links); } return $herb_title; }
function render($dbc, $db_name, $name, $property) { $query = "select * from graph where subject ='{$name}' and property='{$property}'"; $result = mysqli_query($dbc, $query) or die('Error querying database2.'); if (mysqli_num_rows($result) != 0) { echo '<p><a href="#">[' . $property . ']</a> '; while ($row = mysqli_fetch_array($result)) { //$property = $row[property]; $value = $row[value]; echo render_value($dbc, $db_name, $value, false); } echo "</p>"; } }
function hypo_render_treatment($dbc, $db_name, $id) { $query = "SELECT subject, count(*) as count FROM hypo where value = '" . PREFIX . "{$id}' and property = '治疗' group by subject order by count desc"; $result = mysqli_query($dbc, $query) or die('Error querying database2.'); $values = array(); while ($row = mysqli_fetch_array($result)) { $values[$row[0]] = $row[1]; } //arsort($values); $values = array_slice(array_keys($values), 0, 5); foreach ($values as $value) { echo '<li>'; echo render_value($dbc, $db_name, $value, true); $url = 'hypo.php?db_name=' . $db_name . '&subject=' . $value . '&predicate=' . '治疗' . '&object=' . PREFIX . $id; echo ' <a class="btn btn-primary btn-xs" href="' . $url . '">推理依据</a>'; echo '<p/></li>'; } }
function get_instance_summary($dbc, $db_name, $row) { $ids = explode('|', $row['instances']); $i = 0; $arr = array(); while ($i < min(array(10, count($ids)))) { $q1 = "select * from graph where id = '{$ids[$i]}'"; $r1 = mysqli_query($dbc, $q1) or die('Error querying database2.'); if ($row1 = mysqli_fetch_array($r1)) { $s = '(' . render_value($dbc, $db_name, $row1['subject'], false) . ' '; $s .= $row1['property'] . ' '; $s .= render_value($dbc, $db_name, $row1['value'], false) . ')'; $arr[] = $s; } $i = $i + 1; } return implode(', ', $arr) . '<br><a class="btn btn-link" target="blank" href="sn_triple_type.php?db_name=' . $db_name . '&type=' . $row['id'] . '">更多>></a>'; }
function render_treatment($dbc, $db_name, $id) { echo '<p>系统为您推荐如下的方剂:</p>'; $formulas = array(); $values = array_merge(get_subjects($dbc, PREFIX . $id, "治疗"), get_values($dbc, PREFIX . $id, "被...治疗")); foreach ($values as $value) { if (array_key_exists($value, $formulas)) { $formulas[$value] = $formulas[$value] + 1; } else { $formulas[$value] = 1; } } arsort($formulas); //$formulas = array_slice(array_keys($formulas), 0, 5); $formulas = array_keys($formulas); echo '<ol>'; foreach ($formulas as $value) { //echo '<li class="list-group-item">'; echo '<li>'; echo render_value($dbc, $db_name, $value, true); echo '<p/></li>'; } echo '</ol>'; }
?> <functionRelation xlink:href="<?php echo url_for(array($item, 'module' => 'function'), true); ?> " xlink:type="simple"> <relationEntry><?php echo render_title($item->subject); ?> </relationEntry> <?php echo sfEacPlugin::renderDates($item); if (0 < count($date = $item->getNotesByType(array('noteTypeId' => QubitTerm::RELATION_NOTE_DATE_ID)))) { ?> <descriptiveNote> <?php echo render_value('<p>' . $date[0]) . '</p>'; ?> </descriptiveNote> <?php } ?> </functionRelation> <?php } ?> </relations> </cpfDescription> </eac-cpf>
<?php echo render_show(__('Maintenance notes'), render_value($isdiah->maintenanceNotes)); ?> <?php echo render_show(__('Priority'), render_value($isdiah->priorities[$isdiah->ehriPriority])); ?> <div class="field"> <h3><?php echo __('Copyright Issue'); ?> </h3> <div> <?php echo render_value($isdiah->ehriCopyrightIssue ? "Yes" : "No"); ?> </div> </div> </div> <?php if (QubitAcl::check($resource, array('update', 'delete', 'create'))) { ?> <div class="actions section"> <h2 class="element-invisible"><?php echo __('Actions'); ?> </h2>
<div class="page"> <h1><?php echo render_title($resource->getTitle(array('cultureFallback' => true))); ?> </h1> <div> <?php echo render_value($resource->getContent(array('cultureFallback' => true))); ?> </div> <?php if (SecurityCheck::hasPermission($sf_user, array('module' => 'staticpage', 'action' => 'update'))) { ?> <div class="actions section"> <h2 class="element-invisible"><?php echo __('Actions'); ?> </h2> <div class="content"> <ul class="links"> <li><?php echo link_to(__('Edit'), array($resource, 'module' => 'staticpage', 'action' => 'edit'), array('title' => __('Edit this page'))); ?> </li> </ul> </div>
?> <?php echo render_show_repository(__('Relation (isLocatedAt)'), $resource); ?> <?php foreach ($dc->coverage as $item) { ?> <?php echo render_show(__('Coverage (spatial)'), link_to(render_title($item), array($item, 'module' => 'term', 'action' => 'browseTerm'))); } ?> <?php echo render_show(__('Rights'), render_value($resource->getAccessConditions(array('cultureFallback' => true)))); ?> <div class="section" id="rightsArea"> <?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h2>' . __('Rights area') . '</h2>', array($resource, 'module' => 'informationobject', 'action' => 'edit'), array('anchor' => 'rightsArea', 'title' => __('Edit rights area'))); ?> <?php echo get_component('right', 'relatedRights', array('resource' => $resource)); ?> </div> <!-- /.section#rightsArea --> <?php
</li> <?php } ?> </ul> </div> </div> <?php } ?> <?php if ($doc->levelOfDescription) { ?> <?php echo render_show(__('Level of description'), render_value($doc->levelOfDescription)); ?> <?php } ?> <?php if (sfConfig::get('app_multi_repository') && null != $doc->repositoryId) { ?> <?php echo render_show(__('Repository'), link_to($doc->repositoryName, array('slug' => $doc->repositorySlug, 'module' => 'repository'))); ?> <?php } ?>
</td><td> <?php if ($item->getCollectionRoot()->id != $item->id) { ?> <?php echo render_title($item->getCollectionRoot()); ?> <?php } ?> </td><td> <?php if (null != ($accessConditions = $item->getAccessConditions(array('cultureFallback' => true)))) { ?> <?php echo render_value($accessConditions); ?> <?php } else { ?> <?php echo _('None'); ?> <?php } ?> </td> </tr> <?php } ?>
echo $date->getType(array('cultureFallback' => true)); ?> ) <?php if (isset($date->actor)) { ?> <?php echo link_to(render_title($date->actor), array($date->actor, 'module' => 'actor')); ?> <?php } ?> </li> <?php } ?> </ul> </td><td> <?php echo render_value($item->getAccessConditions(array('cultureFallback' => true))); ?> </td> </tr> <?php } ?> </tbody> </table> <?php echo get_partial('default/pager', array('pager' => $pager));
<?php foreach ($resource->scriptOfDescription as $code) { ?> <li><?php echo format_script($code); ?> </li> <?php } ?> </ul> </div> </div> <?php echo render_show(__('Sources'), render_value($resource->getSources(array('cultureFallback' => true)))); ?> </div> <!-- /.section --> <div class="section" id="rightsArea"> <?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h2>' . __('Rights area') . '</h2>', array($resource, 'module' => 'informationobject', 'action' => 'edit'), array('anchor' => 'rightsArea', 'title' => __('Edit rights area'))); ?> <?php echo get_component('right', 'relatedRights', array('resource' => $resource)); ?> </div> <!-- /.section#rightsArea -->
?> <?php echo render_show(__('Received extent units'), render_value($resource->getReceivedExtentUnits(array('cultureFallback' => true)))); ?> <?php echo render_show(__('Processing status'), render_value($resource->processingStatus)); ?> <?php echo render_show(__('Processing priority'), render_value($resource->processingPriority)); ?> <?php echo render_show(__('Processing notes'), render_value($resource->getProcessingNotes(array('cultureFallback' => true)))); ?> </div> <!-- /.section#administrativeArea --> <div class="section" id="rightsArea"> <?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h2>' . __('Rights area') . '</h2>', array($resource, 'module' => 'accession', 'action' => 'edit'), array('anchor' => 'rightsArea', 'title' => __('Edit rights area'))); ?> <?php echo get_component('right', 'relatedRights', array('resource' => $resource)); ?> </div> <!-- /.section#rightsArea -->
</ul> </div> </div> <div class="field"> <h3><?php echo __('Display note(s)'); ?> </h3> <div> <ul> <?php foreach ($resource->getNotesByType(array('noteTypeId' => QubitTerm::DISPLAY_NOTE_ID)) as $item) { ?> <li><?php echo render_value($item->getContent(array('cultureFallback' => true))); ?> </li> <?php } ?> </ul> </div> </div> <div class="field"> <h3><?php echo __('Hierarchical terms'); ?> </h3> <div>
function vis_structure($io, $prev_value, &$allSame) { $id = $io['id']; $value = $io['value']; $ios = get_child_ios($id); $result = ''; if (count($ios) == 0) { $result = vis_value($value, $prev_value, $allSame); } else { $childrenSame = true; $result2 = ''; $result2 .= '<table class="table table-condensed">'; $dttoMode = false; $dttoNames = ''; foreach ($ios as $cio) { $childSame = true; $object = get_object($cio['object_id']); $result3 = '<tr><td>'; $result3 .= get_object_link($object, $cio['name'], $cio['operation_id']); $result3 .= '</td><td>'; $result3 .= render_value($cio, $object, $childSame); $result3 .= '</td></tr>'; $childrenSame = $childrenSame && $childSame; if (!$childSame) { if ($dttoMode) { $result2 .= "<tr><td title=\"These members are unchanged: {$dttoNames}\">⋮</td><td></td></tr>"; $dttoMode = false; $dttoNames = ''; } $result2 .= $result3; } else { $dttoMode = true; $dttoNames .= " " . htmlentities($cio['name']); } } $result2 .= '</table>'; if ($childrenSame) { $result = dtto(); } else { $allSame = false; $result = $result2; } } return $result; }
} echo '</p>'; echo '<hr>'; echo '<p> 系统为您推荐如下的证候:</p>'; $formulas = array(); foreach ($ids as $id) { $values = array_merge(get_subjects($dbc, PREFIX . $id, "由...组成"), get_values($dbc, PREFIX . $id, "组成")); foreach ($values as $value) { if (array_key_exists($value, $formulas)) { $formulas[$value] = $formulas[$value] + 1; } else { $formulas[$value] = 1; } } } arsort($formulas); //print_r($syndromes); $formulas = array_slice(array_keys($formulas), 0, 5); //echo '<ul class="list-group">'; echo '<ol >'; foreach ($formulas as $value) { //echo '<li class="list-group-item">'; echo '<li>'; echo render_value($dbc, $db_name, $value, true); echo ' <a class="btn btn-xs btn-primary" href="qa.php?db_name=' . $db_name . '&keywords=' . get_entity_name($dbc, $value) . '&question_type=证候" ><span class="glyphicon glyphicon-search"></span></a>'; echo '<p/></li>'; } echo '</ol>'; } else { render_warning('对不起!我们的知识库中尚无与"' . $keywords . '"相关的知识!'); }
<div> <?php if (isset($active_class)) { //echo '<h2>' . $active_class . '</h2>'; //echo '<div class="well">'; echo '<ul class="nav well nav-pills">'; $query = "select subject from graph where property = '" . ENTITY_TYPE . "' and value = '{$active_class}' order by subject asc"; /* if (isset($_GET['limit'])){ $query .= ' limit ' . $_GET['limit']; } */ $result = mysqli_query($dbc, $query) or die('Error querying database2.'); $n = 0; while ($row = mysqli_fetch_array($result)) { echo '<li>' . render_value($dbc, $db_name, $row[subject], false) . "</li>"; $n = $n + 1; } /* if (isset($_GET['limit'])&&($n == $_GET['limit'])) echo '更多>>'; */ echo '</ul>'; } else { render_warning('<<请在右侧选择类型以查看其实例'); } ?> </div> </div>
?> <li><?php echo $error; ?> </li> <?php } ?> </ul> </div> <?php } ?> <?php echo render_show(__('Authorized form of name'), render_value($resource->getAuthorizedFormOfName(array('cultureFallback' => true)))); ?> <div class="section" id="contactArea"> <h2><?php echo __('Contact area'); ?> </h2> <?php foreach ($resource->contactInformations as $contactItem) { ?> <?php echo get_partial('contactinformation/contactInformation', array('contactInformation' => $contactItem)); ?>
?> </h3> <div class="email"> <?php echo render_value($contactInformation->email); ?> </div> </div> <div class="field"> <h3><?php echo __('URL'); ?> </h3> <div class="url"> <?php echo render_value($contactInformation->website); ?> </div> </div> <div class="note"> <?php echo render_value($contactInformation->getNote(array('cultureFallback' => true))); ?> </div> </div> </div>
echo format_script($code); ?> </li> <?php } ?> </ul> </div> </div> <?php echo render_show(__('Sources'), render_value($resource->getSources(array('cultureFallback' => true)))); ?> <?php echo render_show(__('Maintenance notes'), render_value($isaar->maintenanceNotes)); ?> </div> <?php if (QubitAcl::check($resource, 'create') || QubitAcl::check($resource, 'delete') || QubitAcl::check($resource, 'update')) { ?> <div class="actions section"> <h2 class="element-invisible"><?php echo __('Actions'); ?> </h2> <div class="content">
<div class="section" id="ehriMetadata"> <?php echo link_to_if(SecurityPriviliges::editCredentials($sf_user, 'informationObject'), '<h2>' . __('EHRI Metadata') . '</h2>', array($resource, 'module' => 'informationobject', 'action' => 'edit'), array('anchor' => 'ehriMetadata', 'title' => __('Edit EHRI Metadata'))); ?> <?php echo render_show(__('Scope'), render_value($isad->ehriScope)); ?> <?php echo render_show(__('Priority'), render_value($isad->priorities[$isad->ehriPriority])); ?> <?php echo render_show(__('Copyright Issue'), render_value($isad->ehriCopyrightIssue ? "Yes" : "No")); ?> </div> <!-- /.section#ehriMetadata --> <div class="section" id="rightsArea"> <?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h2>' . __('Rights area') . '</h2>', array($resource, 'module' => 'informationobject', 'action' => 'edit'), array('anchor' => 'rightsArea', 'title' => __('Edit rights area'))); ?> <?php echo get_component('right', 'relatedRights', array('resource' => $resource)); ?>
function render_io($r, &$allSame, $reference = 'object', $variable_name = '') { $result = ''; # Arrow for read/write/view switch ($r['readwrite']) { case 1: $result .= '<td><i title="read" class="icon-arrow-left"></i></td> '; break; case 2: $result .= '<td><i title="write" class="icon-arrow-right"></i></td> '; break; case 3: $result .= '<td><i title="value" class="icon-eye-open"></i></td> '; break; } // If we want to link to object, use the note for the operation to link to it $object = get_object($r['object_id']); $result .= '<td>'; if ($reference == 'object') { $result .= get_object_link($object, $r['note'], $r['operation_id'], $r['name']); $result .= '</td><td>'; } else { $result .= $r['note']; $result .= '</td><td>'; $result .= get_operation_link(get_operation($r['operation_id']), $r['object_id']); } $result .= '</td><td>'; $allSame = true; $result .= render_value($r, $object, $allSame); $result .= '</td><td>'; $result .= render_code_link($r['code_id'], $r['name']); $result .= '</td>'; return $result; }
function render_panel($dbc, $db_name, $property, $values) { echo '<div class="panel panel-info">'; echo '<div class="panel-heading">'; echo '<h3 class="panel-title">' . $property . '</h3>'; echo '</div>'; echo '<ul class="list-group">'; foreach ($values as $value) { echo '<li class="list-group-item">'; echo render_value($dbc, $db_name, $value, true); echo '</li>'; } echo '</ul>'; echo '</div>'; }
function render_triples_helper($dbc, $db_name, $subject, $object, $query) { $result = mysqli_query($dbc, $query) or die('Error querying database:' . $query); $row_num = 1; $color = true; while ($row = mysqli_fetch_array($result)) { if ($color) { echo '<tr>'; } else { echo '<tr class="info">'; } $color = !$color; $no = $skip + $row_num++; //echo '<td width = "3%">' . $no . '</td>'; echo '<td>' . render_value($dbc, $db_name, $row['subject'], false) . '</td>'; echo '<td>' . $row['property'] . '</td>'; echo '<td>' . render_value($dbc, $db_name, $row['value'], false) . '</td>'; echo '</tr>'; } }
$names = array('英文正名', '英文异名', '中文异名', '中文正名', '异名', '汉语拼音', '英文名', '别名'); $type_labels = array('类型'); /* foreach ($names as $name_property) { $s .= render_info_by_property($dbc, $db_name, PREFIX . $entity_id, $name_property, false); } if ($s != '') echo "<tr><td width='30%'>相关术语:</td><td>$s</td></tr>"; */ $s = array(); foreach ($names as $name_property) { $full_id = PREFIX . $entity_id; $query = "select * from graph where subject ='{$full_id}' and property = '{$name_property}'"; $result = mysqli_query($dbc, $query) or die('Error querying database2.'); while ($row = mysqli_fetch_array($result)) { $value = $row[value]; $s[] = render_value($dbc, $db_name, $value, false); } } if (count($s) != 0) { echo "<tr><td width='30%'>相关术语:</td><td>"; echo implode(', ', $s); echo "</td></tr>"; } $values = get_links($dbc, $db_name, PREFIX . $entity_id); $values = array_slice($values, 0, 4); foreach ($values as $property => $value) { echo "<tr><td width='30%'>" . $property . ":</td><td>"; echo $value; echo "</td></tr>"; } $filter = array_merge($type_labels, $names);
$query = build_query($dbc, $keywords, $active_relation) . " LIMIT {$skip}, {$results_per_page}"; //$query = build_query($keywords) . ' LIMIT 0,100'; $data = mysqli_query($dbc, $query); $row_num = 1; $color = true; while ($row = mysqli_fetch_array($data)) { if ($color) { echo '<tr>'; } else { echo '<tr class="info">'; } $color = !$color; echo '<td width = "3%">' . $row_num++ . '</td>'; echo '<td width = "40%">' . render_value($dbc, $db_name, $row['subject'], true) . '</td>'; echo '<td width = "15%">' . $row['property'] . '</td>'; echo '<td width = "40%">' . render_value($dbc, $db_name, $row['value'], true) . '</td>'; //echo '<td width = "12%">'; //echo '<a class="btn btn-primary btn-xs" href="relation.php?id=' . $row['id'] . '"><span class="glyphicon glyphicon-search"></span> 查看</a>'; //echo '  //echo '</td>'; echo '</tr>'; } ?> </tbody> </table> <?php if ($num_pages > 1) { $page_links = ''; echo '<ul class="pagination">'; echo '<li><a href="' . $_SERVER['PHP_SELF'] . '?db_name=spleen&' . 'active_relation=' . $active_relation . '&keywords=' . $keywords . '&page=' . 1 . '">首页</a></li>'; // If this page is not the first page, generate the "previous" link
function render_related($dbc, $db_name, $keywords) { $query = "SELECT * FROM def where name = '{$keywords}'"; $result = mysqli_query($dbc, $query) or die('Error querying database.'); if ($row = mysqli_fetch_array($result)) { $id = $row[id]; $name = PREFIX . $id; $query = "select * from graph where subject ='{$name}' and value like '" . PREFIX . "%' limit 20"; $result = mysqli_query($dbc, $query) or die('Error querying database2.'); if (mysqli_num_rows($result) != 0) { echo '<p><font color="red">' . $keywords . '</font>的相关搜索:</p>'; while ($row = mysqli_fetch_array($result)) { $value = $row[value]; echo '<p>' . render_value($dbc, $db_name, $value, false) . '</p>'; } } } }