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

1.10.x
Yannick Warnier 11 years ago
commit b27d2f7b73
  1. 13
      app/Resources/public/css/base.css
  2. 6
      main/admin/configure_homepage.php
  3. 4
      main/inc/ajax/course_home.ajax.php
  4. 2
      main/inc/lib/display.lib.php
  5. 19
      main/inc/lib/formvalidator/Element/HtmlEditor.php
  6. 10
      main/inc/lib/formvalidator/FormValidator.class.php
  7. 62
      main/inc/lib/userportal.lib.php
  8. 6
      main/install/index.php
  9. 273
      main/install/install.lib.php
  10. 7
      main/newscorm/learnpath.class.php
  11. 347
      main/template/default/auth/courses_categories.php
  12. 17
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php

@ -130,6 +130,11 @@ a.thumbnail:hover{
height: auto;
width: 100%;
}
#notice_block p, #notice-block p{
color: #666;
font-size: 12px;
line-height: 20px;
}
.carousel-indicators{
bottom: 0px !important;
}
@ -6019,7 +6024,7 @@ div#chat-remote-video video {
.filler-report .filler-report-data-init{
width: 60%;
}
#hot-course .items-course{
.items-course{
padding: 10px;
border: 1px solid #e6e6e6;
border-radius: 5px;
@ -6028,15 +6033,15 @@ div#chat-remote-video video {
min-height: 350px;
margin-bottom: 10px;
}
#hot-course .items-course .items-course-info .title{
.items-course .items-course-info .title{
font-size: 14px;
min-height: 32px;
}
#hot-course .items-course .items-course-info .teachers{
.items-course .items-course-info .teachers{
font-size: 12px;
color: #666666;
}
#hot-course .items-course .items-course-info .ranking{
.items-course .items-course-info .ranking{
font-size: 10px;
color: #666666;
}

@ -286,7 +286,7 @@ if (!empty($action)) {
if (is_writable($homep.$noticef.'_'.$lang.$ext)) {
$fp = fopen($homep.$noticef.'_'.$lang.$ext, 'w');
if ($errorMsg == '') {
fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
fputs($fp, "<h5>$notice_title</h5><p>\n$notice_text");
foreach ($_languages['name'] as $key => $value) {
$lang_name = $_languages['folder'][$key];
@ -294,7 +294,7 @@ if (!empty($action)) {
if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) {
if (is_writable($homep.$noticef.'_'.$lang_name.$ext)) {
$fp = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w');
fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
fputs($fp, "<h5>$notice_title</h5><p>\n$notice_text");
fclose($fp);
}
}
@ -321,7 +321,7 @@ if (!empty($action)) {
} else {
//File does not exist
$fp = fopen($homep.$noticef.'_'.$lang.$ext, 'w');
fputs($fp, "<b>$notice_title</b><br />\n$notice_text");
fputs($fp, "<h5>$notice_title</h5><p>\n$notice_text");
fclose($fp);
}
Event::addEvent(

@ -75,8 +75,8 @@ switch ($action) {
exit;
}
}
echo Display::tag('h2', $course_info['name']);
echo '<br />';
//echo Display::tag('h2', $course_info['name']);
//echo '<br />';
$sql = "SELECT * FROM $tbl_course_description
WHERE c_id = ".$course_info['real_id']." AND session_id = 0

@ -1627,7 +1627,7 @@ class Display
$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
}
$html .= Display::span(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info'));
$html .= Display::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info'));
$html .= ' '.Display::span(' ', array('id' => 'vote_label2_'.$id));
if ($add_div_wrapper) {

@ -57,6 +57,7 @@ class HtmlEditor extends HTML_QuickForm_textarea
if ($this->editor) {
if ($this->editor->getConfigAttribute('fullPage')) {
if (strlen(trim($value)) == 0) {
// TODO: To be considered whether here to be added DOCTYPE, language and character set declarations.
$value = '<html><head><title></title></head><body></body></html>';
@ -69,7 +70,14 @@ class HtmlEditor extends HTML_QuickForm_textarea
if ($this->isFrozen()) {
return $this->getFrozenHtml();
} else {
return $this->buildEditor();
$styleCss = $this->editor->getConfigAttribute('style');
if ($styleCss){
$style = true;
} else {
$style = false;
}
return $this->buildEditor($style);
}
}
@ -85,13 +93,18 @@ class HtmlEditor extends HTML_QuickForm_textarea
/**
* @return string
*/
public function buildEditor()
public function buildEditor($style=false)
{
$result = '';
if ($this->editor) {
$this->editor->value = $this->getValue();
$this->editor->setName($this->getName());
$result = $this->editor->createHtml();
if($style==true){
$result = $this->editor->createHtmlStyle();
} else {
$result = $this->editor->createHtml();
}
}
return $result;

@ -749,11 +749,11 @@ EOT;
* @param bool $fullPage (optional) When it is true, the editor loads completed html code for a full page.
* @param array $config (optional) Configuration settings for the online editor.
*/
public function addHtmlEditor($name, $label, $required = true, $fullPage = false, $config = array())
public function addHtmlEditor($name, $label, $required = true, $fullPage = false, $config = array(), $style = false)
{
$config['rows'] = isset($config['rows']) ? $config['rows'] : 15;
$config['cols'] = isset($config['cols']) ? $config['cols'] : 80;
$this->addElement('html_editor', $name, $label, $config);
$this->addElement('html_editor', $name, $label, $config, $style);
$this->applyFilter($name, 'trim');
if ($required) {
$this->addRule($name, get_lang('ThisFieldIsRequired'), 'required');
@ -761,11 +761,13 @@ EOT;
/** @var HtmlEditor $element */
$element = $this->getElement($name);
if ($style){
$config['style'] = true;
}
if ($fullPage) {
$config['fullPage'] = true;
}
if ($element->editor) {
$element->editor->processConfig($config);
}

@ -179,12 +179,12 @@ class IndexManager
if ($show_menu) {
$html .= '<ul class="nav nav-pills nav-stacked">';
if ($show_create_link) {
$html .= '<li class="add-course"><a href="' . api_get_path(WEB_CODE_PATH) . 'create_course/add_course.php">'.(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
$html .= '<li class="add-course"><a href="' . api_get_path(WEB_CODE_PATH) . 'create_course/add_course.php">'.Display::return_icon('new-course.png', get_lang('CourseCreate')).(api_get_setting('course_validation') == 'true' ? get_lang('CreateCourseRequest') : get_lang('CourseCreate')).'</a></li>';
}
if ($show_course_link) {
if (!api_is_drh() && !api_is_session_admin()) {
$html .= '<li class="list-course"><a href="' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php">'.get_lang('CourseCatalog').'</a></li>';
$html .= '<li class="list-course"><a href="'. api_get_path(WEB_CODE_PATH) . 'auth/courses.php">'. Display::return_icon('catalog-course.png', get_lang('CourseCatalog')) .get_lang('CourseCatalog').'</a></li>';
} else {
$html .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'dashboard/index.php">'.get_lang('Dashboard').'</a></li>';
}
@ -193,7 +193,7 @@ class IndexManager
}
if (!empty($html)) {
$html = self::show_right_block(get_lang('Courses'), $html, 'teacher_block');
$html = self::show_right_block(get_lang('Courses'), $html, 'teacher_block', null, 'teachers', 'teachersCollapse');
}
return $html;
@ -269,8 +269,8 @@ class IndexManager
if (!empty($home_notice)) {
$home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));
$home_notice = Display::div($home_notice, array('class' => 'homepage_notice'));
$html = self::show_right_block(get_lang('Notice'), $home_notice, 'notice_block');
//$home_notice = Display::div($home_notice, array('class' => 'homepage_notice'));
$html = self::show_right_block(get_lang('Notice'), $home_notice, 'notice_block', null, 'notices', 'noticesCollapse');
}
return $html;
}
@ -293,7 +293,7 @@ class IndexManager
$home_menu_content = '<ul class="nav nav-pills nav-stacked">';
$home_menu_content .= api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));
$home_menu_content .= '</ul>';
$html .= self::show_right_block(get_lang('MenuGeneral'), $home_menu_content, 'help_block');
$html .= self::show_right_block(get_lang('MenuGeneral'), $home_menu_content, 'help_block', null, 'helps', 'helpsCollapse');
}
return $html;
}
@ -349,7 +349,7 @@ class IndexManager
}
}
$content .= '</ul>';
$html = self::show_right_block(get_lang("Skills"), $content, 'skill_block');
$html = self::show_right_block(get_lang("Skills"), $content, 'skill_block',null, 'skills', 'skillsCollapse');
return $html;
}
@ -680,17 +680,30 @@ class IndexManager
/**
* @todo use the template system
*/
function show_right_block($title, $content, $id = null, $params = null) {
if (!empty($id)) {
$params['id'] = $id;
}
$params['class'] = 'panel panel-default';
$html = null;
if (!empty($title)) {
$html.= '<div class="panel-heading">'.$title.'</div>';
}
$html.= '<div class="panel-body">'.$content.'</div>';
$html = Display::div($html, $params);
function show_right_block($title, $content, $id = null, $params = null, $idAccordion = null, $idCollpase = null) {
if (!empty($idAccordion)){
$html = null;
$html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">';
$html .= '<div class="panel panel-default" id="'.$id.'">';
$html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">';
$html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollpase.'" aria-expanded="true" aria-controls="'.$idCollpase.'">';
$html .= $title.'</a></h4></div>';
$html .= '<div id="'.$idCollpase.'" class="panel-collapse collapse in" role="tabpanel">';
$html .= '<div class="panel-body">'.$content.'</div>';
$html .= '</div></div></div>';
}else{
if (!empty($id)) {
$params['id'] = $id;
}
$params['class'] = 'panel panel-default';
$html = null;
if (!empty($title)) {
$html.= '<div class="panel-heading">'.$title.'</div>';
}
$html.= '<div class="panel-body">'.$content.'</div>';
$html = Display::div($html, $params);
}
return $html;
}
@ -838,7 +851,13 @@ class IndexManager
$profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.Display::return_icon('edit-profile.png',get_lang('EditProfile'),null,ICON_SIZE_SMALL).get_lang('EditProfile').'</a></li>';
$profile_content .= '</ul>';
$html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block');
$html = self::show_right_block(get_lang('Profile'),
$profile_content,
'profile_block',
null,
'profile',
'profileCollapse'
);
return $html;
}
@ -947,7 +966,10 @@ class IndexManager
$html = self::show_right_block(
get_lang('Courses'),
$my_account_content,
'course_block'
'course_block',
null,
'course',
'courseCollapse'
);
}
return $html;

@ -560,11 +560,11 @@ if (@$_POST['step2']) {
//STEP 6 : LAST CHECK BEFORE INSTALL
?>
<div class="RequirementHeading">
<h2><?php echo display_step_sequence().get_lang('LastCheck'); ?></h2>
<h3><?php echo display_step_sequence().get_lang('LastCheck'); ?></h3>
</div>
<div class="RequirementContent">
<?php echo get_lang('HereAreTheValuesYouEntered'); ?>
</div><br />
</div>
<?php
if ($installType == 'new') {
@ -629,7 +629,7 @@ if (@$_POST['step2']) {
$msg = get_lang('UpdateExecution');
}
echo '<div class="RequirementHeading">
<h2>'.display_step_sequence().$msg.'</h2>';
<h3>'.display_step_sequence().$msg.'</h3>';
if (!empty($installationProfile)) {
echo ' <h3>('.$installationProfile.')</h3>';
}

@ -605,18 +605,20 @@ function display_language_selection_box($name = 'language_list', $default_langua
}
// Displaying the box.
echo "\t\t<select name=\"$name\">\n";
$html = '';
$html .= "\t\t<select class='form-control' name=\"$name\">\n";
foreach ($language_list as $key => $value) {
if ($key == $default_language) {
$option_end = ' selected="selected">';
} else {
$option_end = '>';
}
echo "\t\t\t<option value=\"$key\"$option_end";
echo $value;
echo "</option>\n";
$html .= "\t\t\t<option value=\"$key\"$option_end";
$html .= $value;
$html .= "</option>\n";
}
echo "\t\t</select>\n";
$html .= "\t\t</select>\n";
return $html;
}
/**
@ -633,10 +635,10 @@ function display_language_selection()
<p><?php echo get_lang('PleaseSelectInstallationProcessLanguage'); ?>:</p>
<form id="lang_form" method="post" action="<?php echo api_get_self(); ?>">
<div class="form-group">
<div class="col-sm-2">
<?php display_language_selection_box('language_list', api_get_interface_language()); ?>
<div class="col-sm-4">
<?php echo display_language_selection_box('language_list', api_get_interface_language()); ?>
</div>
<div class="col-sm-8">
<div class="col-sm-6">
<button type="submit" name="step1" class="btn btn-success" value="<?php echo get_lang('Next'); ?>">
<i class="fa fa-forward"> </i>
<?php echo get_lang('Next'); ?></button>
@ -683,7 +685,7 @@ function display_requirements(
echo '</div>';
// SERVER REQUIREMENTS
echo '<div class="RequirementHeading"><h2>'.get_lang('ServerRequirements').'</h2>';
echo '<div class="RequirementHeading"><h4>'.get_lang('ServerRequirements').'</h4>';
$timezone = checkPhpSettingExists("date.timezone");
if (!$timezone) {
@ -768,7 +770,7 @@ function display_requirements(
// RECOMMENDED SETTINGS
// Note: these are the settings for Joomla, does this also apply for Chamilo?
// Note: also add upload_max_filesize here so that large uploads are possible
echo '<div class="RequirementHeading"><h2>'.get_lang('RecommendedSettings').'</h2>';
echo '<div class="RequirementHeading"><h4>'.get_lang('RecommendedSettings').'</h4>';
echo '<div class="RequirementText">'.get_lang('RecommendedSettingsInfo').'</div>';
echo '<div class="RequirementContent">';
echo '<table class="table">
@ -842,7 +844,7 @@ function display_requirements(
echo '</div>';
// DIRECTORY AND FILE PERMISSIONS
echo '<div class="RequirementHeading"><h2>'.get_lang('DirectoryAndFilePermissions').'</h2>';
echo '<div class="RequirementHeading"><h4>'.get_lang('DirectoryAndFilePermissions').'</h4>';
echo '<div class="RequirementText">'.get_lang('DirectoryAndFilePermissionsInfo').'</div>';
echo '<div class="RequirementContent">';
@ -1449,7 +1451,22 @@ function display_database_settings_form(
<?php
}
function panel($content=null, $title=null, $id=null, $style=null){
$html = '';
if(empty($style)){
$style = 'default';
}
if (!empty($title)){
$panelTitle = Display::div($title, array('class' => 'panel-heading'));
$panelBody = Display::div($content, array('class' => 'panel-body'));
$panelParent = Display::div($panelTitle . $panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
} else {
$panelBody = Display::div($html, array('class' => 'panel-body'));
$panelParent = Display::div($panelBody, array('id' => $id, 'class' => 'panel panel-'.$style));
}
$html .= $panelParent;
return $html;
}
/**
* Displays a parameter in a table row.
* Used by the display_configuration_settings_form function.
@ -1466,14 +1483,15 @@ function display_configuration_parameter(
$parameterValue,
$displayWhenUpdate = 'true'
) {
echo "<tr>";
echo "<td>$parameterName</td>";
$html = '<div class="form-group">';
$html.= '<label class="col-sm-6 control-label">' . $parameterName . '</label>';
if ($installType == INSTALL_TYPE_UPDATE && $displayWhenUpdate) {
echo '<td><input type="hidden" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'.$parameterValue."</td>";
$html.= '<input type="hidden" name="' . $formFieldName . '" value="'. api_htmlentities($parameterValue, ENT_QUOTES). '" />' . $parameterValue;
} else {
echo '<td><input type="text" size="'.FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.MAX_FORM_FIELD_LENGTH.'" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'."</td>";
$html.= '<div class="col-sm-6"><input class="form-control" type="text" size="'.FORM_FIELD_DISPLAY_LENGTH.'" maxlength="'.MAX_FORM_FIELD_LENGTH.'" name="'.$formFieldName.'" value="'.api_htmlentities($parameterValue, ENT_QUOTES).'" />'."</div>";
}
echo "</tr>";
$html.= "</div>";
return $html;
}
/**
@ -1520,148 +1538,151 @@ function display_configuration_settings_form(
echo '<p>'.get_lang('ConfigSettingsInfo').' <strong>main/inc/conf/configuration.php</strong></p>';
echo '<fieldset>';
echo '<legend>'.get_lang('Administrator').'</legend>';
echo '<table class="table">';
// Parameter 1: administrator's login
$html = '';
display_configuration_parameter($installType, get_lang('AdminLogin'), 'loginForm', $loginForm, $installType == 'update');
$html .= display_configuration_parameter($installType, get_lang('AdminLogin'), 'loginForm', $loginForm, $installType == 'update');
// Parameter 2: administrator's password
if ($installType != 'update') {
display_configuration_parameter($installType, get_lang('AdminPass'), 'passForm', $passForm, false);
$html .= display_configuration_parameter($installType, get_lang('AdminPass'), 'passForm', $passForm, false);
}
// Parameters 3 and 4: administrator's names
display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName);
display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName);
$html .= display_configuration_parameter($installType, get_lang('AdminFirstName'), 'adminFirstName', $adminFirstName);
$html .= display_configuration_parameter($installType, get_lang('AdminLastName'), 'adminLastName', $adminLastName);
//Parameter 3: administrator's email
display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm);
$html .= display_configuration_parameter($installType, get_lang('AdminEmail'), 'emailForm', $emailForm);
//Parameter 6: administrator's telephone
display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm);
echo '</table>';
echo '</fieldset>';
$html .= display_configuration_parameter($installType, get_lang('AdminPhone'), 'adminPhoneForm', $adminPhoneForm);
echo '<fieldset>';
echo '<legend>'.get_lang('Platform').'</legend>';
echo panel($html, get_lang('Administrator'), 'administrator');
echo '<table class="table">';
//echo '<table class="table">';
//First parameter: language
echo "<tr>";
echo '<td>'.get_lang('MainLang')."&nbsp;&nbsp;</td>";
$html = '<div class="form-group">';
$html .= '<label class="col-sm-6 control-label">'.get_lang('MainLang')."</label>";
if ($installType == 'update') {
echo '<td><input type="hidden" name="languageForm" value="'.api_htmlentities($languageForm, ENT_QUOTES).'" />'.$languageForm."</td>";
$html .= '<input type="hidden" name="languageForm" value="'.api_htmlentities($languageForm, ENT_QUOTES).'" />'.$languageForm;
} else { // new installation
echo '<td>';
display_language_selection_box('languageForm', $languageForm);
echo "</td>\n";
$html .= '<div class="col-sm-6">';
$html .= display_language_selection_box('languageForm', $languageForm);
$html .= '</div>';
}
echo "</tr>\n";
$html.= "</div>";
//Second parameter: Chamilo URL
echo "<tr>";
echo '<td>'.get_lang('ChamiloURL').' (<font color="red">'.get_lang('ThisFieldIsRequired')."</font>)&nbsp;&nbsp;</td>";
$html .= '<div class="form-group">';
$html .= '<label class="col-sm-6 control-label">'.get_lang('ChamiloURL') .get_lang('ThisFieldIsRequired').'</label>';
if ($installType == 'update') {
echo '<td>'.api_htmlentities($urlForm, ENT_QUOTES)."</td>\n";
$html .= api_htmlentities($urlForm, ENT_QUOTES)."\n";
} else {
echo '<td><input type="text" size="40" maxlength="100" name="urlForm" value="'.api_htmlentities($urlForm, ENT_QUOTES).'" />'."</td>";
$html .= '<div class="col-sm-6">';
$html .= '<input class="form-control" type="text" size="40" maxlength="100" name="urlForm" value="'.api_htmlentities($urlForm, ENT_QUOTES).'" />';
$html .= '</div>';
}
echo "</tr>";
$html .= '</div>';
//Parameter 9: campus name
display_configuration_parameter($installType, get_lang('CampusName'), 'campusForm', $campusForm);
$html .= display_configuration_parameter($installType, get_lang('CampusName'), 'campusForm', $campusForm);
//Parameter 10: institute (short) name
display_configuration_parameter($installType, get_lang('InstituteShortName'), 'institutionForm', $institutionForm);
$html .= display_configuration_parameter($installType, get_lang('InstituteShortName'), 'institutionForm', $institutionForm);
//Parameter 11: institute (short) name
display_configuration_parameter($installType, get_lang('InstituteURL'), 'institutionUrlForm', $institutionUrlForm);
?>
<tr>
<td><?php echo get_lang("EncryptMethodUserPass"); ?> :</td>
<?php if ($installType == 'update') { ?>
<td><input type="hidden" name="encryptPassForm" value="<?php echo $encryptPassForm; ?>" /><?php echo $encryptPassForm; ?></td>
<?php } else { ?>
<td>
<div class="control-group">
<label class="radio inline">
<input type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" <?php echo ($encryptPassForm == 'bcrypt') ? 'checked="checked" ': ''; ?>/><?php echo 'bcrypt'; ?>
</label>
<label class="radio inline">
<input type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" <?php echo ($encryptPassForm == 'sha1') ? 'checked="checked" ': ''; ?>/><?php echo 'sha1'; ?>
</label>
<label class="radio inline">
<input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" <?php echo $encryptPassForm == 1 ? 'checked="checked" ' : ''; ?>/><?php echo 'md5'; ?>
</label>
<label class="radio inline">
<input type="radio" name="encryptPassForm" value="none" id="encryptPass2" <?php echo $encryptPassForm === '0' or $encryptPassForm === 0 ? 'checked="checked" ':''; ?>/><?php echo get_lang('None'); ?>
</label>
</div>
</td>
<?php } ?>
</tr>
<tr>
<td><?php echo get_lang('AllowSelfReg'); ?> :</td>
<?php if ($installType == 'update'): ?>
<td><input type="hidden" name="allowSelfReg" value="<?php echo $allowSelfReg; ?>" /><?php echo $allowSelfReg ? get_lang('Yes') : get_lang('No'); ?></td>
<?php else: ?>
<td>
<div class="control-group">
<label class="radio inline">
<input type="radio" name="allowSelfReg" value="1" id="allowSelfReg1" <?php echo $allowSelfReg ? 'checked="checked" ' : ''; ?>/> <?php echo get_lang('Yes'); ?>
</label>
<label class="radio inline">
<input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" <?php echo $allowSelfReg ? '' : 'checked="checked" '; ?>/><?php echo get_lang('No'); ?>
</label>
</div>
</td>
<?php endif; ?>
</tr>
<tr>
<td><?php echo get_lang('AllowSelfRegProf'); ?> :</td>
<?php if ($installType == 'update'): ?>
<td><input type="hidden" name="allowSelfRegProf" value="<?php echo $allowSelfRegProf; ?>" /><?php echo $allowSelfRegProf? get_lang('Yes') : get_lang('No'); ?></td>
<?php else: ?>
<td>
<div class="control-group">
<label class="radio inline">
<input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" <?php echo $allowSelfRegProf ? 'checked="checked" ' : ''; ?>/>
<?php echo get_lang('Yes'); ?>
</label>
<label class="radio inline">
<input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" <?php echo $allowSelfRegProf ? '' : 'checked="checked" '; ?>/>
<?php echo get_lang('No'); ?>
</label>
</div>
</td>
<?php endif; ?>
</tr>
<tr>
<td>
<button type="submit" class="btn btn-default" name="step3" value="&lt; <?php echo get_lang('Previous'); ?>" ><i class="fa fa-backward"> </i> <?php echo get_lang('Previous'); ?></button>
</td>
<td align="right">
$html .= display_configuration_parameter($installType, get_lang('InstituteURL'), 'institutionUrlForm', $institutionUrlForm);
$html .= '<div class="form-group">
<label class="col-sm-6 control-label">'. get_lang("EncryptMethodUserPass").'</label>
<div class="col-sm-6">';
if ($installType == 'update') {
$html .= '<input type="hidden" name="encryptPassForm" value="'. $encryptPassForm .'" />'. $encryptPassForm;
} else {
$html .= '<div class="checkbox">
<label>
<input type="radio" name="encryptPassForm" value="bcrypt" id="encryptPass1" '. ($encryptPassForm == 'bcrypt' ? 'checked="checked" ':'') .'/> bcrypt
</label>';
$html .= '<label>
<input type="radio" name="encryptPassForm" value="sha1" id="encryptPass1" '. ($encryptPassForm == 'sha1' ? 'checked="checked" ':'') .'/> sha1
</label>';
$html .= '<label>
<input type="radio" name="encryptPassForm" value="md5" id="encryptPass0" '. ($encryptPassForm == 'md5' ? 'checked="checked" ':'') .'/> md5
</label>';
$html .= '<label>
<input type="radio" name="encryptPassForm" value="none" id="encryptPass2" '. ($encryptPassForm == 'none' ? 'checked="checked" ':'') .'/>'. get_lang('None').'
</label>';
$html .= '</div>';
}
$html .= '</div></div>';
$html .= '<div class="form-group">
<label class="col-sm-6 control-label">'. get_lang('AllowSelfReg') .'</label>
<div class="col-sm-6">';
if ($installType == 'update'){
$html .= '<input type="hidden" name="allowSelfReg" value="'. $allowSelfReg .'" />'. $allowSelfReg ? get_lang('Yes') : get_lang('No');
} else {
$html .= '<div class="control-group">';
$html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfReg" value="1" id="allowSelfReg1" '. ($allowSelfReg ? 'checked="checked" ' : '') . ' /> '. get_lang('Yes') .'
</label>';
$html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg ? '' : 'checked="checked" ') .' /> '. get_lang('No') .'
</label>';
$html .= '</div>';
}
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="form-group">';
$html .= '<label class="col-sm-6 control-label">'. get_lang('AllowSelfRegProf') .'</label>
<div class="col-sm-6">';
if ($installType == 'update'){
$html .= '<input type="hidden" name="allowSelfRegProf" value="'. $allowSelfRegProf.'" />'. $allowSelfRegProf? get_lang('Yes') : get_lang('No');
} else {
$html .= '<div class="control-group">
<label class="checkbox-inline">
<input type="radio" name="allowSelfRegProf" value="1" id="allowSelfRegProf1" '. ($allowSelfRegProf ? 'checked="checked" ' : '') .'/>
' . get_lang('Yes') .'
</label>';
$html .= '<label class="checkbox-inline">
<input type="radio" name="allowSelfRegProf" value="0" id="allowSelfRegProf0" '. ($allowSelfRegProf ? '' : 'checked="checked" ') .' />
'. get_lang('No') .'
</label>';
$html .= '</div>';
}
$html .= '</div>
</div>';
echo panel($html, get_lang('Platform'), 'platform');
?>
<div class='form-group'>
<div class="col-sm-6">
<button type="submit" class="btn btn-default pull-right" name="step3" value="&lt; <?php echo get_lang('Previous'); ?>" ><i class="fa fa-backward"> </i> <?php echo get_lang('Previous'); ?></button>
<input type="hidden" name="is_executable" id="is_executable" value="-" />
<button class="btn btn-success" type="submit" name="step5" value="<?php echo get_lang('Next'); ?> &gt;" ><i class="fa fa-forward"> </i> <?php echo get_lang('Next'); ?></button></td>
</tr>
</table>
</fieldset>
</div>
<div class="col-sm-6">
<button class="btn btn-success" type="submit" name="step5" value="<?php echo get_lang('Next'); ?> &gt;" ><i class="fa fa-forward"> </i> <?php echo get_lang('Next'); ?></button>
</div>
</div>
<?php
}

@ -7599,9 +7599,10 @@ class learnpath
$form->addButtonSave($text, 'submit_button');
$renderer = $form->defaultRenderer();
$renderer->setElementTemplate('<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{label}<br />{element}', 'content_lp');
$form->addElement('html', '<div>');
$form->addElement('html_editor', 'content_lp', '', null, $editor_config);
$renderer->setElementTemplate('&nbsp;{label}{element}', 'content_lp');
$form->addElement('html', '<div class="editor-lp">');
$form->addHtmlEditor('content_lp', null, null, true, $editor_config, $style=true);
//$form->addElement('html_editor', 'content_lp', '', null, $editor_config);
$form->addElement('html', '</div>');
$defaults['content_lp'] = $content;
}

@ -106,24 +106,21 @@ $code = isset($code) ? $code : null;
</script>
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading"><?php echo get_lang('Search'); ?></div>
<div class="panel-body">
<?php if ($showCourses) { ?>
<?php if (!isset($_GET['hidden_links']) || intval($_GET['hidden_links']) != 1) { ?>
<form class="form-search" method="post" action="<?php echo getCourseCategoryUrl(1, $pageLength, 'ALL', 0, 'subscribe'); ?>">
<fieldset>
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="search_course" value="1" />
<div class="control-group">
<div class="controls">
<div class="input-append">
<input type="text" name="search_term" value="<?php echo (empty($_POST['search_term']) ? '' : api_htmlentities(Security::remove_XSS($_POST['search_term']))); ?>" />
<div class="btn-group">
<button class="btn btn-default btn-sm" type="submit">
<i class="fa fa-search"></i> <?php echo get_lang('Search'); ?>
</button>
<div class="col-md-6">
<h2><?php echo get_lang('Search'); ?></h2>
<?php if ($showCourses) { ?>
<?php if (!isset($_GET['hidden_links']) || intval($_GET['hidden_links']) != 1) { ?>
<form class="form-search" method="post" action="<?php echo getCourseCategoryUrl(1, $pageLength, 'ALL', 0, 'subscribe'); ?>">
<input type="hidden" name="sec_token" value="<?php echo $stok; ?>">
<input type="hidden" name="search_course" value="1" />
<div class="control-group">
<div class="controls">
<div class="input-append">
<input type="text" name="search_term" value="<?php echo (empty($_POST['search_term']) ? '' : api_htmlentities(Security::remove_XSS($_POST['search_term']))); ?>" />
<div class="btn-group">
<button class="btn btn-default btn-sm" type="submit">
<i class="fa fa-search"></i> <?php echo get_lang('Search'); ?>
</button>
<?php
$hidden_links = 0;
} else {
@ -137,14 +134,122 @@ $code = isset($code) ? $code : null;
if (!empty($browse_course_categories)) {
echo '<a class="btn btn-default btn-sm" href="'.api_get_self().'?action=display_random_courses">'.get_lang('RandomPick').'</a>';
?>
</div>
</div>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="col-md-6"></div>
</div>
<div class="row">
<?php if ($showCourses && $action != 'display_sessions') {
if (!empty($message)) {
Display::display_confirmation_message($message, false);
}
if (!empty($error)) {
Display::display_error_message($error, false);
}
if (!empty($content)) {
echo $content;
}
if (!empty($search_term)) {
echo "<p><strong>".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."</strong><br />";
}
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$user_id = api_get_user_id();
if (!empty($browse_courses_in_category)) {
foreach ($browse_courses_in_category as $course) {
$course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN);
if ($course_hidden) {
continue;
}
$user_registerd_in_course = CourseManager::is_user_subscribed_in_course($user_id, $course['code']);
$user_registerd_in_course_as_teacher = CourseManager::is_course_teacher($user_id, $course['code']);
$user_registerd_in_course_as_student = ($user_registerd_in_course && !$user_registerd_in_course_as_teacher);
$course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD);
$course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM);
$course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED);
$course_closed = ($course['visibility'] == COURSE_VISIBILITY_CLOSED);
$course_subscribe_allowed = ($course['subscribe'] == 1);
$course_unsubscribe_allowed = ($course['unsubscribe'] == 1);
$count_connections = $course['count_connections'];
$creation_date = substr($course['creation_date'],0,10);
$icon_title = null;
$html = null;
// display the course bloc
$html .= '<div class="col-md-3"><div class="items-course">';
// display thumbnail
$html .= return_thumbnail($course, $icon_title);
// display course title and button bloc
$html .= '<div class="items-course-info">';
$html .= return_title($course);
// display button line
$html .= '<div class="btn-toolbar">';
// if user registered as student
if ($user_registerd_in_course_as_student) {
if (!$course_closed) {
//$html .= return_goto_button($course);
$html .= return_description_button($course, $icon_title);
if ($course_unsubscribe_allowed) {
$html .= return_unregister_button($course, $stok, $search_term, $code);
}
$html .= return_already_registered_label('student');
}
} elseif ($user_registerd_in_course_as_teacher) {
// if user registered as teacher
//$html .= return_goto_button($course);
$html .= return_description_button($course, $icon_title);
if ($course_unsubscribe_allowed) {
$html .= return_unregister_button($course, $stok, $search_term, $code);
}
$html .= return_already_registered_label('teacher');
} else {
// if user not registered in the course
if (!$course_closed) {
if (!$course_private) {
$html .= return_goto_button($course);
if ($course_subscribe_allowed) {
$html .= return_register_button($course, $stok, $code, $search_term);
}
}
$html .= return_description_button($course, $icon_title);
}
}
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
$html .= '</div>';
echo $html;
}
} else {
if (!isset($_REQUEST['subscribe_user_with_password']) &&
!isset($_REQUEST['subscribe_course'])
) {
Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
}
}
}
echo $cataloguePagination;
?>
</div>
<div class="row">
<div class="col-md-3">
<div class="panel panel-default">
<div class="panel-heading">
<?php
@ -277,116 +382,7 @@ $code = isset($code) ? $code : null;
<?php } ?>
</div>
<div class="col-md-9">
<h2><?php echo get_lang('CourseCatalog')?></h2>
<?php if ($showCourses && $action != 'display_sessions') { ?>
<?php
if (!empty($message)) {
Display::display_confirmation_message($message, false);
}
if (!empty($error)) {
Display::display_error_message($error, false);
}
if (!empty($content)) {
echo $content;
}
if (!empty($search_term)) {
echo "<p><strong>".get_lang('SearchResultsFor')." ".Security::remove_XSS($_POST['search_term'])."</strong><br />";
}
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$user_id = api_get_user_id();
if (!empty($browse_courses_in_category)) {
foreach ($browse_courses_in_category as $course) {
$course_hidden = ($course['visibility'] == COURSE_VISIBILITY_HIDDEN);
if ($course_hidden) {
continue;
}
$user_registerd_in_course = CourseManager::is_user_subscribed_in_course($user_id, $course['code']);
$user_registerd_in_course_as_teacher = CourseManager::is_course_teacher($user_id, $course['code']);
$user_registerd_in_course_as_student = ($user_registerd_in_course && !$user_registerd_in_course_as_teacher);
$course_public = ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD);
$course_open = ($course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM);
$course_private = ($course['visibility'] == COURSE_VISIBILITY_REGISTERED);
$course_closed = ($course['visibility'] == COURSE_VISIBILITY_CLOSED);
$course_subscribe_allowed = ($course['subscribe'] == 1);
$course_unsubscribe_allowed = ($course['unsubscribe'] == 1);
$count_connections = $course['count_connections'];
$creation_date = substr($course['creation_date'],0,10);
$icon_title = null;
// display the course bloc
echo '<div class="well_border"><div class="row">';
// display thumbnail
display_thumbnail($course, $icon_title);
// display course title and button bloc
echo '<div class="col-md-8">';
display_title($course);
// display button line
echo '<div class="btn-toolbar">';
// if user registered as student
if ($user_registerd_in_course_as_student) {
if (!$course_closed) {
display_goto_button($course);
display_description_button($course, $icon_title);
if ($course_unsubscribe_allowed) {
display_unregister_button($course, $stok, $search_term, $code);
}
display_already_registered_label('student');
}
} elseif ($user_registerd_in_course_as_teacher) {
// if user registered as teacher
display_goto_button($course);
display_description_button($course, $icon_title);
if ($course_unsubscribe_allowed) {
display_unregister_button($course, $stok, $search_term, $code);
}
display_already_registered_label('teacher');
} else {
// if user not registered in the course
if (!$course_closed) {
if (!$course_private) {
display_goto_button($course);
if ($course_subscribe_allowed) {
display_register_button($course, $stok, $code, $search_term);
}
}
display_description_button($course, $icon_title);
}
}
echo '</div>'; // btn-toolbar
echo '</div>'; // span4
// display counter
echo '<div class="col-md-2">';
echo '<div class="course-block-popularity"><span>'.get_lang('ConnectionsLastMonth').'</span><div class="course-block-popularity-score">'.$count_connections.'</div></div>';
echo '</div>';
// end of course bloc
echo '</div></div>'; // well_border row
}
} else {
if (!isset($_REQUEST['subscribe_user_with_password']) &&
!isset($_REQUEST['subscribe_course'])
) {
Display::display_warning_message(get_lang('ThereAreNoCoursesInThisCategory'));
}
} ?>
<?php } ?>
<?php
echo $cataloguePagination;
?>
</div>
</div>
<?php
@ -395,49 +391,48 @@ $code = isset($code) ? $code : null;
* @param $course
* @param $icon_title
*/
function display_thumbnail($course, $icon_title)
function return_thumbnail($course, $icon_title)
{
$html = '';
$title = cut($course['title'], 70);
// course path
$course_path = api_get_path(SYS_COURSE_PATH).$course['directory'];
if (file_exists($course_path.'/course-pic85x85.png')) {
$course_medium_image = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic85x85.png'; // redimensioned image 85x85
if (file_exists($course_path.'/course-pic.png')) {
$course_medium_image = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic.png'; // redimensioned image 85x85
} else {
$course_medium_image = Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true); // without picture
$course_medium_image = api_get_path(WEB_IMG_PATH).'session_default.png'; // without picture
}
// course image
echo '<div class="col-md-2">';
echo '<div class="thumbnail">';
$html .= '<div class="items-course-image">';
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
echo '<a class="ajax" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&amp;code='.$course['code'].'" data-title="'.$icon_title.'" title="'.$icon_title.'" rel="gb_page_center[778]">';
echo '<img src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'" />';
echo '</a>';
$html .= '<a class="ajax" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&amp;code='.$course['code'].'" title="'.$icon_title.'" rel="gb_page_center[778]">';
$html .= '<img class="img-responsive" src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'" />';
$html .= '</a>';
} else {
echo '<img src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'"/>';
$html .= '<img class="img-responsive" src="'.$course_medium_image.'" alt="'.api_htmlentities($title).'"/>';
}
echo '</div>'; // thumbail
echo '</div>'; // span2
$html .= '</div>'; // thumbail
return $html;
}
/**
* Display the title of a course in course catalog
* @param $course
*/
function display_title($course)
{
function return_title($course)
{ $html = '';
$linkCourse = api_get_course_url($course['code']);
$title = cut($course['title'], 70);
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$teachers = CourseManager::get_teacher_list_from_course_code_to_string($course['code']);
$rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&amp;course_id='.$course['real_id'], $course['point_info']);
$teachers = '<h5>'.$teachers.'</h5>';
echo '<div class="categories-course-description">';
echo '<h3>'.cut($title, 60).'</h3>';
echo $teachers;
echo $rating;
echo '</div>'; // categories-course-description
$rating = Display::return_rating_system('star_'.$course['real_id'], $ajax_url.'&amp;course_id='.$course['real_id'], $course['point_info']);
$html .= '<h4 class="title"><a href="' . $linkCourse . '">' . cut($title, 60) . '</a></h4>';
$html .= '<div class="teachers">'.$teachers.'</div>';
$html .= '<div class="ranking">'. $rating . '</div>';
return $html;
}
/**
@ -445,33 +440,37 @@ function display_title($course)
* @param $course
* @param $icon_title
*/
function display_description_button($course, $icon_title)
{
function return_description_button($course, $icon_title)
{
$title = $course['title'];
if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') {
echo '<a class="ajax btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&amp;code='.$course['code'].'" title="'.$icon_title.'" data-title="'.get_lang('Description').'">'.get_lang('Description').'</a>';
$html = '<a data-title="' . $title . '" class="ajax btn btn-default btn-sm btn-block" href="'.api_get_path(WEB_CODE_PATH).'inc/ajax/course_home.ajax.php?a=show_course_information&amp;code='.$course['code'].'" title="'.$icon_title.'">'.get_lang('Description').'</a>';
}
return $html;
}
/**
* Display the goto course button of a course in the course catalog
* @param $course
*/
function display_goto_button($course)
function return_goto_button($course)
{
echo ' <a class="btn btn-primary" href="'.api_get_course_url($course['code']).'">'.get_lang('GoToCourse').'</a>';
$html = ' <a class="btn btn-primary" href="'.api_get_course_url($course['code']).'">'.get_lang('GoToCourse').'</a>';
return $html;
}
/**
* Display the already registerd text in a course in the course catalog
* @param $in_status
*/
function display_already_registered_label($in_status)
function return_already_registered_label($in_status)
{
$icon = Display::return_icon('teachers.gif', get_lang('Teacher'));
$icon = Display::return_icon('teacher.png', get_lang('Teacher'), null, ICON_SIZE_TINY);
if ($in_status == 'student') {
$icon = Display::return_icon('students.gif', get_lang('Student'));
$icon = Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY);
}
echo Display::label($icon.' '.get_lang("AlreadyRegisteredToCourse"), "info");
$html = Display::div($icon.' '.get_lang("AlreadyRegisteredToCourse"), array('id' => 'register', 'class' => 'user-register'));
return $html;
}
/**
@ -481,9 +480,11 @@ function display_already_registered_label($in_status)
* @param $code
* @param $search_term
*/
function display_register_button($course, $stok, $code, $search_term)
function return_register_button($course, $stok, $code, $search_term)
{
echo ' <a class="btn btn-primary" href="'.api_get_self().'?action=subscribe_course&amp;sec_token='.$stok.'&amp;subscribe_course='.$course['code'].'&amp;search_term='.$search_term.'&amp;category_code='.$code.'">'.get_lang('Subscribe').'</a>';
$html = ' <a class="btn btn-primary" href="'.api_get_self().'?action=subscribe_course&amp;sec_token='.$stok.'&amp;subscribe_course='.$course['code'].'&amp;search_term='.$search_term.'&amp;category_code='.$code.'">'.get_lang('Subscribe').'</a>';
return $html;
}
/**
@ -493,9 +494,9 @@ function display_register_button($course, $stok, $code, $search_term)
* @param $search_term
* @param $code
*/
function display_unregister_button($course, $stok, $search_term, $code)
function return_unregister_button($course, $stok, $search_term, $code)
{
echo ' <a class="btn btn-primary" href="'. api_get_self().'?action=unsubscribe&amp;sec_token='.$stok.'&amp;unsubscribe='.$course['code'].'&amp;search_term='.$search_term.'&amp;category_code='.$code.'">'.get_lang('Unsubscribe').'</a>';
}
$html = ' <a class="btn btn-primary" href="'. api_get_self().'?action=unsubscribe&amp;sec_token='.$stok.'&amp;unsubscribe='.$course['code'].'&amp;search_term='.$search_term.'&amp;category_code='.$code.'">'.get_lang('Unsubscribe').'</a>';
return $html;
}

@ -30,13 +30,28 @@ class CkEditor extends Editor
//$jsFolder = api_get_path(WEB_LIBRARY_JS_PATH);
//$this->template->addResource($jsFolder.'ckeditor/ckeditor.js', 'js');
}
/**
* Return the HTML code required to run editor.
*
* @return string
*/
public function createHtml()
{
$html = '<textarea id="'.$this->getName().'" name="'.$this->getName().'" class="ckeditor">
'.$this->value.'
</textarea>';
$html .= $this->editorReplace();
return $html;
}
/**
* Return the HTML code required to run editor.
*
* @return string
*/
public function createHtmlStyle()
{
$style = '';
if (trim($this->value) == '<html><head><title></title></head><body></body></html>') {

Loading…
Cancel
Save