dsm0688 2018-10-22 07:26
浏览 12

根据条件显示选择框在zend中

Hi guys i am trying to display select box when there is no grid object. And if i have grid now it will not shown that select box.. But in my case i would like to show select box when grid object also there

Like below

enter image description here

Here is my view page code:

<div>
<?php
if (!empty($this->ticketGridObject)) :
    echo $this->headScript();
    echo $this->ticketGridObject;
else :
?>
<span class="order-ticket-source-text">
    <label><?php echo $this->translate('ticket_source_led_to_order');?> : </label>
</span>

<span class="order-ticket-source-select">
    <select id="ticketSource">
        <option value="">--<?php echo $this->translate('select') ?>--</option>
        <?php foreach ($this->ticketSources as $ticketSource) : ?>
            <option value="<?php echo $ticketSource->source ;?>"><?php echo $ticketSource->source;?></option>
        <?php endforeach;?>
    </select>
</span>
<span class="source-add-icon js-add-new-ticket">
    <img src="/themes/bas/icons/fatcow/16x16/add.png"/>
</span>
<?php endif; ?>

Here is my controller code:

 /**
 * Get order ticket details
 */
public function ticketDetailsAction()
{
    $orderId = $this->getRequest()->getParam('orderId', 0);
    $contactId = $this->getRequest()->getParam('contactId', 0);
    $bootstrap = $this->getInvokeArg('bootstrap');
    $ticketService = new Tickets_Service_Ticket($bootstrap->getOptions());
    $userId = $this->getUserInfo()->getId();
    $params = array(
        'depotAndAffiliateIds' => array_keys($this->_affiliatedDepotMastersWithActiveDepot),
        'orderId' => $orderId,
        'contactId' => (int)$contactId,
        'user' => $userId,
    );
    $options = array(
        'language' => BAS_Shared_Model_Ticket::LANGUAGE_DEFAULT,
        'user' => $userId,
        'translate' => $bootstrap->getResource('translate'),
        'config' => $bootstrap->getResource('config'),
    );
    $ticketGridService = new Ticket_Service_Grid($ticketService, $options);
    if (0 < (int)$contactId) {
        $this->view->ticketGridObject =  $ticketGridService->getGrid(Ticket_Service_Grid::GRID_TYPE_ORDERTICKETOVERVIEW, $params);
    }
    if (empty($this->view->ticketGridObject)) {
        $where = array('depot_id in (?)' => array_keys($this->_affiliatedDepotMastersWithActiveDepot));
        $this->view->ticketSources = $ticketService->getTicketSourceList($where);
    }
}

Can anyone help me How can i do that.Thanks in advance.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 Unity接入微信SDK 无法开启摄像头
    • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
    • ¥20 cad图纸,chx-3六轴码垛机器人
    • ¥15 移动摄像头专网需要解vlan
    • ¥20 access多表提取相同字段数据并合并
    • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
    • ¥20 Java-Oj-桌布的计算
    • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
    • ¥20 有人知道这种图怎么画吗?
    • ¥15 pyqt6如何引用qrc文件加载里面的的资源