public function prepareElements() { // add() can take either an Element/Fieldset instance, // or a specification, from which the appropriate object // will be built. $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $value_option = Utility::getUnitListForSelect(); $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'unit_item_one', 'options' => array('value_options' => $value_option, 'label' => 'Unit Item 1'), 'attributes' => array('class' => 'input-xlarge span12'))); $this->add(array('name' => 'value', 'attributes' => array('type' => 'text'), 'options' => array('label' => 'Convert Value'))); $this->add(array('type' => 'Zend\\Form\\Element\\Select', 'name' => 'unit_item_two', 'options' => array('value_options' => $value_option, 'label' => 'Unit Item 2'), 'attributes' => array('class' => 'input-xlarge span12'))); $this->add(array('name' => 'send', 'attributes' => array('type' => 'submit', 'value' => 'Submit'))); // We could also define the input filter here, or // lazy-create it in the getInputFilter() method. }
public function indexAction() { $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'search' => false, 'type' => 'number'), array('title' => 'Name', 'db' => 'name', 'dt' => 1, 'search' => true, 'type' => 'text'), array('title' => 'Cost', 'db' => 'cost', 'dt' => 2, 'search' => false, 'type' => 'number'), array('title' => 'In', 'db' => 'id', 'dt' => 3, 'search' => true, 'type' => 'number', 'formatter' => function ($d, $row) { $quantityInput = TransactionUtility::checkStore($d, INSERT_STORE_ACRION, MAIN_STORE); if (isset($quantityInput[0])) { $input = $quantityInput[0]['sum_store']; } else { $input = 0; } return $input; }), array('title' => 'Out', 'db' => 'id', 'dt' => 4, 'search' => true, 'type' => 'number', 'formatter' => function ($d, $row) { $quantityOut = TransactionUtility::checkStore($d, ADD_ORDER_ACTION, MAIN_STORE); if (isset($quantityOut[0])) { $output = $quantityOut[0]['sum_store']; } else { $output = 0; } return $output; }), array('title' => 'In Stock', 'db' => 'quantityInStock', 'dt' => 5, 'search' => false, 'type' => 'number'), array('title' => 'Unit', 'db' => 'unit', 'dt' => 6, 'search' => false, 'type' => 'text', 'formatter' => function ($d, $row) { $unitList = Utility::getUnitListForSelect(); return $unitList[$d]; }), array('title' => 'Supplier', 'db' => 'supplier', 'dt' => 7, 'search' => true, 'type' => 'text'), array('title' => 'Action', 'db' => 'id', 'dt' => 8, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) { $actionUrl = '/admin/menustoremain'; $actionTransactionUrl = '/admin/transaction'; return ' <a class="btn-xs action action-detail btn btn-success btn-default" href="' . $actionUrl . '/add/' . $d . '"><i class="icon-edit"></i></a> <a class="btn-xs action action-detail btn btn-success btn-default" href="' . $actionUrl . '/detail/' . $d . '"><i class="icon-info-sign"></i></a> <a data-id="' . $d . '" id="' . $d . '" href="' . $actionTransactionUrl . '/inserttransactionmain/' . $d . '" class="btn-xs action action-detail btn btn-danger"><i class="icon-signin"></i></a> <a data-id="' . $d . '" id="' . $d . '" data-link="' . $actionUrl . '" class="btn-xs action action-detail btn btn-danger btn-delete " href="javascript:void(0)"><i class="icon-remove"></i></a> '; })); /////end column for table $table = new AjaxTable($columns, array(), 'admin/menustoremain'); $table->setTablePrefix('m'); // $table->setExtendJoin( // array( // array(" Admin\\Entity\\Transaction", "t", "WITH", " t.menuStoreId = m.id "), // array(" Admin\\Entity\\Supplier", "s", "WITH", " s.id = m.supplier "), // ) // ); $table->setExtendSQl(array(array('AND', 'm.isdelete', '=', '0'))); $table->setAjaxCall('/admin/menustoremain/index'); $table->setActionDeleteAll('deleteall'); $this->tableAjaxRequest($table, $columns, $this->menuStoreModel); //end config table return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Manage Warehouse'))); }