本文整理汇总了PHP中util_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP util_lang函数的具体用法?PHP util_lang怎么用?PHP util_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了util_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormInteriorForNewMetadataTermValue
public static function renderFormInteriorForNewMetadataTermValue($unique_str)
{
$rendered = '';
$rendered .= '<div class="new-metadata-term-value edit-metadata-term-value">';
$rendered .= ' <div class="edit-metadata-term-value-name">';
$rendered .= '<input type="text" name="metadata-term-value-name-' . $unique_str . '" value="' . htmlentities(util_lang('new_metadata_term_value_name')) . '"/>';
$rendered .= '</div>' . "\n";
$rendered .= ' <div class="edit-metadata-term-value-description">';
$rendered .= '<input type="text" name="metadata-term-value-description-' . $unique_str . '" value="' . htmlentities(util_lang('new_metadata_term_value_description')) . '"/>';
$rendered .= '</div>' . "\n";
$rendered .= '</div>';
return $rendered;
}
示例2: testGetValuesAsOptions
function testGetValuesAsOptions()
{
$this->doLoginBasic();
global $DB;
$DB = $this->DB;
$this->get('http://localhost/digitalfieldnotebooks/ajax_actions/metadata_structure.php?action=value_options&metadata_structure_id=6002');
$this->checkBasicAsserts();
$mdts = Metadata_Term_Set::getOneFromDb(['metadata_term_set_id' => 6101], $DB);
$expected = ' <option value="-1">' . util_lang('prompt_select') . '</option>' . "\n" . $mdts->renderValuesAsOptions();
$this->assertNoPattern('/error/i');
$results = json_decode($this->getBrowser()->getContent());
$this->assertEqual('success', $results->status);
$this->assertEqual($expected, $results->html_output);
}
示例3: testIndexPageLoadsCorrectText
function testIndexPageLoadsCorrectText()
{
$this->get('http://localhost/digitalfieldnotebooks/');
$this->assertTitle(new PatternExpectation('/' . LANG_APP_NAME . ': /'));
$this->assertNoPattern('/' . util_lang('app_signed_in_status') . ': \\<a[^\\>]*\\>' . TESTINGUSER . '\\<\\/a\\>/');
$this->assertPattern('/' . util_lang('app_sign_in_action') . '/');
$this->assertPattern('/' . util_lang('app_short_description') . '/');
$this->assertPattern('/' . util_lang('app_sign_in_msg') . '/');
// check for published, verfied notebooks that are publically viewable
// $this->assertText(ucfirst(util_lang('public')).' '.ucfirst(util_lang('notebooks')));
// $this->assertEltByIdHasAttrOfValue('list-of-user-notebooks','data-notebook-count','1');
// $this->assertEltByIdHasAttrOfValue('notebook-item-1','data-notebook_id','1004');
// $this->assertLink('testnotebook4');
}
示例4: renderAsListItemEdit
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">< ></span>';
$li_elt .= '</div>';
$li_elt .= '</li>';
return $li_elt;
}
示例5: testBaseDataUpdate_NEW
function testBaseDataUpdate_NEW()
{
$this->doLoginAdmin();
$this->get('http://localhost/digitalfieldnotebooks/app_code/metadata_structure.php?action=create&parent_metadata_structure_id=6001');
$this->checkBasicAsserts();
$this->setField('name', 'brand new metadata structure');
$this->click('<i class="icon-ok-sign icon-white"></i> ' . util_lang('save', 'properize'));
$this->checkBasicAsserts();
$this->assertText('brand new metadata structure');
$mds = Metadata_Structure::getOneFromDb(['name' => 'brand new metadata structure'], $this->DB);
$this->assertTrue($mds->matchesDb);
}
示例6: testRenderAsEdit
function testRenderAsEdit()
{
$mds = Metadata_Structure::getOneFromDb(['metadata_structure_id' => 6001], $this->DB);
$mds->loadTermSetAndValues();
$mds->loadReferences();
// name, description, details, term set ('none' is OK) - fields present
// add/remove child structures - add button present, remove buttons present
// re-order child structures - ordering handles and data fields present
// ??? references ?
$canonical = '';
$canonical .= '<form id="form-edit-metadata-structure-base-data" action="/digitalfieldnotebooks/app_code/metadata_structure.php">' . "\n";
$canonical .= ' <input type="hidden" name="action" value="update"/>' . "\n";
$canonical .= ' <input type="hidden" id="metadata_structure_id" name="metadata_structure_id" value="' . $mds->metadata_structure_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/metadata_structure.php?action=view&metadata_structure_id=6001"><i class="icon-remove"></i> Cancel</a> <a id="edit-delete-metadata-structure-control" class="btn btn-danger" href="/digitalfieldnotebooks/app_code/metadata_structure.php?action=delete&metadata_structure_id=6001"><i class="icon-trash icon-white"></i> Delete</a> </div>' . "\n";
$canonical .= '<div id="edit-rendered_metadata_structure_6001" class="edit-rendered_metadata_structure" ' . $mds->fieldsAsDataAttribs() . '>' . "\n";
$canonical .= ' <div class="metadata_lineage"><a href="' . APP_ROOT_PATH . '/app_code/metadata_structure.php?action=list">metadata</a> ></div>' . "\n";
$canonical .= ' <div class="metadata-parent-controls">' . util_lang('label_metadata_structure_change_parent') . ': ' . Metadata_Structure::renderControlSelectAllMetadataStructures('parent_metadata_structure_id', $mds->parent_metadata_structure_id, util_lang('metadata_root_level')) . '</div>' . "\n";
$canonical .= ' <div class="metadata-structure-header">' . "\n";
$canonical .= ' <h3><input id="" class="object-name-control" type="text" name="name" value="flower"/></h3>' . "\n";
$canonical .= ' <div class="active-state-controls"><input type="checkbox" name="flag_active" value="1" checked="checked"/> ' . util_lang('active') . '</div>' . "\n";
$canonical .= ' <div class="description-controls"><input title="brief description/summary" class="description-control" type="text" name="description" value="info about the flower"/></div>' . "\n";
$canonical .= ' <div class="details-controls"><textarea title="additional information/details - no size limit" class="details-control" name="details"></textarea></div>' . "\n";
$canonical .= ' <h4>references</h4>' . "\n";
$canonical .= Metadata_Reference::renderReferencesArrayAsListsEdit($mds->references);
$canonical .= ' </div>' . "\n";
$canonical .= ' <div class="metadata-term-set-controls"><h4>' . util_lang('metadata_term_set') . "</h4>\n" . Metadata_Term_Set::renderAllAsSelectControl('', $mds->term_set ? $mds->term_set->metadata_term_set_id : 0) . "</div>\n";
$canonical .= ' <h4>further breakdown:</h4>' . "\n";
$canonical .= ' <ul class="metadata-structure-tree">' . "\n";
$canonical .= ' <li><a href="' . APP_ROOT_PATH . '/app_code/metadata_structure.php?action=create&parent_metadata_structure_id=' . $mds->metadata_structure_id . '" id="btn-add-metadata-structure" title="' . htmlentities(util_lang('add_metadata_structure')) . '" class="creation_link btn">' . htmlentities(util_lang('add_metadata_structure')) . '</a></li>' . "\n";
$children = $mds->getChildren();
foreach ($children as $mds_child) {
$canonical .= ' ' . $mds_child->renderAsListTreeEditable();
}
$canonical .= ' </ul>';
$canonical .= '</div>';
$rendered = $mds->renderAsEdit();
// echo "<pre>\n".htmlentities($canonical)."\n---------------\n".htmlentities($rendered)."\n</pre>";
$this->assertNoPattern('/IMPLEMENTED/', $rendered);
$this->assertEqual($canonical, $rendered);
}
示例7: renderAsEditEmbed
public function renderAsEditEmbed()
{
$this->cacheImages();
global $USER;
$rendered = '<div class="specimen embedded">' . "\n" . '<button class="btn btn-danger button-mark-specimen-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="list_item-specimen_' . $this->specimen_id . '" data-specimen_id="' . $this->specimen_id . '"><i class="icon-remove-sign icon-white"></i></button>' . "\n" . '<div id="form-edit-specimen-' . $this->specimen_id . '" class="form-edit-specimen" data-specimen_id="' . $this->specimen_id . '">' . "\n" . ' <h3><input type="text" name="specimen-name_' . $this->specimen_id . '" id="specimen-name_' . $this->specimen_id . '" value="' . htmlentities($this->name) . '"/>' . "</h3>\n";
$rendered .= ' <div class="control-workflows">';
if ($this->specimen_id != 'NEW') {
if ($USER->canActOnTarget('publish', $this)) {
$rendered .= ' <span class="published_state workflow-control"><input id="specimen-workflow-publish-control_' . $this->specimen_id . '" type="checkbox" name="specimen-flag_workflow_published_' . $this->specimen_id . '" 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="specimen-workflow-validate-control_' . $this->specimen_id . '" type="checkbox" name="specimen-flag_workflow_validated_' . $this->specimen_id . '" 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 .= "</div>\n";
$rendered .= ' <ul class="base-info">' . "\n";
$rendered .= ' <li><div class="field-label">' . util_lang('coordinates') . '</div> : <div class="field-value"><input type="text" name="specimen-gps_longitude_' . $this->specimen_id . '" id="specimen-gps_longitude_' . $this->specimen_id . '" value="' . $this->gps_longitude . '"/>, <input type="text" name="specimen-gps_latitude_' . $this->specimen_id . '" id="specimen-gps_latitude_' . $this->specimen_id . '" value="' . $this->gps_latitude . '"/></div></li>' . "\n";
$rendered .= ' <li><div class="field-label">' . util_lang('notes') . '</div> : <div class="field-value"><textarea name="specimen-notes_' . $this->specimen_id . '" id="specimen-notes_' . $this->specimen_id . '" class="specimen-notes" row="4" cols="120">' . htmlentities($this->notes) . '</textarea></div></li>' . "\n";
$rendered .= ' <li><div class="field-label">' . util_lang('catalog_identifier') . '</div> : <div class="field-value"><input type="text" name="specimen-catalog_identifier_' . $this->specimen_id . '" id="specimen-catalog_identifier_' . $this->specimen_id . '" value="' . htmlentities($this->catalog_identifier) . '"/></div></li>' . "\n";
$rendered .= ' </ul>' . "\n";
$rendered .= ' <button type="button" class="specimen-save-image-ordering-button btn-success" id="save-specimen-image-ordering-for-' . $this->specimen_id . '" data-for-specimen-id="' . $this->specimen_id . '">' . util_lang('save_ordering', 'ucfirst') . '</button>' . "\n";
$rendered .= ' <ul class="specimen-images inline">' . "\n";
$rendered .= ' <li class="specimen-image-upload-section"><a href="#" id="specimen-control-add-image-for-' . $this->specimen_id . '" class="btn add-specimen-image-button" data-for-specimen="' . $this->specimen_id . '">' . util_lang('add_specimen_image') . '</a>' . "\n";
$rendered .= '<div id="specimen-image-upload-form-for-' . $this->specimen_id . '" class="specimen-image-upload-form">' . "\n";
$rendered .= '<input name="image_file" id="specimen-image-file-for-' . $this->specimen_id . '" class="specimen-image-file-picker" type="file" />' . "\n";
$rendered .= '<label class="specimen-image-file-input-label" id="specimen-image-file-for-' . $this->specimen_id . '-label" for="specimen-image-file-for-' . $this->specimen_id . '">' . util_lang('prompt_choose_file', 'properize') . '</label>' . "\n";
$rendered .= '<input type="button" class="specimen-image-upload-do-it-button" id="specimen-image-upload-submit-for-' . $this->specimen_id . '" value="' . util_lang('upload', 'properize') . '" data-for-specimen="' . $this->specimen_id . '"/>' . "\n";
$rendered .= '<input type="button" class="specimen-image-upload-cancel-button" value="' . util_lang('cancel', 'properize') . '" data-for-specimen="' . $this->specimen_id . '"/>' . "\n";
$rendered .= '<img src="' . APP_ROOT_PATH . '/img/ajax-loader.gif" id="loading-img" style="display:none;" alt="Please Wait"/>' . "\n";
$rendered .= '</div>' . "\n";
$rendered .= '</li>' . "\n";
if (count($this->images) > 0) {
foreach ($this->images as $image) {
$rendered .= ' ' . $image->renderAsListItemEdit() . "\n";
}
}
$rendered .= ' </ul>' . "\n";
$rendered .= "</div>\n</div>";
return $rendered;
}
示例8: renderAsEdit
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;
}
示例9: renderAsListItemEdit
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;
}
示例10: testNewNotebookPage
function testNewNotebookPage()
{
$n = Notebook::getOneFromDb(['notebook_id' => 1001], $this->DB);
$this->doLoginBasic();
$this->get('http://localhost/digitalfieldnotebooks/app_code/notebook.php?action=edit¬ebook_id=1001');
$this->checkBasicAsserts();
$this->click(util_lang('add_notebook_page'));
$this->checkBasicAsserts();
$this->assertEltByIdHasAttrOfValue('form-edit-notebook-page-base-data', 'action', APP_ROOT_PATH . '/app_code/notebook_page.php');
// $this->showContent();
}
示例11: testRenderAsEdit
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);
}
示例12: renderAsEdit
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;
//.........这里部分代码省略.........
示例13: testRenderAsListItemEdit_noTermSet
function testRenderAsListItemEdit_noTermSet()
{
$npf = Notebook_Page_Field::getOneFromDb(['notebook_page_field_id' => 1204], $this->DB);
$mds = Metadata_Structure::getOneFromDb(['metadata_structure_id' => 6004], $this->DB);
global $USER;
$USER = User::getOneFromDb(['username' => TESTINGUSER], $this->DB);
$canonical = '<li id="list_item-notebook_page_field_1204" data-notebook_page_field_id="1204" data-created_at="' . $npf->created_at . '" data-updated_at="' . $npf->updated_at . '" data-notebook_page_id="1101" data-label_metadata_structure_id="6004" data-value_metadata_term_value_id="0" data-value_open="wavy-ish" data-flag_delete="0">' . '<div class="notebook-page-field-label field-label" title="' . htmlentities($mds->description) . '">' . $mds->renderAsFullName() . '</div> : <div class="notebook-page-field-value field-value">' . util_lang('metadata_structure_has_no_term_set') . '; <input type="text" name="page_field_open_value_1204" id="page_field_open_value_1204" class="page_field_open_value" value="wavy-ish"/>' . '</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="list_item-notebook_page_field_1204" data-notebook_page_field_id="1204"><i class="icon-remove-sign icon-white"></i></button></li>';
$rendered = $npf->renderAsListItemEdit();
// echo "<pre>\n".htmlentities($canonical)."\n--------\n".htmlentities($rendered)."\n</pre>";
$this->assertEqual($canonical, $rendered);
$this->assertNoPattern('/IMPLEMENTED/', $rendered);
}
示例14: testRenderAsListItemEdit
function testRenderAsListItemEdit()
{
$si = Specimen_Image::getOneFromDb(['specimen_image_id' => 8103], $this->DB);
global $USER;
$USER = User::getOneFromDb(['username' => TESTINGUSER], $this->DB);
$canonical = '<li id="specimen-image-8103" class="specimen-image" data-specimen_image_id="8103" data-created_at="' . $si->created_at . '" data-updated_at="' . $si->updated_at . '" data-specimen_id="8002" data-user_id="101" data-image_reference="testing/USER101_8103_cnh_castanea_dentata.jpg" data-ordering="0.75000" data-flag_workflow_published="0" data-flag_workflow_validated="1" data-flag_delete="0">';
$canonical .= '<button type="button" class="btn btn-danger button-delete-specimen-image" title="' . util_lang('prompt_confirm_delete', 'ucfirst') . '" data-specimen_image_id="' . $si->specimen_image_id . '" data-dom_id="specimen-image-8103"><i class="icon-remove icon-white"></i></button><br/>';
$canonical .= $si->renderAsHtml();
$canonical .= '<div class="controls">';
$canonical .= util_orderingLeftRightControls('specimen-image-8103');
$canonical .= '<input type="hidden" name="new_ordering-specimen-image-8103" id="new_ordering-specimen-image-8103" value="' . $si->ordering . '"/>';
// publish, verify, reordering handle
$canonical .= '<div class="control-workflows"><span class="control-publish"><input id="flag_workflow_published_8103-control" type="checkbox" name="flag_workflow_published" value="1" /> publish</span>, <span class="control-verify">verified</span></div>';
$canonical .= '</div>';
$canonical .= '</li>';
$rendered = $si->renderAsListItemEdit();
// echo "<pre>\n".htmlentities($canonical)."\n------------------\n".htmlentities($rendered)."\n</pre>";
$this->assertEqual($canonical, $rendered);
$this->assertNoPattern('/IMPLEMENTED/', $rendered);
}
示例15: foreach
exit;
}
# 2. confirm that the user is allowed to take that action
// global specimen create
// additional permission checks are handled at the save point for notebook pages and authoritative plants respectively
$has_permission = $USER->flag_is_system_admin;
if (!$has_permission) {
$USER->cacheRoleActionTargets();
// check global specimen perms (indiv specimen perms are only for editing, not creating, as indiv perms require a specific object ID as a target for the permission)
if (in_array('global_specimen', array_keys($USER->cached_role_action_targets_hash_by_target_type_by_id))) {
foreach ($USER->cached_role_action_targets_hash_by_target_type_by_id['global_specimen'] as $glob_rat) {
if ($glob_rat->action_id == $ACTIONS['create']->action_id) {
$has_permission = true;
break;
}
}
}
}
if (!$has_permission) {
$results['note'] = util_lang('no_permission');
echo json_encode($results);
exit;
}
# 3. branch behavior based on the action
# create - return an appropriate form field set
if ($has_permission && $action == 'create') {
$results['html_output'] = '<div class="specimen embedded">' . "\n" . Specimen::renderFormInteriorForNewSpecimen($unique_str, $DB) . "\n</div>";
$results['status'] = 'success';
}
echo json_encode($results);
exit;