Procedural File: global_functions.php

Source Location: /php/global_functions.php



Classes:

Page Details:

global_functions.php

Take care to consider where would be the best place for you function, preferably put it in the module. Only include it in here if it is genuinely global.

PHP versions 4 and 5

LICENSE: ARK - The Archaeological Recording Kit. An open-source framework for displaying and working with archaeological data Copyright (C) 2008 L - P : Partnership Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Tags:


Includes:
include_once('get_functions.php') [line 43]

global_functions.php

Take care to consider where would be the best place for you function, preferably put it in the module. Only include it in here if it is genuinely global.

PHP versions 4 and 5

LICENSE: ARK - The Archaeological Recording Kit. An open-source framework for displaying and working with archaeological data Copyright (C) 2008 L - P : Partnership Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Tags:




addAction

array addAction( int $actiontype, string $itemkey, string $itemvalue, $actorkey, $actorvalue, string $cre_by, string $cre_on, string $actor_itemkey, string $actor_itemvalue)

[line 475]

adds actions to cor_tbl_action

Tags:

  • return - an array containing results info
  • author - Guy Hunt
  • since - 0.3

Parameters

  • int $actiontype - the classtype number
  • string $itemkey - the itemkey
  • string $itemvalue - the itemval
  • string $actor_itemkey - the actor itemkey
  • string $actor_itemvalue - the actor itemval
  • string $cre_by - the cre by
  • string $cre_on - the cre on
  • $actorkey -
  • $actorvalue -

[ Top ]

addAttr

array addAttr( string $attribute, string $itemkey, string $itemvalue, string $cre_by, string $cre_on, [boolean $bv = FALSE])

[line 583]

gives add functionality for attributes

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since -

    0.6

    NOTE: since 0.6 this has taken add functionality from edtAttr()

    NOTE: this adds to the cor_tbl_attribute. It does not add to the look up table of attributes.

Parameters

  • string $attribute - the id of the attribute
  • string $itemkey - the itemkey
  • string $itemvalue - the itemvalue
  • string $cre_by - the author of this snippet
  • string $cre_on - the create date of this snippet
  • boolean $bv - TRUE or FALSE

[ Top ]

addDate

array addDate( string $datetype, string $itemkey, string $itemvalue, string $date, string $cre_by, string $cre_on)

[line 714]

adds dates

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $datetype - the id of the datetype
  • string $date - the date to add
  • string $cre_by - the new frag creator
  • string $cre_on - the new date of creation
  • string $itemkey - the itemkey
  • string $itemvalue - the itemvalue

[ Top ]

addFile

array addFile( string $itemkey, string $itemvalue, int $file, string $cre_by, string $cre_on)

[line 1473]

makes insert queries for the dataclass file

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $itemkey - the itemkey
  • string $itemvalue - the itemvalue
  • int $file - the id of the file (from cor_lut_file)
  • string $cre_by - the author of this snippet
  • string $cre_on - the create date of this snippet

[ Top ]

addFiles

array addFiles( array $files, $itemvalue, string $orig_dir, string $target_dir, string $itemval)

[line 5171]

DEPRECATED SHOULD USE addFile() INSTEAD moves a file or files from the current location and renames as appropriate

Tags:

  • author - Stuart Eve (stuarteve@lparchaeology.com)
  • since - 0.6

Parameters

  • array $files - the files to process
  • string $itemval - the itemval of the fil_cd
  • string $orig_dir - the current directory of the file
  • string $target_dir - the directory to put the new files
  • $itemvalue -

[ Top ]

addItemKey

array addItemKey( $itemkey, $itemvalue, string $cre_by, string $cre_on, [string $modtype = FALSE], string $mod_short, string $mod_cd_val, string $mod_no_val, string $ste_cd)

[line 332]

inserts the database entry for an itemkey in all modules

Tags:

  • return - containing number of affected rows and 'success' set true or false
  • author - Guy Hunt

Parameters

  • string $mod_short - the three letter mod code
  • string $mod_cd_val - the fully resolved itemvalue of the item
  • string $mod_no_val - just the number
  • string $ste_cd - the site code
  • string $cre_by - the user_id of the record creator
  • string $cre_on - the creation date for this record
  • string $modtype - the modtype (if this module is using types)
  • $itemkey -
  • $itemvalue -

[ Top ]

addMarkup

array addMarkup( string $nname, string $markup, string $lang, string $description, string $cre_by, string $cre_on, [ $dry_run = FALSE])

[line 817]

adds markup

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Stuart Eve
  • since - 0.6

Parameters

  • string $nname - the nickname of the markup
  • string $markup - the markup to add
  • string $lang - the language of the markup
  • string $description - the description of the markup
  • string $cre_by - the new markup creator
  • string $cre_on - the new date of creation
  • $dry_run -

[ Top ]

addNumber

void addNumber( string $numtype, string $itemkey, string $itemvalue, string $num, string $cre_by, string $cre_on)

[line 931]

adds a number

Tags:

  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $numtype - the id of the numbertype
  • string $itemkey - the itemkey
  • string $itemvalue - the itemvalue
  • string $num - the number to insert
  • string $cre_by - the author of this snippet
  • string $cre_on - the create date of this snippet

[ Top ]

addSpan

array addSpan( string $spantype, string $itemkey, string $itemvalue, string $beg, string $end, string $cre_by, string $cre_on)

[line 1034]

adds a span to cor_tbl_span

Tags:

  • return - containing standardised results vars
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $spantype - the type number (id of row in cor_lut_spantype)
  • string $itemkey - the itemkey
  • string $itemvalue - the itemvalue
  • string $beg - the beg column value
  • string $end - the end column value
  • string $cre_by - the frag creator user_id
  • string $cre_on - the frag creation datetime

[ Top ]

addSpanAttr

array addSpanAttr( int $span_id, int $spanlabel, string $cre_by, string $cre_on)

[line 1140]

adds a label for a span

Tags:

  • return - the array of result information
  • author - Guy Hunt
  • since -

    0.3

    took over add functionality from edtSpanAttr()

    bear in mind that this means of attributing frags is now deprecated the correct method is to use chains. However this lives on in the matrix this function could be modified to act as a means to easily chain stuff

Parameters

  • int $span_id - the id number of the span frag
  • int $spanlabel - the id number of the span label
  • string $cre_by - the new frag creator
  • string $cre_on - the new date of creation

[ Top ]

addTxt

array addTxt( string $txttype, string $itemkey, string $itemvalue, string $txt, string $lang, string $cre_by, string $cre_on)

[line 1214]

makes insert queries for the dataclass txt

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $txttype - the id of the texttype
  • string $itemkey - the itemkey
  • string $itemvalue - the itemvalue
  • string $txt - the text to insert
  • string $lang - the language of this snippet
  • string $cre_by - the author of this snippet
  • string $cre_on - the create date of this snippet

[ Top ]

addXmi

array addXmi( string $itemkey, string $itemvalue, string $xmi_itemkey, string $list, string $ste_cd, string $cre_by, string $cre_on)

[line 1344]

loops over a list of item numbers

Tags:

  • return - an array containing standardised results
  • author - Stuart Eve
  • since -

    0.3

    Note: The $ste_cd should only be sent if you are sending mod_no's (that is the number without a site code appended). If you are sending fully resolved itemvalues be sure to set this FALSE

    Note 2: This has now been updated since version 0.6 to allow for a mixture of numbers and fully resolved itemvalues. It will only append the site code if the value is numeric

Parameters

  • string $itemkey - the itemkey of the item you are on
  • string $itemvalue - the itemvalue of the item you are on
  • string $xmi_itemkey - the itemkey of the mod you are linking to
  • string $list - the list of items you want to link to
  • string $ste_cd - the site code of listed items set FALSE if sending full itemvals
  • string $cre_by - the record creator user_id
  • string $cre_on - the creation date of this record

[ Top ]

arraySetCurrent

void arraySetCurrent( &$array, string $key, array $array)

[line 5086]

sets the pointer of an array to the given key

Tags:

  • author - (not too sure) possibly taken off the php.net manual
  • since - 0.4

Parameters

  • array $array - the array to set pointer in
  • string $key - the key to move the pointer to
  • &$array -

[ Top ]

array_diff_key

void array_diff_key( )

[line 5508]

Parameters

[ Top ]

browserDetect

browser browserDetect( )

[line 5261]

works out which browser a user is using

Tags:

  • return - string the ark standard browser name
  • author - Guy Hunt
  • since -

    0.6

    Note: This used to be used as an include script from v0.1 to 0.6, the code may not yet be fully working. Also as a dev note, this code ought to be improved to help detect version numbers as the principle browser problem is MSIE-6

Parameters

[ Top ]

chkCxtSpanlabel

void chkCxtSpanlabel( $ste_cd, $beg, $end, $spanlabelid, $conf_tvclab)

[line 2506]

Parameters

  • $ste_cd -
  • $beg -
  • $end -
  • $spanlabelid -
  • $conf_tvclab -

[ Top ]

chkModType

boolean chkModType( string $mod)

[line 2396]

checks if a module is using types

Tags:

  • return - TRUE meaning it is using types FALSE meaning it isnt
  • author - Guy Hunt

Parameters

  • string $mod - the three letter mod code to test

[ Top ]

chkTranslation

void chkTranslation( string $dataclass, int $frag_id)

[line 2363]

checks if a piece of markup or an alias has translations

Tags:

  • since - 0.6
  • access - public

Parameters

  • string $dataclass - the type of data to check (i.e 'markup' or 'alias')
  • int $frag_id - the id of the frag (in the alias or markup table)

[ Top ]

compareSpans

boolean compareSpans( array $span1, array $span2, [boolean $reverse = FALSE])

[line 5414]

compares two numeric spans to see if they coincide

Tags:

  • return - either TRUE if the spans coincide or FALSE if they don't
  • author - Stuart Eve
  • since - 0.6

Parameters

  • array $span1 - a array retrieved using getSpan()
  • array $span2 - a array retrieved using getSpan()
  • boolean $reverse - if set this reverses the span comparisons (this is mainly used in FASTI for comparing BPs (they work from large->small instead of small->large

[ Top ]

createthumb

void createthumb( string $name, string $filename, string $new_w, string $new_h)

[line 2886]

creates thumbnails for images

Tags:

  • author - http://icant.co.uk/articles/phpthumbnails/
  • since - 0.4

Parameters

  • string $name - the name of the file to be thumbnailed
  • string $filename - the name of the thumbnail
  • string $new_w - the new width in px
  • string $new_h - the new height in px

[ Top ]

dateNow

string dateNow( string $date)

[line 5391]

sets blank dates to NOW()

Tags:

  • return - a date
  • author - Guy Hunt
  • since - 0.4

Parameters

  • string $date - a date

[ Top ]

dateSelect

string dateSelect( string $type, string $fields, string $datetype, [string $date = FALSE])

[line 4956]

makes up a date select element for forms

Tags:

  • return - a resolved html string
  • author - Guy Hunt
  • since -

    0.2

    Current fields: dd - day expressed as two digits mm - month expressed as two digits yr - year expressed as 4 digits

    Current types: text - gives the fields as plain text input fields

Parameters

  • string $type - sets the type of selector (eg. popup/text) //NOTE NOT IMPLEMENTED
  • string $fields - the fields you want in the selector
  • string $datetype - sets a prefix to the date fields when sending in forms
  • string $date - values with which to populate the fields (if blank the fields are empty)

[ Top ]

dbConnect

void dbConnect( $sql_server, $sql_user, $sql_pwd, $ark_db)

[line 5326]

connects to a MySQL db

Tags:

  • author - Guy Hunt
  • since -

    0.6

    Note: this db connect function was an inc script from v0.1 to 0.6, it would be worth putting something a little bit tidier in here.

Parameters

  • $sql_server -
  • $sql_user -
  • $sql_pwd -
  • $ark_db -

[ Top ]

ddActor

void ddActor( $dd_name, $actor_mod, $elem, $elemclass, $top_id, $top_val, [ $actor_group = FALSE])

[line 1960]

returns a drop down menu of actors

Tags:

  • author - Guy Hunt
  • since -

    0.6

    this function presupposes that you are using a module to contain your actor data

Parameters

  • $dd_name -
  • $actor_mod -
  • $elem -
  • $elemclass -
  • $top_id -
  • $top_val -
  • $actor_group -

[ Top ]

ddAlias

void ddAlias( int $top_id, mixed $top_val, string $lut, string $lang, string $dd_name, string $order, string $return_mode, [string $id_col = 'id'])

[line 2169]

provides a dropdown menu with language independant aliases. Creates a dd menu with an 'id | alias' type setup

Tags:

  • since - 0.5.1
  • access - public

Parameters

  • mixed $top_val - the value that appears when the page is loaded - mainly useful when on an edit form
  • int $top_id - the preloaded id - mainly useful when on an edit form
  • string $lut - the table (not necc an lut) from which we want to get the vars
  • string $lang - the lang for the aliases
  • string $dd_name - the name of the select tag (ie the 'name' part of the 'name=value' pair sent to the qrystr)
  • string $order - OPTIONAL sql in the format 'ORDER BY organisation', if not required then send FALSE
  • string $return_mode - either return the html code as a string (by sending 'code') or do a simple print (by sending 'html'.
  • string $id_col - OPTIONAL the name of the col to pull back as the 'id' value in the dropdown (if not specified the function defaults to 'id')

[ Top ]

ddAttr

void ddAttr( $top_id, $top_val, $lang, $attributetype, $return_mode)

[line 2277]

Parameters

  • $top_id -
  • $top_val -
  • $lang -
  • $attributetype -
  • $return_mode -

[ Top ]

ddSimple

string ddSimple( string $top_id, string $top_val, string $lut, string $nickname, string $dd_name, string $order, [string $return_mode = FALSE], [string $id_col = FALSE])

[line 2028]

makes a simple dropdown menu from the db

Tags:

  • return - a resolved XHTML string
  • author - Guy Hunt
  • since -

    0.1

    NOTE: makes a simple dd menu with an 'id | nickname' type of set up

    NOTE: do NOT use print mode anymore. this method is deprecated and will soon be abolished

Parameters

  • string $top_val - the value that appears when the page is loaded
  • string $top_id - the preloaded id - mainly useful when on an edit form
  • string $lut - the table (not necc an lut) from which we want to get the vars
  • string $nickname - the column name
  • string $dd_name - the name of the select tag
  • string $order - optional sql in the format 'ORDER BY organisation';
  • string $return_mode - either return the html code as a string or do a simple print
  • string $id_col - optional column name for the id of the

[ Top ]

ddUnique

string ddUnique( string $top_id, string $top_val, string $lut, string $nickname, string $dd_name, string $order, [string $id_col = FALSE])

[line 2108]

makes a dropdown of unique items menu from the db

Tags:

  • return - a resolved XHTML string
  • author - Guy Hunt
  • since -

    0.1

    NOTE: makes a simple dd menu with an 'id | nickname' type of set up

Parameters

  • string $top_val - the value that appears when the page is loaded
  • string $top_id - the preloaded id - mainly useful when on an edit form
  • string $lut - the table (not necc an lut) from which we want to get the vars
  • string $nickname - the column name
  • string $dd_name - the name of the select tag
  • string $order - optional sql in the format 'ORDER BY organisation';
  • string $id_col - optional column name for the id of the

[ Top ]

delFrag

array delFrag( string $class, int $frag_id, $cre_by, $cre_on)

[line 1713]

deletes fragments from the main class tables

delete functionality removes the row from the main table and logs this. in theory this permits rollbacks and revision history

Tags:

  • return - containing some feedback from the db as well as 'success' set TRUE/FALSE
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $class - the full class name to act on
  • int $frag_id - the frag id (row id number)
  • $cre_by -
  • $cre_on -

[ Top ]

dirList

array dirList( string $directory, [string $extension = FALSE])

[line 2845]

reads out the contents of a directory into an array

Tags:

  • return - containing a list of files in the directory
  • author - ?not sure? from php manual?
  • since - 0.4

Parameters

  • string $directory - the directory you want to list
  • string $extension - a file extension filter

[ Top ]

dynLink

void dynLink( string $dir, string $name, string $value)

[line 1838]

makes up those nice chevron links to move up and down records

Tags:

  • author - Guy Hunt
  • since -

    0.2

    FIXME: this function needs to be altered to return an xhtml string rather than printing direct

Parameters

  • string $dir - the direction of the link
  • string $name - the name of the name value pair
  • string $value - the value of the name value pair

[ Top ]

edtAction

array edtAction( int $action_id, $actorkey, $actorvalue, string $cre_by, string $cre_on, string $actor_itemkey, string $actor_itemvalue)

[line 525]

edits actions

Tags:

  • return - an array containing results info
  • author - Guy Hunt
  • since -

    0.3

    since 0.6 this has lost it's add/del functionality

Parameters

  • int $action_id - the frag id of teh action to edit
  • string $actor_itemkey - the actor itemkey
  • string $actor_itemvalue - the actor itemval
  • string $cre_by - the cre by
  • string $cre_on - the cre on
  • $actorkey -
  • $actorvalue -

[ Top ]

edtAttr

array edtAttr( string $attribute, boolean $bv, string $frag_id, string $cre_by, string $cre_on)

[line 658]

edits an attribute

this functionality is largely of use when using the boolean properties of attributes. as with all the edt and del functions this may only act on a specific frag id which is required. This edit functionality refers to the cor_tbl_attribute not to the lookup which is edited elsewhere

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since -

    0.1

    NOTE: that since 0.6 this function has lost add and del functionality

Parameters

  • string $attribute - the attribute fragment to update with
  • boolean $bv - TRUE or FALSE
  • string $frag_id - the id of this fragment row
  • string $cre_by - the frag creator user_id
  • string $cre_on - the frag creation datetime

[ Top ]

edtDate

array edtDate( string $date, string $date_id, string $cre_by, string $cre_on)

[line 765]

edits dates

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since -

    0.2

    NOTE 1: Only specific frags may be edited - identified by row id

    NOTE 2: Since v0.6 this function has lost add and del functionality

Parameters

  • string $date - the date fragment to update with
  • string $date_id - the id of this fragment row
  • string $cre_by - the frag creator user_id
  • string $cre_on - the frag creation datetime

[ Top ]

edtFile

array edtFile( string $itemkey, string $itemvalue, string $files, string $cre_by, string $cre_on)

[line 1532]

edits one or many files

Tags:

  • return - an array containing standardised results
  • author - Stuart Eve
  • since -

    0.6

    items in the list are checked against a result from the database. if items match exactly they are skipped. If they are not present in the db an add query is requested. If items are present in the db but not in the list a delete query is requested.

Parameters

  • string $itemkey - the itemkey of the item you are on
  • string $itemvalue - the itemvalue of the item you are on
  • string $files - a list of the desired files
  • string $cre_by - the record creator user_id
  • string $cre_on - the creation date of this record

[ Top ]

edtItemKey

array edtItemKey( $itemkey, $itemvalue, string $cre_by, string $cre_on, [string $modtype = FALSE], string $mod_short, string $mod_cd_val, string $mod_no_val, string $ste_cd)

[line 403]

updates the database entry for an itemkey in all modules

Tags:

  • return - containing number of affected rows and 'success' set true or false
  • author - Guy Hunt
  • since -

    0.5

    FIXME: Currently this is set to simply ignore edits to the cre_on this is to avoid some disturbing behavior in the matrix.

Parameters

  • string $mod_short - the three letter mod code
  • string $mod_cd_val - the fully resolved itemvalue of the item
  • string $mod_no_val - just the number
  • string $ste_cd - the site code
  • string $cre_by - the user_id of the record creator
  • string $cre_on - the creation date for this record
  • string $modtype - the modtype (if this module is using types)
  • $itemkey -
  • $itemvalue -

[ Top ]

edtMarkup

array edtMarkup( string $id, string $nname, string $markup, string $lang, string $description, string $cre_by, string $cre_on, [ $dry_run = FALSE])

[line 875]

edits markup

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Stuart Eve
  • since -

    0.6

    NOTE 1: Only specific frags may be edited - identified by row id

    NOTE 2: Since v0.6 this function has lost add and del functionality

Parameters

  • string $id - the id of the markup record
  • string $nname - the nickname of the markup
  • string $markup - the markup to add
  • string $lang - the language of the markup
  • string $description - the description of the markup
  • string $cre_by - the new markup creator
  • string $cre_on - the new date of creation
  • $dry_run -

[ Top ]

edtNumber

array edtNumber( string $num_id, string $num, string $cre_by, string $cre_on)

[line 983]

edits a number

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since -

    0.3

    NOTE 1: Only specific frags may be edited - identified by row id

    NOTE 2: Since v0.6 this function has lost add and del functionality

Parameters

  • string $num_id - the frag_id of the number
  • string $num - the number to update with
  • string $cre_by - the new frag creator
  • string $cre_on - the new date of creation

[ Top ]

edtSpan

array edtSpan( string $span_id, string $beg, string $end, string $cre_by, string $cre_on)

[line 1088]

edits a span in cor_tbl_span

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since -

    0.3

    NOTE 1: Only specific frags may be edited - identified by row id

    NOTE 2: Since v0.6 this function has lost add and del functionality

    FIXME: edtSpan is incomplete must be fixed

Parameters

  • string $span_id - the frag_id of the span
  • string $beg - the beg to update with
  • string $end - the end to update with
  • string $cre_by - the new frag creator
  • string $cre_on - the new date of creation

[ Top ]

edtSpanAttr

void edtSpanAttr( $span_id, $spanlabel, $cre_by, $cre_on)

[line 1188]

in theory this would edit a span attribute (unlikey)

Tags:

  • author - Guy Hunt
  • since -

    0.3

    lost add functionality and never had edt functionality anyway consider removing

Parameters

  • $span_id -
  • $spanlabel -
  • $cre_by -
  • $cre_on -

[ Top ]

edtTxt

array edtTxt( string $txt_id, string $txt, string $lang, string $cre_by, string $cre_on)

[line 1276]

makes update queries for the dataclass txt

Tags:

  • return - containing useful feedback including 'success' containing TRUE or FALSE
  • author - Guy Hunt
  • since -

    0.1

    NOTE 1: Only specific frags may be edited - identified by row id

    NOTE 2: It is anticipated that you will supply the $conf_log_XXX variable to the $log value However this does provide the option to override the conf setting in the process script Do this by specifying on/off rather than simply sending the conf

    NOTE 3: Since v0.6 this function has lost add and del functionality

Parameters

  • string $txt_id - the id of the texttype
  • string $txt - the text fragment to update with
  • string $lang - the language of the new snippet
  • string $cre_by - the new frag creator
  • string $cre_on - the new date of creation

[ Top ]

edtXmi

array edtXmi( string $itemkey, string $itemvalue, string $xmi_itemkey, string $list, string $ste_cd, string $cre_by, string $cre_on)

[line 1418]

edits one or many XMI links

Tags:

  • return - an array containing standardised results
  • author - Stuart Eve
  • author - Guy Hunt
  • since -

    0.6

    items in the list are checked against a result from the database. if items match exactly they are skipped. If they are not present in the db an add query is requested. If items are present in the db but not in the list a delete query is requested.

    Note: notes in addXmi also apply here

Parameters

  • string $itemkey - the itemkey of the item you are on
  • string $itemvalue - the itemvalue of the item you are on
  • string $xmi_itemkey - the itemkey of the mod you are linking to
  • string $list - the list of items you want to link to
  • string $ste_cd - the site code of listed items set FALSE if sending full itemvals
  • string $cre_by - the record creator user_id
  • string $cre_on - the creation date of this record

[ Top ]

feedBk

void feedBk( string $type)

[line 132]

output feedback to the user

Tags:

  • author - Guy Hunt
  • since -

    0.3

    DEV NOTE: The code from the two include files now ought to be formally brought in as a function. The calls should be cleaned up to pass the array to this func which should then unset the arrays. In the meantime, this function is basically just a placeholder for an idea

Parameters

  • string $type - the type of feedback to give either error or message

[ Top ]

frmElem

string frmElem( array $field, string $itemkey, [ $itemvalue = FALSE], [array $defaults = FALSE], string $value)

[line 4427]

returns a form element appropriate for a given field

this function does NOT go to the DB, send current values TO this func inside the field. Consider using resFdCurr() to pull the values

In order to return relevant form element this needs to handle various options: 1- The form is blank 2- The form is an edit and therefore needs filling with the current details

  • edits also need to return an id for the frag in a hidden field
3- The form needs filling with a default

If a field already has data, this needs to be processed by the subform and passed into the field array as 'current'

In the case of keys and modtypes the decision about the form elem to return is currently based on the presence/absence of the key/val pair

For other dataclasses the decision must be based on other factors at the top of each class

In the case of attributes, there is usually just a single drop down to handle 1- There is a menu to add attrs to the record 2- There is a menu to add attrs but we want to specify a default Bear in mind that a subform will have to be able to list out existing attrs and offer delete functionality. In addition, we will need to be able to offer functionality to add new attributes of a given type

This only returns the form element not a wrapper so it could be used to return form elements into other types of forms This presupposes that the rest of the form is being correctly setup

Tags:

  • return - a resolved form element to slip into your form
  • author - Guy Hunt
  • since - 0.5

Parameters

  • array $field - contains settings values for this field
  • string $itemkey - the itemkey
  • string $value - a value set to FALSE for a blank or a default
  • array $defaults - contains default settings for this element
  • $itemvalue -

[ Top ]

getLinkedFiles

array getLinkedFiles( string $itemkey, string $itemval, string $dir, $processed)

[line 5227]

checks to see if we have any files linked to this itemvalue

Tags:

  • return - an array containing the files assocaited with this item
  • author - Stuart Eve (stuarteve@lparchaeology.com)
  • since - 0.6

Parameters

  • string $itemkey - the itemkey of the current item
  • string $itemval - the itemval of the current item
  • string $dir - the current directory of the file
  • $processed -

[ Top ]

getLogVars

void getLogVars( $ref, $refid, $type)

[line 1775]

Parameters

  • $ref -
  • $refid -
  • $type -

[ Top ]

getSfState

string getSfState( string $column, string $view_state, string $edit_state)

[line 5049]

gets the state of subform

used to put together the 'state' of a subform. This state variable can then be used to inform a subform how it should render output (e.g. if the return state is "p_max_edit" then the subform would know that it has to render the output as if the the form was in a primary column, maximised and being edited)

for further info on the different return states see the wiki

Tags:

  • return - the concatenated state string
  • author - Stuart Eve
  • since - 0.5

Parameters

  • string $column - the column (either 'primary_col' or 'secondary_col')
  • string $view_state - the state of the view (either 'min' or 'max')
  • string $edit_state - the state of the view (either 'min' or 'max')

[ Top ]

getStylesheet

string getStylesheet( string $browser)

[line 5293]

chooses the correct stylesheet dependent on the detected browser

Tags:

  • return - string the path to the stylesheet
  • author - Stuart Eve
  • since -

    0.6

    Note: This used to be used as an include script from v0.1 to 0.6.

Parameters

  • string $browser -

[ Top ]

getWebHost

string getWebHost( )

[line 5486]

returns the fully resolved web host (including port)

Tags:

  • return - containing the webhost
  • author - Stuart Eve
  • since - 0.6

Parameters

[ Top ]

in_array_multi

boolean in_array_multi( string $needle, array $haystack)

[line 5111]

checks for a var in a multidim array

Tags:

  • return - TRUE or FALSE
  • author - (not too sure) possibly taken off the php.net manual
  • since - 0.4

Parameters

  • string $needle - the term to search for
  • array $haystack - the multidim array to search in

[ Top ]

isItemkey

void isItemkey( string $key)

[line 291]

runs a quick and dirty check on a string to see if it is in the format xxx_cd. Returns TRUE if it matches the pattern and FALSE if not

Tags:

  • since - 0.6
  • access - public

Parameters

  • string $key - the key to check

[ Top ]

itemValNatSort

array itemValNatSort( array $a, array $b)

[line 3910]

sorts itemvals into natural order

Tags:

  • return - sorted array
  • author - Guy Hunt
  • since -

    0.5

    NOTE: This function is used by the uasort() function which acts as a wrapper

Parameters

  • array $a - an array
  • array $b - an array

[ Top ]

loadFiles

array loadFiles( string $dir)

[line 5135]

lists files in a directory and returns the information as an array

Tags:

  • author - http://webxadmin.free.fr
  • since - 0.6

Parameters

  • string $dir - the directory to search

[ Top ]

logCmplxEvent

void logCmplxEvent( $event, $ref, $refid, $vars, $cre_by, $cre_on)

[line 1861]

Parameters

  • $event -
  • $ref -
  • $refid -
  • $vars -
  • $cre_by -
  • $cre_on -

[ Top ]

logEvent

void logEvent( $event, $vars, $cre_by, $cre_on)

[line 1891]

Parameters

  • $event -
  • $vars -
  • $cre_by -
  • $cre_on -

[ Top ]

makeUsername

void makeUsername( $firstname, $lastname, $init, $type)

[line 2544]

Parameters

  • $firstname -
  • $lastname -
  • $init -
  • $type -

[ Top ]

mkChat

string mkChat( array $snip_array)

[line 2932]

makes up the chat style output for searches

Tags:

  • return - a resolved xhtml string
  • author - Guy Hunt
  • since - 0.4

Parameters

  • array $snip_array - containing the snippets to make into the chat

[ Top ]

mkLeftPanelLink

$var mkLeftPanelLink( array $left_panel)

[line 3860]

takes the left panel array from the settings file and creates a link

Tags:

  • return - string the left panel link
  • author - Henriette Roued
  • since - v0.6

Parameters

  • array $left_panel - the left panel array from the settings file

[ Top ]

mkNavItem

string mkNavItem( string $mode, string $button, string $item_key, string $default, [string $link = FALSE])

[line 3305]

makes an itemvalue jumper

Tags:

  • return - a fully resolved XHTML string
  • author - Guy Hunt
  • author - Henriette Roued Olsen
  • author - Stuart Eve
  • since -

    0.6

    NOTE: This has been available as a script (inc_itemkey_nav.php) since at least version 0.2. The original script was intended to do more that just present a navigation tool, it was supposed to handle the request of the itemvalue and also set up errors if this was missing. For this reason, calls to this function may need to be wrapped correctly in order to not break expected behaviour further down the parse order.

Parameters

  • string $mode - sets output to be a dd or an input type text (options, plain, dd, or live)
  • string $button - markup nickname of the button text
  • string $item_key - sets output to be a dd or an input type text
  • string $default - whatever you want in the box
  • string $link - if not linking to same page you can add another page to link to here.

[ Top ]

mkNavLang

string mkNavLang( [string $qstr = FALSE])

[line 3219]

makes up a navigation list for languages

Tags:

  • return - a resolved xhtml list
  • author - Guy Hunt
  • since -

    0.6

    NOTE: This has been available as a script (inc_itemkey_nav.php) since at least version 0.2.

Parameters

  • string $qstr - the query string (ie everything after the ?)

[ Top ]

mkNavMain

string mkNavMain( array $pages, [array $links = FALSE], [ $hide = FALSE])

[line 3160]

makes up ARK main navigation bar

Tags:

  • return - a resolved xhtml string
  • author - Guy Hunt
  • since -

    0.6

    NOTE 1: this function existed in script form as inc_main_nav.php since 0.1

    NOTE 2: this function makes up the nav bar from two arrays. The first is an array of pages that are authorised for this viewer. The second is a array of links configured by the admin and held in the settings file

    NOTE 3: the info arrays will be outputted in the order pages -> links. The arrays should be in the format array('file' => X, 'vars' => X, 'label' => X)

    NOTE 4: the pages array is generally created by inc_auth

    FIX ME: this needs a better means of selecting the active page

Parameters

  • array $pages - information about the pages
  • array $links - information about static links
  • $hide -

[ Top ]

mkNavPage

void mkNavPage( string $page, string $total, string $url)

[line 2634]

makes out a navigation tool for the paged results

Tags:

  • author - Stuart Eve
  • since -

    0.3

    NOTE: Since 0.6 this function is renamed mkNavPage() from printPagingNav(). It also now returns a resolved XHTML string and does not print to screen

Parameters

  • string $page - the current page
  • string $total - the total number of pages
  • string $url - the url to jump to when someone clicks on the link

[ Top ]

mkNavRows

void mkNavRows( $perpage, $label, $go)

[line 2667]

makes a navigation box to select the number of rows per page in paged result sets

Tags:

  • author - Guy Hunt
  • since -

    0.6

    This has been available as a script (inc_pagination_nav.php) from 0.3 to 0.6

Parameters

  • $perpage -
  • $label -
  • $go -

[ Top ]

mkResMeta

string mkResMeta( array $item_meta)

[line 3002]

makes up the item meta for chat style output for searches

Tags:

  • return - a resolved xhtml string
  • author - Guy Hunt
  • since - 0.6

Parameters

  • array $item_meta - containing the meta to make into the chat

[ Top ]

mkSearchBox

$var mkSearchBox( )

[line 3757]

makes the freetext search box for any page in ark

Tags:

  • return - string the searchbox
  • author - Guy Hunt
  • since -

    v0.6

    Note that this existed as the script inc_search_box.php since v0.4 use of the inc is now deprecated

Parameters

[ Top ]

mkSearchSimple

void mkSearchSimple( $prefix, $link_vars, [ $mod = FALSE], [ $meta_display = FALSE], string $msrc)

[line 3597]

makes a simple search window

Tags:

  • author - Guy Hunt
  • since -

    NOTE: This is largely a wrapper and display function

    NOTE: This is ideally suited to use in subforms

Parameters

  • string $msrc - the mini search criteria
  • $prefix -
  • $link_vars -
  • $mod -
  • $meta_display -

[ Top ]

mkSearchType

string mkSearchType( $modes, $name, string $item_key, string $default, $width, [string $link = FALSE], string $mode, string $button)

[line 3379]

makes an searchbox

Tags:

  • return - a fully resolved XHTML string
  • author - Henriette Roued Olsen
  • since - 0.6

Parameters

  • string $mode - sets output to be a dd or an input type text (options, plain, dd, or live)
  • string $button - markup nickname of the button text
  • string $item_key - sets output to be a dd or an input type text
  • string $default - whatever you want in the box
  • string $link - if not linking to same page you can add another page to link to here.
  • $modes -
  • $name -
  • $width -

[ Top ]

mkSteCdNav

$var mkSteCdNav( )

[line 3797]

makes the site code navigator for use in forms

Tags:

  • return - string the site code navigator
  • author - Stuart Eve
  • since -

    v0.6

    Note that this existed as the script inc_ste_cd_nav.php since v0.4 use of the inc is now deprecated

Parameters

[ Top ]

mkTitle

string mkTitle( string $itemkey, string $itemval, array $title_vars)

[line 3033]

makes up titles or citations from various elements

Tags:

  • return - a resolved xhtml string
  • author - Guy Hunt
  • since - 0.6

Parameters

  • string $itemkey - the itemkey
  • string $itemval - the item value
  • array $title_vars - containing the bits to include in the citation

[ Top ]

mkTl

void mkTl( array $ranges, int $tl_width)

[line 3442]

makes an xhtml timeline out of a getSpan() result

Tags:

  • author - Guy Hunt
  • since - 0.5

Parameters

  • array $ranges - contains the results of a getSpan()
  • int $tl_width - sets the width of teh timeline in pixels

[ Top ]

modBr

string modBr( string $key, string $val, array $conf_br)

[line 2454]

returns a resolved xhtml string wrapping an item

Tags:

  • return - var the resolved string
  • author - Guy Hunt
  • since -

    0.6

    NOTE 1: This existed as a context specific function until 0.6

    NOTE 2: The array of wrap tags needs to be set up as follows: Set this up in mod_MOD_settings. This example sets rounded brackets for modtype 1 and square brackets for modtype 2 $conf_br = array( 'type_1_L' => '(', 'type_1_R' => ')', 'type_2_L' => '[', 'type_2_R' => ']', 'type_3_L' => '', 'type_3_R' => '*' );

Parameters

  • string $key - the full item key
  • string $val - the full item value
  • array $conf_br - an array containing the tags in which to wrap the itemkey

[ Top ]

outpList

void outpList( string $list_type, string $list_id, string $list_class, string $item_class, array $values, string $return_mode)

[line 1927]

returns an xhtml list from a php array

Tags:

  • author - Guy Hunt
  • since -

    0.4

    FIXME: Remove the output mode and simply return a string

Parameters

  • string $list_type - either ul or ol
  • string $list_id - optional id value for the list
  • string $list_class - optional css class for the list
  • string $item_class - optional css class for the items
  • array $values - a simple array of values
  • string $return_mode - code or html

[ Top ]

pageResults

array pageResults( array $search_results, array $page, array $limit)

[line 2578]

pages a results array for display

Tags:

  • return - containing ['paged_results'] the relevant slice of the results ['total'] the number of pages available ['page'] the current page
  • author - Stuart Eve
  • since - 0.3

Parameters

  • array $search_results - containing the unpaged results
  • array $page - the current page being displayed
  • array $limit - the number of records by page

[ Top ]

printError

void printError( array $error)

[line 5370]

prints out the human readable error element ('vars')

Tags:

  • author - Stuart Eve
  • since -

    0.6

    Note: this error print function was an inc script from v0.1 to 0.6

Parameters

  • array $error - an array containing vars

[ Top ]

printPre

void printPre( array $array)

[line 3888]

runs print_r within

Tags:

  • author - Guy Hunt
  • since - 0.4

Parameters

  • array $array - the array to print

[ Top ]

processFiles

int processFiles( string $dir, string $batch, string $module, string $cre_by, string $cre_on, [array $size = array('arkthumb_width' =&gt; 150, 'arkthumb_height' =&gt; 150,'webthumb_width' =&gt; 500,'webthumb_height' =&gt; 500)], [string $orig_file_dir = FALSE])

[line 1586]

processes a set of files (thumbnailing, registering and renaming)

Tags:

  • return - the total number of files processed
  • author - Stuart Eve (stuarteve@lparchaeology.com)
  • since - 0.6

Parameters

  • string $dir - the dir containing the file
  • string $batch - the batch to assign the file to
  • string $module - the module to assign the file to
  • string $cre_by - the cre by
  • string $cre_on - the cre on
  • array $size - an array containing the thumbnail sizes (if you want to specify them)
  • string $orig_file_dir - if you want to store the main files somewhere else you can specify it here

[ Top ]

registerFile

array registerFile( array $file, string $batch, string $module, string $cre_by, string $cre_on)

[line 1664]

registers a file

Tags:

  • author - Stuart Eve (stuarteve@lparchaeology.com)
  • since - 0.6

Parameters

  • array $file - the file to process
  • string $batch - the batch to assign the file to
  • string $module - the module to assign the file to
  • string $cre_by - the cre by
  • string $cre_on - the cre on

[ Top ]

reqArkVar

void reqArkVar( string $var, [string $default = FALSE])

[line 93]

handles a setup procedure for vars which is common in ARK. This

checks for the var in the querystring, then in the session then for a default. The var if set is saved into the session. Returns FALSE if the var cant be set

Tags:

  • since - 0.6
  • access - public

Parameters

  • string $var - the name of the var to set up
  • string $default - an optional default setting for the var

[ Top ]

reqQst

void reqQst( array $array, string $var)

[line 60]

cleanly requests a var from an array and returns false if relevant

typically this is used to request from the querystring or session. Using this function will avoid unwanted e_notices for unset variables as it returns FALSE to your var thereby setting it

Tags:

  • since - 0.4
  • access - public

Parameters

  • array $array - the array to search in (typically $_REQUEST)
  • string $var - the name fo the var to search for (the key in the array)

[ Top ]

resFdCurr

array resFdCurr( array $field, string $itemkey, string $itemvalue)

[line 4258]

returns the current contents of a field in an array with the frag id

Tags:

  • return - an array of arrays each containing 'id' the frag id and 'current' the current value
  • author - Guy Hunt
  • since -

    0.6

    DEV NOTE: this function can be used as an alternative to resTblTd but bear in mind that it returns the data unmarked up and in an array

Parameters

  • array $field - containing settings for this field
  • string $itemkey - the itemkey
  • string $itemvalue - the itemvalue

[ Top ]

resTblTd

string resTblTd( array $field, string $itemkey, string $itemvalue)

[line 4052]

returns the contents of a field in display mode

Tags:

  • return - a resolved html string
  • author - Guy Hunt
  • since -

    0.5

    DEV NOTE: this function needs to be renamed as it can handle any fields not just table fields. This was developed to do table cell contents

Parameters

  • array $field - containing settings for this field
  • string $itemkey - the itemkey
  • string $itemvalue - the itemvalue

[ Top ]

resTblTh

array resTblTh( array $fields, [string $mode = FALSE])

[line 3976]

makes up form and table headers

makes up headers for forms and tables. Creates aliases for the fields/columns and returns this information into the fields array. By default the function. prints a table header row containing the headers. If mode is set to silent the function simply processes and returns the aliased fields array

Tags:

  • return - contains the modified fields array
  • author - Guy Hunt
  • since - 0.5

Parameters

  • array $fields - containing information about each field in a form/table
  • string $mode - should be set to 'silent' if no table header row is needed

[ Top ]

sfNav

$sf_nav sfNav( string $sf_title, string $col_no, string $sf_id, array $disp_cols)

[line 2694]

returns a navigation bar for a subform

Tags:

  • return - a fully resolved xhtml string
  • author - Andy Dufton
  • author - Guy Hunt
  • since - 0.5

Parameters

  • string $sf_title - the string to print into the header
  • string $col_no - the column number
  • string $sf_id - the id of this subform
  • array $disp_cols - containing the columns to display

[ Top ]

sortResArr

array sortResArr( array $results_array, [string $type = FALSE], [ $col = FALSE])

[line 3932]

sorts multidim arrays on a given column (eg the results array by score)

Tags:

  • return - the sorted results array
  • author - Guy Hunt
  • since -

    0.4

    NOTE: the types of sort are: default(FALSE), ITEMVAL and SORT_ASC

Parameters

  • array $results_array - the results array
  • string $type - the column to sort on (default: FALSE, will use 'score')
  • $col -

[ Top ]

splitDate

string splitDate( string $rawdate, string $datestyle)

[line 219]

splits a date

Tags:

  • author - Guy Hunt
  • since - 0.3

Parameters

  • string $rawdate - the date to split
  • string $datestyle - the desired format to return

[ Top ]

splitItemkey

string splitItemkey( string $itemkey)

[line 190]

splitItemkey() splits an itemkey and returns only the three letter mod code

Tags:

  • return - just the three letter mod code
  • since - 0.6
  • access - public

Parameters

  • string $itemkey - the itemkey to be split

[ Top ]

splitItemval

string splitItemval( string $itemval, [string $ste_cd = FALSE])

[line 157]

splitItemval() splits an itemval and returns only the number. If TRUE is supplied to the $ste_cd param it will return the site code instead of the number

Tags:

  • return - only the number element of the itemval
  • since - 0.6
  • access - public

Parameters

  • string $itemval - the itemvalue to be split
  • string $ste_cd - an optional flag to return the site code not the number

[ Top ]

thumbnailFiles

array thumbnailFiles( array $files, $file_dir, string $thumb_dir, string $webthumb_dir, [int $thumb_width = 120], [int $thumb_height = 80], [int $webthumb_width = 400], [int $webthumb_height = 300])

[line 5201]

thumbnails a file or files

Tags:

  • author - Stuart Eve (stuarteve@lparchaeology.com)
  • since - 0.6

Parameters

  • array $files - the file to process
  • string $thumb_dir - the current directory of the file
  • string $webthumb_dir - the directory to put the new files
  • int $thumb_width - the width of the thumbs (default = 120)
  • int $thumb_height - the height of the thumbs (default = 80)
  • int $webthumb_width - the width of the webthumbs (default = 400)
  • int $webthumb_height - the height of the webthumbs (default = 300)
  • $file_dir -

[ Top ]


Documentation generated on Thu, 26 Feb 2009 16:48:22 +0000 by phpDocumentor 1.4.1