protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A helper for generating web links");
}
/**
* Flush the content out,e g. to a template variable
*
* @return void
+ * @todo Completely unimplemented
*/
public function flushContent () {
- $this->partialStub("Please implement this method.");
+ // Needed to be implemented!
+ }
+
+ /**
+ * Adds a link group (like the form group is) with some raw language to the
+ * helper.
+ *
+ * @param $groupId Id string of the group
+ * @param $groupText Text for this group to add
+ * @return void
+ */
+ public function addLinkGroup ($groupId, $groupText) {
+ // Is a group with that name open?
+ if ($this->ifGroupIsOpened($groupId)) {
+ // Then close it here
+ $this->closeGroupById($groupId);
+ } else {
+ // Open the new group
+ $this->openGroupByIdText($groupId, $groupText);
+ }
+ }
+
+ /**
+ * Adds text (note) to the previously opened group or throws an exception
+ * if no previous group was opened.
+ *
+ * @param $groupNote Note to be added to a group
+ * @return void
+ * @throws NoGroupOpenedException If no previous group was opened
+ */
+ public function addLinkNote ($groupNote) {
+ // Check if a previous group was opened
+ if (!$this->ifGroupOpenedPreviously()) {
+ // No group was opened before!
+ throw new NoGroupOpenedException(array($this, $groupNote), self::EXCEPTION_GROUP_NOT_OPENED);
+ }
}
}