Skip to content
Snippets Groups Projects
Commit 153d2f67 authored by efalcy's avatar efalcy
Browse files

dev #36620 : boite formation : affichage des custom fields en mode bloc

parent 70ab616a
Branches
Tags
6 merge requests!1553Master,!1519Master,!1506Master,!1502Master,!1451Dev#36620 improve formation widget,!1437Dev#36620 improve formation widget
......@@ -43,7 +43,7 @@ class SessionFormationLoader extends Storm_Model_Loader {
class Class_SessionFormation extends Storm_Model_Abstract {
use Trait_TimeSource, Trait_Translator;
use Trait_TimeSource, Trait_Translator,Trait_CustomFields;
protected $_table_name = 'sessions_formation';
protected $_loader_class = 'SessionFormationLoader';
protected $_belongs_to = ['formation' => ['model' => 'Class_Formation'],
......
......@@ -53,6 +53,12 @@ trait Trait_CustomFields {
}
public function getAllCustomFields() {
return Class_CustomField_Model::getModel($this->getModelName())->find($this->getId());
}
public function setCustomField($field,$value) {
$this->custom_fields[$field]=$value;
return $this;
......
......@@ -45,6 +45,16 @@ class Render_Session {
public function errorSpan($msg) {
return $this->view->tag('span', $msg, ['class' => 'error']);
}
public function displayCustomFields($session) {
$html='';
foreach ($session->getAllCustomFields()->getFields() as $custom_field) {
$html.=$this->view->tag('dt', $this->view->_($custom_field->getLabel()));
foreach ($custom_field->getValues() as $value)
$html .= $this->view->tag('dd', $value->getLabel());
}
return $html;
}
}
......@@ -111,6 +121,8 @@ class Render_Session_Dl extends Render_Session {
$this->view->tag('dt', $this->view->_('Contenu')).
$this->view->tag('dd', $session->getContenu());
$html .= $this->displayCustomFields($session);
return $this->view->tag('dl', $html , ['class' => 'session_formation']);
}
......@@ -215,6 +227,8 @@ class Render_Session_Block extends Render_Session {
$this->view->tag('dd', $this->sessionInformations($session),
['class' => 'training_informations']);
$html .= $this->displayCustomFields($session);
return $this->view->tag('dl', $html);
}
......
......@@ -1151,7 +1151,7 @@ dl.session_formation + .actions a:last-child {
a.hide_training_content {display:none;}
dd.training_content {display:none;}
a.show_training_content:focus + .hide_training_content { display: inline; }
a.show_training_content:focus + .hide_training_content { display: block; }
a.show_training_content:focus { display: none; }
a.show_training_content:focus ~ .training_content { display:block; }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment