예제 #1
0
파일: foltialib.php 프로젝트: haru8/foltia
function renderepgstation($con, $stationname, $start)
{
    //戻り値 なし EPGの局表示
    $now = date("YmdHi");
    $today = date("Ymd");
    $tomorrow = date("Ymd", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
    //$today = "20051013";
    //$tomorrow = "20051014";
    //$epgstart = $today . "2000";
    $epgstart = $start;
    //$epgend = $tomorrow . "0400";
    $epgend = calcendtime($start, 8 * 60);
    $query = "\n\t\tSELECT startdatetime , enddatetime , lengthmin , epgtitle , epgdesc , epgcategory  ,ontvchannel  ,epgid\n\t\tFROM foltia_epg\n\t\tWHERE foltia_epg.ontvchannel = '{$stationname}' AND\n\t\tenddatetime  > {$epgstart}  AND\n\t\tstartdatetime  < {$epgend}\n\t\tORDER BY foltia_epg.startdatetime  ASC\n\t\t";
    $rs = m_query($con, $query, "DBクエリに失敗しました");
    $rowdata = $rs->fetch();
    if (!$rowdata) {
        print "番組データがありません<BR>";
    } else {
        print "<table width=\"100%\"  border=\"0\">\n";
        //print "<ul><!-- ($maxrows) $query -->\n";
        do {
            $printstarttime = substr($rowdata[0], 8, 2) . ":" . substr($rowdata[0], 10, 2);
            $tdclass = "t" . substr($rowdata[0], 8, 2) . substr($rowdata[0], 10, 2);
            $title = htmlspecialchars($rowdata[3]);
            $title = z2h($title);
            $desc = htmlspecialchars($rowdata[4]);
            $desc = z2h($desc);
            $height = htmlspecialchars($rowdata[2]) * 3;
            $epgid = htmlspecialchars($rowdata[7]);
            print "\n\t\t\t\t<tr>\n\t\t\t\t<td height = \"{$height}\" >{$printstarttime}  <A HREF=\"./reserveepg.php?epgid={$epgid}\">{$title}</A> {$desc} <!-- {$rowdata['0']} - {$rowdata['1']} --></td>\n\t\t\t\t</tr>\n\t\t\t\t";
            /*print"<li style=\"height:" . $height ."px;\" class=\"$tdclass\">
            	  $printstarttime  <A HREF=\"./reserveepg.php?epgid=$epgid\">$title</A> $desc($rowdata[0] - $rowdata[1])
            	  </li>\n";
            	 */
        } while ($rowdata = $rs->fetch());
        //do
        //print "</ul>\n";
        print "</table>\n";
    }
    //if
}
예제 #2
0
 // 終了時刻
 $endtime = calcendtime($rowdata['x'], $rowdata['lengthmin']);
 //番組の開始時刻より遅い時刻に終了し、終了時刻より前にはじまる番組があるかどうか
 //オンボードチューナー録画
 $query = "\n            SELECT\n                foltia_program.tid,\n                stationname,\n                foltia_program.title,\n                foltia_subtitle.countno,\n                foltia_subtitle.subtitle,\n                foltia_subtitle.startdatetime,\n                foltia_subtitle.lengthmin,\n                foltia_tvrecord.bitrate,\n                foltia_subtitle.startoffset,\n                foltia_subtitle.pid,\n                foltia_tvrecord.digital\n              FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord\n                WHERE foltia_tvrecord.tid = foltia_program.tid\n                  AND foltia_tvrecord.stationid = foltia_station .stationid\n                  AND foltia_program.tid = foltia_subtitle.tid\n                  AND foltia_station.stationid = foltia_subtitle.stationid\n                  AND foltia_subtitle.enddatetime > ?\n                  AND foltia_subtitle.startdatetime < ?\n                GROUP BY foltia_station.stationid\n              UNION\n                SELECT\n                    foltia_program.tid,\n                    stationname,\n                    foltia_program.title,\n                    foltia_subtitle.countno,\n                    foltia_subtitle.subtitle,\n                    foltia_subtitle.startdatetime,\n                    foltia_subtitle.lengthmin,\n                    foltia_tvrecord.bitrate,\n                    foltia_subtitle.startoffset,\n                    foltia_subtitle.pid,\n                    foltia_tvrecord.digital\n                  FROM foltia_tvrecord\n                    LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )\n                    LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid )\n                    LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )\n                  WHERE foltia_tvrecord.stationid = 0\n                    AND foltia_subtitle.enddatetime > ?\n                    AND foltia_subtitle.startdatetime < ?\n                  GROUP BY foltia_station.stationid\n                 ";
 $rclass = "";
 if ($overlapCheck) {
     $overlap = sql_query($con, $query, "DBクエリに失敗しました", array($rowdata['x'], $endtime, $rowdata['x'], $endtime));
     $owrowall = $overlap->fetchAll();
     $overlapmaxrows = count($owrowall);
     if ($overlapmaxrows > $recunits) {
         $owtimeline = array();
         for ($rrow = 0; $rrow < $overlapmaxrows; $rrow++) {
             $owrowdata = $owrowall[$rrow];
             $owtimeline[$owrowdata['startdatetime']] = $owtimeline[$owrowdata['startdatetime']] + 1;
             $owrend = calcendtime($owrowdata['startdatetime'], $owrowdata['lengthmin']);
             $owtimeline[$owrend] = $owtimeline[$owrend] - 1;
             //注意: NULL に減算子を適用しても何も起こりませんが、NULL に加算子を 適用すると 1 となります。
         }
         ksort($owtimeline);
         $owcount = 0;
         foreach ($owtimeline as $key => $val) {
             $owcount += $val;
             if ($owcount > $recunits) {
                 $rclass = "overwraped";
                 break;
             }
         }
     }
 }
 //外部チューナー録画
예제 #3
0
파일: viewepg.php 프로젝트: haru8/foltia
    }
}
// ココから新コード
// 局リスト
$query = "\n    SELECT\n      stationid,\n      stationname,\n      stationrecch,\n      ontvcode,\n      digitalch\n    FROM foltia_station\n    WHERE \"ontvcode\" LIKE '%ontvjapan%'\n    ORDER BY stationid ASC, stationrecch\n    LIMIT ? OFFSET ?\n";
$slistrs = sql_query($con, $query, "DBクエリに失敗しました", array($maxdisplay, $offset));
$stationinfo = array();
while ($rowdata = $slistrs->fetch()) {
    $stationhash[] = $rowdata['ontvcode'];
    $snames[] = $rowdata['stationname'] . '(' . $rowdata['stationid'] . ':' . $rowdata['digitalch'] . ')';
    // headder
    $stationinfo[$rowdata['ontvcode']] = array('stationid' => $rowdata['stationid'], 'stationname' => $rowdata['stationname'], 'digitalch' => $rowdata['digitalch']);
}
// 時間と全順番のハッシュ作る
$epgstart = $start;
$epgend = calcendtime($start, $endh * 60);
// 番組毎の放送開始時間の一覧を抽出
$query = "\n\tSELECT DISTINCT startdatetime\n\tFROM foltia_epg\n\tWHERE foltia_epg.ontvchannel in (\n\t  SELECT ontvcode\n\t    FROM foltia_station\n\t    WHERE \"ontvcode\" LIKE '%ontvjapan%'\n\t    ORDER BY stationid ASC , stationrecch\n\t  LIMIT ? OFFSET ?\n\t)\n\tAND startdatetime  >= ?\n\tAND startdatetime  < ?\n\tORDER BY foltia_epg.startdatetime  ASC";
$rs = sql_query($con, $query, "DBクエリに失敗しました", array($maxdisplay, $offset, $start, $epgend));
//print "$query<br>\n";
$rowdata = $rs->fetch();
if (!$rowdata) {
    // 番組データがない
    $colmnums = 2;
} else {
    $colmnums = 0;
    do {
        $colmnums++;
        $timetablehash[$rowdata[0]] = $colmnums;
        //print "$rowdata[0]:$i+1 <br>\n";
    } while ($rowdata = $rs->fetch());
예제 #4
0
파일: m.php 프로젝트: haru8/foltia
 } else {
     $errflag = 2;
     $errmsg = "録画する局を設定してください。";
 }
 // デジタル優先
 /*if ($usedigital == 1){
 	}else{
 		$usedigital = 0;
 	}
 	*/
 // 正しければ
 if ($errflag == 0) {
     // 重複があるか?
     // 未チェック
     //デモモードじゃなかったら書き込み
     $enddatetime = calcendtime($startdatetime, $lengthmin);
     //時刻検査
     if ($startdatetime > $now && $enddatetime > $now && $enddatetime > $startdatetime) {
         //min pidを探す
         $query = "SELECT min(pid) FROM  foltia_subtitle ";
         //$rs = m_query($con, $query, "DBクエリに失敗しました");
         $rs = sql_query($con, $query, "DBクエリに失敗しました");
         $rowdata = $rs->fetch();
         $rs->closeCursor();
         if (!$rowdata) {
             $insertpid = -1;
         } else {
             if ($rowdata[0] > 0) {
                 $insertpid = -1;
             } else {
                 $insertpid = $rowdata[0];