Skip to content

Commit 6920b89

Browse files
committed
1 parent 1645bb0 commit 6920b89

File tree

1 file changed

+83
-83
lines changed

1 file changed

+83
-83
lines changed
Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,89 @@
11
<?php
22

33
class plugin_listview extends plugin_base {
4-
5-
var $module;
6-
var $form;
7-
var $tab;
8-
var $record_id;
9-
var $formdef;
10-
var $options;
11-
12-
function onShow() {
13-
14-
global $app;
15-
16-
$app->uses('listform');
17-
$app->listform->loadListDef($this->options["listdef"]);
18-
19-
//$app->listform->SQLExtWhere = "type = 'alias'";
20-
21-
$listTpl = new tpl;
22-
$listTpl->newTemplate('templates/'.$app->listform->listDef["name"].'_list.htm');
23-
24-
// Changing some of the list values to reflect that the list is called within a tform page
25-
$app->listform->listDef["file"] = $app->tform->formDef["action"];
26-
$app->listform->listDef["page_params"] = "&id=".$app->tform_actions->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
27-
28-
29-
// Generate the SQL for searching
30-
if($app->listform->listDef["auth"] != 'no') {
31-
if($_SESSION["s"]["user"]["typ"] == "admin") {
32-
$sql_where = "";
33-
} else {
34-
$sql_where = $app->tform->getAuthSQL('r')." and";
35-
}
36-
}
37-
38-
if($this->options["sqlextwhere"] != '') {
39-
$sql_where .= " ".$this->options["sqlextwhere"]." and";
40-
}
41-
42-
$sql_where = $app->listform->getSearchSQL($sql_where);
43-
$listTpl->setVar($app->listform->searchValues);
44-
45-
// Generate SQL for paging
46-
$limit_sql = $app->listform->getPagingSQL($sql_where);
47-
$listTpl->setVar("paging",$app->listform->pagingHTML);
48-
49-
// Get the data
50-
$records = $app->db->queryAllRecords("SELECT * FROM ".$app->listform->listDef["table"]." WHERE $sql_where $limit_sql");
51-
52-
$bgcolor = "#FFFFFF";
53-
if(is_array($records)) {
54-
$idx_key = $app->listform->listDef["table_idx"];
55-
foreach($records as $rec) {
56-
57-
$rec = $app->listform->decode($rec);
58-
59-
// Change of color
60-
$bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
61-
$rec["bgcolor"] = $bgcolor;
62-
63-
// The variable "id" contains always the index field
64-
$rec["id"] = $rec[$idx_key];
65-
66-
$records_new[] = $rec;
67-
}
68-
}
69-
70-
$listTpl->setLoop('records',$records_new);
71-
72-
// Loading language field
73-
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
74-
include($lng_file);
75-
$listTpl->setVar($wb);
76-
77-
// Setting Returnto information in the session
78-
$list_name = $app->listform->listDef["name"];
79-
$_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
80-
$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
81-
$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
82-
$_SESSION["s"]["form"]["return_to"] = $list_name;
83-
84-
return $listTpl->grab();
85-
86-
}
4+
5+
var $module;
6+
var $form;
7+
var $tab;
8+
var $record_id;
9+
var $formdef;
10+
var $options;
11+
12+
function onShow() {
13+
14+
global $app;
15+
16+
$app->uses('listform');
17+
$app->listform->loadListDef($this->options["listdef"]);
18+
19+
//$app->listform->SQLExtWhere = "type = 'alias'";
20+
21+
$listTpl = new tpl;
22+
$listTpl->newTemplate('templates/'.$app->listform->listDef["name"].'_list.htm');
23+
24+
// Changing some of the list values to reflect that the list is called within a tform page
25+
$app->listform->listDef["file"] = $app->tform->formDef["action"];
26+
$app->listform->listDef["page_params"] = "&id=".$app->tform_actions->id."&next_tab=".$_SESSION["s"]["form"]["tab"];
27+
28+
29+
// Generate the SQL for searching
30+
if($app->listform->listDef["auth"] != 'no') {
31+
if($_SESSION["s"]["user"]["typ"] == "admin") {
32+
$sql_where = "";
33+
} else {
34+
$sql_where = $app->tform->getAuthSQL('r')." and";
35+
}
36+
}
37+
38+
if($this->options["sqlextwhere"] != '') {
39+
$sql_where .= " ".$this->options["sqlextwhere"]." and";
40+
}
41+
42+
$sql_where = $app->listform->getSearchSQL($sql_where);
43+
$listTpl->setVar($app->listform->searchValues);
44+
45+
// Generate SQL for paging
46+
$limit_sql = $app->listform->getPagingSQL($sql_where);
47+
$listTpl->setVar("paging",$app->listform->pagingHTML);
48+
49+
// Get the data
50+
$records = $app->db->queryAllRecords("SELECT * FROM ".$app->listform->listDef["table"]." WHERE $sql_where $limit_sql");
51+
52+
$bgcolor = "#FFFFFF";
53+
if(is_array($records)) {
54+
$idx_key = $app->listform->listDef["table_idx"];
55+
foreach($records as $rec) {
56+
57+
$rec = $app->listform->decode($rec);
58+
59+
// Change of color
60+
$bgcolor = ($bgcolor == "#FFFFFF")?"#EEEEEE":"#FFFFFF";
61+
$rec["bgcolor"] = $bgcolor;
62+
63+
// The variable "id" contains always the index field
64+
$rec["id"] = $rec[$idx_key];
65+
66+
$records_new[] = $rec;
67+
}
68+
}
69+
70+
$listTpl->setLoop('records',$records_new);
71+
72+
// Loading language field
73+
$lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng";
74+
include($lng_file);
75+
$listTpl->setVar($wb);
76+
77+
// Setting Returnto information in the session
78+
$list_name = $app->listform->listDef["name"];
79+
$_SESSION["s"]["list"][$list_name]["parent_id"] = $app->tform_actions->id;
80+
$_SESSION["s"]["list"][$list_name]["parent_tab"] = $_SESSION["s"]["form"]["tab"];
81+
$_SESSION["s"]["list"][$list_name]["parent_script"] = $app->tform->formDef["action"];
82+
$_SESSION["s"]["form"]["return_to"] = $list_name;
83+
84+
return $listTpl->grab();
85+
86+
}
8787
}
8888

8989
?>

0 commit comments

Comments
 (0)