add qrcode action, #509

This commit is contained in:
wlx 2013-06-12 04:29:07 +00:00
parent eb001f9ecd
commit 5f28d52bdd
1 changed files with 16 additions and 1 deletions

View File

@ -617,7 +617,8 @@ class ServiceController extends Zend_Controller_Action
@$odf->setVars('resources',$row['resources'],true,'utf-8'); @$odf->setVars('resources',$row['resources'],true,'utf-8');
@$odf->setVars('suppinfo',$row['suppinfo'],true,'utf-8'); @$odf->setVars('suppinfo',$row['suppinfo'],true,'utf-8');
@$odf->setVars('contacts',$row['contacts'],true,'utf-8'); @$odf->setVars('contacts',$row['contacts'],true,'utf-8');
} else {
@$odf->setImage('qrcode', 'http://test.heihedata.org/service/qrcode/uuid/'.$row['uuid']);
} }
$odf->exportAsAttachedFile($row['title'].'.odt'); $odf->exportAsAttachedFile($row['title'].'.odt');
@ -1528,6 +1529,20 @@ class ServiceController extends Zend_Controller_Action
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
return true; return true;
}
function qrcodeAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$uuid = $this->getRequest()->getParam('uuid');
$code_params = array('text' => 'http://westdc.westgis.ac.cn/data/'.$uuid,
'backgroundColor' => '#FFFFFF',
'foreColor' => '#000000',
'padding' => 4, //array(10,5,10,5),
'moduleSize' => 2);
$renderer_params = array('imageType' => 'png');
Zend_Matrixcode::render('qrcode', $code_params, 'image', $renderer_params);
} }
} }