本文整理汇总了PHP中Project::restrictedProjectArea方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::restrictedProjectArea方法的具体用法?PHP Project::restrictedProjectArea怎么用?PHP Project::restrictedProjectArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::restrictedProjectArea方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form
$sortfield = "name";
}
/*
* Actions
*/
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
/*
* View
*/
llxHeader('', $langs->trans('Project'), 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
$form = new Form($db);
if ($object->id > 0) {
$upload_dir = $conf->projet->dir_output . '/' . dol_sanitizeFileName($object->ref);
// To verify role of users
//$userAccess = $object->restrictedProjectArea($user,'read');
$userWrite = $object->restrictedProjectArea($user, 'write');
//$userDelete = $object->restrictedProjectArea($user,'delete');
//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
$head = project_prepare_head($object);
dol_fiche_head($head, 'document', $langs->trans("Project"), 0, $object->public ? 'projectpub' : 'project');
// Files list constructor
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\\.meta|_preview\\.png)$', $sortfield, strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC, 1);
$totalsize = 0;
foreach ($filearray as $key => $file) {
$totalsize += $file['size'];
}
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/projet/list.php">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td width="30%">' . $langs->trans("Ref") . '</td><td>';
// Define a complementary filter for search of next/prev ref.
示例2: Form
/*
* View
*/
llxHeader('', $langs->trans("Task"));
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
if ($id > 0 || !empty($ref)) {
if ($object->fetch($id, $ref) > 0) {
$res = $object->fetch_optionals($object->id, $extralabels);
$result = $projectstatic->fetch($object->fk_project);
if (!empty($projectstatic->socid)) {
$projectstatic->fetch_thirdparty();
}
$object->project = clone $projectstatic;
$userWrite = $projectstatic->restrictedProjectArea($user, 'write');
if (!empty($withproject)) {
// Tabs for project
$tab = 'tasks';
$head = project_prepare_head($projectstatic);
dol_fiche_head($head, $tab, $langs->trans("Project"), 0, $projectstatic->public ? 'projectpub' : 'project');
$param = $mode == 'mine' ? '&mode=mine' : '';
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="30%">';
print $langs->trans("Ref");
print '</td><td>';
// Define a complementary filter for search of next/prev ref.
if (!$user->rights->projet->all->lire) {
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0);
$projectstatic->next_prev_filter = " rowid in (" . (count($projectsListId) ? join(',', array_keys($projectsListId)) : '0') . ")";
示例3: restrictedArea
// Security check
$socid = 0;
if ($user->societe_id > 0) {
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'projet', $projectid);
/*
* View
*/
$help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
llxHeader("", $langs->trans("Referers"), $help_url);
$form = new Form($db);
$formproject = new FormProjets($db);
$userstatic = new User($db);
// To verify role of users
$userAccess = $project->restrictedProjectArea($user);
$head = project_prepare_head($project);
dol_fiche_head($head, 'element', $langs->trans("Project"), 0, $project->public ? 'projectpub' : 'project');
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/projet/list.php">' . $langs->trans("BackToList") . '</a>';
print '<tr><td width="30%">' . $langs->trans("Ref") . '</td><td>';
// Define a complementary filter for search of next/prev ref.
if (!$user->rights->projet->all->lire) {
$projectsListId = $project->getProjectsAuthorizedForUser($user, $mine, 0);
$project->next_prev_filter = " rowid in (" . (count($projectsListId) ? join(',', array_keys($projectsListId)) : '0') . ")";
}
print $form->showrefnav($project, 'ref', $linkback, 1, 'ref', 'ref');
print '</td></tr>';
print '<tr><td>' . $langs->trans("Label") . '</td><td>' . $project->title . '</td></tr>';
print '<tr><td>' . $langs->trans("ThirdParty") . '</td><td>';
if (!empty($project->thirdparty->id)) {
示例4:
print '<td class="liste_titre"valign="right">';
print '<input type="text" class="flat" name="search_societe" value="'.$_GET["search_societe"].'">';
print '</td>';
print '<td class="liste_titre"> </td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
print "</tr>\n";
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;
$userAccess = $projectstatic->restrictedProjectArea($user,1);
if ($userAccess >= 0)
{
$var=!$var;
print "<tr $bc[$var]>";
// Project url
print "<td>";
$projectstatic->ref = $objp->ref;
print $projectstatic->getNomUrl(1);
print "</td>";
// Title
print '<td>';
print dol_trunc($objp->title,24);
示例5:
{
$obj = $db->fetch_object($resql);
$projectstatic->id = $obj->projectid;
$projectstatic->ref = $obj->projectref;
$projectstatic->title = $obj->projecttitle;
$projectstatic->public = $obj->public;
$projectstatic->statut = $obj->projectstatus;
$taskstatic->id = $obj->id;
$taskstatic->ref = $obj->ref;
$taskstatic->label = $obj->label;
$taskstatic->fk_statut = $obj->fk_statut;
$taskstatic->progress = $obj->progress;
$userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
if ($userAccess >= 0)
{
$var=!$var;
print "<tr ".$bc[$var].">";
// Project url
if (! empty($arrayfields['p.ref']['checked']))
{
print '<td class="nowrap">';
print $projectstatic->getNomUrl(1, 'task');
print '</td>';
}
// Title
if (! empty($arrayfields['p.title']['checked']))
{
示例6: print_projecttasks_array
/**
* Return HTML table with list of projects and number of opened tasks
*
* @param DoliDB $db Database handler
* @param int $socid Id thirdparty
* @param int $projectsListId Id of project i have permission on
* @param int $mytasks Limited to task i am contact to
* @return void
*/
function print_projecttasks_array($db, $socid, $projectsListId, $mytasks = 0)
{
global $langs, $conf, $user, $bc;
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$projectstatic = new Project($db);
$sortfield = '';
$sortorder = '';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Project"), "index.php", "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Tasks"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Status"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print "</tr>\n";
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, COUNT(t.rowid) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
if ($mytasks) {
$sql .= ", " . MAIN_DB_PREFIX . "projet_task as t";
$sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec";
$sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc";
} else {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t ON p.rowid = t.fk_projet";
}
$sql .= " WHERE p.entity = " . $conf->entity;
$sql .= " AND p.rowid IN (" . $projectsListId . ")";
if ($socid) {
$sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")";
}
if ($mytasks) {
$sql .= " AND p.rowid = t.fk_projet";
$sql .= " AND ec.element_id = t.rowid";
$sql .= " AND ctc.rowid = ec.fk_c_type_contact";
$sql .= " AND ctc.element = 'project_task'";
$sql .= " AND ec.fk_socpeople = " . $user->id;
}
$sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut";
$sql .= " ORDER BY p.title, p.ref";
$var = true;
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;
// Check is user has read permission on project
$userAccess = $projectstatic->restrictedProjectArea($user);
if ($userAccess >= 0) {
$var = !$var;
print "<tr " . $bc[$var] . ">";
print '<td class="nowrap">';
$projectstatic->ref = $objp->ref;
print $projectstatic->getNomUrl(1);
print ' - ' . dol_trunc($objp->title, 24) . '</td>';
print '<td align="right">' . $objp->nb . '</td>';
$projectstatic->statut = $objp->fk_statut;
print '<td align="right">' . $projectstatic->getLibStatut(3) . '</td>';
print "</tr>\n";
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);
}
print "</table>";
}
示例7: print_projecttasks_array
//.........这里部分代码省略.........
$sql2 .= " ORDER BY p.title, p.ref";
$var = true;
$resql = $db->query($sql2);
if ($resql) {
$total_task = 0;
$total_opp_amount = 0;
$ponderated_opp_amount = 0;
$num = $db->num_rows($resql);
$i = 0;
print '<tr class="liste_titre">';
print_liste_field_titre($title . ' <span class="badge">' . $num . '</span>', $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ThirdParty"), $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder);
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print_liste_field_titre($langs->trans("OpportunityAmount"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("OpportunityStatus"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print_liste_field_titre($langs->trans("Tasks"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
if (!in_array('plannedworkload', $hiddenfields)) {
print_liste_field_titre($langs->trans("PlannedWorkload"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
}
if (!in_array('declaredprogress', $hiddenfields)) {
print_liste_field_titre($langs->trans("ProgressDeclared"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
}
}
print_liste_field_titre($langs->trans("Status"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print "</tr>\n";
while ($i < $num) {
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;
// Check is user has read permission on project
$userAccess = $projectstatic->restrictedProjectArea($user);
if ($userAccess >= 0) {
$var = !$var;
print "<tr " . $bc[$var] . ">";
print '<td>';
$projectstatic->ref = $objp->ref;
print $projectstatic->getNomUrl(1);
if (!in_array('projectlabel', $hiddenfields)) {
print ' - ' . dol_trunc($objp->title, 24);
}
print '</td>';
print '<td>';
if ($objp->fk_soc > 0) {
$thirdpartystatic->id = $objp->fk_soc;
$thirdpartystatic->ref = $objp->socname;
$thirdpartystatic->name = $objp->socname;
print $thirdpartystatic->getNomUrl(1);
}
print '</td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<td align="right">';
if ($objp->opp_amount) {
print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency);
}
print '</td>';
print '<td align="right">';
$code = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) {
print $langs->trans("OppStatus" . $code);
}
print '</td>';
}
$projectstatic->statut = $objp->status;
示例8: show_projects
/**
* Show html area for list of projects
*
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Database handler
* @param Object $object Third party object
* @param string $backtopage Url to go once contact is created
* @return void
*/
function show_projects($conf, $langs, $db, $object, $backtopage = '')
{
global $user;
global $bc;
$i = -1;
if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
$langs->load("projects");
$buttoncreate = '';
if (!empty($conf->projet->enabled) && $user->rights->projet->creer) {
//$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
$buttoncreate = '<a class="addnewrecord" href="' . DOL_URL_ROOT . '/projet/fiche.php?socid=' . $object->id . '&action=create&backtopage=' . urlencode($backtopage) . '">' . $langs->trans("AddProject");
if (empty($conf->dol_optimize_smallscreen)) {
$buttoncreate .= ' ' . img_picto($langs->trans("AddProject"), 'filenew');
}
$buttoncreate .= '</a>' . "\n";
}
print "\n";
print_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"), $buttoncreate, '');
print "\n" . '<table class="noborder" width=100%>';
$sql = "SELECT p.rowid,p.title,p.ref,p.public, p.dateo as do, p.datee as de";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
$sql .= " WHERE p.fk_soc = " . $object->id;
$sql .= " ORDER BY p.dateo DESC";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Ref") . '</td><td>' . $langs->trans("Name") . '</td><td align="center">' . $langs->trans("DateStart") . '</td><td align="center">' . $langs->trans("DateEnd") . '</td>';
print '</tr>';
if ($num > 0) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$projectstatic = new Project($db);
$i = 0;
$var = true;
while ($i < $num) {
$obj = $db->fetch_object($result);
$projectstatic->fetch($obj->rowid);
// To verify role of users
$userAccess = $projectstatic->restrictedProjectArea($user);
if ($user->rights->projet->lire && $userAccess > 0) {
$var = !$var;
print "<tr " . $bc[$var] . ">";
// Ref
print '<td><a href="' . DOL_URL_ROOT . '/projet/fiche.php?id=' . $obj->rowid . '">' . img_object($langs->trans("ShowProject"), $obj->public ? 'projectpub' : 'project') . " " . $obj->ref . '</a></td>';
// Label
print '<td>' . $obj->title . '</td>';
// Date start
print '<td align="center">' . dol_print_date($db->jdate($obj->do), "day") . '</td>';
// Date end
print '<td align="center">' . dol_print_date($db->jdate($obj->de), "day") . '</td>';
print '</tr>';
}
$i++;
}
} else {
print '<tr><td colspan="3">' . $langs->trans("None") . '</td></tr>';
}
$db->free($result);
} else {
dol_print_error($db);
}
print "</table>";
print "<br>\n";
}
return $i;
}
示例9: print_projecttasks_array
/**
* Return HTML table with list of projects and number of opened tasks
*
* @param DoliDB $db Database handler
* @param Form $form Object form
* @param int $socid Id thirdparty
* @param int $projectsListId Id of project i have permission on
* @param int $mytasks Limited to task i am contact to
* @param int $statut -1=No filter on statut, 0 or 1 = Filter on status
* @param array $listofoppstatus List of opportunity status
* @return void
*/
function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $statut = -1, $listofoppstatus = array())
{
global $langs, $conf, $user, $bc;
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$projectstatic = new Project($db);
$sortfield = '';
$sortorder = '';
$project_year_filter = 0;
$title = $langs->trans("Projects");
if (strcmp($statut, '') && $statut >= 0) {
$title = $langs->trans("Projects") . ' ' . $langs->trans($projectstatic->statuts_long[$statut]);
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($title, "index.php", "", "", "", "", $sortfield, $sortorder);
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print_liste_field_titre($langs->trans("OpportunityAmount"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("OpportunityStatus"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
print_liste_field_titre($langs->trans("Tasks"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
}
print_liste_field_titre($langs->trans("Status"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print "</tr>\n";
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount, COUNT(DISTINCT t.rowid) as nb";
// We use DISTINCT here because line can be doubled if task has 2 links to same user
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
if ($mytasks) {
$sql .= ", " . MAIN_DB_PREFIX . "projet_task as t";
$sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec";
$sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc";
} else {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t ON p.rowid = t.fk_projet";
}
$sql .= " WHERE p.entity = " . $conf->entity;
$sql .= " AND p.rowid IN (" . $projectsListId . ")";
if ($socid) {
$sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")";
}
if ($mytasks) {
$sql .= " AND p.rowid = t.fk_projet";
$sql .= " AND ec.element_id = t.rowid";
$sql .= " AND ctc.rowid = ec.fk_c_type_contact";
$sql .= " AND ctc.element = 'project_task'";
$sql .= " AND ec.fk_socpeople = " . $user->id;
}
if ($statut >= 0) {
$sql .= " AND p.fk_statut = " . $statut;
}
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
$project_year_filter = GETPOST("project_year_filter");
//Check if empty or invalid year. Wildcard ignores the sql check
if ($project_year_filter != "*") {
if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
$project_year_filter = date("Y");
}
$sql .= " AND (p.dateo IS NULL OR p.dateo <= " . $db->idate(dol_get_last_day($project_year_filter, 12, false)) . ")";
$sql .= " AND (p.datee IS NULL OR p.datee >= " . $db->idate(dol_get_first_day($project_year_filter, 1, false)) . ")";
}
}
$sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount";
$sql .= " ORDER BY p.title, p.ref";
$var = true;
$resql = $db->query($sql);
if ($resql) {
$total_task = 0;
$total_opp_amount = 0;
$ponderated_opp_amount = 0;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;
// Check is user has read permission on project
$userAccess = $projectstatic->restrictedProjectArea($user);
if ($userAccess >= 0) {
$var = !$var;
print "<tr " . $bc[$var] . ">";
print '<td class="nowrap">';
$projectstatic->ref = $objp->ref;
print $projectstatic->getNomUrl(1);
print ' - ' . dol_trunc($objp->title, 24) . '</td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<td align="right">';
if ($objp->opp_amount) {
print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency);
//.........这里部分代码省略.........
示例10: print_projecttasks_array
/**
* Return HTML table with list of projects and number of opened tasks
*
* @param DoliDB $db Database handler
* @param int $socid Id thirdparty
* @param int $projectsListId Id of project i have permission on
* @param int $mytasks Limited to task i am contact to
* @param int $statut -1=No filter on statut, 0 or 1 = Filter on status
* @return void
*/
function print_projecttasks_array($db, $socid, $projectsListId, $mytasks = 0, $statut = -1)
{
global $langs, $conf, $user, $bc;
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
$projectstatic = new Project($db);
$sortfield = '';
$sortorder = '';
$project_year_filter = 0;
$title = $langs->trans("Project");
if ($statut == 0) {
$title = $langs->trans("ProjectDraft");
}
if ($statut == 1) {
$title = $langs->trans("Project") . ' (' . $langs->trans("Validated") . ')';
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($title, "index.php", "", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Tasks"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Status"), "", "", "", "", 'align="right"', $sortfield, $sortorder);
print "</tr>\n";
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut, COUNT(t.rowid) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
if ($mytasks) {
$sql .= ", " . MAIN_DB_PREFIX . "projet_task as t";
$sql .= ", " . MAIN_DB_PREFIX . "element_contact as ec";
$sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc";
} else {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet_task as t ON p.rowid = t.fk_projet";
}
$sql .= " WHERE p.entity = " . $conf->entity;
$sql .= " AND p.rowid IN (" . $projectsListId . ")";
if ($socid) {
$sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")";
}
if ($mytasks) {
$sql .= " AND p.rowid = t.fk_projet";
$sql .= " AND ec.element_id = t.rowid";
$sql .= " AND ctc.rowid = ec.fk_c_type_contact";
$sql .= " AND ctc.element = 'project_task'";
$sql .= " AND ec.fk_socpeople = " . $user->id;
}
if ($statut >= 0) {
$sql .= " AND p.fk_statut = " . $statut;
}
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
$project_year_filter = GETPOST("project_year_filter");
//Check if empty or invalid year. Wildcard ignores the sql check
if ($project_year_filter != "*") {
if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
//
$project_year_filter = date("Y");
}
$sql .= " AND (p.dateo IS NULL OR p.dateo <= " . $db->idate(dol_get_last_day($project_year_filter, 12, false)) . ")";
$sql .= " AND (p.datee IS NULL OR p.datee >= " . $db->idate(dol_get_first_day($project_year_filter, 1, false)) . ")";
}
}
$sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut";
$sql .= " ORDER BY p.title, p.ref";
$var = true;
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($resql);
$projectstatic->id = $objp->projectid;
$projectstatic->user_author_id = $objp->fk_user_creat;
$projectstatic->public = $objp->public;
// Check is user has read permission on project
$userAccess = $projectstatic->restrictedProjectArea($user);
if ($userAccess >= 0) {
$var = !$var;
print "<tr " . $bc[$var] . ">";
print '<td class="nowrap">';
$projectstatic->ref = $objp->ref;
print $projectstatic->getNomUrl(1);
print ' - ' . dol_trunc($objp->title, 24) . '</td>';
print '<td align="right">' . $objp->nb . '</td>';
$projectstatic->statut = $objp->fk_statut;
print '<td align="right">' . $projectstatic->getLibStatut(3) . '</td>';
print "</tr>\n";
}
$i++;
}
$db->free($resql);
} else {
dol_print_error($db);
}
print "</table>";
//.........这里部分代码省略.........