1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-17 00:08:17 +03:00

появился раздел настроек, можно настроить уведомления на мыло

This commit is contained in:
Mzhelskiy Maxim 2008-10-14 18:36:36 +00:00
parent cc5870af61
commit 16b2f600bd
15 changed files with 251 additions and 26 deletions

View file

@ -937,7 +937,8 @@ class ActionBlog extends Action {
/**
* Отправка уведомления автору топика
*/
if ($oCommentNew->getUserId()!=$oTopic->getUserId()) {
$oUserTopic=$this->User_GetUserById($oTopic->getUserId());
if ($oCommentNew->getUserId()!=$oUserTopic->getId() and $oUserTopic->getSettingsNoticeNewComment()) {
$oUserAuthor=$this->User_GetUserById($oTopic->getUserId());
$this->Mail_SetAdress($oUserAuthor->getMail(),$oUserAuthor->getLogin());
$this->Mail_SetSubject('К вашему топику оставили новый комментарий');
@ -953,18 +954,20 @@ class ActionBlog extends Action {
/**
* Отправляем уведомление тому на чем коммент ответили
*/
if ($oCommentParent and $oCommentParent->getUserId()!=$oTopic->getUserId() and $oCommentNew->getUserId()!=$oCommentParent->getUserId()) {
if ($oCommentParent and $oCommentParent->getUserId()!=$oTopic->getUserId() and $oCommentNew->getUserId()!=$oCommentParent->getUserId()) {
$oUserAuthorComment=$this->User_GetUserById($oCommentParent->getUserId());
$this->Mail_SetAdress($oUserAuthorComment->getMail(),$oUserAuthorComment->getLogin());
$this->Mail_SetSubject('Вам ответили на ваш комментарий');
$this->Mail_SetBody('
if ($oUserAuthorComment->getSettingsNoticeReplyComment()) {
$this->Mail_SetAdress($oUserAuthorComment->getMail(),$oUserAuthorComment->getLogin());
$this->Mail_SetSubject('Вам ответили на ваш комментарий');
$this->Mail_SetBody('
Получен ответ на ваш комментарий в топике <b>«'.htmlspecialchars($oTopic->getTitle()).'»</b>, прочитать его можно перейдя по <a href="'.$oTopic->getUrl().'#comment'.$oCommentNew->getId().'">этой ссылке</a><br>
'.$sCommentText.'
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
$this->Mail_setHTML();
$this->Mail_Send();
}
}
func_header_location(DIR_WEB_ROOT.'/blog/'.$oTopic->getId().'.html#comment'.$oCommentNew->getId());
} else {

View file

@ -20,6 +20,18 @@
*
*/
class ActionSettings extends Action {
/**
* Какое меню активно
*
* @var unknown_type
*/
protected $sMenuItemSelect='settings';
/**
* Какое подменю активно
*
* @var unknown_type
*/
protected $sMenuSubItemSelect='profile';
/**
* Текущий юзер
*
@ -45,12 +57,13 @@ class ActionSettings extends Action {
*/
$this->oUserCurrent=$this->User_GetUserCurrent();
$this->SetDefaultEvent('profile');
$this->Viewer_AddHtmlTitle('Настройки профиля');
$this->Viewer_AddHtmlTitle('Настройки');
}
protected function RegisterEvent() {
$this->AddEvent('profile','EventProfile');
$this->AddEvent('invite','EventInvite');
$this->AddEvent('invite','EventInvite');
$this->AddEvent('tuning','EventTuning');
}
@ -59,8 +72,37 @@ class ActionSettings extends Action {
**********************************************************************************
*/
protected function EventTuning() {
$this->sMenuItemSelect='settings';
$this->sMenuSubItemSelect='tuning';
$this->Viewer_AddHtmlTitle('Тюнинг');
if (isset($_REQUEST['submit_settings_tuning'])) {
$this->oUserCurrent->setSettingsNoticeNewTopic( getRequest('settings_notice_new_topic') ? 1 : 0 );
$this->oUserCurrent->setSettingsNoticeNewComment( getRequest('settings_notice_new_comment') ? 1 : 0 );
$this->oUserCurrent->setSettingsNoticeNewTalk( getRequest('settings_notice_new_talk') ? 1 : 0 );
$this->oUserCurrent->setSettingsNoticeReplyComment( getRequest('settings_notice_reply_comment') ? 1 : 0 );
$this->oUserCurrent->setProfileDate(date("Y-m-d H:i:s"));
if ($this->User_Update($this->oUserCurrent)) {
$this->Message_AddNoticeSingle('Настройки успешно сохранены');
} else {
$this->Message_AddErrorSingle('Возникли технические неполадки, пожалуйста повторите позже.','Внутреняя ошибка');
}
}
}
/**
* Показ и обработка формы приглаешний
*
* @return unknown
*/
protected function EventInvite() {
$this->sMenuItemSelect='invite';
$this->sMenuSubItemSelect='';
$this->Viewer_AddHtmlTitle('Инвайты');
if (!USER_USE_INVITE) {
$this->Message_AddErrorSingle('Приглашения не доступны','Ошибка');
return Router::Action('error');
@ -96,6 +138,7 @@ class ActionSettings extends Action {
*
*/
protected function EventProfile() {
$this->Viewer_AddHtmlTitle('Профиль');
/**
* Если нажали кнопку "Сохранить"
*/
@ -264,5 +307,17 @@ class ActionSettings extends Action {
}
}
}
/**
* Выполняется при завершении работы экшена
*
*/
public function EventShutdown() {
/**
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuItemSelect',$this->sMenuItemSelect);
$this->Viewer_Assign('sMenuSubItemSelect',$this->sMenuSubItemSelect);
}
}
?>

View file

@ -141,9 +141,10 @@ class ActionTalk extends Action {
$sTalkText='Текст письма: <i>'.$oTalk->getText().'</i><br>';
}
$oUserToMail=$this->User_GetUserById($iUserId);
$this->Mail_SetAdress($oUserToMail->getMail(),$oUserToMail->getLogin());
$this->Mail_SetSubject('У вас новое письмо');
$this->Mail_SetBody('
if ($oUserToMail->getSettingsNoticeNewTalk()) {
$this->Mail_SetAdress($oUserToMail->getMail(),$oUserToMail->getLogin());
$this->Mail_SetSubject('У вас новое письмо');
$this->Mail_SetBody('
Вам пришло новое письмо, прочитать и ответить на него можно перейдя по <a href="'.DIR_WEB_ROOT.'/talk/read/'.$oTalk->getId().'/">этой ссылке</a><br>
Тема письма: <b>'.htmlspecialchars($oTalk->getTitle()).'</b><br>
'.$sTalkText.'
@ -152,8 +153,9 @@ class ActionTalk extends Action {
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
$this->Mail_setHTML();
$this->Mail_Send();
}
}
}
func_header_location(DIR_WEB_ROOT.'/talk/read/'.$oTalk->getId().'/');
@ -309,7 +311,7 @@ class ActionTalk extends Action {
*/
$aUsersTalk=$this->Talk_GetTalkUsers($oCommentNew->getTalkId());
foreach ($aUsersTalk as $oUserTalk) {
if ($oUserTalk->getId()!=$oCommentNew->getUserId()) {
if ($oUserTalk->getId()!=$oCommentNew->getUserId() and $oUserTalk->getSettingsNoticeNewTalk()) {
$sTalkText='';
if (SYS_MAIL_INCLUDE_TALK_TEXT) {
$sTalkText='Текст: <i>'.$oCommentNew->getText().'</i><br>';

View file

@ -364,7 +364,7 @@ class ActionTopic extends Action {
if ($oTopic->getPublish()==1 and $oBlog->getType()!='personal') {
$aBlogUsers=$this->Blog_GetRelationBlogUsersByBlogId($oBlog->getId());
foreach ($aBlogUsers as $oBlogUser) {
if ($oBlogUser->getUserId()==$this->oUserCurrent->getId()) {
if ($oBlogUser->getUserId()==$this->oUserCurrent->getId() or !$oBlogUser->getUserSettingsNoticeNewTopic()) {
continue;
}
$this->Mail_SetAdress($oBlogUser->getUserMail(),$oBlogUser->getUserLogin());

View file

@ -57,7 +57,18 @@ class BlogEntity_BlogUser extends Entity
return DIR_STATIC_SKIN.'/img/avatar_'.$iSize.'x'.$iSize.'.jpg';
}
}
public function getUserSettingsNoticeNewTopic() {
return $this->_aData['user_settings_notice_new_topic'];
}
public function getUserSettingsNoticeNewComment() {
return $this->_aData['user_settings_notice_new_comment'];
}
public function getUserSettingsNoticeNewTalk() {
return $this->_aData['user_settings_notice_new_talk'];
}
public function getUserSettingsNoticeReplyComment() {
return $this->_aData['user_settings_notice_reply_comment'];
}
public function setBlogId($data) {

View file

@ -109,6 +109,10 @@ class Mapper_Blog extends Mapper {
u.user_mail as user_mail,
u.user_profile_avatar as user_profile_avatar,
u.user_profile_avatar_type as user_profile_avatar_type,
u.user_settings_notice_new_topic,
u.user_settings_notice_new_comment,
u.user_settings_notice_new_talk,
u.user_settings_notice_reply_comment,
b.blog_title as blog_title,
b.blog_url as blog_url
FROM

View file

@ -105,8 +105,21 @@ class UserEntity_User extends Entity {
}
public function getProfileAvatarType() {
return $this->_aData['user_profile_avatar_type'];
}
public function getSettingsNoticeNewTopic() {
return $this->_aData['user_settings_notice_new_topic'];
}
public function getSettingsNoticeNewComment() {
return $this->_aData['user_settings_notice_new_comment'];
}
public function getSettingsNoticeNewTalk() {
return $this->_aData['user_settings_notice_new_talk'];
}
public function getSettingsNoticeReplyComment() {
return $this->_aData['user_settings_notice_reply_comment'];
}
public function getProfileAvatarPath($iSize=100) {
if ($this->getProfileAvatar()) {
@ -213,6 +226,18 @@ class UserEntity_User extends Entity {
}
public function setProfileAvatarType($data) {
$this->_aData['user_profile_avatar_type']=$data;
}
public function setSettingsNoticeNewTopic($data) {
$this->_aData['user_settings_notice_new_topic']=$data;
}
public function setSettingsNoticeNewComment($data) {
$this->_aData['user_settings_notice_new_comment']=$data;
}
public function setSettingsNoticeNewTalk($data) {
$this->_aData['user_settings_notice_new_talk']=$data;
}
public function setSettingsNoticeReplyComment($data) {
$this->_aData['user_settings_notice_reply_comment']=$data;
}
}
?>

View file

@ -65,7 +65,11 @@ class Mapper_User extends Mapper {
user_profile_about = ? ,
user_profile_date = ? ,
user_profile_avatar = ? ,
user_profile_avatar_type = ?
user_profile_avatar_type = ? ,
user_settings_notice_new_topic = ? ,
user_settings_notice_new_comment = ? ,
user_settings_notice_new_talk = ? ,
user_settings_notice_reply_comment = ?
WHERE user_id = ?
";
if ($this->oDb->query($sql,$oUser->getPassword(),
@ -90,7 +94,11 @@ class Mapper_User extends Mapper {
$oUser->getProfileAbout(),
$oUser->getProfileDate(),
$oUser->getProfileAvatar(),
$oUser->getProfileAvatarType(),
$oUser->getProfileAvatarType(),
$oUser->getSettingsNoticeNewTopic(),
$oUser->getSettingsNoticeNewComment(),
$oUser->getSettingsNoticeNewTalk(),
$oUser->getSettingsNoticeReplyComment(),
$oUser->getId())) {
return true;
}

View file

@ -132,6 +132,14 @@ ALTER TABLE `prefix_invite`
-- Дополнительные поля настройки у юзера
ALTER TABLE `prefix_user` ADD `user_settings_notice_new_topic` TINYINT( 1 ) NOT NULL DEFAULT '1';
ALTER TABLE `prefix_user` ADD `user_settings_notice_new_comment` TINYINT( 1 ) NOT NULL DEFAULT '1';
ALTER TABLE `prefix_user` ADD `user_settings_notice_new_talk` TINYINT( 1 ) NOT NULL DEFAULT '1';
ALTER TABLE `prefix_user` ADD `user_settings_notice_reply_comment` TINYINT( 1 ) NOT NULL DEFAULT '1';

View file

@ -57,7 +57,8 @@ LiveStreet представляет из себя <strong>бесплатный</
<li>kabachok(проекту) &mdash; перечислил <b>1 WMZ</b></li>
<li><a href="http://livestreet.ru/profile/g15rus/">g15rus</a>(На хороший дизайн для интересного проекта) &mdash; перечислил <b>1001 рубль</b></li>
<li><a href="http://livestreet.ru/profile/radioact/">radioact</a>(На удачу :)) &mdash; перечислил <b>190 рублей</b></li>
<li>Аноним(live!) &mdash; перечислил <b>199 WMR</b></li>
<li><a href="http://livestreet.ru/profile/serega/">serega</a>(все круто = )) &mdash; перечислил <b>20 WMZ</b></li>
</ul>
</DIV>

View file

@ -1,5 +1,7 @@
{include file='header.tpl'}
{include file='menu.settings.tpl'}
{include file='system_message.tpl'}
<BR>
@ -23,7 +25,7 @@
<p class="l-bot"><input type="submit" name="submit_invite" tabindex="6" value="отправить приглашение" /></p>
</form>
<p><span class="txt_small">Может быть, перейти на <a href="{$DIR_WEB_ROOT}/">заглавную страницу</a>?</span><br />
</td>
</tr>

View file

@ -1,5 +1,7 @@
{include file='header.tpl'}
{include file='menu.settings.tpl'}
{include file='system_message.tpl'}
<BR>

View file

@ -0,0 +1,50 @@
{include file='header.tpl'}
{include file='menu.settings.tpl'}
{include file='system_message.tpl'}
<BR>
<table width="100%" border="0" cellspacing="4" cellpadding="4">
<tr>
<td align="left">
<p><span class="header">Настройки сайта</span>
<div class="backoffice">
<form action="{$DIR_WEB_ROOT}/settings/tuning/" method="POST" enctype="multipart/form-data">
<fieldset >
<legend >Уведомления на e-mail</legend>
<input {if $oUserCurrent->getSettingsNoticeNewTopic()}checked{/if} type="checkbox" id="settings_notice_new_topic" name="settings_notice_new_topic" value="1" {if $_aRequest.settings_notice_new_topic==1}checked{/if}/>
<label for="settings_notice_new_topic"> &mdash; при новом топике в блоге</label>
<br>
<input {if $oUserCurrent->getSettingsNoticeNewComment()}checked{/if} type="checkbox" id="settings_notice_new_comment" name="settings_notice_new_comment" value="1" {if $_aRequest.settings_notice_new_comment==1}checked{/if}/>
<label for="settings_notice_new_comment"> &mdash; при новом комментарии в топике</label>
<br>
<input {if $oUserCurrent->getSettingsNoticeNewTalk()}checked{/if} type="checkbox" id="settings_notice_new_talk" name="settings_notice_new_talk" value="1" {if $_aRequest.settings_notice_new_talk==1}checked{/if}/>
<label for="settings_notice_new_talk"> &mdash; при новом личном сообщении</label>
<br>
<input {if $oUserCurrent->getSettingsNoticeReplyComment()}checked{/if} type="checkbox" id="settings_notice_reply_comment" name="settings_notice_reply_comment" value="1" {if $_aRequest.settings_notice_reply_comment==1}checked{/if}/>
<label for="settings_notice_reply_comment"> &mdash; при ответе на комментарий</label>
<br>
</fieldset>
<p class="l-bot"><input type="submit" name="submit_settings_tuning" tabindex="6" value="сохранить настройки" /></p>
</form>
</div>
</td>
</tr>
</table>
{include file='footer.tpl'}

View file

@ -65,10 +65,8 @@ var msgNoticeBox=new Roar({
<nobr>У вас нет <A class=hello_exit href="{$DIR_WEB_ROOT}/talk/">новых сообщений</a></nobr><br>
{/if}
Изменить <A class=hello_exit href="{$DIR_WEB_ROOT}/settings/">настройки профиля</a><br>
{if $USER_USE_INVITE}
Управлять <A class=hello_exit href="{$DIR_WEB_ROOT}/settings/invite/">приглашениями</a>
{/if}
Настройки <A class=hello_exit href="{$DIR_WEB_ROOT}/settings/profile/">профиля</a> | <A class=hello_exit href="{$DIR_WEB_ROOT}/settings/tuning/">сайта</a><br>
{else}
<DIV class=hello>
<form action="{$DIR_WEB_ROOT}/login/" method="POST" id="loginform">

View file

@ -0,0 +1,56 @@
<TABLE class=pagemenu id=pagemenuszd>
<TBODY>
<TR>
{if $oUserCurrent}
<TD class="width10 read_"><IMG height=35 alt=" " src="{$DIR_STATIC_SKIN}/img/red_ul.gif" width=10></TD>
<TD class="subitem1 center read_" style="WIDTH: 14px">
<A href="{$DIR_WEB_ROOT}/topic/add/"><IMG title=написать height=14 alt="написать" src="{$DIR_STATIC_SKIN}/img/new_habratopic.gif" width=14></A>
</TD>
<TD class="border2px width10 read_"></TD>
{/if}
{assign var="sel" value=""}
{if $sMenuItemSelect=='settings'}
{assign var="sel" value="sel "}
{/if}
<TD class="{$sel}width10"></TD>
<TD class="{$sel}subitem1 center">
<A class=tags_f href="{$DIR_WEB_ROOT}/settings/profile/">Настройки</A>
</TD>
<TD class="{$sel}border2px width10"></TD>
{if $USER_USE_INVITE}
{assign var="sel" value=""}
{if $sMenuItemSelect=='invite'}
{assign var="sel" value="sel "}
{/if}
<TD class="{$sel}width10"></TD>
<TD class="{$sel}subitem1 center">
<A class=tags_f href="{$DIR_WEB_ROOT}/settings/invite/">Инвайты</A>
</TD>
<TD class="{$sel}border2px width10"></TD>
{/if}
</TR>
</TBODY>
</TABLE>
{if $sMenuItemSelect=='settings'}
<TABLE class="pagesubmenu" id="pagemenuszd">
<TBODY>
<TR>
<TD vAlign=bottom width=10><IMG height=10 src="{$DIR_STATIC_SKIN}/img/green2_bl.gif" width=10></TD>
<TD class="subitem2 three_columns{if $sMenuSubItemSelect=='profile'} active_personal{/if}" noWrap align=middle>
<IMG class=arrow_cc height=7 src="{$DIR_STATIC_SKIN}/img/{if $sMenuSubItemSelect=='profile'}arrow_menu_main.gif{else}arrow_menu_main_un.gif{/if}" width=10><A href="{$DIR_WEB_ROOT}/settings/profile/">Профиль</A>
</TD>
<TD class="subitem2 three_columns{if $sMenuSubItemSelect=='tuning'} active_personal{/if}" noWrap align=middle>
<IMG class=arrow_cc height=7 src="{$DIR_STATIC_SKIN}/img/{if $sMenuSubItemSelect=='tuning'}arrow_menu_main.gif{else}arrow_menu_main_un.gif{/if}" width=10><A href="{$DIR_WEB_ROOT}/settings/tuning/">Тюнинг</A>
</TD>
<TD style="BORDER-RIGHT: white 2px solid" vAlign=bottom width=10><IMG height=10 src="{$DIR_STATIC_SKIN}/img/green2_br.gif" width=10></TD>
</TR>
</TBODY>
</TABLE>
{/if}