Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 public function action_addfilelink()
 {
     $edit = new ajaxform_edit($this->getName());
     $edit->restore();
     $filename = multibyte::UTF_decode($_REQUEST[filename]);
     $id = $this->model->getFileId($filename);
     $values[$id] = basename($this->model->getFileNameById($id));
     $value[$id] = 1;
     $field = array("type" => AJAXFORM_TYPE_CHECKBOXES, "name" => "linkfile", "label" => '', "value" => $value, "values" => $values);
     $edit->addFieldAsArray($field);
     $edit->form->SessionSet();
     $out = $edit->getFieldOut($edit->fields[$field[name]]);
     return $out;
 }