function renderAsEdit() { $this->cacheExtras(); $this->cacheNotebookPages(); $this->cacheSpecimens(); $rendered = '<div id="rendered_authoritative_plant_' . $this->authoritative_plant_id . '" class="authoritative-plant edit-authoritative-plant" ' . $this->fieldsAsDataAttribs() . ' data-can-edit="1">' . "\n"; $rendered .= ' <form id="form-edit-authoritative-plant" action="' . APP_ROOT_PATH . '/app_code/authoritative_plant.php">' . "\n"; $rendered .= ' <input type="hidden" name="action" value="update"/>' . "\n"; $rendered .= ' <input type="hidden" id="authoritative_plant_id" name="authoritative_plant_id" value="' . $this->authoritative_plant_id . '"/>' . "\n"; $rendered .= ' <div id="actions"><button id="edit-submit-control" class="btn btn-success" type="submit" name="edit-submit-control" value="update"><i class="icon-ok-sign icon-white"></i> ' . util_lang('update', 'properize') . '</button>' . "\n"; $rendered .= ' <a id="edit-cancel-control" class="btn" href="/digitalfieldnotebooks/app_code/authoritative_plant.php?action=view&authoritative_plant_id=' . $this->authoritative_plant_id . '"><i class="icon-remove"></i> ' . util_lang('cancel', 'properize') . '</a> '; if ($this->authoritative_plant_id != 'NEW') { $rendered .= '<a id="edit-delete-authoritative-plant-control" class="btn btn-danger" href="/digitalfieldnotebooks/app_code/authoritative_plant.php?action=delete&authoritative_plant_id=' . $this->authoritative_plant_id . '"><i class="icon-trash icon-white"></i> ' . util_lang('delete', 'properize') . '</a>'; } $rendered .= '</div>' . "\n"; // basic data fields $rendered .= ' <ul class="base-info">' . "\n"; $rendered .= ' <li><div class="field-label">' . util_lang('class') . '</div> : <div class="field-value taxonomy taxonomy-class"><input type="text" name="authoritative_plant-class_' . $this->authoritative_plant_id . '" id="authoritative_plant-class_' . $this->authoritative_plant_id . '" value="' . htmlentities($this->class) . '"/></div></li>' . "\n"; $rendered .= ' <li><div class="field-label">' . util_lang('order') . '</div> : <div class="field-value taxonomy taxonomy-order"><input type="text" name="authoritative_plant-order_' . $this->authoritative_plant_id . '" id="authoritative_plant-order_' . $this->authoritative_plant_id . '" value="' . htmlentities($this->order) . '"/></div></li>' . "\n"; $rendered .= ' <li><div class="field-label">' . util_lang('family') . '</div> : <div class="field-value taxonomy taxonomy-family"><input type="text" name="authoritative_plant-family_' . $this->authoritative_plant_id . '" id="authoritative_plant-family_' . $this->authoritative_plant_id . '" value="' . htmlentities($this->family) . '"/></div></li>' . "\n"; $rendered .= ' <li><div class="field-label">' . util_lang('genus') . '</div> : <div class="field-value taxonomy taxonomy-genus"><input type="text" name="authoritative_plant-genus_' . $this->authoritative_plant_id . '" id="authoritative_plant-genus_' . $this->authoritative_plant_id . '" value="' . htmlentities($this->genus) . '"/></div></li>' . "\n"; $rendered .= ' <li><div class="field-label">' . util_lang('species') . '</div> : <div class="field-value taxonomy taxonomy-species"><input type="text" name="authoritative_plant-species_' . $this->authoritative_plant_id . '" id="authoritative_plant-species_' . $this->authoritative_plant_id . '" value="' . htmlentities($this->species) . '"/></div></li>' . "\n"; $rendered .= ' <li><div class="field-label">' . util_lang('variety') . '</div> : <div class="field-value taxonomy taxonomy-variety"><input type="text" name="authoritative_plant-variety_' . $this->authoritative_plant_id . '" id="authoritative_plant-variety_' . $this->authoritative_plant_id . '" value="' . htmlentities($this->variety) . '"/></div></li>' . "\n"; $rendered .= ' <li><div class="field-label">' . util_lang('catalog_identifier') . '</div> : <div class="field-value" taxonomy taxonomy-catalog_identifier><input type="text" name="authoritative_plant-catalog_identifier_' . $this->authoritative_plant_id . '" id="authoritative_plant-catalog_identifier_' . $this->authoritative_plant_id . '" value="' . htmlentities($this->catalog_identifier) . '"/></div></li>' . "\n"; $rendered .= ' </ul>' . "\n"; // flag active control $rendered .= ' <div class="active-state-controls"><input type="checkbox" name="flag_active" value="1"' . ($this->flag_active ? ' checked="checked"' : '') . '/> ' . util_lang('active') . '</div>' . "\n"; // extra info : common names (w/ reordering controls) if ($this->authoritative_plant_id != 'NEW') { $rendered .= ' <h5>' . util_lang('common_names', 'properize') . '</h5>' . "\n"; $rendered .= ' <ul class="authoritative-plant-extras authoritative-plant-extra-common_name">' . "\n"; $rendered .= ' <li><a href="#" id="add_new_authoritative_plant_common_name_button" class="btn">' . util_lang('add_common_name') . '</a></li>' . "\n"; foreach ($this->extras as $ae) { if ($ae->type == 'common name') { $rendered .= ' ' . $ae->renderAsListItemEdit() . "\n"; } } $rendered .= ' </ul>' . "\n"; // extra info : images (w/ reordering controls) $rendered .= ' <h5>' . util_lang('images', 'properize') . '</h5>' . "\n"; $rendered .= ' <ul class="authoritative-plant-extras authoritative-plant-extra-image">' . "\n"; $rendered .= ' <li><a href="#" id="add_new_authoritative_plant_image_button" class="btn">' . util_lang('add_image') . '</a></li>' . "\n"; foreach ($this->extras as $ae) { if ($ae->type == 'image') { $rendered .= ' ' . $ae->renderAsListItemEdit() . "\n"; } } $rendered .= ' </ul>' . "\n"; // extra info : text (w/ reordering controls) $rendered .= ' <h5>' . util_lang('descriptions', 'properize') . '</h5>' . "\n"; $rendered .= ' <ul class="authoritative-plant-extras authoritative-plant-extra-description">' . "\n"; $rendered .= ' <li><a href="#" id="add_new_authoritative_plant_description_button" class="btn">' . util_lang('add_description') . '</a></li>' . "\n"; foreach ($this->extras as $ae) { if ($ae->type == 'description') { $rendered .= ' ' . $ae->renderAsListItemEdit() . "\n"; } } $rendered .= ' </ul>' . "\n"; $rendered .= ' <input type="hidden" id="created_authoritative_plant_extra_ids" name="created_authoritative_plant_extra_ids" value=""/>' . "\n"; $rendered .= ' <input type="hidden" id="deleted_authoritative_plant_extra_ids" name="deleted_authoritative_plant_extra_ids" value=""/>' . "\n"; $rendered .= ' <input type="hidden" id="deleted_specimen_ids" name="deleted_specimen_ids" value=""/>' . "\n"; $rendered .= ' <input type="hidden" id="created_specimen_ids" name="created_specimen_ids" value=""/>' . "\n"; $rendered .= Specimen::renderSpecimenListBlock($this->specimens); } $rendered .= ' </form>' . "\n"; $rendered .= '</div>' . "\n"; return $rendered; }
public function renderAsEdit() { $this->loadPageFields(); $this->loadSpecimens(); $n = $this->getNotebook(); $ap = ''; if ($this->notebook_page_id != 'NEW') { $ap = $this->getAuthoritativePlant(); } // util_prePrintR('TO BE IMPLEMENTED: handle auth plant for new pages (i.e. where auth plant id == 0)'); // util_prePrintR($this); global $USER, $ACTIONS; $actions_attribs = ''; // $add_field_button_li = ''; if ($USER->canActOnTarget($ACTIONS['edit'], $this)) { $actions_attribs .= ' data-can-edit="1"'; // $add_field_button_li = ' <li><a href="" id="btn-add-notebook-page-field" class="creation_link btn">'.util_lang('add_notebook_page_field').'</a></li>'."\n"; } $owner = $USER; if ($n->user_id != $USER->user_id) { $owner = $n->getUser(); } $rendered = '<div id="rendered_notebook_page_' . $this->notebook_page_id . '" class="rendered_notebook_page edit_rendered_notebook_page" ' . $this->fieldsAsDataAttribs() . $actions_attribs . ">\n" . '<form id="form-edit-notebook-page-base-data" action="' . APP_ROOT_PATH . '/app_code/notebook_page.php">' . "\n" . ' <input type="hidden" name="action" value="update"/>' . "\n" . ' <input type="hidden" id="notebook_page_id" name="notebook_page_id" value="' . $this->notebook_page_id . '"/>' . "\n" . ' <input type="hidden" id="notebook_id" name="notebook_id" value="' . $this->notebook_id . '"/>' . "\n"; $rendered .= ' <div id="actions">'; $rendered .= '<button id="edit-submit-control" class="btn btn-success" type="submit" name="edit-submit-control" value="update"><i class="icon-ok-sign icon-white"></i> ' . util_lang($this->notebook_page_id != 'NEW' ? 'update' : 'save', 'properize') . '</button>' . "\n"; if ($this->notebook_page_id != 'NEW') { $rendered .= ' <a id="edit-cancel-control" class="btn" href="' . APP_ROOT_PATH . '/app_code/notebook_page.php?action=view¬ebook_page_id=' . $this->notebook_page_id . '"><i class="icon-remove"></i> ' . util_lang('cancel', 'properize') . '</a>'; $rendered .= ' <a id="edit-delete-notebook-page-control" class="btn btn-danger" href="' . APP_ROOT_PATH . '/app_code/notebook_page.php?action=delete¬ebook_page_id=' . $this->notebook_page_id . '"><i class="icon-trash icon-white"></i> ' . util_lang('delete', 'properize') . '</a>'; } else { $rendered .= ' <a id="edit-cancel-control" class="btn" href="' . APP_ROOT_PATH . '/app_code/notebook.php?action=edit¬ebook_id=' . $this->notebook_id . '"><i class="icon-remove"></i> ' . util_lang('cancel', 'properize') . '</a>'; } $rendered .= '</div>' . "\n"; $rendered .= '<h4>' . util_lang('page_in_notebook', 'ucfirst') . ' <a href="' . APP_ROOT_PATH . '/app_code/notebook.php?action=view¬ebook_id=' . $n->notebook_id . '" id="parent-notebook-link">' . htmlentities($n->name) . '</a></h4>' . "\n"; if ($this->notebook_page_id != 'NEW') { $rendered .= '<a class="show-hide-control" href="#" data-for_elt_id="select_new_authoritative_plant_' . $this->notebook_page_id . '">' . util_lang('change_authoritative_plant') . '</a>'; $rendered .= ' <div id="select_new_authoritative_plant_' . $this->notebook_page_id . '" class="select_new_authoritative_plant">' . Authoritative_Plant::renderControlSelectAllAuthoritativePlants($this->notebook_page_id != 'NEW' ? $ap->authoritative_plant_id : 0) . '</div>' . "\n"; $rendered .= ' ' . $ap->renderAsViewEmbed() . "\n"; } else { $rendered .= ' <div id="select_new_authoritative_plant_' . $this->notebook_page_id . '" class="NEW_select_new_authoritative_plant">' . Authoritative_Plant::renderControlSelectAllAuthoritativePlants(0) . '</div>' . "\n"; } $rendered .= ' <div class="info-timestamps"><span class="created_at">' . util_lang('created_at') . ' ' . util_datetimeFormatted($this->created_at) . '</span>, <span class="updated_at">' . util_lang('updated_at') . ' ' . util_datetimeFormatted($this->updated_at) . "</span></div>\n" . ' <div class="info-owner">' . util_lang('owned_by') . ' <a href="' . APP_ROOT_PATH . '/app_code/user.php?action=view&user_id=' . $owner->user_id . '">' . htmlentities($owner->screen_name) . '</a></div>' . "\n"; $rendered .= '<div class="control-workflows">'; if ($this->notebook_page_id != 'NEW') { if ($USER->canActOnTarget('publish', $this)) { $rendered .= ' <span class="published_state workflow-control"><input id="notebook-page-workflow-publish-control" type="checkbox" name="flag_workflow_published" value="1"' . ($this->flag_workflow_published ? ' checked="checked"' : '') . ' /> ' . util_lang('publish') . '</span>,'; } else { $rendered .= ' <span class="published_state workflow-info">' . ($this->flag_workflow_published ? util_lang('published_true') : util_lang('published_false')) . '</span>,'; } if ($USER->canActOnTarget('verify', $this)) { $rendered .= ' <span class="verified_state verified_state_' . ($this->flag_workflow_validated ? 'true' : 'false') . ' workflow-control"><input id="notebook-page-workflow-validate-control" type="checkbox" name="flag_workflow_validated" value="1"' . ($this->flag_workflow_validated ? ' checked="checked"' : '') . ' /> ' . util_lang('verify') . '</span>'; } else { $rendered .= ' <span class="verified_state verified_state_' . ($this->flag_workflow_validated ? 'true' : 'false') . ' workflow-info">' . ($this->flag_workflow_validated ? util_lang('verified_true') : util_lang('verified_false')) . '</span>'; } $rendered .= '<br/>' . "\n"; } else { $rendered .= ' <span class="published_state workflow-info">' . ($this->flag_workflow_published ? util_lang('published_true') : util_lang('published_false')) . '</span>,'; $rendered .= ' <span class="verified_state verified_state_' . ($this->flag_workflow_validated ? 'true' : 'false') . ' workflow-info">' . ($this->flag_workflow_validated ? util_lang('verified_true') : util_lang('verified_false')) . '</span>'; } $rendered .= "</div>\n"; $rendered .= ' <div class="notebook_page_notes"><textarea id="notebook-page-notes" name="notes" rows="4" cols="120">' . htmlentities($this->notes) . '</textarea></div>' . "\n"; if ($this->notebook_page_id != 'NEW') { $rendered .= ' <h4>' . ucfirst(util_lang('metadata')) . "</h4>\n"; $rendered .= ' <ul class="notebook-page-fields">' . "\n"; $rendered .= ' <li><a href="#" id="add_new_notebook_page_field_button" class="btn">' . util_lang('add_notebook_page_field') . '</a></li>' . "\n"; if ($this->page_fields) { $prev_pf_structure_id = $this->page_fields[0]->label_metadata_structure_id; foreach ($this->page_fields as $pf) { $spacer_class = ''; if ($pf->label_metadata_structure_id != $prev_pf_structure_id) { $spacer_class = 'spacing-list-item'; } $rendered .= ' ' . $pf->renderAsListItemEdit('list_item-notebook_page_field_' . $pf->notebook_page_field_id, [$spacer_class]) . "\n"; $prev_pf_structure_id = $pf->label_metadata_structure_id; } } else { $rendered .= '<li>' . util_lang('no_metadata', 'ucfirst') . '</li>' . "\n"; } $rendered .= ' </ul>' . "\n"; $rendered .= Specimen::renderSpecimenListBlock($this->specimens); // $rendered .= ' <h4>'.ucfirst(util_lang('specimens'))."</h4>\n". // ' <ul class="specimens">'."\n"; // $rendered .= ' <li><a href="#" id="add_new_specimen_button" class="btn">'.util_lang('add_specimen').'</a></li>'."\n"; // if ($this->specimens) { // foreach ($this->specimens as $specimen) { // $rendered .= ' <li id="list_item-specimen_'.$specimen->specimen_id.'">'.$specimen->renderAsEditEmbed()."</li>\n"; // } // } else { // $rendered .= '<li>'.util_lang('no_metadata','ucfirst').'</li>'."\n"; // } // $rendered .= " </ul>\n"; $rendered .= '<input type="hidden" id="initial_page_field_ids" name="initial_page_field_ids" value="' . implode(',', Db_Linked::arrayOfAttrValues($this->page_fields, 'notebook_page_field_id')) . '"/>' . "\n"; $rendered .= '<input type="hidden" id="created_page_field_ids" name="created_page_field_ids" value=""/>' . "\n"; $rendered .= '<input type="hidden" id="deleted_page_field_ids" name="deleted_page_field_ids" value=""/>' . "\n"; $rendered .= '<input type="hidden" id="initial_specimen_ids" name="initial_specimen_ids" value="' . implode(',', Db_Linked::arrayOfAttrValues($this->specimens, 'specimen_id')) . '"/>' . "\n"; $rendered .= '<input type="hidden" id="created_specimen_ids" name="created_specimen_ids" value=""/>' . "\n"; $rendered .= '<input type="hidden" id="deleted_specimen_ids" name="deleted_specimen_ids" value=""/>' . "\n"; } $rendered .= '</form>' . "\n"; $rendered .= "</div>"; return $rendered; }
function testRenderAsEdit() { $ap = Authoritative_Plant::getOneFromDb(['authoritative_plant_id' => 5001], $this->DB); $ap->cacheExtras(); $ap->cacheNotebookPages(); $ap->cacheSpecimens(); global $USER; $USER = User::getOneFromDb(['username' => TESTINGUSER], $this->DB); $canonical = '<div id="rendered_authoritative_plant_5001" class="authoritative-plant edit-authoritative-plant" ' . $ap->fieldsAsDataAttribs() . ' data-can-edit="1">' . "\n"; $canonical .= ' <form id="form-edit-authoritative-plant" action="' . APP_ROOT_PATH . '/app_code/authoritative_plant.php">' . "\n"; $canonical .= ' <input type="hidden" name="action" value="update"/>' . "\n"; $canonical .= ' <input type="hidden" id="authoritative_plant_id" name="authoritative_plant_id" value="' . $ap->authoritative_plant_id . '"/>' . "\n"; $canonical .= ' <div id="actions"><button id="edit-submit-control" class="btn btn-success" type="submit" name="edit-submit-control" value="update"><i class="icon-ok-sign icon-white"></i> Update</button>' . "\n"; $canonical .= ' <a id="edit-cancel-control" class="btn" href="/digitalfieldnotebooks/app_code/authoritative_plant.php?action=view&authoritative_plant_id=5001"><i class="icon-remove"></i> Cancel</a> <a id="edit-delete-authoritative-plant-control" class="btn btn-danger" href="/digitalfieldnotebooks/app_code/authoritative_plant.php?action=delete&authoritative_plant_id=5001"><i class="icon-trash icon-white"></i> Delete</a></div>' . "\n"; // basic data fields $canonical .= ' <ul class="base-info">' . "\n"; $canonical .= ' <li><div class="field-label">' . util_lang('class') . '</div> : <div class="field-value taxonomy taxonomy-class"><input type="text" name="authoritative_plant-class_' . $ap->authoritative_plant_id . '" id="authoritative_plant-class_' . $ap->authoritative_plant_id . '" value="' . htmlentities($ap->class) . '"/></div></li>' . "\n"; $canonical .= ' <li><div class="field-label">' . util_lang('order') . '</div> : <div class="field-value taxonomy taxonomy-order"><input type="text" name="authoritative_plant-order_' . $ap->authoritative_plant_id . '" id="authoritative_plant-order_' . $ap->authoritative_plant_id . '" value="' . htmlentities($ap->order) . '"/></div></li>' . "\n"; $canonical .= ' <li><div class="field-label">' . util_lang('family') . '</div> : <div class="field-value taxonomy taxonomy-family"><input type="text" name="authoritative_plant-family_' . $ap->authoritative_plant_id . '" id="authoritative_plant-family_' . $ap->authoritative_plant_id . '" value="' . htmlentities($ap->family) . '"/></div></li>' . "\n"; $canonical .= ' <li><div class="field-label">' . util_lang('genus') . '</div> : <div class="field-value taxonomy taxonomy-genus"><input type="text" name="authoritative_plant-genus_' . $ap->authoritative_plant_id . '" id="authoritative_plant-genus_' . $ap->authoritative_plant_id . '" value="' . htmlentities($ap->genus) . '"/></div></li>' . "\n"; $canonical .= ' <li><div class="field-label">' . util_lang('species') . '</div> : <div class="field-value taxonomy taxonomy-species"><input type="text" name="authoritative_plant-species_' . $ap->authoritative_plant_id . '" id="authoritative_plant-species_' . $ap->authoritative_plant_id . '" value="' . htmlentities($ap->species) . '"/></div></li>' . "\n"; $canonical .= ' <li><div class="field-label">' . util_lang('variety') . '</div> : <div class="field-value taxonomy taxonomy-variety"><input type="text" name="authoritative_plant-variety_' . $ap->authoritative_plant_id . '" id="authoritative_plant-variety_' . $ap->authoritative_plant_id . '" value="' . htmlentities($ap->variety) . '"/></div></li>' . "\n"; $canonical .= ' <li><div class="field-label">' . util_lang('catalog_identifier') . '</div> : <div class="field-value" taxonomy taxonomy-catalog_identifier><input type="text" name="authoritative_plant-catalog_identifier_' . $ap->authoritative_plant_id . '" id="authoritative_plant-catalog_identifier_' . $ap->authoritative_plant_id . '" value="' . htmlentities($ap->catalog_identifier) . '"/></div></li>' . "\n"; $canonical .= ' </ul>' . "\n"; // flag active control $canonical .= ' <div class="active-state-controls"><input type="checkbox" name="flag_active" value="1"' . ($ap->flag_active ? ' checked="checked"' : '') . '/> ' . util_lang('active') . '</div>' . "\n"; // extra info : common names (w/ reordering controls) $canonical .= ' <h5>' . util_lang('common_names', 'properize') . '</h5>' . "\n"; $canonical .= ' <ul class="authoritative-plant-extras authoritative-plant-extra-common_name">' . "\n"; $canonical .= ' <li><a href="#" id="add_new_authoritative_plant_common_name_button" class="btn">' . util_lang('add_common_name') . '</a></li>' . "\n"; foreach ($ap->extras as $ae) { if ($ae->type == 'common name') { $canonical .= ' ' . $ae->renderAsListItemEdit() . "\n"; } } $canonical .= ' </ul>' . "\n"; // extra info : images (w/ reordering controls) $canonical .= ' <h5>' . util_lang('images', 'properize') . '</h5>' . "\n"; $canonical .= ' <ul class="authoritative-plant-extras authoritative-plant-extra-image">' . "\n"; $canonical .= ' <li><a href="#" id="add_new_authoritative_plant_image_button" class="btn">' . util_lang('add_image') . '</a></li>' . "\n"; foreach ($ap->extras as $ae) { if ($ae->type == 'image') { $canonical .= ' ' . $ae->renderAsListItemEdit() . "\n"; } } $canonical .= ' </ul>' . "\n"; // extra info : text (w/ reordering controls) $canonical .= ' <h5>' . util_lang('descriptions', 'properize') . '</h5>' . "\n"; $canonical .= ' <ul class="authoritative-plant-extras authoritative-plant-extra-description">' . "\n"; $canonical .= ' <li><a href="#" id="add_new_authoritative_plant_description_button" class="btn">' . util_lang('add_description') . '</a></li>' . "\n"; foreach ($ap->extras as $ae) { if ($ae->type == 'description') { $canonical .= ' ' . $ae->renderAsListItemEdit() . "\n"; } } $canonical .= ' </ul>' . "\n"; // specimens, as per notebook page rendering $canonical .= ' <input type="hidden" id="created_authoritative_plant_extra_ids" name="created_authoritative_plant_extra_ids" value=""/>' . "\n"; $canonical .= ' <input type="hidden" id="deleted_authoritative_plant_extra_ids" name="deleted_authoritative_plant_extra_ids" value=""/>' . "\n"; $canonical .= ' <input type="hidden" id="deleted_specimen_ids" name="deleted_specimen_ids" value=""/>' . "\n"; $canonical .= ' <input type="hidden" id="created_specimen_ids" name="created_specimen_ids" value=""/>' . "\n"; $canonical .= Specimen::renderSpecimenListBlock($ap->specimens); // // ' <h4>'.ucfirst(util_lang('specimens'))."</h4>\n". // ' <ul class="specimens">'."\n"; // $canonical .= ' <li><a href="#" id="add_new_specimen_button" class="btn">'.util_lang('add_specimen').'</a></li>'."\n"; // if ($ap->specimens) { // foreach ($ap->specimens as $specimen) { // $canonical .= ' <li id="list_item-specimen_'.$specimen->specimen_id.'">'.$specimen->renderAsEditEmbed()."</li>\n"; // } // } else { // $canonical .= '<li>'.util_lang('no_metadata','ucfirst').'</li>'."\n"; // } // $canonical .= " </ul>\n"; // close form and div $canonical .= ' </form>' . "\n"; $canonical .= '</div>' . "\n"; $rendered = $ap->renderAsEdit(); // echo "<pre>\n".htmlentities($canonical)."\n------------------\n".htmlentities($rendered)."\n</pre>"; $this->assertEqual($canonical, $rendered); }
function testRenderSpecimenListBlock() { $ap = Authoritative_Plant::getOneFromDb(['authoritative_plant_id' => 5001], $this->DB); $ap->cacheSpecimens(); $canonical = ''; $canonical .= ' <h4>' . ucfirst(util_lang('specimens')) . "</h4>\n" . ' <ul class="specimens">' . "\n"; $canonical .= ' <li><a href="#" id="add_new_specimen_button" class="btn">' . util_lang('add_specimen') . '</a></li>' . "\n"; if ($ap->specimens) { foreach ($ap->specimens as $specimen) { $canonical .= ' <li id="list_item-specimen_' . $specimen->specimen_id . '">' . $specimen->renderAsEditEmbed() . "</li>\n"; } } else { $canonical .= '<li>' . util_lang('no_metadata', 'ucfirst') . '</li>' . "\n"; } $canonical .= " </ul>\n"; $rendered = Specimen::renderSpecimenListBlock($ap->specimens); $this->assertEqual($canonical, $rendered); $this->assertNoPattern('/IMPLEMENTED/', $rendered); }