]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Meetings/views/view.listbytype.php
Release 6.5.6
[Github/sugarcrm.git] / modules / Meetings / views / view.listbytype.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
4 /*********************************************************************************
5  * SugarCRM Community Edition is a customer relationship management program developed by
6  * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
7  * 
8  * This program is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU Affero General Public License version 3 as published by the
10  * Free Software Foundation with the addition of the following permission added
11  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
12  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
13  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14  * 
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
18  * details.
19  * 
20  * You should have received a copy of the GNU Affero General Public License along with
21  * this program; if not, see http://www.gnu.org/licenses or write to the Free
22  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23  * 02110-1301 USA.
24  * 
25  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
26  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27  * 
28  * The interactive user interfaces in modified source and object code versions
29  * of this program must display Appropriate Legal Notices, as required under
30  * Section 5 of the GNU Affero General Public License version 3.
31  * 
32  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
33  * these Appropriate Legal Notices must retain the display of the "Powered by
34  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
35  * technical reasons, the Appropriate Legal Notices must display the words
36  * "Powered by SugarCRM".
37  ********************************************************************************/
38
39  
40 require_once('include/MVC/View/views/view.list.php');
41 require_once('modules/EAPM/EAPM.php');
42 class MeetingsViewListbytype extends ViewList {
43     var $options = array('show_header' => false, 'show_title' => false, 'show_subpanels' => false, 'show_search' => true, 'show_footer' => false, 'show_javascript' => false, 'view_print' => false,);
44     
45     function MeetingsViewListbytype() {
46         parent::ViewList();
47     }
48     
49         function listViewProcess(){
50         if (!$eapmBean = EAPM::getLoginInfo('IBMSmartCloud', true) ) {
51             $smarty = new Sugar_Smarty();
52             echo $smarty->fetch('include/externalAPI/IBMSmartCloud/IBMSmartCloudSignup.'.$GLOBALS['current_language'].'.tpl');
53             return;
54         }
55
56         $apiName = 'IBMSmartCloud';
57         $api = ExternalAPIFactory::loadAPI($apiName,true);
58         $api->loadEAPM($eapmBean);
59
60         $quickCheck = $api->quickCheckLogin();
61         if ( ! $quickCheck['success'] ) {
62             $errorMessage = string_format(translate('LBL_ERR_FAILED_QUICKCHECK','EAPM'), array('IBM SmartCloud'));
63             $errorMessage .= '<form method="POST" target="_EAPM_CHECK" action="index.php">';
64             $errorMessage .= '<input type="hidden" name="module" value="EAPM">';
65             $errorMessage .= '<input type="hidden" name="action" value="Save">';
66             $errorMessage .= '<input type="hidden" name="record" value="'.$eapmBean->id.'">';
67             $errorMessage .= '<input type="hidden" name="active" value="1">';
68             $errorMessage .= '<input type="hidden" name="closeWhenDone" value="1">';
69             $errorMessage .= '<input type="hidden" name="refreshParentWindow" value="1">';
70
71             $errorMessage .= '<br><input type="submit" value="'.$GLOBALS['app_strings']['LBL_EMAIL_OK'].'">&nbsp;';
72             $errorMessage .= '<input type="button" onclick="lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" value="'.$GLOBALS['app_strings']['LBL_CANCEL_BUTTON_LABEL'].'">';
73             $errorMessage .= '</form>';
74             echo $errorMessage;
75             return;
76         }
77
78                 $this->processSearchForm();
79         $this->params['orderBy'] = 'meetings.date_start';
80         $this->params['overrideOrder'] = true;
81                 $this->lv->searchColumns = $this->searchForm->searchColumns;
82                 $this->lv->show_action_dropdown = false;
83                 $this->lv->multiSelect = false;                 
84                 
85                 unset($this->searchForm->searchdefs['layout']['advanced_search']);
86                 
87                 if(!$this->headers) {
88                         return;
89         }
90
91                 if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
92                         $this->lv->ss->assign("SEARCH",false);
93             if ( !isset($_REQUEST['name_basic']) ) {
94                 $_REQUEST['name_basic'] = '';
95             }
96             $this->lv->ss->assign('DCSEARCH',$_REQUEST['name_basic']);
97                         $this->lv->setup($this->seed, 'include/ListView/ListViewDCMenu.tpl', $this->where, $this->params);
98                         $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
99                         echo $this->lv->display();
100                 }
101         }
102         
103     function listViewPrepare() {
104         $oldRequest = $_REQUEST;
105         parent::listViewPrepare();
106         $_REQUEST = $oldRequest;
107     }
108
109     function processSearchForm(){
110                 // $type = 'LotusLiveDirect';
111                 $type = 'IBMSmartCloud';
112           global $timedate;
113
114          $two_hours_ago = $GLOBALS['db']->convert($GLOBALS['db']->quoted($timedate->asDb($timedate->getNow()->get("-2 hours"))), 'datetime');
115
116                 $where =  " meetings.type = '$type' AND meetings.status != 'Held' AND meetings.status != 'Not Held' AND meetings.date_start > {$two_hours_ago} AND ( meetings.assigned_user_id = '".$GLOBALS['db']->quote($GLOBALS['current_user']->id)."' OR exists ( SELECT id FROM meetings_users WHERE meeting_id = meetings.id AND user_id = '".$GLOBALS['db']->quote($GLOBALS['current_user']->id)."' AND deleted = 0 ) ) ";
117
118           if ( isset($_REQUEST['name_basic']) ) {
119               $name_search = trim($_REQUEST['name_basic']);
120               if ( ! empty($name_search) ) {
121                   $where .= " AND meetings.name LIKE '".$GLOBALS['db']->quote($name_search)."%' ";
122               }
123           }
124
125           $this->where = $where;
126         }
127
128 }