コード例 #1
0
ファイル: links.class.php プロジェクト: joly/web2project
 public function getProjectTaskLinksByCategory($AppUI, $project_id = 0, $task_id = 0, $category_id = 0, $search = '')
 {
     // load the following classes to retrieved denied records
     $project = new CProject();
     $task = new CTask();
     // SETUP FOR LINK LIST
     $q = new DBQuery();
     $q->addQuery('links.*');
     $q->addQuery('contact_first_name, contact_last_name');
     $q->addQuery('project_name, project_color_identifier, project_status');
     $q->addQuery('task_name, task_id');
     $q->addTable('links');
     $q->leftJoin('users', 'u', 'user_id = link_owner');
     $q->leftJoin('contacts', 'c', 'user_contact = contact_id');
     if ($search != '') {
         $q->addWhere('(link_name LIKE \'%' . $search . '%\' OR link_description LIKE \'%' . $search . '%\')');
     }
     if ($project_id > 0) {
         // Project
         $q->addWhere('link_project = ' . (int) $project_id);
     }
     if ($task_id > 0) {
         // Task
         $q->addWhere('link_task = ' . (int) $task_id);
     }
     if ($category_id >= 0) {
         // Category
         $q->addWhere('link_category = ' . $category_id);
     }
     // Permissions
     $project->setAllowedSQL($AppUI->user_id, $q, 'link_project');
     $task->setAllowedSQL($AppUI->user_id, $q, 'link_task and task_project = link_project');
     $q->addOrder('project_name, link_name');
     return $q->loadList();
 }
コード例 #2
0
ファイル: sendpass.php プロジェクト: 222elm/dotprojectFrame
function sendNewPass()
{
    global $AppUI;
    $_live_site = dPgetConfig('base_url');
    $_sitename = dPgetConfig('company_name');
    // ensure no malicous sql gets past
    $checkusername = trim(dPgetParam($_POST, 'checkusername', ''));
    $checkusername = db_escape($checkusername);
    $confirmEmail = trim(dPgetParam($_POST, 'checkemail', ''));
    $confirmEmail = mb_strtolower(db_escape($confirmEmail));
    $q = new DBQuery();
    $q->addTable('users', 'u');
    $q->addQuery('u.user_id');
    $q->addWhere('user_username=\'' . $checkusername . '\' AND LOWER(contact_email)=\'' . $confirmEmail . '\'');
    $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id');
    if (!($user_id = $q->loadResult()) || !$checkusername || !$confirmEmail) {
        $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR);
        $AppUI->redirect();
    }
    $newpass = makePass();
    $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW);
    $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}";
    $m = new Mail();
    // create the mail
    $m->From("dotProject@" . dPgetConfig('site_domain'));
    $m->To($confirmEmail);
    $m->Subject($subject);
    $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
    // set the body
    $m->Send();
    // send the mail
    $newpass = md5($newpass);
    $q->clear();
    $q->addTable('users');
    $q->addUpdate('user_password', $newpass, true);
    $q->addWhere('user_id=\'' . $user_id . '\'');
    $cur = $q->exec();
    if (!$cur) {
        die('SQL error' . $database->stderr(true));
    } else {
        $AppUI->setMsg('New User Password created and emailed to you');
        $AppUI->redirect();
    }
}
コード例 #3
0
ファイル: index.php プロジェクト: kaz190/dotproject
    foreach ($arr as $L) {
        $let .= $L['L'];
    }
}
// optional fields shown in the list (could be modified to allow breif and verbose, etc)
$showfields = array("contact_company" => "contact_company", "company_name" => "company_name", "contact_phone" => "contact_phone", "contact_email" => "contact_email");
require_once $AppUI->getModuleClass('companies');
$company = new CCompany();
$allowedCompanies = $company->getAllowedSQL($AppUI->user_id);
// assemble the sql statement
$q = new DBQuery();
$q->addQuery('contact_id, contact_order_by');
$q->addQuery($showfields);
$q->addQuery('contact_first_name, contact_last_name, contact_phone');
$q->addTable('contacts', 'a');
$q->leftJoin('companies', 'b', 'a.contact_company = b.company_id');
foreach ($search_map as $search_name) {
    $where_filter .= " OR {$search_name} LIKE '{$where}%'";
}
$where_filter = mb_substr($where_filter, 4);
$q->addWhere("({$where_filter} {$additional_filter})");
$q->addWhere("\n\t(contact_private=0\n\t\tOR (contact_private=1 AND contact_owner={$AppUI->user_id})\n\t\tOR contact_owner IS NULL OR contact_owner = 0\n\t)");
if (count($allowedCompanies)) {
    $comp_where = implode(' AND ', $allowedCompanies);
    $q->addWhere('((' . $comp_where . ') OR contact_company = 0)');
}
$q->addOrder('contact_order_by');
$carr[] = array();
$carrWidth = 4;
$carrHeight = 4;
$sql = $q->prepare();
コード例 #4
0
ファイル: vw_projecttask.php プロジェクト: joly/web2project
$task_sort_type2 = w2PgetParam($_GET, 'task_sort_type2', '');
$task_sort_order1 = intval(w2PgetParam($_GET, 'task_sort_order1', 0));
$task_sort_order2 = intval(w2PgetParam($_GET, 'task_sort_order2', 0));
if (isset($_POST['show_task_options'])) {
    $AppUI->setState('TaskListShowIncomplete', w2PgetParam($_POST, 'show_incomplete', 0));
}
$showIncomplete = $AppUI->getState('TaskListShowIncomplete', 0);
$project = new CProject();
// $allowedProjects = $project->getAllowedRecords($AppUI->user_id, 'project_id, project_name');
$allowedProjects = $project->getAllowedSQL($AppUI->user_id);
$working_hours = $w2Pconfig['daily_working_hours'] ? $w2Pconfig['daily_working_hours'] : 8;
$q->addQuery('projects.project_id, project_color_identifier, project_name');
$q->addQuery('SUM(task_duration * task_percent_complete * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) / SUM(task_duration * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) AS project_percent_complete');
$q->addQuery('company_name');
$q->addTable('projects');
$q->leftJoin('tasks', 't1', 'projects.project_id = t1.task_project');
$q->leftJoin('companies', 'c', 'company_id = project_company');
$q->leftJoin('project_departments', 'project_departments', 'projects.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');
$q->addWhere('t1.task_id = t1.task_parent');
$q->addWhere('projects.project_id=' . $project_id);
if (count($allowedProjects)) {
    $q->addWhere($allowedProjects);
}
$q->addGroup('projects.project_id');
$q2 = new DBQuery();
$q2 = $q;
$q2->addQuery('projects.project_id, COUNT(t1.task_id) as total_tasks');
$perms =& $AppUI->acl();
$projects = array();
if ($canViewTasks) {
コード例 #5
0
        $q->addTable('companies', 'c');
        $q->addQuery('c.company_name');
        $q->addWhere('company_id = ' . $company_id);
        $company_name = $q->loadResult();
        $q->clear();
        /*
        	$sql = "select c.company_name from companies as c where company_id = $company_id";
        	$company_name = db_loadResult($sql);
        */
        $company_name_sql = db_escape($company_name);
        $where = " (contact_company = '{$company_name_sql}' or contact_company = '{$company_id}')";
    }
}
// This should now work on company ID, but we need to be able to handle both
$q->addTable('contacts', 'a');
$q->leftJoin('companies', 'b', 'b.company_id = a.contact_company');
$q->leftJoin('departments', 'c', 'c.dept_id = a.contact_department');
$q->leftJoin('users', 'u', 'u.user_contact=a.contact_id');
$q->addQuery('a.contact_id, a.contact_first_name, a.contact_last_name,' . ' a.contact_company, a.contact_department');
$q->addQuery('b.company_name');
$q->addQuery('c.dept_name');
$q->addQuery('u.user_id');
if ($where) {
    // Don't assume where is set. Change needed to fix Mantis Bug 0002056
    $q->addWhere($where);
}
$q->addWhere('(contact_owner = ' . $AppUI->user_id . ' OR contact_private = 0)');
//May need to review this order.
$q->addOrder('company_name, contact_company, dept_name, contact_department' . ', contact_last_name');
$contacts = $q->loadHashList('contact_id');
global $task_id, $project_id;
コード例 #6
0
ファイル: main_functions.php プロジェクト: n2i/xvnkb
function dPgetSysVal($title)
{
    $q = new DBQuery();
    $q->addTable('sysvals');
    $q->leftJoin('syskeys', 'sk', 'syskey_id = sysval_key_id');
    $q->addQuery('syskey_type, syskey_sep1, syskey_sep2, sysval_value');
    $q->addWhere("sysval_title = '{$title}'");
    $q->exec();
    $row = $q->fetchRow();
    $q->clear();
    // type 0 = list
    $sep1 = $row['syskey_sep1'];
    // item separator
    $sep2 = $row['syskey_sep2'];
    // alias separator
    // A bit of magic to handle newlines and returns as separators
    // Missing sep1 is treated as a newline.
    if (!isset($sep1) || empty($sep1)) {
        $sep1 = "\n";
    }
    if ($sep1 == "\\n") {
        $sep1 = "\n";
    }
    if ($sep1 == "\\r") {
        $sep1 = "\r";
    }
    $temp = explode($sep1, $row['sysval_value']);
    $arr = array();
    // We use trim() to make sure a numeric that has spaces
    // is properly treated as a numeric
    foreach ($temp as $item) {
        if ($item) {
            $sep2 = empty($sep2) ? "\n" : $sep2;
            $temp2 = explode($sep2, $item);
            if (isset($temp2[1])) {
                $arr[trim($temp2[0])] = trim($temp2[1]);
            } else {
                $arr[trim($temp2[0])] = trim($temp2[0]);
            }
        }
    }
    return $arr;
}
コード例 #7
0
function displayFiles($folder_id)
{
    global $AppUI, $m, $a, $tab, $page;
    global $current_uri;
    global $canAccess, $canRead, $canEdit, $canAuthor, $canDelete;
    global $canAccess_folders, $canRead_folders, $canEdit_folders;
    global $canAuthor_folders, $canDelete_folders;
    global $company_id, $project_id, $task_id;
    global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders;
    global $showProject, $cfObj, $dPconfig;
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $file_types = dPgetSysVal('FileType');
    $xpg_pagesize = 30;
    //TODO?: Set by System Config Value ...
    $xpg_totalrecs = countFiles($folder_id);
    //get file count for folder
    $xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1;
    $xpg_min = $xpg_pagesize * ($page - 1);
    // This is where we start our record set from
    $q = new DBQuery();
    // most recent version info per file_project and file_version_id
    $q->createTemp('files_count_max' . $folder_id);
    $q->addTable('files', 'f');
    $q->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', file_version_id, f.file_project');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addGroup('f.file_version_id');
    $q->addGroup('f.file_project');
    $file_version_max_counts = $q->exec();
    $q->clear();
    // most recent version
    $q->addTable('files', 'f');
    $q->addQuery('f.*, fmc.file_versions, round(fmc.file_lastversion, 2) as file_lastversion' . ', u.user_username as file_owner, ff.file_folder_name' . ', ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner' . ', cc.contact_first_name as checkout_first_name' . ', cc.contact_last_name as checkout_last_name');
    $q->addJoin('files_count_max' . $folder_id, 'fmc', '(fmc.file_lastversion=f.file_version AND fmc.file_version_id=f.file_version_id' . ' AND fmc.file_project=f.file_project)', 'inner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
    $q->leftJoin('contacts', 'cc', 'cc.contact_id = cu.user_contact');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addOrder('p.project_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    // all versions
    $q->addTable('files', 'f');
    $q->addQuery('f.*, ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    //file arrays
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadHashList($file_versions_sql, 'file_id');
    }
    $q->dropTemp('files_count_max' . $folder_id);
    $q->exec();
    if ($files == array()) {
        return;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Date');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        $canEdit_file = getPermission('files', 'edit', $row['file_id']);
        //single file
        if ($fp != $row['file_project']) {
            if (!$row['file_project']) {
                $row['project_name'] = $AppUI->_('Not associated to projects');
                $row['project_color_identifier'] = 'f4efe3';
            }
            if ($showProject) {
                $style = 'background-color:#' . $row['project_color_identifier'] . ';color:' . bestColor($row['project_color_identifier']);
                ?>
<tr>
	<td colspan="20" style="border: outset 2px #eeeeee;<?php 
                echo $style;
                ?>
">
	<a href="?m=projects&a=view&project_id=<?php 
                echo $row['file_project'];
                ?>
">
	<span style="<?php 
                echo $style;
                ?>
"><?php 
                echo $row['project_name'];
                ?>
</span></a>
	</td>
</tr>
<?php 
            }
        }
        $fp = $row['file_project'];
        ?>
	<form name="frm_remove_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
<?php 
        $file_icon = getIcon($row['file_type']);
        ?>
		  <a href="./fileviewer.php?file_id=<?php 
        echo $row['file_id'];
        ?>
" 
		   title="<?php 
        echo $row['file_description'];
        ?>
"> 
		  <?php 
        echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
        ?>
		  &nbsp;<?php 
        echo $row['file_name'];
        ?>
 
		  </a>
		</td>
		<td width="20%"><?php 
        echo $row['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
<?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            ?>
	  <a href="#" onClick="expand('versions_<?php 
            echo $row['file_id'];
            ?>
');">
	  (<?php 
            echo $row['file_versions'];
            ?>
)
	  </a>
<?php 
        }
        ?>
		</td>
		<td width="10%" nowrap="nowrap" align="center">
		  <?php 
        echo $file_types[$row['file_category']];
        ?>
		</td>
		<td width="5%" align="center">
		  <a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $row['file_task'];
        ?>
">
		  <?php 
        echo $row['task_name'];
        ?>
		  </a>
		</td>
		<td width="15%" nowrap="nowrap">
		  <?php 
        echo $row["contact_first_name"] . ' ' . $row["contact_last_name"];
        ?>
		</td>
		<td width="5%" nowrap="nowrap" align="right">
		  <?php 
        echo file_size(intval($row['file_size']));
        ?>
		</td>
		<td width="15%" nowrap="nowrap" align="right">
		  <?php 
        echo $file_date->format($df . ' ' . $tf);
        ?>
		</td>
		<td width="10%"><?php 
        echo $row['file_co_reason'];
        ?>
</td>
		<td nowrap="nowrap" align="center">
		  
<?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
			  <a href="?m=files&a=co&file_id=<?php 
            echo $row['file_id'];
            ?>
">
			  <?php 
            echo dPshowImage(DP_BASE_URL . '/modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
			  </a>
<?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
			  <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $row['file_id'];
                ?>
">
			  <?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
			  </a>
<?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo '			  ' . $AppUI->_('final');
                } else {
                    echo '	  ' . $row['checkout_first_name'] . ' ' . $row['checkout_last_name'] . '<br />(' . $row['co_user'] . ')';
                }
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="right" width="48">
		  <?php 
        if (empty($row['file_checkout']) || $row['file_checkout'] == 'final') {
            // Edit File
            if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                echo $row['file_id'];
                ?>
">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                ?>
		  </a>
<?php 
            }
            // Duplicate File
            if ($canAuthor || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="document.frm_duplicate_file_<?php 
                echo $row['file_id'];
                ?>
.submit()">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                ?>
		  </a>
<?php 
            }
            // Delete File
            if ($canDelete || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="if (confirm('Are you sure you want to delete this file?')) {document.frm_remove_file_<?php 
                echo $row['file_id'];
                ?>
.submit()}">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', 'delete file');
                ?>
		  </a>
<?php 
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="center" width="1">
<?php 
        if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
            ?>
			<input type="checkbox" <?php 
            echo $bulk_op;
            ?>
 
			 name="chk_sub_sel_file_<?php 
            echo $file_row['file_id'];
            ?>
" />
<?php 
        }
        ?>
		</td>
</tr>



<?php 
        if ($row['file_versions'] > 1) {
            ?>

	  <tr><td colspan="20">
		<table style="display: none" id="versions_<?php 
            echo $row['file_id'];
            ?>
" 
		 width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
		  <tr>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('File Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Description');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Versions');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Category');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Task Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Owner');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Size');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Type');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Date');
            ?>
</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
		  </tr>
<?php 
            foreach ($file_versions as $file) {
                if ($file['file_version_id'] == $row['file_version_id']) {
                    $file_icon = getIcon($file['file_type']);
                    $file_version_date = new Date($file['file_date']);
                    ?>

		  <form name="frm_delete_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="del" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>		
		  <form name="frm_duplicate_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="duplicate" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>
		  <tr>
			<td nowrap="8%">
			  <a href="./fileviewer.php?file_id=<?php 
                    echo $file['file_id'];
                    ?>
" 
			   title="<?php 
                    echo $file['file_description'];
                    ?>
">
			  <?php 
                    echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
                    ?>
			  <?php 
                    echo $file['file_name'];
                    ?>
 
			  </a>
			</td>
			<td width="20%"><?php 
                    echo $file['file_description'];
                    ?>
</td>
			<td width="5%" nowrap="nowrap" align="center"><?php 
                    echo $file['file_version'];
                    ?>
</td>
			<td width="10%" nowrap="nowrap" align="center">
			  <?php 
                    echo $file_types[$file['file_category']];
                    ?>
			</td>
			<td width="5%" align="center">
			  <a href="./index.php?m=tasks&a=view&task_id=<?php 
                    echo $file['file_task'];
                    ?>
">
			  <?php 
                    echo $file['task_name'];
                    ?>
			  </a>
			</td>
			<td width="15%" nowrap="nowrap">
			  <?php 
                    echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
                    ?>
			</td>
			<td width="5%" nowrap="nowrap" align="right">
			  <?php 
                    echo file_size(intval($file['file_size']));
                    ?>
			</td>
			<td nowrap="nowrap">
			  <?php 
                    echo $row['file_type'];
                    ?>
			</td>
			<td width="15%" nowrap="nowrap" align="right">
			  <?php 
                    echo $file_version_date->format($df . ' ' . $tf);
                    ?>
			</td>
			
			<td nowrap="nowrap" align="right" width="48">
			  <?php 
                    if (empty($file['file_checkout']) || $file['file_checkout'] == 'final') {
                        // Edit File
                        if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                            ?>
			  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                            echo $row['file_id'];
                            ?>
">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                            ?>
			  </a>
<?php 
                        }
                        // Duplicate File
                        if ($canAuthor) {
                            ?>
			  <a href="#" 
			   onclick="document.frm_duplicate_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                            ?>
			  </a>
<?php 
                        }
                        // Delete File
                        if ($canDelete) {
                            ?>
			  <a href="#" 
			   onclick="if (confirm('<?php 
                            echo $AppUI->_('Are you sure you want to delete this file?');
                            ?>
')) {document.frm_remove_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()}">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', $AppUI->_('delete file'));
                            ?>
			  </a>
<?php 
                        }
                    }
                    ?>
			</td>
			<td nowrap="nowrap" align="center" width="1">
<?php 
                    if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
                        ?>
			  <input type="checkbox" <?php 
                        echo $bulk_op;
                        ?>
 
			   name="chk_sub_sel_file_<?php 
                        echo $file_row['file_id'];
                        ?>
" />
<?php 
                    }
                    ?>
			  </td>
			</tr>
<?php 
                }
            }
            ?>
		</table>
	  </td></tr>
<?php 
        }
    }
    ?>

	</table>
	<?php 
    shownavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder_id);
    echo "<br />";
}
コード例 #8
0
ファイル: view_topics.php プロジェクト: joly/web2project
    $orderdir = $AppUI->getState('ForumVwOrderDir') ? $AppUI->getState('ForumVwOrderDir') == 'asc' ? 'desc' : 'asc' : 'desc';
    $AppUI->setState('ForumVwOrderBy', w2PgetParam($_GET, 'orderby', null));
    $AppUI->setState('ForumVwOrderDir', $orderdir);
}
$orderby = $AppUI->getState('ForumVwOrderBy') ? $AppUI->getState('ForumVwOrderBy') : 'latest_reply';
$orderdir = $AppUI->getState('ForumVwOrderDir') ? $AppUI->getState('ForumVwOrderDir') : 'desc';
//Pull All Messages
$q = new DBQuery();
$q->addTable('forum_messages', 'fm1');
$q->addQuery('fm1.*');
$q->addQuery('COUNT(distinct fm2.message_id) AS replies');
$q->addQuery('MAX(fm2.message_date) AS latest_reply');
$q->addQuery('user_username, contact_first_name, contact_last_name, watch_user');
$q->addQuery('count(distinct v1.visit_message) as reply_visits');
$q->addQuery('v1.visit_user');
$q->leftJoin('users', 'u', 'fm1.message_author = u.user_id');
$q->leftJoin('contacts', 'con', 'contact_id = user_contact');
$q->leftJoin('forum_messages', 'fm2', 'fm1.message_id = fm2.message_parent');
$q->leftJoin('forum_watch', 'fw', 'watch_user = '******' AND watch_topic = fm1.message_id');
$q->leftJoin('forum_visits', 'v1', 'v1.visit_user = '******' AND v1.visit_message = fm1.message_id');
$q->addWhere('fm1.message_forum = ' . (int) $forum_id);
switch ($f) {
    case 1:
        $q->addWhere('watch_user IS NOT NULL');
        break;
    case 2:
        $q->addWhere('(NOW() < DATE_ADD(fm2.message_date, INTERVAL 30 DAY) OR NOW() < DATE_ADD(fm1.message_date, INTERVAL 30 DAY))');
        break;
}
$q->addGroup('fm1.message_id, fm1.message_parent');
$q->addOrder($orderby . ' ' . $orderdir);
コード例 #9
0
$q->addTable('users');
$q->addWhere('user_id = ' . (int) $user_id);
$contact_id = $q->loadResult();
$q->addQuery('distinct project_id, project_name');
$q->addTable('projects');
$q->addWhere('project_owner = ' . (int) $user_id);
$projects += $q->loadHashList();
$q->addQuery('distinct prj.project_id, prj.project_name');
$q->addTable('projects', 'prj');
$q->innerJoin('project_contacts', 'prc', array('project_id'));
$q->addWhere('prc.contact_id = ' . (int) $contact_id);
$projects += $q->loadHashList();
$q->addQuery('distinct prj.project_id, prj.project_name');
$q->addTable('tasks', 't');
$q->innerJoin('projects', 'prj', 'prj.project_id = t.task_project');
$q->leftJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
$q->addWhere('t.task_owner = ' . (int) $user_id . ' OR ut.user_id = ' . (int) $user_id);
$projects += $q->loadHashList();
$q->addQuery('distinct prj.project_id, prj.project_name');
$q->addTable('tasks', 't');
$q->innerJoin('projects', 'prj', 'prj.project_id = t.task_project');
$q->innerJoin('task_contacts', 'tc', 'tc.task_id = t.task_id');
$q->addWhere('tc.contact_id = ' . (int) $contact_id);
$projects += $q->loadHashList();
$q->addQuery('user_id, concat(u.user_username, \' (\', c.contact_first_name, \' \', c.contact_last_name, \')\') as username');
$q->addTable('users', 'u');
$q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
$q->addWhere('u.user_id != ' . (int) $user_id);
$q->addOrder('u.user_username');
$users = $q->loadHashList();
?>
コード例 #10
0
$q2->setLimit($xpg_pagesize, $xpg_min);
// Adding an Order by that is different to a group by can cause
// performance issues. It is far better to rearrange the group
// by to get the correct ordering.
$q2->addGroup('p.project_id');
$q2->addGroup('f.file_version_id DESC');
$q3 = new DBQuery();
$q3->addQuery('f.file_id, f.file_version, f.file_version_id, f.file_project, f.file_name' . ', f.file_task, t.task_name, f.file_description, f.file_checkout, f.file_co_reason' . ', u.user_username as file_owner, f.file_size, f.file_category, f.file_type' . ', f.file_date, cu.user_username as co_user, p.project_name' . ', p.project_color_identifier, p.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 ');
$q3->addQuery('ff.*');
$q3->addTable('files', 'f');
$q3->addJoin('users', 'u', 'u.user_id = file_owner');
$q3->addJoin('contacts', 'con', 'con.contact_id = u.user_contact');
$q3->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
$q3->addJoin('projects', 'p', 'p.project_id = f.file_project');
$q3->addJoin('tasks', 't', 't.task_id = f.file_task');
$q3->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
$q3->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
if (count($allowedProjects)) {
    $q3->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
}
if (count($allowedTasks)) {
    $q3->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
}
if (count($allowedFolders)) {
    $q3->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
}
if ($category_filter) {
    $q3->addWhere($category_filter);
}
if ($company_id) {
    $q3->addWhere('p.project_company = ' . $company_id);
コード例 #11
0
?>
" class="text" disabled="disabled" />
		<a href="#" onclick="javascript:popCalendar('end_date')">
			<img src="./images/calendar.gif" width="24" height="12" alt="<?php 
echo $AppUI->_('Calendar');
?>
" border="0" />
		</a>
	</td>

	<td nowrap='nowrap'>
	   <?php 
$q = new DBQuery();
$q->addTable('users', 'u');
$q->addQuery('u.user_id, concat_ws(\' \', c.contact_first_name, c.contact_last_name)');
$q->leftJoin('permissions', 'p', '(u.user_id = p.permission_user)');
$q->leftJoin('contacts', 'c', '(u.user_contact = c.contact_id)');
$q->addWhere('!isnull(p.permission_user)');
$users = array(0 => $AppUI->_("All")) + $q->loadHashList();
echo arraySelect($users, "user_id", "class='text'", $user_id);
?>
	</td>
	
	<td align="right" width="50%" nowrap="nowrap">
		<input class="button" type="submit" name="do_report" value="<?php 
echo $AppUI->_('submit');
?>
" />
	</td>
</tr>
コード例 #12
0
ファイル: tasklogs.php プロジェクト: srinivasulurao/jonel
echo $AppUI->_('submit');
?>
" />
	</td>
</tr>
</table>
</form>

<?php 
if ($do_report) {
    $q = new DBQuery();
    $q->addQuery('p.project_id, p.project_name, t.*, 
		CONCAT_WS(\' \',contact_first_name,contact_last_name) AS creator,
		if (bc.billingcode_name is null, \'\', bc.billingcode_name) as billingcode_name');
    $q->addTable('task_log', 't');
    $q->leftJoin('billingcode', 'bc', 'bc.billingcode_id = t.task_log_costcode');
    $q->leftJoin('users', 'u', 'user_id = task_log_creator');
    $q->leftJoin('contacts', 'c', 'u.user_contact = contact_id');
    $q->innerJoin('tasks', 'tsk', 't.task_log_task = tsk.task_id');
    $q->leftJoin('projects', 'p', 'p.project_id = task_project');
    if ($project_id != 0) {
        $q->addWhere('task_project = ' . (int) $project_id);
    }
    if (!$log_all) {
        $q->addWhere('task_log_date >= \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'');
        $q->addWhere('task_log_date <= \'' . $end_date->format(FMT_DATETIME_MYSQL) . "'");
    }
    if ($log_ignore) {
        $q->addWhere('task_log_hours > 0');
    }
    if ($log_userfilter) {
コード例 #13
0
if ($project_id) {
    $q2->addWhere("file_project = {$project_id}");
}
if ($task_id) {
    $q2->addWhere("file_task = {$task_id}");
}
$q2->setLimit($xpg_pagesize, $xpg_min);
// Adding an Order by that is different to a group by can cause
// performance issues. It is far better to rearrange the group
// by to get the correct ordering.
$q2->addGroup('project_id');
$q2->addGroup('file_version_id DESC');
$q3 = new DBQuery();
$q3->addQuery("file_id, file_version, file_version_id, file_project, file_name, file_task, task_name, file_description, file_checkout, file_co_reason, u.user_username as file_owner, file_size, file_category, file_type, file_date, cu.user_username as co_user, project_name, project_color_identifier, project_active, project_owner, contact_first_name, contact_last_name");
$q3->addTable('files');
$q3->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
$q3->leftJoin('users', 'u', 'u.user_id = file_owner');
$q3->leftJoin('contacts', 'con', 'con.contact_id = u.user_contact');
//$q3->leftJoin('tasks', 't', 't.task_id = file_task');
//$q3->leftJoin('projects', 'p', 'p.project_id = file_project');
$project->setAllowedSQL($AppUI->user_id, $q3, 'file_project');
$task->setAllowedSQL($AppUI->user_id, $q3, 'file_task');
if ($project_id) {
    $q3->addWhere("file_project = {$project_id}");
}
if ($task_id) {
    $q3->addWhere("file_task = {$task_id}");
}
$files = array();
$file_versions = array();
if ($canRead) {
コード例 #14
0
ファイル: csvexport.php プロジェクト: juliogallardo1326/proc
 $text .= sprintf("%s", "\"Directory Server\",\"E-mail Address\",\"E-mail Type\",\"E-mail Display Name\",\"E-mail 2 Address\",");
 // Fields 61 - 65
 $text .= sprintf("%s", "\"E-mail 2 Type\",\"E-mail 2 Display Name\",\"E-mail 3 Address\",\"E-mail 3 Type\",\"E-mail 3 Display Name\",");
 // Fields 66 - 70
 $text .= sprintf("%s", "\"Gender\",\"Government ID Number\",\"Hobby\",\"Initials\",\"Internet Free Busy\",");
 // Fields 71 - 75
 $text .= sprintf("%s", "\"Keywords\",\"Language\",\"Location\",\"Manager's Name\",\"Mileage\",");
 // Fields 76 - 80
 $text .= sprintf("%s", "\"Notes\",\"Office Location\",\"Organizational ID Number\",\"PO Box\",\"Priority\",");
 // Fields 81 - 85
 $text .= sprintf("%s", "\"Private\",\"Profession\",\"Referred By\",\"Sensitivity\",\"Spouse\",");
 // Fields 86 - 90
 $text .= sprintf("%s\r\n", "\"User 1\",\"User 2\",\"User 3\",\"User 4\",\"Web Page\"");
 $q = new DBQuery();
 $q->addTable('contacts', 'con');
 $q->leftJoin('companies', 'co', 'co.company_id = con.contact_company');
 $q->leftJoin('departments', 'de', 'de.dept_id = con.contact_department');
 $q->addQuery('con.*');
 $q->addQuery('co.company_name');
 $q->addQuery('de.dept_name');
 $contacts = $q->loadList();
 foreach ($contacts as $row) {
     // Fields 1- 10
     $text .= sprintf("\"\",\"%s\",\"\",\"%s\",\"\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",", $row['contact_first_name'], $row['contact_last_name'], $row['company_name'], $row['dept_name'], $row['contact_title'], $row['contact_address1'], $row['contact_address2']);
     // Fields 11- 20
     //$text .= sprintf("\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",");
     $text .= sprintf(",\"%s\",\"%s\",\"%s\",,,,,,,", $row['contact_city'], $row['contact_state'], $row['contact_zip']);
     // Fields 21- 30
     $text .= sprintf(",,,,,,,,,,");
     // Fields 31- 40
     settype($row['contact_phone'], 'string');
コード例 #15
0
ファイル: index.php プロジェクト: TheIdeaMan/dotproject
$filter_module_tables = array();
$denied_tables = '';
foreach ($available_modules as $my_mod => $my_mod_data) {
    $my_mod_table = $my_mod_data['permissions_item_table'];
    $filter_options[$my_mod]['Name'] = $my_mod_data['mod_name'];
    $filter_options[$my_mod]['Table'] = $my_mod_table;
    $filter_options[$my_mod]['Table_ID'] = $my_mod_data['permissions_item_field'];
    $filter_options[$my_mod]['Table_ID_Name'] = $my_mod_data['permissions_item_label'];
    $filter_module_tables[$my_mod] = $my_mod_table;
    if ($my_mod_table && !getPermission($my_mod, 'view')) {
        $denied_tables .= ($denied_module_list ? "','" : '') . $my_mod_table;
    }
}
$q->includeCount();
$q->addTable('history', 'h');
$q->leftJoin('users', 'u', 'u.user_id = h.history_user');
$q->addQuery('h.*, u.*');
if ($in_filter) {
    $filter .= ($filter ? ' AND ' : '') . "(h.`history_table` LIKE '" . $in_filter . "%')";
}
if ($denied_tables) {
    $filter .= ($filter ? ' AND ' : '') . "(NOT h.`history_table` IN ('" . $denied_tables . "'))";
}
if (!empty($_REQUEST['project_id'])) {
    $project_id = $_REQUEST['project_id'];
    $r = new DBQuery();
    $r->addTable('tasks');
    $r->addQuery('task_id');
    $r->addWhere('task_project = ' . $project_id);
    $project_tasks = implode(',', $r->loadColumn());
    $r->clear();
コード例 #16
0
    /**
     * w2Pacl::recalcPermissions()
     *
     * @param mixed $user_id
     * @param mixed $user_aro_id
     * @param mixed $role_id
     * @param mixed $module
     * @return
     */
    public function recalcPermissions($user_id = null, $user_aro_id = null, $role_id = null, $module = '', $method = 1)
    {
        /*echo '<pre>';
        		print_r(debug_backtrace());
        		echo '</pre>';die;*/
        //@ini_set('max_execution_time', 180);
        //@ini_set('memory_limit', '128M');
        $q = new DBQuery();
        $q->addTable($this->_db_acl_prefix . 'aco_sections', 'a');
        $q->addQuery('a.value AS a_value, a.name AS a_name,
					b.value AS b_value, b.name AS b_name,
					c.value AS c_value, c.name AS c_name,
					d.value AS d_value, d.name AS d_name,
					e.value AS e_value, e.name AS e_name,
					f.value AS f_value, f.name AS f_name
				');
        $q->leftJoin($this->_db_acl_prefix . 'aco', 'b', 'a.value=b.section_value,' . w2PgetConfig('dbprefix') . $this->_db_acl_prefix . 'aro_sections c');
        $q->leftJoin($this->_db_acl_prefix . 'aro', 'd', 'c.value=d.section_value,' . w2PgetConfig('dbprefix') . $this->_db_acl_prefix . 'axo_sections e');
        $q->leftJoin($this->_db_acl_prefix . 'axo', 'f', 'e.value=f.section_value');
        if ($user_id) {
            $q->addWhere('d.value = \'' . $user_id . '\'');
        } elseif ($user_aro_id) {
            $q->addWhere('d.id = \'' . $user_aro_id . '\'');
        } else {
            //only recalculate permissions for users able to login (that have at least one role)
            $active_users = $this->getUsersWithRole();
            $q->addWhere('d.id IN (' . implode(',', array_keys($active_users)) . ')');
        }
        if ($role_id) {
            $role_users = $this->getRoleUsers($role_id);
            if ($role_users) {
                $q->addWhere('d.value IN (' . implode(',', array_keys($role_users)) . ')');
            } else {
                //If there are no users affected then make it so nothing is recalculated
                $q->addWhere('d.value = 0');
            }
        }
        if ($module) {
            $q->addWhere('f.value = \'' . $module . '\'');
        }
        //Make sure things without axos are not ported, this would make addon modules to carry wrong soft denials affecting visible addon modules
        $q->addWhere('f.value IS NOT NULL');
        //Is the order necessary?
        //$q->addOrder('a.value, b.value, c.value, d.value, e.value, f.value');
        //print_r('User ID:'.$user_id);
        //print_r(' User ARO ID:'.$user_aro_id);
        //print_r(' SQL: '.$q->prepare());die;
        $rows = $q->loadList();
        $q->clear();
        /*	echo("<pre>");
        		print_r($rows);
        		echo("</pre>");*/
        $total_rows = count($rows);
        $acls = array();
        while (list(, $row) = @each($rows)) {
            /*	    list(
            			$aco_section_value,
            			$aco_section_name,
            			$aco_value,
            			$aco_name,
            			
            			$aro_section_value,
            			$aro_section_name,
            			$aro_value,
            			$aro_name,
            			
            			$axo_section_value,
            			$axo_section_name,
            			$axo_value,
            			$axo_name
            			) = $row;*/
            $aco_section_value = $row['a_value'];
            $aco_value = $row['b_value'];
            $aro_section_value = $row['c_value'];
            $aro_value = $row['d_value'];
            $aro_name = $row['d_name'];
            $axo_section_value = $row['e_value'];
            $axo_value = $row['f_value'];
            $acl_result = $this->acl_query($aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value, $axo_value);
            $acl_id =& $acl_result['acl_id'];
            $access =& $acl_result['allow'];
            $acls[] = array('aco_section_value' => $aco_section_value, 'aco_value' => $aco_value, 'aro_section_value' => $aro_section_value, 'aro_value' => $aro_value, 'aro_name' => $aro_name, 'axo_section_value' => $axo_section_value, 'axo_value' => $axo_value, 'acl_id' => $acl_id, 'access' => $access);
        }
        /*echo("<pre>");
        		print_r($acls);
        		echo("</pre>");die;*/
        $user_permissions = array();
        foreach ($acls as $key => $acl) {
            $user_permissions[$acl['aro_value']][$key]['user_id'] = $acl['aro_value'];
            $user_permissions[$acl['aro_value']][$key]['user_name'] = $acl['aro_name'];
            $user_permissions[$acl['aro_value']][$key]['module'] = $acl['axo_section_value'] == 'app' || $acl['axo_section_value'] == 'sys' ? $acl['axo_value'] : $acl['axo_section_value'];
            $user_permissions[$acl['aro_value']][$key]['item_id'] = $acl['axo_section_value'] == 'app' || $acl['axo_section_value'] == 'sys' ? 0 : $acl['axo_value'];
            $user_permissions[$acl['aro_value']][$key]['action'] = $acl['aco_value'];
            $user_permissions[$acl['aro_value']][$key]['access'] = $acl['access'] ? 1 : 0;
            $user_permissions[$acl['aro_value']][$key]['acl_id'] = $acl['acl_id'];
        }
        // Now that we have the users permissions lets delete the existing ones and insert the new ones
        $q = new DBQuery();
        $q->setDelete($this->_db_acl_prefix . 'permissions');
        if ($user_id) {
            $q->addWhere('user_id = \'' . $user_id . '\'');
        }
        if ($user_aro_id) {
            $qui = new DBQuery();
            $qui->addTable($this->_db_acl_prefix . 'aro');
            $qui->addQuery('value');
            $qui->addWhere('id = \'' . $user_aro_id . '\'');
            $id = $qui->loadResult();
            if ($id) {
                $q->addWhere('user_id = \'' . $id . '\'');
            }
        }
        if ($role_id) {
            $role_users = $this->getRoleUsers($role_id);
            if ($role_users) {
                $q->addWhere('user_id IN (' . implode(',', array_keys($role_users)) . ')');
            } else {
                //If there are no users affected then don not delete anything
                $q->addWhere('user_id = 0');
            }
        }
        if ($module) {
            $q->addWhere('module = \'' . $module . '\'');
        }
        $q->exec();
        $q->clear();
        /*echo("<pre>");
        		print_r($user_permissions);
        		echo("</pre>");*/
        $q = new DBQuery();
        foreach ($user_permissions as $user => $permissions) {
            foreach ($permissions as $permission) {
                //Only show permissions with acl_id and item_id when item permissions are to show
                //Don't show login ACOs
                if (!($permission['item_id'] && !$permission['acl_id']) && $permission['action'] != 'login') {
                    $q->addTable($this->_db_acl_prefix . 'permissions');
                    $q->addInsert('user_id', $permission['user_id']);
                    $q->addInsert('user_name', $permission['user_name']);
                    $q->addInsert('module', $permission['module']);
                    $q->addInsert('item_id', $permission['item_id'] ? $permission['item_id'] : 0);
                    $q->addInsert('action', $permission['action']);
                    $q->addInsert('access', $permission['access']);
                    $q->addInsert('acl_id', $permission['acl_id'] ? $permission['acl_id'] : 0);
                    $q->exec();
                    $q->clear();
                }
            }
        }
        return true;
    }
コード例 #17
0
ファイル: forums.class.php プロジェクト: joly/web2project
 public function sendWatchMail($debug = false)
 {
     global $AppUI, $debug, $w2Pconfig;
     $subj_prefix = $AppUI->_('forumEmailSubj', UI_OUTPUT_RAW);
     $body_msg = $AppUI->_('forumEmailBody', UI_OUTPUT_RAW);
     // Get the message from details.
     $q = new DBQuery();
     $q->addTable('users', 'u');
     $q->addQuery('contact_email, contact_first_name, contact_last_name');
     $q->addJoin('contacts', 'con', 'contact_id = user_contact', 'inner');
     $q->addWhere('user_id = ' . (int) $this->message_author);
     $res = $q->exec();
     if ($row = $q->fetchRow()) {
         $message_from = $row['contact_first_name'] . ' ' . $row['contact_last_name'] . '<' . $row['contact_email'] . '>';
     } else {
         $message_from = 'Unknown user';
     }
     // Get the forum name;
     $q->clear();
     $q->addTable('forums');
     $q->addQuery('forum_name');
     $q->addWhere('forum_id = \'' . $this->message_forum . '\'');
     $res = $q->exec();
     if ($row = $q->fetchRow()) {
         $forum_name = $row['forum_name'];
     } else {
         $forum_name = 'Unknown';
     }
     // SQL-Query to check if the message should be delivered to all users (forced)
     // In positive case there will be a (0,0,0) row in the forum_watch table
     $q->clear();
     $q->addTable('forum_watch');
     $q->addQuery('*');
     $q->addWhere('watch_user = 0 AND watch_forum = 0 AND watch_topic = 0');
     $resAll = $q->exec();
     $AllCount = db_num_rows($resAll);
     $q->clear();
     $q->addTable('users');
     $q->addQuery('DISTINCT contact_email, user_id, contact_first_name, contact_last_name');
     $q->leftJoin('contacts', 'con', 'contact_id = user_contact');
     if ($AllCount < 1) {
         //message is only delivered to users that checked the forum watch
         $q->addTable('forum_watch');
         $q->addWhere('user_id = watch_user AND (watch_forum = ' . (int) $this->message_forum . ' OR watch_topic = ' . (int) $this->message_parent . ')');
     }
     if (!($res = $q->exec(ADODB_FETCH_ASSOC))) {
         $q->clear();
         return;
     }
     if (db_num_rows($res) < 1) {
         return;
     }
     $mail = new Mail();
     $mail->Subject($subj_prefix . ' ' . $this->message_title, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
     $body = $body_msg;
     $body .= "\n\n" . $AppUI->_('Forum', UI_OUTPUT_RAW) . ': ' . $forum_name;
     $body .= "\n" . $AppUI->_('Subject', UI_OUTPUT_RAW) . ': ' . $this->message_title;
     $body .= "\n" . $AppUI->_('Message From', UI_OUTPUT_RAW) . ': ' . $message_from;
     $body .= "\n\n" . W2P_BASE_URL . '/index.php?m=forums&a=viewer&forum_id=' . $this->message_forum;
     $body .= "\n\n" . $this->message_body;
     $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
     while ($row = $q->fetchRow()) {
         if ($mail->ValidEmail($row['contact_email'])) {
             $mail->To($row['contact_email'], true);
             $mail->Send();
         }
     }
     $q->clear();
     return;
 }
コード例 #18
0
<?php

if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
// Grab a list of the other resources, determine how they are allocated,
// and if there is a clash between this and other tasks.
global $AppUI, $task_id, $obj;
require_once $AppUI->getModuleClass('resources');
$resource = new CResource();
$q = new DBQuery();
$q->addQuery('a.*');
$q->addQuery('b.percent_allocated');
$q->addQuery('c.resource_type_name');
$q->addTable('resources', 'a');
$q->leftJoin('resource_tasks', 'b', 'b.resource_id = a.resource_id');
$q->leftJoin('resource_types', 'c', 'c.resource_type_id = a.resource_type');
$q->addWhere('b.task_id = ' . $task_id);
$resources = $q->loadHashList('resource_id');
// Determine any other clashes.
$resource_tasks = array();
if (count($resources)) {
    $q->clear();
    $q->addQuery('b.resource_id, sum(b.percent_allocated) as total_allocated');
    $q->addTable('tasks', 'a');
    $q->leftJoin('resource_tasks', 'b', 'b.task_id = a.task_id');
    $q->addWhere('b.resource_id in (' . implode(',', array_keys($resources)) . ')');
    $q->addWhere("task_start_date <= '" . $obj->task_end_date . "'");
    $q->addWhere("task_end_date >= '" . $obj->task_start_date . "'");
    $q->addGroup("resource_id");
    $resource_tasks = $q->loadHashList();
コード例 #19
0
$tp = $tl & 4;
?>
		<input type='checkbox' name='email_assignees' <?php 
if ($ta) {
    echo "checked='checked'";
}
?>
><?php 
echo $AppUI->_('Task Assignees');
?>
		<input type='hidden' name='email_task_list' id='email_task_list'
		  value='<?php 
$task_email_title = array();
$q = new DBQuery();
$q->addTable('task_contacts', 'tc');
$q->leftJoin('contacts', 'c', 'c.contact_id = tc.contact_id');
$q->addWhere("tc.task_id = '{$task_id}'");
$q->addQuery('tc.contact_id');
$q->addQuery('c.contact_last_name, c.contact_first_name');
$req =& $q->exec();
$cid = array();
for ($req; !$req->EOF; $req->MoveNext()) {
    $cid[] = $req->fields['contact_id'];
    $task_email_title[] = $req->fields['contact_last_name'] . ' ' . $req->fields['contact_first_name'];
}
echo implode(',', $cid);
?>
'>
		<input type='checkbox' onmouseover="window.status = '<?php 
echo addslashes(implode(',', $task_email_title));
?>
コード例 #20
0
ファイル: index.php プロジェクト: hoodoogurus/dotprojecteap
if ($search_string) {
    $AppUI->setState('ContIdxWhere', $search_string);
    $get_search = addslashes(stripslashes($search_string));
    $additional_filter = "contact_first_name LIKE '%" . $get_search . "%'" . " OR contact_last_name LIKE '%" . $get_search . "%'" . " OR company_name LIKE '%" . $get_search . "%'" . " OR contact_notes LIKE '%" . $get_search . "%'" . " OR contact_email LIKE '%" . $get_search . "%'";
} else {
    if (isset($_GET['where'])) {
        $AppUI->setState('ContIdxWhere', $_GET['where']);
    }
}
$where = $AppUI->getState('ContIdxWhere') ? $AppUI->getState('ContIdxWhere') : '%';
// Pull First Letters
$let = ":";
$search_map = array('contact_order_by', 'contact_first_name', 'contact_last_name');
foreach ($search_map as $search_name) {
    $q->addTable('contacts', 'c');
    $q->leftJoin('users', 'u', 'u.user_contact=c.contact_id');
    $q->addQuery('DISTINCT UPPER(SUBSTRING(' . $search_name . ',1,1)) as L, user_id');
    $q->addWhere('contact_private = 0 OR (contact_private = 1 AND contact_owner = ' . $AppUI->user_id . ') OR contact_owner IS NULL OR contact_owner = 0');
    $arr = $q->loadList();
    foreach ($arr as $L) {
        if (!$L['user_id'] || $perms->checkLogin($L['user_id'])) {
            $let .= $L['L'];
        }
    }
}
$q->clear();
// optional fields shown in the list (could be modified to allow breif and verbose, etc)
$showfields = array('contact_company' => 'contact_company', 'company_name' => 'company_name', 'contact_phone' => 'contact_phone', 'contact_email' => 'contact_email');
require_once $AppUI->getModuleClass('companies');
$company = new CCompany();
$allowedCompanies = $company->getAllowedSQL($AppUI->user_id);
コード例 #21
0
ファイル: tasks.class.php プロジェクト: joly/web2project
 public function canDelete(&$msg, $oid = null, $joins = null)
 {
     global $AppUI;
     $q = new DBQuery();
     // First things first.	Are we allowed to delete?
     $acl =& $AppUI->acl();
     if (!$acl->checkModule('task_log', 'delete')) {
         $msg = $AppUI->_('noDeletePermission');
         return false;
     }
     $k = $this->_tbl_key;
     if ($oid) {
         $this->{$k} = intval($oid);
     }
     if (is_array($joins)) {
         $q->addTable($this->_tbl, 'k');
         $q->addQuery($k);
         $i = 0;
         foreach ($joins as $table) {
             $table_alias = 't' . $i++;
             $q->leftJoin($table['name'], $table_alias, $table_alias . '.' . $table['joinfield'] . ' = ' . 'k' . '.' . $k);
             $q->addQuery('COUNT(DISTINCT ' . $table_alias . '.' . $table['idfield'] . ') AS ' . $table['idfield']);
         }
         $q->addWhere($k . ' = ' . $this->{$k});
         $q->addGroup($k);
         $obj = null;
         $q->loadObject($obj);
         $q->clear();
         if (!$obj) {
             $msg = db_error();
             return false;
         }
         $msg = array();
         foreach ($joins as $table) {
             $k = $table['idfield'];
             if ($obj->{$k}) {
                 $msg[] = $AppUI->_($table['label']);
             }
         }
         if (count($msg)) {
             $msg = $AppUI->_('noDeleteRecord') . ': ' . implode(', ', $msg);
             return false;
         }
     }
     return true;
 }
コード例 #22
0
        $q->addTable('companies', 'c');
        $q->addQuery('c.company_name');
        $q->addWhere('company_id = ' . $company_id);
        $company_name = $q->loadResult();
        $q->clear();
        /*
        	$sql = "select c.company_name from companies as c where company_id = $company_id";
        	$company_name = db_loadResult($sql);
        */
        $company_name_sql = db_escape($company_name);
        $where = " ( contact_company = '{$company_name_sql}' or contact_company = '{$company_id}' )";
    }
}
// This should now work on company ID, but we need to be able to handle both
$q->addTable('contacts', 'a');
$q->leftJoin('companies', 'b', 'company_id = contact_company');
$q->leftJoin('departments', 'c', 'dept_id = contact_department');
$q->addQuery('contact_id, contact_first_name, contact_last_name, contact_company, contact_department');
$q->addQuery('company_name');
$q->addQuery('dept_name');
if ($where) {
    // Don't assume where is set. Change needed to fix Mantis Bug 0002056
    $q->addWhere($where);
}
$q->addWhere("(contact_owner = '" . $AppUI->user_id . "' OR contact_private = '0')");
$q->addOrder('company_name, contact_company, dept_name, contact_department, contact_last_name');
// May need to review this.
$contacts = $q->loadHashList('contact_id');
?>

<form action="index.php?m=public&a=contact_selector&dialog=1&<?php 
コード例 #23
0
ファイル: overdue.php プロジェクト: kaz190/dotproject
// Build the data to go into the table.
$pdfdata = array();
$columns = array();
$columns[] = $AppUI->_('Task Name');
$columns[] = $AppUI->_('Owner');
$columns[] = $AppUI->_('Assigned Users');
if ($hasResources) {
    $columns[] = $AppUI->_('Assigned Resources');
}
$columns[] = $AppUI->_('Finish Date');
// Grab the completed items in the last week
$q = new DBQuery();
$q->addQuery('a.*');
$q->addQuery('b.user_username');
$q->addTable('tasks', 'a');
$q->leftJoin('users', 'b', 'a.task_owner = b.user_id');
$q->addWhere('task_percent_complete < 100');
if ($project_id != 0) {
    $q->addWhere('task_project = ' . $project_id);
}
$q->addWhere("task_end_date <  '" . $date->format(FMT_DATETIME_MYSQL) . "'");
$tasks = $q->loadHashList('task_id');
if ($err = db_error()) {
    $AppUI->setMsg($err, UI_MSG_ERROR);
    $AppUI->redirect();
}
// Now grab the resources allocated to the tasks.
$task_list = array_keys($tasks);
$assigned_users = array();
// Build the array
foreach ($task_list as $tid) {
コード例 #24
0
ファイル: todo.php プロジェクト: hoodoogurus/dotprojecteap
                }
            }
        }
        db_exec($q->prepare(true));
        echo db_error();
    }
}
$AppUI->savePlace();
$proj = new CProject();
$tobj = new CTask();
$allowedProjects = $proj->getAllowedSQL($AppUI->user_id);
$allowedTasks = $tobj->getAllowedSQL($AppUI->user_id, 'task_id');
// query my sub-tasks (ignoring task parents)
$q = new DBQuery();
$q->addTable('tasks', 'ta');
$q->leftJoin('projects', 'pr', 'pr.project_id = ta.task_project');
$q->innerJoin('user_tasks', 'ut', 'ut.task_id = ta.task_id AND ut.user_id = ' . $user_id);
$q->leftJoin('user_task_pin', 'tp', 'tp.task_id = ta.task_id AND tp.user_id = ' . $user_id);
$q->addQuery('ta.*');
$q->addQuery('pr.project_name, pr.project_id, pr.project_color_identifier');
$q->addQuery('tp.task_pinned');
$q->addWhere('(ta.task_percent_complete < 100 OR ta.task_percent_complete IS NULL)');
$q->addWhere('ta.task_status = 0');
if (!$showArcProjs) {
    $q->addWhere('project_status <> 7');
}
if (!$showLowTasks) {
    $q->addWhere('task_priority >= 0');
}
if (!$showHoldProjs) {
    $q->addWhere('project_status != ' . $project_on_hold_status);
コード例 #25
0
ファイル: folders_table.php プロジェクト: magsilva/dotproject
function displayFiles($folder)
{
    global $m, $a, $tab, $AppUI, $xpg_min, $xpg_pagesize;
    global $deny1, $deny2, $project_id, $task_id, $showProject, $file_types, $cfObj;
    global $xpg_totalrecs, $xpg_total_pages, $page;
    global $company_id, $allowed_companies, $current_uri, $dPconfig;
    $canEdit = !getDenyEdit($m, $folder);
    $canRead = !getDenyRead($m, $folder);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    // SETUP FOR FILE LIST
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.*,count(file_version) as file_versions,round(max(file_version), 2) as file_lastversion,file_folder_id, file_folder_name,project_name, project_color_identifier,contact_first_name, contact_last_name,task_name,task_id');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $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) . ')');
    }
    if (count($deny2) > 0) {
        $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
    }
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $q->addGroup('file_folder');
    $q->addGroup('project_name');
    $q->addGroup('file_name');
    $q->addOrder('file_folder');
    $q->addOrder('project_name');
    $q->addOrder('file_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.file_id, file_version, file_project, file_name, file_task, file_description, user_username as file_owner, file_size, file_category, file_type, file_date, file_folder_name');
    $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 ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadList($file_versions_sql);
    }
    if ($files === array()) {
        return 0;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
	    <th><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Type');
    ?>
</a></th>
		<th><?php 
    echo $AppUI->_('Date');
    ?>
</th>
    	<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
    	<th><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        if ($fp != $row["file_project"]) {
            if (!$row["project_name"]) {
                $row["project_name"] = $AppUI->_('All Projects');
                $row["project_color_identifier"] = 'f4efe3';
            }
            if ($showProject) {
                $s = '<tr>';
                $s .= '<td colspan="20" style="background-color:#' . $row["project_color_identifier"] . '">';
                $s .= '<font color="' . bestColor($row["project_color_identifier"]) . '">';
                if ($row['file_project'] > 0) {
                    $href = './index.php?m=projects&a=view&project_id=' . $row['file_project'];
                } else {
                    $href = './index.php?m=projects';
                }
                $s .= '<a href="' . $href . '">' . $row["project_name"] . '</a>';
                $s .= '</font></td></tr>';
                echo $s;
            }
        }
        $fp = $row["file_project"];
        if ($row['file_versions'] > 1) {
            $file = last_file($file_versions, $row['file_name'], $row['file_project']);
        } else {
            $file = $row;
        }
        ?>
	<form name="frm_remove_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
			<?php 
        $file_icon = getIcon($row['file_type']);
        echo "<a href=\"./fileviewer.php?file_id={$file['file_id']}\" title=\"{$file['file_description']}\"><img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;{$row['file_name']}</a>";
        ?>
		</td>
		<td width="20%"><?php 
        echo $file['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
	        <?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            echo ' <a href="#" onClick="expand(\'versions_' . $file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>';
            $hidden_table = '<tr><td colspan="20">
	<table style="display: none" id="versions_' . $file['file_id'] . '" 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 width="1"></th>
	        <th nowrap width="1"></th>
	</tr>
	';
            foreach ($file_versions as $file_row) {
                if ($file_row['file_name'] == $row['file_name'] && $file_row['file_project'] == $row['file_project']) {
                    $file_icon = getIcon($file_row['file_type']);
                    $file_date = new CDate($file_row['file_date']);
                    $hidden_table .= '	
			<form name="frm_delete_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="del" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '	
			<form name="frm_duplicate_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="duplicate" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '
	        <tr>
	                <td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file_row['file_id'] . '" 
	                        title="' . $file_row['file_description'] . '">' . "<img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;" . $file_row['file_name'] . '
	                </a></td>
	                <td width="20%">' . $file_row['file_description'] . '</td>
	                <td width="5%" nowrap="nowrap" align="center">' . $file_row['file_version'] . '</td>
	                <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=' . $m . '&a=' . $a . '&tab=' . ($file_row['file_category'] + 1) . '">' . $file_types[$file_row['file_category'] + 1] . '</a></td>
	                <td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=' . $file_row["file_task"] . '">' . $row["task_name"] . '</a></td>
	                <td width="15%" nowrap="nowrap">' . $row["contact_first_name"] . ' ' . $row["contact_last_name"] . '</td>
	                <td width="5%" nowrap="nowrap" align="right">' . intval($file_row['file_size'] / 1024) . 'kb </td>
	                <td width="15%" nowrap="nowrap">' . $file_row['file_type'] . '</td>
	                <td width="15%" nowrap="nowrap" align="right">' . $file_date->format("{$df} {$tf}") . '</td>
        			<td width="10%">' . $row['file_co_reason'] . '</td>
        			<td nowrap="nowrap" align="center">';
                    if ($canEdit && empty($file_row['file_checkout'])) {
                        $hidden_table .= '<a href="?m=files&a=co&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file') . '</a>';
                    } else {
                        if ($row['file_checkout'] == $AppUI->user_id) {
                            $hidden_table .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file') . '</a>';
                        } else {
                            if ($file_row['file_checkout'] == 'final') {
                                $hidden_table .= 'final';
                            } else {
                                $q4 = new DBQuery();
                                $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                                $q4->addTable('files');
                                $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                                $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                                $q4->addWhere('file_id = ' . $file_row['file_id']);
                                $co_user = array();
                                $co_user = $q4->loadList();
                                $co_user = $co_user[0];
                                $q4->clear();
                                $hidden_table .= $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                            }
                        }
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="48">';
                    if ($canEdit && (empty($file_row['file_checkout']) || $file_row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file_row["file_id"] . '">' . dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file') . "</a>" . '<a href="#" onclick="document.frm_duplicate_sub_file_' . $file_row['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . "</a>" . '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_delete_sub_file_' . $file_row['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . "</a>";
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="1">';
                    if ($canEdit && (empty($row['file_checkout']) || $row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file_row['file_id'] . ') : removeBulkComponent(' . $file_row['file_id'] . ')"';
                        $hidden_table .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sub_sel_file_' . $file_row['file_id'] . '" />';
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '</tr>';
                }
            }
            $hidden_table .= '</table>';
            //$hidden_table .= '</span>';
        }
        ?>
	        </td>
	        <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=<?php 
        echo $m;
        ?>
&a=<?php 
        echo $a;
        ?>
&view=categories&tab=<?php 
        echo $file['file_category'];
        ?>
"><?php 
        echo $file_types[$file["file_category"]];
        ?>
</a></td> 
		<td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $file["task_id"];
        ?>
"><?php 
        echo $file["task_name"];
        ?>
</a></td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="right"><?php 
        echo intval($file["file_size"] / 1024);
        ?>
 kb</td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["file_type"];
        ?>
</td>
		<td width="15%" nowrap="nowrap" align="right"><?php 
        echo $file_date->format("{$df} {$tf}");
        ?>
</td>
        <td width="10%"><?php 
        echo $file['file_co_reason'];
        ?>
</td>
        <td nowrap="nowrap" align="center">
        <?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
                <a href="?m=files&a=co&file_id=<?php 
            echo $file['file_id'];
            ?>
"><?php 
            echo dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
</a>
        <?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
                <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $file['file_id'];
                ?>
"><?php 
                echo dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
</a>
        <?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo 'final';
                } else {
                    $q4 = new DBQuery();
                    $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                    $q4->addTable('files');
                    $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                    $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                    $q4->addWhere('file_id = ' . $file['file_id']);
                    $co_user = array();
                    $co_user = $q4->loadList();
                    $co_user = $co_user[0];
                    $q4->clear();
                    echo $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                }
            }
        }
        ?>
                
        </td>
		<td nowrap="nowrap" align="center" width="48">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            echo '<a href="./index.php?m=files&a=addedit&file_id=' . $file["file_id"] . '">';
            echo dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
            echo "</a>";
            echo '<a href="#" onclick="document.frm_duplicate_file_' . $file['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . '</a>';
            echo '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $file['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . '</a>';
        }
        ?>
		<td nowrap="nowrap" align="center" width="1">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file['file_id'] . ') : removeBulkComponent(' . $file['file_id'] . ')"';
            echo '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $file['file_id'] . '" />';
        }
        ?>
		
		</td>
	</tr>
	<?php 
        echo $hidden_table;
        ?>
	<?php 
        $hidden_table = '';
    }
    ?>
	</table>
	<?php 
    if ($xpg_totalrecs > $xpg_pagesize) {
        showfnavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder);
    }
    echo "<br />";
}
コード例 #26
0
ファイル: tasksperuser.php プロジェクト: klr2003/sourceread
echo $AppUI->_('Display allocated hours/week');
?>
</label>
	</td>
</tr>

</table>
</form>
<center>
	<table class="std">
<?php 
if ($do_report) {
    // Let's figure out which users we have
    $query = new DBQuery();
    $query->addTable('users', 'u');
    $query->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $query->addQuery('u.user_id, u.user_username, c.contact_first_name, c.contact_last_name');
    if ($log_userfilter) {
        $query->addWhere('user_id = ' . $log_userfilter);
    }
    $query->addOrder('user_username');
    $user_list = $query->loadHashList('user_id');
    $query->clear();
    $proj = new CProject();
    $task = new CTask();
    $ss = $start_date->format(FMT_DATETIME_MYSQL);
    $se = $end_date->format(FMT_DATETIME_MYSQL);
    $query->addTable('tasks', 't');
    $query->leftJoin('projects', 'p', 'p.project_id = t.task_project');
    $query->addQuery('t.*');
    if ($use_period) {
コード例 #27
0
 /**
  * Called by the Event Queue processor to process a reminder
  * on a task.
  * @access		  public
  * @param		 string		   $module		  Module name (not used)
  * @param		 string		   $type Type of event (not used)
  * @param		 integer		$id ID of task being reminded
  * @param		 integer		$owner		  Originator of event
  * @param		 mixed		  $args event-specific arguments.
  * @return		  mixed		   true, dequeue event, false, event stays in queue.
  -1, event is destroyed.
 */
 function remind($module, $type, $id, $owner, &$args)
 {
     global $locale_char_set, $AppUI;
     $q = new DBQuery();
     $df = $AppUI->getPref('SHDATEFORMAT');
     $tf = $AppUI->getPref('TIMEFORMAT');
     // If we don't have preferences set for these, use ISO defaults.
     if (!$df) {
         $df = '%Y-%m-%d';
     }
     if (!$tf) {
         $tf = '%H:%m';
     }
     $df .= ' ' . $tf;
     // At this stage we won't have an object yet
     if (!$this->load($id)) {
         return -1;
         // No point it trying again later.
     }
     $this->htmlDecode();
     // Only remind on working days.
     $today = new CDate();
     if (!$today->isWorkingDay()) {
         return true;
     }
     // Check if the task is completed
     if ($this->task_percent_complete == 100) {
         return -1;
     }
     // Grab the assignee list
     $q->addTable('user_tasks', 'ut');
     $q->leftJoin('users', 'u', 'u.user_id = ut.user_id');
     $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
     $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email');
     $q->addWhere('ut.task_id = ' . $id);
     $contacts = $q->loadHashList('contact_id');
     $q->clear();
     // Now we also check the owner of the task, as we will need
     // to notify them as well.
     $owner_is_not_assignee = false;
     $q->addTable('users', 'u');
     $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
     $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email');
     $q->addWhere('u.user_id = ' . $this->task_owner);
     if ($q->exec(ADODB_FETCH_NUM)) {
         list($owner_contact, $owner_first_name, $owner_last_name, $owner_email) = $q->fetchRow();
         if (!isset($contacts[$owner_contact])) {
             $owner_is_not_assignee = true;
             $contacts[$owner_contact] = array('contact_id' => $owner_contact, 'contact_first_name' => $owner_first_name, 'contact_last_name' => $owner_last_name, 'contact_email' => $owner_email);
         }
     }
     $q->clear();
     // build the subject line, based on how soon the
     // task will be overdue.
     $starts = new CDate($this->task_start_date);
     $expires = new CDate($this->task_end_date);
     $now = new CDate();
     $diff = $expires->dateDiff($now);
     $prefix = $AppUI->_('Task Due', UI_OUTPUT_RAW);
     if ($diff == 0) {
         $msg = $AppUI->_('TODAY', UI_OUTPUT_RAW);
     } else {
         if ($diff == 1) {
             $msg = $AppUI->_('TOMORROW', UI_OUTPUT_RAW);
         } else {
             if ($diff < 0) {
                 $msg = $AppUI->_(array('OVERDUE', abs($diff), 'DAYS'));
                 $prefix = $AppUI->_('Task', UI_OUTPUT_RAW);
             } else {
                 $msg = $AppUI->_(array($diff, 'DAYS'));
             }
         }
     }
     $q->addTable('projects');
     $q->addQuery('project_name');
     $q->addWhere('project_id = ' . $this->task_project);
     $project_name = htmlspecialchars_decode($q->loadResult());
     $q->clear();
     $subject = $prefix . ' ' . $msg . ' ' . $this->task_name . '::' . $project_name;
     $body = $AppUI->_('Task Due', UI_OUTPUT_RAW) . ': ' . $msg . "\n" . $AppUI->_('Project', UI_OUTPUT_RAW) . ': ' . $project_name . "\n" . $AppUI->_('Task', UI_OUTPUT_RAW) . ': ' . $this->task_name . "\n" . $AppUI->_('Start Date', UI_OUTPUT_RAW) . ': ' . $starts->format($df) . "\n" . $AppUI->_('Finish Date', UI_OUTPUT_RAW) . ': ' . $expires->format($df) . "\n" . $AppUI->_('URL', UI_OUTPUT_RAW) . ': ' . DP_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->task_id . '&reminded=1' . "\n\n" . $AppUI->_('Resources', UI_OUTPUT_RAW) . ":\n";
     foreach ($contacts as $contact) {
         if ($owner_is_not_assignee || $contact['contact_id'] != $owner_contact) {
             $body .= $contact['contact_first_name'] . ' ' . $contact['contact_last_name'] . ' <' . $contact['contact_email'] . ">\n";
         }
     }
     $body .= "\n" . $AppUI->_('Description', UI_OUTPUT_RAW) . ":\n" . $this->task_description . "\n";
     $mail = new Mail();
     foreach ($contacts as $contact) {
         if ($mail->ValidEmail($contact['contact_email'])) {
             $mail->To($contact['contact_email']);
         }
     }
     $mail->From('"' . $owner_first_name . ' ' . $owner_last_name . '" <' . $owner_email . '>');
     $mail->Subject($subject, $locale_char_set);
     $mail->Body($body, $locale_char_set);
     return $mail->Send();
 }
コード例 #28
0
ファイル: companies.class.php プロジェクト: joly/web2project
    public static function getContacts($AppUI, $companyId)
    {
        $results = array();
        $perms = $AppUI->acl();
        if ($AppUI->isActiveModule('contacts') && $perms->checkModule('contacts', 'view') && (int) $companyId > 0) {
            $q = new DBQuery();
            $q->addQuery('a.*');
            $q->addQuery('dept_name');
            $q->addTable('contacts', 'a');
            $q->leftJoin('companies', 'b', 'a.contact_company = b.company_id');
            $q->leftJoin('departments', '', 'contact_department = dept_id');
            $q->addWhere('contact_company = ' . (int) $companyId);
            $q->addWhere('
				(contact_private=0
					OR (contact_private=1 AND contact_owner=' . $AppUI->user_id . ')
					OR contact_owner IS NULL OR contact_owner = 0
				)');
            $department = new CDepartment();
            $department->setAllowedSQL($AppUI->user_id, $q);
            $q->addOrder('contact_first_name');
            $q->addOrder('contact_last_name');
            $results = $q->loadHashList('contact_id');
        }
        return $results;
    }
コード例 #29
0
ファイル: gantt.php プロジェクト: joly/web2project
 $projects[$project_id]['project_name'] = $AppUI->_('Todo for') . ' ' . CContact::getContactByUserid($user_id);
 $projects[$project_id]['project_color_identifier'] = 'ff6000';
 $showLabels = w2PgetParam($_REQUEST, 'showLabels', false);
 $showPinned = w2PgetParam($_REQUEST, 'showPinned', false);
 $showArcProjs = w2PgetParam($_REQUEST, 'showArcProjs', false);
 $showHoldProjs = w2PgetParam($_REQUEST, 'showHoldProjs', false);
 $showDynTasks = w2PgetParam($_REQUEST, 'showDynTasks', false);
 $showLowTasks = w2PgetParam($_REQUEST, 'showLowTasks', true);
 $q = new DBQuery();
 $q->addQuery('ta.*');
 $q->addQuery('project_name, project_id, project_color_identifier');
 $q->addQuery('tp.task_pinned');
 $q->addTable('projects', 'pr');
 $q->addTable('tasks', 'ta');
 $q->addTable('user_tasks', 'ut');
 $q->leftJoin('user_task_pin', 'tp', 'tp.task_id = ta.task_id and tp.user_id = ' . (int) $user_id);
 $q->addWhere('ut.task_id = ta.task_id');
 $q->addWhere('ut.user_id = ' . (int) $user_id);
 $q->addWhere('(ta.task_percent_complete < 100 OR ta.task_percent_complete is null)');
 $q->addWhere('ta.task_status = 0');
 $q->addWhere('pr.project_id = ta.task_project');
 if (!$showArcProjs) {
     $q->addWhere('pr.project_active = 1');
     if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
         $q->addWhere('pr.project_status <> ' . (int) $template_status);
     }
 }
 if (!$showLowTasks) {
     $q->addWhere('task_priority >= 0');
 }
 if (!$showHoldProjs) {
コード例 #30
0
ファイル: overall.php プロジェクト: srinivasulurao/jonel
function showcompany($company, $restricted = false)
{
    global $AppUI, $allpdfdata, $log_start_date, $log_end_date, $log_all;
    /* $sql="
            SELECT
                    billingcode_id,
                    billingcode_name,
                    billingcode_value
            FROM billingcode
            WHERE company_id=$company
            ORDER BY billingcode_name ASC
            ";
                                                                                                                      
            $company_billingcodes=NULL;
            $ptrc=db_exec($sql);
            $nums=db_num_rows($ptrc);
            echo db_error();
                                                                                                                             
            for ($x=0; $x < $nums; $x++) {
                    $row=db_fetch_assoc($ptrc);
                    $company_billingcodes[$row['billingcode_id']]=$row['billingcode_name'];
            }
    */
    $q = new DBQuery();
    $q->addTable('projects');
    $q->addQuery('project_id, project_name');
    $q->addWhere('project_company = ' . $company);
    $projects = $q->loadHashList();
    $q->addTable('companies');
    $q->addQuery('company_name');
    $q->addWhere('company_id = ' . $company);
    $company_name = $q->loadResult();
    $table = '<h2>Company: ' . $company_name . '</h2>
        <table cellspacing="1" cellpadding="4" border="0" class="tbl">';
    $project_row = '
        <tr>
                <th>' . $AppUI->_('Project') . '</th>';
    $pdfth[] = $AppUI->_('Project');
    /*		if (isset($company_billingcodes))
    	                foreach ($company_billingcodes as $code)
    			{
            	                $project_row .= '<th>' . $code . ' ' . $AppUI->_('Hours') . '</th>';
    				$pdfth[] = $code;
    			}
      */
    $project_row .= '<th>' . $AppUI->_('Total') . '</th></tr>';
    $pdfth[] = $AppUI->_('Total');
    $pdfdata[] = $pdfth;
    $hours = 0.0;
    $table .= $project_row;
    foreach ($projects as $project => $name) {
        $pdfproject = array();
        $pdfproject[] = safe_utf8_decode($name);
        $project_hours = 0;
        $project_row = "<tr><td>{$name}</td>";
        $q->addTable('projects', 'prj');
        $q->leftJoin('tasks', 't', 't.task_project = prj.project_id');
        $q->leftJoin('task_log', 'tl', 'tl.task_log_task = t.task_id');
        $q->addQuery('project_id, sum(task_log_hours) as hours');
        $where = 'project_id = ' . $project;
        if ($log_start_date != 0 && !$log_all) {
            $where .= " AND task_log_date >= {$log_start_date}";
        }
        if ($log_end_date != 0 && !$log_all) {
            $where .= " AND task_log_date <= {$log_end_date}";
        }
        if ($restricted) {
            $where .= " AND task_log_creator = '" . $AppUI->user_id . "'";
        }
        $q->addWhere($where);
        $q->addGroup('project_id');
        //task_log_costcode
        $task_logs = $q->loadHashList('project_id');
        /*		if (isset($company_billingcodes))
        		foreach ($company_billingcodes as $code => $name)
        		{
        			if (isset($task_logs[$code]))
        			{
        				$value = sprintf("%.2f", $task_logs[$code]);
        				$project_row .= '<td>' . $value . '</td>';
        				$project_hours += $task_logs[$code];
        				$pdfproject[] = $value;
        			}
        			else
        			{
        				$project_row .= '<td>&nbsp;</td>';
        				$pdfproject[] = 0;
        			}
        		}
        */
        foreach ($task_logs as $task_log) {
            if ($task_log['hours']) {
                $project_hours += $task_log['hours'];
            }
        }
        $project_row .= '<td>' . round($project_hours, 2) . '</td></tr>';
        $pdfproject[] = round($project_hours, 2);
        $hours += $project_hours;
        if ($project_hours > 0) {
            $table .= $project_row;
            $pdfdata[] = $pdfproject;
        }
    }
    if ($hours > 0) {
        $allpdfdata[$company_name] = $pdfdata;
        echo $table;
        echo '<tr><td>Total</td><td>' . round($hours, 2) . '</td></tr></table>';
    }
    return $hours;
}