CMS  Version 3.9
ShareToken Class Reference

Inherits DataItem.

Public Member Functions

 User ()
 
 Accesses ($constraint="ORDER BY access_timestamp")
 
 getTitle ()
 
 countViews ()
 

Static Public Member Functions

static getShare ($token)
 
static forObject ($obj)
 

Public Attributes

 $table = "share_token"
 
 $primary_key = "share_id"
 
 $fields
 
 $relations
 

Detailed Description

Definition at line 7 of file share_token.inc.

Member Function Documentation

◆ Accesses()

ShareToken::Accesses (   $constraint = "ORDER BY access_timestamp")

Definition at line 27 of file share_token.inc.

28  {
29  return $this->getRelatedList('ShareAccess', "", $constraint);
30  }
$constraint

◆ countViews()

ShareToken::countViews ( )

Definition at line 38 of file share_token.inc.

39  {
40  return Query::create('ShareAccess', "WHERE share_id=:s")
41  ->bind(":s", $this->share_id)
42  ->count();
43  }

◆ forObject()

static ShareToken::forObject (   $obj)
static

Definition at line 64 of file share_token.inc.

65  {
66  $type = get_class($obj);
67  $key = $obj->getPrimaryKeyValue();
68 
69  $matches = Query::create(ShareToken, "WHERE item_type=:t AND item_key=:k")
70  ->bind(":t", $type, ":k", $key)
71  ->execute();
72 
73  return count($matches) > 0 ? $matches[0] : null;
74  }

◆ getShare()

static ShareToken::getShare (   $token)
static

Definition at line 45 of file share_token.inc.

46  {
47  if (!checkPlainGUID($token))
48  {
49  throw new FakoliException("Invalid Token");
50  }
51 
52  try
53  {
54  return Query::create(ShareToken, "WHERE token=:t")
55  ->bind(":t", $token)
56  ->executeSingle();
57  }
58  catch(DataNotFoundException $e)
59  {
60  throw new FakoliException("Token not found");
61  }
62  }
FakoliException is the base exception class for all Fakoli errors.
Definition: core.inc:53

◆ getTitle()

ShareToken::getTitle ( )

Definition at line 32 of file share_token.inc.

33  {
34  $handler = SharingManager::getShareHandler($this->item_type);
35  return $handler->getTitle($this->item_key);
36  }
$handler
Definition: event_form.inc:62
static getShareHandler($type)

◆ User()

ShareToken::User ( )

Definition at line 26 of file share_token.inc.

26 { return $this->getRelated('SiteUser'); }

Member Data Documentation

◆ $fields

ShareToken::$fields
Initial value:
= array("share_id" => Number,
"token" => String,
"item_type" => String,
"item_key" => Number,
"active" => Boolean,
"user_id" => Number,
"created_date" => DateTime,
"last_updated" => DateTime,
"last_updated_by_id" => Number
)

Definition at line 12 of file share_token.inc.

◆ $primary_key

ShareToken::$primary_key = "share_id"

Definition at line 10 of file share_token.inc.

◆ $relations

ShareToken::$relations
Initial value:
= array( "User" => 'SiteUser',
"Accesses" => 'ShareAccess')

Definition at line 23 of file share_token.inc.

◆ $table

ShareToken::$table = "share_token"

Definition at line 9 of file share_token.inc.


The documentation for this class was generated from the following file: