TeamSpeak 3 PHP Framework  1.1.12
TeamSpeak3_Viewer_Text Class Reference

Renders nodes used in ASCII-based TeamSpeak 3 viewers. More...

Inheritance diagram for TeamSpeak3_Viewer_Text:
TeamSpeak3_Viewer_Interface

List of all members.

Public Member Functions

 fetchObject (TeamSpeak3_Node_Abstract $node, array $siblings=array())
 Returns the code needed to display a node in a TeamSpeak 3 viewer.

Protected Member Functions

 getPrefix ()
 Returns the ASCII string to display the prefix of the current node.
 getCorpusIcon ()
 Returns an ASCII string which can be used to display the status icon for a TeamSpeak_Node_Abstract object.
 getCorpusName ()
 Returns a string for the current corpus element which contains the display name for the current TeamSpeak_Node_Abstract object.

Protected Attributes

 $pattern = "%0%1 %2\n"

Detailed Description

Renders nodes used in ASCII-based TeamSpeak 3 viewers.

Definition at line 32 of file Text.php.


Member Function Documentation

TeamSpeak3_Viewer_Text::fetchObject ( TeamSpeak3_Node_Abstract node,
array $  siblings = array() 
)

Returns the code needed to display a node in a TeamSpeak 3 viewer.

Parameters:
TeamSpeak3_Node_Abstract$node
array$siblings
Returns:
string

Reimplemented from TeamSpeak3_Viewer_Interface.

Definition at line 48 of file Text.php.

References TeamSpeak3_Helper_String\factory(), getCorpusIcon(), getCorpusName(), and getPrefix().

  {
    $this->currObj = $node;
    $this->currSib = $siblings;

    $args = array(
      $this->getPrefix(),
      $this->getCorpusIcon(),
      $this->getCorpusName(),
    );

    return TeamSpeak3_Helper_String::factory($this->pattern)->arg($args);
  }

Returns the ASCII string to display the prefix of the current node.

Returns:
string

Definition at line 67 of file Text.php.

Referenced by fetchObject().

  {
    $prefix = "";

    if(count($this->currSib))
    {
      $last = array_pop($this->currSib);

      foreach($this->currSib as $sibling)
      {
        $prefix .=  ($sibling) ? "| " : "  ";
      }

      $prefix .= ($last) ? "\\-" : "|-";
    }

    return $prefix;
  }

Returns an ASCII string which can be used to display the status icon for a TeamSpeak_Node_Abstract object.

Returns:
string

Definition at line 92 of file Text.php.

Referenced by fetchObject().

  {
    return $this->currObj->getSymbol();
  }

Returns a string for the current corpus element which contains the display name for the current TeamSpeak_Node_Abstract object.

Returns:
string

Definition at line 103 of file Text.php.

Referenced by fetchObject().

  {
    return $this->currObj;
  }

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables