Partner.class.php 1.14 KB
<?php
class Controller_Admin_Partner extends Controller_Admin_Base
{
	public function indexAction()
	{
		$this->_view['key'] = Lib_Images::genKey('fragmentimg');
		$this->_view['partners'] = Facade_Partner::getPartner();
		$this->_view['types'] = Facade_Partner::$types;
	}
	
	public function setpartnerAction()
	{
		$id = $this->_request->query('id', '');
		$name = $this->_request->query('name', '');
		$pic = $this->_request->query('pic', '');
		$type = $this->_request->query('type', 0);
		$description = $this->_request->query('description', '');
		$url = $this->_request->query('url', '');
		if(empty($id))
		{
			$status = Facade_Partner::setPartner($type, $name, $pic, $url, $description);
		}
		else
		{
			$status = Facade_Partner::setPartnerById($id, $type, $name, $pic, $url, $description);
		}
		if($status)
		{
			return $this->returnJson(true, 200);
		}
		else
		{
			return $this->returnJson(false, 403);
		}
		
	}
	
	public function delAction()
	{
		$id = $this->_request->query('id');
		$status = Facade_Partner::delPartner($id);
		if($status)
		{
			return $this->returnJson(true, 200);
		}
		else
		{
			return $this->returnJson(false, 403);
		}
	}
}