本文整理汇总了PHP中Phprojekt_Loader::tryToLoadLibClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Phprojekt_Loader::tryToLoadLibClass方法的具体用法?PHP Phprojekt_Loader::tryToLoadLibClass怎么用?PHP Phprojekt_Loader::tryToLoadLibClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phprojekt_Loader
的用法示例。
在下文中一共展示了Phprojekt_Loader::tryToLoadLibClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModelObject
/**
* Gets the core class model of the module.
*
* @return Phprojekt_Model_Interface An instance of Phprojekt_Model_Interface.
*/
public function getModelObject()
{
static $moduleName = null;
if (is_null($moduleName)) {
$moduleName = ucfirst($this->getRequest()->getControllerName());
$moduleName = "Phprojekt_" . $moduleName . "_" . $moduleName;
}
if (Phprojekt_Loader::tryToLoadLibClass($moduleName)) {
$db = Phprojekt::getInstance()->getDb();
return new $moduleName($db);
} else {
throw new Exception('No model object could be found');
}
}
示例2: getModelObject
/**
* Gets the core class model of the module or the default one.
*
* @return Phprojekt_Model_Interface An instance of Phprojekt_Model_Interface.
*/
public function getModelObject()
{
static $object = null;
if (null === $object) {
$moduleName = ucfirst($this->getRequest()->getControllerName());
$moduleName = "Phprojekt_" . $moduleName . "_" . $moduleName;
if (Phprojekt_Loader::tryToLoadLibClass($moduleName)) {
$db = Phprojekt::getInstance()->getDb();
$object = new $moduleName($db);
} else {
$object = null;
}
if (null === $object) {
$object = Phprojekt_Loader::getModel('Default', 'Default');
}
}
return $object;
}
示例3: _saveUser
/**
* This function is used only for integration purposes and should only
* be called when integrating the user data!
*
**/
private static function _saveUser($params)
{
$moduleName = "Phprojekt_User_User";
if (Phprojekt_Loader::tryToLoadLibClass($moduleName)) {
// Temporarily login as admin user
// This is only to get rights to add user
// Ugly hack but PHProjekt backend has not thought of this situation
$authNamespace = new Zend_Session_Namespace('Phprojekt_Auth-login');
$authNamespace->userId = 1;
$authNamespace->admin = true;
$exc = null;
try {
$db = Phprojekt::getInstance()->getDb();
$model = new $moduleName($db);
if ($params['id'] > 0) {
$model = $model->find($params['id']);
}
Default_Helpers_Save::save($model, $params);
$setting = new Phprojekt_Setting();
$setting->setModule('User');
$setting->setSettings($params, $model->id);
} catch (Exception $e) {
$exc = $e;
}
// Set user not logged in
unset($authNamespace->userId);
unset($authNamespace->admin);
if ($exc instanceof Exception) {
// Throw exception if user creation failed
throw $exc;
}
return true;
}
return false;
}