| Index
» Projekty
» phpMyEdit
» Fórum
» Showing directly the "Edit" mode of the predefined |
 |
philipp
Založený: 19.12.2006
Príspevky: 4
Zaslal: 2006-12-20 16:16
Návrat hore
Odpovedať s citátom
|
Normally if you open your phpMyEdit file it shows you the table as a list ...
After you have selected an entry you can edit this entry.
What I try to figure out how can I go directly to an edit mode,without to see first the table.This means I have to define the $_POST options, before I call new phpMyEdit($opts);
I tryed with $opts['cgi']['overwrite']['operation'] options, but I don't get sucessfully ...
Have a look on this example ...
| Kód: |
function EditSchoolLab ($ID_key)
{
//...
//... normal generated code by phpMyEdit setup
//...
$opts['fdd']['ID_School'] = array(
'name' => 'ID School',
'select' => 'T',
'options' => 'AVCPDR', // auto increment
'maxlen' => 11,
'default' => '0',
'sort' => true
);
$opts['fdd']['schoolName'] = array(
'name' => 'SchoolName',
'select' => 'T',
'maxlen' => 30,
'sort' => true
);
$opts['fdd']['MBESC_Code'] = array(
'name' => 'MBESC Code',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
$opts['fdd']['refListSchoolType'] = array(
'name' => 'RefListSchoolType',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
// ...more tables ...
// ...
// show directly the record with $ID_key for editing...
$opts['cgi']['overwrite']['operation'] = 'Edit';
$opts['cgi']['overwrite']['rec'] = '$ID_key';
// Now important call to phpMyEdit
require_once 'phpMyEdit.class.php';
new phpMyEdit($opts);
} |
I already studied the docu and the class code, but I didn't found a solution ...
|
paperogiallo
Založený: 22.12.2006
Príspevky: 1
Zaslal: 2006-12-22 17:34
Návrat hore
Odpovedať s citátom
|
I want to know if it's possible, too! It's about 15 hours I'm trying to figure out how, and reading all class methods, but it seems to be impossible.
@Doug: it should be possible, if only there's a way to pass both ID and action to the class... but as Philipp said, something like
| Kód: |
$opts['cgi']['operation'] = 'edit';
$opts['cgi']['ID'] = 15; |
doesn't work at all. :(
And so something like
| Kód: |
| $opts['cgi']['operation'] = 'add'; |
still displays the "list page", and not directly the "add page".
So, I cannot use it in a MVC controller... :(
_YD
|
philipp
Založený: 19.12.2006
Príspevky: 4
Zaslal: 2006-12-22 18:09
Návrat hore
Odpovedať s citátom
|
| doug Napísal: |
| Without first displaying the default list of record id's, how are you going to know which record you want to edit / change? |
I already fould a solution which works. Anyway may somebody have his comments...
All together I have 5 main tables.
- ComputerLab
- School
- Technical Responsible
- Server Configuration
- Internet
Overview:
A "school" can have a "ComputerLab". If the School have "Computerlab", the have also a main server and some thin clients. The server has his "Server configuration" that he can provide the "Internet".
USECASE - Editing an entry:
1.) On the first page you see only the main table with the Schools on it.
2.) The user select a schools and clicks the "Show details button".
3.) The website get rebuilded it shows again the main school table and addistional some subtables (TechincalResponsible, ComputerLab, ServerConfig, Internet)
4.) The user can select a entry in the main table or in on of the subtable which he want modified.
Comment:
The main table I did with phpMyEdit, and the subtables I generate by hand with help of the ezsql-database class. I tryed first todo the subtables with phpMyEdit, but I failt.
On the own generated subtabels you can choose for every record and click on DEL or EDIT. You also can add some record.
If you click the DEL,EDIT or ADD button, phpMyEdit should load directly this site ...
First I tryed to overwirte the $_POST options with
$opts['cgi']['overwrite']['operation'] = 'Edit';
$opts['cgi']['overwrite']['rec'] = '$ID_key';
Now if found a way to reach my targets. I use the $_GET options...
For Edit of the Technical Responsible person I'm using as button link:
index.php?PME_sys_fl=0&PME_sys_fm=0&PME_sys_sfn[0]=1&PME_sys_operation=PME_op_Change&PME_sys_rec=5&ID_TechnicalResponsible=5&page=TechnicalResponsible&lastPage=school
For Deleting of the Technical Responsible person I'm using as button link:
index.php?PME_sys_fl=0&PME_sys_fm=0&PME_sys_sfn[0]=1&PME_sys_operation=PME_op_Delete&PME_sys_rec=5&ID_TechnicalResponsible=5&page=TechnicalResponsible&lastPage=school
NOTE: PME_sys_rec is already the correct record id for the table TechnicalResponsible
Question: Do I really need all these $_GET options ?
Philipp (www.schoolnet.na)
|
philipp
Založený: 19.12.2006
Príspevky: 4
Zaslal: 2007-01-04 00:01
Návrat hore
Odpovedať s citátom
|
| philipp Napísal: |
First I tryed to overwirte the $_POST options with
$opts['cgi']['overwrite']['operation'] = 'Edit';
$opts['cgi']['overwrite']['rec'] = '$ID_key';
|
May some people also struggeling with overwrite option ...
Finally I figured out, why my first tries failt. I figured out there is mistake in the documentation of 5.6.
I analysed the code of the main class and saw that you have to define it, including the prefix!
In case you didn't chage the sys-prefix, the correct line would be ...
$opts['cgi']['overwrite']['PME_sys_operation'] = 'Edit';
The examples in the user manual should be
$opts['cgi']['overwrite']['PME_sys_sfn'] = ...
The same issues is also with the ['append'] option. The correct example is:
$opts['cgi']['append']['PME_sys_fl'] = ...
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|