Gitlab CSE Unil
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
M. Chardon
moodle-assignfeedback_editpdfplus
Commits
0945bd1e
Commit
0945bd1e
authored
Aug 16, 2017
by
M. Chardon
Browse files
affochage des bars d'outils dispo
parent
ba66ae6e
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
amd/build/admin_panel.min.js
View file @
0945bd1e
This diff is collapsed.
Click to expand it.
amd/src/admin_panel.js
View file @
0945bd1e
...
...
@@ -145,6 +145,7 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
}
currentTool
.
order
=
$
(
"
#order
"
).
val
();
initCanevas
();
initToolDisplay
();
};
//
var
getTypeTool
=
function
(
toolid
)
{
...
...
@@ -384,6 +385,16 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
currentTool
.
enabled
=
$
(
"
#enabled
"
).
val
();
currentTool
.
reply
=
$
(
"
#reply
"
).
val
();
currentTool
.
order
=
$
(
"
#order
"
).
val
();
$
(
"
#typetool
"
).
on
(
"
change
"
,
function
()
{
currentTool
.
typetool
=
$
(
"
#typetool
"
).
val
();
var
typetoolEntity
=
getTypeTool
(
currentTool
.
typetool
);
currentTool
.
color
=
typetoolEntity
.
color
;
currentTool
.
catridgecolor
=
typetoolEntity
.
cartridge_color
;
$
(
"
#color
"
).
val
(
currentTool
.
color
);
$
(
"
#cartridgecolor
"
).
val
(
currentTool
.
catridgecolor
);
initToolDisplay
();
initCanevas
();
});
$
(
"
#toolFormSubmit
"
).
on
(
"
click
"
,
function
()
{
var
res
=
""
;
$
(
"
input[name^='text[']
"
).
each
(
function
()
{
...
...
@@ -592,6 +603,7 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
currentTool
.
catridgecolor
=
typetoolEntity
.
cartridge_color
;
$
(
"
#color
"
).
val
(
currentTool
.
color
);
$
(
"
#cartridgecolor
"
).
val
(
currentTool
.
catridgecolor
);
initToolDisplay
();
});
$
(
"
#typetool
"
).
change
();
}
...
...
classes/widget_admin.php
View file @
0945bd1e
...
...
@@ -59,13 +59,14 @@ class widget_admin implements renderable, templatable {
* @param tool[] $toolbars - the different tool to display
* @param axis[] $axis - the different axis to display
*/
public
function
__construct
(
$context
,
$course
,
$userid
,
$toolbars
,
$axis
,
$typetools
)
{
public
function
__construct
(
$context
,
$course
,
$userid
,
$toolbars
,
$axis
,
$typetools
,
$toolbarsDispo
)
{
$this
->
context
=
$context
;
$this
->
course
=
$course
;
$this
->
userid
=
$userid
;
$this
->
toolbars
=
$toolbars
;
$this
->
axis
=
$axis
;
$this
->
toollibs
=
json_encode
(
$typetools
);
$this
->
toolbarsDispo
=
$toolbarsDispo
;
}
public
function
export_for_template
(
\
renderer_base
$output
)
{
...
...
locallib_admin.php
View file @
0945bd1e
...
...
@@ -28,7 +28,6 @@ use \assignfeedback_editpdfplus\page_editor;
use
\
assignfeedback_editpdfplus\widget_admin
;
use
\
assignfeedback_editpdfplus\form\axis_form
;
use
\
assignfeedback_editpdfplus\form\axis_del_form
;
use
\
assignfeedback_editpdfplus\form\tool_form
;
use
\
assignfeedback_editpdfplus\admin_editor
;
class
assign_feedback_editpdfplus_admin
{
...
...
@@ -162,7 +161,7 @@ class assign_feedback_editpdfplus_admin {
$obj
->
text
=
substr
(
$obj
->
text
,
1
);
}
if
(
substr
(
$obj
->
text
,
-
1
)
==
'"'
)
{
$obj
->
text
=
substr
(
$obj
->
text
,
0
,
-
1
);
$obj
->
text
=
substr
(
$obj
->
text
,
0
,
-
1
);
}
$obj
->
index
=
$compteur
;
$data
->
tool
->
textsarray
[]
=
$obj
;
...
...
@@ -186,12 +185,39 @@ class assign_feedback_editpdfplus_admin {
global
$USER
;
// get the costum toolbars
$toolbars
=
array
();
$coursecontext
=
context
::
instance_by_id
(
$this
->
context
->
id
);
$coursecontexts
=
array_filter
(
explode
(
'/'
,
$coursecontext
->
path
),
'strlen'
);
$tools
=
page_editor
::
get_tools
(
$coursecontexts
);
$typetools
=
page_editor
::
get_typetools
(
null
);
$axis
=
page_editor
::
get_axis
(
array
(
$this
->
context
->
id
));
$toolbars
=
$this
->
prepareToolbar
(
$axis
,
$tools
);
// get all accessibled toolbars
$courses
=
get_courses
();
$contextListToCheck
=
array
();
foreach
(
$courses
as
$course
)
{
$contextid
=
context_course
::
instance
(
$course
->
id
);
$coursecontextsTmp
=
array_filter
(
explode
(
'/'
,
$contextid
->
path
),
'strlen'
);
foreach
(
$coursecontextsTmp
as
$value
)
{
if
(
$value
!=
$this
->
context
->
id
&&
!
in_array
(
$value
,
$contextListToCheck
))
{
$contextListToCheck
[]
=
$value
;
}
}
}
$axisDispo
=
array
();
$toolDispo
=
page_editor
::
get_tools
(
$contextListToCheck
);
foreach
(
$contextListToCheck
as
$value
)
{
$axistmp
=
page_editor
::
get_axis
(
array
(
$value
));
if
(
$axistmp
&&
sizeof
(
$axistmp
)
>
0
)
{
$axisDispo
=
array_merge
(
$axisDispo
,
$axistmp
);
}
}
$toolbarsDispo
=
$this
->
prepareToolbar
(
$axisDispo
,
$toolDispo
);
$widget
=
new
widget_admin
(
$this
->
context
,
$this
->
course
,
$USER
,
$toolbars
,
$axis
,
$typetools
,
$toolbarsDispo
);
return
$widget
;
}
private
function
prepareToolbar
(
$axis
,
$tools
)
{
$toolbars
=
array
();
foreach
(
$axis
as
$ax
)
{
$ax
->
children
=
0
;
$toolbar
=
new
stdClass
();
...
...
@@ -219,8 +245,7 @@ class assign_feedback_editpdfplus_admin {
}
$toolbars
[]
=
$toolbar
;
}
$widget
=
new
widget_admin
(
$this
->
context
,
$this
->
course
,
$USER
,
$toolbars
,
$axis
,
$typetools
);
return
$widget
;
return
$toolbars
;
}
}
templates/admin.mustache
View file @
0945bd1e
...
...
@@ -5,6 +5,41 @@
<div
class=
"assignfeedback_editpdfplus_widget_admin"
>
<h5>
{{#
str
}}
adminsubtitle, assignfeedback_editpdfplus
{{/
str
}}
</h5>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
Importation axe
</div>
<div
class=
"panel-body"
>
Axes disponibles à l'importation
<table
class=
'table table-bordered table-striped'
>
<thead>
<tr>
<!--th>Cours / activité</th-->
<th>
Nom
</th>
<th>
Outils
</th>
<th>
Importer
</th>
</tr>
</thead>
<tbody>
{{#
toolbarsDispo
}}
<tr>
<!--td></td-->
<td>
{{
axis
.
label
}}
</td>
<td>
{{#
tools
}}
<button
class=
"btn btn-default"
style=
"
{{
style
}}
"
>
{{
label
}}
</button>
{{/
tools
}}
</td>
<td><button
class=
'btn btn-primary btn-sm'
class=
'btnimport'
data-axis=
'
{{
axis
.
id
}}
'
><i
class=
'fa fa-download'
></i></button></td>
</tr>
{{/
toolbarsDispo
}}
</tbody>
</table>
</div>
</div>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
{{#
str
}}
admincurrenttoolbar, assignfeedback_editpdfplus
{{/
str
}}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment