本文整理汇总了PHP中Project::getProjectById方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getProjectById方法的具体用法?PHP Project::getProjectById怎么用?PHP Project::getProjectById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getProjectById方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertAgreement
/**
* The student inserts this initially once he/she accepts a project offer
* @param unknown $props
* @param unknown $proposal_id
* @return boolean|unknown
*/
static function insertAgreement($props)
{
if (!$props) {
drupal_set_message(t('Insert requested with empty (filtered) data set'), 'error');
return false;
}
if (!isset($props['proposal_id'])) {
drupal_set_message(t('Insert requested with no proposal set'), 'error');
return false;
}
global $user;
$txn = db_transaction();
try {
$proposal = objectToArray(Proposal::getInstance()->getProposalById($props['proposal_id']));
$project = objectToArray(Project::getProjectById($proposal['pid']));
if (!isset($props['student_id'])) {
$props['student_id'] = $user->uid;
}
if (!isset($props['supervisor_id'])) {
$props['supervisor_id'] = $proposal['supervisor_id'];
}
if (!isset($props['mentor_id'])) {
$props['mentor_id'] = $project['mentor_id'];
}
$props['project_id'] = $proposal['pid'];
if (!isset($props['description'])) {
$props['description'] = '';
}
if (!isset($props['student_signed'])) {
$props['student_signed'] = 0;
}
if (!isset($props['supervisor_signed'])) {
$props['supervisor_signed'] = 0;
}
if (!isset($props['mentor_signed'])) {
$props['mentor_signed'] = 0;
}
/*
if (! testInput($props, array('owner_id', 'org_id', 'inst_id', 'supervisor_id','pid', 'title'))){
return FALSE;
}
*/
try {
$id = db_insert(tableName(_AGREEMENT_OBJ))->fields($props)->execute();
} catch (Exception $e) {
drupal_set_message($e->getMessage(), 'error');
}
if ($id) {
drupal_set_message(t('You have created your agreement: you can continue editing it later.'));
return $id;
} else {
drupal_set_message(t('We could not add your agreement. ') . (_DEBUG ? '<br/>' . getDrupalMessages() : ""), 'error');
}
return $result;
} catch (Exception $ex) {
$txn->rollback();
drupal_set_message(t('We could not add your agreement.') . (_DEBUG ? $ex->__toString() : ''), 'error');
}
return FALSE;
}
示例2: die
*/
if (!isset($_SESSION['user_info']) || empty($_SESSION['user_info'])) {
$res["reason"] = "u are not login";
die(json_encode($res));
}
$db = new MySQL($log);
$mysqli = $db->openDB();
if ($mysqli !== null) {
$project = new Project($mysqli, $log);
$module = new Module($mysqli, $log);
$projectModule = new ProjectModule($mysqli, $log);
if ($data['op'] === 'del') {
foreach ($data['data'] as $prodata) {
//validate power
//judge if the project u_id is eq user id
if ($project->getProjectById($prodata['id'])) {
if ($project->u_id !== $_SESSION['user_info']['id']) {
$res["result"] = false;
$res["reason"] = "U have no power to del ID:" . $prodata['id'];
$db->closeDB();
die(json_encode($res));
}
} else {
$res["result"] = false;
$res["reason"] = "Project ID:" . $prodata['id'] . "Not Found!";
$db->closeDB();
die(json_encode($res));
}
if (!($project->delProject($prodata['id']) && $projectModule->delProjectModuleByPID($prodata['id']))) {
$res["reason"] = "Del Project ID:" . $prodata['id'] . "Failed";
$db->closeDB();
示例3: empty
* An easy Xss framework
*/
require_once "../Path.php";
require_once "../sess.php";
require_once PHP_BASE_DIR . "/db/MySQL.php";
require_once PHP_BASE_DIR . "/util/util.php";
require_once PHP_BASE_DIR . "/entity/Project.php";
require_once PHP_BASE_DIR . "/entity/ProjectModule.php";
error_reporting(E_ALL ^ E_NOTICE);
header("Content-Type: application/javascript; charset=UTF-8");
/**
* validate power
*/
$p_id = empty($_GET['p_id']) ? 0 : (int) $_GET['p_id'];
if (!isset($_SESSION['user_info']) || empty($_SESSION['user_info'])) {
$res["reason"] = "u are not login";
die(json_encode($res));
}
$db = new MySQL($log);
$mysqli = $db->openDB();
if ($mysqli !== null) {
$project = new Project($mysqli, $log);
$projectModule = new ProjectModule($mysqli, $log);
$project->getProjectById($p_id);
if ($_SESSION['user_info']['id'] === $project->u_id) {
$projectModule->getProjectModulesByProject($p_id);
die("coreconfig = " . $projectModule->config);
}
$db->closeDB();
}
die("coreconfig = null;");
示例4: json_encode
if ($result) {
echo json_encode(array('result' => TRUE, 'id' => $id, 'type' => $type, 'new_tab' => !$id ? $properties['org_id'] : 0, 'extra' => $mine ? array('mine' => 1) : '', 'msg' => ($id ? tt('You succesfully changed the data of your %1$s', t_type($type)) : tt('You succesfully added your %1$s', t_type($type))) . (_DEBUG ? showDrupalMessages() : '')));
} else {
echo jsonBadResult();
}
break;
case 'show':
$show_last = altSubValue($_POST, 'new_tab', false);
$owner_only = altSubValue($_POST, 'mine', false);
showProjectPage($show_last, $owner_only);
break;
case 'edit':
$type = altSubValue($_POST, 'type', '');
$id = altSubValue($_POST, 'id', '');
$target = altSubValue($_POST, 'target', '');
$obj = Project::getProjectById($id, FALSE, NULL);
if (!$obj) {
echo t('The project could not be found');
return;
}
// See http://drupal.stackexchange.com/questions/98592/ajax-processed-not-added-on-a-form-inside-a-custom-callback-my-module-deliver
// for additions below
$originalPath = false;
if (isset($_POST['path'])) {
$originalPath = $_POST['path'];
}
unset($_POST);
$form = drupal_get_form("vals_soc_project_form", $obj, $target);
if ($originalPath) {
$form['#action'] = url($originalPath);
}
示例5: getRequestVar
$proposal_id = getRequestVar('proposal_id', 0, 'post');
$project_id = getRequestVar('project_id', 0, 'post');
$is_final = getRequestVar('is_final', 0, 'post');
if (!$project_id) {
echo t('The project could not be found');
return;
}
if (!$proposal_id) {
echo t('The proposal could not be found');
return;
}
if (!$is_final) {
$is_final = 0;
}
// Get the projects current proposal id and state (if set)
$project = Project::getProjectById($project_id, FALSE, NULL);
$old_proposal = $project->proposal_id;
// probably dont need this now
$was_selected = $project->selected;
// only allow project owner (or assigned mentor) to update its selected & proposal_id fields
//if(!Groups::isOwner('project', $project_id) && $project->mentor_id != $GLOBALS['user']->uid){
if (!Groups::isOwner('project', $project_id)) {
echo t('Only the project owner or mentor can update its proposal status.');
return;
}
$selected_prev_set = false;
if ($was_selected == 1) {
$selected_prev_set = true;
}
if (!$selected_prev_set) {
// update the project
示例6: die
}
/**
* validate power
*/
if (!isset($_SESSION['user_info']) || empty($_SESSION['user_info'])) {
$res["reason"] = "u are not login";
die(json_encode($res));
}
$db = new MySQL($log);
$mysqli = $db->openDB();
if ($mysqli !== null) {
$project = new Project($mysqli, $log);
$pmd = new ProjectModuleData($mysqli, $log);
if ($data["op"] === "del") {
foreach ($data['data'] as $deldata) {
$project->getProjectById($deldata["p_id"]);
if ($project->u_id === $_SESSION['user_info']['id']) {
//判断project的所有者是否是当前用户
if ($pmd->delPMD($deldata["pmd_id"], $deldata["p_id"])) {
$res["result"] = true;
$res["reason"] = "Delete data success!";
} else {
$res["result"] = false;
$res["reason"] = "Delete data failed!";
$db->closeDB();
die(json_encode($res));
}
} else {
$res["result"] = false;
$res["reason"] = "You have not power!";
$db->closeDB();
示例7: Page
<?php
$objPage = new Page();
$objProject = new Project();
if (!isset($data['params'])) {
$project = $data['project'];
$id = $project['id'];
} else {
$id = $data['params']['id'];
$project = $objProject->getProjectById($id);
}
$objPosition = new Position();
$allPositions = $objPosition->getAllPositionsInProject($project['project_type_id']);
?>
<div class="sectionParams" data-params="id=<?php
echo $id;
?>
">
</div>
<form id="addApplicationForm">
<table cellpadding="0" cellspacing="0" border="0" style="margin-bottom:15px;">
<tr>
<td>Position</td>
<td>
<input type="hidden" name="project_id" id="project_id" value="<?php
echo $project['id'];
?>
" />
<select class="selectPosition" style="width:140px;" name="position_id" data-url="/sugarkms/mod/getTeamsForPosition.php">
示例8: insertProposal
static function insertProposal($props, $project_id)
{
if (!$props) {
drupal_set_message(t('Insert requested with empty (filtered) data set'), 'error');
return false;
}
global $user;
$txn = db_transaction();
try {
$uid = $user->uid;
if (!Users::isOfType(_STUDENT_TYPE, $uid)) {
drupal_set_message(t('You must be a student to submit a proposal'), 'error');
return false;
}
$project = Project::getProjectById($project_id);
$student_details = Users::getStudentDetails($uid);
$props['owner_id'] = $uid;
$props['org_id'] = $project['org_id'];
$props['inst_id'] = $student_details->inst_id;
$props['supervisor_id'] = altSubValue($props, 'supervisor_id', 0) ?: $student_details->supervisor_id;
$props['pid'] = $project['pid'];
if (!isset($props['state'])) {
$props['state'] = 'draft';
}
if (!testInput($props, array('owner_id', 'org_id', 'inst_id', 'supervisor_id', 'pid', 'title'))) {
return FALSE;
}
try {
// inserts where the field length is exceeded fails silently here
// i.e. the date strinf is too long for the mysql field type
$id = db_insert(tableName(_PROPOSAL_OBJ))->fields($props)->execute();
} catch (Exception $e) {
drupal_set_message($e->getMessage(), 'error');
}
if ($id) {
//TODO: notify mentor???
drupal_set_message(t('Note that you have only saved your proposal: you can continue editing it later.'));
return $id;
} else {
drupal_set_message(t('We could not add your proposal. ') . (_DEBUG ? '<br/>' . getDrupalMessages() : ""), 'error');
}
return $result;
} catch (Exception $ex) {
$txn->rollback();
drupal_set_message(t('We could not add your proposal.') . (_DEBUG ? $ex->__toString() : ''), 'error');
}
return FALSE;
}
示例9: processPageSource
public function processPageSource()
{
$member_id = Session::getSession(Login::$_login_admin);
$objMember = new Member();
$current_user = $objMember->getMemberById($member_id);
//var_dump($current_user);
$page_details = $this->objPage->getPages(array('id' => $this->cPage_id))[0];
if (!empty($page_details['php_file_directory'])) {
if (file_exists(ROOT_PATH . DS . PAGES_DIR . DS . $page_details['php_file_directory'])) {
$cPage = $this->cPage;
$params = $this->cPage_params;
//var_dump($params);
// Tao object
$object = ucwords($cPage);
switch ($cPage) {
case 'exco':
$objProject = new Project();
break;
default:
if (file_exists(ROOT_PATH . DS . CLASSES_DIR . DS . $object . '.php')) {
${'obj' . $object} = new $object();
}
break;
}
if ($cPage == 'database') {
$header = 'Database :: ' . ucwords(str_replace('-', ' ', $params['table']));
}
if (array_key_exists('id', $params)) {
switch ($cPage) {
case 'exco':
$id = $params['id'];
$project = $objProject->getProjectById($id);
$result = $project;
break;
default:
$id = $params['id'];
${$cPage} = ${'obj' . $object}->{'get' . $object . 'byId'}($id);
$result = ${$cPage};
break;
}
if (empty($result)) {
$error = "No record found for the ID provided.";
}
}
} else {
$error = "The source directory is invalid.";
}
} else {
$error = "The source directory is not recorded.";
}
if (isset($error)) {
require_once ROOT_PATH . DS . PAGES_DIR . DS . 'error.php';
} else {
if ($this->objPage->canAccess($this->cPage_params, $member_id, $page_details)) {
//echo '<h1 style="background:white;">';
// var_dump($this->cPage_params);
// var_dump($this->cPage_id);
// echo '</h1>';
require_once ROOT_PATH . DS . PAGES_DIR . DS . $page_details['php_file_directory'];
} else {
$error = 'You do not have permission to access this page';
require_once ROOT_PATH . DS . PAGES_DIR . DS . 'error.php';
}
}
}
示例10: Project
<?php
if (isset($data['params']) && isset($data['params']['id'])) {
$params = $data['params'];
$id = $params['id'];
$objProject = new Project();
$objMember = new Member();
$objPosition = new Position();
$objTeam = new Team();
$involvement = $objMember->getInvolvements(array('id' => $id));
if (!empty($involvement)) {
$involvement = $involvement[0];
$project = $objProject->getProjectById($involvement['project_id']);
$member = $objMember->getMemberById($involvement['member_id']);
?>
<h2 class="borderBottom">
Manage Involvement :: <?php
echo $member['name'];
?>
<a class="closeInvolvementDetails h2rightlink" href="#">Close</a>
</h2>
<div class="sectionParams" data-params="id=<?php
echo $involvement['id'];
?>
"></div>
<br />
<table cellpadding="0" cellspacing="0" border="0" style="width:100%;vertical-align:middle;" class="panelTable horizontalTable" data-object="page">
<tr>
<td >
示例11: intval
if ($project == '1') {
$last = $objTeam->getLastPosition();
$project_order = intval($last) + 1;
}
$params['exco_order'] = $exco_order;
$params['project_order'] = $project_order;
break;
case 'page':
$objPage = new Page();
$group_id = $params['group_id'];
$order = $objPage->getLastPosition($group_id) + 1;
$params['order'] = $order;
break;
case 'involvement':
$objProject = new Project();
$project = $objProject->getProjectById($params['project_id']);
$params['month_start'] = $project['month_start'];
$params['year_start'] = $project['year_start'];
$params['month_end'] = $project['month_end'];
$params['year_end'] = $project['year_end'];
break;
case 'recruitment':
//echo Helper::json('23:59:59 '.$params['deadline']);
//echo Helper::json(strtotime('23:59:59 '.$params['deadline']));
//$deadline = date('Y-m-d H:i:s', strtotime('23:59:59 '.$params['deadline']));
//echo Helper::json($deadline);
$deadline = date('Y-m-d', strtotime($params['deadline']));
$params['deadline'] = $deadline;
//check if an identical recruitment has been added
$recruitment = $objDbase->get('recruitment', array('project_id' => $params['project_id'], 'team_id' => $params['team_id'], 'position_id' => $params['position_id'], 'deadline' => $params['deadline']));
if (!empty($recruitment)) {
示例12: generateURL
public function generateURL($cPage = null, $params = null)
{
$result = '/sugarkms/';
if (!empty($cPage)) {
$result .= $cPage;
if (!empty($params)) {
if (array_key_exists('id', $params)) {
switch ($cPage) {
case 'member':
$objMember = new Member();
$member = $objMember->getMemberById($params['id']);
//$params['id'] = $member['entity'].'-'.$params['id'];
$params['entity'] = $member['entity'];
break;
case 'project':
case 'exco':
$objProject = new Project();
$project = $objProject->getProjectById($params['id']);
$params['entity'] = str_replace(' ', '-', strtolower($project['name'])) . '-' . strtolower(str_replace(' ', '', str_replace(')', '', str_replace(' (', '-', $project['project_time']))));
break;
default:
if (count($params) == 1) {
$params['action'] = 'view';
}
break;
}
}
$page_details = $this->getPageFromURL($cPage, $params);
if (!empty($page_details)) {
$page_params = $this->getPageParams(array('page_id' => $page_details['id']), array('order' => 'asc'));
foreach ($page_params as $page_param) {
if (!($page_param['param'] == 'action' && $page_param['required_value'] == 'view')) {
$result .= '/';
//$result .= $page_param['param'].'/';
$result .= empty($page_param['required_value']) ? $params[$page_param['param']] : $page_param['required_value'];
}
}
}
}
return $result;
}
}