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

Home » RADICORE development » Transaction Patterns » Filepicker (Deleting Files / VPD)
Re: Filepicker [message #5532 is a reply to message #4600] Wed, 04 May 2016 11:08 Go to previous messageGo to previous message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
One more question: I want to examine if the the selected file can be deleted. I try to do this in the _cm_pre_DeleteRecord($rowdata) function with the code below.
I will do this with the _cm_getExtraData method. But $data shows only the occurences in the 'virtual' table 'training_plan_uebungen_pic_file' where all the pics are listed. Why I don't get back the occurences of 'training_plan_uebungen'. Isn't the $dbobject linked to 'training_plan_uebungen'?

class training_plan_uebungen_pic_file extends Default_Table
{ ..........

function _cm_pre_deleteRecord ($rowdata)
// perform custom processing before database record is deleted.
// if anything is placed in $this->errors the deletion will be terminated.
{
// this entry exists in the file system, not the database
$filename = $this->picker_subdir .'/' .$rowdata['file'];

// htManager changes
// check if pic belongs to the appropriate account or is related to an exercise in 'training_plan_uebungen'
$prefix_pattern = prefixAccount($_SESSION['rdcaccount_id']);

// get contents of table 'training_plan_uebungen'
-> $dbobject =& RDCsingleton::getInstance('training_plan_uebungen');
$fieldarray['training_plan_uebung_pfad_grafik'] = $filename;

$data = $dbobject->_cm_getExtraData($where, $fieldarray);

// only files with appropriate rdcaccount_id can be deleted
if (preg_match('/^'.$prefix_pattern.'/i', $rowdata['file']) and count($data) == 0)
{
$result = unlink($filename);

}

return $rowdata;

} // _cm_pre_deleteRecord
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: list1/list2 - prevent opening detail screen
Next Topic: VPD - PopUp
Goto Forum:
  


Current Time: Sat Apr 27 04:39:59 EDT 2024

Total time taken to generate the page: 0.01222 seconds