本文整理汇总了PHP中project::read_db_record方法的典型用法代码示例。如果您正苦于以下问题:PHP project::read_db_record方法的具体用法?PHP project::read_db_record怎么用?PHP project::read_db_record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类project
的用法示例。
在下文中一共展示了project::read_db_record方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_timeSheetItems
function show_timeSheetItems($template_name)
{
global $date_to_view;
$current_user =& singleton("current_user");
global $TPL;
$query = prepare("SELECT * \n FROM timeSheetItem \n LEFT JOIN timeSheet ON timeSheetItem.timeSheetID = timeSheet.timeSheetID\n LEFT JOIN project ON timeSheet.projectID = project.projectID\n WHERE dateTimeSheetItem='%s'\n AND timeSheet.personID=%d", date("Y-m-d", $date_to_view), $current_user->get_id());
$db = new db_alloc();
$db->query($query);
while ($db->next_record()) {
$timeSheetItem = new timeSheetItem();
$timeSheetItem->read_db_record($db);
$timeSheetItem->set_values();
if ($timeSheetItem->get_value("unit") == "Hour") {
$TPL["daily_hours_total"] += $timeSheetItem->get_value("timeSheetItemDuration");
}
$project = new project();
$project->read_db_record($db);
$project->set_values();
if ($project->get_value("projectShortName")) {
$TPL["item_description"] = $project->get_value("projectShortName");
} else {
$TPL["item_description"] = $project->get_value("projectName");
}
include_template($template_name);
}
}
示例2: date
function project_stats()
{
// date from which a project is counted as being new. if monday then date back to friday, else the previous day
$days = date("w") == 1 ? 3 : 1;
$date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - $days, date("Y")));
$query = "SELECT * FROM project";
$db = new db_alloc();
$db_sub = new db_alloc();
$db->query($query);
while ($db->next_record()) {
$project = new project();
$project->read_db_record($db);
$this->projects["total"]["total"]++;
switch ($project->get_value("projectStatus")) {
case "current":
case "overdue":
$this->projects["current"]["total"]++;
break;
case "archived":
$this->projects["archived"]["total"]++;
break;
}
$query = prepare("SELECT * FROM projectPerson WHERE projectID=%d", $project->get_id());
$db_sub->query($query);
while ($db_sub->next_record()) {
$projectPerson = new projectPerson();
$projectPerson->read_db_record($db_sub);
$this->projects["total"][$projectPerson->get_value("personID")]++;
switch ($project->get_value("projectStatus")) {
case "current":
case "overdue":
$this->projects["current"][$projectPerson->get_value("personID")]++;
break;
case "archived":
$this->projects["archived"][$projectPerson->get_value("personID")]++;
break;
}
if ($project->get_value("dateActualStart") != "") {
if (!isset($this->projects["all"][$projectPerson->get_value("personID")])) {
$this->projects["all"][$projectPerson->get_value("personID")] = array();
}
$this->projects["all"][$projectPerson->get_value("personID")][$project->get_value("dateActualStart")]++;
$this->projects["all"][$projectPerson->get_value("personID")]["total"]++;
$this->projects["all"]["total"][$project->get_value("dateActualStart")]++;
if (strcmp($date, $project->get_value("dateActualStart")) <= 0) {
if (!isset($this->projects["new"][$projectPerson->get_value("personID")])) {
$this->projects["new"][$projectPerson->get_value("personID")] = array();
}
$this->projects["new"][$projectPerson->get_value("personID")][$project->get_value("dateActualStart")]++;
$this->projects["new"][$projectPerson->get_value("personID")]["total"]++;
$this->projects["new"]["total"][$project->get_value("dateActualStart")]++;
}
}
}
}
return $this->projects;
}
示例3: while
while ($db->next_record()) {
$client = new client();
$client->read_db_record($db);
$parent_names[$client->get_id()] = $client->get_value('clientName');
}
} else {
if ($parentType == "project") {
if ($current_user->have_role("admin")) {
$query = "SELECT * FROM project WHERE projectStatus != 'Archived' ORDER BY projectName";
} else {
$query = prepare("SELECT * \n FROM project \n LEFT JOIN projectPerson ON project.projectID=projectPerson.projectID \n WHERE personID='%d' \n AND projectStatus != 'Archived'\n ORDER BY projectName", $personID);
}
$db->query($query);
while ($db->next_record()) {
$project = new project();
$project->read_db_record($db);
$parent_names[$project->get_id()] = $project->get_value('projectName');
}
} else {
if ($parentType == "task") {
if ($current_user->have_role("admin")) {
$query = "SELECT * FROM task";
} else {
$query = prepare("SELECT * FROM task WHERE personID=%d ORDER BY taskName", $personID);
}
$db->query($query);
while ($db->next_record()) {
$task = new task();
$task->read_db_record($db);
if (substr($task->get_value("taskStatus"), 0, 6) != "closed") {
$parent_names[$task->get_id()] = $task->get_value('taskName');
示例4: get_list
public static function get_list($_FORM)
{
/*
* This is the definitive method of getting a list of timeSheets that need a sophisticated level of filtering
*
*/
global $TPL;
$current_user =& singleton("current_user");
$_FORM["showShortProjectLink"] and $_FORM["showProjectLink"] = true;
$filter = timeSheet::get_list_filter($_FORM);
// Used in timeSheetListS.tpl
$extra["showFinances"] = $_FORM["showFinances"];
$debug = $_FORM["debug"];
$debug and print "<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
$debug and print "<pre>filter: " . print_r($filter, 1) . "</pre>";
$_FORM["return"] or $_FORM["return"] = "html";
if (is_array($filter) && count($filter)) {
$filter = " WHERE " . implode(" AND ", $filter);
}
$q = "SELECT timeSheet.*, person.personID, projectName, projectShortName\n FROM timeSheet \n LEFT JOIN person ON timeSheet.personID = person.personID\n LEFT JOIN project ON timeSheet.projectID = project.projectID\n LEFT JOIN timeSheetItem ON timeSheet.timeSheetID = timeSheetItem.timeSheetID \n " . $filter . "\n GROUP BY timeSheet.timeSheetID\n ORDER BY dateFrom,projectName,timeSheet.status,surname";
$debug and print "Query: " . $q;
$db = new db_alloc();
$db->query($q);
$status_array = timeSheet::get_timeSheet_statii();
$people_array =& get_cached_table("person");
while ($row = $db->next_record()) {
$t = new timeSheet();
if (!$t->read_db_record($db)) {
continue;
}
$t->load_pay_info();
if ($_FORM["timeSheetItemHours"] && !parse_operator_comparison($_FORM["timeSheetItemHours"], $t->pay_info["total_duration_hours"])) {
continue;
}
$row["currencyTypeID"] = $t->get_value("currencyTypeID");
$row["amount"] = $t->pay_info["total_dollars"];
$amount_tallies[] = array("amount" => $row["amount"], "currency" => $row["currencyTypeID"]);
$extra["amountTotal"] += exchangeRate::convert($row["currencyTypeID"], $row["amount"]);
$extra["totalHours"] += $t->pay_info["total_duration_hours"];
$row["totalHours"] += $t->pay_info["total_duration_hours"];
$row["duration"] = $t->pay_info["summary_unit_totals"];
if ($t->get_value("status") == "edit" && imp($current_user->prefs["timeSheetHoursWarn"]) && $t->pay_info["total_duration_hours"] >= $current_user->prefs["timeSheetHoursWarn"]) {
$row["hoursWarn"] = page::help("This time sheet has gone over " . $current_user->prefs["timeSheetHoursWarn"] . " hours.", page::warn());
}
if ($t->get_value("status") == "edit" && imp($current_user->prefs["timeSheetDaysWarn"]) && (mktime() - format_date("U", $t->get_value("dateFrom"))) / 60 / 60 / 24 >= $current_user->prefs["timeSheetDaysWarn"]) {
$row["daysWarn"] = page::help("This time sheet is over " . $current_user->prefs["timeSheetDaysWarn"] . " days old.", page::warn());
}
$row["person"] = $people_array[$row["personID"]]["name"];
$row["status"] = $status_array[$row["status"]];
$row["customerBilledDollars"] = $t->pay_info["total_customerBilledDollars"];
$extra["customerBilledDollarsTotal"] += exchangeRate::convert($row["currencyTypeID"], $t->pay_info["total_customerBilledDollars"]);
$billed_tallies[] = array("amount" => $row["customerBilledDollars"], "currency" => $row["currencyTypeID"]);
if ($_FORM["showFinances"]) {
list($pos, $neg) = $t->get_transaction_totals();
$row["transactionsPos"] = page::money_print($pos);
$row["transactionsNeg"] = page::money_print($neg);
foreach ((array) $pos as $v) {
$pos_tallies[] = $v;
}
foreach ((array) $neg as $v) {
$neg_tallies[] = $v;
}
}
$p = new project();
$p->read_db_record($db);
$row["projectLink"] = $t->get_link($p->get_name($_FORM));
$rows[$row["timeSheetID"]] = $row;
}
$extra["amount_tallies"] = page::money_print($amount_tallies);
$extra["billed_tallies"] = page::money_print($billed_tallies);
$extra["positive_tallies"] = page::money_print($pos_tallies);
$extra["negative_tallies"] = page::money_print($neg_tallies);
if (!$_FORM["noextra"]) {
return array("rows" => (array) $rows, "extra" => $extra);
} else {
return (array) $rows;
}
}
示例5: get_list
public static function get_list($_FORM)
{
/*
* This is the definitive method of getting a list of projects that need a sophisticated level of filtering
*
*/
global $TPL;
$filter = project::get_list_filter($_FORM);
$debug = $_FORM["debug"];
$debug and print "<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
$debug and print "<pre>filter: " . print_r($filter, 1) . "</pre>";
$_FORM["return"] or $_FORM["return"] = "html";
if ($_FORM["personID"]) {
$from .= " LEFT JOIN projectPerson on projectPerson.projectID = project.projectID ";
}
if (is_array($filter) && count($filter)) {
$filter = " WHERE " . implode(" AND ", $filter);
}
$q = "SELECT project.*, client.* \n FROM project" . $from . "\n LEFT JOIN client ON project.clientID = client.clientID \n " . $filter . " \n GROUP BY project.projectID \n ORDER BY projectName";
// Zero is a valid limit
if ($_FORM["limit"] || $_FORM["limit"] === 0 || $_FORM["limit"] === "0") {
$q .= prepare(" LIMIT %d", $_FORM["limit"]);
}
$debug and print "Query: " . $q;
$db = new db_alloc();
$db->query($q);
while ($row = $db->next_record()) {
$print = true;
$p = new project();
$p->read_db_record($db);
$row["projectName"] = $p->get_name($_FORM);
$row["projectLink"] = $p->get_project_link($_FORM);
$row["navLinks"] = $p->get_navigation_links();
$label = $p->get_name($_FORM);
$_FORM["showProjectType"] and $label .= " [" . $p->get_project_type() . "]";
$row["label"] = $label;
$rows[$row["projectID"]] = $row;
}
return (array) $rows;
}