本文整理匯總了PHP中task::close方法的典型用法代碼示例。如果您正苦於以下問題:PHP task::close方法的具體用法?PHP task::close怎麽用?PHP task::close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類task
的用法示例。
在下文中一共展示了task::close方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: count
/**
* Finish / close a tasklist
*
*
* @param int $id Tasklist ID
* @param bool $closeMilestones Determines if the parent milestone is closed too if $id is the last assigned tasklist to that ms
* @return bool
*/
function close_liste($id, $closeMilestones = true)
{
global $conn, $mylog;
$id = (int) $id;
$updStmt = $conn->prepare("UPDATE tasklist SET status = 0 WHERE ID = ?");
$upd = $updStmt->execute(array($id));
if ($closeMilestones) {
// Close assigned milestone too, if no other open tasklists are assigned to it
$milestone = $conn->query("SELECT milestone FROM tasklist WHERE ID = {$id}")->fetch();
if ($milestone[0] > 0) {
$cou = $conn->query("SELECT count(*) FROM tasklist WHERE milestone = {$milestone['0']} AND status = 1")->fetch();
if ($cou[0] == 0) {
$miles = new milestone();
$miles->close($milestone[0]);
}
}
}
// Close tasks in this list
$tasks = $this->getTasksFromList($id);
if (!empty($tasks)) {
$taskobj = new task();
foreach ($tasks as $task) {
$taskobj->close($task["ID"]);
}
}
// Log entry
if ($upd) {
$nam = $conn->query("SELECT project, name FROM tasklist WHERE ID = {$id}")->fetch();
$project = $nam[0];
$name = $nam[1];
$mylog->add($name, 'tasklist', 5, $project);
return true;
} else {
return false;
}
}
示例2: count
/**
* Finish / close a tasklist
*
* @param int $id Tasklist ID
* @return bool
*/
function close_liste($id)
{
$id = (int) $id;
$upd = mysql_query("UPDATE tasklist SET status = 0 WHERE ID = {$id}");
// Close assigned milestone too, if no other open tasklists are assigned to it
$sql = mysql_query("SELECT milestone FROM tasklist WHERE ID = {$id}");
$milestone = mysql_fetch_row($sql);
if ($milestone[0] > 0) {
$sql2 = mysql_query("SELECT count(*) FROM tasklist WHERE milestone = {$milestone['0']} AND status = 1");
$cou = mysql_fetch_row($sql2);
if ($cou[0] == 0) {
$miles = new milestone();
$miles->close($milestone[0]);
}
}
$tasks = $this->getTasksFromList($id);
if (!empty($tasks)) {
$taskobj = new task();
foreach ($tasks as $task) {
$taskobj->close($task["ID"]);
}
}
// Log entry
if ($upd) {
$nam = mysql_query("SELECT project, name FROM tasklist WHERE ID = {$id}");
$nam = mysql_fetch_row($nam);
$project = $nam[0];
$name = $nam[1];
$this->mylog->add($name, 'tasklist', 5, $project);
return true;
} else {
return false;
}
}