本文整理汇总了PHP中LeftAndMain类的典型用法代码示例。如果您正苦于以下问题:PHP LeftAndMain类的具体用法?PHP LeftAndMain怎么用?PHP LeftAndMain使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LeftAndMain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFrameworkVersion
/**
* Get version
*
* @return string
*/
public static function getFrameworkVersion()
{
$lm = new LeftAndMain();
$version = $lm->CMSVersion();
if ($version) {
$parts = explode(', ', $version);
foreach ($parts as $part) {
$p = explode(': ', $part);
if ($p[0] == 'Framework') {
return $p[1];
}
}
}
// As fallback, we can use deprecation but this can be changed by the user
return Deprecation::dump_settings()['version'];
}
示例2: customise_css
/**
* Apply custom styles to the absolute description element.
*
* @parameter <{DESCRIPTION_CSS}> array(string)
*/
public static function customise_css($styles)
{
if (is_array($styles)) {
// Determine the path to write against.
$URL = DESCRIPTIVE_PATH . '/css/custom.css';
$path = Director::baseFolder() . "/{$URL}";
// Collate each custom style where appropriate.
$CSS = '#cms-menu-descriptive {' . PHP_EOL;
foreach ($styles as $style => $value) {
if (!is_numeric($style)) {
$CSS .= "\t{$style}: {$value} !important;" . PHP_EOL;
// Apply any possible background change.
if (strtolower($style) === 'background') {
$background = '#cms-menu-descriptive:before,' . PHP_EOL . '#cms-menu-descriptive:after {' . PHP_EOL;
$background .= "\tborder-top: 10px solid {$value} !important;" . PHP_EOL . '}' . PHP_EOL . PHP_EOL;
$background .= '#cms-menu-descriptive:before {' . PHP_EOL;
$background .= "\tborder-top: 13px solid !important;" . PHP_EOL;
$background .= "\tborder-top-color: inherit !important;" . PHP_EOL . '}' . PHP_EOL;
}
}
}
$CSS .= '}' . PHP_EOL . PHP_EOL . $background;
// Write the custom styles.
file_put_contents($path, $CSS);
chmod($path, 0664);
LeftAndMain::require_css($URL);
}
}
示例3: init
public function init()
{
// In LeftAndMain::init() the current theme is unset.
// we need to restore the current theme here for make the dropdown of template list.
$theme = SSViewer::current_theme();
parent::init();
if (isset($theme) && $theme) {
SSViewer::set_theme($theme);
}
Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/tiny_mce_improvements.js');
//TODO what is going on here? where did that hover.js go? can't find it.
//TODO We need to reimplement a hover.js?
Requirements::javascript(CMS_DIR . '/javascript/hover.js');
Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/controls.js');
Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_left.js');
Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_right.js');
Requirements::javascript(CMS_DIR . '/javascript/CMSMain_left.js');
Requirements::javascript(CMS_DIR . '/javascript/SecurityAdmin.js');
Requirements::javascript(NEWSLETTER_DIR . '/javascript/NewsletterAdmin_left.js');
Requirements::javascript(NEWSLETTER_DIR . '/javascript/NewsletterAdmin_right.js');
Requirements::javascript(NEWSLETTER_DIR . '/javascript/ProgressBar.js');
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
if (!Director::is_ajax()) {
Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');
HtmlEditorConfig::get('cms')->setOption('ContentCSS', project() . '/css/editor.css');
HtmlEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang());
}
// Always block the HtmlEditorField.js otherwise it will be sent with an ajax request
Requirements::block(SAPPHIRE_DIR . '/javascript/HtmlEditorField.js');
Requirements::css(NEWSLETTER_DIR . '/css/NewsletterAdmin.css');
}
示例4: init
public function init()
{
parent::init();
Requirements::javascript(MCE_ROOT . "tiny_mce_src.js");
Requirements::javascript("jsparty/tiny_mce_improvements.js");
Requirements::javascript("jsparty/hover.js");
Requirements::javascript("jsparty/scriptaculous/controls.js");
Requirements::javascript("cms/javascript/SecurityAdmin.js");
Requirements::javascript("cms/javascript/LeftAndMain_left.js");
Requirements::javascript("cms/javascript/LeftAndMain_right.js");
Requirements::javascript("cms/javascript/CMSMain_left.js");
Requirements::javascript("cms/javascript/ReportAdmin_left.js");
Requirements::javascript("cms/javascript/ReportAdmin_right.js");
Requirements::css("cms/css/ReportAdmin.css");
// TODO Find a better solution to integrate optional Requirements in a specific order
if (Director::fileExists("ecommerce/css/DataReportCMSMain.css")) {
Requirements::css("ecommerce/css/DataReportCMSMain.css");
}
if (Director::fileExists("ecommerce/css/DataReportCMSMain.css")) {
Requirements::javascript("ecommerce/javascript/DataReport.js");
}
if (Director::fileExists(project() . "/css/DataReportCMSMain.css")) {
Requirements::css(project() . "/css/DataReportCMSMain.css");
}
if (Director::fileExists(project() . "/css/DataReportCMSMain.css")) {
Requirements::javascript(project() . "/javascript/DataReport.js");
}
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
if (!Director::is_ajax()) {
Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => project() . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang()));
}
}
示例5: init
public function init()
{
// Check permissions
// if(!Member::currentUser() || !Member::currentUser()->isAdmin()) Security::permissionFailure($this);
parent::init();
/*
if(!$this->can('AdminCMS')) {
$messageSet = array(
'default' => "Please choose an authentication method and enter your credentials to access the CMS.",
'alreadyLoggedIn' => "I'm sorry, but you can't access that part of the CMS. If you want to log in as someone else, do so below",
'logInAgain' => "You have been logged out of the CMS. If you would like to log in again, enter a username and password below.",
);
Security::permissionFailure($this, $messageSet);
return;
}*/
Requirements::javascript(MCE_ROOT . "tiny_mce_src.js");
Requirements::javascript("jsparty/tiny_mce_improvements.js");
Requirements::javascript("jsparty/hover.js");
Requirements::javascript("jsparty/scriptaculous/controls.js");
Requirements::javascript("cms/javascript/SecurityAdmin.js");
Requirements::javascript("cms/javascript/LeftAndMain_left.js");
Requirements::javascript("cms/javascript/LeftAndMain_right.js");
Requirements::javascript("cms/javascript/CMSMain_left.js");
Requirements::javascript("cms/javascript/NewsletterAdmin_left.js");
Requirements::javascript("cms/javascript/NewsletterAdmin_right.js");
Requirements::javascript("sapphire/javascript/ProgressBar.js");
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
if (!Director::is_ajax()) {
Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => project() . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang()));
}
// needed for MemberTableField (Requirements not determined before Ajax-Call)
Requirements::javascript("cms/javascript/MemberTableField.js");
Requirements::css("cms/css/NewsletterAdmin.css");
}
示例6: init
public function init()
{
parent::init();
// We don't want this showing up in every ajax-response, it should always be present in a CMS-environment
if (!Director::is_ajax()) {
Requirements::javascriptTemplate("cms/javascript/tinymce.template.js", array("ContentCSS" => (SSViewer::current_theme() ? "themes/" . SSViewer::current_theme() : project()) . "/css/editor.css", "BaseURL" => Director::absoluteBaseURL(), "Lang" => i18n::get_tinymce_lang()));
}
Requirements::javascript('cms/javascript/CMSMain.js');
Requirements::javascript('cms/javascript/CMSMain_left.js');
Requirements::javascript('cms/javascript/CMSMain_right.js');
Requirements::javascript('sapphire/javascript/UpdateURL.js');
/**
* HACK ALERT: Project-specific requirements
*
* We need a better way of including all of the CSS that *might* be used by this application.
* Perhaps the ajax responses can include some instructions to go get more CSS / JavaScript?
*/
Requirements::css("survey/css/SurveyFilter.css");
Requirements::javascript("survey/javascript/SurveyResponses.js");
Requirements::javascript("survey/javascript/FormResponses.js");
Requirements::javascript("parents/javascript/NotifyMembers.js");
Requirements::css("tourism/css/SurveyCMSMain.css");
Requirements::javascript("tourism/javascript/QuotasReport.js");
Requirements::javascript("sapphire/javascript/ReportField.js");
Requirements::javascript("ptraining/javascript/BookingList.js");
Requirements::javascript("forum/javascript/ForumAccess.js");
Requirements::javascript('gallery/javascript/GalleryPage_CMS.js');
}
示例7: init
public function init()
{
parent::init();
//CSS/JS Dependencies - currently not much there
Requirements::css("calendar/css/admin/CalendarAdmin.css");
Requirements::javascript("calendar/javascript/admin/CalendarAdmin.js");
}
示例8: getSiteTreeFor
function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30)
{
if (!$childrenMethod) {
$childrenMethod = 'ChildFolders';
}
return parent::getSiteTreeFor($className, $rootID, $childrenMethod, $numChildrenMethod, $filterFunction, $minNodeCount);
}
示例9: getEditForm
/**
* @return Form
*/
public function getEditForm($id = null, $fields = null)
{
if (!$id) {
$id = $this->currentPageID();
}
$form = parent::getEditForm($id);
$record = $this->getRecord($id);
if ($record && !$record->canView()) {
return Security::permissionFailure($this);
}
$newComments = Comment::get()->filter('Moderated', 0);
$newGrid = new CommentsGridField('NewComments', _t('CommentsAdmin.NewComments', 'New'), $newComments, CommentsGridFieldConfig::create());
$approvedComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 0);
$approvedGrid = new CommentsGridField('ApprovedComments', _t('CommentsAdmin.ApprovedComments', 'Approved'), $approvedComments, CommentsGridFieldConfig::create());
$spamComments = Comment::get()->filter('Moderated', 1)->filter('IsSpam', 1);
$spamGrid = new CommentsGridField('SpamComments', _t('CommentsAdmin.SpamComments', 'Spam'), $spamComments, CommentsGridFieldConfig::create());
$newCount = '(' . count($newComments) . ')';
$approvedCount = '(' . count($approvedComments) . ')';
$spamCount = '(' . count($spamComments) . ')';
$fields = new FieldList($root = new TabSet('Root', new Tab('NewComments', _t('CommentAdmin.NewComments', 'New') . ' ' . $newCount, $newGrid), new Tab('ApprovedComments', _t('CommentAdmin.ApprovedComments', 'Approved') . ' ' . $approvedCount, $approvedGrid), new Tab('SpamComments', _t('CommentAdmin.SpamComments', 'Spam') . ' ' . $spamCount, $spamGrid)));
$root->setTemplate('CMSTabSet');
$actions = new FieldList();
$form = new Form($this, 'EditForm', $fields, $actions);
$form->addExtraClass('cms-edit-form');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
if ($form->Fields()->hasTabset()) {
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
}
$this->extend('updateEditForm', $form);
return $form;
}
示例10: init
/**
* Provides hook for decorators, so that they can overwrite css
* and other definitions.
*
* @param bool $skipUpdateInit Set to true to skip the parents updateInit extension
*
* @return void
*
* @author Sebastian Diel <sdiel@pixeltricks.de>
* @since 20.02.2013
*/
public function init($skipUpdateInit = false)
{
parent::init();
if (!$skipUpdateInit) {
$this->extend('updateInit');
}
}
示例11: init
function init()
{
parent::init();
// somehow themed css gets mixed in, remove it
$reqbe = Requirements::backend();
foreach ($reqbe->get_css() as $file => $val) {
if (preg_match('/^themes\\//', $file)) {
Requirements::block($file);
}
}
Requirements::javascript(THIRDPARTY_DIR . '/jquery-form/jquery.form.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.core.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.widget.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.mouse.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.tabs.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.button.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.position.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.dialog.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-ui/jquery.ui.draggable.js');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.core.css');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.dialog.css');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.theme.css');
Requirements::css(THIRDPARTY_DIR . '/jquery-ui-themes/base/jquery.ui.tabs.css');
Requirements::clear('jsparty/prototype.js');
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
Requirements::add_i18n_javascript('dbplumber/javascript/lang');
Requirements::javascript("dbplumber/javascript/DatabaseBrowser.js");
Requirements::javascript("dbplumber/thirdparty/jquery.event.drag-1.4.js");
Requirements::javascript("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.js");
Requirements::javascript("dbplumber/thirdparty/jquery.textarea-expander.js");
Requirements::css("dbplumber/thirdparty/jquery.kiketable.colsizable-1.1.css");
Requirements::css("dbplumber/css/DatabaseBrowser_left.css");
Requirements::css("dbplumber/css/DatabaseBrowser_right.css");
}
示例12: init
public function init()
{
parent::init();
if (!$this->request->isAjax()) {
Requirements::css('timeline/css/notification-wall.css');
}
}
示例13: init
/**
* Loads the requirements, checks perms, etc. If an ID is in the URL, that becomes the
* current folder.
*/
public function init()
{
parent::init();
if (!Permission::check("ADMIN") && !Permission::check("CMS_ACCESS_BrowseFiles")) {
return Security::permissionFailure($this, _t('KickAssets.PERMISSIONFAIL', 'You do not have permission to access this section of the CMS.'));
}
Requirements::clear();
Requirements::css('kickassets/css/core.css');
Requirements::css('kickassets/css/kickassets.css');
Requirements::javascript('kickassets/javascript/jquery.js');
Requirements::javascript(THIRDPARTY_DIR . '/jquery-livequery/jquery.livequery.js');
Requirements::javascript('kickassets/javascript/apprise/apprise-1.5.full.js');
Requirements::javascript('kickassets/javascript/jquery.tooltip.js');
Requirements::css('kickassets/javascript/apprise/apprise.css');
Requirements::javascript('kickassets/javascript/kickassets_ui.js');
Requirements::javascript('kickassets/javascript/chosen/chosen.jquery.js');
Requirements::css('kickassets/javascript/chosen/chosen.css');
Requirements::javascript('kickassets/javascript/jquery.form.js');
Requirements::javascript('kickassets/javascript/kickassets.js');
Requirements::css('kickassets/css/kickassets_ui.css');
if ($this->getRequest()->param('ID')) {
$this->currentFolder = DataObject::get_by_id("Folder", (int) $this->getRequest()->param('ID'));
$this->currentPath = KickAssetUtil::relative_asset_dir($this->currentFolder->Filename);
} else {
$this->currentFolder = singleton('Folder');
$this->currentPath = false;
}
}
示例14: getEditForm
/**
* @return Form
*/
public function getEditForm($id = null, $fields = null)
{
if (!$id) {
$id = $this->currentPageID();
}
$form = parent::getEditForm($id);
$record = $this->getRecord($id);
if ($record && !$record->canView()) {
return Security::permissionFailure($this);
}
$commentsConfig = GridFieldConfig::create()->addComponents(new GridFieldFilterHeader(), new GridFieldDataColumns(), new GridFieldSortableHeader(), new GridFieldPaginator(25), new GridFieldDeleteAction(), new GridFieldDetailForm(), new GridFieldExportButton(), new GridFieldEditButton(), new GridFieldDetailForm());
$needs = new GridField('Comments', _t('CommentsAdmin.NeedsModeration', 'Needs Moderation'), Comment::get()->where('Moderated = 0'), $commentsConfig);
$moderated = new GridField('CommentsModerated', _t('CommentsAdmin.CommentsModerated'), Comment::get()->where('Moderated = 1'), $commentsConfig);
$fields = new FieldList($root = new TabSet('Root', new Tab('NeedsModeration', _t('CommentAdmin.NeedsModeration', 'Needs Moderation'), $needs), new Tab('Comments', _t('CommentAdmin.Moderated', 'Moderated'), $moderated)));
$root->setTemplate('CMSTabSet');
$actions = new FieldList();
$form = new Form($this, 'EditForm', $fields, $actions);
$form->addExtraClass('cms-edit-form');
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
if ($form->Fields()->hasTabset()) {
$form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
$form->addExtraClass('center ss-tabset cms-tabset ' . $this->BaseCSSClasses());
}
$this->extend('updateEditForm', $form);
return $form;
}
示例15: Breadcrumbs
/**
* @param bool $unlinked
* @return ArrayList
*/
public function Breadcrumbs($unlinked = false)
{
$items = parent::Breadcrumbs($unlinked);
$items[0]->Link = singleton('CloudinaryAdmin')->Link('show');
$items->push(new ArrayData(array('Title' => _t('CloudinaryAdmin.Upload', 'Upload'), 'Link' => $this->Link())));
return $items;
}
开发者ID:helpfulrobot,项目名称:mademedia-silverstripe-cloudinary,代码行数:11,代码来源:CloudinaryFileAddController.php