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


PHP DBQuery::loadHash方法代码示例

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


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

示例1: getCompanyInfo

function getCompanyInfo($company_id)
{
    global $AppUI;
    $q = new DBQuery();
    $q->addTable('companies', 'c');
    $q->addJoin('users', 'u', 'u.user_id = c.company_owner');
    $q->addJoin('contacts', 'co', 'u.user_contact = co.contact_id');
    $q->addQuery('c.*, CONCAT(contact_first_name, " ", contact_last_name) AS contact_name');
    $q->addWhere('c.company_id = ' . $company_id);
    $company = $q->loadHash();
    if (!$company) {
        $AppUI->setMsg('Missing company ID', UI_MSG_ERROR);
        echo $AppUI->getMsg();
        return;
    }
    include 'modules/public/resources.info.php';
}
开发者ID:n2i,项目名称:xvnkb,代码行数:17,代码来源:viewinfo.php

示例2: current

    $first_task = current($tasks);
    $actual_project_id = 0;
    $first_task = true;
    $task_log = array();
    echo "<table class='tbl' width='80%' summary='task log'>";
    echo "<tr><th>" . $AppUI->_("Task name") . "</th><th>" . $AppUI->_("T.Owner") . "</th><th>" . $AppUI->_("H.Alloc.") . "</th><th>" . $AppUI->_("Task end date") . "</th><th>" . $AppUI->_("Last activity date") . "</th><th>" . $AppUI->_("Done") . "?</th></tr>";
    $hrs = $AppUI->_("hrs");
    // To avoid calling $AppUI each row
    foreach ($tasks as $task) {
        if ($actual_project_id != $task["task_project"]) {
            echo "<tr><td colspan='6'><b>" . $task["project_name"] . "</b></td>";
            $actual_project_id = $task["task_project"];
        }
        if (!$q instanceof DBQuery) {
            //only create if wasn't already present as it may have been created above
            $q = new DBQuery();
        }
        $q->addTable('task_log');
        $q->addQuery('*');
        $q->addWhere('task_log_task = ' . $task['task_id']);
        $q->addOrder('task_log_date desc');
        $q->setLimit('1');
        $task_log = $q->loadHash();
        $done_img = $task["task_percent_complete"] == 100 ? "Yes" : "No";
        echo "<tr><td>&nbsp;&nbsp;&nbsp;" . $task["task_name"] . "</td><td>" . $task["user_username"] . "</td><td>" . $task["task_duration"] * $task["task_duration_type"] . " {$hrs}</td><td>" . $task["task_end_date"] . "</td><td>" . $task_log["task_log_date"] . "</td><td align='center'>{$done_img}</td></tr>";
    }
}
?>
		

开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:28,代码来源:taskenddate.php

示例3: DBQuery

    $q->addTable('contacts', 'con');
    $q->addQuery('con.*, company_id, company_name, dept_name');
    $q->addJoin('companies', 'com', 'contact_company = company_id');
    $q->addJoin('departments', 'dep', 'dept_id = contact_department');
    $q->addWhere('con.contact_id = ' . (int) $contact_id);
} else {
    $q = new DBQuery();
    $q->addTable('users', 'u');
    $q->addQuery('u.*');
    $q->addQuery('con.*, company_id, company_name, dept_name');
    $q->addJoin('contacts', 'con', 'user_contact = contact_id', 'inner');
    $q->addJoin('companies', 'com', 'contact_company = company_id');
    $q->addJoin('departments', 'dep', 'dept_id = contact_department');
    $q->addWhere('u.user_id = ' . (int) $user_id);
}
$user = $q->loadHash();
$q->clear();
if (!$user && $user_id > 0) {
    $titleBlock = new CTitleBlock('Invalid User ID', 'helix-setup-user.png', $m, $m . '.' . $a);
    $titleBlock->addCrumb('?m=admin', 'users list');
    $titleBlock->show();
} else {
    if ($user_id == 0 && !$contact_id) {
        $user['contact_id'] = 0;
    }
    // pull companies
    $company = new CCompany();
    $companies = $company->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
    $companies = arrayMerge(array('0' => ''), $companies);
    // setup the title block
    $ttl = $user_id > 0 ? 'Edit User' : 'Add User';
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:addedituser.php

示例4: notify

 public function notify($assignees, $update = false, $clash = false)
 {
     global $AppUI, $locale_char_set, $w2Pconfig;
     $mail_owner = $AppUI->getPref('MAILALL');
     $assignee_list = explode(',', $assignees);
     $owner_is_assigned = in_array($this->event_owner, $assignee_list);
     if ($mail_owner && !$owner_is_assigned && $this->event_owner) {
         array_push($assignee_list, $this->event_owner);
     }
     // Remove any empty elements otherwise implode has a problem
     foreach ($assignee_list as $key => $x) {
         if (!$x) {
             unset($assignee_list[$key]);
         }
     }
     if (!count($assignee_list)) {
         return;
     }
     $q = new DBQuery();
     $q->addTable('users', 'u');
     $q->addTable('contacts', 'con');
     $q->addQuery('user_id, contact_first_name,contact_last_name, contact_email');
     $q->addWhere('u.user_contact = con.contact_id');
     $q->addWhere('user_id in (' . implode(',', $assignee_list) . ')');
     $users = $q->loadHashList('user_id');
     $date_format = $AppUI->getPref('SHDATEFORMAT');
     $time_format = $AppUI->getPref('TIMEFORMAT');
     $fmt = $date_format . ' ' . $time_format;
     $start_date = new CDate($this->event_start_date);
     $end_date = new CDate($this->event_end_date);
     $mail = new Mail();
     $type = $update ? $AppUI->_('Updated') : $AppUI->_('New');
     if ($clash) {
         $mail->Subject($AppUI->_('Requested Event') . ': ' . $this->event_title, $locale_char_set);
     } else {
         $mail->Subject($type . ' ' . $AppUI->_('Event') . ': ' . $this->event_title, $locale_char_set);
     }
     $body = '';
     if ($clash) {
         $body .= "You have been invited to an event by {$AppUI->user_first_name} {$AppUI->user_last_name}\n";
         $body .= "However, either you or another intended invitee has a competing event\n";
         $body .= "{$AppUI->user_first_name} {$AppUI->user_last_name} has requested that you reply to this message\n";
         $body .= "and confirm if you can or can not make the requested time.\n\n";
     }
     $body .= $AppUI->_('Event') . ":\t" . $this->event_title . "\n";
     if (!$clash) {
         $body .= $AppUI->_('URL') . ":\t" . w2PgetConfig('base_url') . "/index.php?m=calendar&a=view&event_id=" . $this->event_id . "\n";
     }
     $body .= $AppUI->_('Starts') . ":\t" . $start_date->format($fmt) . "\n";
     $body .= $AppUI->_('Ends') . ":\t" . $end_date->format($fmt) . "\n";
     // Find the project name.
     if ($this->event_project) {
         $prj = array();
         $q = new DBQuery();
         $q->addTable('projects', 'p');
         $q->addQuery('project_name');
         $q->addWhere('p.project_id =' . $this->event_project);
         if ($prj = $q->loadHash()) {
             $body .= $AppUI->_('Project') . ":\t" . $prj['project_name'] . "\n";
         }
         $q->clear();
     }
     $types = w2PgetSysVal('EventType');
     $body .= $AppUI->_('Type') . ":\t" . $AppUI->_($types[$this->event_type]) . "\n";
     $body .= $AppUI->_('Attendees') . ":\t";
     $body_attend = '';
     foreach ($users as $user) {
         $body_attend .= ($body_attend ? ', ' : '') . $user['contact_first_name'] . ' ' . $user['contact_last_name'];
     }
     $body .= $body_attend . "\n\n" . $this->event_description . "\n";
     $mail->Body($body, $locale_char_set);
     foreach ($users as $user) {
         if (!$mail_owner && $user['user_id'] == $this->event_owner) {
             continue;
         }
         $mail->To($user['contact_email'], true);
         $mail->Send();
     }
 }
开发者ID:joly,项目名称:web2project,代码行数:79,代码来源:calendar.class.php

示例5: isset

if ($denyEdit) {
    $AppUI->setMsg('Access denied', UI_MSG_ERROR);
    $AppUI->redirect();
}
require_once $AppUI->getSystemClass('date');
require_once $AppUI->getModuleClass('projects');
$df = $AppUI->getPref('SHDATEFORMAT');
$tid = isset($_GET['tid']) ? $_GET['tid'] : 0;
$q = new DBQuery();
$task = array();
if ($tid > 0) {
    $q->addTable('task_log', 'tl');
    $q->addQuery('tl.*,t.task_project');
    $q->addJoin('tasks', 't', 'tl.task_log_task = t.task_id');
    $q->addWhere('task_log_id = ' . $tid);
    $task = $q->loadHash();
    $task_project = $task['task_project'];
    $creator = isset($task['task_log_creator']) ? $task['task_log_creator'] : 0;
} else {
    $creator = $AppUI->user_id;
}
$AppUI->savePlace();
if (isset($task['task_log_date'])) {
    $date = new CDate($task['task_log_date']);
} else {
    if (isset($_GET['date'])) {
        $date = new CDate($_GET['date']);
    } else {
        $date = new CDate();
    }
}
开发者ID:n2i,项目名称:xvnkb,代码行数:31,代码来源:vw_newlog.php

示例6: array

foreach ($avail_modules as $avail_module) {
    $modules[$avail_module['value']] = $avail_module['value'];
}
$modules = array(0 => 'All Modules') + $modules;
$actions = array(0 => 'All Actions', 'access' => 'access', 'add' => 'add', 'delete' => 'delete', 'edit' => 'edit', 'view' => 'view');
$table = '<table class="tbl" width="100%" cellspacing="1" cellpadding="2" border="0">';
$table .= '<tr><th colspan="9"><b>Permission Result Table</b></th></tr>';
$table .= '<tr><th>UserID</th><th>User</th><th>User Name</th><th>Module</th><th>Item</th><th>Item Name</th><th>Action</th><th>Allow</th><th>ACL_ID</th></tr>';
foreach ($permissions as $permission) {
    $item = '';
    if ($permission['item_id']) {
        $q = new DBQuery();
        $q->addTable('modules');
        $q->addQuery('permissions_item_field,permissions_item_label');
        $q->addWhere('mod_directory = \'' . $permission['module'] . '\'');
        $field = $q->loadHash();
        $q = new DBQuery();
        $q->addTable($permission['module']);
        $q->addQuery($field['permissions_item_label']);
        $q->addWhere($field['permissions_item_field'] . ' = \'' . $permission['item_id'] . '\'');
        $item = $q->loadResult();
    }
    if (!($permission['item_id'] && !$permission['acl_id'])) {
        $table .= '<tr>' . '<td style="text-align:right;">' . $permission['user_id'] . '</td>' . '<td>' . $permission['user_name'] . '</td>' . '<td>' . $users[$permission['user_id']] . '</td>' . '<td>' . $permission['module'] . '</td>' . '<td style="text-align:right;">' . ($permission['item_id'] ? $permission['item_id'] : '') . '</td>' . '<td>' . ($item ? $item : 'ALL') . '</td>' . '<td>' . $permission['action'] . '</td>' . '<td ' . (!$permission['access'] ? 'style="text-align:right;background-color:red"' : 'style="text-align:right;background-color:green"') . '>' . $permission['access'] . '</td>' . '<td ' . ($permission['acl_id'] ? '' : 'style="background-color:gray"') . '>' . ($permission['acl_id'] ? $permission['acl_id'] : 'soft-denial') . '</td>' . '</tr>';
    }
}
$table .= '</table>';
$users = array('' => '(' . $AppUI->_('Select User') . ')') + $users;
$user = isset($_POST['user']) && $_POST['user'] != '' ? $_POST['user'] : $AppUI->user_id;
$user_selector = arraySelect($users, 'user', 'class="text" onchange="javascript:document.pickUser.submit()"', $user);
$module = isset($_POST['module']) && $_POST['module'] != '' ? $_POST['module'] : '';
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:acls_view.php

示例7: die

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not call this file directly.');
}
$AppUI->savePlace();
$sort = w2PgetParam($_REQUEST, 'sort', 'asc');
$forum_id = w2PgetParam($_REQUEST, 'forum_id', 0);
$message_id = w2PgetParam($_REQUEST, 'message_id', 0);
$perms =& $AppUI->acl();
$q = new DBQuery();
$q->addQuery('f.forum_name, p.project_name');
$q->addTable('forums', 'f');
$q->addJoin('projects', 'p', 'p.project_id = f.forum_project', 'inner');
$q->addWhere('f.forum_id = ' . (int) $forum_id);
$forum = $q->loadHash();
if (!$perms->checkModuleItem('forums', 'view', $message_id)) {
    $AppUI->redirect('m=public&a=access_denied');
}
$q = new DBQuery();
$q->addTable('forums');
$q->addTable('forum_messages');
$q->addQuery('forum_messages.*,	contact_first_name, contact_last_name, contact_email, user_username, forum_moderated, visit_user');
$q->addJoin('forum_visits', 'v', 'visit_user = ' . (int) $AppUI->user_id . ' AND visit_forum = ' . (int) $forum_id . ' AND visit_message = forum_messages.message_id');
$q->addJoin('users', 'u', 'message_author = u.user_id', 'inner');
$q->addJoin('contacts', 'con', 'contact_id = user_contact', 'inner');
$q->addWhere('forum_id = message_forum AND (message_id = ' . (int) $message_id . ' OR message_parent = ' . (int) $message_id . ')');
if (w2PgetConfig('forum_descendent_order') || w2PgetParam($_REQUEST, 'sort', 0)) {
    $q->addOrder('message_date ' . $sort);
}
$messages = $q->loadList();
开发者ID:joly,项目名称:web2project,代码行数:30,代码来源:view_pdf.php

示例8: checkModuleItemDenied

 /**
  * This gets tricky and is there mainly for the compatibility layer
  * for getDeny functions.
  * If we get an ACL ID, and we get allow = false, then the item is
  * actively denied.	Any other combination is a soft-deny (i.e. not
  * strictly allowed, but not actively denied.
  */
 function checkModuleItemDenied($module, $op, $item, $user_id = null)
 {
     if (!$user_id) {
         $user_id = $GLOBALS['AppUI']->user_id;
     }
     $q = new DBQuery();
     $q->addQuery('allow');
     $q->addTable('dotpermissions');
     $q->addWhere("permission='{$op}' AND axo='{$item}' AND user_id='{$user_id}' and section='{$module}'");
     $q->addOrder('priority ASC, acl_id DESC');
     $q->setLimit(1);
     $arr = $q->loadHash();
     if ($arr && !$arr['allow']) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:25,代码来源:permissions.class.php

示例9: getDepartmentDetails

 function getDepartmentDetails()
 {
     $result = array('dept_id' => 0, 'dept_name' => '');
     if (!$this->contact_department) {
         return $result;
     }
     $q = new DBQuery();
     $q->addTable('departments');
     $q->addQuery('dept_id, dept_name');
     $q->addWhere('dept_id = ' . (int) $this->contact_department);
     return $q->loadHash();
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:12,代码来源:contacts.class.php

示例10: install

 public function install()
 {
     $q = new DBQuery();
     $q->addTable('modules');
     $q->addQuery('mod_directory');
     $q->addWhere('mod_directory = \'' . $this->mod_directory . '\'');
     if ($temp = $q->loadHash()) {
         // the module is already installed
         // TODO: check for older version - upgrade
         return false;
     }
     // This arbitrarily places it at the end of the list.
     $this->mod_ui_order = 100;
     $this->store();
     $this->_compactModuleUIOrder();
     $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);
     }
     return true;
 }
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:system.class.php

示例11: getDepartmentDetails

 public function getDepartmentDetails()
 {
     $result = array('dept_id' => 0, 'dept_name' => '');
     if (!$this->contact_department) {
         return $result;
     }
     $q = new DBQuery();
     $q->addTable('departments');
     $q->addQuery('dept_id, dept_name');
     if ($this->is_alpha($this->contact_department)) {
         $q->addWhere('dept_name = ' . $q->quote($this->contact_department));
     } else {
         $q->addWhere('dept_id = ' . (int) $this->contact_department);
     }
     return $q->loadHash();
 }
开发者ID:joly,项目名称:web2project,代码行数:16,代码来源:contacts.class.php

示例12: getfile

function getfile()
{
    global $root;
    $q = new DBQuery();
    $q->addTable('files');
    $q->addWhere('file_real_filename = "' . $_GET['file'] . '"');
    $q->addWhere('file_project = ' . $_GET['project']);
    $q->addWhere('file_task = ' . $_GET['task']);
    $q->addOrder('file_name');
    $data = $q->loadHash();
    $file = $root . '/' . $_GET['project'] . '/' . $_GET['task'] . '/' . $_GET['file'];
    if ($data['file_type'] == '') {
        $data['file_type'] = 'application/octet-stream';
    }
    header('MIME-Version: 1.0');
    header('Pragma: ');
    header('Cache-Control: public');
    header('Content-length: ' . $data['file_size']);
    header('Content-type: ' . $data['file_type']);
    header('Content-transfer-encoding: 8bit');
    header('Content-disposition: inline; filename="' . $data['file_name'] . '"');
    $fd = fopen($file, 'rb');
    if ($fd) {
        while (!feof($fd)) {
            print fread($fd, 8192);
        }
        fclose($fd);
    }
}
开发者ID:n2i,项目名称:xvnkb,代码行数:29,代码来源:file.php

示例13: install

 function install()
 {
     $q = new DBQuery();
     $q->addQuery('mod_directory');
     $q->addTable('modules');
     $q->addWhere("mod_directory = '{$this->mod_directory}'");
     if ($q->loadHash()) {
         // the module is already installed
         // TODO: check for older version - upgrade
         return false;
     }
     $q->clear();
     $q->addQuery('max(mod_ui_order)');
     $q->addTable('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.
     $q->addWhere(" mod_name NOT LIKE 'Public'");
     $this->mod_ui_order = $q->loadResult() + 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;
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:37,代码来源:system.class.php

示例14: foreach

        $selection_string = 'Department';
        $dataId = $dept_id;
        $deptList = CDepartment::getDepartmentList($AppUI, $company_id, null);
        foreach ($deptList as $dept) {
            $select_list[$dept['dept_id']] = $dept['dept_name'];
        }
        break;
}
$select_list = array('0' => '') + $select_list;
$myId = (int) w2PgetParam($_POST, $id_field, 0);
if ($myId) {
    $q = new DBQuery();
    $q->addTable($table_name);
    $q->addQuery('*');
    $q->addWhere($id_field . '=' . $myId);
    $r_data = $q->loadHash();
    $q->clear();
    $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');
        }
        if ($myId > 0) {
            $data_update_script = "opener.setCompany({$myId} , '" . db_escape($r_data[$name_field]) . "');";
        } else {
            $data_update_script = "opener.setCompany({$myId}, '');";
        }
    } else {
        if ($table_name == 'departments') {
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:select_contact_company.php

示例15: w2Pacl_nuclear

 public function w2Pacl_nuclear($userid, $module, $item, $mod_class = array())
 {
     global $AppUI;
     //This is a sensitive function so if the minimum permission request arguments are not provided don't permit anything to this item
     if (!$userid || !$module || !$item) {
         return array();
     }
     /*echo('<pre>');
     		print_r(debug_backtrace());
     		echo('</pre>');*/
     if (!count($mod_class)) {
         $q = new DBQuery();
         $q->addTable('modules');
         $q->addQuery('mod_main_class, permissions_item_table, permissions_item_field, permissions_item_label, mod_directory');
         $q->addWhere('mod_directory = \'' . $module . '\'');
         $q->addWhere('mod_active = 1');
         $mod_class = $q->loadHash();
     }
     /*print_r($mod_class);
     		print_r('user:'.$userid.'module:'.$module.'Item:'.$item);*/
     //If we don't know what is the module we are dealing with lets deny
     if (!$mod_class['mod_directory']) {
         dprint(__FILE__, __LINE__, 2, 'user:' . $userid . 'module:' . $module . 'Item:' . $item . $AppUI->getModuleClass($mod_class['mod_directory']));
         return array();
     }
     $obj = new $mod_class['mod_main_class']();
     $allowedRecords = array();
     if ($module == 'projects') {
         $allowedRecords = $obj->getAllowedRecords($userid, $mod_class['permissions_item_table'] . '.' . $mod_class['permissions_item_field'] . ',' . $mod_class['permissions_item_label'], '', null, null, 'projects');
     } else {
         $allowedRecords = $obj->getAllowedRecords($userid, $mod_class['permissions_item_table'] . '.' . $mod_class['permissions_item_field'] . ',' . $mod_class['permissions_item_label']);
     }
     /*print_r($allowedRecords[(int)$item]);
     		print_r(intval(isset($allowedRecords[(int)$item])));
     		print_r('Result:'.$item.'>count='.count($allowedRecords));die;*/
     if (count($allowedRecords)) {
         if (isset($allowedRecords[(int) $item])) {
             return array('access' => 1, 'acl_id' => 'checked');
         } else {
             return array();
         }
     } else {
         return array();
     }
 }
开发者ID:joly,项目名称:web2project,代码行数:45,代码来源:permissions.class.php


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