listTimecardEvents

ListTimecardEvents

@param string $timecard_id The ID of the timecard to list events for. (required)
@return \SquareConnect\Model\V1TimecardEvent[]
@throws \SquareConnect\ApiException on non-2xx response
333244
public function listTimecardEvents($timecard_id)
    {
        list($response, $statusCode, $httpHeader) = $this->listTimecardEventsWithHttpInfo ($timecard_id);
        return $response; 
    }
46088
def remove_all_events(self, calendar_id):
        ''''''
        # todo: incomplete

        now = datetime.now(tz=self.timezone) # timezone?
        start_time = datetime(year=now.year - 1, month=now.month, day=now.day, hour=now.hour, minute=now.minute, second=now.second, tzinfo=self.timezone)
        end_time = datetime(year=now.year + 1, month=now.month, day=now.day, hour=now.hour, minute=now.minute, second=now.second, tzinfo=self.timezone)
        start_time = start_time.isoformat()
        end_time = end_time.isoformat()


        #events = self.service.events().list(calendarId = self.configured_calendar_ids[calendar_id], showDeleted = False).execute()
        events = self.service.events().list(calendarId = self.configured_calendar_ids[calendar_id], timeMin = start_time, timeMax = end_time, showDeleted = False).execute()

        print(len(events['items']))

        for event in events['items']:
            dt = None
            nb = DeepNonStrictNestedBunch(event)
            #print(event)
            if (nb.summary or nb.description or '').find('presentation') != -1:
                print(nb.id)
                print(nb.summary or nb.description)
                print(nb.start)
111312
public static function findAll($page_request = null)
    {
        if($page_request != null){
            return self::listAllCreditCardPayments(['page' => $page_request->getPageNumber(), 'size' => $page_request->getSize() ]);
        }else {
            return self::listAllCreditCardPayments();
        }
    }
212726
public function getCardList()
    {
        if ($this->_oCards === null) {
            $this->_oCards = new \OxidEsales\Eshop\Core\Model\ListModel();

            // load gift cards
            if ($this->getViewConfig()->getShowGiftWrapping()) {
                $this->_oCards = oxNew(\OxidEsales\Eshop\Application\Model\Wrapping::class)->getWrappingList('CARD');
            }
        }

        return $this->_oCards;
    }
758300
public function updateCard($card_id, array $member_card)
    {
        $url = "https://api.weixin.qq.com/card/update?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['card_id' => $card_id, 'member_card' => $member_card]);
    }
1366324
public function deleteTimecard($timecard_id)
    {
        list($response, $statusCode, $httpHeader) = $this->deleteTimecardWithHttpInfo ($timecard_id);
        return $response; 
    }
875067
public function listEventsAction()
    {
        $this->checkStaticTemplateIsIncluded();
        $this->checkSettings();

        $this->slotExtendedAssignMultiple([
            self::VIEW_VARIABLE_ASSOCIATION_ID => $this->settings[self::SETTINGS_ASSOCIATION_ID],
            self::VIEW_VARIABLE_FILTER => $this->getEventsFilter()
        ], __CLASS__, __FUNCTION__);

        return $this->view->render();
    }
91531
final protected function cards() {
		$r = []; /** @var array(string => string) $r */
		$m = $this->m(); /** @var Method $m */
		/**
		 * 2017-07-28
		 * The `$m instanceof Method` check is for the «Square» module:
		 * its server part does not use the Df_StripeClone module, but the client part does use it.
		 * So we need this the `$m instanceof Method` check to evade the error:
		 * «Cannot instantiate abstract class Df\StripeClone\Facade\Customer
		 * in mage2pro/core/Payment/Facade.php:88»: https://github.com/mage2pro/square/issues/2
		 * 
		 * 2018-11-13
		 * Currently, in all modules except one (TBCBank) $customerData is just a customer identifier (a string).
		 * But out framework supports $customerData of artibutrary structure, and the TBCBank module uses it:
		 * $data has the following structure there:
		 *	{
		 *		"4349958401": {
		 *			"CARD_NUMBER": "5***********1223",
		 *			"RECC_PMNT_EXPIRY": "1019"
		 *		},
		 *		"1779958449": {
		 *			"CARD_NUMBER": "4***********3333",
		 *			"RECC_PMNT_EXPIRY": "1120"
		 *		}
		 *	}
		 * The top-level keys are bank card tokens there, 
		 * and their values form the corresponding bank card labels.
		 * So the TBCBank module (unlike the rest modules) does not do any API requests
		 * to retrieve a customer's saved cards.
		 */
		/** @var string|null|array(string => mixed) $customerData */
		if ($m instanceof Method && ($customerData = df_ci_get($this->m()))) {
			$this->s()->init();
			$fc = FCustomer::s($m); /** @var FCustomer $fc */
			// 2018-11-14 $customer is an array for TBCBank: it is the same as $customerData (see above).
			if (!($customer = $fc->get($customerData))/** @var object|array(string => mixed) $customer */) {
				// 2017-02-24
				// We could be here, for example, if the store's administrator has changed
				// his Stripe account in the module's settings: https://mage2.pro/t/3337
				df_ci_save($this->m(), null);
			}
			else {
				$r = array_map(function(Card $c) use($m) {
					/**
					 * 2017-07-24
					 * Unfortunately, the one-liner fails on PHP 5.6.30:
					 * return ['id' => $c->id(), 'label' => (CF::s($m, $c))->label()];
					 * «syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ']'»
					 * https://github.com/mage2pro/core/issues/16
					 * See also: https://github.com/mage2pro/core/issues/15
					 *
					 * 2017-07-31
					 * Interestingly, the following code works on all PHP versions >= 5.4.0:
					 * class A {function f() {return __METHOD__;}
					 * echo (new A)->f();
					 * https://3v4l.org/nANqg
					 *
					 * The following code works on all PHP versions >= 5.0.0:
					 *	class A {
					 *		function f() {return __METHOD__;}
					 *		static function s() {return new self;}
					 *	}
					 *	echo A::s()->f();
					 * https://3v4l.org/1qr48
					 *
					 * The same is true for the following code:
					 *	class A {
					 *		function f() {return $this->_v;}
					 *		final protected function __construct($v) {$this->_v = $v;}
					 *		private $_v;
					 *		final static function s($v) {return new self($v);}
					 *	}
					 *	echo A::s('test')->f();
					 * https://3v4l.org/2E8H6
					 *
					 * So, I was unable to reproduce the issue...
					 * Maybe the problem customer uses a non-standard (patched) PHP version?
					 *
					 * 2017-11-08
					 * Note 1.
					 * One-liners like (!($e = $a->e())->b()) are really not supported by PHP < 7:
					 * https://3v4l.org/lJjvS
					 * Note 2.
					 * At the same time, some `))->` one-liners are supported by PHP >= 5.4, e.g:
					 * static function p() {return (new self())->b();}
					 * https://3v4l.org/LJlDE
					 * Note 3.
					 * If we add extra brackets to the code from the Note 2,
					 * then the code will be incompatible with PHP < 7:
					 * static function p() {return ((new self()))->b();}
					 */
					$cf = CF::s($m, $c); /** @var CF $cf */
					return ['id' => $c->id(), 'label' => $cf->label()];
				}, $fc->cardsActive($customer));
			}
		}
		// 2018-11-14
		// It is important, because otherwise this.cards.length will return `undefined` on frontend:
		// https://github.com/mage2pro/core/blob/3.11.1/Payment/view/frontend/web/card.js#L207
		return array_values($r);
	}
642448
public synchronized EventData[] getEvents(int event_type) {
        ArrayList<EventData> v = new ArrayList<EventData>();
        for (EventData event : events)
            if (event.event_type == event_type)
                v.add(event);
        EventData[] periodic = new EventData[v.size()];
        for (int i = 0; i < v.size(); i++) {
            periodic[i] = v.get(i);
            events.remove(v.get(i));
        }
        return periodic;
    }
415770
private function getTimeZoneList(): array
    {
        if (count($this->timeZoneList) === 0) {
            $this->timeZoneList = DateTimeUtils::getTimeZoneList();
        }

        return $this->timeZoneList;
    }
219582
public function sendWxcardByOpenid(array $toUsers, $card_id, array $card_ext = array())
    {
        $ret = array();
        $ret['touser'] = $toUsers;
        $ret['msgtype'] = 'wxcard';
        $ret['wxcard']['card_id'] = $card_id;
        if (! empty($card_ext)) {
            $ret['wxcard']['card_ext'] = json_encode($card_ext);
        }
        return $this->send($ret);
    }
615171
public function getEventInfo(?string $id = null, ?EntityInterface $calendar = null)
    {
        $result = [];

        if (empty($id)) {
            return $result;
        }

        $options = $this->getRecurrenceEventId($id);

        /** @var \Cake\ORM\Query $query */
        $query = $this->find()
                ->where(['id' => $options['id']])
                ->contain(['CalendarAttendees']);
        $result = $query->first();

        if (!($result instanceof EntityInterface)) {
            return [];
        }

        //@NOTE: we're faking the start/end intervals for recurring events
        if (!empty($options['end'])) {
            $time = Time::parse($options['end']);
            $result->set('end_date', $time);
            $result->set('end', $time);
            unset($time);
        }

        if (!empty($options['start'])) {
            $time = Time::parse($options['start']);
            $result->set('start_date', $time);
            $result->set('start', $time);
            unset($time);
        }

        if ($calendar) {
            if (empty($result->calendar_id)) {
                $result->set('calendar_id', $calendar->id);
            }
        }

        $result->set('color', $this->Calendars->getColor($calendar));

        return $result;
    }
65512
final public function getEventList() {

		$app = Application::getInstance();
		$router = Router::getInstance();
		
		if (!$this->isEnabled()) {
			return NULL;
		}
		
		$sum			= 0;
		$log			= '';

		$apiChrono		= 0;
		$queryChrono	= 0;
		$queryCount		= 0;
		$warningCount	= 0;
		$errorCount		= 0;
		
		$firstError		= FALSE;
		$firstWarning	= FALSE;
		
		// cookie infos
		$showQueries	= isset($_COOKIE['LogShowQueries']) ? (bool)$_COOKIE['LogShowQueries'] : FALSE;
		$showEvents		= isset($_COOKIE['LogShowEvents'])  ? (bool)$_COOKIE['LogShowEvents']  : FALSE;
		
		// create a date in timezone of connected user
		$timeStart = new \DateTime('@' . (int)$this->timeStart, new \DateTimeZone(BASE_TIMEZONE));
		if ($app->currentUser and $app->currentUser->areKeysPopulated()) {
			$timeStart->setTimezone($app->currentUser->getDateTimeZone());
		}
		
		// get memory limit
		$limit = ini_get('memory_limit');
		
		// get number multiplier
		switch (substr($limit,-1)) {
			case 'G': case 'g': $multiplier = 1073741824;	break;
			case 'M': case 'm': $multiplier = 1048576;		break;
			case 'K': case 'k': $multiplier = 1024;			break;
			default:			$multiplier = 1;			break;
		}
			
		// convert string memory limit to integer
		$limit = (int)$limit * $multiplier;
		
		// get current usage and percentual ratio
		$ratio = memory_get_usage() / $limit * 100;
		
		// alert about risk of “out of memory”
		if (($ratio) > 60) {
			$this->addWarning('Memory usage is ' . round($ratio,0) . '% of limit, will reduce logs');			
		}
		
		foreach ($this->events as $e) {

			// update ratio with current memory usage
			$ratio = memory_get_usage() / $limit * 100;

			// prevent out memory errors by adding just warnings and errors
			if ($ratio > 60 and !in_array($e->type, ['warning','error'])) {
				continue;
			}
			
			$eventDomId = '';
			
			switch ($e->type) {
				
				// external API-call counters
				case 'api':
					$apiChrono += $e->chrono;
					break;
			
				// SQL queries counters
				case 'query':
					$queryCount++;
					$queryChrono += $e->chrono;
					break;
			
				// warning counter
				case 'warning':
					$warningCount++;
					if (!$firstWarning) {
						$eventDomId = 'id="logFirstWarning" ';
						$firstWarning = TRUE;
					}
					break;
				
				// error counter
				case 'error':
					$errorCount++;
					if (!$firstError) {
						$eventDomId = 'id="logFirstError" ';
						$firstError = TRUE;
					}
					break;
	
			}

			// if it's query, verifies cookie val
			$class = $e->type . (('query'==$e->type and !$showQueries) ? ' hidden' : '');

			$log .=
				'<div ' . $eventDomId . 'class="' . $class . '">' .
				'<span class="time' . ($e->chrono>1 ? ' slow' : '') . '">' . $this->formatChrono($e->chrono) . '</span> ' .
				htmlspecialchars($e->description) .
				($e->subtext ? ' <span>| ' . htmlspecialchars($e->subtext) . '</span>' : '') . '</div>';

			$sum += $e->chrono;
			
		}
		
		// log header
		$ret = '<div id="log">';
		$ret.= '<div class="head">';
		
		// log date
		$ret.= '<div class="item"><span class="icon fa fa-clock"></span><span class="emph">' . $timeStart->format('Y-m-d H:i:s') . '</span></div>';

		// external api
		$ret.= $apiChrono ? '<div class="item"><span class="icon fa fa-exchange"></span><span class="emph">API ' . $this->formatChrono($apiChrono) . '</span></div>' : '';
		
		// database 
		$ret.= '<div class="item database multi' . ($showQueries ? ' active' : '') . '"><div class="icon fa fa-database"></div><div class="desc"><span class="emph">' . $queryCount .'</span> queries <div class="sub">(' . $this->formatChrono($queryChrono) .')</div></div></div>';
		
		// total time
		$ret.= '<div class="item"><span class="icon fa fa-tachometer-alt"></span><span class="emph">' . $this->formatChrono($sum) .'</span> total</div>';
		
		// memory peak
		$ret.= '<div class="item"><span class="icon fa fa-heartbeat"></span><span class="emph">' . floor(memory_get_peak_usage()/1024/1024) . ' MB</span> memory</div>';

		// warnings
		if ($warningCount) {
			$ret.= '<a href="javascript:;" onclick="document.location.hash=\'logFirstWarning\';" class="item warning"><span class="icon fa fa-exclamation-triangle"></span><span class="emph">' . $warningCount . '</span> ' . ($warningCount>1 ? 'warnings' : 'warning') . '</a>';
		}
		
		// errors
		if ($errorCount) {
			$ret.= '<a href="javascript:;" onclick="document.location.hash=\'logFirstError\';" class="item error"><span class="icon fa fa-times-circle"></span><span class="emph">' . $errorCount . '</span> ' . ($errorCount>1 ? 'errors' : 'error') . '</a>';
		}
		
		// show/hide log button
		if ($showEvents) {
			$ret.= '<div id="logShowEvents" class="item active">Hide <span class="fa fa-caret-up"></span></div>';
		} else {
			$ret.= '<div id="logShowEvents" class="item">Show <span class="fa fa-caret-down"></span></div>';
		}
		
		$ret.= '</div>';
		
		// log content
		$ret.= '<div class="events' . ($showEvents ? '' : ' hidden') . '">' . $log . '</div></div>';
		
		return $ret;
		
	}
588977
public function getEvents()
    {
        if (empty($this->events)) {
            return [];
        }

        $events = call_user_func_array('array_merge', $this->events);

        foreach ($events as &$e) {
            if (!$e['timestamp'] instanceof \DateTime) {
                $dt             = new DateTimeHelper($e['timestamp'], 'Y-m-d H:i:s', 'UTC');
                $e['timestamp'] = $dt->getDateTime();
                unset($dt);
            }
        }

        if (!empty($this->orderBy)) {
            usort(
                $events,
                function ($a, $b) {
                    switch ($this->orderBy[0]) {
                        case 'eventLabel':
                            $aLabel = '';
                            if (isset($a['eventLabel'])) {
                                $aLabel = (is_array($a['eventLabel'])) ? $a['eventLabel']['label'] : $a['eventLabel'];
                            }

                            $bLabel = '';
                            if (isset($b['eventLabel'])) {
                                $bLabel = (is_array($b['eventLabel'])) ? $b['eventLabel']['label'] : $b['eventLabel'];
                            }

                            return strnatcmp($aLabel, $bLabel);

                        case 'date_added':
                            if ($a['timestamp'] == $b['timestamp']) {
                                $aPriority = isset($a['eventPriority']) ? (int) $a['eventPriority'] : 0;
                                $bPriority = isset($b['eventPriority']) ? (int) $b['eventPriority'] : 0;

                                return $aPriority - $bPriority;
                            }

                            return $a['timestamp'] < $b['timestamp'] ? -1 : 1;

                        case 'contact_id':
                            if ($a['contactId'] == $b['contactId']) {
                                return 0;
                            }

                            return $a['contactId'] < $b['contactId'] ? -1 : 1;

                        case 'type':

                            return strnatcmp($a['eventType'], $b['eventType']);

                        default:

                            return strnatcmp($a[$this->orderBy[0]], $b[$this->orderBy[0]]);
                    }
                }
            );

            if ('DESC' == $this->orderBy[1]) {
                $events = array_reverse($events);
            }
        }

        return $events;
    }
89681
protected function baseAttachRecord($id, $timed)
    {
        $record[$this->relatedPivotKey] = $id;

        $record[$this->foreignPivotKey] = $this->parent->{$this->parentKey};

        // If the record needs to have creation and update timestamps, we will make
        // them by calling the parent model's "freshTimestamp" method which will
        // provide us with a fresh timestamp in this model's preferred format.
        if ($timed) {
            $record = $this->addTimestampsToAttachment($record);
        }

        foreach ($this->pivotValues as $value) {
            $record[$value['column']] = $value['value'];
        }

        return $record;
    }
1154628
def list(*args)
      arguments(args, required: [:column_id])
      params = arguments.params

      params["accept"] ||= ::Github::Client::Projects::PREVIEW_MEDIA

      response = get_request("/projects/columns/#{arguments.column_id}/cards", params)

      return response unless block_given?
      response.each { |el| yield el }
    end
1044440
public function memberCardSummaryById(string $from, string $to, string $cardId)
    {
        $ext = [
            'card_id' => $cardId,
        ];

        return $this->query('datacube/getcardmembercarddetail', $from, $to, $ext);
    }