Веб-приложение для мониторинга каталога продукции предприятия
Программное обеспечение для мониторинга каталога продукции предприятия, анализа склада, получения информации об актуальной стоимости товара, с учетом налоговой политики. Подключение к файловой системе. Определение объема программного обеспечения.
Рубрика | Программирование, компьютеры и кибернетика |
Вид | дипломная работа |
Язык | русский |
Дата добавления | 15.01.2017 |
Размер файла | 500,3 K |
Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже
Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.
)
)*/
);
public function __construct($hostname, $username, $password, $dbName)
{
$this->objPHPExcel = new PHPExcel();
$this->activeSheetIndex = 0;
$this->row = self::MIN_ROW;
mysql_connect($hostname, $username, $password) OR DIE("Не могу создать соединение с базой данных.");
mysql_select_db($dbName) or die(mysql_error());
$this->getParentCategory(2, false);
$this->writeExcelFile();
}
private function setHeader()
{
$iDrawing = new PHPExcel_Worksheet_Drawing();
$iDrawing->setPath("images/header_logo.png");
$iDrawing->setCoordinates("A1");
$iDrawing->setWorksheet($this->objPHPExcel->getActiveSheet());
$this->objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
$this->objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(60);
$this->objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
}
private function getParentCategory($category, $parent)
{
$name_query = "SELECT name FROM ps_category_lang WHERE id_category=" . $category;
$name_query_result = mysql_query($name_query) or die(mysql_error());
$res2 = mysql_fetch_array($name_query_result);
if (!$parent) {
$this->objPHPExcel->createSheet($this->activeSheetIndex);
$this->objPHPExcel->setActiveSheetIndex($this->activeSheetIndex);
$str = iconv('windows-1251', 'utf-8', $res2['name']);
$this->objPHPExcel->getActiveSheet()->setTitle($str);
$this->activeSheetIndex++;
$this->row = self::MIN_ROW;
$this->setHeader();
echo "<h1>" . $res2['name'] . "</h1><br />\n";
} else {
echo "<h2>" . $res2['name'] . "</h2><br />\n";
$str = iconv('windows-1251', 'utf-8', $res2['name']);
$this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $this->row, $str);
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(0, $this->row)->applyFromArray($this->h2Style)->applyFromArray($this->borderOutline);
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(1, $this->row)->applyFromArray($this->borderOutline);
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(2, $this->row)->applyFromArray($this->borderOutline);
$this->objPHPExcel->getActiveSheet()->mergeCellsByColumnAndRow(0, $this->row, 2, $this->row);
$this->row++;
}
$parent_query = "SELECT id_category FROM ps_category WHERE id_parent =" . $category;
$result = mysql_query($parent_query) or die(mysql_error());
while ($res = mysql_fetch_array($result)) {
if ($category != 2) {
$this->getParentCategory($res['id_category'], true);
} else {
$this->getParentCategory($res['id_category'], false);
}
}
$product_query = "SELECT b.name, b.description_short, c.id_image, d.price FROM ps_category_product a, ps_product_lang b, ps_image c, ps_product d WHERE a.id_product = b.id_product AND a.id_product = c.id_product AND a.id_product = d.id_product AND b.id_lang = 7 AND c.cover = 1 AND a.id_category =" . $category;
$product_query_result = mysql_query($product_query) or die(mysql_error());
while ($res3 = mysql_fetch_array($product_query_result)) {
echo "<p>" . $res3['name'] . "</p>\n";
$name = iconv('windows-1251', 'utf-8', $res3['name']);
$image = iconv('windows-1251', 'utf-8', $res3['id_image']);
$price = iconv('windows-1251', 'utf-8', $res3['price']);
// Currency
$price = round($price * 8700);
$description_short = iconv('windows-1251', 'utf-8', $res3['description_short']);
$this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $this->row, $name);
$this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $this->row, $description_short);
$this->objPHPExcel->getActiveSheet()->setCellValueExplicitByColumnAndRow(2, $this->row, $price, PHPExcel_Cell_DataType::TYPE_NUMERIC);
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(0, $this->row)->applyFromArray($this->mProductName)->getAlignment()->setWrapText(true);
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(1, $this->row)->applyFromArray($this->mDescription)->getAlignment()->setWrapText(true);
$this->objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(2, $this->row)->applyFromArray($this->mDescription)->getNumberFormat()->setFormatCode('#,## руб');
$this->getProductImage($image);
$this->row++;
}
}
private function getProductImage($id){
$t = 1;
$x = $id;
$tmp[] = NULL;
while($x != 0){
$tmp[] = $x % ($t * 10);
$x = (int)($x / 10);
}
$path = "../shop1/img/p/";
foreach (array_reverse($tmp) as $value) {
$path .= $value."/";
}
$path .= $id."-home_default.jpg";
echo "<img src=\"".$path."\" />";
$iDrawing = new PHPExcel_Worksheet_Drawing();
$iDrawing->setPath($path);
$iDrawing->setCoordinates("A".$this->row);
$iDrawing->setOffsetY(10);
$iDrawing->setOffsetX(10);
$iDrawing->setWorksheet($this->objPHPExcel->getActiveSheet());
$this->objPHPExcel->getActiveSheet()->getRowDimension($this->row)->setRowHeight($iDrawing->getHeight());
}
public function writeExcelFile()
{
$objWriter = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel2007');
$objWriter->save('price.xlsx');
}
}
?>
products.php
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
define('DEBUG', false);
define('_PS_DEBUG_SQL_', false);
define('PS_SHOP_PATH', 'catalog.esm.by');
define('PS_WS_AUTH_KEY', 'HNY7LS6196SK1P656HMW4ELY6OMIHGE7');
set_include_path('Classes/');
require_once 'Classes/PSWebServiceLibrary.php';
require('../config/config.inc.php');
include('db_conn.php');
set_time_limit(300);
class Products
{
private $last_p_manufacture = '';
private $last_id_manufacture = 0;
private $last_p_category = '';
private $last_id_category = 0;
private $last_id_category_par = 0;
private $last_id_category_par_par = 0;
public function glob_files($path){
$file_size = filesize($path);
$FILES = glob(_PS_DOWNLOAD_DIR_.'/*');
foreach($FILES as $key => $file){
if( filesize( $file ) == $file_size ){
if (md5_file($path) == md5_file($file)){
return ($file);
}
}
}
return (false);
}
public function encodestring($string)
{
$table = array(
'А' => 'A',
'Б' => 'B',
'В' => 'V',
'Г' => 'G',
'Д' => 'D',
'Е' => 'E',
'Ё' => 'YO',
'Ж' => 'ZH',
'З' => 'Z',
'И' => 'I',
'Й' => 'J',
'К' => 'K',
'Л' => 'L',
'М' => 'M',
'М' => 'N',
'О' => 'O',
'П' => 'P',
'Р' => 'R',
'С' => 'S',
'Т' => 'T',
'У' => 'U',
'Ф' => 'F',
'Х' => 'H',
'Ц' => 'C',
'Ч' => 'CH',
'Ш' => 'SH',
'Щ' => 'CSH',
'Ь' => '',
'Ы' => 'Y',
'Ъ' => '',
'Э' => 'E',
'Ю' => 'YU',
'Я' => 'YA',
'а' => 'a',
'б' => 'b',
'в' => 'v',
'г' => 'g',
'д' => 'd',
'е' => 'e',
'ё' => 'yo',
'ж' => 'zh',
'з' => 'z',
'и' => 'i',
'й' => 'j',
'к' => 'k',
'л' => 'l',
'м' => 'm',
'н' => 'n',
'о' => 'o',
'п' => 'p',
'р' => 'r',
'с' => 's',
'т' => 't',
'у' => 'u',
'ф' => 'f',
'х' => 'h',
'ц' => 'c',
'ч' => 'ch',
'ш' => 'sh',
'щ' => 'csh',
'ь' => '',
'ы' => 'y',
'ъ' => '',
'э' => 'e',
'ю' => 'yu',
'я' => 'ya',
);
$output = str_replace(
array_keys($table),
array_values($table),$string
);
return $output;
}
public function Attachment($id_for_attach,$p_name, $doc_path, $id_product){
if(file_exists($doc_path.$id_for_attach.'.pdf')){
$mime = 'application/pdf';
$path = $doc_path.$id_for_attach.'.pdf';
$type = '.pdf';
filetype($path);
}
elseif(file_exists($doc_path.$id_for_attach.'.doc')){
$mime = 'application/msword';
$path = $doc_path.$id_for_attach.'.doc';
$type = '.doc';
}
elseif(file_exists($doc_path.$id_for_attach.'.docx')){
$mime = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
$path = $doc_path.$id_for_attach.'.docx';
$type = '.docx';
}
elseif(file_exists($doc_path.$id_for_attach.'.rar')){
$mime = 'application/octet-stream';
$path = $doc_path.$id_for_attach.'.rar';
$type = '.rar';
}
elseif(file_exists($doc_path.$id_for_attach.'.zip')){
$mime = 'application/x-zip-compressed';
$path = $doc_path.$id_for_attach.'.zip';
$type = '.zip';
}
else{
echo 'Не удалось найти приложение - ';
return;
}
$comparison_file = $this->glob_files($path);
$p_name_download = $this->encodestring($p_name);
echo $p_name_download;
if ($comparison_file == TRUE){
$comparison_file = basename($comparison_file);
$attachment = new Attachment();
$attachment->name[7] = 'Паспорт '.$p_name.$type;
$attachment->file = $comparison_file;
$attachment->mime = $mime;
$attachment->file_name = $p_name_download.$type;
$attachment->add();
$attachment->attachProduct($id_product);
$attach_query = 'SELECT id_attachment FROM ps_attachment_lang WHERE name LIKE \'Паспорт '.$p_name.$type.'\'';
$attach_query_result = mysql_query($attach_query) or die(mysql_error());
$attach_query_par = mysql_fetch_array ($attach_query_result);
$attachment->attachToProduct($id_product, $attach_query_par);
}
else{
do $uniqid = sha1(microtime());
while (file_exists(_PS_DOWNLOAD_DIR_.$uniqid));
if (copy($path, _PS_DOWNLOAD_DIR_.$uniqid)){
if (isset($uniqid))
{
$attachment = new Attachment();
$attachment->name[7] = 'Паспорт '.$p_name.$type;
$attachment->file = $uniqid;
$attachment->mime = $mime;
$attachment->file_name = $p_name_download.$type;
$attachment->add();
$attachment->attachProduct($id_product);
$attach_query = 'SELECT id_attachment FROM ps_attachment_lang WHERE name LIKE \'Паспорт '.$p_name.$type.'\'';
$attach_query_result = mysql_query($attach_query) or die(mysql_error());
$attach_query_par = mysql_fetch_array ($attach_query_result);
$attachment->attachToProduct($id_product, $attach_query_par);
}
}
}
}
public function link_rewrite($str){
if (function_exists('mb_strtolower'))
$str = mb_strtolower($str, 'utf-8');
$str = trim($str);
if (!function_exists('mb_strtolower'))
$this->replaceAccentedChars($str);
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);
$str = preg_replace('/[\s\'\:\/\[\]-]+/', ' ', $str);
$str = str_replace(array(' ', '/'), '-', $str);
if (!function_exists('mb_strtolower'))
$str = strtolower($str);
return $str;
}
public function replaceAccentedChars($str)
{
$patterns = array(
/* Lowercase */
'/[\x{0105}\x{00E0}\x{00E1}\x{00E2}\x{00E3}\x{00E4}\x{00E5}]/u',
'/[\x{00E7}\x{010D}\x{0107}]/u',
'/[\x{010F}]/u',
'/[\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{011B}\x{0119}]/u',
'/[\x{00EC}\x{00ED}\x{00EE}\x{00EF}]/u',
'/[\x{0142}\x{013E}\x{013A}]/u',
'/[\x{00F1}\x{0148}]/u',
'/[\x{00F2}\x{00F3}\x{00F4}\x{00F5}\x{00F6}\x{00F8}]/u',
'/[\x{0159}\x{0155}]/u',
'/[\x{015B}\x{0161}]/u',
'/[\x{00DF}]/u',
'/[\x{0165}]/u',
'/[\x{00F9}\x{00FA}\x{00FB}\x{00FC}\x{016F}]/u',
'/[\x{00FD}\x{00FF}]/u',
'/[\x{017C}\x{017A}\x{017E}]/u',
'/[\x{00E6}]/u',
'/[\x{0153}]/u',
/* Uppercase */
'/[\x{0104}\x{00C0}\x{00C1}\x{00C2}\x{00C3}\x{00C4}\x{00C5}]/u',
'/[\x{00C7}\x{010C}\x{0106}]/u',
'/[\x{010E}]/u',
'/[\x{00C8}\x{00C9}\x{00CA}\x{00CB}\x{011A}\x{0118}]/u',
'/[\x{0141}\x{013D}\x{0139}]/u',
'/[\x{00D1}\x{0147}]/u',
'/[\x{00D3}]/u',
'/[\x{0158}\x{0154}]/u',
'/[\x{015A}\x{0160}]/u',
'/[\x{0164}]/u',
'/[\x{00D9}\x{00DA}\x{00DB}\x{00DC}\x{016E}]/u',
'/[\x{017B}\x{0179}\x{017D}]/u',
'/[\x{00C6}]/u',
'/[\x{0152}]/u');
$replacements = array(
'a', 'c', 'd', 'e', 'i', 'l', 'n', 'o', 'r', 's', 'ss', 't', 'u', 'y', 'z', 'ae', 'oe',
'A', 'C', 'D', 'E', 'L', 'N', 'O', 'R', 'S', 'T', 'U', 'Z', 'AE', 'OE'
);
return preg_replace($patterns, $replacements, $str);
}
public function PS_new_product($id_for_img, $image_path, $doc_path, $p_name, $p_desc, $p_desc_sh, $p_price, $p_category, $p_manufacture, $p_parent) {
$webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG);
$p_category = trim($p_category);
$p_manufacture = trim($p_manufacture);
$p_desc = trim($p_desc);
$p_desc = strip_tags($p_desc, '<ul><ol><li><table><tr><td><tbody>');
$p_desc = preg_replace('/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i','<$1$2>', $p_desc);
$p_desc_sh = preg_replace('/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i','<$1$2>', $p_desc_sh);
$p_desc_sh = strip_tags($p_desc_sh, '<p><div><ul><ol><li><table><tr><td><tbody>');
$p_desc_sh = trim($p_desc_sh);
if ($p_manufacture != $this->last_p_manufacture)
{
$manufacturer_query = 'SELECT id_manufacturer FROM ps_manufacturer WHERE name LIKE \'' .$p_manufacture.'\'';
$manufacturer_query_result = mysql_query($manufacturer_query) or die(mysql_error());
$this->last_id_manufacture = mysql_fetch_array($manufacturer_query_result);
$this->last_id_manufacture = $this->last_id_manufacture['id_manufacturer'];
$this->last_p_manufacture = $p_manufacture;
}
if (($p_parent == 0) || ($p_parent == NULL)){
if ($p_category != $this->last_p_category)
{
$category_query = 'SELECT id_category FROM ps_category_lang WHERE name LIKE \'' .$p_category.'\'';
$category_query_result = mysql_query($category_query) or die(mysql_error());
$this->last_id_category = mysql_fetch_array($category_query_result);
$this->last_id_category = (integer)$this->last_id_category['id_category'];
$this->last_p_category = $p_category;
$category_par_query = 'SELECT id_parent FROM ps_category WHERE id_category = '.$this->last_id_category;
$category_par_query_result = mysql_query($category_par_query) or die(mysql_error());
$this->last_id_category_par = mysql_fetch_array($category_par_query_result);
$this->last_id_category_par = (integer)$this->last_id_category_par['id_parent'];
$category_par_par_query = 'SELECT id_parent FROM ps_category WHERE id_category = '.$this->last_id_category_par;
$category_par_par_query_result = mysql_query($category_par_par_query) or die(mysql_error());
$this->last_id_category_par_par = mysql_fetch_array($category_par_par_query_result);
$this->last_id_category_par_par = (integer)$this->last_id_category_par_par['id_parent'];
}
}
else{
if ($p_category != $this->last_p_category)
{
$category_par_query = 'SELECT id_category FROM ps_category_lang WHERE name LIKE \'' .$p_parent.'\'';
$category_par_query_result = mysql_query($category_par_query) or die(mysql_error());
$this->last_id_category_par = mysql_fetch_array ($category_par_query_result);
$this->last_id_category_par = (integer)$this->last_id_category_par['id_category'];
$category_par_par_query = 'SELECT id_parent FROM ps_category WHERE id_category = '.$this->last_id_category_par;
$category_par_par_query_result = mysql_query($category_par_par_query) or die(mysql_error());
$this->last_id_category_par_par = mysql_fetch_array($category_par_par_query_result);
$this->last_id_category_par_par = (integer)$this->last_id_category_par_par['id_parent'];
$category_query = 'SELECT id_category FROM ps_category_lang WHERE name LIKE \'' .$p_category.'\' AND id_category = (SELECT id_category FROM ps_category WHERE id_parent LIKE \''.$this->last_id_category_par.'\')';
$category_query_result = mysql_query($category_query) or die(mysql_error());
$this->last_id_category = mysql_fetch_array($category_query_result);
$this->last_id_category = (integer)$this->last_id_category['id_category'];
$this->last_p_category = $p_category;
}
}
$p_link_rewrite = $this->link_rewrite($p_name);
$p_meta_title = $p_manufacture.' '.$p_name;
$p_desc_sh_no_tags = strip_tags($p_desc_sh);
preg_match('`[:\.\r\n]`',$p_desc_sh_no_tags, $M);
$p_meta_description = substr($p_desc_sh_no_tags, 0, strpos($p_desc_sh_no_tags, $M[0])+1);
$p_meta_keywords = mb_strtolower($p_manufacture,'UTF-8').' '.$p_link_rewrite.','.$p_link_rewrite.','.mb_strtolower($p_manufacture,'UTF-8');
$p_l_id = '7';
$xml = $webService -> get(array('url' => PS_SHOP_PATH . '/api/products?schema=blank'));
$resources = $xml -> children() -> children();
unset($resources -> id);
$resources -> id_manufacturer = $this->last_id_manufacture;
$resources -> id_manufacturer['xlink:href'] = PS_SHOP_PATH . '/api/manufactures/' . $this->last_id_manufacture;
unset($resources -> id_supplier);
$resources -> id_category_default = $this->last_id_category;
$resources -> id_category_default['xlink:href'] = PS_SHOP_PATH . '/api/categories/' . $this->last_id_category;
unset($resources -> cache_default_attribute);
unset($resources -> id_default_combination);
$resources -> id_tax_rules_group = 4;
$resources -> id_tax_rules_group['xlink:href'] = PS_SHOP_PATH . '/api/id_tax_rules_group/' . 4;
unset($resources -> position_in_category);
unset($resources -> manufacturer_name);
unset($resources -> quantity);
$resources -> id_shop_default = 1;
$resources -> minimal_quantity = 1;
$resources -> price = $p_price;
$resources -> active = 1;
$resources -> available_for_order = 1;
unset($resources -> available_date);
$resources -> condition = 'new';
$resources -> show_price = 1;
$resources -> indexed = 1;
$resources -> visibility = 'both';
unset($resources -> advanced_stock_management);
unset($resources -> date_add);
unset($resources -> date_upd);
$node = dom_import_simplexml($resources -> meta_description -> language[0][0]);
$no = $node -> ownerDocument;
$node -> appendChild($no -> createCDATASection($p_meta_description));
$resources -> meta_description -> language[0][0] = $p_meta_description;
$resources -> meta_description -> language[0][0]['id'] = $p_l_id;
$resources -> meta_description -> language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . $p_l_id;
$node = dom_import_simplexml($resources -> meta_keywords -> language[0][0]);
$no = $node -> ownerDocument;
$node -> appendChild($no -> createCDATASection($p_meta_keywords));
$resources -> meta_keywords -> language[0][0] = $p_meta_keywords;
$resources -> meta_keywords -> language[0][0]['id'] = $p_l_id;
$resources -> meta_keywords -> language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . $p_l_id;
$resources -> meta_title -> language[0][0] = $p_meta_title;
$resources -> meta_title -> language[0][0]['id'] = $p_l_id;
$resources -> meta_title -> language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . $p_l_id;
$resources -> link_rewrite -> language[0][0] = $p_link_rewrite;
$resources -> link_rewrite -> language[0][0]['id'] = $p_l_id;
$resources -> link_rewrite -> language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . $p_l_id;
$resources -> name -> language[0][0] = $p_name;
$resources -> name -> language[0][0]['id'] = $p_l_id;
$resources -> name -> language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . $p_l_id;
$node = dom_import_simplexml($resources -> description -> language[0][0]);
$no = $node -> ownerDocument;
$node -> appendChild($no -> createCDATASection($p_desc));
$resources -> description -> language[0][0]['id'] = $p_l_id;
$resources -> description -> language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . $p_l_id;
$node = dom_import_simplexml($resources -> description_short -> language[0][0]);
$no = $node -> ownerDocument;
$node -> appendChild($no -> createCDATASection($p_desc_sh));
$resources -> description_short -> language[0][0]['id'] = $p_l_id;
$resources -> description_short -> language[0][0]['xlink:href'] = PS_SHOP_PATH . '/api/languages/' . $p_l_id;
unset($resources -> available_now);
unset($resources -> available_later);
$resources ->associations->categories->category[0]->id = $this->last_id_category_par_par;
$resources -> associations->categories->category[0]['xlink:href'] = PS_SHOP_PATH . '/api/categories/' . $this->last_id_category_par_par;
$resources ->associations->categories->category[1]->id = $this->last_id_category_par;
$resources -> associations->categories->category[1]['xlink:href'] = PS_SHOP_PATH . '/api/categories/' . $this->last_id_category_par;
$resources ->associations->categories->category[2]->id = $this->last_id_category;
$resources -> associations->categories->category[2]['xlink:href'] = PS_SHOP_PATH . '/api/categories/' . $this->last_id_category;
unset($resources -> associations->product_features);
$opt = array('resource' => 'products');
$opt['postXml'] = $xml -> asXML();
$xml = $webService -> add($opt);
unset($opt);
$product_id_image_query = 'SELECT id_product FROM ps_product_lang WHERE id_product=(SELECT MAX(id_product) FROM ps_product) AND name LIKE \'' .$p_name.'\'';
$product_id_image_query_result = mysql_query($product_id_image_query) or die(mysql_error());
$product_id_image = mysql_fetch_array($product_id_image_query_result);
$product_id_image = $product_id_image['id_product'];
$url = 'http://catalog.esm.by/api/images/products/'.$product_id_image;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_USERPWD, PS_WS_AUTH_KEY.':');
if (file_exists($image_path.$id_for_img.'.jpg')){
$format = 'jpg';
}
elseif (file_exists($image_path.$id_for_img.'.png')){
$format = 'png';
}
elseif (file_exists($image_path.$id_for_img.'.gif')){
$format = 'gif';
}
elseif (file_exists($image_path.$id_for_img.'.jpeg')){
$format = 'jpeg';
}
else
echo 'Строка '.$id_for_img.' - ' .$p_name. ' - не удалось загрузить изображение.<br/>';
$image_path = $image_path.$id_for_img.'.'.$format;
curl_setopt($ch, CURLOPT_POSTFIELDS, array('image' => '@'.$image_path.';type=image/'.$format));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
$this->Attachment($id_for_img, $p_name, $doc_path, $product_id_image);
echo 'Строка '.$id_for_img.' - ' .$p_name. ' - продукт добавлен.<br/>';
}
}
?>
Размещено на Allbest.ru
Подобные документы
Создание автоматизированного каталога режущего инструмента предприятия с использованием современного программного обеспечения: СУБДFireBird 2.5 и среда разработки приложений C++ Builder 6. Разработка программного модуля для работы и автоматизации.
курсовая работа [3,2 M], добавлен 14.12.2012Особенности dirent как входной структуры каталога, независимой от файловой системы. Получение содержимого каталога и информации о файле. Разработка блок-схемы алгоритма программы. Изучение программного обеспечения для реализации поставленной задачи.
курсовая работа [1,1 M], добавлен 22.07.2014Проектирование программного обеспечения. Схема начального формирования каталога файлов, вывода на экран каталога файлов, удаления файлов, сортировки файлов по имени, дате создания и размеру методом прямого выбора. Управление каталогом в файловой системе.
курсовая работа [804,0 K], добавлен 08.01.2014Общая характеристика и функциональные возможности, внутреннее устройство и принцип работы спутниковых систем мониторинга, особенности их применения в сфере сельского хозяйства. Технология решения задачи мониторинга. Разработка программного обеспечения.
дипломная работа [5,3 M], добавлен 15.05.2014Методики сбора и анализа сведений по сетевым принтерам Загорской ГАЭС; ввод полученной информации в базу данных оборудования и оргтехники на базе программного обеспечения Hardware Inspector. Изучение автоматизированных систем мониторинга и диагностики.
отчет по практике [30,0 K], добавлен 20.07.2012История возникновения тестирования программного обеспечения, основные цели и особенности его проведения. Виды и типы тестирования, уровни его автоматизации. Использование и исследование необходимых технологий. Полный цикл прогона всей системы мониторинга.
дипломная работа [1,7 M], добавлен 03.05.2018Организация и эволюция развития поискового аппарата электронного каталога библиотеки. Функции и структурные особенности справочно-библиографического аппарата. Электронные каталоги библиотек г. Омска. Общий функционал программного обеспечения OPAC.
курсовая работа [106,8 K], добавлен 16.09.2017Состояние систем управления инженерными сетями. Выбор системы-прототипа и ее описание со всеми видами обеспечения. Разработка автоматизированной информационной системы мониторинга инженерных сетей, принцип работы и используемое программное обеспечение.
дипломная работа [1,9 M], добавлен 21.01.2015Обзор типов сайтов, сравнение популярных CMS, обеспечение работы. Описание их информационного обеспечения, программного и технического обеспечения. Разработка сводного сайта-каталога фирм с функцией просмотра товара и поиска продавца с минимальной ценой.
дипломная работа [3,6 M], добавлен 12.12.2013Классификация программного обеспечения, его особенности, назначение. Программное обеспечение для работы с текстом, изображением, прикладное, офисное, для работы в Интернете. Системы программирования, специфика программного обеспечения, что такое вирусы.
презентация [1,2 M], добавлен 25.02.2010