14 std::map<int, column>
tbl;
18 void list (
int iid,
bool editable =
true);
20 void show(
bool editable =
true);
34 string s_get(
string lbl);
35 float f_get(
string lbl);
36 int i_get(
string lbl);
37 struct tm
d_get(string lbl);
48 s =
"SELECT * FROM `" +
tbl_name +
"` WHERE " +
tbl[1].column_name +
" = " +
tbl[1].quote() +
tbl[1].get_sValue() +
tbl[1].quote() +
";";
50 while (
db.
res->next())
62 for (std::map<int, column>::iterator it=
tbl.begin(); it!=
tbl.end(); ++it)
64 it->second.set_value(
db.
res->getString(it->second.column_name));
73 cout <<
"<table class=\"table table-hover " +
class_name +
"\">\n";
75 cout <<
"<thead><tr>";
76 for (std::map<int, column>::iterator it=
tbl.begin(); it!=
tbl.end(); ++it)
78 if (it->second.input_type !=
"hidden")
80 if (it->second.show_with_previous)
84 cout << it->second.label;
85 std::map<int, column>::iterator it_2 = it;
86 if (it!=
tbl.end()) it_2++;
87 if (it==
tbl.end() || !(it_2->second.show_with_previous))
94 if (editable) cout <<
"<th>Actions</th>";
95 cout <<
"</tr></thead><tbody>\n";
102 cout <<
"</tbody></table>\n";
110 std::map<int, column>::iterator it;
111 cout <<
"<span id=\"is" << this->
class_name <<
"\"></span>";
116 for (it=
tbl.begin(); it!=
tbl.end(); ++it)
118 if (it->second.show_with_previous)
121 {
if (it->second.input_type !=
"hidden") cout <<
"<td>";}
122 it->second.show_inputField(iid, showExisting);
123 std::map<int, column>::iterator it_2 = it;
124 if (it!=
tbl.end()) it_2++;
125 if (it==
tbl.end() || !(it_2->second.show_with_previous))
127 if (it->second.input_type !=
"hidden") cout <<
"</td>";
133 cout <<
"<td><button type=\"submit\" value=\"Submit\"><img src=\"" <<
oConfig.
css_dir <<
"check.svg\" alt=\"add\" width=\"16\" alt=\"Save\"></button>";
134 cout <<
"<a href=\"" +
oConfig.
soft_url +
"?a=" <<
action_ref <<
"l&iid=" << iid <<
"\" class=\"button\"><img src=\"" <<
oConfig.
css_dir <<
"arrow_left.svg\" alt=\"Go back without saving the changes!\" width=\"16\" height=\"16\"></a></td>" ;
137 cout <<
"<td><button type=\"submit\" value=\"Submit\" data-toggle=\"tooltip\" title=\"" <<
t_save <<
"\"><span class=\"glyphicon glyphicon-ok\" style=\"color:green\"></span></button>";
138 cout <<
"<a data-toggle=\"tooltip\" title=\"" <<
t_cancel <<
"\" href=\"" +
oConfig.
soft_url +
"?a=" <<
action_ref <<
"l&iid=" << iid <<
"\"><span class=\"glyphicon glyphicon-chevron-left\" style=\"color:blue\"></span></a></td>" ;
141 cout <<
"<td><button type=\"submit\" value=\"Submit\"><img src=\"" <<
oConfig.
css_dir <<
"check.svg\" alt=\"add\" width=\"16\" alt=\"Save\"></button>";
142 cout <<
"<a href=\"" +
oConfig.
soft_url +
"?a=" <<
action_ref <<
"l&iid=" << iid <<
"\" class=\"button\"><img src=\"" <<
oConfig.
css_dir <<
"arrow_left.svg\" alt=\"Go back without saving the changes!\" width=\"16\" height=\"16\"></a></td>" ;
159 std::map<int, column>::iterator it;
161 cout <<
"<span id=\"is" << this->
class_name <<
"\"></span>";
164 if (class_name !=
"")
166 cout <<
"<div class=\"alert alert-info\">";
176 s =
"SELECT * FROM " +
tbl_name +
" WHERE investor = " + to_string(iid);
180 while (
db.
res->next())
190 for (it=
tbl.begin(); it!=
tbl.end(); ++it)
192 if (it->second.input_type !=
"hidden")
195 if (it->second.show_with_previous)
199 it->second.show_inputField(iid,
false);
200 std::map<int, column>::iterator it_2 = it;
201 if (it!=
tbl.end()) it_2++;
202 if (it==
tbl.end() || !(it_2->second.show_with_previous))
212 cout <<
"<button type=\"submit\" value=\"Submit\"><img src=\"" <<
oConfig.
css_dir <<
"plus.svg\" alt=\"add\" width=\"16\" height=\"16\" alt=\"Save\"></button>";
213 cout <<
"<button type=\"reset\"><img src=\"" <<
oConfig.
css_dir <<
"undo.svg\" alt=\"Reset!\" width=\"16\" height=\"16\"></button></td>" ;
216 cout <<
"<button type=\"submit\" value=\"Submit\" data-toggle=\"tooltip\" title=\"" <<
t_save <<
"\"><span class=\"glyphicon glyphicon-ok\" style=\"color:green\"></span></button>";
217 cout <<
"<button type=\"reset\" data-toggle=\"tooltip\" title=\"" <<
t_reset <<
"\"><span class=\"glyphicon glyphicon-chevron-left\" style=\"color:blue\"></span></button></td>" ;
220 cout <<
"<button type=\"submit\" value=\"Submit\"><img src=\"" <<
oConfig.
css_dir <<
"plus.svg\" alt=\"add\" width=\"16\" height=\"16\" alt=\"Save\"></button>";
221 cout <<
"<button type=\"reset\"><img src=\"" <<
oConfig.
css_dir <<
"undo.svg\" alt=\"Reset!\" width=\"16\" height=\"16\"></button></td>" ;
227 cout <<
"<input name=\"iid\" type=\"hidden\" value=\"" << to_string(iid) <<
"\">";
237 for (std::map<int, column>::iterator it=
tbl.begin(); it!=
tbl.end(); ++it)
239 if (it->second.input_type !=
"hidden")
241 if (it->second.show_with_previous)
246 std::map<int, column>::iterator it_2 = it;
247 if (it!=
tbl.end()) it_2++;
248 if (it==
tbl.end() || !(it_2->second.show_with_previous))
262 cout <<
"<td><a class=\"btn btn-default\" href=\"" +
oConfig.
soft_url +
"?a=" +
action_ref +
"e&" +
action_ref +
"id=" +
tbl[1].get_sValue() +
"\" data-toggle=\"tooltip\" title=\"" <<
t_edit <<
"\"><span class=\"glyphicon glyphicon-pencil\" style=\"color:blue\"></span></a> ";
263 cout <<
"<a href=\"" +
oConfig.
soft_url +
"?a=" +
action_ref +
"d&" +
action_ref +
"id=" +
tbl[1].get_sValue() +
"\" data-toggle=\"tooltip\" title=\"" <<
t_delete <<
"\"><span class=\"glyphicon glyphicon-remove\" style=\"color:red\"></span></a></td>";
278 std::map<int, column>::iterator it;
282 s =
"UPDATE `" +
tbl_name +
"` SET ";
283 for (it=
tbl.begin(); it!=
tbl.end(); ++it)
285 s = s + it->second.column_name +
" = " + it->second.quote() + it->second.get_sValue() + it->second.quote();
286 if (++it!=
tbl.end()) {s = s +
",";}
289 s = s +
" WHERE " +
tbl[1].column_name +
"=" +
tbl[1].quote() +
tbl[1].get_sValue() +
tbl[1].quote() +
";";
293 s =
"INSERT INTO `" +
tbl_name +
"` (";
294 for (it=
tbl.begin(); it!=
tbl.end(); ++it)
296 if (it->second.get_sValue().length() > 0)
298 s = s + it->second.column_name;
299 if (++it!=
tbl.end()) {s = s +
",";}
303 s = s +
") value (" ;
304 for (it=
tbl.begin(); it!=
tbl.end(); ++it)
306 if (it->second.get_sValue().length() > 0)
308 s = s + it->second.quote() + it->second.get_sValue() + it->second.quote();
309 if (++it!=
tbl.end()) {s = s +
",";}
316 debug_info = debug_info +
"<br>goal.save: " + s;
324 debug_info = debug_info +
"<br>" + s;
338 for (std::map<int, column>::iterator it=
tbl.begin(); it!=
tbl.end(); ++it)
341 it->second.set_value(
cgi(it->second.post_code));
344 if (
verify()) {
return true;}
else {
return false;}
353 s =
"DELETE FROM `" +
tbl_name +
"` WHERE " +
tbl[1].column_name +
" = " +
tbl[1].quote() +
tbl[1].get_sValue() +
tbl[1].quote() +
";";
372 for (std::map<int, column>::iterator it=
tbl.begin(); it!=
tbl.end(); ++it)
387 s =
"SELECT COUNT(*) AS CNT FROM `" +
tbl_name +
"` WHERE " +
tbl[1].column_name +
" = " +
tbl[1].quote() +
tbl[1].get_sValue() +
tbl[1].quote() +
";";
389 debug_info = debug_info +
"<br>bona.exists(): " + s;
390 debug_info = debug_info +
"<BR>to_string(tbl[1].get_iValue()): " + to_string(
tbl[1].get_iValue()) +
"<br>";
392 if (
tbl[1].get_iValue() != 0)
395 while (
db.
res->next()) {rc = (
db.
res->getString(
"CNT") ==
"1") ?
true :
false;}
411 struct tm
bona::d_get(string lbl) {
return tbl[defList[lbl]].get_dValue();}
void load_fromRecordSet()
string order_by
should be the column name eventually followed by DESC/ASC, eg. "priority ASC"
void show_th(bool editable)
string error_message
global message variables
const string tbl_prefix
tables start with "" + oConfig.tbl_prefix + "_" if the prefix is eg. "tbl" then we have "tbl_invesotr...
void show_edit_form(int iid, bool showExisting=false)
std::map< int, column > tbl
unordered_map< string, string > t_before_list
std::map< string, int > defList
list holding the column names in the table connected to the correct id of the column ...
void show(bool editable=true)
struct tm d_get(string lbl)
config oConfig
mysql connection mysql connector from dev.mysql.com
void list(int iid, bool editable=true)