tripal_project_teaser.tpl.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. $node = $variables['node'];
  3. $project = $variables['node']->project;
  4. // get the project description. The first iteration of the project
  5. // module incorrectly stored the project description in the Drupal
  6. // node->body field. Also, the project.descriptin field is only 255
  7. // characters which is not large neough. Therefore, we store the description
  8. // in the chado.projectprop table. For backwards compatibility, we
  9. // will check if the node->body is empty and if not we'll use that instead.
  10. // If there is data in the project.description field then we will use that, but
  11. // if there is data in the projectprop table for a descrtion then that takes
  12. // precedence
  13. $description = '';
  14. if (property_exists($node, 'body')) {
  15. $description = $node->body;
  16. }
  17. if (property_exists($node, 'description')) {
  18. $description = $project->description;
  19. }
  20. else {
  21. $projectprop = chado_get_property('property', $project->project_id, 'Project Description', 'project_property');
  22. $description = $projectprop->value;
  23. } ?>
  24. <div class="tripal_project-teaser tripal-teaser">
  25. <div class="tripal-project-teaser-title tripal-teaser-title"><?php
  26. print l($node->title, "node/$node->nid", array('html' => TRUE));?>
  27. </div>
  28. <div class="tripal-project-teaser-text tripal-teaser-text"><?php
  29. print substr($description, 0, 650);
  30. if (strlen($description) > 650) {
  31. print "... " . l("[more]", "node/$node->nid");
  32. } ?>
  33. </div>
  34. </div>