当前位置: 首页>>代码示例>>PHP>>正文


PHP Library\Message类代码示例

本文整理汇总了PHP中Goteo\Library\Message的典型用法代码示例。如果您正苦于以下问题:PHP Message类的具体用法?PHP Message怎么用?PHP Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Message类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 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}"));
 }
开发者ID:kenjs,项目名称:Goteo,代码行数:34,代码来源:tags.php

示例2: process

 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));
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:35,代码来源:icons.php

示例3: process

 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;
     }
 }
开发者ID:kenjs,项目名称:Goteo,代码行数:30,代码来源:templates.php

示例4: index

 /**
  * 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');
     }
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:29,代码来源:impersonate.php

示例5: process

 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));
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:28,代码来源:worth.php

示例6: process

 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);
 }
开发者ID:isbkch,项目名称:Goteo,代码行数:59,代码来源:home.php

示例7: process

 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}"));
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:58,代码来源:sponsors.php

示例8: process

 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;
     }
 }
开发者ID:isbkch,项目名称:Goteo,代码行数:57,代码来源:pages.php

示例9: process

 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));
 }
开发者ID:kenjs,项目名称:Goteo,代码行数:51,代码来源:licenses.php

示例10: process

 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));
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:50,代码来源:faq.php

示例11: process

 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));
 }
开发者ID:kenjs,项目名称:Goteo,代码行数:48,代码来源:criteria.php

示例12: process

 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");
     }
 }
开发者ID:isbkch,项目名称:Goteo,代码行数:45,代码来源:texts.php

示例13: index

 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));
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:40,代码来源:blog.php

示例14: 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));
 }
开发者ID:kenjs,项目名称:Goteo,代码行数:63,代码来源:rewards.php

示例15: process_preferences

 /**
  * 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;
     }
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:28,代码来源:profile.php


注:本文中的Goteo\Library\Message类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。