Niouzes

< Octobre 2021 >
Lu Ma Me Je Ve Sa Di
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Citation

Attention

The documentation is incomplete. The Vae Soli! team works hard to make it as exhaustive as possible with tons of useful examples and easy to understand explanations.

On top of that, we have decided to use our own tool to generate the documentation you read. This also takes time to fine-tune. Our goal is have better documentation, easier to read, easier to use, completely integrated with our site.

Even though NOT finalized, you can now link back to our documentation pages as we have decided once and for all about the structure of our documents and where they all reside on our server.

Thank you very much
The Vae Soli! team.

2020-01-18 à 01:24:43

Table Of Contents

  1. FOUNDATION (functions) (01/04/2015)
  2. LSAction (class) (01/04/2015)
  3. LSAddress (class) (01/04/2015)
  4. LSAdministrativeArea (class) (01/04/2015)
  5. LSApplication (class) (14/10/2013)
  6. LSArray (class) (14/10/2013)
  7. LSArticle (class) (18/02/2014)
  8. LSAssertion (class) (14/10/2013)
  9. LSAudience (class) (18/02/2014)
  10. AUTOLOAD (function) (21/04/2014)
  11. LSAutoReference (class) (14/10/2013)
  12. LSBag (class) (14/10/2013)
  13. LSBBCodes (class) (10/06/2014)
  14. LSBrowser (class) (14/10/2013)
  15. LSCache (class) (14/10/2013)
  16. LSCalculator (class) (14/10/2013)
  17. LSCalendar (class) (14/10/2013)
  18. LSCameraSnapshot (class) (14/10/2013)
  19. LSCitation (class) (14/10/2013)
  20. LSClass (class) (14/10/2013)
  21. LSCode (class) ()
  22. Colors (functions) (18/01/2020)
  23. LSContactForm (class) (14/10/2013)
  24. LSContainer (class) (14/10/2013)
  25. LSContents (class) (14/10/2013)
  26. LSContentsAccounts (class) (14/10/2013)
  27. LSContentsArticles (class) (14/10/2013)
  28. LSContentsAtomicClock (class) (14/10/2013)
  29. LSContentsBusinessCoordinates (class) (14/10/2013)
  30. LSContentsBusinessOff (class) (14/10/2013)
  31. LSContentsBusinessOpeningHours (class) (14/10/2013)
  32. LSContentsBreadcrumb (class) (14/10/2013)
  33. LSContentsCalendar (class) (14/10/2013)
  34. LSContentsCatalogue (class) (14/10/2013)
  35. LSContentsCharter (class) (18/02/2014)
  36. LSContentsCitation (class) (14/10/2013)
  37. LSContentsClock (class) (14/10/2013)
  38. LSContentsComments (class) (14/10/2013)
  39. LSContentsCookieUsage (class) (14/10/2013)
  40. LSContentsCountdown (class) (14/10/2013)
  41. LSContentsDatetime (class) (14/10/2013)
  42. LSContentsHeartbeat (class) (14/10/2013)
  43. LSContentsIFrame (class) (14/10/2013)
  44. LSContentsImageGallery (class) (14/10/2013)
  45. LSContentsLanguageSwitchers (class) (14/10/2013)
  46. LSContentsLegal (class) (18/02/2014)
  47. LSContentsMicronews (class) (14/10/2013)
  48. LSContentsMyAccount (class) (14/10/2013)
  49. LSContentsPaymentOptions (class) (14/10/2013)
  50. LSContentsPinboard (class) (14/10/2013)
  51. LSContentsRememberPassword (class) (14/10/2013)
  52. LSContentsRSS (class) (14/10/2013)
  53. LSContentsSiteManager (class) (14/10/2013)
  54. LSContentsSitemap (class) (14/10/2013)
  55. LSContentsShare (class) (14/10/2013)
  56. LSContentsStopwatch (class) (14/10/2013)
  57. LSContentsTagCloud (class) (14/10/2013)
  58. LSContentsTodosOnPage (class) (14/10/2013)
  59. LSContentsW3C (class) (14/10/2013)
  60. LSContentsWeather (class) (14/10/2013)
  61. LSControl (class) (14/10/2013)
  62. LSCreativeWork (class) (18/02/2014)
  63. LSCursor (class) (09/03/2015)
  64. LSCustomer (class) (14/10/2013)
  65. LSDataEnvironment (class) (14/10/2013)
  66. Dates (functions) (01/04/2015)
  67. LSDate (class) (14/10/2013)
  68. LSDictionary (class) (14/10/2013)
  69. LSDom, LSDomNode and LSXPath (class) (30/04/2014)
  70. LSErrors and LSError (classes) (14/10/2013)
  71. LSException (class) (16/10/2013)
  72. LSExplorer (class) (14/10/2013)
  73. LSFieldset (class) (14/10/2013)
  74. LSFile (class) (14/10/2013)
  75. LSFileProperties (class) (14/10/2013)
  76. Files (functions) (01/04/2015)
  77. Finance (functions) (01/04/2015)
  78. LSFootnotes (class) (22/02/2014)
  79. LSForm (class) (09/06/2014)
  80. LSFunction (class) (14/10/2013)
  81. LSGeorama (class) (24/10/2013)
  82. LSGeoramaVar (class) (24/10/2013)
  83. LSGlossary (class) (09/03/2015)
  84. LSGroup (class) (14/10/2013)
  85. HTML (functions) (01/04/2015)
  86. LSHttp (class) (14/10/2013)
  87. HTTP (functions) (01/04/2015)
  88. LSImageGallery (class) (14/10/2013)
  89. Images (functions) (01/04/2015)
  90. LSInput (class) (26/04/2014)
  91. IP (functions) (01/04/2015)
  92. LSIslandAbstract (14/10/2013)
  93. LSIslandFormAbstract (class) (14/10/2013)
  94. LSLabel (class) (14/10/2013)
  95. LSLanguageSwitchers (class) (14/10/2013)
  96. LSLatin (class) (14/10/2013)
  97. LSLegalPerson (class) (14/10/2013)
  98. LSLinkedList (class) (14/10/2013)
  99. LSList (class) (14/10/2013)
  100. Mails (functions) (01/04/2015)
  101. LSMap (class) (14/10/2013)
  102. Math (functions) (01/04/2015)
  103. LSMicronews (class) (18/02/2014)
  104. Miscellaneous (functions) (01/04/2015)
  105. LSModuleAbstract (class) (14/10/2013)
  106. LSNaturalPerson (class) (14/10/2013)
  107. LSNewsArticle (class) (18/02/2014)
  108. LSNote (class) (14/10/2013)
  109. LSMotherNature (class) (16/10/2013)
  110. LSPage (class) (18/02/2014)
  111. LSParameter (class) (14/10/2013)
  112. LSPaymentOptions (class) (14/10/2013)
  113. LSPeopleAudience (class) (18/02/2014)
  114. LSPerson (class) (14/10/2013)
  115. LSPlace (class) (18/02/2014)
  116. LSProperty (class) (14/10/2013)
  117. LSPublication (class) (14/10/2013)
  118. LSRequirement (class) (14/10/2013)
  119. LSReturn (class) (24/10/2013)
  120. LSRisk (class) (14/10/2013)
  121. LSSentanaiAbstract (14/10/2013)
  122. LSServiceMessage (class) (14/10/2013)
  123. LSSession (class) (14/10/2013)
  124. LSSiteManager (class) (14/10/2013)
  125. LSSitemap (class) (14/10/2013)
  126. LSSockets (class) (14/10/2013)
  127. LSSoftwareApplication (class) (18/02/2014)
  128. LSSource (class) (14/10/2013)
  129. Strings (functions) (31/07/2016)
  130. LSSupplier (class) (14/10/2013)
  131. System (functions) (01/04/2015)
  132. LSTag (class) (21/04/2014)
  133. LSTagCloud (class) (14/10/2013)
  134. LSTechArticle (class) (18/02/2014)
  135. LSThing (class) (18/02/2014)
  136. LSTimeline (class) (14/10/2013)
  137. LSTimer (class) (16/10/2013)
  138. LSTracer (class) (09/03/2015)
  139. LSUnitTesting (class) (14/10/2013)
  140. URL (functions) (01/04/2015)
  141. LSUser (class) (09/03/2015)
  142. LSUserMgr (class) (14/10/2013)
  143. LSVaesoli (class) (09/06/2014)
  144. LSVersion (class) (14/10/2013)
  145. LSWebSite (class) (14/10/2013)
  146. LSWidget (class) (14/10/2013)
  147. LSWireTransferForm (class) (14/10/2013)
  148. LSXMLSitemap (class) (14/10/2013)
  149. XML (functions) (01/04/2015)

LSGlossary.class.php

Generated by The Vae Soli! Documentor: Guide v. 1.3.0018 on 09-03-2015 09:36:39 (DD-MM-YYYY HH:mm:SS). This documentation is built with Vae Soli! functions and classes!

File Properties

C:\websites\vaesoli.org\www\httpdocs/vaesoli/include/LSGlossary.class.phpC:\websites\vaesoli.org\www\httpdocs\vaesoli\include\LSGlossary.class.phpapplication/force-downloadC:\websites\vaesoli.org\www\httpdocs\vaesoli\include38082 bytes03/08/2013 23:27:5230/01/2015 15:50:0430/01/2015 15:50:04

Compliance

Assertions count: 15

Assertions successful: 13

Assertion failures: 2

Manifest Constants

LS_GLOSSARY_CLASS_PWH: Define "LS" glossary (Pat Was Here)

VAESOLI_PATH: Define the path where Vae Soli! is installed

VAESOLI_PLUGINS: Define the path where plugins are located

Sources required

LSV.functions.php: Framework global functions

LSCursor.class.php: Cursor class

Classes

LSGlossary extends LSCursorGeneric services to handle a glossary (XML file)

Properties
NameVisibilityTypeDescription
$szStorage public string Physical file that represents the glossary
Parent Properties (LSCursor)
NameType
IsDebug boolean
IsReadonly boolean
NoDataOnLoad boolean
NoInclusionOnLoad boolean
WithCDATA boolean
aErrors array
iFrom integer
iMaxReccount integer
iTo integer
szComment NULL
szDataSource NULL
szDataSourceType integer
szFilter string
szName NULL
szOrder NULL
szOrderBy NULL
szOrderDir string
xCargo NULL
Methods
  1. __construct(): Class constructor
  2. Add(): Adds a term in the glossary No assertion found for Add() (0 - 0)
  3. Browse(): Browses entries of the glossary No assertion found for Browse() (0 - 0)
  4. Discard(): Removes an entry from the glossary No assertion found for Discard() (0 - 0)
  5. Find(): Search a term in the glossary No assertion found for Find() (0 - 0)
  6. FindByID(): Find a term in the glossary by its ID No assertion found for FindByID() (0 - 0)
  7. FindByTerm(): Find a term in the glossary No assertion found for FindByTerm() (0 - 0)
  8. FindFirst(): Find the first occurrence of a term in the glossary No assertion found for FindFirst() (0 - 0)
  9. FindNext(): Find the next occurrence of a term No assertion found for FindNext() (0 - 0)
  10. GetEntry(): Get the current entry of the glossary No assertion found for GetEntry() (0 - 0)
  11. Modify(): Replaces an entry in the glossary No assertion found for Modify() (0 - 0)
  12. Save(): Saves the glossary
  13. TableOfContents(): Returns an array of terms 1st-letters No assertion found for TableOfContents() (0 - 0)
__construct(): Class constructor

[ back to method list ]

Syntax

__construct( $szName,$szStorage )

Parameters
NameTypeDescription
$szName string Name of the glossary
$szStorage string Physical file name in which the glossary is stored
Return

(void)

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

if ( $oGlossary->Open() )
{
    echo "<p>There are ",$oGlossary->Reccount()," terms in the glossary</p>";
    echo LSUnitTesting::assert( $oGlossary->IsOpen()                                ,
                                'ASSERTION SUCCESSFUL: glossary successfully open'  ,
                                'ASSERTION FAILURE: cannot open glossary'           ,
                                'GuideAssert' );

    $oGlossary->Close();
}

There are 1358 terms in the glossary

GuideAssert() ... ASSERTION SUCCESSFUL: glossary successfully open

Unit Testing

1 assertions: 1 successful; 0 failed

Add(): Adds a term in the glossary

[ back to method list ]

Syntax

Add( $aEntry,$szDate,$szLupdate,$MustSave )

Parameters
NameTypeDescription
$aEntry array An associative array such as one returned by the GetEntry() method
$szDate string Creation date of the entry. Optional. null by default in which case the current date and time is assumed.
$szLupdate string Last update date of the entry. Optional. null by default.
$MustSave boolean Should the glossary be saved right after the addition. Optional. true by default
Parameters Warning

Add() uses 4 parameters whereas the suggested limit is 3.

Return

(bool) true if $aEntry added; false otherwise

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

$oGlossary->Open();
$iCount = $oGlossary->Reccount();

$aEntry = array();

$aEntry['class'   ] = 'IT';
$aEntry['keywords'] = '';
$aEntry['term'    ] = 'MD5';
$aEntry['value'   ] = 'New value';
$aEntry['lang'    ] = 'en';

if ( $bAdded = $oGlossary->Add( $aEntry,'20140806120100',null,false ) )
{
    var_dump( $aEntry = $oGlossary->getEntry() );
}

echo LSUnitTesting::assert( $bAdded                             &&
                            $aEntry['term'] === 'MD5'           &&
                            $aEntry['value'] === 'New value'    &&
                            $oGlossary->Reccount() === ( $iCount + 1 )  ,
                            'ASSERTION SUCCESSFUL: new term added'      ,
                            'ASSERTION FAILURE: new term NOT added'     ,
                            'GuideAssert' );

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20140806120100' (length=14)
  'lupdate' => string '' (length=0)
  'term' => string 'MD5' (length=3)
  'value' => string 'New value' (length=9)
  'lang' => string 'en' (length=2)
  'id' => string '1fef9118-1bbf-49f9-9735-25ba3d5e4bfb' (length=36)

GuideAssert() ... ASSERTION SUCCESSFUL: new term added

Unit Testing

1 assertions: 1 successful; 0 failed

Browse(): Browses entries of the glossary

[ back to method list ]

Warning

The Browse() method is provided for backward compatibility reasons. It should NOT be used at all. Please notice that it no longer does anything worth it.

Syntax

Browse( $szTerm,$szClass )

Parameters
NameTypeDescription
$szTerm string Starting term of the browse ('like' behavior)
$szClass string Class of the terms to browse. Optional. null by default.
Return

(void)

Unit Testing

WARNING: No Unit Testing found. Please provide assertions with assertion constructs ({*assert ... *}) or with GuideAssert() function calls in exec constructs ({*exec LSUnitTesting::assert(...); *}).

Discard(): Removes an entry from the glossary

[ back to method list ]

Syntax

Discard( $xID,$MustSave )

Parameters
NameTypeDescription
$xID mixed ID of the record to remove or an associative array such as one returned by the GetEntry() method.
$MustSave boolean Should the glossary be saved right after the replacement. Optional. true by default
Return

(bool) true if removal successful; false otherwise

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

$oGlossary->Open();
$iCount = $oGlossary->Reccount();

$aEntry = array();

$aEntry['class'   ] = 'IT';
$aEntry['keywords'] = '';
$aEntry['term'    ] = 'MD5';
$aEntry['value'   ] = 'New dummy value';
$aEntry['lang'    ] = 'en';

if ( $bAdded = $oGlossary->Add( $aEntry,'20140806120100',null,false ) )
{
    echo "<p>New entry added:</p>";
    var_dump( $aEntry = $oGlossary->getEntry() );
}

if ( $bRemoved = $oGlossary->Remove( $aEntry,false ) )
{
    echo "<p>New entry removed and glossary pointer points to:</p>";
    var_dump( $aEntry = $oGlossary->getEntry() );
}

echo LSUnitTesting::assert( $oGlossary->Reccount() === $iCount          ,
                            'ASSERTION SUCCESSFUL: new term removed'    ,
                            'ASSERTION FAILURE: new term NOT removed'   ,
                            'GuideAssert' );

New entry added:

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20140806120100' (length=14)
  'lupdate' => string '' (length=0)
  'term' => string 'MD5' (length=3)
  'value' => string 'New dummy value' (length=15)
  'lang' => string 'en' (length=2)
  'id' => string '33b56a65-a715-497e-a58f-2467fa48ac23' (length=36)

New entry removed and glossary pointer points to:

array (size=8)
  'class' => string 'GEN' (length=3)
  'keywords' => string '' (length=0)
  'date' => string '20150128133328' (length=14)
  'lupdate' => string '' (length=0)
  'term' => string 'PFH' (length=3)
  'value' => string 'Putain de Facteur Humain' (length=24)
  'lang' => string 'fr' (length=2)
  'id' => string '400fc9c4-add6-4ed6-9673-b5d81c60523a' (length=36)

GuideAssert() ... ASSERTION SUCCESSFUL: new term removed

Unit Testing

1 assertions: 1 successful; 0 failed

Find(): Search a term in the glossary

[ back to method list ]

Warning

So far (06-08-14 07:13:51) the $szClass parameter is disregarded by the method. Try to avoid using this method as much as possible. Head for the FindFirst() and FindNext() methods instead.

Syntax

Find( $szTerm,$szClass )

Parameters
NameTypeDescription
$szTerm string Term to look for
$szClass string Class of the term to look for. Optional. null by default.
Return

(bool) true if $szTerm found; false otherwise

Unit Testing

WARNING: No Unit Testing found. Please provide assertions with assertion constructs ({*assert ... *}) or with GuideAssert() function calls in exec constructs ({*exec LSUnitTesting::assert(...); *}).

FindByID(): Find a term in the glossary by its ID

[ back to method list ]

Remark

FindByID() acts as of the current position in the glossary. To make sure that the full glossary is scanned correctly, please issue a GoTop() method call BEFORE FindByID().

Syntax

FindByID( $szID )

Parameters
NameTypeDescription
$szID string ID of the term to locate
Return

(boolean) true if term of $szID id found; false if not

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

$oGlossary->Open();

if ( $bFound = $oGlossary->FindByID( '6690f643-440d-4f4d-9126-b779eb62c348' ) )
{
    var_dump( $aEntry = $oGlossary->GetEntry() );
}

echo LSUnitTesting::assert( $bFound && isset( $aEntry['value'] ) &&
                            $aEntry['value'] === 'Zeroconf Working Group'   ,
                            'ASSERTION SUCCESSFUL: ZWG successfully found'  ,
                            'ASSERTION FAILURE: ZWG NOT found'              ,
                            'GuideAssert' );

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20140102' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'ZWG' (length=3)
  'value' => string 'Zeroconf Working Group' (length=22)
  'lang' => string 'en' (length=2)
  'id' => string '6690f643-440d-4f4d-9126-b779eb62c348' (length=36)

GuideAssert() ... ASSERTION SUCCESSFUL: ZWG successfully found

Unit Testing

1 assertions: 1 successful; 0 failed

See Also

FindByTerm()

FindByTerm(): Find a term in the glossary

[ back to method list ]

Remark

FindByTerm() acts as of the current position in the glossary. To make sure that the full glossary is scanned correctly, please issue a GoTop() method call BEFORE FindByTerm().

Syntax

FindByTerm( $szTerm )

Parameters
NameTypeDescription
$szTerm string Term to look for
Return

(boolean) true if $szTerm found; false if not

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

$oGlossary->Open();

if ( $bFound = $oGlossary->FindByTerm( 'ZWG' ) )
{
    var_dump( $aEntry = $oGlossary->GetEntry());
}

echo LSUnitTesting::assert( $bFound && isset( $aEntry['value'] ) &&
                            $aEntry['value'] === 'Zeroconf Working Group'   ,
                            'ASSERTION SUCCESSFUL: ZWG successfully found'  ,
                            'ASSERTION FAILURE: ZWG NOT found'              ,
                            'GuideAssert' );

if ( $bFound = $oGlossary->FindByTerm( '1NF' ) )
{
    var_dump( $aEntry = $oGlossary->GetEntry());
}

echo LSUnitTesting::assert( ! $bFound                                                   ,
                            'ASSERTION SUCCESSFUL: 1NF not found, which was expected'   ,
                            'ASSERTION FAILURE: 1NF found, which is a problem'          ,
                            'GuideAssert' );

$oGlossary->GoTop();

if ( $bFound = $oGlossary->FindByTerm( '1NF' ) )
{
    var_dump( $aEntry = $oGlossary->GetEntry());
}

echo LSUnitTesting::assert( $bFound && isset( $aEntry['value'] ) &&
                            $aEntry['value'] === 'First Normal Form'            ,
                            'ASSERTION SUCCESSFUL: 1NF finally found'           ,
                            'ASSERTION FAILURE: 1NF not found, which is weird'  ,
                            'GuideAssert' );

// Find 1st entry for AAA
if ( $bFound = $oGlossary->FindByTerm( 'AAA' ) )
{
    $oGlossary->Skip();
    // Find 2nd entry for AAA
    if ( $bFound = $oGlossary->FindByTerm( 'AAA' ) )
    {
        var_dump( $aEntry = $oGlossary->GetEntry());
        echo LSUnitTesting::assert( $bFound && isset( $aEntry['value'] ) &&
                                    $aEntry['value'] === 'Authentication, Authorization and Accounting' ,
                                    'ASSERTION SUCCESSFUL: 2nd instance of AAA found'                   ,
                                    'ASSERTION FAILURE: 2nd instance of AAA NOT found'                  ,
                                    'GuideAssert' );
    }
}

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20140102' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'ZWG' (length=3)
  'value' => string 'Zeroconf Working Group' (length=22)
  'lang' => string 'en' (length=2)
  'id' => string '6690f643-440d-4f4d-9126-b779eb62c348' (length=36)

GuideAssert() ... ASSERTION SUCCESSFUL: ZWG successfully found

GuideAssert() ... ASSERTION SUCCESSFUL: 1NF not found, which was expected

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20140722' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string '1NF' (length=3)
  'value' => string 'First Normal Form' (length=17)
  'lang' => string 'en' (length=2)
  'id' => string '3752c229-eab5-4437-ab57-bb220c9e5ed1' (length=36)

GuideAssert() ... ASSERTION SUCCESSFUL: 1NF finally found

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20061229' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Authentication, Authorization and Accounting' (length=44)
  'lang' => string 'en' (length=2)
  'id' => string 'bb5f07c2-7571-4475-840e-ac4fff763f26' (length=36)

GuideAssert() ... ASSERTION SUCCESSFUL: 2nd instance of AAA found

Unit Testing

4 assertions: 4 successful; 0 failed

See Also

FindByID()

FindFirst(): Find the first occurrence of a term in the glossary

[ back to method list ]

Syntax

FindFirst( $szTerm,$szClass,$bExact )

Parameters
NameTypeDescription
$szTerm string Term to look for in the glossary.
$szClass string Class of the term to look for. Optional. null by default. NOT USED AT THE MOMENT: 05-08-14 16:54:01
$bExact boolean Exact match required. Optional. true by default
Return

(bool) true if $szTerm found; false otherwise

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

if ( $oGlossary->FindFirst( 'AAA' ) )
{
    var_dump( $aEntry = $oGlossary->GetEntry() );
    $i = 0;
    while ( $oGlossary->FindNext() && $i++ < 3 )
    {
        var_dump( $aEntry = $oGlossary->GetEntry() );
    }
}

echo LSUnitTesting::assert( $oGlossary->Reccount() >= 2                     ,
                            'ASSERTION SUCCESSFUL: considered successful'   ,
                            'ASSERTION FAILURE: considered failed'          ,
                            'GuideAssert' );

// No exact match would make it possible to query the glossary
// for terms that START with a given value (all terms starting with 'M'
// in the example here below)
if ( $oGlossary->FindFirst( $szLetter = 'M',null,false ) )
{
    echo "<p>",$oGlossary->Reccount()," entries found starting with '",$szLetter,"'</p>";
}

echo LSUnitTesting::assert( $oGlossary->Reccount() >= 40                                    ,
                            'ASSERTION SUCCESSFUL: \'M\' terms lookup considered successful',
                            'ASSERTION FAILURE: \'M\' terms lookup considered failed'       ,
                            'GuideAssert' );

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20080229' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Anywhere, Anything, Anytime' (length=27)
  'lang' => string 'en' (length=2)
  'id' => string 'bf3d9b4d-aeca-49e1-9df1-7beddfe3689c' (length=36)
array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20061229' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Authentication, Authorization and Accounting' (length=44)
  'lang' => string 'en' (length=2)
  'id' => string 'bb5f07c2-7571-4475-840e-ac4fff763f26' (length=36)
array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20150125230721' (length=14)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Autopsies And Analysis' (length=22)
  'lang' => string 'en' (length=2)
  'id' => string 'c88af5d2-8b09-4f18-8492-16f76c4d9e3b' (length=36)

GuideAssert() ... ASSERTION SUCCESSFUL: considered successful

60 entries found starting with 'M'

GuideAssert() ... ASSERTION SUCCESSFUL: 'M' terms lookup considered successful

Unit Testing

2 assertions: 2 successful; 0 failed

FindNext(): Find the next occurrence of a term

[ back to method list ]

Syntax

FindNext()

Parameters

None

Return

(bool) true if $szTerm initiated by the most immediate call of FindFirst() is found; false otherwise

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

if ( $oGlossary->FindFirst( 'AAA' ) )
{
    var_dump( $aEntry = $oGlossary->GetEntry());
    $i = 0;
    while ( $oGlossary->FindNext() && $i++ < 3 )
    {
        var_dump( $aEntry = $oGlossary->GetEntry());
    }
    echo LSUnitTesting::assert( $aEntry['id'] === 'bb5f07c2-7571-4475-840e-ac4fff763f26'    ,
                                'ASSERTION SUCCESSFUL: considered successful'               ,
                                'ASSERTION FAILURE: considered failed'                      ,
                                'GuideAssert' );
}

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20080229' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Anywhere, Anything, Anytime' (length=27)
  'lang' => string 'en' (length=2)
  'id' => string 'bf3d9b4d-aeca-49e1-9df1-7beddfe3689c' (length=36)
array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20061229' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Authentication, Authorization and Accounting' (length=44)
  'lang' => string 'en' (length=2)
  'id' => string 'bb5f07c2-7571-4475-840e-ac4fff763f26' (length=36)
array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20150125230721' (length=14)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Autopsies And Analysis' (length=22)
  'lang' => string 'en' (length=2)
  'id' => string 'c88af5d2-8b09-4f18-8492-16f76c4d9e3b' (length=36)

GuideAssert() ... ASSERTION FAILURE: considered failed

Unit Testing

1 assertions: 0 successful; 1 failed

GetEntry(): Get the current entry of the glossary

[ back to method list ]

Syntax

GetEntry()

Parameters

None

Return

(bool) true if $szTerm found; false otherwise

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

if ( $oGlossary->FindFirst( 'AAA' ) )
{
    var_dump( $aEntry = $oGlossary->GetEntry());
    $i = 0;
    while ( $oGlossary->FindNext() && $i++ < 3 )
    {
        var_dump( $aEntry = $oGlossary->GetEntry());
    }
    echo LSUnitTesting::assert( $aEntry['id'] === 'bb5f07c2-7571-4475-840e-ac4fff763f26'    ,
                                'ASSERTION SUCCESSFUL: considered successful'               ,
                                'ASSERTION FAILURE: considered failed'                      ,
                                'GuideAssert' );
}

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20080229' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Anywhere, Anything, Anytime' (length=27)
  'lang' => string 'en' (length=2)
  'id' => string 'bf3d9b4d-aeca-49e1-9df1-7beddfe3689c' (length=36)
array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20061229' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Authentication, Authorization and Accounting' (length=44)
  'lang' => string 'en' (length=2)
  'id' => string 'bb5f07c2-7571-4475-840e-ac4fff763f26' (length=36)
array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20150125230721' (length=14)
  'lupdate' => string '' (length=0)
  'term' => string 'AAA' (length=3)
  'value' => string 'Autopsies And Analysis' (length=22)
  'lang' => string 'en' (length=2)
  'id' => string 'c88af5d2-8b09-4f18-8492-16f76c4d9e3b' (length=36)

GuideAssert() ... ASSERTION FAILURE: considered failed

Unit Testing

1 assertions: 0 successful; 1 failed

Modify(): Replaces an entry in the glossary

[ back to method list ]

Syntax

Modify( $aEntry,$szDate,$szLupdate,$MustSave )

Parameters
NameTypeDescription
$aEntry array An associative array such as one returned by the GetEntry() method
$szDate string Creation date of the entry. Optional. null by default.
$szLupdate string Last update date of the entry. Optional. null by default.
$MustSave boolean Should the glossary be saved right after the replacement. Optional. true by default
Parameters Warning

Modify() uses 4 parameters whereas the suggested limit is 3.

Return

(bool) true if replacement successful; false otherwise

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

$oGlossary->Open();

if ( $bFound = $oGlossary->FindByTerm( 'MD5' ) )
{
    var_dump( $aEntry = $oGlossary->getEntry() );
    $szOldValue = $aEntry['value'];

    $aEntry['value'] = 'New value';
    $oGlossary->Modify( $aEntry,null,$szNow = date('YmdHis'),false );

    var_dump( $aNewEntry = $oGlossary->getEntry() );

    echo LSUnitTesting::assert( $aNewEntry['value'] === 'New value' &&
                                $aNewEntry['lupdate'] === $szNow                    ,
                                'ASSERTION SUCCESSFUL: value successfully replaced' ,
                                'ASSERTION FAILURE: incorrect replacement'          ,
                                'GuideAssert' );
}

array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20070102' (length=8)
  'lupdate' => string '' (length=0)
  'term' => string 'MD5' (length=3)
  'value' => string 'Message Digest 5: it is a secure hashing 
                                  function that converts a data stream into a 
                                  digest of fixed size. This algorithm has been
                                  placed in the public domain by RSA Data 
                                  Security, Inc.' (length=324)
  'lang' => string 'en' (length=2)
  'id' => string 'fb42ed67-066d-464f-8079-34a8955b552c' (length=36)
array (size=8)
  'class' => string 'IT' (length=2)
  'keywords' => string '' (length=0)
  'date' => string '20070102' (length=8)
  'lupdate' => string '20150309093639' (length=14)
  'term' => string 'MD5' (length=3)
  'value' => string 'New value' (length=9)
  'lang' => string 'en' (length=2)
  'id' => string 'fb42ed67-066d-464f-8079-34a8955b552c' (length=36)

GuideAssert() ... ASSERTION SUCCESSFUL: value successfully replaced

Unit Testing

1 assertions: 1 successful; 0 failed

Save(): Saves the glossary

[ back to method list ]

Syntax

Save()

Parameters

None

Return

(void) The glossary will be saved IF it is dirty

Assertions

true === true successful

Unit Testing

1 assertions: 1 successful; 0 failed

TableOfContents(): Returns an array of terms 1st-letters

[ back to method list ]

Warning

As of version 7.0.0001 the original Index() method has been renamed TableOfContents(). This has a potential impact on your existing code but there was ABSOLUTELY no other way for us.

Syntax

TableOfContents()

Parameters

None

Return

(array) An array of terms 1st-letters

Example Executed
$oGlossary = new LSGlossary( 'Vae Soli! Glossary',
                   FIL_ResolveRoot( '/vaesoli/resources/XML/glossary.xml' ) );

$aKeys = $oGlossary->TableOfContents();

if ( ksort( $aKeys ) )  // Sort keys
{
    echo "<p>Presentation as a list:</p>\n";
    echo "<ol>";        // Start a list
    foreach ( $aKeys as $c => $iCount )
    {
        // Letter + count + link to real-time glossary
        echo "<li><a href=\"http://www.latosensu.be/glossary/{$c}*\">{$c}</a> &hellip; {$iCount} " .
              ( $iCount > 1 ? 'entries' : 'entry' ) . "</li>\n";
    }
    echo "</ol>";

    echo "<p>Presentation as row of 1st letters:</p>\n";
    echo "<p>";
    foreach ( $aKeys as $c => $iCount )
    {
        // Letter + count + link to real-time glossary
        echo "<a href=\"http://www.latosensu.be/glossary/{$c}*\">{$c}</a> ";
    }
    echo "</p>";
}

echo LSUnitTesting::assert( isset( $aKeys['K'] ) && isset( $aKeys['L'] ) && isset( $aKeys['M'] ),
                            'ASSERTION SUCCESSFUL: considered successful'                       ,
                            'ASSERTION FAILURE: considered failed'                              ,
                            'GuideAssert' );

Presentation as a list:

  1. ( … 1 entry
  2. A … 121 entries
  3. B … 55 entries
  4. C … 125 entries
  5. D … 85 entries
  6. E … 50 entries
  7. F … 60 entries
  8. G … 21 entries
  9. H … 37 entries
  10. I … 62 entries
  11. J … 17 entries
  12. K … 11 entries
  13. L … 25 entries
  14. M … 60 entries
  15. N … 9 entries
  16. O … 47 entries
  17. P … 104 entries
  18. Q … 8 entries
  19. R … 88 entries
  20. S … 176 entries
  21. T … 70 entries
  22. U … 32 entries
  23. V … 18 entries
  24. W … 55 entries
  25. X … 7 entries
  26. Y … 2 entries
  27. Z … 4 entries
  28. p … 1 entry
  29. z … 1 entry
  30. 1 … 1 entry
  31. 3 … 1 entry
  32. 4 … 3 entries
  33. 7 … 1 entry

Presentation as row of 1st letters:

( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z p z 1 3 4 7

GuideAssert() ... ASSERTION SUCCESSFUL: considered successful

Unit Testing

1 assertions: 1 successful; 0 failed

Précédent Suivant