forked from extern/egroupware
Set to use template as an object
This commit is contained in:
parent
4b53a832ad
commit
45522f2a0f
@ -15,7 +15,8 @@
|
||||
$phpgw_info["flags"] = array("currentapp" => "admin", "enable_nextmatchs_class" => True);
|
||||
include("../header.inc.php");
|
||||
|
||||
$phpgw->template->set_file(array("list" => "applications.tpl",
|
||||
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
|
||||
$p->set_file(array("list" => "applications.tpl",
|
||||
"row" => "applications_row.tpl"));
|
||||
|
||||
if ($order) {
|
||||
@ -28,14 +29,14 @@
|
||||
$sort = "desc";
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("lang_installed",lang("Installed applications"));
|
||||
$phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_color"]);
|
||||
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
||||
$p->set_var("lang_installed",lang("Installed applications"));
|
||||
$p->set_var("bg_color",$phpgw_info["theme"]["bg_color"]);
|
||||
$p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
||||
|
||||
$phpgw->template->set_var("sort_title",$phpgw->nextmatchs->show_sort_order($sort,"app_title",$order,"applications.php",lang("title")));
|
||||
$phpgw->template->set_var("lang_edit",lang("Edit"));
|
||||
$phpgw->template->set_var("lang_delete",lang("Delete"));
|
||||
$phpgw->template->set_var("lang_enabled",lang("Enabled"));
|
||||
$p->set_var("sort_title",$phpgw->nextmatchs->show_sort_order($sort,"app_title",$order,"applications.php",lang("title")));
|
||||
$p->set_var("lang_edit",lang("Edit"));
|
||||
$p->set_var("lang_delete",lang("Delete"));
|
||||
$p->set_var("lang_enabled",lang("Enabled"));
|
||||
|
||||
$phpgw->db->query("select * from phpgw_applications $ordermethod",__LINE__,__FILE__);
|
||||
while ($phpgw->db->next_record()) {
|
||||
@ -45,24 +46,24 @@
|
||||
if (! $phpgw->db->f("app_title")) $name = $phpgw->db->f("app_name");
|
||||
if (! $name) $name = " ";
|
||||
|
||||
$phpgw->template->set_var("tr_color",$tr_color);
|
||||
$phpgw->template->set_var("name",$name);
|
||||
$phpgw->template->set_var("edit",'<a href="' . $phpgw->link("editapplication.php","app_name=" . urlencode($phpgw->db->f("app_name"))) . '"> ' . lang("Edit") . ' </a>');
|
||||
$phpgw->template->set_var("delete",'<a href="' . $phpgw->link("deleteapplication.php","app_name=" . urlencode($phpgw->db->f("app_name"))) . '"> ' . lang("Delete") . ' </a>');
|
||||
$p->set_var("tr_color",$tr_color);
|
||||
$p->set_var("name",$name);
|
||||
$p->set_var("edit",'<a href="' . $phpgw->link("editapplication.php","app_name=" . urlencode($phpgw->db->f("app_name"))) . '"> ' . lang("Edit") . ' </a>');
|
||||
$p->set_var("delete",'<a href="' . $phpgw->link("deleteapplication.php","app_name=" . urlencode($phpgw->db->f("app_name"))) . '"> ' . lang("Delete") . ' </a>');
|
||||
|
||||
if ($phpgw->db->f("app_enabled") != 0) {
|
||||
$status = lang("Yes");
|
||||
} else {
|
||||
$status = "<b>" . lang("No") . "</b>";
|
||||
}
|
||||
$phpgw->template->set_var("status",$status);
|
||||
$p->set_var("status",$status);
|
||||
|
||||
$phpgw->template->parse("rows","row",True);
|
||||
$p->parse("rows","row",True);
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("new_action",$phpgw->link("newapplication.php"));
|
||||
$phpgw->template->set_var("lang_add",lang("add"));
|
||||
$p->set_var("new_action",$phpgw->link("newapplication.php"));
|
||||
$p->set_var("lang_add",lang("add"));
|
||||
|
||||
$phpgw->template->pparse("out","list");
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
$p->pparse("out","list");
|
||||
$p->common->phpgw_footer();
|
||||
?>
|
||||
|
@ -18,21 +18,25 @@
|
||||
|
||||
$phpgw_info["flags"]["currentapp"] = "admin";
|
||||
$phpgw_info["flags"]["enable_nextmatchs_class"] = True;
|
||||
|
||||
include("../header.inc.php");
|
||||
|
||||
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('admin'));
|
||||
|
||||
function display_row($label, $value)
|
||||
{
|
||||
global $phpgw;
|
||||
$phpgw->template->set_var("tr_color",$phpgw->nextmatchs->alternate_row_color());
|
||||
$phpgw->template->set_var("label",$label);
|
||||
$phpgw->template->set_var("value",$value);
|
||||
global $phpgw,$p;
|
||||
$p->set_var("tr_color",$phpgw->nextmatchs->alternate_row_color());
|
||||
$p->set_var("label",$label);
|
||||
$p->set_var("value",$value);
|
||||
|
||||
$phpgw->template->parse("rows","row",True);
|
||||
$p->parse("rows","row",True);
|
||||
}
|
||||
|
||||
$phpgw->template->set_file(array("form" => "application_form.tpl",
|
||||
"row" => "application_form_row.tpl"
|
||||
));
|
||||
$p->set_file(array(
|
||||
"form" => "application_form.tpl",
|
||||
"row" => "application_form_row.tpl"
|
||||
));
|
||||
|
||||
if ($submit) {
|
||||
if (! $app_order) {
|
||||
@ -53,10 +57,10 @@
|
||||
$phpgw->db->next_record();
|
||||
|
||||
if ($phpgw->db->f(0) != 0) {
|
||||
$error[$totalerrors++] = lang("That application name already exsists.");
|
||||
$error[$totalerrors++] = lang("That application name already exists.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $totalerrors) {
|
||||
$phpgw->db->query("update phpgw_applications set app_name='" . addslashes($n_app_name) . "',"
|
||||
. "app_title='" . addslashes($n_app_title) . "', app_enabled='"
|
||||
@ -79,9 +83,9 @@
|
||||
$phpgw->common->phpgw_header();
|
||||
echo parse_navbar();
|
||||
|
||||
$phpgw->template->set_var("error","<p><center>" . $phpgw->common->error_list($error) . "</center><br>");
|
||||
$p->set_var("error","<p><center>" . $phpgw->common->error_list($error) . "</center><br>");
|
||||
} else {
|
||||
$phpgw->template->set_var("error","");
|
||||
$p->set_var("error","");
|
||||
|
||||
$n_app_name = $phpgw->db->f("app_name");
|
||||
$n_app_title = $phpgw->db->f("app_title");
|
||||
@ -91,16 +95,16 @@
|
||||
$n_app_anonymous = $phpgw->acl->check('', PHPGW_ACL_READ, $n_app_name);
|
||||
}
|
||||
|
||||
$phpgw->template->set_var("lang_header",lang("Edit application"));
|
||||
$phpgw->template->set_var("hidden_vars",'<input type="hidden" name="old_app_name" value="' . $old_app_name . '">');
|
||||
$phpgw->template->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
||||
$phpgw->template->set_var("form_action",$phpgw->link("editapplication.php"));
|
||||
$p->set_var("lang_header",lang("Edit application"));
|
||||
$p->set_var("hidden_vars",'<input type="hidden" name="old_app_name" value="' . $old_app_name . '">');
|
||||
$p->set_var("th_bg",$phpgw_info["theme"]["th_bg"]);
|
||||
$p->set_var("form_action",$phpgw->link("editapplication.php"));
|
||||
|
||||
display_row(lang("application name"),'<input name="n_app_name" value="' . $n_app_name . '">');
|
||||
display_row(lang("application title"),'<input name="n_app_title" value="' . $n_app_title . '">');
|
||||
|
||||
$phpgw->template->set_var("lang_status",lang("Status"));
|
||||
$phpgw->template->set_var("lang_submit_button",lang("edit"));
|
||||
$p->set_var("lang_status",lang("Status"));
|
||||
$p->set_var("lang_submit_button",lang("edit"));
|
||||
|
||||
$selected[$n_app_status] = " selected";
|
||||
$status_html = '<option value="0"' . $selected[0] . '>' . lang("Disabled") . '</option>'
|
||||
@ -118,9 +122,9 @@
|
||||
|
||||
display_row(lang("Allow Anonymous access to this app"),$str);
|
||||
|
||||
$phpgw->template->set_var("select_status",$status_html);
|
||||
$p->set_var("select_status",$status_html);
|
||||
|
||||
$phpgw->template->pparse("out","form");
|
||||
$p->pparse("out","form");
|
||||
|
||||
$phpgw->common->phpgw_footer();
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user