Alex Aragon 8 years ago
parent
commit
2b14025a8a

+ 7 - 0
app/Migrations/Schema/V111/Version111.php

@@ -256,6 +256,13 @@ class Version111 extends AbstractMigrationChamilo
             $this->addSql('CREATE INDEX IDX_EDE2C76812469DE2 ON ticket_ticket (category_id);');
 
             $this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26537A1329 FOREIGN KEY (message_id) REFERENCES ticket_message (id);');
+            $this->addSql('DELETE FROM settings_current WHERE title = "Ticket"');
+
+            $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0)");
+            $this->addSql("INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0)");
+            $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_student_add', 'true', 'Yes'), ('ticket_allow_student_add', 'false', 'No')");
+            $this->addSql("INSERT INTO settings_options (variable, value, display_text) VALUES ('ticket_allow_category_edition', 'true', 'Yes'), ('ticket_allow_category_edition', 'false', 'No')");
+
         }
     }
 

+ 1 - 1
app/config/sonata/sonata_media.yml

@@ -4,7 +4,7 @@ sonata_media:
         media: Chamilo\MediaBundle\Entity\Media
         gallery: Chamilo\MediaBundle\Entity\Gallery
         gallery_has_media: Chamilo\MediaBundle\Entity\GalleryHasMedia
-#        category: Chamilo\ClassificationBundle\Entity\Category
+        category: Chamilo\ClassificationBundle\Entity\Category
 
     db_driver: doctrine_orm # | doctrine_mongodb
     default_context: default

+ 11 - 18
composer.json

@@ -33,12 +33,6 @@
             "main/inc/lib/hook"
         ]
     },
-    "repositories": [
-      {
-        "type": "vcs",
-        "url": "https://github.com/jmontoyaa/SonataMediaBundle"
-      }
-    ],
     "require": {
         "php": ">=5.4",
         "ext-intl": "*",
@@ -82,23 +76,22 @@
         "sonata-project/seo-bundle": "~2.0",
         "sonata-project/doctrine-extensions": "~1@dev",
         "sonata-project/intl-bundle": "~2.2@dev",
-        "sonata-project/admin-bundle": "3.x-dev as 2.4",
-        "sonata-project/doctrine-orm-admin-bundle": "3.x-dev as 2.4",
-        "sonata-project/notification-bundle": "~2.2@dev",
-        "sonata-project/block-bundle": "3.x-dev as 2.4",
-        "sonata-project/media-bundle": "dev-master",
-        "sonata-project/user-bundle": "~2.2@dev",
+        "sonata-project/admin-bundle": "~3.0",
+        "sonata-project/doctrine-orm-admin-bundle": "~3.0",
+        "sonata-project/notification-bundle": "~3.0",
+        "sonata-project/block-bundle": "~3.0",
+        "sonata-project/media-bundle": "~3.0",
+        "sonata-project/user-bundle": "~3.0",
         "sonata-project/cache-bundle": "~2.1@dev",
         "sonata-project/cache": "~1.0@dev",
-        "sonata-project/page-bundle": "dev-master",
-        "sonata-project/core-bundle": "3.x-dev as 2.4",
+        "sonata-project/page-bundle": "~3.0",
+        "sonata-project/core-bundle": "~3.0",
         "sonata-project/formatter-bundle": "~3.0",
-
         "sonata-project/datagrid-bundle": "~2.2@dev",
         "sonata-project/exporter": "~1.3@dev",
-        "sonata-project/timeline-bundle": "~2.3@dev",
-        "sonata-project/classification-bundle": "3.x-dev as 2.3",
-        "sonata-project/comment-bundle": "~2.2@dev",
+        "sonata-project/timeline-bundle": "~3.0",
+        "sonata-project/classification-bundle": "~3.0",
+        "sonata-project/comment-bundle": "~3.0",
         "sonata-project/sonata-composer": "dev-master",
 
         "friendsofsymfony/comment-bundle": "~2.0@dev",

+ 25 - 7
main/auth/inscription.php

@@ -50,17 +50,27 @@ $(document).ready(function() {
 
 function myLocation() {
     if (navigator.geolocation) {
-        navigator.geolocation.getCurrentPosition(function(position) {
+        var geoPosition = function(position) {
             var lat = position.coords.latitude;
             var lng = position.coords.longitude;
             var latLng = new google.maps.LatLng(lat, lng);
             initializeGeo(false, latLng)
-        });
+        };
+
+        var geoError = function(error) {
+            alert("Geocode '.get_lang('Error').': " + error);
+        };
+
+        var geoOptions = {
+            enableHighAccuracy: true
+        };
+
+        navigator.geolocation.getCurrentPosition(geoPosition, geoError, geoOptions);
     }
 }
 
 function initializeGeo(address, latLng) {
-    geocoder = new google.maps.Geocoder();
+    var geocoder = new google.maps.Geocoder();
     var latlng = new google.maps.LatLng(-75.503, 22.921);
     var myOptions = {
         zoom: 15,
@@ -82,8 +92,9 @@ function initializeGeo(address, latLng) {
             if (status == google.maps.GeocoderStatus.OK) {
                 if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
                     map.setCenter(results[0].geometry.location);
-                    console.log(results[0]);
-                    $("#address").val(results[0].formatted_address);
+                    if (!address) {
+                        $("#address").val(results[0].formatted_address);
+                    }
                     var infowindow = new google.maps.InfoWindow({
                         content: "<b>" + $("#address").val() + "</b>",
                         size: new google.maps.Size(150, 50)
@@ -249,8 +260,15 @@ if ($user_already_registered_show_terms == false) {
     // Geolocation
     if (in_array('address', $allowedFields)) {
         $form->addElement('text', 'address', get_lang('AddressField'), ['id' => 'address']);
-        $form->addButton('geolocalization', get_lang('geolocalization'), 'globe', 'default', 'default', 'null', ['id' => 'geolocalization']);
-        $form->addButton('myLocation', get_lang('MyLocation'), 'map-marker', 'default', 'default', 'null', ['id' => 'myLocation']);
+        $form->addHtml('
+            <div class="form-group">
+                <label for="geolocalization" class="col-sm-2 control-label"></label>
+                <div class="col-sm-8">
+                    <button class="null btn btn-default " id="geolocalization" name="geolocalization" type="submit"><em class="fa fa-map-marker"></em> '.get_lang('Geolocalization').'</button>
+                    <button class="null btn btn-default " id="myLocation" name="myLocation" type="submit"><em class="fa fa-crosshairs"></em> '.get_lang('MyLocation').'</button>
+                </div>
+            </div>
+        ');
 
         $form->addHtml('
             <div class="form-group">

+ 25 - 10
main/auth/profile.php

@@ -39,9 +39,6 @@ $(document).ready(function() {
     var $image = $("#previewImage");
     var $input = $("[name=\'cropResult\']");
     var $cropButton = $("#cropButton");
-    var canvas = "";
-    var imageWidth = "";
-    var imageHeight = "";
     
     $("input:file").change(function() {
         var oFReader = new FileReader();
@@ -168,17 +165,27 @@ $(document).ready(function() {
 
 function myLocation() {
     if (navigator.geolocation) {
-        navigator.geolocation.getCurrentPosition(function(position) {
+        var geoPosition = function(position) {
             var lat = position.coords.latitude;
             var lng = position.coords.longitude;
             var latLng = new google.maps.LatLng(lat, lng);
             initializeGeo(false, latLng)
-        });
+        };
+
+        var geoError = function(error) {
+            alert("Geocode '.get_lang('Error').': " + error);
+        };
+
+        var geoOptions = {
+            enableHighAccuracy: true
+        };
+
+        navigator.geolocation.getCurrentPosition(geoPosition, geoError, geoOptions);
     }
 }
 
 function initializeGeo(address, latLng) {
-    geocoder = new google.maps.Geocoder();
+    var geocoder = new google.maps.Geocoder();
     var latlng = new google.maps.LatLng(-34.397, 150.644);
     var myOptions = {
         zoom: 15,
@@ -200,8 +207,9 @@ function initializeGeo(address, latLng) {
             if (status == google.maps.GeocoderStatus.OK) {
                 if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
                     map.setCenter(results[0].geometry.location);
-                    console.log(results[0]);
-                    $("#address").val(results[0].formatted_address);
+                    if (!address) {
+                        $("#address").val(results[0].formatted_address);
+                    }
                     var infowindow = new google.maps.InfoWindow({
                         content: "<b>" + $("#address").val() + "</b>",
                         size: new google.maps.Size(150, 50)
@@ -332,8 +340,15 @@ $form->applyFilter('phone', 'html_filter');
 
 // Geolocation
 $form->addElement('text', 'address', get_lang('AddressField'), ['id' => 'address']);
-$form->addButton('geolocalization', get_lang('geolocalization'), 'globe', 'default', 'default', 'null', ['id' => 'geolocalization']);
-$form->addButton('myLocation', get_lang('MyLocation'), 'map-marker', 'default', 'default', 'null', ['id' => 'myLocation']);
+$form->addHtml('
+    <div class="form-group">
+        <label for="geolocalization" class="col-sm-2 control-label"></label>
+        <div class="col-sm-8">
+            <button class="null btn btn-default " id="geolocalization" name="geolocalization" type="submit"><em class="fa fa-map-marker"></em> '.get_lang('Geolocalization').'</button>
+            <button class="null btn btn-default " id="myLocation" name="myLocation" type="submit"><em class="fa fa-crosshairs"></em> '.get_lang('MyLocation').'</button>
+        </div>
+    </div>
+');
 
 $form->addHtml('
     <div class="form-group">

+ 25 - 0
main/forum/forumfunction.inc.php

@@ -282,6 +282,25 @@ function show_add_forum_form($inputvalues = array(), $lp_id)
     $form->addButtonAdvancedSettings('advanced_params');
     $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
 
+    $form->addDateTimePicker(
+        'start_time',
+        array(get_lang('ForumStartDate'), get_lang('ForumStartDateComment')),
+        array('id' => 'start_time')
+    );
+
+    $form->addDateTimePicker(
+        'end_time',
+        array(get_lang('ForumEndDate'), get_lang('ForumEndDateComment')),
+        array('id' => 'end_time')
+    );
+
+    $form->addRule(
+        array('start_time', 'end_time'),
+        get_lang('StartDateMustBeBeforeTheEndDate'),
+        'compare_datetime_text',
+        '< allow_empty'
+    );
+
     $group = array();
     $group[] = $form->createElement('radio', 'moderated', null, get_lang('Yes'), 1);
     $group[] = $form->createElement('radio', 'moderated', null, get_lang('No'), 0);
@@ -378,6 +397,8 @@ function show_add_forum_form($inputvalues = array(), $lp_id)
         $defaults['forum_id'] = isset($inputvalues['forum_id']) ? $inputvalues['forum_id'] : null;
         $defaults['forum_title'] = prepare4display(isset($inputvalues['forum_title']) ? $inputvalues['forum_title'] : null);
         $defaults['forum_comment'] = prepare4display(isset($inputvalues['forum_comment']) ? $inputvalues['forum_comment'] : null);
+        $defaults['start_time'] = isset($inputvalues['start_time']) ? api_get_local_time($inputvalues['start_time']) : null;
+        $defaults['end_time'] = isset($inputvalues['end_time']) ? api_get_local_time($inputvalues['end_time']) : null;
         $defaults['moderated']['moderated'] = isset($inputvalues['moderated']) ? $inputvalues['moderated'] : 0;
         $defaults['forum_category'] = isset($inputvalues['forum_category']) ? $inputvalues['forum_category'] : null;
         $defaults['allow_anonymous_group']['allow_anonymous'] = isset($inputvalues['allow_anonymous']) ? $inputvalues['allow_anonymous'] : null;
@@ -697,6 +718,8 @@ function store_forum($values, $courseInfo = array(), $returnId = false)
             'forum_of_group'=> isset($values['group_forum']) ? $values['group_forum'] : null,
             'forum_group_public_private'=> isset($values['public_private_group_forum_group']['public_private_group_forum']) ? $values['public_private_group_forum_group']['public_private_group_forum'] : null,
             'moderated'=> isset($values['moderated']['moderated']) ? 1 : 0,
+            'start_time' => isset($values['start_time']) ? api_get_utc_datetime($values['start_time']) : null,
+            'end_time' => isset($values['end_time']) ? api_get_utc_datetime($values['end_time']) : null,
             'forum_order'=> isset($new_max) ? $new_max : null,
             'session_id'=> $session_id,
             'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : 0
@@ -738,6 +761,8 @@ function store_forum($values, $courseInfo = array(), $returnId = false)
             'forum_of_group'=> isset($values['group_forum']) ? $values['group_forum'] : null,
             'forum_group_public_private'=> isset($values['public_private_group_forum_group']['public_private_group_forum']) ? $values['public_private_group_forum_group']['public_private_group_forum'] : null,
             'moderated'=> isset($values['moderated']['moderated']) ? 1 : 0,
+            'start_time' => isset($values['start_time']) ? $values['start_time'] : null,
+            'end_time' => isset($values['end_time']) ? $values['end_time'] : null,
             'forum_order'=> isset($new_max) ? $new_max : null,
             'session_id'=> $session_id,
             'lp_id' => isset($values['lp_id']) ? intval($values['lp_id']) : 0,

+ 12 - 4
main/forum/index.php

@@ -486,24 +486,32 @@ if (is_array($forumCategories)) {
                             null,
                             ICON_SIZE_MEDIUM
                         );
+
                         $linkForum = Display::tag(
                             'a',
                             $forum['forum_title'],
-                            array (
+                            [
                                 'href' => 'viewforum.php?' . api_get_cidreq()
                                     . '&gidReq=' . intval($groupid)
                                     . '&forum=' . intval($forum['forum_id']),
                                 'class' => return_visible_invisible(strval(intval($forum['visibility'])))
-                            )
+                            ]
                         );
 
+                        if (!empty($forum['start_time']) && !empty($forum['end_time'])) {
+                            $res = apiIsDateInDateRange($forum['start_time'], $forum['end_time']);
+                            if (!$res) {
+                                $linkForum = $forum['forum_title'];
+                            }
+                        }
+
                         $html .= '<h3 class="title">' . $iconForum . $linkForum . '</h3>';
                         $html .= Display::tag(
                             'p',
                             Security::remove_XSS($forum['forum_comment']),
-                            array(
+                            [
                                 'class'=>'description'
-                            )
+                            ]
                         );
                         $html .= '</div>';
                         $html .= '</div>';

+ 9 - 0
main/forum/viewforum.php

@@ -60,6 +60,15 @@ $isTutor = GroupManager::is_tutor_of_group($userId, $groupId, $courseId);
 $my_forum = isset($_GET['forum']) ? $_GET['forum'] : '';
 // Note: This has to be validated that it is an existing forum.
 $current_forum = get_forum_information($my_forum);
+$isForumOpenByDateAccess = apiIsDateInDateRange($current_forum['start_time'], $current_forum['end_time']);
+
+if (!$isForumOpenByDateAccess) {
+    if ($origin) {
+        api_not_allowed();
+    } else {
+        api_not_allowed(true);
+    }
+}
 
 if (empty($current_forum)) {
     api_not_allowed();

+ 16 - 1
main/inc/lib/TicketManager.php

@@ -1059,7 +1059,7 @@ class TicketManager
                 $dif = $now - $last_edit_date;
 
                 if ($dif > 172800 && $row['priority_id'] === self::PRIORITY_NORMAL && $row['status_id'] != self::STATUS_CLOSE) {
-                    $actions .= '<a href="myticket.php?ticket_id=' . $row['ticket_id'] . '&amp;action=alert">
+                    $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'ticket/myticket.php?ticket_id=' . $row['ticket_id'] . '&amp;action=alert">
                                  <img src="' . Display::returnIconPath('exclamation.png') . '" border="0" /></a>';
                 }
                 if ($row['priority_id'] === self::PRIORITY_HIGH) {
@@ -1875,4 +1875,19 @@ class TicketManager
 
         return $form;
     }
+
+    public static function getProjects()
+    {
+        $em = Database::getManager()->getRepository('ChamiloTicketBundle')->findAll();
+
+        return $em;
+    }
+
+
+    public static function getProjectsCount()
+    {
+        $em = Database::getManager()->getRepository('ChamiloTicketBundle')->findAll();
+
+        return $em;
+    }
 }

+ 25 - 2
main/inc/lib/api.lib.php

@@ -7956,16 +7956,39 @@ function api_protect_course_group($tool, $showHeader = true)
     }
 }
 
+/**
+ * Check if a date is in a date range
+ *
+ * @param datetime $startDate
+ * @param datetime $endDate
+ * @param datetime $currentDate
+ * @return bool true if date is in rage, false otherwise
+ */
+function apiIsDateInDateRange ($startDate, $endDate, $currentDate = null)
+{
+    $startDate = strtotime(api_get_local_time($startDate));
+    $endDate = strtotime(api_get_local_time($endDate));
+    $currentDate = strtotime(api_get_local_time($currentDate));
+
+    if (($currentDate >= $startDate) && ($currentDate <= $endDate)) {
+        return true;
+    }
+
+    return false;
+}
+
 /**
  * Eliminate the duplicates of a multidimensional array by sending the key
+ *
  * @param array $array multidimensional array
  * @param int $key key to find to compare
+ * @return array
  *
  */
 function api_unique_multidim_array($array, $key){
-    $temp_array = array();
+    $temp_array = [];
     $i = 0;
-    $key_array = array();
+    $key_array = [];
 
     foreach($array as $val){
         if(!in_array($val[$key],$key_array)){

+ 5 - 0
main/inc/lib/javascript/ckeditor/plugins/ckeditor_wiris/Readme.txt

@@ -3,3 +3,8 @@ Download the Plugin from here :
 http://www.wiris.com/es/plugins3/ckeditor/download
 and place the resulting folder inside
 main/inc/lib/javascript/ckeditor/plugins/
+
+To configure the plugin you need to assign read and write permissions to the cache and formulas directories inside the plugin or rename the configuration.ini.dist to configuration.ini and uncomment this lines if you want to change the place where stored the formula images :
+
+#wiriscachedirectory = /var/cache
+#wirisformuladirectory = /var/formulas

+ 2 - 2
main/inc/lib/template.lib.php

@@ -779,8 +779,8 @@ class Template
         global $httpHeadXtra, $interbreadcrumb, $language_file, $_configuration, $this_section;
         $_course = api_get_course_info();
         $help = $this->help;
-        $nameTools             = $this->title;
-        $navigation            = return_navigation_array();
+        $nameTools = $this->title;
+        $navigation = return_navigation_array();
         $this->menu_navigation = $navigation['menu_navigation'];
 
         $locale = api_get_language_isocode();

+ 27 - 12
main/inc/lib/userportal.lib.php

@@ -1110,6 +1110,7 @@ class IndexManager
         }
 
         if (is_array($session_categories)) {
+            $allSessions = [];
             foreach ($session_categories as $session_category) {
                 $session_category_id = $session_category['session_category']['id'];
 
@@ -1248,19 +1249,7 @@ class IndexManager
                                 $params['points'] = GamificationUtils::getSessionPoints($params['id'], $this->user_id);
                             }
                             $listSession[] = $params;
-                            $this->tpl->assign('session', $listSession);
-                            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
-                            $this->tpl->assign('gamification_mode', $gamificationModeIsActive);
 
-                            if (api_get_configuration_value('view_grid_courses')){
-                                $sessions_with_no_category = $this->tpl->fetch(
-                                    $this->tpl->get_template('/user_portal/grid_session.tpl')
-                                );
-                            } else {
-                                $sessions_with_no_category = $this->tpl->fetch(
-                                    $this->tpl->get_template('/user_portal/classic_session.tpl')
-                                );
-                            }
                             $sessionCount++;
                         }
                     }
@@ -1411,6 +1400,32 @@ class IndexManager
                     }
                 }
             }
+
+            $allCoursesInSessions = [];
+
+            foreach ($listSession as $currentSession) {
+                $coursesInSessions = $currentSession['courses'];
+                unset($currentSession['courses']);
+                foreach ($coursesInSessions as $coursesInSession) {
+                    $coursesInSession['session'] = $currentSession;
+                    $allCoursesInSessions[] = $coursesInSession;
+                }
+            }
+
+            $this->tpl->assign('all_courses', $allCoursesInSessions);
+            $this->tpl->assign('session', $listSession);
+            $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
+            $this->tpl->assign('gamification_mode', $gamificationModeIsActive);
+
+            if (api_get_configuration_value('view_grid_courses')){
+                $sessions_with_no_category = $this->tpl->fetch(
+                    $this->tpl->get_template('/user_portal/grid_session.tpl')
+                );
+            } else {
+                $sessions_with_no_category = $this->tpl->fetch(
+                    $this->tpl->get_template('/user_portal/classic_session.tpl')
+                );
+            }
         }
 
         return [

+ 8 - 2
main/install/data.sql

@@ -308,7 +308,9 @@ VALUES
 ('cron_remind_course_expiration_frequency', NULL, 'textfield', 'Crons', '2', 'CronRemindCourseExpirationFrequencyTitle', 'CronRemindCourseExpirationFrequencyComment', NULL, NULL, 1),
 ('cron_remind_course_expiration_activate', NULL, 'radio', 'Crons', 'false', 'CronRemindCourseExpirationActivateTitle', 'CronRemindCourseExpirationActivateComment', NULL, NULL, 1),
 ('allow_coach_feedback_exercises',NULL,'radio','Session','true','AllowCoachFeedbackExercisesTitle','AllowCoachFeedbackExercisesComment',NULL,NULL, 0),
-('allow_my_files',NULL,'radio','Platform','true','AllowMyFilesTitle','AllowMyFilesComment','',NULL, 1);
+('allow_my_files',NULL,'radio','Platform','true','AllowMyFilesTitle','AllowMyFilesComment','',NULL, 1),
+('ticket_allow_student_add', NULL, 'radio','Ticket', 'false','TicketAllowStudentAddTitle','TicketAllowStudentAddComment',NULL,NULL, 0),
+('ticket_allow_category_edition', NULL, 'radio','Ticket', 'false','TicketAllowCategoryEditionTitle','TicketAllowCategoryEditionComment',NULL,NULL, 0);
 
 INSERT INTO settings_options (variable, value, display_text)
 VALUES
@@ -628,7 +630,11 @@ VALUES
 ('allow_coach_feedback_exercises','true','Yes'),
 ('allow_coach_feedback_exercises','false','No'),
 ('allow_my_files','true','Yes'),
-('allow_my_files','false','No');
+('allow_my_files','false','No')
+('ticket_allow_student_add','true','Yes'),
+('ticket_allow_student_add','false','No'),
+('ticket_allow_category_edition','true','Yes'),
+('ticket_allow_category_edition','false','No');
 
 INSERT INTO language (original_name, english_name, isocode, dokeos_folder, available) VALUES
 ('&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;','arabic','ar','arabic',0),

+ 5 - 0
main/lang/english/trad4all.inc.php

@@ -7667,4 +7667,9 @@ $SaveRecordedAudio = "Save recorded audio";
 $GradeFromX = "Grades from course: %s";
 $TitleMandatory = "A title is required";
 $NoCourseCategorySupplied = "No course category was provided";
+$ForumStartDate = "Publication date";
+$ForumEndDate = "Closing date";
+$ForumStartDateComment = "The forum will be visible starting from this date";
+$ForumEndDateComment = "Once this date has passed, the forum will be closed";
+$ModeratedForum = "Moderated forum";
 ?>

File diff suppressed because it is too large
+ 16 - 17
main/lang/french/trad4all.inc.php


+ 5 - 0
main/lang/spanish/trad4all.inc.php

@@ -7686,4 +7686,9 @@ $SaveRecordedAudio = "Guardar el audio grabado";
 $GradeFromX = "Libreta de notas del curso: %s";
 $TitleMandatory = "Título obligatorio";
 $NoCourseCategorySupplied = "No se ha proporcionado una categoría de curso";
+$ForumStartDate = "Fecha de publicación";
+$ForumEndDate = "Fecha de cierre";
+$ForumStartDateComment = "El foro será visible a partir de esta fecha";
+$ForumEndDateComment = "Pasada esta fecha, el foro será automáticamente cerrado";
+$ModeratedForum = "Foro moderado";
 ?>

+ 12 - 8
main/ticket/categories.php

@@ -11,8 +11,6 @@ $cidReset = true;
 $course_plugin = 'ticket';
 require_once __DIR__.'/../inc/global.inc.php';
 
-$plugin = TicketPlugin::create();
-
 api_protect_admin_script(true);
 
 $toolName = get_lang('Categories');
@@ -37,7 +35,10 @@ if ($table->per_page == 0) {
 $formToString = '';
 $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
 
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => get_lang('MyTickets'));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
+    'name' => get_lang('MyTickets')
+);
 
 if (isset($_GET['action'])) {
     global $table;
@@ -45,13 +46,15 @@ if (isset($_GET['action'])) {
     switch ($action) {
         case 'delete':
             TicketManager::deleteCategory($id);
-
             Display::addFlash(Display::return_message(get_lang('Deleted')));
             header("Location: ".api_get_self());
             break;
         case 'add':
             $toolName = get_lang('Add');
-            $interbreadcrumb[] = array('url' => 'categories.php', 'name' => get_lang('Categories'));
+            $interbreadcrumb[] = array(
+                'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
+                'name' => get_lang('Categories')
+            );
             $url = api_get_self().'?action=add';
             $form = TicketManager::getCategoryForm($url);
             $formToString = $form->returnForm();
@@ -64,8 +67,6 @@ if (isset($_GET['action'])) {
                     'total_tickets' => 0,
                     'sys_insert_user_id' => api_get_user_id(),
                     'sys_insert_datetime' => api_get_utc_datetime(),
-                    'category_id' => 0,
-                    'project_id' => 0,
                     'course_required' => ''
                 ];
                 TicketManager::addCategory($params);
@@ -78,7 +79,10 @@ if (isset($_GET['action'])) {
             break;
         case 'edit':
             $toolName = get_lang('Edit');
-            $interbreadcrumb[] = array('url' => 'categories.php', 'name' => get_lang('Categories'));
+            $interbreadcrumb[] = array(
+                'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
+                'name' => get_lang('Categories')
+            );
             $url = api_get_self().'?action=edit&id='.$id;
             $form = TicketManager::getCategoryForm($url);
 

+ 8 - 2
main/ticket/categories_add_user.php

@@ -49,7 +49,13 @@ if ($form->validate()) {
     exit;
 }
 
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => get_lang('MyTickets'));
-$interbreadcrumb[] = array('url' => 'categories.php', 'name' => get_lang('Categories'));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
+    'name' => get_lang('MyTickets')
+);
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
+    'name' => get_lang('Categories')
+);
 Display::display_header(get_lang('Users'));
 $form->display();

+ 1 - 1
main/ticket/index.php

@@ -7,5 +7,5 @@
  */
 
 require_once __DIR__.'/../inc/global.inc.php';
-header('Location:' . api_get_path(WEB_CODE_PATH) . '/ticket/myticket.php');
+header('Location:' . api_get_path(WEB_CODE_PATH) . 'ticket/myticket.php');
 exit;

+ 3 - 3
main/ticket/myticket.php

@@ -220,12 +220,12 @@ if ($isAdmin) {
                 '<a href="' . api_get_self() . '?action=export' . $get_parameter . $get_parameter2 . '">' .
                     Display::return_icon('export_excel.png', get_lang('Export'), '', ICON_SIZE_MEDIUM) . '</a>';
 
-        /*if ($plugin->get('allow_category_edition')) {
+        if (api_get_setting('ticket_allow_category_edition')) {
             echo Display::url(
                 Display::return_icon('folder_document.gif'),
                 api_get_path(WEB_CODE_PATH) . 'ticket/categories.php'
             );
-        }*/
+        }
 
         echo Display::url(
             Display::return_icon('settings.png'),
@@ -258,7 +258,7 @@ if ($isAdmin) {
     $advancedSearchForm->addButtonSearch(get_lang('AdvancedSearch'), 'submit_advanced');
     $advancedSearchForm->display();
 } else {
-    if ($plugin->get('allow_student_add') == 'true') {
+    if (api_get_setting('ticket_allow_student_add') == 'true') {
         echo '<div class="actions" >';
         echo '<span style="float:right;">' .
                 '<a href="' . api_get_path(WEB_CODE_PATH) . 'ticket/new_ticket.php">' .

+ 5 - 4
main/ticket/new_ticket.php

@@ -8,8 +8,7 @@
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
-if (!api_is_platform_admin()
-//    $plugin->get('allow_student_add') != 'true'
+if (!api_is_platform_admin() && api_get_setting('ticket_allow_student_add') != 'true'
 ) {
     header('location:' . api_get_path(WEB_CODE_PATH).'ticket/myticket.php');
     exit;
@@ -570,8 +569,10 @@ function get_user_data($from, $number_of_items, $column, $direction)
     return $users;
 }
 
-
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => get_lang('MyTickets'));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php', 
+    'name' => get_lang('MyTickets')
+);
 
 if (!isset($_POST['compose'])) {
     if (api_is_platform_admin()) {

+ 156 - 0
main/ticket/projects.php

@@ -0,0 +1,156 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+/**
+ * This script is the Tickets plugin main entry point
+ * @package chamilo.plugin.ticket
+ */
+
+$cidReset = true;
+// needed in order to load the plugin lang variables
+$course_plugin = 'ticket';
+require_once __DIR__.'/../inc/global.inc.php';
+
+api_protect_admin_script(true);
+
+$toolName = get_lang('Project');
+
+$libPath = api_get_path(LIBRARY_PATH);
+$webLibPath = api_get_path(WEB_LIBRARY_PATH);
+
+$this_section = 'tickets';
+unset($_SESSION['this_section']);
+
+$table = new SortableTable(
+    'TicketProject',
+    array('TicketManager', 'getProjectsCount'),
+    array('TicketManager', 'getProjects'),
+    1
+);
+
+if ($table->per_page == 0) {
+    $table->per_page = 20;
+}
+
+$formToString = '';
+$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
+
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
+    'name' => get_lang('MyTickets')
+);
+
+if (isset($_GET['action'])) {
+    global $table;
+    $action = $_GET['action'];
+    switch ($action) {
+        case 'delete':
+            TicketManager::deleteProject($id);
+            Display::addFlash(Display::return_message(get_lang('Deleted')));
+            header("Location: ".api_get_self());
+            break;
+        case 'add':
+            $toolName = get_lang('Add');
+            $interbreadcrumb[] = array(
+                'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
+                'name' => get_lang('Categories')
+            );
+            $url = api_get_self().'?action=add';
+            $form = TicketManager::getProjectForm($url);
+            $formToString = $form->returnForm();
+            if ($form->validate()) {
+                $values =$form->getSubmitValues();
+
+                $params = [
+                    'name' => $values['name'],
+                    'description' => $values['description'],
+                    'total_tickets' => 0,
+                    'sys_insert_user_id' => api_get_user_id(),
+                    'sys_insert_datetime' => api_get_utc_datetime(),
+                    'course_required' => ''
+                ];
+                TicketManager::addProject($params);
+
+                Display::addFlash(Display::return_message(get_lang('Added')));
+
+                header("Location: ".api_get_self());
+                exit;
+            }
+            break;
+        case 'edit':
+            $toolName = get_lang('Edit');
+            $interbreadcrumb[] = array(
+                'url' => api_get_path(WEB_CODE_PATH).'ticket/categories.php',
+                'name' => get_lang('Categories')
+            );
+            $url = api_get_self().'?action=edit&id='.$id;
+            $form = TicketManager::getProjectForm($url);
+
+            $cat = TicketManager::getProject($_GET['id']);
+            $form->setDefaults($cat);
+            $formToString = $form->returnForm();
+            if ($form->validate()) {
+                $values =$form->getSubmitValues();
+
+                $params = [
+                    'name' => $values['name'],
+                    'description' => $values['description'],
+                    'sys_lastedit_datetime' => api_get_utc_datetime(),
+                    'sys_lastedit_user_id' => api_get_user_id()
+                ];
+                $cat = TicketManager::updateProject($_GET['id'], $params);
+                Display::addFlash(Display::return_message(get_lang('Updated')));
+                header("Location: ".api_get_self());
+                exit;
+            }
+            break;
+        default:
+            break;
+    }
+}
+
+$user_id = api_get_user_id();
+$isAdmin = api_is_platform_admin();
+
+/**
+ * Build the modify-column of the table
+ * @param   int     The user id
+ * @param   string  URL params to add to table links
+ * @param   array   Row of elements to alter
+ * @return string Some HTML-code with modify-buttons
+ */
+function modify_filter($id, $params, $row)
+{
+    $result = Display::url(
+        Display::return_icon('edit.png', get_lang('Edit')),
+        "projects.php?action=edit&id={$row['id']}"
+    );
+
+    $result .= Display::url(
+        Display::return_icon('delete.png', get_lang('Delete')),
+        "projects.php?action=delete&id={$row['id']}"
+    );
+
+	return $result;
+}
+
+$table->set_header(0, '', false);
+$table->set_header(1, get_lang('Title'), false);
+$table->set_header(2, get_lang('Description'), true, array("style" => "width:200px"));
+$table->set_header(3, get_lang('Actions'), true);
+$table->set_column_filter(3, 'modify_filter');
+
+Display::display_header($toolName);
+
+$items = [
+    [
+        'url' => 'projects.php?action=add',
+        'content' => Display::return_icon('new_folder.png', null, null, ICON_SIZE_MEDIUM)
+    ]
+];
+
+echo Display::actions($items);
+echo $formToString;
+echo $table->return_table();
+
+Display::display_footer();

+ 5 - 7
main/ticket/ticket_details.php

@@ -12,15 +12,13 @@ api_block_anonymous_users();
 
 $user_id = api_get_user_id();
 $isAdmin = api_is_platform_admin();
-$interbreadcrumb[] = array('url' => 'myticket.php', 'name' => get_lang('MyTickets'));
+$interbreadcrumb[] = array(
+    'url' => api_get_path(WEB_CODE_PATH).'ticket/myticket.php',
+    'name' => get_lang('MyTickets')
+);
 $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('TicketDetail'));
 
 $disableReponseButtons = '';
-/*if ($isAdmin) {
-    $disableReponseButtons = "$('#responseyes').attr('disabled', 'disabled');
-                              $('#responseno').attr('disabled', 'disabled');";
-}*/
-
 $htmlHeadXtra[] = '<script>
 $(document).ready(function() {
 	$("#dialog-form").dialog({
@@ -185,7 +183,7 @@ if (!isset($ticket['ticket'])) {
     api_not_allowed();
 }
 if (!isset($_GET['ticket_id'])) {
-    header('location:myticket.php');
+    header('Location: '.api_get_path(WEB_CODE_PATH).'ticket/myticket.php');
     exit;
 }
 if (isset($_POST['response'])) {

Some files were not shown because too many files changed in this diff