Package org.nbphpcouncil.modules.php.yii

Examples of org.nbphpcouncil.modules.php.yii.YiiModule


        String[] paths = splitAliasPath(aliasPath);
        if (paths == null || paths.length < 1) {
            return null;
        }

        YiiModule yiiModule = YiiModuleFactory.create(phpModule);
        FileObject baseDirectory = null;
        StringBuilder sb = new StringBuilder();
        for (String path : paths) {
            // first time
            if (baseDirectory == null) {
                baseDirectory = yiiModule.getDirectory(toPathAlias(path));
                if (baseDirectory == null) {
                    return null;
                }
                continue;
            }
View Full Code Here


     * @return true if item list is not empty, otherwise false.
     */
    private List<GoToItem> createGoToTItems(PhpModule phpModule, TokenSequence<PHPTokenId> ts, int offset) {
        List<GoToItem> items = new ArrayList<GoToItem>();

        YiiModule yiiModule = YiiModuleFactory.create(phpModule);
        FileObject application = yiiModule.getApplication();
        if (application == null || paramCount > 2) {
            return items;
        }

        // move to offset of message for second parameter
        String message = ""; // NOI18N
        if (paramCount == 2) {
            String tFirstParam = getTFirstParam(ts, offset);
            if (tFirstParam == null) {
                return items;
            }
            message = target;
            target = tFirstParam;
        }

        // get messages directory
        FileObject messagesDirectory = null;
        String messagesDirectoryName = DEFAULT_MESSAGES_DIR_NAME;

        // check whether text contains class name
        String className = ""; // NOI18N
        if (target.contains(".")) { // NOI18N
            int dotIndex = target.indexOf("."); // NOI18N
            className = target.substring(0, dotIndex);
            String categoryName = target.substring(dotIndex + 1);
            target = categoryName;
            FileObject classFile = getClassFileObject(phpModule, className);
            if (classFile != null) {
                FileObject parent = classFile.getParent();
                if (parent != null && parent.isFolder()) {
                    messagesDirectory = parent.getFileObject(messagesDirectoryName);
                }
            }
        }

        if (className.isEmpty() && messagesDirectory == null) {
            messagesDirectory = yiiModule.getMessages();
        }
        if (messagesDirectory == null) {
            return items;
        }

View Full Code Here

                return currentModuleDirectory.getFileObject("views"); // NOI18N
            }
        }

        // check theme
        YiiModule yiiModule = YiiModuleFactory.create(phpModule);
        String themeName = yiiModule.getThemeName();
        if (!StringUtils.isEmpty(themeName)) {
            FileObject themesDirectory = YiiUtils.getThemesDirectory(phpModule);
            if (themesDirectory != null) {
                viewsDirectory = themesDirectory.getFileObject(themeName + "/views"); // NOI18N
            }
View Full Code Here

            String subPath = ""; // NOI18N
            String filter = ""; // NOI18N
            String subPathForFind = ""; // NOI18N

            // get base directory for path alias
            YiiModule yiiModule = YiiModuleFactory.create(phpModule);
            FileObject baseDirectory = yiiModule.getDirectory(pathAlias);

            if (baseDirectory != null) {
                int lastDot = target.lastIndexOf(DOT);
                if (firstDot == lastDot) {
                    filter = target.substring(firstDot + 1);
View Full Code Here

     * http://www.yiiframework.com/doc/api/1.1/CController#resolveViewFile-detail
     * @return file if file exists, otherwise null.
     */
    public static FileObject getAbsoluteViewFile(String targetPath, FileObject currentFile) {
        PhpModule phpModule = PhpModule.Factory.forFileObject(currentFile);
        YiiModule yiiModule = YiiModuleFactory.create(phpModule);
        // get absolute view within the application
        if (targetPath.startsWith(APP_PATH_PREFIX)) { // NOI18N
            targetPath = targetPath.replaceFirst(MODULE_PATH_PREFIX, ""); // NOI18N
            targetPath = String.format(VIEW_PATH_FORMAT, targetPath);
            return yiiModule.getFileObject(YiiModule.PATH_ALIAS.APPLICATION, targetPath);
        }

        // get absolute view within a module
        if (targetPath.startsWith(MODULE_PATH_PREFIX)) { // NOI18N
            FileObject currentModuleDirectory = YiiUtils.getCurrentModuleDirectory(currentFile);
            targetPath = String.format(VIEW_PATH_FORMAT, targetPath);
            FileObject targetFile;
            if (currentModuleDirectory != null) {
                targetFile = currentModuleDirectory.getFileObject(targetPath);
            } else {
                targetFile = yiiModule.getFileObject(YiiModule.PATH_ALIAS.APPLICATION, targetPath);
            }
            return targetFile;
        }
        return null;
    }
View Full Code Here

     * @param currentFile
     * @return file if file was created, otherwise null.
     */
    public static FileObject createAbsoluteViewFile(String targetPath, FileObject currentFile) {
        PhpModule phpModule = PhpModule.Factory.forFileObject(currentFile);
        YiiModule yiiModule = YiiModuleFactory.create(phpModule);
        FileObject application = yiiModule.getApplication();
        // get absolute view within the application
        if (targetPath.startsWith(APP_PATH_PREFIX)) { // NOI18N
            targetPath = targetPath.replaceFirst(MODULE_PATH_PREFIX, ""); // NOI18N
            targetPath = String.format(VIEW_PATH_FORMAT, targetPath);
            if (application == null) {
View Full Code Here

        // return null if use external files #11
        if (phpModule == null) {
            return null;
        }
        String path = fo.getPath();
        YiiModule yiiModule = YiiModuleFactory.create(phpModule);
        FileObject webroot = yiiModule.getWebroot();
        String webrootPath = webroot.getPath();
        return path.replace(webrootPath, ""); // NOI18N
    }
View Full Code Here

            String nestedPathDepth = toSubpathDepth(nestedPath);
            String format = String.format(CONTROLLER_RELATIVE_PATH_FORMAT, nestedPathDepth, "", nestedPath, controllerName);
            controller = view.getFileObject(format);
        } else {
            PhpModule phpModule = PhpModule.Factory.forFileObject(view);
            YiiModule yiiModule = YiiModuleFactory.create(phpModule);
            if (yiiModule != null) {
                FileObject controllersDirectory = yiiModule.getControllers();
                if (controllersDirectory == null) {
                    return null;
                }

                // nested directory
View Full Code Here

     *
     * @param phpModule
     * @return
     */
    public static FileObject getViewsDirectory(PhpModule phpModule) {
        YiiModule yiiModule = YiiModuleFactory.create(phpModule);
        if (yiiModule != null) {
            return yiiModule.getViews();
        }
        return null;
    }
View Full Code Here

     *
     * @param phpModule
     * @return
     */
    public static FileObject getControllersDirectory(PhpModule phpModule) {
        YiiModule yiiModule = YiiModuleFactory.create(phpModule);
        if (yiiModule != null) {
            return yiiModule.getControllers();
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.nbphpcouncil.modules.php.yii.YiiModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.