} if (isset($parents)){ $params['parents'] = $parents; } $params['hiddenFields'] = implode(',', $allChunkFieldNames); //$params['hiddenFields'] = implode(',', $xedit->allChunkTvNames);//vorl�ufig noch $params['tpl'] = '@CODE:[[bloX? &chunkname=`[+chunkname+]`]]'; $modx->setPlaceholder('xedit_ditto_params',$params); break; */ case 'makeFormelement': require_once $this->pluginpath . 'inc/formElements.class.inc.php'; $fe = new formElements(); $tv = $xedit->getNewMultiTvs(array($formElementTv)); $tv = $tv[$formElementTv]; $tv['content'] = $formElementValue; $output = $fe->makeFormelement($tv, $prefix = 'tv'); break; case 'prepareDittoTpl': $htmlinner = isset($htmlinner) ? $htmlinner : 'div'; $xedit->docid = isset($docid) ? $docid : $modx->documentIdentifier; //$collectedchunks = $modx->getPlaceholder('collectedchunks'); //$chunk_content = $xedit->prepareChunkForXedit($collectedchunks[$chunkname]['snippet'], $block); //Ende dragelement $chunk_contents = $modx->getPlaceholder('chunkcontents'); $chunk_content = isset($tpl) ? $chunk_contents[$tpl] : $chunk_contents[$chunkname]; $ditto_tpl = isset($tpl) ? 'tpl="[+ditto_tpl+]"' : ''; if ($xedit->userPermissions['cancreatedocs'] == '1') {
function makeFrontEndTvSection($tabfields, $docid, $published = 1, $prefix = '', $mode = 'classic', $attributes = '', $tablename = '', $classnames = array()) { /*example for tv-tabs: * tab1_caption:docfield1,docfield2,tvfield3|| * tab2_caption:hidden:docfield4,tvfield5|| * tab3_caption:@CHUNK:chunkname|| * tab4_caption:field1;formelementTV,field2;formelementTV;field-caption;formelementTV */ //print_r($tabfields); //echo $docid; $fields = array(); $tvnames = array(); if (count($tabfields) > 0) { foreach ($tabfields as $tabfield) { $fieldparts = explode(';', trim($tabfield)); if (count($fieldparts) == 2) { $field = array(); // use TVs for inputFormatting of tablefields $formelementTVs = $this->getNewMultiTvs(array($fieldparts[1])); if (count($formelementTVs) > 0) { $field = $formelementTVs[$fieldparts[1]]; $field['name'] = $fieldparts[0]; $field['fTV_assigned'] = '1'; $fields[$field['name']] = $field; } } elseif ($tablename !== '') { $field = array(); $field['name'] = $fieldparts[0]; $field['type'] = 'text'; $fields[$field['name']] = $field; } $tvnames[] = $fieldparts[0]; } } require_once $this->pluginpath . 'inc/formElements.class.inc.php'; $fe = new formElements(); //Todo: Richtexteditor einbinden für richtext-Tvs usw. //print_r($this->NewMultiTvs); global $modx; //print_r($chunk); $tvSection = ''; if ($docid == 'new') { if ($tablename == '') { $tvs = $this->getNewMultiTvs($tvnames); //merge documentfields to tvfields if (count($tvnames) > 0) { foreach ($tabfields as $Tvname) { $Tvname = trim($Tvname); if (!isset($tvs[$Tvname])) { $tvs[$Tvname]['name'] = $Tvname; } } } } else { $tvs = $fields; } } else { if ($tablename == '') { $tvs = $modx->getTemplateVars($tvnames, "*", $docid, $published, $sort = "rank", $dir = "ASC"); } else { $keyfield = 'id'; $table = $modx->getFullTablename($tablename); $rs = $modx->db->select('*', $table, $keyfield . '=' . $docid); $row = $modx->db->getRow($rs); foreach ($fields as &$field) { $field['value'] = $row[$field['name']]; } $tvs = $fields; } } if (is_array($tvs) && count($tvs) > 0) { foreach ($tvs as $key => $tv) { if (is_array($tv['value'])) { continue; } if (isset($fields[$tv['name']]['fTV_assigned'])) { $fields[$tv['name']]['value'] = $tv['value']; $tv = $fields[$tv['name']]; } else { if ($tv['name'] == 'content') { $tv['type'] = 'textarea'; } } //$tv['content'] = $tvvalues[$tvName]; //$tv['mTVchunkid'] = $chunk['id']; //$tv['formname'] = $tvName.'_'.$containerkey.'_'.$chunkkey; $tv['formname'] = $prefix . '_input_' . $tv['name']; if (!isset($tv['caption'])) { $tv['caption'] = $tv['name']; } $tv['FormElement'] = $fe->makeFormelement($tv, 'tv', $attributes . ' fieldname = "' . $tv['name'] . '"', $classnames); if ($mode == 'hidden') { $tvSection .= ' <div class="xcc_formelement"> <label>' . $tv['caption'] . '</label> ' . $tv['FormElement'] . ' </div> '; } else { $tvSection .= ' <tr><td colspan="2"><div class="split"/></td></tr> <tr style="height: 24px;"> <td align="left" width="150" valign="top"> <span class="warning">' . $tv['caption'] . '</span><br/><span class="comment">' . $tv['description'] . '</span> </td> <td valign="top" style="position: relative;"> ' . $tv['FormElement'] . ' </td> </tr> '; } } if ($mode !== 'hidden') { $tvSection = ' <table cellspacing="0" cellpadding="3" border="0" width="96%" style="position: relative;"> <tbody>' . $tvSection . '</tbody></table>'; } } else { $tvSection .= $_lang['tmplvars_novars']; } //end check to see if there are template variables to display return $tvSection; }