Exemplo n.º 1
0
 /**
  * get module's html select element for info page use
  *
  * @author                                    youzhao.zxw<*****@*****.**>
  * @param   int             $productId        product id
  * @param   int             $productModuleId  productmodule's id
  * @param   string          $infoType         bug,case or result
  * @return  string                            module's html select string
  */
 public static function getModuleSelect($productId, $productModuleId, $infoType)
 {
     $productInfo = Product::model()->findByPk($productId);
     $productName = $productInfo['name'];
     $firstLayerModuleArr = ProductModuleService::getLayer1Module($productId, $productName);
     if (!empty($productModuleId)) {
         $fullIdArr = array();
         $fullIdArr = ProductModuleService::getFullPathId($fullIdArr, $productModuleId);
         $layer1Id = $fullIdArr[1];
     } else {
         $firstLayerIdArr = array_keys($firstLayerModuleArr);
         $layer1Id = $firstLayerIdArr[0];
     }
     $moduleSelectId = ucfirst(strtolower($infoType)) . 'InfoView_productmodule_id';
     $moduleSelectName = ucfirst(strtolower($infoType)) . 'InfoView[productmodule_id]';
     $returnStr = CHtml::dropDownList('layer1_module', $layer1Id, array($productName => $firstLayerModuleArr), array('style' => 'width:180px;', 'class' => 'required', 'onchange' => 'getChildModule($(this).val())'));
     $returnStr .= CHtml::dropDownList($moduleSelectName, $productModuleId, ProductModuleService::getChildModuleSelectOption($layer1Id), array('style' => 'width:400px;', 'class' => 'product_module', 'id' => $moduleSelectId, 'onchange' => 'setAssignTo(\'' . $infoType . '\')'));
     return $returnStr;
 }
Exemplo n.º 2
0
 public function actionGetChildModuleSelect()
 {
     $parentModuleId = $_GET['parent_id'];
     $infoType = $_GET['type'];
     $moduleSelectId = ucfirst(strtolower($infoType)) . 'InfoView_productmodule_id';
     $moduleSelectName = ucfirst(strtolower($infoType)) . 'InfoView[productmodule_id]';
     echo CHtml::dropDownList($moduleSelectName, '', ProductModuleService::getChildModuleSelectOption($parentModuleId), array('style' => 'width:400px;', 'class' => 'product_module', 'id' => $moduleSelectId, 'onchange' => 'setAssignTo(\'' . $infoType . '\')'));
 }