LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file Translation.php

Documentation is available at Translation.php

  1. <?php
  2. require_once 'index.php';
  3. echo '<h3>Translation</h3>';
  4.  
  5. $groups $admin->perm->getGroups(
  6.     array(
  7.         'fields' => array('group_id'),
  8.         'select' => 'col'
  9.     )
  10. );
  11.  
  12. if (empty($groups)) {
  13.     echo 'Run the <strong>Group</strong> test first<br />';
  14.     exit;
  15. }
  16.  
  17. $admin->perm->removeTranslation(array('section_type' => LIVEUSER_SECTION_GROUP));
  18.  
  19. foreach ($groups as $group_id{
  20.     $data = array(
  21.         'section_id' => $group_id,
  22.         'section_type' => LIVEUSER_SECTION_GROUP,
  23.         'language_id' => 'de',
  24.         'name' => 'Name of '.$group_id.'is '.md5(uniqid(rand())),
  25.         'description' => 'Description of '.$group_id.'is '.md5(uniqid(rand())),
  26.     );
  27.     $translation_id $admin->perm->addTranslation($data);
  28.     if ($translation_id === false{
  29.         echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  30.         print_r($admin->getErrors());
  31.     else {
  32.         echo 'added translation for group <strong>' $group_id '</strong> with
  33.               the translation id <strong>'$translation_id .'</strong><br />';
  34.     }
  35. }
  36.  
  37. // Get
  38. echo 'All the groups with translation:<br />';
  39. $groups $admin->perm->getGroups(array('fields' => array('group_id''name''description')));
  40. if ($groups === false{
  41.     echo '<strong>Error on line: '.__LINE__.'</strong><br />';
  42.     print_r($admin->getErrors());
  43. elseif (empty($groups)) {
  44.     echo 'No groups were found<br />';
  45. else {
  46.     Var_Dump::display($groups);
  47.     echo '<br />';
  48. }
  49.  
  50. echo '<hr />';

Documentation generated on Mon, 11 Mar 2019 15:39:44 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.