本文整理汇总了PHP中db_loadHashList函数的典型用法代码示例。如果您正苦于以下问题:PHP db_loadHashList函数的具体用法?PHP db_loadHashList怎么用?PHP db_loadHashList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_loadHashList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllowedUsers
function getAllowedUsers()
{
global $HELPDESK_CONFIG;
//populate user list with all users from permitted companies
$sql = "SELECT user_id, CONCAT(contact_last_name, ',', contact_first_name)\n\t\t\tFROM users\n\t\t LEFT JOIN contacts ON user_contact = contact_id\n\t\t\tWHERE " . getCompanyPerms("user_company", PERM_EDIT, $HELPDESK_CONFIG['the_company']) . " OR " . getCompanyPerms("contact_company", PERM_EDIT, $HELPDESK_CONFIG['the_company']) . "ORDER BY contact_last_name, contact_first_name";
$users = db_loadHashList($sql);
return $users;
}
示例2: getFolderSelectList
function getFolderSelectList()
{
global $AppUI;
$folders = array(0 => '');
$q = new DBQuery();
$q->addTable('file_folders');
$q->addQuery('file_folder_id, file_folder_name, file_folder_parent');
$q->addOrder('file_folder_name');
$sql = $q->prepare();
// $sql = "SELECT file_folder_id, file_folder_name, file_folder_parent FROM file_folders";
$vfolders = arrayMerge(array('0' => array(0, $AppUI->_('Root'), -1)), db_loadHashList($sql, 'file_folder_id'));
$folders = array_filter($vfolders, "check_perm");
return $folders;
}
示例3: getAllowedProjects
function getAllowedProjects($list = 0)
{
global $AppUI, $HELPDESK_CONFIG;
//if helpdeskUseProjectPerms is true, get a list of Projects based on the users standard project permissions
if ($HELPDESK_CONFIG['use_project_perms']) {
require_once $AppUI->getModuleClass('projects');
$project = new CProject();
$allowedProjects = $project->getAllowedRecords($AppUI->user_id, 'project_id, project_name', 'project_name');
//echo "!".implode(" AND ",$rowproject>getAllowedSQL( $AppUI->user_id))."!";
return $allowedProjects;
} else {
//otherwise, get a list of all projects associated with the user's permitted companies.
//the use case here would be that the person assigning or updating the Helpdesk item may not have access to all Projects. They might just be traffic control. This will minimise perm maintenance.
$sql = "SELECT project_id, project_name FROM projects WHERE project_company in (" . implode(",", array_keys(getAllowedCompanies())) . ") ORDER BY project_name";
if ($list) {
return db_loadHashList($sql);
} else {
return db_loadList($sql);
}
}
}
示例4: getDepartmentArrayList
function getDepartmentArrayList($company_id, $checked_array = array(), $dept_parent = 0, $spaces = 0)
{
global $AppUI;
$q = new DBQuery();
$deptsArray = array();
$coArray = array();
$distinctCompanyName = "";
$q->addTable('departments');
$q->addQuery('dept_id, dept_name, co.company_name');
$q->addJoin('companies', 'co', 'departments.dept_company = co.company_id');
$q->addWhere('dept_parent = ' . $dept_parent);
$q->addOrder('co.company_name');
//$q->addWhere('dept_company = ' . $company_id);
require_once $AppUI->getModuleClass('companies');
$obj = new CCompany();
$sql = $q->prepare();
$depts_list = db_loadHashList($sql, 'dept_id');
$q->clear();
foreach ($depts_list as $dept_id => $dept_info) {
if (mb_strlen($dept_info['dept_name']) > 30) {
$dept_info['dept_name'] = mb_substr($dept_info['dept_name'], 0, 28) . '...';
}
$dept_name = str_repeat(' ', $spaces) . $dept_info['dept_name'];
$deptsArray[$dept_id] = $dept_name;
if ($distinctCompanyName != $dept_info['company_name']) {
$coArray[$dept_id] = $dept_info['company_name'];
$distinctCompanyName = $dept_info['company_name'];
}
$childDeptsNCo = getDepartmentArrayList($company_id, $checked_array, $dept_id, $spaces + 5);
$childDepts = $childDeptsNCo[0];
if (!empty($childDepts)) {
foreach ($childDepts as $childDeptId => $childDeptName) {
$deptsArray[$childDeptId] = $childDeptName;
}
}
}
$deptsNCoArray = array();
array_push($deptsNCoArray, $deptsArray, $coArray);
return $deptsNCoArray;
}
示例5: get_dependencies_pd
function get_dependencies_pd($task_id)
{
// Pull tasks dependencies
$q = new DBQuery();
$q->addTable('tasks', 't');
$q->addTable('task_dependencies', 'td');
$q->addQuery('t.task_id, t.task_name');
$q->addWhere("td.dependencies_task_id = {$task_id}");
$q->addWhere('t.task_id = td.dependencies_req_task_id');
$sql = $q->prepare();
$taskDep = db_loadHashList($sql);
}
示例6: array
$sassign = array('' => '(' . $AppUI->_('Assign User') . ')') + $users;
$sunassign = array('' => '(' . $AppUI->_('Unassign User') . ')') + $users;
$obj =& new CTask();
$allowedTasks = $obj->getAllowedSQL($AppUI->user_id, 'tasks.task_id');
$obj->load($task_id);
$task_project = $project_id ? $project_id : ($obj->task_project ? $obj->task_project : 0);
// let's get root tasks
$q = new DBQuery();
$q->addQuery('task_id, task_name, task_end_date, task_start_date, task_milestone, task_parent, task_dynamic');
$q->addTable('tasks');
$q->addWhere('task_project = ' . $task_project);
$q->addWhere('task_id = task_parent');
$q->addOrder('task_start_date');
$sql = $q->prepare();
$q->clear();
$root_tasks = db_loadHashList($sql, 'task_id');
$projTasks = array();
global $task_parent_options;
$task_parent_options = "";
// Now lets get non-root tasks, grouped by the task parent
$q = new DBQuery();
$q->addQuery('task_id, task_name, task_end_date, task_start_date, task_milestone, task_parent, task_dynamic');
$q->addTable('tasks');
$q->addWhere('task_project = ' . $task_project);
$q->addWhere('task_id <> task_parent');
$q->addOrder('task_start_date');
$sql = $q->prepare();
$q->clear();
$parents = array();
$projTasksWithEndDates = array(0 => $AppUI->_('None'));
//arrays contains task end date info for setting new task start date as maximum end date of dependenced tasks
示例7: displayFiles
//.........这里部分代码省略.........
$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)) {
$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) . ')');
}
}
$file_versions_sql = $q->prepare();
$q->clear();
//file arrays
$files = array();
$file_versions = array();
if ($canRead) {
$files = db_loadList($files_sql);
$file_versions = db_loadHashList($file_versions_sql, 'file_id');
}
$q->dropTemp('files_count_max' . $folder_id);
$q->exec();
if ($files == array()) {
return;
}
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tr>
<th nowrap="nowrap"><?php
echo $AppUI->_('File Name');
?>
</th>
<th nowrap="nowrap"><?php
echo $AppUI->_('Description');
?>
</th>
<th nowrap="nowrap"><?php
echo $AppUI->_('Versions');
?>
</th>
<th nowrap="nowrap"><?php
echo $AppUI->_('Category');
?>
</th>
<th nowrap="nowrap"><?php
echo $AppUI->_('Task Name');
?>
</th>
<th nowrap="nowrap"><?php
echo $AppUI->_('Owner');
?>
示例8: foreach
$actions['c'] = $AppUI->_('Copy', UI_OUTPUT_JS);
if ($canEdit) {
$actions['m'] = $AppUI->_('Move', UI_OUTPUT_JS);
$actions['d'] = $AppUI->_('Delete', UI_OUTPUT_JS);
$actions['f'] = $AppUI->_('Mark as Finished', UI_OUTPUT_JS);
foreach ($priorities as $k => $v) {
$actions[$k] = $AppUI->_('set priority to ' . $v, UI_OUTPUT_JS);
}
}
$deny = $proj->getDeniedRecords($AppUI->user_id);
$sql = 'SELECT p.project_id, p.project_name FROM projects AS p';
if ($deny) {
$sql .= ' WHERE p.project_id NOT IN (' . implode(',', $deny) . ')';
}
$sql .= ' ORDER BY p.project_name';
$projects = db_loadHashList($sql, 'project_id');
$p[0] = $AppUI->_('[none]');
foreach ($projects as $proj) {
$p[$proj[0]] = $proj[1];
}
if ($project_id) {
$p[$project_id] = $AppUI->_('[same project]');
}
natsort($p);
$projects = $p;
$ts[0] = $AppUI->_('[top task]');
foreach ($tasks as $t) {
$ts[$t['task_id']] = $t['task_name'];
}
?>
示例9: db_loadHashList
$sql = "SELECT u.user_id,\n\t \t\t\t\tu.user_username, \n\t\t\t\t\tcontact_first_name, \n\t\t\t\t\tcontact_last_name\n\t FROM users AS u\n LEFT JOIN contacts ON u.user_contact = contact_id";
$user_list = db_loadHashList($sql, "user_id");
// Now which tasks will we need and the real allocated hours (estimated time / number of users)
// Also we will use tasks with duration_type = 1 (hours) and those that are not marked
// as milstones
// GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours
$working_hours = $dPconfig['daily_working_hours'];
$sql = "SELECT t.task_id, round(t.task_duration * IF(t.task_duration_type = 24, " . $working_hours . ", t.task_duration_type)/count(ut.task_id),2) as hours_allocated\n\t FROM tasks as t, user_tasks as ut\n\t WHERE t.task_id = ut.task_id\n\t\t\t\t AND t.task_milestone ='0'";
if ($project_id != 0) {
$sql .= " AND t.task_project='{$project_id}'\n";
}
if (!$log_all) {
$sql .= " AND t.task_start_date >= \"" . $start_date->format(FMT_DATETIME_MYSQL) . "\"\n\t\t AND t.task_start_date <= \"" . $end_date->format(FMT_DATETIME_MYSQL) . "\"";
}
$sql .= "GROUP BY t.task_id";
$task_list = db_loadHashList($sql, "task_id");
//echo $sql;
?>
<table cellspacing="1" cellpadding="4" border="0" class="tbl">
<tr>
<th colspan='2'><?php
echo $AppUI->_('User');
?>
</th>
<th><?php
echo $AppUI->_('Hours allocated');
?>
</th>
<th><?php
echo $AppUI->_('Hours worked');
示例10: checkbox
function checkbox($name, $descr, $default = 0, $show = true)
{
global $AppUI;
global ${$name};
if (!isset(${$name})) {
${$name} = $default;
}
if ($show) {
echo '<input type="checkbox" name="' . $name . '" id="' . $name . '" value="1"' . (${$name} ? 'checked="checked"' : '') . ' /><label for="' . $name . '">' . $AppUI->_($descr) . '</label><br />';
} else {
echo '<input type="hidden" name="' . $name . '" value="' . (${$name} ? '1' : '') . '" />';
}
}
// pull projects
$sql = "SELECT project_id, project_name FROM projects ORDER BY project_name";
$projects = arrayMerge(array(0 => '(' . $AppUI->_('All') . ')'), db_loadHashList($sql));
echo $AppUI->_('Project') . ": " . arraySelect($projects, 'project_id', 'class="text"', $project_id) . "<br>";
checkbox("option_check_delayed_tasks", "Check delays for fixed tasks", 1, $do == "conf");
checkbox("option_fix_task_group_date_ranges", "Fix date ranges for task groups according to subtasks dates", 1, $do == "conf");
checkbox("option_no_end_date_warning", "Warn of fixed tasks without end dates", 0, $do == "conf");
checkbox("option_advance_if_possible", "Begin new tasks if dependencies are finished before expected", 1, $do == "conf");
checkbox("option_check_vital_users", "Allow two concurrent tasks when there are no vital users", 1, $do == "conf");
checkbox("option_debug", "Show debug info", 0, $do == "conf");
if ($do == "conf") {
?>
</td>
</tr>
</table>
<br />
<?php
}
示例11: getAllowedUsers
}
if (!$canEdit) {
$AppUI->redirect("m=public&a=access_denied");
}
if (!@$hditem["item_assigned_to"] && $HELPDESK_CONFIG['default_assigned_to_current_user']) {
@($hditem["item_assigned_to"] = $AppUI->user_id);
@($hditem["item_status"] = 1);
}
if (!@$hditem["item_company_id"] && $HELPDESK_CONFIG['default_company_current_company']) {
@($hditem["item_company_id"] = $AppUI->user_company);
}
$users = getAllowedUsers();
$sql = "SELECT company_id, company_name\n FROM companies\n WHERE " . getCompanyPerms("company_id") . "ORDER BY company_name";
$companies = arrayMerge(array(0 => ''), db_loadHashList($sql));
$sql = "\n\tSELECT \n\t\thelpdesk_item_watchers.user_id, \n\t\tCONCAT(contact_last_name, ',', contact_first_name) as name,\n\t\tcontact_email\n\tFROM \n\t\thelpdesk_item_watchers\n\t\tLEFT JOIN users ON helpdesk_item_watchers.user_id = users.user_id\n\t\tLEFT JOIN contacts ON user_contact = contact_id\n WHERE \n \titem_id = " . $item_id . "\n ORDER BY contact_last_name, contact_first_name";
$watchers = db_loadHashList($sql);
// Setup the title block
$ttl = $item_id ? 'Editing Help Desk Item' : 'Adding Help Desk Item';
$titleBlock = new CTitleBlock($ttl, 'helpdesk.png', $m, "{$m}.{$a}");
$titleBlock->addCrumb("?m=helpdesk", 'Home');
$titleBlock->addCrumb("?m=helpdesk&a=list", 'List');
if ($item_id) {
$titleBlock->addCrumb("?m=helpdesk&a=view&item_id={$item_id}", 'View this item');
}
$titleBlock->show();
if ($item_id) {
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$item_date = new CDate($hditem["item_created"]);
$tc = $item_date->format("{$df} {$tf}");
} else {
示例12: db_loadHashList
$sql = 'SELECT u.user_id, u.user_username, contact_first_name, contact_last_name' . ' FROM users AS u' . ' LEFT JOIN contacts ON u.user_contact = contact_id';
$user_list = db_loadHashList($sql, 'user_id');
// Now which tasks will we need and the real allocated hours (estimated time / number of users)
// Also we will use tasks with duration_type = 1 (hours) and those that are not marked
// as milstones
// GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours
$working_hours = $dPconfig['daily_working_hours'];
$sql = 'SELECT t.task_id, round(t.task_duration * IF(t.task_duration_type = 24, ' . $working_hours . ', t.task_duration_type)/count(ut.task_id),2) as hours_allocated' . ' FROM tasks as t, user_tasks as ut' . " WHERE t.task_id = ut.task_id AND t.task_milestone = '0'";
if ($project_id != 0) {
$sql .= " AND t.task_project='{$project_id}'";
}
if (!$log_all) {
$sql .= ' AND t.task_start_date >= "' . $start_date->format(FMT_DATETIME_MYSQL) . '" AND t.task_start_date <= "' . $end_date->format(FMT_DATETIME_MYSQL) . '"';
}
$sql .= ' GROUP BY t.task_id';
$task_list = db_loadHashList($sql, 'task_id');
//echo $sql;
?>
<table cellspacing="1" cellpadding="4" border="0" class="tbl">
<tr>
<th colspan='2'><?php
echo $AppUI->_('User');
?>
</th>
<th><?php
echo $AppUI->_('Hours allocated');
?>
</th>
<th><?php
echo $AppUI->_('Hours worked');
示例13: arrayMerge
$ok = false;
break;
}
if (!$ok) {
echo "Incorrect parameters passed\n";
if ($debug) {
echo "<br />callback = {$callback} \n";
echo "<br />table = {$table} \n";
echo "<br />ok = {$ok} \n";
}
} else {
if (!isset($list)) {
$sql = "SELECT {$select} FROM {$table}";
$sql .= $where ? " WHERE {$where}" : '';
$sql .= $order ? " ORDER BY {$order}" : '';
$list = arrayMerge(array(0 => ''), db_loadHashList($sql));
}
echo db_error();
?>
<script language="javascript">
function setClose(key, val){
window.opener.<?php
echo $callback;
?>
(key,val);
window.close();
}
function setHeight(){
window.opener.<?php
echo $callback;
?>
示例14: doWatchers
function doWatchers($list, $hditem)
{
global $AppUI;
# Create the watcher list
$watcherlist = split(',', $list);
$sql = "SELECT user_id FROM helpdesk_item_watchers WHERE item_id=" . $hditem->item_id;
$current_users = db_loadHashList($sql);
$current_users = array_keys($current_users);
# Delete the existing watchers as the list might have changed
$sql = "DELETE FROM helpdesk_item_watchers WHERE item_id=" . $hditem->item_id;
db_exec($sql);
if (!$del) {
if ($list) {
foreach ($watcherlist as $watcher) {
$sql = "SELECT user_id, contact_email FROM users LEFT JOIN contacts ON user_contact = contact_id WHERE user_id=" . $watcher;
$rows = db_loadlist($sql);
foreach ($rows as $row) {
# Send the notification that they've been added to a watch list.
if (!in_array($row['user_id'], $current_users)) {
notify($row['contact_email'], $hditem);
}
}
$sql = "INSERT INTO helpdesk_item_watchers VALUES(" . $hditem->item_id . "," . $watcher . ",'Y')";
db_exec($sql);
}
}
}
}
示例15: die
<?php
/* SYSKEYS $Id$ */
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly.');
}
$AppUI->savePlace();
// pull all the key types
$sql = "SELECT syskey_id,syskey_name FROM syskeys ORDER BY syskey_name";
$keys = arrayMerge(array(0 => '- Select Type -'), db_loadHashList($sql));
$sql = "SELECT * FROM syskeys, sysvals WHERE sysval_key_id = syskey_id ORDER BY sysval_title";
$values = db_loadList($sql);
$sysval_id = isset($_GET['sysval_id']) ? $_GET['sysval_id'] : 0;
$titleBlock = new CTitleBlock('System Lookup Values', 'myevo-weather.png', $m, "{$m}.{$u}.{$a}");
$titleBlock->addCrumb("?m=system", "System Admin");
$titleBlock->show();
?>
<script language="javascript">
<?php
// security improvement:
// some javascript functions may not appear on client side in case of user not having write permissions
// else users would be able to arbitrarily run 'bad' functions
if ($canEdit) {
?>
function delIt(id, name) {
if (confirm('Are you sure you want to delete \'' + name + '\'?')) {
f = document.sysValFrm;
f.del.value = 1;
f.sysval_id.value = id;
f.submit();
}