function cacheIcon2($data)
 {
     global $repository;
     //debug('cacheIcon2', $data);
     $found = sotf_Blob::cacheIcon($data['id']);
     if ($found) {
         return $data['id'] . '.png';
     }
     if ($data['series_id']) {
         $found = sotf_Blob::cacheIcon($data['series_id']);
     }
     if ($found) {
         return $data['series_id'] . '.png';
     }
     if ($data['station_id']) {
         $found = sotf_Blob::cacheIcon($data['station_id']);
     }
     if ($found) {
         return $data['station_id'] . '.png';
     }
     return false;
 }
Example #2
0
 $smarty->assign('ID', $id);
 $prg =& $repository->getObject($id);
 if (!$prg) {
     raiseError("no_such_object", $id);
 }
 if (!$prg->getBool('published')) {
     if (!hasPerm($prg->id, 'change')) {
         raiseError("not_published_yet", $id);
         exit;
     }
     $smarty->assign("UNPUBLISHED", 1);
 }
 $page->setTitle($prg->get('title'));
 // general data
 $prgData = $prg->getAll();
 $prgData['icon'] = sotf_Blob::cacheIcon($id);
 $smarty->assign('PRG_DATA', $prgData);
 // station data
 $station = $prg->getStation();
 $smarty->assign('STATION_DATA', $station->getAllWithIcon());
 // series data
 $series = $prg->getSeries();
 if ($series) {
     $smarty->assign('SERIES_DATA', $series->getAllWithIcon());
 }
 // roles and contacts
 $smarty->assign('ROLES', $prg->getRoles());
 // genre
 $smarty->assign('GENRE', $vocabularies->getGenreName($prg->get('genre_id')));
 // topics
 $smarty->assign('TOPICS', $prg->getTopics());
Example #3
0
$playlist = new sotf_UserPlaylist();
if (sotf_Utils::getParameter("delete_selected") != "") {
    $checkbox = sotf_Utils::getParameter("checkbox");
    $max = count($checkbox);
    for ($i = 0; $i < $max; $i++) {
        $playlist->delete($checkbox[$i]);
    }
    $page->redirect("playlist.php");
}
if (sotf_Utils::getParameter("play_selected") != "") {
    $pl = new sotf_Playlist();
    $checkbox = sotf_Utils::getParameter("checkbox");
    for ($i = 0; $i < count($checkbox); $i++) {
        $prg = new sotf_Programme($checkbox[$i]);
        $pl->addProg($prg);
    }
    $pl->startStreaming();
    $pl->sendRemotePlaylist();
    $page->logRequest();
    exit;
}
$result = $playlist->load();
$programmes = array();
for ($i = 0; $i < count($result); $i++) {
    $result[$i]['icon'] = sotf_Blob::cacheIcon($result[$i]['id']);
    $programmes["0:" . $i] = $result[$i]["title"];
}
$smarty->assign("result", $result);
$smarty->assign("count", count($result));
$smarty->assign("programmes", $programmes);
$page->send();
function getProgrammes($params)
{
    global $config, $db;
    $prglist = xmlrpc_decode($params->getParam(0));
    $query = "SELECT programmes.* FROM (";
    $query .= " SELECT sotf_programmes.*, sotf_stations.name as station, sotf_series.title as seriestitle, sotf_series.description as seriesdescription, sotf_prog_rating.rating_value as rating FROM sotf_programmes";
    $query .= " LEFT JOIN sotf_stations ON sotf_programmes.station_id = sotf_stations.id";
    $query .= " LEFT JOIN sotf_series ON sotf_programmes.series_id = sotf_series.id";
    $query .= " LEFT JOIN sotf_prog_rating ON sotf_programmes.id = sotf_prog_rating.id";
    $query .= ") as programmes WHERE published = 't'";
    $results = array();
    foreach ($prglist as $prg) {
        //		debug("------------>".$prg."<------------------");
        //		debug("------------>".$query." AND id = '$prg'<------------------");
        $results[] = $db->getRow($query . " AND id = '{$prg}'");
    }
    foreach ($results as $key => $result) {
        //		debug("------------>".$result['id']."<------------------");
        $icon = sotf_Blob::cacheIcon($result['id']);
        $results[$key]['icon'] = $config['cacheUrl'] . "/" . $result['id'] . ".png";
        //TODO if no icon {$IMAGEDIR}/noicon.png $imageprefix????
    }
    $retval = xmlrpc_encode($results);
    return new xmlrpcresp($retval);
}
    if (array_key_exists("topic", $fields)) {
        $topicname = $page->getlocalized("topic");
        $topics = $advsearch->getTopics($result[$i]["id"]);
        foreach ($topics as $topic) {
            if ($topic["name"] != "") {
                if ($values[$topicname] == "") {
                    $values[$topicname] = $topic["name"];
                } else {
                    $values[$topicname] .= "; " . $topic["name"];
                }
            }
        }
    }
    $item['title'] = $result[$i][title];
    $item['id'] = $result[$i][id];
    $item['icon'] = sotf_Blob::cacheIcon($item['id']);
    $item['values'] = $values;
    $selected[] = $item;
    $item = "";
    $values = "";
}
//var_dump($selected);
//if (DB::isError($result)) die($result->getMessage());
//print("<BR />".count($result));
$smarty->assign("SQLquery", $SQLquery);
//the query
$smarty->assign("SQLquerySerial", "&SQLquerySerial={$SQLquerySerial}");
//the serialized query
//$smarty->assign("SQLqueryfields", $advsearch->GetSQLqueryfields());	//translated name for all fieldnames of the query
//$smarty->assign("SQLqueryEQs", $advsearch->GetSQLqueryEQs());		//translated name for all EQs (<, >, = ...) of the query
$smarty->assign("HumanReadable", $advsearch->GetHumanReadable());
 function cacheIcon()
 {
     return sotf_Blob::cacheIcon($this->id);
 }
Example #7
0
    $smarty->assign('PLAYLIST', $playlist->load());
    // check if user has default query
    $advsearch = new sotf_AdvSearch();
    $prefs = $user->getPreferences();
    $defQuery = $prefs->getDefaultQuery();
}
// show default query or new programmes
$maxItemsIndexPage = $sotfVars->get("maxItemsIndexPage", 10);
if ($defQuery) {
    $smarty->assign("DEF_QUERY", 1);
    debug("default query", $defQuery);
    $advsearch->Deserialize($defQuery);
    $query = $advsearch->GetSQLCommand();
    debug("query", $query);
    //get the number of results
    $max = $db->getOne("SELECT count(*) FROM ( {$query} ) as foo ");
    $smarty->assign("DEF_QUERY_MAX", $max);
    $res = $db->limitQuery($query, 0, $maxItemsIndexPage);
    $hits = '';
    while (DB_OK === $res->fetchInto($row)) {
        $row['icon'] = sotf_Blob::cacheIcon($row['id']);
        $hits[] = $row;
    }
    $smarty->assign("NEWS", $hits);
} else {
    // get new programmes
    $smarty->assign('NEWS', sotf_Programme::getNewProgrammes($fromDay, $maxItemsIndexPage));
}
// get topics with most content
$smarty->assign('TOPICS', $repository->getTopTopics(5));
$page->send();
 /** caches icon for object, and adds indicator flag for Smarty templates whether there is an icon */
 function getAllWithIcon()
 {
     $retval = $this->getAll();
     $retval['icon'] = sotf_Blob::cacheIcon($this->id);
     return $retval;
 }
<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*  
 * $Id$
 * Created for the StreamOnTheFly project (IST-2001-32226)
 * Authors: András Micsik, Máté Pataki, Tamás Déri 
 *          at MTA SZTAKI DSD, http://dsd.sztaki.hu
 */
require "init.inc.php";
$contactId = sotf_Utils::getParameter('id');
$contact =& new sotf_Contact($contactId);
$smarty->assign('PAGETITLE', $page->getlocalizedWithParams('programs_by', $contact->get('name')));
$smarty->assign('CONTACT_ID', $contactId);
$smarty->assign('CONTACT_NAME', $contact->get('name'));
$smarty->assign('CONTACT_DATA', $contact->getAllWithIcon());
$limit = $page->splitList($contact->countProgrammes(), "{$scriptUrl}/{$contactId}");
$progs = $contact->listProgrammes($limit["from"], $limit["maxresults"]);
for ($i = 0; $i < count($progs); $i++) {
    $progs[$i]['icon'] = sotf_Blob::cacheIcon($progs[$i]['id']);
}
$smarty->assign('PROGS', $progs);
$page->send();