本文整理汇总了PHP中CTask::getDeniedRecords方法的典型用法代码示例。如果您正苦于以下问题:PHP CTask::getDeniedRecords方法的具体用法?PHP CTask::getDeniedRecords怎么用?PHP CTask::getDeniedRecords使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTask
的用法示例。
在下文中一共展示了CTask::getDeniedRecords方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
$allowed_companies_ary = $obj->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$allowed_companies = implode(",", array_keys($allowed_companies_ary));
if (!isset($task_id)) {
$task_id = dPgetParam($_REQUEST, 'task_id', 0);
}
global $xpg_min, $xpg_pagesize;
$xpg_pagesize = 30;
$xpg_min = $xpg_pagesize * ($page - 1);
// This is where we start our record set from
// load the following classes to retrieved denied records
include_once $AppUI->getModuleClass('projects');
include_once $AppUI->getModuleClass('tasks');
$project = new CProject();
$deny1 = $project->getDeniedRecords($AppUI->user_id);
$task = new CTask();
$deny2 = $task->getDeniedRecords($AppUI->user_id);
global $file_types;
$file_types = dPgetSysVal("FileType");
$folder = $folder ? $folder : 0;
// SQL text for count the total recs from the selected option
$q = new DBQuery();
$q->addTable('files');
$q->addQuery('count(files.file_id)');
$q->addJoin('projects', 'p', 'p.project_id = file_project');
$q->addJoin('users', 'u', 'u.user_id = file_owner');
$q->addJoin('tasks', 't', 't.task_id = file_task');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
$q->addWhere('file_folder = ' . $folder);
if (count($deny1) > 0) {
$q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
}
示例2: displayFiles
function displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id)
{
global $m, $a, $tab, $xpg_min, $xpg_pagesize, $showProject, $file_types, $cfObj, $xpg_totalrecs, $xpg_total_pages, $page, $company_id, $allowed_companies, $current_uri, $w2Pconfig, $canEdit, $canRead;
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
// SETUP FOR FILE LIST
$q = new w2p_Database_Query();
$q->addQuery('f.*, max(f.file_id) as latest_id, count(f.file_version) as file_versions, round(max(file_version), 2) as file_lastversion');
$q->addQuery('ff.*');
$q->addTable('files', 'f');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
$q->addJoin('projects', 'p', 'p.project_id = file_project');
$q->addJoin('tasks', 't', 't.task_id = file_task');
$q->leftJoin('project_departments', 'project_departments', 'p.project_id = project_departments.project_id OR project_departments.project_id IS NULL');
$q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL');
//TODO: apply permissions properly
$project = new CProject();
$deny1 = $project->getDeniedRecords($AppUI->user_id);
if (count($deny1) > 0) {
$q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
}
//TODO: apply permissions properly
$task = new CTask();
$deny2 = $task->getDeniedRecords($AppUI->user_id);
if (count($deny2) > 0) {
$q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
}
if ($project_id) {
$q->addWhere('file_project = ' . (int) $project_id);
}
if ($task_id) {
$q->addWhere('file_task = ' . (int) $task_id);
}
if ($company_id) {
$q->addWhere('project_company = ' . (int) $company_id);
}
$q->setLimit($xpg_pagesize, $xpg_min);
$q->addWhere('file_folder = ' . (int) $folder_id);
$q->addGroup('file_version_id DESC');
$qv = new w2p_Database_Query();
$qv->addTable('files');
$qv->addQuery('file_id, file_version, file_project, file_name, file_task,
file_description, u.user_username as file_owner, file_size, file_category,
task_name, file_version_id, file_checkout, file_co_reason, file_type,
file_date, cu.user_username as co_user, project_name,
project_color_identifier, project_owner, con.contact_first_name,
con.contact_last_name, co.contact_first_name as co_contact_first_name,
co.contact_last_name as co_contact_last_name ');
$qv->addJoin('projects', 'p', 'p.project_id = file_project');
$qv->addJoin('users', 'u', 'u.user_id = file_owner');
$qv->addJoin('contacts', 'con', 'con.contact_id = u.user_contact');
$qv->addJoin('tasks', 't', 't.task_id = file_task');
$qv->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
if ($project_id) {
$qv->addWhere('file_project = ' . (int) $project_id);
}
if ($task_id) {
$qv->addWhere('file_task = ' . (int) $task_id);
}
if ($company_id) {
$qv->addWhere('project_company = ' . (int) $company_id);
}
$qv->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
$qv->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
$qv->addWhere('file_folder = ' . (int) $folder_id);
$files = array();
$file_versions = array();
$files = $q->loadList();
$file_versions = $qv->loadHashList('file_id');
$q->clear();
$qv->clear();
if ($files === array()) {
return 0;
}
$s = '
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tr>
<th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
<th>' . $AppUI->_('Description') . '</th>
<th>' . $AppUI->_('Versions') . '</th>
<th>' . $AppUI->_('Category') . '</th>
<th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th>
<th>' . $AppUI->_('Owner') . '</th>
<th>' . $AppUI->_('Size') . '</th>
<th>' . $AppUI->_('Type') . '</a></th>
<th>' . $AppUI->_('Date') . '</th>
<th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th>
<th>' . $AppUI->_('co') . '</th>
<th nowrap="nowrap" width="5%"></th>
<th nowrap="nowrap" width="1"></th>
</tr>';
$fp = -1;
$file_date = new w2p_Utilities_Date();
$id = 0;
foreach ($files as $row) {
$latest_file = $file_versions[$row['latest_id']];
$file_date = new w2p_Utilities_Date($latest_file['file_date']);
if ($fp != $latest_file['file_project']) {
if (!$latest_file['file_project']) {
$latest_file['project_name'] = $AppUI->_('Not attached to a project');
//.........这里部分代码省略.........
示例3: getFileCountByFolder
public function getFileCountByFolder($notUsed = null, $folder_id, $task_id, $project_id, $company_id, $allowed_companies)
{
// SQL text for count the total recs from the selected option
$q = $this->_getQuery();
$q->addTable('files');
$q->addQuery('count(files.file_id)');
$q->addJoin('projects', 'p', 'p.project_id = file_project');
$q->addJoin('users', 'u', 'u.user_id = file_owner');
$q->addJoin('tasks', 't', 't.task_id = file_task');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
$q->addWhere('file_folder = ' . (int) $folder_id);
//TODO: apply permissions properly
$project = new CProject();
$project->overrideDatabase($this->_query);
$deny1 = $project->getDeniedRecords($this->_AppUI->user_id);
if (count($deny1) > 0) {
$q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
}
//TODO: apply permissions properly
$task = new CTask();
$task->overrideDatabase($this->_query);
$deny2 = $task->getDeniedRecords($this->_AppUI->user_id);
if (count($deny2) > 0) {
$q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
}
if ($project_id) {
$q->addWhere('file_project = ' . (int) $project_id);
}
if ($task_id) {
$q->addWhere('file_task = ' . (int) $task_id);
}
if ($company_id) {
$q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
$q->addWhere('company_id = ' . (int) $company_id);
$q->addWhere('company_id IN (' . $allowed_companies . ')');
}
$q->addGroup('file_folder_name');
$q->addGroup('project_name');
$q->addGroup('file_name');
// counts total recs from selection
return count($q->loadList());
}
示例4: displayFiles
function displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id)
{
global $m, $tab, $xpg_min, $xpg_pagesize, $showProject, $file_types, $company_id, $current_uri, $canEdit;
// SETUP FOR FILE LIST
$q = new w2p_Database_Query();
$q->addQuery('f.*, max(f.file_id) as latest_id, count(f.file_version) as file_versions, round(max(file_version), 2) as file_lastversion, file_owner, user_id');
$q->addQuery('ff.*, max(file_version) as file_version, f.file_date as file_datetime');
$q->addTable('files', 'f');
$q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
$q->addJoin('projects', 'p', 'p.project_id = file_project');
$q->addJoin('tasks', 't', 't.task_id = file_task');
$q->addJoin('users', 'u', 'u.user_id = file_owner');
$q->leftJoin('project_departments', 'project_departments', 'p.project_id = project_departments.project_id OR project_departments.project_id IS NULL');
$q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL');
//TODO: apply permissions properly
$project = new CProject();
$deny1 = $project->getDeniedRecords($AppUI->user_id);
if (count($deny1) > 0) {
$q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
}
//TODO: apply permissions properly
$task = new CTask();
$deny2 = $task->getDeniedRecords($AppUI->user_id);
if (count($deny2) > 0) {
$q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
}
if ($project_id) {
$q->addWhere('file_project = ' . (int) $project_id);
}
if ($task_id) {
$q->addWhere('file_task = ' . (int) $task_id);
}
if ($company_id) {
$q->addWhere('project_company = ' . (int) $company_id);
}
//$tab = ($m == 'files') ? $tab-1 : -1;
$temp_tab = $m == 'files' ? $tab - 1 : -1;
if ($temp_tab >= 0 and count($file_types) - 1 > $temp_tab) {
//if ($tab >= 0) {
$q->addWhere('file_category = ' . (int) $temp_tab);
}
$q->setLimit($xpg_pagesize, $xpg_min);
if ($folder_id > -1) {
$q->addWhere('file_folder = ' . (int) $folder_id);
}
$q->addGroup('file_version_id DESC');
$q->addOrder('project_name ASC, file_parent ASC, file_id DESC');
$qv = new w2p_Database_Query();
$qv->addTable('files');
$qv->addQuery('file_id, file_version, file_project, file_name, file_task,
file_description, file_owner, file_size, file_category,
task_name, file_version_id, file_date as file_datetime, file_checkout, file_co_reason, file_type,
file_date, cu.user_username as co_user, project_name,
project_color_identifier, project_owner, u.user_id,
con.contact_first_name, con.contact_last_name, con.contact_display_name as contact_name,
co.contact_first_name as co_contact_first_name, co.contact_last_name as co_contact_last_name,
co.contact_display_name as co_contact_name ');
$qv->addJoin('projects', 'p', 'p.project_id = file_project');
$qv->addJoin('users', 'u', 'u.user_id = file_owner');
$qv->addJoin('contacts', 'con', 'con.contact_id = u.user_contact');
$qv->addJoin('tasks', 't', 't.task_id = file_task');
$qv->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
if ($project_id) {
$qv->addWhere('file_project = ' . (int) $project_id);
}
if ($task_id) {
$qv->addWhere('file_task = ' . (int) $task_id);
}
if ($company_id) {
$qv->addWhere('project_company = ' . (int) $company_id);
}
if ($temp_tab >= 0 and count($file_types) - 1 > $temp_tab) {
//if ($tab >= 0) {
$qv->addWhere('file_category = ' . (int) $temp_tab);
}
$qv->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
$qv->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
if ($folder_id > -1) {
$qv->addWhere('file_folder = ' . (int) $folder_id);
}
$files = $q->loadList();
$file_versions = $qv->loadHashList('file_id');
$module = new w2p_System_Module();
$fields = $module->loadSettings('files', 'index_list');
if (count($fields) > 0) {
$fieldList = array_keys($fields);
$fieldNames = array_values($fields);
} else {
// TODO: This is only in place to provide an pre-upgrade-safe
// state for versions earlier than v3.0
// At some point at/after v4.0, this should be deprecated
$fieldList = array('file_name', 'file_description', 'file_version', 'file_category', 'file_folder', 'file_task', 'file_owner', 'file_datetime');
$fieldNames = array('File Name', 'Description', 'Version', 'Category', 'Folder', 'Task Name', 'Owner', 'Date');
$module->storeSettings('files', 'index_list', $fieldList, $fieldNames);
}
$s = '<tr>';
$s .= '<th></th>';
$s .= '<th>' . $AppUI->_('co') . '</th>';
foreach ($fieldNames as $index => $name) {
$s .= '<th>' . $AppUI->_($fieldNames[$index]) . '</th>';
//.........这里部分代码省略.........