public function setThemes()
	{
		$installedTheme	= $this->getThemesFromDir();
		$cacheTheme		= file(Yii::getPathOfAlias('application.config').'/cache_theme.php');
		$toBeInstalled	= array();
		
		$caches = array();
		foreach($cacheTheme as $val) {
			$caches[] = $val;
		}

		if(!$installedTheme)
			$installedTheme = array();
		
		foreach($caches as $cache) {
			$cache = trim($cache);
			if(!in_array($cache, array_map("trim", $installedTheme))) {
				$this->deleteTheme($cache, true);
			}
		}

		$themeDb = $this->cacheThemeConfig(true);
		foreach($installedTheme as $theme) {
			if(!in_array(trim($theme), array_map("trim", $themeDb))) {
				$config = $this->getThemeConfig($theme);
				$themeName = $this->urlTitle($theme);

				if($config && $themeName == $config['folder']) {
					$model=new OmmuThemes;
					$model->group_page = $config['group_page'];
					$model->folder = $theme;
					$model->layout = $config['layout'];
					$model->name = $config['name'];
					$model->thumbnail = $config['thumbnail'];
					$model->save();
				}
			}
		}
	}
public function setThemes()
	{
		$installedTheme	= $this->getThemesFromDir();
		$cacheTheme		= file(Yii::getPathOfAlias('application.config').'/cache_theme.php');
		$toBeInstalled	= array();
		
		$caches = array();
		foreach($cacheTheme as $val) {
			$caches[] = $val;
		}

		if(!$installedTheme)
			$installedTheme = array();
		
		foreach($caches as $cache) {
			$cache = trim($cache);
			if(!in_array($cache, array_map("trim", $installedTheme))) {
				$this->deleteTheme($cache, true);
			}
		}

		$themeDb = $this->cacheThemeConfig(true);
		foreach($installedTheme as $theme) {
			if(!in_array(trim($theme), array_map("trim", $themeDb))) {
				$config = $this->getThemeConfig($theme);
				$themeName = $this->urlTitle($theme);

				if($config && $themeName == $config['folder']) {
					$model=new OmmuThemes;
					$model->group_page = $config['group_page'];
					$model->folder = $theme;
					$model->layout = $config['layout'];
					$model->name = $config['name'];
					$model->thumbnail = $config['thumbnail'];
					$model->save();
				}
			}
		}
	}
public function setThemes ( ) { $ installedTheme = $ this -> getThemesFromDir ( ) ; $ cacheTheme = file ( Yii :: getPathOfAlias ( 'application.config' ) . '/cache_theme.php' ) ; $ toBeInstalled = array ( ) ; $ caches = array ( ) ; foreach ( $ cacheTheme as $ val ) { $ caches [ ] = $ val ; } if ( ! $ installedTheme ) $ installedTheme = array ( ) ; foreach ( $ caches as $ cache ) { $ cache = trim ( $ cache ) ; if ( ! in_array ( $ cache , array_map ( "trim" , $ installedTheme ) ) ) { $ this -> deleteTheme ( $ cache , true ) ; } } $ themeDb = $ this -> cacheThemeConfig ( true ) ; foreach ( $ installedTheme as $ theme ) { if ( ! in_array ( trim ( $ theme ) , array_map ( "trim" , $ themeDb ) ) ) { $ config = $ this -> getThemeConfig ( $ theme ) ; $ themeName = $ this -> urlTitle ( $ theme ) ; if ( $ config && $ themeName == $ config [ 'folder' ] ) { $ model = new OmmuThemes ; $ model -> group_page = $ config [ 'group_page' ] ; $ model -> folder = $ theme ; $ model -> layout = $ config [ 'layout' ] ; $ model -> name = $ config [ 'name' ] ; $ model -> thumbnail = $ config [ 'thumbnail' ] ; $ model -> save ( ) ; } } } }
Install theme ke database
Install theme ke database