public function setLayout($layout) { $identifier = KFactory::identify('md://admin/com.learn.docs.pages.'.$layout); $this->_layout = $identifier; return $this; }
/** * 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; }
/** * 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; }
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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
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; }
/** * Method to set a controller object attached to the dispatcher * * @param mixed An object that implements KObjectIdentifiable, an object that * implements KIdentifierInterface or valid identifier string * @throws KDispatcherException If the identifier is not a controller identifier * @return KDispatcherAbstract */ public function setController($controller) { if(!($controller instanceof KControllerAbstract)) { if(is_string($controller) && strpos($controller, '.') === false ) { // Controller names are always singular if(KInflector::isPlural($controller)) { $controller = KInflector::singularize($controller); } $identifier = clone $this->_identifier; $identifier->path = array('controller'); $identifier->name = $controller; } else $identifier = KFactory::identify($controller); if($identifier->path[0] != 'controller') { throw new KDispatcherException('Identifier: '.$identifier.' is not a controller identifier'); } $controller = $identifier; } $this->_controller = $controller; return $this; }