Exemplo n.º 1
0
 * Performs basic controls before entering this module
*/
$neededObjAr = array(AMA_TYPE_SWITCHER => array('layout'));
$trackPageToNavigationHistory = false;
require_once ROOT_DIR . '/include/module_init.inc.php';
$self = "switcher";
include_once '../include/' . $self . '_functions.inc.php';
$self = "translation";
/*
 * Html Library containing forms used in this module.
 */
require_once ROOT_DIR . '/include/HtmlLibrary/AdminModuleHtmlLib.inc.php';
require_once ROOT_DIR . '/include/HtmlLibrary/UserModuleHtmlLib.inc.php';
require_once ROOT_DIR . '/include/Forms/TranslationForm.inc.php';
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $form = $form = new TranslationForm();
    $form->fillWithPostData();
    if ($form->isValid()) {
        $search_text = $_POST['t_name'];
        $language_code = $_POST['selectLanguage'];
        $common_dh = $GLOBALS['common_dh'];
        $thead_data = array(translateFN("Errore"));
        if (is_null($search_text) || $search_text == "") {
            $total_results = array();
            $msgEr = translateFN("Nessun input sottomesso");
            $temp_results = array(translateFN("") => $msgEr);
            array_push($total_results, $temp_results);
            $result_table = BaseHtmlLib::tableElement('id:table_result', $thead_data, $total_results);
            $result = $result_table->getHtml();
            $retArray = array("status" => "ERROR", "msg" => translateFN("Nessun input sottomesso"), "html" => $result);
        } else {
Exemplo n.º 2
0
/**
 * 
 * if usertype is switcher assume as client the first element of the testers array
 */
$languages = Translator::getSupportedLanguages();
if ($_SESSION['sess_id_user_type'] == AMA_TYPE_SWITCHER) {
    $tester_client_Ar = $userObj->getTesters();
    $tester_client = strtoupper($tester_client_Ar[0]);
    $tester_default_language_constant = $tester_client . "_DEFAULT_LANGUAGE";
    if (defined($tester_default_language_constant)) {
        $tester_default_language = constant($tester_default_language_constant);
        $languages = array();
        $languages[0] = array('nome_lingua' => $tester_default_language, 'codice_lingua' => $tester_default_language);
    }
}
$languageName = array();
foreach ($languages as $language) {
    $languageName[$language['codice_lingua']] = $language['nome_lingua'];
}
$form = new TranslationForm($languageName);
$data = $form->getHtml();
$EditTranslFr = new EditTranslationForm();
$dataEdtTslFr = $EditTranslFr->getHtml();
$status = translateFN('translation mode');
$content_dataAr = array('banner' => isset($banner) ? $banner : '', 'eportal' => isset($eportal) ? $eportal : '', 'course_title' => translateFN('Modulo di traduzione'), 'user_name' => $user_name, 'user_type' => $user_type, 'messages' => $user_messages->getHtml(), 'agenda' => $user_agenda->getHtml(), 'status' => $status, 'help' => isset($help) ? $help : '', 'data' => $data, 'dataEditTranslation' => $dataEdtTslFr);
/**
 * Sends data to the rendering engine
 */
$layout_dataAr['JS_filename'] = array(JQUERY, JQUERY_UI, JQUERY_DATATABLE, JQUERY_DATATABLE_REDRAW, JQUERY_NO_CONFLICT, JQUERY_MASKEDINPUT);
$layout_dataAr['CSS_filename'] = array(JQUERY_UI_CSS, JQUERY_DATATABLE_CSS);
ARE::render($layout_dataAr, $content_dataAr, NULL, array('onload_func' => "initDoc();"));
Exemplo n.º 3
0
 public function executeTranslationDefaultText(sfWebRequest $request)
 {
     $campaign = CampaignTable::getInstance()->findById($request->getParameter('id'), $this->userIsAdmin());
     if (!$campaign) {
         return $this->notFound();
     }
     if (!$this->getGuardUser()->isCampaignMember($campaign)) {
         return $this->noAccess();
     }
     $form = new TranslationForm();
     $form_name = $form->getName();
     $value = $request->getGetParameter('value');
     if (!is_string($value)) {
         return $this->notFound();
     }
     $language = LanguageTable::getInstance()->find($value);
     if (!$language) {
         return $this->notFound();
     }
     $validation_email = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::SIGNING_VALIDATION_EMAIL, $value);
     if ($validation_email) {
         $this->ajax()->val('#' . $form_name . '_email_validation_subject', $validation_email->getField('subject', ''));
         $this->ajax()->val('#' . $form_name . '_email_validation_body', $validation_email->getField('body', ''));
     }
     $tellyourfriend_email = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::ACTION_TELL_YOUR_FRIEND_EMAIL, $value);
     if ($tellyourfriend_email) {
         $this->ajax()->val('#' . $form_name . '_email_tellyour_subject', $tellyourfriend_email->getField('subject', ''));
         $this->ajax()->val('#' . $form_name . '_email_tellyour_body', $tellyourfriend_email->getField('body', ''));
     }
     $default_campaign_privacy = CampaignStoreTable::getInstance()->findByCampaignLanguageKey($campaign, $language, CampaignStoreTable::KEY_PRIVACY_POLICY);
     if ($default_campaign_privacy) {
         $this->ajax()->val('#' . $form_name . '_privacy_policy_body', $default_campaign_privacy->getValue());
     } else {
         $privacy = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::ACTION_PRIVACY_POLICY, $value);
         if ($privacy) {
             $this->ajax()->val('#' . $form_name . '_privacy_policy_body', $privacy->getField('body', ''));
         }
     }
     return $this->ajax()->render();
 }
Exemplo n.º 4
0
 protected function getAllLanguages()
 {
     $form = new TranslationForm();
     return $form->getLangs();
 }