public function actionSettings(){
		$model=$this->loadModel(Yii::app()->user->getId());
		
		// get admin model
		$admin = Admin::model()->findByPk(1);

		list($menuItems,$selectedItems) = AdminChild::getMenuItems(true);
		
		foreach($menuItems as $key=>$value) {
			if(!in_array($key,$selectedItems))
				unset($menuItems[$key]);
		}
		$menuItems = array(''=>Yii::t('app',"What's New")) + $menuItems;
		
		if(isset($_POST['ProfileChild'])) {
			$model->attributes = $_POST['ProfileChild'];
			
			if($model->save()){
				//$this->redirect(array('view','id'=>$model->id));
			}
			$this->refresh();
		}
		$languageDirs = scandir('./protected/messages');	// scan for installed language folders

		$languages = array('en'=>'English');

		foreach ($languageDirs as $code) {		// look for langauges name
				$name = $this->getLanguageName($code,$languageDirs);		// in each item in $languageDirs
				if($name!==false)
						$languages[$code] = $name;	// add to $languages if name is found
		}
		$times=$this->getTimeZones();
		
		$myBackgroundProvider = new CActiveDataProvider('MediaChild',array(
			'criteria'=>array(
				'condition'=>"(associationType = 'bg-private' AND associationId = '".Yii::app()->user->getId()."') OR associationType = 'bg'",
				'order'=>'createDate DESC'
			),
		));
		
		$this->render('settings',array(
			'model'=>$model,
			'languages'=>$languages,
			'times'=>$times,
			'myBackgrounds'=>$myBackgroundProvider,
			'menuItems'=>$menuItems
		));
	}
Exemple #2
0
	public function actionRenameModules() {
		
		$admin=Admin::model()->findByPk(1);

		$menuItems = AdminChild::getMenuItems();
		
		foreach($menuItems as $key => $value)
			$menuItems[$key] = mb_ereg_replace(':',':',$value);	// decode any colons

		if(isset($_POST['module']) && isset($_POST['name'])) {
			$module=$_POST['module'];
			$name=$_POST['name'];

			$menuItems[$module]=$name;
			
			//$orderStr="";
			//$nickStr="";

			foreach($menuItems as $key=>$value) {
				//$orderStr .= $key.":";
				//$nickStr .= $value.":";
				
				$menuItems[$key] = mb_ereg_replace(':',':',$value);	// encode any colons in nicknames
			}
			
			//$orderStr=substr($orderStr,0,-1);
			//$nickStr=substr($nickStr,0,-1);
			
			$admin->menuOrder = implode(':',array_keys($menuItems));
			$admin->menuNicknames = implode(':',array_values($menuItems));
			
			if($admin->save()) {
				$this->redirect('index');
			}
		}
		
		$this->render('renameModules',array(
			'modules'=>$menuItems,
		));
	}
 public function actionToggleUpdater()
 {
     $admin = AdminChild::model()->findByPk(1);
     $admin->ignoreUpdates ? $admin->ignoreUpdates = 0 : ($admin->ignoreUpdates = 1);
     $admin->save();
     $this->redirect('index');
 }