dolibarr  16.0.5
projects.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
3  * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2007-2020 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2014-2015 Marcos GarcĂ­a <marcosgdf@gmail.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
26 if (!defined('NOTOKENRENEWAL')) {
27  define('NOTOKENRENEWAL', 1); // Disables token renewal
28 }
29 if (!defined('NOREQUIREMENU')) {
30  define('NOREQUIREMENU', '1');
31 }
32 if (!defined('NOREQUIREHTML')) {
33  define('NOREQUIREHTML', '1');
34 }
35 if (!defined('NOREQUIREAJAX')) {
36  define('NOREQUIREAJAX', '1');
37 }
38 if (!defined('NOREQUIRESOC')) {
39  define('NOREQUIRESOC', '1');
40 }
41 if (!defined('NOCSRFCHECK')) {
42  define('NOCSRFCHECK', '1');
43 }
44 if (!defined('NOREQUIREHTML')) {
45  define('NOREQUIREHTML', '1');
46 }
47 
48 require '../../main.inc.php';
49 
50 $htmlname = GETPOST('htmlname', 'aZ09');
51 $socid = GETPOST('socid', 'int');
52 $mode = GETPOST('mode', 'aZ09');
53 $discard_closed = GETPOST('discardclosed', 'int');
54 
55 // Security check
56 restrictedArea($user, 'projet', 0, 'projet&project');
57 
58 
59 /*
60  * View
61  */
62 
63 dol_syslog("Call ajax projet/ajax/projects.php");
64 
65 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
66 
67 top_httphead();
68 
69 if (empty($htmlname) && !GETPOST('mode', 'aZ09')) {
70  return;
71 }
72 
73 // Mode to get list of projects
74 if (empty($mode) || $mode != 'gettasks') {
75  // When used from jQuery, the search term is added as GET param "term".
76  $searchkey = (GETPOSTISSET($htmlname) ? GETPOST($htmlname, 'aZ09') : '');
77 
78  $formproject = new FormProjets($db);
79  $arrayresult = $formproject->select_projects_list($socid, '', $htmlname, 0, 0, 1, $discard_closed, 0, 0, 1, $searchkey);
80 }
81 
82 // Mode to get list of tasks
83 if ($mode == 'gettasks') {
84  $formproject = new FormProjets($db);
85  $formproject->selectTasks((!empty($socid) ? $socid : -1), 0, 'taskid', 24, 1, '1', 1, 0, 0, 'maxwidth500', GETPOST('projectid', 'int'), '');
86  return;
87 }
88 
89 
90 $db->close();
91 
92 print json_encode($arrayresult);
restrictedArea
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Definition: security.lib.php:234
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
FormProjets
Class to manage building of HTML components.
Definition: html.formprojet.class.php:30
top_httphead
if(!defined('NOREQUIREMENU')) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
Definition: main.inc.php:1407
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386