/userfiles/templates/sob/sidebar_gallery.php

https://github.com/geekbuntu/Microweber · PHP · 87 lines · 81 code · 5 blank · 1 comment · 8 complexity · 7c76d90377727983364f214ff89fe4c6 MD5 · raw file

  1. <?php dbg(__FILE__); ?>
  2. <div class="sidebar">
  3. <?php if(!$post): ?>
  4. <?php $who = $this->core_model->getParamFromURL ( 'username' ); $who = $this->users_model->getIdByUsername($who); ?>
  5. <?php $who = $this->users_model->getUserById($who); ?>
  6. <?php else: ?>
  7. <?php $who = $this->users_model->getUserById( $post ['created_by']); ?>
  8. <?php endif; ?>
  9. <?php if(empty($active_categories)){
  10. $active_categories = $this->taxonomy_model->getMasterCategories(false);
  11. $active_categories = $this->core_model->dbExtractIdsFromArray($active_categories);
  12. }
  13. $related = array();
  14. if($use_master_categories_for_products == false){
  15. $related['selected_categories'] = $active_categories;
  16. }
  17. $related ['content_type'] = 'post';
  18. $related ['content_subtype'] = 'gallery';
  19. // $related ['is_special'] = 'y';
  20. if(!empty($who)){
  21. $related ['created_by'] = $who['id'];
  22. }
  23. $limit[0] = 0;
  24. $limit[1] = 5;
  25. $related = $this->content_model->getContentAndCache($related, false,$limit, $count_only = false, $short = true, $only_fields = array ('id', 'content_type', 'content_url', 'content_title', 'content_description', 'content_body', 'created_by', 'is_special' ) );
  26. @shuffle($related);
  27. @array_slice($related , 0 , 5);
  28. ?>
  29. <?php if(!empty($related)): ?>
  30. <?php if(!empty($who)): ?>
  31. <h2 class="title" style="padding: 10px 0 0 0"><?php print $this->users_model->getPrintableName ( $who['id'], 'full' ); ?>'s galleries</h2>
  32. <?php else: ?>
  33. <h2 class="title" style="padding: 10px 0 0 0">Galleries from The School</h2>
  34. <?php endif; ?>
  35. <ul class="profile-products profile-products-border" style="padding-top: 0">
  36. <?php foreach($related as $the_post): ?>
  37. <?php $author = $this->users_model->getUserById($the_post['created_by']); ?>
  38. <?php $thumb = $this->content_model->contentGetThumbnailForContentId( $the_post['id'], 89, 89); ?>
  39. <li>
  40. <a class="img" href="<?php print $this->content_model->contentGetHrefForPostId($the_post['id']) ; ?>">
  41. <img src="<?php print $thumb ?>" alt="" />
  42. </a>
  43. <div class="sidebar-list-side">
  44. <h3><a href="<?php print $this->content_model->contentGetHrefForPostId($the_post['id']) ; ?>"><?php print (character_limiter($the_post['content_title'], 30, '...')); ?>
  45. </a></h3>
  46. <p>
  47. <?php if($the_post['content_description'] != ''): ?>
  48. <?php print (character_limiter($the_post['content_description'], 50, '...')); ?>
  49. <?php else: ?>
  50. <?php print character_limiter($the_post['content_body_nohtml'], 50, '...'); ?>
  51. <?php endif; ?>
  52. </p>
  53. <a href="<?php print $this->content_model->contentGetHrefForPostId($the_post['id']) ; ?>" class="more">see photos</a></div></li>
  54. <?php endforeach; ?>
  55. </ul>
  56. <?php if(empty($who)): ?>
  57. <a href="<?php print site_url('browse/type:gallery'); ?>" class="btn right hmarg">See All Galleries</a>
  58. <?php else: ?>
  59. <a href="<?php print site_url('userbase/action:gallery/username:'.$who['username']); ?>" class="btn right hmarg"><?php print $this->users_model->getPrintableName ( $who['id'], 'first' ); ?>'s galleries</a>
  60. <?php endif; ?>
  61. <?php else: ?>
  62. <?php if(!empty($who)): ?>
  63. <!--<?php print $this->users_model->getPrintableName ( $who['id'], 'full' ); ?> doesn't have any products.-->
  64. <?php endif; ?>
  65. <?php endif; ?>
  66. <br />
  67. <br />
  68. <?php $use_master_categories_for_products = true;
  69. $use_master_categories_for_trainings = true;
  70. require (ACTIVE_TEMPLATE_DIR.'sidebar_products.php') ?>
  71. <?php require (ACTIVE_TEMPLATE_DIR.'sidebar_trainings.php') ?>
  72. <?php if(!empty( $author)): ?>
  73. <?php require (ACTIVE_TEMPLATE_DIR.'sidebar_widgets.php') ?>
  74. <?php endif; ?>
  75. <span class="c"></span> <br />
  76. </div>
  77. <?php dbg(__FILE__, 1); ?>