コード例 #1
0
ファイル: component.php プロジェクト: nProfessor/Mytb
<?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();
コード例 #2
0
ファイル: club_event_img.php プロジェクト: nProfessor/Mytb
 * 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());
$eventID = intval($_POST['eventID']);
$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($eventID, $arLoadProductArray);
$club = new Club($clubID);
$pic = $club->event()->getInfo($eventID);
$arFile = CFile::GetFileArray($pic["DETAIL_PICTURE"]);
echo imgurl($arFile['SRC'], array("w" => intval($_POST["w"]), "h" => intval($_POST["h"])));