::xowiki::IncludeletClass
::xowiki::includelet::most-popular
Class Hierarchy of ::xowiki::includelet::most-popular
- ::xotcl::Object
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Methods for instances:
- __api_make_doc, __api_make_forward_doc, __timediff, abstract, ad_doc, ad_forward, ad_proc, appendC, arrayC, asHTML, autonameC, check, classC, cleanupC, configureC, containsC, copyC, db_0or1rowC, db_1rowC, debug, defaultmethodC, destroyC, destroy_on_cleanup, ds, evalC, existsC, extractConfigureArg, filterC, filterguardC, filtersearch, forward, hasclass, incrC, infoC, init, instvarC, invarC, isclass, ismetaclass, ismixin, isobject, istype, lappendC, log, method, mixinC, mixinguardC, moveC, msg, noinitC, objectparameter, parametercmdC, proc, procsearch, qn, requireNamespaceC, residualargsC, self, serialize, setC, set_instance_vars_defaults, show-object, substC, traceC, unknown, unsetC, uplevelC, upvarC, volatileC, vwait
- Methods to be applied on the class (in addition to the methods provided by the meta-class):
- getExitHandler, setExitHandler, unsetExitHandler
- ::xo::Context
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Parameter for instances:
- actual_query (default " "), locale, package_id (default "0"), parameter_declaration (default "")
- Methods for instances:
- exists_query_parameter, export_vars, get_all_query_parameter, get_parameters, initialize, original_url_and_query, process_query_parameter, query_parameter
- Methods to be applied on the class:
- Methods provided by the meta-class
- ::xowiki::Includelet
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Parameter for instances:
- __decoration (default "portlet"), id, name (default ""), parameter_declaration (default ""), title (default "")
- Methods for instances:
- category_clause, get_page_order, include_head_entries, initialize, js_name, resolve_page_name, screen_name
- Methods to be applied on the class (in addition to the methods provided by the meta-class):
- available_includelets, describe_includelets, glob_clause, html_encode, html_id, html_to_text, js_encode, js_name, listing, locale_clause, parent_id_clause, publish_status_clause, require_YUI_CSS, require_YUI_JS
- ::xowiki::includelet::most-popular
- Meta-class:
- ::xowiki::IncludeletClass
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Parameter for instances:
- parameter_declaration (default "
{-max_entries:integer "10"}
{-interval}
"), title (default "Most Popular Pages")
- Methods for instances:
- render
- Methods to be applied on the class:
- Methods provided by the meta-class
Class Relations
- superclass: ::xowiki::Includelet
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xowiki::IncludeletClass create ::xowiki::includelet::most-popular \
-superclass ::xowiki::Includelet \
-parameter {{parameter_declaration {
{-max_entries:integer "10"}
{-interval}
}} {title "Most Popular Pages"}}
Methods
instproc render
::274794 instproc render {} {
my get_parameters
::xo::Page requireCSS "/resources/acs-templating/lists.css"
if {[info exists interval]} {
#
# If we have and interval, we cannot get report the number of visits
# for that interval, since we have only the aggregated values in
# the database.
#
my append title " in last $interval"
TableWidget t1 -volatile -columns {
AnchorField title -label [::xowiki::Page::slot::title set pretty_name]
Field users -label Visitors -html { align right }
}
set since_condition "and [::xo::db::sql since_interval_condition time $interval]"
db_foreach [my qn get_pages] [::xo::db::sql select -vars "count(x.user_id) as nr_different_users, x.page_id, r.title,i.name, i.parent_id" -from "xowiki_last_visited x, xowiki_page p, cr_items i, cr_revisions r" -where "x.package_id = $package_id and x.page_id = i.item_id and i.publish_status <> 'production' and i.live_revision = r.revision_id and $since_condition" -groupby "x.page_id, r.title, i.name, i.parent_id" -orderby "nr_different_users desc" -limit $max_entries ] {
t1 add -title $title -title.href [$package_id pretty_link -parent_id $parent_id $name] -users $nr_different_users
}
} else {
TableWidget t1 -volatile -columns {
AnchorField title -label [::xowiki::Page::slot::title set pretty_name]
Field count -label [_ xowiki.includelets-visits] -html { align right }
Field users -label [_ xowiki.includelet-visitors] -html { align right }
}
db_foreach [my qn get_pages] [::xo::db::sql select -vars "sum(x.count) as sum, count(x.user_id) as nr_different_users, x.page_id, r.title,i.name, i.parent_id" -from "xowiki_last_visited x, cr_items i, cr_revisions r" -where "x.package_id = $package_id and x.page_id = i.item_id and i.publish_status <> 'production' and i.live_revision = r.revision_id" -groupby "x.page_id, r.title, i.name, i.parent_id" -orderby "sum desc" -limit $max_entries] {
t1 add -title $title -title.href [$package_id pretty_link -parent_id $parent_id $name] -users $nr_different_users -count $sum
}
}
return [t1 asHTML]
}