本文整理汇总了PHP中query::getrow方法的典型用法代码示例。如果您正苦于以下问题:PHP query::getrow方法的具体用法?PHP query::getrow怎么用?PHP query::getrow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类query
的用法示例。
在下文中一共展示了query::getrow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: syncVariations
/**
* syncronize variations with entered data to the database.
* The configuration for this function must be set manually.
* I.E. there must be the $oid-Variable set and there must(!)
* be also the global vars content_variations_VARIATION_ID_XX
* and content_MODULE_ID
* set which are automatically set by the SelectMultiple2Input.
*/
function syncVariations()
{
global $db, $oid, $content_MODULE_ID;
$module = value("content_MODULE_ID", "NUMERIC");
if ($module == "0") {
$module = $content_MODULE_ID;
}
includePGNSource($module);
//delete all variations first.
$del = "UPDATE content_variations SET DELETED=1 WHERE CID = {$oid}";
$query = new query($db, $del);
// get list of variations
$variations = createNameValueArray("variations", "NAME", "VARIATION_ID", "DELETED=0");
for ($i = 0; $i < count($variations); $i++) {
$id = $variations[$i][1];
if (value("content_variations_VARIATION_ID_" . $id) != "0") {
// create or restore variation
// check, if variations already exists and is set to deleted.
$sql = "SELECT COUNT(CID) AS ANZ FROM content_variations WHERE CID = {$oid} AND VARIATION_ID = {$id}";
$query = new query($db, $sql);
$query->getrow();
$amount = $query->field("ANZ");
if ($amount > 0) {
$sql = "UPDATE content_variations SET DELETED=0 WHERE CID = {$oid} AND VARIATION_ID = {$id}";
} else {
$fk = nextGUID();
$sql = "INSERT INTO content_variations (CID, VARIATION_ID, FK_ID, DELETED) VALUES ( {$oid}, {$id}, {$fk}, 0)";
$PGNRef = createPGNRef($module, $fk);
$PGNRef->sync();
}
$query = new query($db, $sql);
}
}
}
示例2: findContentUsageClusterNodes
/**
* Find clusters, in which a plugin-entry is used.
* @param integer ID of the plugin-Key
*/
function findContentUsageClusterNodes($oid)
{
global $db;
// Initializing Array
$clusters = array();
// Determine cluster_templates using the object as static content...
$sql = "SELECT CLT_ID FROM cluster_template_items WHERE FKID = {$oid}";
$query = new query($db, $sql);
while ($query->getrow()) {
// Determine clusters using this template
$sql = "SELECT CLNID FROM cluster_node WHERE CLT_ID = " . $query->field("CLT_ID");
$subquery = new query($db, $sql);
while ($subquery->getrow()) {
array_push($clusters, $subquery->field("CLNID"));
}
$subquery->free();
}
$query->free();
// determine clusters using this content as library link...
$sql = "SELECT CLID FROM cluster_content WHERE FKID = {$oid} OR CLCID = {$oid}";
$query = new query($db, $sql);
while ($query->getrow()) {
// Determine clusters using this template
$sql = "SELECT CLNID FROM cluster_variations WHERE CLID=" . $query->field("CLID");
$subquery = new query($db, $sql);
while ($subquery->getrow()) {
array_push($clusters, $subquery->field("CLNID"));
}
$subquery->free();
}
$query->free();
$clusters = array_unique($clusters);
return $clusters;
}
示例3: launchSitepageMaster
/**
* Launch a Sitepage-MAster
* @param integer SPM_ID to launch
* @param integer ID of the level to launch to.
* @param integer ID of the variation to launch.
* @returns integer Translated ID after launch
*/
function launchSitepageMaster($in, $level, $variation)
{
global $db;
$out = translateState($in, $level, false);
$sql = "SELECT * FROM sitepage_master WHERE SPM_ID = {$in}";
$query = new query($db, $sql);
$query->getrow();
$clt = $query->field("CLT_ID");
$type = $query->field("SPMTYPE_ID");
$name = addslashes($query->field("NAME"));
$desc = addslashes($query->field("DESCRIPTION"));
$path = addslashes($query->field("TEMPLATE_PATH"));
$cltTrans = launchClusterTemplate($clt, $level, $variation);
$sql = "DELETE FROM sitepage_master WHERE SPM_ID = {$out}";
$query = new query($db, $sql);
$sql = "INSERT INTO sitepage_master (SPM_ID, NAME, DESCRIPTION, TEMPLATE_PATH, CLT_ID, SPMTYPE_ID, DELETED, VERSION) VALUES ";
$sql .= "({$out}, '{$name}', '{$desc}', '{$path}', {$cltTrans}, {$type}, 0, {$level})";
$query = new query($db, $sql);
$query->free();
// copy template physically.
global $c;
if (file_exists($c["devpath"] . $path)) {
nxDelete($c["livepath"], $path);
nxCopy($c["devpath"] . $path, $c["livepath"], $path);
}
launchSPMVariations($in, $level);
return $out;
}
示例4: XmlExportSitepageMaster
/**
* Return the XML-Code for a Sitepage-Master
* @param integer GUID of the sitepage-master
*/
function XmlExportSitepageMaster($spm)
{
global $db, $xmlExchange, $c;
$xmlOptions = array(XML_OPTION_CASE_FOLDING => TRUE, XML_OPTION_SKIP_WHITE => TRUE);
$xml =& new XPath(FALSE, $xmlOptions);
$sql = "SELECT * FROM sitepage_master WHERE SPM_ID = {$spm}";
$query = new query($db, $sql);
if ($query->getrow()) {
$name = urlencode($query->field("NAME"));
$description = urlencode($query->field("DESCRIPTION"));
$templatePath = $query->field("TEMPLATE_PATH");
$clt = $query->field("CLT_ID");
$type = $query->field("SPMTYPE_ID");
$template = "";
$fp = @fopen($c["devpath"] . $templatePath, "r");
if ($fp != "") {
while (!feof($fp)) {
$template .= fgets($fp, 128);
}
@fclose($fp);
}
$template = urlencode($template);
$templatePath = urlencode($templatePath);
$xml->appendChild('', '<NX:SITEPAGEMASTER ID="' . $spm . '" NAME="' . $name . '" DESCRIPTION="' . $description . '" TYPE="' . $type . '" FILENAME="' . $templatePath . '" CLUSTERTEMPLATE="' . $clt . '">' . $template . '</NX:SITEPAGEMASTER>');
$query->free();
$xmlExchange[] = array("clt" => $clt);
}
return $xml->exportAsXml('', '');
}
示例5: drawPGNTeaser
/**
* Draw a teaser defined with the teaser plugin
* @id internal id of the teaser. matched pgn_teaser.fkid.
*/
function drawPGNTeaser($id)
{
global $cds, $db;
$result = '';
$query = new query($db, "Select * FROM pgn_teaser Where FKID=" . $id);
if ($query->getrow()) {
$href = $query->field("HREF");
if (substr($href, 0, 4) == "www.") {
$href = 'http://' . $href;
}
$popup = $href != "";
$spid = $query->field('SPID');
if ($spid != "0" && $href == "") {
$menu = new Menu(null, $spid, $cds->variation, $cds->level);
$href = $menu->getLink();
}
$imageid = $query->field("IMAGEID");
$aTag = '<a href="' . $href . '"';
if ($popup) {
$aTag .= ' target="_blank"';
}
$aTag .= '>';
// image teaser
if ($query->field("ISIMAGETEASER") == "1") {
$result = $aTag . $cds->content->getById($imageid) . '</a>';
} else {
// usual teaser
$headline = $query->field("HEADLINE");
$body = $query->field("BODY");
$linktext = $query->field("LINKTEXT");
if ($linktext == "") {
$linktext = "read more";
}
$result = '<div class="teaser">';
if ($headline != "") {
$result .= '<b>' . $headline . '</b><br>';
}
if ($imageid != "0") {
$result .= $aTag . $cds->content->getById($imageid) . '</a><br>';
}
if ($body != "") {
$result .= $body;
}
if ($query->field("RESOLVECHILDS") != "1" || $spid == "0" && $href == "") {
$result .= ' ' . $aTag . $linktext . '</a>';
} else {
$childs = $menu->lowerLevel();
for ($i = 0; $i < count($childs); $i++) {
$result .= '<br/>';
$result .= $childs[$i]->getTag();
}
}
$result .= '</div>';
}
}
return $result;
}
示例6: syncClids
function syncClids() {
global $db, $form;
$counter = 0;
$sql = "SELECT cv.CLID FROM cluster_variations cv, cluster_node cn WHERE cv.DELETED=0 AND cv.CLNID=cn.CLNID AND cn.VERSION=0";
$query = new query($db, $sql);
while ($query->getrow()) {
syncCluster($query->field("CLID"));
$counter++;
}
//$form->addToTopText("<br/>".$lang->get("num_cl_sync", "Number of cluster who were synchronized").": ".$counter);
}
示例7: _get_message_tree
function _get_message_tree($id)
{
global $PHORUM, $DB;
$q = new query($DB);
$SQL = "Select id from {$PHORUM['ForumTableName']} where parent={$id}";
$q->query($DB, $SQL);
$tree = "{$id}";
while ($rec = $q->getrow()) {
$tree .= "," . _get_message_tree($rec["id"]);
}
return $tree;
}
示例8: draw
/**
* This function is used for drawing the html-code out to the templates.
* It just returns the code
* @param string Optional parameters for the draw-function. There are none supported.
* @return string HTML-CODE to be written into the template.
*/
function draw($param = "") {
global $cds, $db;
$label = getDBCell("pgn_config_store", "TEXT1", "CLTI_ID=".$this->fkid);
echo "<br><h2>$label</h2>";
$label = getDBCell("pgn_config_store", "TEXT3", "CLTI_ID=".$this->fkid);
echo $label;
br(); br();
// draw the linklist...
$sql = "Select * FROM pgn_linkexchange WHERE APPROVED=1 AND SOURCEID=".$cds->pageId. " ORDER BY INSERTTIMESTAMP DESC";
$query = new query($db, $sql);
$counter = 0;
while ($query->getrow()) {
$title = $query->field("TITLE");
$description = $query->field("DESCRIPTION");
$url = $query->field("URL");
echo '<b><a href="'.$url.'" target="_blank">'.$title.'</a></b><br>';
echo $description;
br();
echo '<a style="font-size:11px;text-decoration:none;" href="'.$url.'" target="blank"><span style="color:#008000;">'.$url.'</span></a>';
br();
br();
}
echo '<script language="javascript" type="text/javascript">
<!--
var win=null;
function NewWindow2(mypage,myname,w,h,scroll,pos){
if(pos=="random")
{LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center")
{LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings=\'width=\'+w+\',height=\'+h+\',top=\'+TopPosition+\',left=\'+LeftPosition+\',scrollbars=\'+scroll+\',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes\';
win=window.open(mypage,myname,settings);}
// -->
</script>';
$label = getDBCell("pgn_config_store", "TEXT2", "CLTI_ID=".$this->fkid);
echo '<a class="breadcrumb" href="#" onclick="NewWindow'."('".$cds->docroot."sys/linkexchange/addurl.php?id=".$cds->pageId."','addurl','600','450','no','center');return false".'" onfocus="this.blur()">'.$label.'</a> ';
}
示例9: XmlExportClusterTemplate
/**
* Return the XML-Code for a Cluster-Template
* @param integer ID of the Cluster-Template
* @param mixed data to export also as array. [][type] = "meta", [][guid] = .....
*/
function XmlExportClusterTemplate($clt)
{
global $db, $xmlExchange;
$xmlOptions = array(XML_OPTION_CASE_FOLDING => TRUE, XML_OPTION_SKIP_WHITE => TRUE);
$xml =& new XPath(FALSE, $xmlOptions);
$sql = "SELECT * FROM cluster_templates WHERE CLT_ID = {$clt}";
$query = new query($db, $sql);
if ($query->getrow()) {
$name = urlencode($query->field("NAME"));
$description = urlencode($query->field("DESCRIPTION"));
$layout = urlencode($query->field("TEMPLATE"));
$xmlExchange[] = array("mt" => $query->field("MT_ID"));
$xml->appendChild('', "<nx:clustertemplate id=\"{$clt}\" name=\"{$name}\" description=\"{$description}\" metaTemplate=\"" . $query->field("MT_ID") . "\" />");
$xml->appendChild('/nx:clustertemplate[@id="' . $clt . '"]', "<nx:layout>{$layout}</nx:layout>");
$query->free();
}
$requiredPlugins = array();
$sql = "SELECT * FROM cluster_template_items WHERE CLT_ID = {$clt}";
$query = new query($db, $sql);
while ($query->getrow()) {
$name = urlencode($query->field("NAME"));
$position = $query->field("POSITION");
$type = $query->field("CLTITYPE_ID");
$mincard = $query->field("MINCARD");
$maxcard = $query->field("MAXCARD");
$fkid = $query->field("FKID");
$config = "";
if ($type == 2 || $type == 5) {
//dynamic content or library.
$config = strtoupper(getDBCell("modules", "MODULE_NAME", "MODULE_ID = {$fkid}"));
if (!in_array($config, $requiredPlugins)) {
$requiredPlugins[] = $config;
}
} else {
if ($type == 4) {
$config = $fkid;
$xmlExchange[] = array("clt" => $fkid);
}
}
$xml->appendChild('/nx:clustertemplate[@id="' . $clt . '"]', "<nx:clustertemplateitem name=\"{$name}\" position=\"{$position}\" type=\"{$type}\" mincard=\"{$mincard}\" maxcard=\"{$maxcard}\" configuration=\"{$config}\"/>");
}
for ($i = 0; $i < count($requiredPlugins); $i++) {
if (!in_array($requiredPlugins[$i], $xmlExchange["PLUGINS"])) {
array_push($xmlExchange["PLUGINS"], $requiredPlugins[$i]);
}
}
return $xml->exportAsXml('', '');
}
示例10: draw
/**
* This function is used for drawing the html-code out to the templates.
* It just returns the code
* @param string Optional parameters for the draw-function. There are none supported.
* @return string HTML-CODE to be written into the template.
*/
function draw($param = "") {
global $db;
$result = null;
$sql = "SELECT * FROM pgn_quote ORDER BY RAND() LIMIT 1";
$query = new query($db, $sql);
if ($query->getrow()) {
$result["QUOTE"] = $query->field("QUOTE");
$result["TITLE"] = $query->field("TITLE");
}
$query->free();
return $result;
}
示例11: nextid
function nextid($sequence)
{
$esequence = $sequence . "_seq";
$query = new query($this, "select nextval('{$esequence}') as nextid");
if ($query->result) {
$row = $query->getrow();
$nextid = $row["nextid"];
} else {
$query->query($this, "create sequence {$esequence}");
if ($query->result) {
$nextid = $this->nextid($sequence);
} else {
$nextid = 0;
}
}
return $nextid;
}
示例12: launch
/**
* Parses the placeholders [xxx] and launches the coresponding contents.
*
* @param string $text text to parse;
* @param integer $variation Variation which is to be launched.
*/
function launch($text, $variation)
{
global $db;
if (preg_match_all('/\\[(.+?)\\]/is', $text, $matches)) {
$tags = $matches[1];
foreach ($tags as $tag) {
$sql = 'SELECT c.CID FROM content c, state_translation t Where c.CID<>t.OUT_ID AND UPPER(c.ACCESSKEY)="' . strtoupper($tag) . '"';
$query = new query($db, $sql);
if ($query->getrow()) {
$id = $query->field('CID');
}
if ($id != "") {
launchContent($id, 10, $variation);
}
}
}
return $text;
}
示例13: getVar
/**
* retrieves the value of a variable from the variable stack.
* @param string name of the variable
*/
function getVar($name) {
$back = "";
global $auth, $db;
$userId = $auth->userId;
$sql = "SELECT VALUE FROM temp_vars WHERE USER_ID=$userId and NAME='$name'";
$query = new query($db, $sql);
if ($query->getrow()) {
$back = $query->field("VALUE");
} else {
$back = "";
}
$query->free();
return $back;
}
示例14: draw_metaInput
/**
* draw an input field for meta-Data
* @param string Headline for this field.
* @param string Meta-Template, which is to be used.
*/
function draw_metaInput($headline, $mt_id)
{
global $db, $specialID, $metaPanel, $clnid;
//checking, if there are any items in the template.
$sql = "SELECT COUNT(MTI_ID) AS ANZ FROM meta_template_items WHERE MT_ID = {$mt_id}";
$query = new query($db, $sql);
$query->getrow();
$amount = $query->field("ANZ");
if ($amount > 0) {
$sql = "SELECT m.MID AS D1, t.MTYPE_ID AS D2, t.NAME AS D3 FROM meta_template_items t, meta m WHERE m.MTI_ID = t.MTI_ID AND m.CID = " . $clnid . " AND m.DELETED=0 AND t.MT_ID = {$mt_id} ORDER BY t.POSITION ASC";
$query = new query($db, $sql);
$mlist = null;
$counter = 0;
while ($query->getrow()) {
// save the list, so that it will not go lost.
$mlist[$counter][0] = $query->field("D1");
$mlist[$counter][1] = $query->field("D2");
$mlist[$counter][2] = $query->field("D3");
$counter++;
}
// add the metainput fields.
for ($i = 0; $i < $counter; $i++) {
$specialID = $mlist[$i][0];
// dispatch type.
switch ($mlist[$i][1]) {
case 1:
$obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:text,size:64,width:300");
break;
case 2:
$obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:textarea,size:3,width:300");
break;
case 3:
$obj[$i] = new TextInput($mlist[$i][2], "meta", "VALUE", "MID = " . $mlist[$i][0], "type:color,param:form1");
break;
}
if (isset($obj[$i])) {
$metaPanel->add($obj[$i]);
}
}
$specialID = "";
}
}
示例15: Count_Posts
function Count_Posts($user_id)
{
global $DB, $pho_main;
//Get list of the forums
$sql = "Select distinct(table_name) from " . $pho_main . " where active='1' AND folder='0'";
$q = new query($DB, $sql);
$forums = $q->getrow();
$totalposts = 0;
//Output them in the scipt
while (is_array($forums)) {
//Count posts in each forum
$sql = "SELECT count(*) as posts FROM {$forums['table_name']} WHERE userid='{$user_id}'";
$query = new query($DB, $sql);
$rec = $query->getrow();
$posts = $rec['posts'];
//Add Them To totals
$totalposts = $totalposts + $posts;
$forums = $q->getrow();
}
return $totalposts;
}