Fixing translator, replacing $app variables, replacing entities names.

1.10.x
jmontoya 11 years ago
parent 9099eb8e27
commit b42b2cd944
  1. 6
      composer.json
  2. 5
      main/admin/course_add.php
  3. 14
      main/admin/user_add.php
  4. 5
      main/inc/lib/api.lib.php
  5. 2
      main/inc/lib/chamilo_session.class.php
  6. 12
      main/inc/lib/database.lib.php
  7. 5
      main/inc/lib/extra_field.lib.php
  8. 8
      main/inc/lib/internationalization.lib.php
  9. 7
      main/inc/lib/usermanager.lib.php
  10. 3
      src/ChamiloLMS/CoreBundle/Listener/LegacyListener.php
  11. 6
      src/ChamiloLMS/CoreBundle/Resources/config/services.yml
  12. 9
      src/ChamiloLMS/CoreBundle/Resources/translations/all.en.po
  13. 0
      src/ChamiloLMS/CoreBundle/Resources/translations/all.es.po
  14. 17
      src/ChamiloLMS/CoreBundle/Resources/translations/all.fr_FR.po
  15. 3
      web/legacy.php

@ -58,7 +58,11 @@
"oyejorge/less.php": "~1.5",
"sonata-project/block-bundle": "~2.2",
"knplabs/knp-menu-bundle": "~1.1",
"white-october/pagerfanta-bundle": "dev-master"
"white-october/pagerfanta-bundle": "dev-master",
"jbroadway/urlify": "1.0.0-stable",
"chamilo/chash": "dev-master",
"doctrine/migrations": "dev-master",
"composer/composer": "1.0.*@dev"
},
"scripts": {
"post-install-cmd": [

@ -150,7 +150,4 @@ if ($form->validate()) {
// Display the form.
$content = $form->return_form();
$tpl = $app['template'];
$app['title'] = $tool_name;
$tpl->assign('content', $content);
$tpl->display_one_col_template();
echo $content;

@ -6,7 +6,7 @@
// User permissions
api_protect_admin_script(true);
$is_platform_admin = api_is_platform_admin();
$message = null;
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#password');
@ -268,9 +268,9 @@ if( $form->validate()) {
$language = $user['language'];
$picture = $_FILES['picture'];
$send_mail = intval($user['mail']['send_mail']);
$hr_dept_id = intval($user['hr_dept_id']);
$hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : 0;
if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
if (isset($extAuthSource) && count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
$auth_source = $user['password']['auth_source'];
$password = 'PLACEHOLDER';
} else {
@ -380,7 +380,7 @@ if (!empty($message)){
$content = $form->return_form();
$app['title'] = $tool_name;
$tpl = $app['template'];
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
//$tpl = $app['template'];
echo $message;
echo $content;

@ -6775,9 +6775,8 @@ function api_get_language_interface()
*/
function api_get_user_roles()
{
global $app;
$em = $app['orm.ems']['db_read'];
$roles = $em->getRepository('ChamiloLMS\Entity\Role')->findBy(array(), array('name'=>'asc'));
$em = Database::getManager();
$roles = $em->getRepository('ChamiloLMSCoreBundle:Role')->findBy(array(), array('name'=>'asc'));
$userRoles = array();
foreach ($roles as $role) {
$userRoles[$role->getId()] = $role->getName();

@ -73,7 +73,7 @@ class ChamiloSession
}
/**
* @return Symfony\Component\Security\Core\SecurityContextInterface
* @return Symfony\Bundle\FrameworkBundle\Translation\Translator
*/
public static function getTranslator()
{

@ -36,6 +36,8 @@ class Database
*/
private static $connectionWrite;
private static $em;
/**
* Constructor
*
@ -60,6 +62,16 @@ class Database
self::$connectionWrite = isset($dbs['db_write']) ? $dbs['db_write'] : $db;
}
public static function setManager($em)
{
self::$em = $em;
}
public static function getManager()
{
return self::$em;
}
/**
* Return current connection
* @return \Doctrine\DBAL\Connection

@ -643,14 +643,13 @@ class ExtraField extends Model
$addOptions = array();
global $app;
$optionsExists = $app['orm.em']->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption')->
$optionsExists = Database::getManager()->getRepository('ChamiloLMSCoreBundle:ExtraFieldOptionRelFieldOption')->
findOneBy(array('fieldId' => $field_details['id']));
if ($optionsExists) {
if (isset($userInfo['status']) && !empty($userInfo['status'])) {
$fieldWorkFlow = $app['orm.em']->getRepository('ChamiloLMS\Entity\ExtraFieldOptionRelFieldOption')
$fieldWorkFlow = Database::getManager()->getRepository('ChamiloLMSCoreBundle:ExtraFieldOptionRelFieldOption')
->findBy(
array(
'fieldId' => $field_details['id'],

@ -49,10 +49,12 @@ define('PERSON_NAME_DATA_EXPORT', PERSON_NAME_EASTERN_ORDER); // Contextual: for
*/
function get_lang($variable)
{
$translated = Session::getTranslator()->trans($variable);
$defaultDomain = 'all';
$translated = Session::getTranslator()->trans($variable, array(), $defaultDomain);
if ($translated == $variable) {
// Check the langVariable for BC
$translated = Session::getTranslator()->trans("lang$variable");
$translated = Session::getTranslator()->trans("lang$variable", array(), $defaultDomain);
if ($translated == "lang$variable") {
return $variable;
}
@ -966,7 +968,7 @@ function _api_mb_internal_encoding()
*/
function api_transliterate($string, $unknown = '?', $from_encoding = null)
{
{ return $string;
return URLify::transliterate($string);
//return u::toAscii($string, $unknown);
}

@ -336,13 +336,12 @@ class UserManager
UrlManager::add_user_to_url($return, 1);
}
// Adding user
/** @var ChamiloLMS\Entity\User $user */
$em = self::$em;
$em = Database::getManager();
$user = $em->getRepository('ChamiloLMS\Entity\User')->find($return);
$role = $em->getRepository('ChamiloLMS\Entity\Role')->find($status);
$user = $em->getRepository('ChamiloLMSCoreBundle:User')->find($return);
$role = $em->getRepository('ChamiloLMSCoreBundle:Role')->find($status);
$user->getRolesObj()->add($role);
$em->persist($user);

@ -28,6 +28,7 @@ class LegacyListener
Session::setSession($request->getSession());
$dbConnection = $this->container->get('database_connection');
$database = new \Database($dbConnection, array());
\Database::setManager($this->container->get('doctrine')->getManager());
Session::$urlGenerator = $this->container->get('router');
Session::$security = $this->container->get('security.context');
Session::$translator = $this->container->get('translator');
@ -38,6 +39,8 @@ class LegacyListener
Session::$courseDir = $this->container->get('kernel')->getDataDir();
Session::$configDir = $this->container->get('kernel')->getConfigDir();
// Injecting course in twig
$courseCode = $request->get('code');

@ -31,9 +31,3 @@ services:
arguments: ["sonata.block.service.course", @templating ]
tags:
- { name: sonata.block }
translation.loader.po:
class: Symfony\Component\Translation\Loader\PoFileLoader
tags:
- { name: translation.loader, alias: po }

@ -1,6 +1,13 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=utf-8 \n"
"Content-Type: text/plain; charset=utf-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.5.4\n"
msgid "ResourceAdded"
msgstr "Resource added"

@ -1,6 +1,13 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=utf-8 \n"
"Content-Type: text/plain; charset=utf-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.5.4\n"
msgid "ResourceAdded"
msgstr "Ressource ajoutée"
@ -922,13 +929,13 @@ msgid "ScoringUpdated"
msgstr "Cotations mises à jour"
msgid "CertificateWCertifiesStudentXFinishedCourseYWithGradeZ"
msgstr "%s certifie que
msgstr "%s certifie que
%s
%s
a réussi le cours
a réussi le cours
'%s'
'%s'
avec la mention

@ -1,5 +1,8 @@
<?php
define('USERNAME_MAX_LENGTH', 40);
require_once __DIR__.'/../main/inc/lib/api.lib.php';
require_once __DIR__.'/../main/inc/lib/database.constants.inc.php';
require_once __DIR__.'/../main/inc/lib/internationalization.lib.php';

Loading…
Cancel
Save