Esempio n. 1
0
 function link($attr = null)
 {
     global $c;
     if (is_numeric($attr["PAGE"]) && $attr["PAGE"] != "") {
         $spm = getDBCell("sitepage", "SPM_ID", "SPID = " . $attr["PAGE"]);
         if ($spm != "") {
             $template = getDBCell("sitepage_master", "TEMPLATE_PATH", "SPM_ID = " . $spm);
             $live = getDBCell("state_translation", "OUT_ID", "OUT_ID = " . $attr["PAGE"] . " AND LEVEL = 10 AND EXPIRED=0");
             if ($live != "") {
                 $path = $c["livedocroot"];
             } else {
                 $path = $c["devdocroot"];
             }
             // first, we'll use standard-variation if nothing has been set in the original link
             if (!isset($attr["V"])) {
                 $attr["V"] = $this->variation;
             }
             // if the target sitepage is expired, we'll directly link to the www folder.
             if ($live && isSPExpired($attr["PAGE"], $attr["V"])) {
                 $output = "<a href=\"" . $path . "\"";
             } else {
                 // we need to manually add N/X-GetVars like page and v
                 $output = "<a href=\"" . $path . $template . "?page=" . $attr["PAGE"] . "&v=" . $attr["V"];
                 // append additional getvars.
                 $output .= $attr["GETVARS"] . "\"";
             }
             // other attributes are readded if they haven't already been manually treated
             $manualattribs = array("HREF", "PAGE", "V", "GETVARS", "VARIATION");
             foreach ($attr as $key => $value) {
                 if (!in_array($key, $manualattribs)) {
                     $output .= " " . $key . "=\"" . $value . "\"";
                 }
             }
             $output .= ">";
             return $output;
         }
     }
 }
Esempio n. 2
0
	/**
	 * DEPRECATED! USe getInstances instead.
	 * Gets the IDs of any pages belonging to the same instance of a sitepage. 
	 * You use this function for getting a ordered list of all Members of a portal 
	 * or a multi-instance sitepage. Using it with a single-instance-page will only 
	 * return the ID of the single-instance page. The results will be returned in a 
	 * linear array. 
	 * @param 	integer		Sitepage-Id to get all other instances from.
	 * @returns integer		array of all Sitepage-IDs belonging to the same sitepage. 
	 */
	function getTwinPages($spid) {
		$menuId = getDBCell("sitepage", "MENU_ID", "SPID = $spid");

		$res = createDBCArray("sitepage", "SPID", "MENU_ID = $menuId ORDER BY POSITION");
		$twins = array ();

		for ($i = 0; $i < count($res); $i++) {
			if (!isSPExpired($res[$i]))
				array_push($twins, $res[$i]);
		}

		return $twins;
	}
Esempio n. 3
0
		/**
		   * 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, $cds;
			$v = value("v", "NUMERIC");
			
			$content = "";
			$querySQL = "SELECT * FROM $this->management_table WHERE $this->pk_name = $this->fkid";
			$query = new query($db, $querySQL);
			$query->getrow();
			$label = addslashes($query->field("LABEL"));
			$href = $query->field("HREF");
			$spid = $query->field("SPID");
			$target = $query->field("TARGET");
			$query->free();

			//if (is_object($cds)) {
			//	if ($cds->level == _LIVE) {
			//		$tmp = getDBCell("state_translation", "OUT_ID", "IN_ID = ".$spid." AND LEVEL = 10");	
			//		if ($tmp != "") $spid = $tmp;
			//	}	
			//}
			
			if ($href == "") {
				if (!isSPExpired($spid, $v) || $cds->is_development) {					
					if (function_exists("getMenuLink")) {
						$href = getMenuLink($spid, $v);
					} else if (is_object($cds)) {
						$obj = $cds->menu->getMenuById($spid);
						if (is_object($obj))
						  $href = $obj->getLink();
						unset($obj);	
					}
				}
			}

			if ($href != "") {
				if (strtoupper($param) == "ALL") {
					$cn["HREF"] = $href;

					$cn["LABEL"] = $label;
					$cn["TARGET"] = $target;
					$cn["SPID"] = $spid;
					return $cn;
				} else {
					$tg = "";

					if ($target != "")
						$tg = " target=\"" . $target . "\" ";

					$content = "<a href=\"$href\" $param $tg>$label</a>";
				}
			}

			return $content;
		}
Esempio n. 4
0
			/**
		 * To be used in header.inc.php to determine the URI of the startpage.
		 * to use.
		 * @param integer ID of the variation the Startpage should be find in.
		 * @returns	integer		Sitepage-ID of the first sitepage to use.
		 */		
		function getStartPageURI($variation=0, $level=10) {
			global $c;
			
			$uri=0;
			$pageId = 0;
			
			if ($variation == 0)
			  $variation = $c["stdvariation"];
			$zeroTrans = getDBCell("state_translation", "OUT_ID", "IN_ID=0 AND LEVEL=10");
			
			if ($level < 10) {
				$menues = createDBCArray("sitemap", "MENU_ID", "IS_DISPLAYED=1 AND PARENT_ID=0 ORDER BY POSITION ASC");
			} else {
				$menues = createDBCArray("sitemap", "MENU_ID", "IS_DISPLAYED=1 AND PARENT_ID=$zeroTrans ORDER BY POSITION ASC");
			}

			for ($i = 0; $i < count($menues); $i++) {
				$spids = createDBCArray("sitepage", "SPID", "MENU_ID = " . $menues[$i] . " ORDER BY POSITION");
				for ($j = 0; $j < count($spids); $j++) {
					if (!isSPExpired($spids[$j], $variation, $level)) {
						$pageId =  $spids[$j];
			 			$menu =	new Menu(null, $pageId, $variation, $level);
		  			return $c["host"].$menu->getLink();			
					}
				}
			}		  		 			
		}