Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Supported Apis
Global Action::canExecute ($actname, $appid="")
verify if an action can be executed
Parameters
string$actnameaction name
string$appidapplication name or application id (default is the current application)
Returns
string with error message if the user cannot execute the given action, or an empty string if the user can execute the action
Global Action::exitError ($texterr, $exit=true, $code="")
abort action execution
Global ActionUsage::getUsage ()
Get usage for action funtion
Returns
mixed|string
Global ApiUsage::addEmptyParameter ($argName, $argDefinition="")
add empty argument (argument with boolean value)
Global ApiUsage::addHiddenParameter ($argName, $argDefinition)
add an empty parameter
Global ApiUsage::addOptionalParameter ($argName, $argDefinition, $restriction=null, $default=null)
add optional argument
Global ApiUsage::addRequiredParameter ($argName, $argDefinition, $restriction=null)
add needed argument
Global ApiUsage::setDefinitionText ($text)
add textual definition of program
Parameters
string$textusage text
Global ApiUsage::setStrictMode ($strict=true)
set strict mode
Global ApiUsage::verify ($useException=false)
Verify if wsh's program arguments are valid
Parameters
bool$useExceptionif true throw ApiUsageException when verify is not successful
Global Application::addCssCode ($code)
Add a CSS code in an action
Global Application::addCssRef ($ref, $needparse=null, $packName= '')
Add a CSS in an action
Global Application::addJsCode ($code)
Add a JS code in an action
Global Application::addJsRef ($ref, $needparse=false, $packName= '')
Add a JS in an action
Global Application::getCssLink ($ref, $needparse=null, $packName= '')
Get the src of a CSS with dynacase cache
Global Application::getImageLink ($img, $detectstyle=true, $size=null)
get image url of an application
Parameters
string$imgimage filename
bool$detectstyleto use theme image instead of original
int$sizeto use image with another width (in pixel) - null is original size
Returns
string url to download image
Global Application::getJsLink ($ref, $needparse=false, $packName= '')
Get the src of a JS with dynacase cache
Global ApplicationParameterManager::getParameterValue ($application, $parameterName)
Get parameter in the database
Parameters
string | int | Application$applicationlogical name or id or object of the application, you can use ApplicationParameterManager::CURRENT_APPLICATION or ApplicationParameterManager::GLOBAL_PARAMETER
string$parameterNamelogical name of the parameter
Global ApplicationParameterManager::getScopedParameterValue ($parameter)
Get the value of the parameter in the scope of the current action
Global ApplicationParameterManager::setParameterValue ($application, $parameterName, $value)
Set a parameter value
Parameters
string | int | Application$applicationlogical name or id or object of the application, you can use ApplicationParameterManager::CURRENT_APPLICATION or ApplicationParameterManager::GLOBAL_PARAMETER
string$parameterNamelogical name of the parameter
string$valuevalue of the parameter
Global Dir::insertDocument ($docid, $mode="latest", $noprepost=false, $forcerestrict=false, $nocontrol=false)
add a document reference in this folder
Global Dir::insertMultipleDocuments (array $tdocs, $mode="latest", $noprepost=false, &$tinserted=array(), &$twarning=array(), &$info=array())
insert multiple document reference in this folder
Global Dir::postInsertDocument ($docid, $multiple=false)
hook method called after insert document in folder
See Also
Dir::insertDocument
Parameters
int$dociddocument identifier to insert
bool$multipleflag to indicate if the insertion is a part of grouped insertion
Returns
string error message
Global Dir::postInsertMultipleDocuments ($tdocid)
hook method called after insert several documents in folder
See Also
Dir::insertMultipleDocuments
Dir::postInsertDocument
Global Dir::postRemoveDocument ($docid, $multiple=false)
hook method use after remove document of folder
Global Dir::preInsertDocument ($docid, $multiple=false)
hook method use before insert document in folder
Global Dir::preInsertMultipleDocuments ($tdocid)
hook method called before insert several documents in folder
See Also
Dir::preInsertDocument
Dir::insertMultipleDocuments
Global Dir::preRemoveDocument ($docid, $multiple=false)
hook method use before remove document to folder
Global Dir::removeDocument ($docid, $noprepost=false, $nocontrol=false)
remove a document reference from this folder
Global Doc::addArrayRow ($idAttr, $tv, $index=-1)
add new row in an array attribute
Parameters
string$idAttridentifier of array attribute
array$tvvalues of each column. Array index must be the attribute identifier
int$index$index row (first is 0) -1 at the end; x means before x row
Returns
string error message, if no error empty string
Global Doc::addHistoryEntry ($comment= '', $level=DocHisto::INFO, $code= '', $uid= '')
Add a comment message in history document
Parameters
string$commentthe comment to add
int$levellevel of comment DocHisto::INFO, DocHisto::ERROR, DocHisto::NOTICE DocHisto::MESSAGE, DocHisto::WARNING
string$codeuse when memorize notification
string$uiduser identifier : by default its the current user
Returns
string error message
Global Doc::arrayToRawValue ($v, $br= '< BR >')
convert array value to flat attribute value
Parameters
array$v
string$br
Returns
string
Global Doc::attachTimer (&$timer, $origin=null, $execdate=null)
Attach timer to a document
Returns
string error - empty if no error -
Global Doc::clearArrayValues ($idAttr)
delete all attributes values of an array
Parameters
string$idAttridentifier of array attribute
Returns
string error message, if no error empty string
Global Doc::clearValue ($attrid)
clear value of an attribute
Returns
string error message
Global Doc::delete ($really=false, $control=true, $nopost=false)
Delete document
Parameters
bool$reallyif true really delete from database
bool$controlif false don't control 'delete' acl
bool$nopostif true don't call Doc::postDelete and Doc::preDelete
Returns
string error message
Global Doc::disableEditControl ()
disable edit control for setValue/modify/store
Global Doc::duplicate ($temporary=false, $control=true, $linkfld=false, $copyfile=false)
duplicate document
Parameters
bool$temporaryif true the document create it as temporary document
bool$controlif false don't control acl create (generaly use when temporary is true)
bool$linkfldif true and document is a folder then document included in folder are also inserted in the copy (are not duplicated) just linked
bool$copyfileif true duplicate files of the document
Returns
Doc|string in case of error return a string that indicate the error
Global Doc::enableEditControl ()
default edit control enable
Global Doc::getArrayRawValues ($idAttr, $index=-1)
get all values for an array attribute
Parameters
string$idAttridentifier of array attribute
int$indexthe values for $index row (default value -1 means all values)
Returns
array|false all values of array order by rows (return false if not an array attribute)
Global Doc::getAttachedTimers ()
Get all timer attached to the document
Returns
array of doctimer values
Global Doc::getAttribute ($idAttr, &$oa=null, $useMask=true)
get attribute object
Parameters
string$idAttrattribute identifier
BasicAttribute&$oaobject reference use this if want to modify attribute
bool$useMaskset to false to not apply mask if needed (quick access mode)
Returns
BasicAttribute|bool|NormalAttribute
Global Doc::getCustomSearchValues ()
Hook to add values used in general searches
Returns
string
Global Doc::getCustomTitle ()
hook called in refresh title this method can be redefined in child family to compose specific title
Global Doc::getDate ($daydelta=0, $dayhour="", $daymin="", $getlocale=false)
get date
Parameters
int$daydeltato have the current date more or less day (-1 means yesterday, 1 tomorrow)
int | string$dayhourhours of day
int | string$dayminminutes of day
bool$getlocalewhether to return locale date or not
Returns
string YYYY-MM-DD or DD/MM/YYYY (depend of CORE_LCDATE parameter) or locale dateDD/MM/YYYY or locale date
Global Doc::getDocAnchor ($id, $target="_self", $htmllink=true, $title=false, $js=true, $docrev="latest", $viewIcon=false)
return an html anchor to a document
Parameters
int$ididentifier of document
string$targetwindow target
bool$htmllinkmust be true else return nothing
bool | string$titleshould we override default title
bool$jsshould we add a javascript contextual menu
string$docrevstyle of link (default:latest, other values: fixed or state(xxx))
bool$viewIconset to true to have icon in html link
Returns
string the html anchor
Global Doc::getFamilyDocument ()
return family odcument
Returns
DocFam
Global Doc::getFamilyParameterValue ($idp, $def="")
return family parameter value
Parameters
string$idpparameter identifier
string$defdefault value if parameter not found or if it is null
Note
The value of parameter can come from inherited family if its own value is empty. The value of parameter comes from default configuration value if no one value are set in its family or in a parent family. the default configuration value comes from inherited family if no default configuration. In last case, if no values and no configurated default values, the $def argument is returned
Returns
string parameter value
Global Doc::getLatestId ($fixed=false, $forcequery=false)
get latest id of document
Parameters
bool$fixedif true latest fixed revision
bool$forcequeryif true force recompute of id (use it in case of modification by another program)
Returns
int identifier of latest revision
Global Doc::getMultipleRawValues ($idAttr, $def="", $index=-1)
return all values of a multiple value attribute the attribute must be in an array or declared with multiple option
Parameters
string$idAttridentifier of list attribute
string$defdefault value returned if attribute not found or if is empty
int$indexthe values for $index row (default value -1 means all values)
Returns
array|string the list of attribute values
Global Doc::getOldRawValue ($attrid)
get previous value of an attribute
Parameters
string$attridattribute identifier
Returns
string the old value (false if not modified before)
Global Doc::getOldRawValues ()
get all modified values from last modify
Returns
array indexed by attribute identifier (lowercase)
Global Doc::getPropertyValue ($prop)
get property value
Parameters
string$propproperty identifier
Returns
string false if not an property
Global Doc::getRawValue ($idAttr, $def="")
get the value of an attribute
Parameters
string$idAttrattribute identifier
string$defdefault value returned if attribute not found or if is empty
$doc = new_Doc('',7498 );
if ($doc->isAlive()) {
$rev = $doc->getPropertyValue('revision');
$order = $doc->getRawValue("tst_order");
$level = $doc->getRawValue("tst_level","0");
}
See Also
Doc::getAttributeValue
Returns
string the attribute value
Global Doc::getState ()
get the state of a document
Returns
string the state - empty if no state
Global Doc::getTitle ($id="-1", $def="", $latest=false)
get document's title
Parameters
string$ididentifier of document (if not set use current document)
string$defdefault value if document not found
boolean$latestsearch title in latest revision
Returns
string
See Also
Doc::getCustomTitle()
Global Doc::hasPermission ($aclName, $strict=false)
control document access
Parameters
string$aclNameidentifier of the privilege to test
bool$strictset tio true to test without notion of account susbstitute
Returns
bool return true if access $aclName is granted, false else
Global Doc::isAlive ()
verify that the document exists and is not in trash
Returns
bool
Global Doc::isChanged ()
test if document attributes are changed
Returns
bool
Global Doc::postCopy (&$copyfrom)
hook called after duplicate document
Global Doc::postCreated ()
hook called when document is created in database
Returns
string error message
Global Doc::postDuplicate (&$copyfrom)
hook called after duplicate document
See Also
Doc::duplicate
Parameters
Doc$copyfrom
Returns
string
Global Doc::postImport (array $extra=array())
hook called when import document - after it is imported
Parameters
array$extraextra parameters
Returns
string warning message, if no warning empty string
Global Doc::postRefresh ()
hook called at the end of refresh after update computed attributes
Global Doc::postRevise ()
hook called when revise document - after it is revided
See Also
Doc::revise
Returns
string message - message is added to history
Global Doc::postStore ()
hook called in ::store()
Returns
string error message
Global Doc::postUndelete ()
hook called after undelete document
Returns
string warning message, if no warning empty string
Global Doc::preConsultation ()
hook called when compose view document web interface
Global Doc::preCreated ()
hook called before document is created in database
Returns
string error message
Global Doc::preDuplicate (&$copyfrom)
hook called before duplicate document
See Also
Doc::duplicate
Parameters
Doc$copyfromoriginal document
Returns
string
Global Doc::preEdition ()
hook called when compose edit document web interface
Global Doc::preImport (array $extra=array())
hook called when import document - before import it
Parameters
array$extraextra parameters
Returns
string error message, if no error empty string
Global Doc::preRefresh ()
hook called in begining of refresh before update computed attributes
Global Doc::preRevise ()
hook called when revise document - before revise it
See Also
Doc::revise
Returns
string error message, if no error empty string
Global Doc::preStore ()
hook called in Doc::store()
See Also
Doc::store()
Returns
string error message
Global Doc::preUndelete ()
hook called before undelete document
See Also
Doc::undelete
Returns
string error message, if no error empty string
Global Doc::rawValueToArray ($v)
convert flat attribute value to an array
See Also
Doc::getAttributeValue
Parameters
string$vvalue
Returns
array
Global Doc::refresh ()
refresh document by calling specRefresh and update computed attributes
Returns
string information message
Global Doc::removeArrayRow ($idAttr, $index)
delete a row in an array attribute
Parameters
string$index$index row (first is 0)
Returns
string error message, if no error empty string
Global Doc::setAttributeValue ($idAttr, $value)
Set a value to an attribute
Parameters
string$idAttrattribute identifier
mixed$valuethe new value - value format must be compatible with type
Exceptions
Dcp\Exception
See Also
ErrorCodeDoc::DOC0115
ErrorCodeDoc::DOC0117
Returns
void
Global Doc::setState ($newstate, $comment= '', $force=false, $withcontrol=true, $wm1=true, $wm2=true, $wneed=true, $wm0=true, $wm3=true, &$msg= '')
set state for a document controled by a workflow
Parameters
string$newstatethe new state
string$commentoptional comment to set in history
bool$forceis true when it is the second passage (without interactivity)
bool$withcontrolset to false if you want to not verify control permission ot transition
bool$wm1set to false if you want to not apply m1 methods
bool$wm2set to false if you want to not apply m2 methods
bool$wneedset to false to not test required attributes
bool$wm0set to false if you want to not apply m0 methods
bool$wm3set to false if you want to not apply m3 methods
string$msgreturn message from m2 or m3
Returns
string error message empty if no error
Global Doc::setValue ($attrid, $value, $index=-1, &$kvalue=null)
affect value for an attribute
See Also
Doc::setAttributeValue
Parameters
string$attridattribute identifier
string$valuenew value for the attribute
int$indexonly for array values affect value in a specific row
int&$kvaluein case of error the index of error (for arrays)
Returns
string error message, if no error empty string
Global Doc::store (&$info=null, $skipConstraint=false)
record new document or update it in database
Parameters
storeInfo$inforefresh and postStore messages
boolean$skipConstraintset to true to not test constraints
Returns
string error message
Global Doc::unattachTimer (&$timer)
Unattach timer of a document
Returns
string error - empty if no error -
Global Doc::undelete ()
restore deleted document
See Also
Doc::delete
Returns
string error message (empty message if no errors);
Global DocumentList::addDocumentIdentifiers (array $ids, $useInitid=true)
Set document identifiers to be used in iterator
Parameters
int[]$ids document identifiers
bool$useInitidif true identifier must ne initid else must be latest ids
Global DocumentList::count ()
Get number of returned documents
Returns
int
Global Layout::eSetBlockData ($p_nom_block, $data=NULL)
set data to fill a block
Parameters
string$p_nom_blockblock name
array$datadata to fill the block
Global Layout::gen ()
generate text from template
Returns
string the complete text
Global Layout::set ($tag, $val)
affect value to a key
Parameters
string$tag
string$val
Global Layout::setBlockData ($p_nom_block, $data=NULL)
set data to fill a block
Parameters
string$p_nom_blockblock name
array$datadata to fill the block
Global Log::__construct ($logfile="", $application="", $function="")
initialize log manager
Parameters
string$logfile
string$application
string$function
Global Log::debug ($string)
log with debug level
Parameters
string$stringmessage text
Global Log::deprecated ($string)
log with deprecated level
See Also
Log
Parameters
string$stringmessage text
Global Log::error ($string)
log with error level
Parameters
string$stringmessage text
Global Log::fatal ($string)
log with fatal level
Parameters
string$stringmessage text
Global Log::info ($string)
log with info level
Parameters
string$stringmessage text
Global Log::trace ($string)
log with trace level
Parameters
string$stringmesage text
Global Log::warning ($string)
log with warning level
Parameters
string$stringmessage text
Global SearchAccount::addFilter ($filter, $arg=null)
add sql filter about Account properties
$s->addFilter("mail ~ '%s'", $mailExpr);
Parameters
string$filtersql filter
string$argoptional arguments
Global SearchAccount::addGroupFilter ($group)
add group filter appartenance
Parameters
string$groupgroup name (login)
Exceptions
Dcp\Sacc\Exception
Global SearchAccount::addRoleFilter ($role)
add role filter appartenance
Parameters
string$rolerole reference (login)
Exceptions
Dcp\Sacc\Exception
Global SearchAccount::getLoginFromDocName ($name)
get login account from logical name document
Global SearchAccount::overrideViewControl ($override=true)
include accounts the user cannot view
Parameters
bool$override
Global SearchAccount::search ()
send search of account's object
Returns
DocumentList|AccountList
Global SearchAccount::setOrder ($order)
set order can be login, mail, id, firstname,… each Account properties
Parameters
string$order
Global SearchAccount::setReturnType ($type)
set object type return by search method
Global SearchAccount::setSlice ($slice)
set slice limit / "all" for no limit
Parameters
int | string$slice
Exceptions
Dcp\Sacc\Exception
Global SearchAccount::setStart ($start)
set start offset
Parameters
int$start
Exceptions
Dcp\Sacc\Exception
Global SearchAccount::setTypeFilter ($type)
set account type filter (only matching accounts will be returned)
$s->setTypeFilter($s::userType | $s::groupType);
Parameters
int$typecan be bitmask of SearchAccount::userType, SearchAccount::groupType,SearchAccount::roleType
Global SearchDoc::addFilter ($filter, $args= '')
add a new condition in filters
Parameters
string$filterthe filter string
string$argsarguments of the filter string (arguments are escaped to avoid sql injection)
Returns
void
Global SearchDoc::addGeneralFilter ($keywords, $useSpell=false, $usePartial=false)
add global filter based on keyword
Parameters
string$keywords
bool$useSpelluse spell french checker
bool$usePartialif true each words are defined as partial characters
Exceptions
\Dcp\SearchDoc\ExceptionSD0004 SD0003 SD0002
Global SearchDoc::count ()
count results after query search is sended
Global SearchDoc::excludeConfidential ($exclude=true)
add a filter to not return confidential
Parameters
boolean$excludeset to true to exclude confidential
Returns
void
Global SearchDoc::getDocumentList ()
get document iterator
Returns
DocumentList
Global SearchDoc::getError ()
get error message
Returns
string
Global SearchDoc::getIds ()
get only document identifiers
Returns
int[] document identifiers
Global SearchDoc::getNextDoc ()
get next document results
Global SearchDoc::getSearchInfo ()
get informations about query results
Returns
array of info
Global SearchDoc::join ($jointure)
Add join condition
$s=new searchDoc();
$s->trash='only';
$s->join("id = dochisto(id)");
$s->addFilter("dochisto.uid = %d",$this->getSystemUserId());
// search all document which has been deleted by search DELETE code in history
$s->addFilter("dochisto.code = 'DELETE'");
$s->distinct=true;
$result= $s->search();
Parameters
string$jointure
Exceptions
Dcp\Exception
Global SearchDoc::onlyCount ()
send query search and only count results
Global SearchDoc::overrideViewControl ()
no add view access criteria in final query
Returns
void
Global SearchDoc::search ()
send query
Returns
array|null|SearchDoc array of documents if no setObjectReturn else itself
Exceptions
Dcp\SearchDoc\Exception
Dcp\Db\Exception
Global SearchDoc::setObjectReturn ($returnobject=true)
set return type : document object or document array
Parameters
bool$returnobjectset to true to return object, false to return raw data
Returns
void
Global SearchDoc::setOrder ($order, $orderbyLabel= '')
set order to sort results
Parameters
string$orderthe new order, empty means no order
string$orderbyLabelstring of comma separated columns names on which the order should be performed on their label instead of their value (e.g. order enum by their label instead of their key)
Returns
void
Global SearchDoc::setPertinenceOrder ($keyword= '')
add a order based on keyword
Parameters
string$keyword
Global SearchDoc::setRecursiveSearch ($recursiveMode=true, $level=2)
set recursive mode for folder searches
See Also
SearchDoc::useCollection
Returns
void
Global SearchDoc::setSlice ($slice)
set maximum number of document to return
Parameters
int$slicethe limit ('ALL' means no limit)
Global SearchDoc::setStart ($start)
set offset where start the result window
Parameters
int$startthe offset (0 is the begin)
Global SearchDoc::useCollection ($dirid)
use folder or search document
Parameters
int$dirididentifier of the collection
← centre documentaire © anakeen