本文整理汇总了PHP中db_loadList函数的典型用法代码示例。如果您正苦于以下问题:PHP db_loadList函数的具体用法?PHP db_loadList怎么用?PHP db_loadList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_loadList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchResults
function fetchResults(&$permissions)
{
global $AppUI;
$sql = $this->_buildQuery();
$results = db_loadList($sql);
$outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Projects') . "</th>\n";
require_once $AppUI->getModuleClass("projects");
if ($results) {
foreach ($results as $records) {
if ($permissions->checkModuleItem($this->table, "view", $records["project_id"])) {
$obj = new CProject();
if (!in_array($records["project_id"], $obj->getDeniedRecords($AppUI->user_id))) {
$outstring .= "<tr>";
$outstring .= "<td>";
$outstring .= "<a href = \"index.php?m=projects&a=view&project_id=" . $records["project_id"] . "\">" . $records["project_name"] . "</a>\n";
$outstring .= "</td>\n";
}
}
}
$outstring .= "</tr>";
} else {
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
return $outstring;
}
示例2: getAllowedProjectsForJavascript
function getAllowedProjectsForJavascript()
{
global $HELPDESK_CONFIG, $AppUI;
$allowedProjects = getAllowedProjects();
//if there are none listed, make sure that sql returns nothing
if (!$allowedProjects) {
return "";
}
if ($HELPDESK_CONFIG['use_project_perms']) {
$whereclause = array_keys($allowedProjects);
} else {
foreach ($allowedProjects as $p) {
$whereclause[] = $p['project_id'];
}
}
$whereclause = "project_id in (" . implode(", ", $whereclause) . ")";
$sql = "SELECT project_id, project_name, company_name, company_id\n FROM projects\n LEFT JOIN companies ON company_id = projects.project_company\n WHERE (" . $whereclause . ") ORDER BY project_name";
$allowedCompanyProjectList = db_loadList($sql);
/* Build array of company/projects for output to javascript
Adding slashes in case special characters exist */
foreach ($allowedCompanyProjectList as $row) {
$projects[] = "[{$row['company_id']},{$row['project_id']},'" . addslashes($row['project_name']) . "']";
$reverse[$row['project_id']] = $row['company_id'];
}
return $projects;
}
示例3: fetchResults
function fetchResults(&$permissions)
{
global $AppUI;
if (!$permissions->checkModule('files', 'view')) {
return "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
$sql = $this->_buildQuery();
$results = db_loadList($sql);
$outstring = "<tr><th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Files Content') . "</th></tr>\n";
if ($results) {
foreach ($results as $records) {
$outstring .= "<tr>";
$outstring .= "<td>";
if ($permissions->checkModuleItem('files', "edit", $records["file_id"])) {
$outstring .= "<a href = \"index.php?m=files&a=addedit&file_id=" . $records["file_id"] . "\">" . dPshowImage('./images/icons/stock_edit-16.png', '16', '16') . '</a>';
}
$outstring .= '<a href="' . $this->follow_up_link . $records['file_id'] . '">' . $records["file_name"] . ' v.' . $records['file_version'] . "</a> (word {$records['word_placement']})" . '   --   ' . $records["file_description"];
$outstring .= "</td>\n";
$outstring .= "</tr>";
}
} else {
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
return $outstring;
}
示例4: getExactContractBeginDate
function getExactContractBeginDate($given_time)
{
$company_id = $_REQUEST['company_id'];
$sql = "SELECT application_date from companies WHERE company_id='{$company_id}'";
$rows = db_loadList($sql, NULL);
$au_expiration_date = $rows[0]['application_date'];
$before_one_year = date("m/d/Y", strtotime($au_expiration_date) - 3600 * 24 * 365);
$present_given_time = date("m/d/Y", strtotime($given_time));
//client is kind of confused.
return strtotime($au_expiration_date) > strtotime($given_time) ? date("m/d/Y", strtotime($given_time)) : $present_given_time;
}
示例5: fetchResults
function fetchResults(&$permissions, &$record_count)
{
global $AppUI;
$sql = $this->_buildQuery();
$results = db_loadList($sql);
if ($results) {
$record_count += count($results);
$outstring = "<tr><th><b>" . $AppUI->_($this->table_title) . ' (' . count($results) . ')' . "</b></th></tr> \n";
foreach ($results as $records) {
if ($permissions->checkModuleItem($this->table_module, "view", $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)])) {
// --MSy-
$ii = 0;
$display_val = "";
foreach ($this->display_fields as $fld) {
$ii++;
if (!($this->search_options['display_all_flds'] == "on") && $ii > 2) {
break;
}
$display_val = $display_val . " " . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $fld)];
}
//--MSy-
$tmplink = "";
if (isset($this->table_link) && isset($this->table_key)) {
$tmplink = $this->table_link . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)];
}
if (isset($this->table_link2) && isset($this->table_key2)) {
$tmplink = $this->table_link . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)] . $this->table_link2 . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key2)];
}
//--MSy--
$outstring .= "<tr>";
$outstring .= "<td>";
$outstring .= "<a href = \" " . $tmplink . "\">" . highlight($display_val, $this->keywords) . "</a>\n";
$outstring .= "</td>\n";
$outstring .= "</tr>";
}
}
} else {
if ($this->search_options['show_empty'] == "on") {
$outstring = "<tr><th><b>" . $AppUI->_($this->table_title) . ' (' . count($results) . ')' . "</b></th></tr> \n";
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
}
return $outstring;
}
示例6: fetchResults
function fetchResults(&$permissions)
{
global $AppUI;
$sql = $this->_buildQuery();
$results = db_loadList($sql);
$outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Contacts') . "</th>\n";
if ($results) {
foreach ($results as $records) {
if ($permissions->checkModuleItem($this->table, "view", $records["contact_id"])) {
$outstring .= "<tr>";
$outstring .= "<td>";
$outstring .= "<a href = \"index.php?m=contacts&a=addedit&contact_id=" . $records["contact_id"] . "\">" . $records["contact_first_name"] . " " . $records["contact_last_name"] . "</a>\n";
$outstring .= "</td>\n";
}
}
$outstring .= "</tr>";
} else {
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
return $outstring;
}
示例7: fetchResults
function fetchResults(&$permissions)
{
global $AppUI;
$sql = $this->_buildQuery();
$results = db_loadList($sql);
$outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Task Log') . "</th>\n";
if ($results) {
foreach ($results as $records) {
if ($permissions->checkModuleItem("tasks", "view", $records["task_log_task"])) {
$outstring .= "<tr>";
$outstring .= "<td>";
$outstring .= "<a href = \"index.php?m=tasks&a=view&task_id=" . $records["task_log_task"] . "&tab=1&task_log_id=" . $records["task_log_id"] . "\">" . $records["task_log_name"] . "</a>\n";
$outstring .= "</td>";
}
}
$outstring .= "</tr>";
} else {
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
return $outstring;
}
示例8: fetchResults
function fetchResults(&$permissions)
{
global $AppUI;
$sql = $this->_buildQuery();
$results = db_loadList($sql);
$outstring = "<th nowrap='nowrap' STYLE='background: #cccccc' >" . $AppUI->_('Helpdesk') . "</th>\n";
if ($results) {
foreach ($results as $records) {
if ($permissions->checkModuleItem("helpdesk", "view", $records["item_id"])) {
$outstring .= "<tr>";
$outstring .= "<td>";
$outstring .= "<a href = \"index.php?m=helpdesk&a=view&item_id=" . $records["item_id"] . "\">" . $records["item_title"] . "</a>\n";
$outstring .= "</td>\n";
}
}
$outstring .= "</tr>";
} else {
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
return $outstring;
}
示例9: fetchResults
function fetchResults(&$permissions)
{
global $AppUI;
$sql = $this->_buildQuery();
$results = db_loadList($sql);
$outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Forum Messages') . "</th>\n";
if ($results) {
foreach ($results as $records) {
if ($permissions->checkModuleItem($this->table, "view", $records["message_id"])) {
$outstring .= "<tr>";
$outstring .= "<td>";
$outstring .= "<a href = \"index.php?m=forums&a=view&forum_id=" . $records["message_forum"] . "&message_id=" . $records["message_id"] . "\">" . $records["message_title"] . "</a>\n";
$outstring .= "</td>\n";
}
}
$outstring .= "</tr>";
} else {
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
return $outstring;
}
示例10: fetchResults
function fetchResults(&$permissions)
{
global $AppUI;
$sql = $this->_buildQuery();
$results = db_loadList($sql);
$outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Tickets') . "</th>\n";
if ($results) {
foreach ($results as $records) {
if ($permissions->checkModuleItem($this->table, "view", $records["ticket"])) {
$outstring .= "<tr>";
$outstring .= "<td>";
$outstring .= "<a href = \"index.php?m=ticketsmith&a=view&ticket=" . $records["ticket"] . "\">" . $records["subject"] . "</a>\n";
$outstring .= "</td>\n";
}
}
$outstring .= "</tr>";
} else {
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
return $outstring;
}
示例11: fetchResults
function fetchResults(&$permissions)
{
global $AppUI;
$sql = $this->_buildQuery();
$results = db_loadList($sql);
$outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Files') . "</th>\n";
if ($results) {
foreach ($results as $records) {
if ($permissions->checkModuleItem($this->table, "edit", $records["file_id"])) {
$outstring .= "<tr>";
$outstring .= "<td>";
$outstring .= "<a href = \"index.php?m=files&a=addedit&file_id=" . $records["file_id"] . "\">" . $records["file_name"] . "</a>" . '   --   ' . $records["file_description"];
$outstring .= "</td>\n";
}
}
$outstring .= "</tr>";
} else {
$outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>";
}
return $outstring;
}
示例12: getAllowedDepartmentsForJavascript
function getAllowedDepartmentsForJavascript()
{
global $AppUI;
$allowedDepartments = getAllowedDepartments();
//if there are none listed, make sure that sql returns nothing
if (!$allowedDepartments) {
return "";
}
foreach ($allowedDepartments as $d) {
$whereclause[] = $d['dept_id'];
}
$whereclause = "dept_id in (" . implode(", ", $whereclause) . ")";
$sql = "SELECT dept_id, dept_name, company_name, company_id\n FROM departments\n LEFT JOIN companies ON company_id = departments.dept_company\n WHERE (" . $whereclause . ") ORDER BY dept_name";
$allowedCompanyDepartmentList = db_loadList($sql);
/* Build array of company/departments for output to javascript
Adding slashes in case special characters exist */
foreach ($allowedCompanyDepartmentList as $row) {
$departments[] = "[{$row['company_id']},{$row['dept_id']},'" . addslashes($row['dept_name']) . "']";
$reverse[$row['dept_id']] = $row['company_id'];
}
return $departments;
}
示例13: array
// Responsable de tarea
$perms->add_acl($viewINA_perms, null, array($resp_role), null, array($admin_mods), 1, 1, null, null, "user");
$perms->add_acl($view_perms, null, array($resp_role), null, array($non_admin_mods), 1, 1, null, null, "user");
$perms->add_acl($all_perms, null, array($resp_role), null, array($log_tareas), 1, 1, null, null, "user");
// Consultor
$perms->add_acl($view_perms, null, array($cons_role), null, array($non_admin_mods), 1, 1, null, null, "user");
$perms->add_acl($viewINA_perms, null, array($cons_role), null, array($admin_mods), 1, 1, null, null, "user");
dPmsg("Converting admin user permissions to Administrator Role");
// Now we have the basics set up we need to create objects for all users
$sql = "SELECT user_id, user_username, permission_id from users\nLEFT JOIN permissions ON permission_user = users.user_id and permission_grant_on = 'all' \nAND permission_item = -1 and permission_value = -1";
$res = db_exec($sql);
if ($res) {
while ($row = db_fetch_assoc($res)) {
// Add the basic ARO
$perms->add_object("user", $row["user_username"], $row["user_id"], 1, 0, "aro");
if ($row["permission_id"]) {
$perms->add_group_object($admin_role, "user", $row["user_id"], "aro");
}
}
}
dPmsg("Searching for add-on modules to add to new permissions");
// Upgrade permissions for custom modules
$sql = "SELECT mod_directory, mod_name, permissions_item_table\n\tFROM modules\n\tWHERE mod_ui_active = 1\n\tAND mod_type = 'user'";
$custom_modules = db_loadList($sql);
foreach ($custom_modules as $mod) {
$perms->addModule($mod['mod_directory'], $mod['mod_name']);
$perms->addGroupItem($mod['mod_directory'], "non_admin");
if (isset($mod['permissions_item_table']) && $mod['permissions_item_table']) {
$perms->addModuleSection($mod['permissions_item_table']);
}
}
示例14: die
if (!defined('DP_BASE_DIR')) {
die('You should not access this file directly. Instead, run the Installer in install/index.php.');
}
/**
* This script iterates all contacts and verify if the contact_company
* field has a text value; if it does, it searches of the company in the
* companies table, if it finds it then the contact is related to it by its id.
* If it doesn't find it, the it creates the company (only the name) and then it
* relates it to the contact using the new company's id.
*/
dPmsg('Fetching companies list');
$q = new DBQuery();
$q->addTable('contacts');
$q->addQuery('*');
$sql = $q->prepare(true);
foreach (db_loadList($sql) as $contact) {
$contact_company = $contact['contact_company'];
if (is_numeric($contact_company)) {
if (!checkCompanyId($contact_company)) {
dPmsg('Error found in contact_company in the contact ' . getContactGeneralInformation($contact));
}
} else {
if ($contact_company != "") {
$company_id = fetchCompanyId($contact_company);
// If we find company_id
if (!$company_id) {
// We need to create the new company
$company_id = insertCompany($contact_company);
}
if ($company_id) {
updateContactCompany($contact, $company_id);
示例15: displayFiles
//.........这里部分代码省略.........
$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)) {
$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');