本文整理汇总了PHP中Project::getProjects方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getProjects方法的具体用法?PHP Project::getProjects怎么用?PHP Project::getProjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getProjects方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: projects
public function projects()
{
$projects = Project::getProjects();
$ret = array();
$default = isset($_REQUEST['project_id']) ? $_REQUEST['project_id'] : null;
$ret[] = array('project_id' => 'ALL', 'name' => 'ALL');
foreach ($projects as $project) {
$ret[] = array_merge($project, array('selected' => $project['project_id'] === $default));
}
return $ret;
}
示例2: projects
public function projects()
{
$projects = Project::getProjects();
$default = $this->read('projectFilter');
$ret = array();
$ret[] = array('project_id' => '0', 'name' => 'All projects', 'selected' => !$default);
foreach ($projects as $project) {
$ret[] = array_merge($project, array('selected' => $project['project_id'] == $default));
}
return $ret;
}
示例3: projects
public function projects()
{
$user = $this->currentUser;
$current = empty($this->workItem) ? 'hifi' : $this->workItem()->getProjectName();
$activeOnly = !($user['is_runner'] || $user['is_admin'] || $user['is_payer']);
$projects = Project::getProjects($activeOnly);
$ret = array();
foreach ($projects as $project) {
$ret[] = array('id' => $project['project_id'], 'name' => $project['name'], 'current' => $project['name'] == $current ? true : false);
}
return $ret;
}
示例4: action_index
public function action_index()
{
$studentsPerProject = 5;
$showCreateProject = false;
//$args = array();
$session = Session::instance();
if ($session->get('userType') == 'company') {
$showCreateProject = true;
}
if ($this->request->query('p')) {
$projects = Project::getProjects($this->request->query('p'));
} else {
$projects = Project::getProjects('all');
}
//array_push($args,$projects);
//print_r($args);
$this->response->body(View::factory('header') . View::factory('project')->set('showCreateProject', $showCreateProject)->set('projects', $projects)->bind('studentsPerProject', $studentsPerProject));
}
示例5: getProjectList
/**
* get all existing projects, except ExternalTasksProject & SideTasksProjects
* @return string[int] : name[id]
*/
private function getProjectList()
{
$projects = Project::getProjects();
if ($projects != NULL) {
$extproj_id = Config::getInstance()->getValue(Config::id_externalTasksProject);
$smartyProjects = array();
foreach ($projects as $id => $name) {
if ($extproj_id != $id) {
try {
$p = ProjectCache::getInstance()->getProject($id);
if (!$p->isSideTasksProject()) {
$smartyProjects[$id] = $name;
} else {
// exclude SideTasksProjects
if (self::$logger->isDebugEnabled()) {
self::$logger->debug("project {$id}: sideTaskProjects are excluded");
}
}
} catch (Exception $e) {
// could not determinate, so the project should be included in the list
if (self::$logger->isDebugEnabled()) {
self::$logger->debug("project {$id}: Unknown type, project included anyway.");
}
// nothing to do.
}
} else {
// exclude ExternalTasksProject
if (self::$logger->isDebugEnabled()) {
self::$logger->debug("project {$id}: ExternalTasksProject is excluded");
}
}
}
return $smartyProjects;
} else {
return NULL;
}
}
示例6: renderProjects
function renderProjects($organisation_selection = '', $projects = '', $target = '', $inline = FALSE, $reload_data = TRUE, $owner_only = FALSE)
{
if (!$projects && $reload_data) {
$projects = Project::getProjects('', $owner_only ? $GLOBALS['user']->uid : null, $organisation_selection);
}
$target_set = !empty($target);
if ($projects) {
$s = "<ol class='projectlist'>";
foreach ($projects as $project) {
$project = objectToArray($project);
$s .= "<li>";
if (!$target_set || $inline) {
$target = "show_{$project['pid']}";
}
$inline = $inline ? 1 : 0;
$s .= "<a href='javascript: void(0);' onclick='" . "ajaxCall(\"project\", \"view\", {id:{$project['pid']},type:\"project\", target:\"{$target}\", inline:{$inline}}, \"{$target}\");'>{$project['title']}</a>";
if (!$target_set || $inline) {
$s .= "<div id='{$target}' ></div>";
}
$s .= "</li>";
}
$s .= "</ol>";
return $s;
} else {
return t('You have no projects yet');
}
}
示例7: display
protected function display()
{
if (Tools::isConnectedUser()) {
// Admins only
$session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
$this->smartyHelper->assign('jobType', Job::$typeNames);
$action = Tools::getSecurePOSTStringValue('action', 'none');
if ('addJob' == $action) {
$job_name = Tools::getSecurePOSTStringValue('job_name');
$job_type = Tools::getSecurePOSTStringValue('job_type');
$job_color = Tools::getSecurePOSTStringValue('job_color');
// TODO check if not already in table !
// save to DB
Jobs::create($job_name, $job_type, $job_color);
} elseif ('addAssociationProject' == $action) {
// Add Job to selected projects
$job_id = Tools::getSecurePOSTIntValue('job_id');
$proj = explode(",", Tools::getSecurePOSTStringValue('formattedProjects'));
foreach ($proj as $project_id) {
// TODO check if not already in table !
// save to DB
$query = "INSERT INTO `codev_project_job_table` (`project_id`, `job_id`) VALUES ('" . $project_id . "','" . $job_id . "');";
$result = SqlWrapper::getInstance()->sql_query($query);
if (!$result) {
$this->smartyHelper->assign('error', T_("Couldn't add the job association"));
}
}
} elseif ('deleteJob' == $action) {
$job_id = Tools::getSecurePOSTIntValue('job_id');
if (Jobs::JOB_NA == $job_id || Jobs::JOB_SUPPORT == $job_id) {
$this->smartyHelper->assign('error', T_("This job must not be deleted."));
} else {
$query = "DELETE FROM `codev_project_job_table` WHERE job_id = " . $job_id . ';';
$result = SqlWrapper::getInstance()->sql_query($query);
if (!$result) {
$this->smartyHelper->assign('error', T_("Couldn't remove the job association"));
}
$query = "DELETE FROM `codev_job_table` WHERE id = {$job_id};";
$result = SqlWrapper::getInstance()->sql_query($query);
if (!$result) {
$this->smartyHelper->assign('error', T_("Couldn't delete the job"));
}
}
} elseif ('deleteJobProjectAssociation' == $action) {
$asso_id = Tools::getSecurePOSTIntValue('asso_id');
$query = "DELETE FROM `codev_project_job_table` WHERE id = " . $asso_id . ';';
$result = SqlWrapper::getInstance()->sql_query($query);
if (!$result) {
$this->smartyHelper->assign('error', T_("Couldn't remove the job association"));
}
}
$jobs = $this->getJobs();
$this->smartyHelper->assign('jobs', $jobs);
//$this->smartyHelper->assign('assignedJobs', $this->getAssignedJobs($jobs));
$this->smartyHelper->assign('assignedJobs', $jobs);
$projects = Project::getProjects();
$this->smartyHelper->assign('projects', $projects);
$this->smartyHelper->assign('tuples', $this->getAssignedJobTuples($projects));
}
}
}
示例8: elseif
echo $iPro['ProjectName'];
?>
</label>
</li>
<?php
}
?>
</ol>
<input type='submit' class='btn btn-default' name='submit-approveproject' value='Approve Projects' />
</fieldset>
</form>
<?php
} elseif ($_GET['p'] == 'finishproject') {
$projectObj = new Project();
$Projects = $projectObj->getProjects("all");
?>
<form id='approveproject' role='form' action='admin.php' method = 'POST'>
<fieldset>
<legend>Approve Companies</legend>
<ol style="aligh:left;">
<?php
foreach ($Projects as $Pro) {
//print_r($Pro);
if ($Pro['completed'] == '0') {
?>
<li>
<label><input type='checkbox' class='form-control' name='iPro[]' value="<?php
echo $Pro['id_pk'];
?>
示例9: getProjects
function getProjects($public_only = true)
{
// Create project object
$projectHandler = new Project();
// page 1 is "all active projects"
$page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : 1;
// for subsequent pages, which will be inactive projects, return 10 at a time
if ($page > 1) {
// Define values for sorting a display
$limit = 10;
// Get listing of all inactive projects
$projectListing = $projectHandler->getProjects(false, array(), true, false, $public_only);
// Create content for each page
// Select projects that match the letter chosen and construct the array for
// the selected page
$pageFinish = $page * $limit;
$pageStart = $pageFinish - ($limit - 1);
// leaving 'letter' filter in place for the time being although the UI is not supporting it
$letter = isset($_REQUEST["letter"]) ? trim($_REQUEST["letter"]) : "all";
if ($letter == "all") {
$letter = ".*";
} else {
if ($letter == "_") {
//numbers
$letter = "[^A-Za-z]";
}
}
// Count total number of active projects
$activeProjectsCount = count($projectListing);
if ($projectListing != null) {
foreach ($projectListing as $key => $value) {
if (preg_match("/^{$letter}/i", $value["name"])) {
$selectedProjects[] = $value;
}
}
// Count number of projects to display
$projectsToDisplay = count($selectedProjects);
// Determine total number of pages
$displayPages = ceil($projectsToDisplay / $limit);
// Construct json for pagination
// $projectsOnPage = array(array($projectsToDisplay, $page, $displayPages));
$projectsOnPage = array();
// Select projects for current page
$i = $pageStart - 1;
while ($i < $pageFinish) {
if (isset($selectedProjects[$i])) {
$projectsOnPage[] = $selectedProjects[$i];
}
$i++;
}
}
} else {
// Get listing of active projects
$projectsOnPage = $projectHandler->getProjects(true, array(), false, false, $public_only);
}
// Prepare data for printing in projects
$json = json_encode($projectsOnPage);
echo $json;
}
示例10: Project
if ($r) {
echo "Signed up successfully!";
} else {
echo "Signup failed!";
}
} else {
//if not signing up execute this
?>
<div class="col-md-8">
<?php
$projectObj = new Project();
$projects;
if (isset($_GET['p'])) {
$projects = $projectObj->getProjects($_GET['p']);
} else {
$projects = $projectObj->getProjects('all');
}
?>
<div class="well">
<?php
$p = 1;
for ($i = 0; $i < count($projects) / 3; $i++) {
echo "<div class='row'>";
for ($q = 0; $q < 3; $q++) {
if ($p > count($projects)) {
continue;
}
?>
示例11: showInstituteOverviewPage
function showInstituteOverviewPage($institute)
{
include_once _VALS_SOC_ROOT . '/includes/classes/Proposal.php';
include_once _VALS_SOC_ROOT . '/includes/classes/Organisations.php';
include_once _VALS_SOC_ROOT . '/includes/classes/Project.php';
echo "<h2>" . t('Overview of your institute activity') . "</h2>";
$inst_id = $institute->inst_id;
$nr_proposals_draft = count(Proposal::getProposalsPerOrganisation('', $inst_id));
$nr_proposals_final = count(Proposal::getProposalsPerOrganisation('', $inst_id, 'published'));
$nr_students = Users::getUsers(_STUDENT_TYPE, _INSTITUTE_GROUP, $inst_id)->rowCount();
$nr_groups = Groups::getGroups(_STUDENT_GROUP, 'all', $inst_id)->rowCount();
$nr_tutors = Users::getUsers(_SUPERVISOR_TYPE, _INSTITUTE_GROUP, $inst_id)->rowCount() + Users::getUsers(_INSTADMIN_TYPE, _INSTITUTE_GROUP, $inst_id)->rowCount();
$nr_orgs = count(Organisations::getInstance()->getOrganisations());
$nr_projects = count(Project::getProjects());
echo "<b>" . t("Proposals in draft:") . "</b> {$nr_proposals_draft}<br>";
echo "<b>" . t("Proposals submitted:") . "</b> {$nr_proposals_final}<br>";
echo "<b>" . t("Number of students subscribed:") . "</b> {$nr_students}<br>";
echo "<b>" . t("Number of groups available:") . "</b> {$nr_groups}<br>";
echo "<b>" . t("Number of supervisors subscribed:") . "</b> {$nr_tutors}<br>";
echo "<b>" . t("Number of organisations:") . "</b> {$nr_orgs}<br>";
echo "<b>" . t("Number of projects:") . "</b> {$nr_projects}<br>";
}
示例12: getProjectList
/**
* get all existing projects, except ExternalTasksProject & SideTasksProjects
* @return string[] : name[id]
*/
function getProjectList()
{
global $logger;
$projects = Project::getProjects();
if ($projects != NULL) {
$extproj_id = Config::getInstance()->getValue(Config::id_externalTasksProject);
$smartyProjects = array();
foreach ($projects as $id => $name) {
// exclude ExternalTasksProject
if ($extproj_id == $id) {
echo "<script type=\"text/javascript\">console.log(\" getProjectList - project {$id}: ExternalTasksProject is excluded\");</script>";
continue;
}
// exclude SideTasksProjects
try {
$p = ProjectCache::getInstance()->getProject($id);
if ($p->isSideTasksProject()) {
echo "<script type=\"text/javascript\">console.log(\" getProjectList - project {$id}: sideTaskProjects are excluded\");</script>";
continue;
}
} catch (Exception $e) {
// could not determinate, so the project should be included in the list
echo "<script type=\"text/javascript\">console.log(\" getProjectList - project {$id}: Unknown type, project included anyway\");</script>";
// nothing to do.
}
$smartyProjects[$id] = $name;
}
return $smartyProjects;
} else {
return NULL;
}
}
示例13: listClosureReports
function listClosureReports()
{
$p = new Project();
$this->engine->assign('p_uuid', $_SESSION['user_id']);
$this->engine->assign('projects', $p->getProjects(null, false, false, true));
$this->engine->display('project/list_closure.tpl.php');
}
示例14: view
//.........这里部分代码省略.........
$bid['email'] = '********';
$bid['notes'] = '********';
}
}
$bid['bid_created'] = $this->convertTimezone($bid['unix_bid_created']);
if ($bid['unix_bid_accepted'] > 0) {
$bid['bid_accepted'] = $this->convertTimezone($bid['unix_bid_accepted']);
} else {
$bid['bid_accepted'] = '';
}
if ($bid['unix_done_full'] > 0 && !empty($bid['unix_done_full'])) {
$bid['unix_done_full'] = $this->convertTimezone($bid['unix_done_full']);
} else {
$bid['unix_done_full'] = '';
}
// calculate Total Time to Complete
if (isset($bid['unix_done_by']) && $bid['unix_done_by'] != 0) {
$timeToComplete = (int) $bid['unix_done_by'] - (int) $bid['unix_bid_created'];
if ($bid['unix_bid_accepted'] > 0) {
$timeElapsed = (int) $bid['unix_now'] - (int) $bid['unix_bid_accepted'];
$timeToComplete -= $timeElapsed;
}
$fullDays = floor($timeToComplete / (60 * 60 * 24));
$fullHours = floor(($timeToComplete - $fullDays * 60 * 60 * 24) / (60 * 60));
$fullMinutes = floor(($timeToComplete - $fullDays * 60 * 60 * 24 - $fullHours * 60 * 60) / 60);
$bid['time_to_complete'] = $fullDays . ($fullDays == 1 ? " day, " : " days, ") . $fullHours . ($fullHours == 1 ? " hour and " : " hours and ") . $fullMinutes . ($fullMinutes == 1 ? " minute." : " minutes.");
} else {
$bid['time_to_complete'] = null;
}
}
}
// break reference to $bid
unset($bid);
//get fees
$fees = $workitem->getFees($worklist_id);
$this->write('fees', $fees);
$user_id = isset($_SESSION['userid']) ? $_SESSION['userid'] : "";
$is_runner = isset($_SESSION['is_runner']) ? $_SESSION['is_runner'] : 0;
$is_admin = isset($_SESSION['is_admin']) ? $_SESSION['is_admin'] : 0;
$is_payer = isset($_SESSION['is_payer']) ? $_SESSION['is_payer'] : 0;
$creator_id = isset($worklist['creator_id']) ? $worklist['creator_id'] : 0;
$mechanic_id = isset($worklist['mechanic_id']) ? $worklist['mechanic_id'] : 0;
$runner_id = isset($worklist['runner_id']) ? $worklist['runner_id'] : 0;
$status_error = '';
$has_budget = 0;
if (!empty($user_id)) {
$user = new User();
$user->findUserById($user_id);
if ($user->getBudget() > 0) {
$has_budget = 1;
}
// fee defaults to 0 for internal users
$crFee = 0;
if (!$user->isInternal()) {
// otherwise, lookup reviewer fee on the Project
$crFee = $this->getCRFee($workitem);
}
$this->write('crFee', $crFee);
}
$workitem = WorkItem::getById($worklist['id']);
if ($worklist['project_id']) {
$workitem_project = new Project($worklist['project_id']);
}
$projects = Project::getProjects();
$allowEdit = false;
$classEditable = "";
if ($workitem->getIsRelRunner() && is_null($worklist['runner_id']) || $user->getIs_admin() == 1 && $is_runner || $creator_id == $user_id && $worklist['status'] == 'Suggestion' && is_null($worklist['runner_id']) || $runner_id == $user_id) {
$allowEdit = true;
if ($action != "edit") {
$classEditable = " editable";
}
}
$this->write('classEditable', $classEditable);
$this->write('allowEdit', $allowEdit);
$hideFees = false;
if ($worklist['status'] == 'Bidding' || $worklist['status'] == 'Suggestion') {
$hideFees = true;
}
$this->write('hideFees', $hideFees);
$this->write('bids', $bids);
$this->write('userHasCodeReviewRights', $this->hasCodeReviewRights($user_id, $workitem));
$this->write('mechanic', $workitem->getUserDetails($worklist['mechanic_id']));
$reviewer = new User();
$reviewer->findUserById($workitem->getCReviewerId());
$this->write('reviewer', $reviewer);
$this->write('action_error', isset($action_error) ? $action_error : '');
$this->write('comments', Comment::findCommentsForWorkitem($worklist['id']));
$this->write('entries', $this->getTaskPosts($worklist['id']));
$this->write('message', isset($message) ? $message : '');
$this->write('currentUserHasBid', $currentUserHasBid);
$this->write('has_budget', $has_budget);
$this->write('promptForReviewUrl', $promptForReviewUrl);
$this->write('status_error', $status_error);
$this->write('{{userinfotoshow}}', isset($_REQUEST['userinfotoshow']) && isset($_SESSION['userid']) ? $_REQUEST['userinfotoshow'] : 0);
$job_analytics = VisitQueryTools::visitQuery($worklist_id);
$this->write('viewCount', $job_analytics['views']);
$job_views = $job_analytics['views'] > 1 ? " views" : " view";
$this->write('views', $job_views);
parent::run();
}