From e6281cde910ad7cf1757d89135ef6ea91fac3c70 Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Fri, 31 Mar 2017 13:41:27 -0500 Subject: [PATCH 1/4] add tpl courses_progress, fix thematic controller --- main/course_progress/thematic.php | 41 ++++++++++++------- main/course_progress/thematic_controller.php | 4 ++ .../default/course_progress/progress.tpl | 14 +++++++ main/template/default/layout/page_body.tpl | 4 +- 4 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 main/template/default/course_progress/progress.tpl diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index 635984e6f1..6b18c0db74 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -16,34 +16,37 @@ $url_token = "&sec_token=".$token; $user_info = api_get_user_info(); $params = '&'.api_get_cidreq(); -if (api_is_allowed_to_edit(null, true)) { - echo '
'; +$tpl = new Template(get_lang('ThematicControl')); +$toolbar = null; +if (api_is_allowed_to_edit(null, true)) { + switch ($action) { case 'thematic_add': case 'thematic_import_select': - echo ''. + $actionLeft = ''. Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ThematicDetails'), '', ICON_SIZE_MEDIUM).''; break; case 'thematic_list': - echo ''. + $actionLeft = ''. Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).''; break; case 'thematic_details': - echo ''. + $actionLeft = ''. Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).''; - echo ''. + $actionLeft .= ''. Display::return_icon('import_csv.png', get_lang('ImportThematic'), '', ICON_SIZE_MEDIUM).''; - echo ''. + $actionLeft .= ''. Display::return_icon('export_csv.png', get_lang('ExportThematic'), '', ICON_SIZE_MEDIUM).''; - echo ''. + $actionLeft .= ''. Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).''; break; default: - echo ''. + $actionLeft = ''. Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).''; } - echo '
'; + + $toolbar= Display::toolbarAction('thematic-bar', array(0 => $actionLeft)); } if ($action == 'thematic_list') { @@ -70,7 +73,7 @@ if ($action == 'thematic_list') { } elseif ($action == 'thematic_details') { if (isset($_GET['thematic_plan_save_message']) && $_GET['thematic_plan_save_message'] == 'ok') { - Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull')); + $message = Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull'), false, true); } if (isset($last_id) && $last_id) { @@ -88,10 +91,10 @@ if ($action == 'thematic_list') { if (!empty($thematic_id)) { } else { // display information - $message = ''.get_lang('Information').'
'; - $message .= get_lang('ThematicDetailsDescription'); - Display::display_normal_message($message, false); - echo '
'; + $text = '

'.get_lang('Information').'

'; + $text .= get_lang('ThematicDetailsDescription'); + $message = Display::return_message($text,'info', false); + } // Display thematic data @@ -304,3 +307,11 @@ if ($action == 'thematic_list') { $form->addButtonImport(get_lang('Import'), 'SubmitImport'); $form->display(); } + +$tpl->assign('actions', $toolbar); +$tpl->assign('message', $message); +$tpl->assign('data',$data); +$tpl->assign('score_progress', $score); +$tpl->assign('thamatic', $thematic); +$thematicLayout = $tpl->get_template('course_progress/progress.tpl'); +$tpl->display($thematicLayout); \ No newline at end of file diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php index 7c42cf1a6f..5c775d3a72 100755 --- a/main/course_progress/thematic_controller.php +++ b/main/course_progress/thematic_controller.php @@ -328,6 +328,7 @@ class ThematicController $layoutName = $displayHeader ? 'layout' : 'layout_no_header'; // render to the view + $this->view->set_data($data); $this->view->set_layout($layoutName); $this->view->set_template('thematic'); @@ -403,6 +404,7 @@ class ThematicController $data['next_description_type'] = $thematic->get_next_description_type($_POST['thematic_id']); // render to the view + $this->view->set_data($data); $this->view->set_layout('layout'); $this->view->set_template('thematic_plan'); @@ -445,6 +447,7 @@ class ThematicController $data['thematic_data'] = $thematic->get_thematic_list($thematic_id); //render to the view + $this->view->set_data($data); $this->view->set_layout('layout'); $this->view->set_template('thematic_plan'); @@ -530,6 +533,7 @@ class ThematicController $layoutName = $displayHeader ? 'layout' : 'layout_no_header'; // render to the view + $this->view->set_data($data); $this->view->set_layout($layoutName); $this->view->set_template('thematic_advance'); diff --git a/main/template/default/course_progress/progress.tpl b/main/template/default/course_progress/progress.tpl new file mode 100644 index 0000000000..55174873e9 --- /dev/null +++ b/main/template/default/course_progress/progress.tpl @@ -0,0 +1,14 @@ +{% extends template ~ "/layout/layout_1_col.tpl" %} + +{% block content %} +{{ data | var_dump }} +
+
+
+
+

{{ 'Progress' | get_lang }}: {{ score_progress }} %

+
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/main/template/default/layout/page_body.tpl b/main/template/default/layout/page_body.tpl index 7f4d92470f..7e0a6dffd8 100755 --- a/main/template/default/layout/page_body.tpl +++ b/main/template/default/layout/page_body.tpl @@ -1,7 +1,5 @@ {% if actions != '' %} -
- {{ actions }} -
+ {{ actions }} {% endif %} {{ flash_messages }} From 9ebcedc92abdce7d431d4207f439fd9be6b8dede Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Mon, 3 Apr 2017 18:36:52 -0500 Subject: [PATCH 2/4] new fix template thematic advance refs - BT#12441 --- main/course_progress/index.php | 1 + main/course_progress/thematic.php | 76 ++++++++------ main/course_progress/thematic_controller.php | 3 +- main/img/icons/16/cd.png | Bin 0 -> 862 bytes main/img/icons/16/delete.png | Bin 792 -> 992 bytes main/img/icons/16/down.png | Bin 0 -> 639 bytes main/img/icons/16/down_na.png | Bin 0 -> 601 bytes main/img/icons/16/pdf.png | Bin 0 -> 726 bytes main/img/icons/16/up.png | Bin 0 -> 648 bytes main/img/icons/16/up_na.png | Bin 0 -> 594 bytes main/inc/lib/template.lib.php | 14 ++- main/inc/lib/thematic.lib.php | 17 ++-- .../default/course_progress/progress.tpl | 94 +++++++++++++++++- 13 files changed, 160 insertions(+), 45 deletions(-) create mode 100644 main/img/icons/16/cd.png create mode 100644 main/img/icons/16/down.png create mode 100644 main/img/icons/16/down_na.png create mode 100644 main/img/icons/16/pdf.png create mode 100644 main/img/icons/16/up.png create mode 100644 main/img/icons/16/up_na.png diff --git a/main/course_progress/index.php b/main/course_progress/index.php index 1899bb52d9..7c933a0d88 100755 --- a/main/course_progress/index.php +++ b/main/course_progress/index.php @@ -81,6 +81,7 @@ if (!empty($thematic_id)) { $thematic_data = $thematic->get_thematic_list($thematic_id); } + // get default thematic plan title $default_thematic_plan_title = $thematic->get_default_thematic_plan_title(); diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index 6b18c0db74..f7186c8e3c 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -96,7 +96,7 @@ if ($action == 'thematic_list') { $message = Display::return_message($text,'info', false); } - + $list = []; // Display thematic data if (!empty($thematic_data)) { // display progress @@ -104,6 +104,15 @@ if ($action == 'thematic_list') { echo ''; echo ''; foreach ($thematic_data as $thematic) { + + $list['id'] = $thematic['id']; + $list['id_course'] = $thematic['c_id']; + $list['id_session'] = $thematic['session_id']; + $list['title'] = Security::remove_XSS($thematic['title'], STUDENT); + $list['content'] = Security::remove_XSS($thematic['content'], STUDENT); + $list['display_orden'] = $thematic['display_order']; + $list['active'] = $thematic['active']; + $my_thematic_id = $thematic['id']; $session_star = ''; @@ -115,75 +124,70 @@ if ($action == 'thematic_list') { //@todo add a validation in order to load or not course thematics in the session thematic echo ''; - $actions_first_col = ''; + $toolbarThematic = ''; if (api_is_allowed_to_edit(null, true)) { // Thematic title - $actions_first_col = Display::url( - Display::return_icon('cd.gif', get_lang('Copy')), - 'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$my_thematic_id.$params.$url_token + $toolbarThematic = Display::url( + Display::return_icon('cd.png', get_lang('Copy'), null, ICON_SIZE_TINY), + 'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$my_thematic_id.$params.$url_token, + array('class'=> 'btn btn-default') ); if (api_get_session_id() == 0) { if ($thematic['display_order'] > 1) { - $actions_first_col .= ' '.Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).''; + $toolbarThematic .= ' '.Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_TINY).''; } else { - $actions_first_col .= ' '.Display::return_icon('up_na.png', ' ', '', ICON_SIZE_SMALL); + $toolbarThematic .= '
'.Display::return_icon('up_na.png', ' ', '', ICON_SIZE_TINY) . '
'; } if (isset($thematic['max_thematic_item']) && $thematic['display_order'] < $thematic['max_thematic_item']) { - $actions_first_col .= ' '.Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).''; + $toolbarThematic .= ' '.Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_TINY).''; } else { - $actions_first_col .= ' '.Display::return_icon('down_na.png', ' ', '', ICON_SIZE_SMALL); + $toolbarThematic .= '
'.Display::return_icon('down_na.png', ' ', '', ICON_SIZE_TINY) . '
'; } } if (api_get_session_id() == $thematic['session_id']) { - $actions_first_col .= Display::url( - Display::return_icon('pdf.png'), + $toolbarThematic .= Display::url( + Display::return_icon('pdf.png', get_lang('ExportToPDF'), null, ICON_SIZE_TINY), api_get_self().'?'.api_get_cidreq()."$url_token&".http_build_query([ 'action' => 'export_single_thematic', 'thematic_id' => $my_thematic_id - ]) + ]), + array('class' => 'btn btn-default') ); - $actions_first_col .= '' - .Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).''; - $actions_first_col .= '' - .Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''; + .Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_TINY).''; } - $actions_first_col = Display::div($actions_first_col, array('id' => 'thematic_id_content_'.$thematic['id'], 'class' => 'thematic_tools')); - $actions_first_col = Display::div($actions_first_col, array('style' => 'height:20px')); + // $actions_first_col = Display::div($actions_first_col, array('id' => 'thematic_id_content_'.$thematic['id'], 'class' => 'thematic_tools')); + // $actions_first_col = Display::div($actions_first_col, array('style' => 'height:20px')); } - + echo Display::tag('td', Display::tag('h3', Security::remove_XSS($thematic['title'], STUDENT).$session_star).Security::remove_XSS($thematic['content'], STUDENT).$actions_first_col, array('id' => 'thematic_td_content_'.$thematic['id'], 'class' => 'thematic_content')); // Display 2nd column - thematic plan data echo ''; // Display 3rd column - thematic advance data echo '
'.get_lang('Thematic').''.get_lang('ThematicPlan').''.get_lang('ThematicAdvance').'
'; - //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { - if (api_is_allowed_to_edit(null, true)) { - echo '
'; - } if (empty($thematic_plan_div[$thematic['id']])) { - echo Display::div('', array('id' => "thematic_plan_".$thematic['id'])); + $list['thematic_plan'] = null; } else { - echo $thematic_plan_div[$thematic['id']]; + $list['thematic_plan'] = $thematic_plan_div[$thematic['id']]; } echo '
'; - //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { - if (api_is_allowed_to_edit(null, true)) { - echo ''; - } //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (!empty($thematic_advance_data[$thematic['id']])) { + + $list['thematic_advance'] = $thematic_advance_data[$thematic['id']]; + echo ''; foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) { $thematic_advance['start_date'] = api_get_local_time($thematic_advance['start_date']); @@ -253,7 +257,12 @@ if ($action == 'thematic_list') { } echo ''; echo ''; + $list['toolbar'] = $toolbarThematic; + $listThematic[] = $list; } //End for + + + echo '
'; } else { echo '
'.get_lang('ThereIsNoAThematicSection').'
'; @@ -310,8 +319,9 @@ if ($action == 'thematic_list') { $tpl->assign('actions', $toolbar); $tpl->assign('message', $message); -$tpl->assign('data',$data); -$tpl->assign('score_progress', $score); +$tpl->assign('data',$listThematic); +$tpl->assign('session_star',$session_star); +$tpl->assign('score_progress', $total_average_of_advances); $tpl->assign('thamatic', $thematic); $thematicLayout = $tpl->get_template('course_progress/progress.tpl'); $tpl->display($thematicLayout); \ No newline at end of file diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php index 5c775d3a72..8711597b61 100755 --- a/main/course_progress/thematic_controller.php +++ b/main/course_progress/thematic_controller.php @@ -315,7 +315,7 @@ class ThematicController // Third column $thematic_advance_data = $thematic->get_thematic_advance_list(null, null, true); - $data['thematic_plan_div'] = $thematic->get_thematic_plan_div($thematic_plan_data); + $data['thematic_plan_div'] = $thematic->get_thematic_plan_array($thematic_plan_data); $data['thematic_advance_div'] = $thematic->get_thematic_advance_div($thematic_advance_data); $data['thematic_plan_data'] = $thematic_plan_data; $data['thematic_advance_data'] = $thematic_advance_data; @@ -328,7 +328,6 @@ class ThematicController $layoutName = $displayHeader ? 'layout' : 'layout_no_header'; // render to the view - $this->view->set_data($data); $this->view->set_layout($layoutName); $this->view->set_template('thematic'); diff --git a/main/img/icons/16/cd.png b/main/img/icons/16/cd.png new file mode 100644 index 0000000000000000000000000000000000000000..1e8e16a891007f0c141a3745c0e88656f525bf38 GIT binary patch literal 862 zcmV-k1EKthP)p1n{1(*Arlh2XWU>cv%3f{ydfPkiu39ca zg;Gk=X$FrU>+HI4;m~2Y@n=iR8QR*`KB0JC1puX`TN?I#dVS>fZ#g}d5*bU0j3z~H z-qLdCepc^4aAT-y-l2s6vDnG5xwTaQC@$Vm|H^^72Ra&VwmGZdd@a%`IZ9*ysV1fX-^dJ*HbmPN|}3|lq0Zh<#D&=5$tGLsOU zmE+9WpMO1dx~=aSFGr98Q-dMkn(+J!(Ne`{uBDVO*{s%q1|tX`L{ylhye#_Sbk++* zz)<0*+YZU_5YGSX~oUN}+5U*8|4^+YSNu?oA}1 z^|1l?*DiInC;muj;qPl`m_1i9@8t;9iyW$6QemSFkqC@WWP_t$T|Nt70!&VI-tp6~ zY+4ele$KQMO2AR@Yyr5DFg6N24|2Zn!JdxW7dzhA0bnd%yc=Muv*X0NQ^$UKkjZE? z5ahzBwhgm9h}e+M2nP>b9r)p7cN0Ke-Sp6vlt|CAl{mjYgAb zHO;NYm^z!3=};LhA~M&Nt!$rGN-3o;+nwAF8sn z4rZ}pM@5`(ZO7F5HcE|6o5UpdzYo(MIGpFhc^;mJ!{Hs53x9yO>~_5~81#4ed=7vQ zii+5-Pjhkr=yW=BzV&+jA44`krz}6)QO{RZUAY|&i%aF@6GsaRivc=39?s_F0dNc) zKN-g8WJ`QFTe5seayMEJeG|NiZnnU;3=>jI$s5s&ks)5#a{_qJRDU4BxytGdn;3@_R6I0XPY$09lCy08%OyH+4OkTv}qeyBozYK$b~AdW4k8 zAS{-I1Wy6-4?6Qna(=cr|RDWGZk!AehusgB2c_j4k;rAyYrgXa9 zxix`6(_~H#maFy8I$GvvrnEJB$axqB@zSA7Zp{fgus+#q{T%lYiolUC{$ipUfzt^ z?SFOUet(&|uz*}#%!sZ>$5vKa-c6^c`%Uw4RU&asq|--?ojbD?0KcEHp`p?F@$s(# zs0G{QU~u4GC?p0A6o#Mg-nq_o9Ldq9 zY0A1I8aXl&n2X#*K}AJHXb3J^xM&qg1fei#lo2JBOurNowJ3;+$b^ufpG8DqW35C5 zgVYA6)F~AVX1>$LETyGq`=0Y2&hs8vifUfH8h~?=$f>q)xPJxUOfWdFxBGkmTwA%a zvBPoN0WQ1U3r%ip+}QBFx>^!DcF3)wqK3sw?gWGNiGv5_M^lqLE-#NR5YJUqoEopI z6W!Y@nRr}AH*An=bDIFJ`u(SeH*c2ohYuqC{W5j-tUQQBE&{j!4A7FvKr)F@P(UCS zlf8!y9nH;G)7RHBZ_pYDaBOJk{aUX#FBFegc~-5$ zbh*f_s8Gu)E0x>hL646!(b=h9zJ1$KGdOtsreV+}f`3{J>#pM**^-?dD?D&O896xs zNIK2e?rwTMe{R}8I(q)!e%E3H(Rw;PJuM^GuPZwoMog1m-@c(OOC*z-`tKjK=j8zq z3x!S(mzBu~$Nh z8dMrEO@EUt%R<>UuIy|q5h<>$tlBy=Gg+NVy`M`Et`rqD?G6NP=k)XdC=HU8n@hjP z)7WPihb^}ot+n8CDOV~*)t)`E&cedhc?KS@x4@p6K>!6W01 z9Q|{$r8V~Qy~EeqVV>0fXWL7Uc* zGWcE*{SYG|q=gb1k{D8mWeJ%@;|z{7^X_TkOg?pz`ofp{z31{h=U&daiV#M6IH==^ z=ZV_7P7(PNSIQ#y>*q!xlkRjMF&p;i@TQofrSW8S`km0&^)Lb?L1JrOCHf?a0$p9J!kTU3A^>7_cz(IN&T zLaPK=J1U2?1T+ktqfJ>vbdX>U|^+=#)B*Dl5|Uw4`Vh*ni`sIB9o zttAPD?DAXj`Zi8z9ZNKITxp8e9b18-f-I2U_5M6GABW~sCPqGpnXJRiyB7f1jA literal 0 HcmV?d00001 diff --git a/main/img/icons/16/down_na.png b/main/img/icons/16/down_na.png new file mode 100644 index 0000000000000000000000000000000000000000..513babe08ee3477bd084acf5ff071de3c05d5865 GIT binary patch literal 601 zcmV-f0;c_mP)|W zK~y-)#Zo_y5Zr(5N{oZf#2ok8*>krfE^iRfE5eEpv z(BEt}#Y&}emE?`&Ln(EZ&1PQ|3I%AbZ+J>6dcEFhx7&RO;J5*$6u$3cFc{q0P6&bL zd7zXY2E$$EAMyVUj7Fo834-8EDW#$)dZx8LYP#R=AJ=NN=af>@G|hRnTK!F0t=4re zmwRFuh5~RBMbQJs7&-hz-}hmf=9Un$)mmdT8fhuzOT#qHr?zdMYOO&Cfs_(b%3GVY z*03xKnM{Uhtr;N%j4@nXT%-)&_uqFqo$t17r&6gDVxvPuQH0rS1^}2&r&uf&zZheG zsN*<4!Z7?W91hiPx4T!IJY_naVzpXbN-5uP&NnAQ2sn;&RVtMpNhyn#W!+mCtu^NJ zIhM=iIp_R!yWNHm0+e$OAp|(*pMoIx?7A+LQg_6z>teB3oGYc?0*E!Z$r}^RX0yQ< zE9dihP)ebc!elbRdcD5noWD9+B+fYiz;T?)cDwyL9*?ox?c$ri#bP1E@g~MYLdX{> nWvk!s!}B~*E|)(hQzr2jHK_V1>djib00000NkvXXu0mjf02v5Z literal 0 HcmV?d00001 diff --git a/main/img/icons/16/pdf.png b/main/img/icons/16/pdf.png new file mode 100644 index 0000000000000000000000000000000000000000..54d20aec305772057a6867cc53e84226223e35ac GIT binary patch literal 726 zcmV;{0xA88P)A_=*p1UYfgmW-Rs+5;8EwDb6=PW%UYo<+FL_mk`+p93857z?%co+9j4y5hqO{t^(%TSWn^774>xgh+#N7LVc|Ej z_y-#uA&U@7CFFs;P+1R90C#Y45XT2ir;WaTNtk&@7=og$6zxDPH~eoBIOd3f8ls9s zLq`fE3URn>CIxUnHwI`Dhyv<}f@V&LP6!}*#JgP#Ff#x|#5VzwrKlNbW=QUY($V+t zv9U3jn!v1ZWrd~(aVWp7l4a=B6xHP9GVlS|?eJCs@?0t@1KM99K75EyPt!ktp8D8v(%!uo;8jH$ zALq-}tIq^p3|1f!z&b+`zs-_AzK_n$v3z9$|I07*qo IM6N<$f?e=C9smFU literal 0 HcmV?d00001 diff --git a/main/img/icons/16/up.png b/main/img/icons/16/up.png new file mode 100644 index 0000000000000000000000000000000000000000..e06c1cab13d9e46a48ad3439c82fc47145ff043d GIT binary patch literal 648 zcmV;30(bq1P)*XOR8Sd$n(W9umkd;O(Oz-ncCEEUZ zS7fG8!B48Nc5y1FgnTw3#jONN7E1 z;55A>H&2K?e_14f$P6MAh>Rif9+A(-WvZ`BqRqU^O=>6rGunh|J3#lgy)~T;T^BLa zx4>g{`M}aFC8b%CnabTw#fe>!xE=&B&s7`O%IX@rkKL$*-?!JB1ErScsHm+awIP*s9|3oi!cqoF%aXZ*aGVS<3h?+OrUH#DKinFKQv5pmjLG2kjCK1A zn*G&)ja0DVZ7|u-56C}({?7@N0e0HNw-u7*?<$q2@Lb4!r#t{F#P`J?^6AYz4kLk7 i5ggmkm?lrw0{#GOw+$9n$}yM#0000j08CMoYBrm_)pZ^Hejk+5i-P5H30>C_jYi8t2#-=) zqp?`*E}c%paU3wlKnS@gpp?RK94Lx{TrOAfegB$yp7*2M?Osz#LjYH*sy>d#;}0x^ z5V)=j*LAm)(yf#dzVCxE=CdFO3PBLu0N6_@Zz7S%djOA4)A##5*6Z~rDP@BY5+Q`R zj4_8^$*2@B4H*HBV;@ gf?z`k`Ftw)1#KF~XbHIJw*UYD07*qoM6N<$g8lab8~^|S literal 0 HcmV?d00001 diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index aefe8d81e6..0ad48ae5e8 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -136,6 +136,7 @@ class Template $this->twig->addFilter('icon', new Twig_Filter_Function('Template::get_icon_path')); $this->twig->addFilter('img', new Twig_Filter_Function('Template::get_image')); $this->twig->addFilter('format_date', new Twig_Filter_Function('Template::format_date')); + $this->twig->addFilter('isAllowedToEdit', new Twig_Filter_Function('Template::isAllowedToEdit')); $this->twig->addFilter('api_get_local_time', new Twig_Filter_Function('api_get_local_time')); // a combination of the two previous functions $this->twig->addFilter('local_format_date', new Twig_Filter_Function('api_convert_and_format_date')); @@ -236,7 +237,18 @@ class Template { return api_format_date($timestamp, $format); } - + + /** + * @param string $image + * @param int $size + * @param string $name + * @return string + */ + public static function isAllowedToEdit($tutor= false, $coach = false, $session_coach = false, $check_student_view = true) + { + return api_is_allowed_to_edit($tutor, $coach,$session_coach, $check_student_view); + } + /** * Return the item's url key: * diff --git a/main/inc/lib/thematic.lib.php b/main/inc/lib/thematic.lib.php index 30b19ca9ee..4ff9d12454 100755 --- a/main/inc/lib/thematic.lib.php +++ b/main/inc/lib/thematic.lib.php @@ -614,7 +614,7 @@ class Thematic * @param array $data * @return array */ - public function get_thematic_plan_div($data) + public function get_thematic_plan_array($data) { $final_return = array(); $uinfo = api_get_user_info(); @@ -632,10 +632,10 @@ class Thematic } } - $no_data = true; $session_star = ''; - $return = '
'; + $return = array(); if (!empty($default_thematic_plan_title)) { + foreach ($default_thematic_plan_title as $id=>$title) { //avoid others if ($title == 'Others' && empty($data[$thematic_id][$id]['description'])) { @@ -647,17 +647,18 @@ class Thematic $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']); } } - $return .= Display::tag('h3', Security::remove_XSS($data[$thematic_id][$id]['title'], STUDENT).$session_star); - $return .= Security::remove_XSS($data[$thematic_id][$id]['description'], STUDENT); - $no_data = false; + + $return[$id]['title'] = Security::remove_XSS($data[$thematic_id][$id]['title'], STUDENT).$session_star; + $return[$id]['description'] = Security::remove_XSS($data[$thematic_id][$id]['description'], STUDENT); } } } + $final_return[$thematic_id] = $return; + /* if ($no_data) { $return .= '
'.get_lang('StillDoNotHaveAThematicPlan').'
'; } - $return .= '
'; - $final_return[$thematic_id] = $return; + */ } return $final_return; diff --git a/main/template/default/course_progress/progress.tpl b/main/template/default/course_progress/progress.tpl index 55174873e9..67640bb81e 100644 --- a/main/template/default/course_progress/progress.tpl +++ b/main/template/default/course_progress/progress.tpl @@ -1,13 +1,105 @@ {% extends template ~ "/layout/layout_1_col.tpl" %} {% block content %} -{{ data | var_dump }} +{% set tutor = false | isAllowedToEdit(true) %}

{{ 'Progress' | get_lang }}: {{ score_progress }} %

+
+ + + + + + + + {% for item in data %} + + + + + + {% endfor %} + +
{{ 'Thematic' | get_lang }}{{ 'ThematicPlan' | get_lang }}{{ 'ThematicAdvance' | get_lang }}
+ {% if session_star is empty %} +

{{ item.title }}

+ {% else %} +

{{ item.title }} {{ session_star }}

+ {% endif %} + {{ item.content }} +
+ {{ item.toolbar }} +
+
+ {% if tutor %} +
+ + + +
+ {% endif %} +
+ {% if item.thematic_plan is empty %} +

{{ 'StillDoNotHaveAThematicPlan' | get_lang }}

+ {% else %} + {% for subitem in item.thematic_plan %} +

{{ subitem.title }}

+

{{ subitem.description }}

+ {% endfor %} + {% endif %} +
+
+ {% if tutor %} +
+ + + +
+ {% endif %} + + {% for advance in item.thematic_advance %} + + + + {% endfor %} +
+
+ {{ advance.start_date | format_date }} + {{ advance.content }} +
+ {% if tutor %} +
+
+ + + + + + + +
+
+ {% endif %} + + {% if advance.done_advance == 1 %} + {% set color = "background-color:#E5EDF9;" %} + {% else %} + {% set color = "background-color:#FFFFFF;" %} + {% endif %} +
+ {% if tutor %} +
+ +
+ {% endif %} +
+
+
From 9be713c268574fcceb1a37d92d3f59d18a858a2b Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Tue, 4 Apr 2017 14:25:15 -0500 Subject: [PATCH 3/4] New template TPL for course progress - refs BT#12441 --- app/Resources/public/css/base.css | 21 ++++ main/course_progress/thematic.php | 111 +----------------- .../default/course_progress/progress.tpl | 60 ++++++---- 3 files changed, 63 insertions(+), 129 deletions(-) diff --git a/app/Resources/public/css/base.css b/app/Resources/public/css/base.css index 11a6e6fd88..39c8fa4d69 100644 --- a/app/Resources/public/css/base.css +++ b/app/Resources/public/css/base.css @@ -4138,6 +4138,27 @@ ul.holder li.bit-box{ #thematic .arrow.collapsed{ background: url("../../main/img/icons/22/arrow-down-collapse.png") no-repeat 99% center; } +.thematic .toolbar-actions{ + height: 30px; + display: block; +} +.thematic .thematic-advance{ + margin-top: 10px; + display: inline-block; +} +.thematic .score-progress{ + background-color: #0099FF; + border: 1px solid #0099FF; + color: #FFF; + padding: 12px; + text-transform: uppercase; + margin-bottom: 10px; + border-radius: 5px; +} +.thematic .score-progress h3{ + margin: 0; + padding: 0; +} .question_options .exercise-unique-answer-image .radio{ padding-left: 10px; margin-left: 0px; diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index f7186c8e3c..0c58213be6 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -86,23 +86,17 @@ if ($action == 'thematic_list') { false ); } - - // display title - if (!empty($thematic_id)) { - } else { + if (empty($thematic_id)) { // display information - $text = '

'.get_lang('Information').'

'; + $text = ''.get_lang('Information').': '; $text .= get_lang('ThematicDetailsDescription'); $message = Display::return_message($text,'info', false); - } $list = []; // Display thematic data + if (!empty($thematic_data)) { // display progress - echo '

'.get_lang('Progress').': '.$total_average_of_advances.' %

'; - echo ''; - echo ''; foreach ($thematic_data as $thematic) { $list['id'] = $thematic['id']; @@ -121,9 +115,7 @@ if ($action == 'thematic_list') { $session_star = api_get_session_image(api_get_session_id(), $user_info['status']); } } - //@todo add a validation in order to load or not course thematics in the session thematic - echo ''; $toolbarThematic = ''; if (api_is_allowed_to_edit(null, true)) { // Thematic title @@ -162,110 +154,17 @@ if ($action == 'thematic_list') { .$my_thematic_id.$params.$url_token.'">' .Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_TINY).''; } - - // $actions_first_col = Display::div($actions_first_col, array('id' => 'thematic_id_content_'.$thematic['id'], 'class' => 'thematic_tools')); - // $actions_first_col = Display::div($actions_first_col, array('style' => 'height:20px')); } - - echo Display::tag('td', Display::tag('h3', Security::remove_XSS($thematic['title'], STUDENT).$session_star).Security::remove_XSS($thematic['content'], STUDENT).$actions_first_col, array('id' => 'thematic_td_content_'.$thematic['id'], 'class' => 'thematic_content')); - - // Display 2nd column - thematic plan data - echo ''; - - // Display 3rd column - thematic advance data - echo ''; - echo ''; + $list['thematic_advance'] = $thematic_advance_data[$thematic['id']]; + $list['last_done'] = $last_done_thematic_advance; $list['toolbar'] = $toolbarThematic; $listThematic[] = $list; } //End for - - - - echo '
'.get_lang('Thematic').''.get_lang('ThematicPlan').''.get_lang('ThematicAdvance').'
'; - if (empty($thematic_plan_div[$thematic['id']])) { $list['thematic_plan'] = null; } else { $list['thematic_plan'] = $thematic_plan_div[$thematic['id']]; } - echo ''; - - - //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { - if (!empty($thematic_advance_data[$thematic['id']])) { - - $list['thematic_advance'] = $thematic_advance_data[$thematic['id']]; - - echo ''; - foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) { - $thematic_advance['start_date'] = api_get_local_time($thematic_advance['start_date']); - $thematic_advance['start_date'] = api_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG); - echo ''; - echo ''; - - //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { - if (api_is_allowed_to_edit(null, true)) { - if (empty($thematic_id)) { - $checked = ''; - if ($last_done_thematic_advance == $thematic_advance['id']) { - $checked = 'checked'; - } - $style = ''; - if ($thematic_advance['done_advance'] == 1) { - $style = ' style="background-color:#E5EDF9" '; - } else { - $style = ' style="background-color:#fff" '; - } - echo ''; - } else { - if ($thematic_advance['done_advance'] == 1) { - echo ''; - } else { - echo ''; - } - } - } - echo ''; - } - echo '
'; - - $edit_link = ''; - if (api_is_allowed_to_edit(null, true)) { - $edit_link = Display::url( - Display::return_icon( - 'edit.png', - get_lang('EditThematicAdvance'), - [], - ICON_SIZE_SMALL - ), - 'index.php?'.api_get_cidreq().'&'.http_build_query([ - 'action' => 'thematic_advance_edit', - 'thematic_id' => $thematic['id'], - 'thematic_advance_id' => $thematic_advance['id'] - ]) - ); - $edit_link .= ''. - Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''; - - // Links - $edit_link = Display::div( - Display::div($edit_link, array('id' => 'thematic_advance_tools_'.$thematic_advance['id'], 'class' => 'thematic_advance_actions')), - array('style' => 'height:20px;') - ); - } - - $thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null; - echo Display::div($thematic_advance_item, array('id' => 'thematic_advance_'.$thematic_advance['id'])); - echo $edit_link; - echo '
'; - echo ''; - echo '
'.get_lang('Done').'
-
'; - } else { - echo '
'.get_lang('ThereIsNoAThematicAdvance').'
'; - } - echo '
'; - } else { - echo '
'.get_lang('ThereIsNoAThematicSection').'
'; } } elseif ($action == 'thematic_add' || $action == 'thematic_edit') { // Display form diff --git a/main/template/default/course_progress/progress.tpl b/main/template/default/course_progress/progress.tpl index 67640bb81e..f8445e504c 100644 --- a/main/template/default/course_progress/progress.tpl +++ b/main/template/default/course_progress/progress.tpl @@ -1,21 +1,21 @@ -{% extends template ~ "/layout/layout_1_col.tpl" %} - -{% block content %} +{{ message }} +{% if data is not empty %} {% set tutor = false | isAllowedToEdit(true) %}
-
-

{{ 'Progress' | get_lang }}: {{ score_progress }} %

+
+
+

{{ 'Progress' | get_lang }}: {{ score_progress }} %

+
- +
- {% for item in data %} {% endfor %} @@ -103,4 +115,6 @@ -{% endblock %} \ No newline at end of file +{% else %} + +{% endif %} \ No newline at end of file From 104e35961227cab48b765ed617da6a8778af8275 Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Tue, 4 Apr 2017 16:14:21 -0500 Subject: [PATCH 4/4] fix tpl thematic --- main/course_progress/thematic.php | 15 ++++++++------- main/inc/lib/template.lib.php | 13 +------------ .../template/default/course_progress/progress.tpl | 2 ++ 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index 0c58213be6..f37b706177 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -73,7 +73,7 @@ if ($action == 'thematic_list') { } elseif ($action == 'thematic_details') { if (isset($_GET['thematic_plan_save_message']) && $_GET['thematic_plan_save_message'] == 'ok') { - $message = Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull'), false, true); + Display::addFlash(Display::return_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull'), 'confirmation', false)); } if (isset($last_id) && $last_id) { @@ -81,16 +81,17 @@ if ($action == 'thematic_list') { Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), array('style' => 'vertical-align:middle;float:none;'), ICON_SIZE_SMALL).''; $link_to_thematic_advance = ''. Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), array('style' => 'vertical-align:middle;float:none;'), ICON_SIZE_SMALL).''; - Display::display_confirmation_message( + Display::addFlash(Display::return_message( get_lang('ThematicSectionHasBeenCreatedSuccessfull').'
'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'), $link_to_thematic_plan, $link_to_thematic_advance), + 'confirmation', false - ); + )); } if (empty($thematic_id)) { // display information $text = ''.get_lang('Information').': '; $text .= get_lang('ThematicDetailsDescription'); - $message = Display::return_message($text,'info', false); + $message = Display::return_message($text, 'info', false); } $list = []; // Display thematic data @@ -218,9 +219,9 @@ if ($action == 'thematic_list') { $tpl->assign('actions', $toolbar); $tpl->assign('message', $message); -$tpl->assign('data',$listThematic); -$tpl->assign('session_star',$session_star); +$tpl->assign('data', $listThematic); +$tpl->assign('session_star', $session_star); $tpl->assign('score_progress', $total_average_of_advances); $tpl->assign('thamatic', $thematic); $thematicLayout = $tpl->get_template('course_progress/progress.tpl'); -$tpl->display($thematicLayout); \ No newline at end of file +$tpl->display($thematicLayout); diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 0ad48ae5e8..4550ce5fa9 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -136,7 +136,7 @@ class Template $this->twig->addFilter('icon', new Twig_Filter_Function('Template::get_icon_path')); $this->twig->addFilter('img', new Twig_Filter_Function('Template::get_image')); $this->twig->addFilter('format_date', new Twig_Filter_Function('Template::format_date')); - $this->twig->addFilter('isAllowedToEdit', new Twig_Filter_Function('Template::isAllowedToEdit')); + $this->twig->addFilter('isAllowedToEdit', new Twig_Filter_Function('api_is_allowed_to_edit')); $this->twig->addFilter('api_get_local_time', new Twig_Filter_Function('api_get_local_time')); // a combination of the two previous functions $this->twig->addFilter('local_format_date', new Twig_Filter_Function('api_convert_and_format_date')); @@ -238,17 +238,6 @@ class Template return api_format_date($timestamp, $format); } - /** - * @param string $image - * @param int $size - * @param string $name - * @return string - */ - public static function isAllowedToEdit($tutor= false, $coach = false, $session_coach = false, $check_student_view = true) - { - return api_is_allowed_to_edit($tutor, $coach,$session_coach, $check_student_view); - } - /** * Return the item's url key: * diff --git a/main/template/default/course_progress/progress.tpl b/main/template/default/course_progress/progress.tpl index f8445e504c..fec63a9baf 100644 --- a/main/template/default/course_progress/progress.tpl +++ b/main/template/default/course_progress/progress.tpl @@ -1,4 +1,6 @@ +{{ actions }} {{ message }} +{{ flash_messages }} {% if data is not empty %} {% set tutor = false | isAllowedToEdit(true) %}
{{ 'Thematic' | get_lang }} {{ 'ThematicPlan' | get_lang }} {{ 'ThematicAdvance' | get_lang }}
@@ -56,7 +56,9 @@ {% endif %} +
+ {% if item.thematic_advance is not empty %} {% for advance in item.thematic_advance %} {% if advance.done_advance == 1 %} {% set color = "background-color:#E5EDF9;" %} {% else %} {% set color = "background-color:#FFFFFF;" %} {% endif %} - + {% else %} + + {% endif %} {% endfor %} + {% else %} + + {% endif %}
@@ -65,35 +67,45 @@ {{ advance.content }} {% if tutor %} -
-
- - - - - - - +
+
+
{% endif %} -
- {% if tutor %} + {% if tutor %} + + {% set check = "" %} + {% if item.last_done == advance.id %} + {% set check = "checked" %} + {% endif %}
- +
- {% endif %} -
+