Skip to content

Commit 80d78a9

Browse files
committed
Merge branch 'hotifx/activeRecord'
2 parents bd48b23 + 24e4319 commit 80d78a9

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

system/modules/multicolumnwizard/MultiColumnWizardHelper.php

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public function supportModalSelector($strTable)
5353
}
5454
}
5555
}
56-
56+
5757
/**
58-
*
58+
*
5959
*/
6060
public function changeAjaxPostActions()
6161
{
@@ -79,15 +79,15 @@ public function changeAjaxPostActions()
7979
}
8080
}
8181
}
82-
82+
8383
}
84-
84+
8585
/**
86-
*
86+
*
8787
* @param type $action
8888
* @param type $dc
8989
*/
90-
public function executePostActions($action, $dc)
90+
public function executePostActions($action, \DataContainer $dc)
9191
{
9292
if ($action == 'reloadFiletree_mcw' || $action == 'reloadPagetree_mcw' )
9393
{
@@ -96,21 +96,21 @@ public function executePostActions($action, $dc)
9696
$strRef = substr($strRef, stripos($strRef, 'field=')+6);
9797
$arrRef = explode('&', $strRef);
9898
$strField = $arrRef[0];
99-
99+
100100
//get value and fieldName
101101
$strFieldName = \Input::post('name');
102102
$varValue = \Input::post('value');
103-
103+
104104
//get the fieldname parts
105105
$arrfieldParts = preg_split('/_row[0-9]*_/i', $strFieldName);
106106
preg_match('/_row[0-9]*_/i', $strFieldName, $arrRow);
107107
$intRow = substr(substr($arrRow[0], 4), 0, -1);
108-
108+
109109
//build fieldname
110110
$strFieldName = $arrfieldParts[0] . '[' . $intRow . '][' . $arrfieldParts[1] .']';
111-
111+
112112
$strKey = ($action == 'reloadPagetree_mcw') ? 'pageTree' : 'fileTree';
113-
113+
114114
// Convert the selected values
115115
if ($varValue != '')
116116
{
@@ -135,14 +135,28 @@ public function executePostActions($action, $dc)
135135

136136
$varValue = serialize($varValue);
137137
}
138-
138+
139139
$arrAttribs['id'] = \Input::post('name');
140140
$arrAttribs['name'] = $strFieldName;
141141
$arrAttribs['value'] = $varValue;
142142
$arrAttribs['strTable'] = $dc->table;
143143
$arrAttribs['strField'] = $strField;
144144

145145
$objWidget = new $GLOBALS['BE_FFL'][$strKey]($arrAttribs);
146+
147+
// Re-initialize the activeRecord
148+
$table = \Input::get('table');
149+
if ($dc->activeRecord == null && \Database::getInstance()->tableExists($table)) {
150+
$stmt = \Database::getInstance()
151+
->prepare(sprintf('SELECT * FROM %s WHERE id = ?', $table))
152+
->execute(\Input::get('id'));
153+
154+
if ($stmt->numRows > 0) {
155+
$dc->activeRecord = $stmt;
156+
$objWidget->dataContainer = $dc;
157+
}
158+
}
159+
146160
echo $objWidget->generate();
147161
exit;
148162
}

0 commit comments

Comments
 (0)