Tripal v1.0 (6.x-1.0)
|
00001 <?php 00002 00029 function tripal_db_views_data() { 00030 $data = array(); 00031 00032 if (module_exists('tripal_views')) { 00033 // Base Tables 00034 $tables = array( 00035 'db', 00036 'dbxref' 00037 ); 00038 foreach ($tables as $tablename) { 00039 $priority = 9; 00040 00041 // check to see if the table is integrated. If it is then integrate it's 00042 // corresponding 'chado_[table]' table. 00043 if (!tripal_views_is_integrated($tablename, $priority)) { 00044 $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE, $priority); 00045 00046 // add specialty handlers 00047 if ($tablename == 'db') { 00048 $table_integration_array['fields']['name']['handlers']['filter']['name'] = 'tripal_views_handler_filter_select_string'; 00049 } 00050 00051 tripal_views_integration_add_entry($table_integration_array); 00052 } 00053 } 00054 00055 // Additional Tables 00056 $tables = array( 00057 'dbxrefprop' 00058 ); 00059 foreach ($tables as $tablename) { 00060 $priority = 9; 00061 if (!tripal_views_is_integrated($tablename, $priority)) { 00062 $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE, $priority); 00063 tripal_views_integration_add_entry($table_integration_array); 00064 } 00065 } 00066 } 00067 00068 return $data; 00069 00070 } 00071 00076 function tripal_db_views_default_views() { 00077 $views = array(); 00078 00079 if (!module_exists('tripal_views')) { 00080 return $views; 00081 } 00082 00083 // Main DB default view 00084 $view = new view; 00085 $view->name = 'db_listing'; 00086 $view->description = 'A listing of all databases.'; 00087 $view->tag = 'chado default'; 00088 $view->base_table = 'db'; 00089 $view->core = 6; 00090 $view->api_version = '2'; 00091 $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ 00092 $handler = $view->new_display('default', 'Defaults', 'default'); 00093 $handler->override_option('fields', array( 00094 'name' => array( 00095 'label' => 'Name', 00096 'alter' => array( 00097 'alter_text' => 0, 00098 'text' => '', 00099 'make_link' => 0, 00100 'path' => '', 00101 'absolute' => 0, 00102 'link_class' => '', 00103 'alt' => '', 00104 'rel' => '', 00105 'prefix' => '', 00106 'suffix' => '', 00107 'target' => '', 00108 'help' => '', 00109 'trim' => 0, 00110 'max_length' => '', 00111 'word_boundary' => 1, 00112 'ellipsis' => 1, 00113 'html' => 0, 00114 'strip_tags' => 0, 00115 ), 00116 'empty' => '', 00117 'hide_empty' => 0, 00118 'empty_zero' => 0, 00119 'hide_alter_empty' => 1, 00120 'type' => 'separator', 00121 'separator' => ', ', 00122 'exclude' => 0, 00123 'id' => 'name', 00124 'table' => 'db', 00125 'field' => 'name', 00126 'relationship' => 'none', 00127 ), 00128 'description' => array( 00129 'label' => 'Description', 00130 'alter' => array( 00131 'alter_text' => 0, 00132 'text' => '', 00133 'make_link' => 0, 00134 'path' => '', 00135 'absolute' => 0, 00136 'link_class' => '', 00137 'alt' => '', 00138 'rel' => '', 00139 'prefix' => '', 00140 'suffix' => '', 00141 'target' => '', 00142 'help' => '', 00143 'trim' => 0, 00144 'max_length' => '', 00145 'word_boundary' => 1, 00146 'ellipsis' => 1, 00147 'html' => 0, 00148 'strip_tags' => 0, 00149 ), 00150 'empty' => '', 00151 'hide_empty' => 0, 00152 'empty_zero' => 0, 00153 'hide_alter_empty' => 1, 00154 'type' => 'separator', 00155 'separator' => ', ', 00156 'exclude' => 0, 00157 'id' => 'description', 00158 'table' => 'db', 00159 'field' => 'description', 00160 'relationship' => 'none', 00161 ), 00162 'url' => array( 00163 'label' => 'Url', 00164 'alter' => array( 00165 'alter_text' => 0, 00166 'text' => '', 00167 'make_link' => 1, 00168 'path' => '[url]', 00169 'absolute' => 1, 00170 'link_class' => '', 00171 'alt' => '', 00172 'rel' => '', 00173 'prefix' => '', 00174 'suffix' => '', 00175 'target' => '_blank', 00176 'help' => '', 00177 'trim' => 0, 00178 'max_length' => '', 00179 'word_boundary' => 1, 00180 'ellipsis' => 1, 00181 'html' => 0, 00182 'strip_tags' => 0, 00183 ), 00184 'empty' => '', 00185 'hide_empty' => 0, 00186 'empty_zero' => 0, 00187 'hide_alter_empty' => 1, 00188 'type' => 'separator', 00189 'separator' => ', ', 00190 'exclude' => 0, 00191 'id' => 'url', 00192 'table' => 'db', 00193 'field' => 'url', 00194 'relationship' => 'none', 00195 ), 00196 'urlprefix' => array( 00197 'label' => 'Urlprefix', 00198 'alter' => array( 00199 'alter_text' => 0, 00200 'text' => '', 00201 'make_link' => 0, 00202 'path' => '', 00203 'absolute' => 0, 00204 'link_class' => '', 00205 'alt' => '', 00206 'rel' => '', 00207 'prefix' => '', 00208 'suffix' => '', 00209 'target' => '', 00210 'help' => '', 00211 'trim' => 0, 00212 'max_length' => '', 00213 'word_boundary' => 1, 00214 'ellipsis' => 1, 00215 'html' => 0, 00216 'strip_tags' => 0, 00217 ), 00218 'empty' => '', 00219 'hide_empty' => 0, 00220 'empty_zero' => 0, 00221 'hide_alter_empty' => 1, 00222 'type' => 'separator', 00223 'separator' => ', ', 00224 'exclude' => 0, 00225 'id' => 'urlprefix', 00226 'table' => 'db', 00227 'field' => 'urlprefix', 00228 'relationship' => 'none', 00229 ), 00230 )); 00231 $handler->override_option('filters', array( 00232 'name' => array( 00233 'operator' => '~', 00234 'value' => '', 00235 'group' => '0', 00236 'exposed' => TRUE, 00237 'expose' => array( 00238 'use_operator' => 0, 00239 'operator' => 'name_op', 00240 'identifier' => 'name', 00241 'label' => 'Name Contains', 00242 'remember' => 0, 00243 ), 00244 'case' => 0, 00245 'id' => 'name', 00246 'table' => 'db', 00247 'field' => 'name', 00248 'relationship' => 'none', 00249 'values_form_type' => 'textfield', 00250 'multiple' => 0, 00251 'optional' => 0, 00252 'agg' => array( 00253 'records_with' => 1, 00254 'aggregates_with' => 0, 00255 ), 00256 ), 00257 'description' => array( 00258 'operator' => '~', 00259 'value' => '', 00260 'group' => '0', 00261 'exposed' => TRUE, 00262 'expose' => array( 00263 'use_operator' => 0, 00264 'operator' => 'description_op', 00265 'identifier' => 'description', 00266 'label' => 'Description Contains', 00267 'remember' => 0, 00268 ), 00269 'case' => 0, 00270 'id' => 'description', 00271 'table' => 'db', 00272 'field' => 'description', 00273 'relationship' => 'none', 00274 'agg' => array( 00275 'records_with' => 1, 00276 'aggregates_with' => 0, 00277 ), 00278 ), 00279 'search_results' => array( 00280 'operator' => '=', 00281 'value' => '', 00282 'group' => '0', 00283 'exposed' => FALSE, 00284 'expose' => array( 00285 'operator' => FALSE, 00286 'label' => '', 00287 ), 00288 'id' => 'search_results', 00289 'table' => 'views', 00290 'field' => 'search_results', 00291 'relationship' => 'none', 00292 'apply_button' => 'Show', 00293 'no_results_text' => 'Click "Show" to see a list of all databases matching the entered criteria. If you leave a any of the criteria blank then the databases will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all databases will be listed.', 00294 ), 00295 )); 00296 $handler->override_option('access', array( 00297 'type' => 'perm', 00298 'perm' => 'access chado_db content', 00299 )); 00300 $handler->override_option('cache', array( 00301 'type' => 'none', 00302 )); 00303 $handler->override_option('title', 'Databases'); 00304 $handler->override_option('header', 'Click "Show" to see a list of all databases matching the entered criteria. If you leave a any of the criteria blank then the databases will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all databases will be listed.'); 00305 $handler->override_option('header_format', '2'); 00306 $handler->override_option('header_empty', 0); 00307 $handler->override_option('empty', 'No databases match the supplied criteria.'); 00308 $handler->override_option('empty_format', '2'); 00309 $handler->override_option('items_per_page', 50); 00310 $handler->override_option('use_pager', '1'); 00311 $handler->override_option('style_plugin', 'table'); 00312 $handler->override_option('style_options', array( 00313 'grouping' => '', 00314 'override' => 1, 00315 'sticky' => 0, 00316 'order' => 'asc', 00317 'summary' => '', 00318 'columns' => array( 00319 'name' => 'name', 00320 'url' => 'url', 00321 'urlprefix' => 'urlprefix', 00322 'description' => 'description', 00323 ), 00324 'info' => array( 00325 'name' => array( 00326 'sortable' => 1, 00327 'separator' => '', 00328 ), 00329 'url' => array( 00330 'sortable' => 1, 00331 'separator' => '', 00332 ), 00333 'urlprefix' => array( 00334 'sortable' => 0, 00335 'separator' => '', 00336 ), 00337 'description' => array( 00338 'sortable' => 0, 00339 'separator' => '', 00340 ), 00341 ), 00342 'default' => 'name', 00343 )); 00344 $handler = $view->new_display('page', 'Page', 'page_1'); 00345 $handler->override_option('path', 'admin/tripal/tripal_db/list_dbs'); 00346 $handler->override_option('menu', array( 00347 'type' => 'normal', 00348 'title' => 'DB Listing', 00349 'description' => 'Lists all databases available to create database references for.', 00350 'weight' => '10', 00351 'name' => 'navigation', 00352 )); 00353 $handler->override_option('tab_options', array( 00354 'type' => 'none', 00355 'title' => '', 00356 'description' => '', 00357 'weight' => 0, 00358 'name' => 'navigation', 00359 )); 00360 $views[$view->name] = $view; 00361 00362 // Main dbxref default view 00363 $view = new view; 00364 $view->name = 'dbxref_listing'; 00365 $view->description = 'A listing of all database references filtered by database'; 00366 $view->tag = 'chado default'; 00367 $view->base_table = 'dbxref'; 00368 $view->core = 0; 00369 $view->api_version = '2'; 00370 $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ 00371 $handler = $view->new_display('default', 'Defaults', 'default'); 00372 $handler->override_option('fields', array( 00373 'name' => array( 00374 'label' => 'Database', 00375 'alter' => array( 00376 'alter_text' => 0, 00377 'text' => '', 00378 'make_link' => 0, 00379 'path' => '', 00380 'link_class' => '', 00381 'alt' => '', 00382 'prefix' => '', 00383 'suffix' => '', 00384 'target' => '', 00385 'help' => '', 00386 'trim' => 0, 00387 'max_length' => '', 00388 'word_boundary' => 1, 00389 'ellipsis' => 1, 00390 'html' => 0, 00391 'strip_tags' => 0, 00392 ), 00393 'empty' => '', 00394 'hide_empty' => 0, 00395 'empty_zero' => 0, 00396 'exclude' => 0, 00397 'id' => 'name', 00398 'table' => 'db', 00399 'field' => 'name', 00400 'relationship' => 'none', 00401 ), 00402 'accession' => array( 00403 'label' => 'Accession', 00404 'alter' => array( 00405 'alter_text' => 0, 00406 'text' => '', 00407 'make_link' => 0, 00408 'path' => '', 00409 'link_class' => '', 00410 'alt' => '', 00411 'prefix' => '', 00412 'suffix' => '', 00413 'target' => '', 00414 'help' => '', 00415 'trim' => 0, 00416 'max_length' => '', 00417 'word_boundary' => 1, 00418 'ellipsis' => 1, 00419 'html' => 0, 00420 'strip_tags' => 0, 00421 ), 00422 'empty' => '', 00423 'hide_empty' => 0, 00424 'empty_zero' => 0, 00425 'exclude' => 0, 00426 'id' => 'accession', 00427 'table' => 'dbxref', 00428 'field' => 'accession', 00429 'relationship' => 'none', 00430 ), 00431 'description' => array( 00432 'label' => 'Description', 00433 'alter' => array( 00434 'alter_text' => 0, 00435 'text' => '', 00436 'make_link' => 0, 00437 'path' => '', 00438 'link_class' => '', 00439 'alt' => '', 00440 'prefix' => '', 00441 'suffix' => '', 00442 'target' => '', 00443 'help' => '', 00444 'trim' => 0, 00445 'max_length' => '', 00446 'word_boundary' => 1, 00447 'ellipsis' => 1, 00448 'html' => 0, 00449 'strip_tags' => 0, 00450 ), 00451 'empty' => '', 00452 'hide_empty' => 0, 00453 'empty_zero' => 0, 00454 'exclude' => 0, 00455 'id' => 'description', 00456 'table' => 'dbxref', 00457 'field' => 'description', 00458 'relationship' => 'none', 00459 ), 00460 'version' => array( 00461 'label' => 'Version', 00462 'alter' => array( 00463 'alter_text' => 0, 00464 'text' => '', 00465 'make_link' => 0, 00466 'path' => '', 00467 'link_class' => '', 00468 'alt' => '', 00469 'prefix' => '', 00470 'suffix' => '', 00471 'target' => '', 00472 'help' => '', 00473 'trim' => 0, 00474 'max_length' => '', 00475 'word_boundary' => 1, 00476 'ellipsis' => 1, 00477 'html' => 0, 00478 'strip_tags' => 0, 00479 ), 00480 'empty' => '', 00481 'hide_empty' => 0, 00482 'empty_zero' => 0, 00483 'exclude' => 0, 00484 'id' => 'version', 00485 'table' => 'dbxref', 00486 'field' => 'version', 00487 'relationship' => 'none', 00488 ), 00489 'urlprefix' => array( 00490 'label' => 'External Link', 00491 'alter' => array( 00492 'alter_text' => 1, 00493 'text' => '[name]:[accession]', 00494 'make_link' => 1, 00495 'path' => '[urlprefix][accession]', 00496 'absolute' => 1, 00497 'link_class' => '', 00498 'alt' => '', 00499 'rel' => '', 00500 'prefix' => '', 00501 'suffix' => '', 00502 'target' => '_blank', 00503 'help' => '', 00504 'trim' => 0, 00505 'max_length' => '', 00506 'word_boundary' => 1, 00507 'ellipsis' => 1, 00508 'html' => 0, 00509 'strip_tags' => 0, 00510 ), 00511 'empty' => '', 00512 'hide_empty' => 1, 00513 'empty_zero' => 0, 00514 'hide_alter_empty' => 1, 00515 'type' => 'separator', 00516 'separator' => ', ', 00517 'exclude' => 0, 00518 'id' => 'urlprefix', 00519 'table' => 'db', 00520 'field' => 'urlprefix', 00521 'relationship' => 'none', 00522 ), 00523 )); 00524 $handler->override_option('sorts', array( 00525 'name' => array( 00526 'order' => 'ASC', 00527 'id' => 'name', 00528 'table' => 'db', 00529 'field' => 'name', 00530 'relationship' => 'none', 00531 ), 00532 'accession' => array( 00533 'order' => 'ASC', 00534 'id' => 'accession', 00535 'table' => 'dbxref', 00536 'field' => 'accession', 00537 'relationship' => 'none', 00538 ), 00539 )); 00540 $handler->override_option('filters', array( 00541 'name' => array( 00542 'operator' => '=', 00543 'value' => array(), 00544 'group' => '0', 00545 'exposed' => TRUE, 00546 'expose' => array( 00547 'use_operator' => 0, 00548 'operator' => 'name_op', 00549 'identifier' => 'db', 00550 'label' => 'Database', 00551 'remember' => 0, 00552 ), 00553 'case' => 1, 00554 'id' => 'name', 00555 'table' => 'db', 00556 'field' => 'name', 00557 'relationship' => 'none', 00558 'values_form_type' => 'select', 00559 'multiple' => 1, 00560 'optional' => 0, 00561 'agg' => array( 00562 'records_with' => 1, 00563 'aggregates_with' => 1, 00564 ), 00565 ), 00566 'accession' => array( 00567 'operator' => '~', 00568 'value' => '', 00569 'group' => '0', 00570 'exposed' => TRUE, 00571 'expose' => array( 00572 'use_operator' => 0, 00573 'operator' => 'accession_op', 00574 'identifier' => 'accession', 00575 'label' => 'Accession Contains', 00576 'remember' => 0, 00577 ), 00578 'case' => 0, 00579 'id' => 'accession', 00580 'table' => 'dbxref', 00581 'field' => 'accession', 00582 'relationship' => 'none', 00583 'agg' => array( 00584 'records_with' => 1, 00585 'aggregates_with' => 1, 00586 ), 00587 ), 00588 'search_results' => array( 00589 'operator' => '=', 00590 'value' => '', 00591 'group' => '0', 00592 'exposed' => FALSE, 00593 'expose' => array( 00594 'operator' => FALSE, 00595 'label' => '', 00596 ), 00597 'id' => 'search_results', 00598 'table' => 'views', 00599 'field' => 'search_results', 00600 'relationship' => 'none', 00601 'apply_button' => 'Show', 00602 'no_results_text' => 'Click "Show" to see a list of all database references matching the entered criteria. If you leave a any of the criteria blank then the database references will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all database references will be listed.', 00603 ), 00604 )); 00605 $handler->override_option('access', array( 00606 'type' => 'perm', 00607 'perm' => 'access chado_db content', 00608 )); 00609 $handler->override_option('cache', array( 00610 'type' => 'none', 00611 )); 00612 $handler->override_option('title', 'Database References'); 00613 $handler->override_option('header', 'Click "Show" to see a list of all database references matching the entered criteria. If you leave a any of the criteria blank then the database references will be not be filtered based on that field. Furthermore, if you leave all criteria blank then all database references will be listed.'); 00614 $handler->override_option('header_format', '2'); 00615 $handler->override_option('header_empty', 0); 00616 $handler->override_option('empty', 'There are no database references matching the above criteria. Please select a database in order to display all references to that database.'); 00617 $handler->override_option('empty_format', '1'); 00618 $handler->override_option('items_per_page', 50); 00619 $handler->override_option('use_pager', '1'); 00620 $handler->override_option('style_plugin', 'table'); 00621 $handler->override_option('style_options', array( 00622 'grouping' => '', 00623 'override' => 1, 00624 'sticky' => 0, 00625 'order' => 'asc', 00626 'columns' => array( 00627 'name' => 'name', 00628 'accession' => 'accession', 00629 'description' => 'description', 00630 'version' => 'version', 00631 ), 00632 'info' => array( 00633 'name' => array( 00634 'sortable' => 1, 00635 'separator' => '', 00636 ), 00637 'accession' => array( 00638 'sortable' => 1, 00639 'separator' => '', 00640 ), 00641 'description' => array( 00642 'sortable' => 1, 00643 'separator' => '', 00644 ), 00645 'version' => array( 00646 'sortable' => 1, 00647 'separator' => '', 00648 ), 00649 ), 00650 'default' => '-1', 00651 )); 00652 $handler = $view->new_display('page', 'Page', 'page_1'); 00653 $handler->override_option('path', 'admin/tripal/tripal_db/list_dbxrefs'); 00654 $handler->override_option('menu', array( 00655 'type' => 'normal', 00656 'title' => 'DB Reference Listing', 00657 'description' => 'A listing of all database references associated with a given database', 00658 'weight' => '10', 00659 'name' => 'navigation', 00660 )); 00661 $handler->override_option('tab_options', array( 00662 'type' => 'none', 00663 'title' => '', 00664 'description' => '', 00665 'weight' => 0, 00666 'name' => 'navigation', 00667 )); 00668 $views[$view->name] = $view; 00669 00670 return $views; 00671 }