本文整理汇总了PHP中DBQuery::innerJoin方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::innerJoin方法的具体用法?PHP DBQuery::innerJoin怎么用?PHP DBQuery::innerJoin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBQuery
的用法示例。
在下文中一共展示了DBQuery::innerJoin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAssignedUsers
function getAssignedUsers()
{
$q = new DBQuery();
$q->addTable('users', 'u');
$q->innerJoin('user_tasks', 'ut', 'ut.user_id = u.user_id');
$q->leftJoin('contacts', 'co', ' co.contact_id = u.user_contact');
$q->addQuery('u.*, ut.perc_assignment, ut.user_task_priority' . ', co.contact_first_name, co.contact_last_name');
$q->addWhere('ut.task_id = ' . $this->task_id);
$sql = $q->prepare();
$q->clear();
return db_loadHashList($sql, 'user_id');
}
示例2: displayFiles
function displayFiles($folder_id)
{
global $AppUI, $m, $a, $tab, $page;
global $current_uri;
global $canAccess, $canRead, $canEdit, $canAuthor, $canDelete;
global $canAccess_folders, $canRead_folders, $canEdit_folders;
global $canAuthor_folders, $canDelete_folders;
global $company_id, $project_id, $task_id;
global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders;
global $showProject, $cfObj, $dPconfig;
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$file_types = dPgetSysVal('FileType');
$xpg_pagesize = 30;
//TODO?: Set by System Config Value ...
$xpg_totalrecs = countFiles($folder_id);
//get file count for folder
$xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1;
$xpg_min = $xpg_pagesize * ($page - 1);
// This is where we start our record set from
$q = new DBQuery();
// most recent version info per file_project and file_version_id
$q->createTemp('files_count_max' . $folder_id);
$q->addTable('files', 'f');
$q->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', file_version_id, f.file_project');
$q->addJoin('projects', 'p', 'p.project_id = f.file_project');
$q->addJoin('tasks', 't', 't.task_id = f.file_task');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
$q->addWhere('f.file_folder = ' . $folder_id);
if (count($allowedProjects)) {
$q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
}
if (count($allowedTasks)) {
$q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
}
if (count($allowedFolders)) {
$q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
}
if ($company_id) {
$q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
$q->addWhere('co.company_id = ' . $company_id);
if (count($allowedCompanies)) {
$q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
}
}
$q->addGroup('f.file_version_id');
$q->addGroup('f.file_project');
$file_version_max_counts = $q->exec();
$q->clear();
// most recent version
$q->addTable('files', 'f');
$q->addQuery('f.*, fmc.file_versions, round(fmc.file_lastversion, 2) as file_lastversion' . ', u.user_username as file_owner, ff.file_folder_name' . ', ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner' . ', cc.contact_first_name as checkout_first_name' . ', cc.contact_last_name as checkout_last_name');
$q->addJoin('files_count_max' . $folder_id, 'fmc', '(fmc.file_lastversion=f.file_version AND fmc.file_version_id=f.file_version_id' . ' AND fmc.file_project=f.file_project)', 'inner');
$q->addJoin('projects', 'p', 'p.project_id = f.file_project');
$q->addJoin('users', 'u', 'u.user_id = f.file_owner');
$q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
$q->addJoin('tasks', 't', 't.task_id = f.file_task');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
$q->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
$q->leftJoin('contacts', 'cc', 'cc.contact_id = cu.user_contact');
$q->addWhere('f.file_folder = ' . $folder_id);
if (count($allowedProjects)) {
$q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
}
if (count($allowedTasks)) {
$q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
}
if (count($allowedFolders)) {
$q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
}
if ($project_id) {
$q->addWhere('f.file_project = ' . $project_id);
}
if ($task_id) {
$q->addWhere('f.file_task = ' . $task_id);
}
if ($company_id) {
$q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
$q->addWhere('co.company_id = ' . $company_id);
if (count($allowedCompanies)) {
$q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
}
}
$q->addOrder('p.project_name');
$q->setLimit($xpg_pagesize, $xpg_min);
$files_sql = $q->prepare();
$q->clear();
// all versions
$q->addTable('files', 'f');
$q->addQuery('f.*, ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner');
$q->addJoin('projects', 'p', 'p.project_id = f.file_project');
$q->addJoin('users', 'u', 'u.user_id = f.file_owner');
$q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
$q->addJoin('tasks', 't', 't.task_id = f.file_task');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
$q->addWhere('f.file_folder = ' . $folder_id);
if (count($allowedProjects)) {
$q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
}
if (count($allowedTasks)) {
//.........这里部分代码省略.........
示例3: displayFiles
function displayFiles($folder)
{
global $m, $a, $tab, $AppUI, $xpg_min, $xpg_pagesize;
global $deny1, $deny2, $project_id, $task_id, $showProject, $file_types, $cfObj;
global $xpg_totalrecs, $xpg_total_pages, $page;
global $company_id, $allowed_companies, $current_uri, $dPconfig;
$canEdit = !getDenyEdit($m, $folder);
$canRead = !getDenyRead($m, $folder);
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
// SETUP FOR FILE LIST
$q = new DBQuery();
$q->addTable('files');
$q->addQuery('files.*,count(file_version) as file_versions,round(max(file_version), 2) as file_lastversion,file_folder_id, file_folder_name,project_name, project_color_identifier,contact_first_name, contact_last_name,task_name,task_id');
$q->addJoin('projects', 'p', 'p.project_id = file_project');
$q->addJoin('users', 'u', 'u.user_id = file_owner');
$q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
$q->addJoin('tasks', 't', 't.task_id = file_task');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
$q->addWhere('file_folder = ' . $folder);
if (count($deny1) > 0) {
$q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
}
if (count($deny2) > 0) {
$q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
}
if ($project_id) {
$q->addWhere('file_project = ' . $project_id);
}
if ($task_id) {
$q->addWhere('file_task = ' . $task_id);
}
if ($company_id) {
$q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
$q->addWhere('company_id = ' . $company_id);
$q->addWhere('company_id IN (' . $allowed_companies . ')');
}
$q->addGroup('file_folder');
$q->addGroup('project_name');
$q->addGroup('file_name');
$q->addOrder('file_folder');
$q->addOrder('project_name');
$q->addOrder('file_name');
$q->setLimit($xpg_pagesize, $xpg_min);
$files_sql = $q->prepare();
$q->clear();
$q = new DBQuery();
$q->addTable('files');
$q->addQuery('files.file_id, file_version, file_project, file_name, file_task, file_description, user_username as file_owner, file_size, file_category, file_type, file_date, file_folder_name');
$q->addJoin('projects', 'p', 'p.project_id = file_project');
$q->addJoin('users', 'u', 'u.user_id = file_owner');
$q->addJoin('tasks', 't', 't.task_id = file_task');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
$q->addWhere('file_folder = ' . $folder);
if ($project_id) {
$q->addWhere('file_project = ' . $project_id);
}
if ($task_id) {
$q->addWhere('file_task = ' . $task_id);
}
if ($company_id) {
$q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
$q->addWhere('company_id = ' . $company_id);
$q->addWhere('company_id IN (' . $allowed_companies . ')');
}
$file_versions_sql = $q->prepare();
$q->clear();
$files = array();
$file_versions = array();
if ($canRead) {
$files = db_loadList($files_sql);
$file_versions = db_loadList($file_versions_sql);
}
if ($files === array()) {
return 0;
}
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tr>
<th nowrap="nowrap"><?php
echo $AppUI->_('File Name');
?>
</th>
<th><?php
echo $AppUI->_('Description');
?>
</th>
<th><?php
echo $AppUI->_('Versions');
?>
</th>
<th><?php
echo $AppUI->_('Category');
?>
</th>
<th nowrap="nowrap"><?php
echo $AppUI->_('Task Name');
?>
</th>
<th><?php
//.........这里部分代码省略.........
示例4: array
// We then need to add all projects where a user is assigned a task, is a
// task contact, or is the owner of a task within that project.
// This should cover all situations that we need to correct.
$projects = array();
$q = new DBQuery();
$q->addQuery('user_contact');
$q->addTable('users');
$q->addWhere('user_id = ' . (int) $user_id);
$contact_id = $q->loadResult();
$q->addQuery('distinct project_id, project_name');
$q->addTable('projects');
$q->addWhere('project_owner = ' . (int) $user_id);
$projects += $q->loadHashList();
$q->addQuery('distinct prj.project_id, prj.project_name');
$q->addTable('projects', 'prj');
$q->innerJoin('project_contacts', 'prc', array('project_id'));
$q->addWhere('prc.contact_id = ' . (int) $contact_id);
$projects += $q->loadHashList();
$q->addQuery('distinct prj.project_id, prj.project_name');
$q->addTable('tasks', 't');
$q->innerJoin('projects', 'prj', 'prj.project_id = t.task_project');
$q->leftJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
$q->addWhere('t.task_owner = ' . (int) $user_id . ' OR ut.user_id = ' . (int) $user_id);
$projects += $q->loadHashList();
$q->addQuery('distinct prj.project_id, prj.project_name');
$q->addTable('tasks', 't');
$q->innerJoin('projects', 'prj', 'prj.project_id = t.task_project');
$q->innerJoin('task_contacts', 'tc', 'tc.task_id = t.task_id');
$q->addWhere('tc.contact_id = ' . (int) $contact_id);
$projects += $q->loadHashList();
$q->addQuery('user_id, concat(u.user_username, \' (\', c.contact_first_name, \' \', c.contact_last_name, \')\') as username');
示例5: getTaskList
public function getTaskList($userId, $days = 30)
{
/*
* This list of fields - id, name, description, startDate, endDate,
* updatedDate - are named specifically for the iCal creation.
* If you change them, it's probably going to break. So don't do that.
*/
$q = new DBQuery();
$q->addQuery('t.task_id as id');
$q->addQuery('task_name as name');
$q->addQuery('task_description as description');
$q->addQuery('task_start_date as startDate');
$q->addQuery('task_end_date as endDate');
$q->addQuery($q->dbfnNow() . ' as updatedDate');
$q->addQuery('CONCAT(\'' . W2P_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . '\', t.task_id) as url');
$q->addQuery('p.project_id, p.project_name');
$q->addTable('tasks', 't');
$q->addWhere('(task_start_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ' OR task_end_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ')');
$q->addWhere('task_percent_complete < 100');
$q->addWhere('task_dynamic = 0');
$q->innerJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
$q->addWhere('ut.user_id = ' . $userId);
$q->innerJoin('projects', 'p', 'p.project_id = t.task_project');
$q->addWhere('project_active > 0');
if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
$q->addWhere('project_status <> ' . $template_status);
}
$q->addOrder('task_start_date, task_end_date');
return $q->loadList();
}
示例6: strtolower
function get_group_map($id, $group_type = 'ARO')
{
$this->debug_text('get_group_map(): Assigned ID: ' . $id . ' Group Type: ' . $group_type);
$grp_type_mod = strtolower(trim($group_type));
switch ($grp_type_mod) {
case 'axo':
$group_type = $grp_type_mod;
break;
default:
$group_type = 'aro';
break;
}
$table = $this->_db_table_prefix . $group_type . '_groups';
$map_table = $this->_db_table_prefix . 'groups_' . $group_type . '_map';
$map_field = $group_type . '_id';
if (empty($id)) {
$this->debug_text('get_group_map(): ID (' . $id . ') is empty, this is required');
return FALSE;
}
$q = new DBQuery();
$q->addTable($table, 'g1');
$q->innerJoin($map_table, 'g2', 'g2.group_id = g1.id');
$q->addQuery('g1.id, g1.name, g1.value, g1.parent_id');
$q->addWhere("g2.{$map_field} = {$id}");
$q->addOrder('g1.value');
$result = array();
$q->exec();
while ($row = $q->fetchRow()) {
$result[] = array('id' => $row[0], 'name' => $row[1], 'value' => $row[2], 'parent_id' => $row[3]);
}
$q->clear();
return $result;
}
示例7: CProject
}
}
}
}
}
}
}
$AppUI->savePlace();
$proj = new CProject();
$tobj = new CTask();
$q = new DBQuery();
$allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'p.project_id');
$allowedTasks = $tobj->getAllowedSQL($AppUI->user_id, 't.task_id');
//query my sub-tasks (ignoring task parents)
$q->addTable('tasks', 't');
$q->innerJoin('projects', 'p', 'p.project_id = t.task_project');
$q->addQuery('t.*, p.project_name, p.project_id, p.project_color_identifier');
if ($project_id) {
$q->addWhere('p.project_id = ' . $project_id);
}
if (count($allowedTasks)) {
$q->addWhere($allowedTasks);
}
if (count($allowedProjects)) {
$q->addWhere($allowedProjects);
}
$q->addGroup('t.task_id');
$q->addOrder($sort . ', t.task_priority DESC');
//echo ('<pre>' . $q->prepare(); . '</pre>');
$tasks = $q->loadList();
$priorities = array('1' => 'high', '0' => 'normal', '-1' => 'low');
示例8: count
$r->addTable('files', 'f');
$r->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', f.file_version_id, f.file_project');
$r->addJoin('projects', 'p', 'p.project_id = f.file_project');
$r->addJoin('tasks', 't', 't.task_id = f.file_task');
$r->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
if (count($allowedProjects)) {
$r->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
}
if (count($allowedTasks)) {
$r->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
}
if (count($allowedFolders)) {
$r->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
}
if ($company_id) {
$r->innerJoin('companies', 'co', 'co.company_id = p.project_company');
$r->addWhere('co.company_id = ' . $company_id);
$r->addWhere($allowedCompanies);
}
$r->addGroup('f.file_project');
$r->addGroup('f.file_version_id');
$file_version_max_counts = $r->exec();
$r->clear();
// SETUP FOR FILE LIST
$q2 = new DBQuery();
$q2->addQuery('SQL_CALC_FOUND_ROWS f.*, f.file_id as latest_id' . ', fmc.file_versions , round(fmc.file_lastversion, 2) as file_lastversion');
$q2->addQuery('ff.*');
$q2->addTable('files', 'f');
$q2->addJoin('files_count_max', 'fmc', '(fmc.file_lastversion = f.file_version AND fmc.file_version_id = f.file_version_id' . ' AND fmc.file_project = f.file_project)', 'inner');
$q2->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
$q2->addJoin('projects', 'p', 'p.project_id = f.file_project');
示例9: foreach
<form name="form_buttons" method="post" action="index.php?<?php
echo "m={$m}&a={$a}&date={$date}";
?>
">
<input type="hidden" name="show_form" value="1" />
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td width="50%">
<?php
if ($other_users) {
echo $AppUI->_("Show Todo for:") . '<select name="show_user_todo" onchange="document.form_buttons.submit()">';
$q->addTable('users', 'u');
$q->innerJoin('contacts', 'c', 'c.contact_id = u.user_contact');
$q->addQuery('u.user_id, u.user_username, c.contact_first_name, c.contact_last_name');
$q->addOrder('c.contact_last_name');
$usersql = $q->prepare(true);
if ($rows = db_loadList($usersql)) {
foreach ($rows as $row) {
echo '<option value="' . $row['user_id'] . '"' . ($user_id == $row["user_id"] ? ' selected="selected"' : '') . '>' . $row['contact_last_name'] . ', ' . $row["contact_first_name"];
}
}
}
?>
</select>
</td>
<td align="right" width="50%"><?php
echo $AppUI->_('Show');
?>
示例10: dPuserHasRole
function dPuserHasRole($name)
{
global $AppUI;
$uid = (int) $AppUI->user_id;
$q = new DBQuery();
$q->addTable('roles', 'r');
$q->innerJoin('user_roles', 'ur', 'ur.role_id=r.role_id');
$q->addQuery('r.role_id');
$q->addWhere("ur.user_id={$uid} AND r.role_name='{$name}'");
return $q->loadResult();
}
示例11: CTask
} else {
if (!$canAdd) {
$AppUI->redirect('m=public&a=access_denied');
}
$log->task_log_task = $task_id;
$log->task_log_name = $obj->task_name;
}
// Check that the user is at least assigned to a task
$task = new CTask();
$task->load($task_id);
if (!$task->canAccess($AppUI->user_id)) {
$AppUI->redirect('m=public&a=access_denied');
}
$q = new DBQuery();
$q->addTable('tasks', 't');
$q->innerJoin('projects', 'p', 'p.project_id = t.task_project');
$q->innerJoin('billingcode', 'b', 'b.company_id = p.project_company OR b.company_id = 0');
$q->addQuery('b.billingcode_id, b.billingcode_name');
$q->addWhere('b.billingcode_status = 0');
$q->addWhere('t.task_id = ' . $task_id);
$q->addOrder('b.billingcode_name');
$task_log_costcodes = $q->loadHashList();
$task_log_costcodes[0] = '';
$q->clear();
$taskLogReference = dPgetSysVal('TaskLogReference');
// Task Update Form
$df = $AppUI->getPref('SHDATEFORMAT');
$log_date = new CDate($log->task_log_date);
//task log e-mail checkboxes
$tl = $AppUI->getPref('TASKLOGEMAIL');
$ta = $tl & 1;
示例12: DBQuery
</td>
</tr>
</table>
</form>
<?php
if ($do_report) {
$q = new DBQuery();
$q->addQuery('p.project_id, p.project_name, t.*,
CONCAT_WS(\' \',contact_first_name,contact_last_name) AS creator,
if (bc.billingcode_name is null, \'\', bc.billingcode_name) as billingcode_name');
$q->addTable('task_log', 't');
$q->leftJoin('billingcode', 'bc', 'bc.billingcode_id = t.task_log_costcode');
$q->leftJoin('users', 'u', 'user_id = task_log_creator');
$q->leftJoin('contacts', 'c', 'u.user_contact = contact_id');
$q->innerJoin('tasks', 'tsk', 't.task_log_task = tsk.task_id');
$q->leftJoin('projects', 'p', 'p.project_id = task_project');
if ($project_id != 0) {
$q->addWhere('task_project = ' . (int) $project_id);
}
if (!$log_all) {
$q->addWhere('task_log_date >= \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'');
$q->addWhere('task_log_date <= \'' . $end_date->format(FMT_DATETIME_MYSQL) . "'");
}
if ($log_ignore) {
$q->addWhere('task_log_hours > 0');
}
if ($log_userfilter) {
$q->addWhere('task_log_creator = ' . (int) $log_userfilter);
}
$proj = new CProject();
示例13: dPgetParam
$q->addWhere("b.contact_id = {$user_id}");
}
$q->addWhere(selPermWhere($obj, 'project_id', 'project_name', 'a'));
if ($project_company) {
$q->addWhere("project_company = {$project_company}");
}
break;
case "tasks":
$task_project = dPgetParam($_GET, 'task_project', 0);
$title = 'Task';
$q->addQuery('task_id, task_name, task_parent, p.project_name');
$q->addOrder('task_parent, task_parent = task_id desc');
if ($task_project) {
$q->addWhere("task_project = {$task_project}");
}
$q->innerJoin('projects', 'p', 'task_project = p.project_id');
$task_list = $q->loadList();
$level = 0;
$query_result = array();
$last_parent = 0;
foreach ($task_list as $task) {
if ($task['task_parent'] != $task['task_id']) {
if ($last_parent != $task['task_parent']) {
$last_parent = $task['task_parent'];
$level++;
}
} else {
$last_parent = 0;
$level = 0;
}
$query_result[$task['task_id']] = ($level ? str_repeat(' ', $level) : '') . $task['project_name'] . ' - ' . $task['task_name'];
示例14: getCalendarEvents
public function getCalendarEvents($userId, $days = 30)
{
/*
* This list of fields - id, name, description, startDate, endDate,
* updatedDate - are named specifically for the iCal creation.
* If you change them, it's probably going to break. So don't do that.
*/
$q = new DBQuery();
$q->addQuery('e.event_id as id');
$q->addQuery('event_title as name');
$q->addQuery('event_description as description');
$q->addQuery('event_start_date as startDate');
$q->addQuery('event_end_date as endDate');
$q->addQuery($q->dbfnNow() . ' as updatedDate');
$q->addQuery('CONCAT(\'' . W2P_BASE_URL . '/index.php?m=calendar&a=view&event_id=' . '\', e.event_id) as url');
$q->addQuery('projects.project_id, projects.project_name');
$q->addTable('events', 'e');
$q->leftJoin('projects', 'projects', 'e.event_project = projects.project_id');
$q->addWhere('(event_start_date > ' . $q->dbfnNow() . ' OR event_end_date > ' . $q->dbfnNow() . ')');
$q->addWhere('(event_start_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ' OR event_end_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ')');
$q->innerJoin('user_events', 'ue', 'ue.event_id = e.event_id');
$q->addWhere('ue.user_id = ' . $userId);
$q->addOrder('event_start_date');
return $q->loadList();
}
示例15: CTask
$tempoTask = new CTask();
$userAlloc = $tempoTask->getAllocation("user_id");
// Let's figure out which users we have
$sql = new DBQuery();
$sql->addTable('users');
$sql->addQuery('user_id, user_username');
if ($log_userfilter != 0) {
$sql->addWhere('user_id = ' . $log_userfilter);
}
$sql->addOrder('user_username');
$user_list = $sql->loadHashList('user_id');
$sql->clear();
$ss = $start_date->format(FMT_DATETIME_MYSQL);
$se = $end_date->format(FMT_DATETIME_MYSQL);
$sql->addTable('tasks', 't');
$sql->innerJoin('projects', 'p', 'p.project_id = t.task_project');
if ($log_userfilter != 0) {
$sql->innerJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
}
$sql->addQuery('t.*');
if ($use_period) {
$sql->addWhere("((task_start_date >= '{$ss}' AND task_start_date <= '{$se}') " . " OR (task_end_date <= '{$se}' AND task_end_date >= '{$ss}'))");
}
$sql->addWhere('task_percent_complete < 100');
if ($project_id != 'all') {
$sql->addWhere('t.task_project = \'' . $project_id . '\'');
}
if ($company_id != 'all') {
$sql->addWhere("p.project_company='{$company_id}'");
}
if ($log_userfilter != 0) {