本文整理汇总了PHP中sotf_Utils::getParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP sotf_Utils::getParameter方法的具体用法?PHP sotf_Utils::getParameter怎么用?PHP sotf_Utils::getParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sotf_Utils
的用法示例。
在下文中一共展示了sotf_Utils::getParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: raiseError
<?php
// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*
* $Id: createContact.php 225 2003-06-12 16:46:59Z andras $
* 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";
$page->popup = true;
$page->forceLogin();
$stationId = sotf_Utils::getParameter('stationid');
$contactName = sotf_Utils::getParameter('name');
if ($contactName) {
if (sotf_Contact::findByNameLocal($contactName)) {
//$page->addStatusMsg('contact_name_exists');
//$page->redirect("createCOntact.php);
raiseError("contact_name_exists");
exit;
}
// create a new contact
$contact = new sotf_Contact();
$status = $contact->create($contactName, $stationId);
if (!$status) {
$page->addStatusMsg('contact_create_failed');
} else {
$permissions->addPermission($contact->id, $user->id, 'admin');
$page->redirect("editContact.php?id=" . $contact->id);
exit;
}
示例2: basename
if ($entry != "." && $entry != "..") {
$currentFile = $dirPath . "/" . $entry;
//debug("examining", $currentFile);
if (!is_dir($currentFile)) {
$XBMF[] = basename($currentFile);
}
}
}
$dir->close();
$smarty->assign("XBMF", $XBMF);
// UPDATE Topic Tree ADDED BY Martin Schmidt, FH St. Poelten
if (sotf_Utils::getParameter('updatetopictree')) {
$query = "SELECT * FROM sotf_vars WHERE name='topic_update_done' AND value=1";
$result = $db->getRow($query);
if (count($result) == 0) {
if (is_file($config['basedir'] . '/code/share/update_topics.txt') && sotf_Utils::getParameter('confirmed')) {
$db->query("BEGIN;");
// UPDATE sotf_topic_tree_defs, sotf_topics
$update_statements = "";
$upd_file = fopen($config['basedir'] . '/code/share/update_topics.txt', "r");
while (!feof($upd_file)) {
$update_statements .= fgets($upd_file, 4096);
}
fclose($upd_file);
$db->query($update_statements);
// UPDATE sotf_prog_topics (OLD TOPIC ID => NEW TOPIC ID)
$new_topics = array('001td8' => '001td2', '001td9' => '001td6', '001td10' => '001td8', '001td11' => '001td9', '001td12' => '001td10', '001td13' => '001td11', '001td14' => '001td12', '001td15' => '001td12', '001td16' => '001td13', '001td17' => '001td10', '001td18' => '001td14', '001td19' => '001td15', '001td20' => '001td16', '001td21' => '001td18', '001td22' => '001td19', '001td23' => '001td20', '001td24' => '001td21', '001td25' => '001td22', '001td26' => '001td23', '001td27' => '001td24', '001td28' => '001td18', '001td29' => '001td25', '001td30' => '001td26', '001td31' => '001td27', '001td32' => '001td28', '001td33' => '001td29', '001td34' => '001td18', '001td35' => '001td25', '001td36' => '001td30', '001td37' => '001td18', '001td38' => '001td31', '001td39' => '001td32', '001td40' => '001td18', '001td41' => '001td34', '001td42' => '001td35', '001td43' => '001td35', '001td44' => '001td36', '001td45' => '001td35', '001td46' => '001td34', '001td47' => '001td34', '001td48' => '001td36', '001td49' => '001td26', '001td50' => '001td37', '001td51' => '001td38', '001td52' => '001td39', '001td53' => '001td40', '001td54' => '001td35', '001td55' => '001td38', '001td56' => '001td38', '001td57' => '001td41', '001td58' => '001td42', '001td59' => '001td43', '001td60' => '001td44', '001td61' => '001td41', '001td62' => '001td41', '001td63' => '001td41', '001td64' => '001td45', '001td65' => '001td46', '001td66' => '001td47', '001td67' => '001td48', '001td68' => '001td45', '001td69' => '001td41', '001td70' => '001td49', '001td71' => '001td41', '001td72' => '001td42', '001td73' => '001td50', '001td74' => '001td51', '001td75' => '001td52', '001td76' => '001td51', '001td77' => '001td53', '001td78' => '001td54', '001td79' => '001td55', '001td80' => '001td56', '001td81' => '001td57', '001td82' => '001td58', '001td83' => '001td51', '001td84' => '001td59', '001td85' => '001td60', '001td86' => '001td61', '001td87' => '001td62', '001td88' => '001td63', '001td89' => '001td62', '001td90' => '001td64', '001td91' => '001td65', '001td92' => '001td66', '001td93' => '001td67', '001td94' => '001td68', '001td95' => '001td66', '001td96' => '001td61', '001td97' => '001td69', '001td98' => '001td27', '001td99' => '001td65', '001td100' => '001td70', '001td101' => '001td69', '001td102' => '001td71', '001td103' => '001td72', '001td104' => '001td73', '001td105' => '001td74', '001td106' => '001td75', '001td107' => '001td76', '001td108' => '001td33', '001td109' => '001td111', '001td110' => '001td77', '001td111' => '001td33', '001td112' => '001td106', '001td113' => '001td78', '001td114' => '001td79', '001td115' => '001td80', '001td116' => '001td81', '001td117' => '001td82', '001td118' => '001td83', '001td119' => '001td84', '001td120' => '001td85', '001td121' => '001td86', '001td122' => '001td87', '001td123' => '001td88', '001td124' => '001td89', '001td125' => '001td90', '001td126' => '001td91', '001td127' => '001td92', '001td128' => '001td90', '001td129' => '001td90', '001td130' => '001td93', '001td131' => '001td90', '001td132' => '001td94', '001td133' => '001td91', '001td134' => '001td95', '001td135' => '001td96', '001td136' => '001td97', '001td137' => '001td98', '001td138' => '001td99', '001td139' => '001td98', '001td140' => '001td100', '001td141' => '001td17', '001td142' => '001td17', '001td143' => '001td17', '001td144' => '001td17', '001td145' => '001td17', '001td146' => '001td17', '001td147' => '001td17', '001td148' => '001td17', '001td149' => '001td17', '001td150' => '001td17', '001td151' => '001td17', '001td152' => '001td17', '001td153' => '001td17', '001td154' => '001td17', '001td155' => '001td17', '001td156' => '001td17', '001td157' => '001td17', '001td158' => '001td17', '001td159' => '001td17', '001td160' => '001td17', '001td161' => '001td17', '001td162' => '001td17', '001td163' => '001td17', '001td164' => '001td17', '001td165' => '001td17', '001td166' => '001td17', '001td167' => '001td17', '001td168' => '001td17', '001td169' => '001td17', '001td170' => '001td17', '001td171' => '001td17', '001td172' => '001td17', '001td173' => '001td17', '001td174' => '001td17', '001td175' => '001td17', '001td176' => '001td17', '001td177' => '001td17', '001td178' => '001td17', '001td179' => '001td17', '001td180' => '001td17', '001td181' => '001td17', '001td182' => '001td17', '001td183' => '001td17', '001td184' => '001td17', '001td185' => '001td17', '001td186' => '001td17', '001td187' => '001td17', '001td188' => '001td17', '001td189' => '001td17', '001td190' => '001td17', '001td191' => '001td17', '001td192' => '001td17', '001td193' => '001td17', '001td194' => '001td17', '001td195' => '001td17', '001td196' => '001td17', '001td197' => '001td17', '001td198' => '001td17', '001td199' => '001td17', '001td200' => '001td17', '001td201' => '001td17', '001td202' => '001td17', '001td203' => '001td17', '001td204' => '001td17', '001td205' => '001td17', '001td206' => '001td17', '001td207' => '001td17', '001td208' => '001td17', '001td209' => '001td17', '001td210' => '001td101', '001td211' => '001td102', '001td212' => '001td103', '001td213' => '001td104', '001td214' => '001td105', '001td215' => '001td44', '001td216' => '001td106', '001td217' => '001td106', '001td218' => '001td101', '001td219' => '001td101', '001td220' => '001td103', '001td221' => '001td107', '001td222' => '001td108', '001td223' => '001td103', '001td224' => '001td109', '001td225' => '001td109', '001td226' => '001td110', '001td227' => '001td112', '001td228' => '001td113', '001td229' => '001td114', '001td230' => '001td115', '001td231' => '001td16', '001td232' => '001td116', '001td233' => '001td117', '001td234' => '001td118', '001td235' => '001td119', '001td236' => '001td22', '001td237' => '001td120', '001td238' => '001td119', '001td239' => '001td121', '001td240' => '001td122', '001td241' => '001td113', '001td242' => '001td119', '001td243' => '001td119', '001td244' => '001td123', '001td245' => '001td15', '001td246' => '001td113', '001td247' => '001td124', '001td248' => '001td9', '001td249' => '001td119', '001td250' => '001td125', '001td251' => '001td10', '001td252' => '001td4', '001td253' => '001td126', '001td254' => '001td119', '001td255' => '001td113', '001td256' => '001td16', '001td257' => '001td15', '001td258' => '001td127', '001td259' => '001td18', '001td260' => '001td110');
$old_topics = array_keys($new_topics);
for ($k = 0; $k < count($old_topics); $k++) {
// get programs with current OLD topic_id
$q_progs = $db->query("SELECT prog_id FROM sotf_prog_topics WHERE topic_id = '" . $old_topics[$k] . "';");
示例3:
$_SESSION['error'] = $error;
//needed after reload
$page->redirect($_SERVER["PHP_SELF"] . "?" . $subpage . "=2");
//redirect page
}
////SMARTY variables
$smarty->assign("table", $portal->getTable());
//current layout table
//user rights and options
$smarty->assign("is_admin", $portal->isAdmin($user->getId()));
//true if admin
$smarty->assign("is_logged_in", $user->loggedIn());
//true if logged in
$smarty->assign("username", $user->getName());
//username (if logged in)
$smarty->assign("back", sotf_Utils::getParameter('back'));
//true if came from programmes editor page to the view programme page
//directories and names
$smarty->assign("rootdir", $rootdir);
//root directory (portal/www)
$smarty->assign("php_self", $_SERVER['PHP_SELF']);
//php self for the form submit and hrefs
$smarty->assign("portal_name", $portal_name);
//name of the portal
$smarty->assign("sotfSite", $sotfSite);
//location of the StreamontheFly portal
$smarty->assign("portal", $settings["portal"]);
$smarty->assign("home", $settings["home"]);
$smarty->assign("programmes", $settings["programmes"]);
$smarty->assign("css", $settings["css"]);
//CSS enabled
示例4: sotf_FileList
$smarty->assign("USERFTPURL", $userFtpUrl);
$stations = $permissions->listStationsForEditor();
if (!empty($stations)) {
$smarty->assign_by_ref("STATIONS", $stations);
}
$userAudioFiles = new sotf_FileList();
$userAudioFiles->getAudioFromDir($user->getUserDir());
$list = $userAudioFiles->getFileNames();
if (!empty($list)) {
$smarty->assign_by_ref("USER_AUDIO_FILES", $list);
}
////form sent
$series = sotf_Utils::getParameter("series");
$filter = sotf_Utils::getParameter("filter");
$sort1 = sotf_Utils::getParameter("sort1");
$sort2 = sotf_Utils::getParameter("sort2");
////from user prefs if first time on page
$prefs = $user->getPreferences();
if ($sort1 == NULL) {
$sort1 = $prefs->editorSettings[sort1];
}
if ($sort2 == NULL) {
$sort2 = $prefs->editorSettings[sort2];
}
if ($series == NULL) {
$series = $prefs->editorSettings[series];
}
if ($filter == NULL) {
$filter = $prefs->editorSettings[filter];
}
////default settings if first time here
示例5: define
* $Id: podcast.php 558 2006-05-04 14:34:58Z buddhafly $
* Authors: András Micsik
* at MTA SZTAKI DSD, http://dsd.sztaki.hu
* nicer filenames, stream link, broadcastdate and
* role supporte by rama + rjankowski
*/
define('ITEMS_IN_RSS', 10);
require "init.inc.php";
require_once $config['classdir'] . "/sotf_AdvSearch.class.php";
//$prgId = sotf_Utils::getParameter('id');
$stationId = sotf_Utils::getParameter('station');
$seriesId = sotf_Utils::getParameter('series');
//$userName = sotf_Utils::getParameter('user');
//$queryName = sotf_Utils::getParameter('qname');
$query = sotf_Utils::getParameter('query');
$items = intval(sotf_Utils::getParameter('count'));
if (!$items or $items < 1 or $items > 200) {
$items = ITEMS_IN_RSS;
}
//debug("ITEMS", $items);
function writeTag(&$rss, $tag, $value, $lang = '', $attr = '')
{
if ($lang) {
$langAttr = "xml:lang=\"{$lang}\"";
}
if (is_array($attr)) {
foreach ($attr as $k => $v) {
$attrNew .= $k . '="' . htmlspecialchars($v) . '" ';
}
$attr = $attrNew;
}
示例6: debug
if ($save) {
$userPerms = $permissions->getPermissions($objectid, $userid);
debug("userPerms", $userPerms);
if (sotf_Utils::getParameter('perm_admin')) {
if (!in_array('admin', $userPerms)) {
$permissions->addPermission($objectid, $userid, 'admin');
}
} else {
if (in_array('admin', $userPerms)) {
$permissions->delPermission($objectid, $userid, 'admin');
}
$perms['create'] = sotf_Utils::getParameter('perm_create');
$perms['change'] = sotf_Utils::getParameter('perm_change');
$perms['add_prog'] = sotf_Utils::getParameter('perm_add_prog');
$perms['delete'] = sotf_Utils::getParameter('perm_delete');
$perms['authorize'] = sotf_Utils::getParameter('perm_authorize');
while (list($perm, $hasP) = each($perms)) {
if ($hasP && !in_array($perm, $userPerms)) {
$permissions->addPermission($objectid, $userid, $perm);
} elseif (!$hasP && in_array($perm, $userPerms)) {
$permissions->delPermission($objectid, $userid, $perm);
}
}
}
$page->redirect('closeAndRefresh.php?anchor=perms');
}
$smarty->assign('CONTEXT', $context);
$smarty->assign('OBJECT_NAME', $objectname);
$smarty->assign('OBJECT_ID', $objectid);
$smarty->assign('USER_NAME', $username);
$smarty->assign('USER_ID', $userid);
示例7: sotf_Playlist
require "init.inc.php";
if (sotf_Utils::getParameter('reconnect')) {
$playlist = new sotf_Playlist();
$playlist->sendMyRemotePlaylist();
$page->logRequest();
exit;
}
if (sotf_Utils::getParameter('stop')) {
$playlist = new sotf_Playlist();
$playlist->stopMyStream();
$page->redirect(myGetenv('HTTP_REFERER'));
exit;
}
$id = sotf_Utils::getParameter('id');
$fileid = sotf_Utils::getParameter('fileid');
$jingle = sotf_Utils::getParameter('jingle');
if (empty($id)) {
raiseError("Missing parameters!", 'id');
}
$playlist = new sotf_Playlist();
if ($jingle) {
// play the jingle of station/series
$obj = $repository->getObject($id);
if (!$obj) {
raiseError("no_such_object", $id);
}
if (!$obj->isLocal()) {
// have to send user to home node of this programme
sotf_Node::redirectToHomeNode($obj, 'listen.php');
exit;
}
示例8: raiseError
<?php
require "init.inc.php";
$smarty->assign('PAGETITLE', $page->getlocalized('AdminPage'));
$page->forceLogin();
$page->popup = true;
$page->errorURL = "createNeighbour.php";
if (!hasPerm('node', "change")) {
raiseError("You have no permission to change node settings!");
}
$url = sotf_Utils::getParameter('url');
$nid = sotf_Utils::getParameter('node_id');
//
$createNew = sotf_Utils::getParameter('create_new_node');
if ($createNew) {
if (!$url) {
$page->addStatusMsg('no_url_given');
} elseif (sotf_Node::getNodeById($nid)) {
$page->addStatusMsg('node_id_occupied');
} else {
$neighbor = new sotf_Neighbour();
$neighbor->set('node_id', $nid);
$neighbor->set('use_for_outgoing', 'f');
$neighbor->set('accept_incoming', 't');
$neighbor->set('pending_url', $url);
$neighbor->create();
$page->redirect("closeAndRefresh.php?anchor=network");
exit;
}
$page->redirect("createNeighbour.php?node_id={$nid}&url=" . urlencode($url) . "#network");
exit;
示例9: debug
$page->redirect("admin.php#network");
}
// delete neighbour
$deln = sotf_Utils::getParameter('delneighbour');
debug("deln", $deln);
if ($deln) {
debug("deln", "!!");
$nid = sotf_Utils::getParameter('nodeid');
$neighbour = sotf_Neighbour::getById($nid);
$neighbour->delete();
$page->redirect("admin.php#network");
}
// manage permissions
$delperm = sotf_Utils::getParameter('delperm');
if ($delperm) {
$username = sotf_Utils::getParameter('username');
$userid = $user->getUserid($username);
if (empty($userid) || !is_numeric($userid)) {
raiseError("Invalid username: {$username}");
}
$permissions->delPermission('node', $userid);
$msg = $page->getlocalizedWithParams("deleted_permissions_for", $username);
$page->addStatusMsg($msg, false);
$page->redirect("admin.php");
exit;
}
// generate output
$localNode = sotf_Node::getLocalNode();
if (!$localNode) {
$localNode = new sotf_Node();
$localNode->set('node_id', $nodeId);
示例10: mail
<?php
// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*
* $Id: login.php,v 1.4 2003/09/25 07:46:12 andras Exp $
* Created for the StreamOnTheFly project (IST-2001-32226)
* Author: Martin Schmidt, ptmschmidt@fh-stpoelten.ac.at
*/
require "init.inc.php";
$username = sotf_Utils::getParameter('userid');
$email = sotf_Utils::getParameter('email');
$okURL = sotf_Utils::getParameter('okURL');
if ($username && $email) {
$temp_user = new sotf_User();
$storage = $temp_user->getStorageObject();
$fields['userid'] = $temp_user->getUserid($username);
if ($fields['userid'] != NULL) {
$data = $storage->userDbSelect($fields);
}
if ($email == $data['email'] && $username == $data['username']) {
$new_password = sotf_Utils::randString(6);
global $page;
$login_href = "http://" . $_SERVER['HTTP_HOST'] . $config['localPrefix'] . "/login.php";
$subject = $page->getlocalized("pass_mail_subject");
$message = $page->getlocalizedWithParams("pass_mail_message", $username, $new_password, $login_href);
mail($email, $subject, $message, "From: no-reply@streamonthefly.org\r\nX-Mailer: PHP/" . phpversion() . "\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=utf-8\r\nContent-Transfer-Encoding: 8bit\r\n\r\n");
$fields['password'] = $new_password;
$fields['email'] = $email;
$storage->userDbUpdate($fields);
} else {
$errorMsg = $page->getlocalized("new_pass_error");
示例11: checkPerm
exit;
}
// upload jingle
$uploadjingle = sotf_Utils::getParameter('uploadjingle');
if ($uploadjingle) {
checkPerm($series, "change");
$file = $user->getUserDir() . '/' . $_FILES['userfile']['name'];
moveUploadedFile('userfile', $file);
$series->setJingle($file);
$page->redirect("editSeries.php?seriesid={$seriesid}#icon");
exit;
}
// select icon/jingle from user files
$filename = sotf_Utils::getParameter('filename');
$setjingle = sotf_Utils::getParameter('setjingle');
$seticon = sotf_Utils::getParameter('seticon');
if ($setjingle) {
checkPerm($series, "change");
$file = sotf_Utils::getFileInDir($user->getUserDir(), $filename);
$series->setJingle($file);
$page->redirect("editSeries.php?seriesid={$seriesid}#icon");
} elseif ($seticon) {
checkPerm($series, "change");
$file = sotf_Utils::getFileInDir($user->getUserDir(), $filename);
//debug("FILE", $file);
if ($series->setIcon($file)) {
//$page->addStatusMsg("ok_icon");
} else {
//$page->addStatusMsg("error_icon");
}
$page->redirect("editSeries.php?seriesid={$seriesid}#icon");
示例12: elseif
} elseif ($deluser) {
for ($i = 0; $i < count($selectedUserFiles); $i++) {
$retval = $user->deleteFile($selectedUserFiles[$i]);
}
} elseif ($send) {
$success = move_uploaded_file($_FILES['userfile']['tmp_name'], $user->getUserDir() . '/' . $_FILES['userfile']['name']);
if (!$success) {
$status = "&uploaderror=1";
}
$page->redirect($_SERVER['PHP_SELF'] . "?id=" . rawurlencode($id) . "&okURL=" . rawurlencode($okURL) . $status);
} elseif ($ok) {
$page->redirect($okURL);
} elseif ($itemtoftp) {
foreach ($_POST as $name => $value) {
if (substr($name, 0, 6) == 'tosel-') {
$postvar = sotf_Utils::getParameter($name);
for ($i = 0; $i < count($postvar); $i++) {
$retval = $prg->getAudio($postvar[$i], $copy);
}
}
}
for ($i = 0; $i < count($selectedOtherFiles); $i++) {
$retval = $prg->getOtherFile($selectedOtherFiles[$i], $copy);
}
$page->redirect($PHP_SELF . "?id=" . rawurlencode($id) . "&okURL=" . rawurlencode($okURL));
} elseif ($ftptoaudio) {
for ($i = 0; $i < count($selectedUserFiles); $i++) {
$retval = $prg->setAudio($selectedUserFiles[$i], $copy);
}
$page->redirect($PHP_SELF . "?id=" . rawurlencode($id) . "&okURL=" . rawurlencode($okURL));
} elseif ($ftptoother) {
示例13: raiseError
<?php
// -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*
* $Id: export.php,v 1.5 2004/03/05 15:35:11 micsik Exp $
* 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";
$id = sotf_Utils::getParameter('id');
$type = sotf_Utils::getParameter('type');
$prg =& new sotf_Programme($id);
if (!$prg) {
raiseError("no_such_object", $id);
}
if (!$prg->isLocal()) {
raiseError("works only for local objects!", $id);
exit;
}
checkPerm($prg, 'change');
if ($type == 1) {
// send XBMF metadata
$meta = new sotf_Metadata($prg);
$md = $meta->getXBMFMetadata();
header("Content-type: application/xml\n");
//header("Content-type: text/plain\n");
//header("Content-transfer-encoding: binary\n");
header("Content-length: " . strlen($md) . "\n");
echo $md;
} elseif ($type == 2) {
示例14:
<?php
// -*- tab-width: 3; indent-tabs-mode: 1; -*-
// $Id$
require "init.inc.php";
$hitsPerPage = $sotfVars->get("hitsPerPage", 15);
$smarty->assign('PAGETITLE', $page->getlocalized('Stations'));
$start = sotf_Utils::getParameter('start');
$station = sotf_Utils::getParameter('station');
$delete = sotf_Utils::getParameter('delete');
if ($delete and hasPerm('node', 'delete')) {
$st =& new sotf_Station($station);
$st->delete();
$page->addStatusMsg('delete_ok');
$page->redirect($_SERVER["PHP_SELF"]);
}
$limit = $page->splitList(sotf_Station::countAll(), "{$php_self}");
//$result = $db->limitQuery($query, $limit["from"], $limit["maxresults"]); //get results with limit
$stations = sotf_Station::listStations($limit["from"], $limit["maxresults"]);
for ($i = 0; $i < count($stations); $i++) {
$sprops = $stations[$i]->getAllWithIcon();
$sprops['numProgs'] = $stations[$i]->numProgrammes();
$sprops['isLocal'] = $stations[$i]->isLocal();
if (hasPerm('node', 'delete')) {
$sprops['managers'] = $permissions->listUsersWithPermission($stations[$i]->id, 'admin');
}
$STATION_LIST[] = $sprops;
}
$smarty->assign('STATIONS', $STATION_LIST);
$page->send();
示例15: splitList
function splitList($rp_count, $rp_url, $anchor = "")
{
global $smarty, $sotfVars;
$rp_maxresults = $sotfVars->get("hitsPerPage", 10);
//display maximal so many results
//$rp_maxresults = 2;
$rp_from = sotf_Utils::getParameter('from');
if (!isset($rp_from)) {
$rp_from = 1;
}
//if first time on page
// refresh link
$refresh_url = $this->splitListURL($rp_url, $rp_from);
if (strpos($refresh_url, "?") === false) {
$refresh_url .= "?t=" . time();
} else {
$refresh_url .= "&t=" . time();
}
if ($anchor) {
$refresh_url .= '#' . $anchor;
}
$smarty->assign("rp_refresh_url", $refresh_url);
// last item displayed
$rp_to = $rp_from + $rp_maxresults - 1;
//set 'to' field
if ($rp_to > $rp_count) {
$rp_to = $rp_count;
}
//if less then $maxresults
if ($rp_from > 1) {
// url to first page
$smarty->assign("rp_first_url", $this->splitListURL($rp_url, 1, $anchor));
// url to prev page
$rp_prev = $rp_from - $rp_maxresults;
if ($rp_prev >= 1) {
$smarty->assign("rp_prev_url", $this->splitListURL($rp_url, $rp_prev, $anchor));
}
}
$reminder = $rp_count % $rp_maxresults;
if ($reminder == 0) {
$reminder = $rp_maxresults;
}
$rp_last = $rp_count - $reminder + 1;
if ($rp_from < $rp_last) {
// url to next page
$rp_next = $rp_from + $rp_maxresults;
if ($rp_next <= $rp_count) {
$smarty->assign("rp_next_url", $this->splitListURL($rp_url, $rp_next, $anchor));
}
// url to last page
$smarty->assign("rp_last_url", $this->splitListURL($rp_url, $rp_last, $anchor));
}
$smarty->assign("rp_count", $rp_count);
$smarty->assign("rp_to", $rp_to);
$smarty->assign("rp_from", $rp_from);
$smarty->assign("rp_url", $rp_url);
$smarty->assign("anchor", $anchor);
if ($rp_to == $rp_count) {
$smarty->assign("rp_theend", true);
}
if ($rp_from == 1) {
$smarty->assign("rp_thebeginning", true);
}
$limit["from"] = $rp_from - 1;
$limit["to"] = $rp_to - 1;
$limit["maxresults"] = $rp_maxresults;
$limit["limit"] = " LIMIT " . $rp_maxresults . " OFFSET " . ($rp_from - 1);
return $limit;
//print($query." LIMIT ".$maxresults." OFFSET ".($from - 1))
}