예제 #1
0
 /**
  * Returns a Link to the results screen for the last find
  *
  * @param $po_request - the current request
  * @param $pm_table_name_or_num - the name or number of the table to get the last find operation for
  * @param $ps_content - the link content
  * @param $class - (optional) name of a CSS class to apply to the link
  * @param $pa_params - (optional) associative array of parameters to append onto the link URL
  * @param $pa_attributes - (optional) associative array of values to use as attributes in the key (keys are attribute names and values are attribute values)
  * @return string - an HTML link that will link back to the results for the last find operation
  */
 public static function getResultsLinkForLastFind($po_request, $pm_table_name_or_num, $ps_content, $ps_class = null, $pa_params = null, $pa_attributes = null)
 {
     if (!($vs_table_name = ResultContext::getTableName($pm_table_name_or_num))) {
         return null;
     }
     $vs_last_find = ResultContext::getLastFind($po_request, $pm_table_name_or_num);
     $va_tmp = explode('/', $vs_last_find);
     $o_find_navigation = Configuration::load(__CA_APP_DIR__ . '/conf/find_navigation.conf');
     $va_find_nav = $o_find_navigation->getAssoc($vs_table_name);
     $va_nav = $va_find_nav[$va_tmp[0]];
     if (!$va_nav) {
         return false;
     }
     if (__CA_APP_TYPE__ == 'PAWTUCKET') {
         // Pawtucket-specific navigation rewriting
         if (!(require_once __CA_APP_DIR__ . "/controllers/" . (trim($va_nav['module_path']) ? trim($va_nav['module_path']) . "/" : "") . $va_nav['controller'] . "Controller.php")) {
             return false;
         }
         $vs_controller_class = $va_nav['controller'] . "Controller";
         $va_nav = call_user_func_array("{$vs_controller_class}::" . $va_nav['action'], array($po_request, $vs_table_name));
         $o_storage = ResultContext::_persistentStorageInstance($po_request);
         if (!($vs_action = $o_storage->getVar('result_last_context_' . $vs_table_name . '_action'))) {
             $vs_action = $va_nav['action'];
         }
     } else {
         $vs_action = $va_nav['action'];
     }
     $va_params = array();
     if (is_array($va_nav['params'])) {
         $o_context = new ResultContext($po_request, $pm_table_name_or_num, $va_tmp[0], isset($va_tmp[1]) ? $va_tmp[1] : null);
         foreach ($va_nav['params'] as $vs_param) {
             if (!($vs_param = trim($vs_param))) {
                 continue;
             }
             if (!trim($va_params[$vs_param] = $po_request->getParameter($vs_param, pString))) {
                 $va_params[$vs_param] = trim($o_context->getParameter($vs_param));
             }
         }
         if (!is_array($pa_params)) {
             $pa_params = array();
         }
         $pa_params = array_merge($pa_params, $va_params);
     }
     return caNavLink($po_request, $ps_content, $ps_class, trim($va_nav['module_path']), trim($va_nav['controller']), trim($vs_action), $pa_params, $pa_attributes);
 }
예제 #2
0
 /**
  * Returns a Link to the results screen for the last find
  *
  * @param $po_request - the current request
  * @param $pm_table_name_or_num - the name or number of the table to get the last find operation for
  * @param $ps_content - the link content
  * @param $class - (optional) name of a CSS class to apply to the link
  * @param $pa_params - (optional) associative array of parameters to append onto the link URL
  * @param $pa_attributes - (optional) associative array of values to use as attributes in the key (keys are attribute names and values are attribute values)
  * @return string - an HTML link that will link back to the results for the last find operation
  */
 public static function getResultsLinkForLastFind($po_request, $pm_table_name_or_num, $ps_content, $ps_class = null, $pa_params = null, $pa_attributes = null)
 {
     if (!($vs_table_name = ResultContext::getTableName($pm_table_name_or_num))) {
         return null;
     }
     $vs_last_find = ResultContext::getLastFind($po_request, $pm_table_name_or_num);
     $o_find_navigation = Configuration::load($po_request->config->get('find_navigation'));
     $va_find_nav = $o_find_navigation->getAssoc($vs_table_name);
     $va_nav = $va_find_nav[$vs_last_find];
     if (!$va_nav) {
         return false;
     }
     $va_params = array();
     if (is_array($va_nav['params'])) {
         $o_context = new ResultContext($po_request, $pm_table_name_or_num, $vs_last_find);
         foreach ($va_nav['params'] as $vs_param) {
             if (!($vs_param = trim($vs_param))) {
                 continue;
             }
             if (!trim($va_params[$vs_param] = $po_request->getParameter($vs_param, pString))) {
                 $va_params[$vs_param] = trim($o_context->getParameter($vs_param));
             }
         }
         if (!is_array($pa_params)) {
             $pa_params = array();
         }
         $pa_params = array_merge($pa_params, $va_params);
     }
     return caNavLink($po_request, $ps_content, $ps_class, trim($va_nav['module_path']), trim($va_nav['controller']), trim($va_nav['action']), $pa_params, $pa_attributes);
 }