| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
@require_once("../../includes.php"); |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
define("context","form"); |
|---|
| 17 |
|
|---|
| 18 |
$title = __gettext('Forms'); |
|---|
| 19 |
|
|---|
| 20 |
if (isloggedin() && run("users:flags:get", array("admin", $_SESSION['userid']))) { |
|---|
| 21 |
|
|---|
| 22 |
$edit_msg = __gettext('Edit'); |
|---|
| 23 |
$delete_msg = __gettext('Delete'); |
|---|
| 24 |
$delete_confirm_msg = __gettext("Are you sure that you want to delete this form?"); |
|---|
| 25 |
|
|---|
| 26 |
$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="'.$CFG->wwwroot.'mod/widget/images/%s" />'; |
|---|
| 27 |
$edit_img = sprintf($img_template,$edit_msg,$edit_msg,"16-em-pencil.png"); |
|---|
| 28 |
$delete_img = sprintf($img_template,$delete_msg,$delete_msg,"16-em-cross.png"); |
|---|
| 29 |
$export_text = __gettext("Export"); |
|---|
| 30 |
$preview_text = __gettext("Preview"); |
|---|
| 31 |
$link_text = __gettext("Link"); |
|---|
| 32 |
|
|---|
| 33 |
$form_template = <<<END |
|---|
| 34 |
<a href="{$CFG->wwwroot}mod/form/manage_form.php?action=edit&id=%s">$edit_img</a> | |
|---|
| 35 |
<a onclick="return confirm('$delete_confirm_msg')" href="{$CFG->wwwroot}mod/form/manage_form.php?action=delete&id=%s">$delete_img</a> | |
|---|
| 36 |
<a href="{$CFG->wwwroot}mod/form/export.php?id=%s">$export_text</a> | |
|---|
| 37 |
<a href="{$CFG->wwwroot}mod/form/form.php?id=%s&preview=true">$preview_text</a> | |
|---|
| 38 |
<a href="{$CFG->wwwroot}mod/form/form.php?id=%s">$link_text</a> |
|---|
| 39 |
%s |
|---|
| 40 |
<br /> |
|---|
| 41 |
END; |
|---|
| 42 |
|
|---|
| 43 |
$body = '<p><a href="'.$CFG->wwwroot.'mod/form/manage_form.php">'.__gettext("Add new form").'</a> |'."\n"; |
|---|
| 44 |
$body .= '<a href="'.$CFG->wwwroot.'mod/form/list_fields.php?type=all">'.__gettext("List all fields").'</a> |'."\n"; |
|---|
| 45 |
$body .= '<a href="'.$CFG->wwwroot.'mod/form/list_fields.php?type=orphan">'.__gettext("List orphan fields").'</a> |'."\n"; |
|---|
| 46 |
$body .= '<a href="'.$CFG->wwwroot.'mod/form/import_profile.php">'.__gettext("Import profile").'</a></p>'."\n"; |
|---|
| 47 |
|
|---|
| 48 |
$forms = get_records_sql("SELECT * FROM {$CFG->prefix}forms ORDER BY name ASC"); |
|---|
| 49 |
if ($forms) { |
|---|
| 50 |
foreach ($forms as $form) { |
|---|
| 51 |
$body .= sprintf($form_template,$form->ident,$form->ident,$form->ident,$form->ident,$form->ident,$form->title.' ('.$form->name.')'); |
|---|
| 52 |
} |
|---|
| 53 |
} else { |
|---|
| 54 |
$body .= '<p>'.__gettext("There are no forms.").'</p>'; |
|---|
| 55 |
} |
|---|
| 56 |
} else { |
|---|
| 57 |
$body = __gettext("You must be logged in as a site administrator to view this page."); |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
$body = templates_draw(array( |
|---|
| 62 |
'context' => 'contentholder', |
|---|
| 63 |
'title' => $title, |
|---|
| 64 |
'body' => $body |
|---|
| 65 |
) |
|---|
| 66 |
); |
|---|
| 67 |
|
|---|
| 68 |
echo templates_page_draw( array( |
|---|
| 69 |
$title, $body |
|---|
| 70 |
) |
|---|
| 71 |
); |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
?> |
|---|