1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 22:27:34 +02:00

Quick fix for handling array data and converting to comma separated data including filtering list results. (Admin-UI)

This commit is contained in:
CaMer0n
2012-08-02 02:11:22 +00:00
parent b44f0a2085
commit 4c7525b50d
2 changed files with 14 additions and 6 deletions

View File

@@ -350,7 +350,9 @@ class media_form_ui extends e_admin_form_ui
function media_category($curVal,$mode) // not really necessary since we can use 'dropdown' - but just an example of a custom function.
{
$curVal = explode(",",$curVal);
if($mode == 'read')
{
return $this->getController()->getMediaCategory($curVal);
@@ -409,7 +411,7 @@ class media_admin_ui extends e_admin_ui
'checkboxes' => array('title'=> '', 'type' => null, 'data'=> null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'media_id' => array('title'=> LAN_ID, 'type' => 'number', 'data'=> 'int', 'width' =>'5%', 'forced'=> TRUE, 'nolist'=>TRUE),
'media_url' => array('title'=> 'Preview', 'type' => 'image', 'data'=> 'str', 'thclass' => 'center', 'class'=>'center', 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>TRUE, 'writeParms'=>'thumb=180&thumb_urlraw=0&thumb_aw=180', 'width' => '110px'),
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'str', 'width' => 'auto', 'filter' => true, 'batch' => true,'writeParms'=>'multiple=1'),
'media_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'data'=> 'comma', 'width' => 'auto', 'filter' => true, 'batch' => true,'writeParms'=>'multiple=1'),
// Upload should be managed completely separately via upload-handler.
// 'media_upload' => array('title'=> "Upload File", 'type' => 'upload', 'data'=> false, 'readParms' => 'hidden', 'writeParms' => 'disable_button=1', 'width' => '10%', 'nolist' => true),
@@ -1093,10 +1095,10 @@ class media_admin_ui extends e_admin_ui
public function beforeUpdate($new_data, $old_data, $id)
{
// return data to be merged with posted model data
$new_data['media_category'] = implode(",",$new_data['media_category']);
print_a($new_data);
// $new_data['media_category'] = implode(",",$new_data['media_category']);
$this->fields['media_category']['data'] = 'str'; //XXX Quick fix for 'comma' incompatibility in Db-Update routines.
return $new_data;
return $this->observeUploaded($new_data);
// return $this->observeUploaded($new_data);
}
public function mediaData($sc_path)

View File

@@ -689,7 +689,7 @@ class users_admin_ui extends e_admin_ui
'user_email' => array('title' => LAN_USER_08, 'type' => 'text', 'width' => 'auto'),
'user_hideemail' => array('title' => LAN_USER_10, 'type' => 'boolean', 'width' => 'auto', 'thclass'=>'center', 'class'=>'center', 'filter'=>true, 'batch'=>true, 'readParms'=>'trueonly=1'),
'user_xup' => array('title' => 'Xup', 'type' => 'text', 'width' => 'auto'),
'user_class' => array('title' => LAN_USER_12, 'type' => 'method' , 'data' =>'text', 'filter'=>true, 'batch'=>true),
'user_class' => array('title' => LAN_USER_12, 'type' => 'method' , 'data' =>'comma', 'filter'=>true, 'batch'=>true),
'user_join' => array('title' => LAN_USER_14, 'type' => 'datestamp', 'width' => 'auto', 'writeParms'=>'readonly=1'),
'user_lastvisit' => array('title' => LAN_USER_15, 'type' => 'datestamp', 'width' => 'auto'),
'user_currentvisit' => array('title' => LAN_USER_16, 'type' => 'datestamp', 'width' => 'auto'),
@@ -1089,7 +1089,13 @@ class users_admin_form_ui extends e_admin_form_ui
return $list;
}
return $list[$curval];
$tmp = explode(",",$curval);
$text = array();
foreach($tmp as $v)
{
$text[] = $list[$v];
}
return implode("<br />",$text); // $list[$curval];
}