![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: index.php 40 2008-02-11 12:11:44Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/tasks/index.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 $AppUI->savePlace(); 7 $perms = &$AppUI->acl(); 8 // retrieve any state parameters 9 $user_id = $AppUI->user_id; 10 if ($perms->checkModule('admin', 'view')) { // Only sysadmins are able to change users 11 if (w2PgetParam($_POST, 'user_id', 0) != 0) { // this means that 12 $user_id = w2PgetParam($_POST, 'user_id', 0); 13 $AppUI->setState('user_id', $_POST['user_id']); 14 } elseif ($AppUI->getState('user_id')) { 15 $user_id = $AppUI->getState('user_id'); 16 } else { 17 $AppUI->setState('user_id', $user_id); 18 } 19 } 20 21 if (isset($_POST['f'])) { 22 $AppUI->setState('TaskIdxFilter', $_POST['f']); 23 } 24 $f = $AppUI->getState('TaskIdxFilter') ? $AppUI->getState('TaskIdxFilter') : 'myunfinished'; 25 26 if (isset($_POST['f2'])) { 27 $AppUI->setState('CompanyIdxFilter', $_POST['f2']); 28 } 29 $f2 = $AppUI->getState('CompanyIdxFilter') ? $AppUI->getState('CompanyIdxFilter') : 'all'; 30 31 if (isset($_GET['project_id'])) { 32 $AppUI->setState('TaskIdxProject', w2PgetParam($_GET, 'project_id', null)); 33 } 34 $project_id = $AppUI->getState('TaskIdxProject') ? $AppUI->getState('TaskIdxProject') : 0; 35 36 // get CCompany() to filter tasks by company 37 require_once ($AppUI->getModuleClass('companies')); 38 $obj = new CCompany(); 39 $companies = $obj->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name'); 40 $filters2 = arrayMerge(array('all' => $AppUI->_('All Companies', UI_OUTPUT_RAW)), $companies); 41 42 // setup the title block 43 $titleBlock = new CTitleBlock('Tasks', 'applet-48.png', $m, $m . '.' . $a); 44 45 // patch 2.12.04 text to search entry box 46 if (isset($_POST['searchtext'])) { 47 $AppUI->setState('searchtext', $_POST['searchtext']); 48 } 49 50 $search_text = $AppUI->getState('searchtext') ? $AppUI->getState('searchtext') : ''; 51 $search_text = w2PformSafe($search_text, true); 52 53 $titleBlock->addCell(' ' . $AppUI->_('Search') . ':'); 54 $titleBlock->addCell('<input type="text" class="text" size="20" name="searchtext" onChange="document.searchfilter.submit();" value="' . $search_text . '" title="' . $AppUI->_('Search in name and description fields') . '"/> 55 <!--<input type="submit" class="button" value=">" title="' . $AppUI->_('Search in name and description fields') . '"/>-->', '', '<form action="?m=tasks" method="post" id="searchfilter">', '</form>'); 56 57 // Let's see if this user has admin privileges 58 if (!getDenyRead('admin')) { 59 $titleBlock->addCell(); 60 $titleBlock->addCell($AppUI->_('User') . ':'); 61 62 $user_list = $perms->getPermittedUsers('tasks'); 63 $titleBlock->addCell(arraySelect($user_list, 'user_id', 'size="1" class="text" onChange="document.userIdForm.submit();"', $user_id, false), '', '<form action="?m=tasks" method="post" name="userIdForm">', '</form>'); 64 } 65 66 $titleBlock->addCell(); 67 $titleBlock->addCell($AppUI->_('Company') . ':'); 68 $titleBlock->addCell(arraySelect($filters2, 'f2', 'size=1 class=text onChange="document.companyFilter.submit();"', $f2, false), '', '<form action="?m=tasks" method="post" name="companyFilter">', '</form>'); 69 70 $titleBlock->addCell(); 71 if ($canEdit && $project_id) { 72 $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new task') . '">', '', '<form action="?m=tasks&a=addedit&task_project=' . $project_id . '" method="post">', '</form>'); 73 } 74 75 $titleBlock->show(); 76 77 if (w2PgetParam($_GET, 'inactive', '') == 'toggle') { 78 $AppUI->setState('inactive', $AppUI->getState('inactive') == -1 ? 0 : -1); 79 } 80 $in = $AppUI->getState('inactive') == -1 ? '' : 'in'; 81 82 // use a new title block (a new row) to prevent from oversized sites 83 $titleBlock = new CTitleBlock('', 'shim.gif'); 84 $titleBlock->showhelp = false; 85 $titleBlock->addCell(' ' . $AppUI->_('Task Filter') . ':'); 86 $titleBlock->addCell(arraySelect($filters, 'f', 'size=1 class=text onChange="document.taskFilter.submit();"', $f, true), '', '<form action="?m=tasks" method="post" name="taskFilter">', '</form>'); 87 $titleBlock->addCell(); 88 89 $titleBlock->addCrumb('?m=tasks&a=todo&user_id=' . $user_id, 'my todo'); 90 if (w2PgetParam($_GET, 'pinned') == 1) { 91 $titleBlock->addCrumb('?m=tasks', 'all tasks'); 92 } else { 93 $titleBlock->addCrumb('?m=tasks&pinned=1', 'my pinned tasks'); 94 } 95 $titleBlock->addCrumb('?m=tasks&inactive=toggle', 'show ' . $in . 'active tasks'); 96 $titleBlock->addCrumb('?m=tasks&a=tasksperuser', 'tasks per user'); 97 98 $titleBlock->show(); 99 100 // include the re-usable sub view 101 $min_view = false; 102 include (W2P_BASE_DIR . '/modules/tasks/tasks.php'); 103 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jan 8 03:00:03 2009 | Cross-referenced by PHPXref 0.7 |