Enhanced Studio Samples for ModuleSurfer
From dispage wiki
With some little modifications Enhanced Studio Samples can be viewed from ModuleSurfer grids.
Here are some examples:
Multiple File Upload
(Enhanced Studio FULL version is needed for this sample)
Scenario: create a field that allows to upload multiple files for each Contact or Accounts, and view them from ModuleSurfer grid.
Procedure :
Follow the procedure reported in Multiple File Upload replacing the Code in Step 3 with the following
Code:
if (isset($_REQUEST['oper']) && $_REQUEST['oper'] == 'edit') { if (!isset($_REQUEST['sCall'])) { preg_match('/file_upload_list\[\]"\s+value="([^"]*)"/', $bean->file_upload_c, $cap); $bean->file_upload_c = $cap[1]; } } else { $uploaddir = 'cache/public_uploads/'; if (!file_exists($uploaddir)) { mkdir($uploaddir); } $file_up = array(); foreach($_FILES['file_upload_c']['name'] as $k => $name) { $basename = basename($name); $file_up[] = $basename; $uploadfile = $uploaddir . $basename; move_uploaded_file($_FILES['file_upload_c']['tmp_name'][$k], $uploadfile); } $bean->file_upload_c = join(';', array_filter(array_merge((array)@$_REQUEST['file_upload_list'], $file_up))); }
An example of result is shown in Figure 1
Figure 1
Field with a List of Values
(Enhanced Studio FULL version is needed for this sample)
Scenario: create a field that allows to enter/change/delete multiple values, and view them from ModuleSurfer grid
Procedure :
Follow the procedure reported in Field with a List of Values replacing the Code in Step 3 with the following
if (isset($_REQUEST['oper']) && $_REQUEST['oper'] == 'edit') { if (!isset($_REQUEST['sCall'])) { preg_match_all('/<td>(.*?)<\/td>/i', $bean->multi_c, $cap); $bean->multi_c = serialize($cap[1]); } } else { $uploaddir = 'cache/public_uploads/'; if (isset($_REQUEST['multi_c']) && is_array($_REQUEST['multi_c'])) { $multi_c = $_REQUEST['multi_c']; if (!@$multi_c[count($multi_c) -1]) { array_pop($multi_c); } $bean->multi_c = serialize($multi_c); } }
Field is shown in the grid as in Figure 2
Figure 2