本文整理汇总了PHP中KFactory::identify方法的典型用法代码示例。如果您正苦于以下问题:PHP KFactory::identify方法的具体用法?PHP KFactory::identify怎么用?PHP KFactory::identify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFactory
的用法示例。
在下文中一共展示了KFactory::identify方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setLayout
public function setLayout($layout)
{
$identifier = KFactory::identify('md://admin/com.learn.docs.pages.'.$layout);
$this->_layout = $identifier;
return $this;
}
示例2: setView
/**
* Method to set a view object attached to the template
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIndentifierInterface or valid identifier string
* @throws KDatabaseRowsetException If the identifier is not a table identifier
* @return KTemplateAbstract
*/
public function setView($view)
{
if (!$view instanceof KViewAbstract) {
$identifier = KFactory::identify($view);
if ($identifier->name != 'html') {
throw new KViewException('Identifier: ' . $identifier . ' is not a view identifier');
}
$view = KFactory::get($identifier);
}
$this->_view = $view;
return $this;
}
示例3: setTable
/**
* Method to set a table object attached to the rowset
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIndentifierInterface or valid identifier string
* @throws KDatabaseRowException If the identifier is not a table identifier
* @return KDatabaseRowsetAbstract
*/
public function setTable($table)
{
if (!$table instanceof KDatabaseTableAbstract) {
$identifier = KFactory::identify($table);
if ($identifier->path[0] != 'table') {
throw new KModelException('Identifier: ' . $identifier . ' is not a table identifier');
}
$table = KFactory::get($identifier);
}
$this->_table = $table;
return $this;
}
示例4: loadIdentifier
public function loadIdentifier($template, $data = array(), $process = true)
{
//Identify the template
$identifier = KFactory::identify($template);
// Find the template
$file = KLoader::path($identifier);
if ($file === false) {
throw new KTemplateException('Template "'.$identifier->name.'" not found');
}
// Load the file
$this->loadFile($file, $data, $process);
return $this;
}
示例5: setTemplate
/**
* Method to set a template object attached to the view
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIndentifierInterface or valid identifier string
* @throws KDatabaseRowsetException If the identifier is not a table identifier
* @return KViewAbstract
*/
public function setTemplate($template)
{
if (!$template instanceof KTemplateAbstract) {
$identifier = KFactory::identify($template);
if ($identifier->path[0] != 'template') {
throw new KViewException('Identifier: ' . $identifier . ' is not a template identifier');
}
$this->_template = KFactory::get($identifier);
} else {
$this->_template = $template;
}
return $this;
}
示例6: setController
/**
* Method to set a controller object attached to the dispatcher
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIndentifierInterface or valid identifier string
* @throws KDatabaseRowsetException If the identifier is not a controller identifier
* @return KDispatcherAbstract
*/
public function setController($controller)
{
if (!$controller instanceof KControllerAbstract) {
$identifier = KFactory::identify($controller);
if ($identifier->path[0] != 'controller') {
throw new KDispatcherException('Identifier: ' . $identifier . ' is not a controller identifier');
}
$this->_controller = $identifier;
}
$this->_controller = $controller;
return $this;
}
示例7: getBehavior
/**
* Get a behavior by identifier
*
* @return KControllerBehaviorAbstract
*/
public function getBehavior($behavior, $config = array())
{
if(!($behavior instanceof KIdentifier))
{
//Create the complete identifier if a partial identifier was passed
if(is_string($behavior) && strpos($behavior, '.') === false )
{
$identifier = clone $this->_identifier;
$identifier->path = array('controller', 'behavior');
$identifier->name = $behavior;
}
else $identifier = KFactory::identify($behavior);
}
if(!isset($this->_behaviors[$identifier->name])) {
$behavior = KControllerBehavior::factory($identifier, array_merge($config, array('mixer' => $this)));
} else {
$behavior = $this->_behaviors[$identifier->name];
}
return $behavior;
}
示例8: setModel
/**
* Method to set a model object attached to the view
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIndentifierInterface or valid identifier string
* @throws KViewException If the identifier is not a table identifier
* @return KViewAbstract
*/
public function setModel($model)
{
if (!$model instanceof $model) {
$identifier = KFactory::identify($model);
if ($identifier->path[0] != 'model') {
throw new KViewException('Identifier: ' . $identifier . ' is not a model identifier');
}
$model = KFactory::get($identifier);
}
$this->_model = $model;
return $this;
}
示例9: setModel
/**
* Method to set a model object attached to the controller
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIdentifierInterface or valid identifier string
* @throws KControllerException If the identifier is not a model identifier
* @return object A KModelAbstract object or a KIdentifier object
*/
public function setModel($model)
{
if(!($model instanceof KModelAbstract))
{
if(is_string($model) && strpos($model, '.') === false )
{
// Model names are always plural
if(KInflector::isSingular($model)) {
$model = KInflector::pluralize($model);
}
$identifier = clone $this->_identifier;
$identifier->path = array('model');
$identifier->name = $model;
}
else $identifier = KFactory::identify($model);
if($identifier->path[0] != 'model') {
throw new KControllerException('Identifier: '.$identifier.' is not a model identifier');
}
$model = $identifier;
}
$this->_model = $model;
return $this->_model;
}
示例10: getHelper
/**
* Get a template helper
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIdentifierInterface or valid identifier string
* @param mixed Parameters to be passed to the helper
* @return KTemplateHelperInterface
*/
public function getHelper($helper)
{
//Create the complete identifier if a partial identifier was passed
if(is_string($helper) && strpos($helper, '.') === false )
{
$identifier = clone $this->getIdentifier();
$identifier->path = array('template','helper');
$identifier->name = $helper;
}
else $identifier = KFactory::identify($helper);
//Create the template helper
$helper = KTemplateHelper::factory($identifier, array('template' => $this));
return $helper;
}
示例11: setTemplate
/**
* Method to set a template object attached to the view
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIdentifierInterface or valid identifier string
* @throws KDatabaseRowsetException If the identifier is not a table identifier
* @return KViewAbstract
*/
public function setTemplate($template)
{
if(!($template instanceof KTemplateAbstract))
{
if(is_string($template) && strpos($template, '.') === false )
{
$identifier = clone $this->_identifier;
$identifier->path = array('template');
$identifier->name = $template;
}
else $identifier = KFactory::identify($template);
if($identifier->path[0] != 'template') {
throw new KViewException('Identifier: '.$identifier.' is not a template identifier');
}
$template = $identifier;
}
$this->_template = $template;
return $this;
}
示例12: setMenubar
/**
* Method to set a menubar object attached to the controller
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIdentifierInterface or valid identifier string
* @throws KControllerBehaviorException If the identifier is not a view identifier
* @return KControllerToolbarAbstract
*/
public function setMenubar($menubar)
{
if(!($menubar instanceof KControllerToolbarAbstract))
{
if(is_string($menubar) && strpos($menubar, '.') === false )
{
$identifier = clone $this->_identifier;
$identifier->path = array('controller', 'toolbar');
$identifier->name = $menubar;
}
else $identifier = KFactory::identify($menubar);
if($identifier->path[1] != 'toolbar') {
throw new KControllerBehaviorException('Identifier: '.$identifier.' is not a toolbar identifier');
}
$menubar = $identifier;
}
$this->_menubar = $menubar;
return $this;
}
示例13: setView
/**
* Method to set a view object attached to the controller
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIndentifierInterface or valid identifier string
* @throws KDatabaseRowsetException If the identifier is not a view identifier
* @return KControllerAbstract
*/
public function setView($view)
{
if (!$view instanceof KViewAbstract) {
$identifier = KFactory::identify($view);
if ($identifier->path[0] != 'view') {
throw new KControllerException('Identifier: ' . $identifier . ' is not a view identifier');
}
$this->_view = $view;
}
$this->_view = $view;
return $this;
}
示例14: setTable
/**
* Method to set a table object attached to the model
*
* @param mixed An object that implements KObjectIdentifiable, an object that
* implements KIdentifierInterface or valid identifier string
* @throws KDatabaseRowsetException If the identifier is not a table identifier
* @return KModelTable
*/
public function setTable($table)
{
if(!($table instanceof KDatabaseTableAbstract))
{
if(is_string($table) && strpos($table, '.') === false )
{
$identifier = clone $this->_identifier;
$identifier->path = array('database', 'table');
$identifier->name = KInflector::tableize($table);
}
else $identifier = KFactory::identify($table);
if($identifier->path[1] != 'table') {
throw new KDatabaseRowsetException('Identifier: '.$identifier.' is not a table identifier');
}
$table = $identifier;
}
$this->_table = $table;
return $this;
}
示例15: setSelector
public function setSelector($selector)
{
if (!($this->_selector instanceof ComLearnDatabaseTableSelectorDefault))
{
if(is_string($selector) && strpos($selector, '.') === false )
{
$identifier = clone $this->_identifier;
$identifier->path = array('database', 'table', 'selector');
$identifier->name = $selector;
}
else $identifier = KFactory::identify($selector);
if($identifier->path[2] != 'selector') {
throw new KDatabaseRowsetException('Identifier: '.$identifier.' is not a selector identifier');
}
$selector = $identifier;
}
$this->_selector = $selector;
return $this;
}