Пример #1
0
 function iframe_draw_editor($name, $innerHTML = '', $init = true, $handler_body = 'editor_form', $settings = array())
 {
     print iframe_editor($name, $innerHTML, $init, $handler_body, $settings);
 }
Пример #2
0
 function Problem_GenerateEditorForm($data = array(), $act = 'create', $backlink = '')
 {
     global $INFORMATICS_ProblemSettingsFields, $pageid, $id, $promtadd;
     $fields = $INFORMATICS_ProblemSettingsFields;
     $action = prepare_arg('.?page=prbmanager&action=' . $act . ($id != '' ? '&id=' . $id : '') . '&' . ($pageid != '' ? 'pageid=' . $pageid : '') . ($promtadd != '' ? '&promtadd=' . $promtadd : '') . ($backlink != '' ? '&redirect=' . urlencode($backlink) : ''));
     $desc = $data['desc'];
     if ($desc == '') {
         $tpl = manage_template_by_name('Олимпиады / Informatics / Заготовка условия задачи');
         $desc = $tpl->GetText();
     }
     $iframe = iframe_editor('desc', $desc, $backlink != '', 'ProblemSettings', $this->gateway->content_settings['iframe']);
     $tmp = handler_get_list('ProblemSettings');
     $arr = $tmp['onsubmit'];
     $onsubmit = '';
     for ($i = 0; $i < count($arr); $i++) {
         $onsubmit .= ' ' . handler_build_callback($arr[$i]);
     }
     $form = new CVCForm();
     $form->Init('ProblemSettings', 'method=POST;enctype=multipart/form-data;action=' . $action . ';titlewidth=160;caption=' . ($act == 'create' ? 'Создать' : 'Сохранить') . ';onsubmit=' . prepare_arg($onsubmit) . ';backlink=' . prepare_arg($backlink) . ';');
     for ($i = 0, $n = count($fields); $i < $n; $i++) {
         $f = $fields[$i];
         if ($f['action'] != '' && $f['action'] != $act) {
             continue;
         }
         $v = $data[$f['name']];
         if (strtolower($f['type']) == 'custom') {
             $v = array('src' => $f['src'], 'value' => $v, 'check_value' => $f['check_value']);
         }
         $form->AppendField($f['title'], $f['postname'], $f['type'], $v, array('important' => $f['important']));
     }
     if ($act != 'create') {
         $form->AppendField('Состояние', '', 'CUSTOM', array('src' => $this->Template('problems.state', array('data' => $data))));
     }
     if (isset($promtadd)) {
         $form->AppendCheckBoxField('Добавить на контест', 'addToContest', false);
     }
     $form->AppendCustomField(array('src' => '<center><b>Условие задачи</b>' . $iframe . '</center>'));
     return $form;
 }