Esempio n. 1
0
<?php

/*------------------------------------------------------------------------
# Cobalt
# ------------------------------------------------------------------------
# @author Cobalt
# @copyright Copyright (C) 2012 cobaltcrm.org All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Website: http://www.cobaltcrm.org
-------------------------------------------------------------------------*/
// no direct access
defined('_CEXEC') or die('Restricted access');
$convo = $this->conversation;
echo '<div class="media" id="convo_entry_' . $convo['id'] . '">';
if (UsersHelper::getRole() == "exec" || $convo['author'] == UsersHelper::getUserId()) {
    echo '<div class="btn-group pull-right"><a class="btn" href="javascript:void(0);" onclick="editConvoEntry(' . $convo['id'] . ')"><i class="glyphicon glyphicon-pencil"></i></a><a class="btn" href="javascript:void(0);" onclick="trashConvoEntry(' . $convo['id'] . ')"><i class="glyphicon glyphicon-trash"></i></a></div>';
}
echo '<div class="pull-left"><img class="media-object widget" src="' . $convo['owner_avatar'] . '" /></div>';
echo '<div class="media-body">';
echo '<h4 class="media-heading">' . $convo['owner_first_name'] . ' ' . $convo['owner_last_name'] . '</h4>';
echo nl2br($convo['conversation']);
echo '</div>';
echo '<hr /></div>';
    ?>
                         <optgroup label="<?php 
    echo TextHelper::_('COBALT_MEMBERS');
    ?>
" class="member" id="member" >
                            <?php 
    $member = array();
    $member[] = JHTML::_('select.option', UsersHelper::getUserId(), TextHelper::_('COBALT_ME'));
    echo JHtml::_('select.options', $member, 'value', 'text', $user_filter, true);
    ?>
                            <?php 
    echo JHtml::_('select.options', $this->user_names, 'value', 'text', $user_filter, true);
    ?>
                        </optgroup>
                        <?php 
    if (UsersHelper::getRole() == 'exec') {
        ?>
                        <optgroup label="<?php 
        echo TextHelper::_('COBALT_TEAM');
        ?>
" class="team" id="team" >
                            <?php 
        echo JHtml::_('select.options', $this->team_names, 'value', 'text', $user_filter, true);
        ?>
                        </optgroup>
                        <?php 
    }
    ?>
                    </select>
                </th>
                <th></th>
Esempio n. 3
0
        <?php 
if ($app->input->get('view') != "print") {
    ?>
        <div class='alert alert-info'>
            <?php 
    echo TextHelper::_('COBALT_SHOW_TASKS_FOR');
    ?>
:
            <span class="dropdown">
                <a class="dropdown-toggle" href="#" data-toggle="dropdown" role="button" href="javascript:void(0);" id="event_user_link" ><?php 
    echo TextHelper::_('COBALT_ME');
    ?>
</a>
                <ul class="dropdown-menu" role="menu" aria-labelledby="event_user_link">
                    <?php 
    $user_role = UsersHelper::getRole();
    $user_id = UsersHelper::getUserId();
    ?>
                    <li><a class="filter_user_<?php 
    echo $user_id;
    ?>
" onclick="Task.updateEventList(<?php 
    echo $user_id;
    ?>
,0)" ><?php 
    echo TextHelper::_('COBALT_ME');
    ?>
</a></li>
                    <?php 
    if ($user_role != 'basic') {
        ?>
Esempio n. 4
0
?>
"
                                        name="address_country"
                                        value="<?php 
echo isset($this->company->address_country) ? $this->company->address_country : "";
?>
"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="tab-pane fade in" id="Assignment">
            <?php 
if (UsersHelper::getRole() == 'exec' || UsersHelper::getRole() == "manager" || !($this->company->id > 0) || array_key_exists('owner_id', $this->company) && UsersHelper::getUserId() == $this->company->owner_id || UsersHelper::isAdmin()) {
    ?>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="control-label" for="">
                            <?php 
    echo ucwords(TextHelper::_('COBALT_COMPANY_OWNER'));
    ?>
                        </label>
                        <div class="controls">
                            <?php 
    echo DropdownHelper::generateDropdown('owner', $ownerId, 'company');
    ?>
                        </div>
                    </div>
Esempio n. 5
0
?>
"></td>
            <td>
                <select class="form-control filter_input" name="owner_id">
                    <?php 
if (UsersHelper::getRole() != "basic") {
    ?>
                        <option value=""><?php 
    echo TextHelper::_('COBALT_ALL');
    ?>
</option>
                    <?php 
}
?>
                    <?php 
if (UsersHelper::getRole() != "basic") {
    ?>
                        <?php 
    $user_filter = $this->state->get('Deal.' . str_replace('_filter', '', $app->input->get('layout')) . '_owner_id');
    ?>
                        <?php 
    $team_filter = $this->state->get('Deal.' . str_replace('_filter', '', $app->input->get('layout')) . '_owner_id');
    ?>
                        <optgroup label="<?php 
    echo TextHelper::_('COBALT_TEAM');
    ?>
" class="team">
                            <?php 
    echo JHtml::_('select.options', $this->team_names, 'value', 'text', $user_filter, true);
    ?>
                        </optgroup>
Esempio n. 6
0
    public static function getActivity()
    {
        $db = \Cobalt\Container::fetch('db');
        $query = $db->getQuery(true);
        $query->select('h.*, CONCAT(u.first_name," ", u.last_name) AS owner_name, c.name as company_name, CONCAT(p.first_name," ", p.last_name) AS person_name,
                        d.name as deal_name, e.name as event_name, note_cat.name as notes_category_name,
                        event_cat.name as events_category_name, old_event_cat.name as events_category_name_old, old_note_cat.name AS notes_category_name_old,
                        doc.name AS document_name,status.name AS deal_status_name_old, status2.name AS deal_status_name,deal_source.name AS deal_source_name_old,deal_source_2.name AS deal_source_name,
                        deal_stage.name AS deal_stage_name_old,deal_stage_2.name AS deal_stage_name,CONCAT(deal_owner.first_name," ",deal_owner.last_name) AS deal_owner_name_old,
                        CONCAT(deal_owner_2.first_name," ",deal_owner_2.last_name) AS deal_owner_name

                        ');
        $query->from('#__history AS h');
        $query->leftJoin('#__users AS u ON u.id = h.user_id');
        $query->leftJoin('#__companies AS c ON c.id = h.type_id AND h.type="company"');
        $query->leftJoin('#__notes AS n ON n.id = h.type_id AND h.type="note"');
        $query->leftJoin('#__deals AS d on d.id = h.type_id AND h.type="deal"');
        $query->leftJoin('#__people AS p on p.id = h.type_id AND h.type="person"');
        $query->leftJoin('#__goals AS g on g.id = h.type_id AND h.type="goal"');
        $query->leftJoin('#__events AS e on e.id = h.type_id AND h.type="event"');
        $query->leftJoin('#__reports AS r on r.id = h.type_id AND h.type="report"');
        $query->leftJoin('#__documents AS doc ON doc.id = h.type_id AND h.type="document"');
        $query->leftJoin('#__notes_categories as note_cat ON note_cat.id = h.new_value AND h.field="category_id" AND h.type="notes"');
        $query->leftJoin('#__events_categories as event_cat ON event_cat.id = h.new_value AND h.field="category_id" AND h.type="events"');
        $query->leftJoin('#__notes_categories as old_note_cat ON old_note_cat.id = h.old_value AND h.field="category_id" AND h.type="notes"');
        $query->leftJoin('#__events_categories as old_event_cat ON old_event_cat.id = h.old_value AND h.field="category_id" AND h.type="events"');
        $query->leftJoin("#__deal_status AS status ON status.id = h.old_value AND h.type='deal'");
        $query->leftJoin("#__deal_status AS status2 ON status2.id = h.new_value AND h.type='deal'");
        $query->leftJoin("#__sources AS deal_source ON deal_source.id = h.old_value AND h.type='deal'");
        $query->leftJoin("#__sources AS deal_source_2 ON deal_source_2.id = h.new_value AND h.type='deal'");
        $query->leftJoin("#__stages AS deal_stage ON deal_stage.id = h.old_value AND h.type='deal'");
        $query->leftJoin("#__stages AS deal_stage_2 ON deal_stage_2.id = h.new_value AND h.type='deal'");
        $query->leftJoin("#__users AS deal_owner ON deal_owner.id = h.old_value AND h.type='deal'");
        $query->leftJoin("#__users AS deal_owner_2 ON deal_owner_2.id = h.new_value AND h.type='deal'");
        $member_id = UsersHelper::getUserId();
        $member_role = UsersHelper::getRole();
        $team_id = UsersHelper::getTeamId();
        if ($member_role != 'exec') {
            //manager filter
            if ($member_role == 'manager') {
                $query->where('u.team_id = ' . $team_id);
            } else {
                //basic user filter
                $query->where(array('h.user_id = ' . $member_id));
            }
        }
        //TODO: Add assignees to the display (massive left join)
        $query->where('h.field!="assignee_id" AND h.field!="repeats"');
        $query->order('h.date DESC');
        if (self::$limit != null) {
            $query .= " LIMIT " . self::$limit;
        } else {
            $query .= " LIMIT 10";
        }
        $db->setQuery($query);
        $activity = $db->loadObjectList();
        return $activity;
    }
Esempio n. 7
0
 if ($event['type'] == 'task') {
     $due_date = $event['due_date'] != '0000-00-00 00:00:00' ? DateHelper::formatDate($event['due_date']) : TextHelper::_('COBALT_NA');
     $time = $event['due_date_hour'];
 } else {
     $due_date = DateHelper::formatDate($event['start_time']);
     $time = $event['start_time_hour'];
 }
 $id = (array_key_exists('parent_id', $event) && $event['parent_id']) != 0 ? $event['parent_id'] : $event['id'];
 echo '<tr id="list_row_' . $id . '" class="cobalt_row_' . $k . '">';
 if ($event['completed'] == 1) {
     $completed = "line-through";
 } else {
     $completed = "";
 }
 echo '<td>';
 if (UsersHelper::getLoggedInUser()->id == $event['owner_id'] || UsersHelper::getLoggedInUser()->id == $event['assignee_id'] || UsersHelper::isAdmin() || UsersHelper::getRole() == "exec") {
     echo '<input type="checkbox" name="ids[]" value="' . $id . '" />';
 }
 echo '</td>';
 echo '<td><div class="dropdown"><a data-toggle="dropdown" role="button" class="dropdown-toggle ' . $completed . '" id="event_menu_' . $event['id'] . '_link" >';
 echo $event['name'];
 echo '</a>';
 echo '<ul class="dropdown-menu" role="menu" aria-labelledby="event_menu_' . $event['id'] . '_link">';
 if ($event['completed'] == 1) {
     echo '<li><a href="javascript:void(0);" onclick="Calendar.markEventIncomplete(this)" >' . TextHelper::_('COBALT_MARK_INCOMPLETE') . '</a></li>';
 } else {
     echo '<li><a href="javascript:void(0);" onclick="Calendar.markEventComplete(this)" >' . TextHelper::_('COBALT_MARK_COMPLETE') . '</a></li>';
     echo '<li><a href="javascript:void(0);" onclick="Calendar.postponeEvent(this,1)" >' . TextHelper::_('COBALT_POSTPONE_1_DAY') . '</a></li>';
     echo '<li><a href="javascript:void(0);" onclick="Calendar.postponeEvent(this,7)" >' . TextHelper::_('COBALT_POSTPONE_7_DAYS') . '</a></li>';
 }
 $id = (array_key_exists('parent_id', $event) && $event['parent_id']) != 0 ? $event['parent_id'] : $event['id'];