本文整理匯總了PHP中UserAction::prepareData方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserAction::prepareData方法的具體用法?PHP UserAction::prepareData怎麽用?PHP UserAction::prepareData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserAction
的用法示例。
在下文中一共展示了UserAction::prepareData方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepareData
protected function prepareData()
{
parent::prepareData();
$em = $this->em();
$attachmentOwnerType = $em->getRepository('\\ru\\nazarov\\crm\\entities\\AttachmentType')->findOneBy(array('code' => 'application'));
$attachments = array();
foreach ($em->getRepository('\\ru\\nazarov\\crm\\entities\\Attachment')->findBy(array('type' => $attachmentOwnerType)) as $attachment) {
$ownerId = $attachment->getOwner();
if (!array_key_exists($ownerId, $attachments)) {
$attachments[$ownerId] = array();
}
$attachments[$ownerId][] = $attachment;
}
$orgs = $em->getRepository('\\ru\\nazarov\\crm\\entities\\Organization')->findBy(array(), array('typeId' => 'ASC', 'name' => 'ASC'));
$orgId = $this->request()->get('org');
foreach ($orgs as $org) {
if ($org->getId() == $orgId) {
break;
}
}
if (isset($org) && $org->getId() != $orgId) {
$org = null;
}
$repo = $em->getRepository('\\ru\\nazarov\\crm\\entities\\Application');
$this->view()->set('content', 'apps_list.tpl')->set('apps', isset($org) ? $repo->findBy(array($org->getType()->getCode() => $org->getId()), array('id' => 'DESC')) : $repo->findBy(array(), array('id' => 'DESC')))->set('attachments', $attachments)->set('orgId', isset($org) ? $org->getId() : null)->set('orgs', $orgs);
}
示例2: prepareData
protected function prepareData()
{
parent::prepareData();
$em = $this->em();
$attachmentOwnerType = $em->getRepository('\\ru\\nazarov\\crm\\entities\\AttachmentType')->findOneBy(array('code' => 'offer'));
$attachments = array();
foreach ($em->getRepository('\\ru\\nazarov\\crm\\entities\\Attachment')->findBy(array('type' => $attachmentOwnerType)) as $attachment) {
$ownerId = $attachment->getOwner();
if (!array_key_exists($ownerId, $attachments)) {
$attachments[$ownerId] = array();
}
$attachments[$ownerId][] = $attachment;
}
$type = $this->request()->get('type');
$types = $em->getRepository('\\ru\\nazarov\\crm\\entities\\OrganizationType')->findAll();
$correctType = false;
foreach ($types as $orgType) {
if ($orgType->getId() == $type) {
$correctType = true;
break;
}
}
$em = $this->em();
if ($correctType) {
$offersQuery = $em->createQuery('SELECT off FROM \\ru\\nazarov\\crm\\entities\\Offer off JOIN off.org org WHERE org.type=:type ORDER BY off.offerId desc');
$offersQuery->setParameters(array('type' => $type));
$offers = $offersQuery->getResult();
} else {
$offers = $em->getRepository('\\ru\\nazarov\\crm\\entities\\Offer')->findBy(array(), array('offerId' => 'DESC'));
}
$this->view()->set('content', 'offers_list.tpl')->set('attachments', $attachments)->set('offers', $offers)->set('types', $types)->set('filter', $type);
}
示例3: prepareData
protected function prepareData()
{
parent::prepareData();
$this->view()->set('content', 'person_form.tpl')->set('types', array_map(function ($ct) {
return (object) array('val' => $ct->getId(), 'lbl' => $ct->getCode());
}, $this->em()->getRepository('\\ru\\nazarov\\crm\\entities\\ContactType')->findAll()));
}
示例4: prepareData
protected function prepareData()
{
parent::prepareData();
$em = $this->em();
$selectsDp = \ru\nazarov\sitebase\Facade::getReportSelectsDps();
$this->view()->set('content', 'report_form.tpl')->set('orgs', $selectsDp->orgs)->set('persons', $selectsDp->persons)->set('contacts', $selectsDp->contacts)->set('apps', $selectsDp->apps)->set('supplierTypeId', $em->getRepository('\\ru\\nazarov\\crm\\entities\\OrganizationType')->findOneBy(array('code' => 'supplier'))->getId())->set('clientTypeId', $em->getRepository('\\ru\\nazarov\\crm\\entities\\OrganizationType')->findOneBy(array('code' => 'client'))->getId());
//->set('apps', array_map(function ($app) { return (object) array('id' => $app->getId()); 'client' => }, ));
}
示例5: prepareData
protected function prepareData()
{
parent::prepareData();
if ($this->_form == null) {
$this->_form = $this->prepareForm(new $this->_formCls($this->_formId, $this->_formName, $this->_formAct . "&id=" . $this->_item->getId(), $this->_formMethod, $this->_formEnctype, 'save'));
$this->setFormFields();
}
$this->fillSelects();
$this->view()->set('content', $this->_tpl)->set('form', $this->_form);
}
示例6: prepareData
protected function prepareData()
{
parent::prepareData();
$em = $this->em();
$orgId = $this->request()->get('org');
$orgs = $em->getRepository('\\ru\\nazarov\\crm\\entities\\Organization')->findBy(array(), array('typeId' => 'ASC', 'name' => 'ASC'));
$orgIdCorrect = false;
foreach ($orgs as $org) {
if ($org->getId() == $orgId) {
$orgIdCorrect = true;
break;
}
}
$repo = $em->getRepository('\\ru\\nazarov\\crm\\entities\\Person');
$this->view()->set('content', 'persons_list.tpl')->set('orgId', $orgId)->set('orgs', $orgs)->set('persons', $orgIdCorrect ? $repo->findBy(array('organization' => $orgId)) : $repo->findAll());
}
示例7: prepareData
protected function prepareData()
{
parent::prepareData();
$em = $this->em();
$type = $this->request()->get('type');
$types = $em->getRepository('\\ru\\nazarov\\crm\\entities\\OrganizationType')->findAll();
$correctType = false;
foreach ($types as $orgType) {
if ($orgType->getId() == $type) {
$correctType = true;
break;
}
}
$repo = $em->getRepository('\\ru\\nazarov\\crm\\entities\\Organization');
$this->view()->set('content', 'orgs_list.tpl')->set('orgs', $correctType ? $repo->findBy(array('type' => $type), array('name' => 'ASC')) : $repo->findBy(array(), array('name' => 'ASC')))->set('types', $types)->set('filter', $type);
}
示例8: prepareData
protected function prepareData()
{
parent::prepareData();
$em = $this->em();
$storeItem = new \ru\nazarov\crm\entities\StoreItem();
$storeItem->setCode('code' . rand(0, 100));
$storeItem->setDescription(md5(rand(0, 1000)));
$storeItem->setAmount(rand(100, 10000));
$storeItem->setComment(md5(rand(100, 2355)));
$storeItem->setMinAmount(rand(10, 100));
$storeItem->setManufacturerCode(substr(md5(rand(0, 1000)), 10, 5));
$storeItem->setSupplierCode(substr(md5(rand(0, 1000)), 10, 5));
//$em->persist($storeItem);
//$em->flush();
$items = array_map(function ($item) {
return $item->getJsonable();
}, $em->getRepository('ru\\nazarov\\crm\\entities\\StoreItem')->findAll());
$this->view()->set('content', 'store.tpl')->set('items', $items);
}
示例9: prepareData
protected function prepareData()
{
parent::prepareData();
$em = $this->em();
$orgs = $em->getRepository('\\ru\\nazarov\\crm\\entities\\Organization')->findBy(array(), array('typeId' => 'ASC', 'name' => 'ASC'));
$orgId = $this->request()->get('org');
foreach ($orgs as $org) {
if ($org->getId() == $orgId) {
break;
}
}
$reports = array();
if (isset($org)) {
if ($org->getId() != $orgId) {
$reports = $em->getRepository('\\ru\\nazarov\\crm\\entities\\Report')->findBy(array(), array('id' => 'DESC'));
$org = null;
} else {
$query = $em->createQuery('SELECT r FROM \\ru\\nazarov\\crm\\entities\\Report r JOIN r.contact c JOIN c.person p JOIN p.organization o WHERE o=:org ORDER BY r.id DESC');
$query->setParameter('org', $org->getId());
$reports = $query->getResult();
}
}
$this->view()->set('content', 'reports_list.tpl')->set('reports', $reports)->set('orgId', isset($org) ? $org->getId() : null)->set('orgs', $orgs);
}
示例10: prepareData
protected function prepareData()
{
parent::prepareData();
$this->view()->set('content', 'form.tpl');
}
示例11: prepareData
protected function prepareData()
{
parent::prepareData();
$r = $this->request();
$this->view()->set('content', 'error.tpl')->set('mes', $r->get('mes'))->set('back', $r->get('back'));
}
示例12: prepareData
protected function prepareData()
{
parent::prepareData();
$this->view()->set('content', 'offer_form.tpl')->set('attachment_key', AddAppAction::ATTACHMENT_KEY);
}
示例13: prepareData
protected function prepareData()
{
parent::prepareData();
$this->view()->set('content', 'app_form.tpl')->set('attachment_key', self::ATTACHMENT_KEY);
}
示例14: prepareData
protected function prepareData()
{
parent::prepareData();
$this->em()->find('\\ru\\nazarov\\crm\\entities\\Organization', 1);
$this->view()->set('content', 'welcome.tpl');
}