public function createForm($id_loaivai)
 {
     $lv = new Model_Loaivai();
     $loaivai = $lv->getWhere($id_loaivai);
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/loaivai_layout.phtml')), 'Form'));
     $ls = new Model_Loaisoi();
     $arr = $ls->getAll();
     $options = array();
     foreach ($arr as $item) {
         $name = $item['MaSoi'];
         $options[$name] = $item['TenSoi'];
     }
     $tenloaivai = $this->createElement('text', 'tenloaivai', array('decorators' => array('ViewHelper')));
     $masoi = $this->createElement('select', 'masoi', array('multioptions' => $options, 'decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Chỉnh Sửa'));
     $tenloaivai->setAttrib('class', 'formEdit')->setValue($loaivai['TenLoaiVai']);
     $masoi->setAttrib('class', 'formEdit')->setValue($loaivai['MaSoi']);
     $this->addElement($tenloaivai)->addElement($masoi)->addElement($them);
 }
 public function init()
 {
     $this->setDisableLoadDefaultDecorators(true);
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/loaivai_layout.phtml')), 'Form'));
     $ls = new Model_Loaisoi();
     $arr = $ls->getAll();
     $options = array();
     foreach ($arr as $item) {
         $name = $item['MaSoi'];
         $options[$name] = $item['TenSoi'];
     }
     $tenloaivai = $this->createElement('text', 'tenloaivai', array('decorators' => array('ViewHelper')));
     $masoi = $this->createElement('select', 'masoi', array('multioptions' => $options, 'decorators' => array('ViewHelper')));
     $them = $this->createElement('submit', 'them', array('decorators' => array('ViewHelper'), 'label' => 'Thêm'));
     $masoi->setAttrib('class', 'formEdit');
     $this->addElement($tenloaivai)->addElement($masoi)->addElement($them);
     //         $this->addElement('submit', 'nhap', array(
     //                 'decorators' => array(
     //                         'ViewHelper'
     //                 ),
     //                 'label' => 'Nhập'
     //         ));
 }
 public function getOptionLoaiSoi()
 {
     $ls = new Model_Loaisoi();
     $arr = $ls->getAll();
     $options = array();
     foreach ($arr as $item) {
         $options[$item['MaSoi']] = $item['TenSoi'];
     }
     return $options;
 }
<?php

echo $this->headMeta();
echo $this->headLink();
$ls = new Model_Loaisoi();
$loaisoiall = $ls->getAll();
if ($loaisoiall) {
    $maincontent = array();
    $title = array("Tên Sợi", "Chỉnh Sửa");
    $data = new My_Data();
    foreach ($loaisoiall as $loaisoi) {
        $content = array($loaisoi['TenSoi'], '<a href="' . HOST_PROJECT . "/index/chinhsua/loaisoi/true/masoi/" . $loaisoi['MaSoi'] . '/">Sửa</a>&nbsp|&nbsp' . '<a href="' . HOST_PROJECT . "/index/xoa/loaisoi/true/masoi/" . $loaisoi['MaSoi'] . '/option/caymoc/" onclick="return confirm(' . "'bạn có chắc muốn xóa ?'" . ')">Xóa</a>');
        $maincontent[] = $content;
    }
    $table = $data->createTable($title, $maincontent, "300px");
    echo $table;
} else {
    echo "<div class='message'>";
    echo "Chưa tồn tại Loại Sợi";
    echo "</div>";
}