Exemplo n.º 1
0
            } else {
                $statuses = '';
                //all
            }
        } else {
            $statuses = array('accepted', 'geograph');
        }
        $images->getImagesByUser($uid, $statuses, 'gridimage_id desc', $limit, true);
        $images->assignSmarty($smarty, 'userimages');
        if (count($images->images) == $limit) {
            $smarty->assign('limit', $limit);
        }
        if (count($images->images)) {
            $overview = new GeographMapMosaic('overview');
            $overview->type_or_user = $uid;
            $overview->assignToSmarty($smarty, 'overview');
        }
        $profile->md5_email = md5(strtolower($profile->email));
    } else {
        $profile = new GeographUser();
        $profile->user_id = $uid;
        if ($uid == $USER->user_id) {
            if (empty($_SESSION['last_ticket_time']) || $USER->last_ticket_time > $_SESSION['last_ticket_time']) {
                $profile->tickets = $USER->tickets;
            }
        }
        $smarty->assign_by_ref('profile', $profile);
    }
}
function smarty_function_TruncateWithExpand($input, $more = 'Click here to Read More...')
{
Exemplo n.º 2
0
 function assignToSmarty($smarty)
 {
     global $CONF;
     $taken = $this->getFormattedTakenDate();
     //get the grid references
     $this->getSubjectGridref(true);
     $this->getPhotographerGridref(true);
     //remove grid reference from title
     $this->bigtitle = trim(preg_replace("/^{$this->grid_reference}/", '', $this->title));
     $this->bigtitle = preg_replace('/(?<![\\.])\\.$/', '', $this->bigtitle);
     $rid = $this->grid_square->reference_index;
     $gridrefpref = $CONF['gridrefname'][$rid];
     $smarty->assign('page_title', $this->bigtitle . ":: {$gridrefpref}{$this->grid_reference}");
     $smarty->assign('image_taken', $taken);
     $smarty->assign('ismoderator', $ismoderator);
     $smarty->assign_by_ref('image', $this);
     //get a token to show a suroudding geograph map
     $mosaic = new GeographMapMosaic();
     $smarty->assign('map_token', $mosaic->getGridSquareToken($this->grid_square));
     //find a possible place within 25km
     $place = $this->grid_square->findNearestPlace(75000);
     $smarty->assign_by_ref('place', $place);
     if (empty($this->comment)) {
         $smarty->assign('meta_description', "{$this->grid_reference} :: {$this->bigtitle}, " . strip_tags(smarty_function_place(array('place' => $place))));
     } else {
         $smarty->assign('meta_description', $this->comment);
     }
     if (!empty($CONF['forums'])) {
         //let's find posts in the gridref discussion forum
         $this->grid_square->assignDiscussionToSmarty($smarty);
     }
     //count the number of photos in this square
     $smarty->assign('square_count', $this->grid_square->imagecount);
     //lets add an overview map too
     $overview = new GeographMapMosaic('largeoverview');
     $overview->setCentre($this->grid_square->x, $this->grid_square->y);
     //does call setAlignedOrigin
     $overview->assignToSmarty($smarty, 'overview');
     $smarty->assign('marker', $overview->getSquarePoint($this->grid_square));
     require_once 'geograph/conversions.class.php';
     $conv = new Conversions();
     list($lat, $long) = $conv->gridsquare_to_wgs84($this->grid_square);
     $smarty->assign('lat', $lat);
     $smarty->assign('long', $long);
     list($latdm, $longdm) = $conv->wgs84_to_friendly($lat, $long);
     $smarty->assign('latdm', $latdm);
     $smarty->assign('longdm', $longdm);
     //lets add an rastermap too
     $rastermap = new RasterMap($this->grid_square, false);
     $rastermap->addLatLong($lat, $long);
     if (!empty($this->viewpoint_northings)) {
         $rastermap->addViewpoint($this->viewpoint_refindex, $this->viewpoint_eastings, $this->viewpoint_northings, $this->viewpoint_grlen, $this->view_direction);
     } elseif (isset($this->view_direction) && strlen($this->view_direction) && $this->view_direction != -1) {
         $rastermap->addViewDirection($this->view_direction);
     }
     $smarty->assign_by_ref('rastermap', $rastermap);
     $smarty->assign('x', $this->grid_square->x);
     $smarty->assign('y', $this->grid_square->y);
     if ($this->view_direction > -1) {
         $smarty->assign('view_direction', $this->view_direction % 90 == 0 ? strtoupper(heading_string($this->view_direction)) : ucwords(heading_string($this->view_direction)));
     }
     $level = $this->grid_square->imagecount > 1 ? 6 : 5;
     $smarty->assign('sitemap', getSitemapFilepath($level, $this->grid_square));
 }