本文整理汇总了PHP中Task::getUserRolesForProjectsOrTasks方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::getUserRolesForProjectsOrTasks方法的具体用法?PHP Task::getUserRolesForProjectsOrTasks怎么用?PHP Task::getUserRolesForProjectsOrTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::getUserRolesForProjectsOrTasks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
// Show description of content
if ($mine) print $langs->trans("MyProjectsDesc").'<br><br>';
else
{
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").'<br><br>';
else print $langs->trans("ProjectsPublicDesc").'<br><br>';
}
// Get list of project id allowed to user
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
// Get list of tasks in tasksarray and taskarrayfiltered
// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_product);
// We load also tasks limited to a particular user
$tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : '');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="mode" value="'.GETPOST('mode').'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Project").'</td>';
print '<td width="80">'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td align="center">'.$langs->trans("DateStart").'</td>';
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
print '<td align="right">'.$langs->trans("Progress").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print "</tr>\n";
示例2:
print '<table width="100%"><tr><td align="right">';
if ($mode == 'mine') {
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">' . $langs->trans("DoNotShowMyTasksOnly") . '</a>';
//print ' - ';
//print $langs->trans("ShowMyTaskOnly");
} else {
//print $langs->trans("DoNotShowMyTaskOnly");
//print ' - ';
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&mode=mine">' . $langs->trans("ShowMyTasksOnly") . '</a>';
}
print '</td></tr></table>';
// Get list of tasks in tasksarray and taskarrayfiltered
// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
$tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
// We load also tasks limited to a particular user
$tasksrole = $mode == 'mine' ? $taskstatic->getUserRolesForProjectsOrTasks(0, $user, $object->id, 0) : '';
//var_dump($tasksarray);
//var_dump($tasksrole);
if (!empty($conf->use_javascript_ajax)) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
print '<table id="tablelines" class="noborder" width="100%">';
print '<tr class="liste_titre nodrag nodrop">';
// print '<td>'.$langs->trans("Project").'</td>';
print '<td width="100">' . $langs->trans("RefTask") . '</td>';
print '<td>' . $langs->trans("LabelTask") . '</td>';
print '<td align="center">' . $langs->trans("DateStart") . '</td>';
print '<td align="center">' . $langs->trans("DateEnd") . '</td>';
print '<td align="right">' . $langs->trans("PlannedWorkload") . '</td>';
print '<td align="right">' . $langs->trans("ProgressDeclared") . '</td>';
print '<td align="right">' . $langs->trans("TimeSpent") . '</td>';
示例3:
$title = $langs->trans("TimeSpent");
if ($mine) {
$title = $langs->trans("MyTimeSpent");
}
$usertoprocess = $user;
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess, 0, 1);
// Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
if ($id) {
$project->fetch($id);
$project->fetch_thirdparty();
}
$onlyopenedproject = 1;
// or -1
$tasksarray = $taskstatic->getTasksArray(0, 0, $project->id ? $project->id : 0, $socid, 0, '', $onlyopenedproject);
// We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, $project->id ? $project->id : 0, 0, $onlyopenedproject);
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, $project->id ? $project->id : 0, 0, $onlyopenedproject);
//var_dump($tasksarray);
//var_dump($projectsrole);
//var_dump($taskrole);
llxHeader("", $title, "");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, '', 'title_project');
$param = $mode ? '&mode=' . $mode : '';
// Show navigation bar
$nav = "<a href=\"?year=" . $prev_year . "&month=" . $prev_month . "&day=" . $prev_day . $param . "\">" . img_previous($langs->trans("Previous")) . "</a>\n";
$nav .= " <span id=\"month_name\">" . dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "day") . " </span>\n";
$nav .= "<a href=\"?year=" . $next_year . "&month=" . $next_month . "&day=" . $next_day . $param . "\">" . img_next($langs->trans("Next")) . "</a>\n";
$nav .= " (<a href=\"?year=" . $nowyear . "&month=" . $nowmonth . "&day=" . $nowday . $param . "\">" . $langs->trans("Today") . "</a>)";
$nav .= '<br>' . $form->select_date(-1, '', 0, 0, 2, "addtime", 1, 0, 1) . ' ';
$nav .= ' <input type="submit" name="submitdateselect" class="button" value="' . $langs->trans("Refresh") . '">';
$picto = 'calendarweek';
示例4: foreach
//var_dump($projectsListId);
// Get list of tasks in tasksarray and taskarrayfiltered
// We need all tasks (even not limited to a user because a task assigned to a user can have a parent that is not assigned to him and we need such parents).
$morewherefilter = '';
if ($search_all) {
$morewherefilter .= natural_search(array_keys($fieldstosearchall), $search_all);
}
if ($search_task_ref) {
$morewherefilter .= natural_search('t.ref', $search_task_ref);
}
if ($search_task_label) {
$morewherefilter .= natural_search('t.label', $search_task_label);
}
$tasksarray = $taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status, $morewherefilter, $search_project_user, 0);
// We don't use filter on task user. Because sometimes a task is assigned but not the parent one and we want to show also parent, so filtering is done during output
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $tuser->id ? $tuser : null, $projectstatic->id, 0, $search_status);
// We load also tasks limited to a particular user
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
}
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
print '<input type="hidden" name="type" value="' . $type . '">';
if ($search_all) {
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
}
print $langs->trans("FilterOnInto", $search_all, join(', ', $fieldstosearchall));
示例5:
$title = $langs->trans("TimeSpent");
if ($mine) {
$title = $langs->trans("MyTimeSpent");
}
//$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1);
// Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
if ($id) {
$project->fetch($id);
$project->fetch_thirdparty();
}
$onlyopened = 1;
// or -1
$tasksarray = $taskstatic->getTasksArray(0, 0, $project->id ? $project->id : $projectsListId, $socid, 0, '', $onlyopened);
// We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later.
$projectsrole = $taskstatic->getUserRolesForProjectsOrTasks($user, 0, $project->id ? $project->id : $projectsListId, 0);
$tasksrole = $taskstatic->getUserRolesForProjectsOrTasks(0, $user, $project->id ? $project->id : $projectsListId, 0);
//var_dump($tasksarray);
//var_dump($projectsrole);
//var_dump($taskrole);
llxHeader("", $title, "");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
// Show description of content
if ($mine) {
print $langs->trans("MyTasksDesc") . ($onlyopened ? ' ' . $langs->trans("OnlyOpenedProject") : '') . '<br><br>';
} else {
if ($user->rights->projet->all->lire && !$socid) {
print $langs->trans("ProjectsDesc") . ($onlyopened ? ' ' . $langs->trans("OnlyOpenedProject") : '') . '<br><br>';
} else {
print $langs->trans("ProjectsPublicTaskDesc") . ($onlyopened ? ' ' . $langs->trans("AlsoOnlyOpenedProject") : '') . '<br><br>';
}
示例6:
//print $langs->trans("ShowMyTaskOnly");
}
else
{
//print $langs->trans("DoNotShowMyTaskOnly");
//print ' - ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$project->id.'&mode=mine">'.$langs->trans("ShowMyTasksOnly").'</a>';
}
print '</td></tr></table>';
// Get list of tasks in tasksarray and taskarrayfiltered
// We need all tasks (even not limited to a user because a task to user
// can have a parent that is not affected to him).
$tasksarray=$task->getTasksArray(0, 0, $project->id, $socid, 0);
// We load also tasks limited to a particular user
$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getUserRolesForProjectsOrTasks(0,$user,$project->id,0) : '');
//var_dump($tasksarray);
//var_dump($tasksrole);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
if ($projectstatic->id) print '<td>'.$langs->trans("Project").'</td>';
print '<td width="80">'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td align="right">'.$langs->trans("Progress").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print "</tr>\n";
if (sizeof($tasksarray) > 0)
{
// Show all lines in taskarray (recursive function to go down on tree)
$j=0;