/** * @param array $p_authorBiography * @return void */ public function setBiography(array $p_biography) { if (empty($p_biography) || !isset($p_biography['language'])) { return false; } $biographyObj = new AuthorBiography($this->getId(), $p_biography['language']); if (isset($p_biography['biography']) && !empty($p_biography['biography'])) { $biographyObj->setProperty('biography', $p_biography['biography'], false); } if (isset($p_biography['first_name']) && !empty($p_biography['first_name'])) { $biographyObj->setProperty('first_name', $p_biography['first_name'], false); } if (isset($p_biography['last_name']) && !empty($p_biography['last_name'])) { $biographyObj->setProperty('last_name', $p_biography['last_name'], false); } if ($biographyObj->exists()) { $biographyObj->commit(); } else { $biographyObj->create(); } }
foreach ($publications as $publication) { $languages[] = $publication->getLanguageId(); } $languages = array_unique($languages); $defaultLanguage = 0; $combo = ""; foreach ($languages as $language) { $lang = new Language($language); if ($defaultLanguage == 0) { $defaultLanguage = $language; } $combo .= '<option value="' . $language . '">' . $lang->getName() . "</option>"; } $biography = ""; if ($id > 0) { $bioObj = new AuthorBiography($id, $defaultLanguage); //$biography = $author->getBiography($defaultLanguage); //$lang_first_name = $biography[0]["first_name"]; //$lang_last_name = $biography[0]["last_name"]; $lang_first_name = $bioObj->getFirstName(); $lang_last_name = $bioObj->getLastName(); if (strlen($lang_first_name) == 0) { $lang_first_name = $first_name; } if (strlen($lang_last_name) == 0) { $lang_last_name = $last_name; } //$biography = $biography[0]["biography"]; $biography = $bioObj->getBiography(); } echo $combo;