function form() { $CI =& get_instance(); $CI->load->library('table'); $CI->table->clear(); $CI->table->set_template(array('table_open' => '<table class="sp_polls" id="sp_polls_' . $this->id . '">')); $CI->table->set_caption("<strong>{$this->data->q_question}</strong>"); $answers = new sp_answer(); $answers_array = $answers->get_array($this->id); foreach ($answers_array as $a) { $CI->table->add_row("<label><input type=\"radio\" id=\"sp_answer_{$a->a_id}\" class=\"sp_question_{$this->id}\" name=\"sp_question_{$this->id}\" value=\"{$a->a_id}\"> {$a->a_answer}</label>"); /* $CI->table->add_row( "<input type=\"radio\" id=\"sp_answer_{$a->a_id}\" class=\"sp_question_{$this->id}\" name=\"sp_question_{$this->id}\" value=\"{$a->a_id}\">", "<label for=\"sp_answer_{$a->a_id}\">{$a->a_answer}</label>" ); */ } // Куда отправлять POST $ajax_path = getinfo('ajax') . base64_encode('plugins/samborsky_polls/ajax-ajax.php'); $results_link = $this->options['show_results_link'] ? ' <a href="javascript: void(0);" onclick="javascript:sp_polls_results(' . $this->id . ');" class="sp_polls_ajax_link">' . t('Результаты') . '</a>' : ''; $CI->table->add_row('<input type="hidden" id="sp_ajax_path_' . $this->id . '" value="' . $ajax_path . '">' . '<input type="button" value="' . t('Проголосовать') . '" onclick="javascript:sp_polls_vote(' . $this->id . ');">' . $results_link); if ($this->options['show_archives_link']) { $CI->table->add_row('<a href="' . getinfo('siteurl') . $this->options['archive_url'] . '">' . t('Архивы голосований') . '</a>'); } // Генерируем таблицу и форму загрузки $out = $CI->table->generate() . "<div class=\"sp_polls_loader\" id=\"sp_polls_loader_{$this->id}\">\n\t\t\t\t<img src=\"" . getinfo('plugins_url') . 'samborsky_polls/ajax-loader.gif' . "\" alt=\"" . t('Идет загрузка…') . "\">\n\t\t\t\t<p>" . t('Идет загрузка…') . "</p>\n\t\t\t</div>"; return $out; }
$CI->db->insert('sp_logs', array('l_qid' => $id, 'l_host' => t('Отредактировано'), 'l_timestamp' => mktime(), 'l_user' => is_login() ? $MSO->data['session']['users_login'] : '******')); header("Location: " . getinfo('site_url') . "admin/samborsky_polls/list/edit_ok"); } else { $CI->db->insert('sp_logs', array('l_qid' => $id, 'l_host' => t('Создано'), 'l_timestamp' => mktime(), 'l_user' => is_login() ? $MSO->data['session']['users_login'] : '******')); header("Location: " . getinfo('site_url') . "admin/samborsky_polls/list/add_ok"); } } else { echo '<div class="error">' . t(implode('<br />', $data['errors']), 'admin') . '</div>'; } } // данные для редактирования голосования if (is_numeric(mso_segment(4)) and !isset($data['errors'])) { $qu = new sp_question(mso_segment(4)); $qu->get(); $answers = new sp_answer(); $answers_array = $answers->get_array(mso_segment(4)); $answers_array = add_empty_answers($answers_array); $act = 'edit'; $no_expiry = ''; if ($qu->data->q_expiry == 0) { $no_expiry = 'checked="checked"'; $qu->data->q_expiry = $qu->data->q_timestamp; } //pr($qu); } elseif (!isset($data['errors'])) { $act = 'new'; $no_expiry = ''; $date = mktime(0, 0, 0, date("m"), date("d"), date("Y")); if (!($exp = get_len_polls($date, $options['len_polls']))) { $exp = $date; $no_expiry = 'checked="checked"';