[EXTENSION] phundament

Hi ametad,

the admin view of P3Pages tries to render a tree from all pages within your app.

Therefore it has to look into the metadata records of your page table.

Looks likes a metadata record can not be found?!

Did you delete a meta-data record manually or did you create a P3Page record directly in the database?

Metadata records should never be missing, because they’re always created afterSave() by a behavior.

If you can spot the P3Pages record which has no metadata, you may try to open it directly via URL an resave it, the metadata should get generated then.

Does this help?

Best regards,

schmunk

Thank you! That realy takes some weight of my shoulders :P

It works!

Something else: what are your plans/approach with the isActive()function in the P3Page model? I realy like to get that working.

Also I am trying to figure out how to get submenu’s in the navbar through P3… Can you tell me more about that too?

Greetings!

Could you try, test and harden something like this … and send me the pull request ;)


public function isActive(){

   return (self::getActivePage()->id == $_GET[self::PAGE_ID_KEY])?true:false;

}

Should be available in $model then.


foreach(...)

   if ($model->isActive) $cssClass = "active"

PS: You’ll find more unported code here: http://code.google.com/p/phundament/source/browse/trunk/modules/p2/models/P2Page.php

I am sorry but I feel my skills are yet not at a level for this kind of development you propose. Perhaps in the future. Keep up the good work! Because a lot of features in P3 a realy like, but it is hard for me to read the code.

So long!

Will try to implement it ASAP …

Sorry, my code above did not work, but it’s here :) give it a try.

Hi Schmunk,

You make progress I see with P3. For my project unfortunately P3 wasn’t suitable enough yet, but I watch your progress…

In my project like you I try to implement the two modules Rights (Crisu83) and User (mishamx). I came across a problem and perhaps this is also good for you to know. And also perhaps you could give me some feedback about how to solve this, because I think you have more experience.

In the User module, actionEdit in ProfileController calls an method called updateSession expecting to be in the WebUser class.

‘user/profile/edit’:


	

public function actionEdit()

	{

		$model = $this->loadUser();

		$profile=$model->profile;

		

		// ajax validator

		if(isset($_POST['ajax']) && $_POST['ajax']==='profile-form')

		{

			echo UActiveForm::validate(array($model,$profile));

			Yii::app()->end();

		}

		

		if(isset($_POST['User']))

		{

			$model->attributes=$_POST['User'];

			$profile->attributes=$_POST['Profile'];

			

			if($model->validate()&&$profile->validate()) {

				$model->save();

				$profile->save();

                 Yii::app()->user->updateSession();

				Yii::app()->user->setFlash('profileMessage',UserModule::t("Changes are saved."));

				$this->redirect(array('/user/profile'));

			} else $profile->validate();

		}


		$this->render('edit',array(

			'model'=>$model,

			'profile'=>$profile,

		));

	}



But you use another User class because of the implementation of Rights. Therefore after an update of a user-profile from within the ProfileController (usually accessible for the logged-in user to update his own profile) there will be an Error:


RWebUser and its behaviors do not have a method or closure named "updateSession".

The updateSession() method in the WebUser class in the User module:


public function updateSession() {

        $user = Yii::app()->getModule('user')->user($this->id);

        $userAttributes = CMap::mergeArray(array(

                                                'email'=>$user->email,

                                                'username'=>$user->username,

                                                'create_at'=>$user->create_at,

                                                'lastvisit_at'=>$user->lastvisit_at,

                                           ),$user->profile->getAttributes());

        foreach ($userAttributes as $attrName=>$attrValue) {

            $this->setState($attrName,$attrValue);

        }

    }

I think this method is not really necessary… So I commented it out in the ProfileController. When you look at this, what do you think is a good solution? Is this method really needed to function?

Hopefully this helps you also in developing P3.

Write to you later!

Thanks ametad!

I’ve never used it yet :)

I even have this problem before:


"./protected/modules/user/views/asset" to be published does not exist.

But that’s an easy fix, I think.

Cya.

PS: yii-user has become pretty active https://github.com/mishamx/yii-user/network, but you’ve your own fork, so you’ll know that.

PS2: May we’d come around this issue with a simple function_exists()?

Still… thank you :) From time to time I drop by and then I don’t write or call ;) But I am a little bit too busy. Too bad, but hopefully you can give me an hint about the following.

About the Bootstrap Carousel Widget: Is it possible to just put the images in the textarea instead of filling out the properties with the JSON editor…

It is pretty hard for a normal user to know the right params and how to set them, but there is this pretty ckeditorfield of yours :D

Greetings!

Hi ametad,

Sorry I am on vacation at the moment writing from my phone.

I can’t try this out, but it should be possible somehow.

Maybe you can ask Chris the developer of yii-bootstrap about this issue.

I think you could try to create the same markup with ckeditor or even better with a template to make it more easy for your users.

Best regards,

Schmunk

You are the best, writing when you’re on vacation! :lol: Have fun and enjoy your free time man.

I will give it some thoughts with the directions you gave. Thanks!

Hi ametad, did you find a solution?

Hey schmunk!

Really enjoying working with Phundament on my current project. Thanks for all you have done with it!

I just tried visiting phundament.com and kept getting redirected to a GitHub 404 page. There was an error message about framing not being permitted. Is anyone else seeing this or is it just me?

-Jason

EDIT (29-08-12): The issue seems to have been resolved. Thanks again schmunk!

Hi jason_c,

thank you for your notice and your kind words - I just added a link in the meantime.

Best regards,

schmunk

I just installed phundamental 3 - it setup great - except when I try and update text in a widget. if get the code.


Fatal error: Cannot re-assign auto-global variable _POST in C:\xampp\htdocs\africamd\protected\extensions\phundament\gii-template-collection\components\Relation.php on line 620

it’s a fresh install, no other errors in setup - what’s wrong?

again, sorry if this is a dumb question.

side note - I’m running php 5.4.4? - which may be more strict about code… possible?

Didn’t tried it with 5.4 yet, sorry.

Although it’s not my code :) But could you try this:

change


		public function handleAjaxRequest($_POST) {

			print_r($_POST);

		}



into


		public function handleAjaxRequest($post) {

			print_r($post);

		}

Makes no sense to me, why the global var $_POST is used in the function.

PS: And send me a pull request if it works ;)

schmunk, worked perfect - thanks so much…

Wrote a tutorial about the very basics … http://www.yiiframework.com/wiki/392/creating-yii-applications-with-composer/