]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - modules/Calendar/TasksListView.php
Release 6.3.1
[Github/sugarcrm.git] / modules / Calendar / TasksListView.php
1 <?php
2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4  * SugarCRM Community Edition is a customer relationship management program developed by
5  * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6  * 
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Affero General Public License version 3 as published by the
9  * Free Software Foundation with the addition of the following permission added
10  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11  * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13  * 
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17  * details.
18  * 
19  * You should have received a copy of the GNU Affero General Public License along with
20  * this program; if not, see http://www.gnu.org/licenses or write to the Free
21  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301 USA.
23  * 
24  * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25  * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26  * 
27  * The interactive user interfaces in modified source and object code versions
28  * of this program must display Appropriate Legal Notices, as required under
29  * Section 5 of the GNU Affero General Public License version 3.
30  * 
31  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32  * these Appropriate Legal Notices must retain the display of the "Powered by
33  * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34  * technical reasons, the Appropriate Legal Notices must display the words
35  * "Powered by SugarCRM".
36  ********************************************************************************/
37
38 /*********************************************************************************
39
40  * Description:  TODO: To be written.
41  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42  * All Rights Reserved.
43  * Contributor(s): ______________________________________..
44  ********************************************************************************/
45
46
47
48
49
50 require_once('include/ListView/ListViewSmarty.php');
51 if(file_exists('custom/modules/Calendar/metadata/listviewdefs.php')){
52         require_once('custom/modules/Calendar/metadata/listviewdefs.php');
53 }else{
54         require_once('modules/Calendar/metadata/listviewdefs.php');
55 }
56
57
58 global $mod_strings;
59 global $app_strings;
60 global $app_list_strings;
61
62 global $urlPrefix;
63
64
65 global $currentModule;
66 global $current_language;
67 $current_module_strings = return_module_language($current_language, 'Tasks');
68
69
70 global $theme;
71
72 // clear the display columns back to default when clear query is called
73 if(!empty($_REQUEST['clear_query']) && $_REQUEST['clear_query'] == 'true')
74     $current_user->setPreference('ListViewDisplayColumns', array(), 0, 'Calendar');
75
76 $savedDisplayColumns = $current_user->getPreference('ListViewDisplayColumns', 'Calendar'); // get user defined display columns
77
78 $json = getJSONobj();
79 $seedTask = new Task();
80
81 // setup listview smarty
82 $lv = new ListViewSmarty();
83
84 $displayColumns = array();
85 // check $_REQUEST if new display columns from post
86 if(!empty($_REQUEST['displayColumns'])) {
87     foreach(explode('|', $_REQUEST['displayColumns']) as $num => $col) {
88         if(!empty($listViewDefs['Tasks'][$col]))
89             $displayColumns[$col] = $listViewDefs['Tasks'][$col];
90     }
91 }
92 elseif(!empty($savedDisplayColumns)) { // use user defined display columns from preferences
93     $displayColumns = $savedDisplayColumns;
94 }
95 else { // use columns defined in listviewdefs for default display columns
96     foreach($listViewDefs['Calendar'] as $col => $params) {
97         if(!empty($params['default']) && $params['default'])
98             $displayColumns[$col] = $params;
99     }
100 }
101 $params = array('massupdate' => false); // setup ListViewSmarty params
102 if(!empty($_REQUEST['orderBy'])) { // order by coming from $_REQUEST
103     $params['orderBy'] = $_REQUEST['orderBy'];
104     $params['overrideOrder'] = true;
105     if(!empty($_REQUEST['sortOrder'])) $params['sortOrder'] = $_REQUEST['sortOrder'];
106 }
107 $params['orderBy'] = '';
108 $lv->displayColumns = $displayColumns;
109
110 // use the stored query if there is one
111 if (!isset($where)) $where = "";
112 require_once('modules/MySettings/StoreQuery.php');
113 $storeQuery = new StoreQuery();
114 if(!isset($_REQUEST['query'])){
115     $storeQuery->loadQuery('Calendar');
116     $storeQuery->populateRequest();
117 }else{
118     $storeQuery->saveFromGet('Calendar');
119 }
120 global $timedate;
121
122 //jc: bug 14616 - dates need to specificy the end of the current date in order to get tasks
123 // that are scheduled to start today
124 $today = $timedate->getNow(true)->get_day_end_time()->asDb();
125 //end bug 14616
126
127 $where = "(tasks.assigned_user_id='$current_user->id' and tasks.status<>'Completed' and tasks.status<>'Deferred'";
128 $where .= "and (tasks.date_start is NULL or tasks.date_start <= '$today'))";
129
130 $lv->export = false;
131 $lv->delete = false;
132 $lv->select = false;
133 $lv->mailMerge = false;
134 $lv->multiSelect = false;
135 $lv->showMassupdateFields = false;
136 $lv->setup($seedTask, 'include/ListView/ListViewNoMassUpdate.tpl', $where, $params);
137 echo getClassicModuleTitle($current_module_strings['LBL_MODULE_NAME'], array($current_module_strings['LBL_LIST_FORM_TITLE']), false);
138
139
140 echo $lv->display();
141 //Fake Mass Update
142 $form = "<form action='index.php' id='MassUpdate' method='post' name='MassUpdate'><input type='hidden' id='uid' name='uid'><input name='action' type='hidden' value='index' /><input name='module' type='hidden' value='Project'></form>";
143 echo $form;
144 ?>