Overview

Namespaces

  • None
  • PHP
  • picon

Classes

  • AbstractAjaxBehaviour
  • AbstractAssociatedMarkupSource
  • AbstractBehaviour
  • AbstractCallableOption
  • AbstractChoice
  • AbstractColumn
  • AbstractContextLoader
  • AbstractDatabaseDriver
  • AbstractInjectedDataProvider
  • AbstractJQueryBehaviour
  • AbstractJQueryUIBehaviour
  • AbstractLink
  • AbstractMarkupSource
  • AbstractMultipleChoice
  • AbstractOption
  • AbstractPageClassAuthorisationStrategy
  • AbstractRepeater
  • AbstractSingleChoice
  • AbstractTextComponent
  • AbstractToolbar
  • AbstractValidator
  • AjaxButton
  • AjaxEventBehaviour
  • AjaxFormComponentUpdateBehavior
  • AjaxFormSubmitBehavior
  • AjaxLink
  • AjaxRequestTarget
  • AllowAllAuthorisationStrategy
  • AnnotationRule
  • ApplicationConfigLoadListener
  • ApplicationContext
  • ApplicationContextLoadListener
  • ApplicationInitializer
  • ApplicationInitializerConfigLoadListenerCollection
  • ApplicationInitializerContextLoadListenerCollection
  • ApplicationProfile
  • Args
  • ArrayModel
  • ArrayOption
  • AttributeAppender
  • AttributeModifier
  • AutoContextLoader
  • AutoLoader
  • BasicModel
  • BooleanModel
  • BooleanOption
  • Border
  • BorderMarkupSourcingStratagy
  • BorderResolver
  • Button
  • CacheManager
  • CallbackAjaxCallDecorator
  • CallbackColumn
  • CallbackFunctionOption
  • CallbackOption
  • CallbackRowMapper
  • Check
  • CheckBox
  • CheckBoxGroup
  • CheckChoice
  • ChoiceRenderer
  • ClassNameRule
  • ClassNamespaceRule
  • ClassScanner
  • Comment
  • ComonDomainBase
  • Component
  • ComponentAfterRenderListenerCollection
  • ComponentAuthorisationListener
  • ComponentBeforeRenderListenerCollection
  • ComponentInitializationListenerCollection
  • ComponentInjector
  • ComponentInstantiationListenerCollection
  • ComponentRenderHeadListenerCollection
  • ComponentResolverHelper
  • ComponentTag
  • CompoundPropertyModel
  • Config
  • ConfigLoader
  • ContextLoaderFactory
  • DaoSupport
  • DataBaseTemplate
  • DataGridView
  • DataSource
  • DataSourceConfig
  • DataSourceFactory
  • DataSourceType
  • DataTable
  • DateField
  • DatePickerBehaviour
  • DefaultDataTable
  • DefaultJQueryUIBehaviour
  • DefaultMarkupSource
  • DefaultNotAuthorisedListener
  • DialogBehavior
  • DirectToPageComponentNotAuthorisedListener
  • DraggableBehaviour
  • DropDown
  • EmailAddressValidator
  • EmptyPanel
  • Enum
  • ExceptionPageRequestTarget
  • ExtendResolver
  • FeedbackMessage
  • FeedbackModel
  • FeedbackPanel
  • FileModel
  • FileUploadField
  • Form
  • FormComponent
  • FormComponentLabel
  • FormComponentPanel
  • FunctionOption
  • GridItem
  • GridView
  • HeaderContainer
  • HeaderPartContainer
  • HeaderResolver
  • HeaderResponse
  • HeaderToolbar
  • IdenticalValueValidator
  • Identifier
  • Injector
  • JQueryRenderHeadListener
  • JQueryUIRenderHeadListener
  • Label
  • LabeledMarkupContainer
  • Link
  • ListenerCollection
  • ListenerRequestResolver
  • ListenerRequestTarget
  • ListItem
  • ListMultiple
  • ListView
  • Localizer
  • ManualContextLoader
  • MarkupContainer
  • MarkupElement
  • MarkupLoader
  • MarkupParser
  • MarkupUtils
  • MaximumLengthValidator
  • MaximumValidator
  • MinimumLengthValidator
  • MinimumValidator
  • ModalWindow
  • MySqlDriver
  • MySqliDriver
  • NavigationLink
  • NavigationToolbar
  • Navigator
  • NumbericOption
  • NumericValidator
  • Objects
  • Options
  • PageInstanceRequestResolver
  • PageInstanceRequestTarget
  • PageMap
  • PageMapInitializationListenerCollection
  • PageNotFoundPage
  • PageNotFoundRequestTarget
  • PageRequestResolver
  • PageRequestTarget
  • PageRequestWithListenerTarget
  • PaginatingGridView
  • Panel
  • PanelMarkupSource
  • PanelResolver
  • PasswordField
  • PatternValidator
  • PiconApplication
  • PiconErrorHandler
  • PiconSerializer
  • PiconTag
  • PopupSettings
  • PropertyColumn
  • PropertyModel
  • PropertyOption
  • PropertyResolver
  • Radio
  • RadioChoice
  • RadioGroup
  • RangeLengthValidator
  • RangeValidator
  • RedirectRequestTarget
  • RepeatingView
  • RequestCycle
  • RequestResolverCollection
  • RequiredTextField
  • ResourceReference
  • ResourceRequestResolver
  • ResourceRequestTarget
  • SerializableClosure
  • SortableBehavior
  • StaticTabPanel
  • StringValidator
  • SubClassRule
  • Tab
  • TabCollection
  • TabPanel
  • TextArea
  • TextElement
  • TextField
  • TransparentMarkupContainer
  • ValidatableFormComponentWrapper
  • ValidationResponse
  • WebApplicationSecuritySettings
  • WebComponent
  • WebPage
  • WebRequest
  • WebResponse
  • WrappedCompoundModel
  • XMLDocument
  • XMLParser
  • XMLTag
  • XmlTagType

Interfaces

  • AjaxCallDecorator
  • ApplicationInitializerConfigLoadListener
  • ApplicationInitializerContextLoadListener
  • AuthorisationStrategy
  • Behaviour
  • BehaviourListener
  • CallDecoratorWrapper
  • ChoiceGroup
  • ClassScannerRule
  • Column
  • ComponentAfterRenderListener
  • ComponentAwareModel
  • ComponentBeforeRenderListener
  • ComponentInheritedModel
  • ComponentInitializationListener
  • ComponentInstantiationListener
  • ComponentNotAuthorisedListener
  • ComponentRenderHeadListener
  • ComponentResolver
  • CompoundModel
  • DatabaseDriver
  • DataBaseOperations
  • DataProvider
  • Detachable
  • Equalable
  • FormSubmitListener
  • FormSubmitter
  • Identifiable
  • InitializingBean
  • InjectOnWakeup
  • LinkListener
  • Listener
  • MarkupSource
  • Model
  • Pageable
  • PageMapInitializationListener
  • Request
  • RequestablePage
  • RequestResolver
  • RequestTarget
  • Response
  • RowMapper
  • Validatable
  • Validator
  • XmlElement

Exceptions

  • ConfigException
  • ConversionException
  • RestartRequestOnPageException
  • SQLException
  • UnAuthorisdeException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * Picon Framework
  5:  * http://code.google.com/p/picon-framework/
  6:  *
  7:  * Copyright (C) 2011-2012 Martin Cassidy <martin.cassidy@webquub.com>
  8: 
  9:  * Picon Framework is free software: you can redistribute it and/or modify
 10:  * it under the terms of the GNU General Public License as published by
 11:  * the Free Software Foundation, either version 3 of the License, or
 12:  * (at your option) any later version.
 13: 
 14:  * Picon Framework is distributed in the hope that it will be useful,
 15:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 17:  *  General Public License for more details.
 18: 
 19:  * You should have received a copy of the GNU General Public License
 20:  * along with Picon Framework.  If not, see <http://www.gnu.org/licenses/>.
 21:  * */
 22: 
 23: namespace picon;
 24: require_once("core/ApplicationInitializer.php");
 25: 
 26: require_once("addendum/annotation_parser.php");
 27: require_once("addendum/annotations.php");
 28: require_once("addendum/doc_comment.php");
 29: 
 30: require_once("cache/CacheManager.php");
 31: require_once("cache/PiconSerializer.php");
 32: 
 33: /**
 34:  * This is the main class for the entire application.
 35:  * @author Martin Cassidy
 36:  */
 37: abstract class PiconApplication 
 38: {
 39:     const GLOBAL_APPLICATION_KEY = "picon-application";
 40:     
 41:     private $applicatoinContext;
 42:     private $config;
 43:     private $requestProcessor;
 44:     private $initialiser;
 45:     
 46:     //Application Initializer Listeners
 47:     private $configLoadListeners;
 48:     private $contextLoadListeners;
 49:     private $pageMapInitializationListener;
 50:     
 51:     //Component listeners
 52:     private $componentInstantiationListeners;
 53:     private $componentInitializationListeners;
 54:     private $componentBeforeRenderListeners;
 55:     private $componentAfterRenderListeners;
 56:     private $componentRenderHeadListener;
 57:     
 58:     //Converter
 59:     private $converters = array();
 60:     
 61:     private $securitySettings;
 62:     
 63:     /**
 64:      * Create a new Picon Application
 65:      * Fires off the application initialiser to load an instantiat all resources
 66:      * Despite not being private, like a normal singleton, it is not
 67:      * expected for a Picon Application to be instantiated more than once
 68:      */
 69:     public function __construct()
 70:     {
 71:         if(isset($GLOBALS[self::GLOBAL_APPLICATION_KEY]))
 72:         {
 73:             throw new \IllegalStateException("An instance of picon application already exists");
 74:         }
 75:         $GLOBALS[self::GLOBAL_APPLICATION_KEY] = $this;
 76:         
 77:         $this->initialiser = new ApplicationInitializer();
 78:         $this->initialiser->addScannedDirectory(PICON_DIRECTORY, 'picon');
 79:         $this->initialiser->addScannedDirectory(PICON_DIRECTORY."/annotations");
 80:         $this->initialiser->addScannedDirectory(PICON_DIRECTORY."/web/annotations");
 81:         $this->initialiser->addScannedDirectory(PICON_DIRECTORY."/exceptions");
 82:         $this->initialiser->addScannedDirectory(PICON_DIRECTORY."/web/pages");
 83:         $this->initialiser->addScannedDirectory(ASSETS_DIRECTORY);
 84:         
 85:         $this->internalInit();
 86:         
 87:         $this->initialiser->initialise();
 88:         
 89:         ob_start();
 90:     }
 91:     
 92:     private function internalInit()
 93:     {
 94:         $this->securitySettings = new WebApplicationSecuritySettings();
 95:         
 96:         $this->configLoadListeners = new ApplicationInitializerConfigLoadListenerCollection();
 97:         $this->contextLoadListeners = new ApplicationInitializerContextLoadListenerCollection();
 98:         
 99:         $config = &$this->config;
100:         $context = &$this->applicatoinContext;
101:         
102:         $this->addConfigLoaderListener(new ApplicationConfigLoadListener(function($loadedConfig) use (&$config)  
103:         {
104:             $config = $loadedConfig;
105:         }));
106:         $this->addContextLoaderListener(new ApplicationContextLoadListener(function($createdContext) use (&$context)  
107:         {
108:             $context = $createdContext;
109:             session_start();
110:         }));
111:         
112:         $this->pageMapInitializationListener = new PageMapInitializationListenerCollection();
113:         
114:         $this->componentInstantiationListeners = new ComponentInstantiationListenerCollection();
115:         $this->addComponentInstantiationListener(new ComponentInjector());
116:         $this->addComponentInstantiationListener(new ComponentAuthorisationListener());
117:         
118:         $this->componentInitializationListeners = new ComponentInitializationListenerCollection();
119:         $this->componentBeforeRenderListeners = new ComponentBeforeRenderListenerCollection();
120:         $this->componentAfterRenderListeners = new ComponentAfterRenderListenerCollection();
121:         $this->componentRenderHeadListener = new ComponentRenderHeadListenerCollection();
122:         
123:         $this->init();
124:     }
125:     
126:     /**
127:      * Called once the application has been created but not run the application initializer
128:      * This method creates listener collections.
129:      */
130:     public function init()
131:     {
132: 
133:     }
134:     
135:     public final function run()
136:     {
137:         $this->requestProcessor = new RequestCycle();
138:         $this->requestProcessor->process();
139:     }
140:     
141:     public final function getConfig()
142:     {
143:         return $this->config;
144:     }
145:     
146:     public final function getApplicationContext()
147:     {
148:         return $this->applicatoinContext;
149:     }
150:     
151:     public final function getProfile()
152:     {
153:         return $this->config->getProfile();
154:     }
155:     
156:     public static function get()
157:     {
158:         if(!isset($GLOBALS[self::GLOBAL_APPLICATION_KEY]))
159:         {
160:             throw new \IllegalStateException("Failed to get picon application. The application has not been instantiated.");
161:         }
162:         return $GLOBALS[self::GLOBAL_APPLICATION_KEY];
163:     }
164:     
165:     public function getHomePage()
166:     {
167:         return $this->getConfig()->getHomePage();
168:     }
169:     
170:     public function getConfigLoadListener()
171:     {
172:         return $this->configLoadListeners;
173:     }
174:     
175:     public function getContextLoadListener()
176:     {
177:         return $this->contextLoadListeners;
178:     }
179:     
180:     public function getComponentInstantiationListener()
181:     {
182:         return $this->componentInstantiationListeners;
183:     }
184:     
185:     public function getComponentInitializationListener()
186:     {
187:         return $this->componentInitializationListeners;
188:     }
189:     
190:     public function getComponentBeforeRenderListener()
191:     {
192:         return $this->componentBeforeRenderListeners;
193:     }
194:     
195:     public function getComponentAfterRenderListenersr()
196:     {
197:         return $this->componentAfterRenderListeners;
198:     }
199:     
200:     public function getComponentRenderHeadListener()
201:     {
202:         return $this->componentRenderHeadListener;
203:     }
204:     
205:     public function getPageMapInitializationListener()
206:     {
207:         return $this->pageMapInitializationListener;
208:     }
209:     
210:     public function addConfigLoaderListener(ApplicationInitializerConfigLoadListener $listener)
211:     {
212:         $this->configLoadListeners->add($listener);
213:     }
214:     
215:     public function addContextLoaderListener(ApplicationInitializerContextLoadListener $listener)
216:     {
217:         $this->contextLoadListeners->add($listener);
218:     }
219:     
220:     public function addComponentInstantiationListener(ComponentInstantiationListener $listener)
221:     {
222:         $this->componentInstantiationListeners->add($listener);
223:     }
224:     
225:     public function addComponentInitializationListener(ComponentInitializationListener $listener)
226:     {
227:         $this->componentInitializationListener->add($listener);
228:     }
229:     
230:     public function addComponentBeforeRenderListener(ComponentBeforeRenderListener $listener)
231:     {
232:         $this->componentBeforeRenderListeners->add($listener);
233:     }
234:     
235:     public function addComponentAfterRenderListenersr(ComponentAfterRenderListener $listener)
236:     {
237:         $this->componentAfterRenderListeners->add($listener);
238:     }
239:     
240:     public function addComponentRenderHeadListener(ComponentRenderHeadListener $listener)
241:     {
242:         $this->componentRenderHeadListener->add($listener);
243:     }
244:     
245:     public function addPageMapInitializationListenerCollection(PageMapInitializationListenerCollection $listener)
246:     {
247:         $this->pageMapInitializationListener->add($listener);
248:     }
249:     
250:     public function getConverter($className)
251:     {
252:         if(array_key_exists($className, $this->converters))
253:         {
254:             return $this->converters[$className];
255:         }
256:         return null;
257:     }
258:     
259:     public function __destruct()
260:     {
261:         ob_end_flush();
262:     }
263:     
264:     public function getSecuritySettings()
265:     {
266:         return $this->securitySettings;
267:     }
268: }
269: 
270: ?>
271: 
Picon Framework API documentation generated by ApiGen 2.7.0