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