$vs_buf .= caFormTag($this->request, 'Edit', 'NewChildForm', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
    $vs_buf .= _t('Add a %1 under this', $vs_type_list) . caHTMLHiddenInput($t_item->primaryKey(), array('value' => '0')) . caHTMLHiddenInput('parent_id', array('value' => $t_item->getPrimaryKey()));
    $vs_buf .= '<div id="caTypeChangePanelControlButtons">';
    $vs_buf .= '<div class="saveButton">' . caFormSubmitLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_SAVE__), '', 'NewChildForm') . " " . _t('Save') . "</div>";
    $vs_buf .= caJSButton($this->request, __CA_NAV_BUTTON_CANCEL__, _t('Cancel'), 'caChangeTypeFormCancelButton', array('onclick' => 'caCreateChildPanel.hidePanel(); return false;'), array());
    $vs_buf .= "</div>";
    $vs_buf .= "</form></div>\n";
}
if ($t_item->tableName() == 'ca_collections' && $this->request->config->get('ca_objects_x_collections_hierarchy_enabled')) {
    $t_object = new ca_objects();
    if ((bool) $this->request->config->get('ca_objects_enforce_strict_type_hierarchy')) {
        // strict menu
        $vs_type_list = $t_object->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('childrenOfCurrentTypeOnly' => true, 'directChildrenOnly' => $this->request->config->get($vs_table_name . '_enforce_strict_type_hierarchy') == '~' ? false : true, 'returnHierarchyLevels' => true, 'access' => __CA_BUNDLE_ACCESS_EDIT__));
    } else {
        // all types
        $vs_type_list = $t_object->getTypeListAsHTMLFormElement('type_id', array('style' => 'width: 90px; font-size: 9px;'), array('access' => __CA_BUNDLE_ACCESS_EDIT__));
    }
    $vs_buf .= '<div style="border-top: 1px solid #aaaaaa; margin-top: 5px; font-size: 10px; padding-top:10px" class="addChild">';
    $vs_buf .= caFormTag($this->request, 'Edit', 'NewChildObjectForm', 'editor/objects/ObjectEditor', 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
    $vs_buf .= _t('Add a %1 under this', $vs_type_list) . caHTMLHiddenInput('object_id', array('value' => '0')) . caHTMLHiddenInput('collection_id', array('value' => $t_item->getPrimaryKey()));
    $vs_buf .= '<div id="caTypeChangePanelControlButtons">';
    $vs_buf .= '<div class="saveButton">' . caFormSubmitLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_SAVE__), '', 'NewChildObjectForm') . " " . _t('Save') . "</div>";
    $vs_buf .= caJSButton($this->request, __CA_NAV_BUTTON_CANCEL__, _t('Cancel'), 'caChangeTypeFormCancelButton', array('onclick' => 'caCreateChildPanel.hidePanel(); return false;'), array());
    $vs_buf .= "</div>";
    $vs_buf .= "</form></div>\n";
}
print $vs_buf;
?>
			
	</div>
</div>
}
if ($vo_result) {
    if ($vs_viz_list = Visualizer::getAvailableVisualizationsAsHTMLFormElement($vo_result->tableName(), 'viz', array('id' => 'caSearchVizOpts'), array('resultContext' => $vo_result_context, 'data' => $vo_result, 'restrictToTypes' => array($vo_result_context->getTypeRestriction($vb_type_restriction_has_changed))))) {
        ?>
			<div class='visualize'>
				<div id='vizLink'>
					<?php 
        print "<a href='#'  onclick='jQuery(\"#caSearchVizOptsContainer\").slideToggle(250); jQuery(\"#vizLink\").hide();return false;'>" . caNavIcon($this->request, __CA_NAV_BUTTON_VISUALIZE__) . " " . _t("Visualize") . "</a>";
        ?>
					<div class='clear:both;'></div>
				</div>
				<div id='caSearchVizOptsContainer' style="display:none;">
					<?php 
        print $vs_viz_list;
        ?>
					<?php 
        print "<a href='#'  onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, $this->request->getModulePath(), $this->request->getController(), 'Viz', array()) . "/viz/\" + jQuery(\"#caSearchVizOpts\").val()); return false;'>" . _t("Go") . "</a>";
        ?>
					
					<a href='#' id='hideViz' onclick='$("#caSearchVizOptsContainer").slideUp(250); $("#vizLink").slideDown(250); '><?php 
        print caNavIcon($this->request, __CA_NAV_BUTTON_COLLAPSE__);
        ?>
</a>
					<div class='clear:both;width:100%;'></div>
				</div>

			</div>
<?php 
    }
    print $this->render('Search/search_sets_html.php');
}
예제 #3
0
		
		</div>
		<input type="hidden" name="<?php 
print $vs_id_prefix;
?>
BundleList" id="<?php 
print $vs_id_prefix;
?>
BundleList" value=""/>
		<div style="clear: both; width: 1px; height: 1px;"><!-- empty --></div>
<?php 
if (!$vb_read_only && !(bool) $va_settings['restrictToTermsRelatedToCollection']) {
    ?>
	
		<div class='button labelInfo caAddItemButton'><a href='#'><?php 
    print caNavIcon($this->request, __CA_NAV_BUTTON_ADD__);
    ?>
 <?php 
    print $vs_add_label ? $vs_add_label : _t("Add relationship");
    ?>
</a></div>
<?php 
}
?>
	</div>
</div>

<div id="caRelationEditorPanel<?php 
print $vs_id_prefix;
?>
" class="caRelationQuickAddPanel"> 
        print $i == 1 ? "class='odd'" : "";
        ?>
>
				<td style="width:10px">
<?php 
        if ($t_rel = $o_dm->getInstanceByTableNum($vo_result->get('table_num'), true)) {
            print ' (<i>' . $t_rel->getProperty('NAME_SINGULAR') . '</i>)';
        }
        ?>
				</td>
<?php 
        foreach ($va_display_list as $vn_placement_id => $va_display_item) {
            print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id) . "</td>";
        }
        print "<td style='width:5%;'>" . caNavLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'administrate/setup/relationship_type_editor', 'RelationshipTypeEditor', 'Edit', array('type_id' => $vn_type_id));
        print " <a href='#' onclick='caOpenBrowserWith(" . $vn_type_id . ");'>" . caNavIcon($this->request, __CA_NAV_BUTTON_GO__, null, array('title' => _t('View in hierarchy'))) . "</a>";
        print "</td>";
        ?>
	
			</tr>
<?php 
        $i++;
        $vn_item_count++;
    }
    ?>
	</tbody></table>
</form><!--end caFindResultsForm -->
</div><!--end scrollingResults -->
<?php 
}
?>
        print "</div><!-- end browseCriteria -->\n";
        print "<div class='blueDivide'></div>";
    } else {
        if (sizeof($va_facets)) {
            print "<div id='facetList'>";
            print "<div class='startBrowsingBy'>" . _t("Browse by") . "</div>";
            $va_available_facets = $this->getVar('available_facets');
            $i = 0;
            foreach ($va_available_facets as $vs_facet_code => $va_facet_info) {
                $i++;
                $vs_style = "";
                if ($i == 4) {
                    $vs_style = "style='clear:left;'";
                    $i = 1;
                }
                print "<div class='facetHeadingLink facet{$vs_facet_code}' " . $vs_style . "><a href='#' onclick='caUIBrowsePanel.showBrowsePanel(\"{$vs_facet_code}\"); \$(\".facetHeadingLink\").removeClass(\"active\"); \$(\".facet{$vs_facet_code}\").addClass(\"active\");'>" . $va_facet_info['label_plural'] . caNavIcon($this->request, __CA_NAV_BUTTON_ADD__) . "</a></div>\n";
                #print "<div class='facetDescription'>".$va_facet_info["description"]."</div>";
            }
            print "<div style='clear:both; height:1px;'><!-- empty --></div></div><!-- end facetList -->";
        }
    }
    ?>
	</div><!-- end position relative -->
<?php 
}
?>

	
	<div id="splashBrowsePanel" style="z-index:1000;">
		<div id="splashBrowsePanelContent">
		
    } else {
        $vs_action = "Summary";
    }
    $i == 2 ? $i = 0 : "";
    ?>
				<tr <?php 
    print $i == 1 ? "class='odd'" : "";
    ?>
>
					<td style="width:10px">
						<input type='checkbox' name='add_to_set_ids' value='<?php 
    print (int) $vn_occurrence_id;
    ?>
' class="addItemToSetControl" />
					</td>
	<?php 
    print "<td style='width:5%;'>" . caNavLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'editor/occurrences', 'OccurrenceEditor', $vs_action, array('occurrence_id' => $vn_occurrence_id)) . "</td>";
    foreach ($va_display_list as $vn_placement_id => $va_display_item) {
        print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id, array('request' => $this->request)) . "</td>";
    }
    ?>
	
				</tr>
	<?php 
    $i++;
    $vn_item_count++;
}
?>
		</tbody></table>
	</form>
</div><!--end scrollingResults -->		
예제 #7
0
 /**
  * Options:
  *		appendToSearch = optional text to be AND'ed wuth current search expression
  *		output_format = determines format out search result output. "PDF" and "HTML" are currently supported; "HTML" is the default
  *		view = view with path relative to controller to use overriding default ("search/<table_name>_search_basic_html.php")
  *		vars = associative array with key value pairs to assign to the view
  *
  * Callbacks:
  * 		hookBeforeNewSearch() is called just before executing a new search. The first parameter is the BrowseEngine object containing the search.
  */
 public function Index($pa_options = null)
 {
     $po_search = isset($pa_options['search']) ? $pa_options['search'] : null;
     if (isset($pa_options['saved_search']) && $pa_options['saved_search']) {
         $this->opo_result_context->setSearchExpression($pa_options['saved_search']['search']);
         $this->opo_result_context->isNewSearch(true);
     }
     parent::Index($pa_options);
     AssetLoadManager::register('hierBrowser');
     AssetLoadManager::register('browsable');
     // need this to support browse panel when filtering/refining search results
     $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $va_access_values = caGetUserAccessValues($this->request);
     // Get elements of result context
     $vn_page_num = $this->opo_result_context->getCurrentResultsPageNumber();
     $vs_search = $this->opo_result_context->getSearchExpression();
     $vb_is_new_search = $this->opo_result_context->isNewSearch();
     if ((bool) $this->request->getParameter('reset', pString) && $this->request->getParameter('reset', pString) != 'save') {
         $vs_search = '';
         $vb_is_new_search = true;
     }
     if (!($vn_items_per_page = $this->opo_result_context->getItemsPerPage())) {
         $vn_items_per_page = $this->opn_items_per_page_default;
         $this->opo_result_context->setItemsPerPage($vn_items_per_page);
     }
     if (!($vs_view = $this->opo_result_context->getCurrentView())) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = $this->ops_view_default ? $this->ops_view_default : array_shift($va_tmp);
         $this->opo_result_context->setCurrentView($vs_view);
     }
     if (!isset($this->opa_views[$vs_view])) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = array_shift($va_tmp);
     }
     if (!($vs_sort = $this->opo_result_context->getCurrentSort())) {
         $va_tmp = array_keys($this->opa_sorts);
         $vs_sort = array_shift($va_tmp);
     }
     $vs_sort_direction = $this->opo_result_context->getCurrentSortDirection();
     $vb_sort_has_changed = $this->opo_result_context->sortHasChanged();
     if (!$this->opn_type_restriction_id) {
         $this->opn_type_restriction_id = '';
     }
     $this->view->setVar('type_id', $this->opn_type_restriction_id);
     MetaTagManager::setWindowTitle(_t('%1 search', $this->searchName('plural')));
     // Get attribute sorts
     $va_sortable_elements = ca_metadata_elements::getSortableElements($this->ops_tablename, $this->opn_type_restriction_id);
     if (!is_array($this->opa_sorts)) {
         $this->opa_sorts = array();
     }
     foreach ($va_sortable_elements as $va_sortable_element) {
         $this->opa_sorts[$this->ops_tablename . '.' . $va_sortable_element['element_code']] = $va_sortable_element['display_label'];
     }
     if ($pa_options['appendToSearch']) {
         $vs_append_to_search .= " AND (" . $pa_options['appendToSearch'] . ")";
     }
     //
     // Execute the search
     //
     if ($vs_search && $vs_search != "") {
         /* any request? */
         $va_search_opts = array('sort' => $vs_sort, 'sort_direction' => $vs_sort_direction, 'appendToSearch' => $vs_append_to_search, 'checkAccess' => $va_access_values, 'no_cache' => $vb_is_new_search, 'dontCheckFacetAvailability' => true, 'filterNonPrimaryRepresentations' => true);
         if ($vb_is_new_search || isset($pa_options['saved_search']) || is_subclass_of($po_search, "BrowseEngine") && !$po_search->numCriteria()) {
             $vs_browse_classname = get_class($po_search);
             $po_search = new $vs_browse_classname();
             if (is_subclass_of($po_search, "BrowseEngine")) {
                 $po_search->addCriteria('_search', $vs_search);
                 if (method_exists($this, "hookBeforeNewSearch")) {
                     $this->hookBeforeNewSearch($po_search);
                 }
             }
             $this->opo_result_context->setParameter('show_type_id', null);
         }
         if ($this->opn_type_restriction_id) {
             $po_search->setTypeRestrictions(array($this->opn_type_restriction_id), array('includeSubtypes' => false));
         }
         $vb_criteria_have_changed = false;
         if (is_subclass_of($po_search, "BrowseEngine")) {
             //
             // Restrict facets to specific group for main browse landing page (if set in app.conf config)
             //
             if ($vs_facet_group = $this->request->config->get($this->ops_tablename . '_search_refine_facet_group')) {
                 $po_search->setFacetGroup($vs_facet_group);
             }
             $vb_criteria_have_changed = $po_search->criteriaHaveChanged();
             $po_search->execute($va_search_opts);
             $this->opo_result_context->setParameter('browse_id', $po_search->getBrowseID());
             if ($vs_group_name = $this->request->config->get('browse_facet_group_for_' . $this->ops_tablename)) {
                 $po_search->setFacetGroup($vs_group_name);
             }
             $vo_result = $po_search->getResults($va_search_opts);
         } else {
             $vo_result = $po_search->search($vs_search, $va_search_opts);
         }
         $vo_result = isset($pa_options['result']) ? $pa_options['result'] : $vo_result;
         $this->opo_result_context->validateCache();
         // Only prefetch what we need
         $vo_result->setOption('prefetch', $vn_items_per_page);
         //
         // Handle details of partitioning search results by type, if required
         //
         if ((bool) $this->request->config->get('search_results_partition_by_type')) {
             $va_type_counts = $vo_result->getResultCountForFieldValues(array('ca_objects.type_id'));
             $va_type_counts_obj_type = $va_type_counts['ca_objects.type_id'];
             ksort($va_type_counts_obj_type);
             $this->view->setVar('counts_by_type', $va_type_counts_obj_type);
             $vn_show_type_id = $this->opo_result_context->getParameter('show_type_id');
             if (!isset($va_type_counts_obj_type[$vn_show_type_id])) {
                 $va_tmp = array_keys($va_type_counts_obj_type);
                 $vn_show_type_id = array_shift($va_tmp);
             }
             $this->view->setVar('show_type_id', $vn_show_type_id);
             $vo_result->filterResult('ca_objects.type_id', $vn_show_type_id);
         }
         if ($vb_is_new_search || $vb_criteria_have_changed || $vb_sort_has_changed) {
             $this->opo_result_context->setResultList($vo_result->getPrimaryKeyValues());
             $this->opo_result_context->setParameter('availableVisualizationChecked', 0);
             if ($this->opo_result_context->searchExpressionHasChanged()) {
                 $vn_page_num = 1;
             }
         }
         $this->view->setVar('num_hits', $vo_result->numHits());
         $this->view->setVar('num_pages', $vn_num_pages = ceil($vo_result->numHits() / $vn_items_per_page));
         if ($vn_page_num > $vn_num_pages) {
             $vn_page_num = 1;
         }
         $vo_result->seek(($vn_page_num - 1) * $vn_items_per_page);
         $this->view->setVar('page', $vn_page_num);
         $this->view->setVar('search', $vs_search);
         $this->view->setVar('result', $vo_result);
     }
     //
     // Set up view for display of results
     //
     $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $this->view->setVar('views', $this->opa_views);
     // pass view list to view for rendering
     $this->view->setVar('current_view', $vs_view);
     $this->view->setVar('sorts', $this->opa_sorts);
     // pass sort list to view for rendering
     $this->view->setVar('current_sort', $vs_sort);
     $this->view->setVar('current_sort_direction', $vs_sort_direction);
     $this->view->setVar('current_items_per_page', $vn_items_per_page);
     $this->view->setVar('items_per_page', $this->opa_items_per_page);
     $this->view->setVar('t_subject', $t_model);
     $this->view->setVar('mode_name', _t('search'));
     $this->view->setVar('mode', 'search');
     $this->view->setVar('mode_type_singular', $this->searchName('singular'));
     $this->view->setVar('mode_type_plural', $this->searchName('plural'));
     $this->view->setVar('search_history', $this->opo_result_context->getSearchHistory());
     $this->view->setVar('result_context', $this->opo_result_context);
     $this->view->setVar('uses_hierarchy_browser', $this->usesHierarchyBrowser());
     $this->view->setVar('access_values', $va_access_values);
     $this->view->setVar('browse', $po_search);
     $t_display = $this->view->getVar('t_display');
     if (!is_array($va_display_list = $this->view->getVar('display_list'))) {
         $va_display_list = array();
     }
     if ($vs_view == 'editable') {
         $va_initial_data = array();
         $va_row_headers = array();
         $vn_item_count = 0;
         if ($vo_result) {
             $vs_pk = $vo_result->primaryKey();
             while ($vn_item_count < 100 && $vo_result->nextHit()) {
                 $va_result = array('item_id' => $vn_id = $vo_result->get($vs_pk));
                 foreach ($va_display_list as $vn_placement_id => $va_bundle_info) {
                     $va_result[str_replace(".", "-", $va_bundle_info['bundle_name'])] = $t_display->getDisplayValue($vo_result, $vn_placement_id, array('request' => $this->request));
                 }
                 $va_initial_data[] = $va_result;
                 $vn_item_count++;
                 $va_row_headers[] = $vn_item_count . " " . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), 'caResultsEditorEditLink', $this->ops_tablename, $vn_id);
             }
         }
         $this->view->setVar('initialData', $va_initial_data);
         $this->view->setVar('rowHeaders', $va_row_headers);
     }
     //
     // Bottom line
     //
     $va_bottom_line = array();
     $vb_bottom_line_is_set = false;
     foreach ($va_display_list as $vn_placement_id => $va_placement) {
         if (isset($va_placement['settings']['bottom_line']) && $va_placement['settings']['bottom_line']) {
             $va_bottom_line[$vn_placement_id] = caProcessBottomLineTemplate($this->request, $va_placement, $vo_result, array('pageStart' => ($vn_page_num - 1) * $vn_items_per_page, 'pageEnd' => ($vn_page_num - 1) * $vn_items_per_page + $vn_items_per_page));
             $vb_bottom_line_is_set = true;
         } else {
             $va_bottom_line[$vn_placement_id] = '';
         }
     }
     $this->view->setVar('bottom_line', $vb_bottom_line_is_set ? $va_bottom_line : null);
     switch ($pa_options['output_format']) {
         # ------------------------------------
         case 'LABELS':
             $this->_genLabels($vo_result, $this->request->getParameter("label_form", pString), $vs_search, $vs_search);
             break;
             # ------------------------------------
         # ------------------------------------
         case 'EXPORT':
             $this->_genExport($vo_result, $this->request->getParameter("export_format", pString), $vs_search, $vs_search);
             break;
             # ------------------------------------
         # ------------------------------------
         case 'HTML':
         default:
             // generate type menu and type value list
             if (method_exists($t_model, "getTypeList")) {
                 $this->view->setVar('type_list', $t_model->getTypeList());
             }
             if ($this->opb_uses_hierarchy_browser) {
                 AssetLoadManager::register('hierBrowser');
                 // only for interfaces that use the hierarchy browser
                 $t_list = new ca_lists();
                 if ($vs_type_list_code = $t_model->getTypeListCode()) {
                     $this->view->setVar('num_types', $t_list->numItemsInList($vs_type_list_code));
                     $this->view->setVar('type_menu', $t_list->getListAsHTMLFormElement($vs_type_list_code, 'type_id', array('id' => 'hierTypeList')));
                 }
                 // set last browse id for hierarchy browser
                 $this->view->setVar('browse_last_id', intval($this->request->session->getVar($this->ops_tablename . '_browse_last_id')));
             }
             $this->opo_result_context->setAsLastFind();
             $this->opo_result_context->saveContext();
             if (isset($pa_options['vars']) && is_array($pa_options['vars'])) {
                 foreach ($pa_options['vars'] as $vs_key => $vs_val) {
                     $this->view->setVar($vs_key, $vs_val);
                 }
             }
             if (isset($pa_options['view']) && $pa_options['view']) {
                 $this->render($pa_options['view']);
             } else {
                 $this->render('Search/' . $this->ops_tablename . '_search_basic_html.php');
             }
             break;
             # ------------------------------------
     }
 }
예제 #8
0
,
					setItemAutocompleteID: '<?php 
    print $vs_id_prefix;
    ?>
setItemAutocompleter',
					rowIDListID: '<?php 
    print $vs_id_prefix;
    ?>
setRowIDList',
					displayTemplate: <?php 
    print isset($va_settings['displayTemplate']) ? json_encode($va_settings['displayTemplate']) : 'null';
    ?>
,
					
					editSetItemButton: '<?php 
    print addslashes(caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__));
    ?>
',
					
					lookupURL: '<?php 
    print $va_lookup_urls['search'];
    ?>
',
					itemInfoURL: '<?php 
    print caNavUrl($this->request, 'manage/sets', 'SetEditor', 'GetItemInfo');
    ?>
',
					editSetItemsURL: '<?php 
    print caNavUrl($this->request, 'manage/set_items', 'SetItemEditor', 'Edit', array('set_id' => $vn_set_id));
    ?>
',
			bundleDisplayOps = caUI.bundlelisteditor({
				availableListID: 'bundleDisplayEditorAvailableList',
				toDisplayListID: 'bundleDisplayEditorToDisplayList',
				
				availableDisplayList: <?php 
print json_encode($va_available_display_items);
?>
,
				initialDisplayList: 	<?php 
print json_encode($va_to_display_items);
?>
,
				initialDisplayListOrder : <?php 
print json_encode(array_keys($va_to_display_items));
?>
,
				
				displayBundleListID: '<?php 
print $vs_id_prefix;
?>
displayBundleList',
				
				settingsIcon: "<?php 
print caNavIcon($this->request, __CA_NAV_BUTTON_INFO2__);
?>
"
			});		
		});
	</script>
</div>
예제 #10
0
 /**
  * Returns HTML <select> element containing the specified list, or portion of the list.
  *
  * @param mixed $pm_list_name_or_id
  * @param string $ps_name
  * @param array $pa_attributes 
  * @param array $pa_options Array of options. Valid options include:
  * 	childrenOnlyForItemID = if set only items below item_id in the list item hierarchy are returned. Default (null) is to return all items in the list.
  * 	directChildrenOnly = if set only items with item_id=childrenOnlyForItemID as parent in the list item hierarchy are returned. Default (null) is to return all items in the list.
  *  nullOption = if set then a "null" (no value) option is available labeled with the value passed in this option
  *  additionalOptions = an optional array of options that will be passed through to caHTMLSelect; keys are display labels and values are used as option values
  *  value = if set, the <select> will have default selection set to the item whose *value* matches the option value. If none is set then the first item in the list will be selected
  *  key = ca_list_item field to be used as value for the <select> element list; can be set to either item_id or item_value; default is item_id
  *	width = the display width of the list in characters or pixels
  *  limitToItemsWithID = An optional array of list item_ids. Item_ids not in the array will be omitted from the returned list.
  *  omitItemsWithID = An optional array of list item_ids. Item_ids in the array will be omitted from the returned list.
  *  disableItemsWithID = An optional array of list item_ids. Item_ids in the array will be disabled in the returned list.	
  *
  *	limitToItemsRelatedToCollections = an array of collection_ids or collection idno's; returned items will be restricted to those attached to the specified collections
  *	limitToItemsRelatedToCollectionWithRelationshipTypes = array of collection type names or type_ids; returned items will be restricted to those attached to the specified collectionss with the specified relationship type
  *	limitToListIDs = array of list_ids to restrict returned items to when using "limitToItemsRelatedToCollections"
  *
  *  indentForHierarchy = indicate hierarchy with indentation. [Default is true]
  * 	transaction = transaction to perform database operations within. [Default is null]
  * 
  * @return string - HTML code for the <select> element; empty string if the list is empty
  */
 public static function getListAsHTMLFormElement($pm_list_name_or_id, $ps_name, $pa_attributes = null, $pa_options = null)
 {
     $t_list = new ca_lists();
     if ($o_trans = caGetOption('transaction', $pa_options, null)) {
         $t_list->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!(isset($pa_options['limitToItemsRelatedToCollection']) && is_array($pa_options['limitToItemsRelatedToCollections']))) {
         $vn_list_id = $t_list->_getListID($pm_list_name_or_id);
         $t_list->load($vn_list_id);
     }
     $vn_root_id = isset($pa_options['childrenOnlyForItemID']) && $pa_options['childrenOnlyForItemID'] ? $pa_options['childrenOnlyForItemID'] : null;
     $va_disabled_item_ids = caGetOption('disableItemsWithID', $pa_options, null);
     $vs_render_as = isset($pa_options['render']) ? $pa_options['render'] : '';
     $vn_sort_type = $t_list->get('default_sort');
     if ($vs_render_as == 'yes_no_checkboxes' && $vn_sort_type == __CA_LISTS_SORT_BY_LABEL__) {
         $vn_sort_type = __CA_LISTS_SORT_BY_IDENTIFIER__;
         // never allow sort-by-label when rendering as yes/no checkbox
     }
     if (!in_array($vs_render_as, array('lookup', 'horiz_hierbrowser', 'vert_hierbrowser'))) {
         if (isset($pa_options['limitToItemsRelatedToCollections']) && is_array($pa_options['limitToItemsRelatedToCollections'])) {
             $t_collection = new ca_collections();
             $va_collection_ids = array();
             foreach ($pa_options['limitToItemsRelatedToCollections'] as $vn_collection_id) {
                 if ($vn_collection_id && !is_numeric($vn_collection_id)) {
                     if ($vn_collection_id = $t_collection->load(array('idno' => $vn_collection_id))) {
                         $va_collection_ids[] = $vn_collection_id;
                     }
                 } else {
                     if ($vn_collection_id) {
                         $va_collection_ids[] = $vn_collection_id;
                     }
                 }
             }
             if (sizeof($va_collection_ids)) {
                 $qr_collections = $t_list->makeSearchResult('ca_collections', $va_collection_ids, array('restrictToRelationshipTypes' => isset($pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes']) ? $pa_options['limitToItemsRelatedToCollectionWithRelationshipTypes'] : null));
                 $va_item_ids = array();
                 while ($qr_collections->nextHit()) {
                     $va_list_items = $qr_collections->get('ca_list_items', array('returnAsArray' => true));
                     foreach ($va_list_items as $vn_rel_id => $va_list_item) {
                         $va_item_ids[$vn_rel_id] = $va_list_item['item_id'];
                     }
                 }
                 if ($va_limit_to_listIDs = isset($pa_options['limitToListIDs']) && is_array($pa_options['limitToListIDs']) ? $pa_options['limitToListIDs'] : null) {
                     // for some reason the option comes back as array(0 => null) if no list is selected in UI
                     // -> have to make sure to catch this case here
                     if (sizeof($va_limit_to_listIDs) == 1 && empty($va_limit_to_listIDs[0])) {
                         $va_limit_to_listIDs = null;
                     }
                 }
                 if (is_array($va_limit_to_listIDs) && sizeof($va_item_ids)) {
                     // filter out items from tables we don't want
                     $qr_list_items = $t_list->makeSearchResult("ca_list_items", array_values($va_item_ids));
                     while ($qr_list_items->nextHit()) {
                         if (!in_array($qr_list_items->get('ca_list_items.list_id'), $va_limit_to_listIDs)) {
                             if (is_array($va_k = array_keys($va_item_ids, $qr_list_items->get('ca_list_items.item_id')))) {
                                 foreach ($va_k as $vs_k) {
                                     unset($va_list_items[$vs_k]);
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             $va_list_items = $t_list->getItemsForList($pm_list_name_or_id, array_merge($pa_options, array('returnHierarchyLevels' => caGetOption('indentForHierarchy', $pa_options, true), 'item_id' => $vn_root_id, 'extractValuesByUserLocale' => true, 'sort' => $vn_sort_type)));
         }
     }
     if (!is_array($va_list_items)) {
         $va_list_items = array();
     }
     $va_options = array();
     $va_disabled_options = array();
     if (!isset($pa_options['value'])) {
         $pa_options['value'] = null;
     }
     if (!isset($pa_options['key'])) {
         $pa_options['key'] = 'item_id';
     }
     if (!in_array($pa_options['key'], array('item_id', 'item_value'))) {
         $pa_options['key'] = 'item_id';
     }
     if (!isset($pa_options['limitToItemsWithID']) || !is_array($pa_options['limitToItemsWithID']) || !sizeof($pa_options['limitToItemsWithID'])) {
         $pa_options['limitToItemsWithID'] = null;
     }
     if (!isset($pa_options['omitItemsWithID']) || !is_array($pa_options['omitItemsWithID']) || !sizeof($pa_options['omitItemsWithID'])) {
         $pa_options['omitItemsWithID'] = null;
     }
     if (isset($pa_options['nullOption']) && $pa_options['nullOption'] && $vs_render_as != 'checklist') {
         $va_options[''] = $pa_options['nullOption'];
     }
     $va_colors = array();
     $vn_default_val = null;
     foreach ($va_list_items as $vn_item_id => $va_item) {
         if (is_array($pa_options['limitToItemsWithID']) && !in_array($vn_item_id, $pa_options['limitToItemsWithID'])) {
             continue;
         }
         if (is_array($pa_options['omitItemsWithID']) && in_array($vn_item_id, $pa_options['omitItemsWithID'])) {
             continue;
         }
         $va_options[$va_item[$pa_options['key']]] = str_repeat('&nbsp;', intval($va_item['LEVEL']) * 3) . ' ' . $va_item['name_singular'];
         if (!$va_item['is_enabled'] || is_array($va_disabled_item_ids) && in_array($vn_item_id, $va_disabled_item_ids)) {
             $va_disabled_options[$va_item[$pa_options['key']]] = true;
         }
         $va_colors[$vn_item_id] = $va_item['color'];
         if ($va_item['is_default']) {
             $vn_default_val = $va_item[$pa_options['key']];
         }
         // get default value
         if ($va_item['is_default'] && !isset($pa_options['nullOption'])) {
             // set default if needed, but only if there's not a null option set
             if (!is_array($pa_options['value']) && (!isset($pa_options['value']) || !strlen($pa_options['value']))) {
                 $pa_options['value'] = $vn_default_val;
             } else {
                 if (is_array($pa_options['value']) && !sizeof($pa_options['value'])) {
                     $pa_options['value'] = array(0 => $vn_default_val);
                 }
             }
         }
     }
     if (isset($pa_options['additionalOptions']) && is_array($pa_options['additionalOptions'])) {
         $va_options = array_merge($va_options, array_flip($pa_options['additionalOptions']));
     }
     $pa_options['disabledOptions'] = $va_disabled_options;
     switch ($vs_render_as) {
         case 'radio_buttons':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vn_i = 0;
             $vs_buf = "<table>\n";
             foreach ($va_options as $vm_value => $vs_label) {
                 if ($vn_c == 0) {
                     $vs_buf .= "<tr>";
                 }
                 $va_attributes = array('value' => $vm_value);
                 if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
                     $va_attributes['disabled'] = 1;
                 }
                 $va_attributes['value'] = $vm_value;
                 $va_attributes['id'] = $ps_name . '_' . $vn_i;
                 if ($pa_options['value'] == $vm_value) {
                     $va_attributes['checked'] = '1';
                 }
                 if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                     $va_attributes['disabled'] = 1;
                 }
                 $vs_buf .= "<td>" . caHTMLRadioButtonInput($ps_name, $va_attributes, $pa_options) . " {$vs_label}</td>";
                 $vn_c++;
                 if ($vn_c >= $pa_options['maxColumns']) {
                     $vn_c = 0;
                     $vs_buf .= "</tr>\n";
                 }
                 $vn_i++;
             }
             if ($vn_c != 0) {
                 $vs_buf .= "</tr>\n";
             }
             $vs_buf .= "</table>";
             return $vs_buf;
             break;
         case 'yes_no_checkboxes':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vb_is_checked = false;
             if (!$pa_options['value']) {
                 $pa_options['value'] = (string) $vn_default_val;
             }
             foreach ($va_options as $vm_value => $vs_label) {
                 if (strlen($vm_value) == 0) {
                     continue;
                 }
                 // don't count null values when calculating the first value for the yes/no
                 switch ($vn_c) {
                     case 0:
                         if ($pa_options['value'] === (string) $vm_value) {
                             $vb_is_checked = true;
                         }
                         $pa_attributes['value'] = $pa_options['value'] = $vm_value;
                         $pa_options['label'] = $vs_label;
                         break;
                     case 1:
                         $pa_options['returnValueIfUnchecked'] = $vm_value;
                         break;
                     default:
                         // exit
                         break 2;
                 }
                 $vn_c++;
             }
             if ($vb_is_checked) {
                 $pa_attributes['checked'] = 1;
             }
             if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                 $pa_attributes['disabled'] = 1;
             }
             return caHTMLCheckboxInput($ps_name, $pa_attributes, $pa_options);
             break;
         case 'checklist':
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             $vn_c = 0;
             $vs_buf = "<table>\n";
             foreach ($va_options as $vm_value => $vs_label) {
                 if ($vn_c == 0) {
                     $vs_buf .= "<tr>";
                 }
                 $va_attributes = array('value' => $vm_value);
                 if (isset($va_disabled_options[$vm_value]) && $va_disabled_options[$vm_value]) {
                     $va_attributes['disabled'] = 1;
                 }
                 if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                     $va_attributes['disabled'] = 1;
                 }
                 if (is_array($pa_options['value']) && in_array($vm_value, $pa_options['value'])) {
                     $va_attributes['checked'] = '1';
                 }
                 $vs_buf .= "<td>" . caHTMLCheckboxInput($ps_name . '_' . $vm_value, $va_attributes, $pa_options) . " {$vs_label}</td>";
                 $vn_c++;
                 if ($vn_c >= $pa_options['maxColumns']) {
                     $vn_c = 0;
                     $vs_buf .= "</tr>\n";
                 }
             }
             if ($vn_c != 0) {
                 $vs_buf .= "</tr>\n";
             }
             $vs_buf .= "</table>";
             return $vs_buf;
             break;
         case 'lookup':
             $vs_value = $vs_hidden_value = "";
             if (caGetOption('forSearch', $pa_options)) {
                 if ($vs_val_id = caGetOption('value', $pa_options)) {
                     $vs_value = $t_list->getItemFromListForDisplayByItemID($pm_list_name_or_id, $vs_val_id);
                     $vs_hidden_value = $vs_val_id;
                 }
             } else {
                 $vs_value = "{" . $pa_options['element_id'] . "_label}";
                 $vs_hidden_value = "{" . $pa_options['element_id'] . "}";
             }
             $vs_buf = caHTMLTextInput($ps_name . '_autocomplete', array('width' => isset($pa_options['width']) && $pa_options['width'] > 0 ? $pa_options['width'] : 300, 'height' => isset($pa_options['height']) && $pa_options['height'] > 0 ? $pa_options['height'] : 1, 'value' => $vs_value, 'maxlength' => 512, 'id' => $ps_name . "_autocomplete", 'class' => 'lookupBg')) . caHTMLHiddenInput($ps_name, array('value' => $vs_hidden_value, 'id' => $ps_name));
             if ($pa_options['request']) {
                 $vs_url = caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noInline' => 1, 'noSymbols' => 1, 'max' => 100));
             } else {
                 // hardcoded default for testing.
                 $vs_url = '/index.php/lookup/ListItem/Get';
             }
             $vs_buf .= '</div>';
             $vs_buf .= "\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').autocomplete({\n\t\t\t\t\t\t\t\t\tsource: '{$vs_url}', minLength: 3, delay: 800, html: true,\n\t\t\t\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif (parseInt(ui.item.id) > 0) {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val(ui.item.id);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}_autocomplete').val('');\n\t\t\t\t\t\t\t\t\t\t\tjQuery('#{$ps_name}').val('');\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t</script>\n\t\t\t\t";
             return $vs_buf;
             break;
         case 'horiz_hierbrowser':
         case 'horiz_hierbrowser_with_search':
         case 'vert_hierbrowser':
             $va_width = caParseFormElementDimension($pa_options['width'] ? $pa_options['width'] : $pa_options['width']);
             if ($va_width['type'] != 'pixels' && $va_width['dimension'] < 250) {
                 $va_width['dimension'] = 500;
             }
             $vn_width = $va_width['dimension'] . 'px';
             $va_height = caParseFormElementDimension($pa_options['height']);
             if ($va_height['type'] != 'pixels' && $va_height['dimension'] < 100) {
                 $va_height['dimension'] = 200;
             }
             $vn_height = $va_height['dimension'] . 'px';
             $t_root_item = new ca_list_items();
             $t_root_item->load(array('list_id' => $vn_list_id, 'parent_id' => null));
             JavascriptLoadManager::register("hierBrowser");
             $vs_buf = "<div style='width: {$vn_width}; height: {$vn_height};'><div id='{$ps_name}_hierarchyBrowser{n}' style='width: 100%; height: 100%;' class='" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserVertical' : 'hierarchyBrowser') . "'>\n\t\t\t\t\t<!-- Content for hierarchy browser is dynamically inserted here by ca.hierbrowser -->\n\t\t\t\t</div><!-- end hierarchyBrowser -->\t</div>";
             $vs_buf .= "\t<script type='text/javascript'>\n\t\tjQuery(document).ready(function() { \n\t\t\tvar oHierBrowser = caUI.initHierBrowser('{$ps_name}_hierarchyBrowser{n}', {\n\t\t\t\tuiStyle: '" . ($vs_render_as == 'vert_hierbrowser' ? 'vertical' : 'horizontal') . "',\n\t\t\t\tlevelDataUrl: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'GetHierarchyLevel', array('noSymbols' => 1)) . "',\n\t\t\t\tinitDataUrl: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'GetHierarchyAncestorList') . "',\n\t\t\t\t\n\t\t\t\tselectOnLoad : true,\n\t\t\t\tbrowserWidth: " . (int) $va_width['dimension'] . ",\n\t\t\t\t\n\t\t\t\tclassName: '" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserLevelVertical' : 'hierarchyBrowserLevel') . "',\n\t\t\t\tclassNameContainer: '" . ($vs_render_as == 'vert_hierbrowser' ? 'hierarchyBrowserContainerVertical' : 'hierarchyBrowserContainer') . "',\n\t\t\t\t\n\t\t\t\teditButtonIcon: \"" . caNavIcon($pa_options['request'], __CA_NAV_BUTTON_RIGHT_ARROW__) . "\",\n\t\t\t\tdisabledButtonIcon: \"" . caNavIcon($pa_options['request'], __CA_NAV_BUTTON_DOT__) . "\",\n\t\t\t\tinitItemID: '{" . $pa_options['element_id'] . "}',\n\t\t\t\tdefaultItemID: '" . $t_list->getDefaultItemID() . "',\n\t\t\t\tuseAsRootID: '" . $t_root_item->getPrimaryKey() . "',\n\t\t\t\tindicatorUrl: '" . $pa_options['request']->getThemeUrlPath() . "/graphics/icons/indicator.gif',\n\t\t\t\t\n\t\t\t\tcurrentSelectionDisplayID: '{$ps_name}_browseCurrentSelectionText{n}',\n\t\t\t\tonSelection: function(item_id, parent_id, name, display) {\n\t\t\t\t\tjQuery('#{$ps_name}').val(item_id);\n\t\t\t\t}\n\t\t\t});";
             if ($vs_render_as == 'horiz_hierbrowser_with_search') {
                 $vs_buf .= "jQuery('#{$ps_name}_hierarchyBrowserSearch{n}').autocomplete(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: '" . caNavUrl($pa_options['request'], 'lookup', 'ListItem', 'Get', array('list' => ca_lists::getListCode($vn_list_id), 'noSymbols' => 1)) . "', \n\t\t\t\t\t\tminLength: 3, delay: 800,\n\t\t\t\t\t\tselect: function(event, ui) {\n\t\t\t\t\t\t\toHierBrowser.setUpHierarchy(ui.item.id);\t// jump browser to selected item\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);";
             }
             $vs_buf .= "});\n\t</script>";
             if ($vs_render_as == 'horiz_hierbrowser_with_search') {
                 $vs_buf .= "<div class='hierarchyBrowserSearchBar'>" . _t('Search') . ": <input type='text' id='{$ps_name}_hierarchyBrowserSearch{n}' class='hierarchyBrowserSearchBar' name='search' value='' size='20'/></div>";
             }
             if ($vs_render_as != 'vert_hierbrowser') {
                 $vs_buf .= "<div id='{$ps_name}_browseCurrentSelection{n}' class='hierarchyBrowserCurrentSelection'>" . _t("Current selection") . ": <span id='{$ps_name}_browseCurrentSelectionText{n}' class='hierarchyBrowserCurrentSelectionText'>?</span></div>";
             }
             $vs_buf .= caHTMLHiddenInput($ps_name, array('value' => "{" . $pa_options['element_id'] . "}", 'id' => $ps_name));
             return $vs_buf;
             break;
         case 'text':
             return caHTMLTextInput($ps_name, $pa_attributes, $pa_options);
             break;
         case 'options':
             return $va_options;
             break;
         default:
             if (!sizeof($va_options)) {
                 return '';
             }
             // return empty string if list has no values
             if (isset($pa_options['readonly']) && $pa_options['readonly']) {
                 $pa_attributes['disabled'] = 1;
             }
             return caHTMLSelect($ps_name, $va_options, $pa_attributes, array_merge($pa_options, array('contentArrayUsesKeysForValues' => true, 'colors' => $va_colors, 'height' => null)));
             break;
     }
 }
예제 #11
0
        ?>
			</form>
			<div id="browse">
				<div class='subTitle' style='background-color: #eeeeee; padding:5px 0px 5px 5px;'><?php 
        print _t("Hierarchy");
        ?>
</div>
	<?php 
        if ($this->request->user->canDoAction('can_edit_' . $vs_table) && $this->getVar('num_types') > 0) {
            ?>
				<!--- BEGIN HIERARCHY BROWSER TYPE MENU --->
				<div id='browseTypeMenu'>
					<form action='#'>
	<?php 
            print "<div>";
            print _t('Add under %2 new %1', $this->getVar('type_menu') . ' <a href="#" onclick="_navigateToNewForm(jQuery(\'#hierTypeList\').val())">' . caNavIcon($this->request, __CA_NAV_BUTTON_ADD__) . "</a>", "<span id='browseCurrentSelection'></span>");
            print "</div>";
            ?>
					</form>
	
				</div><!-- end browseTypeMenu -->		
				<!--- END HIERARCHY BROWSER TYPE MENU --->
	<?php 
        }
        ?>
				<div class='clear' style='height:1px;'><!-- empty --></div>
				
				<!--- BEGIN HIERARCHY BROWSER --->
				<div id="hierarchyBrowser" class='hierarchyBrowser'>
					<!-- Content for hierarchy browser is dynamically inserted here by ca.hierbrowser -->
				</div><!-- end hierarchyBrowser -->
예제 #12
0
>
<?php 
if (is_array($va_reps)) {
    foreach ($va_reps as $va_rep) {
        if (sizeof($va_reps) > 1) {
            # --- more than one rep show thumbnails
            $vn_padding_top = (120 - $va_rep["info"]["thumbnail"]["HEIGHT"]) / 2 + 5;
            print "<table style='float:left; margin:5px;" . $vs_clear . "' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle'><div class='thumbnailsImageContainer' style='padding: " . $vn_padding_top . "px 5px " . $vn_padding_top . "px 5px;'>";
            print "<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, 'editor/objects', 'ObjectEditor', 'GetRepresentationInfo', array('object_id' => $vn_item_id, 'representation_id' => $va_rep['representation_id'])) . "\");'>" . $va_rep['tags']['thumbnail'] . "</a>\n";
            if ($this->request->user->canDoAction('can_download_ca_object_representations')) {
                print "<div style='float: right; margin-top: 5px;'>" . caNavLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_DOWNLOAD__), '', 'editor/objects', 'ObjectEditor', 'DownloadRepresentation', array('object_id' => $vn_item_id, 'representation_id' => $va_rep['representation_id'], 'version' => 'original')) . "</div>\n";
            }
            print "</div></td></tr></table>\n";
        } else {
            # --- one rep - show medium rep
            print "<div style='padding: 0px 0px 0px 20px;'>";
            print "<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, 'editor/objects', 'ObjectEditor', 'GetRepresentationInfo', array('object_id' => $vn_item_id, 'representation_id' => $va_rep['representation_id'])) . "\");'>" . $va_rep['tags']['medium'] . "</a>\n";
            if ($this->request->user->canDoAction('can_download_ca_object_representations')) {
                print "<div style='float: right; margin-top: 5px;'>" . caNavLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_DOWNLOAD__), '', 'editor/objects', 'ObjectEditor', 'DownloadRepresentation', array('object_id' => $vn_item_id, 'representation_id' => $va_rep['representation_id'], 'version' => 'original')) . "</div>\n";
            }
            print "</div>";
        }
    }
}
print "<div class=\"unit\">" . $va_rep['tags']['preview170'] . "</div>\n";
?>
			</td>
		</tr>
	</table>
</div><!-- end summary -->
예제 #13
0
				<div class="hierarchyBrowserMessageContainer">
					<?php 
        print _t('Use the controls below to create new %1 relative to this %2 in the hierarchy.', $t_object->getProperty('NAME_PLURAL'), mb_strtolower($t_subject->getTypeName()));
        ?>
				</div>
				
				<div id='<?php 
        print $ps_id_prefix;
        ?>
AddObjectHierarchyBrowseTypeMenu' style="margin-top: 15px;">
					<div style="float: left; width: 700px">
<?php 
        $vs_type_selector = trim($t_object->getTypeListAsHTMLFormElement("{$ps_id_prefix}object_type_id", array('id' => "{$ps_id_prefix}objectTypeList"), array('childrenOfCurrentTypeOnly' => $vb_strict_type_hierarchy, 'includeSelf' => !$vb_strict_type_hierarchy, 'directChildrenOnly' => $vb_strict_type_hierarchy)));
        print "<div id='{$ps_id_prefix}HierarchyBrowseAdd'>" . _t("Add a new %1 under <em>%2</em>", $vs_type_selector, $vs_subject_label);
        // Note the jQuery(\"#{$ps_id_prefix}childTypeList\").val() which grabs the value of the type
        print " <a href='#' onclick='_navigateToNewObjectForm(jQuery(\"#{$ps_id_prefix}objectTypeList\").val(), " . intval($pn_id) . ")'>" . caNavIcon($this->request, __CA_NAV_BUTTON_ADD__) . "</a></div>";
        ?>
					</div>
				</div>
				<div class="clear"><!-- empty --></div>
				<div id="<?php 
        print $ps_id_prefix;
        ?>
AddObjectHierarchyBrowser" class="hierarchyBrowserSmall">
					<!-- Content for hierarchy browser is dynamically inserted here by ca.hierbrowser -->
				</div><!-- end hierbrowser -->
		</div>
<?php 
    }
    ?>
		</div>
예제 #14
0
,
					initialValueOrder: <?php 
    print json_encode(array_keys($va_items));
    ?>
,
					setItemAutocompleteID: '<?php 
    print $vs_id_prefix;
    ?>
setItemAutocompleter',
					rowIDListID: '<?php 
    print $vs_id_prefix;
    ?>
setRowIDList',
					
					editSetItemButton: '<?php 
    print addslashes(caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__, null, null, array('graphicsPath' => $this->getVar('graphicsPath'))));
    ?>
',
					
					lookupURL: '<?php 
    print $va_lookup_urls['search'];
    ?>
',
					itemInfoURL: '<?php 
    print caNavUrl($this->request, 'manage/sets', 'SetEditor', 'GetItemInfo');
    ?>
',
					editSetItemsURL: '<?php 
    print caNavUrl($this->request, 'manage/set_items', 'SetItemEditor', 'Edit', array('set_id' => $vn_set_id));
    ?>
',
			
			jQuery.each(data['list'], function(k, v) {
				var annotation_id = v['annotation_id'];
				var label = v['label'];
				var timecode = v['startTimecode'] + " - " + v['endTimecode'];
				var startTimecode = v['startTimecode_raw'];
			
				var item = "<div id='caAnnoEditorTlAnnotationContainer" + annotation_id + "' class='caAnnoEditorTlAnnotationContainer'>" + 
					"<div class='title'><a href='#' onclick='caAnnoEditorPlayerPlay(" + startTimecode + "); return false;'>" + label + "</a></div>" + 
					"<div class='timecode'><a href='#' onclick='caAnnoEditorPlayerPlay(" + startTimecode + "); return false;'>" + timecode + "</a></div>" + 
					"<div class='editAnnoButton'><a href='#' onclick='caAnnoEditorEdit(" + annotation_id + "); event.preventDefault(); return false;'><?php 
print caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__);
?>
</a></div>" + 
					"<div class='deleteAnnoButton'><a href='#' onclick='caAnnoEditorDelete(" + annotation_id + "); event.preventDefault(); return false;'><?php 
print caNavIcon($this->request, __CA_NAV_BUTTON_DEL_BUNDLE__);
?>
</a></div>";
			
				// does the item already exist?
				if (items.eq(i).length > 0) {
					items.eq(i).html(item);
				} else {
					itemList.append("<li>" + item + "</li>");
				}
				list[i] = v;
				i++;
			});
			
			jQuery(theCarousel).data("annotation_list", list);
			jQuery(theCarousel).jcarousel('reload');
        $i == 2 ? $i = 0 : "";
        ?>
				<tr <?php 
        print $i == 1 ? "class='odd'" : "";
        ?>
>
					<td style="width:10px">
						<input type='checkbox' name='add_to_set_ids' value='<?php 
        print (int) $vn_place_id;
        ?>
' class="addItemToSetControl" />
					</td>
<?php 
        print "<td style='width:5%;'>" . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'ca_places', $vn_place_id, array()) . "</td>";
        if ($vs_mode == 'search') {
            print " <a href='#' onclick='caOpenBrowserWith(" . $vn_place_id . ");'>" . caNavIcon($this->request, __CA_NAV_BUTTON_HIER__) . "</a>";
        }
        print "</td>";
        foreach ($va_display_list as $vn_placement_id => $va_info) {
            print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id, array_merge(array('request' => $this->request), is_array($va_info['settings']) ? $va_info['settings'] : array())) . "</td>";
        }
        ?>
	
				</tr>
<?php 
        $i++;
        $vn_item_count++;
    }
    ?>
		</tbody>
<?php 
예제 #17
0
 /**
  * Return attribute display value. 
  *
  * @param array $pa_options
  * @return string
  *
  * Options:
  *	showMediaInfo - if true media info (dimensions, filesize, bit depth) is returns as part of display; default is false
  *	version - name of media version to return; default is 'thumbnail'
  *  return - valid settings are url, tag, path; if set to a valid value then the url, tag or path for the media is returned rather than display HTML
  *
  * You can also pass other options to be passed-through to the underlying media plugin. Useful ones for video include:
  *		viewer_width		(also used for audio and tilepic image versions)
  *		viewer_height		(also used for audio and tilepic image versions)
  *		poster_frame_version (which will be transformed into the correct poster_frame_url)
  */
 public function getDisplayValue($pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (isset($pa_options['forDuplication']) && $pa_options['forDuplication']) {
         $pa_options['return'] = 'path';
         $pa_options['version'] = 'original';
     }
     if (!isset($pa_options['showMediaInfo'])) {
         $pa_options['showMediaInfo'] = false;
     }
     if (!isset($pa_options['version'])) {
         $pa_options['version'] = 'thumbnail';
     }
     $vs_version = $pa_options['version'];
     $vs_class = trim(isset($pa_options['class']) && $pa_options['class'] ? $pa_options['class'] : '');
     if (!isset($pa_options['return'])) {
         $pa_options['return'] = null;
     } else {
         $pa_options['return'] = strtolower($pa_options['return']);
     }
     switch ($pa_options['return']) {
         case 'url':
             return $this->opo_media_info_coder->getMediaUrl($this->opa_media_data, $vs_version);
             break;
         case 'tag':
             return $this->opo_media_info_coder->getMediaTag($this->opa_media_data, $vs_version);
             break;
         case 'path':
             return $this->opo_media_info_coder->getMediaPath($this->opa_media_data, $vs_version);
             break;
     }
     if ($vs_url = $this->opo_media_info_coder->getMediaUrl($this->opa_media_data, 'original')) {
         AssetLoadManager::register('panel');
         $va_info = $this->opo_media_info_coder->getMediaInfo($this->opa_media_data);
         $vs_dimensions = '';
         if ($pa_options['showMediaInfo']) {
             $va_dimensions = array($va_info['INPUT']['MIMETYPE']);
             if ($va_info['ORIGINAL_FILENAME']) {
                 $vs_filename = $va_info['ORIGINAL_FILENAME'];
             } else {
                 $vs_filename = _t('Uploaded file');
             }
             if (isset($va_info['original']['WIDTH']) && isset($va_info['original']['HEIGHT'])) {
                 if (($vn_w = $va_info['original']['WIDTH']) && ($vn_h = $va_info['original']['WIDTH'])) {
                     $va_dimensions[] = $va_info['original']['WIDTH'] . 'p x ' . $va_info['original']['HEIGHT'] . 'p';
                 }
             }
             if (isset($va_info['original']['PROPERTIES']['bitdepth']) && ($vn_depth = $va_info['original']['PROPERTIES']['bitdepth'])) {
                 $va_dimensions[] = intval($vn_depth) . ' bpp';
             }
             if (isset($va_info['original']['PROPERTIES']['colorspace']) && ($vs_colorspace = $va_info['original']['PROPERTIES']['colorspace'])) {
                 $va_dimensions[] = $vs_colorspace;
             }
             if (isset($va_info['original']['PROPERTIES']['resolution']) && is_array($va_resolution = $va_info['original']['PROPERTIES']['resolution'])) {
                 if (isset($va_resolution['x']) && isset($va_resolution['y']) && $va_resolution['x'] && $va_resolution['y']) {
                     // TODO: units for resolution? right now assume pixels per inch
                     if ($va_resolution['x'] == $va_resolution['y']) {
                         $va_dimensions[] = $va_resolution['x'] . 'ppi';
                     } else {
                         $va_dimensions[] = $va_resolution['x'] . 'x' . $va_resolution['y'] . 'ppi';
                     }
                 }
             }
             if (isset($va_info['original']['PROPERTIES']['duration']) && ($vn_duration = $va_info['original']['PROPERTIES']['duration'])) {
                 $va_dimensions[] = sprintf("%4.1f", $vn_duration) . 's';
             }
             if (isset($va_info['original']['PROPERTIES']['pages']) && ($vn_pages = $va_info['original']['PROPERTIES']['pages'])) {
                 $va_dimensions[] = $vn_pages . ' ' . ($vn_pages == 1 ? _t('page') : _t('pages'));
             }
             if (!isset($va_info['original']['PROPERTIES']['filesize']) || !($vn_filesize = $va_info['original']['PROPERTIES']['filesize'])) {
                 $vn_filesize = 0;
             }
             if ($vn_filesize) {
                 $va_dimensions[] = sprintf("%4.1f", $vn_filesize / (1024 * 1024)) . 'mb';
             }
             if (!isset($va_info['PROPERTIES']['filesize']) || !($vn_filesize = $va_info['PROPERTIES']['filesize'])) {
                 $vn_filesize = @filesize($this->opo_media_info_coder->getMediaPath($this->opa_media_data, 'original'));
             }
             if ($vn_filesize) {
                 $va_dimensions[] = sprintf("%4.2f", $vn_filesize / (1024 * 1024)) . 'mb';
             }
             $vs_dimensions = join('; ', $va_dimensions);
         }
         if (isset($pa_options['poster_frame_version']) && $pa_options['poster_frame_version']) {
             $pa_options['poster_frame_url'] = $this->opo_media_info_coder->getMediaUrl($this->opa_media_data, $pa_options['poster_frame_version']);
         }
         $vs_tag = $this->opo_media_info_coder->getMediaTag($this->opa_media_data, $vs_version, $pa_options);
         if (is_object($pa_options['request'])) {
             $vs_view_url = urldecode(caNavUrl($pa_options['request'], $pa_options['request']->getModulePath(), $pa_options['request']->getController(), 'GetMediaOverlay', array('value_id' => $this->opn_value_id)));
             $vs_val = "<div id='caMediaAttribute" . $this->opn_value_id . "' class='attributeMediaInfoContainer'>";
             $vs_val .= "<div class='attributeMediaThumbnail'>";
             $vs_val .= "<div style='float: left;'>" . urlDecode(caNavLink($pa_options['request'], caNavIcon($pa_options['request'], __CA_NAV_BUTTON_DOWNLOAD__, array('align' => 'middle')), '', $pa_options['request']->getModulePath(), $pa_options['request']->getController(), 'DownloadAttributeMedia', array('download' => 1, 'value_id' => $this->opn_value_id), array('class' => 'attributeDownloadButton'))) . "</div>";
             $vs_val .= "<a href='#' onclick='caMediaPanel.showPanel(\"{$vs_view_url}\"); return false;'>{$vs_tag}</a>";
             $vs_val .= "</div>";
             if ($pa_options['showMediaInfo']) {
                 $vs_val .= "<div class='attributeMediaInfo'><p>{$vs_filename}</p><p>{$vs_dimensions}</p></div>";
             }
             $vs_val .= "</div>";
         } else {
             $vs_val = "<div id='caMediaAttribute" . $this->opn_value_id . "' class='attributeMediaInfoContainer'><div class='attributeMediaThumbnail'>{$vs_tag}</div></div>";
         }
         if ($pa_options['showMediaInfo']) {
             TooltipManager::add('#caMediaAttribute' . $this->opn_value_id, "<h2>" . _t('Media details') . "</h2> <p>{$vs_filename}</p><p>{$vs_dimensions}</p>");
         }
     }
     return $vs_val;
 }
 /**
  * Options:
  *  return - valid settings are url and path; if set to a valid value then the url or path for the file is returned rather than display HTML
  *
  */
 public function getDisplayValue($pa_options = null)
 {
     if (isset($pa_options['forDuplication']) && $pa_options['forDuplication']) {
         $pa_options['return'] = 'path';
     }
     if (!isset($pa_options['return'])) {
         $pa_options['return'] = null;
     } else {
         $pa_options['return'] = strtolower($pa_options['return']);
     }
     switch ($pa_options['return']) {
         case 'url':
             return $this->opo_file_info_coder->getFileUrl($this->opa_file_data);
             break;
         case 'path':
             return $this->opo_file_info_coder->getFilePath($this->opa_file_data);
             break;
     }
     $vs_val = '';
     if ($vs_url = $this->opo_file_info_coder->getFileUrl($this->opa_file_data)) {
         $va_info = $this->opo_file_info_coder->getFileInfo($this->opa_file_data);
         $va_dimensions = array();
         if ($va_info['ORIGINAL_FILENAME']) {
             $vs_filename = $va_info['ORIGINAL_FILENAME'];
         } else {
             $vs_filename = _t('Uploaded file');
         }
         if ($va_info['MIMETYPE']) {
             $va_dimensions[] = FileMimeTypes::nameForMimeType($va_info['MIMETYPE']);
         }
         if (!isset($va_info['PROPERTIES']['filesize']) || !($vn_filesize = $va_info['PROPERTIES']['filesize'])) {
             $vn_filesize = @filesize($this->opo_file_info_coder->getFilePath($this->opa_file_data));
         }
         if ($vn_filesize) {
             $va_dimensions[] = sprintf("%4.2f", $vn_filesize / (1024 * 1024)) . 'mb';
         }
         $vs_dimensions = join('; ', $va_dimensions);
         $vs_val = "<div class='attributeFileInfoContainer'>";
         $vs_val .= "<div class='attributeFileFileName'>{$vs_filename}</div><div class='attributeFileFileInfo'>{$vs_dimensions}";
         if (is_object($pa_options['request'])) {
             $vs_val .= caNavLink($pa_options['request'], caNavIcon($pa_options['request'], __CA_NAV_BUTTON_DOWNLOAD__, array('align' => 'middle')), '', $pa_options['request']->getModulePath(), $pa_options['request']->getController(), 'DownloadAttributeFile', array('download' => 1, 'value_id' => $this->opn_value_id), array('class' => 'attributeDownloadButton'));
         }
         $vs_val .= "</div></div>";
     }
     return $vs_val;
 }
    } else {
        $vs_action = "Summary";
    }
    $i == 2 ? $i = 0 : "";
    ?>
				<tr <?php 
    print $i == 1 ? "class='odd'" : "";
    ?>
>
					<td style="width:10px">
						<input type='checkbox' name='add_to_set_ids' value='<?php 
    print (int) $vn_stop_id;
    ?>
' class="addItemToSetControl" />
					</td>
<?php 
    print "<td style='width:5%;'>" . caNavLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'editor/tour_stops', 'TourStopEditor', $vs_action, array('stop_id' => $vn_stop_id)) . "</td>";
    foreach ($va_display_list as $vn_placement_id => $va_display_item) {
        print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id, array('request' => $this->request)) . "</td>";
    }
    ?>
	
				</tr>
<?php 
    $i++;
    $vn_item_count++;
}
?>
				</tbody></table>
	</form>
</div><!--end scrollingResults -->
예제 #20
0
 * This program is free software; you may redistribute it and/or modify it under
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * CollectiveAccess is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * This source code is free and modifiable under the terms of
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$va_mapping_list = $this->getVar('mapping_list');
$vs_type_menu = '<div class="sf-small-menu form-header-button rounded">' . '<div style="float:right; margin: 3px;">' . '<a href="#" onclick="_navigateToNewForm(jQuery(\'#tableList\').val(), jQuery(\'#targetList\').val(), jQuery(\'#directionList\').val());">' . caNavIcon($this->request, __CA_NAV_BUTTON_ADD__) . '</a>' . '</div>' . '<form action="#">' . _t('New %1 %2 mapping for %3', caHTMLSelect('format', $this->getVar('format_list'), array('id' => 'targetList')), caHTMLSelect('direction', $this->getVar('direction_list'), array('id' => 'directionList')), caHTMLSelect('table_num', $this->getVar('table_list'), array('id' => 'tableList'))) . '</form>' . '</div>';
?>
<script language="JavaScript" type="text/javascript">
/* <![CDATA[ */
	$(document).ready(function(){
		$('#caMappingList').caFormatListTable();
	});
	
	function _navigateToNewForm(table_num, target, direction) {
		document.location = '<?php 
print caNavUrl($this->request, 'administrate/setup/bundle_mapping_editor', 'BundleMappingEditor', 'Edit', array('mapping_id' => 0));
?>
' + '/table_num/' + table_num + '/target/' + target + '/direction/' + direction;
	}
/* ]]> */
</script>
				oHierBrowser = caUI.initHierBrowser('hierarchyBrowser', {
					levelDataUrl: '<?php 
    print caNavUrl($this->request, 'lookup', 'Place', 'GetHierarchyLevel');
    ?>
',
					initDataUrl: '<?php 
    print caNavUrl($this->request, 'lookup', 'Place', 'GetHierarchyAncestorList');
    ?>
',
					
					editUrl: '<?php 
    print caNavUrl($this->request, 'editor/places', 'PlaceEditor', 'Edit', array('place_id' => ''));
    ?>
',
					editButtonIcon: "<?php 
    print caNavIcon($this->request, __CA_NAV_BUTTON_RIGHT_ARROW__);
    ?>
",
					
					initItemID: '<?php 
    print $this->getVar('browse_last_id');
    ?>
',
					indicatorUrl: '<?php 
    print $this->request->getThemeUrlPath();
    ?>
/graphics/icons/indicator.gif',
					typeMenuID: 'browseTypeMenu',
					
					currentSelectionDisplayID: 'browseCurrentSelection'
				});
예제 #22
0
 * This program is free software; you may redistribute it and/or modify it under
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * CollectiveAccess is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * This source code is free and modifiable under the terms of
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$va_editor_ui_list = $this->getVar('editor_ui_list');
$vs_type_menu = '<div class="sf-small-menu form-header-button rounded">' . '<div style="float:right; margin: 3px;">' . '<a href="#" onclick="_navigateToNewForm(jQuery(\'#tableList\').val());">' . caNavIcon($this->request, __CA_NAV_BUTTON_ADD_LARGE__) . '</a>' . '</div>' . '<form action="#">' . _t('New interface for ') . ' ' . caHTMLSelect('editor_type', $this->getVar('table_list'), array('id' => 'tableList')) . '</form>' . '</div>';
?>
<script language="JavaScript" type="text/javascript">
/* <![CDATA[ */
	$(document).ready(function(){
		$('#caUIList').caFormatListTable();
	});
	
	function _navigateToNewForm(editor_type) {
		document.location = '<?php 
print caNavUrl($this->request, 'administrate/setup/interface_editor', 'InterfaceEditor', 'Edit', array('ui_id' => 0));
?>
' + '/editor_type/' + editor_type;
	}
/* ]]> */
</script>
,
			rowCount: <?php 
print $vo_result->numHits();
?>
,
			
			dataLoadUrl: '<?php 
print caNavUrl($this->request, $this->request->getModulePath(), $this->request->getController(), "getPartialResult");
?>
',
			dataSaveUrl: '<?php 
print caNavUrl($this->request, $this->request->getModulePath(), $this->request->getController(), "saveInlineEdit");
?>
',
			editLinkFormat: "<?php 
print urldecode(caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), 'caResultsEditorEditLink', $vs_subject_table, '%1'));
?>
",
			
			rowHeaders: <?php 
print json_encode($va_row_headers);
?>
,
			colHeaders: <?php 
print json_encode($va_column_headers);
?>
,
			columns: <?php 
print json_encode($va_columns);
?>
,
예제 #24
0
 /**
  *
  */
 public function Index($pa_options = null)
 {
     $po_search = isset($pa_options['search']) ? $pa_options['search'] : null;
     $pb_dont_render_view = isset($pa_options['dontRenderView']) && (bool) $pa_options['dontRenderView'] ? true : false;
     parent::Index($pa_options);
     AssetLoadManager::register('browsable');
     AssetLoadManager::register('hierBrowser');
     $va_access_values = caGetUserAccessValues($this->request);
     //
     // Restrict facets to specific group for main browse landing page (if set in app.conf config)
     //
     if ($vs_facet_group = $this->request->config->get($this->ops_tablename . '_browse_facet_group')) {
         $this->opo_browse->setFacetGroup($vs_facet_group);
     }
     //
     // Set useful values we'll need later
     //
     $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $vb_criteria_have_changed = $this->opo_browse->criteriaHaveChanged();
     // Get elements of result context
     $vn_page_num = $this->opo_result_context->getCurrentResultsPageNumber();
     if ($this->opb_type_restriction_has_changed || $this->request->getParameter('reset', pString) == 'clear') {
         $this->opo_browse->removeAllCriteria();
         $this->opo_result_context->setSearchExpression($this->opo_browse->getBrowseID());
     }
     if (!($vn_items_per_page = $this->opo_result_context->getItemsPerPage())) {
         $vn_items_per_page = $this->opn_items_per_page_default;
         $this->opo_result_context->setItemsPerPage($vn_items_per_page);
     }
     if (!($vs_view = $this->opo_result_context->getCurrentView())) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = $this->ops_view_default ? $this->ops_view_default : array_shift($va_tmp);
         $this->opo_result_context->setCurrentView($vs_view);
     }
     if (!isset($this->opa_views[$vs_view])) {
         $va_tmp = array_keys($this->opa_views);
         $vs_view = array_shift($va_tmp);
     }
     if (!($vs_sort = $this->opo_result_context->getCurrentSort())) {
         $va_tmp = array_keys($this->opa_sorts);
         $vs_sort = array_shift($va_tmp);
     }
     $vs_sort_direction = $this->opo_result_context->getCurrentSortDirection();
     $vb_sort_has_changed = $this->opo_result_context->sortHasChanged();
     if (!$vn_page_num || $vb_criteria_have_changed) {
         $vn_page_num = 1;
     }
     // Do redirect directly to detail if configured to do so
     if ($this->opo_browse->criteriaHaveChanged() && sizeof($va_criteria = $this->opo_browse->getCriteria()) == 1) {
         $va_tmp = array_keys($va_criteria);
         $va_tmp1 = array_keys($va_criteria[$va_tmp[0]]);
         $va_facet_info = $this->opo_browse->getInfoForFacet($va_tmp[0]);
         if ($this->request->config->get('redirect_to_' . $va_facet_info['table'] . '_detail_if_is_first_facet')) {
             $t_table = $this->opo_datamodel->getInstanceByTableName($va_facet_info['table'], true);
             $va_newmuseum_hack_occurrence_type_ids = $this->request->config->getList('newmuseum_hack_browse_should_redirect_occurrence_types_to_object_details');
             if (is_array($va_newmuseum_hack_occurrence_type_ids) && sizeof($va_newmuseum_hack_occurrence_type_ids) && $va_facet_info['table'] == 'ca_occurrences') {
                 if ($t_table->load($va_tmp1[0])) {
                     if (in_array($t_table->getTypeID(), $va_newmuseum_hack_occurrence_type_ids)) {
                         if (sizeof($va_objects = $t_table->getRelatedItems('ca_objects'))) {
                             $va_object = array_shift($va_objects);
                             $vn_object_id = $va_object['object_id'];
                             $this->response->setRedirect(caNavUrl($this->request, 'Detail', 'Object', 'Show', array('object_id' => $vn_object_id)));
                             return;
                         }
                     }
                 }
             }
             $this->response->setRedirect(caNavUrl($this->request, 'Detail', ucfirst($t_table->getProperty('NAME_SINGULAR')), 'Show', array($t_table->primaryKey() => $va_tmp1[0])));
             return;
         }
     }
     //
     // Enforce type restriction, if defined
     //
     $this->opo_browse->setTypeRestrictions(array($this->opn_type_restriction_id));
     MetaTagManager::setWindowTitle(_t('%1 browse', $this->browseName('plural')));
     //
     // Actually execute the browse - do the queries
     //
     //if ($vs_group_name = $this->request->config->get('browse_facet_group_for_'.$this->ops_tablename)) {
     //	$this->opo_browse->setFacetGroup($vs_group_name);
     //}
     //
     // Restrict facets to specific group (if set in app.conf config)
     //
     if ($vs_facet_group = $this->request->config->get($this->ops_tablename . ($this->opo_browse->numCriteria() < 1 ? '_browse_facet_group' : '_browse_refine_facet_group'))) {
         $this->opo_browse->setFacetGroup($vs_facet_group);
     }
     $this->opo_browse->execute(array('checkAccess' => $va_access_values, 'no_cache' => !$this->opo_result_context->cacheIsValid()));
     $this->opo_result_context->validateCache();
     $this->opo_result_context->setSearchExpression($this->opo_browse->getBrowseID());
     //
     // Pass browse info (context + facets + criteria) to view
     //
     $this->view->setVar('browse', $this->opo_browse);
     $this->view->setVar('target', $this->ops_tablename);
     $this->view->setVar('result_context', $this->opo_result_context);
     $this->view->setVar('criteria', $va_criteria = $this->opo_browse->getCriteriaWithLabels());
     $this->view->setVar('available_facets', $this->opo_browse->getInfoForAvailableFacets());
     $this->view->setVar('facets_with_content', $this->opo_browse->getInfoForFacetsWithContent());
     $this->view->setVar('facet_info', $va_facet_info = $this->opo_browse->getInfoForFacets());
     $va_single_facet_values = array();
     foreach ($va_facet_info as $vs_facet => $va_facet_settings) {
         $va_single_facet_values[$vs_facet] = isset($va_facet_settings['single_value']) ? $va_facet_settings['single_value'] : null;
     }
     $this->view->setVar('single_facet_values', $va_single_facet_values);
     // browse criteria in an easy-to-display format
     $va_browse_criteria = array();
     foreach ($this->opo_browse->getCriteriaWithLabels() as $vs_facet_code => $va_criteria) {
         $va_facet_info = $this->opo_browse->getInfoForFacet($vs_facet_code);
         $va_criteria_list = array();
         foreach ($va_criteria as $vn_criteria_id => $vs_criteria_label) {
             $va_criteria_list[] = $vs_criteria_label;
         }
         $va_browse_criteria[$va_facet_info['label_singular']] = join('; ', $va_criteria_list);
     }
     $this->view->setVar('browse_criteria', $va_browse_criteria);
     //
     // Get the browse results
     //
     $this->view->setVar('num_hits', $vn_num_hits = $this->opo_browse->numResults());
     $this->view->setVar('num_pages', $vn_num_pages = ceil($vn_num_hits / $vn_items_per_page));
     if ($vn_page_num > $vn_num_pages) {
         $vn_page_num = 1;
     }
     if ($pa_options['output_format']) {
         $vo_result = $this->opo_browse->getResults(array('sort' => $vs_sort, 'sort_direction' => $vs_sort_direction));
     } else {
         $vo_result = $this->opo_browse->getResults(array('sort' => $vs_sort, 'sort_direction' => $vs_sort_direction, 'start' => ($vn_page_num - 1) * $vn_items_per_page, 'limit' => $vn_items_per_page));
     }
     // Only prefetch what we need
     $vo_result->setOption('prefetch', $vn_items_per_page);
     if ($vo_result) {
         if ($vb_criteria_have_changed || $vb_sort_has_changed) {
             // Put the results id list into the results context - we used this for previous/next navigation
             $this->opo_result_context->setResultList($vo_result->getPrimaryKeyValues());
             $this->opo_result_context->setParameter('availableVisualizationChecked', 0);
         }
         $vo_result->seek(0);
     }
     //
     // Set up view for display of results
     //
     $this->view->setVar('page', $vn_page_num);
     $this->view->setVar('result', $vo_result);
     $this->view->setVar('views', $this->opa_views);
     // pass view list to view for rendering
     $this->view->setVar('current_view', $vs_view);
     $this->view->setVar('sorts', $this->opa_sorts);
     // pass sort list to view for rendering
     $this->view->setVar('current_sort', $vs_sort);
     $this->view->setVar('current_sort_direction', $vs_sort_direction);
     $this->view->setVar('items_per_page', $this->opa_items_per_page);
     $this->view->setVar('current_items_per_page', $vn_items_per_page);
     $this->view->setVar('t_subject', $t_model);
     $this->view->setVar('mode_name', _t('browse'));
     $this->view->setVar('mode', 'browse');
     $this->view->setVar('mode_type_singular', $this->browseName('singular'));
     $this->view->setVar('mode_type_plural', $this->browseName('plural'));
     $this->view->setVar('access_values', $va_access_values);
     $t_display = $this->view->getVar('t_display');
     $va_display_list = $this->view->getVar('display_list');
     if ($vs_view == 'editable') {
         $va_initial_data = array();
         $va_row_headers = array();
         $vn_item_count = 0;
         if ($vo_result) {
             $vs_pk = $vo_result->primaryKey();
             while ($vn_item_count < 100 && $vo_result->nextHit()) {
                 $va_result = array('item_id' => $vn_id = $vo_result->get($vs_pk));
                 foreach ($va_display_list as $vn_placement_id => $va_bundle_info) {
                     $va_result[str_replace(".", "-", $va_bundle_info['bundle_name'])] = $t_display->getDisplayValue($vo_result, $vn_placement_id, array('request' => $this->request));
                 }
                 $va_initial_data[] = $va_result;
                 $vn_item_count++;
                 $va_row_headers[] = $vn_item_count . " " . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), 'caResultsEditorEditLink', $this->ops_tablename, $vn_id);
             }
         }
         $this->view->setVar('initialData', $va_initial_data);
         $this->view->setVar('rowHeaders', $va_row_headers);
     }
     //
     // Bottom line
     //
     $va_bottom_line = array();
     $vb_bottom_line_is_set = false;
     foreach ($va_display_list as $vn_placement_id => $va_placement) {
         if (isset($va_placement['settings']['bottom_line']) && $va_placement['settings']['bottom_line']) {
             $va_bottom_line[$vn_placement_id] = caProcessBottomLineTemplate($this->request, $va_placement, $vo_result, array('pageStart' => ($vn_page_num - 1) * $vn_items_per_page, 'pageEnd' => ($vn_page_num - 1) * $vn_items_per_page + $vn_items_per_page));
             $vb_bottom_line_is_set = true;
         } else {
             $va_bottom_line[$vn_placement_id] = '';
         }
     }
     $this->view->setVar('bottom_line', $vb_bottom_line_is_set ? $va_bottom_line : null);
     switch ($pa_options['output_format']) {
         # ------------------------------------
         case 'LABELS':
             $this->_genLabels($vo_result, $this->request->getParameter("label_form", pString), _t('Browse'), _t('Browse'));
             break;
             # ------------------------------------
         # ------------------------------------
         case 'EXPORT':
             $this->_genExport($vo_result, $this->request->getParameter("export_format", pString), _t('Browse'), _t('Browse'));
             break;
             # ------------------------------------
         # ------------------------------------
         case 'HTML':
         default:
             // generate type menu and type value list
             if (method_exists($t_model, "getTypeList")) {
                 $this->view->setVar('type_list', $t_model->getTypeList());
             }
             $this->opo_result_context->setAsLastFind();
             $this->opo_result_context->saveContext();
             if (!$pb_dont_render_view) {
                 $this->render('Browse/browse_controls_html.php');
             }
             break;
     }
 }
    } else {
        $vs_action = "Summary";
    }
    $i == 2 ? $i = 0 : "";
    ?>
				<tr <?php 
    print $i == 1 ? "class='odd'" : "";
    ?>
>
					<td style="width:10px">
						<input type='checkbox' name='add_to_set_ids' value='<?php 
    print (int) $vn_entity_id;
    ?>
' class="addItemToSetControl" />
					</td>
<?php 
    print "<td style='width:5%;'>" . caNavLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'editor/entities', 'EntityEditor', $vs_action, array('entity_id' => $vn_entity_id)) . "</td>";
    foreach ($va_display_list as $vn_placement_id => $va_display_item) {
        print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id, array('request' => $this->request)) . "</td>";
    }
    ?>
	
				</tr>
<?php 
    $i++;
    $vn_item_count++;
}
?>
				</tbody></table>
	</form>
</div><!--end scrollingResults -->
    } else {
        $vs_action = "Summary";
    }
    $i == 2 ? $i = 0 : "";
    ?>
				<tr <?php 
    print $i == 1 ? "class='odd'" : "";
    ?>
>
					<td style="width:10px">
						<input type='checkbox' name='add_to_set_ids' value='<?php 
    print (int) $vn_lot_id;
    ?>
' class="addItemToSetControl" />	
					</td>
	<?php 
    print "<td style='width:5%;'>" . caNavLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'editor/object_lots', 'ObjectLotEditor', $vs_action, array('lot_id' => $vn_lot_id)) . "</td>";
    foreach ($va_display_list as $vn_placement_id => $va_display_item) {
        print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id, array('request' => $this->request)) . "</td>";
    }
    ?>
	
				</tr>
	<?php 
    $i++;
    $vn_item_count++;
}
?>
		</tbody></table>
	</form>
</div><!--end scrollingResults -->
예제 #27
0
/**
 * Generates standard-format inspector panels for editors
 *
 * @param View $po_view Inspector view object
 * @param array $pa_options Optional array of options. Supported options are:
 *		backText = a string to use as the "back" button text; default is "Results"
 *
 * @return string HTML implementing the inspector
 */
function caBatchEditorInspector($po_view, $pa_options = null)
{
    require_once __CA_MODELS_DIR__ . '/ca_sets.php';
    $t_set = $po_view->getVar('t_set');
    $t_item = $po_view->getVar('t_item');
    $vs_table_name = $t_item->tableName();
    if (($vs_priv_table_name = $vs_table_name) == 'ca_list_items') {
        $vs_priv_table_name = 'ca_lists';
    }
    $o_result_context = $po_view->getVar('result_context');
    $t_ui = $po_view->getVar('t_ui');
    $o_dm = Datamodel::load();
    // action extra to preserve currently open screen across next/previous links
    //$vs_screen_extra 	= ($po_view->getVar('screen')) ? '/'.$po_view->getVar('screen') : '';
    $vs_buf = '<h3 class="nextPrevious">' . caNavLink($po_view->request, 'Back', '', 'manage', 'Set', 'ListSets') . "</h3>\n";
    $vs_color = $vs_type_name = null;
    $t_type = method_exists($t_item, "getTypeInstance") ? $t_item->getTypeInstance() : null;
    if ($t_type) {
        $vs_color = trim($t_type->get('color'));
        $vs_type_name = $t_type->getTypeName();
    }
    if (!$vs_color && $t_ui) {
        $vs_color = trim($t_ui->get('color'));
    }
    if (!$vs_color) {
        $vs_color = "444444";
    }
    $vs_buf .= "<h4><div id='caColorbox' style='border: 6px solid #{$vs_color}; padding-bottom:15px;'>\n";
    if ($po_view->request->user->canDoAction("can_edit_" . $vs_priv_table_name) && sizeof($t_item->getTypeList()) > 1) {
        if ($po_view->request->user->canDoAction("can_change_type_{$vs_table_name}")) {
            $vs_buf .= "<div id='inspectorChangeType'><div id='inspectorChangeTypeButton'><a href='#' onclick='caTypeChangePanel.showPanel(); return false;'>" . caNavIcon($po_view->request, __CA_NAV_BUTTON_CHANGE__, array('title' => _t('Change type'))) . "</a></div></div>\n";
            TooltipManager::add("#inspectorChangeType", _t('Change Record Type'));
            $vo_change_type_view = new View($po_view->request, $po_view->request->getViewsDirectoryPath() . "/bundles/");
            $vo_change_type_view->setVar('t_item', $t_item);
            $vo_change_type_view->setVar('t_set', $t_set);
            $vo_change_type_view->setVar('set_id', $t_set->getPrimaryKey());
            FooterManager::add($vo_change_type_view->render("batch_change_type_html.php"));
        }
        $vs_buf .= "<strong>" . _t("Editing %1", $vs_type_name) . ": </strong>\n";
    } else {
        $vs_buf .= "<strong>" . _t("Viewing %1", $vs_type_name) . ": </strong>\n";
    }
    $vn_item_count = $t_set->getItemCount(array('user_id' => $po_view->request->getUserID()));
    $vs_item_name = $vn_item_count == 1 ? $t_item->getProperty("NAME_SINGULAR") : $t_item->getProperty("NAME_PLURAL");
    $vs_buf .= "<strong>" . _t("Batch editing %1 %2 in set", $vn_item_count, $vs_item_name) . ": </strong>\n";
    if (!($vs_label = $t_set->getLabelForDisplay())) {
        if (!($vs_label = $t_set->get('set_code'))) {
            $vs_label = '[' . _t('BLANK') . ']';
        }
    }
    if ($t_set->haveAccessToSet($po_view->request->getUserID(), __CA_SET_EDIT_ACCESS__)) {
        $vs_label = caEditorLink($po_view->request, $vs_label, '', 'ca_sets', $t_set->getPrimaryKey());
    }
    $vs_buf .= " {$vs_label}" . "<a title='{$vs_idno}'>" . ($vs_idno ? " ({$vs_idno})" : '') . "</a>\n";
    // -------------------------------------------------------------------------------------
    $vs_buf .= "<div>" . _t('Set contains <em>%1</em>', join(", ", $t_set->getTypesForItems())) . "</div>\n";
    // -------------------------------------------------------------------------------------
    // Nav link for batch delete
    // -------------------------------------------------------------------------------------
    if ($vn_item_count > 0 && $po_view->request->user->canDoAction('can_batch_delete_' . $o_dm->getTableName($t_set->get('table_num')))) {
        $vs_buf .= "<div class='button' style='text-align:right;'><a href='#' id='inspectorMoreInfo'>" . _t("More options") . "</a> &rsaquo;</div>\n\t\t\t\t<div id='inspectorInfo' style='background-color:#f9f9f9; border: 1px solid #eee;'>";
        $vs_buf .= caNavLink($po_view->request, caNavIcon($po_view->request, __CA_NAV_BUTTON_DEL_BUNDLE__, array('style' => 'margin-top:7px; vertical-align: text-bottom;')) . " " . _t("Delete <strong><em>all</em></strong> records in set"), null, 'batch', 'Editor', 'Delete', array('set_id' => $t_set->getPrimaryKey()));
        $vs_buf .= "</div>\n";
        $vs_buf .= "<script type='text/javascript'>\n\t\t\t\tjQuery('#inspectorMoreInfo').click(function() {\n\t\t\t\t\tjQuery('#inspectorInfo').slideToggle(350, function() { \n\t\t\t\t\t\tjQuery('#inspectorMoreInfo').html((this.style.display == 'block') ? '" . addslashes(_t('Close options')) . "' : '" . addslashes(_t('More options')) . "');\n\t\t\t\t\t}); \n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t</script>";
    }
    // -------------------------------------------------------------------------------------
    $vs_buf .= "</div></h4>\n";
    return $vs_buf;
}
while ($vn_item_count < $vn_items_per_page && $vo_result->nextHit()) {
    $vn_lot_id = $vo_result->get('lot_id');
    $i == 2 ? $i = 0 : "";
    ?>
				<tr <?php 
    print $i == 1 ? "class='odd'" : "";
    ?>
>
					<td style="width:10px">
						<input type='checkbox' name='add_to_set_ids' value='<?php 
    print (int) $vn_lot_id;
    ?>
' class="addItemToSetControl" />	
					</td>
<?php 
    print "<td style='width:5%;'>" . caEditorLink($this->request, caNavIcon($this->request, __CA_NAV_BUTTON_EDIT__), '', 'ca_object_lots', $vn_lot_id, array()) . "</td>";
    foreach ($va_display_list as $vn_placement_id => $va_info) {
        print "<td>" . $t_display->getDisplayValue($vo_result, $vn_placement_id, array_merge(array('request' => $this->request), is_array($va_info['settings']) ? $va_info['settings'] : array())) . "</td>";
    }
    ?>
	
				</tr>
<?php 
    $i++;
    $vn_item_count++;
}
?>
			</tbody>
<?php 
if (is_array($va_bottom_line = $this->getVar('bottom_line'))) {
    ?>
예제 #29
0
<?php 
}
?>
		<div class="caItemList">
		
		</div>
		<input type="hidden" name="<?php 
print $vs_id_prefix;
?>
BundleList" id="<?php 
print $vs_id_prefix;
?>
BundleList" value=""/>
		<div style="clear: both; width: 1px; height: 1px;"><!-- empty --></div>
		<div class='button labelInfo caAddItemButton'><a href='#'><?php 
print caNavIcon($this->request, __CA_NAV_BUTTON_ADD__, null, null, array('graphicsPath' => $this->getVar('graphicsPath')));
?>
 <?php 
print $vs_add_label ? $vs_add_label : _t("Add relationship");
?>
</a></div>
	</div>
</div>
			
<script type="text/javascript">
	var caRelationBundle<?php 
print $vs_id_prefix;
?>
;
	jQuery(document).ready(function() {
		jQuery('#<?php 
 *
 * This program is free software; you may redistribute it and/or modify it under
 * the terms of the provided license as published by Whirl-i-Gig
 *
 * CollectiveAccess is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTIES whatsoever, including any implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 *
 * This source code is free and modifiable under the terms of 
 * GNU General Public License. (http://www.gnu.org/copyleft/gpl.html). See
 * the "license.txt" file for details, or visit the CollectiveAccess web site at
 * http://www.CollectiveAccess.org
 *
 * ----------------------------------------------------------------------
 */
$o_widget_manager = $this->getVar('widget_manager');
$va_widget_list = $o_widget_manager->getWidgetNames();
print caFormTag($this->request, 'addWidget', 'caWidgetManagerForm', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
?>
		<input type="hidden" name="widget" value="" id='caWidgetManagerFormWidgetValue'/>
<?php 
foreach ($va_widget_list as $vs_widget_name) {
    $va_status = WidgetManager::checkWidgetStatus($vs_widget_name);
    if (!$va_status["available"]) {
        continue;
    }
    print "<a href='#' onclick='jQuery(\"#caWidgetManagerFormWidgetValue\").val(\"{$vs_widget_name}\"); jQuery(\"#caWidgetManagerForm\").submit();'>" . caNavIcon($this->request, __CA_NAV_BUTTON_ADD_WIDGET__) . "  " . $o_widget_manager->getWidgetTitle($vs_widget_name) . "</a><br/>\n";
    print "<div id='widgetDescription'>" . $o_widget_manager->getWidgetDescription($vs_widget_name) . "</div>";
}
?>
	</form>