當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Sql::get_tasks_from_project_id方法代碼示例

本文整理匯總了PHP中Sql::get_tasks_from_project_id方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sql::get_tasks_from_project_id方法的具體用法?PHP Sql::get_tasks_from_project_id怎麽用?PHP Sql::get_tasks_from_project_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sql的用法示例。


在下文中一共展示了Sql::get_tasks_from_project_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

$project_owner = Sql::get_user_from_name($project_ownername);
if ($project_owner) {
    $project = Sql::get_project_from_url($project_owner->get_id(), $project_urlname);
}
$tasks = NULL;
$project_name = "<Unknown project>";
$project_owner_name = "<Unknown owner>";
$project_description = "This project does not exist yet.";
$project_id = 0;
$worked_per_week = -1;
$owner_logged_in = FALSE;
if ($project) {
    $project_name = $project->get_name();
    $project_description = $project->get_description();
    $project_id = $project->get_id();
    $tasks = Sql::get_tasks_from_project_id($project_id);
    $project_owner = Sql::get_user_from_id($project->get_owner_user_id());
    $owner_logged_in = Authentication::authenticate_user_by_cookie($project->get_owner_user_id());
    $worked_per_week = $project->get_worked_per_week();
    if ($project_owner) {
        $project_owner_name = $project_owner->get_name();
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title><?php 
echo $project_owner_name;
?>
/<?php 
開發者ID:rafaelbeckel,項目名稱:task-taste,代碼行數:31,代碼來源:manage-project.php

示例2: update_todays_remaining_work_authed

 /**
  * Update todays date with the given work change. If todays date
  * is 2011-01-23 and the remaining work size left that day is
  * 10.0, and this function is called with $work_change set to 2.0,
  * then after this function call the stored remaining work would
  * be changed to 12.0.
  *
  * The user must be authenticated.
  */
 public static function update_todays_remaining_work_authed($project_id, $work_change)
 {
     // Our dates are always UTC
     $todays_date = date('Y-m-d');
     $query = new SqlQuery("SELECT remaining_size FROM Remaining WHERE remaining_projectid='%s' AND remaining_date='%s' LIMIT 1", $project_id, $todays_date);
     if ($query->select_was_successful()) {
         // We've updated todays date before
         $update_mode = 'update';
         $last_size = $query->get_next_row_column('remaining_size');
     } else {
         // First time we update the time for this day, use size
         // from yesterday (or rather, last day we made an update)
         $update_mode = 'insert';
         $query = new SqlQuery("SELECT remaining_size FROM Remaining WHERE remaining_projectid='%s' LIMIT 1", $project_id);
         if ($query->select_was_successful()) {
             $last_size = $query->get_next_row_column('remaining_size');
         } else {
             // First update ever for the project, start at zero
             $last_size = 0.0;
         }
     }
     $new_size = 0;
     $tasks = Sql::get_tasks_from_project_id($project_id);
     foreach ((array) $tasks as $task) {
         $new_size += $task->get_size();
     }
     if ($update_mode == 'update') {
         $query = new SqlQuery("UPDATE Remaining SET remaining_size='%s' WHERE remaining_projectid='%s' AND remaining_date='%s' LIMIT 1", $new_size, $project_id, $todays_date);
     } else {
         $query = new SqlQuery("INSERT INTO Remaining (remaining_projectid, remaining_size, remaining_date) VALUES ('%s', '%s', '%s')", $project_id, $new_size, $todays_date);
     }
 }
開發者ID:rafaelbeckel,項目名稱:task-taste,代碼行數:41,代碼來源:sql.php


注:本文中的Sql::get_tasks_from_project_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。