本文整理汇总了PHP中PageLayout::addHeadElement方法的典型用法代码示例。如果您正苦于以下问题:PHP PageLayout::addHeadElement方法的具体用法?PHP PageLayout::addHeadElement怎么用?PHP PageLayout::addHeadElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageLayout
的用法示例。
在下文中一共展示了PageLayout::addHeadElement方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Initialize a new instance of the plugin.
*/
function __construct()
{
parent::__construct();
if (Config::get()->WYSIWYG && is_object($GLOBALS['user'])) {
if (strpos($_SERVER['REQUEST_URI'], 'dispatch.php/settings/general') !== false) {
if (Request::submitted('forced_language')) {
$GLOBALS['user']->cfg->store('WYSIWYG_DISABLE', Request::submitted('wysiwyg_user_config'));
}
$snippet = '
<tr>
<td>
<label for="wysiwyg_user_config">
WYSIWYG Editor ausschalten<br>
<dfn id="cookie_auth_token_description">
Mit dieser Einstellung können Sie den Stud.IP WYSIWYG Editor ausschalten. Dadurch müssen Sie ggf. Texte in HTML schreiben.
</dfn>
</label>
</td>
<td>
<input type="checkbox" value="1" aria-describedby="wysiwyg_user_config" id="wysiwyg_user_config" name="wysiwyg_user_config" ' . ($GLOBALS['user']->cfg->WYSIWYG_DISABLE ? 'checked' : '') . '>
</td>
</tr>';
$snippet = jsready($snippet, 'script-double');
PageLayout::addHeadElement('script', array('type' => 'text/javascript'), "jQuery(function (\$) {\$('#main_content tbody tr').first().after('{$snippet}');});");
}
if (!(Config::get()->WYSIWYG = !$GLOBALS['user']->cfg->WYSIWYG_DISABLE)) {
$old_packages = array_flip(PageLayout::getSqueezePackages());
unset($old_packages['wysiwyg']);
call_user_func_array('PageLayout::setSqueezePackages', array_values(array_flip($old_packages)));
}
}
}
示例2: index_action
/**
* This method is called to show the form to upload a new avatar for a
* course.
*
* @return void
*/
function index_action()
{
// nothing to do
if ($this->studygroup_mode) {
$this->avatar = StudygroupAvatar::getAvatar($this->course_id);
} else {
$this->avatar = CourseAvatar::getAvatar($this->course_id);
}
if (get_config('NEWS_RSS_EXPORT_ENABLE') && $this->course_id) {
$rss_id = StudipNews::GetRssIdFromRangeId($this->course_id);
if ($rss_id) {
PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => 'rss.php?id=' . $rss_id));
}
}
// Fetch news
$response = $this->relay('news/display/' . $this->course_id);
$this->news = $response->body;
// Fetch votes
if (get_config('VOTE_ENABLE')) {
$response = $this->relay('questionnaire/widget/' . $this->course_id);
$this->votes = $response->body;
}
// Fetch dates
if (!$this->studygroup_mode) {
$response = $this->relay("calendar/contentbox/display/{$this->course_id}/1210000");
$this->dates = $response->body;
}
}
示例3: initialize
public function initialize()
{
PageLayout::addSqueezePackage('lightbox');
$this->addStylesheet('assets/pluginmarket.less');
PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'href' => PluginEngine::getLink($this, array(), 'rss/newest'), 'title' => _('Neueste Plugins')));
$sidebar = Sidebar::Get();
$sidebar->setImage('../../' . $this->getPluginPath() . '/assets/sidebar-marketplace.png');
}
示例4: before_filter
function before_filter($action, $args)
{
$this->current_action = $action;
$this->flash = Trails_Flash::instance();
$this->standard_templates = $GLOBALS['STUDIP_BASE_PATH'] . '/templates/';
$this->standard_trails_root = $GLOBALS['STUDIP_BASE_PATH'] . '/app/';
$this->set_layout('layout.php');
PageLayout::setTitle($this->plugin->getDisplayTitle());
$this->url = $this->plugin->getPluginUrl() . '/public/';
PageLayout::addHeadElement('link', array("rel" => "stylesheet", "href" => $this->url . "stylesheets/application.css", "type" => "text/css"));
PageLayout::addHeadElement('script', array("src" => $this->url . "javascripts/application.js", "type" => "text/javascript"));
}
示例5: before_filter
function before_filter($action, $args) {
$this->current_action = $action;
$this->flash = Trails_Flash::instance();
$this->standard_templates = $GLOBALS['STUDIP_BASE_PATH'] . '/templates/';
$this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
$this->assets_url = $this->plugin->getPluginUrl(). '/assets/';
PageLayout::addScript('jquery.tablesorter.min.js');
PageLayout::addHeadElement("link",
array("href" => $this->assets_url.'stylesheets/blubberforum.css',
"rel" => "stylesheet"),
"");
}
示例6: before_filter
/**
* Initializes the controller
*
* @param String $action Action to execute
* @param Array $args Arguments
*/
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
if (Request::submitted('abort')) {
$this->redirect('admin/statusgroups/index');
}
$this->user_id = $GLOBALS['user']->user_id;
// Set pagelayout
PageLayout::addSqueezePackage('statusgroups');
PageLayout::setHelpKeyword("Basis.Allgemeines");
PageLayout::setTitle(_("Verwaltung von Funktionen und Gruppen"));
Navigation::activateItem('/admin/institute/groups');
// Include url for ajax moving of members in group to page header
PageLayout::addHeadElement('meta', array('name' => 'statusgroups-ajax-movable-endpoint', 'content' => $this->url_for('admin/statusgroups/move')));
$this->setType();
// Check if the viewing user should get the admin interface
$this->tutor = $this->type['edit']($this->user_id);
}
示例7: thread_action
public function thread_action($thread_id)
{
PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/autoresize.jquery.min.js"), "");
PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/blubberforum.js"), "");
PageLayout::addHeadElement("script", array('src' => $this->assets_url . "/javascripts/formdata.js"), "");
$this->thread = new ForumPosting($thread_id);
if ($this->thread['context_type'] === "course") {
PageLayout::setTitle($GLOBALS['SessSemName']["header_line"] . " - " . $this->plugin->getDisplayTitle());
} elseif ($this->thread['context_type'] === "public") {
PageLayout::setTitle(get_fullname($this->thread['user_id']) . " - Blubber");
} elseif ($this->thread['context_type'] === "private") {
PageLayout::setTitle(_("Privater Blubber"));
}
if ($this->thread['context_type'] === "course") {
Navigation::getItem("/course/blubberforum")->setImage($this->plugin->getPluginURL() . "/assets/images/blubber.png");
Navigation::activateItem('/course/blubberforum');
} elseif ($this->thread['context_type'] === "public") {
Navigation::activateItem('/profile/blubber');
} else {
Navigation::activateItem('/community/blubber');
}
$this->course_id = $_SESSION['SessionSeminar'];
$this->single_thread = true;
ForumPosting::$course_hashes = $thread['user_id'] !== $thread['Seminar_id'] ? $thread['Seminar_id'] : false;
}
示例8: add_calculator
public function add_calculator($eventname, $results)
{
//computational goodie
if (strpos($_SESSION['search_parameter']['search'], "?>") === false && strpos($_SESSION['search_parameter']['search'], ";") === false) {
preg_match_all("/(\\w+)/", $_SESSION['search_parameter']['search'], $matches);
$forbidden = false;
$allowed = array("abs", "acos", "acosh", "asin", "asinh", "atan2", "atan", "atanh", "base_convert", "ceil", "cos", "cosh", "exp", "expm1", "floor", "fmod", "lcg_value", "log10", "log1p", "log", "max", "min", "mt_rand", "mt_srand", "pi", "pow", "rand", "round", "sin", "sinh", "sqrt", "srand", "tan", "tanh");
$x = false;
$y = false;
if ($matches[0] && count($matches[0])) {
foreach ($matches[0] as $match) {
if ($match === "x") {
$x = true;
} elseif ($match === "y") {
$y = true;
$forbidden = true;
} elseif (!is_numeric($match) && !in_array($match, $allowed)) {
$forbidden = true;
}
}
}
if (!$forbidden && $x === false) {
//calculate the term
try {
$value = @eval("return " . $_SESSION['search_parameter']['search'] . ";");
if (is_numeric($value)) {
$result_object = new stdClass();
$result_object->title = $value;
array_unshift($results->results, $result_object);
}
} catch (Exception $e) {
//do nothing
}
} elseif (!$forbidden && $x === true && $y === false) {
//2-dimensional graph
$values = array();
$keys = array();
$ymin = 0;
$ymax = 1;
for ($i = -10; $i <= 10; $i += 0.125) {
$value = @eval("return " . preg_replace("/([^\\w]?)x([^\\w]?)/", "\$1 " . $i . " \$2", $_SESSION['search_parameter']['search']) . ";");
if (is_numeric($value)) {
if (is_finite($value)) {
if ($value < $ymin) {
$ymin = $value;
} elseif ($value > $ymax) {
$ymax = $value;
}
}
$values[] = is_finite($value) ? (string) $value : null;
$keys[] = floor($i) === $i ? (string) $i : "";
}
}
$result_object = new stdClass();
$result_object->title = "f(x) = " . $_SESSION['search_parameter']['search'];
$result_object->presentation = '<canvas id="search_f_x_graph" width="650" height="300"></canvas>' . '<script>
var f_x_data = ' . json_encode($values) . ';
var line = new RGraph.Line("search_f_x_graph", f_x_data);
line.Set("chart.linewidth", 2);
//line.Set("chart.ymin", ' . $ymin . ');
//line.Set("chart.ymax", ' . $ymax . ');
line.Set("chart.xaxispos", "' . ($ymin < 0 ? "center" : "bottom") . '");
line.Set("chart.labels", ' . json_encode($keys) . ');
line.Set("chart.shadow", true);
line.Set("chart.shadow.color", "rgba(0,0,0,0.2)");
line.Set("chart.gutter.left", 50);
line.Draw();
</script>';
PageLayout::addHeadElement("script", array('src' => $GLOBALS['ABSOLUTE_URI_STUDIP'] . $this->getPluginPath() . "/assets/RGraph.common.core.js"), '');
PageLayout::addHeadElement("script", array('src' => $GLOBALS['ABSOLUTE_URI_STUDIP'] . $this->getPluginPath() . "/assets/RGraph.line.js"), '');
array_unshift($results->results, $result_object);
}
}
}
示例9: read_action
public function read_action($message_id)
{
$this->message = new Message($message_id);
if (!$this->message->permissionToRead()) {
throw new AccessDeniedException();
}
PageLayout::setTitle(_('Betreff') . ': ' . $this->message['subject']);
if ($this->message['autor_id'] === $GLOBALS['user']->id) {
Navigation::activateItem('/messaging/messages/sent');
} else {
Navigation::activateItem('/messaging/messages/inbox');
}
if (Request::isXhr()) {
$this->response->add_header('X-Tags', json_encode(studip_utf8encode($this->message->getTags())));
$this->response->add_header('X-All-Tags', json_encode(studip_utf8encode(Message::getUserTags())));
} else {
// Try to redirect to overview of recevied/sent messages if
// controller is not called via ajax to ensure message is loaded
// in dialog.
$target = $this->message->autor_id === $GLOBALS['user']->id ? $this->url_for('messages/sent/' . $message_id) : $this->url_for('messages/overview/' . $message_id);
$script = sprintf('if (STUDIP.Dialog.shouldOpen()) { location.href = "%s"; }', $target);
PageLayout::addHeadElement('script', array(), $script);
}
$this->message->markAsRead($GLOBALS["user"]->id);
}
示例10: array
<?php
//OpenGraph attributes
PageLayout::addHeadElement("meta", array('property' => "og:site_name", 'content' => _("Stud.IP Plugin-Marktplatz")));
PageLayout::addHeadElement("meta", array('property' => "og:type", 'content' => "article"));
PageLayout::addHeadElement("meta", array('property' => "og:title", 'content' => $marketplugin['name']));
PageLayout::addHeadElement("meta", array('property' => "og:description", 'content' => $marketplugin['short_description']));
$image = $marketplugin->images->first();
if ($image) {
PageLayout::addHeadElement("meta", array('property' => "og:image", 'content' => $image->getURL(true)));
}
?>
<?php
if (!$marketplugin['publiclyvisible']) {
?>
<?php
echo PageLayout::postMessage(MessageBox::info(_("Dieses Plugin ist nicht öffentlich.")));
}
?>
<h1><?php
echo htmlReady($marketplugin['name']);
?>
</h1>
<div>
<?php
echo htmlReady($marketplugin['short_description']);
?>
</div>
<?php
示例11: initialize
/**
* Initializes the plugin when actually invoked. Injects stylesheets into
* the page layout.
*/
public function initialize()
{
$this->addStylesheet('assets/stylesheets/blubber.less');
$assets_url = $this->getPluginURL() . '/assets/';
PageLayout::addHeadElement('script', array('src' => $assets_url . '/javascripts/autoresize.jquery.min.js'), '');
PageLayout::addHeadElement('script', array('src' => $assets_url . '/javascripts/blubber.js'), '');
PageLayout::addHeadElement('script', array('src' => $assets_url . '/javascripts/formdata.js'), '');
}
示例12: array
<?
global $template_factory;
$this->set_layout($template_factory->open('layouts/base_without_infobox'));
$ASSETS = $plugin->getPluginURL() . '/assets/';
PageLayout::addStylesheet($ASSETS . 'css/questions/styles.css');
PageLayout::addScript($ASSETS . 'js/vendor/validator.js');
PageLayout::addHeadElement('script', array(),
'
var cliqr = {bootstrap: {}, config: {
PLUGIN_URL : "' . htmlReady(current(explode('?', $controller->url_for("")))) . '"
, CID : "' . htmlReady($cid) . '"
, ASSETS : "' . htmlReady($ASSETS) . '"
, SHORT_URL : "' . htmlReady($short_url) . '"
}};
');
?>
<!-- BEGIN CLIQR PAGE -->
<script>
cliqr.bootstrap.POLLS = <?php
echo json_encode(array_map(function ($q) {
return $q->toJSON();
}, $questions));
?>
;
</script>
<div id="cliqr-container"></div>
<!-- END CLIQR PAGE -->
示例13: addStylesheet
/**
* Includes given stylesheet in page, compiles less if neccessary
*
* @param String $filename Name of the stylesheet (css or less) to include
* (relative to plugin directory)
*/
protected function addStylesheet($filename)
{
if (substr($filename, -5) !== '.less') {
$url = $this->getPluginURL() . '/' . $filename;
PageLayout::addStylesheet($url);
return;
}
// Create absolute path to less file
$less_file = $GLOBALS['ABSOLUTE_PATH_STUDIP'] . $this->getPluginPath() . '/' . $filename;
// Fail if file does not exist
if (!file_exists($less_file)) {
throw new Exception('Could not locate LESS file "' . $filename . '"');
}
// Get plugin version from metadata
$metadata = $this->getMetadata();
$plugin_version = $metadata['version'];
// Get plugin id (or parent plugin id if any)
$plugin_id = $this->plugin_info['depends'] ?: $this->getPluginId();
// Get asset file from storage
$asset = Assets\Storage::getFactory()->createCSSFile($less_file, array('plugin_id' => $this->plugin_info['depends'] ?: $this->getPluginId(), 'plugin_version' => $metadata['version']));
// Compile asset if neccessary
if ($asset->isNew()) {
$less = file_get_contents($less_file);
$css = Assets\Compiler::compileLESS($less, array('plugin-path' => $this->getPluginURL()));
$asset->setContent($css);
}
// Include asset in page by reference or directly
$download_uri = $asset->getDownloadLink();
if ($download_uri === false) {
PageLayout::addStyle($asset->getContent());
} else {
PageLayout::addHeadElement('link', ['rel' => 'stylesheet', 'href' => $download_uri, 'type' => 'text/css']);
}
}
示例14: index_action
/**
* Entry point of the controller that displays all the information of the selected or current user
* @return void
*/
public function index_action()
{
// Template Index_Box for render-partials
$layout = $GLOBALS['template_factory']->open('shared/content_box');
$this->shared_box = $layout;
// if he has not yet stored into user_info, he comes in with no values
if ($this->current_user->mkdate === null) {
$this->current_user->store();
}
if (get_config('NEWS_RSS_EXPORT_ENABLE')) {
$news_author_id = StudipNews::GetRssIdFromUserId($this->current_user->user_id);
if ($news_author_id) {
PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => 'rss.php?id=' . $news_author_id));
}
}
// Get Avatar
$this->avatar = Avatar::getAvatar($this->current_user->user_id)->getImageTag(Avatar::NORMAL);
// GetScroreList
if (get_config('SCORE_ENABLE')) {
if ($this->current_user->user_id === $GLOBALS['user']->id || $this->current_user->score) {
$this->score = Score::GetMyScore($this->current_user);
$this->score_title = Score::getTitel($this->score, $this->current_user->geschlecht);
}
}
// Additional user information
$this->public_email = get_visible_email($this->current_user->user_id);
$this->motto = $this->profile->getVisibilityValue('motto');
$this->private_nr = $this->profile->getVisibilityValue('privatnr', 'private_phone');
$this->private_cell = $this->profile->getVisibilityValue('privatcell', 'private_cell');
$this->privadr = $this->profile->getVisibilityValue('privadr', 'privadr');
$this->homepage = $this->profile->getVisibilityValue('Home', 'homepage');
// skype informations
if (get_config('ENABLE_SKYPE_INFO') && $this->profile->checkVisibility('skype_name')) {
$this->skype_name = UserConfig::get($this->current_user->user_id)->SKYPE_NAME;
$this->skype_status = UserConfig::get($this->current_user->user_id)->SKYPE_ONLINE_STATUS && $this->profile->checkVisibility('skype_online_status');
}
// get generic datafield entries
$this->shortDatafields = $this->profile->getShortDatafields();
$this->longDatafields = $this->profile->getLongDatafields();
// get working station of an user (institutes)
$this->institutes = $this->profile->getInstitutInformations();
// get studying informations of an user
if ($this->current_user->perms != 'dozent') {
$study_institutes = UserModel::getUserInstitute($this->current_user->user_id, true);
if (count($study_institutes) > 0 && $this->profile->checkVisibility('studying')) {
$this->study_institutes = $study_institutes;
}
}
if ($this->current_user->user_id == $this->user->user_id && $GLOBALS['has_denoted_fields']) {
$this->has_denoted_fields = true;
}
// get kings informations
if (Config::Get()->SCORE_ENABLE) {
if ($this->current_user->user_id === $GLOBALS['user']->id || $this->current_user->score) {
$kings = $this->profile->getKingsInformations();
if ($kings != null) {
$this->kings = $kings;
}
}
}
$show_admin = $this->perm->have_perm('autor') && $this->user->user_id == $this->current_user->user_id || isDeputyEditAboutActivated() && isDeputy($this->user->user_id, $this->current_user->user_id, true);
if ($this->profile->checkVisibility('news') or $show_admin === true) {
$response = $this->relay('news/display/' . $this->current_user->user_id);
$this->news = $response->body;
}
// calendar
if (get_config('CALENDAR_ENABLE')) {
if (!in_array($this->current_user->perms, words('admin root'))) {
if ($this->profile->checkVisibility('termine')) {
$response = $this->relay('calendar/contentbox/display/' . $this->current_user->user_id);
$this->dates = $response->body;
}
}
}
// include and show votes and tests
if (get_config('VOTE_ENABLE') && $this->profile->checkVisibility('votes')) {
$response = $this->relay('questionnaire/widget/' . $this->current_user->user_id . "/user");
$this->votes = $response->body;
}
// Hier werden Lebenslauf, Hobbys, Publikationen und Arbeitsschwerpunkte ausgegeben:
$ausgabe_felder = array('lebenslauf' => _('Lebenslauf'), 'hobby' => _('Hobbys'), 'publi' => _('Publikationen'), 'schwerp' => _('Arbeitsschwerpunkte'));
$ausgabe_inhalt = array();
foreach ($ausgabe_felder as $key => $value) {
if ($this->profile->checkVisibility($key)) {
$ausgabe_inhalt[$value] = $this->current_user[$key];
}
}
$this->ausgabe_inhalt = array_filter($ausgabe_inhalt);
// Anzeige der Seminare, falls User = dozent
if ($this->current_user['perms'] == 'dozent') {
$this->seminare = array_filter($this->profile->getDozentSeminars());
}
// Hompageplugins
$homepageplugins = PluginEngine::getPlugins('HomepagePlugin');
foreach ($homepageplugins as $homepageplugin) {
if ($homepageplugin->isActivated($this->current_user->user_id, 'user')) {
//.........这里部分代码省略.........