本文整理汇总了PHP中source\LuLu类的典型用法代码示例。如果您正苦于以下问题:PHP LuLu类的具体用法?PHP LuLu怎么用?PHP LuLu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LuLu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initService
public function initService()
{
$this->modularityService = LuLu::getService('modularity');
$this->rbacService = LuLu::getService('rbac');
$this->taxonomyService = LuLu::getService('taxonomy');
$this->menuService = LuLu::getService('menu');
}
示例2: setTheme
public function setTheme()
{
$currentTheme = LuLu::getAppParam('adminTheme');
$moduleId = LuLu::$app->controller->module->id;
$config = ['pathMap' => ['@app/views' => ['@static/admin/' . $currentTheme . '/views'], '@source/modules/' . $moduleId . '/admin/views' => ['@static/admin/' . $currentTheme . '/modules/' . $moduleId]], 'baseUrl' => '@static/admin/' . $currentTheme];
$this->theme = new Theme($config);
}
示例3: loadActiveModules
public function loadActiveModules($isAdmin)
{
$moduleManager = LuLu::getService('modularityService');
$this->activeModules = $moduleManager->getActiveModules($isAdmin);
$module = $isAdmin ? 'AdminModule' : 'HomeModule';
foreach ($this->activeModules as $m)
{
$moduleId = $m['id'];
$moduleDir = $m['dir'];
$ModuleClassName = $m['dir_class'];
$this->setModule($moduleId, [
'class' => 'source\modules\\' . $moduleDir . '\\' . $module
]);
$serviceFile= LuLu::getAlias('@source').'\modules\\' .$moduleDir.'\\'.$ModuleClassName.'Service.php';
if(FileHelper::exist($serviceFile))
{
$serviceClass = 'source\modules\\' .$moduleDir.'\\'.$ModuleClassName.'Service.php';
$serviceInstance = new $serviceClass();
$this->set($serviceInstance->getServiceId(), $serviceInstance);
}
}
}
示例4: init
public function init()
{
parent::init();
$this->modularityService = LuLu::getService('modularity');
$this->rbacService = LuLu::getService('rbac');
$this->taxonomyService = LuLu::getService('taxonomy');
}
示例5: beforeAction
public function beforeAction($action)
{
if (!parent::beforeAction($action)) {
return false;
}
//检查不需要登录的action uniqueID,如 site/login, site/captcha
if (in_array($action->uniqueID, $this->ignoreLogin())) {
return parent::beforeAction($action);
}
if (\Yii::$app->user->isGuest) {
LuLu::go(['/site/login']);
}
if (!$this->rbacService->checkPermission('manager_admin')) {
return $this->showMessage();
}
//return parent::beforeAction($action);
if (in_array($action->uniqueID, $this->ingorePermission())) {
return parent::beforeAction($action);
}
if (!$this->rbacService->checkPermission()) {
return $this->showMessage();
} else {
return parent::beforeAction($action);
}
}
示例6: handleRequest
public function handleRequest($request)
{
if (empty($this->catchAll)) {
list($route, $params) = $request->resolve();
} else {
$route = $this->catchAll[0];
$params = array_splice($this->catchAll, 1);
}
try {
LuLu::trace("Route requested: '{$route}'", __METHOD__);
$this->requestedRoute = $route;
$actionsResult = $this->runAction($route, $params);
$result = $actionsResult instanceof ActionResult ? $actionsResult->result : $actionsResult;
if ($result instanceof \yii\web\Response) {
return $result;
} else {
$response = $this->getResponse();
if ($result !== null) {
$response->data = $result;
}
return $response;
}
} catch (InvalidRouteException $e) {
throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'), $e->getCode(), $e);
}
}
示例7: actionIndex
public function actionIndex()
{
$query = Content::leftJoinWith('takonomy');
$locals = LuLu::getPagedRows($query, ['orderBy' => 'created_at desc', 'pageSize' => 6]);
$dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 5]]);
$locals['dataProvider'] = $dataProvider;
return $this->render('index', $locals);
}
示例8: actionIndex
/**
* Lists all Permission models.
* @return mixed
*/
public function actionIndex()
{
$categoryId = LuLu::getGetValue('category_id');
//$searchModel = new PermissionSearch();
$query = Permission::find();
$query->andFilterWhere(['category_id' => $categoryId]);
$dataProvider = $dataProvider = $this->getDataProvider($query);
return $this->render('index', ['dataProvider' => $dataProvider]);
}
示例9: getPagedContents
/**
*
* @param string $where
* @param string $orderBy
* @param number $pageSize
* @param array $options
* --recommend
* --headline
* --sticky
* --flag
* --is_pic
* --content_type
* --page
* --taxonomy:array or number
*
* @return array:['rows','pager']
*/
public static function getPagedContents($where = null, $orderBy = null, $pageSize = 10, $options = [])
{
$query = self::buildContentQuery($where, $options);
$query->joinWith('taxonomy', true, 'LEFT JOIN');
$page = isset($options['page']) ? $options['page'] : null;
$orderBy = empty($orderBy) ? 'created_at desc' : $orderBy;
$locals = LuLu::getPagedRows($query, ['page' => $page, 'pageSize' => $pageSize, 'orderBy' => $orderBy]);
return $locals;
}
示例10: exist
public static function exist($path)
{
if (is_array($path))
{
$path = self::buildPath($path);
}
LuLu::info($path);
return file_exists($path);
}
示例11: __get
public function __get($name)
{
$dot = strpos($name, 'Service');
if ($dot > 0) {
$serviceName = substr($name, 0, $dot);
return LuLu::getService($serviceName);
}
return parent::__get($name);
}
示例12: clearCachedData
public static function clearCachedData($id)
{
$fragment = self::findOne(['id' => $id]);
if ($fragment === null) {
return;
}
$cacheKey = self::CachePrefix . $fragment->code;
LuLu::deleteCache($cacheKey);
}
示例13: loadAllModules
private function loadAllModules()
{
if ($this->allModules !== null) {
return $this->allModules;
}
$this->allModules = [];
$moduleRootPath = LuLu::getAlias('@source') . '/modules';
if ($moduleRootDir = @dir($moduleRootPath)) {
while (($moduleFolder = $moduleRootDir->read()) !== false) {
$modulePath = $moduleRootPath . '/' . $moduleFolder;
if (preg_match('|^\\.+$|', $moduleFolder) || !is_dir($modulePath)) {
continue;
}
if ($moduleDir = @dir($modulePath)) {
$moduleClassName = ucwords($moduleFolder);
$class = null;
$instance = null;
$has_admin = false;
$has_home = false;
while (($item = $moduleDir->read()) !== false) {
$itemPath = $moduleRootPath . '/' . $moduleFolder . '/' . $item;
if (preg_match('|^\\.+$|', $item) || is_dir($itemPath)) {
continue;
}
if ($item === $moduleClassName . 'Info.php') {
$class = 'source\\modules\\' . $moduleFolder . '\\' . $moduleClassName . 'Info';
}
if ($item === 'AdminModule.php') {
$has_admin = true;
}
if ($item === 'HomeModule.php') {
$has_home = true;
}
}
if ($class !== null) {
try {
// $moduleObj = LuLu::createObject($class);
$instance = new $class();
if (empty($instance->id)) {
$instance->id = $moduleFolder;
}
if (empty($instance->name)) {
$instance->name = $moduleFolder;
}
} catch (Exception $e) {
// $instance=$e;
}
}
if ($instance !== null) {
$this->allModules[$instance->id] = ['id' => $instance->id, 'dir' => $moduleFolder, 'dir_class' => $moduleClassName, 'class' => $class, 'instance' => $instance, 'can_install' => true, 'can_uninstall' => true, 'has_admin' => $has_admin, 'has_home' => $has_home, 'can_active_admin' => false, 'can_active_home' => false];
}
}
}
}
return $this->allModules;
}
示例14: actionIndex
public function actionIndex()
{
$query = Content::leftJoinWith('takonomy');
$locals = LuLu::getPagedRows($query, [
'orderBy' => 'created_at desc',
'pageSize' => 6
]);
return $this->render('index', $locals);
}
示例15: actionDetail
/**
* 内容页
* @param unknown $id
* @return \yii\base\string
*/
public function actionDetail($id)
{
Content::updateAllCounters(['view_count' => 1], ['id' => $id]);
$locals = $this->getDetail($id);
$taxonomyModel = $this->taxonomyService->getTaxonomyById($locals['model']['taxonomy_id']);
LuLu::setViewParam(['taxonomyModel' => $taxonomyModel]);
$locals['taxonomyModel'] = $taxonomyModel;
$vars = $this->getDetailVars($locals['taxonomyModel'], $locals['model']);
$this->layout = $vars['layout'];
return $this->render($vars['view'], $locals);
}