Добавлен Модуль Вопрос/ответ
This commit is contained in:
commit
013ad7401c
13
README.md
Normal file
13
README.md
Normal file
@ -0,0 +1,13 @@
|
||||
## faq
|
||||
|
||||
# Вопрос/ответ v1.0.1
|
||||
|
||||
|
||||
## Модуль создания раширенной справочной системы на основе тегов.
|
||||
|
||||
|
||||
## Перед копированием модуля в папку modules, удалите файл README.md, копируйте только корневую папку faq со всем ее содержимым внутри!
|
||||
|
||||
## Changelog:
|
||||
|
||||
26.11.2015 - версия 1.0.1
|
267
class.faq.php
Normal file
267
class.faq.php
Normal file
@ -0,0 +1,267 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Класс работы с модулем Вопрос-Ответ
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @subpackage module_FAQ
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
class Faq
|
||||
{
|
||||
/**
|
||||
* Вывод списка рубрик
|
||||
*
|
||||
* @param string $tpl_dir путь к директории с шаблонами модуля
|
||||
*/
|
||||
public static function faqList($tpl_dir)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$faq = array();
|
||||
$sql = $AVE_DB->Query("SELECT * FROM ". PREFIX ."_module_faq");
|
||||
while ($row = $sql->FetchRow()) array_push($faq, $row);
|
||||
|
||||
$AVE_Template->assign("faq_arr", $faq);
|
||||
$AVE_Template->assign("content", $AVE_Template->fetch($tpl_dir . "admin_faq_list.tpl"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Создание новой рубрики
|
||||
*
|
||||
*/
|
||||
public static function faqNew()
|
||||
{
|
||||
global $AVE_DB;
|
||||
|
||||
if (isset($_POST['new_faq_title']) && trim($_POST['new_faq_title']))
|
||||
{
|
||||
$AVE_DB->Query("INSERT INTO " . PREFIX . "_module_faq SET id = '', faq_title = '" . mb_substr($_POST['new_faq_title'], 0, 100) . "', faq_description = '" . mb_substr($_POST['new_faq_desc'], 0, 255) . "'");
|
||||
}
|
||||
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Удаление рубрики вместе с вопросами и ответами
|
||||
*
|
||||
* @param string $tpl_dir путь к директории с шаблонами модуля
|
||||
*/
|
||||
public static function faqDelete($tpl_dir)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
if (isset($_GET['fid']) && is_numeric($_GET['fid']) && $_GET['fid'] > 0)
|
||||
{
|
||||
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq WHERE id = '" . $_GET['fid'] . "'");
|
||||
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . $_GET['fid'] . "'");
|
||||
|
||||
$AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_GET['fid']);
|
||||
}
|
||||
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Запись изменений в наименованиях и описаниях рубрик
|
||||
*
|
||||
* @param string $tpl_dir путь к директории с шаблонами модуля
|
||||
*/
|
||||
public static function faqListSave($tpl_dir)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
foreach($_POST['faq_title'] as $id => $faq_title)
|
||||
{
|
||||
if (is_numeric($id) && $id > 0 && trim($faq_title))
|
||||
{
|
||||
$AVE_DB->Query("UPDATE " . PREFIX . "_module_faq SET faq_title = '" . mb_substr($faq_title, 0, 100) . "', faq_description = '" . mb_substr($_POST['faq_description'][$id], 0, 255) . "' WHERE id = '" . $id . "'");
|
||||
|
||||
$AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $id);
|
||||
}
|
||||
}
|
||||
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Вывод списка вопросов и ответов определённой рубрики
|
||||
*
|
||||
* @param string $tpl_dir путь к директории с шаблонами модуля
|
||||
*/
|
||||
public static function faqQuestionList($tpl_dir)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
if (!(isset($_GET['fid']) && is_numeric($_GET['fid']) && $_GET['fid'] > 0))
|
||||
{
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
$questions = array();
|
||||
$sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . $_GET['fid'] . "'");
|
||||
while ($row = $sql->FetchRow()) array_push($questions, $row);
|
||||
|
||||
$r_name = $AVE_DB->Query("SELECT * FROM ". PREFIX ."_module_faq WHERE id = '" . $_GET['fid'] . "'")->FetchRow();
|
||||
|
||||
$AVE_Template->assign("questions", $questions);
|
||||
$AVE_Template->assign("RubricName", $r_name->faq_title);
|
||||
$AVE_Template->assign("content", $AVE_Template->fetch($tpl_dir . "admin_faq_edit.tpl"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Вывод формы редактирования вопроса и ответа на него
|
||||
*
|
||||
* @param string $tpl_dir путь к директории с шаблонами модуля
|
||||
*/
|
||||
public static function faqQuestionEdit($tpl_dir)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
if (! (isset($_GET['fid']) && is_numeric($_GET['fid']) && $_GET['fid'] > 0))
|
||||
{
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0)
|
||||
{
|
||||
$faq = $AVE_DB->Query("
|
||||
SELECT *
|
||||
FROM
|
||||
" . PREFIX . "_module_faq_quest
|
||||
WHERE
|
||||
faq_id = '" . (int)$_GET['fid'] . "'
|
||||
AND
|
||||
id = '" . (int)$_GET['id'] . "'
|
||||
")->FetchAssocArray();
|
||||
|
||||
if ($faq === false)
|
||||
{
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$faq = array(
|
||||
'id' => '',
|
||||
'faq_quest' => '',
|
||||
'faq_answer' => '',
|
||||
'faq_id' => $_GET['fid']
|
||||
);
|
||||
}
|
||||
|
||||
switch ($_SESSION['use_editor'])
|
||||
{
|
||||
case '0': // CKEditor
|
||||
$oCKeditor = new CKeditor();
|
||||
$oCKeditor->returnOutput = true;
|
||||
$oCKeditor->config['toolbar'] = 'Verysmall';
|
||||
$oCKeditor->config['height'] = 100;
|
||||
$config = array();
|
||||
$faq['faq_quest'] = $oCKeditor->editor('faq_quest', $faq['faq_quest'], $config);
|
||||
|
||||
$oCKeditor2 = new CKeditor();
|
||||
$oCKeditor2->returnOutput = true;
|
||||
$oCKeditor2->config['toolbar'] = 'Small';
|
||||
$oCKeditor2->config['height'] = 400;
|
||||
$config2 = array();
|
||||
$faq['faq_answer'] = $oCKeditor2->editor('faq_answer', $faq['faq_answer'], $config2);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
// Elrte и Elfinder
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$AVE_Template->assign($faq);
|
||||
|
||||
$AVE_Template->assign("content", $AVE_Template->fetch($tpl_dir . "admin_quest_edit.tpl"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Запись нового или изменённого вопроса и ответа на него
|
||||
*
|
||||
* @param string $tpl_dir путь к директории с шаблонами модуля
|
||||
*/
|
||||
public static function faqQuestionSave($tpl_dir)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
if (!(isset($_POST['fid']) && is_numeric($_POST['fid']) && $_POST['fid'] > 0))
|
||||
{
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['id']) && is_numeric($_POST['id']) && $_POST['id'] > 0)
|
||||
{
|
||||
$AVE_DB->Query("UPDATE " . PREFIX . "_module_faq_quest SET faq_quest = '" . $_POST['faq_quest'] . "', faq_answer = '" . $_POST['faq_answer'] . "' WHERE id = '" . $_POST['id'] . "'");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($AVE_DB->Query("SELECT 1 FROM " . PREFIX . "_module_faq WHERE id = '" . $_POST['fid'] . "'")->GetCell())
|
||||
{
|
||||
$AVE_DB->Query("INSERT INTO " . PREFIX . "_module_faq_quest SET id = '', faq_id = '" . $_POST['fid'] . "', faq_quest = '" . $_POST['faq_quest'] . "', faq_answer = '" . $_POST['faq_answer'] . "'");
|
||||
}
|
||||
}
|
||||
|
||||
$AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_POST['fid']);
|
||||
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=questlist&fid=" . $_POST['fid'] . "&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Удаление вопроса и ответа на него
|
||||
*
|
||||
* @param string $tpl_dir путь к директории с шаблонами модуля
|
||||
*/
|
||||
public static function faqQuestionDelete($tpl_dir)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
if (!(isset($_GET['fid']) && isset($_GET['id'])
|
||||
&& is_numeric($_GET['fid']) && is_numeric($_GET['id'])
|
||||
&& $_GET['fid'] > 0 && $_GET['id'] > 0))
|
||||
{
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
$AVE_DB->Query("DELETE FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . $_GET['fid'] . "' AND id = '" . $_GET['id'] . "'");
|
||||
|
||||
$AVE_Template->clear_cache($tpl_dir . 'show_faq.tpl', $_GET['fid']);
|
||||
|
||||
header("Location:index.php?do=modules&action=modedit&mod=faq&moduleaction=questlist&fid=" . $_GET['fid'] . "&cp=" . SESSION);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Вывод модуля вопросов и ответов в публичной части
|
||||
*
|
||||
* @param int $id идентификатор рубрики вопросов и ответов
|
||||
*/
|
||||
public static function faqShow($id)
|
||||
{
|
||||
global $AVE_DB, $AVE_Template;
|
||||
|
||||
$faq = $AVE_DB->Query("SELECT faq_title, faq_description FROM " . PREFIX . "_module_faq WHERE id = '" . (int)$id . "'")->fetchArray();
|
||||
|
||||
$questions = array();
|
||||
$sql = $AVE_DB->Query("SELECT * FROM " . PREFIX . "_module_faq_quest WHERE faq_id = '" . (int)$id . "'");
|
||||
while ($row = $sql->FetchRow()) array_push($questions, $row);
|
||||
|
||||
$AVE_Template->assign($faq);
|
||||
$AVE_Template->assign('questions', $questions);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
4
lang/index.php
Normal file
4
lang/index.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
header('Location:/');
|
||||
exit;
|
||||
?>
|
28
lang/ru.txt
Normal file
28
lang/ru.txt
Normal file
@ -0,0 +1,28 @@
|
||||
FAQ_EDIT = "Редактирование рубрики"
|
||||
FAQ_EDIT_RUB = "Редактирование рубрики"
|
||||
FAQ_EDIT_TIP = "В данном разделе представлен список вопросов и ответов выбранной рубрики. Вы можете добавить новый вопрос и ответ на него, перейти к редактированию существующих вопросов и ответов или удалить вопросы и ответы на них."
|
||||
FAQ_QUEST = "Вопрос"
|
||||
FAQ_ANSWER = "Ответ"
|
||||
FAQ_INSERT = "Здесь вы можете редактировать выбранный вопрос и ответ на него."
|
||||
FAQ_SAVE = "Сохранить"
|
||||
FAQ_ENTER_NAME = "Пожалуйста, укажите название рубрики"
|
||||
FAQ_ITEM_NAME = "Название рубрики вопросов и ответов:"
|
||||
FAQ_BUTTON_SAVE = "Сохранить изменения"
|
||||
FAQ_BUTTON_ADD = "Добавить рубрику"
|
||||
FAQ_LIST = "Вопрос-Ответ"
|
||||
FAQ_LIST_TIP = "В разделе представлен список рубрик модуля Вопрос-Ответ. Вы можете изменить наименование и описание рубрики, перейти к управлению вопросами и ответами определённой рубрики или удалить рубрику вместе с её вопросами и ответами."
|
||||
FAQ_NAME = "Название рубрики"
|
||||
FAQ_DESC = "Описание рубрики"
|
||||
FAQ_TAG = "Системный тег"
|
||||
FAQ_ACTIONS = "Действия"
|
||||
FAQ_EDIT_HINT = "Редактировать рубрику"
|
||||
FAQ_QEDIT_HINT = "Редактировать вопрос и ответ"
|
||||
FAQ_DELETE_HINT = "Удалить рубрику вместе с вопросами и ответами"
|
||||
FAQ_QDELETE_HINT = "Удалить вопрос и ответ на него"
|
||||
FAQ_NO_ITEMS = "В настоящий момент нет данных"
|
||||
FAQ_ADD = "Добавить рубрику"
|
||||
FAQ_ADD_QUEST = "Добавить вопрос"
|
||||
FAQ_BACK = "Управление рубриками"
|
||||
FAQ_INSERT_H = "Добавление или Редактирование вопросов и ответов"
|
||||
FAQ_INNAME = "Введите вопрос"
|
||||
FAQ_INDESC = "Введите ответ на вопрос"
|
115
module.php
Normal file
115
module.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms - Модуль Вопрос-Ответ
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @subpackage module_FAQ
|
||||
* @since 2.0
|
||||
* @filesource
|
||||
*/
|
||||
if (!defined('BASE_DIR')) exit;
|
||||
|
||||
if (defined('ACP'))
|
||||
{
|
||||
$modul['ModuleName'] = 'Вопрос/ответ';
|
||||
$modul['ModuleSysName'] = 'faq';
|
||||
$modul['ModuleVersion'] = '1.0.1';
|
||||
$modul['ModuleDescription'] = 'Модуль создания раширенной справочной системы на основе тегов.';
|
||||
$modul['ModuleAutor'] = 'Freeon';
|
||||
$modul['ModuleCopyright'] = '© 2007-2008 Overdoze Team';
|
||||
$modul['ModuleStatus'] = 1;
|
||||
$modul['ModuleIsFunction'] = 1;
|
||||
$modul['ModuleAdminEdit'] = 1;
|
||||
$modul['ModuleFunction'] = 'mod_faq';
|
||||
$modul['ModuleTag'] = '[mod_faq:XXX]';
|
||||
$modul['ModuleTagLink'] = null;
|
||||
$modul['ModuleAveTag'] = '#\\\[mod_faq:(\\\d+)]#';
|
||||
$modul['ModulePHPTag'] = "<?php mod_faq(''$1''); ?>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Обработка тега модуля
|
||||
*
|
||||
* @param int $id идентификатор рубрики вопросов и ответов
|
||||
*/
|
||||
function mod_faq($id)
|
||||
{
|
||||
global $AVE_Template;
|
||||
|
||||
$AVE_Template->caching = 1; // Включаем кеширование
|
||||
$AVE_Template->cache_lifetime = -1; // Неограниченное время жизни кэша
|
||||
// $AVE_Template->cache_dir .= '/faq'; // Папка для кеша модуля
|
||||
|
||||
$tpl_dir = BASE_DIR . '/modules/faq/templates/'; // Путь к шаблону модуля
|
||||
|
||||
// Если нету в кеше, то начинаем обрабатывать
|
||||
if (!$AVE_Template->is_cached($tpl_dir . 'show_faq.tpl', $id))
|
||||
{
|
||||
// Проверяем, есть ли папка для кеша, если нет (первый раз) — создаем
|
||||
if (!is_dir($AVE_Template->cache_dir))
|
||||
{
|
||||
$oldumask = umask(0);
|
||||
@mkdir($AVE_Template->cache_dir, 0777);
|
||||
umask($oldumask);
|
||||
}
|
||||
|
||||
require_once(BASE_DIR . '/modules/faq/class.faq.php');
|
||||
|
||||
Faq::faqShow($id);
|
||||
}
|
||||
|
||||
echo rewrite_link($AVE_Template->fetch($tpl_dir . 'show_faq.tpl', $id));
|
||||
|
||||
$AVE_Template->caching = false; // Отключаем кеширование
|
||||
}
|
||||
|
||||
/**
|
||||
* Администрирование
|
||||
*/
|
||||
if (defined('ACP') && !empty($_REQUEST['moduleaction']))
|
||||
{
|
||||
require_once(BASE_DIR . '/modules/faq/class.faq.php');
|
||||
|
||||
$tpl_dir = BASE_DIR . '/modules/faq/templates/';
|
||||
$lang_file = BASE_DIR . '/modules/faq/lang/' . $_SESSION['user_language'] . '.txt';
|
||||
|
||||
$AVE_Template->config_load($lang_file);
|
||||
|
||||
switch ($_REQUEST['moduleaction'])
|
||||
{
|
||||
case '1':
|
||||
Faq::faqList($tpl_dir);
|
||||
break;
|
||||
|
||||
case 'new':
|
||||
Faq::faqNew();
|
||||
break;
|
||||
|
||||
case 'del':
|
||||
Faq::faqDelete($tpl_dir);
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
Faq::faqListSave($tpl_dir);
|
||||
break;
|
||||
|
||||
case 'questlist':
|
||||
Faq::faqQuestionList($tpl_dir);
|
||||
break;
|
||||
|
||||
case 'questedit':
|
||||
Faq::faqQuestionEdit($tpl_dir);
|
||||
break;
|
||||
|
||||
case 'questsave':
|
||||
Faq::faqQuestionSave($tpl_dir);
|
||||
break;
|
||||
|
||||
case 'questdel':
|
||||
Faq::faqQuestionDelete($tpl_dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
62
sql.php
Normal file
62
sql.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* AVE.cms - Модуль Вопрос-Ответ
|
||||
*
|
||||
* @package AVE.cms
|
||||
* @subpackage module_FAQ
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
/**
|
||||
* mySQL-запросы для установки, обновления и удаления модуля
|
||||
*/
|
||||
|
||||
$module_sql_install = array();
|
||||
$module_sql_deinstall = array();
|
||||
$module_sql_update = array();
|
||||
|
||||
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_faq;";
|
||||
$module_sql_deinstall[] = "DROP TABLE IF EXISTS CPPREFIX_module_faq_quest;";
|
||||
|
||||
$module_sql_install[] = "CREATE TABLE CPPREFIX_module_faq (
|
||||
`id` mediumint(5) unsigned NOT NULL auto_increment,
|
||||
`faq_title` char(100) NOT NULL default '',
|
||||
`faq_description` char(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;";
|
||||
|
||||
$module_sql_install[] = "CREATE TABLE CPPREFIX_module_faq_quest (
|
||||
`id` mediumint(5) unsigned NOT NULL auto_increment,
|
||||
`faq_id` mediumint(5) unsigned NOT NULL default '1',
|
||||
`faq_quest` text NOT NULL,
|
||||
`faq_answer` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251;";
|
||||
|
||||
$module_sql_update[] = "
|
||||
UPDATE
|
||||
`CPPREFIX_module`
|
||||
SET
|
||||
ModuleAveTag = '" . $modul['ModuleAveTag'] . "',
|
||||
ModulePHPTag = '" . $modul['ModulePHPTag'] . "',
|
||||
ModuleVersion = '" . $modul['ModuleVersion'] . "'
|
||||
WHERE
|
||||
ModuleSysName = '" . $modul['ModuleSysName'] . "'
|
||||
LIMIT 1;
|
||||
";
|
||||
|
||||
$module_sql_update[] = "
|
||||
RENAME TABLE
|
||||
`CPPREFIX_modul_faq`
|
||||
TO
|
||||
`CPPREFIX_module_faq`
|
||||
";
|
||||
|
||||
$module_sql_update[] = "
|
||||
RENAME TABLE
|
||||
`CPPREFIX_modul_faq_quest`
|
||||
TO
|
||||
`CPPREFIX_module_faq_quest`
|
||||
";
|
||||
?>
|
71
templates/admin_faq_edit.tpl
Normal file
71
templates/admin_faq_edit.tpl
Normal file
@ -0,0 +1,71 @@
|
||||
<div class="title"><h5>{#FAQ_EDIT_RUB#}</h5></div>
|
||||
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">
|
||||
{#FAQ_EDIT_TIP#}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="breadCrumbHolder module">
|
||||
<div class="breadCrumb module">
|
||||
<ul>
|
||||
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
|
||||
<li><a href="index.php?do=modules&cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
|
||||
<li><a href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_LIST#}</a></li>
|
||||
<li>{$RubricName|escape}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="widget first">
|
||||
<div class="head">
|
||||
<h5 class="iFrames">{if $smarty.request.id != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
|
||||
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&cp={$sess}">{#FAQ_ADD_QUEST#}</a></div>
|
||||
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_BACK#}</a></div>
|
||||
</div>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
|
||||
<col width="40%" />
|
||||
<col width="50%" />
|
||||
<col width="1%" />
|
||||
<col width="1%" />
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{#FAQ_QUEST#}</td>
|
||||
<td>{#FAQ_ANSWER#}</td>
|
||||
<td colspan="2">{#FAQ_ACTIONS#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
{if $questions}
|
||||
{foreach from=$questions item=question}
|
||||
<tr>
|
||||
<td>
|
||||
<strong><a href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}">{$question->faq_quest|strip_tags|escape|truncate:100}</a></strong>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{$question->faq_answer|strip_tags|escape|truncate:80}
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a class="topleftDir icon_sprite ico_edit" title="{#FAQ_QEDIT_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}"></a>
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a class="topleftDir ConfirmDelete icon_sprite ico_delete" title="{#FAQ_QDELETE_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questdel&fid={$smarty.get.fid}&id={$question->id}&cp={$sess}"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{else}
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow">{#FAQ_NO_ITEMS#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{/if}
|
||||
</table>
|
||||
</div>
|
124
templates/admin_faq_list.tpl
Normal file
124
templates/admin_faq_list.tpl
Normal file
@ -0,0 +1,124 @@
|
||||
<script type="text/javascript" language="JavaScript">
|
||||
function check_title() {ldelim}
|
||||
if (document.getElementById('new_faq_title').value == '') {ldelim}
|
||||
alert('{#FAQ_ENTER_NAME#}');
|
||||
document.getElementById('new_faq_title').focus();
|
||||
return false;
|
||||
{rdelim}
|
||||
return true;
|
||||
{rdelim}
|
||||
</script>
|
||||
|
||||
|
||||
<div class="title"><h5>{#FAQ_LIST#}</h5></div>
|
||||
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">
|
||||
{#FAQ_LIST_TIP#}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="breadCrumbHolder module">
|
||||
<div class="breadCrumb module">
|
||||
<ul>
|
||||
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
|
||||
<li><a href="index.php?do=modules&cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
|
||||
<li>{#FAQ_LIST#}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="widget first">
|
||||
|
||||
<ul class="tabs">
|
||||
<li class="activeTab"><a href="#tab1">Список рубрик</a></li>
|
||||
<li class=""><a href="#tab2">{#FAQ_ADD#}</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab_container">
|
||||
|
||||
<div id="tab1" class="tab_content" style="display: block;">
|
||||
<form method="post" action="index.php?do=modules&action=modedit&mod=faq&moduleaction=save&cp={$sess}">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
|
||||
<col />
|
||||
<col />
|
||||
<col width="100" />
|
||||
<col width="10" />
|
||||
<col width="10" />
|
||||
<thead>
|
||||
<tr>
|
||||
<td>{#FAQ_NAME#}</td>
|
||||
<td>{#FAQ_DESC#}</td>
|
||||
<td>{#FAQ_TAG#}</td>
|
||||
<td colspan="2">{#FAQ_ACTIONS#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{if $faq_arr}
|
||||
{foreach from=$faq_arr item=faq}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="pr12"><input style="width:100%" name="faq_title[{$faq->id}]" type="text" id="faq_title[{$faq->id}]" value="{$faq->faq_title|escape}" size="40" /></div>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="pr12"><input style="width:100%" name="faq_description[{$faq->id}]" type="text" id="faq_description[{$faq->id}]" value="{$faq->faq_description|escape}" size="40" /></div>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="pr12"><input style="width:100%" name="textfield" type="text" value="[mod_faq:{$faq->id}]" readonly /></div>
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a class="topleftDir icon_sprite ico_edit" title="{#FAQ_EDIT_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questlist&fid={$faq->id}&cp={$sess}"></a>
|
||||
</td>
|
||||
|
||||
<td align="center">
|
||||
<a class="topleftDir ConfirmDelete icon_sprite ico_delete" title="{#FAQ_DELETE_HINT#}" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=del&fid={$faq->id}&cp={$sess}"></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<input type="submit" class="basicBtn" value="{#FAQ_BUTTON_SAVE#}" />
|
||||
</td>
|
||||
</tr>
|
||||
{else}
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<ul class="messages">
|
||||
<li class="highlight yellow">{#FAQ_NO_ITEMS#}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="tab2" class="tab_content" style="display: none;">
|
||||
<form action="index.php?do=modules&action=modedit&mod=faq&moduleaction=new&cp={$sess}" method="post" onSubmit="return check_title();">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="tableheader">{#FAQ_NAME#}</td>
|
||||
<td class="tableheader">{#FAQ_DESC#}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tr>
|
||||
<td class="second"><div class="pr12"><input placeholder="{#FAQ_NAME#}" name="new_faq_title" type="text" id="new_faq_title" size="60" maxlength="100" style="width:100%" /></div></td>
|
||||
<td class="second"><div class="pr12"><input placeholder="{#FAQ_DESC#}" name="new_faq_desc" type="text" id="new_faq_desc" size="60" maxlength="255" style="width:100%" /></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><input name="submit" type="submit" class="basicBtn" value="{#FAQ_BUTTON_ADD#}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="fix"></div>
|
||||
</div>
|
96
templates/admin_quest_edit.tpl
Normal file
96
templates/admin_quest_edit.tpl
Normal file
@ -0,0 +1,96 @@
|
||||
{if $smarty.session.use_editor == 0}
|
||||
<script type="text/javascript" src="{$ABS_PATH}lib/redactor/ckeditor/ckeditor.js"></script>
|
||||
<script type="text/javascript" src="{$ABS_PATH}lib/redactor/ckeditor/vendor/jquery.spellchecker.js"></script>
|
||||
<link rel="stylesheet" href="{$ABS_PATH}lib/redactor/ckeditor/vendor/jquery.spellchecker.css" type="text/css" media="all" />
|
||||
{/if}
|
||||
|
||||
{if $smarty.session.use_editor == 1}
|
||||
<!-- elrte -->
|
||||
<link rel="stylesheet" href="{$ABS_PATH}lib/redactor/redactor/elrte/css/elrte.full.css" type="text/css" media="screen" />
|
||||
<script src="{$ABS_PATH}lib/redactor/redactor/elrte/js/elrte.full.js" type="text/javascript"></script>
|
||||
<script src="{$ABS_PATH}lib/redactor/redactor/elrte/js/i18n/elrte.ru.js" type="text/javascript"></script>
|
||||
|
||||
<!-- elfinder -->
|
||||
<link rel="stylesheet" href="{$ABS_PATH}lib/redactor/redactor/elfinder/css/elfinder.full.css" type="text/css" media="screen" />
|
||||
<link rel="stylesheet" href="{$ABS_PATH}lib/redactor/redactor/elfinder/css/theme.css" type="text/css" media="screen" />
|
||||
|
||||
<script src="{$ABS_PATH}lib/redactor/redactor/elfinder/js/elfinder.full.js" type="text/javascript"></script>
|
||||
<script src="{$ABS_PATH}lib/redactor/redactor/elfinder/js/i18n/elfinder.ru.js" type="text/javascript"></script>
|
||||
<script src="{$ABS_PATH}lib/redactor/redactor/elfinder/js/jquery.dialogelfinder.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript" src="{$tpl_dir}/js/rle.js"></script>
|
||||
{/if}
|
||||
|
||||
<div class="title">
|
||||
<h5>{#FAQ_INSERT_H#}</h5>
|
||||
</div>
|
||||
|
||||
<div class="widget" style="margin-top: 0px;">
|
||||
<div class="body">
|
||||
{#FAQ_INSERT#}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="breadCrumbHolder module">
|
||||
<div class="breadCrumb module">
|
||||
<ul>
|
||||
<li class="firstB"><a href="index.php" title="{#MAIN_PAGE#}">{#MAIN_PAGE#}</a></li>
|
||||
<li><a href="index.php?do=modules&cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
|
||||
<li><a href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_LIST#}</a></li>
|
||||
<li>{#FAQ_INSERT_H#}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="widget first">
|
||||
<div class="head">
|
||||
<h5 class="iFrames">{if $smarty.request.id != ''}{#FAQ_EDIT_RUB#}{else}{#FAQ_EDIT_RUB#}{/if}</h5>
|
||||
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=questedit&fid={$smarty.get.fid}&cp={$sess}">{#FAQ_ADD_QUEST#}</a></div>
|
||||
<div class="num"><a class="basicNum" href="index.php?do=modules&action=modedit&mod=faq&moduleaction=1&cp={$sess}">{#FAQ_BACK#}</a></div>
|
||||
</div>
|
||||
|
||||
<form action="index.php?do=modules&action=modedit&mod=faq&moduleaction=questsave&cp={$sess}" method="post">
|
||||
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
|
||||
<tr class="tableheader">
|
||||
<td>{#FAQ_INNAME#}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="second">
|
||||
<div>
|
||||
{if $smarty.session.use_editor == 0}
|
||||
{$faq_quest}
|
||||
{elseif $smarty.session.use_editor == 1}
|
||||
<textarea class="mousetrap editor" id="faq_quest" name="faq_quest">{$faq_quest|escape}</textarea>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="tableheader">
|
||||
<td>{#FAQ_INDESC#}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="second">
|
||||
<div>
|
||||
{if $smarty.session.use_editor == 0}
|
||||
{$faq_answer}
|
||||
{elseif $smarty.session.use_editor == 1}
|
||||
<textarea class="mousetrap editor" id="faq_answer" name="faq_answer">{$sfaq_answer|escape}</textarea>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="first">
|
||||
<input type="hidden" name="id" value="{$id}">
|
||||
<input type="hidden" name="fid" value="{$faq_id}">
|
||||
<input name="submit" type="submit" class="basicBtn" value="{#FAQ_SAVE#}" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
4
templates/index.php
Normal file
4
templates/index.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
header('Location:/');
|
||||
exit;
|
||||
?>
|
24
templates/show_faq.tpl
Normal file
24
templates/show_faq.tpl
Normal file
@ -0,0 +1,24 @@
|
||||
<h3>{$faq_title}</h3>
|
||||
|
||||
{if $questions}
|
||||
<dl>
|
||||
{foreach from=$questions item=question}
|
||||
<dt><p><a href="javascript:void(0);">{$question->faq_quest}</a></p></dt>
|
||||
<dd>
|
||||
<h2>{$question->faq_quest}</h2>
|
||||
{$question->faq_answer}
|
||||
</dd>
|
||||
{/foreach}
|
||||
</dl>
|
||||
{literal}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$("dd").hide();
|
||||
$("dt").unbind('click');
|
||||
$("dt").click(function() {
|
||||
$(this).toggleClass("highligh").next("dd").slideToggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
{/if}
|
Loading…
x
Reference in New Issue
Block a user