本文整理汇总了PHP中db_loadHash函数的典型用法代码示例。如果您正苦于以下问题:PHP db_loadHash函数的具体用法?PHP db_loadHash怎么用?PHP db_loadHash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_loadHash函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install()
{
$sql = "SELECT mod_directory FROM modules WHERE mod_directory = '{$this->mod_directory}'";
if (db_loadHash($sql, $temp)) {
// the module is already installed
// TODO: check for older version - upgrade
return false;
}
$sql = 'SELECT max(mod_ui_order)
FROM modules';
// We need to account for "pre-installed" modules that are "UI Inaccessible"
// in order to make sure we get the "correct" initial value for .
// mod_ui_order values of "UI Inaccessible" modules are irrelevant
// and should probably be set to 0 so as not to interfere.
$sql .= " WHERE mod_name NOT LIKE 'Public'";
$this->mod_ui_order = db_loadResult($sql) + 1;
$perms =& $GLOBALS['AppUI']->acl();
$perms->addModule($this->mod_directory, $this->mod_name);
// Determine if it is an admin module or not, then add it to the correct set
if (!isset($this->mod_admin)) {
$this->mod_admin = 0;
}
if ($this->mod_admin) {
$perms->addGroupItem($this->mod_directory, "admin");
} else {
$perms->addGroupItem($this->mod_directory, "non_admin");
}
if (isset($this->permissions_item_table) && $this->permissions_item_table) {
$perms->addModuleSection($this->permissions_item_table);
}
$this->store();
return true;
}
示例2: install
function install()
{
$sql = "SELECT mod_directory FROM modules WHERE mod_directory = '{$this->mod_directory}'";
if (db_loadHash($sql, $temp)) {
// the module is already installed
// TODO: check for older version - upgrade
return false;
}
$sql = 'SELECT max(mod_ui_order)
FROM modules';
$this->mod_ui_order = db_loadResult($sql) + 1;
$perms =& $GLOBALS['AppUI']->acl();
$perms->addModule($this->mod_directory, $this->mod_name);
// Determine if it is an admin module or not, then add it to the correct set
if (!isset($this->mod_admin)) {
$this->mod_admin = 0;
}
if ($this->mod_admin) {
$perms->addGroupItem($this->mod_directory, "admin");
} else {
$perms->addGroupItem($this->mod_directory, "non_admin");
}
if (isset($this->permissions_item_table) && $this->permissions_item_table) {
$perms->addModuleSection($this->permissions_item_table);
}
$this->store();
return true;
}
示例3: db_loadObject
/**
* This global function loads the first row of a query into an object
*
* If an object is passed to this function, the returned row is bound to the existing elements of <var>object</var>.
* If <var>object</var> has a value of null, then all of the returned query fields returned in the object.
* @param string The SQL query
* @param object The address of variable
*/
function db_loadObject($sql, &$object, $bindAll = false, $strip = true)
{
if ($object != null) {
$hash = array();
if (!db_loadHash($sql, $hash)) {
return false;
}
bindHashToObject($hash, $object, null, $strip, $bindAll);
return true;
} else {
$cur = db_exec($sql);
$cur or exit(db_error());
if ($object = db_fetch_object($cur)) {
db_free_result($cur);
return true;
} else {
$object = null;
return false;
}
}
}
示例4: db_loadHash
}
$q->addTable('history');
$q->addUpdate('history_item = history_id');
$q->addWhere('history_table = \'history\'');
$okMsg = 'History deleted';
}
$q->clear();
$AppUI->redirect();
}
// pull the history
$q->addTable('history');
$q->addQuery('*');
$q->addWhere('history_id =' . $history_id);
$sql = $q->prepare();
$q->clear();
db_loadHash($sql, $history);
?>
<form name="AddEdit" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<input name="action" type="hidden" value="<?php
echo $history_id ? "update" : "add";
?>
">
<tr>
<td><img src="./images/icons/tasks.gif" alt="" border="0"></td>
<td align="left" nowrap="nowrap" width="100%"><h1><?php
echo $AppUI->_($history_id ? 'Edit history' : 'New history');
?>
</h1></td>
</tr>
示例5: db_loadList
</th>
<th width="100%"><?php
echo $AppUI->_('Comments');
?>
</th>
<th></th>
</tr>
<?php
// Pull the task comments
$sql = "\nSELECT task_log.*, user_username\nFROM task_log\nLEFT JOIN users ON user_id = task_log_creator\nWHERE task_log_help_desk_id = {$item_id}\nORDER BY task_log_date\n";
$logs = db_loadList($sql);
$s = '';
$hrs = 0;
// Pull help desk item details
$sql = "SELECT item_company_id,item_created_by\n FROM helpdesk_items hi\n WHERE item_id = '{$item_id}'";
db_loadHash($sql, $hditem);
$canEdit = hditemEditable($hditem);
$df = $AppUI->getPref('SHDATEFORMAT');
foreach ($logs as $row) {
$task_log_date = intval($row['task_log_date']) ? new CDate($row['task_log_date']) : null;
$s .= '<tr bgcolor="white" valign="top">';
$s .= "\n\t<td>";
if ($canEdit) {
$s .= "\n\t\t<a href=\"?m=helpdesk&a=view&item_id={$item_id}&tab=1&task_log_id=" . @$row['task_log_id'] . "\">" . "\n\t\t\t" . dPshowImage('./images/icons/stock_edit-16.png', 16, 16, '') . "\n\t\t</a>";
}
$s .= "\n\t</td>";
$s .= '<td nowrap="nowrap">' . ($task_log_date ? $task_log_date->format($df) : '-') . '</td>';
$s .= '<td width="30%">' . @$row["task_log_name"] . '</td>';
$s .= '<td width="100">' . $row["user_username"] . '</td>';
$s .= '<td width="100" align="right">' . sprintf("%.2f", $row["task_log_hours"]) . '</td>';
$s .= '<td width="100">' . $task_log_costcodes[$row["task_log_costcode"]] . '</td>';
示例6: DBQuery
if (isset($_GET['tab'])) {
$AppUI->setState('UserVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('UserVwTab') !== NULL ? $AppUI->getState('UserVwTab') : 0;
// pull data
$q = new DBQuery();
$q->addTable('users', 'u');
$q->addQuery('u.*');
$q->addQuery('con.*, company_id, company_name, dept_name, dept_id');
$q->addJoin('contacts', 'con', 'user_contact = contact_id');
$q->addJoin('companies', 'com', 'contact_company = company_id');
$q->addJoin('departments', 'dep', 'dept_id = contact_department');
$q->addWhere('u.user_id = ' . $user_id);
$sql = $q->prepare();
$q->clear();
if (!db_loadHash($sql, $user)) {
$titleBlock = new CTitleBlock('Invalid User ID', 'helix-setup-user.png', $m, "{$m}.{$a}");
$titleBlock->addCrumb('?m=admin', 'users list');
$titleBlock->show();
} else {
// setup the title block
$titleBlock = new CTitleBlock('View User', 'helix-setup-user.png', $m, "{$m}.{$a}");
if ($canRead) {
$titleBlock->addCrumb('?m=admin', 'users list');
}
if ($canEdit) {
$titleBlock->addCrumb('?m=admin&a=addedituser&user_id=' . $user_id, 'edit this user');
}
if ($canEdit || $user_id == $AppUI->user_id) {
$titleBlock->addCrumb('?m=system&a=addeditpref&user_id=' . $user_id, 'edit preferences');
$titleBlock->addCrumbRight('<a href="#" onclick="popChgPwd();return false">' . $AppUI->_('change password') . '</a>');
示例7: isset
if ($denyEdit) {
$AppUI->redirect("m=public&a=access_denied");
}
require_once $AppUI->getSystemClass('date');
//***START MOD*** pedroa 20050609
require_once $AppUI->getModuleClass('projects');
global $AppUI;
//***END MOD
$df = $AppUI->getPref('SHDATEFORMAT');
$tid = isset($_GET['tid']) ? $_GET['tid'] : 0;
$winnow_project = getPermsWhereClause("projects", "projects.project_id");
$winnow_tasks = getPermsWhereClause("tasks", "tasks.task_id");
//pull data
// if we have a TID, then we editing an existing row
$sql = " \nSELECT task_log.*, project_name, task_name, task_project, project_company \nFROM task_log\nLEFT JOIN tasks ON task_id = task_log_task\nLEFT JOIN projects ON project_id = task_project\nWHERE task_log_id = {$tid} \n\tAND {$winnow_project}\n\tAND {$winnow_tasks}\n";
db_loadHash($sql, $task);
$is_new_record = !$tid;
$task_found = $task['project_company'] != FALSE;
$require_task_info = $is_new_record || $task_found;
global $TIMECARD_CONFIG;
//Prevent users from editing other ppls timecards.
$can_edit_other_timesheets = $TIMECARD_CONFIG['minimum_edit_level'] >= $AppUI->user_type;
if (!$can_edit_other_timesheets) {
if (isset($_GET['tid']) && (isset($v['task_log_creator']) && $task['task_log_creator'] != $AppUI->user_id || !isset($task['task_log_creator']))) {
$AppUI->redirect("m=public&a=access_denied");
}
}
$AppUI->savePlace();
if (isset($task['task_log_date'])) {
$date = new CDate($task['task_log_date']);
} else {
示例8: getProject
function getProject()
{
$q = new DBQuery();
$q->addTable('projects');
$q->addQuery('project_name, project_short_name, project_color_identifier');
$q->addWhere("project_id = '" . $this->task_project . "'");
$sql = $q->prepare();
$q->clear();
$proj = db_loadHash($sql, $projects);
return $projects;
}
示例9: array
if ($filter != null) {
$q->addWhere($filter);
}
$q->addOrder($name_field);
$company_list = array("0" => "") + $q->loadHashList();
?>
<?php
if (dPgetParam($_POST, $id_field, 0) != 0) {
$q = new DBQuery();
$q->addTable($table_name);
$q->addQuery('*');
$q->addWhere("{$id_field}=" . $_POST[$id_field]);
$sql = $q->prepare();
$q->clear();
db_loadHash($sql, $r_data);
$data_update_script = "";
$update_address = isset($_POST["overwrite_address"]);
if ($table_name == "companies") {
$update_fields = array();
if ($update_address) {
$update_fields = array("company_address1" => "contact_address1", "company_address2" => "contact_address2", "company_city" => "contact_city", "company_state" => "contact_state", "company_zip" => "contact_zip", "company_phone1" => "contact_phone", "company_phone2" => "contact_phone2", "company_fax" => "contact_fax");
}
$data_update_script = "opener.setCompany('" . $_POST[$id_field] . "', '" . db_escape($r_data[$name_field]) . "');\n";
} else {
if ($table_name == "departments") {
$update_fields = array("dept_id" => "contact_department");
if ($update_address) {
$update_fields = array("dept_address1" => "contact_address1", "dept_address2" => "contact_address2", "dept_city" => "contact_city", "dept_state" => "contact_state", "dept_zip" => "contact_zip", "dept_phone" => "contact_phone", "dept_fax" => "contact_fax");
}
$data_update_script = "opener.setDepartment('" . $_POST[$id_field] . "', '" . db_escape($r_data[$name_field]) . "');\n";
示例10: dPgetParam
$item_id = dPgetParam($_GET, 'item_id', 0);
// Get pagination page
if (isset($_GET['page'])) {
$AppUI->setState('HelpDeskLogPage', $_GET['page']);
} else {
$AppUI->setState('HelpDeskLogPage', 0);
}
$page = $AppUI->getState('HelpDeskLogPage') ? $AppUI->getState('HelpDeskLogPage') : 0;
// Get tab state
if (isset($_GET['tab'])) {
$AppUI->setState('HelpLogVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('HelpLogVwTab') !== NULL ? $AppUI->getState('HelpLogVwTab') : 0;
// Pull data
$sql = "SELECT hi.*,\n CONCAT(co.contact_first_name,' ',co.contact_last_name) assigned_to_fullname,\n co.contact_email as assigned_email,\n p.project_id,\n p.project_name,\n p.project_color_identifier,\n c.company_name,\n d.dept_name\n FROM helpdesk_items hi\n LEFT JOIN users u ON u.user_id = hi.item_assigned_to\n LEFT JOIN contacts co ON co.contact_id = u.user_contact\n LEFT JOIN projects p ON p.project_id = hi.item_project_id\n LEFT JOIN companies c ON c.company_id = hi.item_company_id\n LEFT JOIN departments d ON d.dept_id = hi.item_department_id\n WHERE item_id = '{$item_id}'";
if (!db_loadHash($sql, $hditem)) {
$titleBlock = new CTitleBlock($AppUI->_('Invalid item id'), 'helpdesk.png', $m, 'ID_HELP_HELPDESK_VIEW');
$titleBlock->addCrumb("?m=helpdesk", 'Home');
$titleBlock->addCrumb("?m=helpdesk&a=list", 'List');
$titleBlock->show();
} else {
// Check permissions on this record
$canRead = hditemReadable($hditem);
$canEdit = hditemEditable($hditem);
if (!$canRead && !$canEdit) {
$AppUI->redirect("m=public&a=access_denied");
}
$name = $hditem['item_requestor'];
$assigned_to_name = $hditem["item_assigned_to"] ? $hditem["assigned_to_fullname"] : "";
$assigned_email = $hditem["assigned_email"];
$sql = "\n\tSELECT \n\t\thelpdesk_item_watchers.user_id, \n\t\tCONCAT(contact_first_name, ' ', contact_last_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\tWHERE \n\t\titem_id = " . $item_id . "\n\tORDER BY contact_last_name, contact_first_name";
示例11: CTitleBlock
$q->addQuery('CONCAT( contact_first_name, \' \', contact_last_name)');
$q->addTable('users');
$q->leftJoin('contacts', 'c', 'user_contact = contact_id');
$q->addOrder('contact_first_name, contact_last_name');
$users = $q->loadHashList();
$q->clear();
$q->addQuery('project_id, project_name');
$q->addTable('projects');
$projects = $q->loadHashList();
$projects[0] = '[All]';
//Pull contact information
$q->clear();
$q->addQuery('*');
$q->addTable('risks');
$q->addWhere('risk_id = ' . $risk_id);
if (!db_loadHash($q->prepare(), $risk) && $risk_id > 0) {
$titleBlock = new CTitleBlock('Invalid Risk ID', 'folder5.png', $m, "{$m}.{$a}");
$titleBlock->addCrumb("?m=risks", "Risks list");
$titleBlock->show();
$tasks = array();
} else {
if (isset($risk['risk_project'])) {
$q->clear();
$q->addQuery('task_id, task_name');
$q->addTable('tasks');
$q->addWhere('task_project = ' . $risk['risk_project']);
$tasks = $q->loadHashList();
} else {
$tasks = array();
}
// setup the title block
示例12: getProject
function getProject()
{
$sql = "SELECT project_name, project_short_name, project_color_identifier FROM projects WHERE project_id = '{$this->task_project}'";
$proj = db_loadHash($sql, $projects);
return $projects;
}
示例13: db_loadHash
} else {
if ($action == "del") {
$sql = "DELETE FROM holiday WHERE holiday_id = " . $holiday_id;
$okMsg = "Holiday removed";
}
}
}
if (!db_exec($sql)) {
$AppUI->setMsg(db_error());
} else {
$AppUI->setMsg($okMsg);
}
$AppUI->redirect();
}
// pull the holiday from the database
db_loadHash("SELECT * FROM holiday WHERE holiday_id = {$holiday_id}", $holiday);
if ($holiday_white == -1) {
$holiday_white = $holiday['holiday_white'];
}
?>
<script language="javascript">
var calendarField = '';
function popCalendar( field ){
calendarField = field;
idate = eval( 'document.AddEdit.log_' + field + '.value' );
window.open( 'index.php?m=public&a=calendar&dialog=1&callback=setCalendar&date=' + idate, 'calwin', 'width=250, height=220, scollbars=false' );
}
function setCalendar( idate, fdate ) {
fld_date = eval( 'document.AddEdit.log_' + calendarField );
fld_fdate = eval( 'document.AddEdit.' + calendarField );
示例14: DBQuery
if ($dept_id > 0) {
// pull data
$q = new DBQuery();
$q->addTable('companies', 'com');
$q->addTable('departments', 'dep');
$q->addQuery('dep.*, company_name');
$q->addQuery('con.contact_first_name');
$q->addQuery('con.contact_last_name');
$q->addJoin('users', 'u', 'u.user_id = dep.dept_owner');
$q->addJoin('contacts', 'con', 'u.user_contact = con.contact_id');
$q->addWhere('dep.dept_id = ' . $dept_id);
$q->addWhere('dep.dept_company = company_id');
$sql = $q->prepare();
$q->clear();
}
if (!db_loadHash($sql, $dept)) {
$titleBlock = new CTitleBlock('Invalid Department ID', 'users.gif', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=companies', 'companies list');
$titleBlock->show();
} else {
if ($dept_id <= 0) {
echo $AppUI->_('Please choose a Department first!');
} else {
$company_id = $dept['dept_company'];
if (!$min_view) {
// setup the title block
$titleBlock = new CTitleBlock('View Department', 'users.gif', $m, $m . '.' . $a);
if ($canEdit) {
$titleBlock->addCell();
$titleBlock->addCell('<form action="?m=departments&a=addedit&company_id=' . $company_id . '&dept_parent=' . $dept_id . '" method="post">' . '<input type="submit" class="button" value="' . $AppUI->_('new department') . '" />' . '</form>');
}
示例15: getDepartmentDetails
function getDepartmentDetails()
{
$result = array('dept_id' => 0, 'dept_name' => '');
if (!$this->contact_department) {
return $result;
}
$sql = "select dept_id, dept_name from departments";
$q = new DBQuery();
$q->addTable('departments');
$q->addQuery('dept_id, dept_name');
if ($this->is_alpha($this->contact_department)) {
$q->addWhere("dept_name = '" . $this->contact_department . "'");
} else {
$q->addWhere("dept_id = '" . $this->contact_department . "'");
}
$sql = $q->prepare();
$q->clear();
db_loadHash($sql, $result);
return $result;
}