task =='copyOrder') { $order_id= http::Request('id'); $user_id = http::Request('user_id'); $result = $orders->copyOrder($order_id,$user_id); header('Location:/adminpanel/orders'); exit(); } if($this->task =='copyOrderForm') { $id= http::Request('id'); $array['users'] = users::getInstance()->getList(); $array['id'] = $id; $data = templates::getInstance()->loadTemplate('admin/orders/copy_order_form',$array); echo $data; } if($this->task =='saveCsv') { $id = http::Request('id'); $order_info = $orders->getOrder($id,1 ); $options = options::getInstance()->getOptions(); foreach($order_info['products'] as $item) { $row = array(); $row['Vendor code']=$item['vendor_code']; $row['Quantity']=$item['kol']; $array[]=$row; } $csv = filesystem::array2csv($array,1,';'); $filename = $options['title']." -order nr.".$id; $path = $_SERVER['DOCUMENT_ROOT']."/".admin_folder."/tmp/"; $filename = $filename.'.csv'; $file = $path.$filename; $fp = fopen($file,'wb+'); fputs($fp,$csv); fclose($fp); header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header('Content-disposition: attachment; filename="'.$filename.'"'); header('Content-type: "text/html"; charset="utf8"'); readfile($file); } if($this->task =='join_orders') { $not_closed = 0; if(isset($_GET['ids'])) { $array = explode(',',$_GET['ids']); foreach($array as $id) { $order_info = $orders->getOrder($id,1 ); //if($order_info['already_joined']) continue; $order_join_array[$id] = $order_info; $users[$order_info['id_user']] = 1; if(!$order_info['closed']) $not_closed++; } $go=0; ?>