private function startFormHtml() { $data = $this->generateSelectQuery(); $usebbcode = false; $result = '<div id="' . $this->uid . '" class="dbeditor-form">'; foreach ($data as $ek => $entry) { $id = 'row_' . $ek; $result .= '<div id="' . $id . '" class="dbeditor-row">'; foreach ($entry as $key => $value) { $name = $ek . '_' . $key; $result .= '<label for="' . $name . '">' . $key . '</label>: '; if ($value['mode'] === 'htmlEdit' && $value['tag'] === 'textarea') { $result .= '<textarea id="' . $name . '" name="' . $name . '_update" class="dbeditor-textarea-update-sceditor">' . $value['value'] . '</textarea><br/>'; $usebbcode = true; } else { if ($value['mode'] === 'readonly' && $value['tag'] === 'input') { $result .= '<input id="' . $name . '" name="' . $name . '_readonly" type="text" value="' . $value['value'] . '" class="dbeditor-input-readonly" readonly/><br/>'; } else { $result .= '<input id="' . $name . '" name="' . $name . '_update" type="text" value="' . $value['value'] . '" class="dbeditor-input-update"/><br/>'; } } } $result .= '<button onclick="DBEditor.editEntry(\'' . $id . '\')"> Update Entry</button>'; $result .= '<button onclick="DBEditor.deleteEntry(\'' . $id . '\')"> Delete Entry</button>'; $result .= '</div><hr>'; } $result .= '<div id=" add_' . $this->uid . '" class="add-field">'; $result .= $this->addForm; $result .= '</div>'; $result .= '<button onclick="DBEditor.addEntry(\'add_' . $this->uid . '\')"> Add Entry</button>'; $result .= '</div>'; JsUtils::prepareDbEditor(); if ($usebbcode) { JsUtils::prepareSceditor(); JsUtils::onjQueryDomReady('__initEditor = function() { $(".dbeditor-textarea-update-sceditor").sceditor({' . ' plugins: \'html\', height: \'500px\', width: \'100%\'' . '})}; __initEditor(); DBEditor.useSceditor(true);'); } JsUtils::prepareScriptTag('DBEditor.mapping = ' . ($jstr = json_encode($this->fields) . ';')); JsUtils::onjQueryDomReady('DBEditor.setAjaxUrl(\'' . JsUtils::getAjaxUrl('_dbedit.php') . '\'); DBEditor.setTableName(\'' . $this->tableName . '\'); DBEditor.setConnectionName(\'' . DBUtils::getActiveConnectionName() . '\')'); return $result; }
public static function prepareDbEditor() { array_push(JsUtils::$scripts, '<script src="' . JsUtils::getRoot() . 'scripts/DBEditor.js"></script>'); }
$dbEditor->add('r3text', 'input', 'text'); $dbEditor->add('r1Sugestie', 'textarea', 'htmlEdit'); $dbEditor->add('r2Sugestie', 'textarea', 'htmlEdit'); $dbEditor->add('r3Sugestie', 'textarea', 'htmlEdit'); $dbEditor->setUid('editQuestionForm'); echo $dbEditor->formContent(); } else { if ($_GET['action'] === 'editMap') { $dbEditor->setTable('points_map'); $dbEditor->add('id', 'input', 'readonly'); $dbEditor->add('punctaj', 'input', 'text'); $dbEditor->add('mesaj', 'input', 'text'); $dbEditor->setFormAction('admin.php?action=editMap'); $dbEditor->setUid('editPointsMapForm'); echo $dbEditor->formContent(); } } } } echo JsUtils::dropCss(); echo JsUtils::dropScripts(); ?> <!--<link rel="stylesheet" type="text/css" href="web/css/jsoneditor.css"> <script src="web/js/jsoneditor.min.js"></script>-->
{ return; } $(this).popover('hide'); }); $('#result_list').find('.pagination').find('a').click(function (evn) { evn.preventDefault(); if (location.href+'#'==this.href) { return; } $.ajax({ url:this.href, data:$.param({keyword:form['keyword'].value}), complete:fn_search_complete }); }); } $.ajax({ url:form.action, complete:fn_search_complete }); }); </script> <?php echo JsUtils::ob_end();
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php echo $this->headMeta(); echo $this->headTitle(); echo $this->headLink(); ?> <link href="/css/bootstrap.css" rel="stylesheet"> <link href="/css/bootstrap-responsive.css" rel="stylesheet"> </head> <body class="iframe_body iframe-mainbar"> <?php echo $this->layout()->content; ?> <script src="/js/jquery.js"></script> <script src="/js/bootstrap.min.js"></script> <?php echo $this->headScript(); ?> <script type="text/javascript"> $.ajaxSetup({ global:false, type:'POST', dataType:'json' }); </script> <?php echo JsUtils::ob_flush(); ?> </body> </html>