phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
CDNGuiGen.php
Go to the documentation of this file.
1<?php
2
3namespace Ajax\lib;
4
5
8
9class CDNGuiGen extends CDNBase {
10 protected $theme;
11 protected $cssUrl;
12 protected $localCss;
13
14 public function __construct($version, $theme=NULL, $provider="Google") {
15 parent::__construct($version, $provider);
16 $this->data=$this->data ["JQueryUI"];
17 if (is_int($theme)) {
18 $themes=$this->getThemes();
19 if (sizeof($themes)>$theme-1)
20 $this->theme=$themes [$theme-1];
21 else
22 throw new \Exception("CDNGuiGen : Le numéro de thème demandé n'existe pas");
23 }
24 $this->theme=$theme;
25 $this->cssUrl=null;
26 }
27
28 public function getCssUrl() {
29 return $this->cssUrl;
30 }
31
32 public function getThemes($provider=NULL) {
33 if (isset($provider))
34 return $this->data [$provider] ["themes"];
35 else
36 return $this->data [$this->provider] ["themes"];
37 }
38
39 public function getFirstTheme($provider=NULL) {
40 $themes=$this->getThemes($provider);
41 if (sizeof($themes)>0)
42 return $themes [0];
43 return "";
44 }
45
46 public function getUrl() {
47 return $this->getUrlOrCss($this->jsUrl, "core");
48 }
49
50 public function getCss() {
51 if (isset($this->cssUrl))
52 return $this->cssUrl;
54 if (array_search($version, $this->getVersions())===false)
55 $version=$this->getLastVersion();
57 if (array_search($theme, $this->getThemes())===false)
58 $theme=$this->getFirstTheme();
59 return $this->replaceVersionAndTheme($this->data [$this->provider] ["css"], $version, $theme);
60 }
61
62 public function __toString() {
63 $url=$this->getUrl();
64 $css=$this->getCss();
65 return HtmlUtils::javascriptInclude($url)."\n".HtmlUtils::stylesheetInclude($css);
66 }
67
68 public function setCssUrl($cssUrl, $local=null) {
69 $this->cssUrl=$cssUrl;
70 if (isset($local)===false) {
71 $local=JString::startsWith($cssUrl, "http")===false;
72 }
73 $this->setLocalCss($local);
74 return $this;
75 }
76
77 public function getLocalCss() {
78 return $this->localCss;
79 }
80
81 public function setLocalCss($localCss) {
82 $this->localCss=$localCss;
83 return $this;
84 }
85}
getUrlOrCss($element, $key)
Definition CDNBase.php:36
getVersions($provider=NULL)
Definition CDNBase.php:79
replaceVersionAndTheme($url, $version, $theme)
Definition CDNBase.php:62
getLastVersion($provider=NULL)
Definition CDNBase.php:86
getFirstTheme($provider=NULL)
Definition CDNGuiGen.php:39
setCssUrl($cssUrl, $local=null)
Definition CDNGuiGen.php:68
__construct($version, $theme=NULL, $provider="Google")
Definition CDNGuiGen.php:14
getThemes($provider=NULL)
Definition CDNGuiGen.php:32
setLocalCss($localCss)
Definition CDNGuiGen.php:81