本文整理汇总了PHP中Goteo\Model\Project::status方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::status方法的具体用法?PHP Project::status怎么用?PHP Project::status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Goteo\Model\Project
的用法示例。
在下文中一共展示了Project::status方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activity
public function activity($option = 'summary', $action = 'view')
{
// quitamos el stepped para que no nos lo coja para el siguiente proyecto que editemos
if (isset($_SESSION['stepped'])) {
unset($_SESSION['stepped']);
}
$user = $_SESSION['user'];
$viewData = array('menu' => self::menu(), 'section' => __FUNCTION__, 'option' => $option, 'action' => $action);
// portada
if ($option == 'summary') {
$page = Page::get('dashboard');
$viewData['message'] = \str_replace('%USER_NAME%', $_SESSION['user']->name, $page->content);
$viewData['lists'] = Dashboard\Activity::projList($user);
$viewData['status'] = Model\Project::status();
}
//@TODO: if ($option == 'wall') Dashboard\Activity::wall($user);
// si es un salto a otro panel
if (in_array($option, array('admin', 'review', 'translate'))) {
if (ACL::check('/' . $option)) {
throw new Redirection('/' . $option, Redirection::TEMPORARY);
} else {
throw new Redirection('/dashboard', Redirection::TEMPORARY);
}
}
return new View('view/dashboard/index.html.php', $viewData);
}
示例2: 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;
}
示例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;
}
示例4: 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);
}
示例5: process
public static function process($action = 'list', $id = null, $filters = array())
{
switch ($action) {
case 'fulfill':
$sql = "UPDATE invest_reward SET fulfilled = 1 WHERE invest = ?";
if (Model\Invest::query($sql, array($id))) {
Message::Info(Text::get('admin-rewards-info-status-completed'));
} else {
Message::Error(Text::get('admin-rewards-error-statuschage-fail'));
}
throw new Redirection('/admin/rewards');
break;
case 'unfill':
$sql = "UPDATE invest_reward SET fulfilled = 0 WHERE invest = ?";
if (Model\Invest::query($sql, array($id))) {
Message::Info(Text::get('admin-rewards-info-status-completed-pending'));
} else {
message::Error('Ha fallado al desmarcar');
}
throw new Redirection('/admin/rewards');
break;
}
// edicion
if ($action == 'edit' && !empty($id)) {
$invest = Model\Invest::get($id);
$projectData = Model\Project::get($invest->project);
$userData = Model\User::getMini($invest->user);
$status = Model\Project::status();
// si tratando post
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
$errors = array();
// la recompensa:
$chosen = $_POST['selected_reward'];
if (empty($chosen)) {
// renuncia a las recompensas, bien por el/ella!
$invest->rewards = array();
} else {
$invest->rewards = array($chosen);
}
$invest->anonymous = $_POST['anonymous'];
// dirección de envio para la recompensa
// y datos fiscales por si fuera donativo
$invest->address = (object) array('name' => $_POST['name'], 'nif' => $_POST['nif'], 'address' => $_POST['address'], 'zipcode' => $_POST['zipcode'], 'location' => $_POST['location'], 'country' => $_POST['country']);
if ($invest->update($errors)) {
Message::Info(Text::get('admin-rewards-info-update'));
throw new Redirection('/admin/rewards');
} else {
Message::Error('No se han actualizado correctamente los datos del aporte. ERROR: ' . implode(', ', $errors));
}
}
return new View('view/admin/index.html.php', array('folder' => 'rewards', 'file' => 'edit', 'invest' => $invest, 'project' => $projectData, 'user' => $userData, 'status' => $status));
}
// listado de proyectos
$projects = Model\Invest::projects();
$status = array('nok' => Text::_("Pendiente"), 'ok' => Text::_("Cumplida"));
// listado de aportes
if ($filters['filtered'] == 'yes') {
$list = Model\Project\Reward::getChossen($filters);
} else {
$list = array();
}
return new View('view/admin/index.html.php', array('folder' => 'rewards', 'file' => 'list', 'list' => $list, 'filters' => $filters, 'projects' => $projects, 'status' => $status));
}
示例6: 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)) {
//.........这里部分代码省略.........
示例7: 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;
?>
" />
示例8: process
public static function process($action = 'list', $id = null, $filters = array())
{
$log_text = null;
$errors = array();
// multiples usos
$nodes = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['id'])) {
$projData = Model\Project::get($_POST['id']);
if (empty($projData->id)) {
Message::Error('El proyecto ' . $_POST['id'] . ' no existe');
throw new Redirection('/admin/projects/images/' . $id);
}
if (isset($_POST['save-dates'])) {
$fields = array('created', 'updated', 'published', 'success', 'closed', 'passed');
$set = '';
$values = array(':id' => $projData->id);
foreach ($fields as $field) {
if ($set != '') {
$set .= ", ";
}
$set .= "`{$field}` = :{$field} ";
if (empty($_POST[$field]) || $_POST[$field] == '0000-00-00') {
$_POST[$field] = null;
}
$values[":{$field}"] = $_POST[$field];
}
try {
$sql = "UPDATE project SET " . $set . " WHERE id = :id";
if (Model\Project::query($sql, $values)) {
$log_text = 'El admin %s ha <span class="red">tocado las fechas</span> del proyecto ' . $projData->name . ' %s';
} else {
$log_text = 'Al admin %s le ha <span class="red">fallado al tocar las fechas</span> del proyecto ' . $projData->name . ' %s';
}
} catch (\PDOException $e) {
Message::Error(Text::_("No se ha guardado correctamente. ") . $e->getMessage());
}
} elseif (isset($_POST['save-accounts'])) {
$accounts = Model\Project\Account::get($projData->id);
$accounts->bank = $_POST['bank'];
$accounts->bank_owner = $_POST['bank_owner'];
$accounts->paypal = $_POST['paypal'];
$accounts->paypal_owner = $_POST['paypal_owner'];
if ($accounts->save($errors)) {
Message::Info(Text::_('Se han actualizado las cuentas del proyecto ') . $projData->name);
} else {
Message::Error(implode('<br />', $errors));
}
} elseif ($action == 'images') {
$todook = true;
if (!empty($_POST['move'])) {
$direction = $_POST['action'];
Model\Project\Image::$direction($id, $_POST['move'], $_POST['section']);
}
foreach ($_POST as $key => $value) {
$parts = explode('_', $key);
if ($parts[1] == 'image' && in_array($parts[0], array('section', 'url'))) {
if (Model\Project\Image::update($id, $parts[2], $parts[0], $value)) {
// OK
} else {
$todook = false;
Message::Error(Text::_('No se ha podido actualizar campo') . " {$parts[0]} -> {$value}");
}
}
}
if ($todook) {
Message::Info(Text::_('Se han actualizado los datos'));
}
throw new Redirection('/admin/projects/images/' . $id);
} elseif ($action == 'rebase') {
$todook = true;
if ($_POST['proceed'] == 'rebase' && !empty($_POST['newid'])) {
$newid = $_POST['newid'];
// pimero miramos que no hay otro proyecto con esa id
$test = Model\Project::getMini($newid);
if ($test->id == $newid) {
Message::Error(Text::_('Ya hay un proyecto con ese Id.'));
throw new Redirection('/admin/projects/rebase/' . $id);
}
if ($projData->status >= 3 && $_POST['force'] != 1) {
Message::Error(Text::_('El proyecto no está ni en Edición ni en Revisión, no se modifica nada.'));
throw new Redirection('/admin/projects/rebase/' . $id);
}
if ($projData->rebase($newid)) {
Message::Info(Text::_('Verificar el proyecto') . ' -> <a href="' . SITE_URL . '/project/' . $newid . '" target="_blank">' . $projData->name . '</a>');
throw new Redirection('/admin/projects');
} else {
Message::Info(Text::_('Ha fallado algo en el rebase, verificar el proyecto') . ' -> <a href="' . SITE_URL . '/project/' . $projData->id . '" target="_blank">' . $projData->name . ' (' . $id . ')</a>');
throw new Redirection('/admin/projects/rebase/' . $id);
}
}
}
}
/*
* switch action,
* proceso que sea,
* redirect
*
*/
if (isset($id)) {
$project = Model\Project::get($id);
//.........这里部分代码省略.........
示例9: if
}
?>
<div class="widget">
<p><strong><?php echo $project->name ?></strong></p>
<a class="button red" href="/project/edit/<?php echo $project->id ?>"><?php echo Text::get('regular-edit') ?></a>
<a class="button" href="/project/<?php echo $project->id ?>" target="_blank"><?php echo Text::get('dashboard-menu-projects-preview') ?></a>
<?php if ($project->status == 1) : ?>
<a class="button weak" href="/project/delete/<?php echo $project->id ?>" onclick="return confirm('<?php echo Text::get('dashboard-project-delete_alert') ?>')"><?php echo Text::get('regular-delete') ?></a>
<?php endif ?>
</div>
<div class="status">
<div id="project-status">
<h3><?php echo Text::get('form-project-status-title'); ?></h3>
<ul>
<?php foreach (Project::status() as $i => $s): ?>
<li><?php if ($i == $project->status) echo '<strong>' ?><?php echo htmlspecialchars($s) ?><?php if ($i == $project->status) echo '</strong>' ?></li>
<?php endforeach ?>
</ul>
</div>
</div>
<div id="meter-big" class="widget collapsable">
<?php echo new View('view/m/project/meter_hor_big.html.php', $this) ?>
</div>
示例10: process
public static function process($action = 'list', $id = null, $filters = array())
{
// año fiscal
$year = Model\User\Donor::$currYear;
$year0 = $year;
$year1 = $year - 1;
$errors = array();
$node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE;
// Valores de filtro
$interests = Model\User\Interest::getAll();
$status = Model\Project::status();
$methods = Model\Invest::methods();
$types = array('investor' => 'Cofinanciadores', 'owner' => 'Autores', 'user' => 'Usuarios');
$roles = array('admin' => 'Administrador', 'checker' => 'Revisor', 'translator' => 'Traductor');
// una variable de sesion para mantener los datos de todo esto
if (!isset($_SESSION['mailing'])) {
$_SESSION['mailing'] = array();
}
switch ($action) {
case 'edit':
$_SESSION['mailing']['receivers'] = array();
$values = array();
$sqlFields = '';
$sqlInner = '';
$sqlFilter = '';
// cargamos los destiantarios
//----------------------------
// por tipo de usuario
switch ($filters['type']) {
case 'investor':
$sqlInner .= "INNER JOIN invest\n ON invest.user = user.id\n AND (invest.status = 0 OR invest.status = 1 OR invest.status = 3 OR invest.status = 4)\n INNER JOIN project\n ON project.id = invest.project\n ";
$sqlFields .= ", project.name as project";
$sqlFields .= ", project.id as projectId";
break;
case 'owner':
$sqlInner .= "INNER JOIN project\n ON project.owner = user.id\n ";
$sqlFields .= ", project.name as project";
$sqlFields .= ", project.id as projectId";
break;
default:
break;
}
$_SESSION['mailing']['filters_txt'] = 'los <strong>' . $types[$filters['type']] . '</strong> ';
if (!empty($filters['project']) && !empty($sqlInner)) {
$sqlFilter .= " AND project.name LIKE (:project) ";
$values[':project'] = '%' . $filters['project'] . '%';
$_SESSION['mailing']['filters_txt'] .= 'de proyectos que su nombre contenga <strong>\'' . $filters['project'] . '\'</strong> ';
} elseif (empty($filters['project']) && !empty($sqlInner)) {
$_SESSION['mailing']['filters_txt'] .= 'de cualquier proyecto ';
}
if (isset($filters['status']) && $filters['status'] > -1 && !empty($sqlInner)) {
$sqlFilter .= "AND project.status = :status ";
$values[':status'] = $filters['status'];
$_SESSION['mailing']['filters_txt'] .= 'en estado <strong>' . $status[$filters['status']] . '</strong> ';
} elseif ($filters['status'] < 0 && !empty($sqlInner)) {
$_SESSION['mailing']['filters_txt'] .= 'en cualquier estado ';
}
if ($filters['type'] == 'investor') {
if (!empty($filters['method']) && !empty($sqlInner)) {
$sqlFilter .= "AND invest.method = :method ";
$values[':method'] = $filters['method'];
$_SESSION['mailing']['filters_txt'] .= 'mediante <strong>' . $methods[$filters['method']] . '</strong> ';
} elseif (empty($filters['method']) && !empty($sqlInner)) {
$_SESSION['mailing']['filters_txt'] .= 'mediante cualquier metodo ';
}
}
if (!empty($filters['interest'])) {
$sqlInner .= "INNER JOIN user_interest\n ON user_interest.user = user.id\n AND user_interest.interest = :interest\n ";
$values[':interest'] = $filters['interest'];
if ($filters['interest'] == 15) {
$_SESSION['mailing']['filters_txt'] .= 'del grupo de testeo ';
} else {
$_SESSION['mailing']['filters_txt'] .= 'interesados en fin <strong>' . $interests[$filters['interest']] . '</strong> ';
}
}
if (!empty($filters['role'])) {
$sqlInner .= "INNER JOIN user_role\n ON user_role.user_id = user.id\n AND user_role.role_id = :role\n ";
$values[':role'] = $filters['role'];
$_SESSION['mailing']['filters_txt'] .= 'que sean <strong>' . $roles[$filters['role']] . '</strong> ';
}
if (!empty($filters['name'])) {
$sqlFilter .= " AND ( user.name LIKE (:name) OR user.email LIKE (:name) ) ";
$values[':name'] = '%' . $filters['name'] . '%';
$_SESSION['mailing']['filters_txt'] .= 'que su nombre o email contenga <strong>\'' . $filters['name'] . '\'</strong> ';
}
if (!empty($filters['donant'])) {
if ($filters['type'] == 'investor') {
$sqlFilter .= " AND invest.resign = 1\n AND invest.status IN (1, 3)\n AND invest.charged >= '{$year0}-01-01'\n AND invest.charged < '{$year1}-01-01'\n AND (project.passed IS NOT NULL AND project.passed != '0000-00-00')\n ";
$_SESSION['mailing']['filters_txt'] .= 'que haya hecho algun donativo ';
} else {
Message::Error('Solo se filtran donantes si se envia "A los: Cofinanciadores"');
}
}
if ($node != \GOTEO_NODE) {
$sqlFilter .= " AND user.node = :node";
$values[':node'] = $node;
if (!empty($sqlInner)) {
$sqlFilter .= " AND project.node = :node";
}
}
//.........这里部分代码省略.........
示例11: 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');
if ($action == 'csv') {
$invest = Model\Invest::getPreapproval($id);
foreach ($invest as $value) {
$csv[] = array($value->id, $value->amount);
}
$fileName = "axes_" . date("YmdHis") . ".csv";
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-type: application/octet-stream");
header("Pragma: no-cache");
header("Expires: 0");
$fp = fopen('php://output', 'w');
foreach ($csv as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
exit;
}
if ($action == 'dopay') {
$query = \Goteo\Core\Model::query("\n SELECT *\n FROM invest\n WHERE invest.project = ?\n AND (invest.status = 0\n OR (invest.method = 'tpv'\n AND invest.status = 1\n )\n OR (invest.method = 'cash'\n AND invest.status = 1\n )\n )\n AND (invest.campaign IS NULL OR invest.campaign = 0)\n ", array($id));
$invests = $query->fetchAll(\PDO::FETCH_CLASS, '\\Goteo\\Model\\Invest');
foreach ($invests as $key => $invest) {
if ($invest->setPayment(date("YmdHis"))) {
$invest->setStatus(1);
Model\Invest::setDetail($invest->id, 'executed', 'Preapproval has been executed, has initiated the chained payment. Process cron / execute');
if ($invest->issue) {
Model\Invest::unsetIssue($invest->id);
Model\Invest::setDetail($invest->id, 'issue-solved', 'The incidence has been resolved upon success by the automatic process');
}
}
}
Message::Info("処理しました");
throw new Redirection('/admin/projects/list');
exit;
}
// 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);
}
示例12: htmlspecialchars
</a>
<?php
}
?>
</div>
<div class="status">
<div id="project-status">
<h3><?php
echo Text::get('form-project-status-title');
?>
</h3>
<ul>
<?php
foreach (Project::status() as $i => $s) {
?>
<li><?php
if ($i == $project->status) {
echo '<strong>';
}
echo htmlspecialchars($s);
if ($i == $project->status) {
echo '</strong>';
}
?>
</li>
<?php
}
?>
</ul>