本文整理汇总了PHP中Project::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getInstance方法的具体用法?PHP Project::getInstance怎么用?PHP Project::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAuthorized
public function isAuthorized()
{
if (Project::getInstance()->getCurUser()->id) {
return true;
}
return false;
}
示例2: get
/**
* Returns a project's release info from the update service.
*
* @param array $request
* A request array.
*
* @param bool $refresh
* Whether to discard cached object.
*
* @return \Drush\UpdateService\Project
*/
public function get($request, $refresh = FALSE)
{
if ($refresh || !isset($this->cache[$request['name']])) {
$project_release_info = Project::getInstance($request, $this->getCacheDuration());
if ($project_release_info && !$project_release_info->isValid()) {
$project_release_info = FALSE;
}
$this->cache[$request['name']] = $project_release_info;
}
return $this->cache[$request['name']];
}
示例3: showFavouritesPage
function showFavouritesPage()
{
if (Users::isStudent()) {
$my_id = Users::getMyId();
$projects = Project::getInstance()->getFavouriteProjects();
if ($projects) {
echo "<ul>";
foreach ($projects as $project) {
echo "<li><a href='" . _WEB_URL . "/projects/browse?pid=" . $project->pid . "'>" . $project->title . "</a></li>";
}
echo "</ul>";
} else {
echo t('You have no projects marked as favourite yet. By browsing them you can mark them as you find them interesting');
}
} else {
echo t('You must be a student to have kept a favourite list');
}
}
示例4: getAll
/**
* Получаем все планы в виде массива
*
* @param boolean $disabled выводить ли выключенные планы
* @return array
*/
public function getAll($disabled = false)
{
$where = 'where 1=1 ';
if ($disabled) {
$where .= '';
} else {
$where .= ' and status="1"';
}
include_once LIB_ROOT . '/users/user.class.php';
if (Project::getInstance()->getCurUser()->isAdmin()) {
$where .= '';
} elseif (Project::getInstance()->getCurUser()->monitor == 1) {
$where .= ' and type in (1, 2)';
} else {
$where .= ' and type in (0, 2)';
}
$result = sql_query('select * from plans ' . $where . ' order by id');
$plans = array();
while ($row = mysql_fetch_assoc($result)) {
$plans[] = $row;
}
return $plans;
}
示例5: addslashes
SUM(IF(t.type="r", t.amount, NULL)) as referral,
SUM(IF(t.type="i", t.amount, NULL)) as reinvest,
SUM(IF(t.type="b", t.amount, NULL)) as bonus
FROM users
LEFT JOIN translines as t ON t.user_id = users.id AND t.stamp < ' . Project::getInstance()->getNow() . ' AND t.status > 0
GROUP BY users.id
ORDER BY ' . (!empty($_REQUEST['order_by']) ? addslashes($_REQUEST['order_by']) : 'reg_date DESC') . '
' . get_limit() . '
');
$users = array();
while ($row = mysql_fetch_assoc($result)) {
$row['ips'] = isset($ips[$row['id']]) ? $ips[$row['id']] : array();
$row['bads'] = isset($bads[$row['id']]) ? intval($bads[$row['id']]) : 0;
$row['ipsec'] = 0;
$users[$row['id']] = $row;
}
foreach ($users_by_ips as $ip => $u_ids) {
if (count($u_ids) > 1) {
foreach ($u_ids as $u_id) {
if (!isset($users[$u_id])) {
continue;
}
$users[$u_id]['ipsec'] = 1;
$users[$u_id]['ips'][$ip] = '(' . implode(',', $u_ids) . ')';
}
}
}
Project::getInstance()->getSmarty()->assign('pagination', pagination(sql_get('SELECT FOUND_ROWS()')));
Project::getInstance()->getSmarty()->assign('users', stripslashes_array($users));
Project::getInstance()->getSmarty()->display('../default/admin/users.tpl');
}
示例6: drupal_get_form
echo "<div id='msg_{$target}'></div>";
$form = drupal_get_form("vals_soc_project_form", '', $target, $org);
renderForm($form, $target);
break;
case 'save':
$type = altSubValue($_POST, 'type', '');
$id = altSubValue($_POST, 'id', '');
$draft = altSubValue($_POST, 'draft', false);
$properties = Project::getInstance()->filterPostLite(Project::getInstance()->getKeylessFields(), $_POST);
$properties['state'] = $draft ? 'draft' : 'pending';
if (!$id) {
$new = $properties['org_id'];
$result = Project::getInstance()->addProject($properties);
} else {
$new = false;
$result = Project::getInstance()->changeProject($properties, $id);
}
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', '');
示例7: User
$valid = false;
}
if ($_POST['login'] == $_POST['referral']) {
$_POST['referral'] = '';
}
if ($valid) {
$user = new User();
$_POST['pm_member_id'] = !empty($_POST['pm_member_id']) ? $_POST['pm_member_id'] : '';
$_POST['secpin'] = $_POST['secpin_signup'];
$_POST['masterpin'] = $_POST['masterpin_signup'];
$_POST['reg_date'] = Project::getInstance()->getNow();
$user->setData(sql_escapeArray($_POST));
$user->access = ACCESS_LEVEL_USER;
$user->status = USER_STATUS_ACTIVE;
if ($user_id = $user->save()) {
$page_tpl = 'signup_ok.tpl';
include_once LIB_ROOT . '/emails.class.php';
$params = array('%user_fullname%' => $user->fullname, '%user_login%' => $user->login, '%user_password%' => $user->password, '%user_secpin%' => $user->secpin, '%user_masterpin%' => $user->masterpin, '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'));
$email = new Emails($user_id, 'signup_notify', $params);
$email->send();
}
} else {
Project::getInstance()->getSmarty()->assign('signup', $_POST);
$page_tpl = 'signup.tpl';
}
} else {
$page_tpl = 'signup.tpl';
Project::getInstance()->getSmarty()->assign('signup', array($_SESSION['referral']));
}
Project::getInstance()->showPage($page_tpl);
示例8: showProposalsForProject
function showProposalsForProject($project_id, $show_only_mine)
{
global $base_url;
$url_type = (bool) $show_only_mine ? '/mine' : '';
echo '<div id="baktoprops"><a href=" ' . $base_url . '/dashboard/proposals/browsebytype' . $url_type . '">' . t('Back to proposals overview') . '</a></div>';
$project = Project::getInstance()->getProjectById($project_id);
echo '<h2>' . t('Proposals for project idea \'' . $project['title']) . '\'</h2>';
?>
<div id="TableContainer" style="width: 800px;"></div>
<script type="text/javascript">
jQuery(document).ready(function($){
window.view_settings = {};
function loadFilteredProposals(){
$("#TableContainer").jtable("load", {
project: <?php
echo $project_id;
?>
});
}
//Prepare jTable
$("#TableContainer").jtable({
paging: true,
pageSize: 10,
sorting: true,
defaultSorting: "pid ASC",
actions: {
listAction: moduleUrl + "actions/proposal_actions.php?action=list_proposals"
},
fields: {
proposal_id: {
key: true,
create: false,
edit: false,
list: false
},
owner_id: {
title: "Student",
width: "30%",
display: function (data){
var uname_text ='';
if(data.record.name){
uname_text = data.record.name;
}else{
uname_text = data.record.u_name;
}
if(data.record.proposal_id == data.record.pr_proposal_id && data.record.selected==0){
uname_text += " <span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-link\" title=\"You have set this proposal as your interim favourite for your project idea.\"> </span>";
}
if(data.record.proposal_id == data.record.pr_proposal_id && data.record.selected==1){
uname_text += " <span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-check\" title=\"You have chosen to offer this student the project.\"> </span>";
}
return uname_text;
}
},
inst_id: {
title: "Institute",
width: "26%",
create: false,
edit: false,
display: function (data){return data.record.i_name;}
},
solution_short : {
//width: "2%",
title: "Proposal details",
sorting: false,
display: function (data) {
console.log(data.record);
if(data.record.state == 'rejected'){
return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
" <span style=\"float:left;display:inline;\" class=\"\" title=\"You have rejected this proposal for your project idea.\">"+
" <div style=\"display:inline;\">Rejected</div></span>";
}
else if(data.record.state == 'archived'){
return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
" <span style=\"float:left;display:inline;\" class=\"\" title=\"This proposal has been archived because another student accepted your offer or this student accepted another offer.\">"+
" <div style=\"display:inline;\">Archived</div></span>";
}
else if(data.record.state == 'draft'){
return " "+
"<span style=\"display:inline;\" class=\"\" title=\"This proposal is in draft mode and not yet visible.\">"+
" <div style=\"display:inline;\">Draft only</div></span>";
}
else if(data.record.state == 'accepted'){
return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
"onclick=\"getProposalDetail("+data.record.proposal_id+")\">"+
"<span style=\"float:left;display:inline;\" class=\"ui-icon ui-icon-info\">See details</span></a>"+
" <span style=\"float:left;display:inline;\" class=\"\" title=\"This proposal has been accepted by the student as their final choice.\">"+
" <div style=\"display:inline;\">Accepted</div></span>";
}
else if(data.record.proposal_id == data.record.pr_proposal_id && data.record.selected==0){
return "<a title=\"See this Proposal\" href=\"javascript:void(0);\" "+
//.........这里部分代码省略.........
示例9: UserMessage
<?php
$ACCESS_LEVEL = 1;
include_once DOC_ROOT . '/includes/authorization.php';
Project::getInstance()->getSmarty()->assign('user', Project::getInstance()->getCurUser());
if (isset($_REQUEST['id'])) {
$message = new UserMessage(intval($_REQUEST['id']));
if ($message->id) {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'read') {
Project::getInstance()->getSmarty()->assign('from', 'Support');
Project::getInstance()->getSmarty()->assign('title', $message->title);
Project::getInstance()->getSmarty()->assign('text', nl2br($message->message));
Project::getInstance()->showPage('user/message.tpl');
$message->readed = 1;
$message->save();
} elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
$message->delete();
header('Location: /user/messages.php');
}
}
} else {
$user_messages_list = new UserMessageList(Project::getInstance()->getCurUser());
Project::getInstance()->getSmarty()->assign('messages', $user_messages_list->getList());
Project::getInstance()->showPage('user/messages.tpl');
}
示例10: location
</form>
<script language="Javascript">
$("#pm_form").submit();
</script>
';
location($_SERVER['PHP_SELF'], $pm_form);
} elseif ($_POST['source'] == 'LR') {
header('Location: https://sci.libertyreserve.com/?lr_acc=' . get_setting('lr_account_deposit') . '&lr_acc_from=' . $user['account'] . '&lr_amnt=' . floatval($_POST['amount']) . '&lr_currency=LRUSD&lr_comments=' . urlencode('Deposit for account: ' . $user['login']) . '&lr_success_url=' . urlencode('http' . (SSL ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . '/index.php?action=success') . '&lr_success_url_method=GET&lr_fail_url=' . urlencode('http' . (SSL ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . '/index.php?action=fail') . '&lr_fail_url_method=GET&lr_store=' . get_setting('lr_store') . '&lr_status_url=' . urlencode('http' . (SSL ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . '/status.php') . '&lr_status_url_method=GET&payment_id=' . sql_insert_id());
}
}
} else {
location($_SERVER['PHP_SELF'], '<p class=imp><strong>Warning:</strong> Incorrect amount has been defined!</p>');
}
} else {
location($_SERVER['PHP_SELF'], '<p class=imp><strong>Warning:</strong> Investment plan does not exist!</p>');
}
} else {
$plans = array();
$result = sql_query('
SELECT
*
FROM plans
WHERE type in (' . (Project::getInstance()->getCurUser()->monitor ? '1, 2' : '0,2') . ')
ORDER BY id
');
while ($row = mysql_fetch_assoc($result)) {
$plans[] = $row;
}
Project::getInstance()->getSmarty()->assign('plans', stripslashes_array($plans));
Project::getInstance()->showPage('user/deposit.tpl');
}
示例11: array
$params = array('%user_fullname%' => htmlspecialchars($user['fullname']), '%user_login%' => $user['login'], '%account%' => $user['account'], '%amount%' => floatval($_POST['amount']), '%batch%' => $reciept_id, '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow()));
$email = new Emails(Project::getInstance()->getCurUser()->id, 'withdrawal_notify', $params);
$email->send();
}
location($_SERVER['PHP_SELF'], '<p class=imp><strong>Achievement:</strong> Operation has been completed, check your account!</p>');
} else {
//���� �� ������ ������, �� ���������� � bad_withdrawals
$gw_balance = $gateway->getBalance($account);
if (Project::getInstance()->getCurUser()->payment_system == 'PM') {
$gw_balance = $gw_balance[get_setting('pm_account')];
}
sql_query('
INSERT INTO bad_withdrawals
SET
id=0,
user_id="' . $user['id'] . '",
amount= "' . floatval($_POST['amount']) . '",
gw_balance="' . floatval($gw_balance) . '",
stamp="' . Project::getInstance()->getNow() . '"');
location($_SERVER['PHP_SELF'], '<p class=imp><strong>Notification:</strong> The action can not be done, please try again later!</p>');
}
} else {
location($_SERVER['PHP_SELF'], '<p class=imp><strong>Alert:</strong> You have defined not valid amount or your available balance is too low to request the withdrawal!');
}
} else {
if ($user['monitor'] == 1) {
$balance = floatval($user['bonus'] + $user['reinvest'] > 0 ? $balance - ($user['bonus'] + $user['reinvest']) : $balance);
}
Project::getInstance()->getSmarty()->assign('balance', $balance);
Project::getInstance()->showPage('user/withdraw.tpl');
}
示例12: User
<?php
$ACCESS_LEVEL = ACCESS_LEVEL_GUEST;
include_once DOC_ROOT . '/includes/authorization.php';
if (AuthController::getInstance()->isAuthorized()) {
$user = new User(Project::getInstance()->getCurUser()->id);
Project::getInstance()->getSmarty()->assign('user', $user);
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'send') {
if (empty($_POST['subject']) || empty($_POST['message']) || empty($_POST['email']) && !$user->id) {
location($_SERVER['PHP_SELF'], '<p style="color:red; font-weight:bold;">All fields required!</p>');
} else {
include_once LIB_ROOT . '/emails.class.php';
$emailer = new Emails($user->id);
$emailer->from = $_POST['email'];
$emailer->subject = 'From: ' . ($user->id ? $user->login : $emailer->from) . ' -> ' . $_POST['subject'];
$emailer->body = $_POST['message'];
$emailer->sendToSystem();
location($_SERVER['PHP_SELF'], '<p style="color:red; font-weight:bold;">Your message has been sent to the support!</p>');
}
}
Project::getInstance()->showPage('contactus.tpl');
示例13: DEFINE
/** CONSTANTS **/
require_once DOC_ROOT . '/includes/constants.php';
/** MYSQL **/
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_NAME', 'total-invest');
DEFINE('DB_LOGIN', 'total-invest');
DEFINE('DB_PASSWORD', 'total-invest');
/** TIMEZONE **/
date_default_timezone_set('Europe/Luxembourg');
/** SETTINGS **/
DEFINE('CACHE_ENABLED', FALSE);
DEFINE('SSL', 0);
DEFINE('REFERRAL_ONCE', 1);
DEFINE('CAPTCHA', 0);
DEFINE('LOGIN_PIN', 0);
DEFINE('MASTER_PIN', 1);
DEFINE('QUESTIONS', 1);
DEFINE('PAGE_ROWS', 20);
session_start();
require_once LIB_ROOT . '/project.class.php';
require_once LIB_ROOT . '/smarty_functions.php';
Project::getInstance()->setupLang();
Project::getInstance()->setupSmarty();
$GLOBALS['row'] = 0;
$GLOBALS['queries'] = array();
$GLOBALS['warnings'] = array();
if (isset($_REQUEST['referral'])) {
$_SESSION['referral'] = $_REQUEST['referral'];
}
/** DEVINFO **/
include_once LIB_ROOT . '/devinfo.php';
示例14: showPage
public function showPage($content = '')
{
$this->getSmarty()->assign('CONTENT', Project::getInstance()->getSmarty()->fetch($content));
$this->getSmarty()->display('header.tpl');
}
示例15: getSums
public function getSums()
{
$query = '
select type, sum(amount) as sum from translines where
translines.user_id="' . $this->user_id . '" and
translines.status > 0 and
translines.stamp < ' . Project::getInstance()->getNow() . '
group by translines.type
';
$result = sql_query($query);
$sums = array();
while ($row = mysql_fetch_assoc($result)) {
$sums[$row['type']] = $row['sum'];
}
return $sums;
}