本文整理汇总了PHP中Zend\View\Model\JsonModel::setTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP JsonModel::setTemplate方法的具体用法?PHP JsonModel::setTemplate怎么用?PHP JsonModel::setTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\View\Model\JsonModel
的用法示例。
在下文中一共展示了JsonModel::setTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
public function __invoke($variables = null, $options = null, $template = null)
{
$viewModel = new JsonModel($variables, $options);
if ($template) {
$viewModel->setTemplate($template);
}
return $viewModel;
}
示例2: getjurisdictionproductformAction
public function getjurisdictionproductformAction()
{
//$response = new \Zend\Http\Response();
//$response->getHeaders()->addHeaderLine('Content-Type', 'text/xml; charset=utf-8');
//$response->setContent($xml);
$marketid = (int) $this->params()->fromQuery('marketid', 0);
$marketproductId = (int) $this->params()->fromQuery('marketproductId', 0);
$form = new \Zend\Form\Form();
$marketJurisdictions = $this->getEntityManager()->getRepository('GDI\\Entity\\RMarketJurisdiction')->findByMarket($marketid);
foreach ($marketJurisdictions as $key => $marketJurisdiction) {
$jurisAbbr = $marketJurisdiction->getJurisdiction()->getJurisdictionAbbr();
//$form->setHydrator(new DoctrineHydrator($this->getEntityManager(), 'GDI\Entity\TJurisdictionProduct'));
$jurisdictionProduct = $this->getEntityManager()->getRepository('GDI\\Entity\\TJurisdictionProduct')->findOneBy(array('marketProduct' => $marketproductId, 'jurisdiction' => $marketJurisdiction->getJurisdiction()->getJurisdictionId()));
//var_dump($jurisdictionProduct->getRSubmissionDate());
//exit;
//var_dump($jurisdictionProduct);
//$form->bind($jurisdictionProduct);
$form->setName('jurisdictionProduct');
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eSubmissionDate]", 'options' => array('label' => 'Submission (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getESubmissionDate(), 'class' => 'form-control')));
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eApprovalDate]", 'options' => array('label' => 'Approval (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getEApprovalDate(), 'class' => 'form-control')));
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eReleaseDate]", 'options' => array('label' => 'Master Release (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getEReleaseDate(), 'class' => 'form-control')));
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eLaunchDate]", 'options' => array('label' => 'Launch (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getELaunchDate(), 'class' => 'form-control')));
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][eRegulatorDate]", 'options' => array('label' => 'Regulator (Estimated)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getERegulatorDate(), 'class' => 'form-control')));
// result
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rSubmissionDate]", 'options' => array('label' => 'Submission (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRSubmissionDate(), 'class' => 'form-control')));
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rApprovalDate]", 'options' => array('label' => 'Approval (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRApprovalDate(), 'class' => 'form-control')));
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rReleaseDate]", 'options' => array('label' => 'Master Release (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRReleaseDate(), 'class' => 'form-control')));
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rLaunchDate]", 'options' => array('label' => 'Launch (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRLaunchDate(), 'class' => 'form-control')));
$form->add(array('type' => 'Zend\\Form\\Element\\Date', 'name' => "jurs_prod[{$jurisAbbr}][rRegulatorDate]", 'options' => array('label' => 'Regulator (Result)'), 'attributes' => array('value' => is_null($jurisdictionProduct) ? "" : $jurisdictionProduct->getRRegulatorDate(), 'class' => 'form-control')));
/*if ($key>0) {
var_dump($key);
break;
}*/
}
$request = $this->getRequest();
if ($request->isPost()) {
$form->setData($request->getPost());
if ($form->isValid()) {
//var_dump($product);
}
}
$view = new JsonModel(array('form' => $form, 'marketJurisdictions' => $marketJurisdictions));
//$view->setTemplate('Application/InputProductInformation/jurisdictionproductform.phtml'); // path to phtml file under view folder
$view->setTemplate('GDI/Index2/jurisdictionproductform.phtml');
// path to phtml file under view folder
return $view;
}