Custom Module to hook into og_panel

Events happening in the community are now at Drupal community events on www.drupal.org.
truyenle's picture

Chào cả nhà,

Mình cần show một custom query như sau trong og_panel.

$sql = "select sum(field_points_value) points, field_team_name_value team, oga.group_nid
from content_type_report report
join og_ancestry oga
on report.nid = oga.nid
join og
on oga.group_nid = og.nid
where og.og_description = %d
group by team, oga.group_nid
order by points desc";

$result = db_query(sql,$node->nid);

Trong đó:

Mình dùng organic group, organic group panels
report là một content type được set là "Standard group post" gồm các fields: field_points_value, field_team_name_value team

Bình thường thì mình dùng view 2, tạo một display (page, attchement) để query database, sau đó add display này vào trong organic group panels để show.

Tuy nhiên, hiện tại view 2 không cho phép thực hiện custom query này (hoặc mình không biết cách). Nên mình nghĩ có thể phải build một module để làm việc này.

Cả nha biết cách nào để thực hiện việc này xin chỉ giúp với.

Mình chưa từng hook vào og hay og_panels, nên nếu phải build module thì phải dùng hook nào?

Xin chỉ giúp.

Cảm ơn cả nhà nhiều.

Truyenle