@ -99,9 +99,11 @@ class Unicalendar
{
{
$AVE_Template->assign('alert', htmlspecialchars(stripslashes($_REQUEST['alert'])));
$AVE_Template->assign('alert', htmlspecialchars(stripslashes($_REQUEST['alert'])));
}
}
$AVE_Template->assign('unicalendars', $unicalendars);
$AVE_Template->assign('unicalendars', $unicalendars);
$AVE_Template->assign('formaction', 'index.php?do=modules&action=modedit&mod=unicalendar&moduleaction=new&sub=save& cp=' . SESSION);
$AVE_Template->assign('formaction', 'index.php?do=modules&action=modedit&mod=unicalendar&moduleaction=new&sub=save& cp=' . SESSION);
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_unicalendar_list.tpl'));
$AVE_Template->assign('content', $AVE_Template->fetch($tpl_dir . 'admin_unicalendar_list.tpl'));
}
}
/**
/**
@ -177,9 +179,20 @@ class Unicalendar
foreach ( $results as $k=>$v )
foreach ( $results as $k=>$v )
{
{
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"title\": \"".$v['document_title']."\", \"description\": \"".$v['document_meta_description']."\", \"url\": \"".$v['document_alias']."\" },";
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"title\": \"".$v['document_title']."\", \"description\": \"".$v['document_meta_description']."\", \"url\": \"".$v['document_alias']."\" },";
$rubric_count .= $v['Id'].",";
}
}
$js_data_files = "$(function(){"."var data".$uca_id." = [".$uni_data."]; $(\"#eventCalendar".$uca_id."\").eventCalendar({jsonData: data".$uca_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"dddd DD-MM-YYYY\", showDescription: ".$uca_descript.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
$js_data_files = "$(function(){"."var data".$uca_id." = [".$uni_data."]; $(\"#eventCalendar".$uca_id."\").eventCalendar({jsonData: data".$uca_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"dddd DD-MM-YYYY\", showDescription: ".$uca_descript.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
// считаем количество документов в категории на момент создания календаря и записываем значение в БД
$rubric_count = count(explode(",", chop($rubric_count, ' ,')));
$AVE_DB->Query("
UPDATE
" . PREFIX . "_module_unicalendar
SET
uca_rub_doc_count = '" . $rubric_count . "'
WHERE id = '" . $uca_id . "'
");
// Создаем js файл для календаря с названием dataXXX.js - где XXX = Id календаря
// Создаем js файл для календаря с названием dataXXX.js - где XXX = Id календаря
$fdir = "/modules/unicalendar/js/data-files/";
$fdir = "/modules/unicalendar/js/data-files/";
mkdir(BASE_DIR . $fdir, 0777, true);
mkdir(BASE_DIR . $fdir, 0777, true);
@ -192,25 +205,36 @@ class Unicalendar
fclose($df);
fclose($df);
}
}
// Если выбрали вывести вс е документы из заданной рубрики - документы с Id=1 (Главная) и 404 страница - выводиться не будут!
// Если выбрали вывести выбранны е документы из заданной рубрики - документы с Id=1 (Главная) и 404 страница - выводиться не будут!
if ($uevents !='' & & $uevents == '2'){
if ($uevents !='' & & $uevents == '2'){
$sql = $AVE_DB->Query("
$sql = $AVE_DB->Query("
SELECT Id, document_alias, document_title, document_published, document_meta_description
SELECT Id, document_alias, document_title, document_published, document_meta_description
FROM " . PREFIX . "_documents
FROM " . PREFIX . "_documents
WHERE rubric_id = '" . $urubric_id . "' AND Id !=1 & & Id != '".PAGE_NOT_FOUND_ID."' AND $udoc_id
WHERE rubric_id = '" . $urubric_id . "' AND Id !=1 & & Id != '".PAGE_NOT_FOUND_ID."' AND ". $udoc_id."
");
");
$results = array();
$results = array();
while ($row = $sql->FetchAssocArray())
while ($row = $sql->FetchAssocArray())
{
{
array_push($results, $row);
array_push($results, $row);
}
}
//получаем данные все х документов из заданной рубрики циклом, формируем строку JSON
//получаем данные выбранны х документов из заданной рубрики циклом, формируем строку JSON
foreach ( $results as $k=>$v )
foreach ( $results as $k=>$v )
{
{
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"title\": \"".$v['document_title']."\", \"description\": \"".$v['document_meta_description']."\", \"url\": \"".$v['document_alias']."\" },";
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"title\": \"".$v['document_title']."\", \"description\": \"".$v['document_meta_description']."\", \"url\": \"".$v['document_alias']."\" },";
$rubric_count .= $v['Id'].",";
}
}
$js_data_files = "$(function(){"."var data".$uca_id." = [".$uni_data."]; $(\"#eventCalendar".$uca_id."\").eventCalendar({jsonData: data".$uca_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"dddd DD-MM-YYYY\", showDescription: ".$uca_descript.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
$js_data_files = "$(function(){"."var data".$uca_id." = [".$uni_data."]; $(\"#eventCalendar".$uca_id."\").eventCalendar({jsonData: data".$uca_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"dddd DD-MM-YYYY\", showDescription: ".$uca_descript.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
// считаем количество выбранных документов в категории на момент создания календаря и записываем значение в БД
$rubric_count = count(explode(",", chop($rubric_count, ' ,')));
$AVE_DB->Query("
UPDATE
" . PREFIX . "_module_unicalendar
SET
uca_rub_doc_count = '" . $rubric_count . "'
WHERE id = '" . $uca_id . "'
");
// Создаем js файл для календаря с названием dataXXX.js - где XXX = Id календаря
// Создаем js файл для календаря с названием dataXXX.js - где XXX = Id календаря
$fdir = "/modules/unicalendar/js/data-files/";
$fdir = "/modules/unicalendar/js/data-files/";
mkdir(BASE_DIR . $fdir, 0777, true);
mkdir(BASE_DIR . $fdir, 0777, true);
@ -269,7 +293,7 @@ class Unicalendar
$sql = $AVE_DB->Query("
$sql = $AVE_DB->Query("
SELECT Id
SELECT Id
FROM " . PREFIX . "_documents
FROM " . PREFIX . "_documents
WHERE rubric_id = '" . $urubric_id . "' AND Id !=1 & & Id != '".PAGE_NOT_FOUND_ID."' AND $udoc_id
WHERE rubric_id = '" . $urubric_id . "' AND Id !=1 & & Id != '".PAGE_NOT_FOUND_ID."' AND ". $udoc_id."
");
");
$check_docs = array();
$check_docs = array();
while ($row = $sql->FetchAssocArray())
while ($row = $sql->FetchAssocArray())
@ -284,7 +308,6 @@ class Unicalendar
}
}
/**
/**
* Сохранение календаря после редактирования
* Сохранение календаря после редактирования
* @param int $unicalendar_id - идентификатор календаря
* @param int $unicalendar_id - идентификатор календаря
@ -349,9 +372,20 @@ class Unicalendar
foreach ( $results as $k=>$v )
foreach ( $results as $k=>$v )
{
{
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"title\": \"".$v['document_title']."\", \"description\": \"".$v['document_meta_description']."\", \"url\": \"".$v['document_alias']."\" },";
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"title\": \"".$v['document_title']."\", \"description\": \"".$v['document_meta_description']."\", \"url\": \"".$v['document_alias']."\" },";
$rubric_count .= $v['Id'].",";
}
}
$js_data_files = "$(function(){"."var data".$unicalendar_id." = [".$uni_data."]; $(\"#eventCalendar".$unicalendar_id."\").eventCalendar({jsonData: data".$unicalendar_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"dddd DD-MM-YYYY\", showDescription: ".$uca_descript.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
$js_data_files = "$(function(){"."var data".$unicalendar_id." = [".$uni_data."]; $(\"#eventCalendar".$unicalendar_id."\").eventCalendar({jsonData: data".$unicalendar_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"dddd DD-MM-YYYY\", showDescription: ".$uca_descript.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
// считаем количество документов в категории на момент создания календаря и записываем значение в БД
$rubric_count = count(explode(",", chop($rubric_count, ' ,')));
$AVE_DB->Query("
UPDATE
" . PREFIX . "_module_unicalendar
SET
uca_rub_doc_count = '" . $rubric_count . "'
WHERE id = '" . $unicalendar_id . "'
");
// Создаем js файл для календаря с названием dataXXX.js - где XXX = Id календаря
// Создаем js файл для календаря с названием dataXXX.js - где XXX = Id календаря
$fdir = "/modules/unicalendar/js/data-files/";
$fdir = "/modules/unicalendar/js/data-files/";
mkdir(BASE_DIR . $fdir, 0777, true);
mkdir(BASE_DIR . $fdir, 0777, true);
@ -369,7 +403,7 @@ class Unicalendar
$sql = $AVE_DB->Query("
$sql = $AVE_DB->Query("
SELECT Id, document_alias, document_title, document_published, document_meta_description
SELECT Id, document_alias, document_title, document_published, document_meta_description
FROM " . PREFIX . "_documents
FROM " . PREFIX . "_documents
WHERE rubric_id = '" . $urubric_id . "' AND Id !=1 & & Id != '".PAGE_NOT_FOUND_ID."' AND $udoc_id
WHERE rubric_id = '" . $urubric_id . "' AND Id !=1 & & Id != '".PAGE_NOT_FOUND_ID."' AND ". $udoc_id."
");
");
$results = array();
$results = array();
while ($row = $sql->FetchAssocArray())
while ($row = $sql->FetchAssocArray())
@ -380,9 +414,20 @@ class Unicalendar
foreach ( $results as $k=>$v )
foreach ( $results as $k=>$v )
{
{
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"title\": \"".$v['document_title']."\", \"description\": \"".$v['document_meta_description']."\", \"url\": \"".$v['document_alias']."\" },";
$uni_data .= "{ \"date\": \"".pretty_date(strftime('%Y-%m-%d %H:%M:%S', $v['document_published']))."\", \"title\": \"".$v['document_title']."\", \"description\": \"".$v['document_meta_description']."\", \"url\": \"".$v['document_alias']."\" },";
$rubric_count .= $v['Id'].",";
}
}
$js_data_files = "$(function(){"."var data".$unicalendar_id." = [".$uni_data."]; $(\"#eventCalendar".$unicalendar_id."\").eventCalendar({jsonData: data".$unicalendar_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"dddd DD-MM-YYYY\", showDescription: ".$uca_descript.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
$js_data_files = "$(function(){"."var data".$unicalendar_id." = [".$uni_data."]; $(\"#eventCalendar".$unicalendar_id."\").eventCalendar({jsonData: data".$unicalendar_id.", jsonDateFormat: \"human\", startWeekOnMonday: ".$uca_day.", eventsScrollable: ".$uca_scroll.", openEventInNewWindow: ".$uca_link.", dateFormat: \"dddd DD-MM-YYYY\", showDescription: ".$uca_descript.", locales: {locale: \"".$uca_locale."\", txt_noEvents: \"".$uca_no_events."\", txt_SpecificEvents_prev: \"\", txt_SpecificEvents_after: \"".$uca_real_events."\", txt_NextEvents: \"".$uca_next_events."\", txt_GoToEventUrl: \"".$uca_look_events."\", moment: {\"months\" : ".$uca_months_events.", \"monthsShort\" : ".$uca_monshort_events.", \"weekdays\" : ".$uca_weekdays_events.", \"weekdaysShort\" : ".$uca_wdayshort_events.", \"weekdaysMin\" : ".$uca_wdaymin_events."}}});});";
// считаем количество выбранных документов в категории на момент создания календаря и записываем значение в БД
$rubric_count = count(explode(",", chop($rubric_count, ' ,')));
$AVE_DB->Query("
UPDATE
" . PREFIX . "_module_unicalendar
SET
uca_rub_doc_count = '" . $rubric_count . "'
WHERE id = '" . $unicalendar_id . "'
");
// Создаем js файл для календаря с названием dataXXX.js - где XXX = Id календаря
// Создаем js файл для календаря с названием dataXXX.js - где XXX = Id календаря
$fdir = "/modules/unicalendar/js/data-files/";
$fdir = "/modules/unicalendar/js/data-files/";
mkdir(BASE_DIR . $fdir, 0777, true);
mkdir(BASE_DIR . $fdir, 0777, true);
@ -438,6 +483,27 @@ class Unicalendar
{
{
echo "< tr class = 'noborder' > < td align = 'center' > < input type = 'checkbox' class = 'my-checkbox' name = 'u_chek".$v[' Id ' ] . " ' value = '".$v[' Id ' ] . " ' > < / td > "."< td align = 'center' > ".$v['Id']."< / td > "."< td > ".$v['document_title']."< / td > "."< td align = 'center' > ".$v['document_published'] = pretty_date(strftime(TIME_FORMAT, $v['document_published']))."< / td > < / tr > ";
echo "< tr class = 'noborder' > < td align = 'center' > < input type = 'checkbox' class = 'my-checkbox' name = 'u_chek".$v[' Id ' ] . " ' value = '".$v[' Id ' ] . " ' > < / td > "."< td align = 'center' > ".$v['Id']."< / td > "."< td > ".$v['document_title']."< / td > "."< td align = 'center' > ".$v['document_published'] = pretty_date(strftime(TIME_FORMAT, $v['document_published']))."< / td > < / tr > ";
}
}
}
if (isset($_POST['all_doc'])) // если пришел запрос-проверка актуальности календаря (не будет выведен документ с Id=1 это Главная страница и документ Ошибка 404)
{
global $AVE_DB;
$sql = $AVE_DB->Query("
SELECT Id
FROM " . PREFIX . "_documents
WHERE rubric_id = '" . $_POST['r_id'] . "' AND Id !=1 & & Id != '".PAGE_NOT_FOUND_ID."' ".$_POST['udoc_id']."
");
$all_doc_rub = array();
while ($row = $sql->FetchAssocArray())
{
array_push($all_doc_rub, $row);
}
foreach ( $all_doc_rub as $k=>$v )
{
$doc_count .= $v['Id'].",";
}
$doc_count = count(explode(",", chop($doc_count, ' ,')));
echo $doc_count;
$sql->Close();
}
}
exit;
exit;
}
}
@ -461,6 +527,5 @@ class Unicalendar
header('Location:index.php?do=modules&action=modedit&mod=unicalendar&moduleaction=1& cp=' . SESSION);
header('Location:index.php?do=modules&action=modedit&mod=unicalendar&moduleaction=1& cp=' . SESSION);
exit;
exit;
}
}
}
}
?>
?>