public function actionUpdateOrder()
 {
     if (isset($_POST['pcdi_id'])) {
         $pcir_id_arr = $_POST['pcdi_id'];
         for ($i = 0; $i < count($pcir_id_arr); $i++) {
             $model = ProcessChecklistDefault::model()->findByPk($pcir_id_arr[$i]);
             $model->pcdi_order = $i + 1;
             $model->save();
         }
         echo '{"status":"success"}';
     } else {
         echo '{"status":"fail"}';
     }
 }
 public function addChecklistItemRel($entity_type, $entity_id, $pc_id)
 {
     $modelPCdefault = ProcessChecklistDefault::model()->getPCheckListDefaultByCheckList($pc_id);
     $result = false;
     foreach ($modelPCdefault->data as $value) {
         $model = new ProcessChecklistItemRel();
         $model->pcir_entity_type = $entity_type;
         $model->pcir_entity_id = $entity_id;
         $model->pc_id = $pc_id;
         $model->pcir_name = $value->pcdi_name;
         $model->pcir_order = $value->pcdi_order;
         $model->pcir_status_date = date('Y-m-d');
         $model->pcir_status_update_by = 0;
         if ($model->save()) {
             $result = true;
         }
     }
     return $result;
 }