本文整理汇总了PHP中CProject::getAllowedProjects方法的典型用法代码示例。如果您正苦于以下问题:PHP CProject::getAllowedProjects方法的具体用法?PHP CProject::getAllowedProjects怎么用?PHP CProject::getAllowedProjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CProject
的用法示例。
在下文中一共展示了CProject::getAllowedProjects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeGet
/**
* Get Request Handler
*
* This method is called when a request is a GET
*
* @return array
*/
public function executeGet()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
$username = $this->getParam('username');
$password = $this->getParam('password');
$project_id = $this->getParam('project_id', self::TYPE_INT);
// Attempt to login as user, a little bit of a hack as we currently
// require the $_POST['login'] var to be set as well as a global AppUI
$AppUI = new CAppUI();
$GLOBALS['AppUI'] = $AppUI;
$_POST['login'] = 'login';
if (!$AppUI->login($username, $password)) {
throw new Frapi_Error('INVALID_LOGIN');
}
$project = new CProject();
$allowed_projects = $project->getAllowedProjects($AppUI->user_id);
// Project ID is the key, so lets get them in to an array so we can
// easily check
$allowed_projects = array_keys($allowed_projects);
if (!in_array($project_id, $allowed_projects)) {
throw new Frapi_Error('PERMISSION_ERROR');
}
// User has permission so load the project for display
$project = (array) $project->load($project_id);
$project_departments = CProject::getDepartments($AppUI, $project_id);
$project_contacts = CProject::getContacts($AppUI, $project_id);
$project['project_departments'] = array();
foreach ($project_departments as $key => $value) {
$project['project_departments'][] = $value['dept_id'];
}
$project['project_contacts'] = array();
foreach ($project_contacts as $key => $value) {
$project['project_contacts'][] = $value['contact_id'];
}
// Remove the data that is not for display
unset($project['_tbl_prefix'], $project['_tbl'], $project['_tbl_key'], $project['_error'], $project['_query'], $project['_tbl_module']);
$this->data['project'] = $project;
$this->data['success'] = true;
$this->setTemplateFileName('Project');
return $this->toArray();
}
示例2: executeGet
/**
* Get Request Handler
*
* This method is called when a request is a GET
*
* @return array
*/
public function executeGet()
{
$valid = $this->hasRequiredParameters($this->requiredParams);
if ($valid instanceof Frapi_Error) {
return $valid;
}
$username = $this->getParam('username');
$password = $this->getParam('password');
// Attempt to login as user, a little bit of a hack as we currently
// require the $_POST['login'] var to be set as well as a global AppUI
$AppUI = new CAppUI();
$GLOBALS['AppUI'] = $AppUI;
$_POST['login'] = 'login';
if (!$AppUI->login($username, $password)) {
throw new Frapi_Error('INVALID_LOGIN');
}
$project = new CProject();
$this->data['projects'] = $project->getAllowedProjects($AppUI->user_id);
$this->data['success'] = true;
$this->setTemplateFileName('ProjectsGet');
return $this->toArray();
}
示例3: die
die('You should not access this file directly.');
}
global $caller, $locale_char_set, $showWork, $sortByName, $showLabels;
global $gantt_arr, $showPinned, $showArcProjs, $showHoldProjs, $showDynTasks;
global $showLowTasks, $user_id, $w2Pconfig;
w2PsetExecutionConditions($w2Pconfig);
$showLabels = w2PgetParam($_REQUEST, 'showLabels', false);
$sortByName = w2PgetParam($_REQUEST, 'sortByName', false);
$project_id = w2PgetParam($_REQUEST, 'project_id', 0);
$f = w2PgetParam($_REQUEST, 'f', 0);
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$project = new CProject();
$criticalTasks = $project_id > 0 ? $project->getCriticalTasks($project_id) : null;
// pull valid projects and their percent complete information
$projects = $project->getAllowedProjects($AppUI->user_id, false);
##############################################
/* gantt is called now by the todo page, too.
** there is a different filter approach in todo
** so we have to tweak a little bit,
** also we do not have a special project available
*/
$caller = w2PgetParam($_REQUEST, 'caller', null);
if ($caller == 'todo') {
$user_id = w2PgetParam($_REQUEST, 'user_id', $AppUI->user_id);
$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);
示例4: array
$showArcProjs = $showArcProjs != '0' ? '1' : $showArcProjs;
$showHoldProjs = w2PgetParam($_POST, 'showHoldProjs', '0');
$showHoldProjs = $showHoldProjs != '0' ? '1' : $showHoldProjs;
$showDynTasks = w2PgetParam($_POST, 'showDynTasks', '0');
$showDynTasks = $showDynTasks != '0' ? '1' : $showDynTasks;
$showLowTasks = w2PgetParam($_POST, 'showLowTasks', '0');
$showLowTasks = $showLowTasks != '0' ? '1' : $showLowTasks;
}
/**
* prepare the array with the tasks to display in the task filter
* (for the most part this is code harvested from gantt.php)
*
*/
$filter_task_list = array();
$projectObject = new CProject();
$projects = $projectObject->getAllowedProjects($AppUI->user_id);
$q = new w2p_Database_Query();
$q->addTable('tasks', 't');
$q->addJoin('projects', 'p', 'p.project_id = t.task_project');
$q->addQuery('t.task_id, task_parent, task_name, task_start_date, task_end_date' . ', task_duration, task_duration_type, task_priority, task_percent_complete' . ', task_order, task_project, task_milestone, project_name, task_dynamic');
$q->addWhere('project_status != 7 AND task_dynamic = 1');
if ($project_id) {
$q->addWhere('task_project = ' . $project_id);
}
$task =& new CTask();
$task->setAllowedSQL($AppUI->user_id, $q);
$proTasks = $q->loadHashList('task_id');
$q->clear();
$filter_task_list = array();
$orrarr[] = array('task_id' => 0, 'order_up' => 0, 'order' => '');
foreach ($proTasks as $row) {
示例5: isset
$obj = $AppUI->restoreObject();
if ($obj) {
$forum = $obj;
$forum_id = $forum->forum_id;
} else {
$forum->load($AppUI, $forum_id);
}
if (!$forum && $forum_id > 0) {
$AppUI->setMsg('Forum');
$AppUI->setMsg('invalidID', UI_MSG_ERROR, true);
$AppUI->redirect();
}
$status = isset($forum->forum_status) ? $forum->forum_status : -1;
$prj = new CProject();
if ($forum_id) {
$projects = $prj->getAllowedProjects($AppUI->user_id, false);
} else {
$projects = $prj->getAllowedProjects($AppUI->user_id, true);
}
foreach ($projects as $project_id => $project_info) {
$projects[$project_id] = $project_info['project_name'];
}
$projects = arrayMerge(array(0 => $all_projects), $projects);
$users = $perms->getPermittedUsers('forums');
$ttl = $forum_id > 0 ? 'Edit Forum' : 'Add Forum';
$titleBlock = new CTitleBlock($ttl, 'support.png', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=forums', 'forums list');
if ($canDelete && $forum_id > 0) {
$titleBlock->addCrumbRight('<table cellspacing="0" cellpadding="0" border="0"?<tr><td><a class="delete" href="javascript:delIt()"><span>' . $AppUI->_('delete forum') . '</span></a></td></tr></table>');
}
$titleBlock->show();
示例6: die
<?php
/* $Id: index.php 1522 2010-12-08 05:08:07Z caseydk $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/reports/index.php $ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$project_id = (int) w2PgetParam($_REQUEST, 'project_id', 0);
$report_type = w2PgetParam($_REQUEST, 'report_type', '');
$canReport = canView('reports');
$canRead = canView('projects', $project_id);
if (!$canReport || !$canRead) {
$AppUI->redirect('m=public&a=access_denied');
}
$project_list = array('0' => $AppUI->_('All', UI_OUTPUT_RAW));
$projectObj = new CProject();
$projectList = $projectObj->getAllowedProjects($AppUI->user_id, false);
$company = new CCompany();
$companyList = $company->getCompanies($AppUI);
foreach ($projectList as $pr) {
if ($pr['project_id'] == $project_id) {
$display_project_name = '(' . $companyList[$pr['project_company']]['company_name'] . ') ' . $pr['project_name'];
}
$project_list[$pr['project_id']] = '(' . $companyList[$pr['project_company']]['company_name'] . ') ' . $pr['project_name'];
}
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$reports = $AppUI->readFiles(W2P_BASE_DIR . '/modules/reports/reports', '\\.php$');
// setup the title block
if (!$suppressHeaders) {
$titleBlock = new CTitleBlock('Project Reports', 'printer.png', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=projects', 'projects list');
示例7: getFolders
?>
</td>
</tr>
<?php
if (countFiles($folder) > 0) {
echo displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id);
} elseif (!$limited or $folder_id != 0) {
echo '<tr><td colspan="20">' . $AppUI->_('no files') . '</td></tr>';
}
echo getFolders($folder_id);
//Lets add our bulk form
$folders_avail = getFolderSelectList();
//used O (uppercase 0)instead of 0 (zero) to keep things in place
$folders = array('-1' => array(0 => 'O', 1 => '(Move to Folder)', 2 => -1)) + array('0' => array(0 => 0, 1 => 'Root', 2 => -1)) + $folders_avail;
$project = new CProject();
$sprojects = $project->getAllowedProjects($AppUI, false);
foreach ($sprojects as $prj_id => $proj_info) {
$sprojects[$prj_id] = $idx_companies[$prj_id] . ': ' . $proj_info['project_name'];
}
asort($sprojects);
$sprojects = array('O' => '(' . $AppUI->_('Move to Project', UI_OUTPUT_RAW) . ')') + array('0' => '(' . $AppUI->_('All Projects', UI_OUTPUT_RAW) . ')') + $sprojects;
?>
<tr>
<td colspan="50" align="right">
<form name="frm_bulk" method="post" action="?m=files&a=do_files_bulk_aed" accept-charset="utf-8">
<input type="hidden" name="redirect" value="<?php
echo $current_uri;
?>
" />
<?php
echo arraySelect($sprojects, 'bulk_file_project', 'style="width:180px" class="text"', 'O');