Initial commit

This commit is contained in:
2026-02-18 22:53:33 +05:00
parent 57fb83b78c
commit bd053e2402
12 changed files with 798 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
# fieldsmanager
### fieldsmanager
### Модуль управления полями рубрик
04.09.2019 - версия 0.26.2 - адаптация для версии ave.cms 3.26
Модуль управления полями рубрик Только для AVE.CMS ALT

119
admin/field-code.tpl Normal file
View File

@@ -0,0 +1,119 @@
<div class="title">
<h5>Управление полями</h5>
</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&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=1&amp;cp={$sess}">Управление полями</a></li>
{if $params.id}
<li><strong>Рубрика</strong> > {$params.field.rubric_title}</li>
<li><strong>Поле:</strong> > {$params.field.rubric_field_title}</li>
{/if}
<li><strong>Тип:</strong> > {$main.name} {if $params.id}(id: {$params.id}){/if}</li>
<li>
<strong class="code">{if $params.type == 'adm'}Шаблон для панели{elseif $params.type == 'doc'}Шаблоня вывода в документе{elseif $params.type == 'req'}Шаблоня вывода в запросе{/if}</strong>
</li>
</ul>
</div>
</div>
{if $code_text}
<form id="code_templ" method="post" action="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=save&cp={$sess}" class="mainForm">
<div class="widget first">
<div class="head">
<h5 class="iFrames">{if $params.func == 'new'}Создание шаблона из основного файла{else}Редактирование шаблона{/if}</h5>
</div>
<div class="rowElem" style="padding: 0">
<textarea id="code_text" name="code_text">{$code_text|escape}</textarea>
<div class="fix"></div>
</div>
<div class="rowElem">
<button class="basicBtn SaveButton">Сохранить</button>
&nbsp;
<a href="javascript:void(0);" class="button redBtn Close">Закрыть</a>
<div class="fix"></div>
</div>
</div>
<input type="hidden" name="func" value="{$params.func}" />
{if $params.id}
<input type="hidden" name="field_id" value="{$params.id}" />
{/if}
<input type="hidden" name="field_name" value="{$params.fld}" />
<input type="hidden" name="field_type" value="{$params.type}" />
</form>
{include file="$codemirror_editor" conn_id="ftpl" textarea_id='code_text' ctrls='$("#code_templ").ajaxSubmit(sett_options);' height=400}
<script language="javascript">
$(document).ready(function(){ldelim}
$(".SaveButton").on('click', function(event){ldelim}
event.preventDefault();
$("#code_templ").ajaxSubmit({ldelim}
url: 'index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=save&cp={$sess}',
dataType: 'json',
beforeSubmit: function(){ldelim}
$.alerts._overlay('show');
{rdelim},
success: function(data){ldelim}
$.jGrowl(data['message'], {ldelim}
header: data['header'],
theme: data['theme']
{rdelim});
$.alerts._overlay('hide');
{if $params.func == 'new'}
var html =
'<a data-dialog="rft-{$params.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=edit&amp;id={$params.id}&amp;fld={$params.fld}&amp;type={$params.type}&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Редактировать</a>'
+ '<br />'
+ '<a href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=delete&amp;id={$params.id}&amp;fld={$params.fld}&amp;type={$params.type}&amp;cp={$sess}" class="link">Удалить</a>'
;
$('#{$params.type}_{$params.fld}_{$params.id}').html(html);
$('a.openDialog').off();
AveAdmin.modalDialog();
{/if}
$('#ajax-dialog-rft-{if $params.id}{$params.id}{else}{$params.fld}{/if}').dialog('destroy').remove();
{rdelim}
{rdelim});
return false;
{rdelim});
$(".Close").on('click', function(event){ldelim}
event.preventDefault();
$('#ajax-dialog-rft-{if $params.id}{$params.id}{else}{$params.fld}{/if}').dialog('destroy').remove();
return false;
{rdelim});
{literal}
setTimeout(function(){editorftpl.refresh();}, 20);
{/literal}
{rdelim});
</script>
{else}
<div class="widget first">
<div class="head">
<h5 class="iFrames">{$main.name} - {if $params.type == 'adm'}Шаблон для панели{elseif $params.type == 'doc'}Шаблоня вывода в документе{elseif $params.type == 'req'}Шаблоня вывода в запросе{/if}</h5>
</div>
</div>
<ul class="messages first">
<li class="highlight red">
<strong>Отсутсвует основной файл шаблона</strong>
</li>
</ul>
{/if}

115
admin/field-list.tpl Normal file
View File

@@ -0,0 +1,115 @@
<div class="title">
<h5>Управление полями</h5>
</div>
<div class="widget">
<div class="body">
<strong>Модуль позволяет:</strong>
<ul style="list-style: square; margin-left:15px;">
<li>Удалять/<s>Устанавливать поля</s></li>
<li>Создавать/Редактировать/Удалять шаблоны полей (tpl)</li>
<li>Редактировать шаблоны вывода полей</li>
</ul>
</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&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><a href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=1&amp;cp={$sess}">Управление полями</a></li>
<li>Список рубрик</li>
<li><strong class="code">{$main.name}</strong></li>
</ul>
</div>
</div>
{foreach from=$rubrics item=rubric}
<div class="widget">
<div class="head">
<h5>{$rubric.rubric_title}</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<col width="10" />
<col />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="80" />
<col width="80" />
<thead>
<tr>
<td colspan="1" rowspan="2">Id</td>
<td colspan="1" rowspan="2">Наименование поля</td>
<td colspan="3" rowspan="1">Шаблон ID</td>
<td colspan="1" rowspan="2">База данных</td>
<td colspan="1" rowspan="2">Удалить</td>
</tr>
<tr>
<td style="border-left: solid 1px #C7D6E6 !important;">Панель</td>
<td>Документ</td>
<td>Запрос</td>
</tr>
</thead>
<tbody>
{foreach from=$rubric.fields item=field}
<tr class="center">
<td align="center">{$field.id}</td>
<td><strong>{$field.title}</strong></td>
<td align="center" id="adm_{$main.id}_{$field.id}">
{if $field.adm_main}
{if $field.adm_tpl}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=edit&amp;id={$field.id}&amp;fld={$main.id}&amp;type=adm&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Редактировать</a>
<br />
<a href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=delete&amp;id={$field.id}&amp;fld={$main.id}&amp;type=adm&amp;cp={$sess}" class="link">Удалить</a>
{else}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=create&amp;id={$field.id}&amp;fld={$main.id}&amp;type=adm&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Создать</a>
{/if}
{else}
<small>Нет шаблона</small>
{/if}
</td>
<td align="center" id="doc_{$main.id}_{$field.id}">
{if $field.doc_main}
{if $field.doc_tpl}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=edit&amp;id={$field.id}&amp;fld={$main.id}&amp;type=doc&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Редактировать</a>
<br />
<a href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=delete&amp;id={$field.id}&amp;fld={$main.id}&amp;type=doc&amp;cp={$sess}" class="link">Удалить</a>
{else}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=create&amp;id={$field.id}&amp;fld={$main.id}&amp;type=doc&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Создать</a>
{/if}
{else}
<small>Нет шаблона</small>
{/if}
</td>
<td align="center" id="req_{$main.id}_{$field.id}">
{if $field.req_main}
{if $field.req_tpl}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=edit&amp;id={$field.id}&amp;fld={$main.id}&amp;type=req&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Редактировать</a>
<br />
<a href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=delete&amp;id={$field.id}&amp;fld={$main.id}&amp;type=req&amp;cp={$sess}" class="link">Удалить</a>
{else}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=create&amp;id={$field.id}&amp;fld={$main.id}&amp;type=req&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Создать</a>
{/if}
{else}
<small>Нет шаблона</small>
{/if}
</td>
<td align="center">
<a data-dialog="rft-{$field.id}" title="{#RUBRIK_FILED_TEMPLATE_H#}" href="index.php?do=rubs&action=field_template&field_id={$field.id}&rubric_id={$rubric.rubric_id}&cp={$sess}&pop=1&onlycontent=1" data-height="700" data-modal="true" data-title="{#RUBRIK_FILED_TEMPLATE_H#}" class="openDialog icon_sprite ico_template topleftDir"></a>
</td>
<td align="center">
<a class="icon_sprite ico_delete_no"></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/foreach}
{include file="$codemirror_connect"}

117
admin/fields-list.tpl Normal file
View File

@@ -0,0 +1,117 @@
<div class="title">
<h5>Управление полями</h5>
</div>
<div class="widget">
<div class="body">
<strong>Модуль позволяет:</strong>
<ul style="list-style: square; margin-left:15px;">
<li>Удалять/<s>Устанавливать</s> поля</li>
<li>Создавать/Редактировать/Удалять шаблоны полей (tpl)</li>
<li>Редактировать шаблоны вывода полей</li>
</ul>
</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&amp;cp={$sess}">{#MODULES_SUB_TITLE#}</a></li>
<li><strong class="code">Управление полями</strong></li>
</ul>
</div>
</div>
<div class="widget">
<div class="head">
<h5>Список полей в системе</h5>
</div>
<table cellpadding="0" cellspacing="0" width="100%" class="tableStatic mainForm">
<col />
<col width="100" />
<col width="100" />
<col width="100" />
<col width="80" />
<col width="100" />
<col width="80" />
<thead>
<tr>
</tr>
<tr>
<td colspan="1" rowspan="2">Наименование поля</td>
<td colspan="1" rowspan="2">Функция</td>
<td colspan="3" rowspan="1">Шаблон Tpl (по умолчанию)</td>
<td colspan="1" rowspan="2">Используется</td>
<td colspan="1" rowspan="2">Удалить</td>
</tr>
<tr>
<td style="border-left: solid 1px #C7D6E6 !important;">Панель</td>
<td>Документ</td>
<td>Запрос</td>
</tr>
</thead>
<tbody>
{foreach from=$fields item=field key=number}
<tr>
<td>
{if in_array($field.id, $enable)}
<strong><a class="link" href="index.php?do=modules&amp;action=modedit&amp;mod=fieldsmanager&amp;moduleaction=showfield&amp;type={$field.id}&amp;cp={$sess}">{$field.name}</a></strong>
{else}
<strong>{$field.name}</strong>
{/if}
</td>
<td class="date_text dgrey" align="center">
{$field.id}
</td>
<td align="center">
{foreach from=$exists item=exist key=key}
{if $field.id == $key}
{if $exist.adm}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=edit&amp;fld={$field.id}&amp;type=adm&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Редактировать</a>
{/if}
{/if}
{/foreach}
</td>
<td align="center">
{foreach from=$exists item=exist key=key}
{if $field.id == $key}
{if $exist.doc}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=edit&amp;fld={$field.id}&amp;type=doc&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Редактировать</a>
{/if}
{/if}
{/foreach}
</td>
<td align="center">
{foreach from=$exists item=exist key=key}
{if $field.id == $key}
{if $exist.req}
<a data-dialog="rft-{$field.id}" href="index.php?do=modules&action=modedit&mod=fieldsmanager&moduleaction=edit&amp;fld={$field.id}&amp;type=req&amp;cp={$sess}&pop=1&onlycontent=1" data-height="650" data-modal="true" class="openDialog">Редактировать</a>
{/if}
{/if}
{/foreach}
</td>
<td align="center">
<span class="icon_sprite {if in_array($field.id, $enable)}ico_ok_green{else}ico_delete_no{/if}"></span>
</td>
<td align="center">
<a class="topleftDir icon_sprite ico_delete ConfirmDelete" title="Удалить с сервера" dir="Удалить" name="Вы уверены?" href="index.php?do=modules&amp;action=modedit&amp;mod=fieldsmanager&amp;moduleaction=unlink&amp;type={$field.id}&amp;cp={$sess}"></a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{include file="$codemirror_connect"}

4
admin/index.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
header('Location:/');
exit;
?>

310
class.fieldsmanager.php Normal file
View File

@@ -0,0 +1,310 @@
<?php
/**
* Класс работы с модулем
*
* @package AVE.cms
* @subpackage
* @filesource
*/
class FieldsManager
{
public static function __get_fields_type($type = null)
{
static $fields;
if(is_array($fields))
return $fields;
$arr = get_defined_functions();
$fields = array();
$field = array();
foreach($arr['user'] as $v)
{
if(trim(substr($v, 0, strlen('get_field_'))) == 'get_field_')
{
$d = '';
$name = @$v('', 'name', '', '', 0, $d);
$id = substr($v, strlen('get_field_'));
if ($name != false && is_string($name))
$fields[] = array('id' => $id,'name' => (isset($fields_vars[$name])
? $fields_vars[$name]
: $name));
if (! empty($type) && $id == $type)
$field = array('id' => $id,'name' => (isset($fields_vars[$name])
? $fields_vars[$name]
: $name));
}
}
$fields = msort($fields, array('name'));
return (! empty($type)) ? $field : $fields;
}
/**
* Вывод списка полей
*
*/
public static function ShowFields()
{
global $AVE_DB, $AVE_Template, $_fm_dir;
$sql = $AVE_DB->Query("
SELECT (rubric_field_type)
FROM " . PREFIX . "_rubric_fields
GROUP BY rubric_field_type
");
$enable = array();
while ($row = $sql->FetchArray())
{
$enable[] = $row['rubric_field_type'];
}
$fields = self::__get_fields_type();
foreach ($fields as $field)
{
$exists[$field['id']]['adm'] = file_exists(BASE_DIR . '/fields/' . $field['id'] . '/tpl/field.tpl');
$exists[$field['id']]['doc'] = file_exists(BASE_DIR . '/fields/' . $field['id'] . '/tpl/field-doc.tpl');
$exists[$field['id']]['req'] = file_exists(BASE_DIR . '/fields/' . $field['id'] . '/tpl/field-req.tpl');
}
$AVE_Template->assign("enable", $enable);
$AVE_Template->assign("exists", $exists);
$AVE_Template->assign("fields", $fields);
$AVE_Template->assign("content", $AVE_Template->fetch($_fm_dir . "admin/fields-list.tpl"));
}
/**
* Вывод поля по рубрикам
*
*/
public static function ShowField($fld)
{
global $AVE_DB, $AVE_Template, $_fm_dir;
$sql = $AVE_DB->Query("
SELECT
a.Id,
a.rubric_id,
a.rubric_field_type,
a.rubric_field_title,
b.rubric_title
FROM
" . PREFIX . "_rubric_fields AS a
LEFT JOIN
" . PREFIX . "_rubrics AS b
ON a.rubric_id = b.Id
WHERE
a.rubric_field_type = '" . $fld ."'
ORDER BY
a.rubric_id
");
$rubrics = array();
while ($row = $sql->FetchRow())
{
$rubrics[$row->rubric_id]['rubric_id'] = $row->rubric_id;
$rubrics[$row->rubric_id]['rubric_title'] = $row->rubric_title;
$rubrics[$row->rubric_id]['fields'][$row->Id]['id'] = $row->Id;
$rubrics[$row->rubric_id]['fields'][$row->Id]['title'] = $row->rubric_field_title;
$rubrics[$row->rubric_id]['fields'][$row->Id]['adm_tpl'] = file_exists(BASE_DIR . '/fields/' . $fld . '/tpl/field-' . $row->Id . '.tpl');
$rubrics[$row->rubric_id]['fields'][$row->Id]['doc_tpl'] = file_exists(BASE_DIR . '/fields/' . $fld . '/tpl/field-doc-' . $row->Id . '.tpl');
$rubrics[$row->rubric_id]['fields'][$row->Id]['req_tpl'] = file_exists(BASE_DIR . '/fields/' . $fld . '/tpl/field-req-' . $row->Id . '.tpl');
$rubrics[$row->rubric_id]['fields'][$row->Id]['adm_main'] = file_exists(BASE_DIR . '/fields/' . $fld . '/tpl/field.tpl');
$rubrics[$row->rubric_id]['fields'][$row->Id]['doc_main'] = file_exists(BASE_DIR . '/fields/' . $fld . '/tpl/field-doc.tpl');
$rubrics[$row->rubric_id]['fields'][$row->Id]['req_main'] = file_exists(BASE_DIR . '/fields/' . $fld . '/tpl/field-req.tpl');
}
$AVE_Template->assign('main', self::__get_fields_type($fld));
$AVE_Template->assign("rubrics", $rubrics);
$AVE_Template->assign("content", $AVE_Template->fetch($_fm_dir . "admin/field-list.tpl"));
}
/**
* Создание шаблона
*
*/
public static function EditTpl($id = '', $fld, $type)
{
global $AVE_DB, $AVE_Template, $_fm_dir;
switch ($type)
{
case 'adm':
$file = BASE_DIR . '/fields/' . $fld . '/tpl/field-' . $id . '.tpl';
$source = BASE_DIR . '/fields/' . $fld . '/tpl/field.tpl';
break;
case 'doc':
$file = BASE_DIR . '/fields/' . $fld . '/tpl/field-doc-' . $id . '.tpl';
$source = BASE_DIR . '/fields/' . $fld . '/tpl/field-doc.tpl';
break;
case 'req':
$file = BASE_DIR . '/fields/' . $fld . '/tpl/field-req-' . $id . '.tpl';
$source = BASE_DIR . '/fields/' . $fld . '/tpl/field-req.tpl';
break;
}
if (empty($id))
$file = $source;
if (file_exists($file))
{
$code_text = file_get_contents($file);
}
else
{
$code_text = file_get_contents($source);
}
$sql = $AVE_DB->Query("
SELECT
a.rubric_field_title,
b.rubric_title
FROM
" . PREFIX . "_rubric_fields AS a
LEFT JOIN
" . PREFIX . "_rubrics AS b
ON a.rubric_id = b.Id
WHERE
a.rubric_field_type = '" . $fld ."'
AND
a.Id = '" . $id ."'
")->FetchAssocArray();
$params =
array(
'id' => $id,
'fld' => $fld,
'type' => $type,
'func' => (file_exists($file) ? 'edit' : 'new'),
'field' => $sql,
);
$AVE_Template->assign('main', self::__get_fields_type($fld));
$AVE_Template->assign('params', $params);
$AVE_Template->assign('code_text', $code_text);
$AVE_Template->assign("content", $AVE_Template->fetch($_fm_dir . "admin/field-code.tpl"));
}
/**
* Сохранение шаблона
*
*/
public static function SaveTpl($id = '', $fld, $type, $func)
{
switch ($type)
{
case 'adm':
$file = (! empty($id))
? BASE_DIR . '/fields/' . $fld . '/tpl/field-' . $id . '.tpl'
: BASE_DIR . '/fields/' . $fld . '/tpl/field.tpl';
break;
case 'doc':
$file = (! empty($id))
? BASE_DIR . '/fields/' . $fld . '/tpl/field-doc-' . $id . '.tpl'
: BASE_DIR . '/fields/' . $fld . '/tpl/field-doc.tpl';
break;
case 'req':
$file = (! empty($id))
? BASE_DIR . '/fields/' . $fld . '/tpl/field-req-' . $id . '.tpl'
: BASE_DIR . '/fields/' . $fld . '/tpl/field-req.tpl';
break;
}
$data = stripcslashes($_REQUEST['code_text']);
@file_put_contents($file, $data);
chmod($file, 0644);
$message = 'Шаблон успешнно сохранен';
$header = 'Выполнено';
$theme = 'accept';
echo json_encode(
array(
'message' => $message,
'header' => $header,
'theme' => $theme)
);
exit;
}
/**
* Удаление шаблона поля
*
*/
public static function DeleteTpl($id, $fld, $type, $func)
{
switch ($type)
{
case 'adm':
$file = BASE_DIR . '/fields/' . $fld . '/tpl/field-' . $id . '.tpl';
break;
case 'doc':
$file = BASE_DIR . '/fields/' . $fld . '/tpl/field-doc-' . $id . '.tpl';
break;
case 'req':
$file = BASE_DIR . '/fields/' . $fld . '/tpl/field-req-' . $id . '.tpl';
break;
}
@unlink($file);
header('Location:' . get_referer_link());
exit;
}
/**
* Удаление поля из системы
*
*/
public static function UnlinkField($dir)
{
/*
$dirPath = (! empty($type))
? BASE_DIR . '/fields/' . $dir
: $dir;
*/
$dirPath = BASE_DIR . '/fields/' . $dir;
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$dirPath .= '/';
}
$files = glob($dirPath . '*', GLOB_MARK);
foreach($files as $file)
{
if(substr($file, -1) == '/')
self::UnlinkField($file);
else
@unlink($file);
}
@rrmdir($dirPath);
}
}
?>

4
index.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
header('Location:/');
exit;
?>

20
info.php Normal file
View File

@@ -0,0 +1,20 @@
<?php
if (! defined('BASE_DIR'))
exit;
$module = array(
'ModuleSysName' => 'fieldsmanager',
'ModuleVersion' => '0.26.2',
'ModuleAutor' => 'M@d D3n',
'ModuleCopyright' => '&copy; 2007-' . date('Y') . ' AVE.cms',
'ModuleStatus' => 1,
'ModuleIsFunction' => 0,
'ModuleTemplate' => 0,
'ModuleAdminEdit' => 1,
'ModuleFunction' => 'mod_fieldsmanager',
'ModuleTag' => null,
'ModuleTagLink' => null,
'ModuleAveTag' => null,
'ModulePHPTag' => null
);
?>

4
lang/index.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
header('Location:/');
exit;
?>

5
lang/ru.txt Normal file
View File

@@ -0,0 +1,5 @@
[name]
MODULE_NAME = "Управление полями"
MODULE_DESCRIPTION = "Модуль для управления полями рубрик."
test = "Редактирование рубрики"

62
module.php Normal file
View File

@@ -0,0 +1,62 @@
<?php
/**
* AVE.cms - Модуль Управление полями
*
* @package AVE.cms
* @subpackage module_FieldsEdit
* @since 1.0
* @filesource
*/
if (!defined('BASE_DIR')) exit;
/**
* Администрирование
*/
if (defined('ACP') && !empty($_REQUEST['moduleaction']))
{
$_dir = basename(dirname(__FILE__).'/');
$_fm_dir = BASE_DIR . '/' . 'modules' . '/' . $_dir . '/';
$lang_file = $_fm_dir . 'lang' . '/' . $_SESSION['admin_language'] . '.txt';
$AVE_Template->config_load($lang_file, 'module');
require_once($_fm_dir . 'class.fieldsmanager.php');
$FieldsManager = new FieldsManager;
switch ($_REQUEST['moduleaction'])
{
case '1':
$FieldsManager::ShowFields();
break;
case 'showfield':
$FieldsManager::ShowField($_REQUEST['type']);
break;
case 'create':
$FieldsManager::EditTpl((int)$_REQUEST['id'], $_REQUEST['fld'], $_REQUEST['type']);
break;
case 'edit':
$FieldsManager::EditTpl((int)$_REQUEST['id'], $_REQUEST['fld'], $_REQUEST['type']);
break;
case 'save':
$FieldsManager::SaveTpl((int)$_REQUEST['field_id'], $_REQUEST['field_name'], $_REQUEST['field_type'], $_REQUEST['func']);
break;
case 'delete':
$FieldsManager::DeleteTpl((int)$_REQUEST['id'], $_REQUEST['fld'], $_REQUEST['type'], $_REQUEST['func']);
break;
case 'unlink':
$FieldsManager::UnlinkField($_REQUEST['type']);
header('Location:' . get_referer_link());
exit;
}
}
?>

33
sql.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
/**
* AVE.cms - Модуль Управление полями
*
* @package AVE.cms
* @subpackage module_FieldsEdit
* @since 1.0
* @filesource
*/
/**
* mySQL-запросы для установки, обновления и удаления модуля
*/
$module_sql_install = array();
$module_sql_deinstall = array();
$module_sql_update = array();
$module_sql_update[] = "
UPDATE
`%%PRFX%%_module`
SET
ModuleFunction = '" . $modul['ModuleFunction'] . "',
ModuleAveTag = '" . $modul['ModuleAveTag'] . "',
ModulePHPTag = '" . $modul['ModulePHPTag'] . "',
ModuleVersion = '" . $modul['ModuleVersion'] . "'
WHERE
ModuleSysName = '" . $modul['ModuleSysName'] . "'
LIMIT 1;
";
?>