2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
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.
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
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
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.
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.
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 ********************************************************************************/
38 /*********************************************************************************
40 * Description: TODO: To be written.
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42 * All Rights Reserved.
43 * Contributor(s): ______________________________________..
44 ********************************************************************************/
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');
54 require_once('modules/Calendar/metadata/listviewdefs.php');
60 global $app_list_strings;
65 global $currentModule;
66 global $current_language;
67 $current_module_strings = return_module_language($current_language, 'Tasks');
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');
76 $savedDisplayColumns = $current_user->getPreference('ListViewDisplayColumns', 'Calendar'); // get user defined display columns
79 $seedTask = new Task();
81 // setup listview smarty
82 $lv = new ListViewSmarty();
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];
92 elseif(!empty($savedDisplayColumns)) { // use user defined display columns from preferences
93 $displayColumns = $savedDisplayColumns;
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;
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'];
107 $params['orderBy'] = '';
108 $lv->displayColumns = $displayColumns;
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();
118 $storeQuery->saveFromGet('Calendar');
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();
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'))";
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);
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>";