mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
parent
d8eee65f49
commit
d80782459a
6 changed files with 55 additions and 11 deletions
|
|
@ -226,9 +226,12 @@ class communicationModel extends communication
|
|||
* get a message list
|
||||
* @param string $message_type (R: Received Message, S: Sent Message, T: Archive)
|
||||
* @param array $columnList
|
||||
* @param string $search_target
|
||||
* @param string $search_keyword
|
||||
* @param int $page
|
||||
* @return Object
|
||||
*/
|
||||
public static function getMessages($message_type = "R", $columnList = array())
|
||||
public static function getMessages($message_type = 'R', $columnList = [], $search_target = null, $search_keyword = null, $page = null)
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args = new stdClass();
|
||||
|
|
@ -260,9 +263,15 @@ class communicationModel extends communication
|
|||
break;
|
||||
}
|
||||
|
||||
// Search conditions
|
||||
if ($search_target && $search_keyword)
|
||||
{
|
||||
$args->{'s_' . $search_target} = $search_keyword;
|
||||
}
|
||||
|
||||
// Other variables
|
||||
$args->sort_index = 'message.list_order';
|
||||
$args->page = Context::get('page');
|
||||
$args->page = $page ?? max(1, intval(Context::get('page')));
|
||||
$args->list_count = 20;
|
||||
$args->page_count = 10;
|
||||
|
||||
|
|
|
|||
|
|
@ -86,28 +86,28 @@ class communicationView extends communication
|
|||
case 'R':
|
||||
if($message->receiver_srl != $logged_info->member_srl)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
if($message->sender_srl != $logged_info->member_srl)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
if($message->receiver_srl != $logged_info->member_srl)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -129,9 +129,20 @@ class communicationView extends communication
|
|||
}
|
||||
}
|
||||
|
||||
// Set search conditions
|
||||
$search_target = Context::get('search_target');
|
||||
if (!in_array($search_target, ['title', 'title_content', 'content']))
|
||||
{
|
||||
$search_target = null;
|
||||
}
|
||||
$search_keyword = utf8_clean(Context::get('search_keyword'));
|
||||
Context::set('search_target', $search_target);
|
||||
Context::set('search_keyword', $search_keyword !== '' ? $search_keyword : null);
|
||||
|
||||
// Extract a list
|
||||
$columnList = array('message_srl', 'message_type', 'related_srl', 'readed', 'title', 'member.member_srl', 'member.nick_name', 'message.regdate', 'readed_date');
|
||||
$output = $oCommunicationModel->getMessages($message_type, $columnList);
|
||||
$page = max(1, intval(Context::get('page')));
|
||||
$output = $oCommunicationModel->getMessages($message_type, $columnList, $search_target, $search_keyword, $page);
|
||||
|
||||
// set a template file
|
||||
Context::set('total_count', $output->total_count);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,14 @@
|
|||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="message.readed" var="readed" notnull="notnull" />
|
||||
<condition operation="equal" column="message.receiver_srl" var="member_srl" notnull="notnull" pipe="and" />
|
||||
<condition operation="equal" column="message.message_type" var="message_type" default="R" pipe="and" />
|
||||
<condition operation="equal" column="message.receiver_srl" var="member_srl" notnull="notnull" />
|
||||
<condition operation="equal" column="message.message_type" var="message_type" default="R" />
|
||||
<condition operation="search" column="message.title" var="s_title" />
|
||||
<condition operation="search" column="message.content" var="s_content" />
|
||||
<group>
|
||||
<condition operation="search" column="message.title" var="s_title_content" />
|
||||
<condition operation="search" column="message.content" var="s_title_content" pipe="or" />
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="message.list_order" order="asc" />
|
||||
|
|
|
|||
|
|
@ -16,7 +16,13 @@
|
|||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="message.receiver_srl" var="member_srl" notnull="notnull" />
|
||||
<condition operation="equal" column="message.message_type" var="message_type" default="R" pipe="and" />
|
||||
<condition operation="equal" column="message.message_type" var="message_type" default="R" />
|
||||
<condition operation="search" column="message.title" var="s_title" />
|
||||
<condition operation="search" column="message.content" var="s_content" />
|
||||
<group>
|
||||
<condition operation="search" column="message.title" var="s_title_content" />
|
||||
<condition operation="search" column="message.content" var="s_title_content" pipe="or" />
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="message.list_order" order="asc" />
|
||||
|
|
|
|||
|
|
@ -16,7 +16,13 @@
|
|||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="message.sender_srl" var="member_srl" notnull="notnull" />
|
||||
<condition operation="equal" column="message.message_type" var="message_type" default="S" pipe="and" />
|
||||
<condition operation="equal" column="message.message_type" var="message_type" default="S" />
|
||||
<condition operation="search" column="message.title" var="s_title" />
|
||||
<condition operation="search" column="message.content" var="s_content" />
|
||||
<group>
|
||||
<condition operation="search" column="message.title" var="s_title_content" />
|
||||
<condition operation="search" column="message.content" var="s_title_content" pipe="or" />
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="message.list_order" order="asc" />
|
||||
|
|
|
|||
|
|
@ -17,6 +17,12 @@
|
|||
<conditions>
|
||||
<condition operation="equal" column="message.receiver_srl" var="member_srl" notnull="notnull" />
|
||||
<condition operation="equal" column="message.message_type" var="message_type" default="T" pipe="and" />
|
||||
<condition operation="search" column="message.title" var="s_title" />
|
||||
<condition operation="search" column="message.content" var="s_content" />
|
||||
<group>
|
||||
<condition operation="search" column="message.title" var="s_title_content" />
|
||||
<condition operation="search" column="message.content" var="s_title_content" pipe="or" />
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="message.list_order" order="asc" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue