imagecms/ImageCMS

View on GitHub
application/modules/comments/assets/admin/comments_list.tpl

Summary

Maintainability
Test Coverage
<script>
langs["Hide answers"] = '<?php echo lang("Hide answers", "comments")?>';
langs["Show answers"] = '<?php echo lang("Show answers", "comments")?>';
</script>
<section class="mini-layout">
    <div class="frame_title clearfix">
        <div class="pull-left">
            <span class="help-inline"></span>
            <span class="title">{lang('Comments', 'comments')}</span>
        </div>
        <div class="pull-right">
            <div class="d-i_b">
                <div class="dropdown d-i_b">
                    <button type="button" class="btn btn-small dropdown-toggle disabled action_on" data-toggle="dropdown">
                        <i class="icon-tag"></i>
                        {lang("Status", 'comments')}
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="#" class="to_pspam">{lang('Into spam', 'comments')}</a></li>
                        <li><a href="#" class="to_wait">{lang('In the waiting', 'comments')}</a></li>
                        <li><a href="#" class="to_approved">{lang('In approve', 'comments')}</a></li>
                    </ul>
                </div>
                <button type="button" class="btn btn-small btn-danger disabled action_on" id="comment_delete"><i class="icon-trash"></i>{lang("Delete", 'comments')}</button>
                <a class="btn btn-small pjax" href="/admin/components/cp/comments/show_settings"><i class="icon-wrench"></i>{lang('Settings', 'comments')}</a>
            </div>
        </div>
    </div>
    <div class="btn-group myTab m-t_20">
        <a class="btn btn-small pjax {if $status == 'all' OR $status== NULL}active{/if}" href="/admin/components/cp/comments/index/status/all/page/0">{lang("All comments", 'comments')}
            {$all_comm_show = $total_waiting + $total_app + $total_spam}
          {/*}
            {if $all_comm_show}
                <span class="comm-label-in">
                    {$all_comm_show}
                </span>
            {/if}
            { */}
        </a>
        <a class="btn btn-small pjax {if $status == 'waiting'}active{/if}" href="/admin/components/cp/comments/index/status/waiting/page/0">{lang("Waiting for moderation", 'comments')}
            {if $total_waiting>0}
                <span style="" class="comm-label-in">{$total_waiting}</span>
            {/if}
        </a>
        <a class="btn btn-small pjax {if $status == 'approved'}active{/if}" href="/admin/components/cp/comments/index/status/approved/page/0">{lang("Approval", 'comments')}

            {if $total_app>0}
                <span class="comm-label-in">
                    {$total_app}
                </span>
            {/if}

        </a>
        <a class="btn btn-small pjax {if $status == 'spam'}active{/if}" href="/admin/components/cp/comments/index/status/spam/page/0">
            {lang("Spam", 'comments')}
            {if $total_spam>0}
                <span  class="comm-label-in">
                    {$total_spam}
                </span>
            {/if}
        </a>
    </div>
    <div class="tab-content">
        {if count($comments) > 0 AND is_array($comments)}
            <div class="tab-pane active" id="modules">
                <div class="row-fluid">
                    <table class="table  table-bordered table-hover table-condensed">
                        <thead>
                            <tr>
                                <th class="t-a_c span1">
                                    <span class="frame_label">
                                        <span class="niceCheck b_n">
                                            <input type="checkbox" value="On"/>
                                        </span>
                                    </span>
                                </th>
                                <th class="span1">{lang("ID", 'comments')}</th>
                                <th class="span5">{lang("Text", 'comments')}</th>
                                <th class="span2">{lang('Mark', 'comments')}</th>
                                <th class="span2">{lang("User", 'comments')}</th>
                                <th class="span2">{lang('User Email', 'comments')}</th>
                                <th class="span2">{lang("Page", 'comments')}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $comments as $item}
                                {if !$children[$item.id]}
                                    <tr data-id="{$item.id}" data-tree>
                                        <td class="t-a_c">
                                            <span class="frame_label">
                                                <span class="niceCheck b_n">
                                                    <input type="checkbox" value="{echo $item.id}" id="nc{$item.id}" name="ids"/>
                                                </span>
                                            </span>
                                        </td>
                                        <td><a href="{echo site_url('admin/components/cp/comments/edit/')}/{$item.id}">{$item.id}</a></td>
                                        <td>
                                            <span class="time muted">{date('d-m-Y H:i', $item.date)}</span>
                                            <span class="text_comment" id="comment_text_holder{$item.id}">{truncate(htmlspecialchars($item.text), 80, '...')}</span>
                                            <span class="frame_edit_comment ref_group" id="comment_text_editor{$item.id}">
                                                <textarea id="edited_com_text{$item.id}">{$item.text}</textarea>

                                                <span class="js ref comment_update" data-cid="{$item.id}" data-uname="{$item.user_name}" data-uemail="{$item.user_mail}" data-cstatus="{$item.status}">{lang('Save', 'comments')}</span>
                                                &nbsp;&nbsp;
                                                <span class="js ref comment_update_cancel" data-cid="{$item.id}">{lang('Cancel', 'comments')}</span>
                                                {if $item.status == 1}
                                                    <a href="#" class="to_approved" data-id="{$item.id}">{lang('In approve', 'comments')}</a>
                                                {/if}
                                                {if $item.status != 2}
                                                    <a href="#" class="to_spam" data-id="{$item.id}">{lang('Into spam', 'comments')}</a>
                                                {else:}
                                                    <a href="#" class="to_waiting" data-id="{$item.id}">{lang('Waiting moderation', 'comments')}</a>
                                                {/if}
                                                <a href="#" class="ref_remove com_del" data-id="{$item.id}">{lang('Delete', 'comments')}</a>
                                            </span>
                                        </td>
                                        <td>
                                            <div class="p_r frame_rating">
                                                <div class="patch_disabled"></div>
                                                <div class="star">
                                                    {for $i=0; $i<5; $i++}
                                                        <a href="#">
                                                            <i class="icon-star{if $i>=(int)$item.rate}-empty{/if}">
                                                            </i>
                                                        </a>
                                                    {/for}
                                                </div>
                                                <a href="#">
                                                    <i class="icon-thumbs-up"></i>
                                                    <span>+{$item.like}</span>
                                                </a>
                                                &nbsp;&nbsp;&nbsp;
                                                <a href="#">
                                                    <i class="icon-thumbs-down"></i>
                                                    <span>-{$item.disslike}</span>
                                                </a>
                                            </div>
                                        </td>
                                        <td>
                                            <span class="text_comment">
                                                <a href="#">{$item.user_name}</a>
                                            </span>
                                            <span class="frame_edit_comment ref_group u_ed">
                                                <input type="text" value="{$item.user_name}" name="user_name" id="u_ed{$item.id}">
                                            </span>
                                        </td>
                                        <td>
                                            <span class="text_comment">
                                                <a href="#">{$item.user_mail}</a>
                                            </span>
                                            <span class="frame_edit_comment ref_group m_ed text_comment">
                                                <input type="text" value="{$item.user_mail}" name="user_mail" id="m_ed{$item.id}">
                                            </span>
                                        </td>
                                        <td>
                                            {if $item.module == 'core'}
                                                <a href="{$item.page_url}#comment_{$item.id}" target="_blank" title="{$item.page_title}">{truncate($item.page_title, 25, '...')}</a>
                                            {/if}
                                            {if $item.module == 'shop'}
                                                {if $this->CI->db->where('name','shop')->get('components')->num_rows() > 0}
                                                    {$p_name = encode(SProductsQuery::create()->filterById($item.item_id)->findOne()->getName())}
                                                    {$p_url = encode(SProductsQuery::create()->filterById($item.item_id)->findOne()->getRouteUrl())}
                                                    <a href="/{$p_url}" target="_blank">{truncate($p_name,25,'...')}</a>
                                                {/if}
                                            {/if}
                                        </td>
                                    </tr>
                                {/if}

                                {if $children[$item.id]}
                                    <tr>
                                        <td colspan="7">
                                            <table>
                                                <thead>
                                                    <tr class="no_vis">
                                                        <th class="span1"></th>
                                                        <th class="span1"></th>
                                                        <th class="span5"></th>
                                                        <th class="span2"></th>
                                                        <th class="span2"></th>
                                                        <th class="span2"></th>
                                                        <th class="span2"></th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr data-id="{$item.id}" class="comments">
                                                        <td class="t-a_c">
                                                            <span class="frame_label">
                                                                <span class="niceCheck b_n">
                                                                    <input type="checkbox" value="{echo $item.id}" id="nc{$item.id}" name="ids"/>
                                                                </span>
                                                            </span>
                                                        </td>
                                                        <td><a href="{echo site_url('admin/components/cp/comments/edit/')}/{$item.id}" >{$item.id}</a></td>
                                                        <td>
                                                            <span class="time muted">{date('d-m-Y H:i', $item.date)}</span>
                                                            <span class="text_comment parent_comment_{$item.id}" id="comment_text_holder{$item.id}">{truncate(htmlspecialchars($item.text), 80, '...')}</span>
                                                            <span class="frame_edit_comment ref_group" id="comment_text_editor{$item.id}">
                                                                <textarea id="edited_com_text{$item.id}">{$item.text}</textarea>
                                                                <span class="js ref comment_update" data-cid="{$item.id}" data-uname="{$item.user_name}" data-uemail="{$item.user_mail}" data-cstatus="{$item.status}">
                                                                    {lang('Save', 'comments')}
                                                                </span>
                                                                &nbsp;&nbsp;
                                                                <span class="js ref comment_update_cancel" data-cid="{$item.id}">
                                                                    {lang('Cancel', 'comments')}
                                                                </span>
                                                                {if $item.status == 1}
                                                                    <a href="#" class="to_approved" data-id="{$item.id}">{lang('In approve', 'comments')}</a>
                                                                {/if}
                                                                {if $item.status != 2}
                                                                    <a href="#" class="to_spam" data-id="{$item.id}">{lang('Into spam', 'comments')}</a>
                                                                {else:}
                                                                    <a href="#" class="to_waiting" data-id="{$item.id}">{lang('Wait moderation', 'comments')}</a>
                                                                {/if}
                                                                <a href="#" class="ref_remove com_del" data-id="{$item.id}">{lang('Delete', 'comments')}</a>
                                                                </div>
                                                                </div>
                                                        </td>
                                                        <td>
                                                            <div class="p_r frame_rating">
                                                                <div class="patch_disabled"></div>
                                                                <div class="star">
                                                                    {for $i=0; $i<5; $i++}
                                                                        <a href="#">
                                                                            <i class="icon-star{if $i>=(int)$item.rate}-empty{/if}">
                                                                            </i>
                                                                        </a>
                                                                    {/for}
                                                                </div>
                                                                <a href="#">
                                                                    <i class="icon-thumbs-up"></i>
                                                                    <span>+{$item.like}</span>
                                                                </a>
                                                                &nbsp;&nbsp;&nbsp;
                                                                <a href="#">
                                                                    <i class="icon-thumbs-down"></i>
                                                                    <span>-{$item.disslike}</span>
                                                                </a>
                                                            </div>
                                                        </td>
                                                        <td>
                                                            <a href="#" class="u_ed text_comment">{$item.user_name}</a>
                                                            <span class="frame_edit_comment ref_group u_ed">
                                                                <input type="text" value="{$item.user_name}" name="user_name" id="u_ed{$item.id}">
                                                            </span>
                                                        </td>
                                                        <td>
                                                            <a href="#" class="m_ed text_comment">{$item.user_mail}</a>
                                                            <span class="frame_edit_comment ref_group m_ed">
                                                                <input type="text" value="{$item.user_mail}" name="user_mail" id="m_ed{$item.id}">
                                                            </span>
                                                        </td>
                                                        <td>
                                                            {if $item.module == 'core'}
                                                                <a href="{$item.page_url}#comment_{$item.id}" target="_blank" title="{$item.page_title}">{truncate($item.page_title, 25, '...')}</a>
                                                            {/if}
                                                            {if $item.module == 'shop'}
                                                                {if $this->CI->db->where('name','shop')->get('components')->num_rows() > 0}
                                                                    {$p_name = encode(SProductsQuery::create()->filterById($item.item_id)->findOne()->getName())}
                                                                    {$p_url = encode(SProductsQuery::create()->filterById($item.item_id)->findOne()->getRouteUrl())}
                                                                    <a href="/{$p_url}" target="_blank">{truncate($p_name,25,'...')}</a>
                                                                {/if}
                                                            {/if}
                                                        </td>
                                                    </tr>
                                                    {if $status == 'all'}
                                                    <tr>
                                                        <td colspan="7">
                                                            <table>
                                                                <thead>
                                                                    <tr class="no_vis">
                                                                        <th class="span1"></th>
                                                                        <th class="span1"></th>
                                                                        <th class="span5"></th>
                                                                        <th class="span2"></th>
                                                                        <th class="span2"></th>
                                                                        <th class="span2"></th>
                                                                        <th class="span2"></th>
                                                                    </tr>
                                                                </thead>
                                                                <tbody>

                                                                    {$counter = 0;}
                                                                    {$newComments = 0;}
                                                                    {foreach  $children[$item.id] as $ic}
                                                                        {$newComments += $ic.status;}
                                                                        {if $counter == 0}
                                                                            <tr style="border-top: 1px solid #ddd; border-left: 1px solid #ddd; border-right: 1px solid #ddd;">
                                                                                <td colspan="8" style="padding-left: 130px!important;{if $newComments}background-color: #FFFFC9!important;{/if}">
                                                                                    <img onclick="expand_Children({$item.id}, $(this))" src="/templates/administrator/images/tree/plus.gif" style="cursor: pointer;">
                                                                                    <img onclick="hide_Children({$item.id}, $(this))" src="/templates/administrator/images/tree/minus.gif" style="cursor: pointer; display: none">
                                                                                    <a onclick="expand_hide_Children($(this), {$item.id})">
                                                                                        {lang('Show answers', 'comments')}
                                                                                    </a>
                                                                                </td>
                                                                            </tr>
                                                                        {/if}
                                                                        <tr data-id="{$ic.id}" class="comments comment_child_{$item.id}" style="display: none;">
                                                                            <td class="t-a_c">
                                                                                <span class="frame_label">
                                                                                    <span class="niceCheck b_n">
                                                                                        <input type="checkbox" value="{echo $ic.id}" id="nc{$ic.id}" name="ids"/>
                                                                                    </span>
                                                                                </span>
                                                                            </td>
                                                                            <td><a href="{echo site_url('admin/components/cp/comments/edit/')}/{$ic.id}" >{$ic.id}</a></td>
                                                                            <td>
                                                                                <span class="simple_tree pull-left">&#8627;</span>
                                                                                <div class="o_h">
                                                                                    <span class="time muted">{date('d-m-Y H:i', $ic.date)}</span>
                                                                                    <span class="text_comment" id="comment_text_holder{$ic.id}">{truncate(htmlspecialchars($ic.text), 80, '...')}</span>
                                                                                    <span class="frame_edit_comment ref_group" id="comment_text_editor{$ic.id}">
                                                                                        <textarea id="edited_com_text{$ic.id}">{$ic.text}</textarea>
                                                                                        <span class="js ref comment_update" data-cid="{$ic.id}" data-uname="{$ic.user_name}" data-uemail="{$ic.user_mail}" data-cstatus="{$ic.status}">{lang('Save', 'comments')}</span>
                                                                                        &nbsp;&nbsp;
                                                                                        <span class="js ref comment_update_cancel" data-cid="{$ic.id}">{lang('Cancel', 'comments')}</span>
                                                                                    {if $ic.status == 1}<a href="#" class="to_approved" data-id="{$ic.id}">{lang('In approve', 'comments')}</a>{/if}
                                                                                    {if $ic.status != 2}
                                                                                        <a href="#" class="to_spam" data-id="{$ic.id}">{lang('Into spam', 'comments')}</a>
                                                                                    {else:}
                                                                                        <a href="#" class="to_waiting" data-id="{$ic.id}">{lang('Wait moderation', 'comments')}</a>
                                                                                    {/if}
                                                                                    <a href="#" class="ref_remove com_del" data-id="{$ic.id}">{lang('Delete', 'comments')}</a>
                                                                                </span>
                                                                            </div>
                                                                        </td>
                                                                        <td>
                                                                            <div class="p_r frame_rating">
                                                                                <div class="patch_disabled"></div>
                                                                                <div class="star">
                                                                                    {for $i=0; $i<5; $i++}
                                                                                        <a href="#"><i class="icon-star{if $i>=(int)$item.rate}-empty{/if}"></i></a>
                                                                                        {/for}
                                                                                </div>
                                                                                <a href="#">
                                                                                    <i class="icon-thumbs-up"></i>
                                                                                    <span>+{$ic.like}</span>
                                                                                </a>
                                                                                &nbsp;&nbsp;&nbsp;
                                                                                <a href="#">
                                                                                    <i class="icon-thumbs-down"></i>
                                                                                    <span>-{$ic.disslike}</span>
                                                                                </a>
                                                                            </div>
                                                                        </td>
                                                                        <td>
                                                                            <a href="#" class="u_ed text_comment">{$ic.user_name}</a>
                                                                            <span class="frame_edit_comment ref_group u_ed">
                                                                                <input type="text" value="{$ic.user_name}" name="user_name" id="u_ed{$ic.id}">
                                                                            </span>
                                                                        </td>
                                                                        <td>
                                                                            <a href="#" class="m_ed text_comment">{$ic.user_mail}</a>
                                                                            <span class="frame_edit_comment ref_group m_ed">
                                                                                <input type="text" value="{$ic.user_mail}" name="user_mail" id="m_ed{$ic.id}">
                                                                            </span>
                                                                        </td>
                                                                        <td>
                                                                            {if $ic.module == 'core'}
                                                                                <a href="{$item.page_url}#comment_{$ic.id}" target="_blank" title="{$ic.page_title}">{truncate($ic.page_title, 25, '...')}</a>
                                                                            {/if}
                                                                            {if $ic.module == 'shop'}
                                                                                {if $this->CI->db->where('name','shop')->get('components')->num_rows() > 0}
                                                                                    {$p_name = encode(SProductsQuery::create()->filterById($ic.item_id)->findOne()->getName())}
                                                                                    {$p_url = encode(SProductsQuery::create()->filterById($item.item_id)->findOne()->getRouteUrl())}
                                                                                    <a href="/{$p_url}" target="_blank">{truncate($p_name,25,'...')}</a>
                                                                                {/if}
                                                                            {/if}
                                                                        </td>
                                                                    </tr>
                                                                    {$counter++}
                                                                {/foreach}
                                                            </tbody>
                                                        </table>
                                                    </td>
                                                </tr>
                                                    {/if}
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                            {/if}
                        {/foreach}
                    </tbody>
                </table>
            </div>
        </div>
    {else:}
        </br>
        <div class="alert alert-info">
            {lang("No data has been found", 'comments')}
        </div>
    {/if}
</div>
<div class="clearfix">
    {$paginator}
</div>
</section>