Exemple #1
0
 public function execute()
 {
     $errors = array();
     $params = array();
     $lang_id = SJB_Request::getVar('languageId', null);
     $i18n = SJB_ObjectMother::createI18N();
     if ($i18n->languageExists($lang_id)) {
         $params = $i18n->getLanguageData($lang_id);
         $params['languageId'] = $lang_id;
         if (isset($_REQUEST['action'])) {
             $action_name = $_REQUEST['action'];
             $form_submitted = SJB_Request::getVar('submit');
             $params = array_merge($params, $_REQUEST);
             $action = SJB_LanguageActionFactory::get($action_name, $params);
             if ($action->canPerform()) {
                 $action->perform();
                 if ($form_submitted == 'save') {
                     SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-languages/');
                 }
             } else {
                 $errors = $action->getErrors();
             }
         }
     } else {
         $errors[] = 'LANGUAGE_DOES_NOT_EXIST';
     }
     $template_editor = SJB_ObjectMother::createTemplateEditor();
     $themes = $template_editor->getThemeList();
     $template_processor = SJB_System::getTemplateProcessor();
     $template_processor->assign('themes', $themes);
     $template_processor->assign('lang', $params);
     $template_processor->assign('errors', $errors);
     $template_processor->display('update_language.tpl');
 }
Exemple #2
0
 public function execute()
 {
     $errors = array();
     if (isset($_REQUEST['action'])) {
         $action_name = $_REQUEST['action'];
         $action = SJB_LanguageActionFactory::get($action_name, $_REQUEST);
         if ($action->canPerform()) {
             $action->perform();
         } else {
             $errors = $action->getErrors();
         }
     }
     $i18n = SJB_ObjectMother::createI18N();
     $langs_data = $i18n->getLanguagesData();
     $template_processor = SJB_System::getTemplateProcessor();
     $template_processor->assign('langs', $langs_data);
     $template_processor->assign('errors', $errors);
     $template_processor->display('languages.tpl');
 }
Exemple #3
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $action = SJB_Request::getVar('action', false);
     if ($action && isset($_FILES['lang_file'])) {
         $params = $_REQUEST + $_FILES['lang_file'];
         $action = SJB_LanguageActionFactory::get($action, $params);
         if (@$action->canPerform()) {
             $action->perform();
             SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-languages/');
         } else {
             $errors = $action->getErrors();
         }
     }
     $tp->assign('errors', $errors);
     $tp->assign("uploadMaxFilesize", SJB_UploadFileManager::getIniUploadMaxFilesize());
     $tp->display('import_language.tpl');
 }
Exemple #4
0
 public function execute()
 {
     $errors = array();
     $params = array();
     if (isset($_REQUEST['action'])) {
         $action_name = $_REQUEST['action'];
         $params = $_REQUEST;
         $action = SJB_LanguageActionFactory::get($action_name, $params);
         if ($action->canPerform()) {
             $action->perform();
             SJB_WrappedFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/manage-languages/');
         } else {
             $errors = $action->getErrors();
         }
     }
     $template_processor = SJB_System::getTemplateProcessor();
     $template_processor->assign('request_data', $params);
     $template_processor->assign('errors', $errors);
     $template_processor->display('add_language.tpl');
 }