public class ResourceManager

class.resourcemanager.php #13

The ResourcesManager is a class used to collect some methods for both Datasources and Events.

Constants

static integer RESOURCE_TYPE_DS = 21

The integer value for datasource-type resources.

static integer RESOURCE_TYPE_EVENT = 20

The integer value for event-type resources.

Methods

static string __getExtensionFromHandle(integer $type, string $r_handle)

Given the type and handle of a resource, return the extension it belongs to.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

  • $r_handle stringThe handle of the resource.

Returns

The extension handle.

static boolean attach(integer $type, string $r_handle, integer $page_id)

Given a resource type, a handle and a page, this function will attach the given handle (which represents either a datasource or event) to that page.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

  • $r_handle stringThe handle of the resource.

  • $page_id integerThe ID of the page.

static boolean detach(integer $type, string $r_handle, integer $page_id)

Given a resource type, a handle and a page, this function detaches the given handle (which represents either a datasource or event) to that page.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

  • $r_handle stringThe handle of the resource.

  • $page_id integerThe ID of the page.

static array fetch(integer $type, array $select, array $where, string $order_by)

This function will return an associative array of resource information. The information returned is defined by the $select parameter, which will allow a developer to restrict what information is returned about the resource. Optionally, $where (not implemented) and $order_by parameters allow a developer to further refine their query.

Parameters
  • $type integerThe type of the resource (needed to retrieve the correct Manager)

  • $select array(optional) Accepts an array of keys to return from the manager's listAll() method. If omitted, all keys will be returned.

  • $where array(optional) Not implemented.

  • $order_by string(optional) Allows a developer to return the resources in a particular order. The syntax is the same as other fetch methods. If omitted this will return resources ordered by name.

Returns

An associative array of resource information, formatted in the same way as the resource's manager listAll() method.

static array getAttachedPages(integer $type, string $r_handle)

Given the resource handle, this function will return an associative array of Page information, filtered by the pages the resource is attached to.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

  • $r_handle stringThe handle of the resource.

Returns

An associative array of Page information, according to the pages the resource is attached to.

static string getManagerFromType(integer $type)

A method used to return the Manager for the given resource type.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

Returns

An string representing the name of the Manager class that handles the resource.

static string getSortingField(integer $type)

Returns the axis a given resource type will be sorted by. The following handles are available: name, source, release-date and author. Defaults to 'name'.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

Returns

The axis handle.

static string getSortingOrder(integer $type)

Returns the sort order for a given resource type. Defaults to 'asc'.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

Returns

Either 'asc' or 'desc'.

static boolean setPages(integer $type, string $r_handle, array $pages)

Given a resource type, a handle and an array of pages, this function will ensure that the resource is attached to the given pages. Note that this function will also remove the resource from all pages that are not provided in the $pages parameter.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

  • $r_handle stringThe handle of the resource.

  • $pages arrayAn array of Page ID's to attach this resource to.

static void setSortingField(integer $type, string $sort, boolean $write)

Saves the new axis a given resource type will be sorted by.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

  • $sort stringThe axis handle.

  • $write booleanIf false, the new settings won't be written on the configuration file. Defaults to true.

static void setSortingOrder(integer $type, string $order, boolean $write)

Saves the new sort order for a given resource type.

Parameters
  • $type integerThe resource type, either RESOURCE_TYPE_EVENT or RESOURCE_TYPE_DS

  • $order stringEither 'asc' or 'desc'.

  • $write booleanIf false, the new settings won't be written on the configuration file. Defaults to true.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details