本文整理汇总了PHP中Viewer::setupTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP Viewer::setupTemplate方法的具体用法?PHP Viewer::setupTemplate怎么用?PHP Viewer::setupTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewer
的用法示例。
在下文中一共展示了Viewer::setupTemplate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$loc = 1;
$sql = "SELECT v_tree_aw_sets.*, aw_sets_users.user_id AS userid\n from v_tree_aw_sets LEFT OUTER JOIN aw_sets_users\n ON aw_sets_users.set_id = v_tree_aw_sets.id\n\t\t\tWHERE v_tree_aw_sets.userid = " . $cfg['DPS']['systemUserID'] . " \n\t\t\t\tAND v_tree_aw_sets.permissions & B'" . $cfg['DPS']['fileR'] . "' = '" . $cfg['DPS']['fileR'] . "'";
// station awsets
$awsets = $db->getAll($sql);
$sql = "SELECT val FROM configuration \n\t\t\tWHERE location = {$loc} \n\t\t\t\tAND parameter = 'station_aw_set'";
$userset = $db->getOne($sql);
foreach ($awsets as &$awset) {
if ($userset == $awset['id']) {
$awset['active'] = 't';
} else {
$awset['active'] = 'f';
}
$sql = "SELECT BIT_OR(permissions) \n\t\t\t\tFROM v_tree_dir \n\t\t\t\tWHERE v_tree_dir.id = {$awset['parent']}\n\t\t\t\t\tAND v_tree_dir.userid = {$cfg['DPS']['systemUserID']}";
$awset['parentperm'] = $db->getOne($sql);
$awset['userid'] = AuthUtil::getUsername($awset['userid']);
}
$this->assign('access_playlist', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID));
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
$this->assign('awsets', $awsets);
}
示例2: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$scriptID = pg_escape_string($this->fieldData['scriptID']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$date = time();
if (is_numeric($scriptID)) {
$script_query = "SELECT bit_or(permissions) \n\t\t\t\tFROM v_tree_script\n\t\t\t\tWHERE id = {$scriptID}\n\t\t\t\t\tAND userid = {$userID}";
$checkScripts = $db->getOne($script_query);
if (substr($checkScripts, 0, 1) == "1") {
if (substr($checkScripts, 1, 1) == "1") {
$this->assign('write', 't');
} else {
$this->assign('write', 'f');
}
$script_sql = "SELECT * FROM scripts WHERE id = " . $scriptID;
$script = $db->getRow($script_sql);
$script['m'] = (int) ($script['length'] / 60);
$script['s'] = $script['length'] - $script['m'] * 60;
$script['niceProducer'] = AuthUtil::getUsername($script['creator']);
$this->assign('script', $script);
} else {
$this->assign('error', 'You do not have permission to edit that script.');
}
} else {
$this->assign('error', 'Invalid Show ID supplied');
}
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
}
示例3: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$count_query = "SELECT count(*) FROM requests";
$requestedNum = $db->getOne($count_query);
$query = "SELECT * FROM requests ORDER BY date DESC";
$requestedResult = $db->getAll($query);
$i = 0;
foreach ($requestedResult as $key => &$track) {
$track['number'] = $i;
$track['rtime'] = date("m/d/y", $track['date']);
$track['user'] = AuthUtil::getUsername($track['userid']);
$i++;
}
$trackCount = $i;
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$this->assign('CensorTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 30), $userID));
$this->assign('RequestTrack', 't');
$this->assign('RemoveRequestTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 29), $userID));
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
$this->assign('requestedTracks', $requestedResult);
$this->assign('requestedNum', $requestedNum);
}
示例4: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$auth = Auth::getInstance();
$ID = $this->fieldData['guid'];
$realmID = substr($this->fieldData['id'], 3);
$type = $this->fieldData['treeUser'];
if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
header("Content-type: application/xhtml+xml");
} else {
header("Content-type: text/xml");
}
if ($type == 'group') {
$treeInfo = AuthSubRealmViewer::singleRealmTree($realmID, $ID, true);
} else {
$treeInfo = AuthSubRealmViewer::singleRealmTree($realmID, $ID, false);
}
echo "<?xml version='1.0' encoding='iso-8859-1'?>\n";
if ($realmID == 0) {
$realmID = 0;
} else {
$realmID = "rlm" . $realmID;
}
$treeInfo = '<tree id="' . $realmID . '">' . $treeInfo . '</tree>';
echo $treeInfo;
}
示例5: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$trackIDs = explode(";", $this->fieldData['trackID']);
$tracksDetails = array();
foreach ($trackIDs as $trackID) {
$sql = "SELECT audio.*, albums.name AS album \n\t\t\tFROM audio, albums \n\t\t\tWHERE audio.music_album = albums.id \n\t\t\t\tAND audio.id = " . pg_escape_string($trackID);
$trackDetails = $db->getRow($sql);
$sql = "SELECT DISTINCT artists.name AS name \n\t\t\tFROM artists, audioartists \n\t\t\tWHERE audioartists.audioid = " . pg_escape_string($trackID) . " \n\t\t\t\tAND audioartists.artistid = artists.id";
$trackDetails['artist'] = $db->getColumn($sql);
$sql = "SELECT DISTINCT keywords.name AS name \n\t\t\tFROM keywords, audiokeywords \n\t\t\tWHERE audiokeywords.audioid = " . pg_escape_string($trackID) . " \n\t\t\t\tAND audiokeywords.keywordid = keywords.id";
$trackDetails['keywords'] = $db->getColumn($sql);
$samples = $trackDetails['length_smpl'];
$trackDetails['length'] = $tracksLen = round($samples / 44100 / 60) . "mins " . $samples / 44100 % 60 . "secs.";
$sql = "SELECT * FROM audiocomments \n\t\t\tWHERE audioid = " . pg_escape_string($trackID) . " \n\t\t\tORDER BY creationdate ASC";
$trackDetails['comments'] = $db->getAll($sql);
foreach ($trackDetails['comments'] as &$comment) {
$comment['username'] = AuthUtil::getUsername($comment['userid']);
$comment['comment'] = str_replace("\n", "<br>", $comment['comment']);
$comment['ctime'] = substr($comment['creationdate'], 0, 10);
}
$tracksDetails[] = $trackDetails;
}
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$this->assign('RequestTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 29), $userID));
$this->assign('Access_CommentTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 34), $userID));
$this->assign('Access_EditTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 27), $userID));
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
$this->assign('tracksDetails', $tracksDetails);
}
示例6: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$trackid = $this->fieldData['trackID'];
if (is_numeric($trackid)) {
$query = "SELECT title, artist, md5, path FROM v_audio \n\t\t\t\tWHERE id = " . $trackid;
$file = $db->getRow($query);
//$filename = escapeshellarg($file['path']) . "/" .
// escapeshellarg($file['md5'][0]) . "/" .
// escapeshellarg($file['md5']);
$filename = $file['path'] . "/" . $file['md5'][0] . "/" . $file['md5'];
header('Pragma: public');
header('Expires: 0');
header('Content-Transfer-Encoding: binary');
#header('Cache-Control: no-store,no-cache,must-revalidate');
header('Content-Length: 180373');
$fileN = str_replace(' ', '_', $file['title']) . '-' . str_replace(' ', '_', $file['artist']) . '.mp3';
$fileN = str_replace('"', "", $fileN);
$headstr = 'Content-Disposition: attachment; filename="' . $fileN . "\"";
header($headstr);
header('Content-type: audio/mpeg');
passthru($cfg['general']['toolkitRoot'] . "/DPS/encode-digiplay-file.sh " . $filename);
}
}
示例7: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$scriptID = pg_escape_string($this->fieldData['scriptID']);
if (!is_numeric($scriptID)) {
$this->assign('permError', 't');
} else {
$sql = "SELECT count(*) FROM v_tree_script\n\t\t\t\tWHERE id = {$scriptID}\n\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'";
if ($db->getOne($sql) > 0) {
$sql = "SELECT dirid FROM scriptsdir\n\t\t\t\t\tWHERE scriptid = {$scriptID}";
$dirID = $db->getOne($sql);
"SELECT count(*) FROM v_tree_dir\n\t\t\t\t\tWHERE id = {$dirID}\n\t\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'";
if ($db->getOne($sql) > 0) {
$flag = true;
}
}
if ($flag) {
$sql = "SELECT * FROM scripts WHERE id = {$scriptID}";
$script = $db->getRow($sql);
$sql = "SELECT count(*) FROM v_tree_script\n\t\t\t\t\tWHERE id = {$scriptID}\n\t\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileO'] . "' = '" . $cfg['DPS']['fileO'] . "'";
$check = $db->getOne($sql);
if ($check > 0) {
$this->assign('own', 't');
}
$this->assign('script', $script);
$this->assign('treeType', '');
} else {
$this->assign('permError', 't');
}
}
}
示例8: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$dirID = pg_escape_string($this->fieldData['rootdir']);
if (!is_numeric($dirID)) {
$this->assign('permError', 't');
} else {
$flag = false;
$sql = "SELECT count(*) FROM v_tree_dir\n\t\t\t\tWHERE id = {$dirID}\n\t\t\t\t\tAND\tuserid = {$userID}\n\t\t\t\t\tAND permissions & B'" . $cfg['DPS']['fileW'] . "' = '" . $cfg['DPS']['fileW'] . "'";
if ($db->getOne($sql) > 0) {
$flag = true;
}
if ($flag) {
$sql = "SELECT * FROM dir WHERE id = {$dirID}";
$folder = $db->getRow($sql);
$this->assign('folder', $folder);
} else {
$this->assign('permError', 't');
}
}
}
示例9: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
//Sue playing now/next
$query = "SELECT audio.title AS title, audio.id AS id \n\t\t\tFROM sustschedule, audio \n\t\t\tWHERE sustschedule.audioid = audio.id \n\t\t\tORDER BY sustschedule.id asc";
$suePlaylist = $db->getAll($query);
foreach ($suePlaylist as $key => &$track) {
$sql = "SELECT DISTINCT artists.name AS name \n\t\t\t\tFROM artists, audioartists \n\t\t\t\tWHERE audioartists.audioid = " . $track['id'] . " \n\t\t\t\t\tAND audioartists.artistid = artists.id";
$artists = $db->getAll($sql);
foreach ($artists as $artist) {
$track['artist'] = $track['artist'] . $artist['name'] . " & ";
}
$track['artist'] = rtrim($track['artist'], " & ");
}
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$this->assign('Access_ViewSue', AuthUtil::getDetailedUserrealmAccess(array(58, 60, 3), $userID));
$this->assign('Access_EditSue', AuthUtil::getDetailedUserrealmAccess(array(58, 60, 66), $userID));
$this->assign('Access_SueStats', AuthUtil::getDetailedUserrealmAccess(array(58, 60, 2), $userID));
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
$this->assign('storedTracks', $systemTracks);
$this->assign('sueLastTrack', $suePlaylist[0]);
$this->assign('sueNextTrack', $suePlaylist[1]);
}
示例10: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$audioID = pg_escape_string($this->fieldData['audioID']);
$sql = "SELECT jinglepkgid FROM audiojinglepkgs WHERE audioid = {$audioID}";
$jinglepkgID = $db->getOne($sql);
$sql = "SELECT name FROM jinglepkgs WHERE id = {$jinglepkgID}";
$currentpkg = $db->getOne($sql);
if ($currentpkg == '') {
$currentpkg = 'Default';
}
$sql = "SELECT title FROM audio WHERE id = {$audioID}";
$jinglename = $db->getOne($sql);
$sql = "SELECT name, id FROM jinglepkgs";
$jinglepkgs = $db->getAll($sql);
$this->assign('access_playlist', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 33), $userID));
$this->assign('access_sue', AuthUtil::getDetailedUserrealmAccess(array(24, 20, 3), $userID));
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
$this->assign('jinglepkgs', $jinglepkgs);
$this->assign('currentpkg', $currentpkg);
$this->assign('currentpkgid', $jinglepkgID);
$this->assign('jinglename', $jinglename);
$this->assign('jingleID', $audioID);
}
示例11: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$dirID = substr($this->fieldData['id'], 3);
$type = $this->fieldData['treeUser'];
if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml")) {
header("Content-type: application/xhtml+xml");
} else {
header("Content-type: text/xml");
}
if ($type == 'group') {
$treeInfo = DPS::singleGroupTreeSetup($dirID, $cfg['Auth']['defaultNewUserGroup'], $this->fieldData['treeType']);
} else {
$treeInfo = DPS::singleTreeSetup($dirID, $userID, $this->fieldData['treeType']);
}
echo "<?xml version='1.0' encoding='iso-8859-1'?>\n";
if ($dirID == 1) {
$dirID = 0;
} else {
$dirID = "dir" . $dirID;
}
$treeInfo = '<tree id="' . $dirID . '">' . $treeInfo . '</tree>';
echo $treeInfo;
}
示例12: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$loginTplID = MVCUtils::getTemplateID('login.tpl');
$this->assign('fwdtid', end($this->templateIDStack));
$this->assign('loginTplID', $loginTplID);
}
示例13: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$offset = $this->fieldData['dpsSearchPage'];
if ($offset == "") {
$offset = 0;
} else {
$offset--;
}
$searchValue = trim($this->fieldData['dpsSearchVal']);
$searchType = $this->fieldData['dpsSearchType'];
$letter = pg_escape_string($this->fieldData['dpsSearchLetter']);
if ($searchType == '' && $letter != '') {
if ($letter == "*") {
$searchType = 'Number';
} else {
$searchType = 'Letter';
}
}
if ($this->fieldData['dpsSortType'] != '') {
$sesh = Session::getInstance();
$sortType = $this->fieldData['dpsSortType'];
$sesh->setValue("dpsSortType", $sortType);
} else {
$sesh = Session::getInstance();
if ($sesh->keyExists("dpsSortType")) {
$sortType = $sesh->getValue("dpsSortType");
} else {
$sortType = "title";
}
}
if ($searchValue != '') {
$searchResult = DPS::searchAudio($searchValue, $searchType, $sortType, $offset, '');
$rNum = DPS::searchPageAudio($searchValue, $searchType, '');
$searchInfo = "Found {$rNum} results matching your query";
}
$pages = ceil($rNum / $cfg['DPS']['resultLimit']);
//fill the $pageArray array with values from 1 to $pages
$pageArray = range(1, $pages);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$this->assign('RequestTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 29), $userID));
$this->assign('CensorTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 30), $userID));
$this->assign('ReportTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 43), $userID));
$this->assign('EditTrack', AuthUtil::getDetailedUserrealmAccess(array(3, 21, 27), $userID));
$this->assign('DeleteTrack', AuthUtil::getDetailedUserrealmAccess(array(2, 21, 32), $userID));
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
$this->assign('page', $offset);
$this->assign('searchResult', $searchResult);
$this->assign('searchInfo', $searchInfo);
$this->assign('pages', $pageArray);
$this->assign('searchType', $searchType);
$this->assign('searchValue', $searchValue);
$this->assign('sortType', $sortType);
}
示例14: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$this->assign('treeType', 'jacspmr');
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
}
示例15: setupTemplate
protected function setupTemplate()
{
global $cfg;
parent::setupTemplate();
$db = Database::getInstance($cfg['DPS']['dsn']);
$auth = Auth::getInstance();
$userID = $auth->getUserID();
$this->assign('Admin', AuthUtil::getDetailedUserrealmAccess(array(1), $userID));
}