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
(defaults to "0") (optional)
viewing user id
-type
(optional)
filter results by type
Returns:
boolean value

Partial Call Graph (max 5 caller/called nodes):
%3 test_view_api_test_with_type view_api_test_with_type (test views) views::viewed_p views::viewed_p test_view_api_test_with_type->views::viewed_p test_view_api_test_without_type view_api_test_without_type (test views) test_view_api_test_without_type->views::viewed_p ad_conn ad_conn (public) views::viewed_p->ad_conn db_string db_string (public) views::viewed_p->db_string

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

[ hide source ] | [ make this the default ]
Show another procedure: