dolibarr 21.0.0-beta
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 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
27if (!defined('NOTOKENRENEWAL')) {
28 define('NOTOKENRENEWAL', 1); // Disables token renewal
29}
30if (!defined('NOREQUIREMENU')) {
31 define('NOREQUIREMENU', '1');
32}
33if (!defined('NOREQUIREHTML')) {
34 define('NOREQUIREHTML', '1');
35}
36if (!defined('NOREQUIREAJAX')) {
37 define('NOREQUIREAJAX', '1');
38}
39if (!defined('NOREQUIRESOC')) {
40 define('NOREQUIRESOC', '1');
41}
42if (!defined('NOREQUIREHTML')) {
43 define('NOREQUIREHTML', '1');
44}
45
46// Load Dolibarr environment
47require '../../main.inc.php';
48
57$htmlname = GETPOST('htmlname', 'aZ09');
58$socid = GETPOSTINT('socid');
59$mode = GETPOST('mode', 'aZ09');
60$discard_closed = GETPOSTINT('discardclosed');
61
62// Security check
63restrictedArea($user, 'projet', 0, 'projet&project');
64
65/*
66 * View
67 */
68
69dol_syslog("Call ajax projet/ajax/projects.php");
70
71require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
72
73// Mode to get list of projects
74if (empty($mode) || $mode != 'gettasks') {
75 top_httphead('application/json');
76
77 // When used from jQuery, the search term is added as GET param "term".
78 $searchkey = (GETPOSTISSET($htmlname) ? GETPOST($htmlname, 'aZ09') : '');
79
80 $formproject = new FormProjets($db);
81 $arrayresult = $formproject->select_projects_list($socid, '', '', 0, 0, 1, $discard_closed, 0, 0, 1, $searchkey);
82
83 $db->close();
84
85 print json_encode($arrayresult);
86
87 return;
88}
89
90// Mode to get list of tasks
91// THIS MODE RETURNS HTML NOT JSON - THE CALL SHOULD BE UPDATE IN THE FUTURE
92if ($mode == 'gettasks') {
94
95 $formproject = new FormProjets($db);
96 $formproject->selectTasks((!empty($socid) ? $socid : -1), 0, 'taskid', 24, 1, '1', 1, 0, 0, 'maxwidth500', GETPOSTINT('projectid'), '');
97
98 $db->close();
99
100 return;
101}
Class to manage building of HTML components.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
restrictedArea(User $user, $features, $object=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.