public function Edit($pa_values = null, $pa_options = null) { $o_result_context = new ResultContext($this->request, 'ca_relationship_types', 'basic_search'); $va_cur_result = $o_result_context->getResultList(); $vn_id = $this->request->getParameter('type_id', pInteger); $vn_parent_id = $this->request->getParameter('parent_id', pInteger); // If we're creating a new record we'll need to establish the table_num // from the parent (there's always a parent) if (!$vn_id) { $t_parent = new ca_relationship_types($vn_parent_id); if (!$t_parent->getPrimaryKey()) { $this->postError(1230, _t("Invalid parent"), "RelationshipTypeEditorController->Edit()"); return; } $this->request->setParameter('table_num', $t_parent->get('table_num')); } if (!is_array($va_cur_result) || !in_array($vn_id, $va_cur_result)) { // // Set "results list" navigation to all types in the same level as the currently selected type // $t_instance = new ca_relationship_types(); if (is_array($va_siblings = $t_instance->getHierarchySiblings($this->request->getParameter('type_id', pInteger), array('idsOnly' => true)))) { $o_result_context->setResultList($va_siblings); $o_result_context->saveContext(); } } parent::Edit(); }
public function dispatchLoopShutdown() { // // Force output to be sent - we need the client to have the page before // we start flushing progress bar updates // $app = AppController::getInstance(); $req = $app->getRequest(); $resp = $app->getResponse(); $resp->sendResponse(); $resp->clearContent(); // // Do export // if (!$req->isLoggedIn()) { return; } set_time_limit(3600 * 24); // if it takes more than 24 hours we're in trouble $vn_id = $req->getParameter('exporter_id', pInteger); $t_exporter = new ca_data_exporters($vn_id); $vs_file = tempnam(__CA_APP_DIR__ . DIRECTORY_SEPARATOR . 'tmp', 'dataExport'); // we have 3 different sources for batch exports: search/browse result, sets and search expressions (deprecated) // they all operate on different parameters and on different static functions in ca_data_exporters if ($req->getParameter('caIsExportFromSearchOrBrowseResult', pInteger)) { // batch export from search or browse result $vs_find_type = $req->getParameter('find_type', pString); $vo_result_context = new ResultContext($req, $t_exporter->getTargetTableName(), $vs_find_type); $t_instance = $t_exporter->getTargetTableInstance(); $o_result = $t_instance->makeSearchResult($t_instance->tableName(), $vo_result_context->getResultList()); ca_data_exporters::exportRecordsFromSearchResult($t_exporter->get('exporter_code'), $o_result, $vs_file, array('request' => $req, 'progressCallback' => 'caIncrementBatchMetadataExportProgress')); } else { if ($vn_set_id = $req->getParameter('set_id', pInteger)) { // batch export from set ca_data_exporters::exportRecordsFromSet($t_exporter->get('exporter_code'), $vn_set_id, $vs_file, array('request' => $req, 'progressCallback' => 'caIncrementBatchMetadataExportProgress')); } else { // batch export from search expression (deprecated) $vs_search = $req->getParameter('search', pString); ca_data_exporters::exportRecordsFromSearchExpression($t_exporter->get('exporter_code'), $vs_search, $vs_file, array('request' => $req, 'progressCallback' => 'caIncrementBatchMetadataExportProgress')); } } // export done, record it in session for later usage in download/destination action if (filesize($vs_file)) { $o_session = $req->getSession(); $o_session->setVar('export_file', $vs_file); $o_session->setVar('export_content_type', $t_exporter->getContentType()); $o_session->setVar('exporter_id', $t_exporter->getPrimaryKey()); caExportAddDownloadLink($req); } }
public function Edit() { $o_result_context = new ResultContext($this->request, 'ca_tour_stops', 'basic_search'); $va_cur_result = $o_result_context->getResultList(); $vn_id = $this->request->getParameter('stop_id', pInteger); if (is_array($va_cur_result) && !in_array($vn_id, $va_cur_result)) { // // Set "results list" navigation to all items in the same level as the currently selected item // $t_instance = new ca_list_items(); if (is_array($va_siblings = $t_instance->getHierarchySiblings($vn_id, array('idsOnly' => true)))) { $o_result_context->setResultList($va_siblings); $o_result_context->saveContext(); } } parent::Edit(); }
public function Edit() { $o_result_context = new ResultContext($this->request, 'ca_user_groups', 'basic_search'); $o_result_context->setAsLastFind(); if (!($t_group = $this->getGroupObject())) { $this->notification->addNotification(_t("You cannot edit this group"), __NOTIFICATION_TYPE_ERROR__); $this->render('group_list_html.php'); return; } if (!is_array($va_result_list = $o_result_context->getResultList())) { $va_result_list = array(); } if (!in_array($t_group->getPrimaryKey(), $va_result_list)) { $va_groups = $t_group->getGroupList('name', 'asc', $this->request->user->getUserID()); $o_result_context->setResultList(is_array($va_groups) ? array_keys($va_groups) : array()); } $o_result_context->saveContext(); $this->render('group_edit_html.php'); }