CMS  Version 3.9
LinkRecord Class Reference

This class maps the publication table. More...

Inherits DataItem.

Public Member Functions

 Owner ()
 
 isOwner ()
 
 LinkLibrary ()
 
 search ($params, $range=null)
 

Public Attributes

 $table = "link_record"
 
 $primary_key = "link_id"
 
 $pretty_class_name = "Link"
 
 $fields
 
 $relations
 

Detailed Description

This class maps the publication table.

Definition at line 44 of file link_record.inc.

Member Function Documentation

◆ isOwner()

LinkRecord::isOwner ( )

Definition at line 74 of file link_record.inc.

75  {
76  global $user;
77  $owner = $this->Owner();
78 
79  return ($owner->user_id == $user->user_id) ? true : false;
80  }
global $user
$table column("Redirect From", "<a href='redirect_form?redirect_id={redirect_id}'>{redirect_from}</a>", true, "width: 30%") -> column("Redirect To", "<a href='{redirect_to}' target='_blank'>{redirect_to}</a>", true, "width: 30%") ->column("Last Modified", "{last_modified}", true, "width: 20%; text-align: center") ->column("Override", "{ override true
Definition: redirects.inc:9

◆ LinkLibrary()

LinkRecord::LinkLibrary ( )

Definition at line 82 of file link_record.inc.

83  {
84  return $this->getRelated(LinkLibrary);
85  }

◆ Owner()

LinkRecord::Owner ( )

Definition at line 68 of file link_record.inc.

69  {
70  $mgr = new UserManager();
71  return $mgr->getUser($this->owner_id);
72  }
$calendar owner_id
Provides the interface to the user model for the application.

◆ search()

LinkRecord::search (   $params,
  $range = null 
)

Definition at line 87 of file link_record.inc.

88  {
89  trace("Searching Links", 3);
90 
91  if ($range)
92  {
93  $range = " AND {$this->primary_key} IN (".implode($range, ", ").")";
94  }
95 
96  if (is_object($params))
97  {
98  $search = clone $params;
99  $search->target = $this;
100 
101  if (!$range)
102  {
103  $search->remapField("text", "description");
104  }
105 
106  $constraint = $search->generateConstraint();
107  $constraint .= $constraint ? " AND published=1" : " WHERE published=1";
108 
109  $constraint .= $range;
110 
111  $links = Query::create(LinkRecord, $constraint)
112  ->execute();
113  }
114  else
115  {
116  $params = preg_replace('/[^\w]+/', ' ', $params);
117  $params = "%$params%";
118  $links = Query::create(LinkRecord, "WHERE (title like :a OR description Like :b) and published=1 $range")
119  ->bind(":a", $params, ":b", $params)
120  ->execute();
121  }
122 
124  }
$constraint
$range
Definition: error_log.inc:13
static wrap($items, $resultClass)

Member Data Documentation

◆ $fields

LinkRecord::$fields
Initial value:
= array("link_id" => Number,
"title" => String,
"url" => String,
"description" => HTML,
"published" => Boolean,
"last_modified" => Timestamp,
"link_library_id" => Number,
"owner_id" => Number,
"sort_order" => Number)

Definition at line 52 of file link_record.inc.

◆ $pretty_class_name

LinkRecord::$pretty_class_name = "Link"

Definition at line 48 of file link_record.inc.

◆ $primary_key

LinkRecord::$primary_key = "link_id"

Definition at line 47 of file link_record.inc.

◆ $relations

LinkRecord::$relations
Initial value:
= array("Owner" => "",
"LinkLibrary" => LinkLibrary
)

Definition at line 64 of file link_record.inc.

◆ $table

LinkRecord::$table = "link_record"

Definition at line 46 of file link_record.inc.


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