public static function process($action = 'list', $id = null, $filters = array()) { $groups = Model\Icon::groups(); $errors = array(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { // instancia $icon = new Model\Icon(array('id' => $_POST['id'], 'name' => $_POST['name'], 'description' => $_POST['description'], 'order' => $_POST['order'], 'group' => empty($_POST['group']) ? null : $_POST['group'])); if ($icon->save($errors)) { switch ($_POST['action']) { case 'add': Message::Info('Nuevo tipo añadido correctamente'); break; case 'edit': Message::Info('Tipo editado correctamente'); // Evento Feed $log = new Feed(); $log->populate('modificacion de tipo de retorno/recompensa (admin)', '/admin/icons', \vsprintf("El admin %s ha %s el tipo de retorno/recompensa %s", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Modificado'), Feed::item('project', $icon->name)))); $log->doAdmin('admin'); unset($log); break; } } else { Message::Error(implode('<br />', $errors)); return new View('view/admin/index.html.php', array('folder' => 'icons', 'file' => 'edit', 'action' => $_POST['action'], 'icon' => $icon, 'groups' => $groups)); } } switch ($action) { case 'edit': $icon = Model\Icon::get($id); return new View('view/admin/index.html.php', array('folder' => 'icons', 'file' => 'edit', 'action' => 'edit', 'icon' => $icon, 'groups' => $groups)); break; } $icons = Model\Icon::getAll($filters['group']); return new View('view/admin/index.html.php', array('folder' => 'icons', 'file' => 'list', 'icons' => $icons, 'groups' => $groups, 'filters' => $filters)); }
public static function process($action = 'list', $id = null, $filters = array()) { // agrupaciones de mas a menos abertas $groups = Model\License::groups(); // tipos de retorno para asociar $icons = Model\Icon::getAll('social'); $errors = array(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { // objeto $license = new Model\License(array('id' => $_POST['id'], 'name' => $_POST['name'], 'description' => $_POST['description'], 'url' => $_POST['url'], 'group' => $_POST['group'], 'order' => $_POST['order'], 'icons' => $_POST['icons'])); if ($license->save($errors)) { switch ($_POST['action']) { case 'add': Message::Info(Text::get('admin-licenses-info-add')); break; case 'edit': Message::Info(Text::get('admin-licenses-info-edit')); // Evento Feed $log = new Feed(); $log->populate('modificacion de licencia (admin)', '/admin/licenses', \vsprintf("El admin %s ha %s la licencia %s", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Modificado'), Feed::item('project', $license->name)))); $log->doAdmin('admin'); unset($log); break; } } else { Message::Error(implode('<br />', $errors)); return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => $_POST['action'], 'license' => $license, 'icons' => $icons, 'groups' => $groups)); } } switch ($action) { case 'up': Model\License::up($id); break; case 'down': Model\License::down($id); break; case 'add': $next = Model\License::next(); return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => 'add', 'license' => (object) array('order' => $next, 'icons' => array()), 'icons' => $icons, 'groups' => $groups)); break; case 'edit': $license = Model\License::get($id); return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'edit', 'action' => 'edit', 'license' => $license, 'icons' => $icons, 'groups' => $groups)); break; case 'remove': // Model\License::delete($id); break; } $licenses = Model\License::getAll($filters['icon'], $filters['group']); return new View('view/admin/index.html.php', array('folder' => 'licenses', 'file' => 'list', 'licenses' => $licenses, 'filters' => $filters, 'groups' => $groups, 'icons' => $icons)); }
* * 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\Model\Category, Goteo\Model\Icon, Goteo\Library\Location, Goteo\Library\Text; $categories = Category::getList(); // categorias que se usan en proyectos $locations = Location::getList(); //localizaciones de royectos $rewards = Icon::getList(); // iconos que se usan en proyectos $params = $this['params']; ?> <div class="widget searcher"> <form method="post" action="/discover/results"> <div class="text-filter"> <label for="text-query"><?php echo Text::get('discover-searcher-bycontent-header'); ?> </label> <input type="text" id="text-query" name="query" size="48" value="<?php echo \htmlspecialchars($params['query']); ?> " /> <br clear="all" />
public static function icons($type = 'social') { $list = array(); $icons = Icon::getAll($type); foreach ($icons as $icon) { $list[$icon->id] = $icon; } return $list; }
public function projects($option = 'summary', $action = 'list', $id = null) { $user = $_SESSION['user']; $errors = array(); // verificación de proyectos y proyecto de trabajo list($project, $projects) = Dashboard\Projects::verifyProject($user, $action); // teniendo proyecto de trabajo, comprobar si el proyecto esta en estado de tener blog if ($option == 'updates') { $blog = Dashboard\Projects::verifyBlog($project); } // sacaexcel de cofinanciadores if ($option == 'rewards' && $action == 'table') { $response = new \Goteo\Controller\Sacaexcel(); return $response->index('investors', $project->id); } // ojo si no tiene retornos if ($option == 'commons' && empty($project->social_rewards)) { Message::Error('Este proyecto no tiene retornos colectivos'); throw new Redirection('/dashboard/projects/'); } // procesamiento de formularios if ($_SERVER['REQUEST_METHOD'] == 'POST') { switch ($option) { // gestionar retornos (o mensaje a los mensajeros) case 'messegers': case 'rewards': // sacamos del post el filtro y el orden if ($action == 'filter') { $_SESSION['dashboard-rewards-filter'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['dashboard-rewards-filter']; $_SESSION['dashboard-rewards-order'] = isset($_POST['order']) ? $_POST['order'] : $_SESSION['dashboard-rewards-order']; } //procesamos el envio de mails if ($action == 'message') { Dashboard\Projects::process_mailing($option, $project); // y lo devolvemos a donde estaba throw new Redirection('/dashboard/projects/' . $option); } break; // colaboraciones // colaboraciones case 'supports': if ($action == 'save') { $project = Dashboard\Projects::process_supports($project, $errors); } break; case 'updates': // verificación: si no llega blog correcto no lo procesamos if (empty($_POST['blog']) || $_POST['blog'] != $blog->id) { throw new Redirection('/dashboard/projects/summary'); } list($action, $id) = Dashboard\Projects::process_updates($action, $project, $errors); break; } } // SubControlador para add, edit, delete y list // devuelve $post en las acciones add y edit y $posts en delete y list // maneja por referencia $action, $posts y $errors if ($option == 'updates') { list($post, $posts) = Dashboard\Projects::prepare_updates($action, $id, $blog->id); } // view data basico para esta seccion $viewData = array('menu' => self::menu(), 'section' => __FUNCTION__, 'option' => $option, 'action' => $action, 'projects' => $projects, 'errors' => $errors); switch ($option) { case 'summary': // los datos json de invests y visitors_data $viewData['data'] = Dashboard\Projects::graph($project->id); break; // gestionar recompensas // gestionar recompensas case 'rewards': // recompensas ofrecidas $viewData['rewards'] = Model\Project\Reward::getAll($project->id, 'individual', LANG); // aportes para este proyecto $viewData['invests'] = Model\Invest::getAll($project->id); // ver por (esto son orden y filtros) $viewData['filter'] = $_SESSION['dashboard-rewards-filter']; $viewData['order'] = $_SESSION['dashboard-rewards-order']; break; // gestionar retornos // gestionar retornos case 'commons': $icons = Model\Icon::getAll('social'); foreach ($icons as $key => $icon) { $icons[$key] = $icon->name; } $viewData['icons'] = $icons; break; // listar mensajeadores // listar mensajeadores case 'messegers': $viewData['messegers'] = Model\Message::getMessegers($project->id); break; // editar colaboraciones // editar colaboraciones case 'supports': $viewData['types'] = Model\Project\Support::types(); // para mantener registros desplegados if ($_POST) { foreach ($_POST as $k => $v) { if (!empty($v) && preg_match('/support-(\\d+)-edit/', $k, $r)) { $viewData[$k] = true; break; } } } if (!empty($_POST['support-add'])) { $last = end($project->supports); if ($last !== false) { $viewData['support-' . $last->id . '-edit'] = true; } } $project->supports = Model\Project\Support::getAll($project->id); break; // publicar actualizaciones // publicar actualizaciones case 'updates': $viewData['blog'] = $blog; $viewData['posts'] = $posts; $viewData['post'] = $post; break; } $viewData['project'] = $project; return new View('view/dashboard/index.html.php', $viewData); }
* 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\Model\Category, Goteo\Model\Skill, Goteo\Model\Icon, Goteo\Library\Location, Goteo\Library\Text; $categories = Category::getList(); // categorias que se usan en proyectos $locations = Location::getList(); //localizaciones de royectos $rewards = Icon::getList(); // iconos que se usan en proyectos $skills = Skill::getList(); // スキル取得 $params = $this['params']; ?> <div class="widget searcher"> <form method="post" action="/discover/results"> <div class="text-filter"> <label for="text-query"><?php echo Text::get('discover-searcher-bycontent-header'); ?></label> <input type="text" id="text-query" name="query" size="48" value="<?php echo \htmlspecialchars($params['query']); ?>" /> <br clear="all" /> </div> <div class="filter"> <label for="skills"><?php echo Text::get('discover-searcher-byskill-header'); ?></label>