function admin_display_groups_popup_edit_definition
Search API
7.x admin.groups.inc | admin_display_groups_popup_edit_definition() |
6.x admin.groups.inc | admin_display_groups_popup_edit_definition() |
4.x admin.groups.inc | admin_display_groups_popup_edit_definition() |
5.x admin.groups.inc | admin_display_groups_popup_edit_definition() |
File
- modules/
admin/ admin.groups.inc, line 848
Code
function admin_display_groups_popup_edit_definition() {
$rtn = $tdef = "";
fp_add_css(fp_get_module_path("admin") . "/css/admin.css");
fp_add_js(fp_get_module_path("admin") . "/js/admin.js");
$group_id = trim($_REQUEST ["group_id"]);
$group = new Group($group_id, null, -1, false, true);
$group->load_descriptive_data();
$school_id = intval($group->school_id);
$de_catalog_year = admin_get_de_catalog_year(TRUE, $school_id);
$school_name = "";
if ($school_id > 0) {
$school_name = " School-" . $school_id;
}
if (module_enabled("schools")) {
$defs = schools_get_school_definitions();
if (isset($defs [$school_id])) {
$school_name = $defs [$school_id];
}
}
if (isset($_REQUEST ["definition"])) {
$definition = trim($_REQUEST ["definition"]);
}
else {
$definition = $group->definition;
}
$results = admin_get_courses_from_definition($definition, "", $school_id);
// This text will be used to describe how the definition works in a javascript alert box:
$tdef .= t("Definitions provide a very quick way to add or remove many courses from a group.") . "<br><br>
" . t("To view a complete set of instructions, <a href='https://getflightpath.com/node/11941' target='_balnk'>visit the documentation page by clicking here</a>.");
$rtn .= "" . t("Edit Definition for %group (%cat)
- @name", array("%group" => $group->title, "%cat" => $de_catalog_year, "@name" => $group->title));
if ($school_name) {
$rtn .= "<br><br>" . t("<strong>Note:</strong> This will only search for courses in the same school as the group <em>since its last save</em>.
<br><strong>Searching in school: %schoolname", array("%schoolname" => $school_name)) . "</strong>";
}
$rtn .= "
<br><br><form action='" . fp_url("admin/groups/popup-edit-definition", "de_catalog_year=$de_catalog_year&group_id=$group_id") . "' method='POST' id='mainform'>
<table border='0' width='100%'>
<tr>
<td valign='top' align='right' width='45%'>
<div class='tenpt' align='left'>" . t("Working Definition:") . "
" . fp_get_js_alert_link($tdef, "<span class='pop-q-mark'><i class='fa fa-question-circle'></i></span>") . "</div>
<textarea name='definition' id='definition' rows='10' style='min-width:100%; resize: none;' >$definition</textarea>
<br>
<input type='button' value='" . t("Generate ->") . "'
onClick='showUpdate(); document.getElementById(\"mainform\").submit();'>
<input type='hidden' name='school_id' value='$school_id'>
</td>
<td valign='top' align='right' class='tenpt' width='55%'>
<div class='tenpt' align='left'>Results:" . " (" . $results ["count"] . ")</div>
<textarea rows='10' style='min-width:100%; resize: none;' readonly=readonly class='readonly'>{$results ["text"]}</textarea>
<br>";
if ($school_name) {
$rtn .= "<div>" . t("loads courses from all cat years in school %schoolname", array("%schoolname" => $school_name)) . "</div>";
}
else {
$rtn .= "<div>" . t("loads courses from all cat years") . "</div>";
}
$rtn .= "
</td>
</tr>
</table>
</form>
" . t("If you are satisfied with the results of this definition,
click the Save to Group button. To cancel, simply close this window.") . "
<br>
<input type='button' value='" . t("Save to Group") . "' onClick='adminPopupSaveDefinition(\"\");'>
";
// Give a little padding.
return "<body style='padding:5px;'>$rtn</body>";
}