Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
helppage.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * return dynamic enum from family parameters
9  * @return string
10  */
11 function helppageenumlang()
12 {
13 
14  $dbaccess = getParam("FREEDOM_DB");
15  if (!is_numeric($famid)) {
16  $famid = getFamIdFromName($dbaccess, 'HELPPAGE');
17  }
19  if ($doc->isAlive()) {
20  $all_lang_keys = $doc->_val2array($doc->getParamValue('help_p_lang_key'));
21  $all_lang_texts = $doc->_val2array($doc->getParamValue('help_p_lang_name'));
22  $langs = array();
23  foreach ($all_lang_keys as $i => $key) {
24  $langs[] = $key . '|' . $all_lang_texts[$i];
25  }
26  return implode(',', $langs);
27  }
28  return 'fr_FR|' . _('french');
29 }
30 
32 {
33 
34  include_once ('FDL/editutil.php');
35  editmode($action);
36 
38  $action->lay->set('DOCID', $docid);
39  $action->lay->set('DOCTITLE', $doc->getTitle());
40 
41  $helps = $doc->getHelpByLang();
42  $langs = $doc->getFamilyLangs();
43 
44  $action->lay->set('JSONLANGS', json_encode($langs));
45 
46  $section_key = GetHttpVars('edit_section_key', '');
47  $action->lay->set('SECTIONKEY', $section_key);
48 
49  $langitems = array();
50  foreach ($langs as $lang_key => $lang_name) {
51  $langitems[] = array(
52  'LANGKEY' => $lang_key,
53  'LANGISO' => strtolower(substr($lang_key, -2)) ,
54  'LANGNAME' => $lang_name,
55  );
56  }
57 
58  $action->lay->SetBlockData('LEGENDCSSLANGS', $langitems);
59  $action->lay->SetBlockData('LEGENDLANGS', $langitems);
60  $action->lay->SetBlockData('MENULANGS', $langitems);
61 }
62 
64 {
65 
66  include_once ('FDL/editutil.php');
67  editmode($action);
68 
70  $action->lay->set('DOCID', $docid);
71  $action->lay->set('DOCTITLE', $doc->getTitle());
72 
73  $helps = $doc->getHelpByLang();
74  $langs = $doc->getFamilyLangs();
75 
76  $action->lay->set('JSONLANGS', json_encode($langs));
77 
78  $helplangs = array();
79  $index = 0;
80  $displayed = false;
81  foreach ($langs as $lang_key => $lang_name) {
82  $item = array();
83  $item['LANGKEY'] = $lang_key;
84  $item['LANGISO'] = strtolower(substr($lang_key, -2));
85  $item['LANGNAME'] = $lang_name;
86  $item['LANGDISPLAY'] = 'none';
87  $oa1 = $doc->getAttribute('help_name');
88  $oa2 = $doc->getAttribute('help_description');
89  if (array_key_exists($lang_key, $helps)) {
90  if (!$displayed) {
91  $item['LANGDISPLAY'] = 'block';
92  $displayed = true;
93  }
94  $item['INPUTLANGNAME'] = getHtmlInput($doc, $oa1, $helps[$lang_key]['help_name'], $index, '', true);
95  $item['INPUTLANGDESCRIPTION'] = getHtmlInput($doc, $oa2, $helps[$lang_key]['help_description'], $index, '', true);
96  } else {
97  $item['INPUTLANGNAME'] = getHtmlInput($doc, $oa1, '', $index, '', true);
98  $item['INPUTLANGDESCRIPTION'] = getHtmlInput($doc, $oa2, '', $index, '', true);
99  }
100  $index++;
101  $helplangs[] = $item;
102  }
103  if (!empty($helplangs) && !$displayed) {
104  $helplangs[0]['LANGDISPLAY'] = 'block';
105  }
106  $action->lay->SetBlockData('HELPLANGS1', $helplangs);
107  $action->lay->SetBlockData('HELPLANGS2', $helplangs);
108 }
109 ?>
← centre documentaire © anakeen - published under CC License - Dynacase