Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » PopUp and add1 - key fields
Re: PopUp and add1 - key fields [message #5221 is a reply to message #5195] Fri, 18 December 2015 11:08 Go to previous messageGo to previous message
htManager is currently offline  htManager
Messages: 417
Registered: May 2014
Senior Member
I do know and understand what you mean but I can't get the code right. I worked through two more php tutorials but I don't succeed. Here is my code, can you take a look at it?

Why can't I change the status of $popupaufruf_status? Is it because of the visibility of the variable? Thank you very much in advance.

<?php
require_once 'std.table.class.inc';
class orga_kontakte_adresse extends Default_Table
{
public $popupaufruf_status = False;

// ************************************************************ ****************
function orga_kontakte_adresse ()
{
// save directory name of current script
$this->dirname = dirname(__file__);

$this->dbms_engine = ''; // to be supplied by getFieldSpec_original()
$this->dbprefix = ''; // to be supplied by getFieldSpec_original()
$this->dbname = 'htm';
$this->tablename = 'orga_kontakte_adresse';

// call this method to get original field specifications
// (note that they may be modified at runtime)
$this->fieldspec = $this->getFieldSpec_original();

} // kontakte

function _cm_getInitialData ($fieldarray)
// Perform custom processing for the getInitialData method.
// $fieldarray contains data from the initial $where clause.
{
{
if ($popupaufruf_status == True) {
echo 'Wahre Welt';
}
elseif ($popupaufruf_status == False) {
echo 'Falsche Welt';

// get next available number for user_seq_no
$where = "user_id='{$_SESSION['logon_user_id']}'";
$query = "SELECT max(user_seq_no) FROM $this->tablename WHERE $where";
$count = $this->getCount($query);
$fieldarray['user_id'] = $_SESSION['logon_user_id'];
$fieldarray['user_seq_no'] = $count + 1;
}
}

// set these fields to 'noedit' (read only)
$this->fieldspec['user_id']['noedit'] = 'y';
$this->fieldspec['user_seq_no']['noedit'] = 'y';

return $fieldarray;

} // _cm_getInitialData

function _cm_popupCall ($popupname, $where, $fieldarray, &$settings)
// if a popup button has been pressed the contents of $where may need to
// be altered before the popup screen is called.
// NOTE: $settings is passed BY REFERENCE as it may be altered.
{
// allow only one entry to be selected (the default)
$settings['select_one'] = FALSE;

return $where;

} // _cm_popupCall

// ************************************************************ ****************
function _cm_popupReturn ($fieldarray, $return_from, &$select_array, $return_files)
// process a selection returned from a popup screen.
// $fieldarray contains the record data when the popup button was pressed.
// $return_from identifies which popup screen was called.
// $select_array contains an array of item(s) selected in that popup screen.
// $return_files contains a list of all files loaded via a fileupload task.
// NOTE: $select_array is passed BY REFERENCE so that it can be modified.
{
//if ($return_from == '???(popup)') {
// // change field name from 'foo_id' to 'bar_id'
// $select_array['bar_id'] = $select_array['foo_id'];
// unset($select_array['foo_id']);
//} // if

// Variable für _cm_GetInitialData, dass Daten aus Kontakt-Pool übernommen werden
$this->popupaufruf_status(True);

return $fieldarray;

} // _cm_popupReturn


// ************************************************************ ****************
function _cm_post_popupReturn ($fieldarray, $return_from, $select_array)
{

// liest Daten in Abhängigkeit des aufrufenden Formulars ein
if ($return_from == 'htm_orga_kontakte(popup1)'){

// get contents of foreign table KONTAKTE
$dbobject =& RDCsingleton::getInstance('orga_kontakte'); // Instanz für Lookup-Tabelle
$where = "user_id='{$select_array['user_id']}'
AND user_seq_no='{$select_array['user_seq_no']}'
AND rdcaccount_id='{$select_array['rdcaccount_id']}'";
$data = $dbobject->getData ($where);

if (!empty($data)){
$data = $data[0];
$fieldarray['user_id'] = $data['user_id'];
$fieldarray['user_seq_no'] = $data['user_seq_no'];
$fieldarray['rdcaccount_id'] = $_SESSION['rdcaccount_id'];
$fieldarray['kontakt_name'] = $data['kontakt_name'];
$fieldarray['kontakt_vorname'] = $data['kontakt_vorname'];
$fieldarray['kontakt_middlename'] = $data['kontakt_middlename'];
$fieldarray['kontakt_geburtstag'] = $data['kontakt_geburtstag'];
} // if
}

return $fieldarray;

}

// ************************************************************ ****************
function popupaufruf_status($neuer_status) {
// ändert die Eigenschaft von $popupaufruf
$this->popupaufruf_status = $neuer_status;
}

// function __construct($neuer_status){
// $this->popupaufruf_status = $neuer_status;
// }

// ************************************************************ ****************
} // end class
// ************************************************************ ****************

// Variable für _cm_GetInitialData, dass Daten aus Kontakt-Pool übernommen werden
$popupobject = new orga_kontakte_adresse();

?>
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Different Categories
Next Topic: Del1 - no table name in query
Goto Forum:
  


Current Time: Mon May 13 20:03:42 EDT 2024

Total time taken to generate the page: 0.00995 seconds