Location: PHPKode > projects > DIY Blog > diy-blog/classes/diy-blog/backend/view/userEdit/EditUserView.class.php
<?php

/**
 * User editing view.
 * @package diy-blog.backend.view.userEdit
 * @author	Martynas Jusevicius <hide@address.com>
 * @link	http://www.xml.lt
 */

class EditUserView extends BackEndView
{

	protected $criteria = null;
	
	public function __construct(Resource $resource = null)
	{
		parent::__construct($resource);
		$this->criteria = new Criteria();

		$this->template->load(APP_VIEW_DIR."userEdit/EditUser.xsl");
	}

	public function display(Request $request, Response $response)
	{
		$users = $this->resource->getUsers();
		$user = $users[0];

		$c = new Criteria();
		$c->add(UserPeer::TYPE, UserPeer::CLASSKEY_ADMINUSER);
		$adminCount = UserPeer::doCount($c);

		$this->proc->setParameter("", "admin-count", $adminCount);

		if ($request->getAttribute("user-result") != null)
		{
			$this->proc->setParameter("", "user-result", $request->getAttribute("user-result"));

			$this->resolver->setArgument("user-errors", XMLSerializer::serialize($request->getAttribute("user-errors")));
			$this->resolver->setArgument("user-form", XMLSerializer::serialize($request->getAttribute("user-form")));

			//if ($request->getAttribute("result") == "success") $this->resolver->setArgument("user", XMLSerializer::serialize($request->getAttribute("user")));
		}

		$this->resolver->setArgument("user", XMLSerializer::serialize($user));

		parent::display($request, $response);
		$response->setStatus(Response::SC_OK);
	}

}

?>
Return current item: DIY Blog