ATutor 2.0
[atutor.git] / mods / _core / languages / language_add.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2010                                              */
6 /* Inclusive Design Institute                                           */
7 /* http://atutor.ca                                                     */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12 // $Id: language_add.php 7208 2008-01-09 16:07:24Z greg $
13
14 define('AT_INCLUDE_PATH', '../../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 admin_authenticate(AT_ADMIN_PRIV_LANGUAGES);
17 if (!AT_DEVEL_TRANSLATE) { exit; }
18
19 if (isset($_POST['cancel'])) {
20         $msg->addFeedback('CANCELLED');
21         header('Location: language.php');
22         exit;
23 } else if (isset($_POST['submit'])) {
24         require_once(AT_INCLUDE_PATH . '../mods/_core/languages/classes/Language/LanguageEditor.class.php'); 
25         
26         if ($languageManager->exists($_POST['code'], $_POST['locale'])) {
27                 $msg->addError('LANG_EXISTS');
28         } else {
29                 $state = LanguageEditor::addLanguage($_POST, $db);
30         }
31
32         if (!$msg->containsErrors() && $state !== FALSE) {
33                 $msg->addFeedback('LANG_ADDED');
34                 header('Location: language.php');
35                 exit;
36         } 
37 }
38
39 require(AT_INCLUDE_PATH.'header.inc.php'); ?>
40
41 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
42 <input type="hidden" name="import" value="1" />
43 <div class="input-form" style="width:95%">
44         <div class="row">
45                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="code"><?php echo _AT('lang_code'); ?></label><br />
46                 <input id="code" name="code" type="text" size="2" maxlength="2" class="formfield" value="<?php echo $_POST['code']; ?>" />
47         </div>
48
49         <div class="row">
50                 <label for="locale"><?php echo _AT('locale'); ?></label><br />
51                 <input id="locale" name="locale" type="text" size="2" maxlength="2" class="formfield" value="<?php echo $_POST['locale']; ?>" />
52         </div>
53
54         <div class="row">
55                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="charset"><?php echo _AT('charset'); ?></label><br />
56                 <input id="charset" name="charset" type="text" size="31" maxlength="20" class="formfield" value="<?php echo $_POST['charset']; ?>" />
57         </div>
58
59         <div class="row">
60                 <label for="ltr"><?php echo _AT('direction'); ?></label><br />
61                 <?php 
62                         if ($_POST['direction'] == 'rtl') { 
63                                 $rtl = 'checked="checked"';  
64                                 $ltr='';  
65                         } else { 
66                                 $rtl = '';  
67                                 $ltr='checked="checked"'; 
68                         }
69                 ?>
70                 <input id="ltr" name="direction" type="radio" value="ltr" <?php echo $ltr; ?> /><label for="ltr"><?php echo _AT('ltr'); ?></label>, <input id="rtl" name="direction" type="radio" value="rtl" <?php echo $rtl; ?> /><label for="rtl"><?php echo _AT('rtl'); ?></label>
71         </div>
72
73         <div class="row">
74                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="reg_exp"><?php echo _AT('reg_exp'); ?></label><br />
75                 <input id="reg_exp" name="reg_exp" type="text" size="31" class="formfield" value="<?php echo $_POST['reg_exp']; ?>" />
76         </div>
77
78         <div class="row">
79                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="nname"><?php echo _AT('name_in_language'); ?></label><br />
80                 <input id="nname" name="native_name" type="text" size="31" maxlength="20" class="formfield" value="<?php echo $_POST['native_name']; ?>" />
81         </div>
82
83         <div class="row">
84                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="ename"><?php echo _AT('name_in_english'); ?></label><br />
85                 <input id="ename" name="english_name" type="text" size="31" maxlength="20" class="formfield" value="<?php echo $_POST['english_name'];?>" />
86         </div>
87
88
89         <div class="row buttons">
90                 <input type="submit" name="submit" value="<?php echo _AT('submit'); ?>" /> <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />           
91         </div>
92 </div>
93 </form>
94
95 <?php require(AT_INCLUDE_PATH.'footer.inc.php');  ?>