Logo ZenEngine Logo SourceForge.net ZenEngine
the lightweight CMS framework


package : ZenEngine/Core
Author : Bruno Desthuilliers
Version : 0.0.5

public class ZenContentManager

The ZenContentManager's job is to retrieve actual content associated with a ZenMenuItem object.
Note that the contentManager does no create Documents. This part is delegated to docMakers. The contentManager look up for the concrete docMaker to instanciate for the menuItem's docType, and pass back the document created by the docMaker. Client code may either send a getDocumentFor(ZenMenuItem) message, or retrieve a docMaker via the getDocMakerFor(DocType) message. The structure of the ContentManager conf file is: [docType] docMakerClass=[name of the docMaker class to instantiate for this docType] docMakerPath=[string, path to the file where the docMaker class lives] docMakerConf=[string, path to the conf file for the docMaker-docType association] Note that the docMakerPath is relative to php_include_path/ZenEngine/, so the docMaker class file must live somewhere in the ZenEngine directory, and that the docMakerConf path is relative to the calling PHP/HTML page path


public void ZenContentManager

Parses the conf file.

Parameters :
string $config_file : path to the config file

Return : (void)

public mixed getDocumentFor

Return the ZenDocument object corresponding to the menuItem, or null.
Look up for the concrete docMaker and conf file for the menuItem's docType, instanciate the docMaker, invoke its makeDocument() method, and send back the document.

Parameters :
object A $menuItem : ZenMenuItem

Return : (mixed) A ZenDocument, or null if fail

public mixed getDocMakerFor

Instantiate and return the docMaker associated with the gievn docType.
This method is used internally and by ZenFSComposedDocMaker. You shouldprobably not have the need to use it.

Parameters :
string $docType : docType for the wanted docMaker

Return : (mixed) a docMaker or null

public string getErrorMsg

Return an error message if getDocumentFor() failed

Return : (string) an error message or an empty string

private void getContextFor

Parameters :

Return : (void)


private string $_config

config for the contentManager, as an assoctiave array of docType : [docMakerClass, docMakerPath, docMakerConf] pairs

private string $_errorMsg

Error message, set by getDocumentFor() if fails
In fact, just return the docMaker error message.