<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== TRUE) { die; } CModule::IncludeModule("iblock"); global $USER; $CLUB_ID = $arParams["CLUB_ID"]; $club = new Club($CLUB_ID); $array = array("stocks" => array("name" => "Действующие акции", "list" => array(), "show" => false), "event" => array("name" => "Предстоящие события", "list" => array(), "show" => false)); $stokRes = $club->stock(); $eventRes = $club->event(); $countSock = $stokRes->getCount(); $countEvent = $eventRes->getCount(); if ($countSock[$CLUB_ID] > 0) { $array["stocks"]["list"] = $stokRes->getListArray(array(">=DATE_ACTIVE_TO" => date("d.m.Y"))); $array["stocks"]["show"] = true; $arResult["LIST"]["stocks"] = $array["stocks"]; } if ($countEvent[$CLUB_ID] > 0) { $array["event"]["list"] = $eventRes->getListArray(array(">=DATE_ACTIVE_TO" => date("d.m.Y"))); $array["event"]["show"] = true; $arResult["LIST"]["event"] = $array["event"]; } $arResult["CLUB_ID"] = $CLUB_ID; $arResult["CLUB"] = $club->getInfo(array("arSelect" => array("NAME", "PREVIEW_PICTURE"))); $this->IncludeComponentTemplate();
* Date: 12.09.12 * Time: 21:15 * To change this template use File | Settings | File Templates. */ require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php"; CModule::IncludeModule("iblock"); global $USER; $userID = intval($USER::GetID()); $stockID = intval($_POST['stockID']); $clubID = Club::getClubID($userID); if ($userID <= 0) { die; } $filename = translate(basename($_FILES['myfile']['name'])); if (!preg_match("#^.*\\.(jpg|png|gif)\$#i", $filename)) { die; } $uploaddir = $_SERVER['DOCUMENT_ROOT'] . "/upload/tmp/" . $userID . "/"; if (!file_exists($uploaddir)) { @mkdir($uploaddir); } $uploadfile = $uploaddir . $filename; move_uploaded_file($_FILES['myfile']['tmp_name'], $uploadfile); $BX_image = CFile::MakeFileArray($uploadfile); $el = new CIBlockElement(); $arLoadProductArray = array("MODIFIED_BY" => $USER->GetID(), "DETAIL_PICTURE" => $BX_image); $res = $el->Update($stockID, $arLoadProductArray); $club = new Club($clubID); $pic = $club->stock()->getInfo($stockID); $arFile = CFile::GetFileArray($pic["DETAIL_PICTURE"]); echo imgurl($arFile['SRC'], array("w" => intval($_POST["w"]), "h" => intval($_POST["h"])));