本文整理汇总了PHP中task::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP task::assign方法的具体用法?PHP task::assign怎么用?PHP task::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类task
的用法示例。
在下文中一共展示了task::assign方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArrayVal
$uprojects = getArrayVal($_POST, "uprojects");
$proarr = array();
foreach ($uprojects as $upro) {
$dat = explode("#", $upro);
$todo = array("project" => $dat[0], "user" => $dat[1]);
array_push($proarr, $todo);
}
if (!empty($proarr)) {
$task = new task();
foreach ($proarr as $proj) {
$tasks = $task->getAllMyProjectTasks($proj["project"], 100, $id);
if ($proj["project"] > 0 and $proj["user"] > 0) {
if (!empty($tasks)) {
foreach ($tasks as $mytask) {
if ($task->deassign($mytask["ID"], $id)) {
$task->assign($mytask["ID"], $proj["user"]);
}
}
}
} else {
if (!empty($tasks)) {
foreach ($tasks as $mytask) {
$task->del($mytask["ID"]);
}
}
}
}
}
if ($user->del($id)) {
header("Location: admin.php?action=users&mode=deleted");
}
示例2: elseif
$template->display("deassignuserform.tpl");
} elseif ($action == "deassign") {
if (!$userpermissions["projects"]["edit"]) {
$errtxt = $langfile["nopermission"];
$noperm = $langfile["accessdenied"];
$template->assign("errortext", "{$errtxt}<br>{$noperm}");
$template->display("error.tpl");
die;
}
$task = new task();
$tasks = $task->getAllMyProjectTasks($id, 100, $usr);
if ($id > 0 and $assignto > 0) {
if (!empty($tasks)) {
foreach ($tasks as $mytask) {
if ($task->deassign($mytask["ID"], $usr)) {
$task->assign($mytask["ID"], $assignto);
}
}
}
} else {
if (!empty($tasks)) {
foreach ($tasks as $mytask) {
$task->del($mytask["ID"]);
}
}
}
if ($project->deassign($usr, $id)) {
if ($redir) {
$redir = $url . $redir;
$redir = $redir . "&mode=deassigned";
header("Location: {$redir}");
示例3: addProjectFromExcel
function addProjectFromExcel($inputFileName)
{
include "./include/PHPExcel/IOFactory.php";
$objReader = new PHPExcel_Reader_Excel2007();
$objPHPExcel = $objReader->load($inputFileName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
$limiter = "#";
$projectObj = new project();
$userObj = new user();
$milestoneObj = new milestone();
$tasklistObj = new tasklist();
$taskObj = new task();
$companyObj = new company();
$projectname = $sheetData[2]["A"];
$projectdescription = $sheetData[3]["A"];
$projectdue = $sheetData[4]["A"];
$projectbudget = $sheetData[5]["A"];
$projectcustomer = $sheetData[6]["A"];
$projectpriority = $sheetData[7]["A"];
$projectId = $projectObj->add($projectname, $projectdescription, $projectdue, $projectbudget, $projectpriority);
$customer = $companyObj->getCompanyByName($projectcustomer);
if ($customer) {
$companyObj->assign($customer["ID"], $projectId);
}
// USERS
for ($i = 1; $i < count($sheetData); $i++) {
$username = $sheetData[$i]["B"];
if ($username) {
$user = $userObj->getUserByName($username);
if ($user) {
$projectObj->assign($user["ID"], $projectId);
}
} else {
break;
}
}
// MILESTONES
for ($i = 1; $i < count($sheetData); $i++) {
$milestone = explode($limiter, $sheetData[$i]["C"]);
if ($milestone) {
$milestoneObj->add($projectId, $milestone[0], $milestone[1], $milestone[2], $milestone[3]);
} else {
break;
}
}
// TASK LISTS
for ($i = 1; $i < count($sheetData); $i++) {
$tasklist = explode($limiter, $sheetData[$i]["D"]);
if ($tasklist) {
if ($tasklist[3]) {
$milestone = $milestoneObj->getMilestoneByName($tasklist[3]);
if ($milestone) {
$tasklistObj->add_liste($projectId, $tasklist[0], $tasklist[1], $tasklist[2], 0, $milestone["ID"]);
}
} else {
$tasklistObj->add_liste($projectId, $tasklist[0], $tasklist[1], $tasklist[2]);
}
} else {
break;
}
}
// TASKS
for ($i = 1; $i < count($sheetData); $i++) {
$task = explode($limiter, $sheetData[$i]["E"]);
if ($task) {
$tasklist = $tasklistObj->getTasklistByName($task[5]);
$taskid = $taskObj->add($task[2], $task[3], $task[0], $task[4], $tasklist["ID"], $projectId, $task[6], $task[7]);
$user = $userObj->getUserByName($task[1]);
if ($taskid) {
if ($user) {
$taskObj->assign($taskid, $user["ID"]);
}
}
} else {
break;
}
}
return $projectId;
}