Exemplo n.º 1
0
 /**
  * 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(Text::get('impersonate-error'));
         throw new Redirection('/dashboard');
     }
 }
Exemplo n.º 2
0
Arquivo: tags.php Projeto: kenjs/Goteo
 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}"));
 }
Exemplo n.º 3
0
 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}"));
 }
Exemplo n.º 4
0
 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(' <strong>' . $page->name . '</strong> ' . Text::get('admin-pages-info-page') . Text::get('admin-pages-info-add-page'));
                     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(Text::get('admin-pages-info-nopermission') . ' <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(Text::get('admin-pages-info-page') . $page->name . Text::get('admin-pages-info-add-page'));
                     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;
     }
 }
Exemplo n.º 5
0
 public static function process($action = 'list', $id = null)
 {
     $model = 'Goteo\\Model\\News';
     $url = '/admin/news';
     $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()), 'form' => array('action' => "{$url}/edit/", 'submit' => array('name' => 'update', 'label' => 'Añadir'), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'title' => array('label' => 'Noticia', 'name' => 'title', 'type' => 'text', 'properties' => 'size="100" maxlength="100"'), 'description' => array('label' => 'Entradilla', 'name' => 'description', 'type' => 'textarea', 'properties' => 'cols="100" rows="2"'), 'url' => array('label' => 'Enlace', 'name' => 'url', 'type' => 'text', 'properties' => 'size=100'), 'order' => array('label' => 'Posición', 'name' => 'order', 'type' => 'text')))));
             break;
         case 'edit':
             // gestionar post
             if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
                 // instancia
                 $item = new $model(array('id' => $_POST['id'], 'title' => $_POST['title'], 'description' => $_POST['description'], 'url' => $_POST['url'], 'order' => $_POST['order']));
                 if ($item->save($errors)) {
                     if (empty($_POST['id'])) {
                         // Evento Feed
                         $log = new Feed();
                         $log->populate('nueva micronoticia (admin)', '/admin/news', \vsprintf('El admin %s ha %s la micronoticia "%s"', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Publicado'), Feed::item('news', $_POST['title'], '#news' . $item->id))));
                         $log->doAdmin('admin');
                         unset($log);
                     }
                     throw new Redirection($url);
                 } else {
                     Message::Error(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'), 'title' => array('label' => 'Noticia', 'name' => 'title', 'type' => 'text', 'properties' => 'size="100"  maxlength="80"'), 'description' => array('label' => 'Entradilla', 'name' => 'description', 'type' => 'textarea', 'properties' => 'cols="100" rows="2"'), 'url' => array('label' => 'Enlace', 'name' => 'url', 'type' => 'text', 'properties' => 'size=100'), 'order' => array('label' => 'Posición', 'name' => 'order', 'type' => 'text')))));
             break;
         case 'up':
             $model::up($id);
             break;
         case 'down':
             $model::down($id);
             break;
         case 'remove':
             $tempData = $model::get($id);
             if ($model::delete($id)) {
                 // Evento Feed
                 $log = new Feed();
                 $log->populate('micronoticia quitada (admin)', '/admin/news', \vsprintf('El admin %s ha %s la micronoticia "%s"', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Quitado'), Feed::item('blog', $tempData->title))));
                 $log->doAdmin('admin');
                 unset($log);
                 throw new Redirection($url);
             }
             break;
     }
     return new View('view/admin/index.html.php', array('folder' => 'base', 'file' => 'list', 'model' => 'news', 'addbutton' => 'Nueva noticia', 'data' => $model::getAll(), 'columns' => array('edit' => '', 'title' => 'Noticia', 'order' => 'Posición', 'up' => '', 'down' => '', 'translate' => '', 'remove' => ''), 'url' => "{$url}"));
 }
Exemplo n.º 6
0
 public static function process($action = 'list', $id = null)
 {
     $model = 'Goteo\\Model\\Skill';
     $url = '/admin/skills';
     $errors = array();
     switch ($action) {
         case 'add':
             if (isset($_GET['word'])) {
                 $item = (object) array('name' => $_GET['word']);
             } else {
                 $item = (object) array();
             }
             $parent_skill = $model::getAllParent();
             return new View('view/admin/index.html.php', array('folder' => 'skills', 'file' => 'edit', 'data' => $item, 'parent_skill' => $parent_skill, '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::_('Skill'), 'name' => 'name', 'type' => 'text'), 'description' => array('label' => Text::_('Descripción'), 'name' => 'description', 'type' => 'textarea', 'properties' => 'cols="100" rows="2"')))));
             break;
         case 'edit':
             // gestionar post
             if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
                 // instancia
                 $item = new $model(array('id' => $_POST['id'], 'name' => $_POST['name'], 'description' => $_POST['description'], 'parent_skill_id' => $_POST['parent_skill_id']));
                 if ($item->save($errors)) {
                     throw new Redirection($url);
                 } else {
                     Message::Error(implode('<br />', $errors));
                 }
             } else {
                 $item = $model::get($id);
             }
             $parent_skill = $model::getAllParent();
             return new View('view/admin/index.html.php', array('folder' => 'skills', 'file' => 'edit', 'data' => $item, 'parent_skill' => $parent_skill, 'form' => array('action' => "{$url}/edit/{$id}", 'submit' => array('name' => 'update', 'label' => 'Guardar'), 'fields' => array('id' => array('label' => '', 'name' => 'id', 'type' => 'hidden'), 'name' => array('label' => 'Skill', 'name' => 'name', 'type' => 'text'), 'description' => array('label' => 'Descripción', 'name' => 'description', 'type' => 'textarea', 'properties' => 'cols="100" rows="2"')))));
             break;
         case 'up':
             $model::up($id);
             break;
         case 'down':
             $model::down($id);
             break;
         case 'remove':
             if ($model::delete($id)) {
                 throw new Redirection($url);
             }
             break;
         case 'keywords':
             return new View('view/admin/index.html.php', array('folder' => 'keywords', 'file' => 'list', 'skills' => $model::getList(), 'words' => $model::getKeyWords()));
             break;
     }
     return new View('view/admin/index.html.php', array('folder' => 'skills', 'file' => 'list', 'model' => 'skill', 'addbutton' => Text::_('New skill'), 'otherbutton' => '<a href="/admin/skills/keywords" class="button">' . Text::get('admin-skill_keyword') . '</a>', 'data' => $model::getAll(), 'columns' => array('edit' => '', 'name' => 'Skill', 'numProj' => 'Proyectos', 'numUser' => 'Usuarios', 'order' => 'Prioridad', 'translate' => '', 'up' => '', 'down' => '', 'translate' => '', 'remove' => ''), 'url' => "{$url}"));
 }
Exemplo n.º 7
0
            echo '<div class="tagmark green">' . Text::get('regular-keepiton_mark') . '</div>';
            break;
        case 'onrun-keepiton': // "en marcha" y "aun puedes"
            echo '<div class="tagmark green twolines"><span class="small"><strong>' . Text::get('regular-onrun_mark') . '</strong><br />' . Text::get('regular-keepiton_mark') . '</span></div>';
            break;
        case 'gotit': // "financiado"
            echo '<div class="tagmark violet">' . Text::get('regular-gotit_mark') . '</div>';
            break;
        case 'success': // "exitoso"
            echo '<div class="tagmark red">' . Text::get('regular-success_mark') . '</div>';
            break;
        case 'fail': // "caducado"
            echo '<div class="tagmark grey">' . Text::get('regular-fail_mark') . '</div>';
            break;
    } ?>

    <div class="project-widget-box">
    <?php echo new View('view/m/project/meter.html.php', array('project' => $project, 'level' => $level) ) ?>
    
        <div class="buttons">
            <?php if ($project->status == 3) : // boton apoyar solo si esta en campaña ?>
            <a class="button violet supportit" href="/project/<?php echo $project->id; ?>/invest"><?php echo Text::get('regular-invest_it'); ?></a>
            <?php /* else : ?>
            <a class="button view" href="/project/<?php echo $project->id ?>/updates"><?php echo Text::get('regular-see_blog'); ?></a>
            <?php */ endif; ?>
        </div>
    </div>
<? /* for_apps_review
    <a class="more" href="/project/<?php echo $project->id; ?>/needs"><?php echo Text::get('regular-see_more'); ?></a>
*/?>
 </div>
Exemplo n.º 8
0
 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));
 }
Exemplo n.º 9
0
 *
 *  Goteo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with Goteo.  If not, see <http://www.gnu.org/licenses/agpl.txt>.
 *
 */
use Goteo\Core\View, Goteo\Model\Image, Goteo\Library\Text;
//@NODESYS
//@CALLSYS
$bodyClass = 'home';
// para que el prologue ponga el código js para botón facebook en el bannerside
$fbCode = Text::widget(Text::get('social-account-facebook'), 'fb');
// metas og: para que al compartir en facebook coja las imagenes de novedades
$ogmeta = array('title' => 'Goteo.org', 'description' => 'Goteo.org', 'url' => SITE_URL);
if (!empty($this['posts'])) {
    foreach ($this['posts'] as $post) {
        if (count($post->gallery) > 1) {
            foreach ($post->gallery as $pbimg) {
                if ($pbimg instanceof Image) {
                    $ogmeta['image'][] = $pbimg->getLink(500, 285);
                }
            }
        } elseif (!empty($post->image)) {
            $ogmeta['image'][] = $post->image->getLink(500, 285);
        }
    }
}
Exemplo n.º 10
0
        <?php 
    }
    ?>
    <?php 
} else {
    ?>
        <p><?php 
    echo Text::get('form-errors-total', $total_errors);
    ?>
</p>
        <?php 
    foreach ($project->errors as $st => $errors) {
        if (!empty($errors)) {
            ?>
            <h4 class="title"><?php 
            echo Text::get('step-' . $st);
            ?>
</h4>
            <ul class="sf-footer-errors">
            <?php 
            foreach ($errors as $id => $error) {
                ?>
                <li><?php 
                echo $error;
                ?>
</li>
            <?php 
            }
            ?>
            </ul>
        <?php 
Exemplo n.º 11
0
                </script>
                <div id="bocadillo"></div>
                <input type="hidden" name="username" value="<?php 
    echo $investData->user->name;
    ?>
" />
                <textarea rows="5" cols="50" name="message" id="message"></textarea>
                <a class="preview" href="#preview" id="a-preview" target="_blank"><?php 
    echo Text::get('regular-preview');
    ?>
</a>
                <div style="display:none">
                    <div style="width:400px;height:300px;overflow:auto;" id="preview"></div>
                </div>
                <button type="submit" class="green"><?php 
    echo Text::get('project-messages-send_message-button');
    ?>
</button>
            </div>
        </form>
    </div>

<?php 
}
?>
<script type="text/javascript">
    function msgto(reward) {
        document.getElementById('msg_reward-'+reward).checked = 'checked';
        document.location.href = '#message';
        $("#message").focus();
    }
Exemplo n.º 12
0
 <span class="euro">&euro;</span></strong></dd>

            <dt class="days"><span><?php 
echo Text::get('project-view-metter-days');
?>
</span></dt>
            <dd class="days"><strong><?php 
echo number_format($days);
?>
</strong> <?php 
echo Text::get('regular-days');
?>
</dd>

            <dt class="supporters"><span><?php 
echo Text::get('project-view-metter-investors');
?>
</span></dt>
            <dd class="supporters"><strong><?php 
echo number_format($supporters);
?>
</strong></dd>                

        </dl>

        <?php 
if ($activable) {
    ?>
        <div class="obtained">
            <strong><?php 
    echo \amount_format($reached);
Exemplo n.º 13
0
            if ($project->status > 2) {
                ?>
                      <div id="widget-code" style="float:none;width:250px;margin-left:25px;">
                          <div class="wc-embed" onclick="$('#widget_code').focus();$('#widget_code').select()"><?php 
                echo Text::get('dashboard-embed_code');
                ?>
</div>
                        <textarea id="widget_code" style="width:230px;margin:0 0 10px;" onclick="this.focus();this.select()" readonly="readonly"><?php 
                echo htmlentities($widget_code);
                ?>
</textarea>
                      </div>

                      <div id="widget-code" style="float:none;width:250px;margin-left:25px;">
                        <div class="wc-embed" onclick="$('#investor_code').focus();$('#investor_code').select()"><?php 
                echo Text::get('dashboard-embed_code_investor');
                ?>
</div>
                        <textarea id="investor_code" style="width:230px;margin:0 0 10px;" onclick="this.focus();this.select()" readonly="readonly"><?php 
                echo htmlentities($widget_code_investor);
                ?>
</textarea>
                      </div>
                <?php 
            }
            ?>
                </div>
                <?php 
        }
        ?>
Exemplo n.º 14
0
                echo is_object($item) ? $item->id : $item['id'];
                ?>
" onclick="return confirm('<?php 
                echo Text::_("Seguro que deseas eliminar este registro?");
                ?>
');">[<?php 
                echo Text::_('Quitar');
                ?>
]</a></td>
                <?php 
            } elseif (in_array($key, array('edit', 'up', 'down'))) {
                $id = is_object($item) ? $item->id : $item['id'];
                ?>
                    <td width="5%">
                        <a title="<?php 
                echo Text::get('admin_registro') . $id;
                ?>
" href="<?php 
                echo "{$this['url']}/{$key}/{$id}/{$filter}";
                ?>
"><?php 
                echo $botones[$key];
                ?>
</a>
                    </td>
                <?php 
            } elseif ($key == 'image') {
                ?>
                    <td width="<?php 
                echo round($per) - 5;
                ?>
Exemplo n.º 15
0
        $title   = Text::get('regular-hello') . " $name";
//        $message = Text::get('project-invest-login');
        break;
    case 'confirm':
        $title   = Text::get('regular-hello') . " $name";
//        $message = Text::get('project-invest-confirm');
        break;
    case 'continue':
        $title   = Text::get('regular-hello') . " $name";
//        $message = Text::get('project-invest-continue');
        break;
    case 'ok':
        $title   = Text::get('regular-thanks') . " {$name}!";
//        $message = Text::get('project-invest-ok');
        break;
    case 'fail':
        $title   = Text::get('regular-sorry') . " {$name}";
//        $message = Text::get('project-invest-fail');
        break;
}

$level = (int) $this['level'] ?: 3;

?>
<div class="widget invest-message">
    <h2><?php echo $avatarhtml; ?><span><?php echo $title; ?></span><?/*<br />
    <span class="message"><?php echo $message; ?></span></h2>*/?>


</div>
Exemplo n.º 16
0
                    <ul>
                    <?php 
                    $cnt = 1;
                    foreach ($sharemates as $mate) :
                        if (empty($this['category']) && $cnt > 6) break;
                    ?>
                        <li class="<?php if($cnt < 3) echo " bordertop"?>">
                            <div class="user">
                                <a href="/user/<?php echo htmlspecialchars($mate->user) ?>" class="expand">&nbsp;</a>
                                <div class="avatar"><a href="/user/<?php echo htmlspecialchars($mate->user) ?>"><img src="<?php echo $mate->avatar->getLink(43, 43, true) ?>" /></a></div>
                                <h4><a href="/user/<?php echo htmlspecialchars($mate->user) ?>"><?php echo htmlspecialchars($mate->name) ?></a></h4>
                                <span class="projects"><?php echo Text::get('regular-projects'); ?> (<?php echo $mate->projects ?>)</span>
                                <span class="invests"><?php echo Text::get('regular-investing'); ?> (<?php echo $mate->invests ?>)</span><br/>
                                <span class="profile"><a href="/user/profile/<?php echo htmlspecialchars($mate->user) ?>"><?php echo Text::get('profile-widget-button'); ?></a> </span>
                                <span class="contact"><a href="/user/profile/<?php echo htmlspecialchars($mate->user) ?>/message"><?php echo Text::get('regular-send_message'); ?></a></span>
                            </div>
                        </li>
                    <?php 
                    $cnt ++;
                    endforeach; ?>
                    </ul>
                </div>
        <?php if (empty($this['category'])) : ?>
            <a class="more" href="/community/sharemates/<?php echo $catId ?>"><?php echo Text::get('regular-see_more'); ?></a>
        <?php else : ?>
            <a class="more" href="/community/sharemates"><?php echo Text::get('regular-see_all'); ?></a>
        <?php endif; ?>
        </div>
        <?php endforeach; ?>
        <!-- fin detalle de categoría (cabecera de categoría) -->
Exemplo n.º 17
0
 /**
  *  Genera codigo html para feed público
  *
  *  segun tenga imagen, ebnlace, titulo, tipo de enlace
  *
  */
 public static function subItem($item)
 {
     $pub_timeago = Text::get('feed-timeago-published', $item->timeago);
     $content = '<div class="subitem">';
     // si enlace -> título como texto del enlace
     if (!empty($item->url)) {
         // si imagen -> segun enlace:
         if (!empty($item->image)) {
             if (substr($item->url, 0, 5) == '/user') {
                 $content .= '<div class="content-avatar">
                     <a href="' . $item->url . '" class="avatar"><img src="' . SRC_URL . '/image/' . $item->image . '/32/32/1" /></a>
                     <a href="' . $item->url . '" class="username">' . $item->title . '</a>
                     <span class="datepub">' . $pub_timeago . '</span>
                     </div>';
             } else {
                 $content .= '<div class="content-image">
                     <a href="' . $item->url . '" class="image"><img src="' . SRC_URL . '/image/' . $item->image . '/90/60/1" /></a>
                     <a href="' . $item->url . '" class="project light-blue">' . $item->title . '</a>
                     <span class="datepub">' . $pub_timeago . '</span>
                     </div>';
             }
         } else {
             // solo titulo con enlace
             $content .= '<div class="content-title">
                     <h5 class="light-blue"><a href="' . $item->url . '" class="project light-blue">' . $item->title . '</a></h5>
                     <span class="datepub">' . $pub_timeago . '</span>
                </div>';
         }
     } else {
         // solo el timeago
         $content .= '<span class="datepub">' . $pub_timeago . '</span>';
     }
     // y lo que venga en el html
     $content .= '<div class="content-pub">' . $item->html . '</div>';
     $content .= '</div>';
     return $content;
 }
Exemplo n.º 18
0
                </div>

               <?php if (!empty($message->responses)) :
                    foreach ($message->responses as $child) : ?>
                       <div class="child<?php if ($child->user->id == $project->owner) echo ' owner'; ?>">
                           <span class="avatar">
                           <a href="/user/profile/<?php echo htmlspecialchars($child->user->id) ?>" target="_blank">
	                           <img src="<?php echo $child->user->avatar->getLink(40, 40, true); ?>" />
                           </a>
                           </span>
                           <a name="message<?php echo $child->id; ?>" />
                           <h<?php echo $level ?> class="user">
						   <a href="/user/profile/<?php echo htmlspecialchars($child->user->id) ?>" target="_blank">
						   <?php echo $child->user->name; ?>
                           </a>
                           </h<?php echo $level ?>>
                           <div class="date"><span><?php echo $child->timeago; ?>前</span></div>
                           <blockquote><?php echo $child->message; ?></blockquote>
                           <?php // si puede borrar este mensaje
                           if (\Goteo\Core\ACL::check("/message/delete/{$child->id}/{$project->id}")) : ?>
                           <div class="actions">
                                <a href="/message/delete/<?php echo $child->id; ?>/<?php echo $project->id; ?>"><?php echo Text::get('regular-delete'); ?></a>
                           </div>
                           <?php endif; ?>
                       </div>
                <?php endforeach;
                endif; ?>
		<?php endforeach; ?>
    </div>
</div>
Exemplo n.º 19
0
 *  You should have received a copy of the GNU Affero General Public License
 *  along with Goteo.  If not, see <http://www.gnu.org/licenses/agpl.txt>.
 *
 */
use Goteo\Core\View, Goteo\Library\Text;
$promotes = $this['promotes'];
// random y que solo pinte seis si hubiera más
if (count($promotes) > 6) {
    shuffle($promotes);
    $promotes = array_slice($promotes, 0, 6);
}
?>
<div class="widget projects">

    <h2 class="title"><?php 
echo Text::get('home-promotes-header');
?>
</h2>

    <?php 
foreach ($promotes as $promo) {
    ?>

            <?php 
    echo new View('view/project/widget/project.html.php', array('project' => $promo->projectData, 'balloon' => '<h4>' . htmlspecialchars($promo->title) . '</h4>' . '<blockquote>' . $promo->description . '</blockquote>'));
    ?>

    <?php 
}
?>
Exemplo n.º 20
0
					echo '<input type="hidden" name="provider" value="' . $oauth->original_provider . '" />';
					//email original, para saber si se ha cambiado
					echo '<input type="hidden" name="provider_email" value="' . $provider_email . '" />';

                    echo '<input type="hidden" name="provider_id" value="' . $oauth->provider_id . '" />';

					?>

				</form>
            </div>
        </div>

        <div class="imported_profiles">
			<p><?php echo Text::get('oauth-login-imported-data'); ?></p>
            <div class="imported_profiles_inner">
			<?php
			//print_r($_POST);
			if($profile_image_url) echo '<img style="float:left;width:200px;max-height:200px;display:block;" src="'.$profile_image_url.'" alt="Imported profile image" />';
			echo "<div>";
			foreach(array_merge($oauth->import_user_data,array('website')) as $k) {
				if($$k) echo '<strong>'.Text::get('oauth-import-'.$k).':</strong><br />'.nl2br($$k)."<br /><br />\n";
			}

			echo "</div>\n";
			?>
            </div>
		</div>
    </div>

<?php include 'view/footer.html.php' ?>
Exemplo n.º 21
0
foreach ($rewards as $id => $reward) {
    ?>
                    <option value="<?php 
    echo $id;
    ?>
"<?php 
    if (in_array("'{$id}'", $params['reward'])) {
        echo ' selected="selected"';
    }
    ?>
><?php 
    echo $reward->name;
    ?>
</option>
                <?php 
}
?>
                </select>
        </div>

        <div style="float:left">
            <button type="submit" id="searcher" name="searcher"><?php 
echo Text::get('discover-searcher-button');
?>
</button>
        </div>
        
        <br clear="all" />
    </form>
</div>
Exemplo n.º 22
0
    ?>
</p>
                <?php 
}
?>

                <form action="/user/recover" method="post">
                    <div class="email">
                        <label><?php 
echo Text::get('login-recover-email-field');
?>
                        <input type="text" name="email" value="<?php 
echo $email;
?>
" /></label>
                    </div>

                    <input type="submit" name="recover" value="<?php 
echo Text::get('login-recover-button');
?>
" />

                </form>

            </div>
        </div>

    </div>

<?php 
include 'view/footer.html.php';
Exemplo n.º 23
0
    }
    ?>
                <div class="description"><?php 
    if ($post->id == 728) {
        echo Text::recorta($post->text, 400);
    } else {
        echo Text::recorta($post->text, 600);
    }
    ?>
</div>

                <div class="read_more"><a href="<?php 
    echo $post->owner_type == 'project' ? '/project/' . $post->owner_id . '/updates/' . $post->id : '/blog/' . $post->id;
    ?>
"><?php 
    echo Text::get('regular-read_more');
    ?>
</a></div>
            </div>
        </div>
        <?php 
    $i++;
}
?>
    </div>
    <a class="prev">prev</a>
    <ul class="slderpag">
        <?php 
$i = 1;
foreach ($posts as $post) {
    ?>
Exemplo n.º 24
0
        <h4><?php echo Text::get('profile-keywords-header'); ?></h4>
        <p><?php echo $user->keywords; ?></p>        
    </div>
    <?php endif ?>
        
    <?php if (!empty($user->webs)): ?>
    <div class="webs">     
        <h4><?php echo Text::get('profile-webs-header'); ?></h4>
        <ul>
            <?php foreach ($user->webs as $link): ?>
            <li><a href="<?php echo htmlspecialchars($link->url) ?>" target="_blank"><?php echo htmlspecialchars($link->url) ?></a></li>
            <?php endforeach ?>
        </ul>
    </div>
    <?php endif ?>
    
    <?php if (!empty($user->location)): ?>
     <div class="location">    
        <h4><?php echo Text::get('profile-location-header'); ?></h4>
        <p><?php echo Text::GmapsLink($user->location); ?></p>
     </div>
    <?php endif ?>

    <?php if (!empty($this['projects'])): ?>
     <div class="message">
         <p><a href="/user/profile/<?php echo $user->id ?>/message"><?php echo Text::get('regular-send_message')?></a></p>
     </div>
    <?php endif ?>

</div>
Exemplo n.º 25
0
    'type'      => 'group',
    'children'  => array(
        'errors' => array(
            'title' => Text::get('form-footer-errors_title'),
            'view'  => new View('view/project/edit/errors.html.php', array(
                'project'   => $project,
                'step'      => $this['step']
            ))                    
        ),
        'buttons'  => array(
            'type'  => 'group',
            'children' => array(
                'next' => array(
                    'type'  => 'submit',
                    'name'  => 'view-step-costs',
                    'label' => Text::get('form-next-button'),
                    'class' => 'next'
                )
            )
        )
    )
);

foreach ($superform['elements'] as $id => &$element) {
    
    if (!empty($this['errors'][$this['step']][$id])) {
        $element['errors'] = arrray();
    }
    
}
Exemplo n.º 26
0
    <?php endif ?>
    <!-- Lista de entradas -->
    <?php if ($action == 'list') : ?>
        <?php if (!empty($posts)) : ?>
            <?php while ($post = $pagedResults->fetchPagedRow()) :
                
                    $share_title = $post->title;
                    $share_url = SITE_URL . '/project/'.$project->id.'/updates/' . $post->id;
                    $facebook_url = 'http://facebook.com/sharer.php?u=' . rawurlencode($share_url) . '&t=' . rawurlencode($share_title);
                    $twitter_url = 'http://twitter.com/home?status=' . rawurlencode($share_title . ': ' . $share_url . ' #Goteo');
                ?>
                <div class="widget post">
                    <?php echo new View('view/blog/post.html.php', array('post' => $post->id, 'show' => 'list', 'url' => '/project/'.$project->id.'/updates/')); ?>
					<ul class="share-goteo">
						<?/*<li class="sharetext"><?php echo Text::get('regular-share_this'); ?></li>*/?>
						<li class="twitter"><a href="<?php echo htmlspecialchars($twitter_url) ?>" target="_blank"><?php echo Text::get('regular-twitter'); ?></a></li>
						<li class="facebook"><a href="<?php echo htmlspecialchars($facebook_url) ?>" target="_blank"><?php echo Text::get('regular-facebook'); ?></a></li>
					</ul>
					<div class="comments-num"><a href="/project/<?php echo $project->id; ?>/updates/<?php echo $post->id; ?>"><?php echo $post->num_comments > 0 ? $post->num_comments . ' ' .Text::get('blog-comments') : Text::get('blog-no_comments'); ?></a></div>
                </div>
            <?php endwhile; ?>
            <ul id="pagination">
                <?php   $pagedResults->setLayout(new DoubleBarLayout());
                        echo $pagedResults->fetchPagedNavigation(); ?>
            </ul>
        <?php else : ?>
            <p><?php echo Text::get('blog-no_posts'); ?></p>
        <?php endif; ?>
    <?php endif; ?>
    
</div>
Exemplo n.º 27
0
        ?>
                        <li><a href="/admin"><span><?php 
        echo Text::get('regular-admin_board');
        ?>
</span></a></li>
                        <?php 
    }
    ?>
                        <li class="logout"><a href="/user/logout"><span><?php 
    echo Text::get('regular-logout');
    ?>
</span></a></li>
                    </ul>
                </div>
            </li>            
            <?php 
} else {
    ?>
            
            <li class="login">
                <a href="/user/login"><?php 
    echo Text::get('regular-login');
    ?>
</a>
            </li>
            
            <?php 
}
?>
        </ul>
    </div>
Exemplo n.º 28
0
?>
</span>
	        </div>
            
	 
            <div>
				<?php 
// el proyecto de trabajo
echo new View('view/project/widget/project.html.php', array('project' => $project, 'investor' => $user));
?>
            </div>
            
            <div>
                <div id="widget-code">
	                <div class="wc-embed" onclick="$('#investor_code').focus();$('#investor_code').select()"><?php 
echo Text::get('project-spread-embed_code');
?>
</div>
              		<textarea id="investor_code" onclick="this.focus();this.select()" readonly="readonly"><?php 
echo htmlentities($widget_code_investor);
?>
</textarea>
    			</div>          
          
            
          </div>
          
   		 </div>
    </div>
        
</div>
Exemplo n.º 29
0
" class="navi-discover-group navi-discover-group-<?php 
        echo $type;
        ?>
"><?php 
        echo $group;
        ?>
</a></li>
                    <?php 
    }
    ?>
                </ul>
                <a class="all" href="/discover/view/<?php 
    echo $type;
    ?>
"><?php 
    echo Text::get('regular-see_all');
    ?>
</a>
            </div>


        </div>

    <?php 
}
?>

    </div>

    <?php 
include 'view/footer.html.php';
Exemplo n.º 30
0
 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 = '*****@*****.**';
         $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);
 }