コード例 #1
0
 /**
  *
  */
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm"));
     }
     caSetPageCSSClasses(array("multisearch"));
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Search") . ": " . $this->request->getParameter('search', pString));
 }
コード例 #2
0
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     $this->config = caGetFrontConfig();
     caSetPageCSSClasses(array("front"));
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm"));
     }
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name"));
 }
コード例 #3
0
 public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
 {
     parent::__construct($po_request, $po_response, $pa_view_paths);
     if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm"));
     }
     $this->config = caGetContactConfig();
     if (!$this->config->get("contact_email") && !$this->config->get("contact_form_elements")) {
         $this->notification->addNotification(_t("Contact form is not configured properly"), __NOTIFICATION_TYPE_ERROR__);
         $this->response->setRedirect(caNavUrl($this->request, '', '', ''));
     }
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Contact"));
     caSetPageCSSClasses(array("contact"));
 }
コード例 #4
0
 /**
  * Initializes editor view with core set of values, loads model with record to be edited and selects user interface to use.
  *
  * @param $pa_options Array of options. Supported options are:
  *		ui = The ui_id or editor_code value for the user interface to use. If omitted the default user interface is used.
  */
 protected function _initView($pa_options = null)
 {
     // load required javascript
     AssetLoadManager::register('bundleableEditor');
     AssetLoadManager::register('imageScroller');
     AssetLoadManager::register('datePickerUI');
     $vn_set_id = $this->request->getParameter('set_id', pInteger);
     $t_set = new ca_sets();
     if (!$vn_set_id || !$t_set->load($vn_set_id)) {
         // Bad set id
         return array(null, null, null, null);
     }
     // Does user have access to set?
     if (!$t_set->haveAccessToSet($this->request->getUserID(), __CA_SET_READ_ACCESS__)) {
         return array(null, null, null, null);
     }
     $t_subject = $this->opo_datamodel->getInstanceByTableNum($t_set->get('table_num'));
     $t_ui = new ca_editor_uis();
     if (!isset($pa_options['ui']) && !$pa_options['ui']) {
         $t_ui->load($this->request->user->getPreference("batch_" . $t_subject->tableName() . "_editor_ui"));
     }
     if (!$t_ui->getPrimaryKey() && isset($pa_options['ui']['__all__']) && $pa_options['ui']['__all__']) {
         if (is_numeric($pa_options['ui']['__all__'])) {
             $t_ui->load((int) $pa_options['ui']['__all__']);
         }
         if (!$t_ui->getPrimaryKey()) {
             $t_ui->load(array('editor_code' => $pa_options['ui']['__all__']));
         }
     }
     if (!$t_ui->getPrimaryKey()) {
         $t_ui = ca_editor_uis::loadDefaultUI($t_subject->tableName(), $this->request, $t_subject->getTypeID());
     }
     $this->view->setVar('set_id', $vn_set_id);
     $this->view->setVar('t_set', $t_set);
     $this->view->setVar('t_subject', $t_subject);
     $vn_item_count = $t_set->getItemCount(array('user_id' => $this->request->getUserID()));
     $vs_item_name = $vn_item_count == 1 ? $t_subject->getProperty("NAME_SINGULAR") : $t_subject->getProperty("NAME_PLURAL");
     MetaTagManager::setWindowTitle(_t("Batch editing %1 %2 with set %3", $vn_item_count, $vs_item_name, $t_set->getLabelForDisplay(true)));
     return array($vn_set_id, $t_set, $t_subject, $t_ui);
 }
コード例 #5
0
ファイル: SetsController.php プロジェクト: kai-iak/pawtucket2
 function setDetail()
 {
     if (!$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'loginForm'));
         return;
     }
     AssetLoadManager::register("mediaViewer");
     $o_context = new ResultContext($this->request, 'ca_objects', 'sets', 'lightbox');
     $o_context->setAsLastFind();
     $this->view->setVar('browse', $o_browse = caGetBrowseInstance("ca_objects"));
     $this->view->setVar("browse_type", "caLightbox");
     # --- this is only used when loading hierarchy facets and is a way to get around needing a browse type to pull the table in FindController
     $ps_view = $this->request->getParameter('view', pString);
     if (!in_array($ps_view, array('thumbnail', 'timeline', 'timelineData', 'pdf', 'list'))) {
         $ps_view = 'thumbnail';
     }
     $this->view->setVar('view', $ps_view);
     $this->view->setVar('views', $this->opo_config->getAssoc("views"));
     if (!($t_set = $this->_getSet(__CA_SET_READ_ACCESS__))) {
         $this->Index();
     }
     $vn_set_id = $t_set->get("set_id");
     $this->view->setVar("set", $t_set);
     $va_comments = $t_set->getComments();
     $this->view->setVar("comments", $va_comments);
     //
     // Load existing browse if key is specified
     //
     if ($ps_cache_key = $this->request->getParameter('key', pString)) {
         $o_browse->reload($ps_cache_key);
     }
     //
     // Clear criteria if required
     //
     if ($vs_remove_criterion = $this->request->getParameter('removeCriterion', pString)) {
         $o_browse->removeCriteria($vs_remove_criterion, array($this->request->getParameter('removeID', pString)));
     }
     if ((bool) $this->request->getParameter('clear', pInteger)) {
         // Clear all refine critera but *not* underlying _search criterion
         $va_criteria = $o_browse->getCriteria();
         foreach ($va_criteria as $vs_criterion => $va_criterion_info) {
             if ($vs_criterion == '_search') {
                 continue;
             }
             $o_browse->removeCriteria($vs_criterion, array_keys($va_criterion_info));
         }
     }
     if ($this->request->getParameter('getFacet', pInteger)) {
         $vs_facet = $this->request->getParameter('facet', pString);
         $this->view->setVar('facet_name', $vs_facet);
         $this->view->setVar('key', $o_browse->getBrowseID());
         $va_facet_info = $o_browse->getInfoForFacet($vs_facet);
         $this->view->setVar('facet_info', $va_facet_info);
         # --- pull in different views based on format for facet - alphabetical, list, hierarchy
         switch ($va_facet_info["group_mode"]) {
             case "alphabetical":
             case "list":
             default:
                 $this->view->setVar('facet_content', $o_browse->getFacetContent($vs_facet, array("checkAccess" => $this->opa_access_values)));
                 $this->render("Browse/list_facet_html.php");
                 break;
             case "hierarchical":
                 $this->render("Browse/hierarchy_facet_html.php");
                 break;
         }
         return;
     }
     //
     // Add criteria and execute
     //
     $vs_search_expression = "ca_sets.set_id:{$vn_set_id}";
     if ($o_browse->numCriteria() == 0 && $vs_search_expression) {
         $o_browse->addCriteria("_search", array($vs_search_expression));
     }
     if ($vs_facet = $this->request->getParameter('facet', pString)) {
         $o_browse->addCriteria($vs_facet, array($this->request->getParameter('id', pString)));
     }
     //
     // Sorting
     //
     $vb_sort_changed = false;
     if (!($ps_secondary_sort = $this->request->getParameter("secondary_sort", pString))) {
         $ps_secondary_sort = $o_context->getCurrentSecondarySort();
     }
     $va_config_sort = $this->opo_config->getAssoc("sortBy");
     if (!is_array($va_config_sort)) {
         $va_config_sort = array();
     }
     $va_sort_by = array_merge(array(_t('Set order') => "ca_set_items.rank/{$vn_set_id}"), $va_config_sort);
     if (!($ps_sort = urldecode($this->request->getParameter("sort", pString)))) {
         if (!$ps_sort && !($ps_sort = $o_context->getCurrentSort())) {
             if (is_array($va_sort_by)) {
                 $ps_sort = array_shift(array_keys($va_sort_by));
                 $vb_sort_changed = true;
             }
         }
     } else {
         $vb_sort_changed = true;
     }
     if ($vb_sort_changed) {
         # --- set the default sortDirection if available
         $va_sort_direction = $this->opo_config->getAssoc("sortDirection");
         if ($ps_sort_direction = $va_sort_direction[$ps_sort]) {
             $o_context->setCurrentSortDirection($ps_sort_direction);
         }
         $ps_secondary_sort = "";
     }
     if (!($ps_sort_direction = $this->request->getParameter("direction", pString))) {
         if (!($ps_sort_direction = $o_context->getCurrentSortDirection())) {
             $ps_sort_direction = 'asc';
         }
     }
     $o_context->setCurrentSort($ps_sort);
     $o_context->setCurrentSecondarySort($ps_secondary_sort);
     $o_context->setCurrentSortDirection($ps_sort_direction);
     $this->view->setVar('sortBy', is_array($va_sort_by) ? $va_sort_by : null);
     $this->view->setVar('sortBySelect', $vs_sort_by_select = is_array($va_sort_by) ? caHTMLSelect("sort", $va_sort_by, array('id' => "sort"), array("value" => $ps_sort)) : '');
     $this->view->setVar('sort', $ps_sort);
     $va_secondary_sort_by = $this->opo_config->getAssoc("secondarySortBy");
     $this->view->setVar('secondarySortBy', is_array($va_secondary_sort_by) ? $va_secondary_sort_by : null);
     $this->view->setVar('secondarySortBySelect', $vs_secondary_sort_by_select = is_array($va_secondary_sort_by) ? caHTMLSelect("secondary_sort", $va_secondary_sort_by, array('id' => "secondary_sort"), array("value" => $ps_secondary_sort)) : '');
     $this->view->setVar('secondarySort', $ps_secondary_sort);
     $this->view->setVar('sortDirection', $ps_sort_direction);
     $va_options = array('checkAccess' => $this->opa_access_values, 'no_cache' => true);
     $o_browse->execute(array_merge($va_options, array('strictPhraseSearching' => true)));
     //
     // Facets
     //
     if ($vs_facet_group = $this->opo_config->get("set_facet_group")) {
         $o_browse->setFacetGroup($vs_facet_group);
     }
     $va_available_facet_list = $this->opo_config->get("availableFacets");
     $va_facets = $o_browse->getInfoForAvailableFacets();
     if (is_array($va_available_facet_list) && sizeof($va_available_facet_list)) {
         foreach ($va_facets as $vs_facet_name => $va_facet_info) {
             if (!in_array($vs_facet_name, $va_available_facet_list)) {
                 unset($va_facets[$vs_facet_name]);
             }
         }
     }
     foreach ($va_facets as $vs_facet_name => $va_facet_info) {
         $va_facets[$vs_facet_name]['content'] = $o_browse->getFacetContent($vs_facet_name, array("checkAccess" => $this->opa_access_values));
     }
     $this->view->setVar('facets', $va_facets);
     $this->view->setVar('key', $vs_key = $o_browse->getBrowseID());
     $this->request->session->setVar('lightbox_last_browse_id', $vs_key);
     //
     // Current criteria
     //
     $va_criteria = $o_browse->getCriteriaWithLabels();
     if (isset($va_criteria['_search']) && isset($va_criteria['_search']['*'])) {
         unset($va_criteria['_search']);
     }
     $va_criteria_for_display = array();
     foreach ($va_criteria as $vs_facet_name => $va_criterion) {
         $va_facet_info = $o_browse->getInfoForFacet($vs_facet_name);
         foreach ($va_criterion as $vn_criterion_id => $vs_criterion) {
             $va_criteria_for_display[] = array('facet' => $va_facet_info['label_singular'], 'facet_name' => $vs_facet_name, 'value' => $vs_criterion, 'id' => $vn_criterion_id);
         }
     }
     $this->view->setVar('criteria', $va_criteria_for_display);
     //
     // Results
     //
     $vs_combined_sort = $va_sort_by[$ps_sort];
     if ($ps_secondary_sort) {
         $vs_combined_sort .= ";" . $va_secondary_sort_by[$ps_secondary_sort];
     }
     $qr_res = $o_browse->getResults(array('sort' => $vs_combined_sort, 'sort_direction' => $ps_sort_direction));
     $this->view->setVar('result', $qr_res);
     if (!($pn_hits_per_block = $this->request->getParameter("n", pString))) {
         if (!($pn_hits_per_block = $o_context->getItemsPerPage())) {
             $pn_hits_per_block = $this->opo_config->get("defaultHitsPerBlock") ? $this->opo_config->get("defaultHitsPerBlock") : 36;
         }
     }
     $o_context->getItemsPerPage($pn_hits_per_block);
     $this->view->setVar('hits_per_block', $pn_hits_per_block);
     $this->view->setVar('start', $vn_start = $this->request->getParameter('s', pInteger));
     $o_context->setParameter('key', $vs_key);
     if (($vn_key_start = $vn_start - 500) < 0) {
         $vn_key_start = 0;
     }
     $qr_res->seek($vn_key_start);
     $o_context->setResultList($qr_res->getPrimaryKeyValues(1000));
     if ($o_block_result_context) {
         $o_block_result_context->setResultList($qr_res->getPrimaryKeyValues(1000));
         $o_block_result_context->saveContext();
     }
     $qr_res->seek($vn_start);
     $o_context->saveContext();
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . ucfirst($this->ops_lightbox_display_name) . ": " . $t_set->getLabelForDisplay());
     switch ($ps_view) {
         case 'pdf':
             $this->_genExport($qr_res, $this->request->getParameter("export_format", pString), $vs_label = $t_set->get('ca_sets.preferred_labels'), $vs_label);
         case 'timelineData':
             $this->view->setVar('view', 'timeline');
             $this->render("Sets/set_detail_timelineData_json.php");
             break;
         default:
             $this->render("Sets/set_detail_html.php");
             break;
     }
 }
コード例 #6
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;
             # ------------------------------------
     }
 }
コード例 #7
0
 /**
  *
  */
 public function __call($ps_function, $pa_args)
 {
     $ps_function = strtolower($ps_function);
     # --- which type of set is configured for display in gallery section
     $t_list = new ca_lists();
     $vn_gallery_set_type_id = $t_list->getItemIDFromList('set_types', $this->config->get('gallery_set_type'));
     $t_set = new ca_sets();
     if ($ps_function == "index") {
         if ($vn_gallery_set_type_id) {
             $va_sets = caExtractValuesByUserLocale($t_set->getSets(array('table' => 'ca_objects', 'checkAccess' => $this->opa_access_values, 'setType' => $vn_gallery_set_type_id)));
             $va_set_first_items = $t_set->getFirstItemsFromSets(array_keys($va_sets), array("version" => "icon", "checkAccess" => $this->opa_access_values));
             $o_front_config = caGetFrontConfig();
             $vs_front_page_set = $o_front_config->get('front_page_set_code');
             $vb_omit_front_page_set = (bool) $this->config->get('omit_front_page_set_from_gallery');
             foreach ($va_sets as $vn_set_id => $va_set) {
                 if ($vb_omit_front_page_set && $va_set['set_code'] == $vs_front_page_set) {
                     unset($va_sets[$vn_set_id]);
                 }
             }
             $this->view->setVar('sets', $va_sets);
             $this->view->setVar('first_items_from_sets', $va_set_first_items);
         }
         MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . ($this->config->get('gallery_section_name') ? $this->config->get('gallery_section_name') : _t("Gallery")));
         $this->render("Gallery/index_html.php");
     } else {
         $ps_set_id = $ps_function;
         $this->view->setVar("set_id", $ps_set_id);
         $t_set->load($ps_set_id);
         $this->view->setVar("set", $t_set);
         $this->view->setVar("label", $t_set->getLabelForDisplay());
         $this->view->setVar("description", $t_set->get($this->config->get('gallery_set_description_element_code')));
         $this->view->setVar("set_items", caExtractValuesByUserLocale($t_set->getItems(array("thumbnailVersions" => array("icon"), "checkAccess" => $this->opa_access_values))));
         MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . ($this->config->get('gallery_section_name') ? $this->config->get('gallery_section_name') : _t("Gallery")) . ": " . $t_set->getLabelForDisplay());
         $this->render("Gallery/detail_html.php");
     }
 }
コード例 #8
0
 /**
  *
  */
 public function __call($ps_function, $pa_args)
 {
     AssetLoadManager::register("panel");
     AssetLoadManager::register("mediaViewer");
     AssetLoadManager::register("carousel");
     AssetLoadManager::register("readmore");
     AssetLoadManager::register("maps");
     $ps_function = strtolower($ps_function);
     $ps_id = urldecode($this->request->getActionExtra());
     if (!isset($this->opa_detail_types[$ps_function]) || !isset($this->opa_detail_types[$ps_function]['table']) || !($vs_table = $this->opa_detail_types[$ps_function]['table'])) {
         // invalid detail type – throw error
         die("Invalid detail type");
     }
     $t_table = $this->opo_datamodel->getInstanceByTableName($vs_table, true);
     if (($vb_use_identifiers_in_urls = caUseIdentifiersInUrls()) && substr($ps_id, 0, 3) == "id:") {
         $va_tmp = explode(":", $ps_id);
         $ps_id = (int) $va_tmp[1];
         $vb_use_identifiers_in_urls = false;
     }
     if (!$t_table->load($vb_use_identifiers_in_urls && $t_table->getProperty('ID_NUMBERING_ID_FIELD') ? $t_table->hasField('deleted') ? array($t_table->getProperty('ID_NUMBERING_ID_FIELD') => $ps_id, 'deleted' => 0) : array($t_table->getProperty('ID_NUMBERING_ID_FIELD') => $ps_id) : ($t_table->hasField('deleted') ? array($t_table->primaryKey() => (int) $ps_id, 'deleted' => 0) : array($t_table->primaryKey() => (int) $ps_id)))) {
         // invalid id - throw error
         die("Invalid id");
     }
     // Printables
     // 	merge displays with drop-in print templates
     //
     $va_export_options = caGetAvailablePrintTemplates('summary', array('table' => $t_table->tableName()));
     $this->view->setVar('export_formats', $va_export_options);
     $va_options = array();
     foreach ($va_export_options as $vn_i => $va_format_info) {
         $va_options[$va_format_info['name']] = $va_format_info['code'];
     }
     // Get current display list
     $t_display = new ca_bundle_displays();
     foreach (caExtractValuesByUserLocale($t_display->getBundleDisplays(array('table' => $this->ops_tablename, 'user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_READ_ACCESS__, 'checkAccess' => caGetUserAccessValues($this->request)))) as $va_display) {
         $va_options[$va_display['name']] = "_display_" . $va_display['display_id'];
     }
     ksort($va_options);
     $this->view->setVar('export_format_select', caHTMLSelect('export_format', $va_options, array('class' => 'searchToolsSelect'), array('value' => $this->view->getVar('current_export_format'), 'width' => '150px')));
     #
     # Enforce access control
     #
     if (sizeof($this->opa_access_values) && $t_table->hasField('access') && !in_array($t_table->get("access"), $this->opa_access_values)) {
         $this->notification->addNotification(_t("This item is not available for view"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . $t_table->getTypeName() . ": " . $t_table->get('preferred_labels') . (($vs_idno = $t_table->get($t_table->getProperty('ID_NUMBERING_ID_FIELD'))) ? " [{$vs_idno}]" : ""));
     $vs_type = $t_table->getTypeCode();
     $this->view->setVar('detailType', $vs_table);
     $this->view->setVar('item', $t_table);
     $this->view->setVar('itemType', $vs_type);
     caAddPageCSSClasses(array($vs_table, $ps_function, $vs_type));
     // Do we need to pull in the multisearch result set?
     if (ResultContext::getLastFind($this->request, $vs_table, array('noSubtype' => true)) === 'multisearch') {
         $o_context = new ResultContext($this->request, $vs_table, 'multisearch', $ps_function);
         $o_context->setAsLastFind();
         $o_context->saveContext();
     } else {
         $o_context = ResultContext::getResultContextForLastFind($this->request, $vs_table);
     }
     $this->view->setVar('previousID', $vn_previous_id = $o_context->getPreviousID($t_table->getPrimaryKey()));
     $this->view->setVar('nextID', $vn_next_id = $o_context->getNextID($t_table->getPrimaryKey()));
     $this->view->setVar('previousURL', caDetailUrl($this->request, $vs_table, $vn_previous_id));
     $this->view->setVar('nextURL', caDetailUrl($this->request, $vs_table, $vn_next_id));
     $this->view->setVar('resultsURL', ResultContext::getResultsUrlForLastFind($this->request, $vs_table));
     $va_options = isset($this->opa_detail_types[$ps_function]['options']) && is_array($this->opa_detail_types[$ps_function]['options']) ? $this->opa_detail_types[$ps_function]['options'] : array();
     $this->view->setVar('previousLink', $vn_previous_id > 0 ? caDetailLink($this->request, caGetOption('previousLink', $va_options, _t('Previous')), '', $vs_table, $vn_previous_id) : '');
     $this->view->setVar('nextLink', $vn_next_id > 0 ? caDetailLink($this->request, caGetOption('nextLink', $va_options, _t('Next')), '', $vs_table, $vn_next_id) : '');
     $this->view->setVar('resultsLink', ResultContext::getResultsLinkForLastFind($this->request, $vs_table, caGetOption('resultsLink', $va_options, _t('Back'))));
     $this->view->setVar('commentsEnabled', (bool) $va_options['enableComments']);
     //
     //
     //
     if (method_exists($t_table, 'getPrimaryRepresentationInstance')) {
         if ($pn_representation_id = $this->request->getParameter('representation_id', pInteger)) {
             $t_representation = $this->opo_datamodel->getInstanceByTableName("ca_object_representations", true);
             $t_representation->load($pn_representation_id);
         } else {
             $t_representation = $t_table->getPrimaryRepresentationInstance(array("checkAccess" => $this->opa_access_values));
         }
         if ($t_representation) {
             $this->view->setVar("t_representation", $t_representation);
             $this->view->setVar("representation_id", $t_representation->get("representation_id"));
         } else {
             $t_representation = $this->opo_datamodel->getInstanceByTableName("ca_object_representations", true);
         }
         $this->view->setVar("representationViewer", caObjectDetailMedia($this->request, $t_table->getPrimaryKey(), $t_representation, $t_table, array("primaryOnly" => caGetOption('representationViewerPrimaryOnly', $va_options, false), "dontShowPlaceholder" => caGetOption('representationViewerDontShowPlaceholder', $va_options, false))));
     }
     //
     // map
     //
     if (!is_array($va_map_attributes = caGetOption('map_attributes', $va_options, array())) || !sizeof($va_map_attributes)) {
         if ($vs_map_attribute = caGetOption('map_attribute', $va_options, false)) {
             $va_map_attributes = array($vs_map_attribute);
         }
     }
     $this->view->setVar("map", "");
     if (is_array($va_map_attributes) && sizeof($va_map_attributes)) {
         $o_map = new GeographicMap(($vn_width = caGetOption('map_width', $va_options, false)) ? $vn_width : 285, ($vn_height = caGetOption('map_height', $va_options, false)) ? $vn_height : 200, 'map');
         $vn_mapped_count = 0;
         foreach ($va_map_attributes as $vs_map_attribute) {
             if ($t_table->get($vs_map_attribute)) {
                 $o_map->mapFrom($t_table, $vs_map_attribute);
                 $vn_mapped_count++;
             }
         }
         if ($vn_mapped_count > 0) {
             $this->view->setVar("map", $o_map->render('HTML'));
         }
     }
     //
     // comments, tags, rank
     //
     $this->view->setVar('averageRank', $t_table->getAverageRating(true));
     $this->view->setVar('numRank', $t_table->getNumRatings(true));
     #
     # User-generated comments, tags and ratings
     #
     $va_user_comments = $t_table->getComments(null, true);
     $va_comments = array();
     if (is_array($va_user_comments)) {
         foreach ($va_user_comments as $va_user_comment) {
             if ($va_user_comment["comment"] || $va_user_comment["media1"] || $va_user_comment["media2"] || $va_user_comment["media3"] || $va_user_comment["media4"]) {
                 # TODO: format date based on locale
                 $va_user_comment["date"] = date("n/j/Y", $va_user_comment["created_on"]);
                 # -- get name of commenter
                 if ($va_user_comment["user_id"]) {
                     $t_user = new ca_users($va_user_comment["user_id"]);
                     $va_user_comment["author"] = $t_user->getName();
                 } elseif ($va_user_comment["name"]) {
                     $va_user_comment["author"] = $va_user_comment["name"];
                 }
                 $va_comments[] = $va_user_comment;
             }
         }
     }
     $this->view->setVar('comments', $va_comments);
     $va_user_tags = $t_table->getTags(null, true);
     $va_tags = array();
     if (is_array($va_user_tags)) {
         foreach ($va_user_tags as $va_user_tag) {
             if (!in_array($va_user_tag["tag"], $va_tags)) {
                 $va_tags[] = $va_user_tag["tag"];
             }
         }
     }
     $this->view->setVar('tags_array', $va_tags);
     $this->view->setVar('tags', implode(", ", $va_tags));
     $this->view->setVar("itemComments", caDetailItemComments($this->request, $t_table->getPrimaryKey(), $t_table, $va_comments, $va_tags));
     //
     // share link
     //
     $this->view->setVar("shareLink", "<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, '', 'Detail', 'ShareForm', array("tablename" => $t_table->tableName(), "item_id" => $t_table->getPrimaryKey())) . "\"); return false;'>Share</a>");
     // find view
     //		first look for type-specific view
     if (!$this->viewExists($vs_path = "Details/{$vs_table}_{$vs_type}_html.php")) {
         // If no type specific view use the default
         $vs_path = "Details/{$vs_table}_default_html.php";
     }
     switch ($ps_view = $this->request->getParameter('view', pString)) {
         case 'pdf':
             $this->_genExport($t_table, $this->request->getParameter("export_format", pString), 'Detail', 'Detail');
             break;
         default:
             //
             // Tag substitution
             //
             // Views can contain tags in the form {{{tagname}}}. Some tags, such as "itemType" and "detailType" are defined by
             // the detail controller. More usefully, you can pull data from the item being detailed by using a valid "get" expression
             // as a tag (Eg. {{{ca_objects.idno}}}. Even more usefully for some, you can also use a valid bundle display template
             // (see http://docs.collectiveaccess.org/wiki/Bundle_Display_Templates) as a tag. The template will be evaluated in the
             // context of the item being detailed.
             //
             $va_defined_vars = array_keys($this->view->getAllVars());
             // get list defined vars (we don't want to copy over them)
             $va_tag_list = $this->getTagListForView($vs_path);
             // get list of tags in view
             foreach ($va_tag_list as $vs_tag) {
                 if (in_array($vs_tag, $va_defined_vars)) {
                     continue;
                 }
                 if (strpos($vs_tag, "^") !== false || strpos($vs_tag, "<") !== false) {
                     $this->view->setVar($vs_tag, $t_table->getWithTemplate($vs_tag, array('checkAccess' => $this->opa_access_values)));
                 } elseif (strpos($vs_tag, ".") !== false) {
                     $this->view->setVar($vs_tag, $t_table->get($vs_tag, array('checkAccess' => $this->opa_access_values)));
                 } else {
                     $this->view->setVar($vs_tag, "?{$vs_tag}");
                 }
             }
             $this->render($vs_path);
             break;
     }
 }
コード例 #9
0
ファイル: About.php プロジェクト: kai-iak/pawtucket2
<?php

MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": Competence Standards");
?>
<div class="container blueBox">
	<div class="row">
		<div class="col-sm-12">
			<p>
				All of the materials provided via this Body of Knowledge portal are keyed to the global competence standards defined in the IUCN WCPA Capacity Development Tools. Thus, understanding the competence framework is critical to effectively using the portal.
			</p><br/>
		</div><!-- end col -->
		<div class="col-sm-6 text-right">
			<a href="<?php 
print caGetThemeGraphicUrl($this->request, 'CompetenceUserGuide_V2_WPC_Nov2014.pdf');
?>
"><button type="button" class="btn btn-blue"><span class="glyphicon glyphicon-download-alt"></span> Competence Standards Handbook</button></a>
		</div>
		<div class="col-sm-6 text-left">
			<a href="<?php 
print caGetThemeGraphicUrl($this->request, 'DraftPACompetenceRegisterNov2014forWPC_LOCKED.xlsx');
?>
"><button type="button" class="btn btn-blue"><span class="glyphicon glyphicon-download-alt"></span> Competence Standards Registry</button></a>
		</div>
	</div><!-- end row -->
</div><!-- end bluebox -->
<div class="container containerTextPadding">
	<div class="row">
		<div class="col-sm-6">
			<p>
				<strong>Competence</strong> is the proven ability to do a job; it is often defined in terms of the required combination of skills, knowledge and attitude. <strong>Skills</strong> ensure the ability to perform a task reliably and consistently, <strong>knowledge</strong> provides an understanding of the technical and theoretical background to the task and an appreciation of its purpose; and having the right <strong>attitude</strong> helps ensure than an individual works professionally, ethically and conscientiously. <strong>Competence</strong> focuses primarily on the actual ability of individuals to perform in their jobs effectively, rather than on delivery of training and acquisition of qualifications.
			</p>
コード例 #10
0
 /**
  * Generates detail detail. Will use a view named according to the following convention:
  *		<table_name>_<type_code>_detail_html.php
  *
  * So for example, the detail for objects of type 'artwork' (where 'artwork' is the type code for the artwork object type)
  * the view would be named "ca_objects_artwork_detail_html.php
  *
  * If the type specific view does not exist, then Show() will attemp to use a generic table-wide view name like this:
  *		<table_name>_detail_html.php
  *
  * For example: "ca_objects_detail_html.php"
  *
  * In general you should always have the table wide views defined. Then you can define type-specific views for your
  * application on an as-needed basis.
  */
 public function Show($pa_options = null)
 {
     AssetLoadManager::register('viz');
     AssetLoadManager::register("ca", "panel");
     AssetLoadManager::register("jit");
     AssetLoadManager::register('browsable');
     AssetLoadManager::register('imageScroller');
     AssetLoadManager::register('jquery', 'expander');
     $va_access_values = caGetUserAccessValues($this->request);
     $this->view->setVar('access_values', $va_access_values);
     if (!($t_item = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true))) {
         die("Invalid table name " . $this->ops_tablename . " for detail");
         // shouldn't happen
     }
     if (!($vn_item_id = $this->request->getParameter($t_item->primaryKey(), pInteger))) {
         $this->notification->addNotification(_t("Invalid ID"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     if (!$t_item->load($vn_item_id)) {
         $this->notification->addNotification(_t("ID does not exist"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     if ($t_item->hasField('deleted') && $t_item->get('deleted')) {
         $this->notification->addNotification(_t("ID has been deleted"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     // Check if item conforms to any configured display type restrictions
     if (method_exists($t_item, "getTypeID")) {
         $va_types = caMergeTypeRestrictionLists($t_item, array());
         if (is_array($va_types) && sizeof($va_types) && !in_array($t_item->getTypeID(), $va_types)) {
             $this->notification->addNotification(_t("This item is not viewable"), "message");
             $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
             return;
         }
     }
     #
     # Enforce access control
     #
     if (sizeof($va_access_values) && !in_array($t_item->get("access"), $va_access_values)) {
         $this->notification->addNotification(_t("This item is not available for view"), "message");
         $this->response->setRedirect(caNavUrl($this->request, "", "", "", ""));
         return;
     }
     //
     // In-detail browsing of objects - limited to object linked to the item being displayed
     //
     if (($vs_browse_for_table = $this->request->config->get('allow_browse_within_detail_for_' . $this->ops_tablename)) && is_object($this->opo_browse)) {
         // set browse context for controller
         $this->setContext($this->opo_browse->getContext());
         //
         // Restrict facets to specific group for refine browse (if set in app.conf config)
         //
         if ($vs_facet_group = $this->request->config->get('ca_objects_refine_facet_group')) {
             $this->opo_browse->setFacetGroup($vs_facet_group);
         }
         $t_table = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
         if ($this->request->session->getVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id') != $vn_item_id) {
             $this->opo_browse->removeAllCriteria();
         }
         // look for 'authority' facet for current detail table type so we can limit the object browse to the currently displayed item
         //$vs_limit_facet_name = null;
         //foreach($this->opo_browse->getInfoForFacets() as $vs_facet_name => $va_facet_info) {
         //	if (($va_facet_info['type'] === 'authority') && ($va_facet_info['table'] === $this->ops_tablename)) {
         //		$vs_limit_facet_name = $vs_facet_name;
         //		break;
         //	}
         //}
         $this->opo_browse->addFacetConfiguration($vs_limit_facet_name = '_detail_browse_' . $this->ops_tablename, array('type' => 'authority', 'table' => $this->ops_tablename, 'relationship_table' => 'ca_objects_x_entities', 'restrict_to_types' => array(), 'restrict_to_relationship_types' => array(), 'label_singular' => 'Detail browse by ' . $this->ops_tablename, 'label_plural' => 'Detail browse by ' . $this->ops_tablename, 'group_mode' => 'none', 'indefinite_article' => 'a'));
         if ($vs_limit_facet_name) {
             if (($va_configured_type_restrictions = $this->request->config->getList($this->ops_tablename . '_detail_browse_type_restrictions')) && is_array($va_configured_type_restrictions)) {
                 $this->opo_browse->setTypeRestrictions($va_configured_type_restrictions, array('includeChildren' => false));
             }
             $this->opo_browse->addCriteria($vs_limit_facet_name, array($vn_item_id));
             $this->opo_browse->execute(array('checkAccess' => $va_access_values));
             $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', $this->opo_browse->getBrowseID());
             $this->view->setVar('show_browse', true);
             //
             // Browse paging
             //
             $vn_items_per_page = $this->request->config->get("objects_per_page_for_detail_pages");
             if (!$vn_items_per_page) {
                 $vn_items_per_page = 12;
             }
             $this->view->setVar('page', ($vn_p = $this->request->getParameter('page', pInteger)) ? $vn_p : 1);
             $qr_hits = null;
             if ($this->opo_browse) {
                 $va_sort = array();
                 if ($vs_sort = $this->request->config->get('sort_browse_within_detail_for_' . $this->ops_tablename)) {
                     $va_sort = array('sort' => $vs_sort);
                 }
                 $qr_hits = $this->opo_browse->getResults($va_sort);
                 $vn_num_pages = ceil($qr_hits->numHits() / $vn_items_per_page);
                 $qr_hits->seek(($vn_p - 1) * $vn_items_per_page);
             } else {
                 $vn_num_pages = 0;
             }
             $this->view->setVar('browse_results', $qr_hits);
             $this->view->setVar('num_pages', (int) $vn_num_pages);
             $this->view->setVar('items_per_page', (int) $vn_items_per_page);
             $this->view->setVar('opo_browse', $this->opo_browse);
             $this->view->setVar('sorts', $this->opa_sorts);
             // supported sorts for the object browse
             // 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);
         } else {
             // not configured for browse
             $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id', null);
             $this->view->setVar('show_browse', false);
         }
     }
     $this->request->session->setVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_item_id', $vn_item_id);
     # Next and previous navigation
     $opo_result_context = new ResultContext($this->request, $this->ops_tablename, ResultContext::getLastFind($this->request, $this->ops_tablename));
     $this->view->setVar('next_id', $opo_result_context->getNextID($vn_item_id));
     $this->view->setVar('previous_id', $opo_result_context->getPreviousID($vn_item_id));
     # Is the item we're show details for in the result set?
     $this->view->setVar('is_in_result_list', $opo_result_context->getIndexInResultList($vn_item_id) != '?');
     # Item instance and id
     $this->view->setVar('t_item', $t_item);
     $this->view->setVar($t_item->getPrimaryKey(), $vn_item_id);
     # Item  - preferred
     $this->view->setVar('label', $t_item->getLabelForDisplay());
     # Item  - nonpreferred
     $this->view->setVar('nonpreferred_labels', caExtractValuesByUserLocale($t_item->getNonPreferredLabels()));
     # Item timestamps (creation and last change)
     if ($va_entry_info = $t_item->getCreationTimestamp()) {
         $this->view->setVar('date_of_entry', date('m/d/Y', $va_entry_info['timestamp']));
     }
     if ($va_last_change_info = $t_item->getLastChangeTimestamp()) {
         $this->view->setVar('date_of_last_change', date('m/d/Y', $va_last_change_info['timestamp']));
     }
     # Media representations to display (objects only)
     if (method_exists($t_item, 'getPrimaryRepresentationInstance')) {
         if ($t_primary_rep = $t_item->getPrimaryRepresentationInstance()) {
             if (!sizeof($va_access_values) || in_array($t_primary_rep->get('access'), $va_access_values)) {
                 // check rep access
                 $this->view->setVar('t_primary_rep', $t_primary_rep);
                 $va_rep_display_info = caGetMediaDisplayInfo('detail', $t_primary_rep->getMediaInfo('media', 'INPUT', 'MIMETYPE'));
                 $this->view->setVar('primary_rep_display_version', $va_rep_display_info['display_version']);
                 unset($va_display_info['display_version']);
                 $va_rep_display_info['poster_frame_url'] = $t_primary_rep->getMediaUrl('media', $va_rep_display_info['poster_frame_version']);
                 unset($va_display_info['poster_frame_version']);
                 $this->view->setVar('primary_rep_display_options', $va_rep_display_info);
             }
         }
     }
     #
     # User-generated comments, tags and ratings
     #
     $va_user_comments = $t_item->getComments(null, true);
     $va_comments = array();
     if (is_array($va_user_comments)) {
         foreach ($va_user_comments as $va_user_comment) {
             if ($va_user_comment["comment"] || $va_user_comment["media1"] || $va_user_comment["media2"] || $va_user_comment["media3"] || $va_user_comment["media4"]) {
                 # TODO: format date based on locale
                 $va_user_comment["date"] = date("n/j/Y", $va_user_comment["created_on"]);
                 # -- get name of commenter
                 $t_user = new ca_users($va_user_comment["user_id"]);
                 $va_user_comment["author"] = $t_user->getName();
                 $va_comments[] = $va_user_comment;
             }
         }
     }
     $this->view->setVar('comments', $va_comments);
     $va_user_tags = $t_item->getTags(null, true);
     $va_tags = array();
     if (is_array($va_user_tags)) {
         foreach ($va_user_tags as $va_user_tag) {
             if (!in_array($va_user_tag["tag"], $va_tags)) {
                 $va_tags[] = $va_user_tag["tag"];
             }
         }
     }
     $this->view->setVar('tags_array', $va_tags);
     $this->view->setVar('tags', implode(", ", $va_tags));
     $this->view->setVar('result_context', $opo_result_context);
     # -- get average user ranking
     $this->view->setVar('ranking', $t_item->getAverageRating(null));
     // null makes it ignore moderation status
     # -- get number of user rankings
     $this->view->setVar('numRankings', $t_item->getNumRatings(null));
     // null makes it ignore moderation status
     #
     # Miscellaneous useful information
     #
     $this->view->setVar('t_relationship_types', new ca_relationship_types());
     // relationship types object - used for displaying relationship type of related authority information
     if (method_exists($t_item, 'getTypeName')) {
         $this->view->setVar('typename', $t_item->getTypeName());
     }
     // Record view
     $t_item->registerItemView($this->request->getUserID());
     MetaTagManager::setWindowTitle("Viewing: " . $t_item->get("preferred_labels"));
     //
     // Render view
     //
     if (isset($pa_options['view']) && $pa_options['view']) {
         $this->render($pa_options['view']);
     } else {
         if ($this->getView()->viewExists($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php')) {
             $this->render($this->ops_tablename . '_' . $t_item->getTypeCode() . '_detail_html.php');
         } else {
             $this->render($this->ops_tablename . '_detail_html.php');
         }
     }
 }
コード例 #11
0
 /**
  * Process form submission
  */
 public function Send()
 {
     global $g_ui_locale_id;
     $o_dm = Datamodel::load();
     $ps_function = $this->request->getParameter('_contributeFormName', pString);
     $va_response_data = array('errors' => array(), 'numErrors' => 0, 'status' => 'OK');
     $vn_num_errors = 0;
     if (!($va_form_info = $this->_checkForm($ps_function))) {
         return;
     }
     $va_related_form_item_config = caGetOption('related', $va_form_info, array());
     $this->view->setVar('t_subject', $t_subject = $this->pt_subject);
     $vs_idno_fld_name = $t_subject->getProperty('ID_NUMBERING_ID_FIELD');
     $t_subject->clear();
     $t_subject->setMode(ACCESS_WRITE);
     $t_subject->purify(true);
     // run all input through HTMLpurifier
     $t_subject->setTransaction($o_trans = new Transaction());
     $vs_subject_table = $t_subject->tableName();
     $t_subject->set('type_id', $va_form_info['type'] ? $va_form_info['type'] : $this->request->getParameter('type_id', pInteger));
     // set type so idno's reflect proper format
     // Set window title
     MetaTagManager::setWindowTitle(caGetOption('formTitle', $va_form_info, $this->request->config->get("app_display_name") . ": " . _t("Contribute")));
     // Get list of form elements to process
     $va_fields = explode(';', $this->request->getParameter('_formElements', pString));
     // Clean up field names, which PHP has mangled by replacing periods with underscores
     if (is_array($va_fields) && sizeof($va_fields) > 0) {
         foreach ($va_fields as $vs_orig_fld_name) {
             $vs_orig_fld_name_proc = str_replace(".", "_", $vs_orig_fld_name);
             $_REQUEST[$vs_orig_fld_name] = $_REQUEST[$vs_orig_fld_name_proc];
             unset($_REQUEST[$vs_orig_fld_name_proc]);
         }
     }
     // Check terms
     if (caGetOption('terms_and_conditions', $va_form_info, false)) {
         // Check terms and conditions checkbox
         if ($this->request->getParameter('iAgreeToTerms', pInteger) != 1) {
             $this->notification->addNotification(_t("You must agree to the terms and conditions before proceeding."), __NOTIFICATION_TYPE_ERROR__);
             $va_response_data['numErrors'] = 1;
             $va_response_data['status'] = 'ERR';
             $va_response_data['errors']['_general_'][] = _t("You must agree to the terms and conditions before proceeding.");
             $va_response_data['formData'] = $_REQUEST;
             $this->view->setVar('response', $va_response_data);
             $t_subject->getTransaction()->rollback();
             call_user_method($ps_function, $this);
             return;
         }
     }
     // Spam check
     if (caGetOption('spam_protection', $va_form_info, false)) {
         // Check SPAM-preventing security question
         if ($this->request->getParameter('security', pInteger) != $this->request->getParameter('sum', pInteger)) {
             $this->notification->addNotification(_t("Please correctly answer the security question."), __NOTIFICATION_TYPE_ERROR__);
             $va_response_data['numErrors'] = 1;
             $va_response_data['status'] = 'ERR';
             $va_response_data['errors']['_general_'][] = _t("Please correctly answer the security question.");
             $va_response_data['formData'] = $_REQUEST;
             $this->view->setVar('response', $va_response_data);
             $t_subject->getTransaction()->rollback();
             call_user_method($ps_function, $this);
             return;
         }
     }
     // Set content from form
     $vm_type = $vs_idno = $vn_status = $vn_access = null;
     $vb_has_media = false;
     // Assemble content tree
     $va_content_tree = array();
     foreach ($va_fields as $vs_field) {
         $va_fld_bits = explode(".", $vs_field);
         $vs_field_proc = str_replace(".", "_", $vs_field);
         // PHP replaces periods in names with underscores :-(
         $vs_table = $va_fld_bits[0];
         $va_vals = $this->request->getParameter($vs_field_proc, pArray);
         if ($vs_subject_table == $vs_table) {
             // subject table
             switch (sizeof($va_fld_bits)) {
                 case 2:
                 case 3:
                     if ($t_subject->hasField($va_fld_bits[1])) {
                         // intrinsic
                         $va_content_tree[$vs_subject_table][$va_fld_bits[1]] = $va_vals[0];
                         switch ($va_fld_bits[1]) {
                             case $t_subject->getTypeFieldName():
                                 $vm_type = $va_vals[0];
                                 break;
                             case $vs_idno_fld_name:
                                 // parse out value
                                 if (method_exists($t_subject, "loadIDNoPlugInInstance") && ($o_numbering_plugin = $t_subject->loadIDNoPlugInInstance(array('IDNumberingConfig' => $this->config)))) {
                                     $vs_idno = $o_numbering_plugin->htmlFormValue($vs_idno_fld_name, null, true);
                                 } else {
                                     $vs_idno = $va_vals[0];
                                 }
                                 break;
                             case 'status':
                                 $vn_status = (int) $va_vals[0];
                                 break;
                             case 'access':
                                 $vn_access = (int) $va_vals[0];
                                 break;
                         }
                     } elseif ($va_fld_bits[1] == 'preferred_labels') {
                         // preferred labels
                         if (!isset($va_fld_bits[2])) {
                             $va_fld_bits[2] = $t_subject->getLabelDisplayField();
                         }
                         foreach ($va_vals as $vn_i => $vs_val) {
                             $va_content_tree[$vs_subject_table]['preferred_labels'][$vn_i][$va_fld_bits[2]] = $va_vals[$vn_i];
                         }
                     } elseif ($va_fld_bits[1] == 'nonpreferred_labels') {
                         // preferred labels
                         if (!isset($va_fld_bits[2])) {
                             $va_fld_bits[2] = $t_subject->getLabelDisplayField();
                         }
                         foreach ($va_vals as $vn_i => $vs_val) {
                             $va_content_tree[$vs_subject_table]['nonpreferred_labels'][$vn_i][$va_fld_bits[2]] = $va_vals[$vn_i];
                         }
                     } elseif ($t_subject->hasElement($va_fld_bits[1])) {
                         if (!isset($va_fld_bits[2])) {
                             $va_fld_bits[2] = $va_fld_bits[1];
                         }
                         if (!is_array($va_vals)) {
                             break;
                         }
                         foreach ($va_vals as $vn_i => $vs_val) {
                             $va_content_tree[$vs_subject_table][$va_fld_bits[1]][$vn_i][$va_fld_bits[2]] = $va_vals[$vn_i];
                         }
                     }
                     break;
             }
         } else {
             // Process related
             switch (sizeof($va_fld_bits)) {
                 case 2:
                 case 3:
                     if ($t_instance = $o_dm->getInstanceByTableName($vs_table, true)) {
                         if ($t_instance->hasField($va_fld_bits[1])) {
                             // intrinsic
                             if ($t_instance->getFieldInfo($va_fld_bits[1], 'FIELD_TYPE') == FT_MEDIA) {
                                 $va_files = array();
                                 foreach ($_FILES[$vs_field_proc]['tmp_name'] as $vn_index => $vs_tmp_name) {
                                     if (!trim($vs_tmp_name)) {
                                         continue;
                                     }
                                     $va_files[$vn_index] = array('tmp_name' => $vs_tmp_name, 'name' => $_FILES[$vs_field_proc]['name'][$vn_index], 'type' => $_FILES[$vs_field_proc]['type'][$vn_index], 'error' => $_FILES[$vs_field_proc]['error'][$vn_index], 'size' => $_FILES[$vs_field_proc]['size'][$vn_index]);
                                 }
                                 foreach ($va_files as $vn_index => $va_file) {
                                     $va_content_tree[$vs_table][$vn_index][$va_fld_bits[1]] = $va_file;
                                 }
                             } else {
                                 foreach ($va_vals as $vn_index => $vm_val) {
                                     $va_content_tree[$vs_table][$vn_index][$va_fld_bits[1]] = $vm_val;
                                 }
                             }
                         } elseif ($va_fld_bits[1] == 'preferred_labels') {
                             // preferred labels
                             if (!isset($va_fld_bits[2])) {
                                 $va_fld_bits[2] = $t_instance->getLabelDisplayField();
                             }
                             foreach ($va_vals as $vn_i => $vs_val) {
                                 $va_content_tree[$vs_table][$vn_i]['preferred_labels'][$va_fld_bits[2]] = $va_vals[$vn_i];
                             }
                         } elseif ($va_fld_bits[1] == 'nonpreferred_labels') {
                             // preferred labels
                             if (!isset($va_fld_bits[2])) {
                                 $va_fld_bits[2] = $t_instance->getLabelDisplayField();
                             }
                             foreach ($va_vals as $vn_i => $vs_val) {
                                 $va_content_tree[$vs_table][$vn_i]['nonpreferred_labels'][$va_fld_bits[2]] = $va_vals[$vn_i];
                             }
                         } elseif ($t_instance->hasElement($va_fld_bits[1])) {
                             if (!isset($va_fld_bits[2])) {
                                 $va_fld_bits[2] = $va_fld_bits[1];
                             }
                             foreach ($va_vals as $vn_i => $vs_val) {
                                 $va_content_tree[$vs_table][$vn_i][$va_fld_bits[1]][$va_fld_bits[2]] = $va_vals[$vn_i];
                             }
                         }
                     }
                     if (is_array($va_rel_types = $this->request->getParameter($vs_field_proc . '_relationship_type', pArray))) {
                         foreach ($va_rel_types as $vn_i => $vs_rel_type) {
                             $va_content_tree[$vs_table][$vn_i]['_relationship_type'] = $vs_rel_type;
                         }
                     }
                     if (is_array($va_types = $this->request->getParameter($vs_field_proc . '_type', pArray))) {
                         foreach ($va_types as $vn_i => $vs_type) {
                             $va_content_tree[$vs_table][$vn_i]['_type'] = $vs_type;
                         }
                     }
                     break;
             }
         }
     }
     //print_R($va_content_tree); die;
     // Set type and idno (from config or tree) and insert
     // 		Configured values are always used in preference
     foreach (array('type_id' => 'type', $vs_idno_fld_name => $vs_idno_fld_name, 'access' => 'access', 'status' => 'status') as $vs_fld => $vs_name) {
         if ($vs_fld == $vs_idno_fld_name) {
             $t_subject->setIdnoWithTemplate($va_form_info[$vs_idno_fld_name] ? $va_form_info[$vs_idno_fld_name] : $vs_idno, array('IDNumberingConfig' => $this->config));
         } else {
             $vs_varname = "vs_{$vs_name}";
             $t_subject->set($vs_fld, $va_form_info[$vs_name] ? $va_form_info[$vs_name] : ${$vs_varname});
         }
         $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
     }
     // Insert
     $t_subject->insert();
     $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
     // Set other content
     foreach ($va_content_tree as $vs_table => $va_content_by_table) {
         if ($vs_subject_table == $vs_table) {
             // subject table
             foreach ($va_content_by_table as $vs_bundle => $va_data_for_bundle) {
                 switch ($vs_bundle) {
                     case 'preferred_labels':
                         foreach ($va_data_for_bundle as $va_data) {
                             $t_subject->addLabel($va_data, $g_ui_locale_id, null, true);
                             $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
                         }
                         break;
                     case 'nonpreferred_labels':
                         foreach ($va_data_for_bundle as $va_data) {
                             $t_subject->addLabel($va_data, $g_ui_locale_id, null, false);
                             $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
                         }
                         break;
                     default:
                         if ($t_subject->hasField($vs_bundle) && !in_array($vs_bundle, array('type_id', $vs_idno_fld_name, 'access', 'status'))) {
                             $t_subject->set($vs_bundle, $va_data_for_bundle[0]);
                         } elseif ($t_subject->hasElement($vs_bundle)) {
                             foreach ($va_data_for_bundle as $va_data) {
                                 $t_subject->addAttribute(array_merge($va_data, array('locale_id' => $g_ui_locale_id)), $vs_bundle);
                             }
                         }
                         $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
                         break;
                 }
             }
         } else {
             // Related table
             switch ($vs_table) {
                 case 'ca_object_representations':
                     $vb_is_primary = true;
                     foreach ($va_content_by_table as $vn_index => $va_representation) {
                         if (!$va_representation['media']['tmp_name'] || $va_representation['media']['size'] == 0) {
                             continue;
                         }
                         if (isset($va_form_info['representation_type'])) {
                             $va_representation['type_id'] = $va_form_info['representation_type'];
                         }
                         if (isset($va_form_info['representation_access'])) {
                             $va_representation['access'] = $va_form_info['representation_access'];
                         }
                         if (isset($va_form_info['representation_status'])) {
                             $va_representation['status'] = $va_form_info['representation_status'];
                         }
                         $vn_rc = $t_subject->addRepresentation($va_representation['media']['tmp_name'], $va_representation['type_id'], $g_ui_locale_id, $va_representation['status'], $va_representation['access'], $vb_is_primary, $va_representation, array('original_filename' => $va_representation['media']['name']));
                         if ($t_subject->numErrors()) {
                             $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
                         } else {
                             $vb_has_media = true;
                             $vb_is_primary = false;
                         }
                     }
                     break;
                 case 'ca_entities':
                     $va_rel_config = caGetOption('ca_entities', $va_related_form_item_config, array());
                     foreach ($va_content_by_table as $vn_index => $va_rel) {
                         foreach (array('idno', 'access', 'status') as $vs_f) {
                             $va_rel[$vs_f] = $va_rel_config[$vs_f];
                         }
                         if ($vn_rel_id = DataMigrationUtils::getEntityID(DataMigrationUtils::splitEntityName($va_rel['preferred_labels']['displayname']), $va_rel['_type'], $g_ui_locale_id, $va_rel, array('transaction' => $o_trans, 'matchOn' => array('label'), 'IDNumberingConfig' => $this->config))) {
                             if (!($vs_rel_type = trim($va_rel['_relationship_type']))) {
                                 break;
                             }
                             $t_subject->addRelationship($vs_table, $vn_rel_id, $vs_rel_type);
                             if ($t_subject->numErrors()) {
                                 $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
                             }
                         }
                     }
                     break;
                 case 'ca_places':
                     $va_rel_config = caGetOption('ca_places', $va_related_form_item_config, array());
                     foreach ($va_content_by_table as $vn_index => $va_rel) {
                         foreach (array('idno', 'access', 'status') as $vs_f) {
                             $va_rel[$vs_f] = $va_rel_config[$vs_f];
                         }
                         if ($vn_rel_id = DataMigrationUtils::getPlaceID($va_rel['preferred_labels']['name'], caGetOption('parent_id', $va_rel_config, null), $va_rel['_type'], $g_ui_locale_id, $va_rel, array('transaction' => $o_trans, 'matchOn' => array('label'), 'IDNumberingConfig' => $this->config))) {
                             if (!($vs_rel_type = trim($va_rel['_relationship_type']))) {
                                 break;
                             }
                             $t_subject->addRelationship($vs_table, $vn_rel_id, $vs_rel_type);
                             if ($t_subject->numErrors()) {
                                 $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
                             }
                         }
                     }
                     break;
                 case 'ca_occurrences':
                     $va_rel_config = caGetOption('ca_occurrences', $va_related_form_item_config, array());
                     foreach ($va_content_by_table as $vn_index => $va_rel) {
                         foreach (array('idno', 'access', 'status') as $vs_f) {
                             $va_rel[$vs_f] = $va_rel_config[$vs_f];
                         }
                         if ($vn_rel_id = DataMigrationUtils::getOccurrenceID($va_rel['preferred_labels']['name'], caGetOption('parent_id', $va_rel_config, null), $va_rel['_type'], $g_ui_locale_id, $va_rel, array('transaction' => $o_trans, 'matchOn' => array('label'), 'IDNumberingConfig' => $this->config))) {
                             if (!($vs_rel_type = trim($va_rel['_relationship_type']))) {
                                 break;
                             }
                             $t_subject->addRelationship($vs_table, $vn_rel_id, $vs_rel_type);
                             if ($t_subject->numErrors()) {
                                 $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
                             }
                         }
                     }
                     break;
                 case 'ca_collections':
                     $va_rel_config = caGetOption('ca_collections', $va_related_form_item_config, array());
                     foreach ($va_content_by_table as $vn_index => $va_rel) {
                         foreach (array('idno', 'access', 'status', 'parent_id') as $vs_f) {
                             $va_rel[$vs_f] = $va_rel_config[$vs_f];
                         }
                         if ($vn_rel_id = DataMigrationUtils::getCollectionID($va_rel['preferred_labels']['name'], $va_rel['_type'], $g_ui_locale_id, $va_rel, array('transaction' => $o_trans, 'matchOn' => array('label'), 'IDNumberingConfig' => $this->config))) {
                             if (!($vs_rel_type = trim($va_rel['_relationship_type']))) {
                                 break;
                             }
                             $t_subject->addRelationship($vs_table, $vn_rel_id, $vs_rel_type);
                             if ($t_subject->numErrors()) {
                                 $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
                             }
                         }
                     }
                     break;
                 default:
                     // (noop for now)
                     break;
             }
         }
     }
     $t_subject->update();
     $this->_checkErrors($t_subject, $va_response_data, $vn_num_errors);
     if ($vn_num_errors > 0) {
         $va_response_data['numErrors'] = $vn_num_errors;
         $va_response_data['status'] = 'ERR';
         $va_response_data['formData'] = $_REQUEST;
         $this->view->setVar('response', $va_response_data);
         $t_subject->getTransaction()->rollback();
         $this->notification->addNotification(_t('There were errors in your submission. See below for details.'), __NOTIFICATION_TYPE_ERROR__);
         call_user_method($ps_function, $this);
     } else {
         $t_subject->getTransaction()->commit();
         if (caGetOption('set_post_submission_notification', $va_form_info, false)) {
             $this->notification->addNotification(caGetOption($vb_has_media ? 'post_submission_notification_message_with_media' : 'post_submission_notification_message', $va_form_info, _t('Thank you!')), __NOTIFICATION_TYPE_INFO__);
         }
         // Redirect to "thank you" page. Options are:
         #		splash = redirect to Pawtucket splash/front page
         #		url = redirect to Pawtucket url specified in post_submission_destination_url directive
         #		page = use result_html view to format direct response (no redirect)
         switch ($va_form_info['post_submission_destination']) {
             case 'url':
                 if (!is_array($va_form_info['post_submission_destination_url']) || !sizeof($va_form_info['post_submission_destination_url']) || !isset($va_form_info['post_submission_destination_url']['controller'])) {
                     $this->notification->addNotification(_t('No destination url configured for form %1', $ps_function), __NOTIFICATION_TYPE_ERROR__);
                     $this->response->setRedirect(caNavUrl($this->request, "", "Front", "Index"));
                     break;
                 }
                 $va_url = $va_form_info['post_submission_destination_url'];
                 $this->response->setRedirect(caNavUrl($this->request, $va_url['module'], $va_url['controller'], $va_url['action']));
                 break;
             case 'page':
                 if (!isset($va_form_info['post_submission_view']) || !$va_form_info['post_submission_view']) {
                     $this->notification->addNotification(_t('No destination view configured for form %1', $ps_function), __NOTIFICATION_TYPE_ERROR__);
                     $this->response->setRedirect(caNavUrl($this->request, "", "Front", "Index"));
                     break;
                 }
                 $this->render($va_form_info['post_submission_view']);
                 break;
             default:
             case 'front':
                 $this->response->setRedirect(caNavUrl($this->request, "", "Front", "Index"));
                 break;
         }
     }
     return;
 }
コード例 #12
0
 /**
  *
  */
 public function __call($ps_function, $pa_args)
 {
     $o_config = caGetListingConfig();
     $ps_function = strtolower($ps_function);
     $ps_type = $this->request->getActionExtra();
     if (!($va_listing_info = caGetInfoForListingType($ps_function))) {
         // invalid listing type – throw error
         die("Invalid listing type");
     }
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . $va_listing_info["displayName"]);
     $o_dm = Datamodel::load();
     $ps_function = strtolower($ps_function);
     $vs_table = $va_listing_info['table'];
     $vs_search = caGetOption('search', $va_listing_info, '*');
     $vs_segment_by = caGetOption('segmentBy', $va_listing_info, '');
     $this->opo_result_context = new ResultContext($this->request, $vs_table, $this->ops_find_type);
     $this->opo_result_context->setAsLastFind();
     if (!($t_instance = $o_dm->getInstanceByTableName($vs_table, true))) {
         die("Invalid table");
     }
     if (!($o_browse = caGetBrowseInstance($vs_table))) {
         die("Invalid listing");
     }
     // Set browse facet group
     if ($vs_facet_group = caGetOption('browseFacetGroup', $va_listing_info, null)) {
         $o_browse->setFacetGroup($vs_facet_group);
     }
     $va_types = caGetOption('restrictToTypes', $va_listing_info, array(), array('castTo' => 'array'));
     $va_type_list = $t_instance->getTypeList();
     if (!is_array($va_types) || !sizeof($va_types)) {
         $va_types = array_keys($va_type_list);
     } else {
         $va_types = caMakeTypeIDList($vs_table, $va_types, array('dontIncludeSubtypesInTypeRestriction' => true));
     }
     $o_browse->addCriteria("_search", array($vs_search));
     $o_browse->setTypeRestrictions($va_types, array('dontExpandHierarchically' => true));
     $o_browse->execute(array('checkAccess' => $this->opa_access_values));
     //
     // Facets for search
     //
     $va_facets = $o_browse->getInfoForAvailableFacets();
     foreach ($va_facets as $vs_facet_name => $va_facet_info) {
         $va_facets[$vs_facet_name]['content'] = $o_browse->getFacetContent($vs_facet_name, array('checkAccess' => $this->opa_access_values));
     }
     $this->view->setVar('facets', $va_facets);
     //
     // Add criteria and execute
     //
     if ($vs_facet = $this->request->getParameter('facet', pString)) {
         $o_browse->addCriteria($vs_facet, array($vn_facet_id = $this->request->getParameter('id', pString)));
         $this->view->setVar('facet', $vs_facet);
         $this->view->setVar('facet_id', $vn_facet_id);
     }
     //
     // Sorting
     //
     $vb_sort_changed = false;
     if (!($ps_sort = $this->request->getParameter("sort", pString))) {
         if (!($ps_sort = $this->opo_result_context->getCurrentSort())) {
             if (is_array($va_sorts = caGetOption('sortBy', $va_listing_info, null))) {
                 $ps_sort = array_shift(array_keys($va_sorts));
                 $vb_sort_changed = true;
             }
         }
     } else {
         $vb_sort_changed = true;
     }
     if ($vb_sort_changed) {
         # --- set the default sortDirection if available
         $va_sort_direction = caGetOption('sortDirection', $va_listing_info, null);
         if ($ps_sort_direction = $va_sort_direction[$ps_sort]) {
             $this->opo_result_context->setCurrentSortDirection($ps_sort_direction);
         }
     }
     if (!($ps_sort_direction = $this->request->getParameter("direction", pString))) {
         if (!($ps_sort_direction = $this->opo_result_context->getCurrentSortDirection())) {
             $ps_sort_direction = 'asc';
         }
     }
     $this->opo_result_context->setCurrentSort($ps_sort);
     $this->opo_result_context->setCurrentSortDirection($ps_sort_direction);
     $va_sort_by = caGetOption('sortBy', $va_listing_info, null);
     $this->view->setVar('sortBy', is_array($va_sort_by) ? $va_sort_by : null);
     $this->view->setVar('sortBySelect', $vs_sort_by_select = is_array($va_sort_by) ? caHTMLSelect("sort", $va_sort_by, array('id' => "sort"), array("value" => $ps_sort)) : '');
     $this->view->setVar('sortControl', $vs_sort_by_select ? _t('Sort with %1', $vs_sort_by_select) : '');
     $this->view->setVar('sort', $ps_sort);
     $this->view->setVar('sort_direction', $ps_sort_direction);
     $va_lists = array();
     $va_res_list = array();
     $o_browse->execute(array('checkAccess' => $this->opa_access_values));
     $qr_res = $o_browse->getResults(array('sort' => $va_sort_by[$ps_sort], 'sort_direction' => $ps_sort_direction));
     while ($qr_res->nextHit()) {
         $vs_key = $qr_res->getWithTemplate($vs_segment_by);
         $va_lists[$vs_key][] = $va_res_list[] = $qr_res->getPrimaryKey();
     }
     foreach ($va_lists as $vs_key => $va_ids) {
         $va_lists[$vs_key] = caMakeSearchResult($vs_table, $va_ids);
     }
     $this->view->setVar('table', $vs_table);
     $this->view->setVar('lists', $va_lists);
     $this->view->setVar('typeInfo', $va_type_list);
     $this->view->setVar('listingInfo', $va_listing_info);
     //
     // Current criteria
     //
     $va_criteria = $o_browse->getCriteriaWithLabels();
     unset($va_criteria['_search']);
     $va_criteria_for_checking = array();
     foreach ($va_criteria as $vs_facet_name => $va_criterion) {
         $va_facet_info = $o_browse->getInfoForFacet($vs_facet_name);
         foreach ($va_criterion as $vn_criterion_id => $vs_criterion) {
             $va_criteria_for_checking[$vs_facet_name] = $vn_criterion_id;
         }
     }
     $this->view->setVar('hasCriteria', sizeof($va_criteria_for_checking) > 0);
     $this->view->setVar('criteria', $va_criteria_for_checking);
     $this->opo_result_context->setResultList($va_res_list);
     $this->opo_result_context->saveContext();
     $this->render("Listing/listing_html.php");
 }
コード例 #13
0
ファイル: About.php プロジェクト: kai-iak/pawtucket2
<?php

MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": Performance Assessment & Certification Guidelines");
?>
<div class="container blueBox">
	<div class="row">
		<div class="col-sm-12">
			<p>
				Assessment and certification of PA professionals helps ensure that those responsible for protecting valuable resources are competently performing their jobs. Built upon clear competence standards and guidelines, certification programs can provide feedback to individuals (and their employers) on their performance while highlighting opportunities for continuing professional development.  Certification works together with the Body of Knowledge and Competence Standards to provide a consistent approach to developing a professional PA workforce.
			</p>
		</div>
	</div>
</div>
<div class="container containerTextPadding">
	<div class="row">
		<div class="col-sm-12">
			<p>
				The IUCN WCPA is committed to assisting national or regional bodies in developing competence assessment and certification programs by providing:
			</p>
		</div><!--end col-sm-12-->
	</div>
	<div class="row">
		<div class="col-sm-6">
			<p>
				1.	<strong>Guidelines</strong> documenting the process for establishing a certification program including key elements and factors for success. These guidelines are best suited for those that want to design their own competence-based certification systems, but who wish to align their programs with the IUCN to be consistent with the international community and potentially receive IUCN endorsement.
			</p>
		</div><!--end col-sm-6-->
		<div class="col-sm-6">
			<p>
				2.	A <strong>model certification program</strong> providing an example of what a full certification program could look like and how the competences should be organized into a certification program with assessment instruments. 
			</p>
コード例 #14
0
ファイル: About.php プロジェクト: kai-iak/pawtucket2
<?php

MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": Supporting Initiatives");
?>
<div class="container containerTextPadding">	
	<div class="row">
		<div class="col-sm-6">
			<p>
				Mentorship among PA professionals helps strengthen the management of protected areas by providing access to experienced conservation professionals.  These mentors work in a voluntary capacity to transfer their knowledge, experience, and proven methodologies to improve the competency of others. Mentorship works together with the Body of Knowledge, Assessment and Certification, and Competence Standards to provide a consistent approach to developing a professional PA workforce.
			</p>
		</div>
		<div class="col-sm-6 col-md-5">
			<p>
				This site provides access to an IUCN WCPA sponsored program provided by <a href="http://www.globalparks.org" target="_blank" class="underline">Global Parks</a> which matches mentors with those requesting mentorship.
			</p>
			<p>
				<ul>
					<li>If you are interested in being a mentor, please review the qualifications and submit your application <a href="https://docs.google.com/forms/d/1iOKVn_uVkQ0MHMnrc549TEvuFzT9yO3b2r3TH6C0xbM/viewform?usp=send_form" target="_blank">here</a>.</li>
					<li>If you are interested in obtaining a mentor, please submit your application <a href="https://docs.google.com/forms/d/1xv-ly3eFTgzuYnyLCmkZYK2yONLwiyfTlJCQlsxWPIM/viewform?usp=send_form" target="_blank">here</a>. </li>
				</ul>
			</p>
			</div>
	</div>
</div>
コード例 #15
0
ファイル: SetsController.php プロジェクト: ffarago/pawtucket2
 function setDetail()
 {
     if (!$this->request->isLoggedIn()) {
         $this->response->setRedirect(caNavUrl($this->request, '', 'LoginReg', 'loginForm'));
         return;
     }
     AssetLoadManager::register("mediaViewer");
     $ps_view = $this->request->getParameter('view', pString);
     if (!in_array($ps_view, array('thumbnail', 'timeline', 'timelineData', 'pdf'))) {
         $ps_view = 'thumbnail';
     }
     $this->view->setVar('view', $ps_view);
     $this->view->setVar('views', $this->opo_config->getAssoc("views"));
     if (!($t_set = $this->_getSet(__CA_SET_READ_ACCESS__))) {
         $this->Index();
     }
     $va_set_items = caExtractValuesByUserLocale($t_set->getItems(array("user_id" => $this->request->getUserID(), "thumbnailVersions" => array("medium"), "checkAccess" => $this->opa_access_values)));
     $this->view->setVar("set", $t_set);
     $this->view->setVar("set_items", $va_set_items);
     $va_comments = $t_set->getComments();
     $this->view->setVar("comments", $va_comments);
     $o_context = new ResultContext($this->request, 'ca_objects', 'sets');
     $o_context->setResultList($va_set_ids = $t_set->getItems(array('idsOnly' => true)));
     $o_context->saveContext();
     $o_context->setAsLastFind();
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Lightbox") . ": " . $t_set->getLabelForDisplay());
     switch ($ps_view) {
         case 'pdf':
             $qr_res = caMakeSearchResult('ca_objects', $va_set_ids);
             $this->view->setVar('result', $qr_res);
             $this->_genExport($qr_res, '_pdf_checklist', $vs_label = $t_set->get('ca_sets.preferred_labels'), $vs_label);
         case 'timelineData':
             $this->view->setVar('view', 'timeline');
             $this->render("Sets/set_detail_timelineData_json.php");
             break;
         default:
             $this->render("Sets/set_detail_html.php");
             break;
     }
 }
コード例 #16
0
 /**
  *
  */
 public function __call($ps_function, $pa_args)
 {
     $o_config = caGetBrowseConfig();
     $this->view->setVar("config", $o_config);
     $ps_function = strtolower($ps_function);
     $ps_type = $this->request->getActionExtra();
     if (!($va_browse_info = caGetInfoForBrowseType($ps_function))) {
         // invalid browse type – throw error
         die("Invalid browse type");
     }
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Browse %1", $va_browse_info["displayName"]));
     $this->view->setVar("browse_type", $ps_function);
     $vs_class = $va_browse_info['table'];
     $va_types = caGetOption('restrictToTypes', $va_browse_info, array(), array('castTo' => 'array'));
     $this->opo_result_context = new ResultContext($this->request, $va_browse_info['table'], $this->ops_find_type);
     $this->opo_result_context->setAsLastFind();
     $this->view->setVar('browseInfo', $va_browse_info);
     $this->view->setVar('name', $va_browse_info['displayName']);
     $this->view->setVar('options', caGetOption('options', $va_browse_info, array(), array('castTo' => 'array')));
     $ps_view = $this->request->getParameter('view', pString);
     $va_views = caGetOption('views', $va_browse_info, array(), array('castTo' => 'array'));
     if (!is_array($va_views) || sizeof($va_views) == 0) {
         $va_views = array('list' => array(), 'images' => array(), 'timeline' => array(), 'map' => array(), 'timelineData' => array(), 'pdf' => array());
     } else {
         $va_views['pdf'] = array();
     }
     if (!in_array($ps_view, array_keys($va_views))) {
         $ps_view = array_shift(array_keys($va_views));
     }
     $vs_format = $ps_view == 'timelineData' ? 'json' : 'html';
     #caAddPageCSSClasses(array($vs_class, $ps_function, $ps_view));
     caAddPageCSSClasses(array($vs_class, $ps_function));
     $this->view->setVar('isNav', (bool) $this->request->getParameter('isNav', pInteger));
     // flag for browses that originate from nav bar
     $t_instance = $this->getAppDatamodel()->getInstanceByTableName($vs_class, true);
     $vn_type_id = $t_instance->getTypeIDForCode($ps_type);
     $this->view->setVar('t_instance', $t_instance);
     $this->view->setVar('table', $va_browse_info['table']);
     $this->view->setVar('primaryKey', $t_instance->primaryKey());
     $this->view->setVar('browse', $o_browse = caGetBrowseInstance($vs_class));
     $this->view->setVar('views', caGetOption('views', $va_browse_info, array(), array('castTo' => 'array')));
     $this->view->setVar('view', $ps_view);
     $this->view->setVar('viewIcons', $o_config->getAssoc("views"));
     //
     // Load existing browse if key is specified
     //
     if ($ps_cache_key = $this->request->getParameter('key', pString)) {
         $o_browse->reload($ps_cache_key);
     }
     if (is_array($va_types) && sizeof($va_types)) {
         $o_browse->setTypeRestrictions($va_types, array('dontExpandHierarchically' => caGetOption('dontExpandTypesHierarchically', $va_browse_info, false)));
     }
     //
     // Clear criteria if required
     //
     if ($vs_remove_criterion = $this->request->getParameter('removeCriterion', pString)) {
         $o_browse->removeCriteria($vs_remove_criterion, array($this->request->getParameter('removeID', pString)));
     }
     if ((bool) $this->request->getParameter('clear', pInteger)) {
         $o_browse->removeAllCriteria();
     }
     if ($this->request->getParameter('getFacet', pInteger)) {
         $vs_facet = $this->request->getParameter('facet', pString);
         $this->view->setVar('facet_name', $vs_facet);
         $this->view->setVar('key', $o_browse->getBrowseID());
         $va_facet_info = $o_browse->getInfoForFacet($vs_facet);
         $this->view->setVar('facet_info', $va_facet_info);
         # --- pull in different views based on format for facet - alphabetical, list, hierarchy
         switch ($va_facet_info["group_mode"]) {
             case "alphabetical":
             case "list":
             default:
                 $this->view->setVar('facet_content', $o_browse->getFacetContent($vs_facet, array("checkAccess" => $this->opa_access_values)));
                 $this->render("Browse/list_facet_html.php");
                 break;
             case "hierarchical":
                 $this->render("Browse/hierarchy_facet_html.php");
                 break;
         }
         return;
     }
     //
     // Add criteria and execute
     //
     // Get any preset-criteria
     $va_base_criteria = caGetOption('baseCriteria', $va_browse_info, null);
     if ($vs_facet = $this->request->getParameter('facet', pString)) {
         $o_browse->addCriteria($vs_facet, array($this->request->getParameter('id', pString)));
     } else {
         if ($o_browse->numCriteria() == 0) {
             if (is_array($va_base_criteria)) {
                 foreach ($va_base_criteria as $vs_facet => $vs_value) {
                     $o_browse->addCriteria($vs_facet, $vs_value);
                 }
             } else {
                 $o_browse->addCriteria("_search", array("*"));
             }
         }
     }
     //
     // Sorting
     //
     $vb_sort_changed = false;
     if (!($ps_sort = $this->request->getParameter("sort", pString))) {
         if (!($ps_sort = $this->opo_result_context->getCurrentSort())) {
             if (is_array($va_sorts = caGetOption('sortBy', $va_browse_info, null))) {
                 $ps_sort = array_shift(array_keys($va_sorts));
                 $vb_sort_changed = true;
             }
         }
     } else {
         $vb_sort_changed = true;
     }
     if ($vb_sort_changed) {
         # --- set the default sortDirection if available
         $va_sort_direction = caGetOption('sortDirection', $va_browse_info, null);
         if ($ps_sort_direction = $va_sort_direction[$ps_sort]) {
             $this->opo_result_context->setCurrentSortDirection($ps_sort_direction);
         }
     }
     if (!($ps_sort_direction = $this->request->getParameter("direction", pString))) {
         if (!($ps_sort_direction = $this->opo_result_context->getCurrentSortDirection())) {
             $ps_sort_direction = 'asc';
         }
     }
     $this->opo_result_context->setCurrentSort($ps_sort);
     $this->opo_result_context->setCurrentSortDirection($ps_sort_direction);
     $va_sort_by = caGetOption('sortBy', $va_browse_info, null);
     $this->view->setVar('sortBy', is_array($va_sort_by) ? $va_sort_by : null);
     $this->view->setVar('sortBySelect', $vs_sort_by_select = is_array($va_sort_by) ? caHTMLSelect("sort", $va_sort_by, array('id' => "sort"), array("value" => $ps_sort)) : '');
     $this->view->setVar('sortControl', $vs_sort_by_select ? _t('Sort with %1', $vs_sort_by_select) : '');
     $this->view->setVar('sort', $ps_sort);
     $this->view->setVar('sort_direction', $ps_sort_direction);
     if (caGetOption('dontShowChildren', $va_browse_info, false)) {
         $o_browse->addResultFilter('ca_objects.parent_id', 'is', 'null');
     }
     $o_browse->execute(array('checkAccess' => $this->opa_access_values, 'showAllForNoCriteriaBrowse' => true));
     //
     // Facets
     //
     if ($vs_facet_group = caGetOption('facetGroup', $va_browse_info, null)) {
         $o_browse->setFacetGroup($vs_facet_group);
     }
     $va_available_facet_list = caGetOption('availableFacets', $va_browse_info, null);
     $va_facets = $o_browse->getInfoForAvailableFacets();
     foreach ($va_facets as $vs_facet_name => $va_facet_info) {
         if (isset($va_base_criteria[$vs_facet_name])) {
             continue;
         }
         // skip base criteria
         $va_facets[$vs_facet_name]['content'] = $o_browse->getFacet($vs_facet_name, array("checkAccess" => $this->opa_access_values, 'checkAvailabilityOnly' => caGetOption('deferred_load', $va_facet_info, false, array('castTo' => 'bool'))));
     }
     $this->view->setVar('facets', $va_facets);
     $this->view->setVar('key', $vs_key = $o_browse->getBrowseID());
     $this->request->session->setVar($ps_function . '_last_browse_id', $vs_key);
     //
     // Current criteria
     //
     $va_criteria = $o_browse->getCriteriaWithLabels();
     if (isset($va_criteria['_search']) && isset($va_criteria['_search']['*'])) {
         unset($va_criteria['_search']);
     }
     // remove base criteria from display list
     if (is_array($va_base_criteria)) {
         foreach ($va_base_criteria as $vs_base_facet => $vs_criteria_value) {
             unset($va_criteria[$vs_base_facet]);
         }
     }
     $va_criteria_for_display = array();
     foreach ($va_criteria as $vs_facet_name => $va_criterion) {
         $va_facet_info = $o_browse->getInfoForFacet($vs_facet_name);
         foreach ($va_criterion as $vn_criterion_id => $vs_criterion) {
             $va_criteria_for_display[] = array('facet' => $va_facet_info['label_singular'], 'facet_name' => $vs_facet_name, 'value' => $vs_criterion, 'id' => $vn_criterion_id);
         }
     }
     $this->view->setVar('criteria', $va_criteria_for_display);
     //
     // Results
     //
     $qr_res = $o_browse->getResults(array('sort' => $va_sort_by[$ps_sort], 'sort_direction' => $ps_sort_direction));
     $this->view->setVar('result', $qr_res);
     if (!($pn_hits_per_block = $this->request->getParameter("n", pString))) {
         if (!($pn_hits_per_block = $this->opo_result_context->getItemsPerPage())) {
             $pn_hits_per_block = $o_config->get("defaultHitsPerBlock");
         }
     }
     $this->opo_result_context->getItemsPerPage($pn_hits_per_block);
     $this->view->setVar('hits_per_block', $pn_hits_per_block);
     $this->view->setVar('start', $vn_start = $this->request->getParameter('s', pInteger));
     $this->opo_result_context->setParameter('key', $vs_key);
     if (!$this->request->isAjax()) {
         if (($vn_key_start = $vn_start - 500) < 0) {
             $vn_key_start = 0;
         }
         $qr_res->seek($vn_key_start);
         $this->opo_result_context->setResultList($qr_res->getPrimaryKeyValues(500));
         $qr_res->seek($vn_start);
     }
     $this->opo_result_context->saveContext();
     if ($vn_type_id) {
         if ($this->render("Browse/{$vs_class}_{$vs_type}_{$ps_view}_{$vs_format}.php")) {
             return;
         }
     }
     switch ($ps_view) {
         case 'pdf':
             $this->_genExport($qr_res, $this->request->getParameter("export_format", pString), $vs_search_expression, $vs_search_expression);
             break;
         case 'timelineData':
             $this->view->setVar('view', 'timeline');
             $this->render("Browse/browse_results_timelineData_json.php");
             break;
         default:
             $this->render("Browse/browse_results_html.php");
             break;
     }
 }
コード例 #17
0
 /**
  * Initializes editor view with core set of values, loads model with record to be edited and selects user interface to use.
  *
  * @param $pa_options Array of options. Supported options are:
  *		ui = The ui_id or editor_code value for the user interface to use. If omitted the default user interface is used.
  */
 protected function _initView($pa_options = null)
 {
     // load required javascript
     JavascriptLoadManager::register('bundleableEditor');
     JavascriptLoadManager::register('imageScroller');
     JavascriptLoadManager::register('datePickerUI');
     $t_subject = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name);
     $vn_subject_id = $this->request->getParameter($t_subject->primaryKey(), pInteger);
     if (!$vn_subject_id || !$t_subject->load($vn_subject_id)) {
         // empty (ie. new) rows don't have a type_id set, which means we'll have no idea which attributes to display
         // so we get the type_id off of the request
         if (!($vn_type_id = $this->request->getParameter($t_subject->getTypeFieldName(), pInteger))) {
             $vn_type_id = null;
         }
         // then set the empty row's type_id
         $t_subject->set($t_subject->getTypeFieldName(), $vn_type_id);
         // then reload the definitions (which includes bundle specs)
         $t_subject->reloadLabelDefinitions();
     }
     $t_ui = new ca_editor_uis();
     if (isset($pa_options['ui']) && $pa_options['ui']) {
         if (is_numeric($pa_options['ui'])) {
             $t_ui->load((int) $pa_options['ui']);
         }
         if (!$t_ui->getPrimaryKey()) {
             $t_ui->load(array('editor_code' => $pa_options['ui']));
         }
     }
     if (!$t_ui->getPrimaryKey()) {
         $t_ui = ca_editor_uis::loadDefaultUI($this->ops_table_name, $this->request, $t_subject->getTypeID());
     }
     $this->view->setVar($t_subject->primaryKey(), $vn_subject_id);
     $this->view->setVar('subject_id', $vn_subject_id);
     $this->view->setVar('t_subject', $t_subject);
     MetaTagManager::setWindowTitle(_t("Editing %1 : %2", ($vs_type = $t_subject->getTypeName()) ? $vs_type : $t_subject->getProperty('NAME_SINGULAR'), $vn_subject_id ? $t_subject->getLabelForDisplay(true) : _t('new %1', $t_subject->getTypeName())));
     if ($vs_parent_id_fld = $t_subject->getProperty('HIERARCHY_PARENT_ID_FLD')) {
         $this->view->setVar('parent_id', $vn_parent_id = $this->request->getParameter($vs_parent_id_fld, pInteger));
         // The "above_id" is set when the new record we're creating is to be inserted *above* an existing record (eg. made
         // the parent of another record). It will be set to the record we're inserting above. We ignore it if set when editing
         // an existing record since it is only relevant for newly created records.
         if (!$vn_subject_id) {
             $this->view->setVar('above_id', $vn_above_id = $this->request->getParameter('above_id', pInteger));
             $t_subject->set($vs_parent_id_fld, $vn_parent_id);
             $t_parent = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name);
             if ($t_parent->load($vn_parent_id)) {
                 $t_subject->set('idno', $t_parent->get('idno'));
             }
         }
         return array($vn_subject_id, $t_subject, $t_ui, $vn_parent_id, $vn_above_id);
     }
     return array($vn_subject_id, $t_subject, $t_ui);
 }
コード例 #18
0
 function resetSave()
 {
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Reset Password"));
     $ps_action = $this->request->getParameter('action', pString);
     if (!$ps_action) {
         $ps_action = "reset";
     }
     $ps_key = $this->request->getParameter('key', pString);
     $ps_key = preg_replace("/[^A-Za-z0-9]+/", "", $ps_key);
     $this->view->setVar("key", $ps_key);
     $this->view->setVar("email", $this->request->config->get("ca_admin_email"));
     $o_check_key = new Db();
     $qr_check_key = $o_check_key->query("\n\t\t\t\tSELECT user_id \n\t\t\t\tFROM ca_users \n\t\t\t\tWHERE\n\t\t\t\t\tmd5(concat(concat(user_id, '/'), password)) = ?\n\t\t\t", $ps_key);
     #
     # Check reset key
     #
     if (!$qr_check_key->nextRow() || !($vs_user_id = $qr_check_key->get("user_id"))) {
         $this->view->setVar("action", "reset_failure");
         $this->view->setVar("message", _t("Your password could not be reset"));
         $this->render('LoginReg/form_reset_html.php');
     } else {
         $ps_password = $this->request->getParameter('password', pString);
         $ps_password_confirm = $this->request->getParameter('password_confirm', pString);
         switch ($ps_action) {
             case 'reset_save':
                 if (!$ps_password || !$ps_password_confirm) {
                     $this->view->setVar("message", _t("Please enter and re-type your password."));
                     $ps_action = "reset";
                     break;
                 }
                 if ($ps_password != $ps_password_confirm) {
                     $this->view->setVar("message", _t("Passwords do not match. Please try again."));
                     $ps_action = "reset";
                     break;
                 }
                 $t_user = new ca_users();
                 $t_user->purify(true);
                 $t_user->load($vs_user_id);
                 # verify user exists with this e-mail address
                 if ($t_user->getPrimaryKey()) {
                     # user with e-mail already exists...
                     $t_user->setMode(ACCESS_WRITE);
                     $t_user->set("password", $ps_password);
                     $t_user->update();
                     if ($t_user->numErrors()) {
                         $this->notification->addNotification(join("; ", $t_user->getErrors()), __NOTIFICATION_TYPE_INFO__);
                         $ps_action = "reset_failure";
                     } else {
                         $ps_action = "reset_success";
                         $o_view = new View($this->request, array($this->request->getViewsDirectoryPath()));
                         # -- generate email subject
                         $vs_subject_line = $o_view->render("mailTemplates/notification_subject.tpl");
                         # -- generate mail text from template - get both the html and text versions
                         $vs_mail_message_text = $o_view->render("mailTemplates/notification.tpl");
                         $vs_mail_message_html = $o_view->render("mailTemplates/notification_html.tpl");
                         caSendmail($t_user->get('email'), $this->request->config->get("ca_admin_email"), $vs_subject_line, $vs_mail_message_text, $vs_mail_message_html);
                     }
                     break;
                 } else {
                     $this->notification->addNotification(_t("Invalid user"), __NOTIFICATION_TYPE_INFO__);
                     $ps_action = "reset_failure";
                 }
         }
         $this->view->setVar("action", $ps_action);
         $this->render('LoginReg/form_reset_html.php');
     }
 }
コード例 #19
0
 /**
  *
  */
 public function Index($pa_options = null)
 {
     $ps_search = $this->request->getParameter('search', pString);
     $ps_sort = $this->request->getParameter('sort', pString);
     if (!$ps_search) {
         $ps_search = $this->request->session->getVar('quick_search_last_search');
     }
     if (!in_array($ps_sort, array('name', 'idno'))) {
         if (!($ps_sort = $this->request->session->getVar('quick_search_last_sort'))) {
             $ps_sort = 'name';
         }
     }
     MetaTagManager::setWindowTitle(_t('Quick search'));
     $o_config = Configuration::load();
     $vs_default_actions["ca_objects"] = $this->request->user->canDoAction("can_edit_ca_objects") ? "Edit" : "Summary";
     $vs_default_actions["ca_object_lots"] = $this->request->user->canDoAction("can_edit_ca_object_lots") ? "Edit" : "Summary";
     $vs_default_actions["ca_entities"] = $this->request->user->canDoAction("can_edit_ca_entities") ? "Edit" : "Summary";
     $vs_default_actions["ca_places"] = $this->request->user->canDoAction("can_edit_ca_places") ? "Edit" : "Summary";
     $vs_default_actions["ca_occurrences"] = $this->request->user->canDoAction("can_edit_ca_occurrences") ? "Edit" : "Summary";
     $vs_default_actions["ca_collections"] = $this->request->user->canDoAction("can_edit_ca_collections") ? "Edit" : "Summary";
     $vs_default_actions["ca_storage_locations"] = $this->request->user->canDoAction("can_edit_ca_storage_locations") ? "Edit" : "Summary";
     $vs_default_actions["ca_loans"] = $this->request->user->canDoAction("can_edit_ca_loans") ? "Edit" : "Summary";
     $vs_default_actions["ca_movements"] = $this->request->user->canDoAction("can_edit_ca_movements") ? "Edit" : "Summary";
     $vs_default_actions["ca_tours"] = $this->request->user->canDoAction("can_edit_ca_tours") ? "Edit" : "Summary";
     $vs_default_actions["ca_tour_stops"] = $this->request->user->canDoAction("can_edit_ca_tours") ? "Edit" : "Summary";
     $va_searches = array('ca_collections' => array('name' => 'ca_collection_labels.name', 'displayidno' => 'ca_collections.idno', 'idno' => 'ca_collections.idno_sort', 'displayname' => _t('Collections'), 'primary_key' => 'collection_id', 'module' => 'editor/collections', 'controller' => 'CollectionEditor', 'action' => $vs_default_actions["ca_collections"], 'searchModule' => 'find', 'searchController' => 'SearchCollections', 'searchAction' => "Index"), 'ca_objects' => array('name' => 'ca_object_labels.name', 'displayidno' => 'ca_objects.idno', 'idno' => 'ca_objects.idno_sort', 'displayname' => _t('Objects'), 'primary_key' => 'object_id', 'module' => 'editor/objects', 'controller' => 'ObjectEditor', 'action' => $vs_default_actions["ca_objects"], 'searchModule' => 'find', 'searchController' => 'SearchObjects', 'searchAction' => "Index"), 'ca_object_lots' => array('name' => 'ca_object_lot_labels.name', 'displayidno' => 'ca_object_lots.idno_stub', 'idno' => 'ca_object_lots.idno_stub_sort', 'displayname' => _t('Object lots'), 'primary_key' => 'lot_id', 'module' => 'editor/object_lots', 'controller' => 'ObjectLotEditor', 'action' => $vs_default_actions["ca_object_lots"], 'searchModule' => 'find', 'searchController' => 'SearchObjectLots', 'searchAction' => "Index"), 'ca_entities' => array('name' => 'ca_entity_labels.surname;ca_entity_labels.forename', 'displayidno' => 'ca_entities.idno', 'idno' => 'ca_entities.idno_sort', 'displayname' => _t('Entities'), 'primary_key' => 'entity_id', 'module' => 'editor/entities', 'controller' => 'EntityEditor', 'action' => $vs_default_actions["ca_entities"], 'searchModule' => 'find', 'searchController' => 'SearchEntities', 'searchAction' => "Index"), 'ca_places' => array('name' => 'ca_place_labels.name', 'displayidno' => 'ca_places.idno', 'idno' => 'ca_places.idno_sort', 'displayname' => _t('Places'), 'primary_key' => 'place_id', 'module' => 'editor/places', 'controller' => 'PlaceEditor', 'action' => $vs_default_actions["ca_places"], 'searchModule' => 'find', 'searchController' => 'SearchPlaces', 'searchAction' => "Index"), 'ca_occurrences' => array('name' => 'ca_occurrence_labels.name', 'displayidno' => 'ca_occurrences.idno', 'idno' => 'ca_occurrences.idno_sort', 'displayname' => _t('Occurrences'), 'primary_key' => 'occurrence_id', 'module' => 'editor/occurrences', 'controller' => 'OccurrenceEditor', 'action' => $vs_default_actions["ca_occurrences"], 'searchModule' => 'find', 'searchController' => 'SearchOccurrences', 'searchAction' => "Index"), 'ca_storage_locations' => array('name' => 'ca_storage_location_labels.name', 'displayidno' => '', 'idno' => '', 'displayname' => _t('Storage locations'), 'primary_key' => 'location_id', 'module' => 'editor/storage_locations', 'controller' => 'StorageLocationEditor', 'action' => $vs_default_actions["ca_storage_locations"], 'searchModule' => 'find', 'searchController' => 'SearchStorageLocations', 'searchAction' => "Index"), 'ca_loans' => array('name' => 'ca_loan_labels.name', 'displayidno' => 'ca_loans.idno', 'idno' => 'ca_loans.idno_sort', 'displayname' => _t('Loans'), 'primary_key' => 'loan_id', 'module' => 'editor/loans', 'controller' => 'LoanEditor', 'action' => $vs_default_actions["ca_loans"], 'searchModule' => 'find', 'searchController' => 'SearchLoans', 'searchAction' => "Index"), 'ca_movements' => array('name' => 'ca_movement_labels.name', 'displayidno' => 'ca_movements.idno', 'idno' => 'ca_movements.idno_sort', 'displayname' => _t('Movements'), 'primary_key' => 'movement_id', 'module' => 'editor/movements', 'controller' => 'MovementEditor', 'action' => $vs_default_actions["ca_movements"], 'searchModule' => 'find', 'searchController' => 'SearchMovements', 'searchAction' => "Index"), 'ca_tours' => array('name' => 'ca_tour_labels.name', 'displayidno' => 'ca_tours.tour_code', 'idno' => 'ca_tours.tour_code', 'displayname' => _t('Tours'), 'primary_key' => 'tour_id', 'module' => 'editor/tours', 'controller' => 'TourEditor', 'action' => $vs_default_actions["ca_tours"], 'searchModule' => 'find', 'searchController' => 'SearchTours', 'searchAction' => "Index"), 'ca_tour_stops' => array('name' => 'ca_tour_stop_labels.name', 'displayidno' => 'ca_tour_stops.idno', 'idno' => 'ca_tour_stops.idno_sort', 'displayname' => _t('Tour stops'), 'primary_key' => 'stop_id', 'module' => 'editor/tour_stops', 'controller' => 'TourStopEditor', 'action' => $vs_default_actions["ca_tour_stops"], 'searchModule' => 'find', 'searchController' => 'SearchTourStops', 'searchAction' => "Index"));
     $t_list = new ca_lists();
     $this->view->setVar('occurrence_types', caExtractValuesByUserLocale($t_list->getItemsForList('occurrence_types')));
     if (sizeof($va_aps_in_search = caSearchGetAccessPoints($ps_search))) {
         $va_aps = caSearchGetTablesForAccessPoints($va_aps_in_search);
         $vb_uses_aps = true;
     } else {
         $vb_uses_aps = false;
     }
     $va_single_results = array();
     $pn_multiple_results = 0;
     foreach ($va_searches as $vs_table => $va_sorts) {
         if ($o_config->get($vs_table . '_disable') || $vs_table == 'ca_tour_stops' && $o_config->get('ca_tours_disable') || $vb_uses_aps && !in_array($vs_table, $va_aps)) {
             unset($va_searches[$vs_table]);
             continue;
         }
         if (!($vo_result = $this->_doSearch($vs_table, $ps_search, $va_sorts[$ps_sort]))) {
             unset($va_searches[$vs_table]);
             continue;
         }
         $vo_result->setOption('prefetch', $this->opn_num_results_per_item_type);
         // get everything we need in one pass
         $vo_result->setOption('dontPrefetchAttributes', true);
         // don't bother trying to prefetch attributes as we don't need them
         $this->view->setVar($vs_table . '_results', $vo_result);
         $va_found_item_ids = array();
         while ($vo_result->nextHit()) {
             $va_found_item_ids[] = $vo_result->get($va_sorts['primary_key']);
         }
         $vo_result->seek(0);
         $o_result_context = new ResultContext($this->request, $vs_table, 'quick_search');
         $o_result_context->setAsLastFind();
         $o_result_context->setResultList($va_found_item_ids);
         $o_result_context->saveContext();
         if ($vo_result->numHits() > 0) {
             if ($vo_result->numHits() == 1) {
                 $va_single_results[$vs_table] = $va_found_item_ids[0];
             } else {
                 $pn_multiple_results = 1;
             }
         }
     }
     $this->view->setVar('searches', $va_searches);
     // note last quick search
     if ($ps_search) {
         $this->request->session->setVar('quick_search_last_search', $ps_search);
     }
     if ($ps_sort) {
         $this->request->session->setVar('quick_search_last_sort', $ps_sort);
     }
     $this->view->setVar('search', $ps_search);
     $this->view->setVar('sort', $this->request->session->getVar('quick_search_last_sort'));
     $this->view->setVar('maxNumberResults', $this->opn_num_results_per_item_type);
     // did we find only a single result in a single table? If so, then redirect to that record instead of showing results
     if (!$pn_multiple_results && sizeof($va_single_results) == 1) {
         foreach ($va_single_results as $vs_table => $vn_id) {
             $this->response->setRedirect(caEditorUrl($this->request, $vs_table, $vn_id));
             return;
         }
     }
     $this->render('Results/quick_search_results_html.php');
 }
コード例 #20
0
 /** 
  * 
  */
 public function advanced()
 {
     $o_config = caGetSearchConfig();
     $ps_function = strtolower($this->request->getActionExtra());
     if (!($va_search_info = caGetInfoForAdvancedSearchType($ps_function))) {
         // invalid advanced search type – throw error
         die("Invalid advanced search type");
     }
     $vs_class = $va_search_info['table'];
     $va_types = caGetOption('restrictToTypes', $va_search_info, array(), array('castTo' => 'array'));
     $this->opo_result_context = new ResultContext($this->request, $va_search_info['table'], $this->ops_find_type . '_advanced');
     $this->opo_result_context->setAsLastFind();
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Search %1", $va_search_info["displayName"]));
     $this->view->setVar('searchInfo', $va_search_info);
     $this->view->setVar('options', caGetOption('options', $va_search_info, array(), array('castTo' => 'array')));
     $va_default_form_values = $this->opo_result_context->getParameter("pawtucketAdvancedSearchFormContent_{$ps_function}");
     $va_default_form_booleans = $this->opo_result_context->getParameter("pawtucketAdvancedSearchFormBooleans_{$ps_function}");
     $va_tags = $this->view->getTagList($va_search_info['view']);
     $t_subject = $this->request->datamodel->getInstanceByTableName($va_search_info['table'], true);
     $va_form_elements = array();
     $vs_script = null;
     foreach ($va_tags as $vs_tag) {
         $va_parse = caParseTagOptions($vs_tag);
         $vs_tag_proc = $va_parse['tag'];
         $va_opts = $va_parse['options'];
         if (($vs_default_value = caGetOption('default', $va_opts, null)) || ($vs_default_value = caGetOption($vs_tag_proc, $va_default_form_values, null))) {
             $va_default_form_values[$vs_tag_proc] = $vs_default_value;
             unset($va_opts['default']);
         }
         $vs_tag_val = null;
         switch (strtolower($vs_tag_proc)) {
             case 'submit':
                 $this->view->setVar($vs_tag, "<a href='#' class='caAdvancedSearchFormSubmit'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Submit')) . "</a>");
                 break;
             case 'reset':
                 $this->view->setVar($vs_tag, "<a href='#' class='caAdvancedSearchFormReset'>" . (isset($va_opts['label']) && $va_opts['label'] ? $va_opts['label'] : _t('Reset')) . "</a>");
                 $vs_script = "<script type='text/javascript'>\n\tjQuery('.caAdvancedSearchFormSubmit').bind('click', function() {\n\t\tjQuery('#caAdvancedSearch').submit();\n\t\treturn false;\n\t});\n\tjQuery('.caAdvancedSearchFormReset').bind('click', function() {\n\t\tjQuery('#caAdvancedSearch').find('input[type!=\"hidden\"],textarea').val('');\n\t\tjQuery('#caAdvancedSearch').find('select.caAdvancedSearchBoolean').val('AND');\n\t\tjQuery('#caAdvancedSearch').find('select').prop('selectedIndex', 0);\n\t\treturn false;\n\t});\n\tjQuery(document).ready(function() {\n\t\tvar f, defaultValues = " . json_encode($va_default_form_values) . ", defaultBooleans = " . json_encode($va_default_form_booleans) . ";\n\t\tfor (f in defaultValues) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('input[name=\"' + f_proc+ '\"], textarea[name=\"' + f_proc+ '\"], select[name=\"' + f_proc+ '\"]').each(function(k, v) {\n\t\t\t\tif (defaultValues[f][k]) { jQuery(v).val(defaultValues[f][k]); } \n\t\t\t});\n\t\t}\n\t\tfor (f in defaultBooleans) {\n\t\t\tvar f_proc = f + '[]';\n\t\t\tjQuery('select[name=\"' + f_proc+ '\"].caAdvancedSearchBoolean').each(function(k, v) {\n\t\t\t\tif (defaultBooleans[f][k]) { jQuery(v).val(defaultBooleans[f][k]); }\n\t\t\t});\n\t\t}\n\t});\n</script>\n";
                 break;
             default:
                 if (preg_match("!^(.*):label\$!", $vs_tag_proc, $va_matches)) {
                     $this->view->setVar($vs_tag, $vs_tag_val = $t_subject->getDisplayLabel($va_matches[1]));
                 } elseif (preg_match("!^(.*):boolean\$!", $vs_tag_proc, $va_matches)) {
                     $this->view->setVar($vs_tag, caHTMLSelect($vs_tag_proc . '[]', array(_t('AND') => 'AND', _t('OR') => 'OR', 'AND NOT' => 'AND NOT'), array('class' => 'caAdvancedSearchBoolean')));
                 } else {
                     $va_opts['asArrayElement'] = true;
                     if (isset($va_opts['restrictToTypes']) && $va_opts['restrictToTypes'] && !is_array($va_opts['restrictToTypes'])) {
                         $va_opts['restrictToTypes'] = explode(";", $va_opts['restrictToTypes']);
                     }
                     if ($vs_tag_val = $t_subject->htmlFormElementForSearch($this->request, $vs_tag_proc, $va_opts)) {
                         $this->view->setVar($vs_tag, $vs_tag_val);
                     }
                     $va_tmp = explode('.', $vs_tag_proc);
                     if (($t_element = ca_metadata_elements::getInstance($va_tmp[1])) && $t_element->get('datatype') == 0) {
                         if (is_array($va_elements = $t_element->getElementsInSet())) {
                             foreach ($va_elements as $va_element) {
                                 if ($va_element['datatype'] > 0) {
                                     $va_form_elements[] = $va_tmp[0] . '.' . $va_tmp[1] . '.' . $va_element['element_code'];
                                 }
                             }
                         }
                         break;
                     }
                 }
                 if ($vs_tag_val) {
                     $va_form_elements[] = $vs_tag_proc;
                 }
                 break;
         }
     }
     $this->view->setVar("form", caFormTag($this->request, "{$ps_function}", 'caAdvancedSearch', null, 'post', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true, 'submitOnReturn' => true)));
     $this->view->setVar("/form", $vs_script . caHTMLHiddenInput("_advancedFormName", array("value" => $ps_function)) . caHTMLHiddenInput("_formElements", array("value" => join(';', $va_form_elements))) . caHTMLHiddenInput("_advanced", array("value" => 1)) . "</form>");
     $this->render($va_search_info['view']);
 }
コード例 #21
0
<?php

MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": Partners and Support");
?>
<div class="container containerTextPadding">
	<div class="row">
		<div class="col-sm-12">
			<H1><?php 
print _t("Partners and Support");
?>
</H1>
		</div>
	</div>
	<div class="row partnersSupportLogoRow">
		<div class="col-sm-12 text-left">
			<H2>Support Provided By</H2>
			<div style="float:left;">
				<a href="http://www.iucn.org/" target="_blank"><?php 
print caGetThemeGraphic($this->request, 'logo_IUCN_WCPA.jpg');
?>
</a>
			</div>
			<div style="text-align:right;">
				<a href="http://www.biopama.org/" target="_blank"><?php 
print caGetThemeGraphic($this->request, 'logo_BIOPAMA.jpg', array("style" => "margin:15px 0px 25px 0px;"));
?>
</a>
				<div>
					BIOPAMA is implemented by:<br/>
					<?php 
print caGetThemeGraphic($this->request, 'logo_biopama_initiative.jpg', array("style" => "margin:0px 0px 5px 0px;"));
コード例 #22
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;
     }
 }
コード例 #23
0
 /**
  * Initializes editor view with core set of values, loads model with record to be edited and selects user interface to use.
  *
  * @param $pa_options Array of options. Supported options are:
  *		ui = The ui_id or editor_code value for the user interface to use. If omitted the default user interface is used.
  */
 protected function _initView($pa_options = null)
 {
     // load required javascript
     AssetLoadManager::register('bundleableEditor');
     AssetLoadManager::register('imageScroller');
     AssetLoadManager::register('datePickerUI');
     $t_subject = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name);
     $vn_subject_id = $this->request->getParameter($t_subject->primaryKey(), pInteger);
     if (!$vn_subject_id || !$t_subject->load($vn_subject_id)) {
         // empty (ie. new) rows don't have a type_id set, which means we'll have no idea which attributes to display
         // so we get the type_id off of the request
         if (!($vn_type_id = $this->request->getParameter($t_subject->getTypeFieldName(), pInteger))) {
             $vn_type_id = null;
         }
         // then set the empty row's type_id
         $t_subject->set($t_subject->getTypeFieldName(), $vn_type_id);
         // then reload the definitions (which includes bundle specs)
         $t_subject->reloadLabelDefinitions();
     } else {
         $vn_type_id = $t_subject->getTypeID();
     }
     $t_ui = $this->_getUI($vn_type_id, $pa_options);
     $this->view->setVar($t_subject->primaryKey(), $vn_subject_id);
     $this->view->setVar('subject_id', $vn_subject_id);
     $this->view->setVar('t_subject', $t_subject);
     MetaTagManager::setWindowTitle(_t("Editing %1 : %2", ($vs_type = $t_subject->getTypeName()) ? $vs_type : $t_subject->getProperty('NAME_SINGULAR'), $vn_subject_id ? $t_subject->getLabelForDisplay(true) : _t('new %1', $t_subject->getTypeName())));
     if ($vs_parent_id_fld = $t_subject->getProperty('HIERARCHY_PARENT_ID_FLD')) {
         $this->view->setVar('parent_id', $vn_parent_id = $this->request->getParameter($vs_parent_id_fld, pInteger));
         // The "above_id" is set when the new record we're creating is to be inserted *above* an existing record (eg. made
         // the parent of another record). It will be set to the record we're inserting above. We ignore it if set when editing
         // an existing record since it is only relevant for newly created records.
         if (!$vn_subject_id) {
             $this->view->setVar('above_id', $vn_above_id = $this->request->getParameter('above_id', pInteger));
             $t_subject->set($vs_parent_id_fld, $vn_parent_id);
             $t_parent = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name);
             if ($t_parent->load($vn_parent_id) && ($t_parent->get('parent_id') || $t_parent->getHierarchyType() == __CA_HIER_TYPE_ADHOC_MONO__) && (!method_exists($t_parent, "getIDNoPlugInInstance") || !($o_numbering_plugin = $t_parent->getIDNoPlugInInstance()) || $o_numbering_plugin->formatHas('FREE', 0))) {
                 $t_subject->set('idno', $t_parent->get('idno'));
             }
         }
         return array($vn_subject_id, $t_subject, $t_ui, $vn_parent_id, $vn_above_id);
     }
     return array($vn_subject_id, $t_subject, $t_ui);
 }
コード例 #24
0
 public function Index($pa_options = null)
 {
     $po_search = isset($pa_options['search']) && $pa_options['search'] ? $pa_options['search'] : null;
     parent::Index($pa_options);
     AssetLoadManager::register('browsable');
     // need this to support browse panel when filtering/refining search results
     $t_model = $this->opo_datamodel->getTableInstance($this->ops_tablename, true);
     // Get elements of result context
     $vn_page_num = $this->opo_result_context->getCurrentResultsPageNumber();
     $vs_search = $this->opo_result_context->getSearchExpression();
     if (!($vn_items_per_page = $this->opo_result_context->getItemsPerPage())) {
         $vn_items_per_page = $this->opa_items_per_page[0];
     }
     if (!($vs_view = $this->opo_result_context->getCurrentView())) {
         $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();
     $vn_display_id = $this->opo_result_context->getCurrentBundleDisplay();
     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 advanced search', $this->searchName('plural')));
     $t_form = new ca_search_forms();
     if (!($vn_form_id = isset($pa_options['form_id']) ? $pa_options['form_id'] : null)) {
         if (!($vn_form_id = $this->opo_result_context->getParameter('form_id'))) {
             if (sizeof($va_forms = $t_form->getForms(array('table' => $this->ops_tablename, 'user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_READ_ACCESS__)))) {
                 $va_tmp = array_keys($va_forms);
                 $vn_form_id = array_shift($va_tmp);
             }
         }
     }
     $t_form->load($vn_form_id);
     $this->view->setVar('t_form', $t_form);
     $this->view->setVar('form_id', $vn_form_id);
     if ($pa_options['appendToSearch']) {
         $vs_append_to_search .= " AND (" . $pa_options['appendToSearch'] . ")";
     }
     //
     // Execute the search
     //
     if (isset($pa_options['saved_search']) && $pa_options['saved_search']) {
         // Is this a saved search? If so, reused the canned params
         $va_form_data = $pa_options['saved_search'];
         foreach ($pa_options['saved_search'] as $vs_fld => $vs_val) {
             $vs_proc_fld = str_replace(".", "_", $vs_fld);
             $va_proc_form_data[$vs_proc_fld] = $vs_val;
         }
         $vs_search = $t_form->getLuceneQueryStringForHTMLFormInput($va_proc_form_data);
         $vb_is_new_search = true;
     } else {
         if (!($vs_search = $t_form->getLuceneQueryStringForHTMLFormInput($_REQUEST))) {
             // try to get search off of request
             $vs_search = $this->opo_result_context->getSearchExpression();
             // get the search out of the result context
             $va_form_data = $this->opo_result_context->getParameter('form_data');
             $vb_is_new_search = !$this->opo_result_context->cacheIsValid();
         } else {
             $va_form_data = $t_form->extractFormValuesFromArray($_REQUEST);
             // ah ok, its an incoming request, so get the form values out for interpretation/processing/whatever
             $vb_is_new_search = true;
         }
     }
     if ($this->request->getParameter('reset', pString) == 'clear') {
         $vs_search = '';
         $vb_is_new_search = true;
     }
     if ($vs_search && $vs_search != "") {
         /* any request? */
         $va_search_opts = array('sort' => $vs_sort, 'sort_direction' => $vs_sort_direction, 'appendToSearch' => $vs_append_to_search, 'getCountsByField' => 'type_id', 'checkAccess' => $va_access_values, 'no_cache' => $vb_is_new_search);
         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);
             $this->opo_browse = $po_search = new $vs_browse_classname();
             $po_search->addCriteria('_search', $vs_search);
         }
         if ($this->opn_type_restriction_id) {
             $po_search->setTypeRestrictions(array($this->opn_type_restriction_id));
         }
         $vb_criteria_have_changed = false;
         if (is_subclass_of($po_search, "BrowseEngine")) {
             $vb_criteria_have_changed = $po_search->criteriaHaveChanged();
             $po_search->execute($va_search_opts);
             $this->opo_result_context->setParameter('browse_id', $po_search->getBrowseID());
             $vo_result = $po_search->getResults($va_search_opts);
         } else {
             $vo_result = $po_search->search($vs_search, $va_search_opts);
         }
         $this->opo_result_context->validateCache();
         // Only prefetch what we need
         $vo_result->setOption('prefetch', $vn_items_per_page);
         $this->opo_result_context->setParameter('form_data', $va_form_data);
         $this->opo_result_context->setSearchExpression($vs_search);
         if ($vb_is_new_search || $vb_criteria_have_changed) {
             $this->opo_result_context->setResultList($vo_result->getPrimaryKeyValues());
             $vn_page_num = 1;
         }
         $vo_result->seek(($vn_page_num - 1) * $vn_items_per_page);
         $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;
         }
         $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->getTableInstance($this->ops_tablename);
     $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('browse', $po_search);
     switch ($pa_options['output_format']) {
         # ------------------------------------
         case 'PDF':
             $this->_genPDF($vo_result, $this->request->getParameter("label_form", pString), $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());
             }
             // Call advanced search form generator directly to set view vars in the current view
             // This lets our view in this action render Search/search_advanced_form_html.php directly
             // to avoid the annoying flicker that occurs if we load the initial search form via AJAX
             $this->getAdvancedSearchForm(false);
             $this->opo_result_context->setAsLastFind();
             $this->opo_result_context->saveContext();
             $this->render('Search/' . $this->ops_tablename . '_search_advanced_html.php');
             break;
             # ------------------------------------
     }
 }
コード例 #25
0
ファイル: About.php プロジェクト: kai-iak/pawtucket2
<?php

MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": Body of Knowledge");
# --- do a occurrece search to get all the competences
$o_search = caGetSearchInstance("ca_occurrences");
$t_lists = new ca_lists();
$vn_category_type_id = $t_lists->getItemIDFromList("occurrence_types", "category");
$qr_res = $o_search->search('type_id:' . $vn_category_type_id, $va_options['sort'] = "ca_occurrences.preferred_labels.name");
$va_all_competences = array();
$va_competences_by_area = array();
if ($qr_res->numHits()) {
    while ($qr_res->nextHit()) {
        $va_all_competences[$qr_res->get("ca_occurrences.occurrence_id")] = array("idno" => $qr_res->get("ca_occurrences.idno"), "label" => strtolower($qr_res->get("ca_occurrences.preferred_labels.name")));
        $va_competences_by_area[str_replace(" Pa ", " PA ", ucwords(strtolower($qr_res->get("ca_occurrences.area", array("convertCodesToDisplayText" => true)))))][$qr_res->get("ca_occurrences.occurrence_id")] = array("idno" => $qr_res->get("ca_occurrences.idno"), "label" => strtolower($qr_res->get("ca_occurrences.preferred_labels.name")));
    }
}
if (sizeof($va_competences_by_area)) {
    ?>
	<div class="container containerTextPadding" id="comp_nav">
		<div class="row">
			<div class="col-sm-12">
				<H2>Choose a competence category to explore:</H2>
<?php 
    if ($this->request->config->get("onlyLinkTrpCategory")) {
        ?>
				<H5 class="indent red"><i>* Content currently under development.  Please use the competence category TRP (Tourism, Recreation, and Public Use) to explore how the Body of Knowledge works.</i></H5>
<?php 
    }
    ?>
			
			</div>
コード例 #26
0
ファイル: Index.php プロジェクト: kai-iak/pawtucket2
<?php

MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": About");
?>
<H1><?php 
print _t("About");
?>
</H1>
<div class="row">
	<div class="col-sm-6 col-md-6">
		<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris dolor purus, facilisis vitae orci at, egestas iaculis turpis. Aliquam ut vestibulum tellus. Nam nec nisi tellus. Phasellus imperdiet risus pulvinar, varius justo sed, egestas turpis. Integer porta tempus lobortis. Ut luctus ac est nec sagittis. Nam aliquam vel ante at blandit. Phasellus neque massa, vulputate a mattis eu, blandit convallis tellus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut dignissim dui quam. Duis interdum mauris eget augue scelerisque elementum. Etiam condimentum nibh eget mi rutrum condimentum. Maecenas et cursus urna, quis sollicitudin libero. Donec sit amet augue suscipit, ultricies dolor quis, aliquam magna. Nunc ut hendrerit odio, vitae rutrum sapien.</p>
		<p>Maecenas nec erat cursus, egestas velit pulvinar, ultrices libero. Vivamus viverra sapien risus, et tincidunt ipsum ultrices et. In malesuada, tellus sit amet interdum tincidunt, massa sem laoreet nulla, ac mollis lorem lacus sit amet ipsum. Nullam vel quam leo. Ut et tincidunt nunc. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nam vel rutrum tortor, sit amet bibendum augue. Nullam nisi leo, imperdiet et feugiat vitae, malesuada nec risus. Cras adipiscing molestie ultrices. Sed quis purus sollicitudin, accumsan nisi in, eleifend mauris. Aliquam erat volutpat.</p>
	</div>
	<div class="col-sm-6 col-md-6">
		<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris dolor purus, facilisis vitae orci at, egestas iaculis turpis. Aliquam ut vestibulum tellus. Nam nec nisi tellus. Phasellus imperdiet risus pulvinar, varius justo sed, egestas turpis. Integer porta tempus lobortis. Ut luctus ac est nec sagittis. Nam aliquam vel ante at blandit. Phasellus neque massa, vulputate a mattis eu, blandit convallis tellus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut dignissim dui quam. Duis interdum mauris eget augue scelerisque elementum. Etiam condimentum nibh eget mi rutrum condimentum. Maecenas et cursus urna, quis sollicitudin libero. Donec sit amet augue suscipit, ultricies dolor quis, aliquam magna. Nunc ut hendrerit odio, vitae rutrum sapien.</p>
		<p>Maecenas nec erat cursus, egestas velit pulvinar, ultrices libero. Vivamus viverra sapien risus, et tincidunt ipsum ultrices et. In malesuada, tellus sit amet interdum tincidunt, massa sem laoreet nulla, ac mollis lorem lacus sit amet ipsum. Nullam vel quam leo. Ut et tincidunt nunc. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nam vel rutrum tortor, sit amet bibendum augue. Nullam nisi leo, imperdiet et feugiat vitae, malesuada nec risus. Cras adipiscing molestie ultrices. Sed quis purus sollicitudin, accumsan nisi in, eleifend mauris. Aliquam erat volutpat.</p>
	</div>
</div>
コード例 #27
0
 /**
  * Initializes editor view with core set of values, loads model with record to be edited and selects user interface to use.
  *
  * @param $pa_options Array of options. Supported options are:
  *		ui = The ui_id or editor_code value for the user interface to use. If omitted the default user interface is used.
  */
 protected function _initView($pa_options = null)
 {
     // load required javascript
     AssetLoadManager::register('bundleableEditor');
     AssetLoadManager::register('imageScroller');
     AssetLoadManager::register('datePickerUI');
     $t_ui = new ca_editor_uis();
     if (!isset($pa_options['ui']) && !$pa_options['ui']) {
         $pa_options['ui'] = $this->request->user->getPreference("batch_ca_object_media_import_ui");
     }
     if (isset($pa_options['ui']) && $pa_options['ui']) {
         if (is_numeric($pa_options['ui'])) {
             $t_ui->load((int) $pa_options['ui']);
         }
         if (!$t_ui->getPrimaryKey()) {
             $t_ui->load(array('editor_code' => $pa_options['ui']));
         }
     }
     if (!$t_ui->getPrimaryKey()) {
         $t_ui = ca_editor_uis::loadDefaultUI('ca_objects', $this->request, null);
     }
     MetaTagManager::setWindowTitle(_t("Batch import media"));
     return array($t_ui);
 }