_ >   1 1 <?xml version="1.0"?>
  2 2
  3 3 <queryset>
< >   4       <rdbms><type>postgresql</type><version>7.1</version></rdbms>
5 4
< >   6  
7 5     <fullquery name="select_n_users">
  8 6         <querytext>
  9 7           select count(u.user_id) as n_users,
 
17 15         </querytext>
  18 16     </fullquery>
  19 17    
< >   20       <fullquery name="select_users_count">
  21           <querytext>
  22               select count (*)                  
  23               from dotlrn_users            
  24           </querytext>
  25       </fullquery>
  26  
27 18     <fullquery name="select_clubs_count">
  28 19         <querytext>
  29 20             select count (*)                  
 
41 32         </querytext>
  42 33     </fullquery>
  43 34
< >   44       <fullquery name="select_portrait_info">     
  45           <querytext>
  46               select cr_items.live_revision as revision_id,
  47                      coalesce(cr_revisions.title, 'view this portrait') as portrait_title
  48               from acs_rels,
  49                    cr_items,
  50                    cr_revisions
  51               where acs_rels.object_id_two = cr_items.item_id
  52               and cr_items.live_revision = cr_revisions.revision_id
  53               and acs_rels.object_id_one = :user_id
  54               and acs_rels.rel_type = 'user_portrait_rel'
  55           </querytext>
  56       </fullquery>
57 35
< >   58       <fullquery name="select_member_classes">
  59           <querytext>
  60               select dotlrn_class_instances_full.*,
  61                      dotlrn_member_rels_approved.rel_type,
  62                      dotlrn_member_rels_approved.role,
  63                      '' as role_pretty_name
  64               from dotlrn_class_instances_full,
  65                    dotlrn_member_rels_approved
  66               where dotlrn_member_rels_approved.user_id = :user_id
  67               and dotlrn_member_rels_approved.community_id = dotlrn_class_instances_full.class_instance_id
  68               order by dotlrn_class_instances_full.department_name,
  69                        dotlrn_class_instances_full.department_key,
  70                        dotlrn_class_instances_full.pretty_name,
  71                        dotlrn_class_instances_full.community_key
  72           </querytext>
  73       </fullquery>
  74  
  75       <fullquery name="select_member_clubs">
  76           <querytext>
  77               select dotlrn_clubs_full.*,
  78                      dotlrn_member_rels_approved.rel_type,
  79                      dotlrn_member_rels_approved.role,
  80                      '' as role_pretty_name
  81               from dotlrn_clubs_full,
  82                    dotlrn_member_rels_approved
  83               where dotlrn_member_rels_approved.user_id = :user_id
  84               and dotlrn_member_rels_approved.community_id = dotlrn_clubs_full.club_id
  85               order by dotlrn_clubs_full.pretty_name,
  86                        dotlrn_clubs_full.community_key
  87           </querytext>
  88       </fullquery>
  89  
  90       <fullquery name="select_member_subgroups">
  91           <querytext>
  92               select dotlrn_communities.*,
  93                      dotlrn_community__url(dotlrn_communities.community_id) as url,
  94                      dotlrn_member_rels_approved.rel_type,
  95                      dotlrn_member_rels_approved.role,
  96                      '' as role_pretty_name
  97               from dotlrn_communities,
  98                    dotlrn_member_rels_approved
  99               where dotlrn_member_rels_approved.user_id = :user_id
  100               and dotlrn_member_rels_approved.community_id = dotlrn_communities.community_id
  101               and dotlrn_communities.community_type = 'dotlrn_community'
  102               order by dotlrn_communities.pretty_name,
  103                        dotlrn_communities.community_key
  104           </querytext>
  105       </fullquery>
  106       <fullquery name="select_subgroup_count">
  107           <querytext>
  108                   select count(distinct community_id)
  109                           from dotlrn_communities
  110                           where parent_community_id= :community_id
  111           </querytext>
  112       </fullquery>
  113  
114 36     <fullquery name="select_members_count_by_type">
  115 37         <querytext>
  116 38                 select count (distinct acs_rels.object_id_two)
 
119 41                                 and dotlrn_users.user_id=acs_rels.object_id_two
  120 42         </querytext>
  121 43     </fullquery>
< >   122      
  123       <fullquery name="select_forums_count">
  124           <querytext>
  125               select count(distinct forums.forum_id)
  126                   from forums_forums_enabled forums               
  127           </querytext>
  128       </fullquery>
  129      
  130       <fullquery name="select_faqs_count">
  131           <querytext>
  132               select count(distinct f.faq_id)
  133                   from faqs f
  134           </querytext>
  135       </fullquery>
  136  
  137       <fullquery name="select_news_count">
  138           <querytext>
  139               select count(distinct n.item_id)
  140                   from news_items_approved n
  141           </querytext>
  142       </fullquery>
  143  
  144       <fullquery name="select_surveys_count">
  145           <querytext>
  146              select count(distinct s.survey_id)
  147                   from surveys s
  148           </querytext>
  149       </fullquery>
  150  
  151       <fullquery name="select_package_exists">
  152           <querytext>
  153                   select distinct package_key from apm_packages where package_key= :package_key
  154           </querytext>
  155       </fullquery>
  156  
< _   157 44 </queryset>