示例#1
0
 public function admin()
 {
     if ($this->is_back()) {
         if ($this->parent->get_type() == 'Base_Admin') {
             $this->parent->reset();
         } elseif (Base_BoxCommon::main_module_instance()->get_type() == $this->get_type()) {
             Base_BoxCommon::pop_main();
         }
         return;
     }
     Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     $gb = $this->init_module(Utils_GenericBrowser::module_name(), null, 'rb_custom');
     $gb->set_table_columns(array(array('name' => __('Table')), array('name' => __('Caption')), array('name' => __('Menu Entry'))));
     $tabs = DB::GetAll('SELECT * FROM recordbrowser_custom_recordsets ORDER BY tab ASC');
     foreach ($tabs as $t) {
         $gbr = $gb->get_new_row();
         if (!$t['active']) {
             $gbr->add_action($this->create_callback_href(array($this, 'set_active'), array($t['id'], true)), 'Activate', null, 'active-off');
         } else {
             $gbr->add_action($this->create_callback_href(array($this, 'set_active'), array($t['id'], false)), 'Deactivate', null, 'active-on');
         }
         $gbr->add_action($this->create_callback_href(array($this, 'edit_rset'), array($t['id'])), 'edit');
         $table_name = $t['tab'];
         $table_href = $this->create_callback_href(array($this, 'manage_recordset'), array($table_name));
         $gbr->add_data("<a {$table_href}>{$table_name}</a>", Utils_RecordBrowserCommon::get_caption($t['tab']), str_replace(Utils_RecordBrowser_CustomRecordsetsCommon::$sep, ' -> ', $t['menu']));
     }
     Base_ActionBarCommon::add('new', __('Create new'), $this->create_callback_href(array($this, 'edit_rset')));
     $this->display_module($gb);
 }
示例#2
0
 protected function call($function, $params, $serialize_response = true)
 {
     self::log($function, $params, $serialize_response);
     $post_data = $this->build_query_post_data($function, $params, $serialize_response);
     $try_times = 3;
     while ($try_times--) {
         try {
             if ($this->secure_connection() == false) {
                 Base_EssClientCommon::add_client_message_warning("Used unsecure connection!");
             }
             $response = $this->request_server($post_data, !$serialize_response);
             return $this->return_response_value_handling_user_messages($serialize_response, $response);
         } catch (SecureConnectionException $e) {
             if (!Base_EssClientCommon::is_no_ssl_allowed()) {
                 try {
                     $main = Base_BoxCommon::main_module_instance();
                     $disable_link_href = $main->create_callback_href(array('Base_BoxCommon', 'push_module'), array('Base_EssClient', 'no_ssl_settings'));
                     $disable_msg = "<br/>Or disable secure connection here: <a {$disable_link_href}>SSL settings</a>";
                 } catch (Exception $e) {
                     $disable_msg = "<br/>Or disable secure connection";
                 }
                 Base_EssClientCommon::add_client_message_error($e->getMessage() . $disable_msg);
             } else {
                 $this->disable_secure_connection();
                 continue;
             }
         } catch (ErrorException $e) {
             Base_EssClientCommon::add_client_message_error($e->getMessage());
             return null;
         }
     }
     if (!$try_times) {
         Base_EssClientCommon::add_client_message_error("Connection try limit exceeded");
     }
 }
示例#3
0
 private static function _display_payments_for_order($order_id)
 {
     $orders = Base_EssClientCommon::server()->orders_list();
     if (isset($orders[$order_id])) {
         $o = $orders[$order_id];
         $keys = array_keys($o['price']);
         $currency = reset($keys);
         $value = $o['price'][$currency]['to_pay'];
         $main_module = Base_BoxCommon::main_module_instance();
         $store = $main_module->init_module(Base_EpesiStore::module_name());
         $main_module->display_module($store, array($o['id'], $value, $currency), 'form_payment_frame');
         return true;
     }
     return "No such order to perform payment.";
 }