示例#1
0
 public function admin($store = false)
 {
     if (!Base_AclCommon::i_am_sa()) {
         return;
     }
     if ($this->is_back()) {
         $this->parent->reset();
         return;
     }
     if (!$store) {
         Base_ActionBarCommon::add('back', __('Back'), $this->create_back_href());
     }
     if (Base_EssClientCommon::is_no_ssl_allowed()) {
         Base_ActionBarCommon::add('settings', __('SSL settings'), $this->create_callback_href(array('Base_BoxCommon', 'push_module'), array('Base_EssClient', 'no_ssl_settings')));
     }
     if (Base_EssClientCommon::has_license_key() == false) {
         $this->terms_and_conditions();
         Base_EssClientCommon::server(true);
     }
     try {
         if (Base_EssClientCommon::has_license_key()) {
             $data = Base_EssClientCommon::server()->installation_registered_data();
             if ($data) {
                 $data['license_key'] = Base_EssClientCommon::get_license_key();
                 $data['status'] = Base_EssClientCommon::get_installation_status();
                 ///////// Status ////////
                 print '<div class="important_notice">';
                 print '<div style="margin: 5px">' . __('Thank you for registering your EPESI installation.') . '</div>';
                 $status_description = '';
                 $verbose_description = '';
                 if (stripos($data['status'], 'confirmed') !== false || stripos($data['status'], 'validated') !== false) {
                     $status_description = __('registration done');
                     $verbose_description = __('The registration process is complete.');
                 } else {
                     $status_description = __('waiting for e-mail confirmation');
                     $verbose_description = __('You need to verify your e-mail address. An e-mail was sent to the Administrator\'s e-mail address with a link to confirm the e-mail address.');
                 }
                 print '<div class="important_notice_frame"><span style="font-weight:bold;">' . __('License Key') . ': ' . '</span>' . $data['license_key'] . '<br/>';
                 print '<span style="font-weight:bold;">' . __('Status') . ': ' . '</span>' . $status_description . '</div>';
                 print '<div style="margin: 5px">' . $verbose_description . '</div>';
                 print '</div>';
                 Base_ActionBarCommon::add('edit', __('Edit company details'), $this->create_callback_href(array($this, 'register_form'), array($data)));
             } else {
                 $email = Base_EssClientCommon::get_support_email();
                 print '<div class="important_notice">' . __('Your EPESI ID is not recognized by EPESI Store Server. Please contact EPESI team at %s.', array($email)) . '</div>';
                 Base_ActionBarCommon::add('delete', __('Revoke license key'), $this->create_confirm_callback_href(__('Are you sure you want to revoke your EPESI License Key?'), array('Base_EssClientCommon', 'clear_license_key')));
             }
             $url = get_epesi_url() . '/modules/Base/EssClient/tos/tos.php';
             Base_ActionBarCommon::add('search', __('Terms & Conditions'), 'target="_blank" href="' . $url . '"');
             Base_ActionBarCommon::add('settings', __('Edit license key'), $this->create_callback_href(array($this, 'license_key_form')));
         }
     } catch (Exception $e) {
         print '<div class="important_notice">' . __('There was an error while trying to connect to Epesi Store Server. Please try again later.') . '<br>';
         print __('If the problem persists, please contact us at %s', array('<a href="http://forum.epesibim.com/" target="_blank">http://forum.epesibim.com/</a>')) . '<br>';
         print '<br>';
         print __('Error message: ') . '<br>';
         print '<div class="important_notice_frame">' . $e->getMessage();
         print '</div></div>';
         Base_ActionBarCommon::add('retry', __('Retry'), $this->create_href(array()));
         return;
     }
     print Base_EssClientCommon::client_messages_frame();
 }