Fetch statistics data by pageId.

@param int $pageId
@param int $beginTime (Unix timestamp)
@param int $endTime   (Unix timestamp)

@return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string
334233
public function pageSummary(int $pageId, int $beginTime, int $endTime)
    {
        $params = [
            'page_id' => $pageId,
            'begin_date' => $beginTime,
            'end_date' => $endTime,
        ];

        return $this->httpPostJson('shakearound/statistics/page', $params);
    }
342652
public function getTimeEntries($startdate = null, $enddate = null)
    {
        if (empty($startdate)) {
            $startdate = date('Y-m-d', time() - 86400);
        }
        if (empty($enddate)) {
            $enddate = $startdate;
        }
        $this->uri = 'https://toggl.com/reports/api/v2/details?user_agent=' . $this->user_agent . '&since=' . $startdate . '&until=' . $enddate . '&workspace_id=' . $this->workspace_id;

        $data = null;
        
        $response = $this->processRequest($data, self::GET);
        $this->_handleError($data, $response);
        $toggl_entries = $this->processTogglResponse($response);
        $timeEntries = [];
        foreach ($toggl_entries as $entry) {
            $te = new TimeEntry(
                $this,
                $entry->id,
                $entry->client,
                $entry->project,
                $entry->description
            );
            $te->setEntryDate(date('Y-m-d', strtotime($entry->start)));
            $te->setDurationTime($entry->dur);
            $te->setTask($entry->task);
            $te->setDescription($entry->description);
            $te->processTags($entry->tags);
            $te->setBillable($entry->is_billable);
            $timeEntries[] = $te;
        }
        return $timeEntries;
    }
108501
public function getPageItemChangedTimeByPageUid(int $pageUid)
    {
        $queryBuilder = $this->getQueryBuilder();
        $queryBuilder->getRestrictions()->removeAll();
        $pageContentLastChangedTime = $queryBuilder
            ->add('select', $queryBuilder->expr()->max('tstamp', 'changed_time'))
            ->from('tt_content')
            ->where(
                $queryBuilder->expr()->eq('pid', $pageUid)
            )
            ->execute()->fetch();

        return $pageContentLastChangedTime['changed_time'];
    }
1196746
public static function fromString($startTime, $endTime)
    {
        return new self(Time::fromString($startTime), Time::fromString($endTime));
    }
392463
public function get($blogId, $pageId, $optParams = array()) {
      $params = array('blogId' => $blogId, 'pageId' => $pageId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('get', array($params));
      if ($this->useObjects()) {
        return new Page($data);
      } else {
        return $data;
      }
    }
837405
public function getParentByPageId($pageId)
    {
        $data = array();
        $success = 0;

        $treeSite = $this->getServiceLocator()->get('MelisSiteTree');

        if($treeSite){
            $data  = $treeSite->getParentByPageId($pageId);
        }


        return $data;
    }
533029
public function links($adzone_id, $start_time, $end_time) {
        $res = $this->getSearch()
            ->parameters(compact('adzone_id', 'start_time', 'end_time'))->text();
        return $res['results']['results'];
    }
758788
protected function actionBasedOnEndDate(DateTimeImmutable $endDateTime, $executionId)
    {
        try {
            $deliveryExecution = $this->getServiceProxy()->getDeliveryExecution($executionId);
            $lastInteraction   = $this->getLastInteractionDateTime($deliveryExecution);

            if ($lastInteraction === null){
                $this->report->add(Report::createFailure('Execution last interaction cannot be found: '. $executionId));
                return false;
            }

            if (new DateTimeImmutable('now') >= $endDateTime) {
                $this->action($deliveryExecution, $executionId, true);
                return true;
            }

            $this->report->add(Report::createInfo('Execution not expired yet:'. $executionId .
                ' Last Interaction:'.$lastInteraction->format('Y-m-d H:i:s') .
                ' Time when will expire:'.$endDateTime->format('Y-m-d H:i:s')
            ));

        } catch (\common_exception_NotFound $e) {
            $this->report->add(Report::createFailure('Execution cannot be found: '. $executionId));
            $this->report->add(Report::createFailure($e->getMessage()));
        }

        return false;
    }
195902
private function getInvoices(DateTime $startDate, DateTime $endDate)
    {
        $offset = Mirakl::MIRAKL_API_MAX_PAGINATE;

        $invoicesData = $this->mirakl->getInvoices(
            $startDate,
            $endDate
        );

        $invoices = array_merge(array(), $invoicesData['invoices']);

        $total = $invoicesData['total_count'];

        while ($total % $offset !== $total) {

            $invoicesData = $this->mirakl->getInvoices(
                $startDate,
                $endDate,
                Mirakl::MIRAKL_API_MAX_PAGINATE,
                $offset
            );

            $invoices = array_merge($invoices, $invoicesData['invoices']);

            $offset += Mirakl::MIRAKL_API_MAX_PAGINATE;
        }

        return $invoices;
    }
976369
protected function get_student_activities($sampleid, $tablename, $starttime, $endtime) {

        // May not be available.
        $user = $this->retrieve('user', $sampleid);

        if ($this->course === null) {
            // The indicator scope is a range, so all activities belong to the same course.
            $this->course = \core_analytics\course::instance($this->retrieve('course', $sampleid));
        }

        if ($this->activitylogs === null) {
            // Fetch all activity logs in each activity in the course, not restricted to a specific sample so we can cache it.

            $courseactivities = $this->course->get_all_activities($this->get_activity_type());

            // Null if no activities of this type in this course.
            if (empty($courseactivities)) {
                $this->activitylogs = false;
                return null;
            }
            $this->activitylogs = $this->fetch_activity_logs($courseactivities, $starttime, $endtime);
        }

        if ($this->grades === null) {
            // Even if this is probably already filled during fill_per_analysable_caches.
            $this->fetch_student_grades($this->course);
        }

        if ($cm = $this->retrieve('cm', $sampleid)) {
            // Samples are at cm level or below.
            $useractivities = array(\context_module::instance($cm->id)->id => $cm);
        } else {
            // Activities that should be completed during this time period.
            $useractivities = $this->get_activities($starttime, $endtime, $user);
        }

        return $useractivities;
    }
242953
public static function getChildPageIds($pageId)
    {
        if (empty(self::$preloaded_page_children)) {
            foreach (static::preloadArray() as $key => $page) {
                if (!isset(self::$preloaded_page_children[$page->parent])) {
                    self::$preloaded_page_children[$page->parent] = [];
                }
                self::$preloaded_page_children[$page->parent][] = $page->id;
            }
        }
        return !empty(self::$preloaded_page_children[$pageId]) ? self::$preloaded_page_children[$pageId] : [];
    }
1236836
public function getApprovalData(int $startTime, int $endTime, int $nextSPNum = 0): array
    {
        $json = [
            'starttime' => $startTime,
            'endtime' => $endTime
        ];

        if ($nextSPNum > 0) {
            $json['next_spnum'] = $nextSPNum;
        }

        return $this->httpClient->postJson('corp/getapprovaldata', $json);
    }
668562
public function getEvents(\DateTime $begin, \DateTime $end, array $options = array())
    {
        return $this->getEventsQuery($begin, $end, $options)->getResult();
    }
672569
public function findSnapshotByPageId($pageId)
    {
        $qb = $this->createQueryBuilder('ps')
            ->where('ps.page = :pageId')
            ->orderBy('ps.version', 'desc')
            ->setParameter(':pageId', $pageId);

        return $qb->getQuery()->execute();
    }
338733
protected function fetch_activity_logs($activities, $starttime = false, $endtime = false) {
        global $DB;

        // Filter by context to use the db table index.
        list($contextsql, $contextparams) = $DB->get_in_or_equal(array_keys($activities), SQL_PARAMS_NAMED);
        $select = "contextid $contextsql AND timecreated > :starttime AND timecreated <= :endtime";
        $params = $contextparams + array('starttime' => $starttime, 'endtime' => $endtime);

        // Pity that we need to pass through logging readers API when most of the people just uses the standard one.
        if (!$logstore = \core_analytics\manager::get_analytics_logstore()) {
            throw new \coding_exception('No log store available');
        }
        $events = $logstore->get_events_select_iterator($select, $params, 'timecreated ASC', 0, 0);

        // Returs the logs organised by contextid, userid and eventname so it is easier to calculate activities data later.
        // At the same time we want to keep this array reasonably "not-massive".
        $processedevents = array();
        foreach ($events as $event) {
            if (!isset($processedevents[$event->contextid])) {
                $processedevents[$event->contextid] = array();
            }
            if (!isset($processedevents[$event->contextid][$event->userid])) {
                $processedevents[$event->contextid][$event->userid] = array();
            }

            // Contextid and userid have already been used to index the events, the next field to index by is eventname:
            // crud is unique per eventname, courseid is the same for all records and we append timecreated.
            if (!isset($processedevents[$event->contextid][$event->userid][$event->eventname])) {

                // Remove all data that can change between events of the same type.
                $data = (object)$event->get_data();
                unset($data->id);
                unset($data->anonymous);
                unset($data->relateduserid);
                unset($data->other);
                unset($data->origin);
                unset($data->ip);
                $processedevents[$event->contextid][$event->userid][$event->eventname] = $data;
                // We want timecreated attribute to be an array containing all user access times.
                $processedevents[$event->contextid][$event->userid][$event->eventname]->timecreated = array();
            }

            // Add the event timecreated.
            $processedevents[$event->contextid][$event->userid][$event->eventname]->timecreated[] = intval($event->timecreated);
        }
        $events->close();

        return $processedevents;
    }
32661
public function getApprovalData($startTime, $endTime, $nextSpNum = null)
    {
        $params = [
            'starttime'  => $startTime,
            'endtime'    => $endTime,
            'next_spnum' => $nextSpNum,
        ];

        return $this->parseJSON('json', [self::API_APPROVAL_DATA, $params]);
    }
1244915
public function getWeanalysisAppidDailySummarytrend($begin_date, $end_date)
    {
        $url = 'https://api.weixin.qq.com/datacube/getweanalysisappiddailysummarytrend?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->callPostApi($url, ['begin_date' => $begin_date, 'end_date' => $end_date], true);
    }