public function showrec($rec) { $form = new ajaxform_edit($this->owner->getName(), $rec[action]); $form->init($rec[edit]); $fields = array(); $form->addFields(array(array("type" => AJAXFORM_TYPE_TEXTAREA, "name" => "what", "label" => '', "value" => $rec["what"], "options" => array("rows" => "10", "html" => " cols=50 onfocus='\$(this).wysiwyg();' ")))); $form->addFields($fields); return $form->getOutput(); }
public function showrigths($rec) { $uid = $rec[edit]; $form = new ajaxform_edit($this->owner->getName(), $rec[action]); $form->init($rec[edit]); foreach ($rec[types] as $key => $val) { $label = sprintf("<span id='rrr' rtype='{$val["type"]}'>[%-25s]</span>:", $val["type"]); $form->addFields(array(array("type" => AJAXFORM_TYPE_CHECKBOXES, "name" => $val[name], "label" => $label, "value" => $val[value], "values" => $val[values], "options" => array("nobr" => true, "html" => " rtype=" . $val["type"] . " ")))); } $form->addFields(array(array("type" => AJAXFORM_TYPE_HIDDEN, "name" => "userid", "value" => $uid))); $form->addFields(array(array("type" => AJAXFORM_TYPE_HIDDEN, "name" => "action", "value" => $rec['do']))); $out = $form->getOutput(); $out .= "<script>\$(document).on('click','#rrr',function(){\$(':checkbox[rtype='+\$(this).attr('rtype')+']').prop('checked',true);});</script>"; $out .= "<script>\$(document).on('contextmenu','#rrr',function(){\$(':checkbox[rtype='+\$(this).attr('rtype')+']').prop('checked',false);return false;});</script>"; return $out; }
public function showrec($rec) { if (empty($rec[fields])) { return false; } // заглушка для нередактируемых extract($rec); $form = new ajaxform_edit($this->owner->getName(), $action); $form->init($edit); if ($rec[files][file]) { foreach ($rec[files][file] as $file) { $values[$file[id]] = basename($file[file_link]); $value[$file[id]] = 1; } array_push($fields, array("type" => AJAXFORM_TYPE_CHECKBOXES, "name" => "curfile", "label" => 'Текущие файлы:', "value" => $value, "values" => $values)); } $form->addFields($fields); $out = $form->getOutput(); if ($rec[files]) { $out .= $this->addFileButton(); } $out .= $this->addComments($edit, $rec[maintable]); return $out; }