<?php

/* TASKS $Id: tasks_tab.files.php 6149 2012-01-09 11:58:40Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $project_id, $task_id, $deny, $canRead, $canEdit, $dPconfig, $cfObj, $m, $obj;
require_once $AppUI->getModuleClass('files');
global $allowed_folders_ary, $denied_folders_ary, $limited;
$cfObj = new CFileFolder();
$allowed_folders_ary = $cfObj->getAllowedRecords($AppUI->user_id);
$denied_folders_ary = $cfObj->getDeniedRecords($AppUI->user_id);
$limited = count($allowed_folders_ary) < $cfObj->countFolders() ? true : false;
if (!$limited) {
    $canEdit = true;
} else {
    if ($limited && array_key_exists($folder, $allowed_folders_ary)) {
        $canEdit = true;
    } else {
        $canEdit = false;
    }
}
$showProject = false;
$project_id = $obj->task_project;
if (getPermission('files', 'edit')) {
    echo '<a href="?m=files&amp;a=addedit&amp;project_id=' . $project_id . '&amp;file_task=' . $task_id . '">' . $AppUI->_('Attach a file') . '</a>';
    echo dPshowImage(dPfindImage('stock_attach-16.png', $m), 16, 16, '');
}
$canAccess_folders = getPermission('file_folders', 'access');
if ($canAccess_folders) {
    $folder = (int) dPgetParam($_GET, 'folder', 0);
Beispiel #2
0
$projects = $project->getAllowedRecords($AppUI->user_id, 'project_id,project_name', 'project_name', null, $extra);
$projects = arrayMerge(array('0' => $AppUI->_('All', UI_OUTPUT_RAW)), $projects);
// get SQL for allowed projects/tasks
$task = new CTask();
$allowedProjects = $project->getAllowedSQL($AppUI->user_id, 'file_project');
$allowedTasks = $task->getAllowedSQL($AppUI->user_id, 'file_task');
// setup the title block
$titleBlock = new CTitleBlock('Files', 'folder5.png', $m, "{$m}.{$a}");
$titleBlock->addCell($AppUI->_('Filter') . ':');
$titleBlock->addCell(arraySelect($projects, 'project_id', 'onChange="document.pickProject.submit()" size="1" class="text"', $project_id), '', '<form name="pickProject" action="?m=files" method="post">', '</form>');
// override the $canEdit variable passed from the main index.php in order to check folder permissions
/** get permitted folders **/
$cfObj = new CFileFolder();
$allowed_folders_ary = $cfObj->getAllowedRecords($AppUI->user_id);
$denied_folders_ary = $cfObj->getDeniedRecords($AppUI->user_id);
if (count($allowed_folders_ary) < $cfObj->countFolders()) {
    $limited = true;
}
if (!$limited) {
    $canEdit = true;
} elseif ($limited and array_key_exists($folder, $allowed_folders_ary)) {
    $canEdit = true;
} else {
    $canEdit = false;
}
if ($canEdit) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new file') . '">', '', '<form action="?m=files&a=addedit&folder=' . $folder . '" method="post">', '</form>');
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new folder') . '">', '', '<form action="?m=files&a=addedit_folder" method="post">', '</form>');
}
$titleBlock->show();
$file_types = dPgetSysVal('FileType');