File/midcom/helper/misc.php

Description
Functions
dump_mem (line 935)
void dump_mem (mixed $text)
ImageCopyResampleBicubic (line 752)

Bicubic resampling of an Image, truecolor version

Gives an image with a higher quality then the built-in gdlib functions. It is recommended to use imagemagick in favor of this function.

void ImageCopyResampleBicubic (int &$dst_img, int &$src_img, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h)
  • int $dst_img: Destination Image Handle.
  • int $src_img: Source image Handle.
  • int $dst_x: X-offest of the destination.
  • int $dst_y: Y-offest of the destination.
  • int $src_x: X-offest of the source.
  • int $src_y: Y-offest of the source.
  • int $dst_w: Width of the destination.
  • int $dst_h: Height of the destination.
  • int $src_w: Width of the source.
  • int $src_h: Height of the source.
ImageCopyResampleBicubicPalette (line 678)

Bicubic resampling of an Image, 256 color version

Gives an image with a higher quality then the built-in gdlib functions. It is recommended to use imagemagick in favor of this function.

void ImageCopyResampleBicubicPalette (int &$dst_img, int &$src_img, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_w, int $dst_h, int $src_w, int $src_h)
  • int $dst_img: Destination Image Handle.
  • int $src_img: Source image Handle.
  • int $dst_x: X-offest of the destination.
  • int $dst_y: Y-offest of the destination.
  • int $src_x: X-offest of the source.
  • int $src_y: Y-offest of the source.
  • int $dst_w: Width of the destination.
  • int $dst_h: Height of the destination.
  • int $src_w: Width of the source.
  • int $src_h: Height of the source.
mgd_delete_extensions (line 580)

Delete all extensions (parameters and attachments) to a Midgard object

  • return: Indicating success.
bool mgd_delete_extensions (MidgardObject &$object)
  • MidgardObject $object: The object that should be cleared.
mgd_fetch_to_array (line 181)

Transforms a fetchable into an ID-array

  • return: An Array of all object id's in the fetchable.
Arraay mgd_fetch_to_array (MidgardFetchable $fetchable)
  • MidgardFetchable $fetchable: Any result traversable by fetch()
mgd_get_createstr (line 284)

Get the constructor string for an object's class.

Returns either a mgd_get_... string or a new ... string.

  • return: The string required to create an object of that type.
string mgd_get_createstr (string $object_type)
  • string $object_type: The typename of the object ("MidgardObject" or "MyClass").
mgd_group_id_array (line 419)

Sort and group an Array of object IDs

Note: This function is quite slow. It does everything on a PHP level.

  • return: Two-Level array with the grouped and sorted IDs.
Array mgd_group_id_array (Array $array, string $groupkey, string $element_type, string $group_type, [int $elementsortkey = "unsorted"], [string $groupsortkey = "unsorted"], [int $elementsorting = SORT_REGULAR], [int $groupsorting = SORT_REGULAR])
  • Array $array: The ID-Array to sort and group.
  • string $groupkey: The key after which to group the results.
  • string $element_type: The type of the element after which to group.
  • int $elementsortkey: The key after which to sort the elements.
  • string $groupsortkey: The name of the member after which the groups should be sorted (prepend "reverse" for a reverse sorting).
  • string $group_type: The type of the object referenced by the groups
  • int $elementsorting: The PHP sorting mechanism to use.
  • int $groupsorting: The PHP sorting mechanism to use.
mgd_include_snippet_php (line 648)

PHP-level implementation of the Midgard Preparser language construct mgd_include_snippet. Same semantics, but probably a littlebit slower.

  • return: Returns false if the snippet could not be loaded or true, if it was evaluated successfully.
bool mgd_include_snippet_php (string $path)
  • string $path: The path of the snippet that should be included.
mgd_is_group_in_group_tree (line 143)

Helper function to check wether a given group is a subgroup of another one.

  • return: True if it is a subgroup, false otherwise.
bool mgd_is_group_in_group_tree (int $id, int $rootid)
  • int $id: Group to query.
  • int $rootid: Root group.
mgd_list_persons_in_group_all (line 161)

List all members in a group.

  • return: ID-Array of all group members
Array mgd_list_persons_in_group_all (int $group)
  • int $group: The id of the group whose members are queried.
mgd_load_custom_fields_param (line 265)

Load a number of variables into parameters and attach them to the Midgard object.

This function will load the Member-Variables specified in $array of the Midgard Object $object in the Parameter Domain $domain. It will assign them as members to the passed object

Note: Midgard currently loads all parameters and assigns them to members automatically. So this function should no longer be needed.

void mgd_load_custom_fields_param (Array $array, MidgardObject &$object, string $domain)
  • Array $array: The variable names to load.
  • MidgardObject $object: The object where to load the information.
  • string $domain: The domain where to load the information.
mgd_load_var_from_attachment (line 527)

Load a variable form an attachment to a Midgard object.

  • return: The retrieved variable.
mixed mgd_load_var_from_attachment (MidgardObject $object, string $name)
  • MidgardObject $object: The object at which to save the data.
  • string $name: The identifier to use for storage.
mgd_memberships_to_gid (line 211)

Transforms a membership fetchable to an Group-ID Array

  • return: An Array of all group id's in the fetchable.
Arraay mgd_memberships_to_gid (MidgardFetchable $fetchable)
  • MidgardFetchable $fetchable: Any result traversable by fetch()
mgd_memberships_to_uid (line 196)

Transforms a membership fetchable to an Person-ID Array

  • return: An Array of all person id's in the fetchable.
Arraay mgd_memberships_to_uid (MidgardFetchable $fetchable)
  • MidgardFetchable $fetchable: Any result traversable by fetch()
mgd_save_custom_fields_param (line 234)

Save a number of variables into parameters on an arbitary Midgard object.

This function will save the Member-Variables specified in $array of the Midgard Object $object in the Parameter Domain $domain. It will checkt wether all Fields are short enough (Margin: 255 characters) to fit into a parameter, if not, it will abort. It will return TRUE if successful, FALSE on failure.

  • return: Indicating success.
bool mgd_save_custom_fields_param (Array $array, MidgardObject &$object, string $domain)
  • Array $array: The data to store (keys will be preserved).
  • MidgardObject $object: The object where to store the information.
  • string $domain: The domain where to save the information.
mgd_save_var_as_attachment (line 482)

Save a variable as attachment to an Midgard object. Type is preserved through serialization.

  • return: Indicating succes.
bool mgd_save_var_as_attachment (MidgardObject $object, mixed &$var, string $name)
  • MidgardObject $object: The object at which to save the data.
  • mixed $var: The variable that should be saved.
  • string $name: The identifier to use for storage.
mgd_sort_id_array (line 301)

Sort an Array of object IDs

Note: This function is quite slow. It does everything on a PHP level.

void mgd_sort_id_array (Array &$array, string $sortkey, string $object_type, [int $sorting = SORT_REGULAR])
  • Array $array: The ID-Array to sort.
  • string $sortkey: The name of the member that should be sorted (prepend "reverse" for a reverse sorting).
  • string $object_type: The type of the object referenced by the IDs
  • int $sorting: The PHP sorting mechanism to use.
mgd_sort_object_array (line 352)

Sort an Array of objects

Works with a reference array (doesn't return anything)

void mgd_sort_object_array (Array &$array, string $sortkey, [int $sorting = SORT_REGULAR])
  • Array $array: The object-array to sort (used via reference).
  • string $sortkey: The name of the member that should be sorted (prepend "reverse" for a reverse sorting).
  • int $sorting: The PHP sorting mechanism to use.
midcom_file_exists_incpath (line 918)

Check if a file exists in the include path

  • return: TRUE if the file exists, FALSE if it does not
  • author: Aidan Lister <aidan@php.net>
  • version: 1.2.0
bool midcom_file_exists_incpath (string $file)
  • string $file: Name of the file to look for
midcom_generate_urlname_from_string (line 809)

Helper function for generating "clean" URL names from titles, etc.

  • return: Normalized name.
string midcom_generate_urlname_from_string (string $string, [string $replacer = "-"])
  • string $string: String to edit.
  • string $replacer: The replacement for invalid cahracters.
midcom_get_snippet_content (line 23)

This helper function searche for a snippet either in the Filesystem or in the database and returns its content or code-field, respecitvly.

Prefix the snippet Path with 'file:' for retrival of a file relative to MIDCOM_ROOT; omit it to get the code field of a Snippet.

Any error (files not found) will raise an MidCOM Error.

  • return: The content of the snippet/file.
string midcom_get_snippet_content (string $path)
  • string $path: The URL to the snippet.
midcom_helper_find_node_by_component (line 953)

This helper function returns the first instance of a given component on the MidCOM site.

  • return: NAP array of the first component instance found
array midcom_helper_find_node_by_component (mixed $component, [mixed $node_id = null], [mixed $nap = null])
midcom_helper_generate_daylabel (line 990)
void midcom_helper_generate_daylabel ([mixed $label = 'start'], mixed $start, mixed $end)
midcom_helper_purge_object (line 866)

Helper function for really removing an object

  • return: Indicating success.
bool midcom_helper_purge_object (guid $guid, [bool $removeattachments = true])
  • guid $guid: The GUID of the object
  • bool $removeattachments: Remove attachments too?
midcom_probe_nemein_rcs (line 55)

Probes for the installed NemeinRCS root

  • return: RCS root or false on failure.
string midcom_probe_nemein_rcs ()
midcom_update_nemein_rcs (line 118)

MidCOM Interface against NemeinRCS.

Updates the Nemein RCS information for $object.

  • return: Indicating success.
bool midcom_update_nemein_rcs (MidgardObject $object)
  • MidgardObject $object: The object that should be version controlled.

Documentation generated on Mon, 21 Nov 2005 18:18:58 +0100 by phpDocumentor 1.3.0RC3