Skip to content

Commit 48d5be1

Browse files
committed
Merge branch '1.10.x' of https://github.com/chamilo/chamilo-lms into 1.10.0-rc
2 parents ad26bdf + 7adc126 commit 48d5be1

File tree

19 files changed

+343
-438
lines changed

19 files changed

+343
-438
lines changed

app/Migrations/Schema/V110/Version20150522222222.php

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,41 @@ class Version20150522222222 extends AbstractMigrationChamilo
1717
*/
1818
public function up(Schema $schema)
1919
{
20-
$this->addSql('ALTER TABLE user ADD COLUMN last_login datetime DEFAULT NULL');
20+
// The first ALTER queries here requires a check because the field might already exist
21+
$connection = $this->connection;
22+
$fieldExists = false;
23+
$sql = "SELECT *
24+
FROM user
25+
LIMIT 1";
26+
$result = $connection->executeQuery($sql);
27+
$dataList = $result->fetchAll();
28+
if (!empty($dataList)) {
29+
foreach ($dataList as $data) {
30+
if (isset($data['last_login'])) {
31+
$fieldExists = true;
32+
}
33+
}
34+
}
35+
if (!$fieldExists) {
36+
$this->addSql('ALTER TABLE user ADD COLUMN last_login datetime DEFAULT NULL');
37+
}
2138
// calendar events comments
22-
$this->addSql("ALTER TABLE c_calendar_event ADD COLUMN comment TEXT");
39+
$fieldExists = false;
40+
$sql = "SELECT *
41+
FROM c_calendar_event
42+
LIMIT 1";
43+
$result = $connection->executeQuery($sql);
44+
$dataList = $result->fetchAll();
45+
if (!empty($dataList)) {
46+
foreach ($dataList as $data) {
47+
if (isset($data['comment'])) {
48+
$fieldExists = true;
49+
}
50+
}
51+
}
52+
if (!$fieldExists) {
53+
$this->addSql("ALTER TABLE c_calendar_event ADD COLUMN comment TEXT");
54+
}
2355

2456
// Move some settings from configuration.php to the database
2557
// Current settings categories are:

app/Resources/public/css/base.css

Lines changed: 5 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,18 +2650,6 @@ form .formw .freeze {
26502650
margin-top: 1em;
26512651
background-color: #FFFFFF;
26522652
}
2653-
.skill-options .legend .title-skill,
2654-
.skill-options .saved_profiles .title-skill
2655-
{
2656-
color: #666655;
2657-
padding-bottom: 1em;
2658-
font-size: 16px;
2659-
}
2660-
.skill-options .skill-profile .title-skill{
2661-
color: #666655;
2662-
padding-bottom: .5em;
2663-
font-size: 18px;
2664-
}
26652653
.skill-options .skill-home{
26662654
margin-top: 1em;
26672655
margin-bottom: 1em;
@@ -2673,42 +2661,11 @@ form .formw .freeze {
26732661
padding-right: 0;
26742662
width: 100%;
26752663
}
2676-
.skill-options .accordion-heading {
2677-
border-bottom: 0px none;
2678-
background: #3FA5C3;
2679-
}
2680-
.skill-options .accordion-heading a{
2681-
color: #FFFFFF;
2682-
}
2683-
.skill-options .button-skill{
2684-
margin-top: 1em;
2685-
}
2686-
.skill-options .form-search .holder{
2687-
padding-left: .5em;
2688-
padding-right: .5em;
2689-
}
26902664
.skill-options .accordion-inner {
26912665
padding: 9px 15px;
26922666
/*border: 1px solid #dadada;*/
26932667
background-color: #FFFFFF;
26942668
}
2695-
.skill-options .items_save{
2696-
margin-top: .5em;
2697-
margin-bottom: .5em;
2698-
display: inline-block;
2699-
height: auto !important;
2700-
clear: both;
2701-
width: 100%;
2702-
}
2703-
.skill-options .accordion-group {
2704-
margin-bottom: 2px;
2705-
border: 1px solid #3FA5C3;
2706-
border-radius: 4px;
2707-
}
2708-
.skill-options .accordion-inner {
2709-
padding: 9px 15px;
2710-
border-top: 1px solid #3FA5C3;
2711-
}
27122669
.skill-options .load_wheel{
27132670
-moz-border-radius:6px;
27142671
-webkit-border-radius:6px;
@@ -2718,11 +2675,6 @@ form .formw .freeze {
27182675
padding:1px 5px 2px;
27192676
color:#333;
27202677
}
2721-
.skill-options .skill-items{
2722-
padding-bottom: 1em;
2723-
margin-bottom: .5em;
2724-
margin-top: .5em;
2725-
}
27262678
.skill-options .skill-winner{
27272679
list-style: none;
27282680
margin: 0;
@@ -2738,133 +2690,39 @@ form .formw .freeze {
27382690
padding-left: 1.5em;
27392691
padding-bottom: 1em;
27402692
}
2741-
.skill-options .skill-profile{
2742-
width: 100%;
2743-
display: block;
2744-
border: 1px solid #CCC;
2745-
border-radius: 10px;
2746-
-moz-border-radius: 10px;
2747-
-webkit-border-radius: 10px;
2748-
margin-top: 1em;
2749-
background-color: #FFFFFF;
2750-
padding-top: .5em;
2751-
padding-bottom: .5em;
2752-
margin-bottom: 1em;
2753-
}
2754-
.skill-options .section-info-skill{
2755-
display: inline-block;
2756-
padding-top: .5em;
2757-
padding-bottom: .5em;
2758-
width: 100%;
2759-
clear: both;
2760-
}
2761-
.skill-options .skill-profile .avatar{
2762-
display: block;
2763-
width: auto;
2764-
text-align: center;
2765-
}
2766-
.skill-options .skill-profile .info-user{
2767-
display: block;
2768-
width: auto;
2769-
margin-left: 1em;
2770-
padding: 1em;
2771-
}
2772-
.skill-options .button-skill{
2773-
margin-bottom: .5em;
2774-
}
27752693
.search-skill ul.holder li.bit-input input{
27762694
width: 100%;
27772695
}
2778-
.page-items-profile{
2779-
padding: .5em;
2780-
}
2781-
.page-items-profile .title-skill{
2782-
margin-bottom: .5em;
2783-
font-size: 18px;
2784-
color: #333333;
2785-
margin-top: .5em;
2786-
}
2787-
.page-items-profile .block-items{
2788-
display: block;
2789-
width: 22.5%;
2790-
margin:10px;
2791-
float: left;
2792-
}
2793-
.page-items-profile .award-items{
2794-
list-style: none;
2795-
margin: 0;
2796-
padding: 0;
2797-
font-size: 12px;
2798-
}
2799-
.page-items-profile .number-skill{
2800-
background-color: #FFFFFF;
2801-
padding-top: .5em;
2802-
padding-bottom: .5em;
2803-
padding-left: .5em;
2804-
margin-bottom: 1em;
2805-
font-size: 12px;
2806-
border: 1px solid #cccccc;
2807-
-webkit-border-radius: 4px;
2808-
-moz-border-radius: 4px;
2809-
border-radius: 4px;
2810-
}
2811-
.page-items-profile .block-items .border-items{
2812-
background-color: #ffffff;
2813-
-webkit-border-radius: 10px;
2814-
-moz-border-radius: 10px;
2815-
border-radius: 10px;
2816-
border: 1px solid #cccccc;
2696+
.skill-legend-basic {
2697+
color: #31A354;
28172698
}
28182699
.skill-legend-add{
2819-
background-color: #F89406;
2700+
color: #F89406;
28202701
}
28212702
.skill-legend-search{
2822-
background-color: #B94A48;
2703+
color: #B94A48;
28232704
}
28242705
.skill-legend-badges{
2825-
background-color: #3A87AD;
2706+
color: #3A87AD;
28262707
}
28272708
.page-skill .panel-heading a{
28282709
color: #ffffff;
28292710
}
28302711
.page-skill .btn-default{
28312712
background-color: #F6F6F6;
28322713
}
2833-
.page-skill .text, .page-skill #saved_profiles h4{
2834-
font-size: 12px;
2835-
}
28362714
.page-skill .btn-default:hover {
28372715
background-color: #E6E6E6;
28382716
}
28392717
.page-skill #skill_info{
28402718
font-size: 12px;
28412719
}
2842-
.page-skill .items_save .holder_simple{
2843-
padding: 0;
2844-
}
28452720
.page-skill #skill_wheel tspan{
28462721
font-size: 12px;
28472722
}
28482723
.page-skill .holder_simple li.bit-box a{
28492724
color: #8A6D3B;
28502725
}
2851-
.page-items-profile .items-info{
2852-
padding:1em;
2853-
}
2854-
.page-items-profile .info-profile{
2855-
margin-top: 1em;
2856-
margin-bottom: .5em;
2857-
}
2858-
.page-items-profile .items-info .avatar-profile{
2859-
text-align: center;
2860-
background: #FFFFFF;
2861-
-webkit-border-radius: 5px;
2862-
-moz-border-radius: 5px;
2863-
border-radius: 5px;
2864-
padding-bottom: 5px;
2865-
padding-top: 5px;
2866-
border: 1px solid #cccccc;
2867-
}
28682726
.skill_partition {
28692727
cursor: pointer;
28702728
stroke: #000000;

main/admin/configure_homepage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function home_tabs($file_logged_in)
153153
$clean_url .= '/';
154154

155155
$homep = $homePath; //homep for Home Path
156-
$homep_new = $homePath.'home/'.$clean_url; //homep for Home Path added the url
156+
$homep_new = $homePath.$clean_url; //homep for Home Path added the url
157157
$new_url_dir = $homePath.$clean_url;
158158
//we create the new dir for the new sites
159159
if (!is_dir($new_url_dir)) {

main/gradebook/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ function confirmation() {
770770
$category_id,
771771
$stud_id
772772
);
773-
if (!empty($certificate)) {
773+
if (isset($certificate['pdf_url'])) {
774774
echo Display::url(
775775
get_lang('DownloadCertificatePdf'),
776776
$certificate['pdf_url'],

main/gradebook/lib/be/category.class.php

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,7 @@ public function lock_all_items($locked)
17811781
*/
17821782
public static function register_user_certificate($category_id, $user_id)
17831783
{
1784+
$courseId = api_get_course_int_id();
17841785
$sessionId = api_get_session_id();
17851786
// Generating the total score for a course
17861787
$cats_course = Category::load(
@@ -1796,26 +1797,13 @@ public static function register_user_certificate($category_id, $user_id)
17961797
/** @var Category $category */
17971798
$category = $cats_course[0];
17981799

1799-
if (!$category->getGenerateCertificates()) {
1800-
1801-
$skill = new Skill();
1802-
$skill->add_skill_to_user(
1803-
$user_id,
1804-
$category_id,
1805-
api_get_course_int_id(),
1806-
$sessionId
1807-
);
1808-
1809-
return false;
1810-
}
1811-
18121800
//@todo move these in a function
18131801
$sum_categories_weight_array = array();
18141802
if (isset($cats_course) && !empty($cats_course)) {
18151803
$categories = Category::load(null, null, null, $category_id);
18161804
if (!empty($categories)) {
1817-
foreach ($categories as $category) {
1818-
$sum_categories_weight_array[$category->get_id()] = $category->get_weight();
1805+
foreach ($categories as $subCategory) {
1806+
$sum_categories_weight_array[$subCategory->get_id()] = $subCategory->get_weight();
18191807
}
18201808
} else {
18211809
$sum_categories_weight_array[$category_id] = $cats_course[0]->get_weight();
@@ -1839,6 +1827,38 @@ public static function register_user_certificate($category_id, $user_id)
18391827
return false;
18401828
}
18411829

1830+
$skillToolEnabled = api_get_setting('allow_skills_tool') == 'true';
1831+
$userHasSkills = false;
1832+
1833+
if ($skillToolEnabled) {
1834+
if (!$category->getGenerateCertificates()) {
1835+
$skill = new Skill();
1836+
$skill->add_skill_to_user(
1837+
$user_id,
1838+
$category_id,
1839+
$courseId,
1840+
$sessionId
1841+
);
1842+
}
1843+
1844+
$objSkillRelUser = new SkillRelUser();
1845+
$userSkills = $objSkillRelUser->get_user_skills($user_id, $courseId, $sessionId);
1846+
$userHasSkills = !empty($userSkills);
1847+
1848+
if (!$category->getGenerateCertificates() && $userHasSkills) {
1849+
return [
1850+
'badge_link' => Display::url(
1851+
get_lang('DownloadBadges'),
1852+
api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user=$user_id",
1853+
array(
1854+
'target' => '_blank',
1855+
'class' => 'btn btn-default'
1856+
)
1857+
)
1858+
];
1859+
}
1860+
}
1861+
18421862
$my_certificate = GradebookUtils::get_certificate_by_user_id(
18431863
$cats_course[0]->get_id(),
18441864
$user_id
@@ -1896,23 +1916,15 @@ public static function register_user_certificate($category_id, $user_id)
18961916
'pdf_url' => "$url&action=export"
18971917
);
18981918

1899-
if (api_get_setting('allow_skills_tool') == 'true') {
1900-
$courseId = api_get_course_int_id();
1901-
$sessionId = api_get_session_id();
1902-
1903-
$objSkillRelUser = new SkillRelUser();
1904-
$userSkills = $objSkillRelUser->get_user_skills($user_id, $courseId, $sessionId);
1905-
1906-
if (!empty($userSkills)) {
1907-
$html['badge_link'] = Display::url(
1908-
get_lang('DownloadBadges'),
1909-
api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user=$user_id",
1910-
array(
1911-
'target' => '_blank',
1912-
'class' => 'btn'
1913-
)
1914-
);
1915-
}
1919+
if ($skillToolEnabled && $userHasSkills) {
1920+
$html['badge_link'] = Display::url(
1921+
get_lang('DownloadBadges'),
1922+
api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user=$user_id",
1923+
array(
1924+
'target' => '_blank',
1925+
'class' => 'btn btn-default'
1926+
)
1927+
);
19161928
}
19171929
}
19181930
return $html;

0 commit comments

Comments
 (0)