</a></td> <td style="font-size: 11pt"><?php $authors = $addon->getAuthorInfo(); //This system should probably be rethought if (sizeof($authors) == 1) { //$uo = new UserHandler(); //$uo->initFromId($authors[0]->id); $uo = UserManager::getFromBLID($authors[0]->blid); echo "<a href=\"#\">" . $uo->getName() . "</a>"; } else { if (sizeof($authors) == 2) { //$uo = new UserHandler(); //$uo->initFromId($authors[0]->id); $uo = UserManager::getFromBLID($authors[0]->blid); $uo2 = new UserHandler(); $uo2->initFromId($authors[1]->id); $uo2 = UserManager::getFromBLID($authors[1]->blid); echo "<a href=\"#\">" . $uo->getName() . "</a>"; echo " and "; echo "<a href=\"#\">" . $uo2->getName() . "</a>"; } else { $count = sizeof($authors); //echo("DATA: "); //print_r($authors); foreach ($authors as $num => $author) { //$uo = new UserHandler(); //$uo->initFromId($auth->id); $uo = UserManager::getFromBLID($author->blid); if ($count - $num == 1) { echo "and <a href=\"#\">" . $uo->getName() . "</a>"; } else {
public function getAuthor() { if (!$this->isInit()) { throw new Exception('AddonObject not init'); return; } if (is_int($this->authorDat + 0)) { //LEGACY SUPPORT if (!is_object($this->author)) { $author = new UserHandler(); $author->initFromBLID($this->authorDat); $this->author = $author; } $ad = array(); $auth = $ad[] = new stdClass(); $auth->id = $author->getId(); $auth->role = "main"; $auth->owner = true; $this->authorDat = json_encode($ad); // TODO do something here to send this back to the database } $this->authors = json_decode($this->authorDat); // [ { "id": 6, "owner": true, "role": "main" }, { "id": 7, "role": "modeler" } ] foreach ($this->authors as $author) { if ($author->owner == true) { $ao = new UserHandler(); $ao->initFromId($author->id); return $ao; } } }