public static function PageLinks() { $strPrevious = null; $strNext = null; $blnFound = false; $strScript = QApplication::$ScriptName; if (strpos($strScript, "plugin") !== false && strpos($strScript, "vendor") !== false) { // a plugin $strLink = QHtml::RenderLink(QHtml::MakeUrl(__DEVTOOLS_ASSETS__ . '/plugin_manager.php'), "Plugin Manager", ["class" => "headerLink"]); return $strLink; } foreach (Examples::$Categories as $objExampleCategory) { if (!$blnFound) { $strPrevious = null; $strNext = null; foreach ($objExampleCategory as $strKey => $strExample) { if (is_numeric($strKey)) { // Pull out the URL fragment from the example tree $intPosition = strpos($strExample, ' '); $strScriptName = substr($strExample, 0, $intPosition); $strDescription = substr($strExample, $intPosition + 1); $qapp = QApplication::$ScriptName; if (!$blnFound) { if (strpos(QApplication::$ScriptName, $strScriptName) !== false || strpos($strScriptName, QApplication::$ScriptName) !== false) { // for plugins examples $blnFound = true; } else { $strPrevious = sprintf('<strong><a href="%s" class="headerLink"><< %s</a></strong>', $strScriptName, $strDescription); } } else { if (!$strNext) { $strNext = sprintf('<strong><a href="%s" class="headerLink">%s >></a></strong>', $strScriptName, $strDescription); } } } } } } $strToReturn = ''; if ($strPrevious) { $strToReturn = $strPrevious; } else { $strToReturn = '<span class="headerGray"><< Previous</span>'; } $intCategoryId = Examples::GetCategoryId(); if ($intCategoryId < 3) { $intPartId = 1; } else { if ($intCategoryId < 10) { $intPartId = 2; } else { $intPartId = 3; } } $strToReturn .= ' | '; $strToReturn .= sprintf('<strong><a href="%s/index.php%s" class="headerLink">Back to Main</a></strong>', __VIRTUAL_DIRECTORY__ . __EXAMPLES__, $intPartId == 1 ? "" : "/" . $intPartId); $strToReturn .= ' | '; if ($strNext) { $strToReturn .= $strNext; } else { $strToReturn .= '<span class="headerGray">Next >></span>'; } return $strToReturn; }
/** * Returns the final string representing the content of the cell. * * @param mixed $item * @return string */ public function FetchCellValue($item) { $strText = parent::FetchCellValue($item); // allow post processing of cell label $getVars = null; if ($this->getVars) { if (is_array($this->getVars)) { if (array_keys($this->getVars)[0] === 0) { // assume this is not associative array. Likely we are here to extract a property list. $getVars = static::GetObjectValue($this->getVars, $item); } else { // associative array, so likely these are Get variables to be assigned individually foreach ($this->getVars as $key => $val) { $getVars[$key] = static::GetObjectValue($val, $item); } } } elseif ($this->getVars instanceof QQNode) { $getVars = static::GetObjectValue($this->getVars, $item); } else { $getVars = $this->getVars; // could be a simple action parameter. } } $tagAttributes = []; if ($this->tagAttributes && is_array($this->tagAttributes)) { foreach ($this->tagAttributes as $key => $val) { $tagAttributes[$key] = static::GetObjectValue($val, $item); } } if ($this->mixDestination === null) { return QApplication::HtmlEntities($strText); } elseif ($this->mixDestination instanceof QControlProxy) { if ($this->blnAsButton) { return $this->mixDestination->RenderAsButton($strText, $getVars, $tagAttributes); } else { return $this->mixDestination->RenderAsLink($strText, $getVars, $tagAttributes); } } else { $strDestination = static::GetObjectValue($this->mixDestination, $item); return QHtml::RenderLink(QHtml::MakeUrl($strDestination, $getVars), $strText, $tagAttributes); } }