Esempio n. 1
0
/**
 * Viatges "handler" 
 * @pages:
 *       view,
 *       add
 *       
 *
 * @return diferent contents
 */
function trip_page_handler($trip)
{
    $page = $trip[0];
    if (empty($page)) {
        ossn_error_page();
        //Mostra 404
    }
    // var_dump($trip);
    switch ($page) {
        //Vista viatge (Accés públic no existeix restricció de visualització)
        case 'view':
            $view = new OptionTrips();
            $viewAlbum = new OssnAlbums();
            $album = $viewAlbum->GetAlbum(19);
            //Agafa id del viatge
            $infoTrip = $view->GetTrip($trip[1]);
            //Agafa id del viatge
            $infoDays = $view->GetTripDays($trip[1]);
            // var_dump($image);
            //$photo['entity'] = $image;
            $trip['info'] = $infoTrip;
            $trip['day'] = $infoDays;
            $trip['album'] = $album;
            //redirect user to home page if trip is empty
            if (empty($infoTrip)) {
                redirect();
            }
            //Missing "back" button to trips
            $owner = ossn_user_by_guid($infoTrip->guid);
            $back = array('text' => ossn_print('back'), 'href' => ossn_site_url("u/{$owner->username}/trips"), 'class' => 'button-grey');
            $control = ossn_plugin_view('output/url', $back);
            $contents = array('title' => ossn_print('trip:details'), 'content' => ossn_plugin_view('trips/pages/trip/view', $trip), 'controls' => $control, 'module_width' => '850px');
            //inclou page layout
            $module['content'] = ossn_set_page_layout('module', $contents);
            //Inclou modul amb els botons d'accions
            $content = ossn_set_page_layout('contents', $module);
            echo ossn_view_page($title, $content);
            break;
            //Afegir viatge
        //Afegir viatge
        case 'add':
            //Missing "back" button to trips
            $owner = ossn_loggedin_user()->username;
            // var_dump($owner);
            $back = array('text' => ossn_print('back'), 'href' => ossn_site_url("u/{$owner}/trips"), 'class' => 'button-grey');
            $control = ossn_plugin_view('output/url', $back);
            $contents = array('title' => ossn_print('add:trip'), 'content' => ossn_plugin_view('trips/pages/trip/add'), 'controls' => $control, 'module_width' => '850px');
            //inclou page layout
            $module['content'] = ossn_set_page_layout('module', $contents);
            //Inclou modul amb els botons d'accions
            $content = ossn_set_page_layout('contents', $module);
            echo ossn_view_page($title, $content);
            // echo ossn_plugin_view('output/url', array(
            // 		'title' => ossn_print('add:trip'),
            // 		'contents' => ossn_plugin_view('trips/pages/trip/add'),
            // 		'callback' => '#ossn-trip-submit'
            // ));
            break;
        case 'addPhoto':
            //add photos (ajax)
            if (!ossn_is_xhr()) {
                ossn_error_page();
            }
            echo ossn_plugin_view('output/ossnbox', array('title' => ossn_print('add:photos'), 'contents' => ossn_plugin_view('trips/pages/trip/addPhoto'), 'callback' => '#photos-submit'));
            break;
        default:
            ossn_error_page();
            //Mostra 404
            break;
    }
}
Esempio n. 2
0
<?php

/**
 *    OpenSource-SocialNetwork
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://opensource-socialnetwork.com/licence
 * @link      http://www.opensource-socialnetwork.com/licence
 */
$album = new OssnAlbums();
$image = $params['entity'];
$name = $album->GetAlbum($image->owner_guid)->album->title;
$img = str_replace('album/photos/', '', $image->value);
?>
<div class="ossn-photo-view">
    <h2> <?php 
echo $name;
?>
</h2>
    <a href="<?php 
echo ossn_site_url("album/view/{$image->owner_guid}");
?>
"> <?php 
echo ossn_print('back:to:album');
?>
  </a>
    <br/>
    <table border="0" class="ossn-photo-viewer">
        <tr>
<?php

/**
 *    OpenSource-SocialNetwork
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://opensource-socialnetwork.com/licence
 * @link      http://www.opensource-socialnetwork.com/licence
 */
$albums = new OssnAlbums();
$photos = $albums->GetAlbum($params['album']);
echo '<div class="ossn-photos">';
echo '<h2>' . $photos->album->title . '</h2>';
if ($photos->photos) {
    foreach ($photos->photos as $photo) {
        $image = str_replace('album/photos/', '', $photo->value);
        $image = ossn_site_url() . "album/getphoto/{$params['album']}/{$image}?size=album";
        $view_url = ossn_site_url() . 'photos/view/' . $photo->guid;
        echo "<li><a href='{$view_url}'><img src='{$image}'  class='pthumb'/></a></li>";
    }
}
echo '</div>';