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;
 }
 public function renderAsListItem($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     global $USER, $ACTIONS;
     $actions_attribs = '';
     $is_editable = false;
     $owner = $USER;
     if ($USER->user_id == $this->user_id) {
         array_push($classes_array, 'owned-object');
         $actions_attribs .= ' data-can-edit="1"';
         $is_editable = true;
     } elseif ($USER->canActOnTarget($ACTIONS['edit'], $this)) {
         array_push($classes_array, 'editable-object');
         $actions_attribs .= ' data-can-edit="1"';
         $owner = $this->getUser();
         $is_editable = true;
     } else {
         $owner = $this->getUser();
     }
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . $actions_attribs . '>';
     $li_elt .= '<a href="' . APP_ROOT_PATH . '/app_code/notebook.php?notebook_id=' . $this->notebook_id . '">' . htmlentities($this->name) . '</a>';
     if ($is_editable) {
         $li_elt .= '<span class="icon-pencil"></span>';
     }
     $li_elt .= ' ' . util_lang('attribution') . ' ' . $owner->renderMinimal(true);
     $li_elt .= '</li>';
     return $li_elt;
 }
 private function _startRenderedListItem($idstr, $classes_array, $other_attribs_hash)
 {
     global $USER, $ACTIONS;
     $actions_attribs = '';
     if ($USER->canActOnTarget($ACTIONS['edit'], $this)) {
         $actions_attribs .= ' data-can-edit="1"';
     }
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . $actions_attribs . '>';
     $li_elt .= '<a href="' . APP_ROOT_PATH . '/app_code/notebook_page.php?action=view&notebook_page_id=' . $this->notebook_page_id . '">';
     return $li_elt;
 }
 public function renderAsListItemEdit($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     //            return 'TO BE IMPLEMENTED';
     //
     global $USER;
     if (!$idstr) {
         $idstr = 'specimen-image-' . $this->specimen_image_id;
     }
     array_unshift($classes_array, 'specimen-image');
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . '>';
     $li_elt .= '<button type="button" class="btn btn-danger button-delete-specimen-image" title="' . util_lang('prompt_confirm_delete', 'ucfirst') . '" data-specimen_image_id="' . $this->specimen_image_id . '" data-dom_id="' . $idstr . '"><i class="icon-remove icon-white"></i></button><br/>';
     $li_elt .= $this->renderAsHtml();
     $li_elt .= '<div class="controls">';
     // publish, verify, reordering handle
     $li_elt .= util_orderingLeftRightControls($idstr);
     $li_elt .= '<input type="hidden" name="new_ordering-' . $idstr . '" id="new_ordering-' . $idstr . '" value="' . $this->ordering . '"/>';
     if ($this->specimen_image_id != 'NEW') {
         $li_elt .= '<div class="control-workflows">';
         if ($USER->canActOnTarget('publish', $this)) {
             $li_elt .= '<span class="control-publish"><input id="flag_workflow_published_' . $this->specimen_image_id . '-control" type="checkbox" name="flag_workflow_published" value="1"' . ($this->flag_workflow_published ? ' checked="checked"' : '') . ' /> ' . util_lang('publish') . '</span>, ';
         } else {
             $li_elt .= '<span class="control-publish">' . ($this->flag_workflow_published ? util_lang('published_true') : util_lang('published_false')) . '</span>, ';
         }
         if ($USER->canActOnTarget('verify', $this)) {
             $li_elt .= '<span class="control-verify"><input id="flag_workflow_validated_' . $this->specimen_image_id . '-control" type="checkbox" name="flag_workflow_validated" value="1"' . ($this->flag_workflow_validated ? ' checked="checked"' : '') . ' /> ' . util_lang('verify') . '</span>';
         } else {
             $li_elt .= '<span class="control-verify">' . ($this->flag_workflow_validated ? util_lang('verified_true') : util_lang('verified_false')) . '</span>';
         }
         $li_elt .= '</div>';
     }
     //            $li_elt .= '<span class="ordering-handle">&lt; &gt;</span>';
     $li_elt .= '</div>';
     $li_elt .= '</li>';
     return $li_elt;
 }
 public function renderAsListItem($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     global $USER, $ACTIONS;
     $actions_attribs = '';
     if ($USER->canActOnTarget($ACTIONS['edit'], $this)) {
         $actions_attribs .= ' data-can-edit="1"';
     }
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . $actions_attribs . '>';
     $li_elt .= '<a href="' . APP_ROOT_PATH . '/app_code/specimen.php?specimen_id=' . $this->specimen_id . '">' . htmlentities($this->name) . '</a></li>';
     return $li_elt;
 }
 public function renderAsListItem($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     global $USER, $ACTIONS;
     $actions_attribs = '';
     if ($USER->canActOnTarget($ACTIONS['edit'], $this)) {
         $actions_attribs .= ' data-can-edit="1"';
     }
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . $actions_attribs . '>';
     if ($this->flag_active) {
         $li_elt .= '<i class="icon-ok"></i> ';
     } else {
         $li_elt .= '<i class="icon-ban-circle"></i> ';
     }
     $li_elt .= $this->renderAsLink();
     $li_elt .= '</li>';
     //            $li_elt .= '<a href="/app_code/authoritative_plant.php?authoritative_plant_id='.$this->authoritative_plant_id.'">'.htmlentities($this->renderAsShortText()).'</a></li>';
     return $li_elt;
 }
Ejemplo n.º 7
0
 function testStartListItem()
 {
     $this->assertEqual('<li>', util_listItemTag());
     $this->assertEqual('<li id="idfoo">', util_listItemTag('idfoo'));
     $this->assertEqual('<li class="class1foo class2foo">', util_listItemTag('', ['class1foo', 'class2foo']));
     $this->assertEqual('<li id="idfoo" class="class1foo class2foo">', util_listItemTag('idfoo', ['class1foo', 'class2foo']));
     $this->assertEqual('<li foostatus="statusfoo" typebar="bartype">', util_listItemTag('', [], ['foostatus' => 'statusfoo', 'typebar' => 'bartype']));
     $this->assertEqual('<li id="idfoo" class="class1foo class2foo" foostatus="statusfoo" typebar="bartype">', util_listItemTag('idfoo', ['class1foo', 'class2foo'], ['foostatus' => 'statusfoo', 'typebar' => 'bartype']));
     $this->assertEqual('<li id="idfoo" class="class1foo class2foo" foostatus="statusfoo" typebar="bartype">', util_listItemTag('idfoo', ['class1foo', 'class2foo'], ['typebar' => 'bartype', 'foostatus' => 'statusfoo']));
 }
 public function renderAsListItemEdit($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     if (!$idstr) {
         $idstr = 'list_item-notebook_page_field_' . $this->notebook_page_field_id;
     }
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . '>';
     $mds = $this->getMetadataStructure();
     $mds->loadTermSetAndValues();
     //            util_prePrintR($mds);
     //            $li_elt .= '<div class="notebook-page-field-label field-label" title="'.htmlentities($mds->description).'">'.htmlentities($mds->name).'</div> : <div class="notebook-page-field-value field-value">';
     $li_elt .= '<div class="notebook-page-field-label field-label" title="' . htmlentities($mds->description) . '">' . $mds->renderAsFullName() . '</div> : <div class="notebook-page-field-value field-value">';
     if ($mds->term_set) {
         $li_elt .= $mds->term_set->renderAsSelectControl('page_field_select_' . $this->notebook_page_field_id, $this->value_metadata_term_value_id);
     } else {
         $li_elt .= util_lang('metadata_structure_has_no_term_set');
     }
     $li_elt .= '; <input type="text" name="page_field_open_value_' . $this->notebook_page_field_id . '" id="page_field_open_value_' . $this->notebook_page_field_id . '" class="page_field_open_value" value="' . htmlentities($this->value_open) . '"/>';
     $li_elt .= '</div> <button class="btn btn-danger button-mark-pagefield-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-notebook_page_field_id="' . $this->notebook_page_field_id . '"><i class="icon-remove-sign icon-white"></i></button></li>';
     return $li_elt;
 }
 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;
 }
 public function renderAsListItem_Lead($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     $li_elt_start = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt_start .= ' ' . $this->fieldsAsDataAttribs() . '>';
     return $li_elt_start;
 }
 public function renderAsListItem($idstr = '', $classes_array = [], $other_attribs_hash = [])
 {
     $li_elt = substr(util_listItemTag($idstr, $classes_array, $other_attribs_hash), 0, -1);
     $li_elt .= ' ' . $this->fieldsAsDataAttribs() . '>';
     $li_elt .= $this->renderAsViewEmbed();
     $li_elt .= '</li>';
     return $li_elt;
 }