public function renderAsListItemEdit($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     array_unshift($classes_array, 'authoritative-plant-extra');
     array_unshift($classes_array, 'authoritative-plant-extra-edit');
     if (!$idstr) {
         $idstr = 'authoritative_plant_extra_' . $this->authoritative_plant_extra_id;
     }
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . '>';
     $li_elt .= "\n" . '  ' . util_orderingUpDownControls($idstr) . "\n";
     // common frame
     $li_elt .= '  <div class="authoritative-plant-extra embedded">' . "\n";
     $li_elt .= '    <div id="form-edit-authoritative-plant-extra-' . $this->authoritative_plant_extra_id . '" class="form-edit-authoritative-plant-extra" data-authoritative_plant_extra_id="' . $this->authoritative_plant_extra_id . '">' . "\n";
     $li_elt .= '      <input type="hidden" name="' . $idstr . '-id" value="' . $this->authoritative_plant_extra_id . '"/>' . "\n";
     $li_elt .= '      <input type="hidden" name="' . $idstr . '-type" value="' . $this->type . '"/>' . "\n";
     // ordering controls here?
     // branch on type
     $value_key = $idstr . '-value';
     if ($this->type == 'common name') {
         $li_elt .= '      <div class="field-label">' . util_lang('common_name') . ' : </div><div class="field-value"><input type="text" name="' . $value_key . '" id="' . $value_key . '" value="' . htmlentities($this->value) . '"/></div>' . "\n";
     } elseif ($this->type == 'image') {
         $li_elt .= '      ' . $this->renderAsHtml() . "\n";
     } elseif ($this->type == 'description') {
         $li_elt .= '      <div class="field-label">' . util_lang('description') . ' : </div><div class="field-value"><input type="text" name="' . $value_key . '" id="' . $value_key . '" value="' . htmlentities($this->value) . '"/></div>' . "\n";
     }
     // close common frame
     $li_elt .= '    </div>' . "\n";
     $li_elt .= '    <button class="btn btn-danger button-mark-authoritative-plant-extra-for-delete" title="' . util_lang('mark_for_delete', 'ucfirst') . '" data-do-mark-title="' . util_lang('mark_for_delete', 'ucfirst') . '" data-remove-mark-title="' . util_lang('unmark_for_delete', 'ucfirst') . '" data-for_dom_id="' . $idstr . '" data-authoritative_plant_extra_id="' . $this->authoritative_plant_extra_id . '"><i class="icon-remove-sign icon-white"></i></button>' . "\n";
     $li_elt .= '  </div>' . "\n";
     $li_elt .= '</li>';
     return $li_elt;
 }
 function testRenderAsListItemEdit_DESCRIPTION()
 {
     $pe = Authoritative_Plant_Extra::getOneFromDb(['authoritative_plant_extra_id' => 5104], $this->DB);
     $canonical = '';
     $canonical .= '<li id="authoritative_plant_extra_5104" class="authoritative-plant-extra-edit authoritative-plant-extra" data-authoritative_plant_extra_id="5104" data-created_at="' . $pe->created_at . '" data-updated_at="' . $pe->updated_at . '" data-authoritative_plant_id="5001" data-type="description" data-value="description of american chestnut" data-ordering="1.00000" data-flag_active="1" data-flag_delete="0">' . "\n";
     $canonical .= '  ' . util_orderingUpDownControls('authoritative_plant_extra_5104') . "\n";
     $canonical .= '  <div class="authoritative-plant-extra embedded">' . "\n";
     $canonical .= '    <div id="form-edit-authoritative-plant-extra-5104" class="form-edit-authoritative-plant-extra" data-authoritative_plant_extra_id="5104">' . "\n";
     $canonical .= '      <div class="field-label">description : </div><div class="field-value"><input type="text" name="authoritative_plant_extra-description_5104" id="authoritative_plant_extra-description_5104" value="description of american chestnut"/></div>' . "\n";
     $canonical .= '    </div>' . "\n";
     $canonical .= '    <button class="btn btn-danger button-mark-authoritative-plant-extra-for-delete" title="Mark this for removal - the actual removal occurs on update" data-do-mark-title="Mark this for removal - the actual removal occurs on update" data-remove-mark-title="Undo the mark for removal" data-for_dom_id="authoritative_plant_extra_5104" data-authoritative_plant_extra_id="5104"><i class="icon-remove-sign icon-white"></i></button>' . "\n";
     $canonical .= '  </div>' . "\n";
     $canonical .= '</li>';
     $rendered = $pe->renderAsListItemEdit();
     //            echo "<pre>\n".htmlentities($canonical)."\n------------------\n".htmlentities($rendered)."\n</pre>";
     $this->assertEqual($canonical, $rendered);
 }
 public function renderAsListItemEdit($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     if (!$idstr) {
         $idstr = 'list-item-metadata-term-value-' . $this->metadata_term_value_id;
     }
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . '>';
     $li_elt .= util_orderingUpDownControls($idstr) . ' ';
     $li_elt .= $this->renderAsEdit();
     $li_elt .= '<input type="hidden" name="original_ordering-' . $idstr . '" id="original_ordering-' . $idstr . '" value="' . $this->ordering . '"/>';
     $li_elt .= '<input type="hidden" name="new_ordering-' . $idstr . '" id="new_ordering-' . $idstr . '" value="' . $this->ordering . '"/>';
     $li_elt .= '</li>';
     return $li_elt;
 }
 function testRenderAsListItemEdit()
 {
     $mdtv = Metadata_Term_Value::getOneFromDb(['metadata_term_value_id' => 6210], $this->DB);
     $canonical = '';
     $canonical .= '<li id="list-item-metadata-term-value-6210" ' . $mdtv->fieldsAsDataAttribs() . '>';
     $canonical .= util_orderingUpDownControls('list-item-metadata-term-value-6210') . ' ';
     $canonical .= $mdtv->renderAsEdit();
     $canonical .= '<input type="hidden" name="original_ordering-list-item-metadata-term-value-6210" id="original_ordering-list-item-metadata-term-value-6210" value="' . $mdtv->ordering . '"/>';
     $canonical .= '<input type="hidden" name="new_ordering-list-item-metadata-term-value-6210" id="new_ordering-list-item-metadata-term-value-6210" value="' . $mdtv->ordering . '"/>';
     $canonical .= '</li>';
     $rendered = $mdtv->renderAsListItemEdit();
     //            echo "<pre>\n".htmlentities($canonical)."\n-------\n".htmlentities($rendered)."\n</pre>";
     $this->assertEqual($canonical, $rendered);
     $this->assertNoPattern('/IMPLEMENTED/', $rendered);
 }
 public function renderAsListTreeEditable()
 {
     $children = $this->getChildren();
     $dom_id = 'item-metadata_structure_' . $this->metadata_structure_id;
     if ($children) {
         $rendered = $this->renderAsListItem_Lead($dom_id, ['orderable']);
         $rendered .= util_orderingUpDownControls($dom_id) . ' ';
         $rendered .= $this->renderAsLink();
         //                $rendered .= '<input type="hidden" name="original_ordering-'.$dom_id.'" id="original_ordering-'.$dom_id.'" value="'.$this->ordering.'"/>';
         $rendered .= '<input type="hidden" name="new_ordering-' . $dom_id . '" id="new_ordering-' . $dom_id . '" value="' . $this->ordering . '"/>';
         $rendered .= '<ul class="metadata-structure-tree">' . "\n";
         foreach ($children as $child) {
             $rendered .= $child->renderAsListTree();
         }
         $rendered .= '</ul>';
         $rendered .= '</li>' . "\n";
         return $rendered;
     } else {
         $rendered = $this->renderAsListItem_Lead($dom_id, ['orderable']);
         $rendered .= util_orderingUpDownControls($dom_id) . ' ';
         $rendered .= $this->renderAsLink();
         //                $rendered .= '<input type="hidden" name="original_ordering-'.$dom_id.'" id="original_ordering-'.$dom_id.'" value="'.$this->ordering.'"/>';
         $rendered .= '<input type="hidden" name="new_ordering-' . $dom_id . '" id="new_ordering-' . $dom_id . '" value="' . $this->ordering . '"/>';
         $rendered .= '</li>' . "\n";
         return $rendered;
     }
 }