本文整理汇总了PHP中ProjectTasks::getPendingTasks方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectTasks::getPendingTasks方法的具体用法?PHP ProjectTasks::getPendingTasks怎么用?PHP ProjectTasks::getPendingTasks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProjectTasks
的用法示例。
在下文中一共展示了ProjectTasks::getPendingTasks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: total_task_times
function total_task_times($report_data = null, $task = null)
{
if (!$report_data) {
$report_data = array_var($_POST, 'report');
// save selections into session
$_SESSION['total_task_times_report_data'] = $report_data;
}
if (array_var($_GET, 'export') == 'csv') {
$context = build_context_array(array_var($_REQUEST, 'context'));
$report_data = json_decode(str_replace("'", '"', $_REQUEST['parameters']), true);
tpl_assign('context', $context);
} else {
$context = active_context();
}
$columns = array_var($report_data, 'columns');
if (!is_array($columns)) {
$columns = array_var($_POST, 'columns', array());
}
asort($columns);
//sort the array by column order
foreach ($columns as $column => $order) {
if ($order > 0) {
$newColumn = new ReportColumn();
//$newColumn->setReportId($newReport->getId());
if (is_numeric($column)) {
$newColumn->setCustomPropertyId($column);
} else {
$newColumn->setFieldName($column);
}
}
}
$user = Contacts::findById(array_var($report_data, 'user'));
$now = DateTimeValueLib::now();
$now->advance(logged_user()->getTimezone() * 3600, true);
switch (array_var($report_data, 'date_type')) {
case 1:
//Today
$st = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), $now->getDay(), $now->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $now->getMonth(), $now->getDay(), $now->getYear());
break;
case 2:
//This week
$monday = $now->getMondayOfWeek();
$nextMonday = $now->getMondayOfWeek()->add('w', 1)->add('d', -1);
$st = DateTimeValueLib::make(0, 0, 0, $monday->getMonth(), $monday->getDay(), $monday->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $nextMonday->getMonth(), $nextMonday->getDay(), $nextMonday->getYear());
break;
case 3:
//Last week
$monday = $now->getMondayOfWeek()->add('w', -1);
$nextMonday = $now->getMondayOfWeek()->add('d', -1);
$st = DateTimeValueLib::make(0, 0, 0, $monday->getMonth(), $monday->getDay(), $monday->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $nextMonday->getMonth(), $nextMonday->getDay(), $nextMonday->getYear());
break;
case 4:
//This month
$st = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), 1, $now->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $now->getMonth(), 1, $now->getYear())->add('M', 1)->add('d', -1);
break;
case 5:
//Last month
$now->add('M', -1);
$st = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), 1, $now->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $now->getMonth(), 1, $now->getYear())->add('M', 1)->add('d', -1);
break;
case 6:
//Date interval
$st = getDateValue(array_var($report_data, 'start_value'));
$st = $st->beginningOfDay();
$et = getDateValue(array_var($report_data, 'end_value'));
$et = $et->endOfDay();
break;
}
$timeslotType = array_var($report_data, 'timeslot_type', 0);
$group_by = array();
for ($i = 1; $i <= 3; $i++) {
if ($timeslotType == 0) {
$gb = array_var($report_data, 'group_by_' . $i);
} else {
$gb = array_var($report_data, 'alt_group_by_' . $i);
}
if ($gb != '0') {
$group_by[] = $gb;
}
}
$timeslots = Timeslots::getTaskTimeslots($context, null, $user, $st, $et, array_var($report_data, 'task_id', 0), $group_by, null, null, null, $timeslotType);
$unworkedTasks = null;
if (array_var($report_data, 'include_unworked') == 'checked') {
$unworkedTasks = ProjectTasks::getPendingTasks(logged_user(), $workspace);
tpl_assign('unworkedTasks', $unworkedTasks);
}
$gb_criterias = array();
foreach ($group_by as $text) {
if (in_array($text, array('contact_id', 'rel_object_id'))) {
$gb_criterias[] = array('type' => 'column', 'value' => $text);
} else {
if (in_array($text, array('milestone_id', 'priority'))) {
$gb_criterias[] = array('type' => 'assoc_obj', 'fk' => 'rel_object_id', 'value' => $text);
} else {
if (str_starts_with($text, 'dim_')) {
//.........这里部分代码省略.........
示例2: total_task_times
//.........这里部分代码省略.........
if ($workspace instanceof Project) {
if (array_var($report_data, 'include_subworkspaces')) {
$workspacesCSV = $workspace->getAllSubWorkspacesQuery(null, logged_user());
} else {
$workspacesCSV = $workspace->getId();
}
} else {
$workspacesCSV = logged_user()->getWorkspacesQuery();
}
$st = DateTimeValueLib::now();
$et = DateTimeValueLib::now();
switch (array_var($report_data, 'date_type')) {
case 1:
//Today
$now = DateTimeValueLib::now();
$st = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), $now->getDay(), $now->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $now->getMonth(), $now->getDay(), $now->getYear());
break;
case 2:
//This week
$now = DateTimeValueLib::now();
$monday = $now->getMondayOfWeek();
$nextMonday = $now->getMondayOfWeek()->add('w', 1)->add('d', -1);
$st = DateTimeValueLib::make(0, 0, 0, $monday->getMonth(), $monday->getDay(), $monday->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $nextMonday->getMonth(), $nextMonday->getDay(), $nextMonday->getYear());
break;
case 3:
//Last week
$now = DateTimeValueLib::now();
$monday = $now->getMondayOfWeek()->add('w', -1);
$nextMonday = $now->getMondayOfWeek()->add('d', -1);
$st = DateTimeValueLib::make(0, 0, 0, $monday->getMonth(), $monday->getDay(), $monday->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $nextMonday->getMonth(), $nextMonday->getDay(), $nextMonday->getYear());
break;
case 4:
//This month
$now = DateTimeValueLib::now();
$st = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), 1, $now->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $now->getMonth(), 1, $now->getYear())->add('M', 1)->add('d', -1);
break;
case 5:
//Last month
$now = DateTimeValueLib::now();
$now->add('M', -1);
$st = DateTimeValueLib::make(0, 0, 0, $now->getMonth(), 1, $now->getYear());
$et = DateTimeValueLib::make(23, 59, 59, $now->getMonth(), 1, $now->getYear())->add('M', 1)->add('d', -1);
break;
case 6:
//Date interval
$st = getDateValue(array_var($report_data, 'start_value'));
$st = $st->beginningOfDay();
$et = getDateValue(array_var($report_data, 'end_value'));
$et = $et->beginningOfDay()->add('d', 1);
break;
}
$st = new DateTimeValue($st->getTimestamp() - logged_user()->getTimezone() * 3600);
$et = new DateTimeValue($et->getTimestamp() - logged_user()->getTimezone() * 3600);
$timeslotType = array_var($report_data, 'timeslot_type', 0);
$group_by = array();
for ($i = 1; $i <= 3; $i++) {
if ($timeslotType == 0) {
$gb = array_var($report_data, 'group_by_' . $i);
} else {
$gb = array_var($report_data, 'alt_group_by_' . $i);
}
if ($gb != '0') {
$group_by[] = $gb;
}
}
$object_subtype = array_var($report_data, 'object_subtype');
$timeslotsArray = Timeslots::getTaskTimeslots($workspace, $user, $workspacesCSV, $st, $et, array_var($report_data, 'task_id', 0), $group_by, null, 0, 0, $timeslotType, $conditions, $object_subtype);
$unworkedTasks = null;
if (array_var($report_data, 'include_unworked') == 'checked') {
$unworkedTasks = ProjectTasks::getPendingTasks(logged_user(), $workspace);
tpl_assign('unworkedTasks', $unworkedTasks);
}
if (array_var($_POST, 'exportCSV')) {
$skip_ws = $all_conditions != null ? true : false;
self::total_task_times_csv($report_data, $columns, $timeslotsArray, $skip_ws);
} else {
if (array_var($_POST, 'exportPDF')) {
//self::total_task_times_pdf($report_data, $columns, $timeslotsArray);
} else {
tpl_assign('columns', $columns);
tpl_assign('conditions', $conditions);
tpl_assign('timeslot_type', $timeslotType);
tpl_assign('group_by', $group_by);
tpl_assign('timeslotsArray', $timeslotsArray);
tpl_assign('workspace', $workspace);
tpl_assign('start_time', $st);
tpl_assign('end_time', $et);
tpl_assign('user', $user);
$report_data['conditions'] = $conditions;
$report_data['columns'] = $columns;
tpl_assign('post', $report_data);
tpl_assign('template_name', 'total_task_times');
tpl_assign('title', lang('task time report'));
}
}
}
示例3: total_task_times
//.........这里部分代码省略.........
if ($timeslotType == 0) {
$gb = array_var($report_data, 'group_by_' . $i);
} else {
$gb = array_var($report_data, 'alt_group_by_' . $i);
}
if ($gb != '0') {
$group_by[] = $gb;
}
}
$dateFormat = user_config_option('date_format');
$date_format_tip = date_format_tip($dateFormat);
$extra_conditions = "";
$conditions = array_var($_POST, 'conditions', array());
foreach ($conditions as $cond) {
if ($cond['deleted'] > 0) {
continue;
}
if (array_var($cond, 'custom_property_id') > 0) {
if (!in_array($cond['condition'], array('like', 'not like', '=', '<=', '>=', '<', '>', '<>', '%'))) {
continue;
}
$cp = CustomProperties::getCustomProperty($cond['custom_property_id']);
if (!$cp instanceof CustomProperty) {
continue;
}
$current_condition = ' AND e.rel_object_id IN ( SELECT object_id as id FROM ' . TABLE_PREFIX . 'custom_property_values cpv WHERE cpv.custom_property_id = ' . $cond['custom_property_id'];
$value = $cond['value'];
if ($cond['condition'] == 'like' || $cond['condition'] == 'not like') {
$value = '%' . $cond['value'] . '%';
}
if ($cp->getType() == 'date') {
if ($value == $date_format_tip) {
continue;
}
$dtValue = DateTimeValueLib::dateFromFormatAndString($dateFormat, $value);
$value = $dtValue->format('Y-m-d H:i:s');
}
if ($cond['condition'] != '%') {
if ($cp->getType() == 'numeric') {
$current_condition .= ' AND cpv.value ' . $cond['condition'] . ' ' . DB::escape($value);
} else {
if ($cp->getType() == 'boolean') {
$current_condition .= ' AND cpv.value ' . $cond['condition'] . ' ' . ($value ? '1' : '0');
if (!$value) {
$current_condition .= ') OR o.id NOT IN (SELECT object_id as id FROM ' . TABLE_PREFIX . 'custom_property_values cpv2 WHERE cpv2.object_id=o.id AND cpv2.value=1 AND cpv2.custom_property_id = ' . $cp->getId();
}
} else {
$current_condition .= ' AND cpv.value ' . $cond['condition'] . ' ' . DB::escape($value);
}
}
} else {
$current_condition .= ' AND cpv.value like ' . DB::escape("%{$value}");
}
$current_condition .= ')';
$extra_conditions .= $current_condition;
}
}
$timeslots = Timeslots::getTaskTimeslots($context, null, $user, $st, $et, array_var($report_data, 'task_id', 0), $group_by, null, null, null, $timeslotType, $extra_conditions);
$unworkedTasks = null;
if (array_var($report_data, 'include_unworked') == 'checked') {
$unworkedTasks = ProjectTasks::getPendingTasks(logged_user(), $workspace);
tpl_assign('unworkedTasks', $unworkedTasks);
}
$gb_criterias = array();
foreach ($group_by as $text) {
if (in_array($text, array('contact_id', 'rel_object_id'))) {
$gb_criterias[] = array('type' => 'column', 'value' => $text);
} else {
if (in_array($text, array('milestone_id', 'priority'))) {
$gb_criterias[] = array('type' => 'assoc_obj', 'fk' => 'rel_object_id', 'value' => $text);
} else {
if (str_starts_with($text, 'dim_')) {
$gb_criterias[] = array('type' => 'dimension', 'value' => str_replace_first('dim_', '', $text));
}
}
}
}
$grouped_timeslots = groupObjects($gb_criterias, $timeslots);
tpl_assign('columns', $columns);
tpl_assign('timeslotsArray', array());
tpl_assign('grouped_timeslots', $grouped_timeslots);
if (array_var($report_data, 'date_type') == 6) {
$st->advance(logged_user()->getTimezone() * 3600, true);
$et->advance(logged_user()->getTimezone() * 3600, true);
}
tpl_assign('start_time', $st);
tpl_assign('end_time', $et);
tpl_assign('user', $user);
tpl_assign('post', $report_data);
tpl_assign('title', lang('task time report'));
tpl_assign('allow_export', false);
if (array_var($_GET, 'export') == 'csv' || isset($csv) && $csv == true) {
$filename = $this->total_task_times_csv_export($grouped_timeslots);
ajx_extra_data(array('filename' => "{$filename}.csv"));
ajx_current("empty");
} else {
tpl_assign('template_name', 'total_task_times');
$this->setTemplate('report_wrapper');
}
}