本文整理汇总了PHP中Goteo\Model\Project类的典型用法代码示例。如果您正苦于以下问题:PHP Project类的具体用法?PHP Project怎么用?PHP Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: project
public function project($id)
{
$project = Project::getMedium($id, LANG);
if (!$project instanceof Project) {
throw new Redirection('/', Redirection::TEMPORARY);
}
return new View('view/widget/project.html.php', array('project' => $project, 'global' => true));
throw new Redirection('/fail', Redirection::TEMPORARY);
}
开发者ID:anvnguyen,项目名称:Goteo,代码行数:9,代码来源:widget.php
示例2: index
public function index()
{
if (isset($_GET['error'])) {
throw new \Goteo\Core\Error('418', Text::html('fatal-error-teapot'));
}
// orden de los elementos en portada
$order = Home::getAll();
// si estamos en easy mode, quitamos el feed
if (defined('GOTEO_EASY') && \GOTEO_EASY === true && isset($order['feed'])) {
unset($order['feed']);
}
// entradas de blog
if (isset($order['posts'])) {
// entradas en portada
$posts = Post::getAll();
}
// Proyectos destacados
if (isset($order['promotes'])) {
$promotes = Promote::getAll(true);
foreach ($promotes as $key => &$promo) {
try {
$promo->projectData = Project::getMedium($promo->project, LANG);
} catch (\Goteo\Core\Error $e) {
unset($promotes[$key]);
}
}
}
// actividad reciente
if (isset($order['feed'])) {
$feed = array();
$feed['goteo'] = Feed::getAll('goteo', 'public', 15);
$feed['projects'] = Feed::getAll('projects', 'public', 15);
$feed['community'] = Feed::getAll('community', 'public', 15);
}
// Banners siempre
/* $banners = Banner::getAll(true);
foreach ($banners as $id => &$banner) {
if (!empty($banner->project)) {
try {
$banner->project = Project::get($banner->project, LANG);
} catch (\Goteo\Core\Error $e) {
unset($banners[$id]);
}
}
}*/
$template = VIEW_PATH . '/index.html.php';
return new View($template, array('banners' => $banners, 'posts' => $posts, 'promotes' => $promotes, 'order' => $order));
}
开发者ID:kenjs,项目名称:Goteo,代码行数:51,代码来源:index.php
示例3: getAll
public static function getAll($activeonly = false, $node = \GOTEO_NODE)
{
// estados
$status = Project::status();
$banners = array();
$sqlFilter = $activeonly ? " AND banner.active = 1" : '';
$query = static::query("\n SELECT\n banner.id as id,\n banner.node as node,\n banner.project as project,\n project.name as name,\n IFNULL(banner_lang.title, banner.title) as title,\n IFNULL(banner_lang.description, banner.description) as description,\n banner.url as url,\n project.status as status,\n banner.image as image,\n banner.order as `order`,\n banner.active as `active`\n FROM banner\n LEFT JOIN project\n ON project.id = banner.project\n LEFT JOIN banner_lang\n ON banner_lang.id = banner.id\n AND banner_lang.lang = :lang\n WHERE banner.node = :node\n {$sqlFilter}\n ORDER BY `order` ASC\n ", array(':node' => $node, ':lang' => \LANG));
foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $banner) {
$banner->image = !empty($banner->image) ? Image::get($banner->image) : null;
$banner->status = $status[$banner->status];
$banners[] = $banner;
}
return $banners;
}
开发者ID:isbkch,项目名称:Goteo,代码行数:14,代码来源:banner.php
示例4: getAll
public static function getAll($activeonly = false, $node = \GOTEO_NODE)
{
// estados
$status = Project::status();
$promos = array();
$sqlFilter = $activeonly ? " AND promote.active = 1" : '';
$query = static::query("\n SELECT\n promote.id as id,\n promote.project as project,\n project.name as name,\n project.status as status,\n IFNULL(promote_lang.title, promote.title) as title,\n IFNULL(promote_lang.description, promote.description) as description,\n promote.order as `order`,\n promote.active as `active`\n FROM promote\n LEFT JOIN promote_lang\n ON promote_lang.id = promote.id\n AND promote_lang.lang = :lang\n INNER JOIN project\n ON project.id = promote.project\n WHERE promote.node = :node\n {$sqlFilter}\n ORDER BY `order` ASC, title ASC\n ", array(':node' => $node, ':lang' => \LANG));
foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $promo) {
$promo->description = Text::recorta($promo->description, 100, false);
$promo->status = $status[$promo->status];
$promos[] = $promo;
}
return $promos;
}
开发者ID:anvnguyen,项目名称:Goteo,代码行数:14,代码来源:promote.php
示例5: projList
public static function projList($user)
{
$lists = array();
// mis proyectos
$projects = Model\Project::ofmine($user->id);
if (!empty($projects)) {
$lists['my_projects'] = Listing::get($projects);
}
// proyectos que cofinancio
$invested = Model\User::invested($user->id, false);
if (!empty($invested)) {
$lists['invest_on'] = Listing::get($invested);
}
return $lists;
}
开发者ID:anvnguyen,项目名称:Goteo,代码行数:15,代码来源:activity.php
示例6: getAll
public static function getAll($position = 'home', $node = \GOTEO_NODE)
{
if (!in_array($position, array('home', 'footer'))) {
$position = 'home';
}
$list = array();
$values = array(':lang' => \LANG);
if ($node == \GOTEO_NODE || empty($node)) {
// portada goteo, sacamos todas las de blogs tipo nodo
// que esten marcadas en la tabla post
$sqlFilter = " WHERE post.{$position} = 1\n AND post.publish = 1\n ";
$sqlField = "post.order as `order`,";
} else {
// portada nodo, igualmente las entradas de blogs tipo nodo
// perosolo la que esten en la tabla de entradas en portada de ese nodo
$sqlFilter = " WHERE post.id IN (SELECT post FROM post_node WHERE node = :node)\n AND post.publish = 1\n ";
$values[':node'] = $node;
$sqlField = "(SELECT `order` FROM post_node WHERE node = :node AND post = post.id) as `order`,";
}
$sql = "\n SELECT\n post.id as id,\n post.blog as blog,\n IFNULL(post_lang.title, post.title) as title,\n IFNULL(post_lang.text, post.text) as `text`,\n post.image as `image`,\n post.media as `media`,\n {$sqlField}\n DATE_FORMAT(post.date, '%d-%m-%Y') as date,\n DATE_FORMAT(post.date, '%d | %m | %Y') as fecha,\n post.publish as publish,\n post.author as author,\n post.home as home,\n post.footer as footer,\n blog.type as owner_type,\n blog.owner as owner_id\n FROM post\n INNER JOIN blog\n ON blog.id = post.blog\n LEFT JOIN post_lang\n ON post_lang.id = post.id\n AND post_lang.lang = :lang\n {$sqlFilter}\n ORDER BY `order` ASC, title ASC\n ";
$query = static::query($sql, $values);
foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $post) {
// galeria
$post->gallery = Image::getAll($post->id, 'post');
$post->image = $post->gallery[0];
$post->media = new Media($post->media);
$post->type = $post->home == 1 ? 'home' : 'footer';
// datos del autor
switch ($post->owner_type) {
case 'project':
$proj_blog = Project::getMini($post->owner_id);
$post->author = $proj_blog->owner;
$post->user = $proj_blog->user;
$post->owner_name = $proj_blog->name;
$sql = "UPDATE post SET author = '.{$proj_blog->owner}.' WHERE post.id = ?";
self::query($sql, array($post->id));
break;
case 'node':
$post->user = User::getMini($post->author);
// (Nodesys)
break;
}
$list[$post->id] = $post;
}
return $list;
}
开发者ID:anvnguyen,项目名称:Goteo,代码行数:46,代码来源:post.php
示例7: process
public static function process($action = 'list', $id = null, $filters = array())
{
$node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE;
// métodos de pago
$methods = Model\Invest::methods();
// estados del proyecto
$status = Model\Project::status();
// estados de aporte
$investStatus = Model\Invest::status();
// listado de proyectos
$projects = Model\Invest::projects(false, $node);
// usuarios cofinanciadores
$users = Model\Invest::users(true);
// campañas que tienen aportes
$calls = Model\Invest::calls();
// extras
$types = array('donative' => 'Solo los donativos', 'anonymous' => 'Solo los anónimos', 'manual' => 'Solo los manuales', 'campaign' => 'Solo con riego');
// detalles del aporte
if ($action == 'details') {
$invest = Model\Invest::get($id);
$project = Model\Project::get($invest->project);
$userData = Model\User::get($invest->user);
if (!empty($invest->droped)) {
$droped = Model\Invest::get($invest->droped);
} else {
$droped = null;
}
if ($project->node != $node) {
throw new Redirection('/admin/invests');
}
return new View('view/admin/index.html.php', array('folder' => 'invests', 'file' => 'details', 'invest' => $invest, 'project' => $project, 'user' => $userData, 'status' => $status, 'investStatus' => $investStatus, 'droped' => $droped, 'calls' => $calls));
}
// listado de aportes
if ($filters['filtered'] == 'yes') {
if (!empty($filters['calls'])) {
$filters['types'] = '';
}
$list = Model\Invest::getList($filters, $node, 999);
} else {
$list = array();
}
$viewData = array('folder' => 'invests', 'file' => 'list', 'list' => $list, 'filters' => $filters, 'projects' => $projects, 'users' => $users, 'calls' => $calls, 'methods' => $methods, 'types' => $types, 'investStatus' => $investStatus);
return new View('view/admin/index.html.php', $viewData);
}
开发者ID:isbkch,项目名称:Goteo,代码行数:44,代码来源:invests.php
示例8: verifyProject
/**
* Verificación de proyecto de trabajo
*
* @param object $user instancia Model\User del convocador
* @param string $action por si es 'select'
* @return array(project, projects)
*/
public static function verifyProject($user, $action)
{
$projects = Model\Project::ofmine($user->id);
// sus proyectos
// si no tiene, no debería estar aquí
if (empty($projects) || !is_array($projects)) {
return array(null, null);
}
// comprobamos que tenga los permisos para editar y borrar
foreach ($projects as $proj) {
// comprueba que puede editar sus proyectos
if (!ACL::check('/project/edit/' . $proj->id)) {
ACL::allow('/project/edit/' . $proj->id . '/', '*', 'user', $user);
}
// y borrarlos
if (!ACL::check('/project/delete/' . $proj->id)) {
ACL::allow('/project/delete/' . $proj->id . '/', '*', 'user', $user);
}
}
// si está seleccionando otro proyecto
if ($action == 'select' && !empty($_POST['project'])) {
$project = Model\Project::get($_POST['project']);
} elseif (!empty($_SESSION['project']->id)) {
// mantener los datos del proyecto de trabajo
$project = Model\Project::get($_SESSION['project']->id);
}
// si aun no tiene proyecto de trabajo, coge el primero
if (empty($project)) {
$project = $projects[0];
}
// tiene que volver con un proyecto de trabajo
if ($project instanceof \Goteo\Model\Project) {
$_SESSION['project'] = $project;
// lo guardamos en sesión para la próxima verificación
} else {
Message::Error('No se puede trabajar con el proyecto seleccionado, contacta con nosotros');
$project = null;
}
// devolvemos lista de proyectos y proyecto de trabajo
return array($project, $projects);
}
开发者ID:isbkch,项目名称:Goteo,代码行数:48,代码来源:projects.php
示例9: __construct
/**
*
* @param type mixed $id Identificador
* @return type object Objeto
*/
public function __construct($id, $all_avatars = true, $with_title = true)
{
if ($this->project = Project::get($id)) {
$this->show_title = $with_title;
$this->investors = $this->project->agregateInvestors();
$avatars = array();
foreach ($this->investors as $i) {
if ($i->avatar->id != 1 || $all_avatars) {
$avatars[$i->user] = $i->amount;
}
}
$this->avatars = self::pondera($avatars, $this->max_multiplier);
//arsort($this->avatars);
$keys = array_keys($this->avatars);
shuffle($keys);
$this->avatars = array_merge(array_flip($keys), $this->avatars);
//print_r($this->project);die;
} else {
return false;
}
}
开发者ID:anvnguyen,项目名称:Goteo,代码行数:26,代码来源:wallfriends.php
示例10: getList
/**
* Metodo para sacar las que hay en proyectos
* @return array strings
*/
public static function getList()
{
$results = array();
// $sql = "SELECT distinct(project_location) as location
// FROM project
// WHERE status > 2
// ORDER BY location ASC";
//
// try {
// $query = Model::query($sql);
// foreach ($query->fetchAll(\PDO::FETCH_CLASS) as $item) {
// $results[md5($item->location)] = $item->location;
// }
// return $results;
// } catch (\PDOException $e) {
// throw new Exception('Fallo la lista de localizaciones');
// }
$_locations = Project::yokohamaLocation();
foreach ($_locations as $_area) {
$results[md5($_area)] = $_area;
}
return $results;
}
开发者ID:kenjs,项目名称:Goteo,代码行数:27,代码来源:location.php
示例11: pay
public static function pay($invest, &$errors = array())
{
if (\GOTEO_FREE) {
$errors[] = Text::_('Bank not implemented. Contact us for development services or make it work somehow');
return false;
}
try {
$project = Project::getMini($invest->project);
// preparo codigo y cantidad
$token = $invest->id . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9);
$amount = $invest->amount * 100;
// Guardar el codigo de preaproval en el registro de aporte (para confirmar o cancelar)
$invest->setPreapproval($token);
// mandarlo al tpv
$urlTPV = TPV_REDIRECT_URL;
$data = '';
$MsgStr = '';
foreach ($datos as $n => $v) {
$data .= '<input name="' . $n . '" type="hidden" value="' . $v . '" />';
$MsgStr .= "{$n}:'{$v}'; ";
}
$conf = array('mode' => 0600, 'timeFormat' => '%X %x');
$logger =& \Log::singleton('file', 'logs/' . date('Ymd') . '_invest.log', 'caller', $conf);
$logger->log('##### TPV [' . $invest->id . '] ' . date('d/m/Y') . ' User:' . $_SESSION['user']->id . '#####');
$logger->log("Charge request: {$MsgStr}");
$logger->close();
Invest::setDetail($invest->id, 'tpv-conection', 'Ha iniciado la comunicacion con el tpv, operacion numero ' . $token . '. Proceso libary/tpv::pay');
echo '<html><head><title>Goteo.org</title></head><body><form action="' . $urlTPV . '" method="post" id="form_tpv" enctype="application/x-www-form-urlencoded">' . $data . '</form><script type="text/javascript">document.getElementById("form_tpv").submit();</script></body></html>';
return true;
} catch (Exception $ex) {
Invest::setDetail($invest->id, 'tpv-conection-fail', 'Ha fallado la comunicacion con el tpv. Proceso libary/tpv::pay');
$errors[] = Text::_('Error fatal en la comunicacion con el TPV, se ha reportado la incidencia. Disculpe las molestias.');
@mail(\GOTEO_FAIL_MAIL, 'Error fatal en comunicacion TPV Sermepa', 'ERROR en ' . __FUNCTION__ . '<br />' . $ex->getMessage());
return false;
}
}
开发者ID:kenjs,项目名称:Goteo,代码行数:36,代码来源:tpv.php
示例12: getMesseged
public static function getMesseged($user, $publicOnly = true)
{
$projects = array();
$sql = "SELECT project.id\n FROM project\n INNER JOIN message\n ON project.id = message.project\n AND message.user = ?\n WHERE project.status < 7\n ";
if ($publicOnly) {
$sql .= "AND project.status >= 3\n ";
}
$sql .= "GROUP BY project.id\n ORDER BY name ASC\n ";
$query = self::query($sql, array($user));
foreach ($query->fetchAll(\PDO::FETCH_CLASS) as $proj) {
$projects[] = \Goteo\Model\Project::getMedium($proj->id);
}
return $projects;
}
开发者ID:anvnguyen,项目名称:Goteo,代码行数:14,代码来源:message.php
示例13: process
public static function process($action = 'list', $id = null, $filters = array())
{
$errors = array();
// reubicando aporte,
if ($action == 'move') {
// el aporte original
$original = Model\Invest::get($id);
$userData = Model\User::getMini($original->user);
$projectData = Model\Project::getMini($original->project);
//el original tiene que ser de tpv o cash y estar como 'cargo ejecutado'
if ($original->method == 'paypal' || $original->status != 1) {
Message::Error('No se puede reubicar este aporte!');
throw new Redirection('/admin/accounts');
}
// generar aporte manual y caducar el original
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['move'])) {
// si falta proyecto, error
$projectNew = $_POST['project'];
// @TODO a saber si le toca dinero de alguna convocatoria
$campaign = null;
$invest = new Model\Invest(array('amount' => $original->amount, 'user' => $original->user, 'project' => $projectNew, 'account' => $userData->email, 'method' => 'cash', 'status' => '1', 'invested' => date('Y-m-d'), 'charged' => $original->charged, 'anonymous' => $original->anonymous, 'resign' => $original->resign, 'admin' => $_SESSION['user']->id, 'campaign' => $campaign));
//@TODO si el proyecto seleccionado
if ($invest->save($errors)) {
//recompensas que le tocan (si no era resign)
if (!$original->resign) {
// sacar recompensas
$rewards = Model\Project\Reward::getAll($projectNew, 'individual');
foreach ($rewards as $rewId => $rewData) {
$invest->setReward($rewId);
//asignar
}
}
// cambio estado del aporte original a 'Reubicado' (no aparece en cofinanciadores)
// si tuviera que aparecer lo marcaríamos como caducado
if ($original->setStatus('5')) {
// Evento Feed
$log = new Feed();
$log->setTarget($projectData->id);
$log->populate('Aporte reubicado', '/admin/accounts', \vsprintf("%s ha aportado %s al proyecto %s en nombre de %s", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('money', $_POST['amount'] . ' €'), Feed::item('project', $projectData->name, $projectData->id), Feed::item('user', $userData->name, $userData->id))));
$log->doAdmin('money');
unset($log);
Message::Info('Aporte reubicado correctamente');
throw new Redirection('/admin/accounts');
} else {
$errors[] = 'A fallado al cambiar el estado del aporte original (' . $original->id . ')';
}
} else {
$errors[] = 'Ha fallado algo al reubicar el aporte';
}
}
$viewData = array('folder' => 'accounts', 'file' => 'move', 'original' => $original, 'user' => $userData, 'project' => $projectData);
return new View('view/admin/index.html.php', $viewData);
// fin de la historia dereubicar
}
// cambiando estado del aporte aporte,
if ($action == 'update') {
// el aporte original
$invest = Model\Invest::get($id);
if (!$invest instanceof Model\Invest) {
Message::Error('No tenemos registro del aporte ' . $id);
throw new Redirection('/admin/accounts');
}
$status = Model\Invest::status();
$new = isset($_POST['status']) ? $_POST['status'] : null;
if ($invest->issue && $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update']) && $_POST['resolve'] == 1) {
Model\Invest::unsetIssue($id);
Model\Invest::setDetail($id, 'issue-solved', 'La incidencia se ha dado por resuelta por el usuario ' . $_SESSION['user']->name);
Message::Info('La incidencia se ha dado por resuelta');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update']) && isset($new) && isset($status[$new])) {
if ($new != $invest->status) {
if (Model\Invest::query("UPDATE invest SET status=:status WHERE id=:id", array(':id' => $id, ':status' => $new))) {
Model\Invest::setDetail($id, 'status-change' . rand(0, 9999), 'El admin ' . $_SESSION['user']->name . ' ha cambiado el estado del apote a ' . $status[$new]);
Message::Info('Se ha actualizado el estado del aporte');
} else {
Message::Error('Ha fallado al actualizar el estado del aporte');
}
} else {
Message::Error('No se ha cambiado el estado');
}
throw new Redirection('/admin/accounts/details/' . $id);
}
return new View('view/admin/index.html.php', array('folder' => 'accounts', 'file' => 'update', 'invest' => $invest, 'status' => $status));
// fin de la historia actualizar estado
}
// resolviendo incidencias
if ($action == 'solve') {
// el aporte original
$invest = Model\Invest::get($id);
if (!$invest instanceof Model\Invest) {
Message::Error('No tenemos registro del aporte ' . $id);
throw new Redirection('/admin/accounts');
}
$projectData = Model\Project::getMini($invest->project);
$errors = array();
// primero cancelar
switch ($invest->method) {
case 'paypal':
$err = array();
if (Paypal::cancelPreapproval($invest, $err)) {
//.........这里部分代码省略.........
开发者ID:isbkch,项目名称:Goteo,代码行数:101,代码来源:accounts.php
示例14: invested
public static function invested($user, $publicOnly = true)
{
$projects = array();
$sql = "SELECT project.id\r\n FROM project\r\n INNER JOIN invest\r\n ON project.id = invest.project\r\n AND invest.user = ?\r\n AND invest.status IN ('0', '1', '3', '4')\r\n WHERE project.status < 7\r\n ";
if ($publicOnly) {
$sql .= "AND project.status >= 3\r\n ";
}
$sql .= "GROUP BY project.id\r\n ORDER BY name ASC\r\n ";
/*
* Restriccion de que no aparecen los que cofinancio que esten en edicion
* solamente no sacamos los caducados
* project.status > 1 AND
*/
$query = self::query($sql, array($user));
foreach ($query->fetchAll(\PDO::FETCH_CLASS) as $proj) {
$projects[] = \Goteo\Model\Project::getMedium($proj->id);
}
return $projects;
}
开发者ID:isbkch,项目名称:Goteo,代码行数:19,代码来源:user.php
示例15: isset
* Goteo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Goteo. If not, see <http://www.gnu.org/licenses/agpl.txt>.
*
*/
use Goteo\Library\Text, Goteo\Model;
$promo = $this['promo'];
$node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE;
// proyectos disponibles
// si tenemos ya proyecto seleccionado lo incluimos
$projects = Model\Promote::available($promo->project, $node);
$status = Model\Project::status();
?>
<form method="post" action="/admin/promote">
<input type="hidden" name="action" value="<?php
echo $this['action'];
?>
" />
<input type="hidden" name="order" value="<?php
echo $promo->order;
?>
" />
<input type="hidden" name="id" value="<?php
echo $promo->id;
?>
" />
开发者ID:anvnguyen,项目名称:Goteo,代码行数:30,代码来源:edit.html.php
示例16: doPay
public static function doPay($invest, &$errors = array())
{
try {
$project = Project::getMini($invest->project);
$userData = User::getMini($invest->user);
// Create request object
$payRequest = new \ExecutePaymentRequest();
$payRequest->payKey = $invest->payment;
$payRequest->requestEnvelope = 'SOAP';
// Create service wrapper object
$ap = new \AdaptivePayments();
// invoke business method on service wrapper passing in appropriate request params
$response = $ap->ExecutePayment($payRequest);
// Check response
if (strtoupper($ap->isSuccess) == 'FAILURE') {
$soapFault = $ap->getLastError();
if (is_array($soapFault->error)) {
$errorId = $soapFault->error[0]->errorId;
$errorMsg = $soapFault->error[0]->message;
} else {
$errorId = $soapFault->error->errorId;
$errorMsg = $soapFault->error->message;
}
if (is_array($soapFault->payErrorList->payError)) {
$errorId = $soapFault->payErrorList->payError[0]->error->errorId;
$errorMsg = $soapFault->payErrorList->payError[0]->error->message;
}
// tratamiento de errores
switch ($errorId) {
case '569013':
// preapproval cancelado por el usuario desde panel paypal
// preapproval cancelado por el usuario desde panel paypal
case '539012':
// preapproval no se llegó a autorizar
if ($invest->cancel()) {
$action = 'Aporte cancelado';
// Evento Feed
$log = new Feed();
$log->setTarget($project->id);
$log->populate('Aporte cancelado por preaproval cancelado por el usuario paypal', '/admin/invests', \vsprintf('Se ha <span class="red">Cancelado</span> el aporte de %s de %s (id: %s) al proyecto %s del dia %s por preapproval cancelado', array(Feed::item('user', $userData->name, $userData->id), Feed::item('money', $invest->amount . ' €'), Feed::item('system', $invest->id), Feed::item('project', $project->name, $project->id), Feed::item('system', date('d/m/Y', strtotime($invest->invested))))));
$log->doAdmin('system');
unset($log);
}
break;
}
if (empty($errorId)) {
$errors[] = 'NO es soapFault pero no es Success: <pre>' . print_r($ap, 1) . '</pre>';
@mail(\GOTEO_FAIL_MAIL, 'Error en implementacion Paypal API', 'ERROR en ' . __FUNCTION__ . ' No es un soap fault pero no es un success.<br /><pre>' . print_r($ap, 1) . '</pre>');
} else {
$errors[] = "{$action} {$errorMsg} [{$errorId}]";
}
return false;
}
// verificar el campo paymentExecStatus
if ($response->paymentExecStatus == 'COMPLETED') {
if ($invest->setStatus('3')) {
return true;
} else {
$errors[] = "Obtenido estatus de ejecución {$response->paymentExecStatus} pero no se ha actualizado el registro de aporte id {$invest->id}.";
@mail(\GOTEO_FAIL_MAIL, 'Error al actualizar registro aporte (setStatus)', 'ERROR en ' . __FUNCTION__ . ' Metodo paypal::setStatus ha fallado.<br /><pre>' . print_r($response, 1) . '</pre>');
return false;
}
} else {
$errors[] = 'No se ha completado el pago encadenado, no se ha pagado al proyecto.';
@mail(\GOTEO_FAIL_MAIL, 'Error fatal en comunicacion Paypal API', 'ERROR en ' . __FUNCTION__ . ' aporte id ' . $invest->id . '. No payment exec status completed.<br /><pre>' . print_r($response, 1) . '</pre>');
return false;
}
} catch (Exception $e) {
$fault = new \FaultMessage();
$errorData = new \ErrorData();
$errorData->errorId = $ex->getFile();
$errorData->message = $ex->getMessage();
$fault->error = $errorData;
$errors[] = 'No se ha podido inicializar la comunicación con Paypal, se ha reportado la incidencia.';
@mail(\GOTEO_FAIL_MAIL, 'Error fatal en comunicacion Paypal API', 'ERROR en ' . __FUNCTION__ . '<br />No se ha podido inicializar la comunicación con Paypal.<br /><pre>' . print_r($fault, 1) . '</pre>');
return false;
}
}
开发者ID:anvnguyen,项目名称:Goteo,代码行数:78,代码来源:paypal.php
示例17: view
private function view($id, $show, $post = null)
{
$project = Model\Project::get($id, LANG);
// recompensas
foreach ($project->individual_rewards as &$reward) {
$reward->none = false;
$reward->taken = $reward->getTaken();
// cofinanciadores quehan optado por esta recompensas
// si controla unidades de esta recompensa, mirar si quedan
if ($reward->units > 0 && $reward->taken >= $reward->units) {
$reward->none = true;
}
}
// mensaje cuando, sin estar en campaña, tiene fecha de publicación, es que la campaña ha sido cancelada
if ($project->status < 3 && !empty($project->published)) {
Message::Info(Text::get('project-unpublished'));
} elseif ($project->status < 3) {
// mensaje de no publicado siempre que no esté en campaña
Message::Info(Text::get('project-not_published'));
}
// solamente se puede ver publicamente si...
$grant = false;
if ($project->status > 2) {
// está publicado
$grant = true;
} elseif ($project->owner == $_SESSION['user']->id) {
// es el dueño
$grant = true;
} elseif (ACL::check('/project/edit/todos')) {
// es un admin
$grant = true;
} elseif (ACL::check('/project/view/todos')) {
// es un usuario con permiso
$grant = true;
} elseif (isset($_SESSION['user']->roles['checker']) && Model\User\Review::is_assigned($_SESSION['user']->id, $project->id)) {
// es un revisor y lo tiene asignado
$grant = true;
}
// (Callsys)
// si lo puede ver
if ($grant) {
$viewData = array('project' => $project, 'show' => $show);
// sus entradas de novedades
$blog = Model\Blog::get($project->id);
// si está en modo preview, ponemos todas las entradas, incluso las no publicadas
if (isset($_GET['preview']) && $_GET['preview'] == $_SESSION['user']->id) {
$blog->posts = Model\Blog\Post::getAll($blog->id, null, false);
}
$viewData['blog'] = $blog;
// tenemos que tocar esto un poquito para motrar las necesitades no economicas
if ($show == 'needs-non') {
$viewData['show'] = 'needs';
$viewData['non-economic'] = true;
}
// -- Mensaje azul molesto para usuarios no registrados
if (($show == 'messages' || $show == 'updates') && empty($_SESSION['user'])) {
Message::Info(Text::html('user-login-required'));
}
//tenemos que tocar esto un poquito para gestionar los pasos al aportar
if ($show == 'invest') {
// si no está en campaña no pueden estar aqui ni de coña
if ($project->status != 3) {
Message::Info(Text::get('project-invest-closed'));
throw new Redirection('/project/' . $id, Redirection::TEMPORARY);
}
$viewData['show'] = 'supporters';
/* pasos de proceso aporte
*
* 1, 'start': ver y seleccionar recompensa (y cantidad)
* 2, 'login': loguear con usuario/contraseña o con email (que crea el usuario automáticamente)
* 3, 'confirm': confirmar los datos y saltar a la pasarela de pago
* 4, 'ok'/'fail': al volver de la pasarela de pago, la confirmación nos dice si todo bien o algo mal
* 5, 'continue': recuperar aporte incompleto (variante de confirm)
*/
// usamos la variable de url $post para movernos entre los pasos
$step = isset($post) && in_array($post, array('start', 'login', 'confirm', 'continue')) ? $post : 'start';
// si llega confirm ya ha terminado el proceso de aporte
if (isset($_GET['confirm']) && \in_array($_GET['confirm'], array('ok', 'fail'))) {
unset($_SESSION['invest-amount']);
// confirmación
$step = $_GET['confirm'];
} else {
// si no, a ver en que paso estamos
if (isset($_GET['amount'])) {
$_SESSION['invest-amount'] = $_GET['amount'];
}
// si el usuario está validado, recuperamos posible amount y mostramos
if ($_SESSION['user'] instanceof Model\User) {
$step = 'confirm';
} elseif ($step != 'start' && empty($_SESSION['user'])) {
// si no está validado solo puede estar en start
Message::Info(Text::get('user-login-required-to_invest'));
$step = 'start';
} elseif ($step == 'start') {
// para cuando salte
$_SESSION['jumpto'] = SEC_URL . '/project/' . $id . '/invest/#continue';
} else {
$step = 'start';
}
}
//.........这里部分代码省略.........
开发者ID:nguyendev,项目名称:LoveSharing,代码行数:101,代码来源:project.php
示例18: View
* Goteo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Goteo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Goteo. If not, see <http://www.gnu.org/licenses/agpl.txt>.
*
*/
use Goteo\Core\View, Goteo\Model\Project, Goteo\Library\Text;
$projects = Goteo\Model\Project::published("available");
// random y que solo pinte seis si hubiera más
?>
<div class="widget projects">
<h2 class="title">プロジェクト<?php
//echo Text::get('home-projects-header');
?>
</h2>
<?php
foreach ($projects as $project) {
?>
<?php
echo new View('view/project/widget/project.html.php', array('project' => $project));
开发者ID:kenjs,项目名称:Goteo,代码行数:31,代码来源:available.html.php
示例19: Projects
public static function Projects($debug = false)
{
// proyectos a notificar
$projects = Model\Project::review();
// para cada uno,
foreach ($projects as $project) {
// por ahora solo tratamos los de primera ronda y hasta 2 meses tras la financiación
if ($project->days > 40 || $project->days > 360) {
|
请发表评论