views::viewed_p (public)
views::viewed_p [ -object_id object_id ] [ -user_id user_id ] \ [ -type type ]
Defined in packages/views/tcl/views-procs.tcl
Returns whether an object was viewed by specified user.
- Switches:
- -object_id (optional)
- viewed object id
- -user_id (optional, defaults to
"0"
)- viewing user id
- -type (optional)
- filter results by type
- Returns:
- boolean value
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- view_api_test_without_type, view_api_test_with_type
Source code: if {!$user_id} { set user_id [ad_conn user_id] } if { $type ne "" } { return [db_string get_viewed_by_type_p {} -default 0] } else { return [db_string get_viewed_p {} -default 0] }Generic XQL file: <fullquery name="views::viewed_p.get_viewed_p"> <querytext> select count(*) from views_views where object_id = :object_id and viewer_id = :user_id </querytext> </fullquery> <fullquery name="views::viewed_p.get_viewed_by_type_p"> <querytext> select count(*) from views_by_type where object_id = :object_id and viewer_id = :user_id and view_type = :type </querytext> </fullquery>packages/views/tcl/views-procs.xql
PostgreSQL XQL file: packages/views/tcl/views-procs-postgresql.xql
Oracle XQL file: packages/views/tcl/views-procs-oracle.xql