/** * Return formatted plan contents for display. * @param user User viewing plan. * @public * @returns Plan */ function displayPlan(&$user, $plan = null, $ts = null) { $plan_txt = $this->getPlan($user, $ts); $out = ''; if (!$user->planwatch->inPlanwatch($this)) { $out .= "<tt><a href=\"" . PW_URL_BASE . "add.php?add=" . $this->username . ";trans=t\" title=\"Add " . $this->username . " to my planwatch\">(Add to my planwatch)</a></tt><br />\n"; } else { $out .= "<tt><a href=\"" . PW_URL_BASE . "add.php?add=" . $this->username . ";trans=t;remove=t\" title=\"Remove " . $this->username . " from my planwatch\">(Remove from my planwatch)</a></tt><br />\n"; } $out .= "<tt>Login name: {$this->username}"; /* user doesn't exist */ if (!$this->isUser() || $this->lastLogin == 0 && $this->lastUpdate == 0) { $out .= "<br />\n"; $out .= "Last login: ???<br />\n"; $out .= "Last update: ???<br />\n"; $out .= "Plan:<br />\n"; $out .= "[Sorry, could not find \"{$this->username}\"]</tt>\n"; } else { if ($this->lastUpdate == 0) { $out .= " (<a href=\"#\" onclick=\"return send('" . $this->username . "');\" title=\"send to " . $this->username . "\">send</a>)<br />\n"; } else { $out .= " (<a href=\"#\" onclick=\"return send('" . $this->username . "');\" title=\"send to " . $this->username . "\">send</a>)<br />\n"; $out .= "Last login: "******"<br />\n"; $out .= "Last updated: " . Planworld::getDisplayDate($this->lastUpdate) . "<br />\n"; if (isset($ts)) { $out .= "Date posted: " . Planworld::getDisplayDate($ts) . "<br />\n"; } $out .= "Plan:</tt>\n"; if (empty($plan_txt)) { $plan_txt = "<tt><br />\n[No plan]</tt>"; } /* only wordwrap if a text plan */ if (Planworld::isText($plan_txt)) { $out .= Planworld::addLinks(wordwrap($plan_txt, 76, "\n", 1), $user->getUsername(), $this->host); } else { $out .= Planworld::addLinks($plan_txt, $user->getUsername(), $this->host); } } } return $out; }