예제 #1
0
<?php

if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
// Copyright 2004 Adam Donnison <*****@*****.**>
$resource_id = intval(dPgetParam($_GET, 'resource_id', null));
$canDelete = getPermission('resources', 'delete', $resource_id);
$canView = getPermission('resources', 'view', $resource_id);
if (!$resource_id && !getPermission('resources', 'add') || !$canView || !$canEdit) {
    $AppUI->redirect('m=public&a=access_denied');
}
$obj = new CResource();
if ($resource_id && !$obj->load($resource_id)) {
    $AppUI->setMsg('Resource');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
}
$titleBlock = new CTitleBlock($resource_id ? 'Edit Resource' : 'Add Resource', 'helpdesk.png', $m, "{$m}.{$a}");
$titleBlock->addCrumb('?m=resources', 'resource list');
if ($resource_id) {
    $titleBlock->addCrumb("?m=resources&amp;a=view&amp;resource_id={$resource_id}", 'view this resource');
}
$titleBlock->show();
$typelist = $obj->typeSelect();
?>
<form name="editfrm" action="?m=resources" method="post">
<input type="hidden" name="dosql" value="do_resource_aed" />
<input type="hidden" name="resource_id" value="<?php 
echo dPformSafe($resource_id);
?>
예제 #2
0
<?php

/* $Id: vw_resources.php 1783 2011-03-29 02:19:20Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/resources/vw_resources.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $tabbed, $currentTabName, $currentTabId, $AppUI;
$obj = new CResource();
$query = new w2p_Database_Query();
$obj->setAllowedSQL($AppUI->user_id, $query);
$query->addTable('resources');
if (!$tabbed) {
    $currentTabId++;
}
if ($currentTabId) {
    $query->addWhere('resource_type = ' . (int) $_SESSION['resource_type_list'][$currentTabId]['resource_type_id']);
}
$res =& $query->exec();
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tr>
	<th nowrap="nowrap" width="20%">
    	<?php 
echo $AppUI->_('ID');
?>
	</th>
	<th nowrap="nowrap" width="70%">
    	<?php 
echo $AppUI->_('Resource Name');
?>
	</th>
예제 #3
0
<?php

/* RESOURCES $Id: do_resource_aed.php 6149 2012-01-09 11:58:40Z ajdonnison $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
$del = (int) dPgetParam($_POST, 'del', 0);
$obj = new CResource();
$msg = '';
if (!$obj->bind($_POST)) {
    $AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
    $AppUI->redirect();
}
$AppUI->setMsg('Resource');
if ($del) {
    if (!$obj->canDelete($msg)) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    }
    if ($msg = $obj->delete()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
        $AppUI->redirect();
    } else {
        $AppUI->setMsg('deleted', UI_MSG_ALERT, true);
        $AppUI->redirect('', -1);
    }
} else {
    if ($msg = $obj->store()) {
        $AppUI->setMsg($msg, UI_MSG_ERROR);
    } else {
        $AppUI->setMsg($_POST['resource_id'] ? 'updated' : 'added', UI_MSG_OK, true);
예제 #4
0
    die('You should not access this file directly.');
}
$obj = new CResource();
$resource_id = (int) dPgetParam($_GET, 'resource_id', 0);
$canView = getPermission($m, 'view', $resource_id);
$canEdit = getPermission($m, 'edit', $resource_id);
$canDelete = getPermission($m, 'delete', $resource_id);
if (!$canView) {
    $AppUI->redirect("m=public&a=access_denied");
}
if (!$resource_id) {
    $AppUI->setMsg("invalid ID", UI_MSG_ERROR);
    $AppUI->redirect();
}
// TODO: tab stuff
$obj = new CResource();
if (!$obj->load($resource_id)) {
    $AppUI->setMsg('Resource');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect();
} else {
    $AppUI->savePlace();
}
$titleBlock = new CTitleBlock('View Resource', 'helpdesk.png', $m, "{$m}.{$a}");
if ($canAuthor) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new resource') . '" />', '', '<form action="?m=resources&amp;a=addedit" method="post">', '</form>');
}
$titleBlock->addCrumb('?m=resources', 'resource list');
if ($canEdit) {
    $titleBlock->addCrumb("?m=resources&amp;a=addedit&amp;resource_id={$resource_id}", "edit this resource");
}
예제 #5
0
<?php

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
$AppUI->savePlace();
$obj = new CResource();
$perms =& $AppUI->acl();
$canEdit = canEdit('resources');
$titleBlock = new w2p_Theme_TitleBlock('Resources', 'resources.png', $m, $m . '.' . $a);
if ($canEdit) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new resource') . '">', '', '<form action="?m=resources&a=addedit" method="post" accept-charset="utf-8">', '</form>');
}
$titleBlock->show();
if (isset($_GET['tab'])) {
    $AppUI->setState('ResourcesIdxTab', w2PgetParam($_GET, 'tab', null));
}
$resourceTab = $AppUI->getState('ResourcesIdxTab', 0);
$tabBox = new CTabBox('?m=resources', W2P_BASE_DIR . '/modules/resources/', $resourceTab);
$tabbed = $tabBox->isTabbed();
foreach ($obj->loadTypes() as $type) {
    if ($type['resource_type_id'] == 0 && !$tabbed) {
        continue;
    }
    $tabBox->add('vw_resources', $type['resource_type_name']);
}
$tabBox->show();
예제 #6
0
 /**
  * Ресурс, к которому календарь привязан
  *
  * @param CResource $resource
  */
 public function setResource(CResource $resource)
 {
     $this->_resource = $resource;
     $this->setResourceId($resource->getId());
 }
<?php

/* $Id: tasks_tab.addedit.other_resources.php 1595 2011-01-17 07:37:10Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/tags/version2.4/modules/resources/tasks_tab.addedit.other_resources.php $ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $users, $task_id, $task_project, $obj;
global $projTasksWithEndDates, $tab, $loadFromTab;
// Need to get all of the resources that this user is allowed to view
$resource = new CResource();
$resource_types =& $resource->typeSelect();
$q = new w2p_Database_Query();
$q->addTable('resources');
$q->addOrder('resource_type', 'resource_name');
$res = $q->exec(ADODB_FETCH_ASSOC);
$all_resources = array();
$resource_max = array();
while ($row = $q->fetchRow()) {
    $type = $row['resource_type'];
    $all_resources[$row['resource_id']] = $resource_types[$row['resource_type']] . ': ' . $row['resource_name'];
    $resource_max[$row['resource_id']] = $row['resource_max_allocation'];
}
$q->clear();
$assigned_resources = array();
$resources = array();
if ($loadFromTab && isset($_SESSION['tasks_subform']['hresource_assign'])) {
    $initResAssignment = '';
    foreach (explode(';', $_SESSION['tasks_subform']['hresource_assign']) as $perc) {
        if ($perc) {
            list($rid, $perc) = explode('=', $perc);
            $assigned_resources[$rid] = $perc;
예제 #8
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
$object_id = (int) w2PgetParam($_GET, 'resource_id', 0);
$object = new CResource();
$object->setId($object_id);
$obj = $object;
$canAddEdit = $obj->canAddEdit();
$canAuthor = $obj->canCreate();
$canEdit = $obj->canEdit();
if (!$canAddEdit) {
    $AppUI->redirect(ACCESS_DENIED);
}
$obj = $AppUI->restoreObject();
if ($obj) {
    $object = $obj;
    $object_id = $object->getId();
} else {
    $object->load($object_id);
}
if (!$object && $object_id > 0) {
    $AppUI->setMsg('Resource');
    $AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
    $AppUI->redirect('m=' . $m);
}
// setup the title block
$ttl = $object_id ? 'Edit Resource' : 'Add Resource';
$titleBlock = new w2p_Theme_TitleBlock($ttl, 'icon.png', $m);
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
// @todo    remove database query
global $AppUI, $users, $task_id, $task_project, $obj;
global $projTasksWithEndDates, $tab, $loadFromTab;
// Need to get all of the resources that this user is allowed to view
$resource = new CResource();
$resources = $resource->loadAll();
$resource_types = w2PgetSysVal('ResourceTypes');
$all_resources = array();
foreach ($resources as $row) {
    $all_resources[$row['resource_id']] = $resource_types[$row['resource_type']] . ': ' . $row['resource_name'];
}
$assigned_resources = array();
$initResAssignment = '';
$resources = array();
if ($loadFromTab && isset($_SESSION['tasks_subform']['hresource_assign'])) {
    $initResAssignment = '';
    foreach (explode(';', $_SESSION['tasks_subform']['hresource_assign']) as $perc) {
        if ($perc) {
            list($rid, $perc) = explode('=', $perc);
            $assigned_resources[$rid] = $perc;
            $initResAssignment .= $rid . '=' . $perc . ';';
            $resources[$rid] = $all_resources[$rid] . ' [' . $perc . '%]';
        }
    }
} elseif ($task_id == 0) {
예제 #10
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
global $AppUI, $tab;
$obj = new CResource();
$where = $tab ? 'resource_type = ' . $tab : '';
$items = $obj->loadAll('resource_name', $where);
$module = new w2p_System_Module();
$fields = $module->loadSettings('resources', 'index_list');
if (0 == count($fields)) {
    $fieldList = array('resource_key', 'resource_name', 'resource_max_allocation', 'resource_type', 'resource_description');
    $fieldNames = array('Identifier', 'Resource Name', 'Max Alloc %', 'Type', 'Notes');
    $module->storeSettings('resources', 'index_list', $fieldList, $fieldNames);
    $fields = array_combine($fieldList, $fieldNames);
}
$resource_types = w2PgetSysVal('ResourceTypes');
$customLookups = array('resource_type' => $resource_types);
$listTable = new w2p_Output_ListTable($AppUI);
echo $listTable->startTable();
echo $listTable->buildHeader($fields);
echo $listTable->buildRows($items, $customLookups);
echo $listTable->endTable();
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
// 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;
$resource = new CResource();
$resources = $resource->getResourcesByTask($task_id);
// Determine any other clashes.
$resource_tasks = array();
if (count($resources)) {
    $resource_tasks = $resource->getTasksByResources($resources, $obj->task_start_date, $obj->task_end_date);
}
$fieldList = array();
$fieldNames = array();
$module = new w2p_System_Module();
$fields = $module->loadSettings('resources', 'task_view');
if (count($fields) > 0) {
    $fieldList = array_keys($fields);
    $fieldNames = array_values($fields);
} else {
    // TODO: This is only in place to provide an pre-upgrade-safe
    //   state for versions earlier than v3.0
    //   At some point at/after v4.0, this should be deprecated
    $fieldList = array('resource_type', 'resource_name', 'percent_allocated');
    $fieldNames = array('Resource Type', 'Resource', 'Allocation');
    $module->storeSettings('resources', 'task_view', $fieldList, $fieldNames);
}
예제 #12
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    convert to template
$resource_id = (int) w2PgetParam($_GET, 'resource_id', 0);
$obj = new CResource();
if (!$obj->load($resource_id)) {
    $AppUI->redirect(ACCESS_DENIED);
}
$canEdit = $obj->canEdit();
$canDelete = $obj->canDelete();
$titleBlock = new w2p_Theme_TitleBlock('View Resource', 'icon.png', $m);
$titleBlock->addCrumb('?m=' . $m, $m . ' list');
if ($canEdit) {
    $titleBlock->addCrumb('?m=resources&a=addedit&resource_id=' . $resource_id, 'edit this resource');
    if ($canDelete) {
        $titleBlock->addCrumbDelete('delete resource', $canDelete, 'no delete permission');
    }
}
$titleBlock->show();
$view = new w2p_Controllers_View($AppUI, $obj, 'Resource');
echo $view->renderDelete();
$types = w2PgetSysVal('ResourceTypes');
$types[0] = 'Not Specified';
$customLookups = array('resource_type' => $types);
include $AppUI->getTheme()->resolveTemplate('resources/view');