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

1.10.x
Yannick Warnier 10 years ago
commit fd44f1e866
  1. 119
      app/Resources/public/css/base.css
  2. 40
      main/admin/resource_sequence.php
  3. BIN
      main/img/icons/48/item-sequence.png
  4. 15
      main/inc/ajax/sequence.ajax.php
  5. 11
      main/inc/lib/formvalidator/FormValidator.class.php
  6. 40
      main/inc/lib/pear/HTML/QuickForm/button.php
  7. 50
      main/inc/lib/pear/HTML/QuickForm/select.php
  8. 48
      main/inc/lib/pear/HTML/QuickForm/text.php
  9. 2
      main/lang/english/trad4all.inc.php
  10. 2
      main/lang/spanish/trad4all.inc.php
  11. 48
      main/template/default/admin/resource_sequence.tpl

@ -5817,6 +5817,117 @@ div#chat-remote-video video {
.forum-post .tools-icons a{
padding: 2px;
}
/* Sequence */
.title-sequence{
font-size: 12px;
text-align: center;
}
#parents{
text-align: center;
}
#parents .parent {
display: inline-block;
padding: 5px;
width: 15%;
}
#parents .parent .big-icon{
background-color: #ECF0F1 ;
padding: 10px;
text-align: center;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
position: relative;
}
#parents .parent .big-icon .sequence-course{
font-size: 12px;
}
#parents .parent .big-icon .sequence-id{
border-radius: 50%;
background-color: #E74C3C;
width: 20%;
color: #ffffff;
position: absolute;
right: 5px;
top: 5px;
}
#parents .parent .big-icon .sequence-deleted{
font-size: 12px;
}
#resource{
text-align: center;
}
#resource .parent {
display: inline-block;
padding: 5px;
width: 15%;
}
#resource .parent .big-icon{
background-color: #eeffaa ;
padding: 10px;
text-align: center;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
position: relative;
}
#resource .parent .big-icon .sequence-course{
font-size: 12px;
}
#resource .parent .big-icon .sequence-id{
border-radius: 50%;
background-color: #E74C3C;
width: 20%;
color: #ffffff;
position: absolute;
right: 5px;
top: 5px;
}
#resource .parent .big-icon .sequence-deleted{
font-size: 12px;
}
.section-title-sequence{
font-size: 22px;
color: #333333;
margin-bottom: 30px;
padding: 0;
border-bottom:1px solid #E5e5e5 ;
}
#children{
text-align: center;
}
#children .parent {
display: inline-block;
padding: 5px;
width: 15%;
}
#children .parent .big-icon{
background-color: #feffd6 ;
padding: 10px;
text-align: center;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
position: relative;
}
#children .parent .big-icon .sequence-course{
font-size: 12px;
}
#children .parent .big-icon .sequence-id{
border-radius: 50%;
background-color: #E74C3C;
width: 20%;
color: #ffffff;
position: absolute;
right: 5px;
top: 5px;
}
#children .parent .big-icon .sequence-deleted{
font-size: 12px;
}
/* CSS NEW TOP ******************************************************************************/
/* CSS Responsive */
@media (min-width: 1025px) and (max-width: 1200px) {
@ -5941,6 +6052,14 @@ div#chat-remote-video video {
.dl-horizontal dd{
margin-left: 140px;
}
#parents .parent, #resource .parent, #children .parent {
display: inline-block;
padding: 5px;
width: 30%;
}
#show_graph{
text-align: center;
}
}
@media (min-width : 480px) and (max-width: 767px) {
#learning_path_breadcrumb_zone {

@ -22,9 +22,9 @@ if (!empty($sessionListFromDatabase)) {
}
}
$formSequence = new FormValidator('sequence_form', 'post', api_get_self());
$formSequence->addText('name', get_lang('Sequence'));
$formSequence->addButtonCreate(get_lang('AddSequence'), 'submit_sequence');
$formSequence = new FormValidator('sequence_form', 'post', api_get_self(),null,null,'inline');
$formSequence->addText('name', get_lang('Sequence'), true, ['cols-size' => [3, 8, 1]]);
$formSequence->addButtonCreate(get_lang('AddSequence'), 'submit_sequence', false, ['cols-size' => [3, 8, 1]]);
$em = Database::getManager();
@ -39,38 +39,50 @@ if ($formSequence->validate()) {
exit;
}
$form = new FormValidator('');
$form->addHidden('sequence_type', 'session');
$selectSequence = new FormValidator('');
$selectSequence ->addHidden('sequence_type', 'session');
$em = Database::getManager();
$sequenceList = $em->getRepository('ChamiloCoreBundle:Sequence')->findAll();
$form->addSelect(
$selectSequence->addSelect(
'sequence',
get_lang('Sequence'),
$sequenceList,
['id' => 'sequence_id']
['id' => 'sequence_id', 'cols-size' => [3, 7, 2]]
);
$form = new FormValidator('');
$form->addHtml("<div class='col-md-6'>");
$form->addHidden('sequence_type', 'session');
$form->addSelect(
'sessions',
get_lang('Sessions'),
$sessionList,
['id' => 'item']
['id' => 'item', 'cols-size' => [4, 7, 1]]
);
$form->addButtonNext(get_lang('UseAsReference'), 'use_as_reference');
$form->addButtonNext(get_lang('UseAsReference'), 'use_as_reference', ['cols-size' => [4, 7, 1]]);
$form->addHtml("</div>");
$form->addHtml("<div class='col-md-6'>");
$form->addSelect(
'requirements',
get_lang('Requirements'),
$sessionList,
['id' => 'requirements', 'multiple' => 'multiple']
['id' => 'requirements', 'cols-size' => [3, 7, 2]]
);
$form->addButtonCreate(get_lang('SetAsRequirementForSelected'), 'set_requirement');
$form->addButtonSave(get_lang('Save'), 'save_resource');
$form->addButtonCreate(get_lang('SetAsRequirement'), 'set_requirement', false, ['cols-size' => [3, 7, 2]]);
$form->addHtml("</div>");
$formSave = new FormValidator('');
$formSave->addHidden('sequence_type', 'session');
$formSave->addButton('save_resource', get_lang('SaveSettings'), 'floppy-o', 'success', null, null, ['cols-size' => [1, 10, 1]]);
$tpl->assign('left_block', $formSequence->returnForm().$form->returnForm());
$tpl->assign('create_sequence', $formSequence->returnForm());
$tpl->assign('select_sequence', $selectSequence->returnForm());
$tpl->assign('configure_sequence', $form->returnForm());
$tpl->assign('save_sequence', $formSave->returnForm());
$layout = $tpl->get_template('admin/resource_sequence.tpl');
$tpl->display($layout);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -51,7 +51,7 @@ switch ($action) {
case 'session':
$type = SequenceResource::SESSION_TYPE;
$showDelete = isset($_REQUEST['show_delete']) ? $_REQUEST['show_delete'] : false;
$image = Display::return_icon('window_list.png');
$image = Display::return_icon('item-sequence.png',null,null,ICON_SIZE_LARGE);
$sessionInfo = api_get_session_info($id);
if (!empty($sessionInfo)) {
$linkDelete = '';
@ -63,12 +63,13 @@ switch ($action) {
);
}
$link = '<div class="parent" data-id="'.$id.'">
<span>'.
$image.' '.$sessionInfo['name'].' ('.$id.')'.
$linkDelete.
'</span>
</div>';
$link = '<div class="parent" data-id="' . $id . '">';
$link .= '<div class="big-icon">';
$link .= $image;
$link .= '<div class="sequence-course">' . $sessionInfo['name'] . '</div>';
$link .= '<div class="sequence-id">' . $id . '</div>';
$link .= '<div class="sequence-deleted">' . $linkDelete . '</div>';
$link .= '</div></div>';
}
break;
}

@ -324,9 +324,10 @@ EOT;
* @param string $label Text appearing on the button
* @param string $name Element name (for form treatment purposes)
* @param bool $createElement Whether to use the create or add method
* @param array $attributes Additional attributes
* @return HTML_QuickForm_button
*/
public function addButtonCreate($label, $name = 'submit', $createElement = false)
public function addButtonCreate($label, $name = 'submit', $createElement = false, $attributes = array())
{
return $this->addButton(
$name,
@ -335,7 +336,7 @@ EOT;
'primary',
null,
null,
array(),
$attributes,
$createElement
);
}
@ -422,12 +423,12 @@ EOT;
* Returns a button with the primary color and a right-pointing arrow icon
* @param string $label Text appearing on the button
* @param string $name Element name (for form treatment purposes)
*
* @param array $attributes Additional attributes
* @return HTML_QuickForm_button
*/
public function addButtonNext($label, $name = 'submit')
public function addButtonNext($label, $name = 'submit',$attributes = array())
{
return $this->addButton($name, $label, 'arrow-right', 'primary');
return $this->addButton($name, $label, 'arrow-right', 'primary',null,null,$attributes);
}
/**

@ -38,6 +38,7 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
private $style;
private $size;
private $class;
private $columnsSize;
/**
* @param string $name input name example 'submit'
@ -61,6 +62,8 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
$this->setStyle($style);
$this->setSize($size);
$this->setClass($class);
$columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null;
$this->setColumnsSize($columnsSize);
parent::__construct(
$name,
@ -161,7 +164,21 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
{
return $this->size;
}
/**
* @return null
*/
public function getColumnsSize()
{
return $this->columnsSize;
}
/**
* @param null $columnsSize
*/
public function setColumnsSize($columnsSize)
{
$this->columnsSize = $columnsSize;
}
/**
* @param mixed $size
*/
@ -204,6 +221,23 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
*/
public function getTemplate($layout)
{
$size = $this->getColumnsSize();
if (empty($size)) {
$size = array(2, 8, 2);
} else {
if (is_array($size)) {
if (count($size) == 1) {
$size = array(2, intval($size[0]), 2);
} elseif (count($size) != 3) {
$size = array(2, 8, 2);
}
// else just keep the $size array as received
} else {
$size = array(2, intval($size), 2);
}
}
switch ($layout) {
case FormValidator::LAYOUT_INLINE:
return '
@ -213,11 +247,11 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
case FormValidator::LAYOUT_HORIZONTAL:
return '
<div class="form-group {error_class}">
<label {label-for} class="col-sm-2 control-label" >
<label {label-for} class="col-sm-'.$size[0].' control-label" >
<!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
{label}
</label>
<div class="col-sm-8">
<div class="col-sm-'.$size[1].'">
{icon}
{element}
@ -229,7 +263,7 @@ class HTML_QuickForm_button extends HTML_QuickForm_input
<span class="help-inline">{error}</span>
<!-- END error -->
</div>
<div class="col-sm-2">
<div class="col-sm-'.$size[2].'">
<!-- BEGIN label_3 -->
{label_3}
<!-- END label_3 -->

@ -46,9 +46,9 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* @since 1.0
* @access private
*/
var $_options = array();
private $_options = array();
var $_optgroups = array();
private $_optgroups = array();
/**
* Default values of the SELECT
@ -57,7 +57,9 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
* @since 1.0
* @access private
*/
var $_values = null;
private $_values = null;
private $columnsSize;
// }}}
// {{{ constructor
@ -82,6 +84,8 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
if (is_array($attributes) || empty($attributes)) {
$attributes['class'] = 'form-control';
}
$columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null;
$this->setColumnsSize($columnsSize);
parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'select';
@ -258,6 +262,22 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
// }}}
// {{{ setMultiple()
/**
* @return null
*/
public function getColumnsSize()
{
return $this->columnsSize;
}
/**
* @param null $columnsSize
*/
public function setColumnsSize($columnsSize)
{
$this->columnsSize = $columnsSize;
}
/**
* Sets the select mutiple attribute
*
@ -659,8 +679,22 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
*/
public function getTemplate($layout)
{
/*$size = $this->getInputSize();
$size = empty($size) ? '8' : $size;*/
$size = $this->getColumnsSize();
if (empty($size)) {
$size = array(2, 8, 2);
} else {
if (is_array($size)) {
if (count($size) == 1) {
$size = array(2, intval($size[0]), 2);
} elseif (count($size) != 3) {
$size = array(2, 8, 2);
}
// else just keep the $size array as received
} else {
$size = array(2, intval($size), 2);
}
}
switch ($layout) {
case FormValidator::LAYOUT_INLINE:
@ -676,11 +710,11 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
case FormValidator::LAYOUT_HORIZONTAL:
return '
<div class="form-group {error_class}">
<label {label-for} class="col-sm-2 control-label" >
<label {label-for} class="col-sm-'.$size[0].' control-label" >
<!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
{label}
</label>
<div class="col-sm-8">
<div class="col-sm-'.$size[1].'">
{icon}
{element}
@ -692,7 +726,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
<span class="help-inline">{error}</span>
<!-- END error -->
</div>
<div class="col-sm-2">
<div class="col-sm-'.$size[2].'">
<!-- BEGIN label_3 -->
{label_3}
<!-- END label_3 -->

@ -34,6 +34,7 @@
class HTML_QuickForm_text extends HTML_QuickForm_input
{
private $inputSize;
private $columnsSize;
/**
* Class constructor
@ -56,6 +57,8 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
}
$inputSize = isset($attributes['input-size']) ? $attributes['input-size'] : null;
$this->setInputSize($inputSize);
$columnsSize = isset($attributes['cols-size']) ? $attributes['cols-size'] : null;
$this->setColumnsSize($columnsSize);
$icon = isset($attributes['icon']) ? $attributes['icon'] : null;
$this->setIcon($icon);
@ -98,8 +101,29 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
*/
public function getTemplate($layout)
{
$size = $this->getInputSize();
$size = empty($size) ? '8' : $size;
$size = $this->getColumnsSize();
if (empty($size)) {
$sizeTemp = $this->getInputSize();
if (empty($size)) {
$sizeTemp = 8;
}
$size = array(2, $sizeTemp, 2);
} else {
if (is_array($size)) {
if (count($size) != 3) {
$sizeTemp = $this->getInputSize();
if (empty($size)) {
$sizeTemp = 8;
}
$size = array(2, $sizeTemp, 2);
}
// else just keep the $size array as received
} else {
$size = array(2, intval($size), 2);
}
}
switch ($layout) {
case FormValidator::LAYOUT_INLINE:
@ -115,11 +139,11 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
case FormValidator::LAYOUT_HORIZONTAL:
return '
<div class="form-group {error_class}">
<label {label-for} class="col-sm-2 control-label" >
<label {label-for} class="col-sm-'.$size[0].' control-label" >
<!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
{label}
</label>
<div class="col-sm-'.$size.'">
<div class="col-sm-'.$size[1].'">
{icon}
{element}
@ -131,7 +155,7 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
<span class="help-inline">{error}</span>
<!-- END error -->
</div>
<div class="col-sm-2">
<div class="col-sm-'.$size[2].'">
<!-- BEGIN label_3 -->
{label_3}
<!-- END label_3 -->
@ -163,7 +187,21 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
{
$this->inputSize = $inputSize;
}
/**
* @return null
*/
public function getColumnsSize()
{
return $this->columnsSize;
}
/**
* @param null $columnsSize
*/
public function setColumnsSize($columnsSize)
{
$this->columnsSize = $columnsSize;
}
/**
* Sets size of text field
*

@ -7348,7 +7348,7 @@ $WithOutCategory = "Without category";
$ItemsTheReferenceDependsOn = "Items the reference depends on";
$UseAsReference = "Use as reference";
$Dependencies = "Items that depend on the reference";
$SetAsRequirementForSelected = "Set as requirement for selected item";
$SetAsRequirement = "Set as requirement";
$AddSequence = "Add new sequence";
$ResourcesSequencing = "Resources sequencing";
$GamificationModeTitle = "Gamification mode";

@ -7377,7 +7377,7 @@ $WithOutCategory = "Sin categoría";
$ItemsTheReferenceDependsOn = "Elementos de los cuales depende la referencia";
$UseAsReference = "Usar como referencia";
$Dependencies = "Elementos que dependen de la referencia";
$SetAsRequirementForSelected = "Añadir como requerimiento del elemento de referencia";
$SetAsRequirement = "Añadir como requerimiento";
$AddSequence = "Añadir nueva secuencia";
$ResourcesSequencing = "Secuencialización de recursos";
$GamificationModeTitle = "Modo ludificación";

@ -167,31 +167,59 @@
});
});
</script>
<div class="panel panel-default">
<div class="panel-body">
<div class="section-title-sequence">Crear nombre de secuencia</div>
<div class="row">
<div class="col-md-6">
{{ create_sequence }}
</div>
<div class="col-md-6">
{{ select_sequence }}
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<div class="section-title-sequence">Configuración de secuencia</div>
<div class="row">
<div class="col-md-4">
{{ left_block }}
{{ configure_sequence }}
</div>
</div>
<div class="col-md-8">
<h3>
</div>
<div class="panel panel-default">
<div class="panel-body">
<div class="section-title-sequence">Vista previa de secuencia</div>
<div class="row">
<div class="col-md-9">
<h4 class="title-sequence">
{{ 'ItemsTheReferenceDependsOn' | get_lang }}
</h3>
</h4>
<div id="parents">
</div>
<h3>{{ 'Item' | get_lang }}</h3>
<h4 class="title-sequence">{{ 'Item' | get_lang }}</h4>
<div id="resource">
</div>
<h3>{{ 'Dependencies' | get_lang }}</h3>
<h4 class="title-sequence">{{ 'Dependencies' | get_lang }}</h4>
<div id="children">
</div>
<h3>{{ 'Graph' | get_lang }}</h3>
<div id="show_graph"></div>
<h4 class="title-sequence">{{ 'Graph' | get_lang }}</h4>
</div>
<div class="col-md-3">
<div id="show_graph"></div>
</div>
{{ right_block }}
</div>
{{ save_sequence }}
</div>
</div>
{% endblock %}

Loading…
Cancel
Save