/** * Creates a link to a fav icon. * Output example: * <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> * <link rel="icon" href="/favicon.ico" type="image/x-icon" /> * @param type $path */ public function faviconLink($path) { $relativePath = Path::relativePath($path); $html = '<link rel="shortcut icon" href="' . $relativePath . '" type="image/x-icon" />'; $html .= '<link rel="icon" href="' . $relativePath . '" type="image/x-icon" />'; echo $html; }
/** * Adds a table footer to the html. */ protected function addHtmlTableFooter() { $modelTable = $this->entityArray->getModelTable(); $this->html .= '<tr>'; $newButtonUrl = \Pvik\Core\Path::relativePath('~' . \Pvik\Core\Config::$config['PvikAdminTools']['Url']) . 'tables/' . strtolower($modelTable->getModelTableName()) . ':new'; if ($this->newButtonPresetValues != null) { $newButtonUrl .= '/'; $first = true; foreach ($this->newButtonPresetValues as $key => $value) { if ($first) { $first = false; } else { $newButtonUrl .= ':'; } $newButtonUrl .= strtolower($key) . ':' . $value; } } $newButtonUrl .= '/'; if ($this->buttonRedirectBack != null) { $newButtonUrl .= '?redirect-back-url=' . urlencode($this->buttonRedirectBack); } for ($index = 0; $index < $this->columns; $index++) { if ($index + 1 == $this->columns) { // last column $this->html .= '<td class="options">['; $this->html .= '<a href="' . $newButtonUrl . '">new</a>'; $this->html .= ']</td>'; } else { $this->html .= '<td>'; $this->html .= '</td>'; } } $this->html .= '</tr>'; }
/** * Shortcut to Path::relativePath function * @param string $path * @return string */ protected function relativePath($path) { return Path::relativePath($path); }
/** * Returns a relative file path with the PvikAdminTools base path. * @param string $path * @return string */ public static function fileRelativePath($path) { return \Pvik\Core\Path::relativePath(\Pvik\Core\Config::$config['PvikAdminTools']['BasePath'] . $path); }
/** * Redirect to a url via setting the location in the header. * @param string $path */ protected function redirectToPath($path) { $relativePath = Path::relativePath($path); header("Location: " . $relativePath); }