1<?php 2require_once 'index.php'; 3echo '<h3>Translation</h3>'; 4 5$groups = $admin->perm->getGroups( 6 array( 7 'fields' => array('group_id'), 8 'select' => 'col' 9 ) 10); 11 12if (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 19foreach ($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 38echo 'All the groups with translation:<br />'; 39$groups = $admin->perm->getGroups(array('fields' => array('group_id', 'name', 'description'))); 40if ($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 50echo '<hr />'; 51