本文整理汇总了PHP中w2p_Database_Query::loadList方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Database_Query::loadList方法的具体用法?PHP w2p_Database_Query::loadList怎么用?PHP w2p_Database_Query::loadList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Database_Query
的用法示例。
在下文中一共展示了w2p_Database_Query::loadList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStructure
public function getStructure($moduleName)
{
$q = new w2p_Database_Query();
$q->addTable('custom_fields_struct');
$q->addWhere("field_module = '{$moduleName}'");
$q->addOrder('field_order ASC');
return $q->loadList();
}
示例2: getMessages
public function getMessages(CAppUI $AppUI, $forum_id = 0, $message_id = 0, $sortDir = 'asc')
{
$q = new w2p_Database_Query();
$q->addTable('forums');
$q->addTable('forum_messages');
$q->addQuery('forum_messages.*, contact_first_name, contact_last_name, contact_email,
contact_display_name, 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 . ')');
$q->addOrder('message_date ' . $sortDir);
return $q->loadList();
}
示例3: getCriticalTasksInverted
/** Retrieve tasks with first task_end_dates within given project
* @param int Project_id
* @param int SQL-limit to limit the number of returned tasks
* @return array List of criticalTasks
*/
function getCriticalTasksInverted($project_id = null, $limit = 1)
{
if (!$project_id) {
$result = array();
$result[0]['task_end_date'] = '0000-00-00 00:00:00';
return $result;
} else {
$q = new w2p_Database_Query();
$q->addTable('tasks');
$q->addWhere('task_project = ' . (int) $project_id . ' AND NOT ISNULL( task_end_date ) AND task_end_date <> \'0000-00-00 00:00:00\'');
$q->addOrder('task_start_date ASC');
$q->setLimit($limit);
return $q->loadList();
}
}
示例4: expand
}
if ($catsql) {
$q->addWhere($catsql);
}
if ($company_id) {
$q->addWhere('project_company = ' . (int) $company_id);
}
if ($project_id) {
$q->addWhere('file_project = ' . (int) $project_id);
}
if ($task_id) {
$q->addWhere('file_task = ' . (int) $task_id);
}
$q->addGroup('file_version_id');
// counts total recs from selection
$xpg_totalrecs = count($q->loadList());
$pageNav = buildPaginationNav($AppUI, $m, $tab, $xpg_totalrecs, $xpg_pagesize, $page);
echo $pageNav;
?>
<script language="javascript" type="text/javascript">
function expand(id){
var element = document.getElementById(id);
element.style.display = (element.style.display == '' || element.style.display == 'none') ? 'block' : 'none';
}
</script>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl list">
<?php
global $showProject;
$showProject = true;
echo displayFiles($AppUI, 0, $task_id, $project_id, $company_id);
?>
示例5: foreach
$q->addWhere($allowedTasks);
}
// Filter by company
if (!$min_view && $f2 != 'allcompanies') {
$q->addJoin('companies', 'c', 'c.company_id = p.project_company', 'inner');
$q->addWhere('company_id = ' . (int) $f2);
}
$q->addGroup('tasks.task_id');
if (!$project_id && !$task_id) {
$q->addOrder('p.project_id, task_start_date, task_end_date');
} else {
$q->addOrder('task_start_date, task_end_date');
}
//print_r($q->prepare());
if ($canViewTask) {
$tasks = $q->loadList();
}
// POST PROCESSING TASKS
if (count($tasks) > 0) {
foreach ($tasks as $row) {
//add information about assigned users into the page output
$q->clear();
$q->addQuery('ut.user_id, u.user_username');
$q->addQuery('ut.perc_assignment');
$q->addQuery('CONCAT(contact_first_name, \' \',contact_last_name) AS assignee, contact_email');
$q->addTable('user_tasks', 'ut');
$q->addJoin('users', 'u', 'u.user_id = ut.user_id', 'inner');
$q->addJoin('contacts', 'c', 'u.user_contact = c.contact_id', 'inner');
$q->addWhere('ut.task_id = ' . (int) $row['task_id']);
$q->addOrder('perc_assignment desc, contact_first_name, contact_last_name');
$assigned_users = array();
示例6: getAllowedTaskList
public function getAllowedTaskList($AppUI, $task_project = 0)
{
$results = array();
$q = new w2p_Database_Query();
$q->addQuery('task_id, task_name, task_parent, task_access, task_owner');
$q->addQuery('task_start_date, task_end_date, task_percent_complete');
$q->addOrder('task_parent, task_parent = task_id desc');
$q->addTable('tasks', 't');
if ($task_project) {
$q->addWhere('task_project = ' . (int) $task_project);
}
if ($orderby == '') {
$q->addOrder('task_parent, task_parent = task_id desc');
} else {
$q->addOrder($orderby);
}
$task_list = $q->loadList();
foreach ($task_list as $task) {
if (canTaskAccess($task['task_id'], $task['task_access'], $task['task_owner'])) {
$results[] = $task;
}
}
return $results;
}
示例7: canView
// check permissions for this module
$perms =& $AppUI->acl();
$canView = canView($m);
$canAddProject = $perms->checkModuleItem('projects', 'add', $project_id);
if (!$canView) {
$AppUI->redirect('m=public&a=access_denied');
}
$AppUI->loadCalendarJS();
$today = new w2p_Utilities_Date();
$today->convertTZ($AppUI->getPref('TIMEZONE'));
//Lets load the users panel viewing options
$q = new w2p_Database_Query();
$q->addTable('project_designer_options', 'pdo');
$q->addQuery('pdo.*');
$q->addWhere('pdo.pd_option_user = ' . (int) $AppUI->user_id);
$view_options = $q->loadList();
$project_id = (int) w2PgetParam($_POST, 'project_id', 0);
$project_id = (int) w2PgetParam($_GET, 'project_id', $project_id);
$extra = array('where' => 'project_active = 1');
$project = new CProject();
$projects = $project->getAllowedRecords($AppUI->user_id, 'projects.project_id,project_name', 'project_name', null, $extra, 'projects');
$q = new w2p_Database_Query();
$q->addTable('projects');
$q->addQuery('projects.project_id, company_name');
$q->addJoin('companies', 'co', 'co.company_id = project_company');
$idx_companies = $q->loadHashList();
$q->clear();
foreach ($projects as $prj_id => $prj_name) {
$projects[$prj_id] = $idx_companies[$prj_id] . ': ' . $prj_name;
}
asort($projects);
示例8: delIt
<?php
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
// check permissions
$perms =& $AppUI->acl();
if (!canEdit('system')) {
$AppUI->redirect('m=public&a=access_denied');
}
$q = new w2p_Database_Query();
$q->addTable('syskeys');
$q->addQuery('*');
$q->addOrder('syskey_name');
$keys = $q->loadList();
$q->clear();
$syskey_id = (int) w2PgetParam($_GET, 'syskey_id', 0);
$titleBlock = new CTitleBlock('System Lookup Keys', 'myevo-weather.png', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=system', 'System Admin');
$titleBlock->show();
?>
<script language="javascript" type="text/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) {
if (confirm( 'Are you sure you want to delete this?' )) {
示例9: getFileList
public static function getFileList($AppUI = null, $company_id = 0, $project_id = 0, $task_id = 0, $category_id = 0)
{
global $AppUI;
$q = new w2p_Database_Query();
$q->addQuery('f.*');
$q->addTable('files', 'f');
$q->addJoin('projects', 'p', 'p.project_id = file_project');
$q->addJoin('project_departments', 'pd', 'p.project_id = pd.project_id');
$q->addJoin('departments', '', 'pd.department_id = dept_id');
$q->addJoin('tasks', 't', 't.task_id = file_task');
$project = new CProject();
//TODO: We need to convert this from static to use ->overrideDatabase() for testing.
$allowedProjects = $project->getAllowedSQL($AppUI->user_id, 'file_project');
if (count($allowedProjects)) {
$q->addWhere('( ( ' . implode(' AND ', $allowedProjects) . ') OR file_project = 0 )');
}
if (isset($company_id) && (int) $company_id > 0) {
$q->addWhere('project_company = ' . (int) $company_id);
}
if (isset($project_id) && (int) $project_id > 0) {
$q->addWhere('file_project = ' . (int) $project_id);
}
if (isset($task_id) && (int) $task_id > 0) {
$q->addWhere('file_task = ' . (int) $task_id);
}
if ($category_id >= 0) {
$q->addWhere('file_category = ' . (int) $category_id);
}
return $q->loadList();
}
示例10: getCriticalTasks
/** Retrieve tasks with latest task_end_dates within given project
* @param int Project_id
* @param int SQL-limit to limit the number of returned tasks
* @return array List of criticalTasks
*/
public function getCriticalTasks($project_id = null, $limit = 1)
{
$project_id = !empty($project_id) ? $project_id : $this->project_id;
$q = new w2p_Database_Query();
$q->addTable('tasks');
$q->addWhere('task_project = ' . (int) $project_id . ' AND task_end_date IS NOT NULL AND task_end_date <> \'0000-00-00 00:00:00\'');
$q->addOrder('task_end_date DESC');
$q->setLimit($limit);
return $q->loadList();
}
示例11: foreach
$s .= 'No contacts were found.';
} else {
$s .= 'Total Contacts Found:' . $info['count'] . '<hr />';
$s .= '<table border="0" cellpadding="1" cellspacing="0" width="98%" class="std">';
if (isset($test)) {
foreach ($sql_ldap_mapping as $sql) {
$s .= '<th>' . $sql . '</th>';
}
foreach ($contact_methods_ldap_mapping as $sql) {
$s .= '<th>' . $sql . '</th>';
}
} else {
$q = new w2p_Database_Query();
$q->addTable($sql_table);
$q->addQuery('contact_id, contact_first_name, contact_last_name');
$contacts = $q->loadList();
$q->clear();
foreach ($contacts as $contact) {
$contact_list[$contact['contact_first_name'] . ' ' . $contact['contact_last_name']] = $contact['contact_id'];
}
unset($contacts);
}
for ($i = 0, $i_cmp = $info['count']; $i < $i_cmp; $i++) {
$pairs = array();
$s .= '<tr>';
foreach ($sql_ldap_mapping as $ldap_name => $sql_name) {
unset($val);
if (isset($info[$i][$ldap_name][0])) {
$val = clean_value($info[$i][$ldap_name][0]);
}
if ($val && $ldap_name == 'postaladdress') {
示例12: CProject
if ($log_ignore) {
$q->addWhere('task_log_hours > 0');
}
if ($log_userfilter) {
$q->addWhere('task_log_creator = ' . (int) $log_userfilter);
}
$proj = new CProject();
$allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'task_project');
if (count($allowedProjects)) {
$q->addWhere(implode(' AND ', $allowedProjects));
}
$q->addOrder('creator');
$q->addOrder('company_name');
$q->addOrder('project_name');
$q->addOrder('task_log_date');
$logs = $q->loadList();
echo db_error();
?>
<table cellspacing="1" cellpadding="4" border="0" class="tbl">
<tr>
<th><?php
echo $AppUI->_('Creator');
?>
</th>
<th><?php
echo $AppUI->_('Company');
?>
</th>
<th><?php
echo $AppUI->_('Project');
?>
示例13: IN
$q->addWhere('user_id IN (' . implode(',', array_keys($users)) . ')');
if (isset($_POST['user']) && (int) $_POST['user'] > 0) {
$q->addWhere('user_id = ' . (int) $_POST['user']);
}
if ($_POST['module']) {
$q->addWhere('module = \'' . $_POST['module'] . '\'');
}
if ($_POST['action']) {
$q->addWhere('action = \'' . $_POST['action'] . '\'');
}
$q->addOrder('user_name');
$q->addOrder('module');
$q->addOrder('action');
$q->addOrder('item_id');
$q->addOrder('acl_id');
$permissions = $q->loadList();
} else {
$permissions = array();
}
$avail_modules = $perms->getModuleList();
$modules = 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 = '';
示例14: addDependencies
private function addDependencies($ganttBar, $task_id)
{
$gantt_arr = $this->taskArray;
$q = new w2p_Database_Query();
$q->addTable('task_dependencies');
$q->addQuery('dependencies_task_id');
$q->addWhere('dependencies_req_task_id=' . (int) $task_id);
$query = $q->loadList();
foreach ($query as $dep) {
for ($d = 0; $d < $this->taskCount; $d++) {
if ($gantt_arr[$d][0]['task_id'] == $dep['dependencies_task_id']) {
$ganttBar->SetConstrain($d, CONSTRAIN_ENDSTART);
}
}
}
return $ganttBar;
}
示例15: notifyNewExternalUser
$isNewUser = !w2PgetParam($_REQUEST, 'user_id', 0);
if ($isNewUser) {
// check if a user with the param Username already exists
if (is_array($contactListByUsername)) {
$AppUI->setMsg('This username is not available, please try another.', UI_MSG_ERROR, true);
$AppUI->redirect();
} else {
$contact->contact_owner = $AppUI->user_id;
}
}
$result = $contact->store($AppUI);
if ($result) {
$user->user_contact = $contact->contact_id;
if ($msg = $user->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
if ($isNewUser) {
notifyNewExternalUser($contact->contact_email, $contact->contact_first_name, $user->user_username, $_POST['user_password']);
}
notifyHR(w2PgetConfig('admin_email', 'admin@web2project.net'), 'w2P System Human Resources', $contact->contact_email, $contact->contact_first_name, $user->user_username, $_POST['user_password'], $user->user_id);
$q = new w2p_Database_Query();
$q->addTable('users', 'u');
$q->addQuery('contact_email');
$q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
$q->addWhere('u.user_username = \'admin\'');
$admin_user = $q->loadList();
}
} else {
$AppUI->setMsg($msg, UI_MSG_ERROR);
}
echo "<script language='javascript'>\n\t alert('The User Administrator has been notified to grant you access to the system and an email message was sent to you with your login info. Thank you very much.');\n\t history.go(-2);\n </script>";