Permalink
Browse files

Merge remote-tracking branch 'cesar/ticket-63065'

  • Loading branch information...
2 parents 1fde288 + e584820 commit cf177bc0b5025e29ee49b628c1bdeca1877f450c @michaelcullum michaelcullum committed Mar 28, 2012
@@ -141,7 +141,8 @@ function load_contrib($contrib_id = false)
);
// Search for a category with the same name as the contrib type. This is a bit ugly, but there really isn't any better option
- $categories_ary = titania::$contrib->get_categories();
+ $categories_ary = titania::$cache->get_categories();
+ titania::$contrib->get_categories();
titania::$contrib->integrate_demo = false;
foreach ($categories_ary as $category_id => $category_row)
@@ -159,7 +160,7 @@ function load_contrib($contrib_id = false)
));
}
- if ($category_row['category_options'] & TITANIA_CAT_FLAG_DEMO)
+ if (isset(titania::$contrib->categories[$category_id]) && $category_row['category_options'] & TITANIA_CAT_FLAG_DEMO)
{
titania::$contrib->integrate_demo = true;
phpbb::$template->assign_var('S_INTEGRATE_DEMO', true);
@@ -70,6 +70,11 @@ class titania_contribution extends titania_message_object
public $screenshots;
/**
+ * Categories in which the contrib resides in.
+ */
+ public $categories = array();
+
+ /**
* is_author (true when visiting user is the author)
* is_active_coauthor (true when visiting user is an active co-author)
* is_coauthor (true when visiting user is a non-active co-author)
@@ -359,6 +364,11 @@ public function get_download($revision_id = false)
*/
public function get_categories()
{
+ if (sizeof($this->categories))
+ {
+ return;
+ }
+
$sql = 'SELECT category_id
FROM ' . TITANIA_CONTRIB_IN_CATEGORIES_TABLE . '
WHERE contrib_id =' . (int) $this->contrib_id;
@@ -374,7 +384,7 @@ public function get_categories()
}
phpbb::$db->sql_freeresult($result);
- return $contrib_categories;
+ $this->categories = $contrib_categories;
}
/**
@@ -542,6 +552,17 @@ public function assign_details($simple = false, $return = false)
{
$this->screenshots->parse_attachments($message = false, false, false, 'screenshots');
}
+
+ // Display categories
+ $this->get_categories();
+ $category = new titania_category();
+
+ foreach ($this->categories as $category_row)
+ {
+ $category->__set_array($category_row);
+
+ phpbb::$template->assign_block_vars('categories', $category->assign_display(true));
+ }
}
if ($return)
@@ -52,6 +52,7 @@
'CACHE_PURGED' => 'Cache has been successfully purged',
'CATEGORY' => 'Category',
+ 'CATEGORIES' => 'Categories',
'CATEGORY_CHILD_AS_PARENT' => 'The chosen parent category cannot be selected because it is a child of this category.',
'CATEGORY_DELETED' => 'Category Deleted',
'CATEGORY_DESC' => 'Category Description',
@@ -154,10 +154,13 @@
</li>
<!-- ENDIF -->
<!-- IF CONTRIB_RATING_STRING -->
- <li style="border-bottom: 0;">
+ <li>
<strong>{L_RATING}</strong> {CONTRIB_RATING_STRING} ({CONTRIB_RATING_COUNT})
</li>
<!-- ENDIF -->
+ <li style="border-bottom: none;">
+ <strong>{L_CATEGORIES}</strong> <!-- BEGIN categories --><a href="{categories.U_VIEW_CATEGORY}">{categories.CATEGORY_NAME}</a><!-- IF not categories.S_LAST_ROW -->, <!-- ENDIF --><!-- END -->
+ </li>
</ul>
<!-- IF .queue_actions or CURRENT_STATUS -->

0 comments on commit cf177bc

Please sign in to comment.