for 1.2.0)
* @param information about the tutorial file. Format:
*
*
* array('tutename' => tutorial name,
* 'path' => relative path of tutorial to tutorials/ directory
* 'ini' => contents of the tutorial .ini file, if any)
*
*/
function parserTutorial($data, $info)
{
$this->value = $data;
$this->package = $info['package'];
$this->subpackage = $info['subpackage'];
$this->tutorial_type = $info['tutetype'];
$this->name = $info['tutename'];
$this->path = $info['path'];
$this->ini = $info['ini'];
}
/**
* Retrieve the title of the tutorial, or of any subsection
* @param Converter
* @param string which subsection to retrieve the title from, if any
* @uses parserXMLDocBookTag::getSubSection() retrieve the subsection to
* to get a title from
*/
function getTitle(&$c,$subsection = '')
{
if (!empty($subsection))
{
$z = $this->value->getSubSection($c,$subsection);
if (!$z)
{
addWarning(PDERROR_TUTORIAL_SUBSECTION_NOT_FOUND,$this->name,$subsection);
return $subsection;
}
return $z->getTitle($c);
}
return $this->value->getTitle($c);
}
/**
* @param Converter
* @param boolean determines whether character data is postprocessed to be
* Converter-friendly or not.
*/
function Convert(&$c, $postprocess = true)
{
return $this->value->Convert($c, $postprocess);
}
/**
* @uses $parent creates a link to the documentation for the parent tutorial
* @param parserTutorial
* @param Converter
*/
function setParent($parent,&$c)
{
$this->parent = new tutorialLink;
$this->parent->addLink('', $parent->path, $parent->name, $parent->package, $parent->subpackage, $parent->getTitle($c));
}
/**
* Determine if this parserTutorial object is a child of another
*
* WARNING: This method can enter an infinite loop when run on PHP v5.2.1...
* see {@link http://bugs.php.net/bug.php?id=40608 PHP Bug #40608}
* and {@link http://pear.php.net/bugs/bug.php?id=10289 PEAR Bug #10289}
* @param array $parents array of parserTutorials that have child tutorials
* @return boolean whether or not this tutorial is a child of the any of the parents
*/
function isChildOf($parents)
{
// avoid infinite loop PHP bug #40608 in PHP v5.2.1, see PEAR #10289
checkForBugCondition('5.2.1', '40608', '10289');
foreach($parents as $i => $parent)
{
if ($parent->path == $this->path) continue;
if ($parent->ini && ($parent->package == $this->package) && ($parent->subpackage == $this->subpackage) && ($parent->tutorial_type == $this->tutorial_type))
{
foreach($parent->ini['Linked Tutorials'] as $child)
{
if ($child . '.' . $this->tutorial_type == $this->name) return true;
}
}
}
}
/**
* Retrieve converter-specific link to the parent tutorial's documentation
* @param Converter
*/
function getParent(&$c)
{
if (!$this->parent) return false;
return $c->returnSee($this->parent);
}
/**
* @uses $next creates a link to the documentation for the next tutorial
* @param parserTutorial
* @param Converter
*/
function setNext($next,&$c)
{
if (phpDocumentor_get_class($next) == 'tutoriallink') return $this->next = $next;
$this->next = new tutorialLink;
$this->next->addLink('', $next->path, $next->name, $next->package, $next->subpackage, $next->getTitle($c));
}
/**
* Retrieve converter-specific link to the next tutorial's documentation
* @param Converter
*/
function getNext(&$c)
{
if (!$this->next) return false;
return $c->returnSee($this->next);
}
/**
* @uses $prev creates a link to the documentation for the previous tutorial
* @param parserTutorial
* @param Converter
*/
function setPrev($prev,&$c)
{
if (phpDocumentor_get_class($prev) == 'tutoriallink') return $this->prev = $prev;
$this->prev = new tutorialLink;
$this->prev->addLink('', $prev->path, $prev->name, $prev->package, $prev->subpackage, $prev->getTitle($c));
}
/**
* Retrieve converter-specific link to the previous tutorial's documentation
* @param Converter
*/
function getPrev(&$c)
{
if (!$this->prev) return false;
return $c->returnSee($this->prev);
}
/**
* Get a link to this tutorial, or to any subsection of this tutorial
* @param Converter
* @param boolean if true, returns a {@link tutorialLink} instead of a string
* @param string section name to link to
* @return string|tutorialLink
*/
function getLink(&$c,$pure = false,$section = '')
{
$link = new tutorialLink;
$link->addLink($section, $this->path, $this->name, $this->package, $this->subpackage, $this->getTitle($c), $this->category);
if ($pure) return $link;
return $c->returnSee($link);
}
}
?>