Pārlūkot izejas kodu

Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

jmontoyaa 8 gadi atpakaļ
vecāks
revīzija
1f1ab7ff47

+ 1 - 1
main/exercise/fill_blanks.class.php

@@ -121,7 +121,7 @@ class FillBlanks extends Question
                         if ($("#samplesize\\\["+i+"\\\]").width()) {
                         // this is a weird patch to avoid to reduce the size of input blank when you are writing in the ckeditor.
                             lainputsize = $("#samplesize\\\["+i+"\\\]").width();
-                            lainputsizetrue = $("#samplesize\\\["+i+"\\\]").width() + 9;
+                            lainputsizetrue = $("#samplesize\\\["+i+"\\\]").width() + 15;
                         }
 
                         if (document.getElementById("weighting["+i+"]")) {

+ 14 - 2
main/inc/lib/sessionmanager.lib.php

@@ -1549,6 +1549,18 @@ class SessionManager
 
         $userId = api_get_user_id();
 
+        /** @var \Chamilo\CoreBundle\Entity\Repository\SequenceRepository $repo */
+        $repo = Database::getManager()->getRepository('ChamiloCoreBundle:SequenceResource');
+        $sequenceResourse = $repo->findRequirementForResource(
+            $id_checked,
+            \Chamilo\CoreBundle\Entity\SequenceResource::SESSION_TYPE
+        );
+
+        if ($sequenceResourse) {
+            Display::addFlash(Display::return_message(get_lang('ThereIsASequenceResourceLinkedToThisSessionYouNeedToDeleteItFirst'), 'error'));
+            return false;
+        }
+
         if (is_array($id_checked)) {
             foreach ($id_checked as $sessionId) {
                 self::delete($sessionId);
@@ -1612,8 +1624,6 @@ class SessionManager
         $extraFieldValue = new ExtraFieldValue('session');
         $extraFieldValue->deleteValuesByItem($id_checked);
 
-        /** @var \Chamilo\CoreBundle\Entity\Repository\SequenceRepository $repo */
-        $repo = Database::getManager()->getRepository('ChamiloCoreBundle:SequenceResource');
         $repo->deleteResource(
             $id_checked,
             \Chamilo\CoreBundle\Entity\SequenceResource::SESSION_TYPE
@@ -1627,6 +1637,8 @@ class SessionManager
             api_get_utc_datetime(),
             $userId
         );
+
+        return true;
     }
 
     /**

+ 5 - 2
main/session/session_list.php

@@ -19,8 +19,11 @@ $idChecked = isset($_REQUEST['idChecked']) ? $_REQUEST['idChecked'] : null;
 $list_type = isset($_REQUEST['list_type']) ? $_REQUEST['list_type'] : 'simple';
 
 if ($action == 'delete') {
-    SessionManager::delete($idChecked);
-    Display::addFlash(Display::return_message(get_lang('Deleted')));
+    $response = SessionManager::delete($idChecked);
+
+    if ($response) {
+        Display::addFlash(Display::return_message(get_lang('Deleted')));
+    }
     header('Location: session_list.php');
     exit();
 } elseif ($action == 'copy') {

+ 2 - 1
plugin/google_maps/lang/english.php

@@ -5,4 +5,5 @@ $strings['plugin_comment'] = "Enable the functionality to show google maps";
 $strings['extra_field_name_help'] = "Ingrese aquí el nombre del campo extra de usuario del cual quiere obtener las localizaciones, siga el siguiente link para ver el mapa : <a href='". api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php'>" . api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php</a>";
 $strings['enable_api'] = "Enable API";
 $strings['api_key'] = "Api Key";
-$strings['extra_field_name'] = "Extra field name";
+$strings['extra_field_name'] = "Extra field name";
+$strings['UsersCoordinatesMap'] = "Users Coordinates Map";

+ 2 - 1
plugin/google_maps/lang/french.php

@@ -5,4 +5,5 @@ $strings['plugin_comment'] = "Active la fonctionnalité pour afficher Google Map
 $strings['extra_field_name_help'] = "Ingrese aquí el nombre del campo extra de usuario del cual quiere obtener las localizaciones, siga el siguiente link para ver el mapa : <a href='". api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php'>" . api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php</a>";
 $strings['enable_api'] = "Enable API";
 $strings['api_key'] = "Api Key";
-$strings['extra_field_name'] = "Nom de champ supplémentaire";
+$strings['extra_field_name'] = "Nom de champ supplémentaire";
+$strings['UsersCoordinatesMap'] = "Carte des coordonnées des utilisateurs";

+ 2 - 1
plugin/google_maps/lang/spanish.php

@@ -5,4 +5,5 @@ $strings['plugin_comment'] = "Enable the functionality to show google maps";
 $strings['extra_field_name_help'] = "Ingrese aquí el nombre del campo extra de usuario del cual quiere obtener las localizaciones, siga el siguiente link para ver el mapa : <a href='". api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php'>" . api_get_path(WEB_PLUGIN_PATH) . "google_maps/src/map_coordinates.php</a>";
 $strings['enable_api'] = "Activar API";
 $strings['api_key'] = "Api Key";
-$strings['extra_field_name'] = "Nombre del campo extra";
+$strings['extra_field_name'] = "Nombre del campo extra";
+$strings['UsersCoordinatesMap'] = "Mapa de Coordenadas de Usuarios";

+ 0 - 0
plugin/google_maps/src/GoogleMapsPluginPlugin.php → plugin/google_maps/src/GoogleMapsPlugin.php


+ 1 - 1
plugin/google_maps/src/map_coordinates.php

@@ -34,7 +34,7 @@ if ($extraField) {
     $extraFieldValues = $extraFieldValues->findBy(['field' => $extraField->getId()]);
 }
 
-$templateName = get_lang('UsersCoordinatesMap');
+$templateName = $plugin->get_lang('UsersCoordinatesMap');
 
 $tpl = new Template($templateName);
 

+ 4 - 3
src/Chamilo/CoreBundle/Entity/Repository/SequenceRepository.php

@@ -75,6 +75,7 @@ class SequenceRepository extends EntityRepository
      *
      * @param int $resourceId
      * @param int $type
+     * @return boolean
      */
     public function deleteResource($resourceId, $type)
     {
@@ -82,7 +83,7 @@ class SequenceRepository extends EntityRepository
 
         if ($sequence && $sequence->hasGraph()) {
             $em = $this->getEntityManager();
-            $graph = $sequence->getUnSerializeGraph();
+            $graph = $sequence->getSequence()->getUnSerializeGraph();
 
             $mainVertex = $graph->getVertex($resourceId);
             $vertices = $graph->getVertices();
@@ -92,10 +93,10 @@ class SequenceRepository extends EntityRepository
                 $subResourceId = $vertex->getId();
                 $subSequence = $this->findRequirementForResource($subResourceId, $type);
                 if ($sequence && $subSequence->hasGraph()) {
-                    $graph = $subSequence->getUnSerializeGraph();
+                    $graph = $subSequence->getSequence()->getUnSerializeGraph();
                     $subMainVertex = $graph->getVertex($resourceId);
                     $subMainVertex->destroy();
-                    $subSequence->setGraphAndSerialize($graph);
+                    $subSequence->getSequence()->setGraphAndSerialize($graph);
                     $em->persist($subSequence);
                 }
             }