• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Library\Message类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: confirmed

 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('[email protected]', '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 . ' &euro;'), Feed::item('project', $projectData->name, $projectData->id))));
         $log->doAdmin('money');
         // evento público
         $log_html = Text::html('feed-invest', Feed::item('money', $invest->amount . ' &euro;'), 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 . ' &euro;'), 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 . ' &euro;') . ' 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::ge 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Library\Text类代码示例发布时间:2022-05-23
下一篇:
PHP FieldDescriptorProto\Type类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap