Browse Source

Merge branch 'CT7614' of https://github.com/aragonc/chamilo-lms into aragonc-CT7614

Yannick Warnier 9 years ago
parent
commit
4561c37e5b

+ 43 - 2
app/Resources/public/css/base.css

@@ -43,8 +43,12 @@ select {
 .clear-header{
   height: 60px;
 }
-.title-header-tools{
-  text-align: center;
+.title-tools{
+  text-align: left;
+  font-size: 20px;
+  margin-bottom: 20px;
+  padding-top: 10px;
+  padding-left: 20px;
 }
 #formLogin .input-group{
   margin-top: 10px;
@@ -6115,6 +6119,43 @@ div#chat-remote-video video {
 #session-list .options p{
   margin: 0;
 }
+#custom-icons .items-tools{
+  padding: 10px;
+  border: 1px solid #CCCCCC;
+  border-radius: 5px;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  min-height: 185px;
+  margin-bottom: 20px;
+  text-align: center;
+}
+#custom-icons .name-tools{
+  font-size: 12px;
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
+#custom-icons .btn{
+  font-size: 18px;
+  line-height: 0;
+  margin-right: 5px;
+}
+#custom-icons .page-header{
+  margin: 20px 0px 20px;
+  border-bottom: 1px solid #CCCCCC;
+}
+.help-course{
+  background-color: #EEEEEE;
+  color: #666;
+  border: 1px dashed #B0B0B0;
+  border-radius: 5px;
+  -moz-border-radius: 5px;
+  -webkit-border-radius: 5px;
+  padding: 1em;
+  margin-bottom: 1em;
+  margin-right: 5%;
+  margin-left: 5%;
+  text-align: center;
+}
 /* CSS NEW TOP ******************************************************************************/
 /* CSS Responsive */
 @media (min-width: 1025px) and (max-width: 1200px) {

+ 3 - 6
main/course_home/activity.php

@@ -177,14 +177,11 @@ if ($session_id == 0 && api_is_course_admin() && api_is_allowed_to_edit(null, tr
  */
 function return_block($title, $content, $class = null)
 {
-    $html = '<div class="row course-title-tools">
-                <div class="col-md-12">
-                    <div class="title-header-tools">
-                        <h4>'.$title.'</h4>
-                    </div>
+    $html = '<div class="row">
+                <div class="col-xs-12 col-md-12">
+                    <div class="title-tools">' . $title . '</div>
                 </div>
             </div>
             <div class="row '.$class.'">'.$content.'</div>';
-
     return $html;
 }

+ 1 - 11
main/course_home/course_home.php

@@ -286,18 +286,8 @@ if (api_get_setting('homepage_view') == 'activity' ||
 	require 'vertical_activity.php';
 }
 
-$editIconButton = '';
-// The icons customization is only available in the base course at this time
-if (api_is_allowed_to_edit() && empty($sessionId)) {
-    $editIconButton = '<div class="pull-right">'.Display::url(
-        get_lang('CustomizeIcons'),
-        api_get_path(WEB_CODE_PATH).'course_info/tools.php?'.api_get_cidreq(),
-        ['class' => 'btn btn-default' ]
-    );
-    $editIconButton .= '</div>';
-}
 
-$content = '<div id="course_tools">'.$editIconButton.$content.'</div>';
+$content = '<div id="course_tools">'.$content.'</div>';
 $tpl = new Template(null);
 $tpl->assign('message', $show_message);
 $tpl->assign('content', $content);

+ 66 - 30
main/course_info/tools.php

@@ -35,7 +35,7 @@ switch ($action) {
             api_not_allowed(true);
         }
 
-        $interbreadcrumb[] = array('url' => api_get_self().'?'.api_get_cidreq(), 'name' => get_lang('Tools'));
+        $interbreadcrumb[] = array('url' => api_get_self().'?'.api_get_cidreq(), 'name' => get_lang('CustomizeIcons'));
 
         $toolName = $tool['name'];
 
@@ -43,9 +43,18 @@ switch ($action) {
 
         $form = new FormValidator('icon_edit', 'post', $currentUrl);
         $form->addElement('header', get_lang('EditIcon'));
+        $form->addHtml('<div class="col-md-7">');
         $form->addElement('text', 'name', get_lang('Name'));
         $form->addElement('text', 'link', get_lang('Links'));
-
+        $allowed_picture_types = array ('jpg', 'jpeg', 'png');
+        $form->addElement('file', 'icon', get_lang('CustomIcon'));
+        $form->addRule('icon', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
+        $form->addElement('select', 'target', get_lang('Target'), array('_self' => '_self', '_blank' => '_blank'));
+        $form->addElement('select', 'visibility', get_lang('Visibility'), array(1 => get_lang('Visible'), 0 => get_lang('Invisible')));
+        $form->addElement('textarea', 'description', get_lang('Description'),array ('rows' => '3', 'cols' => '40'));
+        $form->addButtonUpdate(get_lang('Update'));
+        $form->addHtml('</div>');
+        $form->addHtml('<div class="col-md-5">');
         if (isset($tool['custom_icon']) && !empty($tool['custom_icon'])) {
             $form->addLabel(
                 get_lang('Icon'),
@@ -56,15 +65,8 @@ switch ($action) {
 
             $form->addCheckBox('delete_icon', null, get_lang('DeletePicture'));
         }
+        $form->addHtml('</div>');
 
-        $allowed_picture_types = array ('jpg', 'jpeg', 'png');
-        $form->addElement('file', 'icon', get_lang('CustomIcon'));
-        $form->addRule('icon', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
-
-        $form->addElement('select', 'target', get_lang('Target'), array('_self' => '_self', '_blank' => '_blank'));
-        $form->addElement('select', 'visibility', get_lang('Visibility'), array(1 => get_lang('Visible'), 0 => get_lang('Invisible')));
-        $form->addElement('textarea', 'description', get_lang('Description'),array ('rows' => '3', 'cols' => '40'));
-        $form->addButtonUpdate(get_lang('Update'));
 
         $form->setDefaults($tool);
 
@@ -77,40 +79,74 @@ switch ($action) {
             if (isset($data['delete_icon'])) {
                 CourseHome::deleteIcon($id);
             }
-
-            header('Location: '.$currentUrl);
+            $currentUrlReturn = api_get_self().'?'.api_get_cidreq();
+            header('Location: '.$currentUrlReturn);
             exit;
         }
         break;
     case 'list':
     default:
-        $toolName = get_lang('Tools');
+
         $toolList = CourseHome::toolsIconsAction(
             api_get_course_int_id(),
             api_get_session_id()
         );
+        $iconsTools = '<div id="custom-icons">';
+        $iconsTools .= Display::page_header( get_lang('CustomizeIcons'),null,'h4');
+        $iconsTools .= '<div class="row">';
+        foreach($toolList as $tool){
+
+            if($tool['id']>20){
+                $toolName = $tool['name'];
+            }else{
+                $toolName = get_lang('Tool'.api_underscore_to_camel_case($tool['name']));
+            }
+
+            $iconsTools .= '<div class="col-md-2">';
+            $iconsTools .= '<div class="items-tools">';
+
+            if(!empty($tool['custom_icon'])){
+                $image = getCustomWebIconPath().$tool['custom_icon'];
+                $icon = Display::img($image,$toolName);
+            }else{
+                $image = (substr($tool['image'], 0, strpos($tool['image'], '.'))).'.png';
+                $icon = Display::return_icon(
+                    $image,
+                    $tool_name,
+                    array('id' => 'tool_'.$tool['id']),
+                    ICON_SIZE_BIG,
+                    false
+                );
+            }
 
-        $table = '<table class="data_table">';
-        foreach ($toolList as $tool) {
-            $table .= '<tr>';
-            $table .= '<td><a href="' . api_get_path(WEB_CODE_PATH) . $tool['link'] . '?' . api_get_cidreq() . '">
-                    <img src="' . api_get_path(WEB_IMG_PATH).$tool['image']. '"></a></td>';
-            $table .= '<td><a href="' . api_get_path(WEB_CODE_PATH) . $tool['link'] . '?' . api_get_cidreq() . '">' .
-                $tool['name']. '</a></td>';
-            $table .= '<td>
-                    <a class="btn btn-primary" href="' . api_get_self() . '?action=edit_icon&id=' . $tool['iid'] . '&'.api_get_cidreq().'">' .
-                    get_lang('Edit'). '</a></td>';
-            $delete = (!empty($tool['custom_icon'])) ? '<a class="btn btn-danger" href="' . api_get_self() . '?action=delete_icon&id=' . $tool['iid'] . '&'.api_get_cidreq().'">' .
-                get_lang('Delete'). '</a>' : '';
-            $table .= '<td>' . $delete . '</td>';
-            $table .= '</tr>';
+
+            $delete = (!empty($tool['custom_icon'])) ? '<a class="btn btn-default" href="' . api_get_self() . '?action=delete_icon&id=' . $tool['iid'] . '&'.api_get_cidreq().'">
+            <i class="fa fa-trash-o"></i></a>' : '';
+            $edit = '<a class="btn btn-default" href="' . api_get_self() . '?action=edit_icon&id=' . $tool['iid'] . '&'.api_get_cidreq().'"><i class="fa fa-pencil"></i></a>';
+
+
+            $iconsTools .= '<div class="icon-tools">'. $icon . '</div>';
+            $iconsTools .= '<div class="name-tools">' . $toolName . '</div>';
+            $iconsTools .= '<div class="toolbar">' . $edit . $delete . '</div>';
+            $iconsTools .= '</div>';
+            $iconsTools .= '</div>';
         }
-        $table .= '</table>';
-        $content = $table;
+        $iconsTools .= '</div>';
+        $iconsTools .= '</div>';
+
+        $content.=$iconsTools;
 
         break;
 }
-
+/**
+ * @return string
+ */
+function getCustomWebIconPath()
+{
+    // Check if directory exists or create it if it doesn't
+    $dir = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/course_home_icons/';
+    return $dir;
+}
 $tpl = new Template($toolName);
 
 $tpl->assign('content', $content);

+ 61 - 43
main/inc/introductionSection.inc.php

@@ -275,62 +275,60 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
         $thematic_description_html.='</div></div></div></div></div></div>';
     }
 }
-
-$introduction_section .= '<div class="row"><div class="col-md-12">';
-$introduction_section .=  $thematic_description_html;
-$introduction_section .=  '</div>';
-
-$introduction_section .=  '<div class="home-course-intro col-md-12"><div class="page-course">';
-
-if ($intro_dispDefault) {
-    if (!empty($intro_content)) {
-        $introduction_section.='<div class="page-course-intro">';
-        $introduction_section .=  $intro_content;
-        $introduction_section.='</div>';
-    }
+$introduction_section .= '<div class="row">';
+if (!empty($thematic_advance_info)) {
+    $introduction_section .= '<div class="col-md-12">';
+    $introduction_section .= $thematic_description_html;
+    $introduction_section .= '</div>';
+}
+$editIconButton = '';
+if (api_is_allowed_to_edit()) {
+    $editIconButton = Display::url(
+        '<i class="fa fa-wrench"></i> ',
+        api_get_path(WEB_CODE_PATH).'course_info/tools.php?'.api_get_cidreq(),
+        ['class' => 'btn btn-default', 'title' => get_lang('CustomizeIcons') ]
+    );
 }
-$introduction_section .=  '</div></div>';
-
 if ($intro_dispCommand) {
     if (empty($intro_content)) {
         // Displays "Add intro" commands
-        $introduction_section .=  '<div id="courseintro_empty">';
+        $toolbar =  '<div class="btn-group pull-right" rol="group">';
         if (!empty ($GLOBALS['_cid'])) {
-            $introduction_section .=  "<a href=\"".api_get_self()."?".api_get_cidreq()."&amp;intro_cmdAdd=1\">";
-            $introduction_section .=  Display::return_icon('introduction_add.gif', get_lang('AddIntro')).' ';
-            $introduction_section .=  "</a>";
+            $textIntro  =  '<a class="btn btn-default" title="' . get_lang('AddIntro') . '" href="'.api_get_self().'?' . api_get_cidreq().'&amp;intro_cmdAdd=1">';
+            $textIntro .=   '<i class="fa fa-file-text"></i> ';
+            $textIntro .=  "</a>";
+            $toolbar .= $textIntro . $editIconButton;
         } else {
-            $introduction_section .= "<a href=\"".api_get_self()."?intro_cmdAdd=1\">\n".get_lang('AddIntro')."</a>";
+            $toolbar .= '<a class="btn btn-default" href="' . api_get_self() . '?intro_cmdAdd=1">"' . get_lang('AddIntro') . '</a>';
+            $toolbar .= $editIconButton;
         }
-        $introduction_section .= "</div>";
+        $toolbar .= '</div>';
 
     } else {
         // Displays "edit intro && delete intro" commands
-        $introduction_section .=  '<div id="courseintro_empty">';
+        $toolbar .=  '<div class="btn-group pull-right" rol="group">';
         if (!empty ($GLOBALS['_cid'])) {
-            $introduction_section .=
-                "<a href=\"".api_get_self()."?".api_get_cidreq()."&amp;intro_cmdEdit=1\">".
-                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).
-                "</a>";
-            $introduction_section .=
-                "<a href=\"".api_get_self()."?".api_get_cidreq()."&amp;intro_cmdDel=1\" onclick=\"javascript:
-                if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).
-                "')) return false;\">".
-                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).
-                "</a>";
+            $toolbar .=
+                '<a  class="btn btn-default" href="'.api_get_self().'?'.api_get_cidreq().'&amp;intro_cmdEdit=1" title="'.get_lang('Modify').'">
+                <i class="fa fa-pencil"></i></a>';
+            $toolbar .= $editIconButton;
+            $toolbar .=
+                '<a class="btn btn-default" title="' . get_lang('Delete') . '" href="'.api_get_self().'?'.api_get_cidreq().'&amp;intro_cmdDel=1" onclick="javascript:
+                if(!confirm('.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).
+                ')) return false;"> <i class="fa fa-trash-o"></i> </a>';
+
         } else {
-            $introduction_section .=
-                "<a href=\"".api_get_self()."?intro_cmdEdit=1\">".
-                Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).
-                "</a>";
-            $introduction_section .=
-                "<a href=\"".api_get_self()."?intro_cmdDel=1\" onclick=\"javascript:
-                if(!confirm('".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).
-                "')) return false;\">".
-                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).
-                "</a>";
+            $toolbar .=
+                '<a class="btn btn-default" href="'.api_get_self().'?intro_cmdEdit=1" title="'.get_lang('Modify').'">
+                <i class="fa fa-pencil"></i>
+                </a>"';
+            $toolbar .= $editIconButton;
+            $toolbar .=
+                '<a class="btn btn-default" title="' . get_lang('Delete') . '" href="'.api_get_self().'?intro_cmdDel=1" onclick="javascript:
+                if(!confirm('.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).')) return false;>
+                <i class="fa fa-trash-o"></i> </a>';
         }
-        $introduction_section .=  "</div>";
+        $toolbar .=  "</div>";
         // Fix for chrome XSS filter for videos in iframes - BT#7930
         $browser = api_get_navigator();
         if (strpos($introduction_section, '<iframe') !== false && $browser['name'] == 'Chrome') {
@@ -338,6 +336,26 @@ if ($intro_dispCommand) {
         }
     }
 }
+
+$introduction_section .=  '<div class="col-md-12">';
+
+if ($intro_dispDefault) {
+    if (!empty($intro_content)) {
+        $introduction_section .='<div class="page-course">';
+        $introduction_section .=  $intro_content;
+        $introduction_section .= '</div>';
+    }else{
+        $introduction_section .= '<div class="help-course">';
+        $introduction_section .= get_lang('AddCustomCourse').' ' . $textIntro ;
+        $introduction_section .= '</div>';
+    }
+}
+
+$introduction_section .= $toolbar;
+$introduction_section .= '</div>';
+
+
+
 $introduction_section .=  '</div>';
 
 $browser = api_get_navigator();

File diff suppressed because it is too large
+ 56 - 56
main/lang/spanish/trad4all.inc.php


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