Skip to content

Commit 903787b

Browse files
committed
ready for pr
1 parent b3c792a commit 903787b

File tree

6 files changed

+64
-104
lines changed

6 files changed

+64
-104
lines changed

block_crucible.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,20 @@ public function get_content() {
579579

580580
$role = $lp->get_user_workrole_string($USER->id);
581581
$suggestions = $lp->suggest_templates_for_user($USER->id, 8);
582+
foreach ($suggestions as $s) {
583+
$plan = $lp->get_user_plan_from_template((int)$s->id, $USER->id);
584+
if ($plan) {
585+
$s->hasplan = true;
586+
} else {
587+
$s->hasplan = false;
588+
}
589+
}
582590

583591
$lpdata = (object)[
584-
'heading' => get_string('view_learningplan', 'block_crucible'),
585-
'role' => $role,
592+
'heading' => get_string('view_learningplan', 'block_crucible'),
593+
'role' => $role,
586594
'hassuggestions' => !empty($suggestions),
587-
'suggestions' => array_map(function($s) {
595+
'suggestions' => array_map(function($s) {
588596
return (object)[
589597
'id' => $s->id,
590598
'name' => $s->name,
@@ -593,6 +601,7 @@ public function get_content() {
593601
'url' => $s->url,
594602
'coursecount' => $s->coursecount ?? 0,
595603
'activitycount' => $s->activitycount ?? 0,
604+
'hasplan' => !empty($s->hasplan),
596605
];
597606
}, $suggestions),
598607
];
@@ -601,6 +610,7 @@ public function get_content() {
601610

602611
$this->content->text = $OUTPUT->render_from_template('block_crucible/with_learningplan', $lpdata);
603612
return $this->content;
613+
604614
} else if ($view === 'competencies') {
605615
$svc = new \block_crucible\competencies();
606616
$data = $svc->get_view_data(20);

edit_form.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ protected function specific_definition($mform) {
1919
null, null, [0, 1]
2020
);
2121

22-
$default = (int)get_config('block_crucible', 'showheader_default');
23-
$mform->setDefault('config_showheader', $default ?: 1);
2422
$mform->addHelpButton('config_showheader', 'showheader', 'block_crucible');
2523

26-
$mform->setDefault('config_showheader', 1);
24+
$mform->setDefault('config_showheader', 0);
2725

2826
$mform->addElement('select', 'config_viewtype',
2927
get_string('config_viewtype', 'block_crucible'),

lang/en/block_crucible.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
$string['configplayershow'] = 'Show Player application regardless of user permissions';
6666
$string['playerapiurl'] = 'Player API';
6767
$string['playerappurl'] = 'Player UI';
68-
$string['playerdescription'] = 'Crucible\'s Exercise User Interface';
68+
$string['playerdescription'] = 'Exercise User Interface';
6969
$string['configplayerapiurl'] = 'Player API URL used to pull permissions';
7070
$string['configplayerappurl'] = 'Player UI URL used to redirect participants';
7171
$string['playersectionheading'] = 'Player Settings';
@@ -78,7 +78,7 @@
7878
$string['alloyappurl'] = 'Alloy UI';
7979
$string['configalloyapiurl'] = 'Alloy API URL used to pull permissions';
8080
$string['configalloyappurl'] = 'Alloy UI used to redirect content developers';
81-
$string['alloydescription'] = 'Crucible\'s On-Demand Exercise Deployment Dashboard';
81+
$string['alloydescription'] = 'On-Demand Exercise Deployment Dashboard';
8282
$string['alloysectionheading'] = 'Alloy Settings';
8383
$string['alloysectiondesc'] = 'Configure API and application URLs for Alloy integration.';
8484

@@ -89,7 +89,7 @@
8989
$string['blueprintappurl'] = 'Blueprint UI';
9090
$string['configblueprintapiurl'] = 'Blueprint API URL used to pull permissions';
9191
$string['configblueprintappurl'] = 'Blueprint UI used to redirect content developers';
92-
$string['blueprintdescription'] = 'Crucible\'s Exercise Planning Tool';
92+
$string['blueprintdescription'] = 'Exercise Planning Tool';
9393
$string['blueprintsectionheading'] = 'Blueprint Settings';
9494
$string['blueprintsectiondesc'] = 'Configure API and application URLs for Blueprint integration.';
9595

@@ -100,7 +100,7 @@
100100
$string['casterappurl'] = 'Caster UI';
101101
$string['configcasterapiurl'] = 'Caster API URL used to pull permissions';
102102
$string['configcasterappurl'] = 'Caster UI used to redirect content developers';
103-
$string['casterdescription'] = 'Crucible\'s Exercise Topology Builder';
103+
$string['casterdescription'] = 'Exercise Topology Builder';
104104
$string['castersectionheading'] = 'Caster Settings';
105105
$string['castersectiondesc'] = 'Configure API and application URLs for Caster integration.';
106106

@@ -111,7 +111,7 @@
111111
$string['citeappurl'] = 'CITE UI';
112112
$string['configciteapiurl'] = 'CITE API URL used to pull permissions';
113113
$string['configciteappurl'] = 'CITE UI URL used to redirect participants';
114-
$string['citedescription'] = 'Crucible\'s Exercise Dashboard and Incident Evaluator';
114+
$string['citedescription'] = 'Exercise Dashboard and Incident Evaluator';
115115
$string['citesectionheading'] = 'CITE Settings';
116116
$string['citesectiondesc'] = 'Configure API and application URLs for CITE integration.';
117117

@@ -122,7 +122,7 @@
122122
$string['galleryappurl'] = 'Gallery UI';
123123
$string['configgalleryapiurl'] = 'Gallery API URL used to pull permissions';
124124
$string['configgalleryappurl'] = 'Gallery UI URL used to redirect participants';
125-
$string['gallerydescription'] = 'Crucible\'s Exercise Information Sharing Tool';
125+
$string['gallerydescription'] = 'Exercise Information Sharing Tool';
126126
$string['gallerysectionheading'] = 'Gallery Settings';
127127
$string['gallerysectiondesc'] = 'Configure API and application URLs for Gallery integration.';
128128

@@ -133,7 +133,7 @@
133133
$string['steamfitterappurl'] = 'Steamfitter UI';
134134
$string['configsteamfitterapiurl'] = 'Steamfitter API URL used to pull permissions';
135135
$string['configsteamfitterappurl'] = 'Steamfitter UI URL used to redirect participants';
136-
$string['steamfitterdescription'] = 'Crucible\'s Exercise Inject Automater';
136+
$string['steamfitterdescription'] = 'Exercise Inject Automater';
137137
$string['steamfittersectionheading'] = 'Steamfitter Settings';
138138
$string['steamfittersectiondesc'] = 'Configure API and application URLs for Steamfitter integration.';
139139

@@ -168,7 +168,7 @@
168168
$string['topomojoappurl'] = 'TopoMojo UI';
169169
$string['configtopomojoapiurl'] = 'TopoMojo API URL used to pull permissions';
170170
$string['configtopomojoappurl'] = 'TopoMojo UI URL used to redirect participants';
171-
$string['topomojodescription'] = 'Crucible\'s Training Lab Builder and Interface';
171+
$string['topomojodescription'] = 'Training Lab Builder and Interface';
172172
$string['topomojosectionheading'] = 'TopoMojo Settings';
173173
$string['topomojosectiondesc'] = 'Configure API, keys, and application URLs for TopoMojo integration.';
174174

@@ -179,7 +179,7 @@
179179
$string['gameboardappurl'] = 'Gameboard UI';
180180
$string['configgameboardapiurl'] = 'Gameboard API URL used to pull permissions';
181181
$string['configgameboardappurl'] = 'Gameboard UI URL used to redirect participants';
182-
$string['gameboarddescription'] = 'Crucible\'s Competition Platform';
182+
$string['gameboarddescription'] = 'Competition Platform';
183183
$string['gameboardsectionheading'] = 'Gameboard Settings';
184184
$string['gameboardsectiondesc'] = 'Configure API, keys, and application URLs for Gameboard integration.';
185185

@@ -309,3 +309,6 @@
309309
$string['nocohorts'] = 'You are not in any cohorts.';
310310
$string['cohortroles'] = 'Team Role';
311311
$string['reportsheader'] = 'My Team';
312+
$string['alreadyenrolled'] = 'You are already enrolled in this learning plan.';
313+
$string['alreadyenrolled_short'] = 'Enrolled';
314+
$string['viewplan'] = 'View plan';

styles.css

Lines changed: 25 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
.imcite-lp .imcite-lp-row:hover { background:#f8fafc; }
88
.imcite-template a:hover { text-decoration: underline; background: #f8fafc; }
99

10-
/* Card */
1110
.imcite-card {
1211
margin: 16px auto;
1312
border: 1px solid #e5e7eb;
@@ -18,7 +17,6 @@
1817
font: 14px/1.45 system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
1918
}
2019

21-
/* Header */
2220
.imcite-card__header {
2321
display: flex;
2422
gap: 10px;
@@ -41,10 +39,8 @@
4139
.imcite-card__title { font-size:18px; font-weight:800; color:#1e3a8a; }
4240
.imcite-card__subtitle { font-size:13px; color:#475569; }
4341

44-
/* Body */
4542
.imcite-card__body { padding: 12px; background:#f8fafc; }
4643

47-
/* Table shell */
4844
.comp-table {
4945
border: 1px solid #e5e7eb;
5046
border-radius: 12px;
@@ -77,7 +73,7 @@
7773
.comp-meta { font-size:12px; color:#64748b; margin-top:2px; }
7874
.comp-cell--num { text-align:right; font-variant-numeric: tabular-nums; }
7975

80-
/* Framework band (header row, spans all columns) */
76+
8177
.framework-band[role="rowgroup"] > .framework-band__inner {
8278
grid-column: 1 / -1;
8379
padding: 12px 14px;
@@ -102,7 +98,6 @@
10298
}
10399
.framework-name { font-size: 15px; }
104100

105-
/* Empty state */
106101
.notice--empty {
107102
border: 1px dashed #cbd5e1;
108103
border-radius: 12px;
@@ -112,7 +107,6 @@
112107
text-align: center;
113108
}
114109

115-
/* Unmapped section */
116110
.divider { border-top:1px solid #e5e7eb; margin-top:6px; }
117111
.unmapped-link {
118112
display:block;
@@ -126,7 +120,6 @@
126120
.unmapped-link:focus,
127121
.unmapped-link:hover { background:#fff3d6; outline:none; }
128122

129-
/* LP card tweaks (reuses .imcite-card*, only table is new) */
130123
.lp-table-wrap {
131124
border: 1px solid #e5e7eb;
132125
border-radius: 12px;
@@ -158,6 +151,9 @@
158151
font-size: 16px;
159152
color: #1d4ed8;
160153
text-decoration: none;
154+
white-space: nowrap;
155+
overflow: hidden;
156+
text-overflow: ellipsis;
161157
}
162158
.imcite-lp .lp-row:hover td .lp-name a { text-decoration: underline; }
163159
.imcite-lp .lp-row:hover { background: #f8fafc; }
@@ -177,12 +173,9 @@
177173
text-align: center;
178174
}
179175

180-
/* ===== Landing (apps) ===== */
181176
.imcite-apps {container-type: inline-size;}
182177
.imcite-apps .imcite-card__body { padding:14px; }
183178

184-
/* header subtitle color already covered by .imcite-card__subtitle */
185-
186179
/* Grid */
187180
.apps-grid {
188181
display: grid;
@@ -217,86 +210,33 @@
217210
object-fit: contain;
218211
}
219212

220-
/* Hover affordance */
221213
.imcite-apps .app-card:hover { box-shadow: 0 2px 8px rgba(2,6,23,.06); }
222214

223215
#dropdownFiltersButton {
224216
display: none !important;
225217
}
226-
/* Scope all overrides to this block only */
227-
.imcite-report .reportbuilder-table {
228-
/* Base look */
229-
border-radius: 12px;
230-
overflow: hidden; /* keep rounded corners on header */
231-
border: 1px solid rgba(0,0,0,0.06);
232-
background: #fff;
233-
margin: 0; /* align with card edges */
234-
}
235-
236-
/* Header */
237-
.imcite-report .reportbuilder-table thead th.header {
238-
background: linear-gradient(180deg, #f7f9fc 0%, #f1f4f9 100%);
239-
color: #2b4b9b; /* match your apps card title blue */
240-
font-weight: 700;
241-
border-bottom: 1px solid rgba(0,0,0,0.08);
242-
padding: 10px 14px;
243-
}
244-
.imcite-report .reportbuilder-table thead th.header a {
245-
color: inherit;
246-
text-decoration: none;
247-
}
248-
249-
/* Body cells */
250-
.imcite-report .reportbuilder-table tbody td.cell {
251-
padding: 10px 14px;
252-
vertical-align: middle;
253-
border-top-color: rgba(0,0,0,0.04); /* soften row separators */
254-
}
255-
256-
/* Row hover */
257-
.imcite-report .reportbuilder-table tbody tr:hover td {
258-
background: #f8fbff;
259-
}
260218

261-
/* Link styling inside cells */
262-
.imcite-report .reportbuilder-table tbody td a {
263-
color: #2b4b9b;
219+
.lp-chip {
220+
display: inline-flex;
221+
align-items: center;
222+
gap: .5rem;
223+
padding: .18rem .6rem;
224+
border-radius: 999px;
225+
background: #e6f4ea;
226+
border: 1px solid #b7e0c2;
227+
color: #155724;
228+
font-size: .78rem;
264229
font-weight: 600;
265-
}
266-
.imcite-report .reportbuilder-table tbody td a:hover {
267-
text-decoration: underline;
268-
}
269-
270-
/* Hide RB's extra card-view toggle column (not used in your layout) */
271-
.imcite-report .reportbuilder-table td.card-toggle,
272-
.imcite-report .reportbuilder-table th.card-toggle {
273-
display: none !important;
274-
}
275-
276-
/* RB sometimes renders 'emptyrow' to pad the page — hide them */
277-
.imcite-report .reportbuilder-table tr.emptyrow {
278-
display: none;
279-
}
280-
281-
/* Make long text wrap nicely */
282-
.imcite-report .reportbuilder-table .no-overflow,
283-
.imcite-report .reportbuilder-table .text_to_html {
284-
white-space: normal;
285-
overflow: visible;
286-
text-overflow: clip;
230+
line-height: 1.2;
231+
margin-top: 0;
232+
white-space: nowrap;
233+
flex: 0 0 auto;
287234
}
288235

289-
/* Optional: compact mode (tighten everything slightly) */
290-
.imcite-report .reportbuilder-table.table {
291-
--rb-cell-pad-y: 8px;
292-
--rb-cell-pad-x: 12px;
293-
}
294-
.imcite-report .reportbuilder-table td.cell,
295-
.imcite-report .reportbuilder-table th.header {
296-
padding: var(--rb-cell-pad-y) var(--rb-cell-pad-x);
297-
}
298-
299-
/* OPTIONAL: remove the Download UI inside this card only */
300-
.imcite-report .dataformatselector {
301-
display: none !important;
302-
}
236+
.lp-name__title {
237+
display: flex;
238+
margin-top: 0;
239+
align-items: center;
240+
gap: .5rem;
241+
min-width: 0;
242+
}

templates/with_learningplan.mustache

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<!-- Body (table with counts) -->
2424
<div class="imcite-card__body">
2525

26-
{{#hassuggestions}}
26+
{{#hassuggestions}}
2727
<div class="lp-table-wrap">
2828
<table role="table" class="lp-table">
2929
<thead>
@@ -42,9 +42,18 @@
4242
<tbody>
4343
{{#suggestions}}
4444
<tr class="lp-row">
45-
<td class="lp-cell lp-name">
45+
<td class="lp-cell lp-name">
46+
<div class="lp-name__title">
4647
<a href="{{url}}">{{name}}</a>
47-
</td>
48+
{{#hasplan}}
49+
<span class="lp-chip" title="{{#str}} alreadyenrolled, block_crucible {{/str}}">
50+
<span class="lp-chip__label">
51+
{{#str}} alreadyenrolled_short, block_crucible {{/str}}
52+
</span>
53+
</span>
54+
{{/hasplan}}
55+
</div>
56+
</td>
4857
<td class="lp-cell--num">{{coursecount}}</td>
4958
<td class="lp-cell--num">{{activitycount}}</td>
5059
</tr>

version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
defined('MOODLE_INTERNAL') || die;
4444

45-
$plugin->version = 2025102100;
45+
$plugin->version = 2025102200;
4646
$plugin->requires = 2025041400;
4747
$plugin->component = 'block_crucible';
4848
$plugin->maturity = MATURITY_ALPHA;

0 commit comments

Comments
 (0)