本文整理汇总了PHP中Prado::createComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Prado::createComponent方法的具体用法?PHP Prado::createComponent怎么用?PHP Prado::createComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prado
的用法示例。
在下文中一共展示了Prado::createComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDecorator
/**
* @return TWebControlDecorator
*/
public function getDecorator($create = true)
{
if ($create && !$this->_decorator) {
$this->_decorator = Prado::createComponent('TWebControlDecorator', $this);
}
return $this->_decorator;
}
示例2: insertBrick
function insertBrick($sender, $param)
{
$x = Prado::createComponent("Application.pages.LTemplate");
$x->Size = $sender->NamingContainer->findControl("MySize")->SelectedValue;
$this->placeholder->getControls()->add($x);
$this->Page->CallbackClient->insertContentAfter($this->AjaxInsertPoint, $x);
}
示例3: run
/**
* Runs the service.
* This method is invoked by application automatically.
*/
public function run()
{
$id = $this->getRequest()->getServiceParameter();
if (isset($this->_feeds[$id])) {
$feedConfig = $this->_feeds[$id];
$properties = $feedConfig->getAttributes();
if (($class = $properties->remove('class')) !== null) {
$feed = Prado::createComponent($class);
if ($feed instanceof IFeedContentProvider) {
// init feed properties
foreach ($properties as $name => $value) {
$feed->setSubproperty($name, $value);
}
$feed->init($feedConfig);
$content = $feed->getFeedContent();
//$this->getResponse()->setContentType('application/rss+xml');
$this->getResponse()->setContentType($feed->getContentType());
$this->getResponse()->write($content);
} else {
throw new TConfigurationException('feedservice_feedtype_invalid', $id);
}
} else {
throw new TConfigurationException('feedservice_class_required', $id);
}
} else {
throw new THttpException(404, 'feedservice_feed_unknown', $id);
}
}
示例4: createInstanceOf
/**
* Creates a new instance of a particular class (for PHP primative types,
* their corresponding default value for given type is used).
* @param string PHP type name
* @return mixed default type value, if no type is specified null is returned.
* @throws TSqlMapException if class name is not found.
*/
public function createInstanceOf($type = '')
{
if (strlen($type) > 0) {
switch (strtolower($type)) {
case 'string':
return '';
case 'array':
return array();
case 'float':
case 'double':
case 'decimal':
return 0.0;
case 'integer':
case 'int':
return 0;
case 'bool':
case 'boolean':
return false;
}
if (class_exists('Prado', false)) {
return Prado::createComponent($type);
} else {
if (class_exists($type, false)) {
//NO auto loading
return new $type();
} else {
throw new TSqlMapException('sqlmap_unable_to_find_class', $type);
}
}
}
}
示例5: getThumbnailGenerator
protected function getThumbnailGenerator()
{
if (is_null($this->_thumbnailGen)) {
$this->_thumbnailGen = Prado::createComponent($this->getThumbnailGeneratorClass());
}
return $this->_thumbnailGen;
}
示例6: button2_onclick
function button2_onclick($sender, $param)
{
$this->label1->Text = "Button 1 was clicked ";
$this->label1->Text .= $this->foo->Text;
$x = Prado::createComponent('Application.pages.CustomTemplateComponent');
$this->placeholder->getControls()->add($x);
$this->placeholder->dataBind();
}
示例7: onLoad
function onLoad($param)
{
new TActiveButton();
for ($i = 0; $i < 1500; $i++) {
$ctl = Prado::createComponent("TLabel");
$ctl->Text = "Label " . $i;
$this->Controls[] = $ctl;
}
}
示例8: setImageUrl
/**
* Sets the location of image file of the THyperLink.
* @param string the image file location
*/
public function setImageUrl($value)
{
parent::setImageUrl($value);
if ($this->getActiveControl()->canUpdateClientSide() && $value !== '') {
$textWriter = new TTextWriter();
$renderer = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $textWriter);
$this->createImage($value)->renderControl($renderer);
$this->getPage()->getCallbackClient()->update($this, $textWriter->flush());
}
}
示例9: getStatementAnalyser
/**
* Gets the statement analyser of type given by
* {@link setStatementAnalyserClass StatementAnalyserClass }.
* @return IDbStatementAnalysis statement analyser.
*/
public function getStatementAnalyser()
{
if ($this->_statementAnalyser === null) {
$this->setActive(true);
$this->_statementAnalyser = Prado::createComponent($this->getStatementAnalyserClass());
if ($this->getActive()) {
$this->_statementAnalyser->setDriverName($this->getDriverName());
}
}
return $this->_statementAnalyser;
}
示例10: renderContents
/**
* Renders body content.
* This method overrides the parent implementation by replacing
* the body content with the processed text content.
* @param THtmlWriter writer
*/
public function renderContents($writer)
{
if (($text = $this->getText()) === '' && $this->getHasControls()) {
$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
parent::renderContents($htmlWriter);
$text = $htmlWriter->flush();
}
if ($text !== '') {
$writer->write($this->processText($text));
}
}
示例11: createImage
/**
* Gets the TImage for rendering the ImageUrl property. This is not for
* creating dynamic images.
* @param string image url.
* @return TImage image control for rendering.
*/
protected function createImage($imageUrl)
{
$image = Prado::createComponent('System.Web.UI.WebControls.TImage');
$image->setImageUrl($imageUrl);
if (($toolTip = $this->getToolTip()) !== '') {
$image->setToolTip($toolTip);
}
if (($text = $this->getText()) !== '') {
$image->setAlternateText($text);
}
$image->setBorderWidth('0');
return $image;
}
示例12: getDao
/**
* Returns an implementation of a Dao type, implements the Registery
* pattern. Multiple calls returns the same Dao instance.
* @param string Dao type to find.
* @return object instance of the Dao implementation.
*/
public function getDao($class)
{
if (isset($this->_dao[$class])) {
if (!isset($this->_dao[$class]['instance'])) {
$dao = Prado::createComponent($this->_dao[$class]['class']);
$dao->setSqlMap($this->getClient());
$this->_dao[$class]['instance'] = $dao;
}
return $this->_dao[$class]['instance'];
} else {
throw new TimeTrackerException('daomanager_undefined_dao', $class);
}
}
示例13: setText
/**
* Client-side Text property can only be updated after the OnLoad stage.
* @param string text content for the textbox
*/
public function setText($value)
{
parent::setText($value);
if ($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()) {
$cb = $this->getPage()->getCallbackClient();
$cb->setValue($this, $value);
if ($this->getInputMode() == TDatePickerInputMode::DropDownList) {
$s = Prado::createComponent('System.Util.TDateTimeStamp');
$date = $s->getDate($this->getTimeStampFromText());
$id = $this->getClientID();
$cb->select($id . TControl::CLIENT_ID_SEPARATOR . 'day', 'Value', $date['mday'], 'select');
$cb->select($id . TControl::CLIENT_ID_SEPARATOR . 'month', 'Value', $date['mon'] - 1, 'select');
$cb->select($id . TControl::CLIENT_ID_SEPARATOR . 'year', 'Value', $date['year'], 'select');
}
}
}
示例14: matchCountries
protected function matchCountries($token)
{
$info = Prado::createComponent('System.I18N.core.CultureInfo', 'en');
$list = array();
$count = 0;
$token = strtolower($token);
foreach ($info->getCountries() as $country) {
if (strpos(strtolower($country), $token) === 0) {
$list[] = $country;
$count++;
if ($count > 10) {
break;
}
}
}
return $list;
}
示例15: loadConfig
/**
* Loads configuration from an XML element
* @param TXmlElement configuration node
* @throws TConfigurationException if log route class or type is not specified
*/
private function loadConfig($xml)
{
foreach ($xml->getElementsByTagName('route') as $routeConfig) {
$properties = $routeConfig->getAttributes();
if (($class = $properties->remove('class')) === null) {
throw new TConfigurationException('logrouter_routeclass_required');
}
$route = Prado::createComponent($class);
if (!$route instanceof TLogRoute) {
throw new TConfigurationException('logrouter_routetype_invalid');
}
foreach ($properties as $name => $value) {
$route->setSubproperty($name, $value);
}
$this->_routes[] = $route;
$route->init($routeConfig);
}
}