Spade

Mini Shell

Directory:~$ /home/lmsyaran/public_html/joomla4/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ /home/lmsyaran/public_html/joomla4/mod_chatters.zip

PK��[y��
ii
css/style.cssnu�[���.chatters
.card-body  {
    padding: 5px !important
}
.chatters .card-body li {
    display: flex;
    justify-content: space-around;
    margin: 10px 0;
	border-radius:5px;
	border: 1px solid #e2e2e2;
	box-shadow: 1px 1px 5px #dadada;
}
.chatters .card-body li .info span {
    font-size: 12px;
    color: #929292;
}
.chatters .card-body li p{
    font-size: 12px;
    margin-top: 10px;
    color: #6f6f6f;
    border-bottom: 1px dashed #a6cdc3;
    padding-bottom: 5px;
    margin-bottom: 5px;
}
.chatters .card-body .image img{
    width: 65px;
    height: 65px;
    border-radius: 50%;
	border: 2px solid #d6d6d6;
}
.messageCounter{
    border-radius: 50%;
    background: #ff9c02;
    position: absolute;
    width: 20px;
    height: 20px;
    text-align: center;
    top: 23px;
    right: -7px;
	color:white;
}
#side-panel{
	max-width: 100%;
}

.side_panel {
	float:unset !important;
}

.btn-danger {
    background: #dc3545 !important;
}

.btn-info{
	background:#17a2b8 !Important;
}

.button-consulting a:hover {
    color: white !important;
}

.calender-cahtters-icon,
.time-cahtters-icon,
.coins-cahtters-icon {
    margin-left: 3px;
}

.calender-cahtters-icon{
	color: #b970de !important;
}

.time-cahtters-icon{
	color:#0059fd !important;
}

.coins-cahtters-icon {
    color: #e4b404 !important;
}PK��[�9���
helper.phpnu�[���<?php

class ModChattersHelper
{

    public static function getChatters($params,$userid)
    {

        $db= JFactory::getDbo();

        $query = $db->getQuery(true)
            ->select($db->quoteName('id'))
            ->from($db->quoteName('#__reservation_sick'))
           
->where($db->quoteName('userid').'='.$userid);
        $db->setQuery($query);
        $res= $db->loadResult();

        if ($res)
        {
            $group= 'sick';
            $join= 'co.userid';
            $where= 'si.userid';
        }

        else
        {
            $group= 'consultant';
            $join= 'si.userid';
            $where= 'co.userid';
        }



        $db= JFactory::getDbo();

        $query = $db->getQuery(true)
           
->select($db->quoteName(array('u.id','u.name','p.id','se.pay','p.price','se.created','se.id','se.finish'),array('uid','name','pid','pay','price','created','seid','finish')))
           
->from($db->quoteName('#__reservation_session','se'))
           
->join('INNER',$db->quoteName('#__reservation_sick','si').'on
('.$db->quoteName('se.sickid').'='.$db->quoteName('si.id').')')
           
->join('INNER',$db->quoteName('#__reservation_plan','p').'on
('.$db->quoteName('se.planid').'='.$db->quoteName('p.id').')')
           
->join('INNER',$db->quoteName('#__reservation_consultant','co').'on
('.$db->quoteName('p.consultantid').'='.$db->quoteName('co.id').')')
           
->join('INNER',$db->quoteName('#__users','u').'on
('.$db->quoteName($join).'='.$db->quoteName('u.id').')')
            ->where($db->quoteName($where).'='.$userid)
           
->where($db->quoteName('se.pay').'=1');


        $db->setQuery($query);
        $res= $db->loadObjectList();

        
        $seidList=[];
        foreach ($res as $item) {
            $seidList[]= $item->seid;
        }
        $lastMessage= self::getLastMessage($seidList);


        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
           
->select($db->quoteName(array('id','seid','token')))
           
->from($db->quoteName('#__reservation_comment','cm'));

        $db->setQuery($query);
        $res2 = $db->loadAssocList('seid');
        
        $messageCount= self::getMessageCount($userid);

        return [$res,$res2,$group, $messageCount, $lastMessage];
    }

    public function getMessageCount($userid)
    {
        $db= JFactory::getDbo();
        $query= $db->getQuery(true)
            ->select('m.from as sender , m.to as receiver, m.seid
as seid, count(m.from) as count, m.message as message')
           
->from($db->quoteName('#__reservation_message','m'))
            ->where($db->quoteName('m.to').'='.
$db->quote($userid))
            ->where($db->quoteName('m.read').'=
0')
            ->group('sender, receiver, seid');
        
        $db->setQuery($query);
        $result = $db->loadObjectList('sender');
        return $result;
    }
    public function getLastMessage($seidList)
    {

        if (empty($seidList))
            return [];

        $db= JFactory::getDbo();
        
        $subQuery = $db->getQuery(true);
        $subQuery->select('max(id)')
           
->from($db->quoteName('#__reservation_message','m'))
            ->where($db->quoteName('m.seid') . '
IN('.implode(',',$seidList).')' )
            ->group('m.seid');


        $query= $db->getQuery(true)
            ->select('m.seid as seid , m.message as message')
           
->from($db->quoteName('#__reservation_message','m'))
           
->where($db->quoteName('m.id').'IN('.$subQuery.')');


        $db->setQuery($query);
        $result = $db->loadObjectList('seid');
        return $result;
    }

}PK��[
index.htmlnu�[���PK��[
js/main.jsnu�[���PK��[1rQ��mod_chatters.phpnu�[���<?php

// No direct access
defined('_JEXEC') or die;


// Include the syndicate functions only once
require_once dirname(__FILE__) . '/helper.php';
$userid= JFactory::getUser()->get('id','0');


$document = JFactory::getDocument();
$document->addStyleSheet('modules/mod_chatters/css/style.css');
//$document->addScript('modules/mod_chatters/js/main.js');


$chatters = ModChattersHelper::getChatters($params,$userid)[0];
$comment = ModChattersHelper::getChatters($params,$userid)[1];
$group = ModChattersHelper::getChatters($params,$userid)[2];
$messageCount = ModChattersHelper::getChatters($params,$userid)[3];
$lastMessage = ModChattersHelper::getChatters($params,$userid)[4];

require
JModuleHelper::getLayoutPath('mod_chatters','default');PK��[x��[��mod_chatters.xmlnu�[���<?xml
version="1.0" encoding="UTF-8" ?>
<extension type="module" version="1.0.0"
client="site" method="upgrade">
    <name>Chatters</name>
    <author>farhad shahbazi</author>
    <version>1.0.0</version>
    <description>show users who can chat</description>
    <files>
        <filename>mod_chatters.xml</filename>
        <filename>index.html</filename>
        <filename
module="mod_chatters">mod_chatters.php</filename>
        <filename>helper.php</filename>
        <filename>tmpl/default.php</filename>
        <filename>tmpl/index.html</filename>
        <folder>css</folder>
        <folder>js</folder>
    </files>
    <config>
    </config>
</extension>PK��[�����tmpl/default.phpnu�[���<section
class="chatters">

    <div class="row">
        <div class="col-12">
            <div class="card border-0">
                <div class="card-body">
                    <ul style="padding: 0;margin: 0;">

                        <?php foreach ($chatters as $chatter): ?>

                            <li class="flex-column p-2">
							<div class="d-flex">
                                <div class="image d-flex mr-3
position-relative">
                                    <?php
if(isset($messageCount[$chatter->uid])):?>

                                        <?php
if($messageCount[$chatter->uid]->seid== $chatter->seid):?>

                                            <span
class="messageCounter">
                                     <?=
$messageCount[$chatter->uid]->count;?>
                                  </span>

                                        <?php endif;?>

                                    <?php endif;?>
                                    <img
src="templates/mytemp/assets/images/farzad.jpg"
alt="">
                                </div>
                                <div class="info
text-left">
                                    <a class="text-dark"
href="#"><?= $chatter->name;?></a>
                                    <p>
                                        <?php if
(isset($lastMessage[$chatter->seid])): ?>
                                            <?=
mb_substr($lastMessage[$chatter->seid]->message,0,40,'UTF-8')?>
                                        ...
                                        <?php endif; ?>
                                    </p>
                                    <div>
                                        <span><span
class="calender-cahtters-icon"><i class="far
fa-calendar-alt"></i></span><?=
Joomla\CMS\HTML\HtmlHelper::date($chatter->created, 'Y-m-d');
?> </span>
                                        <span style="margin-right:
.5rem;"><span class="time-cahtters-icon"><i
class="far fa-clock"></i></span><?=
Joomla\CMS\HTML\HtmlHelper::date($chatter->created, 'H:i');
?> </span>
                                        <span style="margin-right:
.5rem;"><span class="coins-cahtters-icon"><i
class="fas fa-coins"></i></span><?=
$chatter->price; ?> تومان</span>
                                    </div>
                                </div>
							</div>
                                <div
class="button-consulting">
                                    <?php if($chatter->pay &&
!$chatter->finish): ?>
                                        <a href="<?=
JRoute::_('index.php?option=com_reservation&view=messages&uid='.
$chatter->uid.'&pid='.
$chatter->pid.'&seid='.$chatter->seid
,false);?>" class="btn btn-info btn-sm">صفحه
گفتگو</a>
                                    <?php elseif($chatter->pay
&& $chatter->finish) : ?>
                                        <a href="<?=
JRoute::_('index.php?option=com_reservation&view=messages&uid='.
$chatter->uid.'&pid='.
$chatter->pid.'&seid='.$chatter->seid
,false);?>" class="btn btn-success btn-sm">خاتمه
یافته</a>
                                    <?php else: ?>
                                        <a href="<?=
JRoute::_('index.php?option=com_reservation&view=payment&seid='.$chatter->seid
,false);?>" class="btn btn-danger
btn-sm">پرداخت</a>
                                    <?php endif; ?>
                                    <div>
                                        <?php if($group==
'sick'):?>
                                            <?php if
($chatter->finish==1 &&
!isset($comment[$chatter->seid])):?>
                                                <a href="<?=
JRoute::_('index.php?option=com_reservation&view=comment&uid='.$chatter->uid.'&seid='.$chatter->seid
,false);?>" class="btn btn-warning btn-sm">ثبت
نظر</a>
                                            <?php endif;?>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </li>

                        <?php endforeach;?>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</section>PK��[tmpl/index.htmlnu�[���PK��[y��
ii
css/style.cssnu�[���PK��[�9���
�helper.phpnu�[���PK��[
|index.htmlnu�[���PK��[
�js/main.jsnu�[���PK��[1rQ���mod_chatters.phpnu�[���PK��[x��[��.mod_chatters.xmlnu�[���PK��[�����tmpl/default.phpnu�[���PK��[,tmpl/index.htmlnu�[���PKjO,