当前位置: 首页>>代码示例>>PHP>>正文


PHP DBQuery::addGroup方法代码示例

本文整理汇总了PHP中DBQuery::addGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::addGroup方法的具体用法?PHP DBQuery::addGroup怎么用?PHP DBQuery::addGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBQuery的用法示例。


在下文中一共展示了DBQuery::addGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DBQuery

 function _buildQuery()
 {
     $q = new DBQuery();
     $q->addTable($this->table);
     $q->addTable('files');
     $q->addQuery('*');
     $q->addWhere("files.file_id = {$this->table}.file_id");
     $sql = '';
     foreach ($this->search_fields as $field) {
         $sql .= " {$field} LIKE '%{$this->keyword}%' or ";
     }
     $sql = substr($sql, 0, -4);
     $q->addWhere("({$sql})");
     $q->addGroup('files.file_id');
     return $q->prepare(true);
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:16,代码来源:files_content.inc.php

示例2: round

$q->addTable('projects', 'pr');
$q->leftJoin('tasks', 't', 'task_project = project_id');
if (!empty($project_id)) {
    $q->addWhere('project_id = ' . (int) $project_id);
}
$all_tasks = $q->loadList();
$q->addQuery('*, round(sum(task_log_hours),2) as work');
$q->addTable('projects', 'pr');
$q->leftJoin('tasks', 't', 'task_project = project_id');
$q->leftJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
$q->leftJoin('users', 'u', 'ut.user_id = u.user_id');
$q->leftJoin('task_log', 'tl', 'task_log_task = t.task_id AND task_log_creator = u.user_id');
if (!empty($project_id)) {
    $q->addWhere('project_id = ' . (int) $project_id);
}
$q->addGroup('t.task_id, u.user_id');
$users_all = $q->loadList();
foreach ($users_all as $user) {
    $users_per_task[$user['task_id']][] = $user['user_id'];
    $users[$user['user_id']]['all'][$user['task_id']] = $user;
    $users[$user['user_id']]['name'] = !empty($user['user_username']) ? $user['user_username'] : $user['user_id'];
    $users[$user['user_id']]['hours'] = 0;
    $users[$user['user_id']]['completed'] = array();
    $users[$user['user_id']]['inprogress'] = array();
    $users[$user['user_id']]['pending'] = array();
    $users[$user['user_id']]['overdue'] = array();
}
$tasks['hours'] = 0;
$tasks['inprogress'] = array();
$tasks['completed'] = array();
$tasks['pending'] = array();
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:31,代码来源:stats.php

示例3: IF

$allowedProjects = $project->getAllowedSQL($AppUI->user_id);
$working_hours = $w2Pconfig['daily_working_hours'] ? $w2Pconfig['daily_working_hours'] : 8;
$q->addQuery('projects.project_id, project_color_identifier, project_name');
$q->addQuery('SUM(task_duration * task_percent_complete * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) / SUM(task_duration * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) AS project_percent_complete');
$q->addQuery('company_name');
$q->addTable('projects');
$q->leftJoin('tasks', 't1', 'projects.project_id = t1.task_project');
$q->leftJoin('companies', 'c', 'company_id = project_company');
$q->leftJoin('project_departments', 'project_departments', 'projects.project_id = project_departments.project_id OR project_departments.project_id IS NULL');
$q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL');
$q->addWhere('t1.task_id = t1.task_parent');
$q->addWhere('projects.project_id=' . $project_id);
if (count($allowedProjects)) {
    $q->addWhere($allowedProjects);
}
$q->addGroup('projects.project_id');
$q2 = new DBQuery();
$q2 = $q;
$q2->addQuery('projects.project_id, COUNT(t1.task_id) as total_tasks');
$perms =& $AppUI->acl();
$projects = array();
if ($canViewTasks) {
    $prc = $q->exec();
    echo db_error();
    while ($row = $q->fetchRow()) {
        $projects[$row['project_id']] = $row;
    }
    $prc2 = $q2->exec();
    echo db_error();
    while ($row2 = $q2->fetchRow()) {
        $projects[$row2['project_id']] = !$projects[$row2['project_id']] ? array() : $projects[$row2['project_id']];
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:vw_projecttask.php

示例4: getAllocation

 /**
  *	Calculate the extent of utilization of user assignments
  *	@param string hash	 a hash for the returned hashList
  *	@param array users	 an array of user_ids calculating their assignment capacity
  *	@return array		 returns hashList of extent of utilization for assignment of the users
  */
 function getAllocation($hash = NULL, $users = NULL)
 {
     // if (! dPgetConfig('check_overallocation') && ! dPgetConfig('direct_edit_assignment')) {
     return array();
     //}
     $q = new DBQuery();
     // retrieve the systemwide default preference for the assignment maximum
     $q->addTable('user_preferences');
     $q->addQuery('pref_value');
     $q->addWhere("pref_user = 0 AND pref_name = 'TASKASSIGNMAX'");
     $sql = $q->prepare();
     $q->clear();
     $result = db_loadHash($sql, $sysChargeMax);
     if (!$result) {
         $scm = 0;
     } else {
         $scm = $sysChargeMax['pref_value'];
     }
     /*
      * provide actual assignment charge, individual chargeMax 
      * and freeCapacity of users' assignments to tasks
      */
     $q->addTable('users', 'u');
     $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
     $q->leftJoin('user_tasks', 'ut', 'ut.user_id = u.user_id');
     $q->leftJoin('user_preferences', 'up', 'up.pref_user = u.user_id');
     $q->addQuery("u.user_id, CONCAT(CONCAT_WS(' [', CONCAT_WS(' '" . ', contact_first_name, contact_last_name), IF(IFNULL((IFNULL(up.pref_value' . ', ' . $scm . ') - SUM(ut.perc_assignment)), up.pref_value) > 0' . ', IFNULL((IFNULL(up.pref_value, ' . $scm . ') - SUM(ut.perc_assignment))' . ', up.pref_value), 0)), ' . "'%]')" . ' AS userFC' . ', IFNULL(SUM(ut.perc_assignment), 0) AS charge, u.user_username' . ', IFNULL(up.pref_value,' . $scm . ') AS chargeMax' . ', IF(IFNULL((IFNULL(up.pref_value, ' . $scm . ') ' . '- SUM(ut.perc_assignment)), up.pref_value) > 0' . ', IFNULL((IFNULL(up.pref_value, ' . $scm . ') - SUM(ut.perc_assignment))' . ', up.pref_value), 0) AS freeCapacity');
     if (!empty($users)) {
         // use userlist if available otherwise pull data for all users
         $q->addWhere('u.user_id IN (' . implode(',', $users) . ')');
     }
     $q->addGroup('u.user_id');
     $q->addOrder('contact_last_name, contact_first_name');
     $sql = $q->prepare();
     $q->clear();
     //echo "<pre>$sql</pre>";
     return db_loadHashList($sql, $hash);
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:44,代码来源:tasks.class.php

示例5: 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 
//.........这里部分代码省略.........
开发者ID:magsilva,项目名称:dotproject,代码行数:101,代码来源:folders_table.php

示例6: 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)) {
//.........这里部分代码省略.........
开发者ID:slawekmikula,项目名称:dotproject,代码行数:101,代码来源:folders_table.php

示例7: NOW

$q->addQuery('v1.visit_user');
$q->leftJoin('users', 'u', 'fm1.message_author = u.user_id');
$q->leftJoin('contacts', 'con', 'contact_id = user_contact');
$q->leftJoin('forum_messages', 'fm2', 'fm1.message_id = fm2.message_parent');
$q->leftJoin('forum_watch', 'fw', 'watch_user = ' . (int) $AppUI->user_id . ' AND watch_topic = fm1.message_id');
$q->leftJoin('forum_visits', 'v1', 'v1.visit_user = ' . (int) $AppUI->user_id . ' AND v1.visit_message = fm1.message_id');
$q->addWhere('fm1.message_forum = ' . (int) $forum_id);
switch ($f) {
    case 1:
        $q->addWhere('watch_user IS NOT NULL');
        break;
    case 2:
        $q->addWhere('(NOW() < DATE_ADD(fm2.message_date, INTERVAL 30 DAY) OR NOW() < DATE_ADD(fm1.message_date, INTERVAL 30 DAY))');
        break;
}
$q->addGroup('fm1.message_id, fm1.message_parent');
$q->addOrder($orderby . ' ' . $orderdir);
$topics = $q->loadList();
$crumbs = array();
$crumbs['?m=forums'] = 'forums list';
?>
<br />
<?php 
if (function_exists('styleRenderBoxTop')) {
    echo styleRenderBoxTop();
}
?>
<table width="100%" cellspacing="1" cellpadding="2" border="0" class="tbl">
<form name="watcher" action="?m=forums&a=viewer&forum_id=<?php 
echo $forum_id;
?>
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:view_topics.php

示例8: getDepartments

 public static function getDepartments($AppUI, $companyId)
 {
     $perms = $AppUI->acl();
     if ($AppUI->isActiveModule('departments') && $perms->checkModule('departments', 'view')) {
         $q = new DBQuery();
         $q->addTable('departments');
         $q->addQuery('departments.*, COUNT(contact_department) dept_users');
         $q->addJoin('contacts', 'c', 'c.contact_department = dept_id');
         $q->addWhere('dept_company = ' . (int) $companyId);
         $q->addGroup('dept_id');
         $q->addOrder('dept_parent, dept_name');
         $department = new CDepartment();
         $department->setAllowedSQL($AppUI->user_id, $q);
         return $q->loadList();
     }
 }
开发者ID:joly,项目名称:web2project,代码行数:16,代码来源:companies.class.php

示例9: round

                }
            }
            $users[$user]['hours'] += $users[$user]['all'][$task['task_id']]['work'];
            $tasks['hours'] += $users[$user]['all'][$task['task_id']]['work'];
        }
    }
}
$q = new DBQuery();
$q->addTable('files');
$q->addQuery('sum(file_size)');
if ($project_id) {
    $q->addWhere('file_project = ' . (int) $project_id);
} else {
    $q->addWhere('file_project = 0');
}
$q->addGroup('file_project');
$files = $q->loadResult();
$q->clear();
$ontime = round(100 * (1 - count($tasks['overdue']) / count($all_tasks) - count($tasks['completed']) / count($all_tasks)));
?>

<table width="100%" border="1" cellpadding="0" cellspacing="0" class="tbl">
<tr>
	<th colspan="3"><?php 
echo $AppUI->_('Progress Chart (completed/in progress/pending)');
?>
</th>
</tr>
<tr>
	<td width="<?php 
echo round(count($tasks['completed']) / count($all_tasks) * 100);
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:stats.php

示例10: breadCrumbs

$q->addJoin('forum_watch', 'fw', "watch_user = {$AppUI->user_id} AND watch_topic = fm1.message_id");
$q->addJoin('forum_visits', 'v1', "v1.visit_user = {$AppUI->user_id} AND v1.visit_message = fm2.message_id");
$q->addJoin('forum_visits', 'v2', "v2.visit_user = {$AppUI->user_id} AND v2.visit_message = fm1.message_id");
$q->addWhere("fm1.message_forum = {$forum_id}");
switch ($f) {
    case 1:
        $q->addWhere("watch_user IS NOT NULL");
        break;
    case 2:
        $q->addWhere("(NOW() < DATE_ADD(fm2.message_date, INTERVAL 30 DAY) OR NOW() < DATE_ADD(fm1.message_date, INTERVAL 30 DAY))");
        break;
}
$q->addGroup('fm1.message_id,
	fm1.message_parent,
	fm1.message_author,
	fm1.message_title,
	fm1.message_date,
	fm1.message_body,
	fm1.message_published');
$q->addOrder("{$orderby} {$orderdir}");
$topics = $q->loadList();
$crumbs = array();
$crumbs["?m=forums"] = "forums list";
?>
<table width="100%" cellspacing="1" cellpadding="2" border="0">
<tr>
	<td><?php 
echo breadCrumbs($crumbs);
?>
</td>
	<td align="right">
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:view_topics.php

示例11: DBQuery

$q = new DBQuery();
$q->addTable('users', 'u');
$q->addQuery('DISTINCT(user_id), user_username, contact_last_name, contact_first_name,
	permission_user, contact_email, company_name, contact_company');
$q->addJoin('contacts', 'con', 'user_contact = contact_id');
$q->addJoin('companies', 'com', 'contact_company = company_id');
$q->addJoin('permissions', 'per', 'user_id = permission_user');
if ($stub) {
    $q->addWhere("(UPPER(user_username) LIKE '{$stub}%' or UPPER(contact_first_name) LIKE '{$stub}%' OR UPPER(contact_last_name) LIKE '{$stub}%')");
} else {
    if ($where) {
        $where = $q->quote("%{$where}%");
        $q->addWhere("(UPPER(user_username) LIKE {$where} or UPPER(contact_first_name) LIKE {$where} OR UPPER(contact_last_name) LIKE {$where})");
    }
}
$q->addGroup('user_id');
$q->addOrder($orderby);
$users = $q->loadList();
$canLogin = !isset($_REQUEST['inactive']) || $_REQUEST['inactive'] == 'false';
?>
<table cellpadding="7" cellspacing="0" border="0" width="100%" class="infopanel">
<tr>
<td>
<?php 
showButton('New User', '?m=admin&a=addedituser');
?>
</td>
<td align="right">
<table class="internal">
	<tr><td>Show:</td>
	<td><input id="idInactive" type="checkbox" name="inactive" <?php 
开发者ID:n2i,项目名称:xvnkb,代码行数:31,代码来源:vw_usr_list.php

示例12: dPgetSysVal

## based on Companies: View Projects sub-table by gregorerhardt
##
global $AppUI, $company_id, $pstatus, $dPconfig;
$df = $AppUI->getPref('SHDATEFORMAT');
$project_types = dPgetSysVal('ProjectStatus');
// get any records denied from viewing
$obj = new CProject();
// Task sum table
// by Pablo Roca (pabloroca@mvps.org)
// 16 August 2003
$q = new DBQuery();
$q->createTemp('tasks_sum');
$q->addQuery('task_project, COUNT(DISTINCT task_id) AS total_tasks,
			SUM(task_duration * task_duration_type * task_percent_complete) / SUM(task_duration * task_duration_type) AS project_percent_complete');
$q->addTable('tasks');
$q->addGroup('task_project');
$q->exec();
$q->clear();
// temporary My Tasks
// by Pablo Roca (pabloroca@mvps.org)
// 16 August 2003
$q->createTemp('tasks_summy');
$q->addQuery('task_project, COUNT(DISTINCT task_id) AS my_tasks');
$q->addTable('tasks');
$q->addWhere('task_owner = ' . $AppUI->user_id);
$q->addGroup('task_project');
$q->exec();
$q->clear();
$q->addTable('projects', 'pr');
$q->addQuery('project_id, project_name, project_status, project_color_identifier,
	project_start_date, project_end_date, project_priority,
开发者ID:klr2003,项目名称:sourceread,代码行数:31,代码来源:calendar_tab.projects.php

示例13: canDelete

 /**
  *	Generic check for whether dependencies exist for this object in the db schema
  *
  *	Can be overloaded/supplemented by the child class
  *	@param string $msg Error message returned
  *	@param int Optional key index
  *	@param array Optional array to compiles standard joins: format [label=>'Label',name=>'table name',idfield=>'field',joinfield=>'field']
  *	@return true|false
  */
 function canDelete(&$msg, $oid = null, $joins = null)
 {
     global $AppUI;
     // First things first.  Are we allowed to delete?
     $acl =& $AppUI->acl();
     if (!$acl->checkModuleItem($this->_tbl, "delete", $oid)) {
         $msg = $AppUI->_("noDeletePermission");
         return false;
     }
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = intval($oid);
     }
     if (is_array($joins)) {
         $select = "{$k}";
         $join = "";
         $q = new DBQuery();
         $q->addTable($this->_tbl);
         $q->addWhere("{$k} = '" . $this->{$k} . "'");
         $q->addGroup($k);
         foreach ($joins as $table) {
             $q->addQuery("COUNT(DISTINCT {$table['idfield']}) AS {$table['idfield']}");
             $q->addJoin($table['name'], $table['name'], "{$table['joinfield']} = {$k}");
         }
         $sql = $q->prepare();
         $q->clear();
         $obj = null;
         if (!db_loadObject($sql, $obj)) {
             $msg = db_error();
             return false;
         }
         $msg = array();
         foreach ($joins as $table) {
             $k = $table['idfield'];
             if ($obj->{$k}) {
                 $msg[] = $AppUI->_($table['label']);
             }
         }
         if (count($msg)) {
             $msg = $AppUI->_("noDeleteRecord") . ": " . implode(', ', $msg);
             return false;
         } else {
             return true;
         }
     }
     return true;
 }
开发者ID:n2i,项目名称:xvnkb,代码行数:56,代码来源:dp.class.php

示例14: array

		<TH ALIGN="center" VALIGN="top" class="hdr"><a href="?m=risks&sort=risk_owner">Owner</a></TH>
		<TH ALIGN="center" VALIGN="top" class="hdr"><a href="?m=risks&sort=risk_status">Status</a></TH>
		<TH ALIGN="center" VALIGN="top" class="hdr"><a href="?m=risks&sort=risk_note_date">Last Note</a></TH>
	</TR>
<?php 
$projects = array_merge(array(0 => array('project_id' => 0)), $projects);
foreach ($projects as $p) {
    $q->clear();
    $q->addQuery('risks.*');
    $q->addQuery('max(risk_note_date) as risk_note_date');
    $q->addQuery('task_name');
    $q->addTable('risks');
    $q->leftJoin('risk_notes', 'r', 'risk_id = risk_note_risk');
    $q->leftJoin('tasks', 't', 'task_id = risk_task');
    $q->addWhere('risk_project = ' . $p['project_id']);
    $q->addGroup('risk_id');
    $q->addOrder($order);
    if ($riskFilter != 0) {
        $q->addWhere('risk_status = ' . $riskFilter);
    }
    $risks = $q->loadList();
    if (!empty($risks)) {
        //			if(!isset($_GET['project_id'])){
        echo '<TR><TD colspan="12" style="background-color:#' . $p['project_color_identifier'] . '">
					<a href="?m=projects&a=view&project_id=' . $p['project_id'] . '">
						<font color="' . bestColor($p["project_color_identifier"]) . '">' . $p['project_name'] . '</font>&nbsp</a>
					</TD></TR>';
        //		  	}
        //---- Print Table Data ----//
        foreach ($risks as $row) {
            if (!$row['task_name']) {
开发者ID:slawekmikula,项目名称:dotproject,代码行数:31,代码来源:index.php

示例15: array

$q->addTable('resources', 'a');
$q->addJoin('resource_tasks', 'b', 'b.resource_id = a.resource_id', 'inner');
$q->addJoin('resource_types', 'c', 'c.resource_type_id = a.resource_type', 'inner');
$q->addWhere('b.task_id = ' . (int) $task_id);
$resources = $q->loadHashList('resource_id');
// Determine any other clashes.
$resource_tasks = array();
if (count($resources)) {
    $q->clear();
    $q->addQuery('b.resource_id, sum(b.percent_allocated) as total_allocated');
    $q->addTable('tasks', 'a');
    $q->addJoin('resource_tasks', 'b', 'b.task_id = a.task_id', 'inner');
    $q->addWhere('b.resource_id IN (' . implode(',', array_keys($resources)) . ')');
    $q->addWhere('task_start_date <= \'' . $obj->task_end_date . '\'');
    $q->addWhere('task_end_date >= \'' . $obj->task_start_date . '\'');
    $q->addGroup('resource_id');
    $resource_tasks = $q->loadHashList();
}
?>
<table class="std" width="100%" cellpadding="4" cellspacing="1">
<tr><th>Type</th><th>Resource</th><th>Allocation</th><th>&nbsp;</th></tr>
<?php 
foreach ($resources as $res) {
    $output = '<tr><td class="hilite">' . $res['resource_type_name'] . '</td>
	<td class="hilite">' . $res['resource_name'] . '</td>
	<td class="hilite">' . $res['percent_allocated'] . '%</td><td class="warning">';
    if (isset($resource_tasks[$res['resource_id']]) && $resource_tasks[$res['resource_id']] > $res['resource_max_allocation']) {
        $output .= 'OVERALLOCATED';
    }
    $output .= '&nbsp;</td></tr>';
    echo $output;
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:tasks_tab.view.other_resources.php


注:本文中的DBQuery::addGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。