dolibarr 19.0.3
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
26if (!defined('NOTOKENRENEWAL')) {
27 define('NOTOKENRENEWAL', 1); // Disables token renewal
28}
29if (!defined('NOREQUIREMENU')) {
30 define('NOREQUIREMENU', '1');
31}
32if (!defined('NOREQUIREHTML')) {
33 define('NOREQUIREHTML', '1');
34}
35if (!defined('NOREQUIREAJAX')) {
36 define('NOREQUIREAJAX', '1');
37}
38if (!defined('NOREQUIRESOC')) {
39 define('NOREQUIRESOC', '1');
40}
41if (!defined('NOREQUIREHTML')) {
42 define('NOREQUIREHTML', '1');
43}
44
45// Load Dolibarr environment
46require '../../main.inc.php';
47
48$htmlname = GETPOST('htmlname', 'aZ09');
49$socid = GETPOST('socid', 'int');
50$mode = GETPOST('mode', 'aZ09');
51$discard_closed = GETPOST('discardclosed', 'int');
52
53// Security check
54restrictedArea($user, 'projet', 0, 'projet&project');
55
56/*
57 * View
58 */
59
60dol_syslog("Call ajax projet/ajax/projects.php");
61
62require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
63
64// Mode to get list of projects
65if (empty($mode) || $mode != 'gettasks') {
66 top_httphead('application/json');
67
68 // When used from jQuery, the search term is added as GET param "term".
69 $searchkey = (GETPOSTISSET($htmlname) ? GETPOST($htmlname, 'aZ09') : '');
70
71 $formproject = new FormProjets($db);
72 $arrayresult = $formproject->select_projects_list($socid, '', '', 0, 0, 1, $discard_closed, 0, 0, 1, $searchkey);
73
74 $db->close();
75
76 print json_encode($arrayresult);
77
78 return;
79}
80
81// Mode to get list of tasks
82// THIS MODE RETURNS HTML NOT JSON - THE CALL SHOULD BE UPDATE IN THE FUTURE
83if ($mode == 'gettasks') {
85
86 $formproject = new FormProjets($db);
87 $formproject->selectTasks((!empty($socid) ? $socid : -1), 0, 'taskid', 24, 1, '1', 1, 0, 0, 'maxwidth500', GETPOST('projectid', 'int'), '');
88
89 $db->close();
90
91 return;
92}
Class to manage building of HTML components.
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.