function _query_vm($id) { $qry = "SELECT M.*, S.*, S.id siteid\n FROM vminfo M\n LEFT JOIN sites S ON M.siteid=S.id\n WHERE M.id='{$id}'"; $ret = myQuery($qry); $row = myFetchRow($ret); return $row; }
function option_resources($preset = '') { $qry = "SELECT * FROM sites WHERE ep_occi != '' ORDER BY cmf"; $ret = myQuery($qry); $opts = "<option>::select a site::</option>"; while ($row = myFetchRow($ret)) { //dd($row); $v = $row['id']; $t = site_title($row); if ($preset == $v) { $sel = " selected"; } else { $sel = ''; } $opts .= "<option value='{$v}'{$sel}>{$t}</option>"; } return $opts; }
ParagraphTitle("OS Template", 1); $qry = "SELECT O.*\n, R.affiliation, R.cmf, R.cc\n FROM ostpl O\n LEFT JOIN resources R ON O.resid=R.id"; $ret = myQuery($qry); print <<<EOS <table border='1' class='mmdata'> <th>#</th> <th>Affiliation</th> <th>CC</th> <th>CMF</th> <th>OSID</th> <th>Date</th> </tr> EOS; $cnt = 0; while ($row = myFetchRow($ret)) { $cnt++; //dd($row); $resid = $row['resid']; $uri = $row['uri']; $ostpl = urlencode($uri); $link = <<<EOS <a href='lires.php?mode=detail&resid={$resid}&ostpl={$ostpl}'>detail</a> EOS; print <<<EOS <tr> <td>{$cnt}</td> <td>{$row['affiliation']}</td> <td>{$row['cc']}</td> <td>{$row['cmf']}</td> <td class='l'>{$row['osid']}</td>
function List_Resource_Template($siteid) { $ctype = 'RES'; $w = array(); $w[] = "siteid='{$siteid}'"; $w[] = "ctype='{$ctype}'"; $vtime = $this->vtime; if ($vtime > 0) { $w[] = "idate > date_sub(now(), interval {$vtime} SECOND)"; } $sql_where = " WHERE " . join(" AND ", $w); $qry = "SELECT * FROM {$this->tbl} {$sql_where}"; $this->_debug($qry); $ret = myQuery($qry); $lists = array(); while ($row = myFetchRow($ret)) { //dd($row); $uri = $row['uri']; $lists[] = $uri; } return $lists; }