Ejemplo n.º 1
0
 public function clearFlow($flowIds)
 {
     $ids = is_array($flowIds) ? $flowIds : explode(",", $flowIds);
     $count = 0;
     foreach ($ids as $id) {
         $flow = $this->fetchByPk($id);
         if (!empty($flow)) {
             $runs = FlowRun::model()->fetchAllByFlowId($id);
             if (!empty($runs)) {
                 $runIds = ConvertUtil::getSubByKey($runs, "runid");
                 WfHandleUtil::destroy($runIds);
                 $table = sprintf("{{flow_data_%d}}", $id);
                 if (WfCommonUtil::tableExists($table)) {
                     Ibos::app()->db->createCommand()->dropTable($table);
                 }
                 FlowRun::model()->deleteAllByAttributes(array("flowid" => $id));
                 $content = Ibos::lang("Clear flow", "workflow.default", array("{flowName}" => $flow["name"]));
                 FlowManageLog::model()->log($id, $flow["name"], Ibos::app()->user->uid, 3, $content);
                 $count++;
             }
         }
     }
     return $count;
 }