Beispiel #1
0
<?php

/**
 * Script que agafa les dades del formulari per inserir nou viatge a la bdd
 *
 * @author    Dani Marti <*****@*****.**>
 * @copyright 2016 ABALIT TECHNOLOGIES SL
 * @license   GPL
 * @link      http://www.abalit.org/
 */
$add = new OptionTrips();
$params['title'] = input('title');
$params['place'] = input('place');
$params['continent'] = input('continent');
//Get lat long from input place
$latLong = $add->getLatLng($params['place']);
$coordinates = explode(";", $latLong);
//String to Array
$params['latitude'] = $coordinates[0];
$params['longitude'] = $coordinates[1];
$params['description'] = input('description');
$params['num_days'] = input('num_days');
foreach ($params as $field) {
    if (empty($field)) {
        ossn_trigger_message(ossn_print('fields:required'), 'error');
        redirect(REF);
    }
}
//Params no required
$params['transport'] = input('transport');
$params['security'] = input('security');
Beispiel #2
0
<?php

/**
 * Script Widget Profile últim viatge inserit per l'usuari
 *
 * @author    Dani Marti <*****@*****.**>
 * @copyright 2016 ABALIT TECHNOLOGIES SL
 * @license   GPL
 *
 */
echo '<div class="ossn-profile-module-trips">';
$trips = new OptionTrips();
$lastTrip = $trips->getLastTrip();
if ($lastTrip) {
    // foreach ($lastTrip as $nombre => $valor) {
    //      echo "$nombre: $valor\n";
    //    }
    echo '<label>' . ossn_print('last:trip:place') . '</label>: ';
    echo $lastTrip->place . '<br>';
    echo '<label>' . ossn_print('last:trip:title') . '</label>: ';
    echo $lastTrip->title . '<br>';
    echo '<label>' . ossn_print('last:trip:date') . '</label>: ';
    echo $lastTrip->date . '<br>';
    //var_dump($lastTrip->date);
} else {
    echo '<h3>' . ossn_print('no:last:trip') . '</h3>';
}
echo '</div>';
Beispiel #3
0
<?php

/**
 * Script Mostra tot els viatges inserits de la base de dades
 *
 * @author    Dani Marti <*****@*****.**>
 * @copyright 2016 ABALIT TECHNOLOGIES SL
 * @license   GPL
 *
 */
// echo '<div class="ossn-trips">';
$trips = new OptionTrips();
$allTrips = $trips->getTrips();
if ($allTrips) {
    foreach ($allTrips as $trip) {
        echo '<div class="ossn-wall-item">';
        //var_dump($trip);
        // foreach ($trip as $nombre => $valor) {
        // $continent = $trips->getLongContinent($trip->continent);
        // echo $trip->place .'({$continent})';
        // echo $trip->place,' (' , $trips->getLongContinent($trip->continent),')';
        // echo "{$trip->place} ({$trips->getLongContinent($trip->continent)})";
        // echo '<div>';
        // echo ossn_user_friendly_time($trip->date); //Temps que fa que ha estat creat
        // echo $trip->place, '<br>';
        // echo $trips->getLongContinent($trip->continent), '<br>';
        // echo $trip->id_trip, '<br>';
        // echo $trip->title, '<br>';
        // echo $trip->description, '<br>';
        // echo '<input class="btn btn-primary ossn-wall-post" type="text" value="Ver" onclick="location.href = \'http://localhost/social1/social/trip/view/1\'"><br>';
        // }
Beispiel #4
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;
    }
}