Get PDF link to location schedule.

@param int $location
Location ID.
@param int|bool $timestamp
Timestamp.
@param int|bool $category
Category.

@return \Drupal\Core\Url
Link.
195768
public function getPdfLink($location, $timestamp = FALSE, $category = FALSE) {
    $account = $this->configFactory->get('openy_group_schedules.settings')->get('account_id');
    $query = [
      'font' => 'larger',
      'account' => $account,
      'l' => $location,
    ];

    if ($timestamp) {
      $query['week'] = strtotime('Monday this week', $timestamp);
    }

    if ($category) {
      $query['c'] = $category;
    }

    return Url::fromUri(self::PRINT_URI, ['query' => $query]);
  }
1256177
private function generateCategoryData(NewsCategoryModel $category, Module $module)
    {
        $data = $category->row();

        $data['model'] = $category;
        $data['name'] = $category->getTitle();
        $data['class'] = $category->getCssClass();
        $data['href'] = '';
        $data['hrefWithParam'] = '';
        $data['targetPage'] = null;

        /** @var StringUtil $stringUtilAdapter */
        $stringUtilAdapter = $this->framework->getAdapter(StringUtil::class);
        $data['linkTitle'] = $stringUtilAdapter->specialchars($data['name']);

        /** @var PageModel $pageAdapter */
        $pageAdapter = $this->framework->getAdapter(PageModel::class);

        // Overwrite the category links with filter page set in module
        if ($module->news_categoryFilterPage && null !== ($targetPage = $pageAdapter->findPublishedById($module->news_categoryFilterPage))) {
            $data['href'] = $this->manager->generateUrl($category, $targetPage);
            $data['hrefWithParam'] = $data['href'];
            $data['targetPage'] = $targetPage;
        } elseif (null !== ($targetPage = $this->manager->getTargetPage($category))) {
            // Add the category target page and URLs
            $data['href'] = $targetPage->getFrontendUrl();
            $data['hrefWithParam'] = $this->manager->generateUrl($category, $targetPage);
            $data['targetPage'] = $targetPage;
        }

        // Register a function to generate category URL manually
        $data['generateUrl'] = function (PageModel $page, $absolute = false) use ($category) {
            return $this->manager->generateUrl($category, $page, $absolute);
        };

        // Add the image
        if (null !== ($image = $this->manager->getImage($category))) {
            /** @var Controller $controllerAdapter */
            $controllerAdapter = $this->framework->getAdapter(Controller::class);
            $data['image'] = new \stdClass();
            $controllerAdapter->addImageToTemplate($data['image'], ['singleSRC' => $image->path, 'size' => $module->news_categoryImgSize]);
        } else {
            $data['image'] = null;
        }

        return $data;
    }
1371418
protected function getJql($timestamp)
    {
        if (!isset($timestamp)) {
            return $this->jql;
        }

        return $this->jql . " AND updated > '" . date('Y-m-d H:i', $timestamp) . "'";
    }
858142
private static function _timestampToUTC($timestamp)
    {
        $tz = new DateTimeZone('UTC');
        $dateTime = new DateTime($timestamp, $tz);
        $dateTime->setTimezone($tz);
        return $dateTime;
    }
924013
private function fetchUrl($location, array $options = [])
    {
        $uri = null;
        foreach ($this->transformers as $transformer) {
            $this->setContext($transformer);
            $object = $transformer->transform($location, $options);
            if ($object instanceof UriInterface) {
                $uri = $object;
                break;
            }
        }
        return $uri;
    }
1005136
public function getJsSign($url, $timestamp = 0, $noncestr = '', $appid = '', $access_token = '')
    {
        if (!$this->jsapi_ticket && !$this->getJsTicket($appid, '', $access_token) || empty($url)) {
            return false;
        }
        $data = array(
            "jsapi_ticket" => $this->jsapi_ticket,
            "timestamp"    => empty($timestamp) ? time() : $timestamp,
            "noncestr"     => '' . empty($noncestr) ? Tools::createNoncestr(16) : $noncestr,
            "url"          => trim($url),
        );
        return array(
            "url"       => $url,
            'debug'     => false,
            "appId"     => empty($appid) ? $this->appid : $appid,
            "nonceStr"  => $data['noncestr'],
            "timestamp" => $data['timestamp'],
            "signature" => Tools::getSignature($data, 'sha1'),
            'jsApiList' => array(
                'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone',
                'hideOptionMenu', 'showOptionMenu', 'hideMenuItems', 'showMenuItems', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem',
                'chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'closeWindow', 'scanQRCode', 'chooseWXPay',
                'translateVoice', 'getNetworkType', 'openLocation', 'getLocation',
                'openProductSpecificView', 'addCard', 'chooseCard', 'openCard',
                'startRecord', 'stopRecord', 'onVoiceRecordEnd', 'playVoice', 'pauseVoice', 'stopVoice', 'onVoicePlayEnd', 'uploadVoice', 'downloadVoice',
                'openWXDeviceLib', 'closeWXDeviceLib', 'getWXDeviceInfos', 'sendDataToWXDevice', 'disconnectWXDevice', 'getWXDeviceTicket', 'connectWXDevice',
                'startScanWXDevice', 'stopScanWXDevice', 'onWXDeviceBindStateChange', 'onScanWXDeviceResult', 'onReceiveDataFromWXDevice',
                'onWXDeviceBluetoothStateChange', 'onWXDeviceStateChange'
            )
        );
    }
267198
protected static function getCategoryPageUrl($pageCode, $category, $theme)
    {
        $page = CmsPage::loadCached($theme, $pageCode);
        if (!$page) {
            return;
        }

        $properties = $page->getComponentProperties('blogPosts');
        if (!isset($properties['categoryFilter'])) {
            return;
        }

        /*
         * Extract the routing parameter name from the category filter
         * eg: {{ :someRouteParam }}
         */
        if (!preg_match('/^\{\{([^\}]+)\}\}$/', $properties['categoryFilter'], $matches)) {
            return;
        }

        $paramName = substr(trim($matches[1]), 1);
        $url = CmsPage::url($page->getBaseFileName(), [$paramName => $category->slug]);

        return $url;
    }
429269
public function getURL($start_timestamp = 0, $calendar_guid = 0) {
		if (!$start_timestamp) {
			$start_timestamp = $this->getNextOccurrence();
		}
		$url = parent::getURL();
		return elgg_http_add_url_query_elements($url, array_filter(array(
			'ts' => $start_timestamp,
			'calendar' => $calendar_guid,
		)));
	}
1281296
public function getDay($timestamp = false)
    {
        if (!$timestamp) {
            $timestamp = $this->dateTime->getTimestamp();
        }

        return date('j', $timestamp);
    }
991827
public function entity($entityType, $id, $timestamp)
	{
		$params = array(
			'type_name' => $entityType,
			'id'        => $id,
			'timestamp' => $timestamp,
		);

		return $this->post('versions/entity', $params);
	}
968435
public function getWeek($timestamp = false)
    {
        if (!$timestamp) {
            $timestamp = $this->dateTime->getTimestamp();
        }

        return (int) date('W', $timestamp);
    }
315830
public function getTemporaryUrl($path, DateTimeInterface $expiration, array $options = [])
    {
        $options = array_merge(
            $options,
            ['Scheme' => isset($this->config['scheme']) ? $this->config['scheme'] : 'http']
        );

        $objectUrl = $this->client->getObjectUrl(
            $this->getBucket(), $path, $expiration->format('c'), $options
        );

        return $objectUrl;
    }
267818
public static function getFileUrl($filePath, $addTimestamp = FALSE) {

		if (!file_exists($filePath)) {
			throw new \Exception('File not found at path ' . $filePath);
		}
		
		// check if valid path
		if (FALSE === strpos($filePath, APPLICATION_PATH)) {
			throw new \Exception('File path doesn’t match the application root folder ' . APPLICATION_PATH);
		}
		
		// BASE_HREF has trailing slash
		$url = BASE_HREF . substr($filePath, strlen(APPLICATION_PATH)+1);
			
		if ($addTimestamp) {
			$timestamp = filemtime($filePath);
			// check if valid timestamp
			if (FALSE == $timestamp) {
				throw new \Exception('File last change timestamp failed for ' . $filePath);
			}
			$url .= '?' . $timestamp;
		}
		
		return $url;

	}
143953
public function getDocumentListEntry($location = null)
    {
        if ($location === null) {
            require_once 'Zend/Gdata/App/InvalidArgumentException.php';
            throw new Zend_Gdata_App_InvalidArgumentException(
                    'Location must not be null'
            );
        } else if ($location instanceof Zend_Gdata_Query) {
            $uri = $location->getQueryUrl();
        } else {
            $uri = $location;
        }
        return parent::getEntry($uri, 'Zend_Gdata_Docs_DocumentListEntry');
    }
183238
public static function get_calendar_upcoming_view($courseid, $categoryid) {
        global $DB, $USER, $PAGE;

        // Parameter validation.
        $params = self::validate_parameters(self::get_calendar_upcoming_view_parameters(), [
            'courseid' => $courseid,
            'categoryid' => $categoryid,
        ]);

        $context = \context_user::instance($USER->id);
        self::validate_context($context);
        $PAGE->set_url('/calendar/');

        $calendar = \calendar_information::create(time(), $params['courseid'], $params['categoryid']);
        self::validate_context($calendar->context);

        list($data, $template) = calendar_get_view($calendar, 'upcoming');

        return $data;
    }
634893
public function link($timestamp=true)
	{
		$output = $this->targetPath();

		if (!$output)
		{
			return $output;
		}

		if ($this->isExternal())
		{
			return $output;
		}

		if ($this->extensionType() == 'system')
		{
			$relative = rtrim(str_replace('/administrator', '', \Request::base(true)), '/') . substr($output, strlen(PATH_ROOT));
		}
		else
		{
			if (strpos($output, PATH_ROOT) === 0)
			{
				$relative = rtrim(\Request::root(true), '/') . rtrim(substr($output, strlen(PATH_ROOT)), '/');
			}
			else if (strpos($output, PATH_CORE) === 0)
			{
				$relative = rtrim(\Request::root(true), '/') . "/core/" . rtrim(substr($output, strlen(PATH_CORE)), '/');
			}
		}

		return $relative . ($timestamp ? '?v=' . $this->lastModified() : '');
	}
986055
public function setScheduledLink(TimelineLinkEvent $event): void
    {
        $action = $event->getAction();

        if ('scheduled' != $action->getVerb()) {
            return;
        }

        $production = $action->getComponent('indirectComplement')->getData();
        $schedule = $action->getComponent('directComplement')->getData();
        $event->setLink($this->url_generator->generate('bkstg_schedule_read', [
            'id' => $schedule->getId(),
            'production_slug' => $production->getSlug(),
        ]));
    }