当前位置: 首页>>代码示例>>PHP>>正文


PHP parseXml函数代码示例

本文整理汇总了PHP中parseXml函数的典型用法代码示例。如果您正苦于以下问题:PHP parseXml函数的具体用法?PHP parseXml怎么用?PHP parseXml使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parseXml函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getOnlineUsersInfo

function getOnlineUsersInfo($sUserId, $bInit)
{
    global $aXmlTemplates;
    $aSaved = getSavedUsers();
    $aActive = getActiveUsers($sUserId);
    $aFriends = getFriends($sUserId);
    saveUsers($aActive);
    $sContents = "";
    if ($bInit) {
        $aFullUsers = array_unique(array_merge($aActive['online'], $aFriends));
    } else {
        $aFullUsers = array_diff($aActive['online'], $aSaved['online'], $aFriends);
        $aNewOfflineUsers = array_intersect($aSaved['online'], $aActive['offline']);
        $aNewOnlineUsers = array_intersect($aSaved['offline'], $aActive['online'], $aFriends);
        for ($i = 0; $i < count($aNewOfflineUsers); $i++) {
            $sContents .= parseXml($aXmlTemplates['user'], $aNewOfflineUsers[$i], FALSE_VAL);
        }
        for ($i = 0; $i < count($aNewOnlineUsers); $i++) {
            $sContents .= parseXml($aXmlTemplates['user'], $aNewOnlineUsers[$i], TRUE_VAL);
        }
    }
    $rResult = getUsersMedia($aFullUsers);
    if ($rResult != null) {
        for ($i = 0; $i < mysql_num_rows($rResult); $i++) {
            $aUser = mysql_fetch_assoc($rResult);
            $aUserInfo = getUserInfo($aUser['ID']);
            $sOnline = in_array($aUser['ID'], $aActive['online']) ? TRUE_VAL : FALSE_VAL;
            $sFriend = in_array($aUser['ID'], $aFriends) ? TRUE_VAL : FALSE_VAL;
            $sMusic = $aUser['CountMusic'] > 0 ? TRUE_VAL : FALSE_VAL;
            $sVideo = $aUser['CountVideo'] > 0 ? TRUE_VAL : FALSE_VAL;
            $sContents .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUserInfo['nick'], $aUserInfo['sex'], $aUserInfo['age'], $aUserInfo['photo'], $aUserInfo['profile'], $sOnline, $sFriend, $sMusic, $sVideo);
        }
    }
    return makeGroup($sContents, "users");
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:35,代码来源:functions.inc.php

示例2: getSavedBoardInfo

function getSavedBoardInfo($sId, $iBoardId)
{
    global $aXmlTemplates;
    $aBoard = BxDolService::call('photos', 'get_photo_array', array($iBoardId, 'original'), 'Search');
    if (count($aBoard) == 0 || $sId != $aBoard["owner"]) {
        $sResult = parseXml($aXmlTemplates["result"], "msgSavedError", FAILED_VAL);
    } else {
        $sResult = parseXml($aXmlTemplates["result"], $iBoardId, SUCCESS_VAL);
        $sResult .= parseXml($aXmlTemplates["savedBoard"], $aBoard["file"], $aBoard["title"]);
    }
    return $sResult;
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:12,代码来源:customFunctions.inc.php

示例3: parseXml

function parseXml($node)
{
    $data = array();
    foreach ($node->children() as $child) {
        if (count($child->children()) == 0) {
            if (is_numeric((string) $child)) {
                $data[$child->getName()] = (int) $child;
            } else {
                $data[$child->getName()] = (string) $child;
            }
        } else {
            $data[$child->getName()] = parseXml($child);
        }
    }
    return $data;
}
开发者ID:CaptainThunk,项目名称:StarOS,代码行数:16,代码来源:functions.php

示例4: video_getList

function video_getList($sId)
{
    global $sModule;
    global $aXmlTemplates;
    global $sFilesPath;
    $sMode = getSettingValue($sModule, "listSource");
    $iCount = (int) getSettingValue($sModule, "listCount");
    if (!is_numeric($iCount) || $iCount <= 0) {
        $iCount = 10;
    }
    $oSource = new BxVideosSearch();
    $oSource->aCurrent['sorting'] = 'top';
    $oSource->aCurrent['paginate']['perPage'] = $iCount;
    $oSource->aCurrent['restriction']['id'] = array('value' => $sId, 'field' => 'ID', 'operator' => '<>');
    switch ($sMode) {
        case "Member":
            $sOwner = getValue("SELECT `Owner` FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "'");
            $oSource->aCurrent['restriction']['owner'] = array('value' => $sOwner, 'field' => 'Owner', 'operator' => '=');
            break;
        case "Related":
            $aFile = getArray("SELECT * FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "'");
            $oSource->aCurrent['restriction']['keyword'] = array('value' => $aFile['Title'] . " " . $aFile['Tags'] . " " . $aFile['Description'], 'field' => '', 'operator' => 'against');
            break;
        case "Top":
        default:
            $oSource->aCurrent['restriction']['id'] = array('value' => $sId, 'field' => 'ID', 'operator' => '<>');
            break;
    }
    $aData = $oSource->getSearchData();
    $iCurrentTime = time();
    $sResult = "";
    for ($i = 0; $i < count($aData); $i++) {
        $aData[$i]['uri'] = $oSource->getCurrentUrl('file', $aData[$i]['id'], $aData[$i]['uri']);
        $aData[$i]['date'] = _format_when($iCurrentTime - $aData[$i]['date']);
        $sImageFile = $aData[$i]['id'] . IMAGE_EXTENSION;
        $sThumbFile = $aData[$i]['id'] . THUMB_FILE_NAME . IMAGE_EXTENSION;
        if (!file_exists($sFilesPath . $sThumbFile)) {
            $sThumbFile = $sImageFile;
        }
        $sResult .= parseXml($aXmlTemplates['file'], $sThumbFile, $aData[$i]['size'], $aData[$i]['ownerName'], $aData[$i]['view'], $aData[$i]['voting_rate'], $aData[$i]['date'], $aData[$i]['title'], BX_DOL_URL_ROOT . $aData[$i]['uri']);
    }
    return $sResult;
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:43,代码来源:customFunctions.inc.php

示例5: printFiles

/**
 * get extra files for module in XML format
 * @param $sModule - module name
 * @param $sFolder - folder name for which value is set
 * @param $bGetDate - get dates of files
 * @return $sContents - XML formatted result
 */
function printFiles($sModule, $sFolder = "langs", $bGetDate = false, $bGetNames = false)
{
    global $sIncPath;
    global $sModulesUrl;
    require_once $sIncPath . "xmlTemplates.inc.php";
    $aFileContents = getFileContents($sModule, "/xml/" . $sFolder . ".xml", true);
    $aFiles = $aFileContents['contents'];
    $aEnabledFiles = array();
    foreach ($aFiles as $sFile => $sEnabled) {
        if ($sEnabled == TRUE_VAL) {
            $aEnabledFiles[] = $sFile;
        }
    }
    $sDefault = $aFiles['_default_'];
    $aResult = getExtraFiles($sModule, $sFolder, true, $bGetDate);
    $sCurrent = $aResult['current'];
    $sCurrent = in_array($sCurrent, $aEnabledFiles) ? $sCurrent : $sDefault;
    $sCurrentFile = $sCurrent . "." . $aResult['extension'];
    $aRealFiles = array_flip($aResult['files']);
    $aFileDates = $aResult['dates'];
    $sContents = "";
    for ($i = 0; $i < count($aEnabledFiles); $i++) {
        if (isset($aRealFiles[$aEnabledFiles[$i]])) {
            $sFile = $aEnabledFiles[$i];
            if ($bGetDate) {
                $sContents .= parseXml($aXmlTemplates['file'], $sFile, $aFileDates[$aRealFiles[$sFile]]);
            } else {
                if ($bGetNames) {
                    $sName = $sFolder == "langs" ? getSettingValue($sModule, "_name_", $sFile, false, "langs") : getSettingValue($sModule, $sFile, "skinsNames");
                    if (empty($sName)) {
                        $sName = $sFile;
                    }
                    $sContents .= parseXml($aXmlTemplates['file'], $sFile, $sName, "");
                } else {
                    $sContents .= parseXml($aXmlTemplates['file'], $sFile);
                }
            }
        }
    }
    $sContents = makeGroup($sContents, "files");
    $sContents .= parseXml($aXmlTemplates['current'], $sCurrent, $sModulesUrl . $sModule . "/" . $sFolder . "/" . $sCurrentFile);
    return $sContents;
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:50,代码来源:apiFunctions.inc.php

示例6: refreshUsersInfo

/**
 * ===> The rest of functions is for XML version only. <===
 * Update user's status
 * @comment - Refreshed
 */
function refreshUsersInfo($iId = 0, $sMode = 'all')
{
    global $aXmlTemplates;
    global $sModule;
    $iUpdateInterval = (int) getSettingValue($sModule, "updateInterval");
    $iIdleTime = (int) getSettingValue($sModule, "idleTime");
    $iDeleteTime = (int) getSettingValue($sModule, "deleteTime");
    //--- refresh current user's track ---//
    $sQuery = "UPDATE `" . MODULE_DB_PREFIX . "CurrentUsers` SET `Status`='" . USER_STATUS_OLD . "', `When`=UNIX_TIMESTAMP() WHERE `Status`<>'" . USER_STATUS_KICK . "' AND IF(`Status` IN ('" . USER_STATUS_NEW . "', '" . USER_STATUS_TYPE . "', '" . USER_STATUS_ROOM . "') AND `When`>=(UNIX_TIMESTAMP()-" . $iUpdateInterval . "), `ID`='-1', `ID`='" . $iId . "')";
    getResult($sQuery);
    //--- refresh other users' states ---//
    $sQuery = "UPDATE `" . MODULE_DB_PREFIX . "CurrentUsers` SET `When`=UNIX_TIMESTAMP(), `Status`='" . USER_STATUS_IDLE . "' WHERE `Status`<>'" . USER_STATUS_IDLE . "' AND `When`<=(UNIX_TIMESTAMP()-" . $iIdleTime . ")";
    getResult($sQuery);
    //--- delete idle users, whose track was not refreshed more than delete time ---//
    $sQuery = "DELETE FROM `" . MODULE_DB_PREFIX . "CurrentUsers` WHERE `Status`='" . USER_STATUS_IDLE . "' AND `When`<=(UNIX_TIMESTAMP()-" . $iDeleteTime . ")";
    getResult($sQuery);
    //--- delete old rooms ---//
    $sQuery = "DELETE FROM `" . MODULE_DB_PREFIX . "Rooms` WHERE `Status`='" . ROOM_STATUS_DELETE . "' AND `When`<=(UNIX_TIMESTAMP()-" . $iDeleteTime . ")";
    getResult($sQuery);
    //--- delete old messages ---//
    $sQuery = "DELETE FROM `" . MODULE_DB_PREFIX . "Messages` WHERE `When`<=(UNIX_TIMESTAMP()-" . $iDeleteTime . ")";
    getResult($sQuery);
    //--- Get information about users in the chat ---//
    switch ($sMode) {
        case 'upd':
            $rRes = getResult("SELECT ccu.`ID` AS `ID`, ccu.`Nick` AS `Nick`, ccu.`Sex` AS `Sex`, ccu.`Age` AS `Age`, ccu.`Desc` AS `Desc`, ccu.`Photo` AS `Photo`, ccu.`Profile` AS `Profile`, ccu.`Status` AS `Status`, ccu.`RoomID` AS `RoomID`, rp.`Type` AS `Type` FROM `" . MODULE_DB_PREFIX . "Profiles` AS rp, `" . MODULE_DB_PREFIX . "CurrentUsers` AS ccu WHERE rp.`ID`=ccu.`ID` ORDER BY ccu.`When`");
            while ($aUser = mysql_fetch_assoc($rRes)) {
                if ($aUser['ID'] == $iId && !($aUser['Status'] == USER_STATUS_KICK || $aUser['Status'] == USER_STATUS_TYPE)) {
                    continue;
                }
                switch ($aUser['Status']) {
                    case USER_STATUS_NEW:
                        $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUser['Status'], $aUser['Nick'], $aUser['Sex'], $aUser['Age'], $aUser['Desc'], $aUser['Photo'], $aUser['Profile'], $aUser['Type'], $aUser['RoomID']);
                        break;
                    case USER_STATUS_ROOM:
                        $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUser['Status'], $aUser['RoomID']);
                        break;
                    case USER_STATUS_TYPE:
                        $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUser['Status'], $aUser['RoomID'], $aUser['Type']);
                        break;
                    case USER_STATUS_IDLE:
                    case USER_STATUS_KICK:
                        $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], $aUser['Status']);
                        break;
                }
            }
            break;
        case 'all':
            $rRes = getResult("SELECT ccu.`ID` AS `ID`, ccu.`Nick` AS `Nick`, ccu.`Sex` AS `Sex`, ccu.`Age` AS `Age`, ccu.`Desc` AS `Desc`, ccu.`Photo` AS `Photo`, ccu.`Profile` AS `Profile`, ccu.`RoomID` AS `RoomID`, rp.`Type` AS `Type` FROM `" . MODULE_DB_PREFIX . "Profiles` AS rp, `" . MODULE_DB_PREFIX . "CurrentUsers` AS ccu WHERE rp.`ID`=ccu.`ID` AND ccu.`Status` NOT IN ('" . USER_STATUS_IDLE . "', '" . USER_STATUS_KICK . "') AND rp.`Banned`='false' ORDER BY ccu.`When`");
            while ($aUser = mysql_fetch_assoc($rRes)) {
                $sContent .= parseXml($aXmlTemplates['user'], $aUser['ID'], "new", $aUser['Nick'], $aUser['Sex'], $aUser['Age'], $aUser['Desc'], $aUser['Photo'], $aUser['Profile'], $aUser['Type'], $aUser['RoomID']);
            }
            break;
    }
    return makeGroup($sContent, "users");
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:61,代码来源:functions.inc.php

示例7: getResult

        $res = getResult($sQuery);
        getResult($sQuery1);
        $bResult = true;
        for ($i = 0; $i < mysql_num_rows($res); $i++) {
            $aFile = mysql_fetch_assoc($res);
            $bResult = deleteFile($aFile["ID"]);
        }
        if ($bResult) {
            $sContents = parseXml($aXmlTemplates['result'], "", SUCCESS_VAL);
        }
        break;
        /**
         * add files to playlist
         */
    /**
     * add files to playlist
     */
    case 'addFilesToPlayList':
        $aFiles = explode(",", $sFile);
        $iFilesCount = count($aFiles);
        if ($iFilesCount == 0) {
            $sContents = parseXml($aXmlTemplates['result'], FALSE_VAL);
            break;
        }
        getResult("UPDATE `" . MODULE_DB_PREFIX . "PlayLists` SET `Order`=`Order`+" . $iFilesCount . " WHERE `Owner` = '" . $sId . "'");
        for ($i = 0; $i < $iFilesCount; $i++) {
            getResult("INSERT INTO `" . MODULE_DB_PREFIX . "PlayLists` VALUES('" . $aFiles[$i] . "', '" . $sId . "', '" . ($i + 1) . "')");
        }
        $sContents = parseXml($aXmlTemplates['result'], TRUE_VAL);
        break;
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:actions.inc.php

示例8: move_uploaded_file

         move_uploaded_file($_FILES['Filedata']['tmp_name'], $sFilePath);
         @chmod($sFilePath, 0644);
     }
     break;
 case 'initFile':
     $sFilePath = $sFilesPath . $sSender . ".temp";
     $sContents = parseXml($aXmlTemplates['result'], "msgErrorUpload", FAILED_VAL);
     if (empty($sSender) || !file_exists($sFilePath) || filesize($sFilePath) == 0) {
         break;
     }
     getResult("INSERT INTO `" . MODULE_DB_PREFIX . "Messages`(`Sender`, `Recipient`, `Message`, `Type`, `When`) VALUES('" . $sSender . "', '" . $sRcp . "', '" . $sMessage . "', 'file', '" . time() . "')");
     $sFileName = getLastInsertId() . ".file";
     if (!@rename($sFilePath, $sFilesPath . $sFileName)) {
         break;
     }
     $sContents = parseXml($aXmlTemplates['result'], $sFileName, SUCCESS_VAL);
     break;
 case 'removeFile':
     $sId = str_replace(".file", "", $sId);
     removeFile($sId);
     break;
 case 'help':
     $sApp = isset($_REQUEST['app']) ? $_REQUEST['app'] : "user";
     $sContents = makeGroup("", "topics");
     $sFileName = $sModulesPath . $sModule . "/help/" . $sApp . ".xml";
     if (file_exists($sFileName)) {
         $rHandle = @fopen($sFileName, "rt");
         $sContents = @fread($rHandle, filesize($sFileName));
         fclose($rHandle);
     }
     break;
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:actions.inc.php

示例9: parseXml

 case 'adminAuthorize':
     $sContents .= parseXml($aXmlTemplates['result'], loginAdmin($sNick, $sPassword));
     break;
     /**
      * Search user by ID or by Nick.
      */
 /**
  * Search user by ID or by Nick.
  */
 case 'searchUser':
     $sId = searchUser($sParamValue, $sParamName);
     //--- if such user exists, than print his info ---//
     if (!empty($sId)) {
         $sContents = parseXml($aXmlTemplates['result'], $sId, SUCCESS_VAL);
     } else {
         $sContents = parseXml($aXmlTemplates['result'], "User not found", FAILED_VAL);
     }
     break;
 case 'stat':
     $iApproved = isset($_REQUEST['approved']) ? $_REQUEST['approved'] : 0;
     $iPending = isset($_REQUEST['pending']) ? $_REQUEST['pending'] : 0;
     getResult("UPDATE `" . MODULE_DB_PREFIX . "Stats` SET `Approved`='" . $iApproved . "', `Pending`='" . $iPending . "' WHERE `User`='' LIMIT 1");
     break;
 case 'userStat':
     $aApproved = isset($_REQUEST['approved']) ? explode(",", $_REQUEST['approved']) : array();
     $aPending = isset($_REQUEST['pending']) ? explode(",", $_REQUEST['pending']) : array();
     $aUsers = empty($sUserId) ? array() : explode(",", $sUserId);
     for ($i = 0; $i < count($aUsers); $i++) {
         if (empty($aUsers[$i])) {
             continue;
         }
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:actions.inc.php

示例10: createMainFile

/**
 * creates widget's main config file
 * @param sWidget - the name of the widget.
 */
function createMainFile($sWidget)
{
    global $sModulesPath;
    global $aXmlTemplates;
    global $aErrorCodes;
    $bResult = false;
    if (secureCheckWidgetName($sWidget)) {
        require $sModulesPath . $sWidget . "/inc/constants.inc.php";
        $sCode = $aInfo['code'];
        $sContents = parseXml($aXmlTemplates["item"], "status", WIDGET_STATUS_NOT_REGISTERED);
        $sContents .= parseXml($aXmlTemplates["item"], "license", "");
        $sContents .= parseXml($aXmlTemplates["item"], "code", $sCode);
        $sContents .= parseXml($aXmlTemplates["item"], "updated", TRUE_VAL);
        $sContents .= parseXml($aXmlTemplates["item"], "updateLast", "");
        $sContents .= parseXml($aXmlTemplates["item"], "updateUrl", "");
        $sContents = makeGroup($sContents, "items");
        //--- Save changes to the file---//
        $sFile = $sWidget . "/xml/main.xml";
        $sFileName = $sModulesPath . $sFile;
        if (($rHandle = @fopen($sFileName, "wt")) !== false) {
            $bResult = fwrite($rHandle, $sContents) !== false;
            fclose($rHandle);
        }
        $bResult = $bResult && $rHandle;
        $sValue = $bResult ? "" : getError($aErrorCodes[2], $sFile);
    } else {
        $sValue = $aErrorCodes[8];
    }
    return array('value' => $sValue, 'status' => $bResult ? SUCCESS_VAL : FAILED_VAL);
}
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:34,代码来源:functions.inc.php

示例11: getCalendarDataAsXmlFromXml

function getCalendarDataAsXmlFromXml($xml)
{
    /* <calendar>
     *   <id>1658</id>
     *   <startdate>0</startdate>
     *   <enddate>1440</enddate>
     * <calendar>
     */
    $a = parseXml($xml)[0];
    $boundsexists = isset($a->startdate) && isset($a->enddate);
    if ($boundsexists) {
        return getCalendarDataAsXml($a->id, $a->startdate, $a->enddate);
    } else {
        return getCalendarDataAsXml($a->id, null, null);
    }
}
开发者ID:nolanshah,项目名称:webcal,代码行数:16,代码来源:api.php

示例12: parseXml

                }
            }
            $sContents = parseXml($aXmlTemplates['result'], SUCCESS_VAL, $sCode, $aContents['license']);
        } else {
            $sContents = parseXml($aXmlTemplates['result'], $aResult['value'], FAILED_VAL);
        }
        break;
        /**
         * Gets widget status and ads banner if it's paid
         */
    /**
     * Gets widget status and ads banner if it's paid
     */
    case 'getWidgetAds':
        $sFooter = getParam("enable_dolphin_footer");
        $bPaid = empty($sFooter);
        $sEnabled = $bPaid ? TRUE_VAL : FALSE_VAL;
        if ($bPaid) {
            $sBannerUrl = getSettingValue(GLOBAL_MODULE, "bannerUrl");
            $sBannerLink = getSettingValue(GLOBAL_MODULE, "bannerLink");
            $sBannerTarget = getSettingValue(GLOBAL_MODULE, "bannerTarget");
            $iBannerAlpha = getSettingValue(GLOBAL_MODULE, "bannerAlpha");
            if (!is_numeric($iBannerAlpha) || $iBannerAlpha < 0 || $iBannerAlpha > 100) {
                $iBannerAlpha = 100;
            }
            $sContents = parseXml($aXmlTemplates['ads'], $sEnabled, $sBannerUrl, $sBannerLink, $sBannerTarget, $iBannerAlpha);
        } else {
            $sContents = parseXml($aXmlTemplates['ads'], $sEnabled);
        }
        break;
}
开发者ID:Gotgot59,项目名称:dolphin.pro,代码行数:31,代码来源:actions.inc.php

示例13: getFileContents

        break;
        /**
         * Gets widget code.
         */
    /**
     * Gets widget code.
     */
    case 'getWidgetCode':
        $aResult = getFileContents($sWidget, "/xml/main.xml", true);
        if ($aResult['status'] == SUCCESS_VAL) {
            $aContents = $aResult['contents'];
            $sCode = $aContents['code'];
            if (empty($sCode)) {
                require_once $sModulesPath . $sWidget . "/inc/constants.inc.php";
                $sCode = $aInfo['code'];
            }
            $sContents = parseXml($aXmlTemplates['result'], SUCCESS_VAL, $sCode, $aContents['license']);
        } else {
            $sContents = parseXml($aXmlTemplates['result'], $aResult['value'], FAILED_VAL);
        }
        break;
        /**
         * update user's online status
         */
    /**
     * update user's online status
     */
    case 'updateOnlineStatus':
        updateOnline($sId);
        break;
}
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:actions.inc.php

示例14: processDataFromMoysklad

function processDataFromMoysklad($userDate)
{
    $orderUrl = "CustomerOrder";
    $goodUrl = "Good";
    $serviceUrl = "Service";
    $courierUrl = "Employee";
    $warehouseUrl = "Warehouse";
    // Getting data from Moysklad
    $courierData = getXmlFromMoysklad($courierUrl, "");
    $goodData = getXmlFromMoysklad($goodUrl, "");
    $serviceData = getXmlFromMoysklad($serviceUrl, "");
    $warehouseData = getXmlFromMoysklad($warehouseUrl, "");
    $date = new DateTime($userDate, new DateTimeZone("Europe/Moscow"));
    $filterTimeTomorrow = (int) $date->format("Ymd");
    $date = new DateTime($userDate . "+1 day", new DateTimeZone("Europe/Moscow"));
    $filterTimeAfterTomorrow = (int) $date->format("Ymd");
    $filterOrderString = urlencode("deliveryPlannedMoment>" . $filterTimeTomorrow . "040000;" . "deliveryPlannedMoment<" . $filterTimeAfterTomorrow . "040000");
    $orderData = getXmlFromMoysklad($orderUrl, "?filter=" . $filterOrderString);
    // Parsing XML
    try {
        $goodXml = new SimpleXmlElement($goodData);
    } catch (Exception $e) {
        echo "Возникла ошибка при загрузке данных о товарах с Moysklad. Пожалуйста, попробуйте еще раз.";
        return;
    }
    $goodArray = parseXml($goodXml, "good");
    $GLOBALS["goodArray"] = $goodArray;
    try {
        $serviceXml = new SimpleXmlElement($serviceData);
    } catch (Exception $e) {
        echo "Возникла ошибка при загрузке данных об услугах с Moysklad. Пожалуйста, попробуйте еще раз.";
        return;
    }
    $serviceArray = parseXml($serviceXml, "service");
    $GLOBALS["serviceArray"] = $serviceArray;
    try {
        $orderXml = new SimpleXmlElement($orderData);
    } catch (Exception $e) {
        echo "Возникла ошибка при загрузке данных о заказах покупателей с Moysklad. Пожалуйста, попробуйте еще раз.";
        return;
    }
    $orderArray = parseXml($orderXml, "customerOrder");
    $GLOBALS["orderArray"] = $orderArray;
    try {
        $warehouseXml = new SimpleXMLElement($warehouseData);
    } catch (Exception $e) {
        echo "Возникла ошибка при загрузке данных о складах с Moysklad. Пожалуйста, попробуйте еще раз.";
        return;
    }
    $warehouseArray = parseXml($warehouseXml, "warehouse");
    $GLOBALS["warehouseArray"] = $warehouseArray;
    try {
        $courierXml = new SimpleXmlElement($courierData);
    } catch (Exception $e) {
        echo "Возникла ошибка при загрузке данных по курьерам с Moysklad. Пожалуйста, попробуйте еще раз.";
        return;
    }
    $courierArray = parseXml($courierXml, "courier");
    $GLOBALS["courierArray"] = $courierArray;
}
开发者ID:DmitryLyange,项目名称:Delivery-Management-Program,代码行数:60,代码来源:main_script.php

示例15: getOnline

  * Update online user's information.
  * @param online - currently online users, whose info was got earlier.
  */
 case "updateOnlineUsers":
     $aCurDbOnline = getOnline();
     $aCurProgOnline = empty($_REQUEST['online']) ? array() : explode(",", $_REQUEST['online']);
     //--- Get new online users ---//
     $aNewOnline = array_diff($aCurDbOnline, $aCurProgOnline);
     foreach ($aNewOnline as $iNewOnline) {
         $aUserInfo = getUserInfo($iNewOnline);
         $sContents .= parseXml($aXmlTemplates['user'], $iNewOnline, $aUserInfo['nick'], $aUserInfo['sex'], $aUserInfo['age'], TRUE_VAL, $aUserInfo['photo'], $aUserInfo['profile']);
     }
     //--- Get new offline users ---//
     $aNewOffline = array_diff($aCurProgOnline, $aCurDbOnline);
     foreach ($aNewOffline as $iNewOffline) {
         $sContents .= parseXml($aXmlTemplates['user'], $iNewOffline, FALSE_VAL);
     }
     $sContents = makeGroup($sContents, "users");
     break;
     /**
      * Updates user's information in RayPresenceUsers table.
      * For Users, who didn't login into Ray Presence, but logged in into site.
      * @param id - user's ID.
      * @param status - user's status.
      */
 /**
  * Updates user's information in RayPresenceUsers table.
  * For Users, who didn't login into Ray Presence, but logged in into site.
  * @param id - user's ID.
  * @param status - user's status.
  */
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:actions.inc.php


注:本文中的parseXml函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。