本文整理汇总了PHP中View::setVar方法的典型用法代码示例。如果您正苦于以下问题:PHP View::setVar方法的具体用法?PHP View::setVar怎么用?PHP View::setVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::setVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postDispatch
public function postDispatch()
{
$o_view = new View($this->getRequest(), $this->getRequest()->config->get('views_directory'));
$o_notification = new NotificationManager($this->getRequest());
if ($o_notification->numNotifications()) {
$o_view->setVar('notifications', $o_notification->getNotifications($this->getResponse()->isRedirect()));
$this->getResponse()->prependContent($o_view->render('pageFormat/notifications.php'), 'notifications');
}
//$nav = new AppNavigation($this->getRequest(), $this->getResponse());
$o_view->setVar('nav', $nav);
//$this->getResponse()->prependContent($o_view->render('pageFormat/menuBar.php'), 'menubar');
$this->getResponse()->prependContent($o_view->render('pageFormat/pageHeader.php'), 'head');
$this->getResponse()->appendContent($o_view->render('pageFormat/pageFooter.php'), 'footer');
}
示例2: caDownloadAttributeMedia
function caDownloadAttributeMedia($po_request, $po_response, $pn_occurrence_id, $ps_version, $pa_options = null)
{
$o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
$t_occurrence = new ca_occurrences($pn_occurrence_id);
if (!$t_occurrence->getPrimaryKey()) {
return null;
}
$vs_path = $t_occurrence->get('ca_occurrences.report_file', array('version' => $ps_version, 'return' => 'path'));
$vs_path_ext = pathinfo($vs_path, PATHINFO_EXTENSION);
if (!($vs_title = trim($t_occurrence->get('ca_occurrences.preferred_labels.name')))) {
$vs_title = "report";
}
$vs_name = _t(preg_replace('![^A-Za-z0-9\\,\\/\\?\\"\']+!', '_', $vs_title) . ".{$vs_path_ext}");
$o_view->setVar('file_path', $vs_path);
$o_view->setVar('file_name', $vs_name);
// send download
return $o_view->render('ca_attributes_download_media.php');
}
示例3: loadView
public function loadView($view_file)
{
if ($this->module != null) {
$arr = explode("/", $view_file);
if (count($arr) == 1) {
$view_file .= "/index";
}
$view = new View();
$view->setModuleName("module/" . $this->module);
$view->setView($view_file);
$view->setLayout($this->parent->getLayoutFile());
$view->setLayoutClass($this->parent->getLayout());
$view->setVar($this->parent->getVar());
$view->setVar($this->parent->getVar());
$view->setModuleMeta($this->parent->getModuleMeta());
$view->setModuleTitle($this->parent->getModuleTitle());
$view->setModuleCss($this->parent->getModuleCss());
$view->setModuleScript($this->parent->getModuleScript());
$view->CallView();
} else {
return new TException("Vui lòng cho biết module cần truy cập. {$this->module}(module cân truy cập)", 401);
}
}
示例4: getRepresentationChooserHTMLFormBundle
/**
* Returns HTML bundle for picking representations to attach to an object-* relationship
*
* @param object $po_request The current request
* @param $ps_form_name The name of the HTML form this bundle will be part of
*
* @return string HTML for bundle
*/
public function getRepresentationChooserHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_bundle_settings, $pa_options = null)
{
$o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
$o_view->setVar('lookup_urls', caJSONLookupServiceUrl($po_request, $this->getAppDatamodel()->getTableName($this->get('table_num'))));
$o_view->setVar('t_subject', $this);
$vn_object_id = $this->getLeftTableName() == 'ca_objects' ? $this->get($this->getLeftTableFieldName()) : $this->get($this->getRightTableFieldName());
$o_view->setVar('t_object', $t_object = new ca_objects($vn_object_id));
$o_view->setVar('id_prefix', $ps_form_name);
$o_view->setVar('placement_code', $ps_placement_code);
$o_view->setVar('element_code', caGetOption(array('elementCode', 'element_code'), $pa_bundle_settings, null));
$o_view->setVar('settings', $pa_bundle_settings);
return $o_view->render('ca_object_representation_chooser_html.php');
}
示例5: getTourStopHTMLFormBundle
/**
* Renders and returns HTML form bundle for management of stops in the currently loaded tour
*
* @param object $po_request The current request object
* @param string $ps_form_name The name of the form in which the bundle will be rendered
*
* @return string Rendered HTML bundle for display
*/
public function getTourStopHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_options = null)
{
$o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
$o_view->setVar('t_tour', $this);
$o_view->setVar('t_stop', new ca_tour_stops());
$o_view->setVar('id_prefix', $ps_form_name);
$o_view->setVar('placement_code', $ps_placement_code);
$o_view->setVar('request', $po_request);
if ($this->getPrimaryKey()) {
$o_view->setVar('stops', $this->getStops($po_request));
} else {
$o_view->setVar('stops', array());
}
return $o_view->render('ca_tour_stops_list.php');
}
示例6: getSetMedia
/**
* Download (accessible) media for all records in this set
*/
public function getSetMedia()
{
set_time_limit(600);
// allow a lot of time for this because the sets can be potentially large
$o_dm = Datamodel::load();
$t_set = new ca_sets($this->request->getParameter('set_id', pInteger));
if (!$t_set->getPrimaryKey()) {
$this->notification->addNotification(_t('No set defined'), __NOTIFICATION_TYPE_ERROR__);
$this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey()));
return false;
}
$va_record_ids = array_keys($t_set->getItemRowIDs(array('limit' => 100000)));
if (!is_array($va_record_ids) || !sizeof($va_record_ids)) {
$this->notification->addNotification(_t('No media is available for download'), __NOTIFICATION_TYPE_ERROR__);
$this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey()));
return false;
}
$vs_subject_table = $o_dm->getTableName($t_set->get('table_num'));
$t_instance = $o_dm->getInstanceByTableName($vs_subject_table);
$qr_res = $vs_subject_table::createResultSet($va_record_ids);
$qr_res->filterNonPrimaryRepresentations(false);
$va_paths = array();
while ($qr_res->nextHit()) {
$va_original_paths = $qr_res->getMediaPaths('ca_object_representations.media', 'original');
if (sizeof($va_original_paths) > 0) {
$va_paths[$qr_res->get($t_instance->primaryKey())] = array('idno' => $qr_res->get($t_instance->getProperty('ID_NUMBERING_ID_FIELD')), 'paths' => $va_original_paths);
}
}
if (sizeof($va_paths) > 0) {
$vs_tmp_name = caGetTempFileName('DownloadSetMedia', 'zip');
$o_phar = new PharData($vs_tmp_name, null, null, Phar::ZIP);
foreach ($va_paths as $vn_pk => $va_path_info) {
$vn_c = 1;
foreach ($va_path_info['paths'] as $vs_path) {
if (!file_exists($vs_path)) {
continue;
}
$vs_filename = $va_path_info['idno'] ? $va_path_info['idno'] : $vn_pk;
$vs_filename .= "_{$vn_c}";
if ($vs_ext = pathinfo($vs_path, PATHINFO_EXTENSION)) {
$vs_filename .= ".{$vs_ext}";
}
$o_phar->addFile($vs_path, $vs_filename);
$vn_c++;
}
}
$o_view = new View($this->request, $this->request->getViewsDirectoryPath() . '/bundles/');
// send download
$vs_set_code = $t_set->get('set_code');
$o_view->setVar('tmp_file', $vs_tmp_name);
$o_view->setVar('download_name', 'media_for_' . mb_substr(preg_replace('![^A-Za-z0-9]+!u', '_', $vs_set_code ? $vs_set_code : $t_set->getPrimaryKey()), 0, 20) . '.zip');
$this->response->addContent($o_view->render('ca_sets_download_media.php'));
return;
} else {
$this->notification->addNotification(_t('No media is available for download'), __NOTIFICATION_TYPE_ERROR__);
$this->opo_response->setRedirect(caEditorUrl($this->opo_request, 'ca_sets', $t_set->getPrimaryKey()));
return;
}
return $this->Edit();
}
示例7: foreach
if ($vb_should_use_book_viewer && $this->getVar('num_multifiles') > 0) {
// Create book viewer from single representation with multifiles
$vb_use_book_reader = true;
foreach ($t_rep->getFileList(null, 0, null, array('preview', 'large_preview', 'page_preview')) as $vn_id => $va_file) {
$va_pages[] = array('object_id' => $vn_object_id, 'representation_id' => $t_rep->getPrimaryKey(), 'thumbnail_url' => $va_file['preview_url'], 'thumbnail_path' => $va_file['preview_path'], 'thumbnail_width' => $va_file['preview_width'], 'thumbnail_height' => $va_file['preview_height'], 'thumbnail_mimetype' => $va_file['preview_mimetype'], 'normal_url' => $va_file['large_preview_url'], 'normal_path' => $va_file['large_preview_path'], 'normal_width' => $va_file['large_preview_width'], 'normal_height' => $va_file['large_preview_height'], 'normal_mimetype' => $va_file['large_preview_mimetype'], 'large_url' => $va_file['page_preview_url'], 'large_path' => $va_file['page_preview_path'], 'large_width' => $va_file['page_preview_width'], 'large_height' => $va_file['page_preview_height'], 'large_mimetype' => $va_file['page_preview_mimetype']);
}
$vn_object_id = $t_object->getPrimaryKey();
$vn_representation_id = $t_rep->getPrimaryKey();
$vs_book_viewer_content_mode = 'multifiles';
}
}
}
}
if ($vb_use_book_reader) {
$o_view = new View($this->request, $this->request->getViewsDirectoryPath() . '/bundles/');
$o_view->setVar('pages', $va_pages);
$o_view->setVar('sections', $va_sections);
$o_view->setVar('object_id', $vn_object_id);
$o_view->setVar('representation_id', $vn_representation_id);
$o_view->setVar('content_mode', $vs_book_viewer_content_mode);
$o_view->setVar('initial_page', $vn_open_to_page);
$o_view->setVar('display_type', $vs_display_type);
$o_view->setVar('display_options', $va_display_options);
$va_page_cache = $this->request->session->getVar('caDocumentViewerPageListCache');
$va_page_cache[$vn_object_id . '/' . $vn_representation_id] = $va_pages;
$this->request->session->setVar('caDocumentViewerPageListCache', $va_page_cache);
$va_section_cache = $this->request->session->getVar('caDocumentViewerSectionCache');
$va_section_cache[$vn_object_id . '/' . $vn_representation_id] = $va_sections;
$this->request->session->setVar('caDocumentViewerSectionCache', $va_section_cache);
print $o_view->render('bookviewer_html.php');
} else {
示例8: getCommerceOrderHistoryHTMLFormBundle
/**
* Returns HTML form bundle (for use in a ca_object_representations editor form) for media
*
* @param HTTPRequest $po_request The current request
* @param string $ps_form_name
* @param string $ps_placement_code
* @param array $pa_bundle_settings
* @param array $pa_options Array of options. Supported options are
* noCache = If set to true then label cache is bypassed; default is true
*
* @return string Rendered HTML bundle
*/
public function getCommerceOrderHistoryHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_bundle_settings = null, $pa_options = null)
{
global $g_ui_locale;
$o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
if (!is_array($pa_options)) {
$pa_options = array();
}
$o_view->setVar('id_prefix', $ps_form_name . '_commerce_order_history');
$o_view->setVar('placement_code', $ps_placement_code);
// pass placement code
$o_view->setVar('settings', $pa_bundle_settings);
$o_view->setVar('t_subject', $this);
return $o_view->render('ca_commerce_order_history.php');
}
示例9: render
//.........这里部分代码省略.........
case 'HTML':
default:
if (isset($pa_options['showNavigationControls'])) {
$vb_show_navigation_control = $pa_options['showNavigationControls'] ? 'true' : 'false';
} else {
$vb_show_navigation_control = $this->opo_config->get('google_maps_show_navigation_controls') ? 'true' : 'false';
}
if (isset($pa_options['showScaleControls'])) {
$vb_show_scale_control = $pa_options['showScaleControls'] ? 'true' : 'false';
} else {
$vb_show_scale_control = $this->opo_config->get('google_maps_show_scale_controls') ? 'true' : 'false';
}
if (isset($pa_options['showMapTypeControls'])) {
$vb_show_map_type_control = $pa_options['showMapTypeControls'] ? 'true' : 'false';
} else {
$vb_show_map_type_control = $this->opo_config->get('google_maps_show_map_type_controls') ? 'true' : 'false';
}
$vs_buf = "<div style='width:{$vs_width}; height:{$vs_height}' id='{$vs_id}'> </div>\n\n<script type='text/javascript'>\n\tvar caMap_{$vs_id};\n\tvar GeoMarker_{$vs_id};\njQuery(document).ready(function() {\n\tcaMap_{$vs_id} = caUI.initGoogleMap({id: '{$vs_id}', mapType: '{$vs_type}', zoomControl: true, navigationControl: {$vb_show_navigation_control} , mapTypeControl: {$vb_show_map_type_control}, scaleControl: {$vb_show_scale_control}});\n\tvar caMap_{$vs_id}_markers = [];\n\tvar caMap_{$vs_id}_current_marker = -1;\n\n\t\tvar styles = [\n\t\t {\n\t\t\tstylers: [\n\n\t\t\t { saturation: -100 },\n\n\t\t\t]\n\t\t },{\n\t\t\tfeatureType: 'road',\n\t\t\telementType: 'geometry',\n\t\t\tstylers: [\n\t\t\t { lightness: 100 },\n\t\t\t { visibility: 'simplified' }\n\t\t\t]\n\t\t }\n\t\t];\n\t\t\n\n\t\t\tcaMap_{$vs_id}.map.setOptions({styles: styles});\n\t\t\tvar mc_{$vs_id} = new MarkerClusterer(caMap_{$vs_id}.map, [], {maxZoom: 14});\n\t\t\tGeoMarker_{$vs_id} = new GeolocationMarker(caMap_{$vs_id}.map);\n\t\t\tGeoMarker_{$vs_id}.setCircleOptions({ fillColor: 'red', radius: '100', visible: true, map: caMap_{$vs_id}.map});\n";
if ($vn_zoom_level > 0) {
$vs_buf .= "\n\t\t\t\tvar idleMinListener_{$vs_id} = google.maps.event.addListenerOnce(caMap_{$vs_id}.map, 'idle', function() {\n\t\t\t\t\tcaMap_{$vs_id}.map.setZoom({$vn_zoom_level});\n\t\t\t\t});\n\t\t\t\t";
} else {
if ($vn_min_zoom_level) {
$vs_buf .= "\n\t\t\t\t\tvar idleMinListener_{$vs_id} = google.maps.event.addListenerOnce(caMap_{$vs_id}.map, 'idle', function() {\n\t\t\t\t\t\tif (caMap_{$vs_id}.map.getZoom() < {$vn_min_zoom_level}) {\n\t\t\t\t\t\t\tcaMap_{$vs_id}.map.setZoom({$vn_min_zoom_level});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t";
}
if ($vn_max_zoom_level) {
$vs_buf .= "\n\t\t\t\t\tvar idleMaxListener_{$vs_id} = google.maps.event.addListenerOnce(caMap_{$vs_id}.map, 'idle', function() {\n\t\t\t\t\t\tif (caMap_{$vs_id}.map.getZoom() > {$vn_max_zoom_level}) {\n\t\t\t\t\t\t\tcaMap_{$vs_id}.map.setZoom({$vn_max_zoom_level});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t";
}
}
$va_locs = $va_paths = array();
foreach ($va_map_items as $o_map_item) {
$va_coords = $o_map_item->getCoordinates();
if (sizeof($va_coords) > 1) {
// is path
$va_path = array();
foreach ($va_coords as $va_coord) {
$va_path[] = "new google.maps.LatLng({$va_coord['latitude']},{$va_coord['longitude']})";
}
$va_paths[] = array('path' => $va_coords, 'pathJS' => $va_path, 'label' => $o_map_item->getLabel(), 'content' => $o_map_item->getContent(), 'ajaxContentUrl' => $o_map_item->getAjaxContentUrl(), 'ajaxContentID' => $o_map_item->getAjaxContentID());
} else {
// is point
$va_coord = array_shift($va_coords);
$va_locs[$va_coord['latitude']][$va_coord['longitude']][] = array('label' => $o_map_item->getLabel(), 'content' => $o_map_item->getContent(), 'ajaxContentUrl' => $o_map_item->getAjaxContentUrl(), 'ajaxContentID' => $o_map_item->getAjaxContentID());
}
}
foreach ($va_locs as $vn_latitude => $va_locs_by_longitude) {
foreach ($va_locs_by_longitude as $vn_longitude => $va_marker_content_items) {
$va_buf = array();
$va_ajax_ids = array();
$vs_label = $vs_ajax_content_url = '';
foreach ($va_marker_content_items as $va_marker_content_item) {
if (!$vs_label) {
$vs_label = $va_marker_content_item['label'];
}
if (!$vs_ajax_content_url) {
$vs_ajax_content_url = $va_marker_content_item['ajaxContentUrl'];
}
$va_ajax_ids[] = $va_marker_content_item['ajaxContentID'];
$va_buf[md5($va_marker_content_item['content'])] = $va_marker_content_item['content'];
// md5 is to ensure there is no duplicate content (eg. if something is mapped to the same location twice)
}
if (!($vn_latitude && $vn_longitude)) {
continue;
}
if ($vs_balloon_view && isset($pa_options['request']) && $pa_options['request']) {
$o_view = new View($pa_options['request'], isset($pa_options['viewPath']) && $pa_options['viewPath'] ? $pa_options['viewPath'] : $pa_options['request']->getViewsDirectoryPath());
$o_view->setVar("content", join($vs_delimiter, $va_buf));
$o_view->setVar("contentList", $va_buf);
$o_view->setVar("ids", $va_ajax_ids);
$vs_balloon_content = $o_view->render($vs_balloon_view);
} else {
$vs_balloon_content = join($vs_delimiter, $va_buf);
}
$vs_buf .= "\tvar m = caMap_{$vs_id}.makeMarker(" . $vn_latitude . ", " . $vn_longitude . ", '" . preg_replace("![\n\r]+!", " ", addslashes($vs_label)) . "', '" . preg_replace("![\n\r]+!", " ", addslashes($vs_balloon_content)) . "', '" . preg_replace("![\n\r]+!", " ", $vs_ajax_content_url ? addslashes($vs_ajax_content_url . "/_ajax/1/id/" . join(';', $va_ajax_ids)) : '') . "', {icon: '" . $o_config->get("themes_url") . "/" . (defined("__CA_THEME__") ? __CA_THEME__ : $o_config->get('theme')) . "/graphics/blu-pointer.png'} );\n";
$vs_buf .= "\tcaMap_{$vs_id}_markers.push(m);\n";
$vs_buf .= "\tmc_{$vs_id}.addMarker(m);\n";
}
}
foreach ($va_paths as $vn_i => $va_path) {
$vs_buf .= "caMap_{$vs_id}.makePath([" . join(',', $va_path['pathJS']) . "], '" . preg_replace("![\n\r]+!", " ", addslashes($va_path['label'])) . "','" . preg_replace("![\n\r]+!", " ", addslashes($va_path['content'])) . "', {strokeColor: '{$vs_path_color}', strokeWeight: {$vn_path_weight}, strokeOpacity: {$vn_path_opacity}});\n";
}
$vs_buf .= "\n\t\t\t\tcaMap_{$vs_id}.fitBounds(" . $va_extents['north'] . "," . $va_extents['south'] . "," . $va_extents['east'] . "," . $va_extents['west'] . ");";
if (isset($pa_options['cycleRandomly']) && $pa_options['cycleRandomly']) {
if (isset($pa_options['cycleRandomlyInterval']) && $pa_options['cycleRandomlyInterval']) {
$vs_interval = $pa_options['cycleRandomlyInterval'];
} else {
$vs_interval = "2s";
}
if (isset($pa_options['stopAfterRandomCycles']) && $pa_options['stopAfterRandomCycles']) {
$vn_times = (int) $pa_options['stopAfterRandomCycles'];
} else {
$vn_times = 0;
}
$vs_buf .= "\n\t\t\t\tcaMap_{$vs_id}.openInfoWindow(caMap_{$vs_id}_markers[0]);\n\t\t\t\tjQuery(document).everyTime('{$vs_interval}', 'caMap_{$vs_id}_cycler', function() {\n\t\t\t\t\tvar i = -1;\n\t\t\t\t\tif (caMap_{$vs_id}_markers.length > 1) {\n\t\t\t\t\t\twhile((i < 0) || (i == caMap_{$vs_id}_current_marker)) {\n\t\t\t\t\t\t\t i = Math.floor(Math.random()*(caMap_{$vs_id}_markers.length));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\t}\n\t\t\t\t\tcaMap_{$vs_id}_current_marker = i;\n\t\t\t\t\tcaMap_{$vs_id}.openInfoWindow(caMap_{$vs_id}_markers[i]);\n\t\t\t\t}, {$vn_times});\n\t\t";
}
$vs_buf .= "\n\t});\n\tfunction clickroute() { \n\t\tvar latLng = GeoMarker_{$vs_id}.getPosition();\n\t\tif (typeof latLng === 'undefined' ) {\n\t\t\tdocument.getElementById('helpDiv').style.display = 'block';\n\t\t} else {\n\t\t\tcaMap_{$vs_id}.map.panTo(latLng);\n\t\t}\n\t}\n</script>\n";
break;
# ---------------------------------
}
return $vs_buf;
}
示例10: getSearchFormHTMLFormBundle
/**
* Returns HTML bundle for adding/editing/deleting placements from a form
*
* @param object $po_request The current request
* @param $ps_form_name The name of the HTML form this bundle will be part of
* @return string HTML for bundle
*/
public function getSearchFormHTMLFormBundle($po_request, $ps_form_name, $pa_options = null)
{
if (!$this->haveAccessToForm($po_request->getUserID(), __CA_SEARCH_FORM_EDIT_ACCESS__)) {
return null;
}
$vs_view_path = isset($pa_options['viewPath']) && $pa_options['viewPath'] ? $pa_options['viewPath'] : $po_request->getViewsDirectoryPath();
$o_view = new View($po_request, "{$vs_view_path}/bundles/");
$o_view->setVar('lookup_urls', caJSONLookupServiceUrl($po_request, $this->_DATAMODEL->getTableName($this->get('table_num'))));
$o_view->setVar('t_form', $this);
$o_view->setVar('id_prefix', $ps_form_name);
return $o_view->render('ca_search_form_placements.php');
}
示例11: getPropertyHTMLFormBundle
public function getPropertyHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $ps_property, $pa_attributes = null, $pa_options = null)
{
$vs_view_path = isset($pa_options['viewPath']) && $pa_options['viewPath'] ? $pa_options['viewPath'] : $po_request->getViewsDirectoryPath();
$o_view = new View($po_request, "{$vs_view_path}/bundles/");
$o_view->setVar('property', $ps_property);
$o_view->setVar('id_prefix', $ps_form_name);
$o_view->setVar('placement_code', $ps_placement_code);
$pa_attributes['name'] = $pa_attributes['id'] = "{$ps_placement_code}{$ps_form_name}{$ps_property}";
$o_view->setVar('form_element', $this->getPropertyHTMLFormElement($ps_property, $pa_attributes));
return $o_view->render('ca_representation_annotation_properties.php');
}
示例12: htmlFormElement
/**
* Return HTML form element for editing.
*
* @param array $pa_element_info An array of information about the metadata element being edited
* @param array $pa_options array Options include:
* class = the CSS class to apply to all visible form elements [Default=lookupBg]
* width = the width of the form element [Default=field width defined in metadata element definition]
* height = the height of the form element [Default=field height defined in metadata element definition]
* request = the RequestHTTP object for the current request; required for lookups to work [Default is null]
*
* @return string
*/
public function htmlFormElement($pa_element_info, $pa_options = null)
{
$t_instance = self::elementTypeToInstance($this->getType());
$va_settings = $this->getSettingValuesFromElementArray($pa_element_info, array('fieldWidth'));
$vs_class = trim(isset($pa_options['class']) && $pa_options['class'] ? $pa_options['class'] : 'lookupBg');
if ($pa_options['request']) {
if ($vs_restrict_to_type = caGetOption('restrictTo' . $this->ops_name_singular . 'TypeIdno', $pa_element_info['settings'], null)) {
$va_params = array('max' => 50, 'type' => $vs_restrict_to_type);
} else {
$va_params = array('max' => 50);
}
$vs_url = caNavUrl($pa_options['request'], 'lookup', $this->ops_name_singular, 'Get', $va_params);
} else {
// no lookup is possible
return $this->getDisplayValue();
}
$va_pieces = caEditorUrl($pa_options['request'], $t_instance->tableName(), 0, true);
$va_pieces['controller'] = str_replace('Editor', 'QuickAdd', $va_pieces['controller']);
$va_pieces['action'] = 'Form';
$vs_quickadd_url = caNavUrl($pa_options['request'], $va_pieces['module'], $va_pieces['controller'], $va_pieces['action'], array($t_instance->primaryKey() => 0));
$o_view = new View($pa_options['request'], $pa_options['request']->getViewsDirectoryPath() . "/bundles/");
$o_view->setVar('field_name_prefix', "{fieldNamePrefix}{$pa_element_info['element_id']}");
$o_view->setVar('quickadd_url', $vs_quickadd_url);
$o_view->setVar('lookup_url', $vs_url);
$o_view->setVar('options', $pa_options);
$o_view->setVar('settings', $va_settings);
$o_view->setVar('element_info', $pa_element_info);
$o_view->setVar('class', $vs_class);
return $o_view->render('authority_attribute.php');
}
示例13: getComponentListHTMLFormBundle
/**
* Returns HTML form bundle for component listing
*
* @param HTTPRequest $po_request The current request
* @param string $ps_form_name
* @param string $ps_placement_code
* @param array $pa_bundle_settings
* @param array $pa_options Array of options. Options include:
* noCache = If set to true then label cache is bypassed. [Default = true]
*
* @return string Rendered HTML bundle
*/
public function getComponentListHTMLFormBundle($po_request, $ps_form_name, $ps_placement_code, $pa_bundle_settings = null, $pa_options = null)
{
global $g_ui_locale;
$o_view = new View($po_request, $po_request->getViewsDirectoryPath() . '/bundles/');
if (!is_array($pa_options)) {
$pa_options = array();
}
$o_view->setVar('id_prefix', $ps_form_name);
$o_view->setVar('placement_code', $ps_placement_code);
// pass placement code
$o_view->setVar('settings', $pa_bundle_settings);
$o_view->setVar('add_label', isset($pa_bundle_settings['add_label'][$g_ui_locale]) ? $pa_bundle_settings['add_label'][$g_ui_locale] : null);
$o_view->setVar('t_subject', $this);
return $o_view->render('ca_objects_components_list.php');
}
示例14: elseif
} elseif ($vn_value_id > 0) {
// displaying media attribute
if ($vb_should_use_book_viewer && $this->getVar('num_multifiles') > 0) {
// Create book viewer from single representation with multifiles
$vb_use_book_reader = true;
$vn_subject_id = $t_subject->getPrimaryKey();
foreach ($t_value->getFileList(null, 0, null, array('preview', 'large_preview', 'page_preview')) as $vn_id => $va_file) {
$va_pages[] = array('subject_id' => $vn_subject_id, 'value_id' => $vn_value_id, 'thumbnail_url' => $va_file['preview_url'], 'thumbnail_path' => $va_file['preview_path'], 'thumbnail_width' => $va_file['preview_width'], 'thumbnail_height' => $va_file['preview_height'], 'thumbnail_mimetype' => $va_file['preview_mimetype'], 'normal_url' => $va_file['large_preview_url'], 'normal_path' => $va_file['large_preview_path'], 'normal_width' => $va_file['large_preview_width'], 'normal_height' => $va_file['large_preview_height'], 'normal_mimetype' => $va_file['large_preview_mimetype'], 'large_url' => $va_file['page_preview_url'], 'large_path' => $va_file['page_preview_path'], 'large_width' => $va_file['page_preview_width'], 'large_height' => $va_file['page_preview_height'], 'large_mimetype' => $va_file['page_preview_mimetype']);
}
$vs_book_viewer_content_mode = 'multifiles';
}
}
if ($vb_use_book_reader) {
// Return Javascript for document viewer interface
$o_view = new View($this->request, $this->request->getViewsDirectoryPath() . '/bundles/');
$o_view->setVar('t_subject', $t_subject);
$o_view->setVar('t_representation', $t_rep);
$o_view->setVar('t_attribute_value', $t_value);
$o_view->setVar('item_id', $t_set_item ? $t_set_item->getPrimaryKey() : null);
$o_view->setVar('pages', $va_pages);
$o_view->setVar('sections', $va_sections);
$o_view->setVar('content_mode', $vs_book_viewer_content_mode);
$o_view->setVar('initial_page', $vn_open_to_page);
$o_view->setVar('display_type', $vs_display_type);
$o_view->setVar('display_options', $va_display_options);
// Save pages in cache so BaseEditorController::GetPageListAsJSON() can get them for return to the document viewer
$va_page_cache = $this->request->session->getVar('caDocumentViewerPageListCache');
$vs_page_cache_key = $vs_book_viewer_content_mode == 'hierarchy_of_representations' ? md5($vn_subject_id) : md5($vn_subject_id . '/' . $vn_representation_id . '/' . $vn_value_id);
$va_page_cache[$vs_page_cache_key] = $va_pages;
$this->request->session->setVar('caDocumentViewerPageListCache', $va_page_cache);
$va_section_cache = $this->request->session->getVar('caDocumentViewerSectionCache');
示例15: Run
/**
*
*
*
*/
public function Run()
{
AssetLoadManager::register('fileupload');
$t_importer = $this->getImporterInstance();
$this->view->setVar('t_importer', $t_importer);
$this->view->setVar('last_settings', $va_last_settings = $this->request->user->getVar('batch_metadata_last_settings'));
$o_view = new View($this->request, $this->request->getViewsDirectoryPath() . '/bundles/');
$o_view->setVar('id', 'fileImportPath');
$o_view->setVar('defaultPath', caGetOption('fileImportPath', $va_last_settings, null));
$this->view->setVar('file_browser', $o_view->render('settings_directory_browser_html.php'));
$this->render('metadataimport/importer_run_html.php');
}