作者:kenj
项目:Gote
public static function process($action = 'list', $id = null)
{
$model = 'Goteo\\Model\\Blog\\Post\\Tag';
$url = '/admin/tags';
$errors = array();
switch ($action) {
case 'add':
return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => (object) array(), 'form' => array('action' => "{$url}/edit/", 'submit' => array('name' => 'update', 'label' => Text::_('Añadir')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'name' => array('label' => Text::_('Tag'), 'name' => 'name', 'type' => 'text')))));
break;
case 'edit':
// gestionar post
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
$errors = array();
// instancia
$item = new $model(array('id' => $_POST['id'], 'name' => $_POST['name']));
if ($item->save($errors)) {
Message::Info(Text::get('admin-tags-info-udate'));
throw new Redirection($url);
} else {
Message::Error(Text::get('admin-tags-error-save-fail') . implode('<br />', $errors));
}
} else {
$item = $model::get($id);
}
return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => $item, 'form' => array('action' => "{$url}/edit/{$id}", 'submit' => array('name' => 'update', 'label' => Text::get('regular-save')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'name' => array('label' => Text::_('Tag'), 'name' => 'name', 'type' => 'text')))));
break;
case 'remove':
if ($model::delete($id)) {
throw new Redirection($url);
}
break;
}
return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'list', 'model' => 'tag', 'addbutton' => Text::_('Nuevo tag'), 'data' => $model::getList(1), 'columns' => array('edit' => '', 'name' => Text::_('Tag'), 'used' => Text::_('Entradas'), 'translate' => '', 'remove' => ''), 'url' => "{$url}"));
}
作者:anvnguye
项目:Gote
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));
}
作者:kenj
项目:Gote
public static function process($action = 'list', $id = null, $filters = array())
{
$errors = array();
// valores de filtro
$groups = Template::groups();
switch ($action) {
case 'edit':
// si estamos editando una plantilla
$template = Template::get($id);
// si llega post, vamos a guardar los cambios
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$template->title = $_POST['title'];
$template->text = $_POST['text'];
if ($template->save($errors)) {
//Message::Info(Text::_('La plantilla se ha actualizado correctamente'));
throw new Redirection("/admin/templates");
} else {
Message::Error(Text::get('admin-templates-error-record-fail') . implode('<br />', $errors));
}
}
// sino, mostramos para editar
return new View('view/admin/index.html.php', array('folder' => 'templates', 'file' => 'edit', 'template' => $template));
break;
case 'list':
// si estamos en la lista de páginas
$templates = Template::getAll($filters);
return new View('view/admin/index.html.php', array('folder' => 'templates', 'file' => 'list', 'templates' => $templates, 'groups' => $groups, 'filters' => $filters));
break;
}
}
作者:anvnguye
项目:Gote
/**
* Suplantando al usuario
* @param string $id user->id
*/
public function index()
{
$admin = $_SESSION['user'];
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['id']) && !empty($_POST['impersonate'])) {
$impersonator = $_SESSION['user']->id;
session_unset();
$_SESSION['user'] = User::get($_POST['id']);
$_SESSION['impersonating'] = true;
$_SESSION['impersonator'] = $impersonator;
unset($_SESSION['admin_menu']);
/*
* Evento Feed
*/
// Evento Feed
$log = new Feed();
$log->setTarget($_SESSION['user']->id, 'user');
$log->populate('Suplantación usuario (admin)', '/admin/users', \vsprintf('El admin %s ha %s al usuario %s', array(Feed::item('user', $admin->name, $admin->id), Feed::item('relevant', 'Suplantado'), Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id))));
$log->doAdmin('user');
unset($log);
throw new Redirection('/dashboard');
} else {
Message::Error('Ha ocurrido un error');
throw new Redirection('/dashboard');
}
}
作者:anvnguye
项目:Gote
public static function process($action = 'list', $id = null)
{
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $action == 'edit') {
// instancia
$data = array('id' => $_POST['id'], 'name' => $_POST['name'], 'amount' => $_POST['amount']);
if (WorthLib::save($data, $errors)) {
$action = 'list';
Message::Info(Text::_('Nivel de meritocracia modificado'));
// Evento Feed
$log = new Feed();
$log->populate(Text::_('Nivel de meritocracia modificado'), '/admin/worth', \vsprintf("El admin %s ha %s el nivel de meritocrácia %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);
} else {
Message::Error(Text::_('No se ha guardado correctamente. ') . implode('<br />', $errors));
return new View('view/admin/index.html.php', array('folder' => 'worth', 'file' => 'edit', 'action' => 'edit', 'worth' => (object) $data));
}
}
switch ($action) {
case 'edit':
$worth = WorthLib::getAdmin($id);
return new View('view/admin/index.html.php', array('folder' => 'worth', 'file' => 'edit', 'action' => 'edit', 'worth' => $worth));
break;
}
$worthcracy = WorthLib::getAll();
return new View('view/admin/index.html.php', array('folder' => 'worth', 'file' => 'list', 'worthcracy' => $worthcracy));
}
作者:isbkc
项目:Gote
public static function process($action = 'list', $id = null, $filters = array(), $type = 'main')
{
//@NODESYS
$node = \GOTEO_NODE;
$type = 'main';
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// instancia
$item = new Model\Home(array('item' => $_POST['item'], 'type' => $_POST['type'], 'node' => $node, 'order' => $_POST['order'], 'move' => 'down'));
if ($item->save($errors)) {
} else {
Message::Error(implode('<br />', $errors));
}
}
switch ($action) {
case 'remove':
Model\Home::delete($id, $node, $type);
throw new Redirection('/admin/home');
break;
case 'up':
Model\Home::up($id, $node, $type);
throw new Redirection('/admin/home');
break;
case 'down':
Model\Home::down($id, $node, $type);
throw new Redirection('/admin/home');
break;
case 'add':
$next = Model\Home::next($node, 'main');
$availables = Model\Home::available($node);
if (empty($availables)) {
Message::Info(Text::_('Todos los elementos disponibles ya estan en portada'));
throw new Redirection('/admin/home');
break;
}
return new View('view/admin/index.html.php', array('folder' => 'home', 'file' => 'add', 'action' => 'add', 'home' => (object) array('node' => $node, 'order' => $next, 'type' => 'main'), 'availables' => $availables));
break;
case 'addside':
$next = Model\Home::next($node, 'side');
$availables = Model\Home::availableSide($node);
if (empty($availables)) {
Message::Info(Text::_('Todos los elementos laterales disponibles ya estan en portada'));
throw new Redirection('/admin/home');
break;
}
return new View('view/admin/index.html.php', array('folder' => 'home', 'file' => 'add', 'action' => 'add', 'home' => (object) array('node' => $node, 'order' => $next, 'type' => 'side'), 'availables' => $availables));
break;
}
$viewData = array('folder' => 'home', 'file' => 'list');
$viewData['items'] = Model\Home::getAll($node);
/* Para añadir nuevos desde la lista */
$viewData['availables'] = Model\Home::available($node);
$viewData['new'] = (object) array('node' => $node, 'order' => Model\Home::next($node, 'main'), 'type' => 'main');
// laterales
$viewData['side_items'] = Model\Home::getAllSide($node);
$viewData['side_availables'] = Model\Home::availableSide($node);
$viewData['side_new'] = (object) array('node' => $node, 'order' => Model\Home::next($node, 'side'), 'type' => 'side');
return new View('view/admin/index.html.php', $viewData);
}
作者:anvnguye
项目:Gote
public static function process($action = 'list', $id = null)
{
$node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE;
$model = 'Goteo\\Model\\Sponsor';
$url = '/admin/sponsors';
$errors = array();
switch ($action) {
case 'add':
return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => (object) array('order' => $model::next($node), 'node' => $node), 'form' => array('action' => "{$url}/edit/", 'submit' => array('name' => 'update', 'label' => Text::_('Añadir')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'node' => array('label' => '', 'name' => 'node', 'type' => 'hidden'), 'name' => array('label' => Text::_('Patrocinador'), 'name' => 'name', 'type' => 'text'), 'url' => array('label' => Text::_('Enlace'), 'name' => 'url', 'type' => 'text', 'properties' => 'size=100'), 'image' => array('label' => Text::_('Logo'), 'name' => 'image', 'type' => 'image'), 'order' => array('label' => Text::_('Posición'), 'name' => 'order', 'type' => 'text')))));
break;
case 'edit':
// gestionar post
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// instancia
$item = new $model(array('id' => $_POST['id'], 'name' => $_POST['name'], 'node' => $_POST['node'], 'image' => $_POST['image'], 'url' => $_POST['url'], 'order' => $_POST['order']));
// tratar si quitan la imagen
$current = $_POST['image'];
// la actual
if (isset($_POST['image-' . $current . '-remove'])) {
$image = Model\Image::get($current);
$image->remove('sponsor');
$item->image = '';
$removed = true;
}
// tratar la imagen y ponerla en la propiedad image
if (!empty($_FILES['image']['name'])) {
$item->image = $_FILES['image'];
}
if ($item->save($errors)) {
Message::Info(Text::_('Datos grabados correctamente'));
throw new Redirection($url);
} else {
Message::Error(Text::_('No se ha grabado correctamente. ') . implode(', ', $errors));
}
} else {
$item = $model::get($id);
}
return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'edit', 'data' => $item, 'form' => array('action' => "{$url}/edit/{$id}", 'submit' => array('name' => 'update', 'label' => Text::get('regular-save')), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'node' => array('label' => '', 'name' => 'node', 'type' => 'hidden'), 'name' => array('label' => Text::_('Patrocinador'), 'name' => 'name', 'type' => 'text'), 'url' => array('label' => Text::_('Enlace'), 'name' => 'url', 'type' => 'text', 'properties' => 'size=100'), 'image' => array('label' => Text::_('Logo'), 'name' => 'image', 'type' => 'image'), 'order' => array('label' => Text::_('Posición'), 'name' => 'order', 'type' => 'text')))));
break;
case 'up':
$model::up($id, $node);
throw new Redirection($url);
break;
case 'down':
$model::down($id, $node);
throw new Redirection($url);
break;
case 'remove':
if ($model::delete($id)) {
Message::Info(Text::_('Se ha eliminado el registro'));
throw new Redirection($url);
} else {
Message::Info(Text::_('No se ha podido eliminar el registro'));
}
break;
}
return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'list', 'addbutton' => Text::_('Nuevo patrocinador'), 'data' => $model::getAll($node), 'columns' => array('edit' => '', 'name' => Text::_('Patrocinador'), 'url' => Text::_('Enlace'), 'image' => Text::_('Imagen'), 'order' => Text::_('Posición'), 'up' => '', 'down' => '', 'remove' => ''), 'url' => "{$url}"));
}
作者:isbkc
项目:Gote
public static function process($action = 'list', $id = null)
{
$node = isset($_SESSION['admin_node']) ? $_SESSION['admin_node'] : \GOTEO_NODE;
$errors = array();
switch ($action) {
case 'add':
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$page = new Page();
$page->id = $_POST['id'];
$page->name = $_POST['name'];
if ($page->add($errors)) {
Message::Info('La página <strong>' . $page->name . '</strong> se ha creado correctamente, se puede editar ahora.');
throw new Redirection("/admin/pages/edit/{$page->id}");
} else {
Message::Error('No se ha creado bien ' . implode('<br />', $errors));
throw new Redirection("/admin/pages/add");
}
}
return new View('view/admin/index.html.php', array('folder' => 'pages', 'file' => 'add'));
break;
case 'edit':
if ($node != \GOTEO_NODE && !in_array($id, static::_node_pages())) {
Message::Info('No puedes gestionar la página <strong>' . $id . '</strong>');
throw new Redirection("/admin/pages");
}
// si estamos editando una página
$page = Page::get($id, $node, \GOTEO_DEFAULT_LANG);
// si llega post, vamos a guardar los cambios
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$page->name = $_POST['name'];
$page->description = $_POST['description'];
$page->content = $_POST['content'];
if ($page->save($errors)) {
// Evento Feed
$log = new Feed();
if ($node != \GOTEO_NODE && in_array($id, static::_node_pages())) {
$log->setTarget($node, 'node');
}
$log->populate(Text::_('modificacion de página institucional (admin)'), '/admin/pages', \vsprintf("El admin %s ha %s la página institucional %s", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Modificado'), Feed::item('relevant', $page->name, $page->url))));
$log->doAdmin('admin');
unset($log);
Message::Info('La página ' . $page->name . ' se ha actualizado correctamente');
throw new Redirection("/admin/pages");
} else {
Message::Error(implode('<br />', $errors));
}
}
// sino, mostramos para editar
return new View('view/admin/index.html.php', array('folder' => 'pages', 'file' => 'edit', 'page' => $page));
break;
case 'list':
// si estamos en la lista de páginas
$pages = Page::getList($node);
return new View('view/admin/index.html.php', array('folder' => 'pages', 'file' => 'list', 'pages' => $pages, 'node' => $node));
break;
}
}
作者:kenj
项目:Gote
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));
}
作者:anvnguye
项目:Gote
public static function process($action = 'list', $id = null, $filters = array())
{
$sections = Model\Faq::sections();
if (!isset($sections[$filters['section']])) {
unset($filters['section']);
}
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// instancia
$faq = new Model\Faq(array('id' => $_POST['id'], 'node' => \GOTEO_NODE, 'section' => $_POST['section'], 'title' => $_POST['title'], 'description' => $_POST['description'], 'order' => $_POST['order'], 'move' => $_POST['move']));
if ($faq->save($errors)) {
switch ($_POST['action']) {
case 'add':
Message::Info('Pregunta añadida correctamente');
break;
case 'edit':
Message::Info('Pregunta editado correctamente');
break;
}
} else {
Message::Error(implode('<br />', $errors));
return new View('view/admin/index.html.php', array('folder' => 'faq', 'file' => 'edit', 'action' => $_POST['action'], 'faq' => $faq, 'filter' => $filter, 'sections' => $sections));
}
}
switch ($action) {
case 'up':
Model\Faq::up($id);
throw new Redirection('/admin/faq');
break;
case 'down':
Model\Faq::down($id);
throw new Redirection('/admin/faq');
break;
case 'add':
$next = Model\Faq::next($filters['section']);
return new View('view/admin/index.html.php', array('folder' => 'faq', 'file' => 'edit', 'action' => 'add', 'faq' => (object) array('section' => $filters['section'], 'order' => $next, 'cuantos' => $next), 'sections' => $sections));
break;
case 'edit':
$faq = Model\Faq::get($id);
$cuantos = Model\Faq::next($faq->section);
$faq->cuantos = $cuantos - 1;
return new View('view/admin/index.html.php', array('folder' => 'faq', 'file' => 'edit', 'action' => 'edit', 'faq' => $faq, 'sections' => $sections));
break;
case 'remove':
Model\Faq::delete($id);
break;
}
$faqs = Model\Faq::getAll($filters['section']);
return new View('view/admin/index.html.php', array('folder' => 'faq', 'file' => 'list', 'faqs' => $faqs, 'sections' => $sections, 'filters' => $filters));
}
作者:kenj
项目:Gote
public static function process($action = 'list', $id = null, $filters = array())
{
$sections = Model\Criteria::sections();
if (!isset($sections[$filters['section']])) {
unset($filters['section']);
}
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// instancia
$criteria = new Model\Criteria(array('id' => $_POST['id'], 'section' => $_POST['section'], 'title' => $_POST['title'], 'description' => $_POST['description'], 'order' => $_POST['order'], 'move' => $_POST['move']));
if ($criteria->save($errors)) {
switch ($_POST['action']) {
case 'add':
Message::Info(Text::get('criteria-info-add-correctly'));
break;
case 'edit':
Message::Info(Text::get('criteria-info-edit-correctly'));
break;
}
} else {
Message::Error(implode('<br />', $errors));
return new View('view/admin/index.html.php', array('folder' => 'criteria', 'file' => 'edit', 'action' => $_POST['action'], 'criteria' => $criteria, 'sections' => $sections));
}
}
switch ($action) {
case 'up':
Model\Criteria::up($id);
break;
case 'down':
Model\Criteria::down($id);
break;
case 'add':
$next = Model\Criteria::next($filters['section']);
return new View('view/admin/index.html.php', array('folder' => 'criteria', 'file' => 'edit', 'action' => 'add', 'criteria' => (object) array('section' => $filters['section'], 'order' => $next, 'cuantos' => $next), 'sections' => $sections));
break;
case 'edit':
$criteria = Model\Criteria::get($id);
$cuantos = Model\Criteria::next($criteria->section);
$criteria->cuantos = $cuantos - 1;
return new View('view/admin/index.html.php', array('folder' => 'criteria', 'file' => 'edit', 'action' => 'edit', 'criteria' => $criteria, 'sections' => $sections));
break;
case 'remove':
Model\Criteria::delete($id);
break;
}
$criterias = Model\Criteria::getAll($filters['section']);
return new View('view/admin/index.html.php', array('folder' => 'criteria', 'file' => 'list', 'criterias' => $criterias, 'sections' => $sections, 'filters' => $filters));
}
作者:isbkc
项目:Gote
public static function process($action = 'list', $id = null, $filters = array())
{
// valores de filtro
$groups = Text::groups();
// metemos el todos
\array_unshift($groups, Text::_('Todas las agrupaciones'));
//@fixme temporal hasta pasar las agrupaciones a tabal o arreglar en el list.html.php
// I dont know if this must serve in default lang or in current navigation lang
$data = Text::getAll($filters, 'original');
foreach ($data as $key => $item) {
$data[$key]->group = $groups[$item->group];
}
switch ($action) {
case 'list':
return new View('view/admin/index.html.php', array('folder' => 'texts', 'file' => 'list', 'data' => $data, 'columns' => array('edit' => '', 'text' => Text::_('Texto'), 'group' => Text::_('Agrupación')), 'url' => '/admin/texts', 'filters' => array('filtered' => $filters['filtered'], 'group' => array('label' => Text::_('Filtrar por agrupación:'), 'type' => 'select', 'options' => $groups, 'value' => $filters['group']), 'text' => array('label' => Text::_('Buscar texto:'), 'type' => 'input', 'options' => null, 'value' => $filters['text']))));
break;
case 'edit':
// gestionar post
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
$errors = array();
$id = $_POST['id'];
$text = $_POST['text'];
$data = array('id' => $id, 'text' => $_POST['text']);
if (Text::update($data, $errors)) {
Message::Info(Text::_('El texto ha sido actualizado'));
throw new Redirection("/admin/texts");
} else {
Message::Error(implode('<br />', $errors));
}
} else {
//@TODO: this must get the text in the GOTEO_DEFAULT_LANG or it will be overwrited
$text = Text::getPurpose($id);
// Julian Canaves 23 nov 2013
// right now getPurpose gets the spanish text.
// In future this spanish text will be moved to the `Text` table
// and the `Purpose` table will distribute to database text or to gettext
// and there will be no hardcoded strings
// and will be all happy, fun and joy
}
return new View('view/admin/index.html.php', array('folder' => 'texts', 'file' => 'edit', 'data' => (object) array('id' => $id, 'text' => $text), 'form' => array('action' => '/admin/texts/edit/' . $id, 'submit' => array('name' => 'update', 'label' => Text::_('Aplicar')), 'fields' => array('idtext' => array('label' => '', 'name' => 'id', 'type' => 'hidden', 'properties' => ''), 'newtext' => array('label' => Text::_('Texto'), 'name' => 'text', 'type' => 'textarea', 'properties' => 'cols="100" rows="6"')))));
break;
default:
throw new Redirection("/admin");
}
}
作者:anvnguye
项目:Gote
public function index($post = null)
{
if (!empty($post)) {
$show = 'post';
// -- Mensaje azul molesto para usuarios no registrados
if (empty($_SESSION['user'])) {
$_SESSION['jumpto'] = '/blog/' . $post;
Message::Info(Text::html('user-login-required'));
}
} else {
$show = 'list';
}
// sacamos su blog
$blog = Model\Blog::get(\GOTEO_NODE, 'node');
$filters = array();
if (isset($_GET['tag'])) {
$tag = Model\Blog\Post\Tag::get($_GET['tag']);
if (!empty($tag->id)) {
$filters['tag'] = $tag->id;
}
} else {
$tag = null;
}
if (isset($_GET['author'])) {
$author = Model\User::getMini($_GET['author']);
if (!empty($author->id)) {
$filters['author'] = $author->id;
}
} else {
$author = null;
}
if (!empty($filters)) {
$blog->posts = Model\Blog\Post::getList($filters);
}
if (isset($post) && !isset($blog->posts[$post]) && $_GET['preview'] != $_SESSION['user']->id) {
throw new \Goteo\Core\Redirection('/blog');
}
// segun eso montamos la vista
return new View('view/blog/index.html.php', array('blog' => $blog, 'show' => $show, 'filters' => $filters, 'post' => $post, 'owner' => \GOTEO_NODE));
}
作者:kenj
项目:Gote
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));
}
作者:anvnguye
项目:Gote
/**
* Tratamiendo del formulario de preferencias de notificación
*
* @param string(59) $id del usuario logueado
* @param array $errors (por referencia)
* @param string $log_action (por referencia)
* @return boolean si se guarda bien
*/
public static function process_preferences($id, &$errors, &$log_action)
{
$fields = array('updates', 'threads', 'rounds', 'mailing', 'email', 'tips');
$preferences = array();
foreach ($fields as $field) {
$preferences[$field] = $_POST[$field];
}
// actualizamos estos datos en las preferencias del usuario
if (Model\User::setPreferences($id, $preferences, $errors)) {
Message::Info(Text::get('user-prefer-saved'));
$log_action = 'Modificado las preferencias de notificación';
//feed admin
return true;
} else {
Message::Error(Text::get('user-save-fail'));
$log_action = '¡ERROR! al modificar las preferencias de notificación';
//feed admin
return false;
}
}
作者:isbkc
项目:Gote
public function confirmed($project = null, $id = null, $reward = null)
{
if (empty($id)) {
Message::Error(Text::get('invest-data-error'));
throw new Redirection('/', Redirection::TEMPORARY);
}
// el aporte
$invest = Model\Invest::get($id);
$projectData = Model\Project::getMedium($invest->project);
// para evitar las duplicaciones de feed y email
if (isset($_SESSION['invest_' . $invest->id . '_completed'])) {
Message::Info(Text::get('invest-process-completed'));
throw new Redirection($retUrl);
}
// segun método
if ($invest->method == 'tpv') {
// si el aporte no está en estado "cobrado por goteo" (1)
if ($invest->status != '1') {
@mail('goteo_fail@doukeshi.org', 'Aporte tpv no pagado ' . $invest->id, 'Ha llegado a invest/confirm el aporte ' . $invest->id . ' mediante tpv sin estado cobrado (llega con estado ' . $invest->status . ')');
// mandarlo a la pagina de aportar para que lo intente de nuevo
// si es de Bazar, a la del producto del catálogo
if ($project == 'bazargoteo') {
throw new Redirection("/bazaar/{$reward}/fail");
} else {
throw new Redirection("/project/{$invest->project}/invest/?confirm=fail");
}
}
}
// Paypal solo disponible si activado
if ($invest->method == 'paypal') {
// hay que cambiarle el status a 0
$invest->setStatus('0');
// Evento Feed
$log = new Feed();
$log->setTarget($projectData->id);
$log->populate('Aporte PayPal', '/admin/invests', \vsprintf("%s ha aportado %s al proyecto %s mediante PayPal", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('money', $invest->amount . ' €'), Feed::item('project', $projectData->name, $projectData->id))));
$log->doAdmin('money');
// evento público
$log_html = Text::html('feed-invest', Feed::item('money', $invest->amount . ' €'), Feed::item('project', $projectData->name, $projectData->id));
if ($invest->anonymous) {
$log->populate(Text::get('regular-anonymous'), '/user/profile/anonymous', $log_html, 1);
} else {
$log->populate($_SESSION['user']->name, '/user/profile/' . $_SESSION['user']->id, $log_html, $_SESSION['user']->avatar->id);
}
$log->doPublic('community');
unset($log);
}
// fin segun metodo
// Feed del aporte de la campaña
if (!empty($invest->droped) && $drop instanceof Model\Invest && is_object($callData)) {
// Evento Feed
$log = new Feed();
$log->setTarget($projectData->id);
$log->populate('Aporte riego ' . $drop->method, '/admin/invests', \vsprintf("%s ha aportado %s de %s al proyecto %s a través de la campaña %s", array(Feed::item('user', $callData->user->name, $callData->user->id), Feed::item('money', $drop->amount . ' €'), Feed::item('drop', 'Capital Riego', '/service/resources'), Feed::item('project', $projectData->name, $projectData->id), Feed::item('call', $callData->name, $callData->id))));
$log->doAdmin('money');
// evento público
$log->populate($callData->user->name, '/user/profile/' . $callData->user->id, Text::html('feed-invest', Feed::item('money', $drop->amount . ' €') . ' de ' . Feed::item('drop', 'Capital Riego', '/service/resources'), Feed::item('project', $projectData->name, $projectData->id) . ' a través de la campaña ' . Feed::item('call', $callData->name, $callData->id)), $callData->user->avatar->id);
$log->doPublic('community');
unset($log);
}
// texto recompensa
// @TODO quitar esta lacra de N recompensas porque ya es solo una recompensa siempre
$rewards = $invest->rewards;
array_walk($rewards, function (&$reward) {
$reward = $reward->reward;
});
$txt_rewards = implode(', ', $rewards);
// recaudado y porcentaje
$amount = $projectData->invested;
$percent = floor($projectData->invested / $projectData->mincost * 100);
// email de agradecimiento al cofinanciador
// primero monto el texto de recompensas
//@TODO el concepto principal sería 'renuncia' (porque todos los aportes son donativos)
if ($invest->resign) {
// Plantilla de donativo segun la ronda
if ($projectData->round == 2) {
$template = Template::get(36);
// en segunda ronda
} else {
$template = Template::get(28);
// en primera ronda
}
} else {
// plantilla de agradecimiento segun la ronda
if ($projectData->round == 2) {
$template = Template::get(34);
// en segunda ronda
} else {
$template = Template::get(10);
// en primera ronda
}
}
// Dirección en el mail (y version para regalo)
$txt_address = Text::get('invest-address-address-field') . ' ' . $invest->address->address;
$txt_address .= '<br> ' . Text::get('invest-address-zipcode-field') . ' ' . $invest->address->zipcode;
$txt_address .= '<br> ' . Text::get('invest-address-location-field') . ' ' . $invest->address->location;
$txt_address .= '<br> ' . Text::get('invest-address-country-field') . ' ' . $invest->address->country;
$txt_destaddr = $txt_address;
$txt_address = Text::get('invest-mail_info-address') . '<br>' . $txt_address;
// Agradecimiento al cofinanciador
//.........这里部分代码省略.........
作者:kenj
项目:Gote
public function personal($user = null)
{
if (empty($user)) {
throw new Redirection('/community', Redirection::PERMANENT);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['message'])) {
// sacamos el mail del responsable del proyecto
$user = Model\User::get($user);
if (!$user instanceof Model\User) {
throw new Redirection('/', Redirection::TEMPORARY);
}
$msg_content = \nl2br(\strip_tags($_POST['message']));
// Obtenemos la plantilla para asunto y contenido
$template = Template::get(4);
// Sustituimos los datos
if (isset($_POST['subject']) && !empty($_POST['subject'])) {
$subject = $_POST['subject'];
} else {
// En el asunto por defecto: %USERNAME% por $_SESSION['user']->name
$subject = str_replace('%USERNAME%', $_SESSION['user']->name, $template->title);
}
$remite = $_SESSION['user']->name . ' ' . Text::get('regular-from') . ' ';
$remite .= GOTEO_MAIL_NAME;
$response_url = SITE_URL . '/user/profile/' . $_SESSION['user']->id . '/message';
$profile_url = SITE_URL . "/user/profile/{$user->id}/sharemates";
// En el contenido: nombre del destinatario -> %TONAME% por $user->name
// el mensaje que ha escrito el usuario -> %MESSAGE% por $msg_content
// nombre del usuario -> %USERNAME% por $_SESSION['user']->name
// url del perfil -> %PROFILEURL% por ".SITE_URL."/user/profile/{$user->id}/sharemates"
$search = array('%MESSAGE%', '%TONAME%', '%USERNAME%', '%PROFILEURL%', '%RESPONSEURL%');
$replace = array($msg_content, $user->name, $_SESSION['user']->name, $profile_url, $response_url);
$content = \str_replace($search, $replace, $template->text);
$mailHandler = new Mail();
$mailHandler->fromName = $remite;
$mailHandler->to = $user->email;
$mailHandler->toName = $user->name;
// blind copy a goteo desactivado durante las verificaciones
// $mailHandler->bcc = 'comunicaciones@goteo.org';
$mailHandler->subject = $subject;
$mailHandler->content = $content;
$mailHandler->html = true;
$mailHandler->template = $template->id;
if ($mailHandler->send($errors)) {
// ok
\Goteo\Library\Message::Info(Text::get('regular-message_success'));
} else {
\Goteo\Library\Message::Info(Text::get('regular-message_fail') . '<br />' . implode(', ', $errors));
}
unset($mailHandler);
}
throw new Redirection("/user/profile/{$user->id}", Redirection::TEMPORARY);
}
作者:isbkc
项目:Gote
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)) {
//.........这里部分代码省略.........
作者:anvnguye
项目:Gote
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);
//.........这里部分代码省略.........
作者:nguyende
项目:LoveSharin
public static function menu($BC = array())
{
$admin_label = Text::_('Admin');
$options = static::_options();
$supervisors = static::_supervisors();
// El menu del panel admin dependerá del rol del usuario que accede
// Superadmin = todo
// Admin = contenidos de Nodo
// Supervisor = menus especiales
if (isset($supervisors[$_SESSION['user']->id])) {
$menu = self::setMenu('supervisor', $_SESSION['user']->id);
} elseif (isset($_SESSION['user']->roles['admin'])) {
$menu = self::setMenu('admin', $_SESSION['user']->id);
} else {
$menu = self::setMenu('superadmin', $_SESSION['user']->id);
}
// si el breadcrumbs no es un array vacio,
// devolveremos el contenido html para pintar el camino de migas de pan
// con enlaces a lo anterior
if (empty($BC)) {
return $menu;
} else {
// a ver si puede estar aqui!
if ($BC['option'] != 'index') {
$puede = false;
foreach ($menu as $sCode => $section) {
if (isset($section['options'][$BC['option']])) {
$puede = true;
break;
}
}
if (!$puede) {
Message::Error(Text::get('admin-no_permission', $options[$BC['option']]['label']));
throw new Redirection('/admin');
}
}
// Los últimos serán los primeros
$path = '';
// si el BC tiene Id, accion sobre ese registro
// si el BC tiene Action
if (!empty($BC['action']) && $BC['action'] != 'list') {
// si es una accion no catalogada, mostramos la lista
if (!in_array($BC['action'], array_keys($options[$BC['option']]['actions']))) {
$BC['action'] = '';
$BC['id'] = null;
}
$action = $options[$BC['option']]['actions'][$BC['action']];
// si es de item , añadir el id (si viene)
if ($action['item'] && !empty($BC['id'])) {
$path = " > <strong>{$action['label']}</strong> {$BC['id']}";
} else {
$path = " > <strong>{$action['label']}</strong>";
}
}
// si el BC tiene Option, enlace a la portada de esa gestión (a menos que sea laaccion por defecto)
if (!empty($BC['option']) && isset($options[$BC['option']])) {
$option = $options[$BC['option']];
if ($BC['action'] == 'list') {
$path = " > <strong>{$option['label']}</strong>";
} else {
$path = ' > <a href="/admin/' . $BC['option'] . '">' . $option['label'] . '</a>' . $path;
}
}
// si el BC tiene section, facil, enlace al admin
if ($BC['option'] == 'index') {
$path = "<strong>{$admin_label}</strong>";
} else {
$path = '<a href="/admin">' . $admin_label . '</a>' . $path;
}
return $path;
}
}