public static function getRecordById($type, $id) { $record = parent::getRecordById($type, $id); if (!$record) { return false; } // Add the ctime by getting view ctime $data = self::getRecordDataById($type, $id); if (!$data) { return false; } // As block_instances do not have certain fields we need to get their // info either from the view they are on or from their configdata $record->ctime = parent::checkctime($data->ctime); $record->description = $data->description; $record->owner = $data->owner; $record->group = $data->group; $record->institution = $data->institution; // Access: get all the views where the block_instance is included $access = self::view_access_records($id); $accessObj = self::access_process($access); $record->access = $accessObj; $record->secfacetterm = self::$secfacetterm; // AS the field "sort" is not analyzed, we need to clean it (remove html tags & lowercase) $record->sort = strtolower(strip_tags($record->title)); return $record; }
public static function getRecordDataById($type, $id) { $record = parent::getRecordDataById($type, $id); if (!$record || $record->deleted) { return false; } return $record; }
public static function getRecordById($type, $id) { $record = parent::getRecordById($type, $id); if (!$record || $record->deleted) { return false; } $record->access['general'] = $record->public ? 'public' : 'loggedin'; $record->access['groups']['member'] = $record->id; $record->sort = strtolower(strip_tags($record->name)); return $record; }
public static function getRecordById($type, $id) { $record = parent::getRecordById($type, $id); if (!$record) { return false; } // Access: get view_access info $access = self::collection_access_records($id); $accessObj = self::access_process($access); $record->access = $accessObj; $record->sort = strtolower(strip_tags($record->name)); $record->secfacetterm = self::$secfacetterm; return $record; }
public static function getRecordDataById($type, $id) { $record = parent::getRecordDataById($type, $id); if (!$record) { return false; } // Created by if (intval($record->owner) > 0) { $record->createdby = get_record('usr', 'id', $record->owner); $record->createdbyname = display_name($record->createdby); } // Tags $tags = get_records_array('view_tag', 'view', $id); if ($tags != false) { foreach ($tags as $tag) { $record->tags[] = $tag->tag; } } else { $record->tags = null; } return $record; }
public static function getRecordById($type, $id, $artefacttypesmap_array) { $record = parent::getRecordById($type, $id); if (!$record) { return false; } // Tags $tags = get_records_array('artefact_tag', 'artefact', $id); if ($tags != false) { foreach ($tags as $tag) { $record->tags[] = $tag->tag; } } else { $record->tags = null; } // Access: get all the views where the artefact is included $access = self::view_access_records($id); $accessObj = self::access_process($access); if (!$access) { // File access: get viewable group media not attached to a view $groupaccess = self::group_artefact_access_records($id); if ($groupaccess) { foreach ($groupaccess as $access) { $accessObj['groups'][$access->role][] = $access->can_view; } } } $record->access = $accessObj; // set 'mainfacetterm' & 'artefactgroup' $terms = explode("|", $artefacttypesmap_array[$record->artefacttype]); $record->mainfacetterm = $terms[2]; $record->secfacetterm = $terms[1]; // AS the field "sort" is not analyzed, we need to clean it (remove html tags & lowercase) $record->sort = strtolower(strip_tags($record->title)); return $record; }
public static function getRecordById($type, $id, $artefacttypesmap_array) { $record = parent::getRecordById($type, $id); if (!$record) { return false; } // Tags $tags = get_records_array('artefact_tag', 'artefact', $id); if ($tags != false) { foreach ($tags as $tag) { $record->tags[] = $tag->tag; } } else { $record->tags = null; } // Access: get all the views where the artefact is included $access = self::view_access_records($id); $accessObj = self::access_process($access); if (!$access) { // File access: get viewable group media not attached to a view $groupaccess = self::group_artefact_access_records($id); if ($groupaccess) { foreach ($groupaccess as $access) { $accessObj['groups'][$access->role][] = $access->can_view; } } } $record->access = $accessObj; // set 'mainfacetterm' & 'artefactgroup' $terms = explode("|", $artefacttypesmap_array[$record->artefacttype]); $record->mainfacetterm = $terms[2]; $record->secfacetterm = $terms[1]; require_once get_config('docroot') . 'artefact/resume/lib.php'; if (PluginArtefactResume::is_active()) { // If the artefacttype is one of the résumé ones we need to get the description // from this artefact's related résumé table. There is a one -> many relationship between // the artefact and the items but seen as all resume items are added // to a page when choosing One résumé field, rather than selecting them individually, // we can just blob together all the info for this résumé artefact into $record->description. $resumetypes = ArtefactTypeResumeComposite::get_composite_artefact_types(); if (in_array($terms[0], $resumetypes)) { try { $query = "SELECT * FROM {artefact_resume_" . $terms[0] . "} WHERE artefact = ?"; $results = get_records_sql_assoc($query, array($record->id)); } catch (SQLException $e) { // Table doesn't exist $results = array(); } foreach ($results as $result) { $items = get_object_vars($result); foreach ($items as $key => $item) { if (!in_array($key, array('id', 'artefact', 'displayorder'))) { $record->description .= $item . ' '; } } } } } // AS the field "sort" is not analyzed, we need to clean it (remove html tags & lowercase) $record->sort = strtolower(strip_tags($record->title)); return $record; }
public function __construct($data) { $this->conditions = array('deleted' => 0); $this->mapping = array('mainfacetterm' => NULL, 'secfacetterm' => NULL, 'id' => NULL, 'subject' => NULL, 'body' => NULL, 'access' => NULL, 'ctime' => NULL, 'sort' => NULL); parent::__construct($data); }
public function __construct($data) { $this->conditions = array('active' => 1, 'deleted' => 0); $this->mapping = array('mainfacetterm' => NULL, 'id' => NULL, 'email' => NULL, 'username' => NULL, 'firstname' => NULL, 'lastname' => NULL, 'preferredname' => NULL, 'institutions' => NULL, 'access' => NULL, 'ctime' => NULL, 'sort' => NULL); parent::__construct($data); }