Пример #1
0
 /**
  * 
  */
 public function Info()
 {
     $t_set = new ca_sets($vn_set_id = $this->request->getParameter('set_id', pInteger));
     $vn_user_id = !(bool) $this->request->config->get('ca_sets_all_users_see_all_sets') ? $this->request->getUserID() : null;
     $va_set_stats = array('mine' => caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $this->request->getUserID(), 'access' => __CA_SET_EDIT_ACCESS__)), null, null, array()));
     if ($this->request->user->canDoAction('is_administrator') || $this->request->user->canDoAction('can_administrate_sets')) {
         $va_set_stats['user'] = caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $vn_user_id, 'allUsers' => true)), null, null, array());
         $va_set_stats['public'] = caExtractValuesByUserLocale($t_set->getSets(array('user_id' => $vn_user_id, 'publicUsers' => true)), null, null, array());
     }
     $o_result_context = new ResultContext($this->request, 'ca_sets', 'basic_search');
     $pn_mode = (int) $o_result_context->getParameter('set_display_mode');
     $this->view->setVar('mode', $pn_mode);
     $this->view->setVar('sets', $va_set_stats);
     return $this->render('widget_set_info_html.php', true);
 }
 public function Index()
 {
     AssetLoadManager::register('bundleableEditor');
     $t_comm = new ca_commerce_communications();
     $t_user = new ca_users();
     $o_result_context = new ResultContext($this->request, 'ca_commerce_communications', 'basic_search_library');
     $va_options = array();
     $o_db = new Db();
     // filtering options
     foreach (array('created_on' => 'string', 'search' => 'string', 'user_id' => 'int', 'read_status' => 'string') as $vs_f => $vs_type) {
         if (array_key_exists($vs_f, $_REQUEST)) {
             $vm_v = $this->request->getParameter($vs_f, pString);
             $o_result_context->setParameter('caClientCommunicationList_' . $vs_f, $vm_v);
         } else {
             $vm_v = $o_result_context->getParameter('caClientCommunicationList_' . $vs_f);
         }
         switch ($vs_type) {
             case 'int':
                 if (strlen($vm_v)) {
                     $vm_v = (int) $vm_v;
                 }
                 break;
         }
         if ($vs_f == 'read_status') {
             $va_options[$vs_f] = $vm_v;
             switch ($vm_v) {
                 case 'read':
                     $vs_f = 'readOnly';
                     $vm_v = true;
                     break;
                 case 'unread':
                     $vs_f = 'unreadOnly';
                     $vm_v = true;
                     break;
                 default:
                     break;
             }
         }
         if ($vs_f == 'user_id') {
             if (!$this->request->getParameter('client_user_id_autocomplete', pString)) {
                 continue;
             }
             $o_search = new UserSearch();
             $va_labels = caProcessRelationshipLookupLabel($o_search->search("ca_users.user_id:{$vm_v}"), $t_user, array('stripTags' => true));
             if (sizeof($va_labels)) {
                 $va_label = array_pop($va_labels);
                 $va_options['_user_id_display'] = $va_label['label'];
             }
         }
         if ($vs_f != 'search') {
             $t_comm->set($vs_f, $vm_v);
         }
         $va_options[$vs_f] = $vm_v;
     }
     if ($pn_transaction_id = $this->request->getParameter('transaction_id', pInteger)) {
         // if set load messages for this transaction
         $va_options['transaction_id'] = $pn_transaction_id;
     }
     $this->view->setVar('t_communication', $t_comm);
     $this->view->setVar('filter_options', $va_options);
     $this->view->setVar('message_list', $t_comm->getMessages($this->request->getUserID(), $va_options));
     //$o_result_context->setResultList($va_order_ids);
     $o_result_context->setAsLastFind();
     $o_result_context->saveContext();
     $this->render('list_communications_html.php');
 }
Пример #3
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);
 }
Пример #4
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);
 }
 public function renderWidget($ps_widget_id, &$pa_settings)
 {
     parent::renderWidget($ps_widget_id, $pa_settings);
     $this->opo_view->setVar('request', $this->getRequest());
     $t_form = new ca_search_forms();
     if (!($vn_form_id = (int) $pa_settings["form_code"])) {
         $va_forms = caExtractValuesByUserLocale($t_form->getForms(array('table' => 'ca_objects', '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->opo_view->setVar("t_form", $t_form);
     if ($t_form->haveAccessToForm($this->getRequest()->user->getUserID(), __CA_SEARCH_FORM_READ_ACCESS__)) {
         $vo_dm = Datamodel::load();
         $vo_result_context = new ResultContext($this->getRequest(), $vo_dm->getTableName($t_form->get("table_num")), "advanced_search");
         $va_form_data = $vo_result_context->getParameter('form_data');
         $this->opo_view->setVar("controller_name", $this->getAdvancedSearchControllerNameForTable($vo_dm->getTableName($t_form->get("table_num"))));
         $this->opo_view->setVar('form_data', $va_form_data);
         $this->opo_view->setVar('form_elements', $t_form->getHTMLFormElements($this->getRequest(), $va_form_data));
     } else {
         $t_form->clear();
     }
     return $this->opo_view->render('main_html.php');
 }