public function saveAjaxAction(\Difra\Param\AjaxString $name, \Difra\Param\AjaxString $alias, \Difra\Param\AjaxInt $id = null, \Difra\Param\AjaxString $originalAlias = null) { $id = !is_null($id) ? $id->val() : null; if (is_null($id) || $originalAlias->val() != $alias->val()) { if (\Difra\Plugins\Announcements\Additionals::checkAlias($alias->val())) { \Difra\Ajaxer::getInstance()->invalid('alias', \Difra\Locales::getInstance()->getXPath('announcements/adm/additionals/duplicateName')); return; } } \Difra\Plugins\Announcements::getInstance()->saveAdditionalField($name->val(), $alias->val(), $id); if (is_null($id)) { \Difra\Ajaxer::getInstance()->notify(\Difra\Locales::getInstance()->getXPath('announcements/adm/additionals/added')); } else { \Difra\Ajaxer::getInstance()->notify(\Difra\Locales::getInstance()->getXPath('announcements/adm/additionals/updated')); } \Difra\Ajaxer::getInstance()->refresh(); }
public function saveAjaxAction(\Difra\Param\AjaxString $categoryName, \Difra\Param\AjaxString $categoryAlias, \Difra\Param\AjaxInt $catId = null, \Difra\Param\AjaxString $originalAlias = null) { $catId = !is_null($catId) ? $catId->val() : null; $Announcements = \Difra\Plugins\Announcements::getInstance(); if (is_null($catId) || $originalAlias->val() != $categoryAlias->val()) { if (\Difra\Plugins\Announcements\Category::checkName($categoryAlias->val())) { $this->ajax->invalid('categoryAlias', \Difra\Locales::getInstance()->getXPath('announcements/adm/category/duplicateName')); return; } } $Announcements->saveCategory($categoryAlias->val(), $categoryName->val(), $catId); if (is_null($catId)) { $this->ajax->notify(\Difra\Locales::getInstance()->getXPath('announcements/adm/category/added')); } else { $this->ajax->notify(\Difra\Locales::getInstance()->getXPath('announcements/adm/category/updated')); } $this->ajax->refresh(); }
public function updateAjaxAction(\Difra\Param\AjaxString $title, \Difra\Param\AjaxString $eventDate, \Difra\Param\AjaxString $beginDate, \Difra\Param\AjaxInt $priorityValue, \Difra\Param\AjaxCheckbox $visible, \Difra\Param\AjaxSafeHTML $shortDescription, \Difra\Param\AjaxInt $id, \Difra\Param\AjaxSafeHTML $description = null, \Difra\Param\AjaxInt $group = null, \Difra\Param\AjaxString $endDate = null, \Difra\Param\AjaxFile $eventImage = null) { $data = ['title' => $title->val(), 'eventDate' => $eventDate->val(), 'beginDate' => $beginDate->val(), 'id' => $id->val(), 'priority' => $priorityValue->val(), 'visible' => $visible->val(), 'shortDescription' => $shortDescription->val()]; $data['description'] = is_null($description) ? null : $description->val(); $data['group'] = is_null($group) ? null : $group->val(); $data['endDate'] = is_null($endDate) ? null : $endDate->val(); // из админки пока ставим так, потом добавим выбор юзера. $data['user'] = 1; $Announcements = \Difra\Plugins\Announcements::getInstance(); // апдейтим анонс $eventId = $Announcements->create($data); if (is_null($eventId)) { $this->ajax->error(\Difra\Locales::getInstance()->getXPath('announcements/adm/notify/updateError')); return; } if (!is_null($eventImage)) { $Announcements->saveImage($eventId, $eventImage->val()); } \Difra\Libs\Cookies::getInstance()->notify(\Difra\Locales::getInstance()->getXPath('announcements/adm/notify/goodUpdate')); $this->ajax->redirect('/adm/announcements/'); }
public function getSitemap() { return \Difra\Plugins\Announcements::getMap(); }
public function updateAjaxAction(\Difra\Param\AjaxString $title, \Difra\Param\AjaxString $eventDate, \Difra\Param\AjaxString $beginDate, \Difra\Param\AjaxInt $priorityValue, \Difra\Param\AjaxCheckbox $visible, \Difra\Param\AjaxInt $id, \Difra\Param\AjaxHTML $description, \Difra\Param\AjaxInt $group = null, \Difra\Param\AjaxString $shortDescription = null, \Difra\Param\AjaxString $endDate = null, \Difra\Param\AjaxFile $eventImage = null, \Difra\Param\AjaxData $additionalField = null, \Difra\Param\AjaxString $fromEventDate = null, \Difra\Param\AjaxInt $category = null, \Difra\Param\AjaxString $scheduleName = null, \Difra\Param\AjaxData $scheduleField = null, \Difra\Param\AjaxData $scheduleValue = null, \Difra\Param\AjaxInt $location = null, Param\AjaxInt $userId = null) { $data = ['title' => $title->val(), 'eventDate' => $eventDate->val(), 'beginDate' => $beginDate->val(), 'id' => $id->val(), 'priority' => $priorityValue->val(), 'visible' => $visible->val(), 'description' => $description]; $data['shortDescription'] = is_null($shortDescription) ? null : $shortDescription->val(); $data['group'] = is_null($group) ? null : $group->val(); $data['endDate'] = is_null($endDate) ? null : $endDate->val(); $data['category'] = is_null($category) ? null : $category->val(); $data['fromEventDate'] = is_null($fromEventDate) ? null : $fromEventDate->val(); $data['location'] = is_null($location) ? null : $location->val(); if (is_null($data['fromEventDate']) || $data['fromEventDate'] == '' || $data['fromEventDate'] == 'null') { $data['fromEventDate'] = $eventDate->val(); } // из админки пока ставим так, потом добавим выбор юзера. if (!is_null($userId)) { $data['user'] = $userId->val(); } else { $data['user'] = 1; } $Announcements = \Difra\Plugins\Announcements::getInstance(); // апдейтим анонс $eventId = $Announcements->create($data); if (is_null($eventId)) { $this->ajax->error(\Difra\Locales::getInstance()->getXPath('announcements/adm/notify/updateError')); return; } // сохраняем дополнительные поля if (!is_null($additionalField)) { \Difra\Plugins\Announcements\Additionals::saveData($eventId, $additionalField->val()); } if (!is_null($eventImage)) { $Announcements->saveImage($eventId, $eventImage); } // смотрим есть ли расписание if (!is_null($scheduleField) && !is_null($scheduleValue)) { $scheduleName = !is_null($scheduleName) ? $scheduleName->val() : null; $Announcements->saveSchedules($eventId, $scheduleName, $scheduleField->val(), $scheduleValue->val()); } $this->ajax->notify(\Difra\Locales::getInstance()->getXPath('announcements/adm/notify/goodUpdate')); $this->ajax->redirect('/adm/announcements/'); }
public function saveAjaxAction(\Difra\Param\AjaxInt $maxPerUser, \Difra\Param\AjaxInt $maxPerGroup, \Difra\Param\AjaxInt $width, \Difra\Param\AjaxInt $height, \Difra\Param\AjaxInt $bigWidth, \Difra\Param\AjaxInt $bigHeight, \Difra\Param\AjaxInt $perPage) { $settingsArray = ['maxPerUser' => $maxPerUser->val(), 'maxPerGroup' => $maxPerGroup->val(), 'perPage' => $perPage->val(), 'width' => $width->val(), 'height' => $height->val(), 'bigWidth' => $bigWidth->val(), 'bigHeight' => $bigHeight->val()]; \Difra\Plugins\Announcements::getInstance()->saveSettings($settingsArray); $this->ajax->notify(\Difra\Locales::getInstance()->getXPath('announcements/adm/settingsSaved')); }
private function _showGroupEvents($groupId) { $Announcements = \Difra\Plugins\Announcements::getInstance(); $Announcements->getByGroupXML($groupId, $this->eventRoot); }
public function editAction(\Difra\Param\AnyInt $id) { $LocNode = $this->root->appendChild($this->xml->createElement('announcementsLocationsEdit')); $LocNode->setAttribute('id', $id->val()); \Difra\Plugins\Announcements::getInstance()->getLocationByIdXML($id->val(), $LocNode); }