public static function process($action = 'list', $id = null) { $node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE; $feed = empty($_GET['feed']) ? 'all' : $_GET['feed']; $items = Feed::getAll($feed, 'admin', 50, $node); return new View('view/admin/index.html.php', array('folder' => 'recent', 'file' => $action, 'feed' => $feed, 'items' => $items)); }
public function index($show = 'activity', $category = null) { if (defined('GOTEO_EASY') && \GOTEO_EASY === true) { throw new Redirection('/'); } $page = Page::get('community'); $items = array(); $shares = array(); if (!in_array($show, array('sharemates', 'activity'))) { $show = 'activity'; } $viewData = array('description' => $page->description, 'show' => $show); switch ($show) { // compartiendo intereses global case 'sharemates': $categories = Interest::getAll(); foreach ($categories as $catId => $catName) { $gente = Interest::shareAll($catId); if (count($gente) == 0) { continue; } $shares[$catId] = $gente; } $viewData['category'] = $category; $viewData['categories'] = $categories; $viewData['shares'] = $shares; // top ten cofinanciadores en Goteo $projects = Invest::projects(true); $investors = array(); foreach ($projects as $projectId => $projectName) { foreach (Invest::investors($projectId) as $key => $investor) { if (\array_key_exists($investor->user, $investors)) { // si es otro proyecto y ya está en el array, añadir uno if ($investors[$investor->user]->lastproject != $projectId) { ++$investors[$investor->user]->projects; $investors[$investor->user]->lastproject = $projectId; } $investors[$investor->user]->amount += $investor->amount; $investors[$investor->user]->date = $investor->date; } else { $investors[$investor->user] = (object) array('user' => $investor->user, 'name' => $investor->name, 'projects' => 1, 'lastproject' => $projectId, 'avatar' => $investor->avatar, 'worth' => $investor->worth, 'amount' => $investor->amount, 'date' => $investor->date); } } } $viewData['investors'] = $investors; break; // feed público // feed público case 'activity': $items = array(); $items['goteo'] = Feed::getAll('goteo', 'public', 50); $items['projects'] = Feed::getAll('projects', 'public', 50); $items['community'] = Feed::getAll('community', 'public', 50); $viewData['items'] = $items; break; } return new View('view/community.html.php', $viewData); }
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)); }
?> <?php if (!empty($this['folder']) && !empty($this['file'])) { if ($this['folder'] == 'base') { $path = 'view/admin/' . $this['file'] . '.html.php'; } else { $path = 'view/admin/' . $this['folder'] . '/' . $this['file'] . '.html.php'; } echo new View($path, $this); } else { /* PORTADA ADMIN */ $node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE; $feed = empty($_GET['feed']) ? 'all' : $_GET['feed']; $items = Feed::getAll($feed, 'admin', 50); // Central pendientes ?> <div class="widget admin-home"> <h3 class="title"><?php echo Text::_("Tareas pendientes"); ?> </h3> <?php if (!empty($this['tasks'])) { ?> <table> <?php foreach ($this['tasks'] as $task) { ?> <tr>