本文整理汇总了PHP中ResultContext类的典型用法代码示例。如果您正苦于以下问题:PHP ResultContext类的具体用法?PHP ResultContext怎么用?PHP ResultContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ResultContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Edit
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();
}
示例2: ListForms
public function ListForms()
{
AssetLoadManager::register('tableList');
$t_form = new ca_search_forms();
$this->view->setVar('t_form', $t_form);
$this->view->setVar('form_list', $va_forms = caExtractValuesByUserLocale($t_form->getForms(array('user_id' => $this->request->getUserID(), 'access' => __CA_SEARCH_FORM_EDIT_ACCESS__)), null, null, array()));
$o_result_context = new ResultContext($this->request, 'ca_search_forms', 'basic_search');
$o_result_context->setAsLastFind();
$o_result_context->setResultList(is_array($va_forms) ? array_keys($va_forms) : array());
$o_result_context->saveContext();
$this->view->setVar('table_list', caFilterTableList($t_form->getFieldInfo('table_num', 'BOUNDS_CHOICE_LIST')));
$this->render('search_form_list_html.php');
}
示例3: ListDisplays
public function ListDisplays()
{
AssetLoadManager::register('tableList');
$t_display = new ca_bundle_displays();
$this->view->setVar('t_display', $t_display);
$this->view->setVar('display_list', $va_displays = caExtractValuesByUserLocale($t_display->getBundleDisplays(array('user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_EDIT_ACCESS__)), null, null, array()));
$o_result_context = new ResultContext($this->request, 'ca_bundle_displays', 'basic_search');
$o_result_context->setAsLastFind();
$o_result_context->setResultList(is_array($va_displays) ? array_keys($va_displays) : array());
$o_result_context->saveContext();
$this->view->setVar('table_list', caFilterTableList($t_display->getFieldInfo('table_num', 'BOUNDS_CHOICE_LIST')));
$this->render('bundle_display_list_html.php');
}
示例4: Index
public function Index()
{
AssetLoadManager::register('tableList');
$vo_dm = Datamodel::load();
$va_elements = ca_metadata_elements::getRootElementsAsList(null, null, true, true);
$this->view->setVar('element_list', $va_elements);
$this->view->setVar('attribute_types', Attribute::getAttributeTypes());
$o_result_context = new ResultContext($this->request, $this->ops_table_name, 'basic_search');
$o_result_context->setResultList(array_keys($va_elements));
$o_result_context->setAsLastFind();
$o_result_context->saveContext();
return $this->render('elements_list_html.php');
}
示例5: dispatchLoopShutdown
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);
}
}
示例6: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
$this->opa_views = array('list' => _t('list'), 'editable' => _t('editable'));
$this->opa_sorts = array_merge(array('_natural' => _t('relevance'), 'ca_list_item_labels.name_singular' => _t('name'), 'ca_list_items.idno_sort' => _t('idno')), $this->opa_sorts);
$this->opo_browse = new ListItemBrowse($this->opo_result_context->getParameter('browse_id'), 'providence');
//
// We need to set the same "last find" for ca_lists as well as ca_list_items; here we set
// it for ca_lists... ca_list_items is taken care of automatically by BaseFindController
// because $this->ops_tablename is set to ca_list_items
//
$o_ca_lists_result_context = new ResultContext($po_request, 'ca_lists', $this->ops_find_type);
$o_ca_lists_result_context->setAsLastFind();
$o_ca_lists_result_context->saveContext();
}
示例7: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
$this->ops_theme = __CA_THEME__;
// get current theme
if (!is_dir(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')) {
// if theme is not defined for this plugin, try to use "default" theme
$this->ops_theme = 'default';
}
parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views'));
MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/eastend/themes/" . $this->ops_theme . "/css/eastend.css", 'text/css');
$this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/eastend/conf/eastend.conf');
if (!(bool) $this->opo_plugin_config->get('enabled')) {
die(_t('eastend plugin is not enabled'));
}
// redirect user if not logged in
if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) {
$this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form"));
}
if ($this->request->config->get("dont_enforce_access_settings")) {
$this->opa_access_values = array();
} else {
$this->opa_access_values = caGetUserAccessValues($this->request);
}
$this->view->setVar('access_values', $va_access_values);
$this->opo_result_context = new ResultContext($po_request, 'ca_objects', ResultContext::getLastFind($po_request, 'ca_objects'));
JavascriptLoadManager::register('cycle');
}
示例8: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
}
示例9: Edit
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();
}
示例10: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
JavascriptLoadManager::register('bundleListEditorUI');
JavascriptLoadManager::register('panel');
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
}
示例11: convertResults
/**
* 将结果集转为前端的模式
* @param ResultContext $resContext
*/
function convertResults($resContext)
{
$ret = array();
$resArr = $resContext->getResArr();
foreach ($resArr as $record) {
$item = array();
$record = $record->getRecord();
$item['type'] = $record['type'];
$item['node_path'] = $record['node_path'];
$item['var_path'] = $record['var_path'];
//整理node代码
$node = $record['node'];
$node_item = array();
if ($node instanceof Symbol) {
$node_start = $node->getValue()->getAttribute('startLine');
$node_end = $node->getValue()->getAttribute('endLine');
} else {
$node_start = $node->getAttribute('startLine');
$node_end = $node->getAttribute('endLine');
}
$node_item['line'] = $node_start . "|" . $node_end;
$node_item['code'] = FileUtils::getCodeByLine($record['node_path'], $node_start, $node_end);
$item['node'] = $node_item;
//整理var代码
$var = $record['var'];
$var_item = array();
if ($var instanceof Symbol) {
$var_start = $var->getValue()->getAttribute('startLine');
$var_end = $var->getValue()->getAttribute('endLine');
} elseif (is_string($var)) {
$var_start = $node_start;
$var_end = $node_end;
} else {
$var_start = $var->getAttribute('startLine');
$var_end = $var->getAttribute('endLine');
}
$var_item['line'] = $var_start . "|" . $var_end;
$var_item['code'] = FileUtils::getCodeByLine($record['var_path'], $var_start, $var_end);
$item['var'] = $var_item;
array_push($ret, $item);
}
return $ret;
}
示例12: _initView
protected function _initView($pa_options = null)
{
AssetLoadManager::register('bundleableEditor');
AssetLoadManager::register('sortableUI');
AssetLoadManager::register('bundleListEditorUI');
if ($vn_rc = parent::_initView()) {
$t_screen = $this->view->getVar('t_subject');
$this->opn_ui_id = $t_screen->get('ui_id');
$t_ui = new ca_editor_uis($this->opn_ui_id);
$va_screens = $t_ui->getScreens(null, array('showAll' => true));
if (is_array($va_screens)) {
$o_result_context = new ResultContext($this->request, 'ca_editor_ui_screens', 'basic_search');
$o_result_context->setResultList(array_keys($va_screens));
$o_result_context->setAsLastFind();
$o_result_context->saveContext();
}
}
return $vn_rc;
}
示例13: ListUIs
/**
*
*/
public function ListUIs()
{
AssetLoadManager::register('tableList');
$this->checkConfiguration();
$vo_dm = Datamodel::load();
$va_uis = ca_editor_uis::getUIList(null);
foreach ($va_uis as $vs_key => $va_ui) {
if (!($t_instance = $vo_dm->getInstanceByTableNum($va_ui['editor_type'], true))) {
continue;
}
$va_uis[$vs_key]['editor_type'] = $t_instance->getProperty('NAME_PLURAL');
}
$this->view->setVar('editor_ui_list', $va_uis);
$o_result_context = new ResultContext($this->request, $this->ops_table_name, 'basic_search');
$o_result_context->setResultList(array_keys($va_uis));
$o_result_context->setAsLastFind();
$o_result_context->saveContext();
$t_ui = new ca_editor_uis();
$this->view->setVar('table_list', caFilterTableList($t_ui->getFieldInfo('editor_type', 'BOUNDS_CHOICE_LIST')));
return $this->render('ui_list_html.php');
}
示例14: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
if (!$po_request->user->canDoAction('can_batch_import_metadata')) {
$po_response->setRedirect($po_request->config->get('error_display_url') . '/n/3400?r=' . urlencode($po_request->getFullUrlPath()));
return;
}
AssetLoadManager::register('bundleableEditor');
AssetLoadManager::register('panel');
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
}
示例15: __construct
public function __construct(&$po_request, &$po_response, $pa_view_paths = null)
{
parent::__construct($po_request, $po_response, $pa_view_paths);
// Can user batch import media?
if (!$po_request->user->canDoAction('can_batch_import_media')) {
$po_response->setRedirect($po_request->config->get('error_display_url') . '/n/3410?r=' . urlencode($po_request->getFullUrlPath()));
return;
}
AssetLoadManager::register('bundleableEditor');
AssetLoadManager::register('panel');
$this->opo_datamodel = Datamodel::load();
$this->opo_app_plugin_manager = new ApplicationPluginManager();
$this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name));
$this->opa_importable_tables = array(caGetTableDisplayName('ca_objects') => 'ca_objects', caGetTableDisplayName('ca_entities') => 'ca_entities', caGetTableDisplayName('ca_places') => 'ca_places', caGetTableDisplayName('ca_collections') => 'ca_collections', caGetTableDisplayName('ca_occurrences') => 'ca_occurrences', caGetTableDisplayName('ca_storage_locations') => 'ca_storage_locations', caGetTableDisplayName('ca_object_lots') => 'ca_object_lots', caGetTableDisplayName('ca_movements') => 'ca_movements', caGetTableDisplayName('ca_loans') => 'ca_loans');
foreach ($this->opa_importable_tables as $vs_key => $vs_table) {
if ($this->getRequest()->getAppConfig()->get($vs_table . '_disable')) {
unset($this->opa_importable_tables[$vs_key]);
}
}
}